Formalization: Honest Confidence Intervals for Homogeneous Causal Log Odds under Low Smoothness

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

CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Basic 56 declarations Concrete binary records, continuous conditional cells, the prescribed native-logit model, randomized interval procedures, and the expected-length objective.

Continuous observed laws and honest interval decisions

Concrete binary records, continuous conditional cells, the prescribed native-logit model, randomized interval procedures, and the expected-length objective. The Hölder seminorm is extended nonnegative, so a continuous non-Hölder function has infinite seminorm rather than the junk value of an unbounded real supremum.

def Covariate

[The covariate interval.

Definition (Lean source)
Covariate :
Set ℝ
Icc (0 : ℝ) 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.Covariate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:23
def Record

The concrete observed record space.

Definition (Lean source)
Record :
Type
CausalSmith.Stat.LogoddsLowsmoothFrontier.Record · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:25
def covariate

First coordinate.

Definition (Lean source)
o :
covariate o :
o.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.covariate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:27
def treatment

Binary treatment as a real.

Definition (Lean source)
o :
treatment o :
ℝ
if o.2.1 then 1 else 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.treatment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:29
def outcome

Binary outcome as a real.

Definition (Lean source)
o :
outcome o :
ℝ
if o.2.2 then 1 else 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.outcome · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:31
def uniformLaw

Public uniform design, as Lebesgue measure pulled back to the unit interval.

Definition (Lean source)
uniformLaw :
Measure.comap val volume
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:33

Logistic map.

Definition (Lean source)
t :
ℝ
logistic t :
ℝ
CausalSmith.Stat.LogoddsLowsmoothFrontier.logistic · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:35

Log odds, used only at interior probabilities.

Definition (Lean source)
t :
ℝ
logit t :
ℝ
log (t / (1 - t))
CausalSmith.Stat.LogoddsLowsmoothFrontier.logit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:37
def jointLaw

Reconstruct the joint law from its covariate law and conditional cell functions.

Definition (Lean source)
p :
Bool → Bool → Covariate → ℝ
jointLaw Q p :
∑ a : Bool, ∑ y : Bool, Measure.map (fun x : Covariate => (x, a, y)) (Q.withDensity (fun x => ofReal (p a y x)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.jointLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:39

An ambient probability law includes its unique continuous interior conditional cells.

Definition (Lean source)
measure :
probability :
cells :
Bool → Bool → Covariate → ℝ
continuous_cells :
∀ a y, Continuous (cells a y)
interior_cells :
∀ a y x, 0 < cells a y x ∧ cells a y x < 1
normalized_cells :
∀ x, ∑ a : Bool, ∑ y : Bool, cells a y x = 1
disintegration :
measure = jointLaw (Measure.map covariate measure) cells
full_support :
∀ G : Set Covariate
if
and
G.Nonempty
then
0 < (Measure.map covariate measure) G
CausalSmith.Stat.LogoddsLowsmoothFrontier.ObservedLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:44

Public exponent domain.

Definition (Lean source)
α β :
ℝ
ExponentDomain α β :
Prop
clause 1
0 < β
clause 2
β < 1 / 4
clause 3
β < α
clause 4
α ≤ 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.ExponentDomain · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:59
def propensity

The propensity, pinned to the law.

Definition (Lean source)
propensity P x :
ℝ
P.cells true false x + P.cells true true x
CausalSmith.Stat.LogoddsLowsmoothFrontier.propensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:62
def armRisk

Arm risks, pinned to the conditional table.

Definition (Lean source)
a :
x :
armRisk P a x :
ℝ
P.cells a true x / (P.cells a false x + P.cells a true x)
CausalSmith.Stat.LogoddsLowsmoothFrontier.armRisk · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:65
def propensityLogit

Native propensity logit.

Definition (Lean source)
propensityLogit P x :
ℝ
logit (propensity P x)
CausalSmith.Stat.LogoddsLowsmoothFrontier.propensityLogit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:68

Native prognosis logit.

Definition (Lean source)
prognosisLogit P x :
ℝ
CausalSmith.Stat.LogoddsLowsmoothFrontier.prognosisLogit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:71
def effect

Effect is defined literally at covariate zero.

Definition (Lean source)
effect P :
ℝ
logit (armRisk P true ⟨0, le_rfl, zero_le_one⟩)
- prognosisLogit P ⟨0, le_rfl, zero_le_one⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:74
def cellProbability

Conditional cells expressed through propensity and arm risks.

Definition (Lean source)
a y :
x :
cellProbability P a y x :
ℝ
(if a then propensity P x else 1 - propensity P x) * (if y then armRisk P a x else 1 - armRisk P a x)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellProbability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:78
def marginalMean

Conditional outcome mean.

Definition (Lean source)
marginalMean P x :
ℝ
(1 - propensity P x) * armRisk P false x + propensity P x * armRisk P true x
CausalSmith.Stat.LogoddsLowsmoothFrontier.marginalMean · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:82
def covarianceCoordinate

Expected conditional covariance under uniform design.

Definition (Lean source)
covarianceCoordinate P :
ℝ
(∫ o, treatment o * outcome o ∂P.measure)
- ∫ x, propensity P x * marginalMean P x ∂uniformLaw
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceCoordinate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:85
def denominatorCoordinate

Integrated off-diagonal product.

Definition (Lean source)
denominatorCoordinate P :
ℝ
∫ x, cellProbability P true false x * cellProbability P false true x ∂uniformLaw
CausalSmith.Stat.LogoddsLowsmoothFrontier.denominatorCoordinate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:89
def denominatorFloor

Public denominator floor.

Definition (Lean source)
denominatorFloor :
ℝ
1 / 512
CausalSmith.Stat.LogoddsLowsmoothFrontier.denominatorFloor · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:92

The generic Hölder exponent has precisely the paper's domain.

Definition (Lean source)
γ :
ℝ
HolderExponentDomain γ :
Prop
clause 1
0 < γ
clause 2
γ ≤ 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.HolderExponentDomain · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:94

The generic real function on the covariate interval is continuous.

Definition (Lean source)
f :
Covariate → ℝ
ContinuousFunctionDomain f :
Prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.ContinuousFunctionDomain · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:97
def holderSeminorm

Extended Hölder seminorm, including infinite values. Its paper domain is HolderExponentDomain γ together with ContinuousFunctionDomain f.

Definition (Lean source)
γ :
ℝ
f :
Covariate → ℝ
holderSeminorm γ f :
ℝ≥0∞
⨆ x : Covariate, ⨆ z : Covariate, ⨆ (_ : x ≠ z), ofReal (|f x - f z| / |(x : ℝ) - (z : ℝ)| ^ γ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.holderSeminorm · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:100
def UniformDesign

Known uniform covariate design.

Definition (Lean source)
UniformDesign P :
Prop
Measure.map covariate P.measure = uniformLaw
CausalSmith.Stat.LogoddsLowsmoothFrontier.UniformDesign · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:107
def HomogeneousLogit

A single homogeneous conditional log-odds coefficient.

Definition (Lean source)
x :
HomogeneousLogit P :
Prop
armRisk P true x = logistic (prognosisLogit P x + effect P)
CausalSmith.Stat.LogoddsLowsmoothFrontier.HomogeneousLogit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:110
def EffectEnvelope

Compact scalar effect envelope.

Definition (Lean source)
EffectEnvelope P :
Prop
|effect P| ≤ 1 / 2
CausalSmith.Stat.LogoddsLowsmoothFrontier.EffectEnvelope · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:114
def PropensityEnvelope

Propensity native-logit envelope.

Definition (Lean source)
x :
PropensityEnvelope P :
Prop
|propensityLogit P x| ≤ 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.PropensityEnvelope · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:117
def PrognosisEnvelope

Prognosis native-logit envelope.

Definition (Lean source)
x :
PrognosisEnvelope P :
Prop
|prognosisLogit P x| ≤ 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.PrognosisEnvelope · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:120
def PropensityHolder

Propensity native-logit Hölder radius.

Definition (Lean source)
α :
ℝ
PropensityHolder α P :
Prop
holderSeminorm α (propensityLogit P) ≤ 2
CausalSmith.Stat.LogoddsLowsmoothFrontier.PropensityHolder · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:123
def PrognosisHolder

Prognosis native-logit Hölder radius.

Definition (Lean source)
β :
ℝ
PrognosisHolder β P :
Prop
holderSeminorm β (prognosisLogit P) ≤ 2
CausalSmith.Stat.LogoddsLowsmoothFrontier.PrognosisHolder · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:126
def RadiusDomain

The public evaluation-radius parameter has exactly the frozen range.

Definition (Lean source)
r :
ℝ
RadiusDomain r :
Prop
r ∈ Icc (0 : ℝ) (1/2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.RadiusDomain · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:128
def EvaluationRadius

Radius restriction used only for length evaluation.

Definition (Lean source)
r :
ℝ
EvaluationRadius r P :
Prop
|effect P| ≤ r
CausalSmith.Stat.LogoddsLowsmoothFrontier.EvaluationRadius · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:132
structure LogisticClass

The unrestricted homogeneous logistic class.

Definition (Lean source)
homogeneous :

@realizes \mathcal L(logistic class)

CausalSmith.Stat.LogoddsLowsmoothFrontier.LogisticClass · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:135
structure Model

Exactly the seven prescribed law properties.

Definition (Lean source)
α β :
ℝ
uniform :

@realizes \mathcal M(model class)

homogeneous :
effect_envelope :
propensity_envelope :
prognosis_envelope :
propensity_holder :
prognosis_holder :
CausalSmith.Stat.LogoddsLowsmoothFrontier.Model · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:139
structure RadiusModel

The radius slice inherits the whole model and adds only the effect bound.

Definition (Lean source)
α β r :
ℝ
@realizes \mathcal M_r(radius model)
radius :
CausalSmith.Stat.LogoddsLowsmoothFrontier.RadiusModel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:149

An interval encoded by endpoints and their inclusion flags.

Definition (Lean source)
d :
ℝ × ℝ × Bool × Bool
IntervalDataValid d :
Prop
clause 1
-(1 / 2 : ℝ) ≤ d.1
clause 2
d.2.1 ≤ 1 / 2
clause 3
d.1 < d.2.1 ∨ (d.1 = d.2.1 ∧ d.2.2.1 = true ∧ d.2.2.2 = true)
CausalSmith.Stat.LogoddsLowsmoothFrontier.IntervalDataValid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:153
def EffectInterval

All nonempty connected Borel intervals in the effect region.

Definition (Lean source)
EffectInterval :
Type
{d : ℝ × ℝ × Bool × Bool // IntervalDataValid d}
CausalSmith.Stat.LogoddsLowsmoothFrontier.EffectInterval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:157

Interval membership, respecting endpoint inclusion.

Definition (Lean source)
intervalSet B :
Set ℝ
{t | (B.val.1 < t ∨ (B.val.2.2.1 = true ∧ B.val.1 = t)) ∧ (t < B.val.2.1 ∨ (B.val.2.2.2 = true ∧ t = B.val.2.1))}
CausalSmith.Stat.LogoddsLowsmoothFrontier.intervalSet · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:159
def intervalLength

Interval length is supremum minus infimum.

Definition (Lean source)
intervalLength B :
ℝ
B.val.2.1 - B.val.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.intervalLength · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:163
def Experiment

Exactly n original observations and an independent uniform seed.

Definition (Lean source)
n :
ℕ
Experiment n :
Type
(Fin n → Record) × Covariate
CausalSmith.Stat.LogoddsLowsmoothFrontier.Experiment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:165
def experimentLaw

Reuse the substrate's finite iid law and tensor the seed.

Definition (Lean source)
n :
ℕ
experimentLaw P n :
Measure (Experiment n)
(iidLaw P.measure n).prod uniformLaw
CausalSmith.Stat.LogoddsLowsmoothFrontier.experimentLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:169

Borel interval procedures, including randomized procedures.

Definition (Lean source)
n :
ℕ
output :
Experiment n → EffectInterval
borel :
Measurable output
coverage_measurable :
∀ t : ℝ, MeasurableSet {ω | t ∈ intervalSet (output ω)}
length_measurable :
Measurable (fun ω => intervalLength (output ω))
CausalSmith.Stat.LogoddsLowsmoothFrontier.Procedure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:172
def GlobalCoverage

Global finite-sample ninety-percent coverage.

Definition (Lean source)
n :
ℕ
α β :
ℝ
I :
Procedure n
P :
Model α β P
GlobalCoverage n α β I :
Prop
(9 / 10 : ℝ≥0∞) ≤ experimentLaw P n {ω | effect P ∈ intervalSet (I.output ω)}
CausalSmith.Stat.LogoddsLowsmoothFrontier.GlobalCoverage · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:179
structure HonestProcedure

Honest procedures are bundled through their sole member property.

Definition (Lean source)
n :
ℕ
α β :
ℝ
I :
Procedure n
coverage :
GlobalCoverage n α β I

@realizes \mathcal A(globally honest procedures)

CausalSmith.Stat.LogoddsLowsmoothFrontier.HonestProcedure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:184

Expected length, with the seed included.

Definition (Lean source)
n :
ℕ
I :
Procedure n
expectedLength P n I :
ℝ
∫ ω, intervalLength (I.output ω) ∂experimentLaw P n
CausalSmith.Stat.LogoddsLowsmoothFrontier.expectedLength · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:187

Worst-case expected length on the prescribed radius slice.

Definition (Lean source)
n :
ℕ
α β r :
ℝ
I :
Procedure n
worstLength n α β r I :
ℝ
sSup {l | ∃ P, RadiusModel α β r P ∧ l = expectedLength P n I}
CausalSmith.Stat.LogoddsLowsmoothFrontier.worstLength · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:190

Infimum of worst-case length over globally honest procedures.

Definition (Lean source)
n :
ℕ
α β r :
ℝ
lengthObjective n α β r :
ℝ
sInf {l | ∃ I : Procedure n, HonestProcedure n α β I ∧ l = worstLength n α β r I}
CausalSmith.Stat.LogoddsLowsmoothFrontier.lengthObjective · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:194
def exponentA

Numerator rate exponent.

Definition (Lean source)
α β :
ℝ
exponentA α β :
ℝ
min (1 / 2) (2 * (α + β) / (2 * α + 2 * β + 1))
CausalSmith.Stat.LogoddsLowsmoothFrontier.exponentA · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:197
def exponentB

Effect-scaled denominator rate exponent.

Definition (Lean source)
β :
ℝ
exponentB β :
ℝ
4 * β / (4 * β + 1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.exponentB · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:199
def diagnosticEnvelope Definition 9 in the paper ↗

Explicit diagnostic profile.

Definition (Lean source)
n :
ℕ
α β r :
ℝ
diagnosticEnvelope n α β r :
ℝ
(n : ℝ) ^ (-exponentA α β) + r * (n : ℝ) ^ (-exponentB β)
CausalSmith.Stat.LogoddsLowsmoothFrontier.diagnosticEnvelope · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:202

Every encoded interval has nonnegative length. the stated conclusion holds.

Formal statement
0 ≤ intervalLength B
Proof (Lean source)
-- @node: intervalLength_nonneg lemma intervalLength_nonneg (B : EffectInterval) : 0 ≤ intervalLength B := by rcases B.property.2.2 with h | ⟨h, _, _⟩ · exact sub_nonneg.mpr h.le · exact sub_nonneg.mpr h.le
CausalSmith.Stat.LogoddsLowsmoothFrontier.intervalLength_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:206
theorem expectedLength_nonneg

Expected interval length is nonnegative under any observed law. the stated conclusion holds.

Formal statement
n :
ℕ
I :
Procedure n
0 ≤ expectedLength P n I
Proof (Lean source)
-- @node: expectedLength_nonneg lemma expectedLength_nonneg (P : ObservedLaw) (n : ℕ) (I : Procedure n) : 0 ≤ expectedLength P n I := by exact integral_nonneg (fun ω => intervalLength_nonneg (I.output ω))
CausalSmith.Stat.LogoddsLowsmoothFrontier.expectedLength_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:213
theorem worstLength_nonneg

The worst-case length is nonnegative, including an empty radius slice. the stated conclusion holds.

Formal statement
n :
ℕ
α β r :
ℝ
I :
Procedure n
0 ≤ worstLength n α β r I
Proof (Lean source)
-- @node: worstLength_nonneg lemma worstLength_nonneg (n : ℕ) (α β r : ℝ) (I : Procedure n) : 0 ≤ worstLength n α β r I := by apply Real.sSup_nonneg rintro l ⟨P, _, rfl⟩ exact expectedLength_nonneg P n I
CausalSmith.Stat.LogoddsLowsmoothFrontier.worstLength_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:219
theorem lengthObjective_le

Any honest procedure upper bounds the minimax objective. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
α β r :
ℝ
I :
Procedure n
hI :
HonestProcedure n α β I
lengthObjective n α β r ≤ worstLength n α β r I
Proof (Lean source)
-- @node: lengthObjective_le lemma lengthObjective_le (n : ℕ) (α β r : ℝ) (I : Procedure n) (hI : HonestProcedure n α β I) : lengthObjective n α β r ≤ worstLength n α β r I := by apply csInf_le · refine ⟨0, ?_⟩ rintro l ⟨J, _, rfl⟩ exact worstLength_nonneg n α β r J · exact ⟨I, hI, rfl⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.lengthObjective_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:227
theorem le_lengthObjective

An all-procedure lower bound transfers to the minimax objective. Under the stated assumptions.

Formal statement
n :
ℕ
α β r b :
ℝ
h :
∀ I : Procedure n
if
HonestProcedure n α β I
then
b ≤ worstLength n α β r I
b ≤ lengthObjective n α β r
Proof (Lean source)
-- @node: le_lengthObjective lemma le_lengthObjective (n : ℕ) (α β r b : ℝ) (h : ∀ I : Procedure n, HonestProcedure n α β I → b ≤ worstLength n α β r I) : b ≤ lengthObjective n α β r := by classical have : IsProbabilityMeasure uniformLaw := by constructor rw [uniformLaw, comap_subtype_coe_apply measurableSet_Icc] rw [Set.image_univ, Subtype.range_coe, Real.volume_Icc] norm_num let B : EffectInterval := ⟨(-(1/2 : ℝ), (1/2 : ℝ), true, true), by norm_num [IntervalDataValid]⟩ let I : Procedure n := { output := fun _ => B borel := by fun_prop coverage_measurable := fun t => by by_cases ht : t ∈ intervalSet B <;> simp [ht] length_measurable := by fun_prop } have hI : HonestProcedure n α β I := by constructor intro P hP have : IsProbabilityMeasure (experimentLaw P n) := by unfold experimentLaw Causalean.Stat.UStatistic.LocalizedVariance.iidLaw infer_instance have ht : effect P ∈ intervalSet B := by have he := abs_le.mp hP.effect_envelope change (-(1/2 : ℝ) < effect P ∨ (true = true ∧ -(1/2 : ℝ) = effect P)) ∧ (effect P < (1/2 : ℝ) ∨ (true = true ∧ effect P = (1/2 : ℝ))) constructor · rcases he.1.eq_or_lt with hEq | hLt · exact inr ⟨rfl, hEq⟩ · exact inl hLt · rcases he.2.lt_or_eq with hLt | hEq · exact inl hLt · exact inr ⟨rfl, hEq⟩ change (9/10 : ℝ≥0∞) ≤ experimentLaw P n {ω : Experiment n | effect P ∈ intervalSet B} simp only [ht, Set.ofPred_true, measure_univ] exact ENNReal.div_le_of_le_mul (by norm_num) apply le_csInf · exact ⟨worstLength n α β r I, I, hI, rfl⟩ · rintro l ⟨J, hJ, rfl⟩ exact h J hJ
CausalSmith.Stat.LogoddsLowsmoothFrontier.le_lengthObjective · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Basic.lean:236
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Defs.Calibration 52 declarations Local root selectors are totalized outside their brackets.

Scalar calibrations, continuous sign priors, and full-data extensions

Local root selectors are totalized outside their brackets. Probability laws are constructed from the displayed cells, with a fixed harmless default outside the positive-cell neighbourhood; neighbourhood validity is a theorem obligation.

[Uniform design is a probability measure. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: uniformLaw_probability lemma uniformLaw_probability : IsProbabilityMeasure uniformLaw := by constructor rw [uniformLaw, comap_subtype_coe_apply measurableSet_Icc] rw [Set.image_univ, Subtype.range_coe, Real.volume_Icc] norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformLaw_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:22
instance instIsProbabilityMeasureElemRealCovariateUniformLaw

The anonymous instance result states the corresponding mathematical identity, bound, or structural property.

Definition (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.instIsProbabilityMeasureElemRealCovariateUniformLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:29
def ValidCells

Continuous, normalized, strictly interior conditional cells.

Definition (Lean source)
p :
Bool → Bool → Covariate → ℝ
ValidCells p :
Prop
clause 1
a y :
Continuous (p a y)
clause 2
a y x :
0 < p a y x
p a y x < 1
clause 3
x :
∑ a : Bool, ∑ y : Bool, p a y x = 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.ValidCells · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:31

Marginal of the explicitly constructed cell law. Under the stated assumptions. The stated conclusion follows.

Formal statement
p :
Bool → Bool → Covariate → ℝ
h :
Measure.map covariate (jointLaw uniformLaw p) = uniformLaw
Proof (Lean source)
-- @node: jointLaw_uniform lemma jointLaw_uniform (p : Bool → Bool → Covariate → ℝ) (h : ValidCells p) : Measure.map covariate (jointLaw uniformLaw p) = uniformLaw := by have hm (a y : Bool) : Measurable (fun x => ofReal (p a y x)) := ENNReal.measurable_ofReal.comp (h.1 a y).measurable have hc : Measurable covariate := by unfold covariate; fun_prop simp only [jointLaw, Fintype.sum_bool, Measure.map_add _ _ hc, Measure.map_map hc (by fun_prop : Measurable (fun x : Covariate => (x, false, false))), Measure.map_map hc (by fun_prop : Measurable (fun x : Covariate => (x, false, true))), Measure.map_map hc (by fun_prop : Measurable (fun x : Covariate => (x, true, false))), Measure.map_map hc (by fun_prop : Measurable (fun x : Covariate => (x, true, true))), covariate, Function.comp_def, Measure.map_id'] rw [← withDensity_add_left (hm true true), ← withDensity_add_left (hm false true), ← withDensity_add_left ((hm true true).add (hm true false))] convert withDensity_one (μ := uniformLaw) using 1 congr 1 funext x have hn := h.2.2 x simp only [Fintype.sum_bool] at hn simp only [Pi.add_apply, Pi.one_apply] rw [← ENNReal.ofReal_add (h.2.1 true true x).1.le (h.2.1 true false x).1.le, ← ENNReal.ofReal_add (h.2.1 false true x).1.le (h.2.1 false false x).1.le, ← ENNReal.ofReal_add (add_nonneg (h.2.1 true true x).1.le (h.2.1 true false x).1.le) (add_nonneg (h.2.1 false true x).1.le (h.2.1 false false x).1.le), hn, ENNReal.ofReal_one]
CausalSmith.Stat.LogoddsLowsmoothFrontier.jointLaw_uniform · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:35

The law of valid cells is a probability law. Under the stated assumptions.

Formal statement
p :
Bool → Bool → Covariate → ℝ
h :
Proof (Lean source)
-- @node: jointLaw_probability lemma jointLaw_probability (p : Bool → Bool → Covariate → ℝ) (h : ValidCells p) : IsProbabilityMeasure (jointLaw uniformLaw p) := by constructor have hm := congrArg (fun μ : Measure Covariate => μ univ) (jointLaw_uniform p h) rw [Measure.map_apply (by unfold covariate; fun_prop) MeasurableSet.univ] at hm simpa using hm
CausalSmith.Stat.LogoddsLowsmoothFrontier.jointLaw_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:63
theorem jointLaw_disintegration Lemma jointLaw_disintegration in the paper ↗

The explicitly constructed law has the required disintegration identity. Under the stated assumptions.

Formal statement
p :
Bool → Bool → Covariate → ℝ
h :
jointLaw uniformLaw p = jointLaw (Measure.map covariate (jointLaw uniformLaw p)) p
Proof (Lean source)
-- @node: jointLaw_disintegration lemma jointLaw_disintegration (p : Bool → Bool → Covariate → ℝ) (h : ValidCells p) : jointLaw uniformLaw p = jointLaw (Measure.map covariate (jointLaw uniformLaw p)) p := by rw [jointLaw_uniform p h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.jointLaw_disintegration · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:71

Uniform laws have full support. Under the stated assumptions.

Formal statement
p :
Bool → Bool → Covariate → ℝ
h :
G.Nonempty
0 < (Measure.map covariate (jointLaw uniformLaw p)) G
Proof (Lean source)
-- @node: jointLaw_full_support lemma jointLaw_full_support (p : Bool → Bool → Covariate → ℝ) (h : ValidCells p) : ∀ G : Set Covariate, IsOpen G → G.Nonempty → 0 < (Measure.map covariate (jointLaw uniformLaw p)) G := by intro G hG hNonempty rw [jointLaw_uniform p h, uniformLaw, comap_subtype_coe_apply measurableSet_Icc] obtain ⟨U, hU, hUG⟩ := isOpen_induced_iff.mp hG obtain ⟨x, hx⟩ := hNonempty have hxU : (x : ℝ) ∈ U := by change x ∈ val ⁻¹' U rw [hUG] exact hx have hxClosure : (x : ℝ) ∈ closure (Ioo (0 : ℝ) 1) := by rw [closure_Ioo (by norm_num : (0 : ℝ) ≠ 1)] exact x.property have hIntersection : (U ∩ Ioo (0 : ℝ) 1).Nonempty := mem_closure_iff.mp hxClosure U hU hxU have hPositive : 0 < volume (U ∩ Ioo (0 : ℝ) 1) := (hU.inter isOpen_Ioo).measure_pos volume hIntersection apply lt_of_lt_of_le hPositive apply measure_mono intro z hz refine ⟨⟨z, hz.2.1.le, hz.2.2.le⟩, ?_, rfl⟩ rw [← hUG] exact hz.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.jointLaw_full_support · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:76
def lawFromCells

[Pack the concrete cell construction into the ambient carrier.

Definition (Lean source)
p :
Bool → Bool → Covariate → ℝ
h :
lawFromCells p h :
clause 1
measure := jointLaw uniformLaw p
clause 2
probability := jointLaw_probability p h
clause 3
cells := p
clause 4
continuous_cells := h.1
clause 5
interior_cells := h.2.1
clause 6
normalized_cells := h.2.2
clause 7
disintegration := jointLaw_disintegration p h
clause 8
full_support := jointLaw_full_support p h
CausalSmith.Stat.LogoddsLowsmoothFrontier.lawFromCells · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:103

A fixed interior table for totalization outside the calibration neighbourhood. the stated conclusion holds.

Formal statement
ValidCells (fun _ _ _ => (1/4 : ℝ))
Proof (Lean source)
-- @node: fairDefault_valid lemma fairDefault_valid : ValidCells (fun _ _ _ => (1/4 : ℝ)) := by refine ⟨?_, ?_, ?_⟩ · intro a y fun_prop · intro a y x norm_num · intro x norm_num [Fintype.sum_bool]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairDefault_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:113
def totalCellLaw

Total cell-law constructor; on valid cells it is literally the given cell law.

Definition (Lean source)
p :
Bool → Bool → Covariate → ℝ
totalCellLaw p :
if h : ValidCells p then lawFromCells p h else lawFromCells (fun _ _ _ => 1/4) fairDefault_valid
CausalSmith.Stat.LogoddsLowsmoothFrontier.totalCellLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:123
def dividedExp

Smooth exponential divided difference through zero.

Definition (Lean source)
t :
ℝ
dividedExp t :
ℝ
∫ s in (0 : ℝ)..1, exp (s*t)
CausalSmith.Stat.LogoddsLowsmoothFrontier.dividedExp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:129
def covarianceBranch

Binary-table covariance branch with the prescribed positive square root.

Definition (Lean source)
t ξ υ :
ℝ
covarianceBranch t ξ υ :
ℝ
d :
exp t - 1
v :
ξ*(1-ξ)*υ*(1-υ)
L :
1+d*(ξ*(1-υ)+(1-ξ)*υ)
2*d*v/(L+sqrt (L^2-4*d^2*v))
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:131
def normalizedBranch

Smooth normalized covariance branch.

Definition (Lean source)
t ξ υ :
ℝ
normalizedBranch t ξ υ :
ℝ
d :
exp t - 1
v :
ξ*(1-ξ)*υ*(1-υ)
L :
1+d*(ξ*(1-υ)+(1-ξ)*υ)
2*dividedExp t*v/(L+sqrt (L^2-4*d^2*v))
CausalSmith.Stat.LogoddsLowsmoothFrontier.normalizedBranch · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:137
def signValue

A sign as a real number.

Definition (Lean source)
b :
signValue b :
ℝ
if b then 1 else -1
def localSignField

Two auxiliary signs at a within-cell coordinate.

Definition (Lean source)
u :
ℝ
s :
localSignField u s :
ℝ
signValue s.1 * cos (pi*u/2) + signValue s.2 * sin (pi*u/2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.localSignField · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:145
def signAverage

Expectation over the two auxiliary independent fair signs.

Definition (Lean source)
F :
(Bool × Bool) → ℝ
signAverage F :
ℝ
(1/4)*∑ s, F s
CausalSmith.Stat.LogoddsLowsmoothFrontier.signAverage · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:148
def mixedEquation

Normalized mixed-prior root equation.

Definition (Lean source)
η ζ u q :
ℝ
mixedEquation η ζ u q :
ℝ
16*signAverage (fun s => normalizedBranch (32*η*ζ) (1/2-η*q*localSignField u s) (1/2+ζ*localSignField u s))-q
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:150
def mixedRoot

Choose the local mixed root in its prescribed bracket, otherwise use one.

Definition (Lean source)
η ζ u :
ℝ
mixedRoot η ζ u :
ℝ
if h : ∃ q : ℝ, q ∈ Ioo (3/4) (5/4) ∧ mixedEquation η ζ u q
= 0 then choose h else 1
def riskShift

Logistic risk shift.

Definition (Lean source)
t ξ :
ℝ
riskShift t ξ :
ℝ
exp t*ξ/(1+(exp t-1)*ξ)
def comparatorEffect

Fair comparator effect.

Definition (Lean source)
t δ :
ℝ
comparatorEffect t δ :
ℝ
p :
2/5 (: ℝ)
B :
1+(exp t-1)*p
t+log (1-(exp t-1)*δ^2/(p*B))- log (1+(exp t-1)*δ^2/((1-p)*B))
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:160
def fairNumerator

Numerator of the normalized fair equation.

Definition (Lean source)
t δ ξ u :
ℝ
fairNumerator t δ ξ u :
ℝ
signAverage (fun s => riskShift t (ξ+δ*localSignField u s))-riskShift (comparatorEffect t δ) ξ
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:166
def fairEquation

Double-integral Taylor form is the removable extension, including both zero axes.

Definition (Lean source)
t δ ξ u :
ℝ
fairEquation t δ ξ u :
ℝ
∫ s in (0 : ℝ)..1, ∫ v in (0 : ℝ)..1, (1-v)*deriv (fun T => deriv (fun D => deriv (fun D' => fairNumerator T D' ξ u) D) (v*δ)) (s*t)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:169
def fairRoot

Choose the local fair centering root; outside its neighbourhood use 2/5.

Definition (Lean source)
t δ u :
ℝ
fairRoot t δ u :
ℝ
if h : ∃ p : ℝ, p ∈ Ioo (3/10) (1/2) ∧ fairEquation t δ p u
= 0 then choose h else 2/5
def calibrationMaps

All seven calibration maps, with their literal defining formulas.

Definition (Lean source)
t ξ υ η ζ δ u :
ℝ
calibrationMaps t ξ υ η ζ δ u :
ℝ × ℝ × ℝ × ℝ × ℝ × ℝ × ℝ
(covarianceBranch t ξ υ, normalizedBranch t ξ υ, mixedRoot η ζ u, riskShift t ξ, comparatorEffect t δ, fairEquation t δ ξ u, fairRoot t δ u)
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrationMaps · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:179
def cellIndex

Cell number, taking the left cell at the rightmost endpoint.

Definition (Lean source)
k :
ℕ
x :
cellIndex k x :
ℕ
min (k-1) (⌊(k : ℝ)*(x : ℝ)⌋ : ℤ).toNat
def cellCoord

Within-cell coordinate.

Definition (Lean source)
k :
ℕ
x :
cellCoord k x :
ℝ
(k : ℝ)*(x : ℝ)-cellIndex k x
def endpointSign

Endpoint signs are extended by zero-index fallback only for k=0.

Definition (Lean source)
k :
ℕ
σ :
Fin (k + 1) → Bool
j :
ℕ
endpointSign k σ j :
ℝ
signValue (σ ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointSign · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:187
def signFieldZ

Continuous shared-endpoint sign field.

Definition (Lean source)
k :
ℕ
σ :
Fin (k + 1) → Bool
x :
signFieldZ k σ x :
ℝ
j :
u :
endpointSign k σ j*cos (pi*u/2)+endpointSign k σ (j+1)*sin (pi*u/2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.signFieldZ · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:190
def tableCell

A four-cell table from margins and covariance.

Definition (Lean source)
e m c :
ℝ
a y :
tableCell e m c a y :
ℝ
if a then (if y then e*m+c else e*(1-m)-c) else (if y then (1-e)*m-c else (1-e)*(1-m)+c)
def mixedCells

Mixed-prior conditional cell formula.

Definition (Lean source)
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
η ζ :
ℝ
a y :
x :
mixedCells b k σ η ζ a y x :
ℝ
Z :
signFieldZ k σ x
u :
q :
mixedRoot η ζ u
e :
if b then 1/2-η*q*Z else 1/2+η*q*Z
m :
1/2+ζ*Z
c :
if b then covarianceBranch (32*η*ζ) e m else 0
tableCell e m c a y
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:200
def fairCells

Fair random and deterministic-comparator cells.

Definition (Lean source)
random :
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
a y :
x :
fairCells random k σ t δ a y x :
ℝ
p :
fairRoot t δ (cellCoord k x)
μ0 :
if random then p+δ*signFieldZ k σ x else p
μ1 :
riskShift (if random then t else comparatorEffect t δ) μ0
(1/2)*(if y then (if a then μ1 else μ0) else 1-(if a then μ1 else μ0))
def mixedLaw

Construct the ambient mixed law from its explicit conditional cells.

Definition (Lean source)
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
η ζ :
ℝ
mixedLaw b k σ η ζ :
totalCellLaw (mixedCells b k σ η ζ)
def fairLaw

Construct a fair random law from its explicit cells.

Definition (Lean source)
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
fairLaw k σ t δ :
def fairComparator

Deterministic comparator, whose cells do not depend on the supplied sign vector.

Definition (Lean source)
k :
ℕ
t δ :
ℝ
fairComparator k t δ :
totalCellLaw (fairCells false k (fun _ => false) t δ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComparator · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:221
def finiteSignMixture

Uniform finite mixture with signs drawn once for the whole iid sample.

Definition (Lean source)
n k :
ℕ
laws :
(Fin (k + 1) → Bool) → ObservedLaw
finiteSignMixture n k laws :
(ofReal ((2 : ℝ)^(-(k+1 : ℕ) : ℤ))) • ∑ σ : Fin (k + 1) → Bool, iidLaw (laws σ).measure n
CausalSmith.Stat.LogoddsLowsmoothFrontier.finiteSignMixture · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:224
def mixedMixture

Mixed original-record mixture.

Definition (Lean source)
b :
n k :
ℕ
η ζ :
ℝ
mixedMixture b n k η ζ :
finiteSignMixture n k (fun σ => mixedLaw b k σ η ζ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedMixture · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:228
def fairMixture

Fair original-record mixture.

Definition (Lean source)
n k :
ℕ
t δ :
ℝ
fairMixture n k t δ :
finiteSignMixture n k (fun σ => fairLaw k σ t δ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairMixture · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:231
def calibratedPriors

Both mixed and fair prior experiments contain exactly n original records.

Definition (Lean source)
n k :
ℕ
η ζ t δ :
ℝ
calibratedPriors n k η ζ t δ :
Measure (Fin n → Record) × Measure (Fin n → Record) × Measure (Fin n → Record)
(mixedMixture false n k η ζ, mixedMixture true n k η ζ, fairMixture n k t δ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibratedPriors · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:235
def FullRecord

Full data contain two binary potential outcomes and a treatment.

Definition (Lean source)
FullRecord :
Type
(Covariate × (Bool × Bool)) × Bool
CausalSmith.Stat.LogoddsLowsmoothFrontier.FullRecord · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:240
def potentialControl

Potential control outcome.

Definition (Lean source)
potentialControl o :
ℝ
if o.1.2.1 then 1 else 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.potentialControl · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:242
def potentialTreated

Potential treated outcome.

Definition (Lean source)
potentialTreated o :
ℝ
if o.1.2.2 then 1 else 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.potentialTreated · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:244
def observedMap

Observation by literal consistency.

Definition (Lean source)
observedMap o :
(o.1.1, o.2, if o.2 then o.1.2.2 else o.1.2.1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.observedMap · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:246
def bernoulliLaw

Binary law at a success probability.

Definition (Lean source)
p :
ℝ
bernoulliLaw p :
ofReal (1-p) • Measure.dirac false + ofReal p • Measure.dirac true
CausalSmith.Stat.LogoddsLowsmoothFrontier.bernoulliLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:248
def AdmissibleCoupling

A coupling is admissible exactly when both conditional margins are the law's arm risks.

Definition (Lean source)
AdmissibleCoupling P Γ :
Prop
clause 1
clause 2
x :
Measure.map fst (Γ x) = bernoulliLaw (armRisk P false x)
Measure.map snd (Γ x) = bernoulliLaw (armRisk P true x)
CausalSmith.Stat.LogoddsLowsmoothFrontier.AdmissibleCoupling · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:251
theorem propensity_interior

The treatment probability is strictly interior by cell normalization. Under the stated assumptions. The stated conclusion follows.

Formal statement
conclusion 1
0 < propensity P x
conclusion 2
propensity P x < 1
Proof (Lean source)
-- @node: propensity_interior lemma propensity_interior (P : ObservedLaw) (x : Covariate) : 0 < propensity P x ∧ propensity P x < 1 := by have h := P.normalized_cells x simp only [Fintype.sum_bool] at h have h00 := (P.interior_cells false false x).1 have h01 := (P.interior_cells false true x).1 have h10 := (P.interior_cells true false x).1 have h11 := (P.interior_cells true true x).1 unfold propensity constructor <;> linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.propensity_interior · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:257
theorem bernoulliLaw_probability Lemma bernoulliLaw_probability in the paper ↗

An interior Bernoulli parameter defines a probability measure. Under the stated assumptions.

Formal statement
p :
ℝ
hp :
0 ≤ p
hp1 :
p ≤ 1
IsProbabilityMeasure (bernoulliLaw p)
Proof (Lean source)
-- @node: bernoulliLaw_probability lemma bernoulliLaw_probability (p : ℝ) (hp : 0 ≤ p) (hp1 : p ≤ 1) : IsProbabilityMeasure (bernoulliLaw p) := by apply (isProbabilityMeasure_iff).2 simp only [bernoulliLaw, Measure.add_apply, Measure.smul_apply, Measure.dirac_apply_of_mem (Set.mem_univ _), smul_eq_mul, mul_one] rw [← ENNReal.ofReal_add (by linarith) hp] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.bernoulliLaw_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:270
theorem treatmentKernel_measurable

[Conditional treatment kernel is measurable. the documented result

Formal statement
Measurable (fun z : Covariate × (Bool × Bool) => bernoulliLaw (propensity P z.1))
Proof (Lean source)
-- @node: treatmentKernel_measurable @[fun_prop] lemma treatmentKernel_measurable (P : ObservedLaw) : Measurable (fun z : Covariate × (Bool × Bool) => bernoulliLaw (propensity P z.1)) := by unfold bernoulliLaw propensity apply add · apply Measurable.smul_measure exact ENNReal.measurable_ofReal.comp ((measurable_const.sub ((P.continuous_cells true false).measurable.add (P.continuous_cells true true).measurable)).comp measurable_fst) · apply Measurable.smul_measure exact ENNReal.measurable_ofReal.comp (((P.continuous_cells true false).measurable.add (P.continuous_cells true true).measurable).comp measurable_fst)
CausalSmith.Stat.LogoddsLowsmoothFrontier.treatmentKernel_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:280
def treatmentKernel

Treatment is drawn independently of the potential outcomes given X.

Definition (Lean source)
treatmentKernel P :
clause 1
toFun := fun z => bernoulliLaw (propensity P z.1)
clause 2
CausalSmith.Stat.LogoddsLowsmoothFrontier.treatmentKernel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:295
def fullConditionalLaw

The conditional factorization defining exchangeability.

Definition (Lean source)
fullConditionalLaw P Γ x :
Measure ((Bool × Bool) × Bool)
(Γ x).prod (bernoulliLaw (propensity P x))
CausalSmith.Stat.LogoddsLowsmoothFrontier.fullConditionalLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:299
theorem fullConditionalLaw_eq_compProd

The conditional product is the fibre of the sequential kernel composition. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
fullConditionalLaw P Γ x = (Γ ⊗ₖ treatmentKernel P) x
Proof (Lean source)
-- @node: fullConditionalLaw_eq_compProd lemma fullConditionalLaw_eq_compProd (P : ObservedLaw) (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ) (x : Covariate) : fullConditionalLaw P Γ x = (Γ ⊗ₖ treatmentKernel P) x := by let : IsMarkovKernel Γ := hΓ.1 let : IsMarkovKernel (treatmentKernel P) := ⟨fun z => bernoulliLaw_probability _ (propensity_interior P z.1).1.le (propensity_interior P z.1).2.le⟩ ext s hs rw [Kernel.compProd_apply hs, fullConditionalLaw, Measure.prod_apply hs] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.fullConditionalLaw_eq_compProd · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:302
theorem fullConditionalLaw_measurable

[The full conditional laws of an admissible coupling form a measurable kernel. the documented result Under the stated assumptions.

Formal statement
Proof (Lean source)
@[fun_prop] -- @node: fullConditionalLaw_measurable lemma fullConditionalLaw_measurable (P : ObservedLaw) (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ) : Measurable (fullConditionalLaw P Γ) := by have heq : fullConditionalLaw P Γ = (Γ ⊗ₖ treatmentKernel P) := by funext x exact fullConditionalLaw_eq_compProd P Γ hΓ x rw [heq] exact Kernel.measurable _
CausalSmith.Stat.LogoddsLowsmoothFrontier.fullConditionalLaw_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:316
def causalExtension

X uniform, the supplied potential-outcome coupling, then independent Bernoulli treatment.

Definition (Lean source)
causalExtension P Γ :
(uniformLaw.compProd Γ).compProd (treatmentKernel P)
CausalSmith.Stat.LogoddsLowsmoothFrontier.causalExtension · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Calibration.lean:328
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Defs.CalibrationRegularity 9 declarations Fully substituted local cells and the closed parameter regions used for smoothness and bounds of all fixed derivative orders.

Calibration regularity specifications

Fully substituted local cells and the closed parameter regions used for smoothness and bounds of all fixed derivative orders.

def localMixedCell

Actual local four-cell formulas, with the root fully substituted.

Definition (Lean source)
b :
s :
a y :
v :
Fin 3 → ℝ
localMixedCell b s a y v :
ℝ
η :
v 0
ζ :
v 1
Z :
q :
mixedRoot η ζ (v 2)
e :
if b then 1/2-η*q*Z else 1/2+η*q*Z
m :
1/2+ζ*Z
tableCell e m (if b then covarianceBranch (32*η*ζ) e m else 0) a y
def localFairCell

Actual local fair-cell formulas, including spatial centering and comparator effect.

Definition (Lean source)
random :
s :
a y :
v :
Fin 3 → ℝ
localFairCell random s a y v :
ℝ
t :
v 0
δ :
v 1
p :
fairRoot t δ (v 2)
μ0 :
if random then p+δ*localSignField (v 2) s else p
μ1 :
riskShift (if random then t else comparatorEffect t δ) μ0
(1/2)*(if y then (if a then μ1 else μ0) else 1-(if a then μ1 else μ0))
def mixedParameterRegion

Closed mixed-amplitude neighbourhood, including the full spatial coordinate range.

Definition (Lean source)
ε :
ℝ
mixedParameterRegion ε :
Set (Fin 3 → ℝ)
{v | |v 0| ≤ ε ∧ |v 1| ≤ ε ∧ v 2 ∈ Icc (0 : ℝ) 1}
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedParameterRegion · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/CalibrationRegularity.lean:32
def fairParameterRegion

Closed fair-amplitude neighbourhood, including zero effect and zero amplitude.

Definition (Lean source)
ε :
ℝ
fairParameterRegion ε :
Set (Fin 3 → ℝ)
{v | v 0 ∈ Icc (0 : ℝ) (1/4) ∧ |v 1| ≤ ε ∧ v 2 ∈ Icc (0 : ℝ) 1}
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairParameterRegion · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/CalibrationRegularity.lean:35
def CalibrationSmooth

Both roots and all fully substituted local cell formulas are smooth.

Definition (Lean source)
ε :
ℝ
CalibrationSmooth ε :
Prop
clause 1
ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) (mixedParameterRegion ε)
clause 2
ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => fairRoot (v 0) (v 1) (v 2)) (fairParameterRegion ε)
clause 3
b s a y :
clause 4
b s a y :
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibrationSmooth · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/CalibrationRegularity.lean:38
def CalibrationDerivativeBounds

Every fixed derivative order is uniformly bounded; the order is not truncated at two.

Definition (Lean source)
ε :
ℝ
m :
ℕ
CalibrationDerivativeBounds ε :
Prop
∃ B : ℝ,
0 < B
clause 1
v ∈ mixedParameterRegion ε :
‖iteratedFDeriv ℝ m (fun w : Fin 3 → ℝ => mixedRoot (w 0) (w 1) (w 2)) v‖ ≤ B
b s a y :
‖iteratedFDeriv ℝ m (localMixedCell b s a y) v‖ ≤ B
clause 2
v ∈ fairParameterRegion ε :
‖iteratedFDeriv ℝ m (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v‖ ≤ B
b s a y :
‖iteratedFDeriv ℝ m (localFairCell b s a y) v‖ ≤ B
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibrationDerivativeBounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/CalibrationRegularity.lean:44
def MixedCalibrationZero

The literal mixed selector is the unique zero in its prescribed open bracket.

Definition (Lean source)
v :
Fin 3 → ℝ
MixedCalibrationZero v :
Prop
clause 1
mixedRoot (v 0) (v 1) (v 2) ∈ Ioo (3/4 : ℝ) (5/4)
clause 2
mixedEquation (v 0) (v 1) (v 2) (mixedRoot (v 0) (v 1) (v 2)) = 0
clause 3
q ∈ Set.Ioo (3/4 : ℝ) (5/4) :
mixedEquation (v 0) (v 1) (v 2) q = 0
q = mixedRoot (v 0) (v 1) (v 2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.MixedCalibrationZero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/CalibrationRegularity.lean:54
def FairCalibrationZero

The literal fair selector lies in one fixed narrow bracket and is its unique zero; it also lies in the existing selector bracket.

Definition (Lean source)
b :
ℝ
v :
Fin 3 → ℝ
FairCalibrationZero b v :
Prop
clause 1
fairRoot (v 0) (v 1) (v 2) ∈ Ioo ((2/5 : ℝ)-b) (2/5+b)
clause 2
fairRoot (v 0) (v 1) (v 2) ∈ Ioo (3/10 : ℝ) (1/2)
clause 3
fairEquation (v 0) (v 1) (fairRoot (v 0) (v 1) (v 2)) (v 2) = 0
clause 4
p ∈ Set.Ioo ((2/5 : ℝ)-b) (2/5+b) :
fairEquation (v 0) (v 1) p (v 2) = 0
p = fairRoot (v 0) (v 1) (v 2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.FairCalibrationZero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/CalibrationRegularity.lean:60
def CalibrationBranchNeighbourhood

Absolute signed branch radii larger than the derivative-bound radius, one fixed fair bracket, and open neighborhoods of the full closed parameter regions. The ambient open sets include signed effects across zero and neighborhoods of both spatial endpoints; all cells have their selectors fully substituted. The fair equation itself is smooth on an ambient open set containing the entire fair core and centered margin bracket, and agrees with the normalized numerator off the axes throughout that core, for every margin in the bracket.

Definition (Lean source)
ε :
ℝ
CalibrationBranchNeighbourhood ε :
Prop
∃ εmix εfair b : ℝ, ∃ U V : Set (Fin 3 → ℝ),
0 < εmix
ε < εmix
0 < εfair
ε < εfair
0 < b
b < 1/10
fairParameterRegion εfair ⊆ V
clause 1
v ∈ U :
clause 2
v ∈ V :
clause 3
ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) U
clause 4
ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => fairRoot (v 0) (v 1) (v 2)) V
clause 5
b s a y :
ContDiffOn ℝ ∞ (localMixedCell b s a y) U
clause 6
b s a y :
ContDiffOn ℝ ∞ (localFairCell b s a y) V
clause 7
∃ W : Set (Fin 4 → ℝ),
{w | w 0 ∈ Icc (0 : ℝ) (1/4) ∧ |w 1| ≤ εfair ∧ w 2 ∈ Ioo ((2/5 : ℝ)-b) (2/5+b) ∧ w 3 ∈ Icc (0 : ℝ) 1} ⊆ W
ContDiffOn ℝ ∞ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) W
t δ ξ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ εfair
ξ ∈ Ioo ((2/5 : ℝ)-b) (2/5+b)
u ∈ Icc (0 : ℝ) 1
t*δ ≠ 0
fairEquation t δ ξ u = fairNumerator t δ ξ u/(t*δ^2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibrationBranchNeighbourhood · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/CalibrationRegularity.lean:68
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Defs.Engine 27 declarations Primitive image and excess contracts are distinct from statistical budget conclusions.

Rational engines and Borel dyadic naming policies

Primitive image and excess contracts are distinct from statistical budget conclusions. Bounded stateful rational register programs certify the recurrence requirement; arbitrary operation-count metadata alone does not certify a computation.

inductive RationalInstruction

Instructions of a finite rational register machine. Registers carry state between steps; comparisons may branch or jump back to an earlier instruction. Integer operations act on the nonnegative part of the floor, except floor and ceil, which retain the sign.

Definition (Lean source)
inductive RationalInstruction where | constant : ℕ → ℚ → RationalInstruction | copy : ℕ → ℕ → RationalInstruction | add : ℕ → ℕ → ℕ → RationalInstruction | sub : ℕ → ℕ → ℕ → RationalInstruction | mul : ℕ → ℕ → ℕ → RationalInstruction | div : ℕ → ℕ → ℕ → RationalInstruction | min : ℕ → ℕ → ℕ → RationalInstruction | max : ℕ → ℕ → ℕ → RationalInstruction | floor : ℕ → ℕ → RationalInstruction | ceil : ℕ → ℕ → RationalInstruction | factorial : ℕ → ℕ → RationalInstruction | integerSqrt : ℕ → ℕ → RationalInstruction | clogTwo : ℕ → ℕ → RationalInstruction | natPow : ℕ → ℕ → ℕ → RationalInstruction | branchLe : ℕ → ℕ → ℕ → ℕ → RationalInstruction | jump : ℕ → RationalInstruction | halt : RationalInstruction
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalInstruction · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:22
def RationalProgram

A fixed finite instruction list, with no access to real inputs or external oracles.

Definition (Lean source)
RationalProgram :
Type
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:43
def RationalState

Program counter, rational registers, and halt flag.

Definition (Lean source)
RationalState :
Type
ℕ × (ℕ → ℚ) × Bool
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalState · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:45
def initial

Initialize registers from the supplied rational arguments, and all others to zero.

Definition (Lean source)
xs :
List ℚ
initial xs :
(0, fun i => xs[i]?.getD 0, false)
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalProgram.initial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:47
def step

One stateful rational step. Falling off the finite code also halts.

Definition (Lean source)
step code s :
if s.2.2 then s else let pc := s.1 let r := s.2.1 let write := fun dst value
=> (pc + 1, update r dst value, false) match code[pc]? with | none => (pc, r, true) | some (.constant dst v) => write dst v | some (.copy dst a) => write dst (r a) | some (.add dst a b) => write dst (r a + r b) | some (.sub dst a b) => write dst (r a - r b) | some (.mul dst a b) => write dst (r a * r b) | some (.div dst a b) => write dst (r a / r b) | some (.min dst a b) => write dst (min (r a) (r b)) | some (.max dst a b) => write dst (max (r a) (r b)) | some (.floor dst a) => write dst (⌊r a⌋ : ℤ) | some (.ceil dst a) => write dst (⌈r a⌉ : ℤ) | some (.factorial dst a) => write dst (factorial (⌊r a⌋ : ℤ).toNat) | some (.integerSqrt dst a) => write dst (sqrt (⌊r a⌋ : ℤ).toNat) | some (.clogTwo dst a) => write dst (clog 2 (⌊r a⌋ : ℤ).toNat) | some (.natPow dst a b) => write dst (r a ^ (⌊r b⌋ : ℤ).toNat) | some (.branchLe a b yes no) => (if r a ≤ r b then yes else no, r, false) | some (.jump target) => (target, r, false) | some .halt => (pc, r, true)
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalProgram.step · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:50
def run

General state-carrying iteration for a specified public number of steps. In particular, repeated natPow instructions can generate towers of input-dependent height.

Definition (Lean source)
run code :
clause 1
| 0, s => s
clause 2
| fuel + 1, s => code.run fuel (code.step s)
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalProgram.run · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:75
def PublicIterationBound

Allowable public iteration-count functions are all total functions of rational arguments computed by a fixed finite rational register program. The computation of this bound must itself halt on every input; no elementary-growth restriction is imposed.

Definition (Lean source)
bound :
List ℚ → ℕ
PublicIterationBound bound :
Prop
∃ code : RationalProgram,
∀ xs : List ℚ,
∃ fuel : ℕ,
(code.run fuel (RationalProgram.initial xs)).2.2 = true ∧
(code.run fuel (RationalProgram.initial xs)).2.1 0 = (bound xs : ℚ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.PublicIterationBound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:80
structure BoundedRationalProgram

A general bounded stateful rational program with its specified public bound. Registers zero and one are the returned endpoints. The bound and program are fixed independently of exponents, samples, laws, naming policies, and evaluation radii.

Definition (Lean source)
iterationBound :
List ℚ → ℕ
public_bound :
PublicIterationBound iterationBound
halts :
∀ xs, (code.run (iterationBound xs) (RationalProgram.initial xs)).2.2 = true
CausalSmith.Stat.LogoddsLowsmoothFrontier.BoundedRationalProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:87
def eval

Execute the certified finite state recurrence and read its rational endpoints.

Definition (Lean source)
xs :
List ℚ
eval program xs :
ℚ × ℚ
s :
program.code.run (program.iterationBound xs) (RationalProgram.initial xs)
(s.2.1 0, s.2.1 1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.BoundedRationalProgram.eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:95
def rationalBox

Endpoint ordering is enforced without any real input.

Definition (Lean source)
lo hi :
ℚ
rationalBox lo hi :
⟨min lo hi, max lo hi, min_le_max⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalBox · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:99
inductive PrimitiveKind

Fixed primitive index.

Definition (Lean source)
inductive PrimitiveKind where | pi | exp | cos | log | sqrt | power
CausalSmith.Stat.LogoddsLowsmoothFrontier.PrimitiveKind · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:101

Independently fixed deterministic maps over rational data only.

Definition (Lean source)
piBox :
ℕ → RatInterval
expBox :
cosBox :
logBox :
sqrtBox :
powBox :
ℕ → ℕ → RatInterval → RatInterval
CausalSmith.Stat.LogoddsLowsmoothFrontier.ArithmeticEngine · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:104
def precisionError

Precision error.

Definition (Lean source)
q :
ℕ
precisionError q :
ℝ
(2 : ℝ) ^ (-(q : ℤ))
CausalSmith.Stat.LogoddsLowsmoothFrontier.precisionError · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:112
def MonotoneContract

Image containment and outward endpoint excess for a monotone primitive.

Definition (Lean source)
F :
ℝ → ℝ
q :
ℕ
I J :
MonotoneContract F q I J :
Prop
clause 1
x :
I.Contains x
J.Contains (F x)
clause 2
0 ≤ F I.lo - J.lo
clause 3
F I.lo - J.lo ≤ precisionError q
clause 4
0 ≤ (J.hi : ℝ) - F I.hi
clause 5
(J.hi : ℝ) - F I.hi ≤ precisionError q
CausalSmith.Stat.LogoddsLowsmoothFrontier.MonotoneContract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:114
def RationalRecurrences

Every primitive is a general bounded stateful rational program, with a public iteration bound computed solely from precision, rational range bounds, and the integer base when present. The finite register language permits unrestricted state-carrying loops within that bound, including non-elementary output growth.

Definition (Lean source)
RationalRecurrences E :
Prop
clause 1
q :
E.piBox q = let v := (code .pi).eval [q]; rationalBox v.1 v.2
clause 2
q I :
E.expBox q I = let v := (code .exp).eval [q,I.lo,I.hi]; rationalBox v.1 v.2
clause 3
q I :
E.cosBox q I = let v := (code .cos).eval [q,I.lo,I.hi]; rationalBox v.1 v.2
clause 4
q I :
E.logBox q I = let v := (code .log).eval [q,I.lo,I.hi]; rationalBox v.1 v.2
clause 5
q I :
E.sqrtBox q I = let v := (code .sqrt).eval [q,I.lo,I.hi]; rationalBox v.1 v.2
clause 6
q b I :
E.powBox q b I = let v := (code .power).eval [q,b,I.lo,I.hi]; rationalBox v.1 v.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalRecurrences · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:119
def Admissible

Primitive contracts and finite rational computation, with no budget conclusion.

Definition (Lean source)
Admissible E :
Prop
clause 2
q :
(E.piBox q).Contains pi
3 ≤ (E.piBox q).lo
(E.piBox q).hi ≤ 4
pi - (E.piBox q).lo ≤ precisionError q
(E.piBox q).hi - pi ≤ precisionError q
clause 3
q I :
MonotoneContract exp q I (E.expBox q I)
0 < (E.expBox q I).lo
clause 4
q I :
0 < I.lo
MonotoneContract log q I (E.logBox q I)
clause 5
q I :
0 ≤ I.lo
MonotoneContract sqrt q I (E.sqrtBox q I)
0 ≤ (E.sqrtBox q I).lo
clause 6
q (b : ℕ) I :
1 ≤ b
-3 ≤ I.lo
I.hi ≤ 3
MonotoneContract (fun v => (b : ℝ) ^ v) q I (E.powBox q b I)
0 < (E.powBox q b I).lo
clause 7
q I :
m :
((I.lo : ℝ) + I.hi) / 2 (: ℝ)
w :
((I.hi : ℝ) - I.lo) / 2 (: ℝ)
x :
I.Contains x
(E.cosBox q I).Contains (cos x)
∃ a b : ℚ,
(a : ℝ) ≤ cos m
cos m ≤ b
cos m - a ≤ precisionError q
(b : ℝ) - cos m ≤ precisionError q
-1 ≤ a
b ≤ 1
(E.cosBox q I).lo = max (-1) (a - (I.hi - I.lo) / 2)
(E.cosBox q I).hi = min 1 (b + (I.hi - I.lo) / 2)
((E.cosBox q I).width : ℝ) ≤ 2 * w + 2 * precisionError q
CausalSmith.Stat.LogoddsLowsmoothFrontier.ArithmeticEngine.Admissible · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:132
def DyadicName

A name is a precision-indexed rational interval.

Definition (Lean source)
DyadicName :
Type
ℕ → RatInterval
CausalSmith.Stat.LogoddsLowsmoothFrontier.DyadicName · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:154

Dyadic rational endpoint.

Definition (Lean source)
v :
ℚ
IsDyadic v :
Prop
∃ z : ℤ, ∃ q : ℕ, v = (z : ℚ) / 2 ^ q
CausalSmith.Stat.LogoddsLowsmoothFrontier.IsDyadic · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:156
def IsValidName

Validity at every precision, with nesting and literal containment.

Definition (Lean source)
v :
ℝ
name :
IsValidName v name :
Prop
clause 1
q :
IsDyadic (name q).lo
IsDyadic (name q).hi
(name q).Contains v
((name q).width : ℝ) ≤ precisionError q
clause 2
q :
(name (q + 1)).Subinterval (name q)
CausalSmith.Stat.LogoddsLowsmoothFrontier.IsValidName · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:158

Public names are fixed without the sample; covariate names may depend on it.

Definition (Lean source)
alphaName :
ℕ → ℝ → ℝ → DyadicName
betaName :
ℕ → ℝ → ℝ → DyadicName
covariateName :
(n : ℕ) → ℝ → ℝ → (Fin n → Record) → Fin n → DyadicName
CausalSmith.Stat.LogoddsLowsmoothFrontier.NamingPolicy · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:163
def Admissible

Every selected name is valid, and every rational response is Borel.

Definition (Lean source)
Admissible N :
Prop
clause 1
n α β :
IsValidName α (N.alphaName n α β)
IsValidName β (N.betaName n α β)
clause 2
n α β o i :
IsValidName (covariate (o i)) (N.covariateName n α β o i)
clause 3
n q :
Measurable (fun ab : ℝ × ℝ => ((N.alphaName n ab.1 ab.2 q).lo, (N.alphaName n ab.1 ab.2 q).hi))
Measurable (fun ab : ℝ × ℝ => ((N.betaName n ab.1 ab.2 q).lo, (N.betaName n ab.1 ab.2 q).hi))
clause 4
n i q :
Measurable (fun abo : (ℝ × ℝ) × (Fin n → Record) => ((N.covariateName n abo.1.1 abo.1.2 abo.2 i q).lo, (N.covariateName n abo.1.1 abo.1.2 abo.2 i q).hi))
CausalSmith.Stat.LogoddsLowsmoothFrontier.NamingPolicy.Admissible · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:169

Ordered endpoints of the dyadic-floor response. the stated conclusion holds.

Formal statement
v :
ℝ
q :
ℕ
((⌊(2 : ℝ)^q * v⌋ : ℤ) : ℚ) / 2^q ≤ (((⌊(2 : ℝ)^q * v⌋ : ℤ) : ℚ) + 1) / 2^q
Proof (Lean source)
-- @node: dyadic_floor_order lemma dyadic_floor_order (v : ℝ) (q : ℕ) : ((⌊(2 : ℝ)^q * v⌋ : ℤ) : ℚ) / 2^q ≤ (((⌊(2 : ℝ)^q * v⌋ : ℤ) : ℚ) + 1) / 2^q := by apply div_le_div_of_nonneg_right · exact le_add_of_nonneg_right zero_le_one · positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.dyadic_floor_order · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:180
def dyadicFloorName

The exact prescribed dyadic-floor name, including dyadic inputs.

Definition (Lean source)
v :
ℝ
q :
ℕ
dyadicFloorName v q :
⟨((⌊(2 : ℝ)^q * v⌋ : ℤ) : ℚ) / 2^q, (((⌊(2 : ℝ)^q * v⌋ : ℤ) : ℚ) + 1) / 2^q, dyadic_floor_order v q⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.dyadicFloorName · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:188
def dyadicFloorPolicy

One concrete policy, with the literal dyadic-floor responses.

Definition (Lean source)
dyadicFloorPolicy :
clause 1
alphaName := fun _ α _ => dyadicFloorName α
clause 2
betaName := fun _ _ β => dyadicFloorName β
clause 3
covariateName := fun _ _ _ o i => dyadicFloorName (covariate (o i))
CausalSmith.Stat.LogoddsLowsmoothFrontier.dyadicFloorPolicy · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:192

The literal floor boxes contain their input with the prescribed width. the stated conclusion holds.

Formal statement
v :
ℝ
Proof (Lean source)
-- @node: dyadicFloorName_valid lemma dyadicFloorName_valid (v : ℝ) : IsValidName v (dyadicFloorName v) := by constructor · intro q refine ⟨⟨⌊(2 : ℝ)^q*v⌋, q, rfl⟩, ?_, ?_, ?_⟩ · refine ⟨⌊(2 : ℝ)^q*v⌋ + 1, q, ?_⟩ simp [dyadicFloorName] · simp only [dyadicFloorName, RatInterval.Contains] push_cast constructor · apply (div_le_iff₀ (by positivity : (0 : ℝ) < 2^q)).2 simpa [mul_comm] using Int.floor_le ((2 : ℝ)^q*v) · apply (le_div_iff₀ (by positivity : (0 : ℝ) < 2^q)).2 simpa [mul_comm] using (Int.lt_floor_add_one ((2 : ℝ)^q*v)).le · simp only [dyadicFloorName, RatInterval.width] push_cast simp only [precisionError, zpow_neg, zpow_natCast] apply le_of_eq field_simp ring · intro q have hlo : 2 * ⌊(2 : ℝ)^q*v⌋ ≤ ⌊(2 : ℝ)^(q+1)*v⌋ := by apply Int.le_floor.mpr push_cast have := Int.floor_le ((2 : ℝ)^q*v) rw [pow_succ] linarith have hhi : ⌊(2 : ℝ)^(q+1)*v⌋ < 2 * (⌊(2 : ℝ)^q*v⌋ + 1) := by apply Int.floor_lt.mpr push_cast have := Int.lt_floor_add_one ((2 : ℝ)^q*v) rw [pow_succ] linarith change ((⌊(2 : ℝ)^q*v⌋ : ℤ) : ℚ) / 2^q ≤ ((⌊(2 : ℝ)^(q+1)*v⌋ : ℤ) : ℚ) / 2^(q+1) ∧ (((⌊(2 : ℝ)^(q+1)*v⌋ : ℤ) : ℚ)+1) / 2^(q+1) ≤ (((⌊(2 : ℝ)^q*v⌋ : ℤ) : ℚ)+1) / 2^q rw [pow_succ] constructor · apply (div_le_div_iff₀ (by positivity) (by positivity)).2 have hl : (2 : ℚ) * ⌊(2 : ℝ)^q*v⌋ ≤ ⌊(2 : ℝ)^(q+1)*v⌋ := by exact_mod_cast hlo simp only [pow_succ] at hl ⊢ nlinarith [show (0 : ℚ) < 2^q by positivity] · apply (div_le_div_iff₀ (by positivity) (by positivity)).2 have hh : (⌊(2 : ℝ)^(q+1)*v⌋ : ℚ)+1 ≤ 2 * (⌊(2 : ℝ)^q*v⌋+1) := by exact_mod_cast (Int.add_one_le_iff.mpr hhi) simp only [pow_succ] at hh ⊢ nlinarith [show (0 : ℚ) < 2^q by positivity]
CausalSmith.Stat.LogoddsLowsmoothFrontier.dyadicFloorName_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:197
theorem dyadicFloorName_measurable Lemma dyadicFloorName_measurable in the paper ↗

At each fixed precision the two rational floor endpoints are Borel. the stated conclusion holds.

Formal statement
q :
ℕ
Measurable (fun v : ℝ => ((dyadicFloorName v q).lo, (dyadicFloorName v q).hi))
Proof (Lean source)
-- @node: dyadicFloorName_measurable lemma dyadicFloorName_measurable (q : ℕ) : Measurable (fun v : ℝ => ((dyadicFloorName v q).lo, (dyadicFloorName v q).hi)) := by unfold dyadicFloorName fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.dyadicFloorName_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:247
theorem dyadicFloorPolicy_admissible

The explicit floor policy meets all validity and Borel contracts. the stated conclusion holds.

Formal statement
NamingPolicy.Admissible dyadicFloorPolicy
Proof (Lean source)
-- @node: dyadicFloorPolicy_admissible lemma dyadicFloorPolicy_admissible : NamingPolicy.Admissible dyadicFloorPolicy := by refine ⟨?_, ?_, ?_, ?_⟩ · intro n α β exact ⟨dyadicFloorName_valid α, dyadicFloorName_valid β⟩ · intro n α β o i exact dyadicFloorName_valid _ · intro n q exact ⟨(dyadicFloorName_measurable q).comp measurable_fst, (dyadicFloorName_measurable q).comp measurable_snd⟩ · intro n i q apply (dyadicFloorName_measurable q).comp unfold covariate fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.dyadicFloorPolicy_admissible · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Engine.lean:254
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Defs.FrontierSpecifications 6 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

Defs/FrontierSpecifications

Paper-owned scaffold obligations; proofs are filled in Stage 3.

The two explicit radius-elbow identities, with positivity and shared-boundary agreement.

Definition (Lean source)
α β :
ℝ
ElbowIdentities α β :
Prop
clause 1
0 < exponentA α β-exponentB β
clause 2
α+β ≤ 1/2
exponentA α β-exponentB β = 2*(α-β)/((2*α+2*β+1)*(4*β+1))
clause 3
1/2 ≤ α+β
exponentA α β-exponentB β = (1-4*β)/(2*(4*β+1))
clause 4
α+β = 1/2
2*(α-β)/((2*α+2*β+1)*(4*β+1)) = (1-4*β)/(2*(4*β+1))

Compact-uniform bounds, expressed as the actual infimum/supremum conditions.

Definition (Lean source)
c C :
ℝ
K :
Set (ℝ × ℝ)
K.Nonempty
K ⊆ {ab | ExponentDomain ab.1 ab.2}
CompactUniform c C :
Prop
clause 1
0 < sInf ((fun _ : ℝ × ℝ => c) '' K)
clause 2
(⨆ ab ∈ K, ofReal C) < ⊤
clause 3
sSup ((fun _ : ℝ × ℝ => (1 : ℕ)) '' K) = 1

The all-radius expected-length comparison for one literal implementation.

Definition (Lean source)
c C :
ℝ
hN :
N.Admissible
n :
ℕ
α β r :
ℝ
FrontierComparison c C E N hN n α β r :
Prop
clause 1
c*rate n α β r ≤ lengthObjective n α β r
clause 2
lengthObjective n α β r ≤ worstLength n α β r (upperInterval E N hN n α β)
clause 3
worstLength n α β r (upperInterval E N hN n α β) ≤ C*rate n α β r
CausalSmith.Stat.LogoddsLowsmoothFrontier.FrontierComparison · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/FrontierSpecifications.lean:29

The operational guarantees are properties of the actual supplied-engine output.

Definition (Lean source)
hN :
N.Admissible
n :
ℕ
α β :
ℝ
FrontierOperational E N hN n α β :
Prop
clause 1
HonestProcedure n α β (upperInterval E N hN n α β)
clause 2
ω :
RationalOutputShape ((upperInterval E N hN n α β).output ω)
clause 3
o u v :
(upperInterval E N hN n α β).output (o,u) = (upperInterval E N hN n α β).output (o,v)
clause 4
n = 1
ω :
intervalSet ((upperInterval E N hN n α β).output ω) = Icc (-(1/2 : ℝ)) (1/2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.FrontierOperational · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/FrontierSpecifications.lean:35

Concrete sequence uses precisely the certified concrete engine and the floor policy.

Definition (Lean source)
n :
ℕ
α β :
ℝ
starInterval n α β :
Procedure n
upperInterval concreteEngine dyadicFloorPolicy fixed_budget_realization.1 n α β

Parameter-independent universal generalization of the sharp comparison and output guarantees.

Definition (Lean source)
c C :
ℝ
E.Admissible
hN :
N.Admissible
α β :
ℝ
n :
ℕ
1 ≤ n
UniversalFrontier c C :
Prop
clause 1
FrontierOperational E N hN n α β
clause 2
r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
FrontierComparison c C E N hN n α β r
CausalSmith.Stat.LogoddsLowsmoothFrontier.UniversalFrontier · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/FrontierSpecifications.lean:46
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Defs.Projection 8 declarations Cosine projections and original-record ordered-pair statistics

Cosine projections and original-record ordered-pair statistics

def cosineBasis

Cosine basis with the constant frequency separated.

Definition (Lean source)
j :
ℕ
x :
cosineBasis j x :
ℝ
if j = 0 then 1 else sqrt 2 * cos (pi * j * (x : ℝ))
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineBasis · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:14
def uniformInner

Inner product against the public uniform design.

Definition (Lean source)
f g :
Covariate → ℝ
uniformInner f g :
ℝ
∫ x, f x * g x ∂uniformLaw
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformInner · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:18
def cosineProjection

Rank-k cosine projection.

Definition (Lean source)
k :
ℕ
f :
Covariate → ℝ
x :
cosineProjection k f x :
ℝ
∑ j ∈ range k, uniformInner f (cosineBasis j) * cosineBasis j x
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineProjection · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:20
def projectionKernel

Projection kernel.

Definition (Lean source)
k :
ℕ
x z :
projectionKernel k x z :
ℝ
∑ j ∈ range k, cosineBasis j x * cosineBasis j z
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionKernel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:24
structure BoundedMark

Borel marks valued in the unit interval.

Definition (Lean source)
value :
Record → ℝ
measurable_value :
range_value :
∀ o, 0 ≤ value o ∧ value o ≤ 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.BoundedMark · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:27
def conditionalMarkMean

Conditional mean computed from the actual four-cell kernel.

Definition (Lean source)
conditionalMarkMean P W x :
ℝ
∑ a : Bool, ∑ y : Bool, P.cells a y x * W.value (x, a, y)
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:32
def projectionStatistic Definition 11 in the paper ↗

Ordered distinct pairs, with the asymmetric marked kernel.

Definition (Lean source)
n k :
ℕ
W V :
Record → ℝ
o :
Fin n → Record
projectionStatistic n k W V o :
ℝ
((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), projectionKernel k (covariate (o ij.1)) (covariate (o ij.2)) * W (o ij.1) * V (o ij.2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:37
def uniformL2Norm

Uniform L2 norm, with extended semantics.

Definition (Lean source)
f :
Covariate → ℝ
uniformL2Norm f :
ℝ≥0∞
(∫⁻ x, ofReal (f x ^ 2) ∂uniformLaw).rpow (1 / 2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformL2Norm · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Projection.lean:43
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Defs.Upper 40 declarations One retained rank pair drives both exact coordinates and the literal rational expression tree.

Fixed-budget represented upper intervals

One retained rank pair drives both exact coordinates and the literal rational expression tree. Ideal real endpoints and their evaluated enclosures are separate.

def boxIntersection

[Exact interval intersection; an empty intersection is reported.

Definition (Lean source)
I J :
boxIntersection I J :
if h : max I.lo J.lo ≤ min I.hi J.hi then some ⟨max I.lo J.lo, min I.hi J.hi, h⟩ else none
CausalSmith.Stat.LogoddsLowsmoothFrontier.boxIntersection · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:18
theorem boxIntersection_subinterval_right

A successful intersection is contained in its second input interval. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
I J B :
h :
boxIntersection I J = some B
B.Subinterval J
Proof (Lean source)
-- @node: boxIntersection_subinterval_right lemma boxIntersection_subinterval_right (I J B : RatInterval) (h : boxIntersection I J = some B) : B.Subinterval J := by unfold boxIntersection at h split at h · cases h exact ⟨le_max_right _ _, min_le_right _ _⟩ · cases h
CausalSmith.Stat.LogoddsLowsmoothFrontier.boxIntersection_subinterval_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:21
def boxMin

[Exact minimum range.

Definition (Lean source)
I J :
boxMin I J :
rationalBox (min I.lo J.lo) (min I.hi J.hi)
CausalSmith.Stat.LogoddsLowsmoothFrontier.boxMin · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:31
def boxMax

Exact maximum range.

Definition (Lean source)
I J :
boxMax I J :
rationalBox (max I.lo J.lo) (max I.hi J.hi)
CausalSmith.Stat.LogoddsLowsmoothFrontier.boxMax · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:33
def boxDiv

Domain-checked division.

Definition (Lean source)
I J :
boxDiv I J :
if h : J.hi < 0 ∨ 0 < J.lo then some (I.div J h) else none
CausalSmith.Stat.LogoddsLowsmoothFrontier.boxDiv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:35
def fullEffectBox

Full public effect box.

Definition (Lean source)
fullEffectBox :
rationalBox (-1/2) (1/2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fullEffectBox · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:38
def qRank

Public rank budget, computed with integer comparisons.

Definition (Lean source)
n :
ℕ
qRank n :
ℕ
7 + 3 * clog 2 n
CausalSmith.Stat.LogoddsLowsmoothFrontier.qRank · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:40
def qEnd

Public endpoint budget.

Definition (Lean source)
n kC kS :
ℕ
qEnd n kC kS :
ℕ
44 + clog 2 (n + 1) + 4 * clog 2 (max kC kS + 1)
def rankBoxes

Literal engine rank-target enclosures.

Definition (Lean source)
n :
ℕ
α β :
ℝ
rankBoxes E N n α β :
do let q := qRank n let a ← boxIntersection (N.alphaName n α β q) (rationalBox 0 1) let b ← boxIntersection (N.betaName n α β q) (rationalBox 0 (1/4)) let c ← boxDiv (RatInterval.point 2) ((RatInterval.point 2).mul a |>.add ((RatInterval.point 2).mul b) |>.add (RatInterval.point 1)) let d ← boxDiv (RatInterval.point 2) (((RatInterval.point 4).mul b).add (RatInterval.point 1)) return (E.powBox q n c, E.powBox q n d)
CausalSmith.Stat.LogoddsLowsmoothFrontier.rankBoxes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:45
def resolutions

Ceiling of each upper enclosure endpoint, fixed before sampling.

Definition (Lean source)
n :
ℕ
α β :
ℝ
resolutions E N n α β :
ℕ × ℕ
match rankBoxes E N n α β with | some (c,s)
=> ((⌈c.hi⌉ : ℤ).toNat, (⌈s.hi⌉ : ℤ).toNat) | none => (1,1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.resolutions · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:55
def cHat

Exact covariance coordinate statistic at the retained rank.

Definition (Lean source)
n kC :
ℕ
o :
Fin n → Record
cHat n kC o :
ℝ
(n : ℝ)⁻¹ * ∑ i, treatment (o i) * outcome (o i)
def sHat

Exact denominator statistic at the retained rank.

Definition (Lean source)
n kS :
ℕ
o :
Fin n → Record
sHat n kS o :
ℝ
projectionStatistic n kS (fun o => treatment o * (1 - outcome o)) (fun o => (1 - treatment o) * outcome o) o
def coordinateEstimates

Both statistics use exactly the previously selected rank pair.

Definition (Lean source)
n :
ℕ
α β :
ℝ
o :
Fin n → Record
coordinateEstimates E N n α β o :
ℝ × ℝ
k :
resolutions E N n α β
(cHat n k.1 o, sHat n k.2 o)
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinateEstimates · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:70
def varianceRadius

Public variance radius.

Definition (Lean source)
n k :
ℕ
varianceRadius n k :
ℝ
10 / n + 4 * k / ((n : ℝ) * ((n : ℝ) - 1))
CausalSmith.Stat.LogoddsLowsmoothFrontier.varianceRadius · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:74
def clip

Clipping as literal maximum and minimum.

Definition (Lean source)
l u v :
ℝ
clip l u v :
ℝ
max l (min u v)
def inversion

Joint odds inversion with the public effect clipping.

Definition (Lean source)
c d :
ℝ
inversion c d :
ℝ
log (clip (exp (-1/2)) (exp (1/2)) (1 + c / d))
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:78
def idealEndpoints

The ideal exact-real endpoint expressions.

Definition (Lean source)
n :
ℕ
α β :
ℝ
o :
Fin n → Record
idealEndpoints E N n α β o :
ℝ × ℝ
k :
resolutions E N n α β
c :
cHat n k.1 o
s :
sHat n k.2 o
bC :
8 * (k.1 : ℝ) ^ (-(α+β)) + sqrt (20 * varianceRadius n k.1)
bS :
25 * (k.2 : ℝ) ^ (-2*β) + sqrt (20 * varianceRadius n k.2)
sm :
clip denominatorFloor 1 (s-bS)
sp :
clip denominatorFloor 1 (s+bS)
(min (inversion (c-bC) sm) (inversion (c-bC) sp), max (inversion (c+bC) sm) (inversion (c+bC) sp))
CausalSmith.Stat.LogoddsLowsmoothFrontier.idealEndpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:81
inductive BoxExpr

Finite expression syntax with matching real and rational-box semantics.

Definition (Lean source)
inductive BoxExpr where | constant : ℚ → BoxExpr | input : ℕ → BoxExpr | pi : BoxExpr | add : BoxExpr → BoxExpr → BoxExpr | sub : BoxExpr → BoxExpr → BoxExpr | mul : BoxExpr → BoxExpr → BoxExpr | div : BoxExpr → BoxExpr → BoxExpr | min : BoxExpr → BoxExpr → BoxExpr | max : BoxExpr → BoxExpr → BoxExpr | exp : BoxExpr → BoxExpr | cos : BoxExpr → BoxExpr | log : BoxExpr → BoxExpr | sqrt : BoxExpr → BoxExpr | power : ℕ → BoxExpr → BoxExpr
CausalSmith.Stat.LogoddsLowsmoothFrontier.BoxExpr · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:92
def real

Exact-real semantics.

Definition (Lean source)
real :
BoxExpr → List ℝ → ℝ
clause 1
| .constant c, _ => c
clause 2
| .input i, xs => xs[i]?.getD 0
clause 3
| .pi, _ => pi
clause 4
| .add a b, xs => a.real xs + b.real xs
clause 5
| .sub a b, xs => a.real xs - b.real xs
clause 6
| .mul a b, xs => a.real xs * b.real xs
clause 7
| .div a b, xs => a.real xs / b.real xs
clause 8
| .min a b, xs => min (a.real xs) (b.real xs)
clause 9
| .max a b, xs => max (a.real xs) (b.real xs)
clause 10
| .exp a, xs => exp (a.real xs)
clause 11
| .cos a, xs => cos (a.real xs)
clause 12
| .log a, xs => log (a.real xs)
clause 13
| .sqrt a, xs => sqrt (a.real xs)
clause 14
| .power b a, xs => (b : ℝ) ^ a.real xs
CausalSmith.Stat.LogoddsLowsmoothFrontier.BoxExpr.real · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:108
def eval

Literal structural box evaluation with the supplied engine and one precision.

Definition (Lean source)
q :
ℕ
clause 1
| .constant c, _ => some (RatInterval.point c)
clause 2
| .input i, xs => xs[i]?
clause 3
| .pi, _ => some (E.piBox q)
clause 4
| .add a b, xs => return (← a.eval E q xs).add (← b.eval E q xs)
clause 5
| .sub a b, xs => return (← a.eval E q xs).sub (← b.eval E q xs)
clause 6
| .mul a b, xs => return (← a.eval E q xs).mul (← b.eval E q xs)
clause 7
| .div a b, xs => do boxDiv (← a.eval E q xs) (← b.eval E q xs)
clause 8
| .min a b, xs => return boxMin (← a.eval E q xs) (← b.eval E q xs)
clause 9
| .max a b, xs => return boxMax (← a.eval E q xs) (← b.eval E q xs)
clause 10
| .exp a, xs => return E.expBox q (← a.eval E q xs)
clause 11
| .cos a, xs => return E.cosBox q (← a.eval E q xs)
clause 12
| .log a, xs => do let I ← a.eval E q xs if 0 < I.lo then return E.logBox q I else none
clause 13
| .sqrt a, xs => do let I ← a.eval E q xs if 0 ≤ I.lo then return E.sqrtBox q I else none
clause 14
| .power b a, xs => do let I ← a.eval E q xs if 1 ≤ b ∧
-3 ≤ I.lo ∧
I.hi ≤ 3 then return E.powBox q b I else none
CausalSmith.Stat.LogoddsLowsmoothFrontier.BoxExpr.eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:124
def expressionSum

A literal finite expression sum.

Definition (Lean source)
xs :
expressionSum xs :
xs.foldr BoxExpr.add (.constant 0)
CausalSmith.Stat.LogoddsLowsmoothFrontier.expressionSum · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:146
def basisExpression

Cosine basis expression at input covariate i.

Definition (Lean source)
j i :
ℕ
basisExpression j i :
if j
= 0 then .constant 1 else .mul (.sqrt (.constant 2)) (.cos (.mul (.mul .pi (.constant j)) (.input (2+i))))
CausalSmith.Stat.LogoddsLowsmoothFrontier.basisExpression · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:148
def kernelExpression

Projection kernel expression.

Definition (Lean source)
k i j :
ℕ
kernelExpression k i j :
expressionSum ((List.range k).map fun l => .mul (basisExpression l i) (basisExpression l j))
CausalSmith.Stat.LogoddsLowsmoothFrontier.kernelExpression · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:152
def statisticExpression

The full original-record statistic as a finite expression.

Definition (Lean source)
n k :
ℕ
W V :
Fin n → ℚ
statisticExpression n k W V :
.mul (.constant (1 / ((n : ℚ) * ((n : ℚ)-1)))) (expressionSum ((Finset.univ : Finset (Fin n × Fin n)).toList.filter (fun ij => ij.1 ≠ ij.2) |>.map fun ij => .mul (kernelExpression k ij.1.val ij.2.val) (.constant (W ij.1 * V ij.2))))
CausalSmith.Stat.LogoddsLowsmoothFrontier.statisticExpression · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:155
def coordinateExpressions

Literal numerator and denominator expressions using exact binary labels.

Definition (Lean source)
n kC kS :
ℕ
o :
Fin n → Record
coordinateExpressions n kC kS o :
A :
fun i => if (o i).2.1 then 1 else 0 (: Fin n → ℚ)
Y :
fun i => if (o i).2.2 then 1 else 0 (: Fin n → ℚ)
(.sub (.constant ((n : ℚ)⁻¹ * ∑ i, A i * Y i)) (statisticExpression n kC A Y), statisticExpression n kS (fun i => A i * (1-Y i)) (fun i => (1-A i)*Y i))
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinateExpressions · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:160
def inversionExpression

Literal joint-inversion expression.

Definition (Lean source)
c d :
inversionExpression c d :
.log (.max (.exp (.constant (-1/2))) (.min (.exp (.constant (1/2))) (.add (.constant 1) (.div c d))))
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversionExpression · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:166
def endpointExpressions

The displayed finite expression tree, retaining the rank-step integers.

Definition (Lean source)
n kC kS :
ℕ
o :
Fin n → Record
endpointExpressions n kC kS o :
cs :
bC :
BoxExpr.add (.mul (.constant 8) (.power kC (.sub (.constant 0) (.add (.input 0) (.input 1))))) (.sqrt (.constant (20 * (10/(n : ℚ)+4*kC/((n : ℚ)*((n : ℚ)-1))))))
bS :
BoxExpr.add (.mul (.constant 25) (.power kS (.mul (.constant (-2)) (.input 1)))) (.sqrt (.constant (20 * (10/(n : ℚ)+4*kS/((n : ℚ)*((n : ℚ)-1))))))
sm :
BoxExpr.max (.constant (1/512)) (.min (.constant 1) (.sub cs.2 bS))
sp :
BoxExpr.max (.constant (1/512)) (.min (.constant 1) (.add cs.2 bS))
(.min (inversionExpression (.sub cs.1 bC) sm) (inversionExpression (.sub cs.1 bC) sp), .max (inversionExpression (.add cs.1 bC) sm) (inversionExpression (.add cs.1 bC) sp))
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointExpressions · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:170
def endpointInputs

Endpoint-step inputs are queried once at the public endpoint precision. The supplied boxes enter the expression tree directly, without domain narrowing.

Definition (Lean source)
n :
ℕ
α β :
ℝ
o :
Fin n → Record
q :
ℕ
endpointInputs N n α β o q :
some (N.alphaName n α β q :: N.betaName n α β q :: (List.finRange n).map (fun i => N.covariateName n α β o i q))
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointInputs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:181
def endpointBoxes

Literal endpoint enclosures.

Definition (Lean source)
n :
ℕ
α β :
ℝ
o :
Fin n → Record
endpointBoxes E N n α β o :
do let k := resolutions E N n α β let q := qEnd n k.1 k.2 let xs ← endpointInputs N n α β o q let lr := endpointExpressions n k.1 k.2 o return (← lr.1.eval E q xs, ← lr.2.eval E q xs)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointBoxes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:186
def upperRawBox

Outward rational endpoints, with full-box totalization on invalid inputs.

Definition (Lean source)
n :
ℕ
α β :
ℝ
o :
Fin n → Record
upperRawBox E N n α β o :
if n < 2 then fullEffectBox else match rankBoxes E N n α β, endpointBoxes E N n α β o with | some _, some (L,R)
=> match boxIntersection (rationalBox L.lo R.hi) fullEffectBox with | some I => I | none => fullEffectBox | _, _ => fullEffectBox
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperRawBox · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:193
theorem upperRawBox_subinterval

The final intersection or full-box fallback keeps both endpoints in the effect box. the stated conclusion holds.

Formal statement
n :
ℕ
α β :
ℝ
o :
Fin n → Record
(upperRawBox E N n α β o).Subinterval fullEffectBox
Proof (Lean source)
-- @node: upperRawBox_subinterval lemma upperRawBox_subinterval (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (α β : ℝ) (o : Fin n → Record) : (upperRawBox E N n α β o).Subinterval fullEffectBox := by unfold upperRawBox split · exact RatInterval.subinterval_refl _ · split · split · exact boxIntersection_subinterval_right _ _ _ ‹_› · exact RatInterval.subinterval_refl _ · exact RatInterval.subinterval_refl _
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperRawBox_subinterval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:202
theorem upperRawBox_valid

The totalized rational output always defines a nonempty closed effect interval. the stated conclusion holds.

Formal statement
n :
ℕ
α β :
ℝ
o :
Fin n → Record
IntervalDataValid ((upperRawBox E N n α β o).lo, (upperRawBox E N n α β o).hi, true, true)
Proof (Lean source)
-- @node: upperRawBox_valid lemma upperRawBox_valid (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (α β : ℝ) (o : Fin n → Record) : IntervalDataValid ((upperRawBox E N n α β o).lo, (upperRawBox E N n α β o).hi, true, true) := by have hBounds := upperRawBox_subinterval E N n α β o have hlo : (fullEffectBox.lo : ℝ) ≤ (upperRawBox E N n α β o).lo := by exact_mod_cast hBounds.1 have hhi : ((upperRawBox E N n α β o).hi : ℝ) ≤ fullEffectBox.hi := by exact_mod_cast hBounds.2 norm_num [fullEffectBox, rationalBox] at hlo hhi have hOrder : ((upperRawBox E N n α β o).lo : ℝ) ≤ (upperRawBox E N n α β o).hi := by exact_mod_cast (upperRawBox E N n α β o).lo_le_hi dsimp [IntervalDataValid] refine ⟨?_, ?_, ?_⟩ · exact hlo · exact hhi · rcases lt_or_eq_of_le hOrder with hlt | heq · exact inl hlt · exact inr ⟨heq, rfl, rfl⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperRawBox_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:216
def upperOutput

Closed interval carrier for the literal rational output.

Definition (Lean source)
n :
ℕ
α β :
ℝ
o :
Fin n → Record
upperOutput E N n α β o :
⟨((upperRawBox E N n α β o).lo, (upperRawBox E N n α β o).hi, true, true), upperRawBox_valid E N n α β o⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperOutput · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:236
theorem upperRawBox_response_congr

A finite response code determines every subsequent rational computation. the stated conclusion holds. Under the stated assumptions.

Formal statement
n :
ℕ
α β :
ℝ
o o' :
Fin n → Record
hlabels :
∀ i, (o i).2 = (o' i).2
hnames :
∀ i,
N.covariateName n α β o i (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2)
= N.covariateName n α β o' i (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2)
upperRawBox E N n α β o = upperRawBox E N n α β o'
Proof (Lean source)
-- @node: upperRawBox_response_congr lemma upperRawBox_response_congr (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (α β : ℝ) (o o' : Fin n → Record) (hlabels : ∀ i, (o i).2 = (o' i).2) (hnames : ∀ i, N.covariateName n α β o i (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) = N.covariateName n α β o' i (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2)) : upperRawBox E N n α β o = upperRawBox E N n α β o' := by have hinputs : endpointInputs N n α β o (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) = endpointInputs N n α β o' (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) := by unfold endpointInputs simp_rw [hnames] have hexprs : endpointExpressions n (resolutions E N n α β).1 (resolutions E N n α β).2 o = endpointExpressions n (resolutions E N n α β).1 (resolutions E N n α β).2 o' := by unfold endpointExpressions coordinateExpressions simp_rw [hlabels] unfold upperRawBox endpointBoxes dsimp only rw [hinputs, hexprs]
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperRawBox_response_congr · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:239
theorem countable_response_preimage Lemma countable_response_preimage in the paper ↗

Any union of fibers of a measurable countable response code is measurable. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
A B C :
Type*
Countable B
A → B
A → C
hcode :
houtput :
∀ a a'
if
code a = code a'
then
output a = output a'
s :
Set C
MeasurableSet (output ⁻¹' s)
Proof (Lean source)
-- @node: countable_response_preimage lemma countable_response_preimage {A B C : Type*} [MeasurableSpace A] [MeasurableSpace B] [Countable B] [MeasurableSingletonClass B] {code : A → B} {output : A → C} (hcode : Measurable code) (houtput : ∀ a a', code a = code a' → output a = output a') (s : Set C) : MeasurableSet (output ⁻¹' s) := by have hfibers : output ⁻¹' s = ⋃ b ∈ {b | ∃ a, code a = b ∧ output a ∈ s}, code ⁻¹' {b} := by ext a simp only [Set.mem_preimage, Set.mem_iUnion, Set.mem_ofPred_eq, Set.mem_singleton_iff] constructor · intro ha exact ⟨code a, ⟨a, rfl, ha⟩, rfl⟩ · rintro ⟨b, ⟨a', ha', hs⟩, ha⟩ rw [houtput a a' (ha.trans ha'.symm)] exact hs rw [hfibers] exact MeasurableSet.biUnion (Set.to_countable _) fun b _ => hcode (measurableSet_singleton b)
CausalSmith.Stat.LogoddsLowsmoothFrontier.countable_response_preimage · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:265
theorem upperOutput_regular

Borelness follows from finite rational computations and the Borel supplied policy. Under the stated assumptions.

Formal statement
hN :
N.Admissible
n :
ℕ
α β :
ℝ
conclusion 1
Measurable (fun ω : Experiment n => upperOutput E N n α β ω.1)
conclusion 2
t :
ℝ
MeasurableSet {ω : Experiment n | t ∈ intervalSet (upperOutput E N n α β ω.1)}
conclusion 3
Measurable (fun ω : Experiment n => intervalLength (upperOutput E N n α β ω.1))
Proof (Lean source)
-- @node: upperOutput_regular lemma upperOutput_regular (E : ArithmeticEngine) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (α β : ℝ) : Measurable (fun ω : Experiment n => upperOutput E N n α β ω.1) ∧ (∀ t : ℝ, MeasurableSet {ω : Experiment n | t ∈ intervalSet (upperOutput E N n α β ω.1)}) ∧ Measurable (fun ω : Experiment n => intervalLength (upperOutput E N n α β ω.1)) := by let q := qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2 let code : Experiment n → Fin n → (Bool × Bool) × (ℚ × ℚ) := fun ω i => ((ω.1 i).2, (N.covariateName n α β ω.1 i q).lo, (N.covariateName n α β ω.1 i q).hi) have hcode : Measurable code := by apply measurable_pi_lambda intro i have hlabels : Measurable (fun ω : Experiment n => (ω.1 i).2) := by fun_prop have hnames : Measurable (fun ω : Experiment n => ((N.covariateName n α β ω.1 i q).lo, (N.covariateName n α β ω.1 i q).hi)) := by exact (hN.2.2.2 n i q).comp ((measurable_const (a := (α, β))).prodMk measurable_fst) exact hlabels.prodMk hnames have houtput : ∀ ω ω' : Experiment n, code ω = code ω' → upperOutput E N n α β ω.1 = upperOutput E N n α β ω'.1 := by intro ω ω' heq have hi (i : Fin n) := congrFun heq i have hraw : upperRawBox E N n α β ω.1 = upperRawBox E N n α β ω'.1 := by apply upperRawBox_response_congr · intro i exact congrArg fst (hi i) · intro i apply RatInterval.ext · exact congrArg (fun v => v.2.1) (hi i) · exact congrArg (fun v => v.2.2) (hi i) apply Subtype.ext simp only [upperOutput, hraw] refine ⟨?_, ?_, ?_⟩ · intro s hs exact countable_response_preimage hcode houtput s · intro t exact countable_response_preimage hcode houtput {B | t ∈ intervalSet B} · intro s hs exact countable_response_preimage hcode (fun ω ω' h => congrArg intervalLength (houtput ω ω' h)) s
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperOutput_regular · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:286

The literal represented algorithm, with no radius or nuisance input.

Definition (Lean source)
hN :
N.Admissible
n :
ℕ
α β :
ℝ
upperInterval E N hN n α β :
Procedure n
clause 1
output := fun ω => upperOutput E N n α β ω.1
clause 2
borel := (upperOutput_regular E N hN n α β).1
clause 3
coverage_measurable := (upperOutput_regular E N hN n α β).2.1
clause 4
length_measurable := (upperOutput_regular E N hN n α β).2.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperInterval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:328
def upperHandle

Canonical upper handle for the literal fixed-budget represented procedure.

Definition (Lean source)
hN :
N.Admissible
n :
ℕ
α β :
ℝ
upperHandle E N hN n α β :
Procedure n
upperInterval E N hN n α β
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperHandle · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:335

Sharp profile candidate, defined independently of the engine and policy.

Definition (Lean source)
rate :
ℕ → ℝ → ℝ → ℝ → ℝ
def frontierHandle

The rate and the actual supplied-engine interval family.

Definition (Lean source)
hN :
N.Admissible
frontierHandle E N hN :
(ℕ → ℝ → ℝ → ℝ → ℝ) × ((n : ℕ) → ℝ → ℝ → Procedure n)
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontierHandle · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Defs/Upper.lean:342
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CalibratedDensityDerivatives 5 declarations Affine amplitude slices do not increase derivative norms.

Amplitude derivative envelopes for calibrated densities

Affine amplitude slices do not increase derivative norms. The compact local cell envelopes therefore control the fully substituted density formulas.

theorem calibrated_affine_slice_derivative_bound Lemma calibrated_affine_slice_derivative_bound in the paper ↗

[Restricting a smooth local cell to a contractive affine amplitude slice cannot increase the norm of any fixed-order derivative. the documented result Under the stated assumptions.

Formal statement
f :
(Fin 3 → ℝ) → ℝ
L :
E →L[ℝ] (Fin 3 → ℝ)
c :
Fin 3 → ℝ
x :
E
m :
ℕ
hf :
ContDiffAt ℝ ∞ f (L x + c)
hL :
‖L‖ ≤ 1
‖iteratedFDeriv ℝ m (fun z => f (L z + c)) x‖ ≤ ‖iteratedFDeriv ℝ m f (L x + c)‖
Proof (Lean source)
-- @node: calibrated_affine_slice_derivative_bound lemma calibrated_affine_slice_derivative_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (f : (Fin 3 → ℝ) → ℝ) (L : E →L[ℝ] (Fin 3 → ℝ)) (c : Fin 3 → ℝ) (x : E) (m : ℕ) (hf : ContDiffAt ℝ ∞ f (L x + c)) (hL : ‖L‖ ≤ 1) : ‖iteratedFDeriv ℝ m (fun z => f (L z + c)) x‖ ≤ ‖iteratedFDeriv ℝ m f (L x + c)‖ := by let F : (Fin 3 → ℝ) → ℝ := fun z => f (z + c) have hF : ContDiffAt ℝ m F (L x) := by exact (hf.of_le (WithTop.coe_le_coe.mpr le_top)).comp (L x) (by fun_prop : ContDiffAt ℝ m (fun z : Fin 3 → ℝ => z+c) (L x)) obtain ⟨S, hS, hFS⟩ := hF.contDiffOn le_rfl (by simp) obtain ⟨D, hDS, hD, hxD⟩ := mem_nhds_iff.mp hS have hpre : IsOpen (L ⁻¹' D) := hD.preimage L.continuous have heq := L.iteratedFDerivWithin_comp_right (hFS.mono hDS) hD.uniqueDiffOn hpre.uniqueDiffOn hxD (i := m) le_rfl rw [iteratedFDerivWithin_of_isOpen m hpre (show x ∈ L ⁻¹' D from hxD), iteratedFDerivWithin_of_isOpen m hD hxD] at heq change iteratedFDeriv ℝ m (fun z => f (L z + c)) x = _ at heq rw [heq] calc _ ≤ ‖iteratedFDeriv ℝ m F (L x)‖ * ∏ _ : Fin m, ‖L‖ := ContinuousMultilinearMap.norm_compContinuousLinearMap_le _ _ _ ≤ ‖iteratedFDeriv ℝ m F (L x)‖ * ∏ _ : Fin m, (1 : ℝ) := by gcongr _ = ‖iteratedFDeriv ℝ m f (L x + c)‖ := by rw [show iteratedFDeriv ℝ m F (L x) = iteratedFDeriv ℝ m f (L x + c) from iteratedFDeriv_comp_add_right m c (L x)] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_affine_slice_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedDensityDerivatives.lean:17
theorem calibrated_mixed_slice_derivative_bound Lemma calibrated_mixed_slice_derivative_bound in the paper ↗

[The mixed amplitude plane is a contractive slice of the full local parameter space, with the spatial coordinate held fixed. the documented result Under the stated assumptions.

Formal statement
f :
(Fin 3 → ℝ) → ℝ
v :
Fin 2 → ℝ
u :
ℝ
m :
ℕ
hf :
ContDiffAt ℝ ∞ f ![v 0, v 1, u]
‖iteratedFDeriv ℝ m (fun w : Fin 2 → ℝ => f ![w 0, w 1, u]) v‖
≤ ‖iteratedFDeriv ℝ m f ![v 0, v 1, u]‖
Proof (Lean source)
-- @node: calibrated_mixed_slice_derivative_bound lemma calibrated_mixed_slice_derivative_bound (f : (Fin 3 → ℝ) → ℝ) (v : Fin 2 → ℝ) (u : ℝ) (m : ℕ) (hf : ContDiffAt ℝ ∞ f ![v 0, v 1, u]) : ‖iteratedFDeriv ℝ m (fun w : Fin 2 → ℝ => f ![w 0, w 1, u]) v‖ ≤ ‖iteratedFDeriv ℝ m f ![v 0, v 1, u]‖ := by let L : (Fin 2 → ℝ) →L[ℝ] (Fin 3 → ℝ) := ContinuousLinearMap.pi ![ContinuousLinearMap.proj 0, ContinuousLinearMap.proj 1, 0] let c : Fin 3 → ℝ := ![0, 0, u] have heq (w : Fin 2 → ℝ) : L w + c = ![w 0, w 1, u] := by ext i simp only [L, c, Pi.add_apply, ContinuousLinearMap.pi_apply] fin_cases i <;> norm_num have hL : ‖L‖ ≤ 1 := by refine L.opNorm_le_bound (by norm_num) ?_ intro w rw [one_mul] apply (pi_norm_le_iff_of_nonneg (norm_nonneg w)).mpr intro i simp only [L, ContinuousLinearMap.pi_apply] fin_cases i <;> simp only [Fin.isValue, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, ContinuousLinearMap.proj_apply, ContinuousLinearMap.zero_apply] · change ‖w 0‖ ≤ ‖w‖ exact norm_le_pi_norm w 0 · change ‖w 1‖ ≤ ‖w‖ exact norm_le_pi_norm w 1 · change ‖(0 : ℝ)‖ ≤ ‖w‖ simpa using norm_nonneg w simpa only [heq] using calibrated_affine_slice_derivative_bound f L c v m (by simpa only [heq] using hf) hL
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_mixed_slice_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedDensityDerivatives.lean:50
theorem calibrated_fair_slice_derivative_bound Lemma calibrated_fair_slice_derivative_bound in the paper ↗

[The fair amplitude line is a contractive slice, with effect and spatial coordinate held fixed. the documented result Under the stated assumptions.

Formal statement
f :
(Fin 3 → ℝ) → ℝ
t δ u :
ℝ
m :
ℕ
hf :
ContDiffAt ℝ ∞ f ![t, δ, u]
‖iteratedFDeriv ℝ m (fun d : ℝ => f ![t, d, u]) δ‖ ≤ ‖iteratedFDeriv ℝ m f ![t, δ, u]‖
Proof (Lean source)
-- @node: calibrated_fair_slice_derivative_bound lemma calibrated_fair_slice_derivative_bound (f : (Fin 3 → ℝ) → ℝ) (t δ u : ℝ) (m : ℕ) (hf : ContDiffAt ℝ ∞ f ![t, δ, u]) : ‖iteratedFDeriv ℝ m (fun d : ℝ => f ![t, d, u]) δ‖ ≤ ‖iteratedFDeriv ℝ m f ![t, δ, u]‖ := by let L : ℝ →L[ℝ] (Fin 3 → ℝ) := ContinuousLinearMap.pi ![0, id ℝ ℝ, 0] let c : Fin 3 → ℝ := ![t, 0, u] have heq (d : ℝ) : L d + c = ![t, d, u] := by ext i simp only [L, c, Pi.add_apply, ContinuousLinearMap.pi_apply] fin_cases i <;> norm_num have hL : ‖L‖ ≤ 1 := by refine L.opNorm_le_bound (by norm_num) ?_ intro d rw [one_mul] apply (pi_norm_le_iff_of_nonneg (norm_nonneg d)).mpr intro i simp only [L, ContinuousLinearMap.pi_apply] fin_cases i <;> simp only [Fin.isValue, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, ContinuousLinearMap.id_apply, ContinuousLinearMap.zero_apply] · change ‖(0 : ℝ)‖ ≤ ‖d‖ simpa using norm_nonneg d · change ‖d‖ ≤ ‖d‖ exact le_rfl · change ‖(0 : ℝ)‖ ≤ ‖d‖ simpa using norm_nonneg d simpa only [heq] using calibrated_affine_slice_derivative_bound f L c δ m (by simpa only [heq] using hf) hL
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_fair_slice_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedDensityDerivatives.lean:83
theorem calibrated_density_rescale_derivative_bound Lemma calibrated_density_rescale_derivative_bound in the paper ↗

[Passing from a cell probability to its uniform-label relative density multiplies every amplitude derivative envelope by four. the documented result Under the stated assumptions.

Formal statement
f :
E → ℝ
x :
E
m :
ℕ
B :
ℝ
hf :
ContDiffAt ℝ ∞ f x
hB :
‖iteratedFDeriv ℝ m f x‖ ≤ B
‖iteratedFDeriv ℝ m (fun z => 4 * f z) x‖ ≤ 4 * B
Proof (Lean source)
-- @node: calibrated_density_rescale_derivative_bound lemma calibrated_density_rescale_derivative_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (f : E → ℝ) (x : E) (m : ℕ) (B : ℝ) (hf : ContDiffAt ℝ ∞ f x) (hB : ‖iteratedFDeriv ℝ m f x‖ ≤ B) : ‖iteratedFDeriv ℝ m (fun z => 4 * f z) x‖ ≤ 4 * B := by change ‖iteratedFDeriv ℝ m (fun z => (4 : ℝ) • f z) x‖ ≤ 4 * B rw [iteratedFDeriv_const_smul_apply' (hf.of_le (WithTop.coe_le_coe.mpr le_top)), norm_smul] norm_num linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_density_rescale_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedDensityDerivatives.lean:116
theorem calibrated_local_density_derivative_envelopes Lemma calibrated_local_density_derivative_envelopes in the paper ↗

Compact local calibration boxes give a common finite envelope for the first two derivatives of both relative-density amplitude slices. the documented result

Formal statement
∃ r M : ℝ,
0 < r
1 ≤ M
conclusion 1
η ζ u :
ℝ
|η| ≤ r
|ζ| ≤ r
u ∈ Icc (0 : ℝ) 1
b s a y :
m :
ℕ
1 ≤ m
m ≤ 2
‖iteratedFDeriv ℝ m (fun w : Fin 2 → ℝ => 4 * localMixedCell b s a y ![w 0, w 1, u]) ![η, ζ]‖
≤ M
conclusion 2
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ r
u ∈ Icc (0 : ℝ) 1
b s a y :
m :
ℕ
1 ≤ m
m ≤ 2
‖iteratedFDeriv ℝ m (fun d : ℝ => 4 * localFairCell b s a y ![t, d, u]) δ‖ ≤ M
Proof (Lean source)
-- @node: calibrated_local_density_derivative_envelopes lemma calibrated_local_density_derivative_envelopes : ∃ r M : ℝ, 0 < r ∧ 1 ≤ M ∧ (∀ η ζ u : ℝ, |η| ≤ r → |ζ| ≤ r → u ∈ Icc (0 : ℝ) 1 → ∀ b s a y, ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fun w : Fin 2 → ℝ => 4 * localMixedCell b s a y ![w 0, w 1, u]) ![η, ζ]‖ ≤ M) ∧ (∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ r → u ∈ Icc (0 : ℝ) 1 → ∀ b s a y, ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fun d : ℝ => 4 * localFairCell b s a y ![t, d, u]) δ‖ ≤ M) := by obtain ⟨rm, hrm, hsm, hbm⟩ := localMixedCell_uniform_smooth_derivative_bounds obtain ⟨rf, hrf, hsmall, hsf⟩ := fairRoot_uniform_contDiffAt obtain ⟨_, hbf⟩ := localFairCell_smooth_derivative_bounds_of_root rf hsmall hsf obtain ⟨Bm1, hBm1, hm1⟩ := hbm 1 obtain ⟨Bm2, hBm2, hm2⟩ := hbm 2 obtain ⟨Bf1, hBf1, hf1⟩ := hbf 1 obtain ⟨Bf2, hBf2, hf2⟩ := hbf 2 let M := 4 * (Bm1 + Bm2 + Bf1 + Bf2) + 1 have hM : 1 ≤ M := by dsimp [M]; linarith refine ⟨min rm rf, M, lt_min hrm hrf, hM, ?_, ?_⟩ · intro η ζ u hη hζ hu b s a y m hmlo hmhi have hv : ![η, ζ, u] ∈ mixedParameterRegion rm := ⟨hη.trans (min_le_left _ _), hζ.trans (min_le_left _ _), hu⟩ have hs : ContDiffAt ℝ ∞ (localMixedCell b s a y) ![η, ζ, u] := (hsm _ hv b s a y).of_le le_top have hslice : ContDiffAt ℝ ∞ (fun w : Fin 2 → ℝ => localMixedCell b s a y ![w 0, w 1, u]) ![η, ζ] := by exact hs.comp ![η, ζ] (show ContDiffAt ℝ ∞ (fun w : Fin 2 → ℝ => ![w 0, w 1, u]) ![η, ζ] from by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) have hfull : ‖iteratedFDeriv ℝ m (localMixedCell b s a y) ![η, ζ, u]‖ ≤ Bm1 + Bm2 := by have hm : m = 1 ∨ m = 2 := by omega rcases hm with rfl | rfl · exact (hm1 _ hv b s a y).trans (by linarith) · exact (hm2 _ hv b s a y).trans (by linarith) have hsliceBound := (calibrated_mixed_slice_derivative_bound _ ![η, ζ] u m hs).trans hfull exact (calibrated_density_rescale_derivative_bound _ _ m _ hslice hsliceBound).trans (by dsimp [M]; linarith) · intro t δ u ht hδ hu b s a y m hmlo hmhi have hv : ![t, δ, u] ∈ fairParameterRegion rf := ⟨ht, hδ.trans (min_le_right _ _), hu⟩ have hs := localFairCell_contDiffAt_of_root _ ht (hv.2.1.trans hsmall) (hsf _ hv) b s a y have hslice : ContDiffAt ℝ ∞ (fun d : ℝ => localFairCell b s a y ![t, d, u]) δ := by have hmap : ContDiffAt ℝ ∞ (fun d : ℝ => ![t, d, u]) δ := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hcomp := hs.comp δ hmap exact hcomp have hfull : ‖iteratedFDeriv ℝ m (localFairCell b s a y) ![t, δ, u]‖ ≤ Bf1 + Bf2 := by have hm : m = 1 ∨ m = 2 := by omega rcases hm with rfl | rfl · exact ((hf1 _ hv).2 b s a y).trans (by linarith) · exact ((hf2 _ hv).2 b s a y).trans (by linarith) have hsliceBound := (calibrated_fair_slice_derivative_bound _ t δ u m hs).trans hfull exact (calibrated_density_rescale_derivative_bound _ _ m _ hslice hsliceBound).trans (by dsimp [M]; linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_local_density_derivative_envelopes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedDensityDerivatives.lean:130
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CalibratedEffects 6 declarations Positive four-cell odds identify the native logit contrast.

Homogeneous effects of the calibrated laws

Positive four-cell odds identify the native logit contrast. The mixed covariance branch and the fair risk shift therefore give the effects of the actual laws, provided their continuous cell tables are valid.

theorem cell_odds_logit_difference

Positive cells turn their odds ratio into the native conditional logit contrast. Under the stated assumptions. Under the stated assumptions.

Formal statement
x :
t :
ℝ
h :
P.cells true true x * P.cells false false x
= exp t * (P.cells true false x * P.cells false true x)
logit (armRisk P true x) - logit (armRisk P false x) = t
Proof (Lean source)
-- @node: cell_odds_logit_difference lemma cell_odds_logit_difference (P : ObservedLaw) (x : Covariate) (t : ℝ) (h : P.cells true true x * P.cells false false x = exp t * (P.cells true false x * P.cells false true x)) : logit (armRisk P true x) - logit (armRisk P false x) = t := by have h0 := armRisk_interior P false x have h1 := armRisk_interior P true x have h00 := (P.interior_cells false false x).1 have h01 := (P.interior_cells false true x).1 have h10 := (P.interior_cells true false x).1 have h11 := (P.interior_cells true true x).1 apply Real.exp_injective rw [Real.exp_sub, logit, logit, Real.exp_log (div_pos h1.1 (sub_pos.mpr h1.2)), Real.exp_log (div_pos h0.1 (sub_pos.mpr h0.2))] unfold armRisk field_simp [ne_of_gt h00, ne_of_gt h01, ne_of_gt h10, ne_of_gt h11, ne_of_gt (add_pos h00 h01), ne_of_gt (add_pos h10 h11)] nlinarith [h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_odds_logit_difference · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedEffects.lean:15
theorem homogeneous_effect_of_cell_odds

[A common conditional cell odds coefficient is the law's scalar effect and makes its native logistic regression homogeneous. the documented result Under the stated assumptions.

Formal statement
t :
ℝ
h :
∀ x,
P.cells true true x * P.cells false false x
= exp t * (P.cells true false x * P.cells false true x)
conclusion 1
effect P = t
conclusion 2
Proof (Lean source)
-- @node: homogeneous_effect_of_cell_odds lemma homogeneous_effect_of_cell_odds (P : ObservedLaw) (t : ℝ) (h : ∀ x, P.cells true true x * P.cells false false x = exp t * (P.cells true false x * P.cells false true x)) : effect P = t ∧ HomogeneousLogit P := by have hd (x : Covariate) := cell_odds_logit_difference P x t (h x) have he : effect P = t := hd ⟨0, le_rfl, zero_le_one⟩ refine ⟨he, ?_⟩ intro x rw [he] have ha : prognosisLogit P x + t = logit (armRisk P true x) := by change logit (armRisk P false x) + t = _ linarith [hd x] rw [ha] exact (logistic_logit _ (armRisk_interior P true x).1 (armRisk_interior P true x).2).symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.homogeneous_effect_of_cell_odds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedEffects.lean:36
theorem totalCellLaw_cells_of_valid Lemma totalCellLaw_cells_of_valid in the paper ↗

Valid totalized cells retain the literal supplied table. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
p :
Bool → Bool → Covariate → ℝ
hp :
Proof (Lean source)
-- @node: totalCellLaw_cells_of_valid lemma totalCellLaw_cells_of_valid (p : Bool → Bool → Covariate → ℝ) (hp : ValidCells p) : (totalCellLaw p).cells = p := by rw [totalCellLaw, dif_pos hp] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.totalCellLaw_cells_of_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedEffects.lean:55

Logistic risk shifting multiplies the risk odds by the exponential effect. Under the stated assumptions.

Formal statement
t ξ :
ℝ
hξ :
0 < ξ
hξ1 :
ξ < 1
riskShift t ξ * (1-ξ) = exp t * ((1-riskShift t ξ)*ξ)
Proof (Lean source)
-- @node: riskShift_cross_odds lemma riskShift_cross_odds (t ξ : ℝ) (hξ : 0 < ξ) (hξ1 : ξ < 1) : riskShift t ξ * (1-ξ) = exp t * ((1-riskShift t ξ)*ξ) := by have hden : 0 < 1+(exp t-1)*ξ := by have he := Real.exp_pos t nlinarith [mul_pos he hξ] have hn : 1-ξ+ξ*exp t ≠ 0 := by nlinarith [hden] unfold riskShift field_simp [ne_of_gt hden, hn] ring_nf nlinarith [mul_inv_cancel₀ hn]
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_cross_odds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedEffects.lean:62
theorem fairCells_homogeneous_effect

[Every valid fair table has its prescribed scalar effect, including the comparator's effect, and is homogeneous at every covariate. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
hδ :
|δ| ≤ 1/100
hv :
ValidCells (fairCells b k σ t δ)
conclusion 1
effect (totalCellLaw (fairCells b k σ t δ)) = (if b then t else comparatorEffect t δ)
conclusion 2
Proof (Lean source)
-- @node: fairCells_homogeneous_effect lemma fairCells_homogeneous_effect (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (hδ : |δ| ≤ 1/100) (hv : ValidCells (fairCells b k σ t δ)) : effect (totalCellLaw (fairCells b k σ t δ)) = (if b then t else comparatorEffect t δ) ∧ HomogeneousLogit (totalCellLaw (fairCells b k σ t δ)) := by apply homogeneous_effect_of_cell_odds intro x rw [totalCellLaw_cells_of_valid _ hv] have hμ := fair_control_risk_bounds b k σ t δ x hδ have h := riskShift_cross_odds (if b then t else comparatorEffect t δ) (if b then fairRoot t δ (cellCoord k x)+δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x)) (by linarith [hμ.1]) (by linarith [hμ.2]) simp only [fairCells, Bool.false_eq_true, ↓reduceIte] nlinarith [h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_homogeneous_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedEffects.lean:75
theorem mixedCells_homogeneous_effect

[Every valid mixed table has the null or calibrated effect, and its logit coefficient is homogeneous throughout the covariate interval. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hv :
ValidCells (mixedCells b k σ η ζ)
conclusion 1
effect (mixedLaw b k σ η ζ) = (if b then 32*η*ζ else 0)
conclusion 2
HomogeneousLogit (mixedLaw b k σ η ζ)
Proof (Lean source)
-- @node: mixedCells_homogeneous_effect lemma mixedCells_homogeneous_effect (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hv : ValidCells (mixedCells b k σ η ζ)) : effect (mixedLaw b k σ η ζ) = (if b then 32*η*ζ else 0) ∧ HomogeneousLogit (mixedLaw b k σ η ζ) := by apply homogeneous_effect_of_cell_odds intro x simp only [mixedLaw, totalCellLaw_cells_of_valid _ hv] obtain ⟨he, hm⟩ := mixed_margin_bounds b k σ η ζ x hη hζ cases b · simp only [mixedCells, Bool.false_eq_true, ↓reduceIte, Real.exp_zero, one_mul, tableCell] ring · have ht : |32*η*ζ| ≤ 1/8 := by rw [abs_mul, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 32)] have h := mul_le_mul hη hζ (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1/100) nlinarith simp only [Bool.false_eq_true, ↓reduceIte] at he hm ⊢ have hr := covarianceBranch_odds_ratio (32*η*ζ) (1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x) (1/2+ζ*signFieldZ k σ x) ht (by linarith) (by linarith) have hp := covarianceBranch_table_positive (32*η*ζ) (1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x) (1/2+ζ*signFieldZ k σ x) ht (by linarith) (by linarith) simpa only [mixedCells, ↓reduceIte] using (div_eq_iff (ne_of_gt (mul_pos (hp true false) (hp false true)))).mp hr
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_homogeneous_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedEffects.lean:93
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CalibratedHolderModulus 4 declarations The roadmap's two-scale modulus argument turns a global Lipschitz bound and an oscillation bound into the exact prescribed Hölder radius.

Global Hölder modulus for calibrated supports

The roadmap's two-scale modulus argument turns a global Lipschitz bound and an oscillation bound into the exact prescribed Hölder radius. It includes exponent one and requires no derivative matching at cell endpoints.

theorem calibrated_two_scale_power Lemma calibrated_two_scale_power in the paper ↗

[Below unit scale, the linear modulus is bounded by every legal Hölder power; above unit scale, the constant modulus is bounded by that power. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
r γ :
ℝ
hr :
0 ≤ r
hγ :
0 < γ
hγ1 :
γ ≤ 1
min r 1 ≤ r ^ γ
Proof (Lean source)
-- @node: calibrated_two_scale_power lemma calibrated_two_scale_power (r γ : ℝ) (hr : 0 ≤ r) (hγ : 0 < γ) (hγ1 : γ ≤ 1) : min r 1 ≤ r ^ γ := by by_cases hsmall : r ≤ 1 · rw [min_eq_left hsmall] simpa only [Real.rpow_one] using Real.rpow_le_rpow_of_exponent_ge' hr hsmall hγ.le hγ1 · rw [min_eq_right (le_of_not_ge hsmall)] exact Real.one_le_rpow (le_of_not_ge hsmall) hγ.le
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_two_scale_power · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedHolderModulus.lean:15
theorem calibrated_holder_modulus Lemma calibrated_holder_modulus in the paper ↗

A Lipschitz modulus at cell scale and a uniform oscillation modulus give an exponent-uniform Hölder bound after cancelling the rate-scaled amplitude. the documented result Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
f :
Covariate → ℝ
γ :
ℝ
k :
ℕ
hk :
1 ≤ k
hγ :
0 < γ
hγ1 :
γ ≤ 1
hlin :
∀ x z, |f x - f z| ≤ (k : ℝ) ^ (1-γ) * |(x : ℝ)-(z : ℝ)|
hamp :
∀ x z, |f x - f z| ≤ 2 * (k : ℝ) ^ (-γ)
holderSeminorm γ f ≤ 2
Proof (Lean source)
-- @node: calibrated_holder_modulus lemma calibrated_holder_modulus (f : Covariate → ℝ) (γ : ℝ) (k : ℕ) (hk : 1 ≤ k) (hγ : 0 < γ) (hγ1 : γ ≤ 1) (hlin : ∀ x z, |f x - f z| ≤ (k : ℝ) ^ (1-γ) * |(x : ℝ)-(z : ℝ)|) (hamp : ∀ x z, |f x - f z| ≤ 2 * (k : ℝ) ^ (-γ)) : holderSeminorm γ f ≤ 2 := by have hkpos : 0 < (k : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hknonneg := hkpos.le have hcancel : (k : ℝ) ^ (-γ) * (k : ℝ) ^ γ = 1 := by rw [← Real.rpow_add hkpos, neg_add_cancel, Real.rpow_zero] have hlinear : (k : ℝ) ^ (1-γ) = (k : ℝ) ^ (-γ) * (k : ℝ) := by calc (k : ℝ) ^ (1-γ) = (k : ℝ) ^ (-γ+1) := by congr 1; ring _ = (k : ℝ) ^ (-γ) * (k : ℝ) := by rw [Real.rpow_add hkpos, Real.rpow_one] have hmod : ∀ x z : Covariate, |f x-f z| ≤ 2 * |(x : ℝ)-(z : ℝ)| ^ γ := by intro x z let d : ℝ := |(x : ℝ)-(z : ℝ)| have hd : 0 ≤ d := abs_nonneg _ have hscale : (k : ℝ) * d ≤ ((k : ℝ) * d) ^ γ ∨ 1 ≤ ((k : ℝ) * d) ^ γ := by by_cases hs : (k : ℝ) * d ≤ 1 · left simpa [min_eq_left hs] using calibrated_two_scale_power ((k : ℝ)*d) γ (mul_nonneg hknonneg hd) hγ hγ1 · right simpa [min_eq_right (le_of_not_ge hs)] using calibrated_two_scale_power ((k : ℝ)*d) γ (mul_nonneg hknonneg hd) hγ hγ1 have hpow : (k : ℝ) ^ (-γ) * ((k : ℝ) * d) ^ γ = d ^ γ := by rw [Real.mul_rpow hknonneg hd, ← mul_assoc, hcancel, one_mul] rcases hscale with hs | hs · calc |f x-f z| ≤ (k : ℝ) ^ (1-γ) * d := hlin x z _ = (k : ℝ) ^ (-γ) * ((k : ℝ)*d) := by rw [hlinear]; ring _ ≤ (k : ℝ) ^ (-γ) * ((k : ℝ)*d) ^ γ := mul_le_mul_of_nonneg_left hs (Real.rpow_nonneg hknonneg _) _ = d ^ γ := hpow _ ≤ 2 * d ^ γ := by nlinarith [Real.rpow_nonneg hd γ] · calc |f x-f z| ≤ 2 * (k : ℝ) ^ (-γ) := hamp x z _ ≤ 2 * (k : ℝ) ^ (-γ) * ((k : ℝ)*d) ^ γ := le_mul_of_one_le_right (by positivity) hs _ = 2 * d ^ γ := by rw [mul_assoc, hpow] exact (holderSeminorm_le_of_pointwise γ 2 f hmod).trans (by norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_holder_modulus · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedHolderModulus.lean:28
structure CalibratedModelBounds

[Remaining construction obligations before applying the global modulus argument: the five non-Hölder model properties and the two scale bounds for each native logit. These are proof obligations, not additional model premises.

Definition (Lean source)
α β :
ℝ
k :
ℕ
uniform :
homogeneous :
effect_envelope :
propensity_envelope :
prognosis_envelope :
propensity_linear :
∀ x z, |propensityLogit P x-propensityLogit P z| ≤ (k : ℝ) ^ (1-α) * |(x : ℝ)-(z : ℝ)|
propensity_oscillation :
∀ x z, |propensityLogit P x-propensityLogit P z| ≤ 2 * (k : ℝ) ^ (-α)
prognosis_linear :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ (k : ℝ) ^ (1-β) * |(x : ℝ)-(z : ℝ)|
prognosis_oscillation :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ 2 * (k : ℝ) ^ (-β)
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibratedModelBounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedHolderModulus.lean:74
theorem calibrated_model_of_bounds

The two-scale native-logit bounds discharge both exact Hölder radii of the paper model, uniformly over the public exponent domain. the documented result Under the stated assumptions.

Formal statement
α β :
ℝ
k :
ℕ
hab :
hk :
1 ≤ k
h :
Model α β P
Proof (Lean source)
-- @node: calibrated_model_of_bounds lemma calibrated_model_of_bounds (α β : ℝ) (k : ℕ) (P : ObservedLaw) (hab : ExponentDomain α β) (hk : 1 ≤ k) (h : CalibratedModelBounds α β k P) : Model α β P := by refine ⟨h.uniform, h.homogeneous, h.effect_envelope, h.propensity_envelope, h.prognosis_envelope, ?_, ?_⟩ · exact calibrated_holder_modulus _ α k hk (hab.1.trans hab.2.2.1) hab.2.2.2 h.propensity_linear h.propensity_oscillation · exact calibrated_holder_modulus _ β k hk hab.1 (hab.2.1.le.trans (by norm_num)) h.prognosis_linear h.prognosis_oscillation
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_model_of_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedHolderModulus.lean:93
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CalibratedModelProperties 13 declarations The explicit cells give uniform covariate design, homogeneous scalar effects, and the required effect envelopes.

Basic model properties of the calibrated constructions

The explicit cells give uniform covariate design, homogeneous scalar effects, and the required effect envelopes. Fair treatment is exactly balanced. Only native logit envelopes and spatial scale bounds remain in the reduced assembly.

[Totalization retains the public uniform design, even on fallback inputs. the stated conclusion holds.

Formal statement
p :
Bool → Bool → Covariate → ℝ
Measure.map covariate (totalCellLaw p).measure = uniformLaw
Proof (Lean source)
-- @node: totalCellLaw_uniform lemma totalCellLaw_uniform (p : Bool → Bool → Covariate → ℝ) : Measure.map covariate (totalCellLaw p).measure = uniformLaw := by classical unfold totalCellLaw split · rename_i hp change Measure.map covariate (jointLaw uniformLaw p) = uniformLaw exact jointLaw_uniform p hp · change Measure.map covariate (jointLaw uniformLaw (fun _ _ _ => 1/4)) = uniformLaw exact jointLaw_uniform _ fairDefault_valid
CausalSmith.Stat.LogoddsLowsmoothFrontier.totalCellLaw_uniform · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:16
theorem fairCells_propensity_half Lemma fairCells_propensity_half in the paper ↗

Fair tables have exactly balanced treatment, including totalization fallback. Under the stated assumptions. The stated conclusion follows.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
x :
propensity (totalCellLaw (fairCells b k σ t δ)) x = 1/2
Proof (Lean source)
-- @node: fairCells_propensity_half lemma fairCells_propensity_half (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (x : Covariate) : propensity (totalCellLaw (fairCells b k σ t δ)) x = 1/2 := by classical unfold totalCellLaw split · change fairCells b k σ t δ true false x + fairCells b k σ t δ true true x = _ simp only [fairCells, Bool.false_eq_true, ↓reduceIte] ring · norm_num [propensity, lawFromCells]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_propensity_half · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:29
theorem fairCells_propensityLogit_zero Lemma fairCells_propensityLogit_zero in the paper ↗

Exact fair treatment balance makes the native propensity logit zero. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
x :
propensityLogit (totalCellLaw (fairCells b k σ t δ)) x = 0
Proof (Lean source)
-- @node: fairCells_propensityLogit_zero lemma fairCells_propensityLogit_zero (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (x : Covariate) : propensityLogit (totalCellLaw (fairCells b k σ t δ)) x = 0 := by rw [propensityLogit, fairCells_propensity_half] norm_num [logit]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_propensityLogit_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:42
theorem fairCells_propensity_bounds

Fair supports satisfy the propensity envelope and both spatial scale bounds at every exponent and rank, because their propensity logit vanishes. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ α :
ℝ
conclusion 1
conclusion 2
x z :
≤ (k : ℝ)^(1-α) * |(x : ℝ)-(z : ℝ)|
conclusion 3
x z :
≤ 2*(k : ℝ)^(-α)
Proof (Lean source)
-- @node: fairCells_propensity_bounds lemma fairCells_propensity_bounds (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ α : ℝ) : PropensityEnvelope (totalCellLaw (fairCells b k σ t δ)) ∧ (∀ x z, |propensityLogit (totalCellLaw (fairCells b k σ t δ)) x - propensityLogit (totalCellLaw (fairCells b k σ t δ)) z| ≤ (k : ℝ)^(1-α) * |(x : ℝ)-(z : ℝ)|) ∧ (∀ x z, |propensityLogit (totalCellLaw (fairCells b k σ t δ)) x - propensityLogit (totalCellLaw (fairCells b k σ t δ)) z| ≤ 2*(k : ℝ)^(-α)) := by refine ⟨?_, ?_, ?_⟩ · intro x rw [fairCells_propensityLogit_zero] norm_num · intro x z rw [fairCells_propensityLogit_zero, fairCells_propensityLogit_zero] simp only [sub_self, abs_zero] positivity · intro x z rw [fairCells_propensityLogit_zero, fairCells_propensityLogit_zero] simp only [sub_self, abs_zero] positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_propensity_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:50
theorem mixedCells_basic_model_properties

[The mixed effect from cell odds stays in the model envelope on the signed calibration square; uniform design and homogeneity hold for every valid table. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hv :
ValidCells (mixedCells b k σ η ζ)
conclusion 1
UniformDesign (mixedLaw b k σ η ζ)
conclusion 2
HomogeneousLogit (mixedLaw b k σ η ζ)
conclusion 3
EffectEnvelope (mixedLaw b k σ η ζ)
Proof (Lean source)
-- @node: mixedCells_basic_model_properties lemma mixedCells_basic_model_properties (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hv : ValidCells (mixedCells b k σ η ζ)) : UniformDesign (mixedLaw b k σ η ζ) ∧ HomogeneousLogit (mixedLaw b k σ η ζ) ∧ EffectEnvelope (mixedLaw b k σ η ζ) := by obtain ⟨he,hh⟩ := mixedCells_homogeneous_effect b k σ η ζ hη hζ hv refine ⟨totalCellLaw_uniform _, hh, ?_⟩ change |effect (mixedLaw b k σ η ζ)| ≤ 1/2 rw [he] cases b · norm_num · simp only [↓reduceIte, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 32)] have h := mul_le_mul hη hζ (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1/100) nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_basic_model_properties · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:73
theorem fairCells_basic_model_properties

[Fair effects and comparator effects lie in the model envelope, as follows from exact cell odds and the calibrated comparator range. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hv :
ValidCells (fairCells b k σ t δ)
conclusion 1
conclusion 2
conclusion 3
Proof (Lean source)
-- @node: fairCells_basic_model_properties lemma fairCells_basic_model_properties (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hv : ValidCells (fairCells b k σ t δ)) : UniformDesign (totalCellLaw (fairCells b k σ t δ)) ∧ HomogeneousLogit (totalCellLaw (fairCells b k σ t δ)) ∧ EffectEnvelope (totalCellLaw (fairCells b k σ t δ)) := by obtain ⟨he,hh⟩ := fairCells_homogeneous_effect b k σ t δ hδ hv refine ⟨totalCellLaw_uniform _, hh, ?_⟩ change |effect (totalCellLaw (fairCells b k σ t δ))| ≤ 1/2 rw [he] obtain ⟨hlo,hhi⟩ := comparatorEffect_range_bounds t δ ht hδ cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] · rw [abs_of_nonneg (by linarith : 0 ≤ comparatorEffect t δ)] linarith [ht.2] · rw [abs_of_nonneg ht.1] linarith [ht.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_basic_model_properties · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:91
theorem calibrated_logit_abs_le_one Lemma calibrated_logit_abs_le_one in the paper ↗

[Interior probabilities between one third and two thirds have native logit magnitude at most one, using the two elementary logarithm bounds. the documented result Under the stated assumptions.

Formal statement
p :
ℝ
hp :
p ∈ Icc (1/3 : ℝ) (2/3)
|logit p| ≤ 1
Proof (Lean source)
-- @node: calibrated_logit_abs_le_one lemma calibrated_logit_abs_le_one (p : ℝ) (hp : p ∈ Icc (1/3 : ℝ) (2/3)) : |logit p| ≤ 1 := by have hpos : 0 < p := by linarith [hp.1] have hc : 0 < 1-p := by linarith [hp.2] have hlo : (1/2 : ℝ) ≤ p/(1-p) := (le_div_iff₀ hc).mpr (by linarith [hp.1]) have hhi : p/(1-p) ≤ 2 := (div_le_iff₀ hc).mpr (by linarith [hp.2]) have hi : (p/(1-p))⁻¹ ≤ 2 := by rw [inv_div] apply (div_le_iff₀ hpos).mpr linarith [hp.1] have hl := Real.one_sub_inv_le_log_of_pos (div_pos hpos hc) have hu := Real.log_le_sub_one_of_pos (div_pos hpos hc) change |log (p/(1-p))| ≤ 1 exact abs_le.mpr ⟨by linarith, by linarith⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_logit_abs_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:111
theorem mixed_table_control_risk_bounds Lemma mixed_table_control_risk_bounds in the paper ↗

Small covariance and centered margins keep the table's control risk between one third and two thirds. the documented result Under the stated assumptions.

Formal statement
e m c :
ℝ
he :
|e-1/2| ≤ 1/40
hm :
|m-1/2| ≤ 1/40
hc :
|c| ≤ 1/24
tableCell e m c false true / (tableCell e m c false false + tableCell e m c false true) ∈ Icc (1/3 : ℝ) (2/3)
Proof (Lean source)
-- @node: mixed_table_control_risk_bounds lemma mixed_table_control_risk_bounds (e m c : ℝ) (he : |e-1/2| ≤ 1/40) (hm : |m-1/2| ≤ 1/40) (hc : |c| ≤ 1/24) : tableCell e m c false true / (tableCell e m c false false + tableCell e m c false true) ∈ Icc (1/3 : ℝ) (2/3) := by obtain ⟨helo,hehi⟩ := abs_le.mp he obtain ⟨hmlo,hmhi⟩ := abs_le.mp hm obtain ⟨hclo,hchi⟩ := abs_le.mp hc have hd : 0 < 1-e := by linarith simp only [tableCell, Bool.false_eq_true, ↓reduceIte] have hn : (1-e)*(1-m)+c+((1-e)*m-c) = 1-e := by ring rw [hn] constructor · apply (le_div_iff₀ hd).mpr nlinarith [mul_nonneg (show 0 ≤ 1-e by linarith) (show 0 ≤ m-19/40 by linarith)] · apply (div_le_iff₀ hd).mpr nlinarith [mul_nonneg (show 0 ≤ 1-e by linarith) (show 0 ≤ 21/40-m by linarith)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_table_control_risk_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:129
theorem mixedCells_logit_envelopes

[Both mixed native logit envelopes follow from the centered margins and small calibrated covariance on the fixed signed support square. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hv :
ValidCells (mixedCells b k σ η ζ)
conclusion 1
conclusion 2
Proof (Lean source)
-- @node: mixedCells_logit_envelopes lemma mixedCells_logit_envelopes (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hv : ValidCells (mixedCells b k σ η ζ)) : PropensityEnvelope (mixedLaw b k σ η ζ) ∧ PrognosisEnvelope (mixedLaw b k σ η ζ) := by have hcells := totalCellLaw_cells_of_valid _ hv constructor · intro x obtain ⟨he,_⟩ := mixed_margin_bounds b k σ η ζ x hη hζ apply calibrated_logit_abs_le_one change propensity (totalCellLaw (mixedCells b k σ η ζ)) x ∈ _ rw [propensity, hcells] simp only [mixedCells, tableCell, Bool.false_eq_true, ↓reduceIte] obtain ⟨helo,hehi⟩ := abs_le.mp he constructor <;> linarith · intro x obtain ⟨he,hm⟩ := mixed_margin_bounds b k σ η ζ x hη hζ apply calibrated_logit_abs_le_one change armRisk (totalCellLaw (mixedCells b k σ η ζ)) false x ∈ _ rw [armRisk, hcells] dsimp only [mixedCells] apply mixed_table_control_risk_bounds _ _ _ he hm cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] at he ⊢ · norm_num · have ht : |32*η*ζ| ≤ 1/8 := by simp only [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 32)] have h := mul_le_mul hη hζ (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1/100) nlinarith exact (covarianceBranch_local_bounds _ _ _ ht (by linarith) (by linarith)).2.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_logit_envelopes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:152
structure CalibratedSpatialBounds

[The remaining mixed spatial scale bounds after design, homogeneous effects, and all three pointwise envelopes have been proved from explicit cells.

Definition (Lean source)
α β :
ℝ
k :
ℕ
propensity_linear :
∀ x z, |propensityLogit P x-propensityLogit P z| ≤ (k : ℝ) ^ (1-α) * |(x : ℝ)-(z : ℝ)|
propensity_oscillation :
∀ x z, |propensityLogit P x-propensityLogit P z| ≤ 2 * (k : ℝ) ^ (-α)
prognosis_linear :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ (k : ℝ) ^ (1-β) * |(x : ℝ)-(z : ℝ)|
prognosis_oscillation :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ 2 * (k : ℝ) ^ (-β)
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibratedSpatialBounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:185
theorem mixedCells_model_bounds_of_spatial

Native-logit spatial bounds combine with independently proved mixed cell-law properties and envelopes to feed the global Hölder assembly. the documented result Under the stated assumptions.

Formal statement
α β :
ℝ
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hv :
ValidCells (mixedCells b k σ η ζ)
h :
CalibratedSpatialBounds α β k (mixedLaw b k σ η ζ)
CalibratedModelBounds α β k (mixedLaw b k σ η ζ)
Proof (Lean source)
-- @node: mixedCells_model_bounds_of_spatial lemma mixedCells_model_bounds_of_spatial (α β : ℝ) (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hv : ValidCells (mixedCells b k σ η ζ)) (h : CalibratedSpatialBounds α β k (mixedLaw b k σ η ζ)) : CalibratedModelBounds α β k (mixedLaw b k σ η ζ) := by obtain ⟨hu,hh,he⟩ := mixedCells_basic_model_properties b k σ η ζ hη hζ hv obtain ⟨hp,hn⟩ := mixedCells_logit_envelopes b k σ η ζ hη hζ hv exact ⟨hu,hh,he,hp,hn,h.propensity_linear,h.propensity_oscillation, h.prognosis_linear,h.prognosis_oscillation⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_model_bounds_of_spatial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:198
structure CalibratedPrognosisBounds

[For fair treatment, only the prognosis envelope and its two spatial scale bounds remain; the propensity logit is already identically zero.

Definition (Lean source)
β :
ℝ
k :
ℕ
prognosis_envelope :
prognosis_linear :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ (k : ℝ) ^ (1-β) * |(x : ℝ)-(z : ℝ)|
prognosis_oscillation :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ 2 * (k : ℝ) ^ (-β)
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibratedPrognosisBounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:211
theorem fairCells_model_bounds_of_prognosis

The actual fair tables' balanced treatment supplies every propensity obligation, leaving just the native prognosis bounds for Hölder assembly. the documented result Under the stated assumptions.

Formal statement
α β :
ℝ
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hv :
ValidCells (fairCells b k σ t δ)
Proof (Lean source)
-- @node: fairCells_model_bounds_of_prognosis lemma fairCells_model_bounds_of_prognosis (α β : ℝ) (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hv : ValidCells (fairCells b k σ t δ)) (h : CalibratedPrognosisBounds β k (totalCellLaw (fairCells b k σ t δ))) : CalibratedModelBounds α β k (totalCellLaw (fairCells b k σ t δ)) := by obtain ⟨hp,hlin,hosc⟩ := fairCells_propensity_bounds b k σ t δ α obtain ⟨hu,hh,he⟩ := fairCells_basic_model_properties b k σ t δ ht hδ hv exact ⟨hu,hh,he,hp,h.prognosis_envelope,hlin,hosc, h.prognosis_linear,h.prognosis_oscillation⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_model_bounds_of_prognosis · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedModelProperties.lean:221
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CalibratedPriorTesting 2 declarations The mixed null prior belongs to every radius slice.

Testing bounds from the calibrated mixed and fair supports

The mixed null prior belongs to every radius slice. The random fair prior with input effect r/2 also belongs to the slice. Their original-record Hellinger budgets imply length lower bounds through the finite-prior reduction.

theorem mixed_prior_length_lower

[The null mixed support and the homogeneous alternative yield a lower bound proportional to the actual mixed amplitude product. the documented result Under the stated assumptions.

Formal statement
α β r :
ℝ
n k :
ℕ
hD :
hr :
0 ≤ r
hk :
1 ≤ k
I :
Procedure n
hI :
HonestProcedure n α β I
hH :
originalRecordHellinger n (mixedMixture false n k (calibEps*(k : ℝ)^(-α)) (calibEps*(k : ℝ)^(-β))) (mixedMixture true n k (calibEps*(k : ℝ)^(-α)) (calibEps*(k : ℝ)^(-β)))
≤ 1/100
(7/10 : ℝ)*(32*(calibEps*(k : ℝ)^(-α))*(calibEps*(k : ℝ)^(-β))) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: mixed_prior_length_lower lemma mixed_prior_length_lower (α β r : ℝ) (n k : ℕ) (hD : ExponentDomain α β) (hr : 0 ≤ r) (hk : 1 ≤ k) (I : Procedure n) (hI : HonestProcedure n α β I) (hH : originalRecordHellinger n (mixedMixture false n k (calibEps*(k : ℝ)^(-α)) (calibEps*(k : ℝ)^(-β))) (mixedMixture true n k (calibEps*(k : ℝ)^(-α)) (calibEps*(k : ℝ)^(-β))) ≤ 1/100) : (7/10 : ℝ)*(32*(calibEps*(k : ℝ)^(-α))*(calibEps*(k : ℝ)^(-β))) ≤ worstLength n α β r I := by let η := calibEps*(k : ℝ)^(-α) let ζ := calibEps*(k : ℝ)^(-β) have hSupport := calib_constants_spec.2.2.1 α β hD k hk dsimp only at hSupport have hModels := hSupport.1 have hP₀ (σ : Fin (k+1) → Bool) : RadiusModel α β r (mixedLaw false k σ η ζ) := by refine { (hModels σ).1 with radius := ?_ } change |effect (mixedLaw false k σ η ζ)| ≤ r rw [(hModels σ).2.2.1, abs_zero] exact hr have h := finitePrior_hellinger_length_lower n k k α β r 0 (32*η*ζ) (fun σ => mixedLaw false k σ η ζ) (fun σ => mixedLaw true k σ η ζ) I hI hP₀ (fun σ => (hModels σ).2.1) (fun σ => (hModels σ).2.2.1) (fun σ => (hModels σ).2.2.2) (fun σ => totalCellLaw_uniform _) (fun σ => totalCellLaw_uniform _) hH have hη : 0 ≤ η := mul_nonneg calib_constants_spec.1.le (by positivity) have hζ : 0 ≤ ζ := mul_nonneg calib_constants_spec.1.le (by positivity) simpa only [sub_zero, abs_of_nonneg (by positivity : 0 ≤ 32*η*ζ)] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_prior_length_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedPriorTesting.lean:16
theorem fair_prior_length_lower

[The random fair prior is the evaluation prior, even though its effect exceeds the comparator's effect. The comparator is a constant finite prior. the documented result Under the stated assumptions.

Formal statement
α β r :
ℝ
n k :
ℕ
hD :
hr :
r ∈ Icc (0 : ℝ) (1/2)
hk :
1 ≤ k
I :
Procedure n
hI :
HonestProcedure n α β I
hH :
originalRecordHellinger n (fairMixture n k (r/2) (calibEps*(k : ℝ)^(-β))) (iidLaw (fairComparator k (r/2) (calibEps*(k : ℝ)^(-β))).measure n)
≤ 1/100
(7/10 : ℝ)*(3*(r/2)*(calibEps*(k : ℝ)^(-β))^2) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: fair_prior_length_lower lemma fair_prior_length_lower (α β r : ℝ) (n k : ℕ) (hD : ExponentDomain α β) (hr : r ∈ Icc (0 : ℝ) (1/2)) (hk : 1 ≤ k) (I : Procedure n) (hI : HonestProcedure n α β I) (hH : originalRecordHellinger n (fairMixture n k (r/2) (calibEps*(k : ℝ)^(-β))) (iidLaw (fairComparator k (r/2) (calibEps*(k : ℝ)^(-β))).measure n) ≤ 1/100) : (7/10 : ℝ)*(3*(r/2)*(calibEps*(k : ℝ)^(-β))^2) ≤ worstLength n α β r I := by let t := r/2 let δ := calibEps*(k : ℝ)^(-β) have ht : t ∈ Icc (0 : ℝ) (1/4) := ⟨by dsimp [t]; linarith [hr.1], by dsimp [t]; linarith [hr.2]⟩ have hδ : |δ| ≤ 1/100 := (calibrated_amplitude_abs_le calibEps β calib_constants_spec.1.le hD.1.le k hk).trans calib_regularity_spec.1 have hSupport := (calib_constants_spec.2.2.1 α β hD k hk).2.2 t ht have hP₀ (σ : Fin (k+1) → Bool) : RadiusModel α β r (fairLaw k σ t δ) := by refine { (hSupport.1 σ).1 with radius := ?_ } change |effect (fairLaw k σ t δ)| ≤ r rw [(hSupport.1 σ).2, abs_of_nonneg ht.1] dsimp [t] linarith [hr.1] have hH' : originalRecordHellinger n (finiteSignMixture n k (fun σ => fairLaw k σ t δ)) (finiteSignMixture n k (fun _ => fairComparator k t δ)) ≤ 1/100 := by rw [finiteSignMixture_const] exact hH have h := finitePrior_hellinger_length_lower n k k α β r t (comparatorEffect t δ) (fun σ => fairLaw k σ t δ) (fun _ => fairComparator k t δ) I hI hP₀ (fun _ => hSupport.2.1) (fun σ => (hSupport.1 σ).2) (fun _ => hSupport.2.2.1) (fun σ => totalCellLaw_uniform _) (fun _ => totalCellLaw_uniform _) hH' rw [abs_of_nonpos (sub_nonpos.mpr (comparatorEffect_range_bounds t δ ht hδ).2), neg_sub] at h exact (mul_le_mul_of_nonneg_left (comparatorEffect_gap_bounds t δ ht hδ).1 (by norm_num : (0 : ℝ) ≤ 7/10)).trans h
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_prior_length_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CalibratedPriorTesting.lean:46
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ComponentPriorRestriction 10 declarations Averaging a likelihood over all endpoint signs equals averaging over the signs owned by its record block.

Restricting hidden sign priors to one component

Averaging a likelihood over all endpoint signs equals averaging over the signs owned by its record block. This bridge transfers exact singleton matching to component densities without revealing signs or assuming record independence.

theorem signPrior_average_restrict

[The uniform prior on all signs has the uniform marginal on any ownership fiber. A function depending only on that fiber has the same two averages. the documented result Under the stated assumptions.

Formal statement
ν κ :
owner :
ν → κ
c :
κ
f :
(ν → Bool) → ℝ
hlocal :
∀ σ τ
if
(∀ s, owner s = c → σ s = τ s)
then
f σ = f τ
(card (ν → Bool) : ℝ)⁻¹ * ∑ σ, f σ
= (card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, f (componentSignExtension owner c σ)
Proof (Lean source)
-- @node: signPrior_average_restrict lemma signPrior_average_restrict {ν κ : Type*} [Fintype ν] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (c : κ) (f : (ν → Bool) → ℝ) (hlocal : ∀ σ τ, (∀ s, owner s = c → σ s = τ s) → f σ = f τ) : (card (ν → Bool) : ℝ)⁻¹ * ∑ σ, f σ = (card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, f (componentSignExtension owner c σ) := by classical let e := Equiv.piEquivPiSubtypeProd (fun s => owner s = c) (fun _ : ν => Bool) have he (σ : ν → Bool) : f σ = f (componentSignExtension owner c (fun s => σ s.1)) := by apply hlocal intro s hs simp [componentSignExtension, hs] have hsum : (∑ σ : ν → Bool, f σ) = (card ({s : ν // ¬owner s = c} → Bool) : ℝ) * ∑ σ, f (componentSignExtension owner c σ) := by rw [show (∑ σ : ν → Bool, f σ) = ∑ σ : ν → Bool, f (componentSignExtension owner c (fun s => σ s.1)) from Finset.sum_congr rfl (fun σ _ => he σ)] change (∑ σ, f (componentSignExtension owner c (e σ).1)) = _ rw [e.sum_comp (fun z => f (componentSignExtension owner c z.1))] rw [Fintype.sum_prod_type] simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, ← Finset.mul_sum] have hcard : (card (ν → Bool) : ℝ) = (card ({s : ν // owner s = c} → Bool) : ℝ) * (card ({s : ν // ¬owner s = c} → Bool) : ℝ) := by rw [Fintype.card_congr e, Fintype.card_prod, Nat.cast_mul] rw [hsum, hcard, mul_inv_rev] have hb : (card ({s : ν // ¬owner s = c} → Bool) : ℝ) ≠ 0 := by positivity field_simp <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPrior_average_restrict · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:18
theorem signPrior_block_average_restrict

A block product depending only on its owned signs can use the full prior, which makes the existing whole-prior cancellation lemmas directly applicable. the documented result Under the stated assumptions.

Formal statement
ι ν κ :
owner :
ν → κ
block :
ι → κ
c :
κ
f :
ι → (ν → Bool) → ℝ
hlocal :
∀ i σ τ
if
(∀ s, owner s = block i → σ s = τ s)
then
f i σ = f i τ
(card (ν → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, f i.1 σ
= (card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, f i.1 (componentSignExtension owner c σ)
Proof (Lean source)
-- @node: signPrior_block_average_restrict lemma signPrior_block_average_restrict {ι ν κ : Type*} [Fintype ι] [Fintype ν] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (block : ι → κ) (c : κ) (f : ι → (ν → Bool) → ℝ) (hlocal : ∀ i σ τ, (∀ s, owner s = block i → σ s = τ s) → f i σ = f i τ) : (card (ν → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, f i.1 σ = (card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, f i.1 (componentSignExtension owner c σ) := by apply signPrior_average_restrict intro σ τ h apply Finset.prod_congr rfl intro i _ apply hlocal intro s hs exact h s (hs.trans i.2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPrior_block_average_restrict · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:53
theorem signPrior_small_block_matching Lemma signPrior_small_block_matching in the paper ↗

Exact matching of single-record averages removes every block of at most one record, including the empty block used for unowned endpoint signs. the documented result Under the stated assumptions.

Formal statement
ι ν :
f g :
ι → (ν → Bool) → ℝ
hcard :
card ι ≤ 1
hmatch :
∀ i, (∑ σ, f i σ) = ∑ σ, g i σ
(∑ σ, ∏ i, f i σ) = ∑ σ, ∏ i, g i σ
Proof (Lean source)
-- @node: signPrior_small_block_matching lemma signPrior_small_block_matching {ι ν : Type*} [Fintype ι] [Fintype ν] [DecidableEq ν] (f g : ι → (ν → Bool) → ℝ) (hcard : card ι ≤ 1) (hmatch : ∀ i, (∑ σ, f i σ) = ∑ σ, g i σ) : (∑ σ, ∏ i, f i σ) = ∑ σ, ∏ i, g i σ := by classical let : Subsingleton ι := Fintype.card_le_one_iff_subsingleton.mp hcard rcases isEmpty_or_nonempty ι with h | h · let := h simp · let := h let : Unique ι := { default := choice h, uniq := fun _ => Subsingleton.elim _ _ } simpa only [Fintype.prod_unique] using hmatch (default : ι)
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPrior_small_block_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:73
theorem mixedCells_block_average_restrict

[Endpoint ownership transfers the full sign prior to a selected component for literal mixed cells. Totalization is handled separately by cell validity. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
b :
η ζ :
ℝ
owner :
block :
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*mixedCells b k σ η ζ (l i).1 (l i).2 (x i.1)
= (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*mixedCells b k (componentSignExtension owner c σ) η ζ (l i).1 (l i).2 (x i.1)
Proof (Lean source)
-- @node: mixedCells_block_average_restrict lemma mixedCells_block_average_restrict {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (b : Bool) (η ζ : ℝ) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*mixedCells b k σ η ζ (l i).1 (l i).2 (x i.1) = (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*mixedCells b k (componentSignExtension owner c σ) η ζ (l i).1 (l i).2 (x i.1) := by dsimp only apply signPrior_average_restrict intro σ τ h apply Finset.prod_congr rfl intro i _ congr 1 apply mixedCells_endpoint_congr intro j hj unfold endpointSign congr 1 apply h exact (signComponentOwner_incident k hk x i.1 j hj).trans i.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_block_average_restrict · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:89
theorem fairCells_block_average_restrict

[The fair component uses the same hidden-prior restriction as the mixed component, uniformly in the effect and signed amplitude. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
t δ :
ℝ
owner :
block :
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*fairCells true k σ t δ (l i).1 (l i).2 (x i.1)
= (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*fairCells true k (componentSignExtension owner c σ) t δ (l i).1 (l i).2 (x i.1)
Proof (Lean source)
-- @node: fairCells_block_average_restrict lemma fairCells_block_average_restrict {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (t δ : ℝ) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*fairCells true k σ t δ (l i).1 (l i).2 (x i.1) = (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, 4*fairCells true k (componentSignExtension owner c σ) t δ (l i).1 (l i).2 (x i.1) := by dsimp only apply signPrior_average_restrict intro σ τ h apply Finset.prod_congr rfl intro i _ congr 1 apply fairCells_endpoint_congr intro j hj unfold endpointSign congr 1 apply h exact (signComponentOwner_incident k hk x i.1 j hj).trans i.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_block_average_restrict · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:118
theorem mixedDensity_block_average_restrict

[Validity on the support neighborhood transfers sign restriction to the actual mixed record density, including its law constructor. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
b :
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
owner :
block :
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw b k σ η ζ) (x i.1,l i)
= (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw b k (componentSignExtension owner c σ) η ζ) (x i.1,l i)
Proof (Lean source)
-- @node: mixedDensity_block_average_restrict lemma mixedDensity_block_average_restrict {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (b : Bool) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw b k σ η ζ) (x i.1,l i) = (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw b k (componentSignExtension owner c σ) η ζ) (x i.1,l i) := by have hv (σ : Fin (k+1) → Bool) : ValidCells (mixedCells b k σ η ζ) := ((calib_constants_spec.2.2.2 k hk σ).1 η ζ hη hζ b).1 simp only [recordCellDensity, mixedLaw, totalCellLaw_cells_of_valid _ (hv _)] exact mixedCells_block_average_restrict k hk x c l b η ζ
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedDensity_block_average_restrict · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:147
theorem fairDensity_block_average_restrict

[Validity on the support neighborhood transfers sign restriction to the actual fair record density, with every root already substituted. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ calibEps
owner :
block :
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k σ t δ) (x i.1,l i)
= (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k (componentSignExtension owner c σ) t δ) (x i.1,l i)
Proof (Lean source)
-- @node: fairDensity_block_average_restrict lemma fairDensity_block_average_restrict {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ calibEps) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k σ t δ) (x i.1,l i) = (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k (componentSignExtension owner c σ) t δ) (x i.1,l i) := by have hv (σ : Fin (k+1) → Bool) : ValidCells (fairCells true k σ t δ) := ((calib_constants_spec.2.2.2 k hk σ).2 t δ ht hδ true).1 simp only [recordCellDensity, fairLaw, totalCellLaw_cells_of_valid _ (hv _)] exact fairCells_block_average_restrict k hk x c l t δ
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairDensity_block_average_restrict · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:168
theorem mixedDensity_small_block_matching

[Empty and singleton components have identical actual mixed likelihoods, by the support theorem's exact singleton matching and hidden-prior restriction. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
hcard :
≤ 1
owner :
block :
(card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw false k (componentSignExtension owner c σ) η ζ) (x i.1,l i)
= (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw true k (componentSignExtension owner c σ) η ζ) (x i.1,l i)
Proof (Lean source)
-- @node: mixedDensity_small_block_matching lemma mixedDensity_small_block_matching {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) (hcard : card {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} ≤ 1) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw false k (componentSignExtension owner c σ) η ζ) (x i.1,l i) = (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw true k (componentSignExtension owner c σ) η ζ) (x i.1,l i) := by dsimp only rw [← mixedDensity_block_average_restrict k hk x c l false η ζ hη hζ, ← mixedDensity_block_average_restrict k hk x c l true η ζ hη hζ] congr 1 apply signPrior_small_block_matching _ _ hcard intro i simp only [recordCellDensity, ← Finset.mul_sum] rw [(calib_singletons_spec k hk).1 η ζ hη hζ (l i).1 (l i).2 (x i.1)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedDensity_small_block_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:189
theorem fairDensity_small_block_matching

[Exact singleton matching also removes every fair component of at most one original record; its comparator average is a constant-prior average. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ calibEps
hcard :
≤ 1
owner :
block :
(card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k (componentSignExtension owner c σ) t δ) (x i.1,l i)
= (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairComparator k t δ) (x i.1,l i)
Proof (Lean source)
-- @node: fairDensity_small_block_matching lemma fairDensity_small_block_matching {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ calibEps) (hcard : card {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} ≤ 1) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k (componentSignExtension owner c σ) t δ) (x i.1,l i) = (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairComparator k t δ) (x i.1,l i) := by dsimp only rw [← fairDensity_block_average_restrict k hk x c l t δ ht hδ] have he (i : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c}) : (∑ σ : Fin (k+1) → Bool, recordCellDensity (fairLaw k σ t δ) (x i.1,l i)) = ∑ _σ : Fin (k+1) → Bool, recordCellDensity (fairComparator k t δ) (x i.1,l i) := by have hm := (calib_singletons_spec k hk).2 t δ ht hδ (l i).1 (l i).2 (x i.1) have hc : (card (Fin (k+1) → Bool) : ℝ) ≠ 0 := by positivity simp only [recordCellDensity, ← Finset.mul_sum, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] have hm' := (div_eq_iff hc).mp (show (∑ σ : Fin (k+1) → Bool, (fairLaw k σ t δ).cells (l i).1 (l i).2 (x i.1)) / (card (Fin (k+1) → Bool) : ℝ) = (fairComparator k t δ).cells (l i).1 (l i).2 (x i.1) from by simpa only [div_eq_mul_inv, mul_comm] using hm) rw [hm'] ring rw [signPrior_small_block_matching _ _ hcard he] simp [← mul_assoc, Fintype.card_ne_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairDensity_small_block_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:216
theorem signComponent_record_card

[The record fiber is empty for unowned signs and otherwise has exactly the support cardinality of its graph component. the documented result

Formal statement
n :
ℕ
k :
ℕ
x :
= match c with | none => 0 | some v => v.supp.toFinset.card
Proof (Lean source)
-- @node: signComponent_record_card lemma signComponent_record_card {n : ℕ} (k : ℕ) (x : Fin n → Covariate) (c : SignComponentBlock k x) : card {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} = match c with | none => 0 | some v => v.supp.toFinset.card := by rw [Fintype.card_subtype] cases c with | none => simp | some v => congr 1 ext i simp [SimpleGraph.ConnectedComponent.mem_supp_iff]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signComponent_record_card · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ComponentPriorRestriction.lean:255
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CoordinateBias 7 declarations Cauchy–Schwarz for the uniform design converts the verified constant-five projection approximation into residual-product bounds.

Hölder approximation bounds for the coordinate biases

Cauchy–Schwarz for the uniform design converts the verified constant-five projection approximation into residual-product bounds. Native-logit regularity supplies the off-diagonal Hölder radii, giving the exact denominator constant.

For continuous functions, the extended norm has the ordinary integral representation. Under the stated assumptions.

Formal statement
f :
Covariate → ℝ
hf :
(uniformL2Norm f).toReal = (∫ x, f x^2 ∂uniformLaw)^(1/2 : ℝ)
Proof (Lean source)
-- @node: uniformL2Norm_toReal lemma uniformL2Norm_toReal (f : Covariate → ℝ) (hf : Continuous f) : (uniformL2Norm f).toReal = (∫ x, f x^2 ∂uniformLaw)^(1/2 : ℝ) := by have hi : Integrable (fun x => f x^2) uniformLaw := (hf.pow 2).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) rw [uniformL2Norm, ← ofReal_integral_eq_lintegral_ofReal hi (Filter.Eventually.of_forall (fun x => sq_nonneg (f x)))] change ((ofReal (∫ x, f x^2 ∂uniformLaw)) ^ (1/2 : ℝ)).toReal = _ rw [← ENNReal.toReal_rpow, ENNReal.toReal_ofReal (integral_nonneg (fun x => sq_nonneg (f x)))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformL2Norm_toReal · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateBias.lean:17

The real inner product is bounded by the product of the two finite L2 norms. Under the stated assumptions.

Formal statement
f g :
Covariate → ℝ
hf :
hg :
Proof (Lean source)
-- @node: uniformInner_abs_le_L2 lemma uniformInner_abs_le_L2 (f g : Covariate → ℝ) (hf : Continuous f) (hg : Continuous g) : |uniformInner f g| ≤ (uniformL2Norm f).toReal*(uniformL2Norm g).toReal := by have hfm : MemLp f (ofReal 2) uniformLaw := hf.memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hgm : MemLp g (ofReal 2) uniformLaw := hg.memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hcs := integral_mul_norm_le_Lp_mul_Lq (p := 2) (q := 2) (by constructor <;> norm_num) hfm hgm simp only [Real.norm_eq_abs, Real.rpow_two, sq_abs] at hcs rw [uniformL2Norm_toReal f hf, uniformL2Norm_toReal g hg] exact (show |uniformInner f g| ≤ ∫ x, |f x| *|g x| ∂uniformLaw by simpa only [uniformInner, Real.norm_eq_abs, abs_mul] using norm_integral_le_integral_norm (fun x => f x*g x)).trans hcs
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformInner_abs_le_L2 · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateBias.lean:29
theorem continuous_cosineProjection_function Lemma continuous_cosineProjection_function in the paper ↗

The finite projection of any function is continuous. Under the stated assumptions.

Formal statement
k :
ℕ
f :
Covariate → ℝ
Continuous (cosineProjection k f)
Proof (Lean source)
-- @node: continuous_cosineProjection_function lemma continuous_cosineProjection_function (k : ℕ) (f : Covariate → ℝ) : Continuous (cosineProjection k f) := by have hb (j : ℕ) : Continuous (cosineBasis j) := by unfold cosineBasis split_ifs <;> fun_prop unfold cosineProjection fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.continuous_cosineProjection_function · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateBias.lean:45
theorem cosineProjection_error_real_bound

A real Hölder radius bounds the real L2 approximation error. Under the stated assumptions.

Formal statement
γ L :
ℝ
f :
Covariate → ℝ
hf :
hL :
0 ≤ L
hH :
holderSeminorm γ f ≤ ofReal L
k :
ℕ
hk :
1 ≤ k
(uniformL2Norm (fun x => f x-cosineProjection k f x)).toReal ≤ 5*L*(k : ℝ)^(-γ)
Proof (Lean source)
-- @node: cosineProjection_error_real_bound lemma cosineProjection_error_real_bound (γ L : ℝ) (f : Covariate → ℝ) (hγ : HolderExponentDomain γ) (hf : Continuous f) (hL : 0 ≤ L) (hH : holderSeminorm γ f ≤ ofReal L) (k : ℕ) (hk : 1 ≤ k) : (uniformL2Norm (fun x => f x-cosineProjection k f x)).toReal ≤ 5*L*(k : ℝ)^(-γ) := by have hb := cosineProjection_error_le_holderSeminorm γ f hγ hf k hk have hm : uniformL2Norm (fun x => f x-cosineProjection k f x) ≤ 5*ofReal L*ofReal ((k : ℝ)^(-γ)) := hb.trans (by gcongr) have ht : 5*ofReal L*ofReal ((k : ℝ)^(-γ)) ≠ ⊤ := ENNReal.mul_ne_top (ENNReal.mul_ne_top (by norm_num) ENNReal.ofReal_ne_top) ENNReal.ofReal_ne_top have hr := ENNReal.toReal_mono ht hm simpa only [ENNReal.toReal_mul, ENNReal.toReal_ofNat, ENNReal.toReal_ofReal hL, ENNReal.toReal_ofReal (Real.rpow_nonneg (Nat.cast_nonneg k) _)] using hr
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineProjection_error_real_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateBias.lean:55
theorem cosineProjection_residual_holder_bound

Two real Hölder radii give the product approximation bound with constant twenty-five. Under the stated assumptions.

Formal statement
γ τ L M :
ℝ
f g :
Covariate → ℝ
hf :
hg :
hL :
0 ≤ L
hM :
0 ≤ M
hF :
holderSeminorm γ f ≤ ofReal L
hG :
holderSeminorm τ g ≤ ofReal M
k :
ℕ
hk :
1 ≤ k
|uniformInner (fun x => f x-cosineProjection k f x) (fun x => g x-cosineProjection k g x)|
≤ 25*L*M*(k : ℝ)^(-(γ+τ))
Proof (Lean source)
-- @node: cosineProjection_residual_holder_bound lemma cosineProjection_residual_holder_bound (γ τ L M : ℝ) (f g : Covariate → ℝ) (hγ : HolderExponentDomain γ) (hτ : HolderExponentDomain τ) (hf : Continuous f) (hg : Continuous g) (hL : 0 ≤ L) (hM : 0 ≤ M) (hF : holderSeminorm γ f ≤ ofReal L) (hG : holderSeminorm τ g ≤ ofReal M) (k : ℕ) (hk : 1 ≤ k) : |uniformInner (fun x => f x-cosineProjection k f x) (fun x => g x-cosineProjection k g x)| ≤ 25*L*M*(k : ℝ)^(-(γ+τ)) := by have hkp : (0 : ℝ) < k := by exact_mod_cast (show 0 < k by omega) have hcs := uniformInner_abs_le_L2 _ _ (hf.sub (continuous_cosineProjection_function k f)) (hg.sub (continuous_cosineProjection_function k g)) have hprod := mul_le_mul (cosineProjection_error_real_bound γ L f hγ hf hL hF k hk) (cosineProjection_error_real_bound τ M g hτ hg hM hG k hk) ENNReal.toReal_nonneg (by positivity : 0 ≤ 5*L*(k : ℝ)^(-γ)) have he : (5*L*(k : ℝ)^(-γ))*(5*M*(k : ℝ)^(-τ)) = 25*L*M*(k : ℝ)^(-(γ+τ)) := by rw [neg_add, Real.rpow_add hkp] ring exact hcs.trans (he ▸ hprod)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineProjection_residual_holder_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateBias.lean:72
theorem denominator_projection_bias_bound

The off-diagonal residual has precisely the paper's constant twenty-five bound. Under the stated assumptions.

Formal statement
α β :
ℝ
hab :
hP :
Model α β P
k :
ℕ
hk :
1 ≤ k
|uniformInner (fun x => cellProbability P true false x-cosineProjection k (cellProbability P true false) x) (fun x => cellProbability P false true x-cosineProjection k (cellProbability P false true) x)|
≤ 25*(k : ℝ)^(-2*β)
Proof (Lean source)
-- @node: denominator_projection_bias_bound lemma denominator_projection_bias_bound (P : ObservedLaw) (α β : ℝ) (hab : ExponentDomain α β) (hP : Model α β P) (k : ℕ) (hk : 1 ≤ k) : |uniformInner (fun x => cellProbability P true false x-cosineProjection k (cellProbability P true false) x) (fun x => cellProbability P false true x-cosineProjection k (cellProbability P false true) x)| ≤ 25*(k : ℝ)^(-2*β) := by obtain ⟨hF, hG⟩ := offDiagonal_holder_bounds P α β hab hP have hcont (a y : Bool) : Continuous (cellProbability P a y) := by have he : cellProbability P a y = P.cells a y := funext (cellProbability_eq_cells P a y) rw [he] exact P.continuous_cells a y have hβ : HolderExponentDomain β := ⟨hab.1, by linarith [hab.2.1]⟩ have h := cosineProjection_residual_holder_bound β β 1 1 _ _ hβ hβ (hcont true false) (hcont false true) (by norm_num) (by norm_num) (by simpa using hF) (by simpa using hG) k hk convert h using 1 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.denominator_projection_bias_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateBias.lean:95
theorem numerator_projection_bias_bound

The sharper marginal radius gives a numerator residual constant below eight. Under the stated assumptions.

Formal statement
α β :
ℝ
hab :
hP :
Model α β P
k :
ℕ
hk :
1 ≤ k
|uniformInner (fun x => propensity P x-cosineProjection k (propensity P) x) (fun x => marginalMean P x-cosineProjection k (marginalMean P) x)|
≤ 8*(k : ℝ)^(-(α+β))
Proof (Lean source)
-- @node: numerator_projection_bias_bound lemma numerator_projection_bias_bound (P : ObservedLaw) (α β : ℝ) (hab : ExponentDomain α β) (hP : Model α β P) (k : ℕ) (hk : 1 ≤ k) : |uniformInner (fun x => propensity P x-cosineProjection k (propensity P) x) (fun x => marginalMean P x-cosineProjection k (marginalMean P) x)| ≤ 8*(k : ℝ)^(-(α+β)) := by have he : holderSeminorm α (propensity P) ≤ ofReal (1/2 : ℝ) := holderSeminorm_le_of_pointwise α (1/2) _ (propensity_holder_modulus P α hP.propensity_holder) have hc : Continuous (propensity P) := (P.continuous_cells true false).add (P.continuous_cells true true) have hm : Continuous (marginalMean P) := by have heq : marginalMean P = fun x => P.cells false true x+P.cells true true x := funext (marginalMean_eq_cells P) rw [heq] exact (P.continuous_cells false true).add (P.continuous_cells true true) have hα : HolderExponentDomain α := ⟨hab.1.trans hab.2.2.1, hab.2.2.2⟩ have hβ : HolderExponentDomain β := ⟨hab.1, by linarith [hab.2.1]⟩ have h := cosineProjection_residual_holder_bound α β (1/2) (9/16) _ _ hα hβ hc hm (by norm_num) (by norm_num) he (marginalMean_holder_bound P α β hab hP) k hk exact h.trans (by gcongr; norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.numerator_projection_bias_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateBias.lean:114
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CoordinateRegularity 10 declarations The quarter-Lipschitz logistic map transports the model's native Hölder radii to propensity and arm risks.

Native-logit Hölder control of the observable cells

The quarter-Lipschitz logistic map transports the model's native Hölder radii to propensity and arm risks. On the unit covariate interval, the smoother propensity exponent can be lowered to the prognosis exponent. Product bounds then give the unit Hölder radii of both off-diagonal cells used in the bias proof.

theorem logistic_sub_le_quarter Lemma logistic_sub_le_quarter in the paper ↗

[The logistic derivative is globally bounded by one quarter. the stated conclusion holds.

Formal statement
s t :
ℝ
|logistic s - logistic t| ≤ (1/4 : ℝ) * |s-t|
Proof (Lean source)
-- @node: logistic_sub_le_quarter lemma logistic_sub_le_quarter (s t : ℝ) : |logistic s - logistic t| ≤ (1/4 : ℝ) * |s-t| := by have hbound (x : ℝ) : ‖deriv sigmoid x‖ ≤ (1/4 : ℝ) := by rw [Real.deriv_sigmoid, Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (Real.sigmoid_pos x).le (sub_nonneg.mpr (Real.sigmoid_le_one x)))] nlinarith [sq_nonneg (sigmoid x - 1/2)] simpa only [logistic, Real.norm_eq_abs] using (convex_univ : Convex ℝ (Set.univ : Set ℝ)).norm_image_sub_le_of_norm_deriv_le (fun x _ => (Real.hasDerivAt_sigmoid x).differentiableAt) (fun x _ => hbound x) (Set.mem_univ t) (Set.mem_univ s)
CausalSmith.Stat.LogoddsLowsmoothFrontier.logistic_sub_le_quarter · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:18
theorem holderSeminorm_pointwise Lemma holderSeminorm_pointwise in the paper ↗

A finite extended Hölder radius gives its pointwise real modulus. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
γ L :
ℝ
f :
Covariate → ℝ
hL :
0 ≤ L
h :
holderSeminorm γ f ≤ ofReal L
x z :
|f x-f z| ≤ L * |(x : ℝ)-(z : ℝ)|^γ
Proof (Lean source)
-- @node: holderSeminorm_pointwise lemma holderSeminorm_pointwise (γ L : ℝ) (f : Covariate → ℝ) (hL : 0 ≤ L) (h : holderSeminorm γ f ≤ ofReal L) (x z : Covariate) : |f x-f z| ≤ L * |(x : ℝ)-(z : ℝ)|^γ := by by_cases hxz : x = z · subst z simp positivity have hd : 0 < |(x : ℝ)-(z : ℝ)| := abs_pos.mpr (sub_ne_zero.mpr (fun he => hxz (Subtype.ext he))) unfold holderSeminorm at h have hratio : ofReal (|f x-f z| / |(x : ℝ)-(z : ℝ)|^γ) ≤ ofReal L := (le_iSup_of_le x (le_iSup_of_le z (le_iSup_of_le (f := fun (_ : x ≠ z) => ofReal (|f x-f z| / |(x : ℝ)-(z : ℝ)|^γ)) hxz le_rfl))).trans h have hr : |f x-f z| / |(x : ℝ)-(z : ℝ)|^γ ≤ L := (ENNReal.ofReal_le_ofReal_iff hL).mp hratio exact (div_le_iff₀ (Real.rpow_pos_of_pos hd _)).mp hr
CausalSmith.Stat.LogoddsLowsmoothFrontier.holderSeminorm_pointwise · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:32
theorem holderSeminorm_le_of_pointwise Lemma holderSeminorm_le_of_pointwise in the paper ↗

A pointwise modulus bounds the extended Hölder seminorm. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
γ L :
ℝ
f :
Covariate → ℝ
h :
∀ x z : Covariate, |f x-f z| ≤ L * |(x : ℝ)-(z : ℝ)|^γ
holderSeminorm γ f ≤ ofReal L
Proof (Lean source)
-- @node: holderSeminorm_le_of_pointwise lemma holderSeminorm_le_of_pointwise (γ L : ℝ) (f : Covariate → ℝ) (h : ∀ x z : Covariate, |f x-f z| ≤ L * |(x : ℝ)-(z : ℝ)|^γ) : holderSeminorm γ f ≤ ofReal L := by refine iSup_le fun x => iSup_le fun z => iSup_le fun hxz => ?_ apply ENNReal.ofReal_le_ofReal have hd : 0 < |(x : ℝ)-(z : ℝ)| := abs_pos.mpr (sub_ne_zero.mpr (fun he => hxz (Subtype.ext he))) exact (div_le_iff₀ (Real.rpow_pos_of_pos hd _)).mpr (h x z)
CausalSmith.Stat.LogoddsLowsmoothFrontier.holderSeminorm_le_of_pointwise · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:53
theorem covariate_rpow_exponent_mono Lemma covariate_rpow_exponent_mono in the paper ↗

Hölder powers decrease with the exponent on the unit covariate interval. Under the stated assumptions.

Formal statement
x z :
α β :
ℝ
hβα :
β ≤ α
hβ :
0 < β
|(x : ℝ)-(z : ℝ)|^α ≤ |(x : ℝ)-(z : ℝ)|^β
Proof (Lean source)
-- @node: covariate_rpow_exponent_mono lemma covariate_rpow_exponent_mono (x z : Covariate) (α β : ℝ) (hβα : β ≤ α) (hβ : 0 < β) : |(x : ℝ)-(z : ℝ)|^α ≤ |(x : ℝ)-(z : ℝ)|^β := by have hd : |(x : ℝ)-(z : ℝ)| ≤ 1 := by rw [abs_le] constructor <;> linarith [x.property.1, x.property.2, z.property.1, z.property.2] by_cases hz : |(x : ℝ)-(z : ℝ)| = 0 · rw [hz, Real.zero_rpow (ne_of_gt (hβ.trans_le hβα)), Real.zero_rpow hβ.ne'] · exact Real.rpow_le_rpow_of_exponent_ge (lt_of_le_of_ne (abs_nonneg _) (Ne.symm hz)) hd hβα
CausalSmith.Stat.LogoddsLowsmoothFrontier.covariate_rpow_exponent_mono · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:64
theorem propensity_holder_modulus

Native propensity regularity is transported through the logistic map. Under the stated assumptions.

Formal statement
α :
ℝ
h :
x z :
|propensity P x-propensity P z| ≤ (1/2 : ℝ)*|(x : ℝ)-(z : ℝ)|^α
Proof (Lean source)
-- @node: propensity_holder_modulus lemma propensity_holder_modulus (P : ObservedLaw) (α : ℝ) (h : PropensityHolder α P) (x z : Covariate) : |propensity P x-propensity P z| ≤ (1/2 : ℝ)*|(x : ℝ)-(z : ℝ)|^α := by have hg := holderSeminorm_pointwise α 2 (propensityLogit P) (by norm_num) (by simpa [PropensityHolder] using h) x z have he (v : Covariate) : logistic (propensityLogit P v) = propensity P v := logistic_logit _ (propensity_interior P v).1 (propensity_interior P v).2 have hl := logistic_sub_le_quarter (propensityLogit P x) (propensityLogit P z) rw [he x, he z] at hl linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.propensity_holder_modulus · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:75
theorem armRisk_holder_modulus

Both arm risks inherit the same prognosis Hölder modulus; the effect is constant. Under the stated assumptions.

Formal statement
β :
ℝ
h :
a :
x z :
|armRisk P a x-armRisk P a z| ≤ (1/2 : ℝ)*|(x : ℝ)-(z : ℝ)|^β
Proof (Lean source)
-- @node: armRisk_holder_modulus lemma armRisk_holder_modulus (P : ObservedLaw) (β : ℝ) (h : PrognosisHolder β P) (hh : HomogeneousLogit P) (a : Bool) (x z : Covariate) : |armRisk P a x-armRisk P a z| ≤ (1/2 : ℝ)*|(x : ℝ)-(z : ℝ)|^β := by have hn := holderSeminorm_pointwise β 2 (prognosisLogit P) (by norm_num) (by simpa [PrognosisHolder] using h) x z cases a · have he (v : Covariate) : logistic (prognosisLogit P v) = armRisk P false v := logistic_logit _ (armRisk_interior P false v).1 (armRisk_interior P false v).2 have hl := logistic_sub_le_quarter (prognosisLogit P x) (prognosisLogit P z) rw [he x, he z] at hl linarith · rw [hh x, hh z] have hl := logistic_sub_le_quarter (prognosisLogit P x+effect P) (prognosisLogit P z+effect P) simp only [add_sub_add_right_eq_sub] at hl linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.armRisk_holder_modulus · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:88
theorem probability_product_sub_le Lemma probability_product_sub_le in the paper ↗

[Products of probability factors have the sum of their two moduli. the stated conclusion holds. Under the stated assumptions.

Formal statement
a b c d :
ℝ
ha :
a ∈ Icc (0 : ℝ) 1
hd :
d ∈ Icc (0 : ℝ) 1
|a*b-c*d| ≤ |b-d|+|a-c|
Proof (Lean source)
-- @node: probability_product_sub_le lemma probability_product_sub_le (a b c d : ℝ) (ha : a ∈ Icc (0 : ℝ) 1) (hd : d ∈ Icc (0 : ℝ) 1) : |a*b-c*d| ≤ |b-d|+|a-c| := by calc |a*b-c*d| = |a*(b-d)+(a-c)*d| := by congr 1; ring _ ≤ |a*(b-d)|+|(a-c)*d| := abs_add_le _ _ _ = |a| *|b-d|+|a-c| *|d| := by rw [abs_mul, abs_mul] _ ≤ |b-d|+|a-c| := by rw [abs_of_nonneg ha.1, abs_of_nonneg hd.1] nlinarith [mul_le_mul_of_nonneg_right ha.2 (abs_nonneg (b-d)), mul_le_mul_of_nonneg_left hd.2 (abs_nonneg (a-c))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.probability_product_sub_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:108
theorem offDiagonal_holder_bounds

Each off-diagonal cell has unit prognosis-exponent Hölder radius. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
α β :
ℝ
hab :
hP :
Model α β P
conclusion 1
holderSeminorm β (cellProbability P true false) ≤ 1
conclusion 2
holderSeminorm β (cellProbability P false true) ≤ 1
Proof (Lean source)
-- @node: offDiagonal_holder_bounds lemma offDiagonal_holder_bounds (P : ObservedLaw) (α β : ℝ) (hab : ExponentDomain α β) (hP : Model α β P) : holderSeminorm β (cellProbability P true false) ≤ 1 ∧ holderSeminorm β (cellProbability P false true) ≤ 1 := by have he (x z : Covariate) : |propensity P x-propensity P z| ≤ (1/2 : ℝ)*|(x : ℝ)-(z : ℝ)|^β := (propensity_holder_modulus P α hP.propensity_holder x z).trans (mul_le_mul_of_nonneg_left (covariate_rpow_exponent_mono x z α β hab.2.2.1.le hab.1) (by norm_num)) constructor all_goals apply le_trans (holderSeminorm_le_of_pointwise β 1 _ ?_) (by norm_num) intro x z · simp only [cellProbability, Bool.false_eq_true, ↓reduceIte] have h := probability_product_sub_le (propensity P x) (1-armRisk P true x) (propensity P z) (1-armRisk P true z) ⟨(propensity_interior P x).1.le, (propensity_interior P x).2.le⟩ ⟨by linarith [(armRisk_interior P true z).2], by linarith [(armRisk_interior P true z).1]⟩ have hr := armRisk_holder_modulus P β hP.prognosis_holder hP.homogeneous true x z have he' := he x z rw [show (1-armRisk P true x)-(1-armRisk P true z) = -(armRisk P true x-armRisk P true z) by ring, abs_neg] at h linarith · simp only [cellProbability, Bool.false_eq_true, ↓reduceIte] have h := probability_product_sub_le (1-propensity P x) (armRisk P false x) (1-propensity P z) (armRisk P false z) ⟨by linarith [(propensity_interior P x).2], by linarith [(propensity_interior P x).1]⟩ ⟨(armRisk_interior P false z).1.le, (armRisk_interior P false z).2.le⟩ have hr := armRisk_holder_modulus P β hP.prognosis_holder hP.homogeneous false x z have he' := he x z rw [show (1-propensity P x)-(1-propensity P z) = -(propensity P x-propensity P z) by ring, abs_neg] at h linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.offDiagonal_holder_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:122
theorem armRisk_gap_le_effect

The homogeneous arm-risk gap is bounded by one quarter of the scalar effect. Under the stated assumptions.

Formal statement
|armRisk P true x-armRisk P false x| ≤ (1/4 : ℝ)*|effect P|
Proof (Lean source)
-- @node: armRisk_gap_le_effect lemma armRisk_gap_le_effect (P : ObservedLaw) (hh : HomogeneousLogit P) (x : Covariate) : |armRisk P true x-armRisk P false x| ≤ (1/4 : ℝ)*|effect P| := by have he : logistic (prognosisLogit P x) = armRisk P false x := logistic_logit _ (armRisk_interior P false x).1 (armRisk_interior P false x).2 have hl := logistic_sub_le_quarter (prognosisLogit P x+effect P) (prognosisLogit P x) rw [he, ← hh x] at hl simpa only [add_sub_cancel_left] using hl
CausalSmith.Stat.LogoddsLowsmoothFrontier.armRisk_gap_le_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:160
theorem marginalMean_holder_bound

The marginal outcome mean has the sharper nine-sixteenths Hölder radius. Under the stated assumptions.

Formal statement
α β :
ℝ
hab :
hP :
Model α β P
holderSeminorm β (marginalMean P) ≤ ofReal (9/16 : ℝ)
Proof (Lean source)
-- @node: marginalMean_holder_bound lemma marginalMean_holder_bound (P : ObservedLaw) (α β : ℝ) (hab : ExponentDomain α β) (hP : Model α β P) : holderSeminorm β (marginalMean P) ≤ ofReal (9/16 : ℝ) := by apply holderSeminorm_le_of_pointwise intro x z let D := |(x : ℝ)-(z : ℝ)|^β have hD : 0 ≤ D := Real.rpow_nonneg (abs_nonneg _) _ have he := (propensity_holder_modulus P α hP.propensity_holder x z).trans (mul_le_mul_of_nonneg_left (covariate_rpow_exponent_mono x z α β hab.2.2.1.le hab.1) (by norm_num)) have h0 := armRisk_holder_modulus P β hP.prognosis_holder hP.homogeneous false x z have h1 := armRisk_holder_modulus P β hP.prognosis_holder hP.homogeneous true x z have hgap : |armRisk P true z-armRisk P false z| ≤ (1/8 : ℝ) := (armRisk_gap_le_effect P hP.homogeneous z).trans (by linarith [show |effect P| ≤ (1/2 : ℝ) from hP.effect_envelope]) have hep := propensity_interior P x have hdecomp : marginalMean P x-marginalMean P z = (1-propensity P x)*(armRisk P false x-armRisk P false z)+ propensity P x*(armRisk P true x-armRisk P true z)+ (propensity P x-propensity P z)*(armRisk P true z-armRisk P false z) := by unfold marginalMean ring rw [hdecomp] have htri := (abs_add_le ((1-propensity P x)*(armRisk P false x-armRisk P false z)+ propensity P x*(armRisk P true x-armRisk P true z)) ((propensity P x-propensity P z)*(armRisk P true z-armRisk P false z))).trans (add_le_add (abs_add_le _ _) le_rfl) simp only [abs_mul, abs_of_nonneg (by linarith [hep.2] : 0 ≤ 1-propensity P x), abs_of_nonneg hep.1.le] at htri have hb0 := mul_le_mul_of_nonneg_left h0 (by linarith [hep.2] : 0 ≤ 1-propensity P x) have hb1 := mul_le_mul_of_nonneg_left h1 hep.1.le have hb2 := mul_le_mul he hgap (abs_nonneg _) (by positivity : 0 ≤ (1/2 : ℝ)*D) change |(1-propensity P x)*(armRisk P false x-armRisk P false z)+ propensity P x*(armRisk P true x-armRisk P true z)+ (propensity P x-propensity P z)*(armRisk P true z-armRisk P false z)| ≤ (9/16 : ℝ)*D change (1-propensity P x)*|armRisk P false x-armRisk P false z| ≤ (1-propensity P x)*((1/2 : ℝ)*D) at hb0 change propensity P x*|armRisk P true x-armRisk P true z| ≤ propensity P x*((1/2 : ℝ)*D) at hb1 change |propensity P x-propensity P z| *|armRisk P true z-armRisk P false z| ≤ ((1/2 : ℝ)*D)*(1/8) at hb2 nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.marginalMean_holder_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateRegularity.lean:170
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CoordinateVariance 15 declarations The empirical mean uses independent original records.

Coordinate mean identities and variance bounds

The empirical mean uses independent original records. The projection statistic uses the sharp order-two Hoeffding bound; adding the independent seed preserves variance. Together these give the two public coordinate variance radii. Disintegration also identifies both biases with projection residual inner products.

theorem continuous_treatment_mark Lemma continuous_treatment_mark in the paper ↗

[Both binary marks are continuous on the original record space. The stated conclusion follows.

Formal statement
Proof (Lean source)
-- @node: continuous_treatment_mark @[fun_prop] lemma continuous_treatment_mark : Continuous treatment := by exact (continuous_of_discreteTopology : Continuous (fun b : Bool => if b then (1 : ℝ) else 0)).comp continuous_snd.fst
CausalSmith.Stat.LogoddsLowsmoothFrontier.continuous_treatment_mark · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:22
theorem continuous_outcome_mark Lemma continuous_outcome_mark in the paper ↗

The outcome mark is continuous on the original record space. The stated conclusion follows.

Formal statement
Proof (Lean source)
-- @node: continuous_outcome_mark @[fun_prop] lemma continuous_outcome_mark : Continuous outcome := by exact (continuous_of_discreteTopology : Continuous (fun b : Bool => if b then (1 : ℝ) else 0)).comp continuous_snd.snd
CausalSmith.Stat.LogoddsLowsmoothFrontier.continuous_outcome_mark · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:28
theorem continuous_projectionStatistic_sample

Finite cosine statistics are continuous functions of the original sample. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n k :
ℕ
W V :
Record → ℝ
hW :
hV :
Proof (Lean source)
-- @node: continuous_projectionStatistic_sample lemma continuous_projectionStatistic_sample (n k : ℕ) (W V : Record → ℝ) (hW : Continuous W) (hV : Continuous V) : Continuous (projectionStatistic n k W V) := by have hb (j : ℕ) : Continuous (cosineBasis j) := by unfold cosineBasis split_ifs <;> fun_prop unfold projectionStatistic projectionKernel covariate fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.continuous_projectionStatistic_sample · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:34
theorem coordinateEstimates_memLp

[The two coordinate estimates have finite second moments, including the seed. the stated conclusion holds.

Formal statement
n kC kS :
ℕ
conclusion 1
MemLp (fun ω : Experiment n => cHat n kC ω.1) 2 (experimentLaw P n)
conclusion 2
MemLp (fun ω : Experiment n => sHat n kS ω.1) 2 (experimentLaw P n)
Proof (Lean source)
-- @node: coordinateEstimates_memLp lemma coordinateEstimates_memLp (P : ObservedLaw) (n kC kS : ℕ) : MemLp (fun ω : Experiment n => cHat n kC ω.1) 2 (experimentLaw P n) ∧ MemLp (fun ω : Experiment n => sHat n kS ω.1) 2 (experimentLaw P n) := by let := experimentLaw_probability P n have hc : Continuous (cHat n kC) := by unfold cHat apply Continuous.sub · fun_prop · exact continuous_projectionStatistic_sample n kC _ _ continuous_treatment_mark continuous_outcome_mark have hs : Continuous (sHat n kS) := by unfold sHat apply continuous_projectionStatistic_sample all_goals fun_prop exact ⟨(hc.comp continuous_fst).memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _), (hs.comp continuous_fst).memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinateEstimates_memLp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:45
theorem projectionStatistic_sample_memLp

Continuous marks give a square-integrable finite projection statistic. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n k :
ℕ
W V :
Record → ℝ
hW :
hV :
MemLp (projectionStatistic n k W V) 2 (iidLaw P.measure n)
Proof (Lean source)
-- @node: projectionStatistic_sample_memLp lemma projectionStatistic_sample_memLp (P : ObservedLaw) (n k : ℕ) (W V : Record → ℝ) (hW : Continuous W) (hV : Continuous V) : MemLp (projectionStatistic n k W V) 2 (iidLaw P.measure n) := by letI : IsProbabilityMeasure (iidLaw P.measure n) := by unfold iidLaw infer_instance exact (continuous_projectionStatistic_sample n k W V hW hV).memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic_sample_memLp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:66
theorem projectionStatistic_experiment_variance_le

Tensoring the unused independent seed preserves the sharp projection variance. Under the stated assumptions.

Formal statement
hDesign :
n k :
ℕ
hn :
2 ≤ n
W V :
Record → ℝ
hW :
hV :
hWR :
∀ o, 0 ≤ W o ∧ W o ≤ 1
hVR :
∀ o, 0 ≤ V o ∧ V o ≤ 1
variance (fun ω : Experiment n => projectionStatistic n k W V ω.1) (experimentLaw P n)
≤ 4/(n : ℝ)+2*k/((n : ℝ)*((n : ℝ)-1))
Proof (Lean source)
-- @node: projectionStatistic_experiment_variance_le lemma projectionStatistic_experiment_variance_le (P : ObservedLaw) (hDesign : UniformDesign P) (n k : ℕ) (hn : 2 ≤ n) (W V : Record → ℝ) (hW : Continuous W) (hV : Continuous V) (hWR : ∀ o, 0 ≤ W o ∧ W o ≤ 1) (hVR : ∀ o, 0 ≤ V o ∧ V o ≤ 1) : variance (fun ω : Experiment n => projectionStatistic n k W V ω.1) (experimentLaw P n) ≤ 4/(n : ℝ)+2*k/((n : ℝ)*((n : ℝ)-1)) := by let WM : BoundedMark := ⟨W, hW.measurable, hWR⟩ let VM : BoundedMark := ⟨V, hV.measurable, hVR⟩ have hMeas := (continuous_projectionStatistic_sample n k W V hW hV).measurable rw [experimentLaw, measurePreserving_fst.variance_fun_comp hMeas.aemeasurable, variance_eq_integral hMeas.aemeasurable] exact projectionStatistic_variance_le P hDesign WM VM k n hn
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic_experiment_variance_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:79
theorem bounded_sampleMean_variance_le

[Independence of the original records gives the unit-range empirical mean variance bound used for the numerator coordinate. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
1 ≤ n
W :
Record → ℝ
hW :
hWR :
∀ o, 0 ≤ W o ∧ W o ≤ 1
variance (fun ω : Experiment n => (n : ℝ)⁻¹ * ∑ i, W (ω.1 i)) (experimentLaw P n)
≤ 1/(n : ℝ)
Proof (Lean source)
-- @node: bounded_sampleMean_variance_le lemma bounded_sampleMean_variance_le (P : ObservedLaw) (n : ℕ) (hn : 1 ≤ n) (W : Record → ℝ) (hW : Continuous W) (hWR : ∀ o, 0 ≤ W o ∧ W o ≤ 1) : variance (fun ω : Experiment n => (n : ℝ)⁻¹ * ∑ i, W (ω.1 i)) (experimentLaw P n) ≤ 1/(n : ℝ) := by have hMem : MemLp W 2 P.measure := hW.memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hVar : variance W P.measure ≤ 1 := by have h := variance_le_sq_of_bounded (μ := P.measure) (Filter.Eventually.of_forall hWR) hW.measurable.aemeasurable norm_num at h linarith have hMeas : Measurable (fun o : Fin n → Record => (n : ℝ)⁻¹ * ∑ i, W (o i)) := by fun_prop rw [experimentLaw, measurePreserving_fst.variance_fun_comp hMeas.aemeasurable, variance_const_mul] have hSum : variance (fun o : Fin n → Record => ∑ i, W (o i)) (iidLaw P.measure n) = (n : ℝ) * variance W P.measure := by have heq : (fun o : Fin n → Record => ∑ i, W (o i)) = ∑ i : Fin n, fun o : Fin n → Record => W (o i) := by funext o simp rw [heq] simpa [iidLaw] using (variance_sum_pi (μ := fun _ : Fin n => P.measure) (X := fun _ => W) (fun _ => hMem)) rw [hSum] have hnR : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) calc (n : ℝ)⁻¹ ^ 2 * ((n : ℝ) * variance W P.measure) ≤ (n : ℝ)⁻¹ ^ 2 * ((n : ℝ) * 1) := by gcongr _ = 1/(n : ℝ) := by field_simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.bounded_sampleMean_variance_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:94
theorem coordinate_variance_sub_le Lemma coordinate_variance_sub_le in the paper ↗

[Nonnegativity of the sum variance bounds the variance of a difference, without requiring the two coordinates to be independent. the documented result Under the stated assumptions.

Formal statement
Ω :
X Y :
Ω → ℝ
hX :
MemLp X 2 μ
hY :
MemLp Y 2 μ
variance (fun ω => X ω-Y ω) μ ≤ 2*variance X μ+2*variance Y μ
Proof (Lean source)
-- @node: coordinate_variance_sub_le lemma coordinate_variance_sub_le {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] (X Y : Ω → ℝ) (hX : MemLp X 2 μ) (hY : MemLp Y 2 μ) : variance (fun ω => X ω-Y ω) μ ≤ 2*variance X μ+2*variance Y μ := by have hAdd := variance_nonneg (fun ω => X ω+Y ω) μ rw [variance_fun_add hX hY] at hAdd rw [variance_fun_sub hX hY] linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinate_variance_sub_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:128
theorem coordinateEstimates_variance_bounds

Both exact coordinate estimates obey the prescribed public variance radius. Under the stated assumptions.

Formal statement
hDesign :
n kC kS :
ℕ
hn :
2 ≤ n
conclusion 1
variance (fun ω : Experiment n => cHat n kC ω.1) (experimentLaw P n) ≤ varianceRadius n kC
conclusion 2
variance (fun ω : Experiment n => sHat n kS ω.1) (experimentLaw P n) ≤ varianceRadius n kS
Proof (Lean source)
-- @node: coordinateEstimates_variance_bounds lemma coordinateEstimates_variance_bounds (P : ObservedLaw) (hDesign : UniformDesign P) (n kC kS : ℕ) (hn : 2 ≤ n) : variance (fun ω : Experiment n => cHat n kC ω.1) (experimentLaw P n) ≤ varianceRadius n kC ∧ variance (fun ω : Experiment n => sHat n kS ω.1) (experimentLaw P n) ≤ varianceRadius n kS := by letI := experimentLaw_probability P n have hTreat (o : Record) : 0 ≤ treatment o ∧ treatment o ≤ 1 := by unfold treatment; split <;> norm_num have hOutcome (o : Record) : 0 ≤ outcome o ∧ outcome o ≤ 1 := by unfold outcome; split <;> norm_num have hAY (o : Record) : 0 ≤ treatment o * outcome o ∧ treatment o * outcome o ≤ 1 := by rcases o with ⟨x, a, y⟩; cases a <;> cases y <;> norm_num [treatment, outcome] have h10 (o : Record) : 0 ≤ treatment o * (1-outcome o) ∧ treatment o * (1-outcome o) ≤ 1 := by rcases o with ⟨x, a, y⟩; cases a <;> cases y <;> norm_num [treatment, outcome] have h01 (o : Record) : 0 ≤ (1-treatment o) * outcome o ∧ (1-treatment o) * outcome o ≤ 1 := by rcases o with ⟨x, a, y⟩; cases a <;> cases y <;> norm_num [treatment, outcome] have hCproj := projectionStatistic_experiment_variance_le P hDesign n kC hn treatment outcome continuous_treatment_mark continuous_outcome_mark hTreat hOutcome have hSproj := projectionStatistic_experiment_variance_le P hDesign n kS hn (fun o => treatment o * (1-outcome o)) (fun o => (1-treatment o) * outcome o) (by fun_prop) (by fun_prop) h10 h01 have hMean := bounded_sampleMean_variance_le P n (by omega) (fun o => treatment o * outcome o) (by fun_prop) hAY have hMeanMem : MemLp (fun ω : Experiment n => (n : ℝ)⁻¹ * ∑ i, treatment (ω.1 i) * outcome (ω.1 i)) 2 (experimentLaw P n) := by have hCont : Continuous (fun ω : Experiment n => (n : ℝ)⁻¹ * ∑ i, treatment (ω.1 i) * outcome (ω.1 i)) := by fun_prop exact hCont.memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hCprojMem : MemLp (fun ω : Experiment n => projectionStatistic n kC treatment outcome ω.1) 2 (experimentLaw P n) := by exact ((continuous_projectionStatistic_sample n kC _ _ continuous_treatment_mark continuous_outcome_mark).comp continuous_fst).memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) constructor · have h := coordinate_variance_sub_le (experimentLaw P n) _ _ hMeanMem hCprojMem change variance (fun ω : Experiment n => (n : ℝ)⁻¹ * ∑ i, treatment (ω.1 i) * outcome (ω.1 i) - projectionStatistic n kC treatment outcome ω.1) (experimentLaw P n) ≤ _ unfold varianceRadius simp only [div_eq_mul_inv] at hMean hCproj ⊢ nlinarith [h] · change variance (fun ω : Experiment n => projectionStatistic n kS (fun o => treatment o * (1-outcome o)) (fun o => (1-treatment o) * outcome o) ω.1) (experimentLaw P n) ≤ _ have hnR : (1 : ℝ) < n := by exact_mod_cast (show 1 < n by omega) have hExtra : 0 ≤ 6/(n : ℝ)+2*kS/((n : ℝ)*((n : ℝ)-1)) := by positivity unfold varianceRadius simp only [div_eq_mul_inv] at hSproj hExtra ⊢ nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinateEstimates_variance_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:140
theorem experiment_integral_sample

[Integrating a statistic that ignores the independent probability seed gives its original finite-sample expectation. the documented result

Formal statement
n :
ℕ
f :
(Fin n → Record) → ℝ
(∫ ω : Experiment n, f ω.1 ∂experimentLaw P n)
= ∫ o, f o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n
Proof (Lean source)
-- @node: experiment_integral_sample lemma experiment_integral_sample (P : ObservedLaw) (n : ℕ) (f : (Fin n → Record) → ℝ) : (∫ ω : Experiment n, f ω.1 ∂experimentLaw P n) = ∫ o, f o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n := by letI : IsProbabilityMeasure (iidLaw P.measure n) := by unfold iidLaw infer_instance rw [experimentLaw, integral_fun_fst] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.experiment_integral_sample · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:191
theorem sampleMean_experiment_integral

The seed-free empirical mean has the original one-record expectation. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
hn :
1 ≤ n
W :
Record → ℝ
hW :
(∫ ω : Experiment n, (n : ℝ)⁻¹ * ∑ i, W (ω.1 i) ∂experimentLaw P n) = ∫ o, W o ∂P.measure
Proof (Lean source)
-- @node: sampleMean_experiment_integral lemma sampleMean_experiment_integral (P : ObservedLaw) (n : ℕ) (hn : 1 ≤ n) (W : Record → ℝ) (hW : Continuous W) : (∫ ω : Experiment n, (n : ℝ)⁻¹ * ∑ i, W (ω.1 i) ∂experimentLaw P n) = ∫ o, W o ∂P.measure := by let μ := Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n letI : IsProbabilityMeasure μ := by dsimp [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] infer_instance have hi (i : Fin n) : Integrable (fun o : Fin n → Record => W (o i)) μ := (hW.comp (continuous_apply i)).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) rw [experiment_integral_sample P n (fun o => (n : ℝ)⁻¹ * ∑ i, W (o i)), integral_const_mul, integral_finsetSum _ (fun i _ => hi i)] have heval (i : Fin n) : (∫ o : Fin n → Record, W (o i) ∂μ) = ∫ o, W o ∂P.measure := by exact integral_comp_eval hW.measurable.aestronglyMeasurable change (n : ℝ)⁻¹ * (∑ i : Fin n, ∫ o : Fin n → Record, W (o i) ∂μ) = _ simp_rw [heval] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hnR : (n : ℝ) ≠ 0 := by exact_mod_cast (show n ≠ 0 by omega) field_simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.sampleMean_experiment_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:203
theorem conditionalMarkMean_treatment

Disintegration identifies the conditional treatment mean with propensity. Under the stated assumptions.

Formal statement
hW :
W.value = treatment
conditionalMarkMean P W = propensity P
Proof (Lean source)
-- @node: conditionalMarkMean_treatment lemma conditionalMarkMean_treatment (P : ObservedLaw) (W : BoundedMark) (hW : W.value = treatment) : conditionalMarkMean P W = propensity P := by funext x simp [conditionalMarkMean, hW, treatment, propensity] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_treatment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:226
theorem conditionalMarkMean_outcome

Disintegration identifies the conditional outcome mean with the marginal risk. Under the stated assumptions.

Formal statement
hW :
W.value = outcome
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_outcome · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:234
theorem conditionalMarkMean_offdiagonal

[The two off-diagonal marks have exactly the model's off-diagonal cell means. the stated conclusion holds. Under the stated assumptions.

Formal statement
W V :
hW :
W.value = fun o => treatment o * (1-outcome o)
hV :
V.value = fun o => (1-treatment o) * outcome o
conclusion 1
conditionalMarkMean P W = cellProbability P true false
conclusion 2
conditionalMarkMean P V = cellProbability P false true
Proof (Lean source)
-- @node: conditionalMarkMean_offdiagonal lemma conditionalMarkMean_offdiagonal (P : ObservedLaw) (W V : BoundedMark) (hW : W.value = fun o => treatment o * (1-outcome o)) (hV : V.value = fun o => (1-treatment o) * outcome o) : conditionalMarkMean P W = cellProbability P true false ∧ conditionalMarkMean P V = cellProbability P false true := by constructor <;> funext x <;> rw [cellProbability_eq_cells] · simp [conditionalMarkMean, hW, treatment, outcome] · simp [conditionalMarkMean, hV, treatment, outcome]
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_offdiagonal · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:242
theorem coordinateEstimates_bias_identities

The coordinate biases are precisely the two projection residual inner products; no nuisance smoothness or approximation premise is used in these identities. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hDesign :
n kC kS :
ℕ
hn :
2 ≤ n
conclusion 1
(∫ ω : Experiment n, cHat n kC ω.1 ∂experimentLaw P n) - covarianceCoordinate P
= uniformInner (fun x => propensity P x-cosineProjection kC (propensity P) x) (fun x => marginalMean P x-cosineProjection kC (marginalMean P) x)
conclusion 2
(∫ ω : Experiment n, sHat n kS ω.1 ∂experimentLaw P n) - denominatorCoordinate P
= -uniformInner (fun x => cellProbability P true false x-cosineProjection kS (cellProbability P true false) x) (fun x => cellProbability P false true x-cosineProjection kS (cellProbability P false true) x)
Proof (Lean source)
-- @node: coordinateEstimates_bias_identities lemma coordinateEstimates_bias_identities (P : ObservedLaw) (hDesign : UniformDesign P) (n kC kS : ℕ) (hn : 2 ≤ n) : (∫ ω : Experiment n, cHat n kC ω.1 ∂experimentLaw P n) - covarianceCoordinate P = uniformInner (fun x => propensity P x-cosineProjection kC (propensity P) x) (fun x => marginalMean P x-cosineProjection kC (marginalMean P) x) ∧ (∫ ω : Experiment n, sHat n kS ω.1 ∂experimentLaw P n) - denominatorCoordinate P = -uniformInner (fun x => cellProbability P true false x-cosineProjection kS (cellProbability P true false) x) (fun x => cellProbability P false true x-cosineProjection kS (cellProbability P false true) x) := by letI := experimentLaw_probability P n let A : BoundedMark := ⟨treatment, continuous_treatment_mark.measurable, by intro o; unfold treatment; split <;> norm_num⟩ let Y : BoundedMark := ⟨outcome, continuous_outcome_mark.measurable, by intro o; unfold outcome; split <;> norm_num⟩ let W : BoundedMark := ⟨(fun o => treatment o*(1-outcome o)), by fun_prop, by rintro ⟨x,a,y⟩; cases a <;> cases y <;> norm_num [treatment,outcome]⟩ let V : BoundedMark := ⟨(fun o => (1-treatment o)*outcome o), by fun_prop, by rintro ⟨x,a,y⟩; cases a <;> cases y <;> norm_num [treatment,outcome]⟩ have hA := conditionalMarkMean_treatment P A rfl have hY := conditionalMarkMean_outcome P Y rfl obtain ⟨hW,hV⟩ := conditionalMarkMean_offdiagonal P W V rfl rfl have hCbias := projectionStatistic_bias P hDesign A Y kC n hn have hSbias := projectionStatistic_bias P hDesign W V kS n hn rw [hA,hY] at hCbias rw [hW,hV] at hSbias have hCCont := continuous_projectionStatistic_sample n kC treatment outcome continuous_treatment_mark continuous_outcome_mark have hSCont := continuous_projectionStatistic_sample n kS W.value V.value (by dsimp [W]; fun_prop) (by dsimp [V]; fun_prop) have hCmean : (∫ ω : Experiment n, projectionStatistic n kC treatment outcome ω.1 ∂experimentLaw P n) = ∫ o, projectionStatistic n kC treatment outcome o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n := experiment_integral_sample P n _ have hSmean : (∫ ω : Experiment n, projectionStatistic n kS W.value V.value ω.1 ∂experimentLaw P n) = ∫ o, projectionStatistic n kS W.value V.value o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n := experiment_integral_sample P n _ constructor · have hMeanCont : Continuous (fun ω : Experiment n => (n : ℝ)⁻¹ * ∑ i, treatment (ω.1 i)*outcome (ω.1 i)) := by fun_prop have hMeanInt : Integrable (fun ω : Experiment n => (n : ℝ)⁻¹ * ∑ i, treatment (ω.1 i)*outcome (ω.1 i)) (experimentLaw P n) := hMeanCont.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hProjInt : Integrable (fun ω : Experiment n => projectionStatistic n kC treatment outcome ω.1) (experimentLaw P n) := (hCCont.comp continuous_fst).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) simp only [cHat] rw [integral_sub hMeanInt hProjInt, sampleMean_experiment_integral P n (by omega) (fun o => treatment o*outcome o) (by fun_prop), hCmean] unfold covarianceCoordinate rw [← hCbias] unfold uniformInner dsimp [A,Y] ring · change (∫ ω : Experiment n, projectionStatistic n kS W.value V.value ω.1 ∂experimentLaw P n) - _ = _ rw [hSmean, ← hSbias] unfold denominatorCoordinate uniformInner ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinateEstimates_bias_identities · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CoordinateVariance.lean:253
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.CosProgram 13 declarations The fixed program computes the midpoint polynomial by the successive-term recurrence, sorts its scalar endpoints, and enlarges by the input half width.

Finite register certificate for the prescribed cosine routine

The fixed program computes the midpoint polynomial by the successive-term recurrence, sorts its scalar endpoints, and enlarges by the input half width.

[The next cosine term is obtained by the prescribed rational multiplier. the stated conclusion holds.

Formal statement
j :
ℕ
z :
ℚ
(((-1 : ℚ)^j*z^(2*j)/(factorial (2*j) : ℚ)) * (-z^2)) / ((2*j+1 : ℕ)*(2*j+2 : ℕ) : ℚ)
= (-1 : ℚ)^(j+1)*z^(2*(j+1))/(factorial (2*(j+1)) : ℚ)
Proof (Lean source)
-- @node: cosRegister_term_succ lemma cosRegister_term_succ (j : ℕ) (z : ℚ) : (((-1 : ℚ)^j*z^(2*j)/(factorial (2*j) : ℚ)) * (-z^2)) / ((2*j+1 : ℕ)*(2*j+2 : ℕ) : ℚ) = (-1 : ℚ)^(j+1)*z^(2*(j+1))/(factorial (2*(j+1)) : ℚ) := by rw [show 2*(j+1) = (2*j+1)+1 by omega, Nat.factorial_succ, Nat.factorial_succ] push_cast rw [show 2*j+1+1 = 2*j+2 by omega, pow_add, pow_succ] have hf : (factorial (2*j) : ℚ) ≠ 0 := by positivity have h1 : (2*(j : ℚ)+1) ≠ 0 := by positivity have h2 : (2*(j : ℚ)+2) ≠ 0 := by positivity field_simp ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegister_term_succ · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:15

The finite midpoint cosine program, including the exact prescribed truncation count.

Definition (Lean source)
cosRegisterCode :
[.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .add 4 1 2, .div 4 4 9, .sub 15 2 1, .div 15 15 9, .mul 10 4 4, .constant 13 (-1), .mul 10 10 13, .copy 11 4, .constant 13 (-1), .mul 13 4 13, .max 11 11 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .constant 5 1, .constant 6 0, .constant 3 1, .branchLe 2 12 35 27, .add 6 6 5, .add 13 3 8, .mul 13 3 13, .mul 5 5 10, .div 5 5 13, .add 3 3 9, .sub 2 2 8, .jump 26, .constant 13 3, .add 13 14 13, .natPow 9 9 13, .div 8 8 9, .sub 0 6 8, .add 1 6 8, .constant 13 (-1), .max 0 13 0, .constant 16 1, .min 1 16 1, .min 17 0 1, .max 1 0 1, .copy 0 17, .sub 0 0 15, .add 1 1 15, .max 0 13 0, .min 1 16 1, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:30

Registers at the head of the cosine term loop.

Definition (Lean source)
q j remaining :
ℕ
z w :
ℚ
pc :
s.1 = 26
active :
s.2.2 = false
count :
s.2.1 2 = remaining
odd :
s.2.1 3 = (2*j+1 : ℕ)
argument :
s.2.1 4 = z
term :
s.2.1 5 = (-1 : ℚ)^j*z^(2*j)/(factorial (2*j) : ℚ)
sum :
s.2.1 6 = ∑ i ∈ range j, (-1 : ℚ)^i*z^(2*i)/(factorial (2*i) : ℚ)
one :
s.2.1 8 = 1
two :
s.2.1 9 = 2
ratio :
s.2.1 10 = -z^2
zero :
s.2.1 12 = 0
precision :
s.2.1 14 = q
halfWidth :
s.2.1 15 = w
CausalSmith.Stat.LogoddsLowsmoothFrontier.CosRegisterInvariant · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:50
theorem cosRegisterCode_initial

Initialization on arbitrary rational inputs clamps the precision to a natural number. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
z :
(xs[1]?.getD 0 + xs[2]?.getD 0)/2
w :
(xs[2]?.getD 0 - xs[1]?.getD 0)/2
CosRegisterInvariant q 0 (seriesCount q z) z w (cosRegisterCode.run 26 (RationalProgram.initial xs))
Proof (Lean source)
-- @node: cosRegisterCode_initial lemma cosRegisterCode_initial (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let z := (xs[1]?.getD 0 + xs[2]?.getD 0)/2 let w := (xs[2]?.getD 0 - xs[1]?.getD 0)/2 CosRegisterInvariant q 0 (seriesCount q z) z w (cosRegisterCode.run 26 (RationalProgram.initial xs)) := by have hq : max (↑(⌊xs[0]?.getD 0⌋ : ℤ) : ℚ) 0 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊xs[0]?.getD 0⌋ : ℤ) 0 = (((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℕ) : ℤ) by omega) have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] have hB (z : ℚ) : max (↑(⌈|z|⌉ : ℤ) : ℚ) 1 = (seriesBound z : ℚ) := by have hn : 0 ≤ (⌈|z|⌉ : ℤ) := Int.ceil_nonneg (abs_nonneg z) have hc : ((⌈|z|⌉ : ℤ).toNat : ℚ) = (⌈|z|⌉ : ℤ) := by exact_mod_cast Int.toNat_of_nonneg hn simp only [seriesBound, Nat.cast_max, Nat.cast_one, hc] exact max_comm _ _ generalize he : cosRegisterCode.run 26 (RationalProgram.initial xs) = t norm_num [cosRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, hq, habs, hB] at he subst t constructor <;> norm_num [Function.update_apply, seriesCount, Nat.cast_max, Nat.cast_mul, Nat.cast_pow, Nat.cast_add] <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterCode_initial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:67
theorem cosRegisterCode_round

Each nine-instruction loop block adds one term and advances its multiplier. the stated conclusion holds. Under the stated assumptions.

Formal statement
q j N :
ℕ
z w :
ℚ
h :
CosRegisterInvariant q j (N+1) z w s
CosRegisterInvariant q (j+1) N z w (cosRegisterCode.run 9 s)
Proof (Lean source)
-- @node: cosRegisterCode_round lemma cosRegisterCode_round (q j N : ℕ) (z w : ℚ) (s : RationalState) (h : CosRegisterInvariant q j (N+1) z w s) : CosRegisterInvariant q (j+1) N z w (cosRegisterCode.run 9 s) := by rcases h with ⟨hp, ha, hc, ho, hz, ht, hs, h1, h2, hr, h0, hq, hw⟩ have hcpos : ¬ (s.2.1 2 ≤ s.2.1 12) := by rw [hc, h0] exact not_le.mpr (by positivity) generalize he : cosRegisterCode.run 9 s = t norm_num [cosRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hcpos] at he subst t constructor <;> norm_num [Function.update_apply, hc, ho, hz, ht, hs, h1, h2, hr, h0, hq, hw, Finset.sum_range_succ, Nat.cast_add, Nat.cast_mul] · ring · convert cosRegister_term_succ j z using 1 <;> push_cast <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterCode_round · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:96
theorem cosRegisterCode_exit

At zero count the exit block returns the literal scalar sorting and width enlargement. Under the stated assumptions. The stated conclusion follows.

Formal statement
q j :
ℕ
z w :
ℚ
h :
S :
∑ i ∈ range j, (-1 : ℚ)^i*z^(2*i)/(factorial (2*i) : ℚ)
a :
max (-1) (S - rationalError (q+3))
b :
min 1 (S + rationalError (q+3))
t :
cosRegisterCode.run 20 s
t.2.2 = true
t.2.1 0 = max (-1) (min a b - w)
t.2.1 1 = min 1 (max a b + w)
Proof (Lean source)
-- @node: cosRegisterCode_exit lemma cosRegisterCode_exit (q j : ℕ) (z w : ℚ) (s : RationalState) (h : CosRegisterInvariant q j 0 z w s) : let S := ∑ i ∈ range j, (-1 : ℚ)^i*z^(2*i)/(factorial (2*i) : ℚ) let a := max (-1) (S - rationalError (q+3)) let b := min 1 (S + rationalError (q+3)) let t := cosRegisterCode.run 20 s t.2.2 = true ∧ t.2.1 0 = max (-1) (min a b - w) ∧ t.2.1 1 = min 1 (max a b + w) := by rcases h with ⟨hp, ha, hc, ho, hz, ht, hs, h1, h2, hr, h0, hq, hw⟩ have hnat : ((q : ℤ)+3).toNat = q+3 := by omega norm_num [cosRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, hs, h1, h2, h0, hq, hw, rationalError, ← Nat.cast_add, hnat]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterCode_exit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:114
theorem cosRegisterCode_loop

Iteration exhausts the prescribed term counter before executing the exit block. Under the stated assumptions.

Formal statement
q j N :
ℕ
z w :
ℚ
h :
S :
∑ i ∈ range (j+N), (-1 : ℚ)^i*z^(2*i)/(factorial (2*i) : ℚ)
a :
max (-1) (S - rationalError (q+3))
b :
min 1 (S + rationalError (q+3))
t :
cosRegisterCode.run (9*N+20) s
t.2.2 = true
t.2.1 0 = max (-1) (min a b - w)
t.2.1 1 = min 1 (max a b + w)
Proof (Lean source)
-- @node: cosRegisterCode_loop lemma cosRegisterCode_loop (q j N : ℕ) (z w : ℚ) (s : RationalState) (h : CosRegisterInvariant q j N z w s) : let S := ∑ i ∈ range (j+N), (-1 : ℚ)^i*z^(2*i)/(factorial (2*i) : ℚ) let a := max (-1) (S - rationalError (q+3)) let b := min 1 (S + rationalError (q+3)) let t := cosRegisterCode.run (9*N+20) s t.2.2 = true ∧ t.2.1 0 = max (-1) (min a b - w) ∧ t.2.1 1 = min 1 (max a b + w) := by induction N generalizing j s with | zero => simpa using cosRegisterCode_exit q j z w s h | succ N ih => rw [show 9*(N+1)+20 = 9+(9*N+20) by omega, rationalProgram_run_add] simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (j+1) _ (cosRegisterCode_round q j N z w s h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterCode_loop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:130

The total public step count includes initialization, each term, and clipping.

Definition (Lean source)
xs :
List ℚ
cosRegisterFuel xs :
ℕ
26 + (9*seriesCount (⌊xs[0]?.getD 0⌋ : ℤ).toNat ((xs[1]?.getD 0 + xs[2]?.getD 0)/2) + 20)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:147

A fixed straight-line program computes the public fuel from the same input bounds.

Definition (Lean source)
cosRegisterFuelCode :
cosRegisterCode.take 26 ++ [.constant 13 9, .mul 0 2 13, .constant 13 46, .add 0 0 13, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:153
theorem cosRegisterFuel_public

The cosine fuel is itself a total finite rational register computation. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: cosRegisterFuel_public lemma cosRegisterFuel_public : PublicIterationBound cosRegisterFuel := by refine ⟨cosRegisterFuelCode, ?_⟩ intro xs have hp : cosRegisterFuelCode.run 26 (RationalProgram.initial xs) = cosRegisterCode.run 26 (RationalProgram.initial xs) := by norm_num [cosRegisterFuelCode, cosRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply] have h := cosRegisterCode_initial xs refine ⟨31, ?_, ?_⟩ all_goals rw [show 31 = 26+5 by rfl, rationalProgram_run_add, hp] generalize he : cosRegisterCode.run 26 (RationalProgram.initial xs) = s at h ⊢ norm_num [cosRegisterFuelCode, cosRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, h.pc, h.active, h.count, cosRegisterFuel, Nat.cast_add, Nat.cast_mul] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:159
theorem cosRegisterCode_halts

The publicly bounded cosine computation halts on every rational input list. the stated conclusion holds.

Formal statement
xs :
List ℚ
(cosRegisterCode.run (cosRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true
Proof (Lean source)
-- @node: cosRegisterCode_halts lemma cosRegisterCode_halts (xs : List ℚ) : (cosRegisterCode.run (cosRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true := by unfold cosRegisterFuel rw [rationalProgram_run_add] exact (cosRegisterCode_loop _ _ _ _ _ _ (cosRegisterCode_initial xs)).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterCode_halts · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:178

Certified register implementation of the midpoint cosine routine.

Definition (Lean source)
cosRegisterProgram :
clause 1
clause 2
iterationBound := cosRegisterFuel
clause 3
public_bound := cosRegisterFuel_public
clause 4
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosRegisterProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:186
theorem concreteEngine_cos_register_certificate

The finite recurrence returns exactly the concrete engine's cosine interval. the stated conclusion holds.

Formal statement
q :
ℕ
concreteEngine.cosBox q I
= let v := cosRegisterProgram.eval [q, I.lo, I.hi]; rationalBox v.1 v.2
Proof (Lean source)
-- @node: concreteEngine_cos_register_certificate lemma concreteEngine_cos_register_certificate (q : ℕ) (I : RatInterval) : concreteEngine.cosBox q I = let v := cosRegisterProgram.eval [q, I.lo, I.hi]; rationalBox v.1 v.2 := by have h := cosRegisterCode_loop _ _ _ _ _ _ (cosRegisterCode_initial [(q : ℚ), I.lo, I.hi]) simp only [List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast, zero_add] at h change paperCos q I = rationalBox ((cosRegisterCode.run (cosRegisterFuel [q, I.lo, I.hi]) (RationalProgram.initial [q, I.lo, I.hi])).2.1 0) ((cosRegisterCode.run (cosRegisterFuel [q, I.lo, I.hi]) (RationalProgram.initial [q, I.lo, I.hi])).2.1 1) unfold cosRegisterFuel simp only [List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] rw [rationalProgram_run_add, h.2.1, h.2.2] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_cos_register_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/CosProgram.lean:194
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.EndpointCoordinates 9 declarations The original-record ordered-pair expression propagates kernel widths through exact binary marks and exact normalization.

Literal coordinate enclosures

The original-record ordered-pair expression propagates kernel widths through exact binary marks and exact normalization. The empirical mean is rational and exact, so both coordinate expressions inherit the kernel width bound without a sample size loss. These are bounds on the actual expression tree.

theorem endpoint_indexed_sum_enclosure

Finite expression sums preserve containment and add width bounds for any index type. Under the stated assumptions. Under the stated assumptions.

Formal statement
ι :
Type*
q :
ℕ
f :
ι → BoxExpr
v w :
ι → ℝ
js :
List ι
h :
∀ j ∈ js,
∃ B : RatInterval, (f j).eval E q xs = some B ∧ B.Contains (v j) ∧ (B.width : ℝ) ≤ w j
∃ B : RatInterval,
conclusion 1
(expressionSum (js.map f)).eval E q xs = some B
conclusion 2
B.Contains ((js.map v).sum)
conclusion 3
(B.width : ℝ) ≤ (js.map w).sum
Proof (Lean source)
-- @node: endpoint_indexed_sum_enclosure lemma endpoint_indexed_sum_enclosure {ι : Type*} (E : ArithmeticEngine) (q : ℕ) (xs : List RatInterval) (f : ι → BoxExpr) (v w : ι → ℝ) (js : List ι) (h : ∀ j ∈ js, ∃ B : RatInterval, (f j).eval E q xs = some B ∧ B.Contains (v j) ∧ (B.width : ℝ) ≤ w j) : ∃ B : RatInterval, (expressionSum (js.map f)).eval E q xs = some B ∧ B.Contains ((js.map v).sum) ∧ (B.width : ℝ) ≤ (js.map w).sum := by induction js with | nil => refine ⟨RatInterval.point 0, rfl, ?_, ?_⟩ · simp · simp [RatInterval.width, RatInterval.point] | cons j js ih => obtain ⟨A, hA, hvA, hwA⟩ := h j (by simp) obtain ⟨B, hB, hvB, hwB⟩ := ih (fun l hl => h l (by simp [hl])) refine ⟨A.add B, ?_, ?_, ?_⟩ · change (BoxExpr.add (f j) (expressionSum (js.map f))).eval E q xs = some (A.add B) simp [BoxExpr.eval, hA, hB] · simpa only [List.map_cons, List.sum_cons] using RatInterval.add_sound hvA hvB · rw [RatInterval.width_add] push_cast simpa only [List.map_cons, List.sum_cons] using add_le_add hwA hwB
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_indexed_sum_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:17
theorem endpoint_point_scale_width

Multiplication by an exact nonnegative rational scales the width exactly. Under the stated assumptions.

Formal statement
a :
ℚ
ha :
0 ≤ a
conclusion 1
(I.mul (RatInterval.point a)).width = I.width*a
conclusion 2
((RatInterval.point a).mul I).width = a*I.width
Proof (Lean source)
-- @node: endpoint_point_scale_width lemma endpoint_point_scale_width (I : RatInterval) (a : ℚ) (ha : 0 ≤ a) : (I.mul (RatInterval.point a)).width = I.width*a ∧ ((RatInterval.point a).mul I).width = a*I.width := by obtain ⟨hlo, hhi⟩ := endpoint_mul_point_endpoints I a ha constructor · change (I.mul (RatInterval.point a)).hi - (I.mul (RatInterval.point a)).lo = (I.hi-I.lo)*a rw [hlo, hhi] ring · have heq : (RatInterval.point a).mul I = I.mul (RatInterval.point a) := by have h := mul_le_mul_of_nonneg_left I.lo_le_hi ha simp [RatInterval.mul, RatInterval.point, mul_comm, min_eq_left h, max_eq_right h] rw [heq] change (I.mul (RatInterval.point a)).hi - (I.mul (RatInterval.point a)).lo = a*(I.hi-I.lo) rw [hlo, hhi] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_point_scale_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:41
theorem endpoint_pair_list_finset Lemma endpoint_pair_list_finset in the paper ↗

[The filtered list in the literal statistic enumerates precisely the ordered distinct pairs. the stated conclusion holds.

Formal statement
n :
ℕ
((Finset.univ : Finset (Fin n × Fin n)).toList.filter (fun ij => ij.1 ≠ ij.2)).toFinset
= (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2)
Proof (Lean source)
-- @node: endpoint_pair_list_finset lemma endpoint_pair_list_finset (n : ℕ) : ((Finset.univ : Finset (Fin n × Fin n)).toList.filter (fun ij => ij.1 ≠ ij.2)).toFinset = (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2) := by ext ij simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_pair_list_finset · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:61

There are exactly n(n-1) ordered distinct pairs, including the small sample cases. the stated conclusion holds.

Formal statement
n :
ℕ
(((Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2)).card : ℝ)
= (n : ℝ)*((n : ℝ)-1)
Proof (Lean source)
-- @node: endpoint_pair_card lemma endpoint_pair_card (n : ℕ) : (((Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2)).card : ℝ) = (n : ℝ)*((n : ℝ)-1) := by have heq : (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2) = (Finset.univ : Finset (Fin n)).offDiag := by ext ij simp rw [heq, Finset.offDiag_card] simp only [Finset.card_univ, Fintype.card_fin] rw [Nat.cast_sub (by nlinarith : n ≤ n*n)] push_cast ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_pair_card · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:69
theorem endpoint_statistic_enclosure Lemma endpoint_statistic_enclosure in the paper ↗

Normalizing the actual ordered-pair sum cancels the pair count in the width bound. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hE :
E.Admissible
q :
ℕ
hq :
precisionError q ≤ 1/4
n k :
ℕ
hn :
2 ≤ n
o :
Fin n → Record
X :
hX :
∀ i,
xs[2+i.val]? = some (X i) ∧
(X i).Contains (covariate (o i)) ∧
-precisionError q ≤ ((X i).lo : ℝ) ∧
((X i).hi : ℝ) ≤ 1 + precisionError q ∧
((X i).width : ℝ) ≤ precisionError q
W V :
Fin n → ℚ
hW :
∀ i, 0 ≤ W i ∧ W i ≤ 1
hV :
∀ i, 0 ≤ V i ∧ V i ≤ 1
∃ B : RatInterval,
conclusion 1
(statisticExpression n k W V).eval E q xs = some B
conclusion 2
B.Contains (((n : ℝ)*((n : ℝ)-1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), projectionKernel k (covariate (o ij.1)) (covariate (o ij.2)) * (W ij.1 : ℝ) * V ij.2)
conclusion 3
(B.width : ℝ) ≤ 160*(k : ℝ)^2*precisionError q
Proof (Lean source)
lemma endpoint_statistic_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (hq : precisionError q ≤ 1/4) (n k : ℕ) (hn : 2 ≤ n) (o : Fin n → Record) (xs : List RatInterval) (X : Fin n → RatInterval) (hX : ∀ i, xs[2+i.val]? = some (X i) ∧ (X i).Contains (covariate (o i)) ∧ -precisionError q ≤ ((X i).lo : ℝ) ∧ ((X i).hi : ℝ) ≤ 1 + precisionError q ∧ ((X i).width : ℝ) ≤ precisionError q) (W V : Fin n → ℚ) (hW : ∀ i, 0 ≤ W i ∧ W i ≤ 1) (hV : ∀ i, 0 ≤ V i ∧ V i ≤ 1) : ∃ B : RatInterval, (statisticExpression n k W V).eval E q xs = some B ∧ B.Contains (((n : ℝ)*((n : ℝ)-1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), projectionKernel k (covariate (o ij.1)) (covariate (o ij.2)) * (W ij.1 : ℝ) * V ij.2) ∧ (B.width : ℝ) ≤ 160*(k : ℝ)^2*precisionError q := by let pairs := (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2) let js := (Finset.univ : Finset (Fin n × Fin n)).toList.filter (fun ij => ij.1 ≠ ij.2) have hjs : js.Nodup := Finset.nodup_toList _ |>.filter _ have hjsFin : js.toFinset = pairs := endpoint_pair_list_finset n let f := fun ij : Fin n × Fin n => BoxExpr.mul (kernelExpression k ij.1.val ij.2.val) (.constant (W ij.1*V ij.2)) let v := fun ij : Fin n × Fin n => projectionKernel k (covariate (o ij.1)) (covariate (o ij.2)) * (W ij.1 : ℝ) * V ij.2 let w := 160*(k : ℝ)^2*precisionError q have hw : 0 ≤ w := by dsimp [w, precisionError]; positivity have hTerm (ij : Fin n × Fin n) (_ : ij ∈ js) : ∃ B : RatInterval, (f ij).eval E q xs = some B ∧ B.Contains (v ij) ∧ (B.width : ℝ) ≤ w := by obtain ⟨hXi, hxi, hXlo, hXhi, hXW⟩ := hX ij.1 obtain ⟨hZi, hzi, hZlo, hZhi, hZW⟩ := hX ij.2 obtain ⟨B, hB, hvB, hwB⟩ := endpoint_kernel_enclosure E hE q hq k ij.1.val ij.2.val xs (X ij.1) (X ij.2) hXi hZi (covariate (o ij.1)) (covariate (o ij.2)) hxi hzi hXlo hXhi hZlo hZhi hXW hZW have ha : 0 ≤ W ij.1*V ij.2 := mul_nonneg (hW _).1 (hV _).1 have haOne : W ij.1*V ij.2 ≤ 1 := by simpa using mul_le_mul (hW ij.1).2 (hV ij.2).2 (hV _).1 (by norm_num : (0 : ℚ) ≤ 1) refine ⟨B.mul (RatInterval.point (W ij.1*V ij.2)), ?_, ?_, ?_⟩ · simp [f, BoxExpr.eval, hB] · simpa only [v, Rat.cast_mul, mul_assoc] using RatInterval.mul_sound hvB (RatInterval.point_sound (W ij.1*V ij.2)) · rw [(endpoint_point_scale_width B _ ha).1] push_cast have ha' : (W ij.1 : ℝ)*(V ij.2 : ℝ) ≤ 1 := by exact_mod_cast haOne have ha0 : 0 ≤ (W ij.1 : ℝ)*(V ij.2 : ℝ) := by exact_mod_cast ha calc _ ≤ w*((W ij.1 : ℝ)*V ij.2) := mul_le_mul_of_nonneg_right hwB ha0 _ ≤ w := by simpa using mul_le_mul_of_nonneg_left ha' hw obtain ⟨B, hB, hvB, hwB⟩ := endpoint_indexed_sum_enclosure E q xs f v (fun _ => w) js hTerm let a : ℚ := 1/((n : ℚ)*((n : ℚ)-1)) have hn' : (1 : ℚ) < n := by exact_mod_cast (show 1 < n by omega) have ha : 0 ≤ a := by dsimp [a]; positivity have haReal : (a : ℝ) = ((n : ℝ)*((n : ℝ)-1))⁻¹ := by dsimp [a] push_cast rw [one_div] have hPairs : (pairs.card : ℝ) = (n : ℝ)*((n : ℝ)-1) := endpoint_pair_card n have hPos : 0 < (n : ℝ)*((n : ℝ)-1) := by have : (1 : ℝ) < n := by exact_mod_cast (show 1 < n by omega) positivity refine ⟨(RatInterval.point a).mul B, ?_, ?_, ?_⟩ · change (BoxExpr.mul (.constant a) (expressionSum (js.map f))).eval E q xs = _ simp only [BoxExpr.eval, hB] rfl · have hsum : (js.map v).sum = ∑ ij ∈ pairs, v ij := by rw [← List.sum_toFinset _ hjs, hjsFin] rw [hsum] at hvB simpa only [haReal] using RatInterval.mul_sound (RatInterval.point_sound a) hvB · rw [(endpoint_point_scale_width B a ha).2] push_cast have hsum : (js.map (fun _ => w)).sum = (pairs.card : ℝ)*w := by have hlen : js.length = pairs.card := by rw [← List.toFinset_card_of_nodup hjs, hjsFin] simp [hlen] rw [hsum] at hwB calc _ ≤ (a : ℝ)*((pairs.card : ℝ)*w) := mul_le_mul_of_nonneg_left hwB (by exact_mod_cast ha) _ = w := by rw [haReal, hPairs, ← mul_assoc, inv_mul_cancel₀ hPos.ne']; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_statistic_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:84
theorem endpoint_coordinates_enclosure Lemma endpoint_coordinates_enclosure in the paper ↗

[The binary-label coordinate trees terminate, contain the exact sample coordinates, and inherit the kernel width bounds since the empirical mean is evaluated exactly. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
hq :
precisionError q ≤ 1/4
n kC kS :
ℕ
hn :
2 ≤ n
o :
Fin n → Record
X :
hX :
∀ i,
xs[2+i.val]? = some (X i) ∧
(X i).Contains (covariate (o i)) ∧
-precisionError q ≤ ((X i).lo : ℝ) ∧
((X i).hi : ℝ) ≤ 1 + precisionError q ∧
((X i).width : ℝ) ≤ precisionError q
∃ C S : RatInterval,
conclusion 1
(coordinateExpressions n kC kS o).1.eval E q xs = some C
conclusion 2
(coordinateExpressions n kC kS o).2.eval E q xs = some S
conclusion 3
C.Contains (cHat n kC o)
conclusion 4
S.Contains (sHat n kS o)
conclusion 5
(C.width : ℝ) ≤ 160*(kC : ℝ)^2*precisionError q
conclusion 6
(S.width : ℝ) ≤ 160*(kS : ℝ)^2*precisionError q
Proof (Lean source)
lemma endpoint_coordinates_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (hq : precisionError q ≤ 1/4) (n kC kS : ℕ) (hn : 2 ≤ n) (o : Fin n → Record) (xs : List RatInterval) (X : Fin n → RatInterval) (hX : ∀ i, xs[2+i.val]? = some (X i) ∧ (X i).Contains (covariate (o i)) ∧ -precisionError q ≤ ((X i).lo : ℝ) ∧ ((X i).hi : ℝ) ≤ 1 + precisionError q ∧ ((X i).width : ℝ) ≤ precisionError q) : ∃ C S : RatInterval, (coordinateExpressions n kC kS o).1.eval E q xs = some C ∧ (coordinateExpressions n kC kS o).2.eval E q xs = some S ∧ C.Contains (cHat n kC o) ∧ S.Contains (sHat n kS o) ∧ (C.width : ℝ) ≤ 160*(kC : ℝ)^2*precisionError q ∧ (S.width : ℝ) ≤ 160*(kS : ℝ)^2*precisionError q := by let A : Fin n → ℚ := fun i => if (o i).2.1 then 1 else 0 let Y : Fin n → ℚ := fun i => if (o i).2.2 then 1 else 0 have hA (i : Fin n) : 0 ≤ A i ∧ A i ≤ 1 := by dsimp [A]; split <;> norm_num have hY (i : Fin n) : 0 ≤ Y i ∧ Y i ≤ 1 := by dsimp [Y]; split <;> norm_num have hAc (i : Fin n) : (A i : ℝ) = treatment (o i) := by dsimp [A, treatment]; split <;> norm_num have hYc (i : Fin n) : (Y i : ℝ) = outcome (o i) := by dsimp [Y, outcome]; split <;> norm_num have hW (i : Fin n) : 0 ≤ A i*(1-Y i) ∧ A i*(1-Y i) ≤ 1 := by constructor · exact mul_nonneg (hA i).1 (sub_nonneg.mpr (hY i).2) · simpa using mul_le_mul (hA i).2 (show 1-Y i ≤ 1 by linarith [(hY i).1]) (sub_nonneg.mpr (hY i).2) (by norm_num : (0 : ℚ) ≤ 1) have hV (i : Fin n) : 0 ≤ (1-A i)*Y i ∧ (1-A i)*Y i ≤ 1 := by constructor · exact mul_nonneg (sub_nonneg.mpr (hA i).2) (hY i).1 · simpa using mul_le_mul (show 1-A i ≤ 1 by linarith [(hA i).1]) (hY i).2 (hY i).1 (by norm_num : (0 : ℚ) ≤ 1) obtain ⟨B, hB, hvB, hwB⟩ := endpoint_statistic_enclosure E hE q hq n kC hn o xs X hX A Y hA hY obtain ⟨S, hS, hvS, hwS⟩ := endpoint_statistic_enclosure E hE q hq n kS hn o xs X hX (fun i => A i*(1-Y i)) (fun i => (1-A i)*Y i) hW hV let m : ℚ := (n : ℚ)⁻¹ * ∑ i, A i*Y i have hm : (m : ℝ) = (n : ℝ)⁻¹ * ∑ i, treatment (o i)*outcome (o i) := by simp [m, hAc, hYc] have hvB' : B.Contains (projectionStatistic n kC treatment outcome o) := by simpa only [projectionStatistic, hAc, hYc] using hvB have hvS' : S.Contains (sHat n kS o) := by simpa only [sHat, projectionStatistic, Rat.cast_mul, Rat.cast_sub, Rat.cast_one, hAc, hYc] using hvS refine ⟨(RatInterval.point m).sub B, S, ?_, ?_, ?_, hvS', ?_, hwS⟩ · change (BoxExpr.sub (.constant m) (statisticExpression n kC A Y)).eval E q xs = _ simp only [BoxExpr.eval, hB] rfl · exact hS · simpa only [hm, cHat] using RatInterval.sub_sound (RatInterval.point_sound m) hvB' · rw [RatInterval.width_sub] simpa [RatInterval.width, RatInterval.point] using hwB
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_coordinates_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:162
theorem endpoint_mapM_boxes

A finite list of successful input queries evaluates to the list of their selected boxes. Under the stated assumptions. Under the stated assumptions.

Formal statement
ι :
Type*
f :
X :
js :
List ι
h :
∀ i ∈ js, f i = some (X i)
js.mapM f = some (js.map X)
Proof (Lean source)
-- @node: endpoint_mapM_boxes lemma endpoint_mapM_boxes {ι : Type*} (f : ι → Option RatInterval) (X : ι → RatInterval) (js : List ι) (h : ∀ i ∈ js, f i = some (X i)) : js.mapM f = some (js.map X) := by induction js with | nil => rfl | cons i js ih => simp [List.mapM_cons, h i (by simp), ih (fun j hj => h j (by simp [hj]))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_mapM_boxes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:214
theorem endpoint_inputs_contract Lemma endpoint_inputs_contract in the paper ↗

[All literal endpoint inputs are available at the prescribed precision, with the supplied raw covariate boxes at their exact input positions. the documented result Under the stated assumptions.

Formal statement
hN :
N.Admissible
n :
ℕ
α β :
ℝ
_hab :
o :
Fin n → Record
q :
ℕ
∃ xs : List RatInterval, ∃ X : Fin n → RatInterval,
endpointInputs N n α β o q = some xs
conclusion 1
i :
xs[2+i.val]? = some (X i)
(X i).Contains (covariate (o i))
-precisionError q ≤ ((X i).lo : ℝ)
((X i).hi : ℝ) ≤ 1 + precisionError q
((X i).width : ℝ) ≤ precisionError q
Proof (Lean source)
lemma endpoint_inputs_contract (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (α β : ℝ) (_hab : ExponentDomain α β) (o : Fin n → Record) (q : ℕ) : ∃ xs : List RatInterval, ∃ X : Fin n → RatInterval, endpointInputs N n α β o q = some xs ∧ (∀ i, xs[2+i.val]? = some (X i) ∧ (X i).Contains (covariate (o i)) ∧ -precisionError q ≤ ((X i).lo : ℝ) ∧ ((X i).hi : ℝ) ≤ 1 + precisionError q ∧ ((X i).width : ℝ) ≤ precisionError q) := by let X : Fin n → RatInterval := fun i => N.covariateName n α β o i q refine ⟨N.alphaName n α β q :: N.betaName n α β q :: (List.finRange n).map X, X, rfl, ?_⟩ intro i have hName := (hN.2.1 n α β o i).1 q obtain ⟨hlo, hhi⟩ := endpoint_raw_box_bounds (X i) (covariate (o i)) 0 1 (precisionError q) hName.2.2.1 (unitInterval.nonneg _) (unitInterval.le_one _) hName.2.2.2 refine ⟨?_, hName.2.2.1, ?_, hhi, hName.2.2.2⟩ · simp [List.getElem?_cons, i.isLt] · simpa using hlo
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_inputs_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:224
theorem endpoint_coordinates_budget_contract

[At the actual endpoint budget and with the actual naming policy, both literal coordinate evaluations succeed with the roadmap's width bounds. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n kC kS :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
o :
Fin n → Record
∃ xs : List RatInterval, ∃ C S : RatInterval,
conclusion 1
endpointInputs N n α β o (qEnd n kC kS) = some xs
conclusion 2
(coordinateExpressions n kC kS o).1.eval E (qEnd n kC kS) xs = some C
conclusion 3
(coordinateExpressions n kC kS o).2.eval E (qEnd n kC kS) xs = some S
conclusion 4
C.Contains (cHat n kC o)
conclusion 5
S.Contains (sHat n kS o)
conclusion 6
(C.width : ℝ) ≤ 160*(kC : ℝ)^2*precisionError (qEnd n kC kS)
conclusion 7
(S.width : ℝ) ≤ 160*(kS : ℝ)^2*precisionError (qEnd n kC kS)
Proof (Lean source)
-- @node: endpoint_coordinates_budget_contract lemma endpoint_coordinates_budget_contract (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n kC kS : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) (o : Fin n → Record) : ∃ xs : List RatInterval, ∃ C S : RatInterval, endpointInputs N n α β o (qEnd n kC kS) = some xs ∧ (coordinateExpressions n kC kS o).1.eval E (qEnd n kC kS) xs = some C ∧ (coordinateExpressions n kC kS o).2.eval E (qEnd n kC kS) xs = some S ∧ C.Contains (cHat n kC o) ∧ S.Contains (sHat n kS o) ∧ (C.width : ℝ) ≤ 160*(kC : ℝ)^2*precisionError (qEnd n kC kS) ∧ (S.width : ℝ) ≤ 160*(kS : ℝ)^2*precisionError (qEnd n kC kS) := by obtain ⟨xs, X, hinputs, hX⟩ := endpoint_inputs_contract N hN n α β hab o (qEnd n kC kS) obtain ⟨C, S, hC, hS, hc, hs, hwC, hwS⟩ := endpoint_coordinates_enclosure E hE (qEnd n kC kS) (endpoint_precision_small n kC kS) n kC kS hn o xs X hX exact ⟨xs, C, S, hinputs, hC, hS, hc, hs, hwC, hwS⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_coordinates_budget_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointCoordinates.lean:246
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.EndpointQuotients 18 declarations The denominator floor controls both reciprocal magnitudes and reciprocal widths.

Literal quotient widths

The denominator floor controls both reciprocal magnitudes and reciprocal widths. The four-corner product estimate then bounds the actual quotient evaluation, including numerator boxes that straddle zero.

theorem endpoint_reciprocal_bounds

A denominator above the public floor has bounded reciprocal endpoints and width. Under the stated assumptions.

Formal statement
hD :
1/512 ≤ D.lo
∃ h : D.AwayFromZero,
conclusion 1
|(D.inv h).lo| ≤ 512
conclusion 2
|(D.inv h).hi| ≤ 512
conclusion 3
(D.inv h).width ≤ 512^2*D.width
Proof (Lean source)
-- @node: endpoint_reciprocal_bounds lemma endpoint_reciprocal_bounds (D : RatInterval) (hD : 1/512 ≤ D.lo) : ∃ h : D.AwayFromZero, |(D.inv h).lo| ≤ 512 ∧ |(D.inv h).hi| ≤ 512 ∧ (D.inv h).width ≤ 512^2*D.width := by have hlo : 0 < D.lo := lt_of_lt_of_le (by norm_num) hD have hhi : 0 < D.hi := hlo.trans_le D.lo_le_hi refine ⟨Or.inr hlo, ?_, ?_, ?_⟩ · change |D.hi⁻¹| ≤ 512 rw [abs_of_pos (inv_pos.mpr hhi)] rw [inv_le_comm₀ hhi (by norm_num : (0 : ℚ) < 512)] norm_num exact hD.trans D.lo_le_hi · change |D.lo⁻¹| ≤ 512 rw [abs_of_pos (inv_pos.mpr hlo)] rw [inv_le_comm₀ hlo (by norm_num : (0 : ℚ) < 512)] norm_num exact hD · change D.lo⁻¹-D.hi⁻¹ ≤ 512^2*(D.hi-D.lo) have hid : D.lo⁻¹-D.hi⁻¹ = (D.hi-D.lo)/(D.lo*D.hi) := by field_simp <;> ring rw [hid] apply (div_le_iff₀ (mul_pos hlo hhi)).2 have hp : (1/512 : ℚ)^2 ≤ D.lo*D.hi := by simpa only [pow_two] using mul_le_mul hD (hD.trans D.lo_le_hi) (by norm_num) hlo.le have hw : 0 ≤ D.hi-D.lo := sub_nonneg.mpr D.lo_le_hi nlinarith [mul_nonneg hw (show 0 ≤ 512^2*(D.lo*D.hi)-1 by nlinarith)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_reciprocal_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:15
theorem endpoint_quotient_enclosure

Exact rational quotient evaluation preserves containment and has the roadmap width bound. Under the stated assumptions.

Formal statement
q :
ℕ
c d :
C D :
v z :
ℝ
B :
ℚ
hc :
c.eval E q xs = some C
hd :
d.eval E q xs = some D
hv :
C.Contains v
hz :
D.Contains z
hD :
1/512 ≤ D.lo
hB :
0 ≤ B
hClo :
|C.lo| ≤ B
hChi :
|C.hi| ≤ B
∃ Q : RatInterval,
conclusion 1
(BoxExpr.div c d).eval E q xs = some Q
conclusion 2
Q.Contains (v/z)
conclusion 3
(Q.width : ℝ) ≤ 512*(C.width : ℝ)+(B : ℝ)*512^2*(D.width : ℝ)
Proof (Lean source)
-- @node: endpoint_quotient_enclosure lemma endpoint_quotient_enclosure (E : ArithmeticEngine) (q : ℕ) (xs : List RatInterval) (c d : BoxExpr) (C D : RatInterval) (v z : ℝ) (B : ℚ) (hc : c.eval E q xs = some C) (hd : d.eval E q xs = some D) (hv : C.Contains v) (hz : D.Contains z) (hD : 1/512 ≤ D.lo) (hB : 0 ≤ B) (hClo : |C.lo| ≤ B) (hChi : |C.hi| ≤ B) : ∃ Q : RatInterval, (BoxExpr.div c d).eval E q xs = some Q ∧ Q.Contains (v/z) ∧ (Q.width : ℝ) ≤ 512*(C.width : ℝ)+(B : ℝ)*512^2*(D.width : ℝ) := by obtain ⟨h, hlo, hhi, hw⟩ := endpoint_reciprocal_bounds D hD have hpos : 0 < D.lo := lt_of_lt_of_le (by norm_num) hD refine ⟨C.div D h, ?_, RatInterval.div_sound h hv hz, ?_⟩ · simp [BoxExpr.eval, hc, hd, boxDiv, hpos] · have hp := endpoint_product_width C (D.inv h) B 512 hB (by norm_num) hClo hChi hlo hhi have hdw : 0 ≤ D.width := D.width_nonneg have hb := mul_le_mul_of_nonneg_left hw hB have hq : (C.div D h).width ≤ 512*C.width+B*512^2*D.width := by dsimp only [RatInterval.div] nlinarith only [hp, hb] exact_mod_cast hq
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_quotient_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:45
theorem endpoint_log_range_width

[Width contraction for logarithms on the public positive argument range. the stated conclusion holds. Under the stated assumptions.

Formal statement
hI :
(1/2 : ℚ) ≤ I.lo
log (I.hi : ℝ)-log (I.lo : ℝ) ≤ 2*(I.width : ℝ)
Proof (Lean source)
-- @node: endpoint_log_range_width lemma endpoint_log_range_width (I : RatInterval) (hI : (1/2 : ℚ) ≤ I.lo) : log (I.hi : ℝ)-log (I.lo : ℝ) ≤ 2*(I.width : ℝ) := by have hlo : (1/2 : ℝ) ≤ I.lo := by have h : ((1/2 : ℚ) : ℝ) ≤ (I.lo : ℝ) := Rat.cast_le.mpr hI norm_num at h exact h have ho : (I.lo : ℝ) ≤ I.hi := by exact_mod_cast I.lo_le_hi have hpos : (0 : ℝ) < I.lo := by linarith have hhi : (0 : ℝ) < I.hi := hpos.trans_le ho rw [← Real.log_div hhi.ne' hpos.ne'] have h := Real.log_le_sub_one_of_pos (div_pos hhi hpos) have hb : (I.hi : ℝ)/(I.lo : ℝ)-1 ≤ 2*((I.hi : ℝ)-I.lo) := by rw [div_sub_one hpos.ne'] apply (div_le_iff₀ hpos).2 nlinarith [mul_nonneg (sub_nonneg.mpr ho) (show 0 ≤ 2*(I.lo : ℝ)-1 by linarith)] exact h.trans (by simpa [RatInterval.width] using hb)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_log_range_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:68
theorem endpoint_exp_half_bounds Lemma endpoint_exp_half_bounds in the paper ↗

The two clipping exponentials stay strictly inside the public argument range. the stated conclusion holds.

Formal statement
conclusion 1
(9/16 : ℝ) ≤ exp (-(1/2))
conclusion 2
exp (1/2 : ℝ) ≤ 16/9
Proof (Lean source)
-- @node: endpoint_exp_half_bounds lemma endpoint_exp_half_bounds : (9/16 : ℝ) ≤ exp (-(1/2)) ∧ exp (1/2 : ℝ) ≤ 16/9 := by have hquarter : exp (1/4 : ℝ) ≤ 4/3 := by have h := Real.exp_bound_div_one_sub_of_interval (by norm_num : (0 : ℝ) ≤ 1/4) (by norm_num : (1/4 : ℝ) < 1) norm_num at h exact h have hhalf : exp (1/2 : ℝ) ≤ 16/9 := by have he : exp (1/2 : ℝ) = exp (1/4)*exp (1/4) := by rw [← Real.exp_add]; norm_num rw [he] nlinarith [Real.exp_pos (1/4 : ℝ)] refine ⟨?_, hhalf⟩ rw [Real.exp_neg] have h := (inv_le_inv₀ (by norm_num : (0 : ℝ) < 16/9) (Real.exp_pos (1/2 : ℝ))).2 hhalf norm_num at h exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exp_half_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:87
theorem endpoint_exp_boundary_boxes

The literal exponential boundary boxes have two-error widths and positive public bounds. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hE :
E.Admissible
q :
ℕ
hq :
precisionError q ≤ 1/16
A :
E.expBox q (RatInterval.point (-(1/2)))
B :
E.expBox q (RatInterval.point (1/2))
A.Contains (exp (-(1/2)))
B.Contains (exp (1/2))
1/2 ≤ A.lo
B.hi ≤ 2
(A.width : ℝ) ≤ 2*precisionError q
(B.width : ℝ) ≤ 2*precisionError q
Proof (Lean source)
-- @node: endpoint_exp_boundary_boxes lemma endpoint_exp_boundary_boxes (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (hq : precisionError q ≤ 1/16) : let A := E.expBox q (RatInterval.point (-(1/2))) let B := E.expBox q (RatInterval.point (1/2)) A.Contains (exp (-(1/2))) ∧ B.Contains (exp (1/2)) ∧ 1/2 ≤ A.lo ∧ B.hi ≤ 2 ∧ (A.width : ℝ) ≤ 2*precisionError q ∧ (B.width : ℝ) ≤ 2*precisionError q := by dsimp only have hA := (hE.2.2.1 q (RatInterval.point (-(1/2)))).1 have hB := (hE.2.2.1 q (RatInterval.point (1/2))).1 have hcA := hA.1 _ (RatInterval.point_sound (-(1/2))) have hcB := hB.1 _ (RatInterval.point_sound (1/2)) norm_num only [Rat.cast_neg, Rat.cast_div, Rat.cast_ofNat] at hcA hcB have haL := hA.2.2.1 have haH := hA.2.2.2.2 have hbL := hB.2.2.1 have hbH := hB.2.2.2.2 change exp (((-(1/2) : ℚ) : ℝ)) - (E.expBox q (RatInterval.point (-(1/2)))).lo ≤ precisionError q at haL change (E.expBox q (RatInterval.point (-(1/2)))).hi - exp (((-(1/2) : ℚ) : ℝ)) ≤ precisionError q at haH change exp (((1/2 : ℚ) : ℝ)) - (E.expBox q (RatInterval.point (1/2))).lo ≤ precisionError q at hbL change (E.expBox q (RatInterval.point (1/2))).hi - exp (((1/2 : ℚ) : ℝ)) ≤ precisionError q at hbH norm_num only [Rat.cast_neg, Rat.cast_div, Rat.cast_ofNat] at haL haH hbL hbH obtain ⟨hlo, hhi⟩ := endpoint_exp_half_bounds refine ⟨hcA, hcB, ?_, ?_, ?_, ?_⟩ · have h : (1/2 : ℝ) ≤ (E.expBox q (RatInterval.point (-(1/2)))).lo := by linarith have h' : (((1/2 : ℚ) : ℝ)) ≤ (E.expBox q (RatInterval.point (-(1/2)))).lo := by simpa using h exact Rat.cast_le.mp h' · have h : ((E.expBox q (RatInterval.point (1/2))).hi : ℝ) ≤ 2 := by linarith exact_mod_cast h · simp only [RatInterval.width, Rat.cast_sub]; linarith · simp only [RatInterval.width, Rat.cast_sub]; linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exp_boundary_boxes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:107
theorem endpoint_log_enclosure

A successful positive argument produces a logarithm box with twice its input width plus two errors. Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
e :
v :
ℝ
he :
e.eval E q xs = some I
hv :
I.Contains v
hlo :
(1/2 : ℚ) ≤ I.lo
∃ L : RatInterval,
conclusion 1
(BoxExpr.log e).eval E q xs = some L
conclusion 2
L.Contains (log v)
conclusion 3
(L.width : ℝ) ≤ 2*(I.width : ℝ)+2*precisionError q
Proof (Lean source)
-- @node: endpoint_log_enclosure lemma endpoint_log_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (xs : List RatInterval) (e : BoxExpr) (I : RatInterval) (v : ℝ) (he : e.eval E q xs = some I) (hv : I.Contains v) (hlo : (1/2 : ℚ) ≤ I.lo) : ∃ L : RatInterval, (BoxExpr.log e).eval E q xs = some L ∧ L.Contains (log v) ∧ (L.width : ℝ) ≤ 2*(I.width : ℝ)+2*precisionError q := by have hpos : 0 < I.lo := lt_of_lt_of_le (by norm_num) hlo have hc := hE.2.2.2.1 q I hpos refine ⟨E.logBox q I, ?_, hc.1 _ hv, ?_⟩ · simp [BoxExpr.eval, he, hpos] · have hL := hc.2.2.1 have hH := hc.2.2.2.2 have hw := endpoint_log_range_width I hlo simp only [RatInterval.width, Rat.cast_sub] at * linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_log_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:141
theorem endpoint_inversion_enclosure

The literal clipping and logarithm tree terminates and propagates the quotient width. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
hq :
precisionError q ≤ 1/16
c d :
C D :
v z :
ℝ
B :
ℚ
hc :
c.eval E q xs = some C
hd :
d.eval E q xs = some D
hv :
C.Contains v
hz :
D.Contains z
hD :
1/512 ≤ D.lo
hB :
0 ≤ B
hClo :
|C.lo| ≤ B
hChi :
|C.hi| ≤ B
∃ L : RatInterval,
conclusion 1
(inversionExpression c d).eval E q xs = some L
conclusion 2
L.Contains (inversion v z)
conclusion 3
(L.width : ℝ) ≤ 2*(512*(C.width : ℝ)+(B : ℝ)*512^2*(D.width : ℝ))+6*precisionError q
Proof (Lean source)
-- @node: endpoint_inversion_enclosure lemma endpoint_inversion_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (hq : precisionError q ≤ 1/16) (xs : List RatInterval) (c d : BoxExpr) (C D : RatInterval) (v z : ℝ) (B : ℚ) (hc : c.eval E q xs = some C) (hd : d.eval E q xs = some D) (hv : C.Contains v) (hz : D.Contains z) (hD : 1/512 ≤ D.lo) (hB : 0 ≤ B) (hClo : |C.lo| ≤ B) (hChi : |C.hi| ≤ B) : ∃ L : RatInterval, (inversionExpression c d).eval E q xs = some L ∧ L.Contains (inversion v z) ∧ (L.width : ℝ) ≤ 2*(512*(C.width : ℝ)+(B : ℝ)*512^2*(D.width : ℝ))+6*precisionError q := by obtain ⟨Q, heQ, hvQ, hwQ⟩ := endpoint_quotient_enclosure E q xs c d C D v z B hc hd hv hz hD hB hClo hChi let A := E.expBox q (RatInterval.point (-(1/2))) let Bp := E.expBox q (RatInterval.point (1/2)) let J := (RatInterval.point 1).add Q let I := boxMax A (boxMin Bp J) obtain ⟨hvA, hvB, hloA, _hhiB, hwA, hwB⟩ := endpoint_exp_boundary_boxes E hE q hq have hvJ : J.Contains (1+v/z) := by exact RatInterval.add_sound (by norm_num [RatInterval.point, RatInterval.Contains]) hvQ have hvI : I.Contains (clip (exp (-(1/2))) (exp (1/2)) (1+v/z)) := (endpoint_min_max_contains A (boxMin Bp J) _ _ hvA (endpoint_min_max_contains Bp J _ _ hvB hvJ).1).2 have hloI : (1/2 : ℚ) ≤ I.lo := by exact hloA.trans ((endpoint_min_max_endpoints A (boxMin Bp J)).2.2.1.symm ▸ le_max_left _ _) have heJ : (BoxExpr.add (.constant 1) (.div c d)).eval E q xs = some J := by change (do let X ← some (RatInterval.point 1) let Y ← (BoxExpr.div c d).eval E q xs pure (X.add Y)) = _ rw [heQ]; rfl have heMin : (BoxExpr.min (.exp (.constant (1/2))) (.add (.constant 1) (.div c d))).eval E q xs = some (boxMin Bp J) := by change (do let X ← some Bp let Y ← (BoxExpr.add (.constant 1) (.div c d)).eval E q xs pure (boxMin X Y)) = _ rw [heJ]; rfl have heI : (BoxExpr.max (.exp (.constant (-(1/2)))) (.min (.exp (.constant (1/2))) (.add (.constant 1) (.div c d)))).eval E q xs = some I := by change (do let X ← some A let Y ← (BoxExpr.min (.exp (.constant (1/2))) (.add (.constant 1) (.div c d))).eval E q xs pure (boxMax X Y)) = _ rw [heMin]; rfl have hwJ : (J.width : ℝ) = Q.width := by rw [RatInterval.width_add] simp [RatInterval.width, RatInterval.point] have hwI : (I.width : ℝ) ≤ (Q.width : ℝ)+2*precisionError q := by have herr : 0 ≤ precisionError q := by unfold precisionError; positivity have hwQ0 : (0 : ℝ) ≤ Q.width := by exact_mod_cast Q.width_nonneg have hwMin : ((boxMin Bp J).width : ℝ) ≤ (Q.width : ℝ)+2*precisionError q := by have h : ((boxMin Bp J).width : ℝ) ≤ max (Bp.width : ℝ) (J.width : ℝ) := by exact_mod_cast (endpoint_min_max_width Bp J).1 apply h.trans rw [hwJ] exact max_le (by linarith) (by linarith) have h : (I.width : ℝ) ≤ max (A.width : ℝ) ((boxMin Bp J).width : ℝ) := by exact_mod_cast (endpoint_min_max_width A (boxMin Bp J)).2 exact h.trans (max_le (by linarith) hwMin) obtain ⟨L, heL, hvL, hwL⟩ := endpoint_log_enclosure E hE q xs _ I _ heI hvI hloI refine ⟨L, ?_, ?_, ?_⟩ · simpa only [inversionExpression, neg_div] using heL · simpa only [inversion, neg_div] using hvL · linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_inversion_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:159
theorem endpoint_exact_kernel_abs Lemma endpoint_exact_kernel_abs in the paper ↗

The exact cosine kernel has the roadmap magnitude envelope. Under the stated assumptions.

Formal statement
k :
ℕ
x z :
|projectionKernel k x z| ≤ 2*(k : ℝ)
Proof (Lean source)
-- @node: endpoint_exact_kernel_abs lemma endpoint_exact_kernel_abs (k : ℕ) (x z : Covariate) : |projectionKernel k x z| ≤ 2*(k : ℝ) := by have hb (j : ℕ) (x : Covariate) : |cosineBasis j x| ≤ sqrt 2 := by unfold cosineBasis split · norm_num · rw [abs_mul, abs_of_nonneg (Real.sqrt_nonneg _)] simpa using mul_le_mul_of_nonneg_left (Real.abs_cos_le_one _) (Real.sqrt_nonneg 2) calc _ ≤ ∑ j ∈ range k, |cosineBasis j x*cosineBasis j z| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _j ∈ range k, (2 : ℝ) := by apply Finset.sum_le_sum intro j hj rw [abs_mul] have h := mul_le_mul (hb j x) (hb j z) (abs_nonneg _) (Real.sqrt_nonneg 2) simpa [Real.mul_self_sqrt (by norm_num : (0 : ℝ) ≤ 2)] using h _ = _ := by simp; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exact_kernel_abs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:222
theorem endpoint_exact_statistic_abs

Normalization by the number of distinct pairs preserves the kernel magnitude bound. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
W V :
Record → ℝ
hW :
∀ o, |W o| ≤ 1
hV :
∀ o, |V o| ≤ 1
o :
Fin n → Record
|projectionStatistic n k W V o| ≤ 2*(k : ℝ)
Proof (Lean source)
-- @node: endpoint_exact_statistic_abs lemma endpoint_exact_statistic_abs (n k : ℕ) (hn : 2 ≤ n) (W V : Record → ℝ) (hW : ∀ o, |W o| ≤ 1) (hV : ∀ o, |V o| ≤ 1) (o : Fin n → Record) : |projectionStatistic n k W V o| ≤ 2*(k : ℝ) := by have hpos : 0 < (n : ℝ)*((n : ℝ)-1) := by have h : (1 : ℝ) < n := by exact_mod_cast (show 1 < n by omega) positivity let pairs := (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2) have hs : |∑ ij ∈ pairs, projectionKernel k (covariate (o ij.1)) (covariate (o ij.2))*W (o ij.1)*V (o ij.2)| ≤ (pairs.card : ℝ)*(2*(k : ℝ)) := by calc _ ≤ ∑ ij ∈ pairs, |projectionKernel k (covariate (o ij.1)) (covariate (o ij.2))*W (o ij.1)*V (o ij.2)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _ij ∈ pairs, 2*(k : ℝ) := by apply Finset.sum_le_sum intro ij hij rw [abs_mul, abs_mul] calc _ ≤ (2*(k : ℝ))*1*1 := by gcongr · exact endpoint_exact_kernel_abs _ _ _ · exact hW _ · exact hV _ _ = _ := by ring _ = _ := by simp unfold projectionStatistic rw [abs_mul, abs_of_pos (inv_pos.mpr hpos)] calc _ ≤ ((n : ℝ)*((n : ℝ)-1))⁻¹*((pairs.card : ℝ)*(2*(k : ℝ))) := mul_le_mul_of_nonneg_left hs (inv_nonneg.mpr hpos.le) _ = _ := by rw [endpoint_pair_card n, ← mul_assoc, inv_mul_cancel₀ hpos.ne']; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exact_statistic_abs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:242
theorem endpoint_exact_cHat_abs Lemma endpoint_exact_cHat_abs in the paper ↗

The covariance coordinate is bounded by one plus twice its retained rank. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
o :
Fin n → Record
|cHat n k o| ≤ 1+2*(k : ℝ)
Proof (Lean source)
-- @node: endpoint_exact_cHat_abs lemma endpoint_exact_cHat_abs (n k : ℕ) (hn : 2 ≤ n) (o : Fin n → Record) : |cHat n k o| ≤ 1+2*(k : ℝ) := by have hA (r : Record) : |treatment r| ≤ 1 := by simp [treatment]; split <;> norm_num have hY (r : Record) : |outcome r| ≤ 1 := by simp [outcome]; split <;> norm_num have hn0 : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) have hm : |(n : ℝ)⁻¹*∑ i, treatment (o i)*outcome (o i)| ≤ 1 := by rw [abs_mul, abs_of_pos (inv_pos.mpr hn0)] calc _ ≤ (n : ℝ)⁻¹*∑ i, |treatment (o i)*outcome (o i)| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ (n : ℝ)⁻¹*∑ _i : Fin n, (1 : ℝ) := by gcongr with i rw [abs_mul] simpa using mul_le_mul (hA (o i)) (hY (o i)) (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) _ = 1 := by simp [hn0.ne'] unfold cHat rw [sub_eq_add_neg] apply (abs_add_le _ _).trans rw [abs_neg] exact add_le_add hm (endpoint_exact_statistic_abs n k hn _ _ hA hY o)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exact_cHat_abs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:274
theorem endpoint_exact_noise_bound Lemma endpoint_exact_noise_bound in the paper ↗

The variance radius and its square root have elementary rank-dependent envelopes. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
conclusion 1
varianceRadius n k ≤ 5+2*(k : ℝ)
conclusion 2
sqrt (20*varianceRadius n k) ≤ 10+7*(k : ℝ)
Proof (Lean source)
-- @node: endpoint_exact_noise_bound lemma endpoint_exact_noise_bound (n k : ℕ) (hn : 2 ≤ n) : varianceRadius n k ≤ 5+2*(k : ℝ) ∧ sqrt (20*varianceRadius n k) ≤ 10+7*(k : ℝ) := by have hn2 : (2 : ℝ) ≤ n := by exact_mod_cast hn have hden : 2 ≤ (n : ℝ)*((n : ℝ)-1) := by nlinarith have hv : varianceRadius n k ≤ 5+2*(k : ℝ) := by unfold varianceRadius have h1 : 10/(n : ℝ) ≤ 5 := (div_le_iff₀ (by linarith)).2 (by linarith) have h2 : 4*(k : ℝ)/((n : ℝ)*((n : ℝ)-1)) ≤ 2*(k : ℝ) := by apply (div_le_iff₀ (by linarith)).2 nlinarith [mul_nonneg (show 0 ≤ (k : ℝ) by positivity) (show 0 ≤ (n : ℝ)*((n : ℝ)-1)-2 by linarith)] linarith refine ⟨hv, ?_⟩ apply (Real.sqrt_le_iff).2 constructor · positivity · nlinarith [sq_nonneg (k : ℝ)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exact_noise_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:300
theorem endpoint_exact_cRadius_bound

The exact numerator radius obeys the roadmap magnitude bound. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
hk :
1 ≤ k
α β :
ℝ
hab :
conclusion 1
0 ≤ 8*(k : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k)
conclusion 2
8*(k : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k) ≤ 25*(k : ℝ)
Proof (Lean source)
-- @node: endpoint_exact_cRadius_bound lemma endpoint_exact_cRadius_bound (n k : ℕ) (hn : 2 ≤ n) (hk : 1 ≤ k) (α β : ℝ) (hab : ExponentDomain α β) : 0 ≤ 8*(k : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k) ∧ 8*(k : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k) ≤ 25*(k : ℝ) := by have hk1 : (1 : ℝ) ≤ k := by exact_mod_cast hk have hp : (k : ℝ)^(-(α+β)) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hk1 (by linarith [hab.1, hab.2.2.1]) refine ⟨by positivity, ?_⟩ linarith [(endpoint_exact_noise_bound n k hn).2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exact_cRadius_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:320
theorem endpoint_contains_abs_bounds

Containment and width turn an exact magnitude bound into endpoint magnitude bounds. Under the stated assumptions. Under the stated assumptions.

Formal statement
v B w :
ℝ
hv :
I.Contains v
hB :
|v| ≤ B
hw :
(I.width : ℝ) ≤ w
conclusion 1
|(I.lo : ℝ)| ≤ B+w
conclusion 2
|(I.hi : ℝ)| ≤ B+w
Proof (Lean source)
-- @node: endpoint_contains_abs_bounds lemma endpoint_contains_abs_bounds (I : RatInterval) (v B w : ℝ) (hv : I.Contains v) (hB : |v| ≤ B) (hw : (I.width : ℝ) ≤ w) : |(I.lo : ℝ)| ≤ B+w ∧ |(I.hi : ℝ)| ≤ B+w := by have hwidth : (I.hi : ℝ)-I.lo ≤ w := by simpa [RatInterval.width] using hw rw [abs_le] at hB ⊢ constructor · constructor <;> linarith [hv.1, hv.2] · rw [abs_le]; constructor <;> linarith [hv.1, hv.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_contains_abs_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:332
theorem endpoint_precision_quartic_bound Lemma endpoint_precision_quartic_bound in the paper ↗

[The public endpoint budget controls the full quartic precision product. the stated conclusion holds.

Formal statement
n kC kS :
ℕ
(2 : ℝ)^44*((n : ℝ)+1)*((max kC kS : ℕ)+1)^4* precisionError (qEnd n kC kS) ≤ 1
Proof (Lean source)
-- @node: endpoint_precision_quartic_bound lemma endpoint_precision_quartic_bound (n kC kS : ℕ) : (2 : ℝ)^44*((n : ℝ)+1)*((max kC kS : ℕ)+1)^4* precisionError (qEnd n kC kS) ≤ 1 := by have hn : (n : ℝ)+1 ≤ (2 : ℝ)^(clog 2 (n+1)) := by exact_mod_cast Nat.le_pow_clog (by norm_num : 1 < 2) (n+1) have hk : ((max kC kS : ℕ) : ℝ)+1 ≤ (2 : ℝ)^(clog 2 (max kC kS+1)) := by exact_mod_cast Nat.le_pow_clog (by norm_num : 1 < 2) (max kC kS+1) have hb : (2 : ℝ)^44*((n : ℝ)+1)*((max kC kS : ℕ)+1)^4 ≤ (2 : ℝ)^qEnd n kC kS := by unfold qEnd rw [pow_add, pow_add, pow_mul, ← pow_mul (2 : ℝ) 4, Nat.mul_comm 4, pow_mul] gcongr rw [precisionError, zpow_neg, zpow_natCast] exact (mul_le_mul_of_nonneg_right hb (by positivity)).trans_eq (mul_inv_cancel₀ (by positivity))
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_precision_quartic_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:343
theorem endpoint_precision_coefficient_bound Lemma endpoint_precision_coefficient_bound in the paper ↗

Every coefficient below the quartic budget has a precision product at most one. the stated conclusion holds. Under the stated assumptions.

Formal statement
n kC kS :
ℕ
a :
ℝ
ha :
a ≤ (2 : ℝ)^44*((n : ℝ)+1)*((max kC kS : ℕ)+1)^4
a*precisionError (qEnd n kC kS) ≤ 1
Proof (Lean source)
-- @node: endpoint_precision_coefficient_bound lemma endpoint_precision_coefficient_bound (n kC kS : ℕ) (a : ℝ) (ha : a ≤ (2 : ℝ)^44*((n : ℝ)+1)*((max kC kS : ℕ)+1)^4) : a*precisionError (qEnd n kC kS) ≤ 1 := by exact (mul_le_mul_of_nonneg_right ha (by unfold precisionError; positivity)).trans (endpoint_precision_quartic_bound n kC kS)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_precision_coefficient_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:359
theorem endpoint_precision_final_estimates Lemma endpoint_precision_final_estimates in the paper ↗

The endpoint budget pays for coordinate widths, positive log arguments, and final widths. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n kC kS :
ℕ
hn :
2 ≤ n
conclusion 1
precisionError (qEnd n kC kS) ≤ 1/16
conclusion 2
300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS) ≤ 1
conclusion 3
(2 : ℝ)^37*((max kC kS : ℕ)+1)^3*precisionError (qEnd n kC kS) ≤ 1/(n : ℝ)
Proof (Lean source)
-- @node: endpoint_precision_final_estimates lemma endpoint_precision_final_estimates (n kC kS : ℕ) (hn : 2 ≤ n) : precisionError (qEnd n kC kS) ≤ 1/16 ∧ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS) ≤ 1 ∧ (2 : ℝ)^37*((max kC kS : ℕ)+1)^3*precisionError (qEnd n kC kS) ≤ 1/(n : ℝ) := by let K : ℝ := (max kC kS : ℕ) have hK : 0 ≤ K := by positivity have hn0 : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) have hK1 : 1 ≤ K+1 := by linarith have hKpow : 1 ≤ (K+1)^4 := one_le_pow₀ hK1 have hK2 : K^2 ≤ (K+1)^4 := by have h : K^2 ≤ (K+1)^2 := by gcongr; linarith have h' : (K+1)^2 ≤ (K+1)^4 := by exact pow_le_pow_right₀ hK1 (by norm_num) exact h.trans h' have h16 := endpoint_precision_coefficient_bound n kC kS 16 (by change 16 ≤ (2 : ℝ)^44*((n : ℝ)+1)*(K+1)^4 have h : (2 : ℝ)^44 ≤ (2 : ℝ)^44*((n : ℝ)+1)*(K+1)^4 := by calc _ = (2 : ℝ)^44*1*1 := by ring _ ≤ _ := by gcongr; linarith norm_num at h ⊢ linarith) have h300 := endpoint_precision_coefficient_bound n kC kS (300*K^2) (by change 300*K^2 ≤ (2 : ℝ)^44*((n : ℝ)+1)*(K+1)^4 calc _ ≤ 300*(K+1)^4 := by gcongr _ ≤ _ := by gcongr; norm_num; nlinarith) have hfinal := endpoint_precision_coefficient_bound n kC kS ((2 : ℝ)^37*(K+1)^3*n) (by change (2 : ℝ)^37*(K+1)^3*n ≤ (2 : ℝ)^44*((n : ℝ)+1)*(K+1)^4 calc _ = (2 : ℝ)^37*(n : ℝ)*(K+1)^3 := by ring _ ≤ _ := by gcongr <;> norm_num <;> linarith) refine ⟨by linarith, h300, ?_⟩ apply (le_div_iff₀ hn0).2 simpa only [K, mul_assoc, mul_left_comm, mul_comm] using hfinal
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_precision_final_estimates · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:367
theorem endpoint_numerator_corners

Both actual numerator corners have bounded magnitudes and the roadmap widths. Under the stated assumptions. Under the stated assumptions.

Formal statement
n kC kS :
ℕ
hn :
2 ≤ n
hkC :
1 ≤ kC
α β :
ℝ
hab :
o :
Fin n → Record
C BC :
hC :
(coordinateExpressions n kC kS o).1.eval E (qEnd n kC kS) xs = some C
hBC :
(endpointRadiusExpressions n kC kS).1.eval E (qEnd n kC kS) xs = some BC
hvC :
C.Contains (cHat n kC o)
hvBC :
BC.Contains (8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC))
hwC :
(C.width : ℝ) ≤ 160*(kC : ℝ)^2*precisionError (qEnd n kC kS)
hwBC :
(BC.width : ℝ) ≤ 34*(max kC kS : ℕ)*precisionError (qEnd n kC kS)
∃ Cm Cp : RatInterval,
conclusion 1
(BoxExpr.sub (coordinateExpressions n kC kS o).1 (endpointRadiusExpressions n kC kS).1).eval E (qEnd n kC kS) xs
= some Cm
conclusion 2
(BoxExpr.add (coordinateExpressions n kC kS o).1 (endpointRadiusExpressions n kC kS).1).eval E (qEnd n kC kS) xs
= some Cp
conclusion 3
Cm.Contains (cHat n kC o-(8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC)))
conclusion 4
Cp.Contains (cHat n kC o+(8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC)))
conclusion 5
|Cm.lo| ≤ 100*((max kC kS : ℕ)+1)
conclusion 6
|Cm.hi| ≤ 100*((max kC kS : ℕ)+1)
conclusion 7
|Cp.lo| ≤ 100*((max kC kS : ℕ)+1)
conclusion 8
|Cp.hi| ≤ 100*((max kC kS : ℕ)+1)
conclusion 9
(Cm.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS)
conclusion 10
(Cp.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS)
Proof (Lean source)
-- @node: endpoint_numerator_corners lemma endpoint_numerator_corners (E : ArithmeticEngine) (n kC kS : ℕ) (hn : 2 ≤ n) (hkC : 1 ≤ kC) (α β : ℝ) (hab : ExponentDomain α β) (o : Fin n → Record) (xs : List RatInterval) (C BC : RatInterval) (hC : (coordinateExpressions n kC kS o).1.eval E (qEnd n kC kS) xs = some C) (hBC : (endpointRadiusExpressions n kC kS).1.eval E (qEnd n kC kS) xs = some BC) (hvC : C.Contains (cHat n kC o)) (hvBC : BC.Contains (8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC))) (hwC : (C.width : ℝ) ≤ 160*(kC : ℝ)^2*precisionError (qEnd n kC kS)) (hwBC : (BC.width : ℝ) ≤ 34*(max kC kS : ℕ)*precisionError (qEnd n kC kS)) : ∃ Cm Cp : RatInterval, (BoxExpr.sub (coordinateExpressions n kC kS o).1 (endpointRadiusExpressions n kC kS).1).eval E (qEnd n kC kS) xs = some Cm ∧ (BoxExpr.add (coordinateExpressions n kC kS o).1 (endpointRadiusExpressions n kC kS).1).eval E (qEnd n kC kS) xs = some Cp ∧ Cm.Contains (cHat n kC o-(8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC))) ∧ Cp.Contains (cHat n kC o+(8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC))) ∧ |Cm.lo| ≤ 100*((max kC kS : ℕ)+1) ∧ |Cm.hi| ≤ 100*((max kC kS : ℕ)+1) ∧ |Cp.lo| ≤ 100*((max kC kS : ℕ)+1) ∧ |Cp.hi| ≤ 100*((max kC kS : ℕ)+1) ∧ (Cm.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS) ∧ (Cp.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS) := by let K : ℝ := (max kC kS : ℕ) let h := precisionError (qEnd n kC kS) have hK1 : 1 ≤ K := by dsimp [K]; exact_mod_cast hkC.trans (le_max_left kC kS) have hkK : (kC : ℝ) ≤ K := by dsimp [K]; exact_mod_cast le_max_left kC kS have herr : 0 ≤ h := by unfold h precisionError; positivity have hw : (C.width : ℝ)+(BC.width : ℝ) ≤ 300*K^2*h := by have hk2 : (kC : ℝ)^2 ≤ K^2 := by gcongr have hKK : K ≤ K^2 := by nlinarith nlinarith only [hwC, hwBC, mul_nonneg herr (show 0 ≤ 300*K^2-160*(kC : ℝ)^2-34*K by nlinarith)] have hwm : ((C.sub BC).width : ℝ) ≤ 300*K^2*h := by rw [RatInterval.width_sub, Rat.cast_add]; exact hw have hwp : ((C.add BC).width : ℝ) ≤ 300*K^2*h := by rw [RatInterval.width_add, Rat.cast_add]; exact hw have hvM := RatInterval.sub_sound hvC hvBC have hvP := RatInterval.add_sound hvC hvBC have hcb := endpoint_exact_cHat_abs n kC hn o obtain ⟨hb0, hbb⟩ := endpoint_exact_cRadius_bound n kC hn hkC α β hab have habm : |cHat n kC o-(8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC))| ≤ 1+27*K := by rw [sub_eq_add_neg] apply (abs_add_le _ _).trans rw [abs_neg, abs_of_nonneg hb0] linarith have habp : |cHat n kC o+(8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC))| ≤ 1+27*K := by apply (abs_add_le _ _).trans rw [abs_of_nonneg hb0] linarith have hsmall := (endpoint_precision_final_estimates n kC kS hn).2.1 have hwM1 : ((C.sub BC).width : ℝ) ≤ 1 := hwm.trans hsmall have hwP1 : ((C.add BC).width : ℝ) ≤ 1 := hwp.trans hsmall obtain ⟨hml, hmh⟩ := endpoint_contains_abs_bounds _ _ _ 1 hvM habm hwM1 obtain ⟨hpl, hph⟩ := endpoint_contains_abs_bounds _ _ _ 1 hvP habp hwP1 have hcast (a : ℚ) (ha : |(a : ℝ)| ≤ 1+27*K+1) : |a| ≤ 100*((max kC kS : ℕ)+1) := by have h : |(a : ℝ)| ≤ 100*(K+1) := by linarith dsimp [K] at h exact_mod_cast h refine ⟨C.sub BC, C.add BC, ?_, ?_, hvM, hvP, hcast _ hml, hcast _ hmh, hcast _ hpl, hcast _ hph, hwm, hwp⟩ · change (do let A ← (coordinateExpressions n kC kS o).1.eval E (qEnd n kC kS) xs let B ← (endpointRadiusExpressions n kC kS).1.eval E (qEnd n kC kS) xs pure (A.sub B)) = _ rw [hC, hBC]; rfl · change (do let A ← (coordinateExpressions n kC kS o).1.eval E (qEnd n kC kS) xs let B ← (endpointRadiusExpressions n kC kS).1.eval E (qEnd n kC kS) xs pure (A.add B)) = _ rw [hC, hBC]; rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_numerator_corners · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:406
theorem endpoint_inversion_budget_contract

At the endpoint budget every inversion corner has width at most one over sample size. Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
n kC kS :
ℕ
hn :
2 ≤ n
c d :
C D :
v z :
ℝ
hc :
c.eval E (qEnd n kC kS) xs = some C
hd :
d.eval E (qEnd n kC kS) xs = some D
hv :
C.Contains v
hz :
D.Contains z
hD :
1/512 ≤ D.lo
hClo :
|C.lo| ≤ 100*((max kC kS : ℕ)+1)
hChi :
|C.hi| ≤ 100*((max kC kS : ℕ)+1)
hwC :
(C.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS)
hwD :
(D.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS)
∃ L : RatInterval,
conclusion 1
(inversionExpression c d).eval E (qEnd n kC kS) xs = some L
conclusion 2
L.Contains (inversion v z)
conclusion 3
(L.width : ℝ) ≤ 1/(n : ℝ)
Proof (Lean source)
-- @node: endpoint_inversion_budget_contract lemma endpoint_inversion_budget_contract (E : ArithmeticEngine) (hE : E.Admissible) (n kC kS : ℕ) (hn : 2 ≤ n) (xs : List RatInterval) (c d : BoxExpr) (C D : RatInterval) (v z : ℝ) (hc : c.eval E (qEnd n kC kS) xs = some C) (hd : d.eval E (qEnd n kC kS) xs = some D) (hv : C.Contains v) (hz : D.Contains z) (hD : 1/512 ≤ D.lo) (hClo : |C.lo| ≤ 100*((max kC kS : ℕ)+1)) (hChi : |C.hi| ≤ 100*((max kC kS : ℕ)+1)) (hwC : (C.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS)) (hwD : (D.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError (qEnd n kC kS)) : ∃ L : RatInterval, (inversionExpression c d).eval E (qEnd n kC kS) xs = some L ∧ L.Contains (inversion v z) ∧ (L.width : ℝ) ≤ 1/(n : ℝ) := by obtain ⟨hq, _, hfinal⟩ := endpoint_precision_final_estimates n kC kS hn obtain ⟨L, heL, hvL, hwL⟩ := endpoint_inversion_enclosure E hE _ hq xs c d C D v z _ hc hd hv hz hD (by positivity) hClo hChi refine ⟨L, heL, hvL, hwL.trans (le_trans ?_ hfinal)⟩ let K : ℝ := (max kC kS : ℕ) let h := precisionError (qEnd n kC kS) have hK : 0 ≤ K := by positivity have herr : 0 ≤ h := by unfold h precisionError; positivity have hBcast : ((100*((max kC kS : ℕ)+1) : ℚ) : ℝ) = 100*(K+1) := by simp [K] rw [hBcast] change 2*(512*(C.width : ℝ)+100*(K+1)*512^2*(D.width : ℝ))+6*h ≤ (2 : ℝ)^37*(K+1)^3*h calc _ ≤ (2*(512*300*K^2+100*(K+1)*512^2*300*K^2)+6)*h := by nlinarith only [hwC, hwD, mul_nonneg (show 0 ≤ 100*(K+1)*512^2 by positivity) (show 0 ≤ 300*K^2*h-(D.width : ℝ) by linarith)] _ ≤ _ := by apply mul_le_mul_of_nonneg_right _ herr have h2 : K^2 ≤ (K+1)^2 := by gcongr; linarith have h3 : (K+1)*K^2 ≤ (K+1)^3 := by nlinarith have h23 : K^2 ≤ (K+1)^3 := by nlinarith [sq_nonneg K] have h13 : 1 ≤ (K+1)^3 := one_le_pow₀ (by linarith) norm_num nlinarith only [h23, h3, h13]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_inversion_budget_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointQuotients.lean:472
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.EndpointRadii 15 declarations Negative powers on the public exponent rectangle have derivative bounded by the integer base.

Literal endpoint radius enclosures

Negative powers on the public exponent rectangle have derivative bounded by the integer base. Primitive endpoint excess and exact scaling then give the two bias-and-noise radius widths in the fixed-budget roadmap.

theorem endpoint_negative_power_range_width

Negative exponent ranges have variation at most the base times their width. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
hhi :
I.hi ≤ 0
(k : ℝ)^(I.hi : ℝ) - (k : ℝ)^(I.lo : ℝ) ≤ (k : ℝ) * (I.width : ℝ)
Proof (Lean source)
-- @node: endpoint_negative_power_range_width lemma endpoint_negative_power_range_width (k : ℕ) (hk : 1 ≤ k) (I : RatInterval) (hhi : I.hi ≤ 0) : (k : ℝ)^(I.hi : ℝ) - (k : ℝ)^(I.lo : ℝ) ≤ (k : ℝ) * (I.width : ℝ) := by have hk1 : (1 : ℝ) ≤ k := by exact_mod_cast hk have hk0 : (0 : ℝ) < k := zero_lt_one.trans_le hk1 have ho : (I.lo : ℝ) ≤ I.hi := by exact_mod_cast I.lo_le_hi have hh : (I.hi : ℝ) ≤ 0 := by exact_mod_cast hhi have hb (v : ℝ) (hv : v ∈ Icc (I.lo : ℝ) I.hi) : ‖(k : ℝ)^v * log k‖ ≤ k := by rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (Real.rpow_nonneg hk0.le _) (Real.log_nonneg hk1))] have hp : (k : ℝ)^v ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hk1 (hv.2.trans hh) have hl : log (k : ℝ) ≤ k := (Real.log_le_sub_one_of_pos hk0).trans (by linarith) calc _ ≤ 1 * (k : ℝ) := mul_le_mul hp hl (Real.log_nonneg hk1) (by norm_num) _ = _ := one_mul _ have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le (f := fun v : ℝ => (k : ℝ)^v) (f' := fun v => (k : ℝ)^v * log k) (fun v _ => by simpa [mul_comm] using ((hasDerivAt_id v).const_rpow hk0).hasDerivWithinAt) hb (convex_Icc (I.lo : ℝ) I.hi) ⟨le_rfl, ho⟩ ⟨ho, le_rfl⟩ rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr ho)] at h exact (le_abs_self _).trans (by simpa [RatInterval.width] using h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_negative_power_range_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:15
theorem endpoint_negative_power_width

The power primitive adds at most two endpoint errors on a negative exponent box. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q k :
ℕ
hk :
1 ≤ k
hlo :
-3 ≤ I.lo
hhi :
I.hi ≤ 0
((E.powBox q k I).width : ℝ) ≤ (k : ℝ)*(I.width : ℝ)+2*precisionError q
Proof (Lean source)
-- @node: endpoint_negative_power_width lemma endpoint_negative_power_width (E : ArithmeticEngine) (hE : E.Admissible) (q k : ℕ) (hk : 1 ≤ k) (I : RatInterval) (hlo : -3 ≤ I.lo) (hhi : I.hi ≤ 0) : ((E.powBox q k I).width : ℝ) ≤ (k : ℝ)*(I.width : ℝ)+2*precisionError q := by have h := hE.2.2.2.2.2.1 q k I hk hlo (hhi.trans (by norm_num)) have hw := endpoint_negative_power_range_width k hk I hhi have hl := h.1.2.2.1 have hr := h.1.2.2.2.2 simp only [RatInterval.width, Rat.cast_sub] at * linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_negative_power_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:43
theorem endpoint_variance_rational Lemma endpoint_variance_rational in the paper ↗

The variance quantity in the literal radius tree is an exact nonnegative rational. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
conclusion 1
0 ≤ (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))))
conclusion 2
((20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))) : ℚ) : ℝ) = 20 * varianceRadius n k
Proof (Lean source)
-- @node: endpoint_variance_rational lemma endpoint_variance_rational (n k : ℕ) (hn : 2 ≤ n) : 0 ≤ (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1)))) ∧ ((20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))) : ℚ) : ℝ) = 20 * varianceRadius n k := by have hn' : (1 : ℚ) < n := by exact_mod_cast (show 1 < n by omega) constructor · positivity · simp [varianceRadius]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_variance_rational · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:55
theorem endpoint_noise_enclosure

An exact nonnegative input has a square-root enclosure of width at most two errors. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q n k :
ℕ
hn :
2 ≤ n
∃ B : RatInterval,
conclusion 1
(BoxExpr.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1)))))).eval E q xs
= some B
conclusion 2
B.Contains (sqrt (20 * varianceRadius n k))
conclusion 3
(B.width : ℝ) ≤ 2*precisionError q
Proof (Lean source)
-- @node: endpoint_noise_enclosure lemma endpoint_noise_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q n k : ℕ) (hn : 2 ≤ n) (xs : List RatInterval) : ∃ B : RatInterval, (BoxExpr.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1)))))).eval E q xs = some B ∧ B.Contains (sqrt (20 * varianceRadius n k)) ∧ (B.width : ℝ) ≤ 2*precisionError q := by let a : ℚ := 20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))) obtain ⟨ha, haReal⟩ := endpoint_variance_rational n k hn have hc := hE.2.2.2.2.1 q (RatInterval.point a) ha refine ⟨E.sqrtBox q (RatInterval.point a), ?_, ?_, ?_⟩ · simp [BoxExpr.eval, a, RatInterval.point, ha] · rw [← haReal] exact hc.1.1 _ (RatInterval.point_sound a) · have hl := hc.1.2.2.1 have hr := hc.1.2.2.2.2 change sqrt (a : ℝ) - (E.sqrtBox q (RatInterval.point a)).lo ≤ precisionError q at hl change (E.sqrtBox q (RatInterval.point a)).hi - sqrt (a : ℝ) ≤ precisionError q at hr simp only [RatInterval.width, Rat.cast_sub] linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_noise_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:66
theorem endpoint_radius_enclosure

A successful power expression and its exact noise term assemble a scaled radius. Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q n k :
ℕ
hn :
2 ≤ n
hk :
1 ≤ k
e :
v :
ℝ
he :
e.eval E q xs = some I
hv :
I.Contains v
hlo :
-3 ≤ I.lo
hhi :
I.hi ≤ 0
hw :
(I.width : ℝ) ≤ 2*precisionError q
a :
ℚ
ha :
0 ≤ a
∃ B : RatInterval,
conclusion 1
(BoxExpr.add (.mul (.constant a) (.power k e)) (.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))))))).eval E q xs
= some B
conclusion 2
B.Contains ((a : ℝ)*(k : ℝ)^v+sqrt (20*varianceRadius n k))
conclusion 3
(B.width : ℝ) ≤ ((a : ℝ)*(2*(k : ℝ)+2)+2)*precisionError q
Proof (Lean source)
-- @node: endpoint_radius_enclosure lemma endpoint_radius_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q n k : ℕ) (hn : 2 ≤ n) (hk : 1 ≤ k) (xs : List RatInterval) (e : BoxExpr) (I : RatInterval) (v : ℝ) (he : e.eval E q xs = some I) (hv : I.Contains v) (hlo : -3 ≤ I.lo) (hhi : I.hi ≤ 0) (hw : (I.width : ℝ) ≤ 2*precisionError q) (a : ℚ) (ha : 0 ≤ a) : ∃ B : RatInterval, (BoxExpr.add (.mul (.constant a) (.power k e)) (.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))))))).eval E q xs = some B ∧ B.Contains ((a : ℝ)*(k : ℝ)^v+sqrt (20*varianceRadius n k)) ∧ (B.width : ℝ) ≤ ((a : ℝ)*(2*(k : ℝ)+2)+2)*precisionError q := by let P := E.powBox q k I have hP := hE.2.2.2.2.2.1 q k I hk hlo (hhi.trans (by norm_num)) have hPW := endpoint_negative_power_width E hE q k hk I hlo hhi obtain ⟨S, hS, hvS, hwS⟩ := endpoint_noise_enclosure E hE q n k hn xs refine ⟨((RatInterval.point a).mul P).add S, ?_, ?_, ?_⟩ · have hdom : 1 ≤ k ∧ -3 ≤ I.lo ∧ I.hi ≤ 3 := ⟨hk, hlo, hhi.trans (by norm_num)⟩ have hPower : (BoxExpr.power k e).eval E q xs = some P := by simp [BoxExpr.eval, he, hdom, P] have hMul : (BoxExpr.mul (.constant a) (.power k e)).eval E q xs = some ((RatInterval.point a).mul P) := by change (do let A ← some (RatInterval.point a); let B ← (BoxExpr.power k e).eval E q xs; pure (A.mul B)) = _ rw [hPower] rfl change (do let A ← (BoxExpr.mul (.constant a) (.power k e)).eval E q xs let B ← (BoxExpr.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1)))))).eval E q xs pure (A.add B)) = _ rw [hMul, hS] rfl · exact RatInterval.add_sound (RatInterval.mul_sound (RatInterval.point_sound a) (hP.1.1 v hv)) hvS · rw [RatInterval.width_add, (endpoint_point_scale_width P a ha).2] push_cast have ha' : (0 : ℝ) ≤ a := by exact_mod_cast ha have hPw : (P.width : ℝ) ≤ (2*(k : ℝ)+2)*precisionError q := by calc _ ≤ (k : ℝ)*(I.width : ℝ)+2*precisionError q := hPW _ ≤ (k : ℝ)*(2*precisionError q)+2*precisionError q := by gcongr _ = _ := by ring calc _ ≤ (a : ℝ)*((2*(k : ℝ)+2)*precisionError q)+2*precisionError q := add_le_add (mul_le_mul_of_nonneg_left hPw ha') hwS _ = _ := by ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_radius_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:88
theorem endpoint_precision_rank_product

[The endpoint precision bounds the positive exponent overhang even after multiplication by either retained rank. the documented result

Formal statement
n kC kS :
ℕ
(max kC kS : ℕ)*precisionError (qEnd n kC kS) ≤ (1/16 : ℝ)
Proof (Lean source)
lemma endpoint_precision_rank_product (n kC kS : ℕ) : (max kC kS : ℕ)*precisionError (qEnd n kC kS) ≤ (1/16 : ℝ) := by have hk : ((max kC kS : ℕ) : ℝ) ≤ (2 : ℝ)^(clog 2 (max kC kS+1)) := by have h : ((max kC kS : ℕ) : ℝ)+1 ≤ (2 : ℝ)^(clog 2 (max kC kS+1)) := by exact_mod_cast Nat.le_pow_clog (by norm_num : 1 < 2) (max kC kS+1) linarith have hq : 4 + clog 2 (max kC kS+1) ≤ qEnd n kC kS := by unfold qEnd; omega have hp : 16*((max kC kS : ℕ) : ℝ) ≤ (2 : ℝ)^qEnd n kC kS := by calc _ ≤ (2 : ℝ)^4*(2 : ℝ)^(clog 2 (max kC kS+1)) := by simpa only [show (2 : ℝ)^4 = 16 by norm_num] using mul_le_mul_of_nonneg_left hk (by norm_num : (0 : ℝ) ≤ 16) _ = (2 : ℝ)^(4 + clog 2 (max kC kS+1)) := (pow_add _ _ _).symm _ ≤ _ := by gcongr; norm_num rw [precisionError, zpow_neg, zpow_natCast] have h := (mul_le_mul_of_nonneg_right hp (by positivity : 0 ≤ ((2 : ℝ)^qEnd n kC kS)⁻¹)).trans_eq (mul_inv_cancel₀ (by positivity)) nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_precision_rank_product · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:134
theorem endpoint_raw_power_range_width

A precision-sized positive overhang leaves the integer-base derivative bound unchanged when the rank times the precision error is at most one sixteenth. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
q :
ℕ
hhi :
(I.hi : ℝ) ≤ 2*precisionError q
hbudget :
(k : ℝ)*precisionError q ≤ 1/16
(k : ℝ)^(I.hi : ℝ) - (k : ℝ)^(I.lo : ℝ) ≤ (k : ℝ)*(I.width : ℝ)
Proof (Lean source)
-- @node: endpoint_raw_power_range_width lemma endpoint_raw_power_range_width (k : ℕ) (hk : 1 ≤ k) (q : ℕ) (I : RatInterval) (hhi : (I.hi : ℝ) ≤ 2*precisionError q) (hbudget : (k : ℝ)*precisionError q ≤ 1/16) : (k : ℝ)^(I.hi : ℝ) - (k : ℝ)^(I.lo : ℝ) ≤ (k : ℝ)*(I.width : ℝ) := by have hk1 : (1 : ℝ) ≤ k := by exact_mod_cast hk have hk0 : (0 : ℝ) < k := zero_lt_one.trans_le hk1 have ho : (I.lo : ℝ) ≤ I.hi := by exact_mod_cast I.lo_le_hi have hb (v : ℝ) (hv : v ∈ Icc (I.lo : ℝ) I.hi) : ‖(k : ℝ)^v * log k‖ ≤ k := by rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (Real.rpow_nonneg hk0.le _) (Real.log_nonneg hk1))] have hlog2 : log (2 : ℝ) ≤ 1 := by have h := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2) linarith have hlogHalf := Real.log_le_sub_one_of_pos (by positivity : 0 < (k : ℝ)/2) have hlogSplit : log (k : ℝ) = log ((k : ℝ)/2) + log 2 := by rw [← Real.log_mul (by positivity : (k : ℝ)/2 ≠ 0) (by norm_num : (2 : ℝ) ≠ 0)] congr 1 ring have hlog : log (k : ℝ) ≤ (k : ℝ)/2 := by linarith have hlog2Lower : (1/2 : ℝ) ≤ log 2 := by have h := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2⁻¹) rw [Real.log_inv] at h norm_num at h linarith have heps : 0 ≤ precisionError q := by unfold precisionError; positivity have hexp : log (k : ℝ)*v ≤ log 2 := by have hvUpper := hv.2.trans hhi have h₁ := mul_le_mul_of_nonneg_left hvUpper (Real.log_nonneg hk1) have h₂ := mul_le_mul_of_nonneg_right hlog (by positivity : 0 ≤ 2*precisionError q) nlinarith have hpow : (k : ℝ)^v ≤ 2 := by rw [Real.rpow_def_of_pos hk0] exact (Real.exp_le_exp.mpr hexp).trans_eq (Real.exp_log (by norm_num)) calc _ ≤ 2 * ((k : ℝ)/2) := mul_le_mul hpow hlog (Real.log_nonneg hk1) (by norm_num) _ = _ := by ring have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le (f := fun v : ℝ => (k : ℝ)^v) (f' := fun v => (k : ℝ)^v * log k) (fun v _ => by simpa [mul_comm] using ((hasDerivAt_id v).const_rpow hk0).hasDerivWithinAt) hb (convex_Icc (I.lo : ℝ) I.hi) ⟨le_rfl, ho⟩ ⟨ho, le_rfl⟩ rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr ho)] at h exact (le_abs_self _).trans (by simpa [RatInterval.width] using h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_raw_power_range_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:155
theorem endpoint_raw_power_width

The primitive endpoint errors add twice the precision to the raw power range. Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q k :
ℕ
hk :
1 ≤ k
hlo :
-3 ≤ I.lo
hhi :
(I.hi : ℝ) ≤ 2*precisionError q
hq :
precisionError q ≤ 1/4
hbudget :
(k : ℝ)*precisionError q ≤ 1/16
((E.powBox q k I).width : ℝ) ≤ (k : ℝ)*(I.width : ℝ)+2*precisionError q
Proof (Lean source)
lemma endpoint_raw_power_width (E : ArithmeticEngine) (hE : E.Admissible) (q k : ℕ) (hk : 1 ≤ k) (I : RatInterval) (hlo : -3 ≤ I.lo) (hhi : (I.hi : ℝ) ≤ 2*precisionError q) (hq : precisionError q ≤ 1/4) (hbudget : (k : ℝ)*precisionError q ≤ 1/16) : ((E.powBox q k I).width : ℝ) ≤ (k : ℝ)*(I.width : ℝ)+2*precisionError q := by have hdom : I.hi ≤ 3 := by have h : (I.hi : ℝ) ≤ 3 := by linarith exact_mod_cast h have h := hE.2.2.2.2.2.1 q k I hk hlo hdom have hw := endpoint_raw_power_range_width k hk q I hhi hbudget have hl := h.1.2.2.1 have hr := h.1.2.2.2.2 simp only [RatInterval.width, Rat.cast_sub] at * linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_raw_power_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:205
theorem endpoint_raw_radius_enclosure

The raw power expression and exact noise term assemble the same scaled radius. Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q n k :
ℕ
hn :
2 ≤ n
hk :
1 ≤ k
e :
v :
ℝ
he :
e.eval E q xs = some I
hv :
I.Contains v
hlo :
-3 ≤ I.lo
hhi :
(I.hi : ℝ) ≤ 2*precisionError q
hq :
precisionError q ≤ 1/4
hbudget :
(k : ℝ)*precisionError q ≤ 1/16
hw :
(I.width : ℝ) ≤ 2*precisionError q
a :
ℚ
ha :
0 ≤ a
∃ B : RatInterval,
conclusion 1
(BoxExpr.add (.mul (.constant a) (.power k e)) (.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))))))).eval E q xs
= some B
conclusion 2
B.Contains ((a : ℝ)*(k : ℝ)^v+sqrt (20*varianceRadius n k))
conclusion 3
(B.width : ℝ) ≤ ((a : ℝ)*(2*(k : ℝ)+2)+2)*precisionError q
Proof (Lean source)
lemma endpoint_raw_radius_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q n k : ℕ) (hn : 2 ≤ n) (hk : 1 ≤ k) (xs : List RatInterval) (e : BoxExpr) (I : RatInterval) (v : ℝ) (he : e.eval E q xs = some I) (hv : I.Contains v) (hlo : -3 ≤ I.lo) (hhi : (I.hi : ℝ) ≤ 2*precisionError q) (hq : precisionError q ≤ 1/4) (hbudget : (k : ℝ)*precisionError q ≤ 1/16) (hw : (I.width : ℝ) ≤ 2*precisionError q) (a : ℚ) (ha : 0 ≤ a) : ∃ B : RatInterval, (BoxExpr.add (.mul (.constant a) (.power k e)) (.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1))))))).eval E q xs = some B ∧ B.Contains ((a : ℝ)*(k : ℝ)^v+sqrt (20*varianceRadius n k)) ∧ (B.width : ℝ) ≤ ((a : ℝ)*(2*(k : ℝ)+2)+2)*precisionError q := by let P := E.powBox q k I have hdomHi : I.hi ≤ 3 := by have h : (I.hi : ℝ) ≤ 3 := by linarith exact_mod_cast h have hP := hE.2.2.2.2.2.1 q k I hk hlo hdomHi have hPW := endpoint_raw_power_width E hE q k hk I hlo hhi hq hbudget obtain ⟨S, hS, hvS, hwS⟩ := endpoint_noise_enclosure E hE q n k hn xs refine ⟨((RatInterval.point a).mul P).add S, ?_, ?_, ?_⟩ · have hdom : 1 ≤ k ∧ -3 ≤ I.lo ∧ I.hi ≤ 3 := ⟨hk, hlo, hdomHi⟩ have hPower : (BoxExpr.power k e).eval E q xs = some P := by simp [BoxExpr.eval, he, hdom, P] have hMul : (BoxExpr.mul (.constant a) (.power k e)).eval E q xs = some ((RatInterval.point a).mul P) := by change (do let A ← some (RatInterval.point a); let B ← (BoxExpr.power k e).eval E q xs; pure (A.mul B)) = _ rw [hPower] rfl change (do let A ← (BoxExpr.mul (.constant a) (.power k e)).eval E q xs let B ← (BoxExpr.sqrt (.constant (20 * (10/(n : ℚ)+4*k/((n : ℚ)*((n : ℚ)-1)))))).eval E q xs pure (A.add B)) = _ rw [hMul, hS] rfl · exact RatInterval.add_sound (RatInterval.mul_sound (RatInterval.point_sound a) (hP.1.1 v hv)) hvS · rw [RatInterval.width_add, (endpoint_point_scale_width P a ha).2] push_cast have ha' : (0 : ℝ) ≤ a := by exact_mod_cast ha have hPw : (P.width : ℝ) ≤ (2*(k : ℝ)+2)*precisionError q := by calc _ ≤ (k : ℝ)*(I.width : ℝ)+2*precisionError q := hPW _ ≤ (k : ℝ)*(2*precisionError q)+2*precisionError q := by gcongr _ = _ := by ring calc _ ≤ (a : ℝ)*((2*(k : ℝ)+2)*precisionError q)+2*precisionError q := add_le_add (mul_le_mul_of_nonneg_left hPw ha') hwS _ = _ := by ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_raw_radius_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:221
theorem endpoint_exponent_inputs Lemma endpoint_exponent_inputs in the paper ↗

[Successful endpoint queries retain the raw public exponent boxes with their containment, widths, and precision-sized overhang beyond the public rectangle. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hN :
N.Admissible
n :
ℕ
α β :
ℝ
hab :
o :
Fin n → Record
q :
ℕ
hInputs :
endpointInputs N n α β o q = some xs
∃ a b : RatInterval,
conclusion 1
xs[0]? = some a
conclusion 2
xs[1]? = some b
conclusion 3
a.Contains α
conclusion 4
b.Contains β
conclusion 5
-precisionError q ≤ (a.lo : ℝ)
conclusion 6
(a.hi : ℝ) ≤ 1 + precisionError q
conclusion 7
-precisionError q ≤ (b.lo : ℝ)
conclusion 8
(b.hi : ℝ) ≤ 1/4 + precisionError q
conclusion 9
(a.width : ℝ) ≤ precisionError q
conclusion 10
(b.width : ℝ) ≤ precisionError q
Proof (Lean source)
lemma endpoint_exponent_inputs (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (α β : ℝ) (hab : ExponentDomain α β) (o : Fin n → Record) (q : ℕ) (xs : List RatInterval) (hInputs : endpointInputs N n α β o q = some xs) : ∃ a b : RatInterval, xs[0]? = some a ∧ xs[1]? = some b ∧ a.Contains α ∧ b.Contains β ∧ -precisionError q ≤ (a.lo : ℝ) ∧ (a.hi : ℝ) ≤ 1 + precisionError q ∧ -precisionError q ≤ (b.lo : ℝ) ∧ (b.hi : ℝ) ≤ 1/4 + precisionError q ∧ (a.width : ℝ) ≤ precisionError q ∧ (b.width : ℝ) ≤ precisionError q := by have haName := ((hN.1 n α β).1.1 q).2.2 have hbName := ((hN.1 n α β).2.1 q).2.2 have haBounds := endpoint_raw_box_bounds _ α 0 1 (precisionError q) haName.1 (hab.1.trans hab.2.2.1).le hab.2.2.2 haName.2 have hbBounds := endpoint_raw_box_bounds _ β 0 (1/4) (precisionError q) hbName.1 hab.1.le hab.2.1.le hbName.2 simp only [endpointInputs, Option.some.injEq] at hInputs subst xs exact ⟨_, _, rfl, rfl, haName.1, hbName.1, by simpa using haBounds.1, haBounds.2, by simpa using hbBounds.1, hbBounds.2, haName.2, hbName.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_exponent_inputs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:271
theorem endpoint_bias_exponents Lemma endpoint_bias_exponents in the paper ↗

The raw exponent trees remain in the primitive domain, with a two-error positive overhang. Under the stated assumptions. Under the stated assumptions.

Formal statement
q :
ℕ
a b :
α β :
ℝ
ha :
xs[0]? = some a
hb :
xs[1]? = some b
haC :
a.Contains α
hbC :
b.Contains β
halo :
-precisionError q ≤ (a.lo : ℝ)
hahi :
(a.hi : ℝ) ≤ 1 + precisionError q
hblo :
-precisionError q ≤ (b.lo : ℝ)
hbhi :
(b.hi : ℝ) ≤ 1/4 + precisionError q
hq :
precisionError q ≤ 1/4
haW :
(a.width : ℝ) ≤ precisionError q
hbW :
(b.width : ℝ) ≤ precisionError q
∃ I J : RatInterval,
conclusion 1
(BoxExpr.sub (.constant 0) (.add (.input 0) (.input 1))).eval E q xs = some I
conclusion 2
(BoxExpr.mul (.constant (-2)) (.input 1)).eval E q xs = some J
conclusion 3
I.Contains (-(α+β))
conclusion 4
J.Contains (-2*β)
conclusion 5
-3 ≤ I.lo
conclusion 6
(I.hi : ℝ) ≤ 2*precisionError q
conclusion 7
-3 ≤ J.lo
conclusion 8
(J.hi : ℝ) ≤ 2*precisionError q
conclusion 9
(I.width : ℝ) ≤ 2*precisionError q
conclusion 10
(J.width : ℝ) ≤ 2*precisionError q
Proof (Lean source)
lemma endpoint_bias_exponents (E : ArithmeticEngine) (q : ℕ) (xs : List RatInterval) (a b : RatInterval) (α β : ℝ) (ha : xs[0]? = some a) (hb : xs[1]? = some b) (haC : a.Contains α) (hbC : b.Contains β) (halo : -precisionError q ≤ (a.lo : ℝ)) (hahi : (a.hi : ℝ) ≤ 1 + precisionError q) (hblo : -precisionError q ≤ (b.lo : ℝ)) (hbhi : (b.hi : ℝ) ≤ 1/4 + precisionError q) (hq : precisionError q ≤ 1/4) (haW : (a.width : ℝ) ≤ precisionError q) (hbW : (b.width : ℝ) ≤ precisionError q) : ∃ I J : RatInterval, (BoxExpr.sub (.constant 0) (.add (.input 0) (.input 1))).eval E q xs = some I ∧ (BoxExpr.mul (.constant (-2)) (.input 1)).eval E q xs = some J ∧ I.Contains (-(α+β)) ∧ J.Contains (-2*β) ∧ -3 ≤ I.lo ∧ (I.hi : ℝ) ≤ 2*precisionError q ∧ -3 ≤ J.lo ∧ (J.hi : ℝ) ≤ 2*precisionError q ∧ (I.width : ℝ) ≤ 2*precisionError q ∧ (J.width : ℝ) ≤ 2*precisionError q := by let I := (RatInterval.point 0).sub (a.add b) let J := (RatInterval.point (-2)).mul b have hJlo : J.lo = -2*b.hi := by have h := mul_le_mul_of_nonpos_left b.lo_le_hi (by norm_num : (-2 : ℚ) ≤ 0) simp [J, RatInterval.mul, RatInterval.point, min_eq_right h, max_eq_left h, b.lo_le_hi] have hJhi : J.hi = -2*b.lo := by have h := mul_le_mul_of_nonpos_left b.lo_le_hi (by norm_num : (-2 : ℚ) ≤ 0) simp [J, RatInterval.mul, RatInterval.point, min_eq_right h, max_eq_left h, b.lo_le_hi] refine ⟨I, J, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ · simp [BoxExpr.eval, ha, hb, I] · simp [BoxExpr.eval, hb, J] · simpa using RatInterval.sub_sound (RatInterval.point_sound 0) (RatInterval.add_sound haC hbC) · simpa only [Rat.cast_neg, Rat.cast_ofNat] using RatInterval.mul_sound (RatInterval.point_sound (-2)) hbC · dsimp [I, RatInterval.sub, RatInterval.neg, RatInterval.add, RatInterval.point] simp only [zero_add] have h : (-3 : ℝ) ≤ -((a.hi : ℝ)+(b.hi : ℝ)) := by linarith exact_mod_cast h · dsimp [I, RatInterval.sub, RatInterval.neg, RatInterval.add, RatInterval.point] push_cast linarith · rw [hJlo] have h : (-3 : ℝ) ≤ -2*(b.hi : ℝ) := by linarith exact_mod_cast h · rw [hJhi] push_cast linarith · simp only [I, RatInterval.width_sub, RatInterval.width_add] simp only [RatInterval.width, RatInterval.point, sub_self, zero_add, Rat.cast_add] simpa [RatInterval.width] using (show (a.width : ℝ)+(b.width : ℝ) ≤ 2*precisionError q by linarith) · have hJW : J.width = 2*b.width := by rw [RatInterval.width, hJlo, hJhi] dsimp [RatInterval.width]; ring rw [hJW] push_cast linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_bias_exponents · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:293

[The two bias-and-noise subtrees used verbatim by the literal endpoint expressions.

Definition (Lean source)
n kC kS :
ℕ
endpointRadiusExpressions n kC kS :
(.add (.mul (.constant 8) (.power kC (.sub (.constant 0) (.add (.input 0) (.input 1))))) (.sqrt (.constant (20 * (10/(n : ℚ)+4*kC/((n : ℚ)*((n : ℚ)-1)))))), .add (.mul (.constant 25) (.power kS (.mul (.constant (-2)) (.input 1)))) (.sqrt (.constant (20 * (10/(n : ℚ)+4*kS/((n : ℚ)*((n : ℚ)-1)))))))
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointRadiusExpressions · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:345
theorem endpoint_radii_budget_contract

At the actual endpoint inputs both radius subtrees terminate and have the roadmap widths. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n kC kS :
ℕ
hn :
2 ≤ n
hkC :
1 ≤ kC
hkS :
1 ≤ kS
α β :
ℝ
hab :
o :
Fin n → Record
hInputs :
endpointInputs N n α β o (qEnd n kC kS) = some xs
∃ BC BS : RatInterval,
conclusion 1
(endpointRadiusExpressions n kC kS).1.eval E (qEnd n kC kS) xs = some BC
conclusion 2
(endpointRadiusExpressions n kC kS).2.eval E (qEnd n kC kS) xs = some BS
conclusion 3
BC.Contains (8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC))
conclusion 4
BS.Contains (25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS))
conclusion 5
(BC.width : ℝ) ≤ 34*(max kC kS : ℕ)*precisionError (qEnd n kC kS)
conclusion 6
(BS.width : ℝ) ≤ 102*(max kC kS : ℕ)*precisionError (qEnd n kC kS)
Proof (Lean source)
-- @node: endpoint_radii_budget_contract lemma endpoint_radii_budget_contract (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n kC kS : ℕ) (hn : 2 ≤ n) (hkC : 1 ≤ kC) (hkS : 1 ≤ kS) (α β : ℝ) (hab : ExponentDomain α β) (o : Fin n → Record) (xs : List RatInterval) (hInputs : endpointInputs N n α β o (qEnd n kC kS) = some xs) : ∃ BC BS : RatInterval, (endpointRadiusExpressions n kC kS).1.eval E (qEnd n kC kS) xs = some BC ∧ (endpointRadiusExpressions n kC kS).2.eval E (qEnd n kC kS) xs = some BS ∧ BC.Contains (8*(kC : ℝ)^(-(α+β))+sqrt (20*varianceRadius n kC)) ∧ BS.Contains (25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS)) ∧ (BC.width : ℝ) ≤ 34*(max kC kS : ℕ)*precisionError (qEnd n kC kS) ∧ (BS.width : ℝ) ≤ 102*(max kC kS : ℕ)*precisionError (qEnd n kC kS) := by have hq := endpoint_precision_small n kC kS have hbudget := endpoint_precision_rank_product n kC kS have hbudgetC : (kC : ℝ)*precisionError (qEnd n kC kS) ≤ 1/16 := by exact (mul_le_mul_of_nonneg_right (by exact_mod_cast le_max_left kC kS) (by unfold precisionError; positivity)).trans hbudget have hbudgetS : (kS : ℝ)*precisionError (qEnd n kC kS) ≤ 1/16 := by exact (mul_le_mul_of_nonneg_right (by exact_mod_cast le_max_right kC kS) (by unfold precisionError; positivity)).trans hbudget obtain ⟨a, b, ha, hb, haC, hbC, halo, hahi, hblo, hbhi, haW, hbW⟩ := endpoint_exponent_inputs N hN n α β hab o _ xs hInputs obtain ⟨I, J, heI, heJ, hvI, hvJ, hloI, hhiI, hloJ, hhiJ, hwI, hwJ⟩ := endpoint_bias_exponents E _ xs a b α β ha hb haC hbC halo hahi hblo hbhi hq haW hbW obtain ⟨BC, heBC, hvBC, hwBC⟩ := endpoint_raw_radius_enclosure E hE _ n kC hn hkC xs _ I _ heI hvI hloI hhiI hq hbudgetC hwI 8 (by norm_num) obtain ⟨BS, heBS, hvBS, hwBS⟩ := endpoint_raw_radius_enclosure E hE _ n kS hn hkS xs _ J _ heJ hvJ hloJ hhiJ hq hbudgetS hwJ 25 (by norm_num) have hkC' : (1 : ℝ) ≤ kC := by exact_mod_cast hkC have hkS' : (1 : ℝ) ≤ kS := by exact_mod_cast hkS have hKC : (kC : ℝ) ≤ (max kC kS : ℕ) := by exact_mod_cast le_max_left kC kS have hKS : (kS : ℝ) ≤ (max kC kS : ℕ) := by exact_mod_cast le_max_right kC kS have herr : 0 ≤ precisionError (qEnd n kC kS) := by unfold precisionError; positivity refine ⟨BC, BS, heBC, heBS, ?_, ?_, ?_, ?_⟩ · simpa only [Rat.cast_ofNat] using hvBC · simpa only [Rat.cast_ofNat] using hvBS · apply hwBC.trans apply mul_le_mul_of_nonneg_right _ herr norm_num only [Rat.cast_ofNat] linarith · apply hwBS.trans apply mul_le_mul_of_nonneg_right _ herr norm_num only [Rat.cast_ofNat] linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_radii_budget_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:353
theorem endpoint_denominator_clip

The literal denominator clipping is safe for division and preserves the incoming width. Under the stated assumptions. Under the stated assumptions.

Formal statement
q :
ℕ
e :
v w :
ℝ
he :
e.eval E q xs = some B
hv :
B.Contains v
hw :
(B.width : ℝ) ≤ w
∃ D : RatInterval,
conclusion 1
(BoxExpr.max (.constant (1/512)) (.min (.constant 1) e)).eval E q xs = some D
conclusion 2
D.Contains (clip denominatorFloor 1 v)
conclusion 3
1/512 ≤ D.lo
conclusion 4
D.hi ≤ 1
conclusion 5
(D.width : ℝ) ≤ w
Proof (Lean source)
-- @node: endpoint_denominator_clip lemma endpoint_denominator_clip (E : ArithmeticEngine) (q : ℕ) (xs : List RatInterval) (e : BoxExpr) (B : RatInterval) (v w : ℝ) (he : e.eval E q xs = some B) (hv : B.Contains v) (hw : (B.width : ℝ) ≤ w) : ∃ D : RatInterval, (BoxExpr.max (.constant (1/512)) (.min (.constant 1) e)).eval E q xs = some D ∧ D.Contains (clip denominatorFloor 1 v) ∧ 1/512 ≤ D.lo ∧ D.hi ≤ 1 ∧ (D.width : ℝ) ≤ w := by let A := boxMin (RatInterval.point 1) B let D := boxMax (RatInterval.point (1/512)) A have hAc := (endpoint_min_max_contains (RatInterval.point 1) B 1 v (by norm_num [RatInterval.Contains, RatInterval.point]) hv).1 have hDc := (endpoint_min_max_contains (RatInterval.point (1/512)) A (1/512) (min 1 v) (by norm_num [RatInterval.Contains, RatInterval.point]) hAc).2 have hA := endpoint_min_max_endpoints (RatInterval.point 1) B have hD := endpoint_min_max_endpoints (RatInterval.point (1/512)) A have hB0 : (0 : ℝ) ≤ B.width := by exact_mod_cast B.width_nonneg have hw0 : (0 : ℝ) ≤ w := hB0.trans hw have hAW : (A.width : ℝ) ≤ w := by have h := (endpoint_min_max_width (RatInterval.point 1) B).1 simp only [RatInterval.width, RatInterval.point, sub_self] at h have h' : (A.width : ℝ) ≤ max 0 (B.width : ℝ) := by exact_mod_cast h exact h'.trans (max_le hw0 hw) refine ⟨D, ?_, ?_, ?_, ?_, ?_⟩ · simp [BoxExpr.eval, he, D, A] · simpa only [clip, denominatorFloor] using hDc · change 1/512 ≤ (boxMax (RatInterval.point (1/512)) A).lo rw [hD.2.2.1] exact le_max_left _ _ · change (boxMax (RatInterval.point (1/512)) A).hi ≤ 1 rw [hD.2.2.2] apply max_le (by norm_num [RatInterval.point]) change (boxMin (RatInterval.point 1) B).hi ≤ 1 rw [hA.2.1] exact min_le_left _ _ · have h := (endpoint_min_max_width (RatInterval.point (1/512)) A).2 simp only [RatInterval.width, RatInterval.point, sub_self] at h have h' : (D.width : ℝ) ≤ max 0 (A.width : ℝ) := by exact_mod_cast h exact h'.trans (max_le hw0 hAW)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_denominator_clip · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:400
theorem endpoint_denominator_corners

Both literal denominator corners stay positive and have the roadmap's joint width. Under the stated assumptions. Under the stated assumptions.

Formal statement
q n kC kS :
ℕ
hkS :
1 ≤ kS
o :
Fin n → Record
β :
ℝ
S BS :
hS :
(coordinateExpressions n kC kS o).2.eval E q xs = some S
hBS :
(endpointRadiusExpressions n kC kS).2.eval E q xs = some BS
hvS :
S.Contains (sHat n kS o)
hvBS :
BS.Contains (25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS))
hwS :
(S.width : ℝ) ≤ 160*(kS : ℝ)^2*precisionError q
hwBS :
(BS.width : ℝ) ≤ 102*(max kC kS : ℕ)*precisionError q
∃ Dm Dp : RatInterval,
conclusion 1
(BoxExpr.max (.constant (1/512)) (.min (.constant 1) (.sub (coordinateExpressions n kC kS o).2 (endpointRadiusExpressions n kC kS).2))).eval E q xs
= some Dm
conclusion 2
(BoxExpr.max (.constant (1/512)) (.min (.constant 1) (.add (coordinateExpressions n kC kS o).2 (endpointRadiusExpressions n kC kS).2))).eval E q xs
= some Dp
conclusion 3
Dm.Contains (clip denominatorFloor 1 (sHat n kS o-(25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS))))
conclusion 4
Dp.Contains (clip denominatorFloor 1 (sHat n kS o+(25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS))))
conclusion 5
1/512 ≤ Dm.lo
conclusion 6
Dm.hi ≤ 1
conclusion 7
1/512 ≤ Dp.lo
conclusion 8
Dp.hi ≤ 1
conclusion 9
(Dm.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError q
conclusion 10
(Dp.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError q
Proof (Lean source)
-- @node: endpoint_denominator_corners lemma endpoint_denominator_corners (E : ArithmeticEngine) (q n kC kS : ℕ) (hkS : 1 ≤ kS) (xs : List RatInterval) (o : Fin n → Record) (β : ℝ) (S BS : RatInterval) (hS : (coordinateExpressions n kC kS o).2.eval E q xs = some S) (hBS : (endpointRadiusExpressions n kC kS).2.eval E q xs = some BS) (hvS : S.Contains (sHat n kS o)) (hvBS : BS.Contains (25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS))) (hwS : (S.width : ℝ) ≤ 160*(kS : ℝ)^2*precisionError q) (hwBS : (BS.width : ℝ) ≤ 102*(max kC kS : ℕ)*precisionError q) : ∃ Dm Dp : RatInterval, (BoxExpr.max (.constant (1/512)) (.min (.constant 1) (.sub (coordinateExpressions n kC kS o).2 (endpointRadiusExpressions n kC kS).2))).eval E q xs = some Dm ∧ (BoxExpr.max (.constant (1/512)) (.min (.constant 1) (.add (coordinateExpressions n kC kS o).2 (endpointRadiusExpressions n kC kS).2))).eval E q xs = some Dp ∧ Dm.Contains (clip denominatorFloor 1 (sHat n kS o-(25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS)))) ∧ Dp.Contains (clip denominatorFloor 1 (sHat n kS o+(25*(kS : ℝ)^(-2*β)+sqrt (20*varianceRadius n kS)))) ∧ 1/512 ≤ Dm.lo ∧ Dm.hi ≤ 1 ∧ 1/512 ≤ Dp.lo ∧ Dp.hi ≤ 1 ∧ (Dm.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError q ∧ (Dp.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError q := by have hm : (BoxExpr.sub (coordinateExpressions n kC kS o).2 (endpointRadiusExpressions n kC kS).2).eval E q xs = some (S.sub BS) := by change (do let A ← (coordinateExpressions n kC kS o).2.eval E q xs let B ← (endpointRadiusExpressions n kC kS).2.eval E q xs pure (A.sub B)) = _ rw [hS, hBS]; rfl have hp : (BoxExpr.add (coordinateExpressions n kC kS o).2 (endpointRadiusExpressions n kC kS).2).eval E q xs = some (S.add BS) := by change (do let A ← (coordinateExpressions n kC kS o).2.eval E q xs let B ← (endpointRadiusExpressions n kC kS).2.eval E q xs pure (A.add B)) = _ rw [hS, hBS]; rfl have herr : 0 ≤ precisionError q := by unfold precisionError; positivity have hK : (1 : ℝ) ≤ (max kC kS : ℕ) := by exact_mod_cast hkS.trans (le_max_right kC kS) have hk : (kS : ℝ) ≤ (max kC kS : ℕ) := by exact_mod_cast le_max_right kC kS have hw : (S.width : ℝ)+(BS.width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError q := by calc _ ≤ (160*(kS : ℝ)^2+102*(max kC kS : ℕ))*precisionError q := by nlinarith [hwS, hwBS] _ ≤ (300*(max kC kS : ℕ)^2)*precisionError q := by apply mul_le_mul_of_nonneg_right _ herr have hk2 : (kS : ℝ)^2 ≤ ((max kC kS : ℕ) : ℝ)^2 := by gcongr nlinarith [sq_nonneg (((max kC kS : ℕ) : ℝ)-1)] have hwm : ((S.sub BS).width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError q := by rw [RatInterval.width_sub, Rat.cast_add]; exact hw have hwp : ((S.add BS).width : ℝ) ≤ 300*(max kC kS : ℕ)^2*precisionError q := by rw [RatInterval.width_add, Rat.cast_add]; exact hw obtain ⟨Dm, heDm, hvDm, hloDm, hhiDm, hwDm⟩ := endpoint_denominator_clip E q xs _ _ _ _ hm (RatInterval.sub_sound hvS hvBS) hwm obtain ⟨Dp, heDp, hvDp, hloDp, hhiDp, hwDp⟩ := endpoint_denominator_clip E q xs _ _ _ _ hp (RatInterval.add_sound hvS hvBS) hwp exact ⟨Dm, Dp, heDm, heDp, hvDm, hvDp, hloDm, hhiDm, hloDp, hhiDp, hwDm, hwDp⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_denominator_corners · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRadii.lean:442
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.EndpointRanges 18 declarations Exact minimum and maximum ranges preserve containment and the larger input width.

Range operations for the fixed endpoint budget

Exact minimum and maximum ranges preserve containment and the larger input width. Product ranges obey the cross-product variation inequality used in the endpoint roadmap. These estimates concern literal rational operations, not ideal ranges.

theorem endpoint_min_max_endpoints

[Ordered input endpoints remain ordered after taking either minimum or maximum. the stated conclusion holds.

Formal statement
I J :
conclusion 1
(boxMin I J).lo = min I.lo J.lo
conclusion 2
(boxMin I J).hi = min I.hi J.hi
conclusion 3
(boxMax I J).lo = max I.lo J.lo
conclusion 4
(boxMax I J).hi = max I.hi J.hi
Proof (Lean source)
-- @node: endpoint_min_max_endpoints lemma endpoint_min_max_endpoints (I J : RatInterval) : (boxMin I J).lo = min I.lo J.lo ∧ (boxMin I J).hi = min I.hi J.hi ∧ (boxMax I J).lo = max I.lo J.lo ∧ (boxMax I J).hi = max I.hi J.hi := by have hmin := min_le_min I.lo_le_hi J.lo_le_hi have hmax := max_le_max I.lo_le_hi J.lo_le_hi simp [boxMin, boxMax, rationalBox, min_eq_left hmin, max_eq_right hmin, min_eq_left hmax, max_eq_right hmax]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_min_max_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:15
theorem endpoint_min_max_contains

Exact minimum and maximum ranges contain the corresponding real operations. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
I J :
x y :
ℝ
hx :
I.Contains x
hy :
J.Contains y
conclusion 1
(boxMin I J).Contains (min x y)
conclusion 2
(boxMax I J).Contains (max x y)
Proof (Lean source)
-- @node: endpoint_min_max_contains lemma endpoint_min_max_contains (I J : RatInterval) (x y : ℝ) (hx : I.Contains x) (hy : J.Contains y) : (boxMin I J).Contains (min x y) ∧ (boxMax I J).Contains (max x y) := by obtain ⟨hml, hmh, hxl, hxh⟩ := endpoint_min_max_endpoints I J simp only [RatInterval.Contains, hml, hmh, hxl, hxh, Rat.cast_min, Rat.cast_max] exact ⟨⟨min_le_min hx.1 hy.1, min_le_min hx.2 hy.2⟩, ⟨max_le_max hx.1 hy.1, max_le_max hx.2 hy.2⟩⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_min_max_contains · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:25
theorem endpoint_min_max_width

[Minimum and maximum ranges have width at most the larger input width. the stated conclusion holds.

Formal statement
I J :
conclusion 1
(boxMin I J).width ≤ max I.width J.width
conclusion 2
(boxMax I J).width ≤ max I.width J.width
Proof (Lean source)
-- @node: endpoint_min_max_width lemma endpoint_min_max_width (I J : RatInterval) : (boxMin I J).width ≤ max I.width J.width ∧ (boxMax I J).width ≤ max I.width J.width := by obtain ⟨hml, hmh, hxl, hxh⟩ := endpoint_min_max_endpoints I J have hI : I.hi ≤ I.lo + max I.width J.width := by have := le_max_left I.width J.width change I.hi - I.lo ≤ max I.width J.width at this linarith have hJ : J.hi ≤ J.lo + max I.width J.width := by have := le_max_right I.width J.width change J.hi - J.lo ≤ max I.width J.width at this linarith have hm := min_le_min hI hJ have hx := max_le_max hI hJ rw [min_add_add_right] at hm rw [max_add_add_right] at hx change (boxMin I J).hi - (boxMin I J).lo ≤ max I.width J.width ∧ (boxMax I J).hi - (boxMax I J).lo ≤ max I.width J.width rw [hml, hmh, hxl, hxh] constructor <;> linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_min_max_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:35
theorem endpoint_product_variation Lemma endpoint_product_variation in the paper ↗

Inserting the cross product bounds product variation by two coordinate variations. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
x x' y y' B₁ B₂ w₁ w₂ :
ℚ
hB₁ :
0 ≤ B₁
hB₂ :
0 ≤ B₂
hx :
|x'| ≤ B₁
hy :
|y| ≤ B₂
hdx :
|x - x'| ≤ w₁
hdy :
|y - y'| ≤ w₂
x*y-x'*y' ≤ B₂*w₁+B₁*w₂
Proof (Lean source)
-- @node: endpoint_product_variation lemma endpoint_product_variation (x x' y y' B₁ B₂ w₁ w₂ : ℚ) (hB₁ : 0 ≤ B₁) (hB₂ : 0 ≤ B₂) (hx : |x'| ≤ B₁) (hy : |y| ≤ B₂) (hdx : |x - x'| ≤ w₁) (hdy : |y - y'| ≤ w₂) : x*y-x'*y' ≤ B₂*w₁+B₁*w₂ := by calc x*y-x'*y' ≤ |x*y-x'*y'| := le_abs_self _ _ = |y*(x-x')+x'*(y-y')| := by congr 1; ring _ ≤ |y*(x-x')|+|x'*(y-y')| := abs_add_le _ _ _ = |y| *|x - x'|+|x'| *|y - y'| := by rw [abs_mul, abs_mul] _ ≤ B₂*w₁+B₁*w₂ := add_le_add (mul_le_mul hy hdx (abs_nonneg _) hB₂) (mul_le_mul hx hdy (abs_nonneg _) hB₁)
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_product_variation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:58
theorem endpoint_range_difference

Two points of a rational range differ by at most its width. Under the stated assumptions.

Formal statement
x x' :
ℚ
hx :
I.lo ≤ x ∧ x ≤ I.hi
hx' :
I.lo ≤ x' ∧ x' ≤ I.hi
|x - x'| ≤ I.width
Proof (Lean source)
-- @node: endpoint_range_difference lemma endpoint_range_difference (I : RatInterval) (x x' : ℚ) (hx : I.lo ≤ x ∧ x ≤ I.hi) (hx' : I.lo ≤ x' ∧ x' ≤ I.hi) : |x - x'| ≤ I.width := by rw [abs_le] dsimp [RatInterval.width] constructor <;> linarith [hx.1, hx.2, hx'.1, hx'.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_range_difference · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:74
theorem endpoint_range_abs

A uniform magnitude bound on both endpoints bounds every point of the range. Under the stated assumptions.

Formal statement
B x :
ℚ
hlo :
|I.lo| ≤ B
hhi :
|I.hi| ≤ B
hx :
I.lo ≤ x ∧ x ≤ I.hi
|x| ≤ B
Proof (Lean source)
-- @node: endpoint_range_abs lemma endpoint_range_abs (I : RatInterval) (B x : ℚ) (hlo : |I.lo| ≤ B) (hhi : |I.hi| ≤ B) (hx : I.lo ≤ x ∧ x ≤ I.hi) : |x| ≤ B := by rw [abs_le] at hlo hhi ⊢ exact ⟨hlo.1.trans hx.1, hx.2.trans hhi.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_range_abs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:83
theorem endpoint_product_width

The literal four-corner product has the cross-product width bound. Under the stated assumptions.

Formal statement
I J :
B₁ B₂ :
ℚ
hB₁ :
0 ≤ B₁
hB₂ :
0 ≤ B₂
hIlo :
|I.lo| ≤ B₁
hIhi :
|I.hi| ≤ B₁
hJlo :
|J.lo| ≤ B₂
hJhi :
|J.hi| ≤ B₂
(I.mul J).width ≤ B₂*I.width+B₁*J.width
Proof (Lean source)
-- @node: endpoint_product_width lemma endpoint_product_width (I J : RatInterval) (B₁ B₂ : ℚ) (hB₁ : 0 ≤ B₁) (hB₂ : 0 ≤ B₂) (hIlo : |I.lo| ≤ B₁) (hIhi : |I.hi| ≤ B₁) (hJlo : |J.lo| ≤ B₂) (hJhi : |J.hi| ≤ B₂) : (I.mul J).width ≤ B₂*I.width+B₁*J.width := by have h (x x' y y' : ℚ) (hx : I.lo ≤ x ∧ x ≤ I.hi) (hx' : I.lo ≤ x' ∧ x' ≤ I.hi) (hy : J.lo ≤ y ∧ y ≤ J.hi) (hy' : J.lo ≤ y' ∧ y' ≤ J.hi) : x*y-x'*y' ≤ B₂*I.width+B₁*J.width := endpoint_product_variation x x' y y' B₁ B₂ I.width J.width hB₁ hB₂ (endpoint_range_abs I B₁ x' hIlo hIhi hx') (endpoint_range_abs J B₂ y hJlo hJhi hy) (endpoint_range_difference I x x' hx hx') (endpoint_range_difference J y y' hy hy') have hIl : I.lo ≤ I.lo ∧ I.lo ≤ I.hi := ⟨le_rfl, I.lo_le_hi⟩ have hIh : I.lo ≤ I.hi ∧ I.hi ≤ I.hi := ⟨I.lo_le_hi, le_rfl⟩ have hJl : J.lo ≤ J.lo ∧ J.lo ≤ J.hi := ⟨le_rfl, J.lo_le_hi⟩ have hJh : J.lo ≤ J.hi ∧ J.hi ≤ J.hi := ⟨J.lo_le_hi, le_rfl⟩ dsimp [RatInterval.width] at h ⊢ simp only [RatInterval.mul] rw [sub_le_iff_le_add] simp only [max_le_iff, ← min_add_add_left, le_min_iff] repeat' apply intro all_goals first | linarith only [h _ _ _ _ hIl hIl hJl hJl ] | linarith only [h _ _ _ _ hIl hIl hJl hJh ] | linarith only [h _ _ _ _ hIl hIl hJh hJl ] | linarith only [h _ _ _ _ hIl hIl hJh hJh ] | linarith only [h _ _ _ _ hIl hIh hJl hJl ] | linarith only [h _ _ _ _ hIl hIh hJl hJh ] | linarith only [h _ _ _ _ hIl hIh hJh hJl ] | linarith only [h _ _ _ _ hIl hIh hJh hJh ] | linarith only [h _ _ _ _ hIh hIl hJl hJl ] | linarith only [h _ _ _ _ hIh hIl hJl hJh ] | linarith only [h _ _ _ _ hIh hIl hJh hJl ] | linarith only [h _ _ _ _ hIh hIl hJh hJh ] | linarith only [h _ _ _ _ hIh hIh hJl hJl ] | linarith only [h _ _ _ _ hIh hIh hJl hJh ] | linarith only [h _ _ _ _ hIh hIh hJh hJl ]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_product_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:91
theorem endpoint_product_abs

Uniform endpoint magnitudes multiply under the literal four-corner product. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
I J :
B₁ B₂ :
ℚ
hB₁ :
0 ≤ B₁
_hB₂ :
0 ≤ B₂
hIlo :
|I.lo| ≤ B₁
hIhi :
|I.hi| ≤ B₁
hJlo :
|J.lo| ≤ B₂
hJhi :
|J.hi| ≤ B₂
conclusion 1
|(I.mul J).lo| ≤ B₁*B₂
conclusion 2
|(I.mul J).hi| ≤ B₁*B₂
Proof (Lean source)
-- @node: endpoint_product_abs lemma endpoint_product_abs (I J : RatInterval) (B₁ B₂ : ℚ) (hB₁ : 0 ≤ B₁) (_hB₂ : 0 ≤ B₂) (hIlo : |I.lo| ≤ B₁) (hIhi : |I.hi| ≤ B₁) (hJlo : |J.lo| ≤ B₂) (hJhi : |J.hi| ≤ B₂) : |(I.mul J).lo| ≤ B₁*B₂ ∧ |(I.mul J).hi| ≤ B₁*B₂ := by have hll : |I.lo * J.lo| ≤ B₁*B₂ := by rw [abs_mul]; exact mul_le_mul hIlo hJlo (abs_nonneg _) hB₁ have hlh : |I.lo * J.hi| ≤ B₁*B₂ := by rw [abs_mul]; exact mul_le_mul hIlo hJhi (abs_nonneg _) hB₁ have hhl : |I.hi * J.lo| ≤ B₁*B₂ := by rw [abs_mul]; exact mul_le_mul hIhi hJlo (abs_nonneg _) hB₁ have hhh : |I.hi * J.hi| ≤ B₁*B₂ := by rw [abs_mul]; exact mul_le_mul hIhi hJhi (abs_nonneg _) hB₁ rw [abs_le] at hll hlh hhl hhh simp only [RatInterval.mul, abs_le, le_min_iff, max_le_iff] constructor · constructor · exact ⟨⟨hll.1, hlh.1⟩, hhl.1, hhh.1⟩ · exact (min_le_left _ _).trans ((min_le_left _ _).trans hll.2) · constructor · exact (hll.1.trans (le_max_left _ _)).trans (le_max_left _ _) · exact ⟨⟨hll.2, hlh.2⟩, hhl.2, hhh.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_product_abs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:133
theorem endpoint_pi_contract

Every admissible engine supplies a two-error-width pi box in [3,4]. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
conclusion 1
((E.piBox q).width : ℝ) ≤ 2*precisionError q
conclusion 2
|(E.piBox q).lo| ≤ 4
conclusion 3
|(E.piBox q).hi| ≤ 4
Proof (Lean source)
-- @node: endpoint_pi_contract lemma endpoint_pi_contract (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) : ((E.piBox q).width : ℝ) ≤ 2*precisionError q ∧ |(E.piBox q).lo| ≤ 4 ∧ |(E.piBox q).hi| ≤ 4 := by obtain ⟨hContains, hlo, hhi, hlerr, hherr⟩ := hE.2.1 q refine ⟨?_, ?_, ?_⟩ · simp only [RatInterval.width, Rat.cast_sub] linarith · rw [abs_le] constructor <;> linarith [(E.piBox q).lo_le_hi] · rw [abs_le] constructor <;> linarith [(E.piBox q).lo_le_hi]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_pi_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:158
theorem endpoint_cos_contract

[The cosine primitive encloses its exact image, stays in [-1,1], and adds only two precision errors to the argument width. the documented result Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
conclusion 1
x :
I.Contains x
(E.cosBox q I).Contains (cos x)
conclusion 2
|(E.cosBox q I).lo| ≤ 1
conclusion 3
|(E.cosBox q I).hi| ≤ 1
conclusion 4
((E.cosBox q I).width : ℝ) ≤ (I.width : ℝ)+2*precisionError q
Proof (Lean source)
-- @node: endpoint_cos_contract lemma endpoint_cos_contract (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (I : RatInterval) : (∀ x, I.Contains x → (E.cosBox q I).Contains (cos x)) ∧ |(E.cosBox q I).lo| ≤ 1 ∧ |(E.cosBox q I).hi| ≤ 1 ∧ ((E.cosBox q I).width : ℝ) ≤ (I.width : ℝ)+2*precisionError q := by obtain ⟨hContains, a, b, ha, hb, hae, hbe, hal, hbh, hlo, hhi, hw⟩ := hE.2.2.2.2.2.2 q I have hl : -1 ≤ (E.cosBox q I).lo := by rw [hlo]; exact le_max_left _ _ have hh : (E.cosBox q I).hi ≤ 1 := by rw [hhi]; exact min_le_left _ _ refine ⟨hContains, abs_le.mpr ⟨hl, (E.cosBox q I).lo_le_hi.trans hh⟩, abs_le.mpr ⟨hl.trans (E.cosBox q I).lo_le_hi, hh⟩, ?_⟩ simp only [RatInterval.width, Rat.cast_sub] at hw ⊢ linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_cos_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:172
theorem endpoint_sqrt_two_contract

[The square-root-of-two primitive has width at most two precision errors; when the error is at most one quarter its entire range has magnitude at most two. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
hq :
precisionError q ≤ 1 / 4
conclusion 1
(E.sqrtBox q (RatInterval.point 2)).Contains (sqrt 2)
conclusion 2
((E.sqrtBox q (RatInterval.point 2)).width : ℝ) ≤ 2*precisionError q
conclusion 3
|(E.sqrtBox q (RatInterval.point 2)).lo| ≤ 2
conclusion 4
|(E.sqrtBox q (RatInterval.point 2)).hi| ≤ 2
Proof (Lean source)
-- @node: endpoint_sqrt_two_contract lemma endpoint_sqrt_two_contract (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (hq : precisionError q ≤ 1 / 4) : (E.sqrtBox q (RatInterval.point 2)).Contains (sqrt 2) ∧ ((E.sqrtBox q (RatInterval.point 2)).width : ℝ) ≤ 2*precisionError q ∧ |(E.sqrtBox q (RatInterval.point 2)).lo| ≤ 2 ∧ |(E.sqrtBox q (RatInterval.point 2)).hi| ≤ 2 := by obtain ⟨hc, hlo⟩ := hE.2.2.2.2.1 q (RatInterval.point 2) (by norm_num [RatInterval.point]) have hContains := hc.1 _ (RatInterval.point_sound 2) have hLower := hc.2.1 have hLowerErr := hc.2.2.1 have hUpper := hc.2.2.2.1 have hUpperErr := hc.2.2.2.2 have hsqrt : sqrt 2 ≤ 3/2 := by nlinarith [Real.sq_sqrt (by norm_num : (0 : ℝ) ≤ 2), Real.sqrt_nonneg 2] change 0 ≤ sqrt 2 - (E.sqrtBox q (RatInterval.point 2)).lo at hLower change sqrt 2 - (E.sqrtBox q (RatInterval.point 2)).lo ≤ precisionError q at hLowerErr change 0 ≤ (E.sqrtBox q (RatInterval.point 2)).hi - sqrt 2 at hUpper change (E.sqrtBox q (RatInterval.point 2)).hi - sqrt 2 ≤ precisionError q at hUpperErr have hhi : (E.sqrtBox q (RatInterval.point 2)).hi ≤ 2 := by have : ((E.sqrtBox q (RatInterval.point 2)).hi : ℝ) ≤ 2 := by linarith exact_mod_cast this refine ⟨hContains, ?_, ?_, ?_⟩ · simp only [RatInterval.width, Rat.cast_sub] linarith · rw [abs_of_nonneg hlo] exact (E.sqrtBox q (RatInterval.point 2)).lo_le_hi.trans hhi · rw [abs_of_nonneg (hlo.trans (E.sqrtBox q (RatInterval.point 2)).lo_le_hi)] exact hhi
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_sqrt_two_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:189
theorem endpoint_mul_point_endpoints

Multiplication on the right by a nonnegative point scales both endpoints exactly. Under the stated assumptions.

Formal statement
a :
ℚ
ha :
0 ≤ a
conclusion 1
(I.mul (RatInterval.point a)).lo = I.lo*a
conclusion 2
(I.mul (RatInterval.point a)).hi = I.hi*a
Proof (Lean source)
-- @node: endpoint_mul_point_endpoints lemma endpoint_mul_point_endpoints (I : RatInterval) (a : ℚ) (ha : 0 ≤ a) : (I.mul (RatInterval.point a)).lo = I.lo*a ∧ (I.mul (RatInterval.point a)).hi = I.hi*a := by have h := mul_le_mul_of_nonneg_right I.lo_le_hi ha simp [RatInterval.mul, RatInterval.point, min_eq_left h, max_eq_right h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_mul_point_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:221
theorem endpoint_basis_enclosure Lemma endpoint_basis_enclosure in the paper ↗

[The literal cosine basis tree terminates, contains its exact value, has magnitude at most two, and has width at most twenty times the index plus one precision errors, uniformly over engines and covariate enclosures. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
hq :
precisionError q ≤ 1 / 4
j i :
ℕ
hinput :
xs[2 + i]? = some X
x :
hx :
X.Contains (x : ℝ)
hXlo :
-precisionError q ≤ (X.lo : ℝ)
hXhi :
(X.hi : ℝ) ≤ 1 + precisionError q
hXW :
(X.width : ℝ) ≤ precisionError q
∃ B : RatInterval,
conclusion 1
(basisExpression j i).eval E q xs = some B
conclusion 2
B.Contains (cosineBasis j x)
conclusion 3
|B.lo| ≤ 2
conclusion 4
|B.hi| ≤ 2
conclusion 5
(B.width : ℝ) ≤ 20*((j : ℝ)+1)*precisionError q
Proof (Lean source)
lemma endpoint_basis_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (hq : precisionError q ≤ 1 / 4) (j i : ℕ) (xs : List RatInterval) (X : RatInterval) (hinput : xs[2 + i]? = some X) (x : Covariate) (hx : X.Contains (x : ℝ)) (hXlo : -precisionError q ≤ (X.lo : ℝ)) (hXhi : (X.hi : ℝ) ≤ 1 + precisionError q) (hXW : (X.width : ℝ) ≤ precisionError q) : ∃ B : RatInterval, (basisExpression j i).eval E q xs = some B ∧ B.Contains (cosineBasis j x) ∧ |B.lo| ≤ 2 ∧ |B.hi| ≤ 2 ∧ (B.width : ℝ) ≤ 20*((j : ℝ)+1)*precisionError q := by have herr : 0 ≤ precisionError q := by unfold precisionError; positivity by_cases hj : j = 0 · subst j refine ⟨RatInterval.point 1, ?_, ?_, ?_, ?_, ?_⟩ · simp [basisExpression, BoxExpr.eval] · simp [cosineBasis] · norm_num [RatInterval.point] · norm_num [RatInterval.point] · simp only [RatInterval.width, RatInterval.point] push_cast nlinarith · let P := (E.piBox q).mul (RatInterval.point (j : ℚ)) let A := P.mul X let C := E.cosBox q A let S := E.sqrtBox q (RatInterval.point 2) let B := S.mul C obtain ⟨hπW, hπl, hπh⟩ := endpoint_pi_contract E hE q obtain ⟨hSl, hSW, hSlo, hShi⟩ := endpoint_sqrt_two_contract E hE q hq obtain ⟨hPl, hPh⟩ := endpoint_mul_point_endpoints (E.piBox q) (j : ℚ) (by positivity) have hPW : (P.width : ℝ) ≤ 2*(j : ℝ)*precisionError q := by have heq : P.width = (E.piBox q).width*(j : ℚ) := by change P.hi - P.lo = ((E.piBox q).hi - (E.piBox q).lo)*(j : ℚ) dsimp only [P] rw [hPl, hPh] ring rw [heq] push_cast nlinarith have hPlo : |P.lo| ≤ 4*(j : ℚ) := by dsimp only [P]; rw [hPl, abs_mul, abs_of_nonneg (by positivity : (0 : ℚ) ≤ j)] exact mul_le_mul_of_nonneg_right hπl (by positivity) have hPhi : |P.hi| ≤ 4*(j : ℚ) := by dsimp only [P]; rw [hPh, abs_mul, abs_of_nonneg (by positivity : (0 : ℚ) ≤ j)] exact mul_le_mul_of_nonneg_right hπh (by positivity) have hXorder : (X.lo : ℝ) ≤ X.hi := by exact_mod_cast X.lo_le_hi have hXl : |X.lo| ≤ 5/4 := by have h : |(X.lo : ℝ)| ≤ ((5/4 : ℚ) : ℝ) := by norm_num; rw [abs_le]; constructor <;> linarith exact_mod_cast h have hXh : |X.hi| ≤ 5/4 := by have h : |(X.hi : ℝ)| ≤ ((5/4 : ℚ) : ℝ) := by norm_num; rw [abs_le]; constructor <;> linarith exact_mod_cast h have hAW : (A.width : ℝ) ≤ (13/2)*(j : ℝ)*precisionError q := by have hw := endpoint_product_width P X (4*(j : ℚ)) (5/4) (by positivity) (by norm_num) hPlo hPhi hXl hXh have hw' : (A.width : ℝ) ≤ ((5/4 : ℚ) : ℝ)*(P.width : ℝ)+ ((4*(j : ℚ) : ℚ) : ℝ)*(X.width : ℝ) := by exact_mod_cast hw norm_num only [Rat.cast_div, Rat.cast_mul, Rat.cast_ofNat, Rat.cast_natCast] at hw' nlinarith obtain ⟨hCos, hClo, hChi, hCW⟩ := endpoint_cos_contract E hE q A have hBlo : |B.lo| ≤ 2 := by simpa only [mul_one] using (endpoint_product_abs S C 2 1 (by norm_num) (by norm_num) hSlo hShi hClo hChi).1 have hBhi : |B.hi| ≤ 2 := by simpa only [mul_one] using (endpoint_product_abs S C 2 1 (by norm_num) (by norm_num) hSlo hShi hClo hChi).2 refine ⟨B, ?_, ?_, hBlo, hBhi, ?_⟩ · simp [basisExpression, hj, BoxExpr.eval, hinput, B, S, C, A, P, RatInterval.point] · have hArg : A.Contains (pi*(j : ℝ)*(x : ℝ)) := RatInterval.mul_sound (RatInterval.mul_sound (hE.2.1 q).1 (RatInterval.point_sound (j : ℚ))) hx have hb := RatInterval.mul_sound hSl (hCos _ hArg) simpa only [cosineBasis, if_neg hj] using hb · have hw := endpoint_product_width S C 2 1 (by norm_num) (by norm_num) hSlo hShi hClo hChi have hw' : (B.width : ℝ) ≤ (S.width : ℝ)+2*(C.width : ℝ) := by simp only [one_mul] at hw exact_mod_cast hw change (C.width : ℝ) ≤ (A.width : ℝ)+2*precisionError q at hCW change (S.width : ℝ) ≤ 2*precisionError q at hSW nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_basis_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:229
theorem endpoint_expressionSum_enclosure

[A finite expression sum terminates and contains the exact sum whenever each summand does; its width is bounded by the sum of the summand width bounds. the documented result Under the stated assumptions.

Formal statement
q :
ℕ
f :
ℕ → BoxExpr
v w :
ℕ → ℝ
js :
List ℕ
h :
∀ j ∈ js,
∃ B : RatInterval, (f j).eval E q xs = some B ∧ B.Contains (v j) ∧ (B.width : ℝ) ≤ w j
∃ B : RatInterval,
conclusion 1
(expressionSum (js.map f)).eval E q xs = some B
conclusion 2
B.Contains ((js.map v).sum)
conclusion 3
(B.width : ℝ) ≤ (js.map w).sum
Proof (Lean source)
-- @node: endpoint_expressionSum_enclosure lemma endpoint_expressionSum_enclosure (E : ArithmeticEngine) (q : ℕ) (xs : List RatInterval) (f : ℕ → BoxExpr) (v w : ℕ → ℝ) (js : List ℕ) (h : ∀ j ∈ js, ∃ B : RatInterval, (f j).eval E q xs = some B ∧ B.Contains (v j) ∧ (B.width : ℝ) ≤ w j) : ∃ B : RatInterval, (expressionSum (js.map f)).eval E q xs = some B ∧ B.Contains ((js.map v).sum) ∧ (B.width : ℝ) ≤ (js.map w).sum := by induction js with | nil => refine ⟨RatInterval.point 0, ?_, ?_, ?_⟩ · rfl · simp · simp [RatInterval.width, RatInterval.point] | cons j js ih => obtain ⟨A, hA, hvA, hwA⟩ := h j (by simp) obtain ⟨B, hB, hvB, hwB⟩ := ih (fun l hl => h l (by simp [hl])) refine ⟨A.add B, ?_, ?_, ?_⟩ · change (BoxExpr.add (f j) (expressionSum (js.map f))).eval E q xs = some (A.add B) simp [BoxExpr.eval, hA, hB] · simpa only [List.map_cons, List.sum_cons] using RatInterval.add_sound hvA hvB · rw [RatInterval.width_add] push_cast simpa only [List.map_cons, List.sum_cons] using add_le_add hwA hwB
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_expressionSum_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:314
theorem endpoint_kernel_enclosure Lemma endpoint_kernel_enclosure in the paper ↗

[The actual finite cosine-kernel expression terminates, encloses the exact projection kernel, and has width at most 160 k squared precision errors. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q :
ℕ
hq :
precisionError q ≤ 1 / 4
k i l :
ℕ
X Z :
hXi :
xs[2 + i]? = some X
hZl :
xs[2 + l]? = some Z
x z :
hx :
X.Contains (x : ℝ)
hz :
Z.Contains (z : ℝ)
hXlo :
-precisionError q ≤ (X.lo : ℝ)
hXhi :
(X.hi : ℝ) ≤ 1 + precisionError q
hZlo :
-precisionError q ≤ (Z.lo : ℝ)
hZhi :
(Z.hi : ℝ) ≤ 1 + precisionError q
hXW :
(X.width : ℝ) ≤ precisionError q
hZW :
(Z.width : ℝ) ≤ precisionError q
∃ B : RatInterval,
conclusion 1
(kernelExpression k i l).eval E q xs = some B
conclusion 2
B.Contains (projectionKernel k x z)
conclusion 3
(B.width : ℝ) ≤ 160*(k : ℝ)^2*precisionError q
Proof (Lean source)
lemma endpoint_kernel_enclosure (E : ArithmeticEngine) (hE : E.Admissible) (q : ℕ) (hq : precisionError q ≤ 1 / 4) (k i l : ℕ) (xs : List RatInterval) (X Z : RatInterval) (hXi : xs[2 + i]? = some X) (hZl : xs[2 + l]? = some Z) (x z : Covariate) (hx : X.Contains (x : ℝ)) (hz : Z.Contains (z : ℝ)) (hXlo : -precisionError q ≤ (X.lo : ℝ)) (hXhi : (X.hi : ℝ) ≤ 1 + precisionError q) (hZlo : -precisionError q ≤ (Z.lo : ℝ)) (hZhi : (Z.hi : ℝ) ≤ 1 + precisionError q) (hXW : (X.width : ℝ) ≤ precisionError q) (hZW : (Z.width : ℝ) ≤ precisionError q) : ∃ B : RatInterval, (kernelExpression k i l).eval E q xs = some B ∧ B.Contains (projectionKernel k x z) ∧ (B.width : ℝ) ≤ 160*(k : ℝ)^2*precisionError q := by have herr : 0 ≤ precisionError q := by unfold precisionError; positivity have hTerm (j : ℕ) (_ : j ∈ List.range k) : ∃ B : RatInterval, (BoxExpr.mul (basisExpression j i) (basisExpression j l)).eval E q xs = some B ∧ B.Contains (cosineBasis j x * cosineBasis j z) ∧ (B.width : ℝ) ≤ 80*((j : ℝ)+1)*precisionError q := by obtain ⟨A, hA, hvA, haL, haH, hwA⟩ := endpoint_basis_enclosure E hE q hq j i xs X hXi x hx hXlo hXhi hXW obtain ⟨B, hB, hvB, hbL, hbH, hwB⟩ := endpoint_basis_enclosure E hE q hq j l xs Z hZl z hz hZlo hZhi hZW refine ⟨A.mul B, ?_, RatInterval.mul_sound hvA hvB, ?_⟩ · simp [BoxExpr.eval, hA, hB] · have hw := endpoint_product_width A B 2 2 (by norm_num) (by norm_num) haL haH hbL hbH have hw' : ((A.mul B).width : ℝ) ≤ 2*(A.width : ℝ)+2*(B.width : ℝ) := by exact_mod_cast hw linarith obtain ⟨B, hB, hvB, hwB⟩ := endpoint_expressionSum_enclosure E q xs (fun j => BoxExpr.mul (basisExpression j i) (basisExpression j l)) (fun j => cosineBasis j x * cosineBasis j z) (fun j : ℕ => 80*((j : ℝ)+1)*precisionError q) (List.range k) hTerm refine ⟨B, hB, ?_, hwB.trans ?_⟩ · simpa only [projectionKernel, ← List.sum_toFinset _ (List.nodup_range (n := k)), List.toFinset_range] using hvB · have hsum : ((List.range k).map (fun j : ℕ => 80*((j : ℝ)+1)*precisionError q)).sum = ∑ j ∈ range k, 80*((j : ℝ)+1)*precisionError q := by rw [← List.sum_toFinset _ (List.nodup_range (n := k)), List.toFinset_range] rw [hsum] calc _ ≤ ∑ _j ∈ range k, 80*(k : ℝ)*precisionError q := by apply Finset.sum_le_sum intro j hj have hjk : (j : ℝ)+1 ≤ k := by exact_mod_cast Finset.mem_range.mp hj gcongr _ = 80*(k : ℝ)^2*precisionError q := by simp; ring _ ≤ 160*(k : ℝ)^2*precisionError q := by nlinarith [sq_nonneg (k : ℝ)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_kernel_enclosure · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:340
theorem endpoint_precision_small Lemma endpoint_precision_small in the paper ↗

[The prescribed endpoint precision is small enough for the square-root basis range bound, for every sample size and every selected pair of ranks. the documented result

Formal statement
n kC kS :
ℕ
precisionError (qEnd n kC kS) ≤ 1/4
Proof (Lean source)
-- @node: endpoint_precision_small lemma endpoint_precision_small (n kC kS : ℕ) : precisionError (qEnd n kC kS) ≤ 1/4 := by have hq : 2 ≤ qEnd n kC kS := by unfold qEnd; omega have hp : (4 : ℝ) ≤ (2 : ℝ)^(qEnd n kC kS) := by calc _ = (2 : ℝ)^2 := by norm_num _ ≤ (2 : ℝ)^(qEnd n kC kS) := by gcongr; norm_num rw [precisionError, zpow_neg, zpow_natCast] have h := (inv_le_inv₀ (by positivity : (0 : ℝ) < (2 : ℝ)^qEnd n kC kS) (by norm_num)).mpr hp simpa only [one_div] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_precision_small · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:389
theorem endpoint_raw_box_bounds

Containment and width bound the overhang of an unchanged input box. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
v l u w :
ℝ
hv :
I.Contains v
hl :
l ≤ v
hu :
v ≤ u
hw :
(I.width : ℝ) ≤ w
conclusion 1
l-w ≤ (I.lo : ℝ)
conclusion 2
(I.hi : ℝ) ≤ u+w
Proof (Lean source)
lemma endpoint_raw_box_bounds (I : RatInterval) (v l u w : ℝ) (hv : I.Contains v) (hl : l ≤ v) (hu : v ≤ u) (hw : (I.width : ℝ) ≤ w) : l-w ≤ (I.lo : ℝ) ∧ (I.hi : ℝ) ≤ u+w := by have hwidth : (I.hi : ℝ)-(I.lo : ℝ) ≤ w := by simpa [RatInterval.width] using hw constructor <;> linarith [hv.1, hv.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_raw_box_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:403
theorem endpoint_covariate_box

[Intersecting a valid covariate name with the public unit interval succeeds, retains its exact covariate, and does not enlarge the name width. the documented result Under the stated assumptions.

Formal statement
hN :
N.Admissible
n :
ℕ
α β :
ℝ
o :
Fin n → Record
i :
Fin n
q :
ℕ
∃ X : RatInterval,
conclusion 1
boxIntersection (N.covariateName n α β o i q) (rationalBox 0 1) = some X
conclusion 2
X.Contains (covariate (o i))
conclusion 3
0 ≤ X.lo
conclusion 4
X.hi ≤ 1
conclusion 5
(X.width : ℝ) ≤ precisionError q
Proof (Lean source)
-- @node: endpoint_covariate_box lemma endpoint_covariate_box (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (α β : ℝ) (o : Fin n → Record) (i : Fin n) (q : ℕ) : ∃ X : RatInterval, boxIntersection (N.covariateName n α β o i q) (rationalBox 0 1) = some X ∧ X.Contains (covariate (o i)) ∧ 0 ≤ X.lo ∧ X.hi ≤ 1 ∧ (X.width : ℝ) ≤ precisionError q := by have hName := (hN.2.1 n α β o i).1 q have hPublic : (rationalBox 0 1).Contains (covariate (o i)) := by norm_num [rationalBox, RatInterval.Contains] exact ⟨unitInterval.nonneg _, unitInterval.le_one _⟩ obtain ⟨X, hX, hContains, hSub⟩ := boxIntersection_exists_contains (N.covariateName n α β o i q) (rationalBox 0 1) _ hName.2.2.1 hPublic have hSubName : X.Subinterval (N.covariateName n α β o i q) := by unfold boxIntersection at hX split at hX · cases hX exact ⟨le_max_left _ _, min_le_left _ _⟩ · cases hX refine ⟨X, hX, hContains, ?_, ?_, ?_⟩ · simpa [rationalBox] using hSub.1 · simpa [rationalBox] using hSub.2 · have hw : (X.width : ℝ) ≤ (N.covariateName n α β o i q).width := by exact_mod_cast RatInterval.width_mono hSubName exact hw.trans hName.2.2.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpoint_covariate_box · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EndpointRanges.lean:410
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.EngineRoutines 20 declarations The specified truncation counts, remainder brackets, binary integer-square-root recurrence and Machin formula define the witness; its contracts remain proof obligations.

The paper's explicit finite rational arithmetic routines

The specified truncation counts, remainder brackets, binary integer-square-root recurrence and Machin formula define the witness; its contracts remain proof obligations.

def rationalError

Exact dyadic rational error.

Definition (Lean source)
q :
ℕ
rationalError q :
ℚ
1 / 2 ^ q
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalError · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:15
def seriesBound

Bound for the exponential and cosine routines.

Definition (Lean source)
z :
ℚ
seriesBound z :
ℕ
max 1 (⌈|z|⌉ : ℤ).toNat
def seriesCount

The specified polynomial length.

Definition (Lean source)
q :
ℕ
z :
ℚ
seriesCount q z :
ℕ
max (2 * seriesBound z ^ 2) (q + 6)
def expPolynomial

Exact exponential polynomial.

Definition (Lean source)
q :
ℕ
z :
ℚ
expPolynomial q z :
ℚ
∑ j ∈ range (2 * seriesCount q z), z ^ j / (Nat.factorial j : ℚ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.expPolynomial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:21
def paperExpScalar

Scalar exponential enclosure with the prescribed positive floor.

Definition (Lean source)
q :
ℕ
z :
ℚ
paperExpScalar q z :
rationalBox (max (1 / (3 : ℚ) ^ seriesBound z) (expPolynomial q z - rationalError (q + 3))) (expPolynomial q z + rationalError (q + 3))
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperExpScalar · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:24
def cosPolynomial

Exact cosine polynomial.

Definition (Lean source)
q :
ℕ
z :
ℚ
cosPolynomial q z :
ℚ
∑ j ∈ range (seriesCount q z), (-1 : ℚ) ^ j * z ^ (2 * j) / (factorial (2 * j) : ℚ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosPolynomial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:29
def paperCosScalar

Scalar cosine bracket, clipped to its range.

Definition (Lean source)
q :
ℕ
z :
ℚ
paperCosScalar q z :
rationalBox (max (-1) (cosPolynomial q z - rationalError (q + 3))) (min 1 (cosPolynomial q z + rationalError (q + 3)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperCosScalar · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:33
def logRangeBound

Rational range bound for the logarithm.

Definition (Lean source)
z :
ℚ
logRangeBound z :
ℕ
max 2 (max (⌈z⌉ : ℤ).toNat (⌈1 / z⌉ : ℤ).toNat)
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRangeBound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:37
def logPolynomial

Exact atanh logarithm polynomial, with the specified count.

Definition (Lean source)
q :
ℕ
z :
ℚ
logPolynomial q z :
ℚ
v :
(z - 1) / (z + 1)
2 * ∑ j ∈ range (B * (q + 3 + clog 2 (8 * B) + 2)), v ^ (2 * j + 1) / (2 * j + 1 : ℕ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.logPolynomial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:40
def paperLogScalar

Positive-domain logarithm enclosure, totalized by a point outside the domain.

Definition (Lean source)
q :
ℕ
z :
ℚ
paperLogScalar q z :
if 0 < z then rationalBox (logPolynomial q z - rationalError (q + 3)) (logPolynomial q z + rationalError (q + 3)) else RatInterval.point 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperLogScalar · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:46
def integerSqrtStep

One binary integer-square-root step.

Definition (Lean source)
N :
ℕ
lu :
ℕ × ℕ
integerSqrtStep N lu :
ℕ × ℕ
if lu.2 - lu.1
= 1 then lu else let a := (lu.1 + lu.2) / 2 if a ^ 2 ≤ N then (a, lu.2) else (lu.1, a)
CausalSmith.Stat.LogoddsLowsmoothFrontier.integerSqrtStep · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:50
def integerSqrtLoop

Exactly the public number of binary steps, by structural recursion.

Definition (Lean source)
N :
ℕ
integerSqrtLoop N :
ℕ → ℕ × ℕ → ℕ × ℕ
clause 1
| 0, lu => lu
clause 2
| q + 1, lu => integerSqrtLoop N q (integerSqrtStep N lu)
CausalSmith.Stat.LogoddsLowsmoothFrontier.integerSqrtLoop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:55
def paperIntegerSqrt

The literal prescribed fixed-count integer-square-root algorithm.

Definition (Lean source)
N :
ℕ
paperIntegerSqrt N :
ℕ
(integerSqrtLoop N (clog 2 (N + 1) + 1) (0, N + 1)).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperIntegerSqrt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:59
def paperSqrtScalar

Scalar dyadic square-root bracket.

Definition (Lean source)
q :
ℕ
z :
ℚ
paperSqrtScalar q z :
p :
q + 3
N :
(⌊(2 : ℚ) ^ (2 * p) * z⌋ : ℤ).toNat
rationalBox ((a : ℚ) / 2 ^ p) (((a : ℚ) + 1) / 2 ^ p)
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperSqrtScalar · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:62
def arctanPolynomial

The alternating arctangent polynomial.

Definition (Lean source)
N :
ℕ
v :
ℚ
arctanPolynomial N v :
ℚ
∑ j ∈ range N, (-1 : ℚ) ^ j * v ^ (2 * j + 1) / (2 * j + 1 : ℕ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.arctanPolynomial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:68
def paperPi

Machin's fixed-count rational pi enclosure.

Definition (Lean source)
q :
ℕ
paperPi q :
p :
q + 3
S :
16 * arctanPolynomial (p + 4) (1 / 5) - 4 * arctanPolynomial (p + 4) (1 / 239)
def endpointExtension

Monotone endpoint extension of a scalar routine.

Definition (Lean source)
F :
ℕ → ℚ → RatInterval
q :
ℕ
endpointExtension F q I :
rationalBox (F q I.lo).lo (F q I.hi).hi
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointExtension · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:77
def paperCos

Midpoint cosine, enlarged by half the argument width then intersected with [-1,1].

Definition (Lean source)
q :
ℕ
paperCos q I :
J :
paperCosScalar q ((I.lo + I.hi) / 2)
rationalBox (max (-1) (J.lo - I.width / 2)) (min 1 (J.hi + I.width / 2))
def paperPowerScalar

Scalar positive-integer-base power with the paper's internal precision.

Definition (Lean source)
q b :
ℕ
v :
ℚ
paperPowerScalar q b v :
if b
= 1 then RatInterval.point 1 else let B := max 2 b let p := q
+ 12
+ 3 * clog 2 B let L := paperLogScalar p b let J := paperExpScalar p (v * ((L.lo + L.hi) / 2)) let e := 96 * (B : ℚ) ^ 3 * rationalError p rationalBox (max (1 / (b : ℚ) ^ 3) (J.lo - e)) (min ((b : ℚ) ^ 3) (J.hi + e))
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperPowerScalar · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:84
def concreteEngine

The concrete independently fixed rational engine.

Definition (Lean source)
concreteEngine :
clause 1
piBox := paperPi
clause 3
cosBox := paperCos
clause 6
powBox := fun q b => endpointExtension (fun q v => paperPowerScalar q b v) q
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/EngineRoutines.lean:93
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ExpProgram 15 declarations Two copies of the successive-term loop evaluate the scalar endpoint brackets.

Register certificate for the prescribed exponential recurrence

Two copies of the successive-term loop evaluate the scalar endpoint brackets. The instruction count is a fixed rational computation of the public truncation counts.

[Successive terms multiply by the argument and divide by the next index. the stated conclusion holds.

Formal statement
j :
ℕ
z :
ℚ
(z^j / (Nat.factorial j : ℚ) * z) / (j+1 : ℕ) = z^(j+1) / (Nat.factorial (j+1) : ℚ)
Proof (Lean source)
-- @node: expRegister_term_succ lemma expRegister_term_succ (j : ℕ) (z : ℚ) : (z^j / (Nat.factorial j : ℚ) * z) / (j+1 : ℕ) = z^(j+1) / (Nat.factorial (j+1) : ℚ) := by rw [Nat.factorial_succ, pow_succ] push_cast rw [mul_comm (↑j + 1 : ℚ), ← div_div] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegister_term_succ · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:15

The two scalar loops retain the original precision and right endpoint in spare registers.

Definition (Lean source)
expRegisterCode :
[.copy 16 0, .copy 20 2, .constant 18 0, .constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1, .branchLe 2 12 30 24, .add 6 6 5, .mul 5 5 4, .div 5 5 3, .add 3 3 8, .sub 2 2 8, .jump 23, .constant 13 3, .add 13 14 13, .natPow 9 9 13, .div 8 8 9, .sub 0 6 8, .add 1 6 8, .constant 13 3, .natPow 13 13 11, .constant 8 1, .div 13 8 13, .max 0 13 0, .min 17 0 1, .max 1 0 1, .copy 0 17, .copy 18 0, .copy 0 16, .copy 1 20, .constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1, .branchLe 2 12 74 68, .add 6 6 5, .mul 5 5 4, .div 5 5 3, .add 3 3 8, .sub 2 2 8, .jump 67, .constant 13 3, .add 13 14 13, .natPow 9 9 13, .div 8 8 9, .sub 0 6 8, .add 1 6 8, .constant 13 3, .natPow 13 13 11, .constant 8 1, .div 13 8 13, .max 0 13 0, .min 17 0 1, .max 1 0 1, .copy 0 17, .copy 0 18, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:25

The loop head records the partial sum, current term, counter, and untouched frame.

Definition (Lean source)
right :
q j remaining :
ℕ
z :
ℚ
original left endpoint :
ℚ
pc :
s.1 = (if right then 67 else 23)
active :
s.2.2 = false
count :
s.2.1 2 = remaining
index :
s.2.1 3 = (j+1 : ℕ)
argument :
s.2.1 4 = z
term :
s.2.1 5 = z^j/(Nat.factorial j : ℚ)
sum :
s.2.1 6 = ∑ i ∈ range j, z^i/(Nat.factorial i : ℚ)
one :
s.2.1 8 = 1
two :
s.2.1 9 = 2
bound :
s.2.1 11 = seriesBound z
zero :
s.2.1 12 = 0
precision :
s.2.1 14 = q
original :
s.2.1 16 = original
left :
s.2.1 18 = left
endpoint :
s.2.1 20 = endpoint
CausalSmith.Stat.LogoddsLowsmoothFrontier.ExpRegisterInvariant · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:52
theorem expRegisterCode_initial

Initialization computes the prescribed count from any rational argument and precision. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
right :
hp :
s.1 = (if right then 47 else 3)
ha :
s.2.2 = false
q :
(⌊s.2.1 0⌋ : ℤ).toNat
z :
s.2.1 1
ExpRegisterInvariant right q 0 (2*seriesCount q z) z (s.2.1 16) (s.2.1 18) (s.2.1 20) (expRegisterCode.run 20 s)
Proof (Lean source)
-- @node: expRegisterCode_initial lemma expRegisterCode_initial (right : Bool) (s : RationalState) (hp : s.1 = (if right then 47 else 3)) (ha : s.2.2 = false) : let q := (⌊s.2.1 0⌋ : ℤ).toNat let z := s.2.1 1 ExpRegisterInvariant right q 0 (2*seriesCount q z) z (s.2.1 16) (s.2.1 18) (s.2.1 20) (expRegisterCode.run 20 s) := by have hq : max (↑(⌊s.2.1 0⌋ : ℤ) : ℚ) 0 = ((⌊s.2.1 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊s.2.1 0⌋ : ℤ) 0 = (((⌊s.2.1 0⌋ : ℤ).toNat : ℕ) : ℤ) by omega) have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] have hB (z : ℚ) : max (↑(⌈|z|⌉ : ℤ) : ℚ) 1 = (seriesBound z : ℚ) := by have hn := Int.ceil_nonneg (abs_nonneg z) have hc : ((⌈|z|⌉ : ℤ).toNat : ℚ) = (⌈|z|⌉ : ℤ) := by exact_mod_cast Int.toNat_of_nonneg hn simp only [seriesBound, Nat.cast_max, Nat.cast_one, hc] exact max_comm _ _ cases right <;> generalize he : expRegisterCode.run 20 s = t all_goals norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq, habs, hB] at he subst t constructor <;> norm_num [Function.update_apply, seriesCount, Nat.cast_max, Nat.cast_mul, Nat.cast_pow, Nat.cast_add] <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_initial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:72
theorem expRegisterCode_round

Seven instructions add a term and advance the exponential recurrence. Under the stated assumptions. Under the stated assumptions.

Formal statement
right :
q j N :
ℕ
z a l e :
ℚ
h :
ExpRegisterInvariant right q j (N + 1) z a l e s
ExpRegisterInvariant right q (j+1) N z a l e (expRegisterCode.run 7 s)
Proof (Lean source)
-- @node: expRegisterCode_round lemma expRegisterCode_round (right : Bool) (q j N : ℕ) (z a l e : ℚ) (s : RationalState) (h : ExpRegisterInvariant right q j (N + 1) z a l e s) : ExpRegisterInvariant right q (j+1) N z a l e (expRegisterCode.run 7 s) := by rcases h with ⟨hp, ha, hc, hi, hz, ht, hs, h1, h2, hB, h0, hq, ho, hl, he⟩ have hcpos : ¬ (s.2.1 2 ≤ s.2.1 12) := by rw [hc, h0] exact not_le.mpr (by positivity) cases right <;> generalize hh : expRegisterCode.run 7 s = t all_goals norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hcpos] at hh subst t constructor <;> norm_num [Function.update_apply, hc, hi, hz, ht, hs, h1, h2, hB, h0, hq, ho, hl, he, Finset.sum_range_succ, Nat.cast_add] · convert expRegister_term_succ j z using 1 <;> push_cast <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_round · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:103
theorem expRegisterCode_exit

At zero count the scalar exit sorts its prescribed positive-floor bracket. Under the stated assumptions.

Formal statement
right :
q j :
ℕ
z a l e :
ℚ
h :
ExpRegisterInvariant right q j 0 z a l e s
S :
∑ i ∈ range j, z^i/(Nat.factorial i : ℚ)
A :
max (1/(3 : ℚ)^seriesBound z) (S-rationalError (q+3))
B :
t :
expRegisterCode.run 15 s
t.1 = (if right then 88 else 44)
t.2.2 = false
t.2.1 0 = min A B
t.2.1 1 = max A B
t.2.1 16 = a
t.2.1 18 = l
t.2.1 20 = e
Proof (Lean source)
-- @node: expRegisterCode_exit lemma expRegisterCode_exit (right : Bool) (q j : ℕ) (z a l e : ℚ) (s : RationalState) (h : ExpRegisterInvariant right q j 0 z a l e s) : let S := ∑ i ∈ range j, z^i/(Nat.factorial i : ℚ) let A := max (1/(3 : ℚ)^seriesBound z) (S-rationalError (q+3)) let B := S+rationalError (q+3) let t := expRegisterCode.run 15 s t.1 = (if right then 88 else 44) ∧ t.2.2 = false ∧ t.2.1 0 = min A B ∧ t.2.1 1 = max A B ∧ t.2.1 16 = a ∧ t.2.1 18 = l ∧ t.2.1 20 = e := by rcases h with ⟨hp, ha, hc, hi, hz, ht, hs, h1, h2, hB, h0, hq, ho, hl, he⟩ have hnat : ((q : ℤ)+3).toNat = q+3 := by omega have hbound : (⌊(seriesBound z : ℚ)⌋ : ℤ).toNat = seriesBound z := by simp cases right <;> norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, hs, h1, h2, hB, h0, hq, ho, hl, he, rationalError, ← Nat.cast_add, hnat, hbound]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_exit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:121
theorem expRegisterCode_loop

The fixed loop count exhausts all terms before the scalar exit. Under the stated assumptions.

Formal statement
right :
q j N :
ℕ
z a l e :
ℚ
h :
ExpRegisterInvariant right q j N z a l e s
S :
∑ i ∈ range (j+N), z^i/(Nat.factorial i : ℚ)
A :
max (1/(3 : ℚ)^seriesBound z) (S-rationalError (q+3))
B :
t :
expRegisterCode.run (7*N+15) s
t.1 = (if right then 88 else 44)
t.2.2 = false
t.2.1 0 = min A B
t.2.1 1 = max A B
t.2.1 16 = a
t.2.1 18 = l
t.2.1 20 = e
Proof (Lean source)
-- @node: expRegisterCode_loop lemma expRegisterCode_loop (right : Bool) (q j N : ℕ) (z a l e : ℚ) (s : RationalState) (h : ExpRegisterInvariant right q j N z a l e s) : let S := ∑ i ∈ range (j+N), z^i/(Nat.factorial i : ℚ) let A := max (1/(3 : ℚ)^seriesBound z) (S-rationalError (q+3)) let B := S+rationalError (q+3) let t := expRegisterCode.run (7*N+15) s t.1 = (if right then 88 else 44) ∧ t.2.2 = false ∧ t.2.1 0 = min A B ∧ t.2.1 1 = max A B ∧ t.2.1 16 = a ∧ t.2.1 18 = l ∧ t.2.1 20 = e := by induction N generalizing j s with | zero => simpa using expRegisterCode_exit right q j z a l e s h | succ N ih => rw [show 7*(N+1)+15 = 7+(7*N+15) by omega, rationalProgram_run_add] simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (j+1) _ (expRegisterCode_round right q j N z a l e s h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_loop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:140
theorem expRegisterCode_start

The initial frame saves the right endpoint before the left scalar loop. the stated conclusion holds.

Formal statement
xs :
List ℚ
ExpRegisterInvariant false (⌊xs[0]?.getD 0⌋ : ℤ).toNat 0 (2*seriesCount (⌊xs[0]?.getD 0⌋ : ℤ).toNat (xs[1]?.getD 0)) (xs[1]?.getD 0) (xs[0]?.getD 0) 0 (xs[2]?.getD 0) (expRegisterCode.run 23 (RationalProgram.initial xs))
Proof (Lean source)
-- @node: expRegisterCode_start lemma expRegisterCode_start (xs : List ℚ) : ExpRegisterInvariant false (⌊xs[0]?.getD 0⌋ : ℤ).toNat 0 (2*seriesCount (⌊xs[0]?.getD 0⌋ : ℤ).toNat (xs[1]?.getD 0)) (xs[1]?.getD 0) (xs[0]?.getD 0) 0 (xs[2]?.getD 0) (expRegisterCode.run 23 (RationalProgram.initial xs)) := by rw [show 23 = 3+20 by rfl, rationalProgram_run_add] have hp : (expRegisterCode.run 3 (RationalProgram.initial xs)).1 = 3 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial] have ha : (expRegisterCode.run 3 (RationalProgram.initial xs)).2.2 = false := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial] have h := expRegisterCode_initial false _ hp ha convert h using 1 <;> norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_start · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:158

The two scalar loops have a public count determined by the input precision and endpoints.

Definition (Lean source)
xs :
List ℚ
expRegisterFuel xs :
ℕ
78
+ 7*(2*seriesCount (⌊xs[0]?.getD 0⌋ : ℤ).toNat (xs[1]?.getD 0) + 2*seriesCount (⌊xs[0]?.getD 0⌋ : ℤ).toNat (xs[2]?.getD 0))
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:175
theorem expRegisterCode_result

Both endpoint loops return the literal endpoint extension, on every rational input list. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
lo :
(paperExpScalar q (xs[1]?.getD 0)).lo
hi :
(paperExpScalar q (xs[2]?.getD 0)).hi
t :
expRegisterCode.run (expRegisterFuel xs) (RationalProgram.initial xs)
t.2.2 = true
t.2.1 0 = lo
t.2.1 1 = hi
Proof (Lean source)
-- @node: expRegisterCode_result lemma expRegisterCode_result (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let lo := (paperExpScalar q (xs[1]?.getD 0)).lo let hi := (paperExpScalar q (xs[2]?.getD 0)).hi let t := expRegisterCode.run (expRegisterFuel xs) (RationalProgram.initial xs) t.2.2 = true ∧ t.2.1 0 = lo ∧ t.2.1 1 = hi := by let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let z := xs[1]?.getD 0 let w := xs[2]?.getD 0 let N := 2*seriesCount q z let M := 2*seriesCount q w have h := expRegisterCode_loop false q 0 N z _ 0 w _ (expRegisterCode_start xs) dsimp only [expRegisterFuel] have hf : 78+7*(N+M) = 23+(7*N+15)+(3+20)+(7*M+15)+2 := by omega rw [hf, rationalProgram_run_add _ (23+(7*N+15)+(3+20)+(7*M+15)) 2, rationalProgram_run_add _ (23+(7*N+15)+(3+20)) (7*M+15), rationalProgram_run_add _ (23+(7*N+15)) (3+20), rationalProgram_run_add _ 23 (7*N+15)] generalize hs : expRegisterCode.run (7*N+15) (expRegisterCode.run 23 (RationalProgram.initial xs)) = s at h ⊢ simp only [Bool.false_eq_true, ↓reduceIte, zero_add] at h rcases h with ⟨hp, ha, hlo, hhi, hq, hl, hw⟩ have hp' : (expRegisterCode.run 3 s).1 = 47 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have ha' : (expRegisterCode.run 3 s).2.2 = false := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have hinit := expRegisterCode_initial true (expRegisterCode.run 3 s) hp' ha' have h0 : (expRegisterCode.run 3 s).2.1 0 = xs[0]?.getD 0 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq] have h1 : (expRegisterCode.run 3 s).2.1 1 = w := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hw] have h18 : (expRegisterCode.run 3 s).2.1 18 = (paperExpScalar q z).lo := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hlo, paperExpScalar, rationalBox, expPolynomial, N] simp only [h0, h1] at hinit have hright := expRegisterCode_loop true q 0 M w _ _ _ _ hinit rw [rationalProgram_run_add _ 3 20] generalize ht : expRegisterCode.run (7*M+15) (expRegisterCode.run 20 (expRegisterCode.run 3 s)) = t at hright ⊢ simp only [↓reduceIte, zero_add] at hright rcases hright with ⟨htp, hta, _, hthi, _, htl, _⟩ rw [h18] at htl norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hthi, htl, paperExpScalar, rationalBox, expPolynomial, M, q, z, w]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:181

A straight-line register program computes the complete two-endpoint instruction count.

Definition (Lean source)
expRegisterFuelCode :
[.copy 20 2] ++ [.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1] ++ [.copy 21 2, .copy 1 20] ++ [.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1] ++ [.add 2 2 21, .constant 13 7, .mul 0 2 13, .constant 13 78, .add 0 0 13, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:231
theorem expRegisterFuel_public

The step bound is itself computed by a total finite rational program. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: expRegisterFuel_public lemma expRegisterFuel_public : PublicIterationBound expRegisterFuel := by refine ⟨expRegisterFuelCode, ?_⟩ intro xs have hq : max (↑(⌊xs[0]?.getD 0⌋ : ℤ) : ℚ) 0 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊xs[0]?.getD 0⌋ : ℤ) 0 = (((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℕ) : ℤ) by omega) have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] have hB (z : ℚ) : max (↑(⌈|z|⌉ : ℤ) : ℚ) 1 = (seriesBound z : ℚ) := by have hn := Int.ceil_nonneg (abs_nonneg z) have hc : ((⌈|z|⌉ : ℤ).toNat : ℚ) = (⌈|z|⌉ : ℤ) := by exact_mod_cast Int.toNat_of_nonneg hn simp only [seriesBound, Nat.cast_max, Nat.cast_one, hc] exact max_comm _ _ refine ⟨49, ?_, ?_⟩ · norm_num [expRegisterFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply] · norm_num [expRegisterFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, expRegisterFuel, seriesCount, Nat.cast_add, Nat.cast_mul, Nat.cast_max, Nat.cast_pow, hq, habs, hB] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:252
theorem expRegisterCode_halts

The publicly bounded two-endpoint exponential program halts on every rational list. the stated conclusion holds.

Formal statement
xs :
List ℚ
(expRegisterCode.run (expRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true
Proof (Lean source)
-- @node: expRegisterCode_halts lemma expRegisterCode_halts (xs : List ℚ) : (expRegisterCode.run (expRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true := by exact (expRegisterCode_result xs).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_halts · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:279

Certified finite register implementation of exponential endpoint extension.

Definition (Lean source)
expRegisterProgram :
clause 1
clause 2
iterationBound := expRegisterFuel
clause 3
public_bound := expRegisterFuel_public
clause 4
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:285
theorem concreteEngine_exp_register_certificate

The register output agrees with the prescribed concrete exponential interval. the stated conclusion holds.

Formal statement
q :
ℕ
concreteEngine.expBox q I
= let v := expRegisterProgram.eval [q, I.lo, I.hi]; rationalBox v.1 v.2
Proof (Lean source)
-- @node: concreteEngine_exp_register_certificate lemma concreteEngine_exp_register_certificate (q : ℕ) (I : RatInterval) : concreteEngine.expBox q I = let v := expRegisterProgram.eval [q, I.lo, I.hi]; rationalBox v.1 v.2 := by have h := expRegisterCode_result [(q : ℚ), I.lo, I.hi] simp only [List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] at h dsimp only [concreteEngine, endpointExtension, BoundedRationalProgram.eval, expRegisterProgram] rw [h.2.1, h.2.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_exp_register_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ExpProgram.lean:293
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairAmbientSmoothness 3 declarations Compactness of the two integration coordinates preserves joint smoothness on one ambient neighborhood.

Ambient smoothness of the fair Taylor equation

Compactness of the two integration coordinates preserves joint smoothness on one ambient neighborhood. The scalar implicit theorem then gives one smooth branch on an open set, rather than order-dependent point neighborhoods.

theorem fairEquation_eventually_contDiffAt

[The analytic Taylor integrand remains smooth above a common ambient neighborhood of every point of the closed parameter box. the documented result Under the stated assumptions.

Formal statement
x :
Fin 4 → ℝ
∀ᶠ w in 𝓝 x, ContDiffAt ℝ ∞ (fun z : Fin 4 → ℝ => fairEquation (z 0) (z 1) (z 2) (z 3)) w
Proof (Lean source)
-- @node: fairEquation_eventually_contDiffAt lemma fairEquation_eventually_contDiffAt (x : Fin 4 → ℝ) (hx : x ∈ fairTaylorParameterRegion) : ∀ᶠ w in 𝓝 x, ContDiffAt ℝ ∞ (fun z : Fin 4 → ℝ => fairEquation (z 0) (z 1) (z 2) (z 3)) w := by let F : ((Fin 4 → ℝ) × ℝ) → ℝ → ℝ := fun z v => (1-v)*deriv (fun T => deriv (deriv (fun D => fairNumerator T D (z.1 2) (z.1 3))) (v*z.1 1)) (z.2*z.1 0) have hevent : ∀ᶠ w in 𝓝 x, ∀ sv ∈ Icc (0 : ℝ) 1 ×ˢ Icc (0 : ℝ) 1, ContDiffAt ℝ ⊤ F.uncurry ((w,sv.1),sv.2) := by apply (isCompact_Icc.prod isCompact_Icc).eventually_forall_of_forall_eventually intro sv hsv exact (by fun_prop : ContinuousAt (fun z : (Fin 4 → ℝ) × (ℝ × ℝ) => ((z.1,z.2.1),z.2.2)) (x,sv)) ((fairTaylorIntegrand_contDiffAt ((x,sv.1),sv.2) hx hsv.1 hsv.2).eventually (by simp)) filter_upwards [hevent] with w hw apply calibration_intervalIntegral_contDiffAt intro s hs exact calibration_intervalIntegral_contDiffAt F (w,s) (fun v hv => (hw (s,v) ⟨hs,hv⟩).of_le le_top)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_eventually_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairAmbientSmoothness.lean:16
theorem scalar_infty_implicit_function Lemma scalar_infty_implicit_function in the paper ↗

[A single open domain of smoothness gives a single smooth implicit branch for every finite derivative order. the documented result Under the stated assumptions.

Formal statement
d :
ℕ
F :
((Fin d → ℝ) × ℝ) → ℝ
D :
Set ((Fin d → ℝ) × ℝ)
b₀ :
Fin d → ℝ
χ₀ :
ℝ
hOpen :
hMem :
(b₀, χ₀) ∈ D
hSmooth :
ContDiffOn ℝ ∞ F D
hZero :
F (b₀, χ₀) = 0
hPartial :
deriv (fun χ => F (b₀, χ)) χ₀ ≠ 0
∃ (U : Set (Fin d → ℝ)) (V : Set ℝ) (q : (Fin d → ℝ) → ℝ),
b₀ ∈ U
χ₀ ∈ V
U ×ˢ V ⊆ D
ContDiffOn ℝ ∞ q U
q b₀ = χ₀
conclusion 1
b ∈ U :
q b ∈ V
conclusion 2
b ∈ U :
χ ∈ V :
F (b,χ) = 0 ↔ χ = q b
Proof (Lean source)
-- @node: scalar_infty_implicit_function lemma scalar_infty_implicit_function (d : ℕ) (F : ((Fin d → ℝ) × ℝ) → ℝ) (D : Set ((Fin d → ℝ) × ℝ)) (b₀ : Fin d → ℝ) (χ₀ : ℝ) (hOpen : IsOpen D) (hMem : (b₀, χ₀) ∈ D) (hSmooth : ContDiffOn ℝ ∞ F D) (hZero : F (b₀, χ₀) = 0) (hPartial : deriv (fun χ => F (b₀, χ)) χ₀ ≠ 0) : ∃ (U : Set (Fin d → ℝ)) (V : Set ℝ) (q : (Fin d → ℝ) → ℝ), IsOpen U ∧ b₀ ∈ U ∧ IsOpen V ∧ χ₀ ∈ V ∧ U ×ˢ V ⊆ D ∧ ContDiffOn ℝ ∞ q U ∧ q b₀ = χ₀ ∧ (∀ b ∈ U, q b ∈ V) ∧ (∀ b ∈ U, ∀ χ ∈ V, F (b,χ) = 0 ↔ χ = q b) := by have hCoeff (z : (Fin d → ℝ) × ℝ) (hz : z ∈ D) : deriv (fun χ => F (z.1, χ)) z.2 = fderiv ℝ F z (0, 1) := by have hAt := (hSmooth.contDiffAt (hOpen.mem_nhds hz)).differentiableAt (by simp : (∞ : ℕ∞ω) ≠ 0) exact (hAt.hasFDerivAt.comp z.2 (hasFDerivAt_prodMk_right z.1 z.2)).hasDerivAt.deriv have hc : ContinuousAt (fun z => fderiv ℝ F z (0, 1)) (b₀, χ₀) := by exact ((hSmooth.continuousOn_fderiv_of_isOpen hOpen (by simp)).continuousAt (hOpen.mem_nhds hMem)).clm_apply continuousAt_const have hne : ∀ᶠ z in 𝓝 (b₀, χ₀), fderiv ℝ F z (0, 1) ≠ 0 := hc.eventually_ne (by rwa [← hCoeff (b₀, χ₀) hMem]) obtain ⟨W, hWsub, hWopen, hWmem⟩ := mem_nhds_iff.mp hne obtain ⟨U, V, q, hU, hb, hV, hχ, hUV, hC1, hBase, hRange, hGraph⟩ := scalar_implicit_function d F (D ∩ W) b₀ χ₀ (hOpen.inter hWopen) ⟨hMem, hWmem⟩ ((hSmooth.of_le (by simp)).mono Set.inter_subset_left) hZero hPartial refine ⟨U, V, q, hU, hb, hV, hχ, ?_, ?_, hBase, hRange, hGraph⟩ · intro z hz exact (hUV hz).1 · intro b hb have hz : (b, q b) ∈ D ∩ W := hUV ⟨hb, hRange b hb⟩ have hq := (hC1.contDiffAt (hU.mem_nhds hb)).continuousAt have he : ∀ᶠ a in 𝓝 b, F (a, q a) = 0 := by filter_upwards [hU.mem_nhds hb] with a ha exact (hGraph a ha (q a) (hRange a ha)).mpr rfl apply (scalar_implicit_root_contDiffAt d ∞ (by simp) F q b (hSmooth.contDiffAt (hOpen.mem_nhds hz.1)) hq he ?_).contDiffWithinAt rw [hCoeff (b, q b) hz.1] exact hWsub hz.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.scalar_infty_implicit_function · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairAmbientSmoothness.lean:40
theorem localFairCell_eventually_contDiffAt_of_root Lemma localFairCell_eventually_contDiffAt_of_root in the paper ↗

Smooth selected roots near a zero-amplitude point yield smooth actual fair cells nearby; the outer risk formulas have analytic ambient neighborhoods. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hq :
ContinuousAt (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) ![t,0,u]
hroot :
∀ᶠ v in 𝓝 ![t,0,u], ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v
b :
s :
a y :
∀ᶠ v in 𝓝 ![t,0,u], ContDiffAt ℝ ∞ (localFairCell b s a y) v
Proof (Lean source)
-- @node: localFairCell_eventually_contDiffAt_of_root lemma localFairCell_eventually_contDiffAt_of_root (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hq : ContinuousAt (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) ![t,0,u]) (hroot : ∀ᶠ v in 𝓝 ![t,0,u], ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v) (b : Bool) (s : Bool × Bool) (a y : Bool) : ∀ᶠ v in 𝓝 ![t,0,u], ContDiffAt ℝ ∞ (localFairCell b s a y) v := by let q : (Fin 3 → ℝ) → ℝ := fun w => fairRoot (w 0) (w 1) (w 2) let μ : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => if b then z.2+z.1 1*localSignField (z.1 2) s else z.2 let T : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => if b then z.1 0 else comparatorEffect (z.1 0) (z.1 1) let H : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => (1/2)*(if y then (if a then riskShift (T z) (μ z) else μ z) else 1-(if a then riskShift (T z) (μ z) else μ z)) let z₀ := (![t,0,u],q ![t,0,u]) have hμ : ContDiffAt ℝ ⊤ μ z₀ := by cases b <;> dsimp [μ] <;> first | fun_prop | (unfold localSignField; fun_prop) have hT : ContDiffAt ℝ ⊤ T z₀ := by cases b · have hp : ContDiffAt ℝ ⊤ (fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1]) z₀ := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop exact (comparatorEffect_contDiffAt ![t,0] ht (by norm_num)).comp z₀ hp · dsimp [T]; fun_prop have hμpos : 0 ≤ μ z₀ := by have hp := fairRoot_mem_bracket t 0 u cases b <;> simp [μ,z₀,q] <;> linarith [hp.1] have hTpos : 0 ≤ T z₀ := by have h := comparatorEffect_range_bounds t 0 ht (by norm_num) cases b <;> dsimp [T,z₀] <;> linarith [ht.1,h.1] have hshift : ContDiffAt ℝ ⊤ (fun z => riskShift (T z) (μ z)) z₀ := by unfold riskShift exact (hT.exp.mul hμ).div (contDiffAt_const.add ((hT.exp.sub contDiffAt_const).mul hμ)) (ne_of_gt (riskShift_denominator_pos _ _ hTpos hμpos)) have hH : ContDiffAt ℝ ⊤ H z₀ := by cases a <;> cases y <;> dsimp [H] <;> fun_prop have hevent := (continuousAt_id.prodMk hq) (hH.eventually (by simp)) filter_upwards [hevent,hroot] with v hHv hqv change ContDiffAt ℝ ⊤ H (v,q v) at hHv have hc : ContDiffAt ℝ ∞ (fun w => H (w,q w)) v := (hHv.of_le (show (∞ : ℕ∞ω) ≤ ⊤ from le_top)).comp (f := fun w => (w,q w)) (g := H) v (contDiffAt_id.prodMk hqv) exact hc
CausalSmith.Stat.LogoddsLowsmoothFrontier.localFairCell_eventually_contDiffAt_of_root · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairAmbientSmoothness.lean:83
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairAmplitudeSymmetry 6 declarations Sign symmetry transports through the numerator, its Taylor extension, and the literal selected root, including both amplitude axes.

Signed fair-calibration symmetry

Sign symmetry transports through the numerator, its Taylor extension, and the literal selected root, including both amplitude axes.

Symmetry of the two independent signs makes every transformed sign average even. Under the stated assumptions.

Formal statement
F :
ℝ → ℝ
u :
ℝ
signAverage (fun s => F (-localSignField u s))
= signAverage (fun s => F (localSignField u s))
Proof (Lean source)
-- @node: signAverage_neg_field lemma signAverage_neg_field (F : ℝ → ℝ) (u : ℝ) : signAverage (fun s => F (-localSignField u s)) = signAverage (fun s => F (localSignField u s)) := by simp only [signAverage, Fintype.sum_prod_type, Fintype.sum_bool, localSignField, signValue, Bool.false_eq_true, ↓reduceIte] simp only [neg_add_rev, neg_mul, neg_neg, one_mul] simp only [add_comm, add_left_comm]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signAverage_neg_field · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairAmplitudeSymmetry.lean:16

[The deterministic fair comparator is even in the signed amplitude. the stated conclusion holds.

Formal statement
t δ :
ℝ
Proof (Lean source)
-- @node: comparatorEffect_even lemma comparatorEffect_even (t δ : ℝ) : comparatorEffect t (-δ) = comparatorEffect t δ := by simp only [comparatorEffect, neg_sq]
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_even · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairAmplitudeSymmetry.lean:26

Reversing the amplitude reindexes the symmetric sign law in the fair numerator. the stated conclusion holds.

Formal statement
t δ ξ u :
ℝ
fairNumerator t (-δ) ξ u = fairNumerator t δ ξ u
Proof (Lean source)
-- @node: fairNumerator_even lemma fairNumerator_even (t δ ξ u : ℝ) : fairNumerator t (-δ) ξ u = fairNumerator t δ ξ u := by unfold fairNumerator rw [comparatorEffect_even] have he : (fun s => riskShift t (ξ+(-δ)*localSignField u s)) = (fun s => riskShift t (ξ+δ*(-localSignField u s))) := by funext s congr 1 ring rw [he, signAverage_neg_field (fun z => riskShift t (ξ+δ*z)) u]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_even · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairAmplitudeSymmetry.lean:31
theorem calibration_second_deriv_even Lemma calibration_second_deriv_even in the paper ↗

Two derivatives preserve evenness, including where the totalized derivative is zero. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
f :
ℝ → ℝ
hf :
∀ x, f (-x) = f x
x :
ℝ
deriv (deriv f) (-x) = deriv (deriv f) x
Proof (Lean source)
-- @node: calibration_second_deriv_even lemma calibration_second_deriv_even (f : ℝ → ℝ) (hf : ∀ x, f (-x) = f x) (x : ℝ) : deriv (deriv f) (-x) = deriv (deriv f) x := by have he : (fun x => f (-x)) = f := funext hf have ho (y : ℝ) : deriv f (-y) = -deriv f y := by have h := deriv_comp_neg f y rw [he] at h linarith have he' : (fun y => deriv f (-y)) = (fun y => -deriv f y) := funext ho have h := congrArg (fun g : ℝ → ℝ => deriv g x) he' rw [deriv_comp_neg, deriv.fun_neg] at h linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_second_deriv_even · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairAmplitudeSymmetry.lean:43

The literal integral Taylor extension retains amplitude evenness on both axes. the stated conclusion holds.

Formal statement
t δ ξ u :
ℝ
fairEquation t (-δ) ξ u = fairEquation t δ ξ u
Proof (Lean source)
-- @node: fairEquation_even lemma fairEquation_even (t δ ξ u : ℝ) : fairEquation t (-δ) ξ u = fairEquation t δ ξ u := by unfold fairEquation congr 1 funext s congr 1 funext v congr 1 have he : (fun T => deriv (deriv (fun D => fairNumerator T D ξ u)) (v*(-δ))) = (fun T => deriv (deriv (fun D => fairNumerator T D ξ u)) (v*δ)) := by funext T rw [mul_neg] exact calibration_second_deriv_even _ (fun D => fairNumerator_even T D ξ u) _ rw [he]

Equal normalized equations give equal literal fair-root selectors. the stated conclusion holds.

Formal statement
t δ u :
ℝ
fairRoot t (-δ) u = fairRoot t δ u
Proof (Lean source)
-- @node: fairRoot_even lemma fairRoot_even (t δ u : ℝ) : fairRoot t (-δ) u = fairRoot t δ u := by have he : fairEquation t (-δ) = fairEquation t δ := by funext ξ u exact fairEquation_even t δ ξ u unfold fairRoot rw [he]
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairCellSmoothness 9 declarations The literal fair selector stays in its interior bracket.

Smooth actual fair cells

The literal fair selector stays in its interior bracket. The comparator's positive logarithm arguments and the shifted-risk denominator therefore make the actual cell formulas smooth wherever the selected root is smooth. Compactness then bounds all fixed-order derivatives of these fully substituted formulas.

theorem localSignField_abs_le_two Lemma localSignField_abs_le_two in the paper ↗

[The local sign interpolation is bounded on its entire real carrier. the stated conclusion holds.

Formal statement
u :
ℝ
s :
|localSignField u s| ≤ 2
Proof (Lean source)
-- @node: localSignField_abs_le_two lemma localSignField_abs_le_two (u : ℝ) (s : Bool × Bool) : |localSignField u s| ≤ 2 := by have hs (b : Bool) : |signValue b| = 1 := by cases b <;> norm_num [signValue] unfold localSignField calc _ ≤ |signValue s.1 * cos (pi*u/2)| + |signValue s.2 * sin (pi*u/2)| := abs_add_le _ _ _ ≤ 2 := by simp only [abs_mul, hs, one_mul] linarith [Real.abs_cos_le_one (pi*u/2), Real.abs_sin_le_one (pi*u/2)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.localSignField_abs_le_two · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:19
theorem riskShift_denominator_pos Lemma riskShift_denominator_pos in the paper ↗

Any nonnegative logistic shift has a positive denominator at a positive risk. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
t ξ :
ℝ
ht :
0 ≤ t
hξ :
0 ≤ ξ
0 < 1 + (exp t - 1)*ξ
Proof (Lean source)
-- @node: riskShift_denominator_pos lemma riskShift_denominator_pos (t ξ : ℝ) (ht : 0 ≤ t) (hξ : 0 ≤ ξ) : 0 < 1 + (exp t - 1)*ξ := by have hd : 0 ≤ exp t - 1 := by have he := Real.add_one_le_exp t linarith positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_denominator_pos · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:33

[A nonzero shifted-risk denominator makes the two-parameter risk map smooth. the stated conclusion holds. Under the stated assumptions.

Formal statement
v :
Fin 2 → ℝ
hden :
1 + (exp (v 0) - 1) * (v 1) ≠ 0
ContDiffAt ℝ ⊤ (fun w : Fin 2 → ℝ => riskShift (w 0) (w 1)) v
Proof (Lean source)
-- @node: riskShift_contDiffAt lemma riskShift_contDiffAt (v : Fin 2 → ℝ) (hden : 1 + (exp (v 0) - 1) * (v 1) ≠ 0) : ContDiffAt ℝ ⊤ (fun w : Fin 2 → ℝ => riskShift (w 0) (w 1)) v := by unfold riskShift exact (by fun_prop : ContDiffAt ℝ ⊤ (fun w : Fin 2 → ℝ => exp (w 0)*w 1) v).div (by fun_prop) hden
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:42
theorem comparatorEffect_contDiffAt Lemma comparatorEffect_contDiffAt in the paper ↗

The actual logarithmic comparator is smooth through both zero axes and on full neighborhoods of the endpoints of the prescribed effect interval. the documented result Under the stated assumptions.

Formal statement
v :
Fin 2 → ℝ
ht :
v 0 ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|v 1| ≤ 1 / 100
ContDiffAt ℝ ⊤ (fun w : Fin 2 → ℝ => comparatorEffect (w 0) (w 1)) v
Proof (Lean source)
-- @node: comparatorEffect_contDiffAt lemma comparatorEffect_contDiffAt (v : Fin 2 → ℝ) (ht : v 0 ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |v 1| ≤ 1 / 100) : ContDiffAt ℝ ⊤ (fun w : Fin 2 → ℝ => comparatorEffect (w 0) (w 1)) v := by obtain ⟨hB, ha, hb, _, _⟩ := fair_matching_denominators (v 0) (v 1) ht hδ unfold comparatorEffect dsimp only apply ContDiffAt.sub · apply ContDiffAt.add · fun_prop · apply ContDiffAt.log · apply ContDiffAt.sub contDiffAt_const apply ContDiffAt.div · fun_prop · fun_prop · exact ne_of_gt (mul_pos (by norm_num) hB) · exact ne_of_gt ha · apply ContDiffAt.log · apply ContDiffAt.add contDiffAt_const apply ContDiffAt.div · fun_prop · fun_prop · exact ne_of_gt (mul_pos (by norm_num) hB) · exact ne_of_gt hb
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:51
theorem localFairControlRisk_bounds Lemma localFairControlRisk_bounds in the paper ↗

[The actual selected fair control risk remains interior before any smoothness of the selector is used. the documented result Under the stated assumptions.

Formal statement
b :
s :
t δ u :
ℝ
hδ :
|δ| ≤ 1 / 100
(if b then fairRoot t δ u + δ*localSignField u s else fairRoot t δ u) ∈ Icc (1 / 4 : ℝ) (3 / 5)
Proof (Lean source)
-- @node: localFairControlRisk_bounds lemma localFairControlRisk_bounds (b : Bool) (s : Bool × Bool) (t δ u : ℝ) (hδ : |δ| ≤ 1 / 100) : (if b then fairRoot t δ u + δ*localSignField u s else fairRoot t δ u) ∈ Icc (1 / 4 : ℝ) (3 / 5) := by have hp := fairRoot_mem_bracket t δ u have hz := localSignField_abs_le_two u s have hprod : |δ*localSignField u s| ≤ 1 / 50 := by rw [abs_mul] calc _ ≤ (1 / 100 : ℝ)*2 := mul_le_mul hδ hz (abs_nonneg _) (by norm_num) _ = _ := by norm_num obtain ⟨hlo, hhi⟩ := abs_le.mp hprod cases b <;> simp only [Bool.false_eq_true, if_false, if_true] <;> constructor <;> linarith [hp.1, hp.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.localFairControlRisk_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:78
theorem localFairCell_contDiffAt_of_root Lemma localFairCell_contDiffAt_of_root in the paper ↗

[Composing the smooth actual root with the interior risk maps proves smoothness of every actual fair cell, including the comparator cells. the documented result Under the stated assumptions.

Formal statement
v :
Fin 3 → ℝ
ht :
v 0 ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|v 1| ≤ 1 / 100
hroot :
ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v
b :
s :
a y :
ContDiffAt ℝ ∞ (localFairCell b s a y) v
Proof (Lean source)
-- @node: localFairCell_contDiffAt_of_root lemma localFairCell_contDiffAt_of_root (v : Fin 3 → ℝ) (ht : v 0 ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |v 1| ≤ 1 / 100) (hroot : ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v) (b : Bool) (s : Bool × Bool) (a y : Bool) : ContDiffAt ℝ ∞ (localFairCell b s a y) v := by let p : (Fin 3 → ℝ) → ℝ := fun w => fairRoot (w 0) (w 1) (w 2) let μ : (Fin 3 → ℝ) → ℝ := fun w => if b then p w + w 1*localSignField (w 2) s else p w let T : (Fin 3 → ℝ) → ℝ := fun w => if b then w 0 else comparatorEffect (w 0) (w 1) have hp : ContDiffAt ℝ ∞ p v := hroot have hμ : ContDiffAt ℝ ∞ μ v := by cases b · exact hp · dsimp [μ] unfold localSignField fun_prop have hT : ContDiffAt ℝ ∞ T v := by cases b · have hf : ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => ![w 0,w 1]) v := by apply contDiffAt_pi.mpr intro i fin_cases i · change ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => w 0) v fun_prop · change ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => w 1) v fun_prop exact ((comparatorEffect_contDiffAt ![v 0,v 1] ht hδ).of_le le_top).comp v hf · dsimp [T] fun_prop have hμpos : 0 ≤ μ v := by have h := (localFairControlRisk_bounds b s (v 0) (v 1) (v 2) hδ).1 dsimp [μ, p] linarith have hTpos : 0 ≤ T v := by have h := comparatorEffect_range_bounds (v 0) (v 1) ht hδ cases b <;> dsimp [T] <;> linarith [ht.1] have hshift : ContDiffAt ℝ ∞ (fun w => riskShift (T w) (μ w)) v := by unfold riskShift apply ContDiffAt.div · fun_prop · fun_prop · exact ne_of_gt (riskShift_denominator_pos _ _ hTpos hμpos) change ContDiffAt ℝ ∞ (fun w => (1 / 2 : ℝ) * (if y then (if a then riskShift (T w) (μ w) else μ w) else 1-(if a then riskShift (T w) (μ w) else μ w))) v cases a <;> cases y <;> simp only [Bool.false_eq_true, if_false, if_true] <;> fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.localFairCell_contDiffAt_of_root · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:96
theorem fairParameterRegion_isCompact Lemma fairParameterRegion_isCompact in the paper ↗

[The closed effect-amplitude-coordinate parameter region is compact. the stated conclusion holds.

Formal statement
ε :
ℝ
Proof (Lean source)
-- @node: fairParameterRegion_isCompact lemma fairParameterRegion_isCompact (ε : ℝ) : IsCompact (fairParameterRegion ε) := by let K : Set (Fin 3 → ℝ) := pi univ (fun i => if i = 0 then Icc (0 : ℝ) (1 / 4) else if i = 1 then Icc (-ε) ε else Icc (0 : ℝ) 1) have hK : IsCompact K := isCompact_univ_pi (fun i => by split · exact isCompact_Icc · split <;> exact isCompact_Icc) have heq : K = fairParameterRegion ε := by ext v simp only [K, Set.mem_pi, Set.mem_univ, forall_const, fairParameterRegion, Set.mem_ofPred_eq] constructor · intro h exact ⟨by simpa using h 0, abs_le.mpr (by simpa using h 1), by simpa using h 2⟩ · rintro ⟨h0,h1,h2⟩ i fin_cases i · simpa using h0 · simpa using abs_le.mp h1 · simpa using h2 rwa [heq] at hK
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairParameterRegion_isCompact · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:145
theorem calibration_compact_infty_derivative_bounds Lemma calibration_compact_infty_derivative_bounds in the paper ↗

Smoothness to every finite order uniformly bounds each fixed derivative on a compact parameter set; analyticity is not needed. the documented result Under the stated assumptions.

Formal statement
d :
ℕ
f :
(Fin d → ℝ) → ℝ
K :
Set (Fin d → ℝ)
hK :
hf :
∀ v ∈ K, ContDiffAt ℝ ∞ f v
m :
ℕ
∃ B : ℝ,
0 < B
conclusion 1
v ∈ K :
‖iteratedFDeriv ℝ m f v‖ ≤ B
Proof (Lean source)
-- @node: calibration_compact_infty_derivative_bounds lemma calibration_compact_infty_derivative_bounds (d : ℕ) (f : (Fin d → ℝ) → ℝ) (K : Set (Fin d → ℝ)) (hK : IsCompact K) (hf : ∀ v ∈ K, ContDiffAt ℝ ∞ f v) (m : ℕ) : ∃ B : ℝ, 0 < B ∧ ∀ v ∈ K, ‖iteratedFDeriv ℝ m f v‖ ≤ B := by have hc : ContinuousOn (iteratedFDeriv ℝ m f) K := by intro v hv exact ((hf v hv).continuousAt_iteratedFDeriv (WithTop.coe_le_coe.mpr le_top)).continuousWithinAt obtain ⟨C,hC⟩ := hK.exists_bound_of_continuousOn hc exact ⟨max C 1,lt_of_lt_of_le (by norm_num) (le_max_right _ _), fun v hv => (hC v hv).trans (le_max_left _ _)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_compact_infty_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:168
theorem localFairCell_smooth_derivative_bounds_of_root Lemma localFairCell_smooth_derivative_bounds_of_root in the paper ↗

[Root smoothness on neighborhoods of the closed region supplies both cell smoothness and all fixed-order bounds for the fully substituted roots and cells. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
ε :
ℝ
hε :
ε ≤ 1 / 100
hroot :
∀ v ∈ fairParameterRegion ε,
ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v
conclusion 1
b s a y :
ContDiffOn ℝ ∞ (localFairCell b s a y) (fairParameterRegion ε)
conclusion 2
m :
ℕ
∃ B : ℝ,
0 < B
v ∈ fairParameterRegion ε :
‖iteratedFDeriv ℝ m (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v‖ ≤ B
b s a y :
‖iteratedFDeriv ℝ m (localFairCell b s a y) v‖ ≤ B
Proof (Lean source)
-- @node: localFairCell_smooth_derivative_bounds_of_root lemma localFairCell_smooth_derivative_bounds_of_root (ε : ℝ) (hε : ε ≤ 1 / 100) (hroot : ∀ v ∈ fairParameterRegion ε, ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v) : (∀ b s a y, ContDiffOn ℝ ∞ (localFairCell b s a y) (fairParameterRegion ε)) ∧ (∀ m : ℕ, ∃ B : ℝ, 0 < B ∧ ∀ v ∈ fairParameterRegion ε, ‖iteratedFDeriv ℝ m (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v‖ ≤ B ∧ ∀ b s a y, ‖iteratedFDeriv ℝ m (localFairCell b s a y) v‖ ≤ B) := by have hcell (v : Fin 3 → ℝ) (hv : v ∈ fairParameterRegion ε) (b s a y) := localFairCell_contDiffAt_of_root v hv.1 (hv.2.1.trans hε) (hroot v hv) b s a y refine ⟨fun b s a y v hv => (hcell v hv b s a y).contDiffWithinAt, ?_⟩ intro m obtain ⟨Bq,hBq,hq⟩ := calibration_compact_infty_derivative_bounds 3 _ _ (fairParameterRegion_isCompact ε) hroot m let I := Bool × (Bool × Bool) × Bool × Bool have hb : ∀ i : I, ∃ B : ℝ, 0 < B ∧ ∀ v ∈ fairParameterRegion ε, ‖iteratedFDeriv ℝ m (localFairCell i.1 i.2.1 i.2.2.1 i.2.2.2) v‖ ≤ B := by intro i exact calibration_compact_infty_derivative_bounds 3 _ _ (fairParameterRegion_isCompact ε) (fun v hv => hcell v hv _ _ _ _) m choose B hB hBound using hb refine ⟨Bq + ∑ i : I, B i, ?_, ?_⟩ · exact add_pos hBq (Finset.sum_pos (fun i _ => hB i) univ_nonempty) · intro v hv refine ⟨(hq v hv).trans (le_add_of_nonneg_right (Finset.sum_nonneg (fun i _ => (hB i).le))), ?_⟩ intro b s a y exact (hBound (b,s,a,y) v hv).trans ((Finset.single_le_sum (fun i _ => (hB i).le) (Finset.mem_univ (b,s,a,y))).trans (le_add_of_nonneg_left hBq.le))
CausalSmith.Stat.LogoddsLowsmoothFrontier.localFairCell_smooth_derivative_bounds_of_root · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCellSmoothness.lean:183
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairCenterSlope 8 declarations Differentiating the cleared endpoint identity at the asymmetric center proves strict positivity of the actual normalized equation's center derivative.

Nonzero fair center slope over the full effect range

Differentiating the cleared endpoint identity at the asymmetric center proves strict positivity of the actual normalized equation's center derivative. The zero-effect extension handles the removable boundary without division.

theorem fairEquation_center_slope_cleared Lemma fairEquation_center_slope_cleared in the paper ↗

[Differentiating the endpoint factorization at its center root gives a cleared derivative identity throughout the full effect range. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hu :
u ∈ Icc (0 : ℝ) 1
t * deriv (fun x => fairEquation t 0 x u) (2/5) * (1+(exp t-1)*(2/5))^3 * ((3/5)*(1+(2/5)*(exp t-1)))
= (exp t-1)*exp t*(8*(exp t-1)+5)/10
Proof (Lean source)
-- @node: fairEquation_center_slope_cleared lemma fairEquation_center_slope_cleared (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hu : u ∈ Icc (0 : ℝ) 1) : t * deriv (fun x => fairEquation t 0 x u) (2/5) * (1+(exp t-1)*(2/5))^3 * ((3/5)*(1+(2/5)*(exp t-1))) = (exp t-1)*exp t*(8*(exp t-1)+5)/10 := by let d := exp t-1 let H : ℝ → ℝ := fun x => fairEquation t 0 x u have hbox : ![t,0,2/5,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨ht,by norm_num,by change (2/5 : ℝ) ∈ Icc (3/10) (1/2) constructor <;> norm_num,hu⟩ have hH : DifferentiableAt ℝ H (2/5) := by exact ((fairEquation_contDiffAt _ hbox).comp (2/5) (show ContDiffAt ℝ ∞ (fun x : ℝ => ![t,0,x,u]) (2/5) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop)).differentiableAt (by simp) have hz : H (2/5) = 0 := fairEquation_zero_amplitude_center t u ht have hB := (hasDerivAt_const (2/5 : ℝ) (1 : ℝ)).add ((hasDerivAt_id (2/5 : ℝ)).const_mul d) have hL : HasDerivAt (fun x => t*H x*(1+d*x)^3*((3/5)*(1+(2/5)*d))) (t*deriv H (2/5)*(1+d*(2/5))^3*((3/5)*(1+(2/5)*d))) (2/5) := by convert (((hH.hasDerivAt.const_mul t).mul (hB.pow 3)).mul_const ((3/5)*(1+(2/5)*d))) using 1 <;> first | rfl | (dsimp; rw [hz]; ring) have hQ := (((hasDerivAt_id (2/5 : ℝ)).pow 2).const_mul (25*d)).sub ((hasDerivAt_id (2/5 : ℝ)).const_mul (15*d)) have hR : HasDerivAt (fun x => -d*exp t*(5*x-2)* (25*d*x^2-15*d*x-6*d+25*x-15)/50) (d*exp t*(8*d+5)/10) (2/5) := by convert ((((hasDerivAt_id (2/5 : ℝ)).const_mul 5).sub_const 2).const_mul (-d*exp t)).mul (((hQ.sub_const (6*d)).add ((hasDerivAt_id (2/5 : ℝ)).const_mul 25)).sub_const 15) |>.div_const 50 using 1 <;> first | rfl | (dsimp; ring) have he : (fun x => t*H x*(1+d*x)^3*((3/5)*(1+(2/5)*d))) =ᶠ[𝓝 (2/5 : ℝ)] (fun x => -d*exp t*(5*x-2)*(25*d*x^2-15*d*x-6*d+25*x-15)/50) := by filter_upwards [isOpen_Ioo.mem_nhds (show (2/5 : ℝ) ∈ Ioo (3/10) (1/2) by constructor <;> norm_num)] with x hx have hx' : x ∈ Icc (3/10 : ℝ) (1/2) := ⟨hx.1.le,hx.2.le⟩ dsimp [H,d] rw [fairEquation_zero_amplitude_endpoint t x u ht hx'] exact fairEquation_endpoint_factor_zero_amplitude t x ht hx' exact (hL.congr_of_eventuallyEq he.symm).unique hR
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_center_slope_cleared · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:16
theorem fairEquation_center_slope_pos Lemma fairEquation_center_slope_pos in the paper ↗

The fair equation's center derivative is strictly positive, including zero effect, at every point of the closed effect and position ranges. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hu :
u ∈ Icc (0 : ℝ) 1
0 < deriv (fun x => fairEquation t 0 x u) (2/5)
Proof (Lean source)
-- @node: fairEquation_center_slope_pos lemma fairEquation_center_slope_pos (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hu : u ∈ Icc (0 : ℝ) 1) : 0 < deriv (fun x => fairEquation t 0 x u) (2/5) := by by_cases hz : t = 0 · subst t rw [fairEquation_center_deriv_zero_effect 0 (2/5) u (by norm_num) (by constructor <;> norm_num) hu] norm_num have htpos : 0 < t := lt_of_le_of_ne ht.1 (Ne.symm hz) have hd : 0 < exp t-1 := by have h := Real.exp_lt_exp.mpr htpos simpa using sub_pos.mpr h have he := fairEquation_center_slope_cleared t u ht hu have hA : 0 < t*(1+(exp t-1)*(2/5))^3* ((3/5)*(1+(2/5)*(exp t-1))) := by positivity have hR : 0 < (exp t-1)*exp t*(8*(exp t-1)+5)/10 := by positivity have hm : 0 < deriv (fun x => fairEquation t 0 x u) (2/5) * (t*(1+(exp t-1)*(2/5))^3*((3/5)*(1+(2/5)*(exp t-1)))) := by nlinarith only [he,hR] exact (mul_pos_iff.mp hm).resolve_right (by intro h; linarith [h.2]) |>.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_center_slope_pos · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:63
theorem fairEquation_uniform_center_slope_pos Lemma fairEquation_uniform_center_slope_pos in the paper ↗

Compactness in effect and position preserves the positive center slope on one absolute signed amplitude and center neighborhood. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
ε ≤ 1/100
conclusion 1
t δ ξ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
|ξ-2/5| ≤ ε
u ∈ Icc (0 : ℝ) 1
0 < deriv (fun x => fairEquation t δ x u) ξ
Proof (Lean source)
-- @node: fairEquation_uniform_center_slope_pos lemma fairEquation_uniform_center_slope_pos : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ∀ t δ ξ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → |ξ-2/5| ≤ ε → u ∈ Icc (0 : ℝ) 1 → 0 < deriv (fun x => fairEquation t δ x u) ξ := by let K := Icc (0 : ℝ) (1/4) ×ˢ Icc (0 : ℝ) 1 have hK : IsCompact K := isCompact_Icc.prod isCompact_Icc have hevent : ∀ᶠ a : ℝ × ℝ in 𝓝 (0,2/5), ∀ z ∈ K, 0 < deriv (fun x => fairEquation z.1 a.1 x z.2) a.2 := by apply hK.eventually_forall_of_forall_eventually intro z hz have hbox : ![z.1,0,2/5,z.2] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨hz.1,by norm_num,by change (2/5 : ℝ) ∈ Icc (3/10) (1/2) constructor <;> norm_num,hz.2⟩ have hp : ContDiffAt ℝ ∞ (fun w : (ℝ × ℝ) × (ℝ × ℝ) => ![w.2.1,w.1.1,w.1.2,w.2.2]) ((0,2/5),z) := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hh := (fairEquation_center_deriv_contDiffAt _ hbox).comp ((0,2/5),z) hp have hc := hh.continuousAt change ContinuousAt (fun w : (ℝ × ℝ) × (ℝ × ℝ) => deriv (fun x => fairEquation w.2.1 w.1.1 x w.2.2) w.1.2) ((0,2/5),z) at hc apply hc.eventually apply lt_mem_nhds change 0 < deriv (fun x => fairEquation z.1 0 x z.2) (2/5) exact fairEquation_center_slope_pos z.1 z.2 hz.1 hz.2 obtain ⟨a,ha,hball⟩ := Metric.mem_nhds_iff.mp hevent let ε := min (a/2) (1/100) refine ⟨ε,lt_min (by linarith) (by norm_num),min_le_right _ _,?_⟩ intro t δ ξ u ht hδ hξ hu have hm : (δ,ξ) ∈ ball (0,2/5) a := by rw [Metric.mem_ball,Prod.dist_eq] simp only [Real.dist_eq,sub_zero] exact max_lt (lt_of_le_of_lt (hδ.trans (min_le_left _ _)) (by linarith)) (lt_of_le_of_lt (hξ.trans (min_le_left _ _)) (by linarith)) exact hball hm (t,u) ⟨ht,hu⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_center_slope_pos · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:88
theorem fairEquation_uniform_center_strictMono Lemma fairEquation_uniform_center_strictMono in the paper ↗

The normalized fair equation is strictly increasing on a fixed center bracket for every allowed effect and all sufficiently small signed amplitudes. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
ε ≤ 1/100
conclusion 1
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
StrictMonoOn (fun x => fairEquation t δ x u) (Icc (2/5-ε) (2/5+ε))
Proof (Lean source)
-- @node: fairEquation_uniform_center_strictMono lemma fairEquation_uniform_center_strictMono : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → StrictMonoOn (fun x => fairEquation t δ x u) (Icc (2/5-ε) (2/5+ε)) := by obtain ⟨ε,hε,hsmall,hpos⟩ := fairEquation_uniform_center_slope_pos refine ⟨ε,hε,hsmall,?_⟩ intro t δ u ht hδ hu apply strictMonoOn_of_deriv_pos (convex_Icc _ _) · intro x hx have hξ : x ∈ Icc (3/10 : ℝ) (1/2) := by constructor <;> linarith [hx.1,hx.2] have hbox : ![t,δ,x,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨ht,hδ.trans hsmall,hξ,hu⟩ have hp : ContDiffAt ℝ ∞ (fun y : ℝ => ![t,δ,y,u]) x := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop exact ((fairEquation_contDiffAt _ hbox).comp x hp).continuousAt.continuousWithinAt · intro x hx rw [interior_Icc] at hx exact hpos t δ x u ht hδ (abs_le.mpr ⟨by linarith [hx.1],by linarith [hx.2]⟩) hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_center_strictMono · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:129
theorem fairEquation_uniform_root_confined Lemma fairEquation_uniform_root_confined in the paper ↗

Uniform continuity excludes every zero-amplitude noncenter root, even at the bracket endpoints, on a compact set away from the center. the documented result Under the stated assumptions.

Formal statement
r :
ℝ
hr :
0 < r
∃ ε : ℝ,
0 < ε
ε ≤ 1/100
conclusion 1
t δ u q :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
q ∈ Icc (3/10 : ℝ) (1/2)
fairEquation t δ q u = 0
|q-2/5| < r
Proof (Lean source)
-- @node: fairEquation_uniform_root_confined lemma fairEquation_uniform_root_confined (r : ℝ) (hr : 0 < r) : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ∀ t δ u q : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → q ∈ Icc (3/10 : ℝ) (1/2) → fairEquation t δ q u = 0 → |q-2/5| < r := by let S := Icc (3/10 : ℝ) (1/2) ∩ {q : ℝ | r ≤ |q-2/5|} have hS : IsCompact S := isCompact_Icc.inter_right (isClosed_le continuous_const (by fun_prop)) let K := (Icc (0 : ℝ) (1/4) ×ˢ Icc (0 : ℝ) 1) ×ˢ S have hK : IsCompact K := (isCompact_Icc.prod isCompact_Icc).prod hS have hevent : ∀ᶠ δ : ℝ in 𝓝 0, ∀ z ∈ K, fairEquation z.1.1 δ z.2 z.1.2 ≠ 0 := by apply hK.eventually_forall_of_forall_eventually intro z hz have hbox : ![z.1.1,0,z.2,z.1.2] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨hz.1.1,by norm_num,hz.2.1,hz.1.2⟩ have hp : ContDiffAt ℝ ∞ (fun w : ℝ × ((ℝ × ℝ) × ℝ) => ![w.2.1.1,w.1,w.2.2,w.2.1.2]) (0,z) := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hh := (fairEquation_contDiffAt _ hbox).comp (0,z) hp apply hh.continuousAt.eventually_ne change fairEquation z.1.1 0 z.2 z.1.2 ≠ 0 intro he have hcenter : z.2 = 2/5 := by by_cases hlo : z.2 = 3/10 · rw [hlo] at he have hs := (fairEquation_zero_amplitude_bracket_signs z.1.1 z.1.2 hz.1.1 hz.1.2).1 linarith by_cases hhi : z.2 = 1/2 · rw [hhi] at he have hs := (fairEquation_zero_amplitude_bracket_signs z.1.1 z.1.2 hz.1.1 hz.1.2).2 linarith exact fairEquation_zero_amplitude_unique z.1.1 z.1.2 z.2 hz.1.1 hz.1.2 ⟨lt_of_le_of_ne hz.2.1.1 (Ne.symm hlo),lt_of_le_of_ne hz.2.1.2 hhi⟩ he have haway : r ≤ |z.2-2/5| := hz.2.2 rw [hcenter,sub_self,abs_zero] at haway linarith obtain ⟨a,ha,hball⟩ := Metric.mem_nhds_iff.mp hevent let ε := min (a/2) (1/100) refine ⟨ε,lt_min (by linarith) (by norm_num),min_le_right _ _,?_⟩ intro t δ u q ht hδ hu hq he by_contra hn have hδball : δ ∈ ball (0 : ℝ) a := by rw [Metric.mem_ball,Real.dist_eq,sub_zero] exact lt_of_le_of_lt (hδ.trans (min_le_left _ _)) (by linarith) exact hball hδball ((t,u),q) ⟨⟨ht,hu⟩,hq,le_of_not_gt hn⟩ he
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_root_confined · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:155
theorem fairEquation_uniform_existsUnique Lemma fairEquation_uniform_existsUnique in the paper ↗

[A fixed center derivative neighborhood and compact exclusion of all other roots yield uniqueness on the original full selector bracket. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
ε ≤ 1/100
conclusion 1
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
∃! q : ℝ,
q ∈ Ioo (3/10 : ℝ) (1/2)
fairEquation t δ q u = 0
Proof (Lean source)
-- @node: fairEquation_uniform_existsUnique lemma fairEquation_uniform_existsUnique : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → ∃! q : ℝ, q ∈ Ioo (3/10 : ℝ) (1/2) ∧ fairEquation t δ q u = 0 := by obtain ⟨r,hr,hrsmall,hmono⟩ := fairEquation_uniform_center_strictMono obtain ⟨a,ha,hasmall,hconf⟩ := fairEquation_uniform_root_confined r hr obtain ⟨b,hb,hbsmall,hex⟩ := fairEquation_uniform_exists let ε := min r (min a b) have her : ε ≤ r := min_le_left _ _ have hea : ε ≤ a := (min_le_right _ _).trans (min_le_left _ _) have heb : ε ≤ b := (min_le_right _ _).trans (min_le_right _ _) refine ⟨ε,lt_min hr (lt_min ha hb),her.trans hrsmall,?_⟩ intro t δ u ht hδ hu obtain ⟨q,hq,he⟩ := hex t δ u ht (hδ.trans heb) hu have hcq := hconf t δ u q ht (hδ.trans hea) hu ⟨hq.1.le,hq.2.le⟩ he refine ⟨q,⟨hq,he⟩,?_⟩ intro p hp have hcp := hconf t δ u p ht (hδ.trans hea) hu ⟨hp.1.1.le,hp.1.2.le⟩ hp.2 apply (hmono t δ u ht (hδ.trans her) hu).injOn · exact ⟨by linarith [(abs_lt.mp hcp).1],by linarith [(abs_lt.mp hcp).2]⟩ · exact ⟨by linarith [(abs_lt.mp hcq).1],by linarith [(abs_lt.mp hcq).2]⟩ · exact hp.2.trans he.symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_existsUnique · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:205
theorem fairEquation_eventually_unique_of_center_control Lemma fairEquation_eventually_unique_of_center_control in the paper ↗

A positive center slope and exclusion of roots elsewhere remain valid on full parameter neighborhoods, including effect and position endpoints. the documented result Under the stated assumptions.

Formal statement
t δ u r :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hu :
u ∈ Icc (0 : ℝ) 1
hr :
0 < r
hrsmall :
r ≤ 1/100
hpos :
∀ x ∈ Icc (2/5-r) (2/5+r), 0 < deriv (fun y => fairEquation t δ y u) x
hconf :
∀ x ∈ Icc (3/10 : ℝ) (1/2)
if
fairEquation t δ x u = 0
then
|x-2/5| < r
∀ᶠ a : Fin 3 → ℝ in 𝓝 ![t,δ,u], ∀ x ∈ Ioo (3/10 : ℝ) (1/2), ∀ y ∈ Ioo (3/10 : ℝ) (1/2), fairEquation (a 0) (a 1) x (a 2)
= 0 → fairEquation (a 0) (a 1) y (a 2) = 0 → x = y
Proof (Lean source)
-- @node: fairEquation_eventually_unique_of_center_control lemma fairEquation_eventually_unique_of_center_control (t δ u r : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hu : u ∈ Icc (0 : ℝ) 1) (hr : 0 < r) (hrsmall : r ≤ 1/100) (hpos : ∀ x ∈ Icc (2/5-r) (2/5+r), 0 < deriv (fun y => fairEquation t δ y u) x) (hconf : ∀ x ∈ Icc (3/10 : ℝ) (1/2), fairEquation t δ x u = 0 → |x-2/5| < r) : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![t,δ,u], ∀ x ∈ Ioo (3/10 : ℝ) (1/2), ∀ y ∈ Ioo (3/10 : ℝ) (1/2), fairEquation (a 0) (a 1) x (a 2) = 0 → fairEquation (a 0) (a 1) y (a 2) = 0 → x = y := by have hbox (x : ℝ) (hx : x ∈ Icc (3/10 : ℝ) (1/2)) : ![t,δ,x,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨ht,hδ,hx,hu⟩ have hp (x : ℝ) : ContDiffAt ℝ ∞ (fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) (![t,δ,u],x) := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hcontrol : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![t,δ,u], ∀ x ∈ Icc (3/10 : ℝ) (1/2), ContDiffAt ℝ 1 (fun z : (Fin 3 → ℝ) × ℝ => fairEquation (z.1 0) (z.1 1) z.2 (z.1 2)) (a,x) := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro x hx exact (((fairEquation_contDiffAt _ (hbox x hx)).comp (![t,δ,u],x) (hp x)).of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by norm_num) have hpositive : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![t,δ,u], ∀ x ∈ Icc (2/5-r) (2/5+r), 0 < deriv (fun y => fairEquation (a 0) (a 1) y (a 2)) x := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro x hx have hx' : x ∈ Icc (3/10 : ℝ) (1/2) := by constructor <;> linarith [hx.1,hx.2] have hh := (fairEquation_center_deriv_contDiffAt _ (hbox x hx')).comp (![t,δ,u],x) (hp x) exact hh.continuousAt.eventually (lt_mem_nhds (hpos x hx)) let S := Icc (3/10 : ℝ) (1/2) ∩ {x : ℝ | r ≤ |x-2/5|} have hS : IsCompact S := isCompact_Icc.inter_right (isClosed_le continuous_const (by fun_prop)) have hexclude : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![t,δ,u], ∀ x ∈ S, fairEquation (a 0) (a 1) x (a 2) ≠ 0 := by apply hS.eventually_forall_of_forall_eventually intro x hx have hh := (fairEquation_contDiffAt _ (hbox x hx.1)).comp (![t,δ,u],x) (hp x) apply hh.continuousAt.eventually_ne change fairEquation t δ x u ≠ 0 intro he exact (not_lt_of_ge hx.2) (hconf x hx.1 he) filter_upwards [hcontrol,hpositive,hexclude] with a hc hp' he' have hmono : StrictMonoOn (fun x => fairEquation (a 0) (a 1) x (a 2)) (Icc (2/5-r) (2/5+r)) := by apply strictMonoOn_of_deriv_pos (convex_Icc _ _) · intro x hx have hx' : x ∈ Icc (3/10 : ℝ) (1/2) := by constructor <;> linarith [hx.1,hx.2] exact (((hc x hx').continuousAt).comp (f := fun x : ℝ => (a,x)) (by fun_prop)).continuousWithinAt · intro x hx rw [interior_Icc] at hx exact hp' x ⟨hx.1.le,hx.2.le⟩ have hnear (x : ℝ) (hx : x ∈ Ioo (3/10 : ℝ) (1/2)) (he : fairEquation (a 0) (a 1) x (a 2) = 0) : x ∈ Icc (2/5-r) (2/5+r) := by have hn : |x-2/5| < r := by by_contra h exact he' x ⟨⟨hx.1.le,hx.2.le⟩,le_of_not_gt h⟩ he exact ⟨by linarith [(abs_lt.mp hn).1],by linarith [(abs_lt.mp hn).2]⟩ intro x hx y hy hex hey exact hmono.injOn (hnear x hx hex) (hnear y hy hey) (hex.trans hey.symm)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_eventually_unique_of_center_control · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:231
theorem fairRoot_uniform_contDiffAt Lemma fairRoot_uniform_contDiffAt in the paper ↗

The actual fair selector is jointly smooth on full neighborhoods of the closed parameter region, uniformly over the complete prescribed effect range. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
ε ≤ 1/100
conclusion 1
v ∈ fairParameterRegion ε :
ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v
Proof (Lean source)
-- @node: fairRoot_uniform_contDiffAt lemma fairRoot_uniform_contDiffAt : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ∀ v ∈ fairParameterRegion ε, ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v := by obtain ⟨r,hr,hrsmall,hpos⟩ := fairEquation_uniform_center_slope_pos obtain ⟨a,ha,hasmall,hconf⟩ := fairEquation_uniform_root_confined r hr obtain ⟨b,hb,hbsmall,hex⟩ := fairEquation_uniform_exists let ε := min r (min a b) have her : ε ≤ r := min_le_left _ _ have hea : ε ≤ a := (min_le_right _ _).trans (min_le_left _ _) have heb : ε ≤ b := (min_le_right _ _).trans (min_le_right _ _) refine ⟨ε,lt_min hr (lt_min ha hb),her.trans hrsmall,?_⟩ intro v hv have ht := hv.1 have hδ : |v 1| ≤ 1/100 := hv.2.1.trans (her.trans hrsmall) have hu := hv.2.2 have hs := fairRoot_spec (v 0) (v 1) (v 2) (hex (v 0) (v 1) (v 2) ht (hv.2.1.trans heb) hu) have hqnear := hconf (v 0) (v 1) (v 2) _ ht (hv.2.1.trans hea) hu ⟨hs.1.1.le,hs.1.2.le⟩ hs.2 let F : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => fairEquation (z.1 0) (z.1 1) z.2 (z.1 2) apply scalar_bracket_selector_contDiffAt_infty 3 F (fun w => fairRoot (w 0) (w 1) (w 2)) v (3/10) (1/2) · have hbox : ![v 0,v 1,fairRoot (v 0) (v 1) (v 2),v 2] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨ht,hδ,⟨hs.1.1.le,hs.1.2.le⟩,hu⟩ exact (fairEquation_contDiffAt _ hbox).comp (v,fairRoot (v 0) (v 1) (v 2)) (show ContDiffAt ℝ ∞ (fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) (v,fairRoot (v 0) (v 1) (v 2)) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) · exact hs.1 · exact hs.2 · exact ne_of_gt (hpos (v 0) (v 1) _ (v 2) ht (hv.2.1.trans her) hqnear.le hu) · intro w hw exact fairRoot_spec (w 0) (w 1) (w 2) hw · have hvec : ![v 0,v 1,v 2] = v := by funext i fin_cases i <;> rfl rw [← hvec] exact fairEquation_eventually_unique_of_center_control (v 0) (v 1) (v 2) r ht hδ hu hr hrsmall (fun x hx => hpos (v 0) (v 1) x (v 2) ht (hv.2.1.trans her) (abs_le.mpr ⟨by linarith [hx.1],by linarith [hx.2]⟩) hu) (fun x hx he => hconf (v 0) (v 1) (v 2) x ht (hv.2.1.trans hea) hu hx he)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_uniform_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairCenterSlope.lean:300
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairComponentSupport 2 declarations The support theorem's smoothness and derivative envelope discharge the actual record inputs to the quadratic Taylor bound.

Fair component bounds from calibrated record support

The support theorem's smoothness and derivative envelope discharge the actual record inputs to the quadratic Taylor bound. Restricting the hidden sign prior then transfers that bound to each original-record component.

theorem fair_block_hellinger_from_support

[Actual fair block likelihoods satisfy the quadratic Hellinger estimate using the jointly selected support radius and derivative envelope. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
I :
t :
ℝ
o :
Fin n → Record
δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ calibEps
(sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i)) - sqrt (∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i)))^2
≤ calibM^4 * (I.card : ℝ)^4 * 8^I.card * δ^4
Proof (Lean source)
-- @node: fair_block_hellinger_from_support lemma fair_block_hellinger_from_support {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) (δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ calibEps) : (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i)) - sqrt (∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i)))^2 ≤ calibM^4 * (I.card : ℝ)^4 * 8^I.card * δ^4 := by apply fair_component_hellinger_of_record_derivatives k I t o δ calibM ht (hδ.trans calib_regularity_spec.1) calib_regularity_spec.2.1 · intro b σ i hi z hz have hzsmall : |z| ≤ calibEps := by rw [abs_of_nonneg hz.1] exact hz.2.trans hδ exact calib_regularity_spec.2.2 k hk σ t z ht hzsmall b (o i).2.1 (o i).2.2 (o i).1 · intro b σ i hi z hz m hm hm' have hzsmall : |z| ≤ calibEps := by rw [abs_of_nonneg hz.1] exact hz.2.trans hδ exact (((calib_constants_spec.2.2.2 k hk σ).2 t z ht hzsmall b).2 (o i).2.1 (o i).2.2 (o i).1).2.2 m hm hm'
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_block_hellinger_from_support · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairComponentSupport.lean:18
theorem fair_component_hellinger_from_support

[The uniform sign marginal on one component preserves the Taylor bound, with the exact number of original records in that component. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ calibEps
owner :
block :
(sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k (componentSignExtension owner c σ) t δ) (x i.1,l i)) - sqrt (∏ i : {i : Fin n // block i = c}, recordCellDensity (fairComparator k t δ) (x i.1,l i)))^2
≤ calibM^4 * (card {i : Fin n // block i = c} : ℝ)^4 * 8^(card {i : Fin n // block i = c}) * δ^4
Proof (Lean source)
-- @node: fair_component_hellinger_from_support lemma fair_component_hellinger_from_support {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ calibEps) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k (componentSignExtension owner c σ) t δ) (x i.1,l i)) - sqrt (∏ i : {i : Fin n // block i = c}, recordCellDensity (fairComparator k t δ) (x i.1,l i)))^2 ≤ calibM^4 * (card {i : Fin n // block i = c} : ℝ)^4 * 8^(card {i : Fin n // block i = c}) * δ^4 := by classical dsimp only rw [← fairDensity_block_average_restrict k hk x c l t δ ht hδ] let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) let I := Finset.univ.filter (fun i => block i = c) let o : Fin n → Record := fun i => (x i, if h : block i = c then l ⟨i,h⟩ else (false,false)) have hp (P : ObservedLaw) : (∏ i ∈ I, recordCellDensity P (o i)) = ∏ i : {i : Fin n // block i = c}, recordCellDensity P (x i.1,l i) := by rw [Finset.prod_subtype (p := fun i => block i = c) I (by simp [I])] apply Finset.prod_congr rfl intro i _ simp only [o, dif_pos i.2] rfl have hc : I.card = card {i : Fin n // block i = c} := by rw [Fintype.card_subtype] have h := fair_block_hellinger_from_support k hk I t o δ ht hδ simp only [hp, hc] at h exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_component_hellinger_from_support · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairComponentSupport.lean:43
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairDensityRanges 6 declarations The literal root bracket and the explicit effect bounds control every fair cell on a fixed signed amplitude neighborhood, without a smoothness assumption.

Fair four-cell density bounds

The literal root bracket and the explicit effect bounds control every fair cell on a fixed signed amplitude neighborhood, without a smoothness assumption.

[Endpoint signs have unit magnitude. the stated conclusion holds.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
j :
ℕ
|endpointSign k σ j| = 1
Proof (Lean source)
-- @node: endpointSign_abs lemma endpointSign_abs (k : ℕ) (σ : Fin (k + 1) → Bool) (j : ℕ) : |endpointSign k σ j| = 1 := by unfold endpointSign signValue split <;> norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointSign_abs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairDensityRanges.lean:13

The shared endpoint sign field is bounded on every covariate. Under the stated assumptions. The stated conclusion follows.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
x :
|signFieldZ k σ x| ≤ 2
Proof (Lean source)
-- @node: signFieldZ_abs_le_two lemma signFieldZ_abs_le_two (k : ℕ) (σ : Fin (k + 1) → Bool) (x : Covariate) : |signFieldZ k σ x| ≤ 2 := by unfold signFieldZ calc _ ≤ |endpointSign k σ (cellIndex k x) * cos (pi * cellCoord k x / 2)| + |endpointSign k σ (cellIndex k x + 1) * sin (pi * cellCoord k x / 2)| := abs_add_le _ _ _ ≤ 2 := by simp only [abs_mul, endpointSign_abs, one_mul] linarith [Real.abs_cos_le_one (pi * cellCoord k x / 2), Real.abs_sin_le_one (pi * cellCoord k x / 2)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signFieldZ_abs_le_two · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairDensityRanges.lean:20
theorem riskShift_quarter_bounds Lemma riskShift_quarter_bounds in the paper ↗

[A small nonnegative shift preserves a fixed interior risk interval. the stated conclusion holds. Under the stated assumptions.

Formal statement
t ξ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hξ :
ξ ∈ Icc (1/4 : ℝ) (3/5)
riskShift t ξ ∈ Icc (1/4 : ℝ) (3/4)
Proof (Lean source)
-- @node: riskShift_quarter_bounds lemma riskShift_quarter_bounds (t ξ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hξ : ξ ∈ Icc (1/4 : ℝ) (3/5)) : riskShift t ξ ∈ Icc (1/4 : ℝ) (3/4) := by obtain ⟨hdlo, hdhi⟩ := fair_exp_increment_bounds t ht have hd : 0 ≤ exp t - 1 := by linarith [ht.1] have hd' : exp t - 1 ≤ 1/3 := by linarith [ht.2] obtain ⟨hξlo, hξhi⟩ := hξ have hden : 0 < 1 + (exp t - 1)*ξ := by positivity unfold riskShift constructor · apply (le_div_iff₀ hden).mpr nlinarith [mul_nonneg hd (show 0 ≤ ξ - 1/4 by linarith)] · apply (div_le_iff₀ hden).mpr nlinarith [mul_nonneg (show 0 ≤ 1/3 - (exp t - 1) by linarith) (show 0 ≤ ξ by linarith)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_quarter_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairDensityRanges.lean:33
theorem fair_control_risk_bounds Lemma fair_control_risk_bounds in the paper ↗

The root bracket and small signed perturbation keep the fair control risk interior. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
x :
hδ :
|δ| ≤ 1/100
(if b then fairRoot t δ (cellCoord k x) + δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x)) ∈ Icc (1/4 : ℝ) (3/5)
Proof (Lean source)
-- @node: fair_control_risk_bounds lemma fair_control_risk_bounds (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (t δ : ℝ) (x : Covariate) (hδ : |δ| ≤ 1/100) : (if b then fairRoot t δ (cellCoord k x) + δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x)) ∈ Icc (1/4 : ℝ) (3/5) := by have hp := fairRoot_mem_bracket t δ (cellCoord k x) have hz := signFieldZ_abs_le_two k σ x have hprod : |δ*signFieldZ k σ x| ≤ 1/50 := by rw [abs_mul] calc _ ≤ (1/100 : ℝ)*2 := mul_le_mul hδ hz (abs_nonneg _) (by norm_num) _ = _ := by norm_num obtain ⟨hlo, hhi⟩ := abs_le.mp hprod cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] <;> constructor <;> linarith [hp.1, hp.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_control_risk_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairDensityRanges.lean:51
theorem fairCells_density_bounds Lemma fairCells_density_bounds in the paper ↗

All four literal fair cells have the required common density floor and ceiling. Under the stated assumptions. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
a y :
x :
conclusion 1
(1/2 : ℝ) ≤ 4*fairCells b k σ t δ a y x
conclusion 2
4*fairCells b k σ t δ a y x ≤ 2
Proof (Lean source)
-- @node: fairCells_density_bounds lemma fairCells_density_bounds (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (a y : Bool) (x : Covariate) : (1/2 : ℝ) ≤ 4*fairCells b k σ t δ a y x ∧ 4*fairCells b k σ t δ a y x ≤ 2 := by have hμ := fair_control_risk_bounds b k σ t δ x hδ have hT := comparatorEffect_range_bounds t δ ht hδ have heffect : (if b then t else comparatorEffect t δ) ∈ Icc (0 : ℝ) (1/4) := by cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] · constructor <;> linarith [ht.1, ht.2, hT.1, hT.2] · exact ht have hshift := riskShift_quarter_bounds _ _ heffect hμ unfold fairCells cases a <;> cases y <;> simp only [Bool.false_eq_true, ↓reduceIte] <;> constructor <;> linarith [hμ.1, hμ.2, hshift.1, hshift.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_density_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairDensityRanges.lean:68
theorem totalCellLaw_density_bounds Lemma totalCellLaw_density_bounds in the paper ↗

Totalizing a bounded table preserves its density bounds, including the fallback table. Under the stated assumptions. Under the stated assumptions.

Formal statement
p :
Bool → Bool → Covariate → ℝ
hp :
∀ a y x, (1/2 : ℝ) ≤ 4*p a y x ∧ 4*p a y x ≤ 2
a y :
x :
conclusion 1
(1/2 : ℝ) ≤ 4*(totalCellLaw p).cells a y x
conclusion 2
4*(totalCellLaw p).cells a y x ≤ 2
Proof (Lean source)
-- @node: totalCellLaw_density_bounds lemma totalCellLaw_density_bounds (p : Bool → Bool → Covariate → ℝ) (hp : ∀ a y x, (1/2 : ℝ) ≤ 4*p a y x ∧ 4*p a y x ≤ 2) (a y : Bool) (x : Covariate) : (1/2 : ℝ) ≤ 4*(totalCellLaw p).cells a y x ∧ 4*(totalCellLaw p).cells a y x ≤ 2 := by classical unfold totalCellLaw split · exact hp a y x · norm_num [lawFromCells]
CausalSmith.Stat.LogoddsLowsmoothFrontier.totalCellLaw_density_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairDensityRanges.lean:86
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairEffectBounds 4 declarations The explicit comparator logarithms give a quadratic effect gap, uniformly through zero effect and zero amplitude, on the paper's fixed amplitude neighbourhood.

Quantitative separation of the fair comparator effect

The explicit comparator logarithms give a quadratic effect gap, uniformly through zero effect and zero amplitude, on the paper's fixed amplitude neighbourhood.

Reciprocal bounds for the two logarithms in the fair effect gap. Under the stated assumptions.

Formal statement
x y :
ℝ
hx :
0 ≤ x
hx' :
x ≤ 1/100
hy :
0 ≤ y
hy' :
y ≤ 1/100
conclusion 1
x + (100/101)*y ≤ -log (1-x) + log (1+y)
conclusion 2
-log (1-x) + log (1+y) ≤ (100/99)*x + y
Proof (Lean source)
-- @node: fair_log_gap_bounds lemma fair_log_gap_bounds (x y : ℝ) (hx : 0 ≤ x) (hx' : x ≤ 1/100) (hy : 0 ≤ y) (hy' : y ≤ 1/100) : x + (100/101)*y ≤ -log (1-x) + log (1+y) ∧ -log (1-x) + log (1+y) ≤ (100/99)*x + y := by have hxp : 0 < 1-x := by linarith have hyp : 0 < 1+y := by linarith have hxl := Real.log_le_sub_one_of_pos hxp have hxu := Real.one_sub_inv_le_log_of_pos hxp have hyl := Real.one_sub_inv_le_log_of_pos hyp have hyu := Real.log_le_sub_one_of_pos hyp have hxi : 1 - (1-x)⁻¹ = -x/(1-x) := by field_simp; ring have hyi : 1 - (1+y)⁻¹ = y/(1+y) := by field_simp; ring rw [hxi, neg_div] at hxu rw [hyi] at hyl have hxq : x/(1-x) ≤ (100/99)*x := by apply (div_le_iff₀ hxp).mpr nlinarith have hyq : (100/101)*y ≤ y/(1+y) := by apply (le_div_iff₀ hyp).mpr nlinarith constructor <;> linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_log_gap_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEffectBounds.lean:13
theorem fair_exp_increment_bounds Lemma fair_exp_increment_bounds in the paper ↗

[The exponential increment has the bounds used by the fair calibration roadmap. the stated conclusion holds. Under the stated assumptions.

Formal statement
t :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
conclusion 1
t ≤ exp t - 1
conclusion 2
exp t - 1 ≤ (4/3)*t
Proof (Lean source)
-- @node: fair_exp_increment_bounds lemma fair_exp_increment_bounds (t : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) : t ≤ exp t - 1 ∧ exp t - 1 ≤ (4/3)*t := by have ht0 := ht.1 have ht1 := ht.2 have hl := Real.add_one_le_exp t have hu := Real.exp_bound_div_one_sub_of_interval ht.1 (by linarith : t < 1) have hden : 0 < 1-t := by linarith have hu' := (le_div_iff₀ hden).mp hu constructor · linarith · nlinarith [mul_nonneg (show 0 ≤ exp t - 1 by linarith) (show 0 ≤ 1/4-t by linarith)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_exp_increment_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEffectBounds.lean:37
theorem comparatorEffect_gap_bounds Lemma comparatorEffect_gap_bounds in the paper ↗

The explicit fair comparator loses between three and six times the quadratic amplitude. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
conclusion 1
3*t*δ^2 ≤ t-comparatorEffect t δ
conclusion 2
t-comparatorEffect t δ ≤ 6*t*δ^2
Proof (Lean source)
-- @node: comparatorEffect_gap_bounds lemma comparatorEffect_gap_bounds (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) : 3*t*δ^2 ≤ t-comparatorEffect t δ ∧ t-comparatorEffect t δ ≤ 6*t*δ^2 := by let d := exp t - 1 let B := 1 + d*(2/5) let a := d*δ^2/B obtain ⟨hdlo, hdhi⟩ := fair_exp_increment_bounds t ht change t ≤ d at hdlo change d ≤ (4/3)*t at hdhi have hd0 : 0 ≤ d := ht.1.trans hdlo have hd1 : d ≤ 1/3 := by linarith [ht.2] have hB : 1 ≤ B := by dsimp [B]; linarith have hBp : 0 < B := by linarith have hBhi : B ≤ 4/3 := by dsimp [B]; linarith have hδsq : δ^2 ≤ 1/10000 := by obtain ⟨hl, hu⟩ := abs_le.mp hδ nlinarith [sq_nonneg (δ-1/100), sq_nonneg (δ+1/100)] have ha0 : 0 ≤ a := by dsimp [a]; positivity have haeq : a*B = d*δ^2 := by dsimp [a]; field_simp have had : a ≤ d*δ^2 := by nlinarith [mul_nonneg ha0 (sub_nonneg.mpr hB)] have haSmall : a ≤ 1/1000 := by nlinarith [mul_nonneg hd0 (sub_nonneg.mpr hδsq)] have haLower : (3/4)*(t*δ^2) ≤ a := by have h1 := mul_le_mul_of_nonneg_right hdlo (sq_nonneg δ) have h2 := mul_le_mul_of_nonneg_left hBhi ha0 nlinarith have haUpper : a ≤ (4/3)*(t*δ^2) := by have h1 := mul_le_mul_of_nonneg_right hdhi (sq_nonneg δ) nlinarith have hx : d*δ^2/((2/5)*B) = (5/2)*a := by dsimp [a]; field_simp <;> ring have hy : d*δ^2/((1-2/5)*B) = (5/3)*a := by dsimp [a]; field_simp <;> ring have hgap : t-comparatorEffect t δ = -log (1-(5/2)*a) + log (1+(5/3)*a) := by unfold comparatorEffect change t - (t + log (1-d*δ^2/((2/5)*B)) - log (1+d*δ^2/((1-2/5)*B))) = _ rw [hx, hy] ring obtain ⟨hl, hu⟩ := fair_log_gap_bounds ((5/2)*a) ((5/3)*a) (by positivity) (by linarith) (by positivity) (by linarith) rw [hgap] constructor <;> nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_gap_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEffectBounds.lean:52
theorem comparatorEffect_range_bounds Lemma comparatorEffect_range_bounds in the paper ↗

The fair comparator stays between half the input effect and the input effect. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
conclusion 1
t/2 ≤ comparatorEffect t δ
conclusion 2
comparatorEffect t δ ≤ t
Proof (Lean source)
-- @node: comparatorEffect_range_bounds lemma comparatorEffect_range_bounds (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) : t/2 ≤ comparatorEffect t δ ∧ comparatorEffect t δ ≤ t := by obtain ⟨hl, hu⟩ := comparatorEffect_gap_bounds t δ ht hδ have hsq : δ^2 ≤ 1/10000 := by obtain ⟨hl, hu⟩ := abs_le.mp hδ nlinarith [sq_nonneg (δ-1/100), sq_nonneg (δ+1/100)] have hm := mul_le_mul_of_nonneg_left hsq ht.1 have hn := mul_nonneg ht.1 (sq_nonneg δ) constructor <;> nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_range_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEffectBounds.lean:97
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairEndpointUniqueness 12 declarations Clearing the positive risk denominators factors the endpoint matching equation.

Uniqueness of the fair endpoint center

Clearing the positive risk denominators factors the endpoint matching equation. Its second factor is strictly negative throughout the prescribed bracket, so nonzero effect and amplitude force the literal selected root to be the center.

theorem fairEndpoint_residual_negative Lemma fairEndpoint_residual_negative in the paper ↗

[The residual factor in endpoint matching is strictly negative throughout the fair bracket for every nonnegative exponential increment. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
d δ ξ :
ℝ
hd :
0 ≤ d
hξ :
ξ ∈ Icc (3/10 : ℝ) (1/2)
-25*δ^2*d + 25*d*ξ^2 - 15*d*ξ - 6*d + 25*ξ - 15 < 0
Proof (Lean source)
-- @node: fairEndpoint_residual_negative lemma fairEndpoint_residual_negative (d δ ξ : ℝ) (hd : 0 ≤ d) (hξ : ξ ∈ Icc (3/10 : ℝ) (1/2)) : -25*δ^2*d + 25*d*ξ^2 - 15*d*ξ - 6*d + 25*ξ - 15 < 0 := by have hξpos : 0 ≤ ξ := by linarith [hξ.1] have hquad : ξ^2 ≤ ξ/2 := by nlinarith [hξ.2] have hmul := mul_nonneg hd (sub_nonneg.mpr hquad) have hδ := mul_nonneg (sq_nonneg δ) hd have hx := mul_nonneg hd hξpos nlinarith [hξ.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEndpoint_residual_negative · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:15
theorem fairEndpoint_rational_factor Lemma fairEndpoint_rational_factor in the paper ↗

[Clearing the endpoint risk denominators factors the exact matching residual, retaining the amplitude square needed for the removable extension. the documented result Under the stated assumptions.

Formal statement
d δ ξ e :
ℝ
hp :
1+d*(ξ+δ) ≠ 0
hm :
1+d*(ξ-δ) ≠ 0
hc :
1+(e-1)*ξ ≠ 0
he :
e*((3/5)*(1+(2/5)*d)+d*δ^2) = (d+1)*((3/5)*(1+(2/5)*d)-(3/2)*d*δ^2)
(((d+1)*(ξ+δ)/(1+d*(ξ+δ)) + (d+1)*(ξ-δ)/(1+d*(ξ-δ)))/2 - e*ξ/(1+(e-1)*ξ)) * (1+d*(ξ+δ))*(1+d*(ξ-δ))*(1+(e-1)*ξ)* ((3/5)*(1+(2/5)*d)+d*δ^2)
= -d*δ^2*(d+1)*(5*ξ-2)* (-25*δ^2*d+25*d*ξ^2-15*d*ξ-6*d+25*ξ-15)/50
Proof (Lean source)
-- @node: fairEndpoint_rational_factor lemma fairEndpoint_rational_factor (d δ ξ e : ℝ) (hp : 1+d*(ξ+δ) ≠ 0) (hm : 1+d*(ξ-δ) ≠ 0) (hc : 1+(e-1)*ξ ≠ 0) (he : e*((3/5)*(1+(2/5)*d)+d*δ^2) = (d+1)*((3/5)*(1+(2/5)*d)-(3/2)*d*δ^2)) : (((d+1)*(ξ+δ)/(1+d*(ξ+δ)) + (d+1)*(ξ-δ)/(1+d*(ξ-δ)))/2 - e*ξ/(1+(e-1)*ξ)) * (1+d*(ξ+δ))*(1+d*(ξ-δ))*(1+(e-1)*ξ)* ((3/5)*(1+(2/5)*d)+d*δ^2) = -d*δ^2*(d+1)*(5*ξ-2)* (-25*δ^2*d+25*d*ξ^2-15*d*ξ-6*d+25*ξ-15)/50 := by let H := (d+1)*(ξ+δ)*(1+d*(ξ-δ))*(1+(e-1)*ξ) + (d+1)*(ξ-δ)*(1+d*(ξ+δ))*(1+(e-1)*ξ) - 2*e*ξ*(1+d*(ξ+δ))*(1+d*(ξ-δ)) calc _ = ((3/5)*(1+(2/5)*d)+d*δ^2)*H/2 := by dsimp [H] have hc' : 1+ξ*(e-1) ≠ 0 := by simpa [mul_comm] using hc field_simp [hp,hm,hc,hc'] <;> ring _ = _ := by dsimp [H] linear_combination ξ*(-δ^2*d+d*ξ^2-d*ξ+ξ-1)*he
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEndpoint_rational_factor · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:28
theorem comparatorEffect_corrected_odds Lemma comparatorEffect_corrected_odds in the paper ↗

The explicit log correction supplies the rational comparator odds after clearing its positive logarithm denominators. the documented result Under the stated assumptions.

Formal statement
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
exp (comparatorEffect t δ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*δ^2)
= ((exp t-1)+1)*((3/5)*(1+(2/5)*(exp t-1))- (3/2)*(exp t-1)*δ^2)
Proof (Lean source)
-- @node: comparatorEffect_corrected_odds lemma comparatorEffect_corrected_odds (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) : exp (comparatorEffect t δ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*δ^2) = ((exp t-1)+1)*((3/5)*(1+(2/5)*(exp t-1))- (3/2)*(exp t-1)*δ^2) := by have he := comparatorEffect_exp_formula t δ ht hδ obtain ⟨hB,ha,hb,_,_⟩ := fair_matching_denominators t δ ht hδ have hd : 0 ≤ exp t-1 := ht.1.trans (fair_exp_increment_bounds t ht).1 field_simp (disch := positivity) at he linear_combination (1/50)*he
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_corrected_odds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:55
theorem fairEndpoint_rational_unique Lemma fairEndpoint_rational_unique in the paper ↗

[The rational comparator odds and endpoint risk matching have only the asymmetric center as a bracket solution off the two removable axes. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
d δ ξ e :
ℝ
hd :
0 < d
hδ :
δ ≠ 0
hξ :
ξ ∈ Icc (3/10 : ℝ) (1/2)
hp :
1+d*(ξ+δ) ≠ 0
hm :
1+d*(ξ-δ) ≠ 0
hc :
1+(e-1)*ξ ≠ 0
he :
e*((3/5)*(1+(2/5)*d)+d*δ^2) = (d+1)*((3/5)*(1+(2/5)*d)-(3/2)*d*δ^2)
hmatch :
((d+1)*(ξ+δ)/(1+d*(ξ+δ)) + (d+1)*(ξ-δ)/(1+d*(ξ-δ)))/2 = e*ξ/(1+(e-1)*ξ)
ξ = 2/5
Proof (Lean source)
-- @node: fairEndpoint_rational_unique lemma fairEndpoint_rational_unique (d δ ξ e : ℝ) (hd : 0 < d) (hδ : δ ≠ 0) (hξ : ξ ∈ Icc (3/10 : ℝ) (1/2)) (hp : 1+d*(ξ+δ) ≠ 0) (hm : 1+d*(ξ-δ) ≠ 0) (hc : 1+(e-1)*ξ ≠ 0) (he : e*((3/5)*(1+(2/5)*d)+d*δ^2) = (d+1)*((3/5)*(1+(2/5)*d)-(3/2)*d*δ^2)) (hmatch : ((d+1)*(ξ+δ)/(1+d*(ξ+δ)) + (d+1)*(ξ-δ)/(1+d*(ξ-δ)))/2 = e*ξ/(1+(e-1)*ξ)) : ξ = 2/5 := by let H := (d+1)*(ξ+δ)*(1+d*(ξ-δ))*(1+(e-1)*ξ) + (d+1)*(ξ-δ)*(1+d*(ξ+δ))*(1+(e-1)*ξ) - 2*e*ξ*(1+d*(ξ+δ))*(1+d*(ξ-δ)) have hH : H = 0 := by dsimp [H] have hc' : 1+ξ*(e-1) ≠ 0 := by simpa [mul_comm] using hc field_simp [hp,hm,hc,hc'] at hmatch linear_combination hmatch have hfactor : d*δ^2*(d+1)*(5*ξ-2)* (-25*δ^2*d+25*d*ξ^2-15*d*ξ-6*d+25*ξ-15) = 0 := by calc _ = -25*(((3/5)*(1+(2/5)*d)+d*δ^2)*H - 2*ξ*(-δ^2*d+d*ξ^2-d*ξ+ξ-1)* (e*((3/5)*(1+(2/5)*d)+d*δ^2) - (d+1)*((3/5)*(1+(2/5)*d)-(3/2)*d*δ^2))) := by dsimp [H]; ring _ = 0 := by rw [hH,he]; ring have hres := fairEndpoint_residual_negative d δ ξ hd.le hξ have hbase : d*δ^2*(d+1) ≠ 0 := mul_ne_zero (mul_ne_zero hd.ne' (pow_ne_zero 2 hδ)) (by linarith) have hz := (mul_eq_zero.mp hfactor).resolve_right (ne_of_lt hres) have hx := (mul_eq_zero.mp hz).resolve_left hbase linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEndpoint_rational_unique · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:70
theorem fairEquation_endpoint_unique_off_axes Lemma fairEquation_endpoint_unique_off_axes in the paper ↗

[Exact endpoint singleton matching identifies any bracket root with the fixed center whenever effect and amplitude are both nonzero. the documented result Under the stated assumptions.

Formal statement
t δ ξ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hξ :
ξ ∈ Ioo (3/10 : ℝ) (1/2)
hu :
u = 0 ∨ u = 1
hne :
t*δ ≠ 0
hroot :
fairEquation t δ ξ u = 0
ξ = 2/5
Proof (Lean source)
-- @node: fairEquation_endpoint_unique_off_axes lemma fairEquation_endpoint_unique_off_axes (t δ ξ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hξ : ξ ∈ Ioo (3/10 : ℝ) (1/2)) (hu : u = 0 ∨ u = 1) (hne : t*δ ≠ 0) (hroot : fairEquation t δ ξ u = 0) : ξ = 2/5 := by have htpos : 0 < t := lt_of_le_of_ne ht.1 (mul_ne_zero_iff.mp hne).1.symm have hd : 0 < exp t-1 := by have h := Real.exp_lt_exp.mpr htpos simpa using sub_pos.mpr h have hξ' : ξ ∈ Icc (3/10 : ℝ) (1/2) := ⟨hξ.1.le,hξ.2.le⟩ have hmatch := fair_matching_of_equation t δ ξ u ht hδ hξ' hroot rw [fair_endpoint_sign_average (fun z => riskShift t (ξ+δ*z)) u hu] at hmatch simp only [mul_one,mul_neg_one,← sub_eq_add_neg] at hmatch have hp : 0 < 1+(exp t-1)*(ξ+δ) := by have hx : 0 ≤ ξ+δ := by linarith [(abs_le.mp hδ).1,hξ.1] positivity have hm : 0 < 1+(exp t-1)*(ξ-δ) := by have hx : 0 ≤ ξ-δ := by linarith [(abs_le.mp hδ).2,hξ.1] positivity have hc : 0 < 1+(exp (comparatorEffect t δ)-1)*ξ := by have hpos := Real.exp_pos (comparatorEffect t δ) nlinarith [hξ.1,hξ.2] have he := comparatorEffect_exp_formula t δ ht hδ obtain ⟨hB,ha,hb,_,_⟩ := fair_matching_denominators t δ ht hδ have hcorr : exp (comparatorEffect t δ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*δ^2) = ((exp t-1)+1)*((3/5)*(1+(2/5)*(exp t-1))- (3/2)*(exp t-1)*δ^2) := by exact comparatorEffect_corrected_odds t δ ht hδ apply fairEndpoint_rational_unique (exp t-1) δ ξ (exp (comparatorEffect t δ)) hd (mul_ne_zero_iff.mp hne).2 hξ' hp.ne' hm.ne' hc.ne' hcorr simpa only [riskShift,sub_add_cancel] using hmatch
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_unique_off_axes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:105
theorem fairRoot_endpoint_center_off_axes Lemma fairRoot_endpoint_center_off_axes in the paper ↗

[The literal endpoint selector equals the center throughout the full effect range away from the removable axes. the documented result Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hu :
u = 0 ∨ u = 1
hne :
t*δ ≠ 0
fairRoot t δ u = 2/5
Proof (Lean source)
-- @node: fairRoot_endpoint_center_off_axes lemma fairRoot_endpoint_center_off_axes (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hu : u = 0 ∨ u = 1) (hne : t*δ ≠ 0) : fairRoot t δ u = 2/5 := by obtain ⟨hb,he⟩ := fairRoot_endpoint_spec t δ u ht hδ hu exact fairEquation_endpoint_unique_off_axes t δ _ u ht hδ hb hu hne he
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_endpoint_center_off_axes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:141
theorem fairEquation_endpoint_factor_off_axes Lemma fairEquation_endpoint_factor_off_axes in the paper ↗

[The endpoint factorization survives Taylor normalization off the axes; the amplitude square cancels without changing the risk residual. the documented result Under the stated assumptions.

Formal statement
t δ ξ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hξ :
ξ ∈ Icc (3/10 : ℝ) (1/2)
hne :
δ ≠ 0
t*fairEquation t δ ξ 0 * (1+(exp t-1)*(ξ+δ))*(1+(exp t-1)*(ξ-δ))* (1+(exp (comparatorEffect t δ)-1)*ξ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*δ^2)
= -(exp t-1)*exp t*(5*ξ-2)* (-25*δ^2*(exp t-1)+25*(exp t-1)*ξ^2- 15*(exp t-1)*ξ-6*(exp t-1)+25*ξ-15)/50
Proof (Lean source)
-- @node: fairEquation_endpoint_factor_off_axes lemma fairEquation_endpoint_factor_off_axes (t δ ξ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hξ : ξ ∈ Icc (3/10 : ℝ) (1/2)) (hne : δ ≠ 0) : t*fairEquation t δ ξ 0 * (1+(exp t-1)*(ξ+δ))*(1+(exp t-1)*(ξ-δ))* (1+(exp (comparatorEffect t δ)-1)*ξ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*δ^2) = -(exp t-1)*exp t*(5*ξ-2)* (-25*δ^2*(exp t-1)+25*(exp t-1)*ξ^2- 15*(exp t-1)*ξ-6*(exp t-1)+25*ξ-15)/50 := by have hd : 0 ≤ exp t-1 := ht.1.trans (fair_exp_increment_bounds t ht).1 have hp : 0 < 1+(exp t-1)*(ξ+δ) := by have hx : 0 ≤ ξ+δ := by linarith [(abs_le.mp hδ).1,hξ.1] positivity have hm : 0 < 1+(exp t-1)*(ξ-δ) := by have hx : 0 ≤ ξ-δ := by linarith [(abs_le.mp hδ).2,hξ.1] positivity have hc : 0 < 1+(exp (comparatorEffect t δ)-1)*ξ := by nlinarith [Real.exp_pos (comparatorEffect t δ),hξ.1,hξ.2] have hf := fairEndpoint_rational_factor (exp t-1) δ ξ (exp (comparatorEffect t δ)) hp.ne' hm.ne' hc.ne' (comparatorEffect_corrected_odds t δ ht hδ) have hN : fairNumerator t δ ξ 0 = (riskShift t (ξ+δ)+riskShift t (ξ-δ))/2 - riskShift (comparatorEffect t δ) ξ := by unfold fairNumerator rw [fair_endpoint_sign_average (fun z => riskShift t (ξ+δ*z)) 0 (inl rfl)] simp only [mul_one,mul_neg_one,← sub_eq_add_neg] simp only [sub_add_cancel] at hf change ((riskShift t (ξ+δ)+riskShift t (ξ-δ))/2 - riskShift (comparatorEffect t δ) ξ)* (1+(exp t-1)*(ξ+δ))*(1+(exp t-1)*(ξ-δ))* (1+(exp (comparatorEffect t δ)-1)*ξ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*δ^2) = _ at hf rw [← hN,← fairEquation_mul_parameters t δ ξ 0 ht hδ hξ] at hf apply mul_left_cancel₀ (pow_ne_zero 2 hne) calc _ = t*δ^2*fairEquation t δ ξ 0 * (1+(exp t-1)*(ξ+δ))*(1+(exp t-1)*(ξ-δ))* (1+(exp (comparatorEffect t δ)-1)*ξ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*δ^2) := by ring _ = _ := hf.trans (by ring)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_factor_off_axes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:150
theorem fairEquation_endpoint_factor_zero_amplitude Lemma fairEquation_endpoint_factor_zero_amplitude in the paper ↗

[Continuity of the actual Taylor extension preserves the factored endpoint equation at zero amplitude, throughout the closed effect range. the documented result Under the stated assumptions.

Formal statement
t ξ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hξ :
ξ ∈ Icc (3/10 : ℝ) (1/2)
t*fairEquation t 0 ξ 0 * (1+(exp t-1)*ξ)^3 * ((3/5)*(1+(2/5)*(exp t-1)))
= -(exp t-1)*exp t*(5*ξ-2)* (25*(exp t-1)*ξ^2-15*(exp t-1)*ξ- 6*(exp t-1)+25*ξ-15)/50
Proof (Lean source)
-- @node: fairEquation_endpoint_factor_zero_amplitude lemma fairEquation_endpoint_factor_zero_amplitude (t ξ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hξ : ξ ∈ Icc (3/10 : ℝ) (1/2)) : t*fairEquation t 0 ξ 0 * (1+(exp t-1)*ξ)^3 * ((3/5)*(1+(2/5)*(exp t-1))) = -(exp t-1)*exp t*(5*ξ-2)* (25*(exp t-1)*ξ^2-15*(exp t-1)*ξ- 6*(exp t-1)+25*ξ-15)/50 := by let f : ℝ → ℝ := fun D => t*fairEquation t D ξ 0 * (1+(exp t-1)*(ξ+D))*(1+(exp t-1)*(ξ-D))* (1+(exp (comparatorEffect t D)-1)*ξ)* ((3/5)*(1+(2/5)*(exp t-1))+(exp t-1)*D^2) let g : ℝ → ℝ := fun D => -(exp t-1)*exp t*(5*ξ-2)* (-25*D^2*(exp t-1)+25*(exp t-1)*ξ^2- 15*(exp t-1)*ξ-6*(exp t-1)+25*ξ-15)/50 have hf : ContinuousOn f (Icc (0 : ℝ) (1/100)) := by intro D hD have hδ : |D| ≤ 1/100 := by rw [abs_of_nonneg hD.1]; exact hD.2 have hbox : ![t,D,ξ,0] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨ht,hδ,hξ,by change (0 : ℝ) ∈ Icc 0 1; constructor <;> norm_num⟩ have hpH : ContDiffAt ℝ ∞ (fun x : ℝ => ![t,x,ξ,0]) D := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hpC : ContDiffAt ℝ ⊤ (fun x : ℝ => ![t,x]) D := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hH : ContinuousAt (fun x => fairEquation t x ξ 0) D := by have hh := (fairEquation_contDiffAt ![t,D,ξ,0] hbox).comp D hpH exact hh.continuousAt have hC : ContinuousAt (fun x => comparatorEffect t x) D := by have hh := (comparatorEffect_contDiffAt ![t,D] ht hδ).comp D hpC exact hh.continuousAt apply ContinuousAt.continuousWithinAt dsimp [f] fun_prop have hg : ContinuousOn g (Icc (0 : ℝ) (1/100)) := by dsimp [g]; fun_prop have he : EqOn f g (Ioo (0 : ℝ) (1/100)) := by intro D hD exact fairEquation_endpoint_factor_off_axes t D ξ ht (by rw [abs_of_pos hD.1]; exact hD.2.le) hξ hD.1.ne' have hz := he.of_subset_closure hf hg Set.Ioo_subset_Icc_self (by rw [closure_Ioo (by norm_num : (0 : ℝ) ≠ 1/100)]) (show (0 : ℝ) ∈ Icc (0 : ℝ) (1/100) by constructor <;> norm_num) dsimp [f,g] at hz simp only [zero_pow (by norm_num : 2 ≠ 0),mul_zero,add_zero,sub_zero, comparatorEffect_zero_amplitude] at hz convert hz using 1 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_factor_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:196
theorem fairEquation_zero_amplitude_unique Lemma fairEquation_zero_amplitude_unique in the paper ↗

The zero-amplitude normalized equation has a unique bracket root for the entire effect range; its position independence comes from unit sign variance. the documented result Under the stated assumptions.

Formal statement
t u ξ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hu :
u ∈ Icc (0 : ℝ) 1
hξ :
ξ ∈ Ioo (3/10 : ℝ) (1/2)
he :
fairEquation t 0 ξ u = 0
ξ = 2/5
Proof (Lean source)
-- @node: fairEquation_zero_amplitude_unique lemma fairEquation_zero_amplitude_unique (t u ξ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hu : u ∈ Icc (0 : ℝ) 1) (hξ : ξ ∈ Ioo (3/10 : ℝ) (1/2)) (he : fairEquation t 0 ξ u = 0) : ξ = 2/5 := by by_cases hz : t = 0 · subst t exact fairEquation_zero_effect_unique 0 u ξ (by norm_num) hu hξ he have hξ' : ξ ∈ Icc (3/10 : ℝ) (1/2) := ⟨hξ.1.le,hξ.2.le⟩ rw [fairEquation_zero_amplitude_endpoint t ξ u ht hξ'] at he have hf := fairEquation_endpoint_factor_zero_amplitude t ξ ht hξ' rw [he] at hf have htpos : 0 < t := lt_of_le_of_ne ht.1 (Ne.symm hz) have hd : 0 < exp t-1 := by have h := Real.exp_lt_exp.mpr htpos simpa using sub_pos.mpr h have hres := fairEndpoint_residual_negative (exp t-1) 0 ξ hd.le hξ' simp only [zero_pow (by norm_num : 2 ≠ 0),mul_zero,zero_mul,sub_zero,zero_add] at hres have hproduct : (5*ξ-2)*(25*(exp t-1)*ξ^2-15*(exp t-1)*ξ- 6*(exp t-1)+25*ξ-15) = 0 := by have hn : -(exp t-1)*exp t ≠ 0 := mul_ne_zero (neg_ne_zero.mpr hd.ne') (Real.exp_pos t).ne' have hzero : -(exp t-1)*exp t*(5*ξ-2)* (25*(exp t-1)*ξ^2-15*(exp t-1)*ξ- 6*(exp t-1)+25*ξ-15) = 0 := by linarith [hf] apply mul_left_cancel₀ hn simpa only [mul_zero,mul_assoc] using hzero have hcenter := (mul_eq_zero.mp hproduct).resolve_right (ne_of_lt hres) linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_amplitude_unique · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:250
theorem fairRoot_zero_amplitude Lemma fairRoot_zero_amplitude in the paper ↗

[The actual zero-amplitude selector is the fixed asymmetric center on the whole prescribed effect and spatial ranges. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hu :
u ∈ Icc (0 : ℝ) 1
fairRoot t 0 u = 2/5
Proof (Lean source)
-- @node: fairRoot_zero_amplitude lemma fairRoot_zero_amplitude (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hu : u ∈ Icc (0 : ℝ) 1) : fairRoot t 0 u = 2/5 := by obtain ⟨hb,he⟩ := fairRoot_zero_amplitude_spec t u ht exact fairEquation_zero_amplitude_unique t u _ ht hu hb he
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:282
theorem fairRoot_endpoint_center Lemma fairRoot_endpoint_center in the paper ↗

Both spatial endpoint selectors equal the center, including effect and amplitude zero, uniformly on the complete prescribed effect range. the documented result Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hu :
u = 0 ∨ u = 1
fairRoot t δ u = 2/5
Proof (Lean source)
-- @node: fairRoot_endpoint_center lemma fairRoot_endpoint_center (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hu : u = 0 ∨ u = 1) : fairRoot t δ u = 2/5 := by have hu' : u ∈ Icc (0 : ℝ) 1 := by rcases hu with rfl | rfl <;> constructor <;> norm_num by_cases htzero : t = 0 · subst t exact fairRoot_zero_effect δ u hδ hu' by_cases hδzero : δ = 0 · subst δ exact fairRoot_zero_amplitude t u ht hu' exact fairRoot_endpoint_center_off_axes t δ u ht hδ hu (mul_ne_zero htzero hδzero)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_endpoint_center · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:291
theorem fairEquation_zero_amplitude_bracket_signs Lemma fairEquation_zero_amplitude_bracket_signs in the paper ↗

At zero amplitude the normalized fair equation has strictly separated signs on the whole selector bracket, uniformly over the closed effect range. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hu :
u ∈ Icc (0 : ℝ) 1
conclusion 1
fairEquation t 0 (3/10) u < 0
conclusion 2
0 < fairEquation t 0 (1/2) u
Proof (Lean source)
-- @node: fairEquation_zero_amplitude_bracket_signs lemma fairEquation_zero_amplitude_bracket_signs (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hu : u ∈ Icc (0 : ℝ) 1) : fairEquation t 0 (3/10) u < 0 ∧ 0 < fairEquation t 0 (1/2) u := by by_cases hz : t = 0 · subst t rw [fairEquation_zero_effect 0 (3/10) u (by norm_num) (by constructor <;> norm_num) hu, fairEquation_zero_effect 0 (1/2) u (by norm_num) (by constructor <;> norm_num) hu] norm_num have htpos : 0 < t := lt_of_le_of_ne ht.1 (Ne.symm hz) have hd : 0 < exp t-1 := by have h := Real.exp_lt_exp.mpr htpos simpa using sub_pos.mpr h have hsign (ξ : ℝ) (hξ : ξ ∈ Icc (3/10 : ℝ) (1/2)) : (fairEquation t 0 ξ 0 < 0 ↔ 5*ξ-2 < 0) ∧ (0 < fairEquation t 0 ξ 0 ↔ 0 < 5*ξ-2) := by have hf := fairEquation_endpoint_factor_zero_amplitude t ξ ht hξ have hK := fairEndpoint_residual_negative (exp t-1) 0 ξ hd.le hξ simp only [zero_pow (by norm_num : 2 ≠ 0),mul_zero,zero_mul,sub_zero,zero_add] at hK have hx : 0 ≤ ξ := by linarith [hξ.1] let A := t*(1+(exp t-1)*ξ)^3*((3/5)*(1+(2/5)*(exp t-1))) let B := -(exp t-1)*exp t* (25*(exp t-1)*ξ^2-15*(exp t-1)*ξ-6*(exp t-1)+25*ξ-15)/50 have hA : 0 < A := by dsimp [A]; positivity have hB : 0 < B := by dsimp [B] exact div_pos (mul_pos_of_neg_of_neg (mul_neg_of_neg_of_pos (neg_neg_of_pos hd) (Real.exp_pos t)) hK) (by norm_num) have heq : fairEquation t 0 ξ 0 * A = (5*ξ-2)*B := by dsimp [A,B] linear_combination hf constructor <;> constructor <;> intro h <;> nlinarith only [hA,hB,heq,h] rw [fairEquation_zero_amplitude_endpoint t (3/10) u ht (by constructor <;> norm_num), fairEquation_zero_amplitude_endpoint t (1/2) u ht (by constructor <;> norm_num)] exact ⟨(hsign (3/10) (by constructor <;> norm_num)).1.mpr (by norm_num), (hsign (1/2) (by constructor <;> norm_num)).2.mpr (by norm_num)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_amplitude_bracket_signs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEndpointUniqueness.lean:307
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairEquationContinuity 10 declarations Compact domination justifies continuity of both Taylor integrations.

Continuity of the normalized fair equation through its axes

Compact domination justifies continuity of both Taylor integrations. The exact endpoint numerator identity then extends to the actual normalized equation on both zero axes, providing genuine bracket roots for the literal selector.

theorem calibration_compact_intervalIntegral_continuousOn Lemma calibration_compact_intervalIntegral_continuousOn in the paper ↗

A continuous family on a compact parameter set has a continuous unit-interval integral. Under the stated assumptions. Under the stated assumptions.

Formal statement
S :
Set X
hS :
F :
X → ℝ → ℝ
hF :
ContinuousOn F.uncurry (S ×ˢ Icc (0 : ℝ) 1)
ContinuousOn (fun x => ∫ y in (0 : ℝ)..1, F x y) S
Proof (Lean source)
-- @node: calibration_compact_intervalIntegral_continuousOn lemma calibration_compact_intervalIntegral_continuousOn {X : Type*} [TopologicalSpace X] [FirstCountableTopology X] (S : Set X) (hS : IsCompact S) (F : X → ℝ → ℝ) (hF : ContinuousOn F.uncurry (S ×ˢ Icc (0 : ℝ) 1)) : ContinuousOn (fun x => ∫ y in (0 : ℝ)..1, F x y) S := by obtain ⟨B, hB⟩ := (hS.prod isCompact_Icc).bddAbove_image hF.norm have hslice (x : X) (hx : x ∈ S) : ContinuousOn (F x) (Icc (0 : ℝ) 1) := hF.comp (continuousOn_const.prodMk continuousOn_id) (fun y hy => ⟨hx,hy⟩) intro x hx apply intervalIntegral.continuousWithinAt_of_dominated_interval (bound := fun _ => B) · filter_upwards [self_mem_nhdsWithin] with z hz rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] exact ((hslice z hz).mono Set.Ioc_subset_Icc_self).aestronglyMeasurable measurableSet_Ioc · filter_upwards [self_mem_nhdsWithin] with z hz refine Filter.Eventually.of_forall (fun y hy => ?_) rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] at hy exact hB ⟨(z,y), ⟨hz,hy.1.le,hy.2⟩, rfl⟩ · exact intervalIntegrable_const · refine Filter.Eventually.of_forall (fun y hy => ?_) rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] at hy exact (hF.comp (continuousOn_id.prodMk continuousOn_const) (fun z hz => ⟨hz,hy.1.le,hy.2⟩)) x hx
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_compact_intervalIntegral_continuousOn · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:16

[The compact box on which the fair Taylor equation is used.

Definition (Lean source)
fairTaylorParameterRegion :
Set (Fin 4 → ℝ)
pi univ (fun i => if i = 0 then Icc (0 : ℝ) (1 / 4) else if i = 1 then Icc (-(1 / 100 : ℝ)) (1 / 100) else if i = 2 then Icc (3 / 10 : ℝ) (1 / 2) else Icc (0 : ℝ) 1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairTaylorParameterRegion · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:40
theorem fairTaylorParameterRegion_mem

Coordinate characterization of the closed Taylor box. the stated conclusion holds.

Formal statement
v :
Fin 4 → ℝ
v ∈ fairTaylorParameterRegion ↔ v 0 ∈ Icc (0 : ℝ) (1 / 4) ∧
|v 1| ≤ 1 / 100 ∧
v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2) ∧
v 3 ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: fairTaylorParameterRegion_mem lemma fairTaylorParameterRegion_mem (v : Fin 4 → ℝ) : v ∈ fairTaylorParameterRegion ↔ v 0 ∈ Icc (0 : ℝ) (1 / 4) ∧ |v 1| ≤ 1 / 100 ∧ v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2) ∧ v 3 ∈ Icc (0 : ℝ) 1 := by simp only [fairTaylorParameterRegion, Set.mem_pi, Set.mem_univ, forall_const] constructor · intro h exact ⟨by simpa using h 0, abs_le.mpr (by simpa using h 1), by simpa using h 2, by simpa using h 3⟩ · rintro ⟨ht,hδ,hξ,hu⟩ i fin_cases i · simpa using ht · simpa using abs_le.mp hδ · simpa using hξ · simpa using hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairTaylorParameterRegion_mem · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:47
theorem fairTaylorParameterRegion_isCompact

Compactness includes both removable axes and all spatial endpoints. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: fairTaylorParameterRegion_isCompact lemma fairTaylorParameterRegion_isCompact : IsCompact fairTaylorParameterRegion := isCompact_univ_pi (fun i => by split · exact isCompact_Icc · split · exact isCompact_Icc · split <;> exact isCompact_Icc)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairTaylorParameterRegion_isCompact · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:64
theorem fairTaylorIntegrand_contDiffAt

The actual weighted Taylor integrand is smooth jointly in the parameters and its two integration coordinates on full neighborhoods of the closed box. the documented result Under the stated assumptions.

Formal statement
z :
((Fin 4 → ℝ) × ℝ) × ℝ
hz :
hs :
z.1.2 ∈ Icc (0 : ℝ) 1
hv :
z.2 ∈ Icc (0 : ℝ) 1
ContDiffAt ℝ ⊤ (fun w : ((Fin 4 → ℝ) × ℝ) × ℝ => (1-w.2)*deriv (fun T => deriv (deriv (fun D => fairNumerator T D (w.1.1 2) (w.1.1 3))) (w.2*w.1.1 1)) (w.1.2*w.1.1 0)) z
Proof (Lean source)
-- @node: fairTaylorIntegrand_contDiffAt lemma fairTaylorIntegrand_contDiffAt (z : ((Fin 4 → ℝ) × ℝ) × ℝ) (hz : z.1.1 ∈ fairTaylorParameterRegion) (hs : z.1.2 ∈ Icc (0 : ℝ) 1) (hv : z.2 ∈ Icc (0 : ℝ) 1) : ContDiffAt ℝ ⊤ (fun w : ((Fin 4 → ℝ) × ℝ) × ℝ => (1-w.2)*deriv (fun T => deriv (deriv (fun D => fairNumerator T D (w.1.1 2) (w.1.1 3))) (w.2*w.1.1 1)) (w.1.2*w.1.1 0)) z := by obtain ⟨ht,hδ,hξ,hu⟩ := (fairTaylorParameterRegion_mem _).mp hz have ht' : z.1.2*z.1.1 0 ∈ Icc (0 : ℝ) (1 / 4) := ⟨mul_nonneg hs.1 ht.1, by nlinarith [hs.2,ht.1,ht.2]⟩ have hδ' : |z.2*z.1.1 1| ≤ 1 / 100 := (calibration_segment_abs_le _ _ (calibration_unit_mul_mem_segment _ _ hv)).trans hδ have hp : ContDiffAt ℝ ⊤ (fun w : ((Fin 4 → ℝ) × ℝ) × ℝ => ![w.1.2*w.1.1 0,w.2*w.1.1 1,w.1.1 2,w.1.1 3]) z := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hderiv := (fairNumerator_taylor_deriv_contDiffAt ![z.1.2*z.1.1 0,z.2*z.1.1 1,z.1.1 2,z.1.1 3] ht' hδ' hξ).comp z hp apply (show ContDiffAt ℝ ⊤ (fun w : ((Fin 4 → ℝ) × ℝ) × ℝ => 1-w.2) z by fun_prop).mul simpa only [Function.comp_def, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val] using hderiv
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairTaylorIntegrand_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:74
theorem fairEquation_continuousOn

The double Taylor integral is jointly continuous through both axes. Compact bounds on the actual integrand justify both integrations. The stated conclusion follows.

Formal statement
ContinuousOn (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) fairTaylorParameterRegion
Proof (Lean source)
-- @node: fairEquation_continuousOn @[fun_prop] lemma fairEquation_continuousOn : ContinuousOn (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) fairTaylorParameterRegion := by let F : ((Fin 4 → ℝ) × ℝ) → ℝ → ℝ := fun z v => (1-v)*deriv (fun T => deriv (deriv (fun D => fairNumerator T D (z.1 2) (z.1 3))) (v*z.1 1)) (z.2*z.1 0) have hF : ContinuousOn F.uncurry ((fairTaylorParameterRegion ×ˢ Icc (0 : ℝ) 1) ×ˢ Icc (0 : ℝ) 1) := by intro z hz exact (fairTaylorIntegrand_contDiffAt z hz.1.1 hz.1.2 hz.2).continuousAt.continuousWithinAt have hInner := calibration_compact_intervalIntegral_continuousOn _ (fairTaylorParameterRegion_isCompact.prod isCompact_Icc) F hF exact calibration_compact_intervalIntegral_continuousOn _ fairTaylorParameterRegion_isCompact (fun w s => ∫ v in (0 : ℝ)..1, F (w,s) v) hInner
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_continuousOn · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:99
theorem fairEquation_endpoint_zero_nonzero_amplitude Lemma fairEquation_endpoint_zero_nonzero_amplitude in the paper ↗

Endpoint roots persist through zero effect for every nonzero signed amplitude. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ 1 / 100
hu :
u = 0 ∨ u = 1
hδne :
δ ≠ 0
fairEquation t δ (2 / 5) u = 0
Proof (Lean source)
-- @node: fairEquation_endpoint_zero_nonzero_amplitude lemma fairEquation_endpoint_zero_nonzero_amplitude (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ 1 / 100) (hu : u = 0 ∨ u = 1) (hδne : δ ≠ 0) : fairEquation t δ (2 / 5) u = 0 := by have hu' : u ∈ Icc (0 : ℝ) 1 := by rcases hu with rfl | rfl <;> constructor <;> norm_num have hc : ContinuousOn (fun T => fairEquation T δ (2 / 5) u) (Icc (0 : ℝ) (1 / 4)) := by have hp : ContinuousOn (fun T : ℝ => ![T,δ,2 / 5,u]) (Icc (0 : ℝ) (1 / 4)) := by apply Continuous.continuousOn apply continuous_pi intro i fin_cases i <;> dsimp <;> fun_prop have h := fairEquation_continuousOn.comp hp (fun T hT => (fairTaylorParameterRegion_mem _).mpr ⟨hT,hδ,by change (2 / 5 : ℝ) ∈ Icc (3 / 10 : ℝ) (1 / 2) constructor <;> norm_num,hu'⟩) simpa only [Function.comp_def, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val] using h have he : EqOn (fun T => fairEquation T δ (2 / 5) u) (fun _ => 0) (Ioo (0 : ℝ) (1 / 4)) := by intro T hT exact fairEquation_endpoint_zero_off_axes T δ u ⟨hT.1.le,hT.2.le⟩ hδ hu (mul_ne_zero (ne_of_gt hT.1) hδne) exact he.of_subset_closure hc continuousOn_const Set.Ioo_subset_Icc_self (by rw [closure_Ioo (by norm_num : (0 : ℝ) ≠ 1 / 4)]) ht
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_zero_nonzero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:116
theorem fairEquation_endpoint_zero Lemma fairEquation_endpoint_zero in the paper ↗

[The endpoint center solves the actual Taylor-normalized equation also on both removable axes, by joint continuity and the exact off-axis identity. the documented result Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ 1 / 100
hu :
u = 0 ∨ u = 1
fairEquation t δ (2 / 5) u = 0
Proof (Lean source)
-- @node: fairEquation_endpoint_zero lemma fairEquation_endpoint_zero (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ 1 / 100) (hu : u = 0 ∨ u = 1) : fairEquation t δ (2 / 5) u = 0 := by by_cases hδne : δ ≠ 0 · exact fairEquation_endpoint_zero_nonzero_amplitude t δ u ht hδ hu hδne · have hδzero : δ = 0 := not_ne_iff.mp hδne subst δ have hu' : u ∈ Icc (0 : ℝ) 1 := by rcases hu with rfl | rfl <;> constructor <;> norm_num have hc : ContinuousOn (fun D => fairEquation t D (2 / 5) u) (Icc (0 : ℝ) (1 / 100)) := by have hp : ContinuousOn (fun D : ℝ => ![t,D,2 / 5,u]) (Icc (0 : ℝ) (1 / 100)) := by apply Continuous.continuousOn apply continuous_pi intro i fin_cases i <;> dsimp <;> fun_prop have h := fairEquation_continuousOn.comp hp (fun D hD => (fairTaylorParameterRegion_mem _).mpr ⟨ht,by change |D| ≤ 1 / 100; rw [abs_of_nonneg hD.1]; exact hD.2, by change (2 / 5 : ℝ) ∈ Icc (3 / 10 : ℝ) (1 / 2); constructor <;> norm_num,hu'⟩) simpa only [Function.comp_def, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val] using h have he : EqOn (fun D => fairEquation t D (2 / 5) u) (fun _ => 0) (Ioo (0 : ℝ) (1 / 100)) := by intro D hD exact fairEquation_endpoint_zero_nonzero_amplitude t D u ht (by simpa only [abs_of_pos hD.1] using hD.2.le) hu (ne_of_gt hD.1) exact he.of_subset_closure hc continuousOn_const Set.Ioo_subset_Icc_self (by rw [closure_Ioo (by norm_num : (0 : ℝ) ≠ 1 / 100)]) (by constructor <;> norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:144
theorem fairEquation_endpoint_exists Lemma fairEquation_endpoint_exists in the paper ↗

Every endpoint has an actual bracket root, with no off-axis restriction. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ 1 / 100
hu :
u = 0 ∨ u = 1
∃ p ∈ Ioo (3 / 10 : ℝ) (1 / 2), fairEquation t δ p u = 0
Proof (Lean source)
-- @node: fairEquation_endpoint_exists lemma fairEquation_endpoint_exists (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ 1 / 100) (hu : u = 0 ∨ u = 1) : ∃ p ∈ Ioo (3 / 10 : ℝ) (1 / 2), fairEquation t δ p u = 0 := ⟨2 / 5, by constructor <;> norm_num, fairEquation_endpoint_zero t δ u ht hδ hu⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_exists · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:176

[At either spatial endpoint the literal selected fair root is a genuine bracket zero, including zero effect and zero amplitude. the documented result Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ 1 / 100
hu :
u = 0 ∨ u = 1
conclusion 1
fairRoot t δ u ∈ Ioo (3 / 10 : ℝ) (1 / 2)
conclusion 2
fairEquation t δ (fairRoot t δ u) u = 0
Proof (Lean source)
-- @node: fairRoot_endpoint_spec lemma fairRoot_endpoint_spec (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ 1 / 100) (hu : u = 0 ∨ u = 1) : fairRoot t δ u ∈ Ioo (3 / 10 : ℝ) (1 / 2) ∧ fairEquation t δ (fairRoot t δ u) u = 0 := fairRoot_spec t δ u (fairEquation_endpoint_exists t δ u ht hδ hu)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_endpoint_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationContinuity.lean:184
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairEquationRegularity 6 declarations The Taylor identity gives joint smoothness away from the removable axes, including relative smoothness on the closed parameter box.

Regularity and endpoint roots of the fair equation

The Taylor identity gives joint smoothness away from the removable axes, including relative smoothness on the closed parameter box. At the cell endpoints it supplies actual bracket roots off the axes. Matching itself follows from the undivided Taylor identity, including both axes.

[The closed effect, signed amplitude, and centering box; position is unrestricted.

Definition (Lean source)
fairEquationParameterRegion :
Set (Fin 4 → ℝ)
{v | v 0 ∈ Icc (0 : ℝ) (1/4) ∧ |v 1| ≤ 1/100 ∧ v 2 ∈ Icc (3/10 : ℝ) (1/2)}
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquationParameterRegion · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationRegularity.lean:17
theorem fairEquation_contDiffWithinAt_off_axes

Off the axes the Taylor extension has the joint smoothness of its quotient, relative to the full closed calibration box. the documented result Under the stated assumptions.

Formal statement
v :
Fin 4 → ℝ
hne :
v 0 * v 1 ≠ 0
ContDiffWithinAt ℝ ⊤ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) fairEquationParameterRegion v
Proof (Lean source)
-- @node: fairEquation_contDiffWithinAt_off_axes lemma fairEquation_contDiffWithinAt_off_axes (v : Fin 4 → ℝ) (hv : v ∈ fairEquationParameterRegion) (hne : v 0 * v 1 ≠ 0) : ContDiffWithinAt ℝ ⊤ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) fairEquationParameterRegion v := by have hden : v 0 * (v 1)^2 ≠ 0 := mul_ne_zero (mul_ne_zero_iff.mp hne).1 (pow_ne_zero 2 (mul_ne_zero_iff.mp hne).2) have hquot : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => fairNumerator (w 0) (w 1) (w 2) (w 3) / (w 0 * (w 1)^2)) v := (fairNumerator_contDiffAt v hv.1 hv.2.1 hv.2.2).div (by fun_prop) hden have hevent : ∀ᶠ w : Fin 4 → ℝ in 𝓝 v, w 0 * w 1 ≠ 0 := (show ContinuousAt (fun w : Fin 4 → ℝ => w 0 * w 1) v by fun_prop).eventually_ne hne apply hquot.contDiffWithinAt.congr_of_eventuallyEq _ (fairEquation_eq_div _ _ _ _ hv.1 hv.2.1 hv.2.2 hne) filter_upwards [hevent.filter_mono nhdsWithin_le_nhds, self_mem_nhdsWithin] with w hw hbox exact fairEquation_eq_div _ _ _ _ hbox.1 hbox.2.1 hbox.2.2 hw
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_contDiffWithinAt_off_axes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationRegularity.lean:23
theorem fairEquation_contDiffAt_off_axes Lemma fairEquation_contDiffAt_off_axes in the paper ↗

At interior box points, off-axis smoothness holds on a full neighborhood. Under the stated assumptions. Under the stated assumptions.

Formal statement
v :
Fin 4 → ℝ
ht :
v 0 ∈ Ioo (0 : ℝ) (1/4)
hδ :
|v 1| < 1/100
hξ :
v 2 ∈ Ioo (3/10 : ℝ) (1/2)
hne :
v 0 * v 1 ≠ 0
ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) v
Proof (Lean source)
-- @node: fairEquation_contDiffAt_off_axes lemma fairEquation_contDiffAt_off_axes (v : Fin 4 → ℝ) (ht : v 0 ∈ Ioo (0 : ℝ) (1/4)) (hδ : |v 1| < 1/100) (hξ : v 2 ∈ Ioo (3/10 : ℝ) (1/2)) (hne : v 0 * v 1 ≠ 0) : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) v := by have hv : v ∈ fairEquationParameterRegion := ⟨⟨ht.1.le,ht.2.le⟩,hδ.le,⟨hξ.1.le,hξ.2.le⟩⟩ apply (fairEquation_contDiffWithinAt_off_axes v hv hne).contDiffAt have ht' : ∀ᶠ w : Fin 4 → ℝ in 𝓝 v, w 0 ∈ Ioo (0 : ℝ) (1/4) := (continuous_apply (0 : Fin 4)).continuousAt.eventually (isOpen_Ioo.mem_nhds ht) have hδ' : ∀ᶠ w : Fin 4 → ℝ in 𝓝 v, |w 1| < 1/100 := ((continuous_apply (1 : Fin 4)).continuousAt.abs).eventually (gt_mem_nhds hδ) have hξ' : ∀ᶠ w : Fin 4 → ℝ in 𝓝 v, w 2 ∈ Ioo (3/10 : ℝ) (1/2) := (continuous_apply (2 : Fin 4)).continuousAt.eventually (isOpen_Ioo.mem_nhds hξ) filter_upwards [ht',hδ',hξ'] with w hw hd hx exact ⟨⟨hw.1.le,hw.2.le⟩,hd.le,⟨hx.1.le,hx.2.le⟩⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_contDiffAt_off_axes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationRegularity.lean:43
theorem fairEquation_endpoint_zero_off_axes Lemma fairEquation_endpoint_zero_off_axes in the paper ↗

Endpoint matching supplies a root of the actual normalized equation off the axes. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hu :
u = 0 ∨ u = 1
hne :
t*δ ≠ 0
fairEquation t δ (2/5) u = 0
Proof (Lean source)
-- @node: fairEquation_endpoint_zero_off_axes lemma fairEquation_endpoint_zero_off_axes (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hu : u = 0 ∨ u = 1) (hne : t*δ ≠ 0) : fairEquation t δ (2/5) u = 0 := by rw [fairEquation_eq_div t δ (2/5) u ht hδ (by constructor <;> norm_num) hne, fairNumerator_endpoints t δ u ht hδ hu, zero_div]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_zero_off_axes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationRegularity.lean:65
theorem fairEquation_endpoint_exists_off_axes Lemma fairEquation_endpoint_exists_off_axes in the paper ↗

The endpoint root belongs to the prescribed open centering bracket. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hu :
u = 0 ∨ u = 1
hne :
t*δ ≠ 0
∃ p ∈ Ioo (3/10 : ℝ) (1/2), fairEquation t δ p u = 0
Proof (Lean source)
-- @node: fairEquation_endpoint_exists_off_axes lemma fairEquation_endpoint_exists_off_axes (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hu : u = 0 ∨ u = 1) (hne : t*δ ≠ 0) : ∃ p ∈ Ioo (3/10 : ℝ) (1/2), fairEquation t δ p u = 0 := by exact ⟨2/5, by constructor <;> norm_num, fairEquation_endpoint_zero_off_axes t δ u ht hδ hu hne⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoint_exists_off_axes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationRegularity.lean:74
theorem fair_matching_of_equation Lemma fair_matching_of_equation in the paper ↗

[Multiplying the normalized root equation gives matching without any division or exception for the effect and amplitude axes. the documented result Under the stated assumptions.

Formal statement
t δ ξ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hξ :
ξ ∈ Icc (3/10 : ℝ) (1/2)
he :
fairEquation t δ ξ u = 0
signAverage (fun s => riskShift t (ξ+δ*localSignField u s))
Proof (Lean source)
-- @node: fair_matching_of_equation lemma fair_matching_of_equation (t δ ξ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hξ : ξ ∈ Icc (3/10 : ℝ) (1/2)) (he : fairEquation t δ ξ u = 0) : signAverage (fun s => riskShift t (ξ+δ*localSignField u s)) = riskShift (comparatorEffect t δ) ξ := by apply sub_eq_zero.mp change fairNumerator t δ ξ u = 0 rw [← fairEquation_mul_parameters t δ ξ u ht hδ hξ, he, mul_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_matching_of_equation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationRegularity.lean:83
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairEquationSmoothness 7 declarations Compactness of the integration interval supplies uniform derivative bounds for parameter differentiation.

Smoothness of the fair Taylor equation through its axes

Compactness of the integration interval supplies uniform derivative bounds for parameter differentiation. Iterating this argument preserves every finite order of smoothness in the two Taylor integrations.

theorem calibration_parameter_fderiv_contDiffAt Lemma calibration_parameter_fderiv_contDiffAt in the paper ↗

The scalar integration coordinate is fixed when taking the parameter derivative. Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
E → ℝ → F
x :
E
y :
ℝ
hf :
ContDiffAt ℝ ∞ f.uncurry (x, y)
ContDiffAt ℝ ∞ (fun z : E × ℝ => fderiv ℝ (fun w => f w z.2) z.1) (x, y)
Proof (Lean source)
-- @node: calibration_parameter_fderiv_contDiffAt lemma calibration_parameter_fderiv_contDiffAt {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] (f : E → ℝ → F) (x : E) (y : ℝ) (hf : ContDiffAt ℝ ∞ f.uncurry (x, y)) : ContDiffAt ℝ ∞ (fun z : E × ℝ => fderiv ℝ (fun w => f w z.2) z.1) (x, y) := by have h := hf.comp ((x, y),x) (show ContDiffAt ℝ ∞ (fun z : (E × ℝ) × E => (z.2,z.1.2)) ((x, y),x) by fun_prop) exact h.fderiv (by fun_prop) (by simp)
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_parameter_fderiv_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationSmoothness.lean:17
theorem calibration_intervalIntegral_hasFDerivAt Lemma calibration_intervalIntegral_hasFDerivAt in the paper ↗

[Local joint differentiability on a compact interval justifies differentiation under the parameter integral, with a bound uniform in the integration coordinate. the documented result Under the stated assumptions.

Formal statement
f :
E → ℝ → F
x :
E
hf :
∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (x, y)
HasFDerivAt (fun z => ∫ y in (0 : ℝ)..1, f z y) (∫ y in (0 : ℝ)..1, fderiv ℝ (fun z => f z y) x) x
Proof (Lean source)
-- @node: calibration_intervalIntegral_hasFDerivAt lemma calibration_intervalIntegral_hasFDerivAt {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] (f : E → ℝ → F) (x : E) (hf : ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (x, y)) : HasFDerivAt (fun z => ∫ y in (0 : ℝ)..1, f z y) (∫ y in (0 : ℝ)..1, fderiv ℝ (fun z => f z y) x) x := by let f' : E → ℝ → E →L[ℝ] F := fun z y => fderiv ℝ (fun w => f w y) z have hpartial (y : ℝ) (hy : y ∈ Icc (0 : ℝ) 1) : ContinuousAt f'.uncurry (x, y) := by have h := (hf y hy).comp ((x, y),x) (show ContDiffAt ℝ 1 (fun z : (E × ℝ) × E => (z.2,z.1.2)) ((x, y),x) by fun_prop) exact (show ContDiffAt ℝ 0 f'.uncurry (x, y) from h.fderiv (by fun_prop) (by norm_num)).continuousAt have hbase : ContinuousOn (f' x) (Icc (0 : ℝ) 1) := by intro y hy exact ((hpartial y hy).comp (by fun_prop)).continuousWithinAt obtain ⟨B,hB⟩ := isCompact_Icc.bddAbove_image hbase.norm have hevent : ∀ᶠ z in 𝓝 x, ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (z,y) ∧ ‖f' z y‖ < B+1 := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro y hy exact ((hf y hy).eventually (by norm_num)).and ((hpartial y hy).norm.eventually (gt_mem_nhds (lt_of_le_of_lt (hB ⟨y,hy,rfl⟩) (lt_add_one B)))) let S := {z | ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (z,y) ∧ ‖f' z y‖ < B+1} have hS : S ∈ 𝓝 x := hevent have hslice (z : E) (hz : z ∈ S) : ContinuousOn (f z) (Icc (0 : ℝ) 1) := by intro y hy exact (((hz y hy).1.continuousAt).comp (by fun_prop)).continuousWithinAt apply hasFDerivAt_integral_of_dominated_of_fderiv_le'' hS · filter_upwards [hS] with z hz rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] exact ((hslice z hz).mono Set.Ioc_subset_Icc_self).aestronglyMeasurable measurableSet_Ioc · have hx : x ∈ S := mem_of_mem_nhds hS exact (hslice x hx).intervalIntegrable_of_Icc (by norm_num) · rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] exact (hbase.mono Set.Ioc_subset_Icc_self).aestronglyMeasurable measurableSet_Ioc · rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] filter_upwards [ae_restrict_mem measurableSet_Ioc] with y hy exact fun z hz => (hz y ⟨hy.1.le,hy.2⟩).2.le · exact intervalIntegrable_const · rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] filter_upwards [ae_restrict_mem measurableSet_Ioc] with y hy intro z hz exact (((hz y ⟨hy.1.le,hy.2⟩).1.differentiableAt (by norm_num)).comp z (show DifferentiableAt ℝ (fun w : E => (w,y)) z by fun_prop)).hasFDerivAt
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_intervalIntegral_hasFDerivAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationSmoothness.lean:29
theorem calibration_intervalIntegral_contDiffAt_nat Lemma calibration_intervalIntegral_contDiffAt_nat in the paper ↗

[Every finite derivative order passes through integration on the fixed compact interval. The induction differentiates the actual parameter family. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
f :
E → ℝ → F
x :
E
hf :
∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ ∞ f.uncurry (x, y)
ContDiffAt ℝ n (fun z => ∫ y in (0 : ℝ)..1, f z y) x
Proof (Lean source)
-- @node: calibration_intervalIntegral_contDiffAt_nat lemma calibration_intervalIntegral_contDiffAt_nat {E F : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] (n : ℕ) (f : E → ℝ → F) (x : E) (hf : ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ ∞ f.uncurry (x, y)) : ContDiffAt ℝ n (fun z => ∫ y in (0 : ℝ)..1, f z y) x := by induction n generalizing F f x with | zero => have hevent : ∀ᶠ z in 𝓝 x, ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (z,y) := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro y hy exact ((hf y hy).of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by norm_num) apply contDiffAt_zero.mpr exact ⟨{z | ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (z,y)}, hevent, fun z hz => (calibration_intervalIntegral_hasFDerivAt f z hz).continuousAt.continuousWithinAt⟩ | succ n ih => let f' : E → ℝ → E →L[ℝ] F := fun z y => fderiv ℝ (fun w => f w y) z have hevent : ∀ᶠ z in 𝓝 x, ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (z,y) := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro y hy exact ((hf y hy).of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by norm_num) apply contDiffAt_succ_iff_hasFDerivAt.mpr refine ⟨fun z => ∫ y in (0 : ℝ)..1, f' z y, ?_, ?_⟩ · exact ⟨{z | ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ 1 f.uncurry (z,y)}, hevent, fun z hz => calibration_intervalIntegral_hasFDerivAt f z hz⟩ · exact ih f' x (fun y hy => calibration_parameter_fderiv_contDiffAt f x y (hf y hy))
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_intervalIntegral_contDiffAt_nat · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationSmoothness.lean:81
theorem calibration_intervalIntegral_contDiffAt Lemma calibration_intervalIntegral_contDiffAt in the paper ↗

[Smoothness at all points above a compact integration interval gives smoothness of the parameter integral on a full neighborhood of the base parameter. the documented result Under the stated assumptions.

Formal statement
f :
E → ℝ → F
x :
E
hf :
∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ ∞ f.uncurry (x, y)
ContDiffAt ℝ ∞ (fun z => ∫ y in (0 : ℝ)..1, f z y) x
Proof (Lean source)
-- @node: calibration_intervalIntegral_contDiffAt lemma calibration_intervalIntegral_contDiffAt {E F : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] (f : E → ℝ → F) (x : E) (hf : ∀ y ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ ∞ f.uncurry (x, y)) : ContDiffAt ℝ ∞ (fun z => ∫ y in (0 : ℝ)..1, f z y) x := by apply contDiffAt_infty.mpr intro n exact calibration_intervalIntegral_contDiffAt_nat n f x hf
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_intervalIntegral_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationSmoothness.lean:114
theorem fairEquation_contDiffAt

[Both Taylor integrations preserve joint smoothness of the actual fair normalized equation, including both axes and every boundary of the closed box. the documented result Under the stated assumptions.

Formal statement
x :
Fin 4 → ℝ
ContDiffAt ℝ ∞ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) x
Proof (Lean source)
-- @node: fairEquation_contDiffAt lemma fairEquation_contDiffAt (x : Fin 4 → ℝ) (hx : x ∈ fairTaylorParameterRegion) : ContDiffAt ℝ ∞ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) x := by let F : ((Fin 4 → ℝ) × ℝ) → ℝ → ℝ := fun z v => (1-v)*deriv (fun T => deriv (deriv (fun D => fairNumerator T D (z.1 2) (z.1 3))) (v*z.1 1)) (z.2*z.1 0) apply calibration_intervalIntegral_contDiffAt intro s hs exact calibration_intervalIntegral_contDiffAt F (x,s) (fun v hv => (fairTaylorIntegrand_contDiffAt ((x,s),v) hx hs hv).of_le le_top)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationSmoothness.lean:127
theorem fairEquation_center_deriv_contDiffAt

The center partial derivative is jointly smooth also on the removable axes. Under the stated assumptions.

Formal statement
x :
Fin 4 → ℝ
ContDiffAt ℝ ∞ (fun w : Fin 4 → ℝ => deriv (fun ξ => fairEquation (w 0) (w 1) ξ (w 3)) (w 2)) x
Proof (Lean source)
-- @node: fairEquation_center_deriv_contDiffAt lemma fairEquation_center_deriv_contDiffAt (x : Fin 4 → ℝ) (hx : x ∈ fairTaylorParameterRegion) : ContDiffAt ℝ ∞ (fun w : Fin 4 → ℝ => deriv (fun ξ => fairEquation (w 0) (w 1) ξ (w 3)) (w 2)) x := by have hvec : ![x 0,x 1,x 2,x 3] = x := by funext i fin_cases i <;> rfl have h' := (fairEquation_contDiffAt x hx) rw [← hvec] at h' have hlift := h'.comp (x,x 2) (show ContDiffAt ℝ ∞ (fun z : (Fin 4 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 3]) (x,x 2) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) exact (hlift.fderiv (by fun_prop) (by simp)).clm_apply contDiffAt_const
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_center_deriv_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationSmoothness.lean:141
theorem fairEquation_uniform_derivative_bounds

Every fixed derivative order of the actual normalized equation is uniformly bounded on the same closed parameter box, with no excluded amplitude axis. the documented result

Formal statement
m :
ℕ
∃ B : ℝ,
0 < B
conclusion 1
x ∈ fairTaylorParameterRegion :
‖iteratedFDeriv ℝ m (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) x‖ ≤ B
Proof (Lean source)
-- @node: fairEquation_uniform_derivative_bounds lemma fairEquation_uniform_derivative_bounds (m : ℕ) : ∃ B : ℝ, 0 < B ∧ ∀ x ∈ fairTaylorParameterRegion, ‖iteratedFDeriv ℝ m (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) x‖ ≤ B := by have hc : ContinuousOn (iteratedFDeriv ℝ m (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3))) fairTaylorParameterRegion := by intro x hx exact ((fairEquation_contDiffAt x hx).continuousAt_iteratedFDeriv (WithTop.coe_le_coe.mpr le_top)).continuousWithinAt obtain ⟨C,hC⟩ := fairTaylorParameterRegion_isCompact.exists_bound_of_continuousOn hc refine ⟨max C 1, lt_of_lt_of_le (by norm_num) (le_max_right _ _), ?_⟩ intro x hx exact (hC x hx).trans (le_max_left _ _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairEquationSmoothness.lean:160
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairMixtureParity 16 declarations Simultaneous reversal of endpoint signs proves evenness of the actual fair component likelihoods, including all substituted roots and totalization.

Fair component cancellation through zero amplitude

Simultaneous reversal of endpoint signs proves evenness of the actual fair component likelihoods, including all substituted roots and totalization. Their difference from the comparator vanishes to first order at zero, as required by the quadratic Taylor step in the original-record mixture proof.

theorem fairCells_neg_amplitude_reverse Lemma fairCells_neg_amplitude_reverse in the paper ↗

[Negating the fair amplitude reverses every endpoint sign in the random table. the stated conclusion holds.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
fairCells true k σ t (-δ) = fairCells true k (fun i => !(σ i)) t δ
Proof (Lean source)
-- @node: fairCells_neg_amplitude_reverse lemma fairCells_neg_amplitude_reverse (k : ℕ) (σ : Fin (k + 1) → Bool) (t δ : ℝ) : fairCells true k σ t (-δ) = fairCells true k (fun i => !(σ i)) t δ := by funext a y x simp only [fairCells, fairRoot_even, signFieldZ_reverse, neg_mul, mul_neg, if_true]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_neg_amplitude_reverse · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:19
theorem fairCells_comparator_even Lemma fairCells_comparator_even in the paper ↗

The comparator table is even in the amplitude, with its actual root substituted. the stated conclusion holds.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
fairCells false k σ t (-δ) = fairCells false k σ t δ
Proof (Lean source)
-- @node: fairCells_comparator_even lemma fairCells_comparator_even (k : ℕ) (σ : Fin (k + 1) → Bool) (t δ : ℝ) : fairCells false k σ t (-δ) = fairCells false k σ t δ := by funext a y x simp [fairCells, fairRoot_even, comparatorEffect_even]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_comparator_even · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:26
theorem fairLaw_neg_amplitude_reverse Lemma fairLaw_neg_amplitude_reverse in the paper ↗

Sign reversal identifies actual observed laws, including the fallback law. the stated conclusion holds.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
fairLaw k σ t (-δ) = fairLaw k (fun i => !(σ i)) t δ
Proof (Lean source)
-- @node: fairLaw_neg_amplitude_reverse lemma fairLaw_neg_amplitude_reverse (k : ℕ) (σ : Fin (k + 1) → Bool) (t δ : ℝ) : fairLaw k σ t (-δ) = fairLaw k (fun i => !(σ i)) t δ := by simp only [fairLaw, fairCells_neg_amplitude_reverse]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairLaw_neg_amplitude_reverse · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:33

The actual observed comparator law is even in its amplitude. the stated conclusion holds.

Formal statement
k :
ℕ
t δ :
ℝ
fairComparator k t (-δ) = fairComparator k t δ
Proof (Lean source)
-- @node: fairComparator_even lemma fairComparator_even (k : ℕ) (t δ : ℝ) : fairComparator k t (-δ) = fairComparator k t δ := by simp only [fairComparator, fairCells_comparator_even]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComparator_even · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:39

The entire finite-prior sample measure is even, without revealing any signs. the stated conclusion holds.

Formal statement
n k :
ℕ
t δ :
ℝ
fairMixture n k t (-δ) = fairMixture n k t δ
Proof (Lean source)
-- @node: fairMixture_even lemma fairMixture_even (n k : ℕ) (t δ : ℝ) : fairMixture n k t (-δ) = fairMixture n k t δ := by unfold fairMixture finiteSignMixture simp only [fairLaw_neg_amplitude_reverse] congr 1 exact endpointSign_prior_reverse k (fun σ => iidLaw (fairLaw k σ t δ).measure n)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairMixture_even · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:45

Actual likelihood difference on any selected block of original records. The sign prior remains hidden and all records in the block share its draw.

Definition (Lean source)
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
δ :
ℝ
fairComponentDifference k I t o δ :
ℝ
(card (Fin (k + 1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k + 1) → Bool, ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i))
- ∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:55
theorem fairComponentDifference_even

Every block mixture difference is even by reversal of the shared sign prior. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
δ :
ℝ
Proof (Lean source)
-- @node: fairComponentDifference_even lemma fairComponentDifference_even {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) (δ : ℝ) : fairComponentDifference k I t o (-δ) = fairComponentDifference k I t o δ := by unfold fairComponentDifference rw [fairComparator_even] simp only [fairLaw_neg_amplitude_reverse] rw [endpointSign_prior_reverse k (fun σ => ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference_even · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:64
theorem fairComponentDifference_zero

At zero amplitude every block mixture equals its product comparator. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
Proof (Lean source)
-- @node: fairComponentDifference_zero lemma fairComponentDifference_zero {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) : fairComponentDifference k I t o 0 = 0 := by have hdraw (σ : Fin (k + 1) → Bool) : fairLaw k σ t 0 = fairComparator k t 0 := by simp only [fairLaw, fairComparator, fairCells_zero_amplitude] have hcard : (card (Fin (k + 1) → Bool) : ℝ) ≠ 0 := by positivity simp only [fairComponentDifference, hdraw, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] rw [← mul_assoc, inv_mul_cancel₀ hcard, one_mul, sub_self]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:75
theorem mixture_even_deriv_zero Lemma mixture_even_deriv_zero in the paper ↗

An even real function has zero totalized derivative at zero. This also covers nondifferentiable inputs, where Lean's derivative is defined as zero. the documented result Under the stated assumptions.

Formal statement
f :
ℝ → ℝ
hf :
∀ δ, f (-δ) = f δ
deriv f 0 = 0
Proof (Lean source)
-- @node: mixture_even_deriv_zero lemma mixture_even_deriv_zero (f : ℝ → ℝ) (hf : ∀ δ, f (-δ) = f δ) : deriv f 0 = 0 := by have he : (fun δ => f (-δ)) = f := funext hf have h := deriv_comp_neg f 0 rw [he] at h simp only [neg_zero] at h linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_even_deriv_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:86
theorem fairComponentDifference_deriv_zero

[The linear term of every actual fair block difference vanishes. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
Proof (Lean source)
-- @node: fairComponentDifference_deriv_zero lemma fairComponentDifference_deriv_zero {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) : deriv (fairComponentDifference k I t o) 0 = 0 := by exact mixture_even_deriv_zero _ (fairComponentDifference_even k I t o)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference_deriv_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:97
theorem mixture_even_quadratic_bound Lemma mixture_even_quadratic_bound in the paper ↗

The signed second-order Taylor bound when the constant and linear terms vanish. Evenness permits the same positive-interval argument for both signs. the documented result Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
f :
ℝ → ℝ
δ C :
ℝ
_hC :
0 ≤ C
heven :
∀ x, f (-x) = f x
hzero :
f 0 = 0
hlinear :
hSmooth :
ContDiffOn ℝ 2 f (Icc 0 |δ|)
hSecond :
∀ x ∈ Ioo 0 |δ|, |iteratedDeriv 2 f x| ≤ C
|f δ| ≤ C * δ ^ 2 / 2
Proof (Lean source)
-- @node: mixture_even_quadratic_bound lemma mixture_even_quadratic_bound (f : ℝ → ℝ) (δ C : ℝ) (_hC : 0 ≤ C) (heven : ∀ x, f (-x) = f x) (hzero : f 0 = 0) (hlinear : HasDerivAt f 0 0) (hSmooth : ContDiffOn ℝ 2 f (Icc 0 |δ|)) (hSecond : ∀ x ∈ Ioo 0 |δ|, |iteratedDeriv 2 f x| ≤ C) : |f δ| ≤ C * δ ^ 2 / 2 := by by_cases hδ : δ = 0 · subst δ simp [hzero] have hp : 0 < |δ| := abs_pos.mpr hδ have hWithin : derivWithin f (Icc 0 |δ|) 0 = 0 := hlinear.hasDerivWithinAt.derivWithin ((uniqueDiffOn_Icc hp) 0 ⟨le_rfl, hp.le⟩) have hTaylor : taylorWithinEval f 1 (Icc 0 |δ|) 0 |δ| = 0 := by rw [show (1 : ℕ) = 0 + 1 from rfl, taylorWithinEval_succ] simp only [Nat.zero_add, taylor_within_zero_eval, iteratedDerivWithin_one, hzero, hWithin, smul_zero, add_zero] have hs : ContDiffOn ℝ 2 f (uIcc 0 |δ|) := by simpa only [Set.uIcc_of_le hp.le] using hSmooth obtain ⟨x, hx, hrem⟩ := taylor_mean_remainder_lagrange_iteratedDeriv (n := 1) (x₀ := 0) (x := |δ|) hp.ne hs rw [Set.uIoo_of_lt hp] at hx rw [Set.uIcc_of_le hp.le] at hrem have he : f |δ| = f δ := by rcases le_total 0 δ with hd | hd · rw [abs_of_nonneg hd] · rw [abs_of_nonpos hd, heven] rw [hTaylor, sub_zero, sub_zero] at hrem calc |f δ| = |iteratedDeriv 2 f x| * δ^2 / 2 := by rw [← he, hrem] norm_num [abs_mul, abs_div, sq_abs, abs_pow] _ ≤ C * δ ^ 2 / 2 := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right (hSecond x hx) (sq_nonneg δ)) (by norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_even_quadratic_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:103
theorem fairComponentDifference_quadratic_bound

[Applying Taylor to the actual block difference needs only its smoothness and second-derivative estimate; the two zero terms are already proved. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
δ C :
ℝ
hC :
0 ≤ C
hDiff :
hSmooth :
ContDiffOn ℝ 2 (fairComponentDifference k I t o) (Icc 0 |δ|)
hSecond :
∀ x ∈ Ioo 0 |δ|, |iteratedDeriv 2 (fairComponentDifference k I t o) x| ≤ C
|fairComponentDifference k I t o δ| ≤ C * δ ^ 2 / 2
Proof (Lean source)
-- @node: fairComponentDifference_quadratic_bound lemma fairComponentDifference_quadratic_bound {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) (δ C : ℝ) (hC : 0 ≤ C) (hDiff : DifferentiableAt ℝ (fairComponentDifference k I t o) 0) (hSmooth : ContDiffOn ℝ 2 (fairComponentDifference k I t o) (Icc 0 |δ|)) (hSecond : ∀ x ∈ Ioo 0 |δ|, |iteratedDeriv 2 (fairComponentDifference k I t o) x| ≤ C) : |fairComponentDifference k I t o δ| ≤ C * δ ^ 2 / 2 := by have hlinear := hDiff.hasDerivAt rw [fairComponentDifference_deriv_zero] at hlinear exact mixture_even_quadratic_bound _ δ C hC (fairComponentDifference_even k I t o) (fairComponentDifference_zero k I t o) hlinear hSmooth hSecond
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference_quadratic_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:139
theorem fairComponentDifference_taylor_bound

[The actual fair component Taylor estimate has the roadmap's coefficient. The product differentiation bound is kept as an explicit remaining input. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
δ M :
ℝ
hDiff :
hSmooth :
ContDiffOn ℝ 2 (fairComponentDifference k I t o) (Icc 0 |δ|)
hSecond :
∀ x ∈ Ioo 0 |δ|,
≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card
|fairComponentDifference k I t o δ| ≤ M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card * δ ^ 2
Proof (Lean source)
-- @node: fairComponentDifference_taylor_bound lemma fairComponentDifference_taylor_bound {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) (δ M : ℝ) (hDiff : DifferentiableAt ℝ (fairComponentDifference k I t o) 0) (hSmooth : ContDiffOn ℝ 2 (fairComponentDifference k I t o) (Icc 0 |δ|)) (hSecond : ∀ x ∈ Ioo 0 |δ|, |iteratedDeriv 2 (fairComponentDifference k I t o) x| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card) : |fairComponentDifference k I t o δ| ≤ M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card * δ ^ 2 := by apply (fairComponentDifference_quadratic_bound k I t o δ _ (by positivity) hDiff hSmooth hSecond).trans_eq ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference_taylor_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:155
theorem fairComponentDifference_singleton

Exact singleton matching removes any one-record block, throughout the support neighborhood and including the original observed cells. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
i :
Fin n
t :
ℝ
o :
Fin n → Record
δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ calibEps
fairComponentDifference k {i} t o δ = 0
Proof (Lean source)
-- @node: fairComponentDifference_singleton lemma fairComponentDifference_singleton {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (i : Fin n) (t : ℝ) (o : Fin n → Record) (δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ calibEps) : fairComponentDifference k {i} t o δ = 0 := by simp only [fairComponentDifference, Finset.prod_singleton, recordCellDensity, ← Finset.mul_sum] have hmatch := (calib_singletons_spec k hk).2 t δ ht hδ (o i).2.1 (o i).2.2 (o i).1 calc _ = 4 * ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, (fairLaw k σ t δ).cells (o i).2.1 (o i).2.2 (o i).1) - 4 * (fairComparator k t δ).cells (o i).2.1 (o i).2.2 (o i).1 := by ring _ = 0 := by rw [hmatch]; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference_singleton · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:171
theorem mixture_average_product_lower Lemma mixture_average_product_lower in the paper ↗

[Averaging products of densities with the common half-unit floor preserves the component floor, despite dependence among records through the hidden signs. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
f :
(Fin (k + 1) → Bool) → Fin n → ℝ
hf :
∀ σ i
if
i ∈ I
then
(1 / 2 : ℝ) ≤ f σ i
((2 : ℝ) ^ I.card)⁻¹ ≤ (card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, f σ i
Proof (Lean source)
-- @node: mixture_average_product_lower lemma mixture_average_product_lower {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (f : (Fin (k + 1) → Bool) → Fin n → ℝ) (hf : ∀ σ i, i ∈ I → (1 / 2 : ℝ) ≤ f σ i) : ((2 : ℝ) ^ I.card)⁻¹ ≤ (card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, f σ i := by have hprod (σ : Fin (k + 1) → Bool) : ((2 : ℝ) ^ I.card)⁻¹ ≤ ∏ i ∈ I, f σ i := by calc _ = ∏ _i ∈ I, (1 / 2 : ℝ) := by simp [one_div, inv_pow] _ ≤ _ := Finset.prod_le_prod (fun _ _ => by norm_num) (hf σ) have hsum := Finset.sum_le_sum (fun σ (_ : σ ∈ univ) => hprod σ) have hcard : (card (Fin (k + 1) → Bool) : ℝ) ≠ 0 := by positivity have hscaled := mul_le_mul_of_nonneg_left hsum (by positivity : 0 ≤ (card (Fin (k + 1) → Bool) : ℝ)⁻¹) simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, ← mul_assoc, inv_mul_cancel₀ hcard, one_mul] using hscaled
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_average_product_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:188
theorem fair_component_hellinger_taylor_bound

The actual fair component square-root discrepancy follows from its Taylor bound and one-record density floors, with the precise exponential coefficient. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
δ M :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ 1 / 100
hDiff :
hSmooth :
ContDiffOn ℝ 2 (fairComponentDifference k I t o) (Icc 0 |δ|)
hSecond :
∀ x ∈ Ioo 0 |δ|,
≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card
(sqrt ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i)) - sqrt (∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i))) ^ 2
≤ M ^ 4 * (I.card : ℝ) ^ 4 * 8 ^ I.card * δ ^ 4
Proof (Lean source)
-- @node: fair_component_hellinger_taylor_bound lemma fair_component_hellinger_taylor_bound {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) (δ M : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ 1 / 100) (hDiff : DifferentiableAt ℝ (fairComponentDifference k I t o) 0) (hSmooth : ContDiffOn ℝ 2 (fairComponentDifference k I t o) (Icc 0 |δ|)) (hSecond : ∀ x ∈ Ioo 0 |δ|, |iteratedDeriv 2 (fairComponentDifference k I t o) x| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card) : (sqrt ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i)) - sqrt (∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i))) ^ 2 ≤ M ^ 4 * (I.card : ℝ) ^ 4 * 8 ^ I.card * δ ^ 4 := by have hfloor (σ : Fin (k + 1) → Bool) (i : Fin n) : (1 / 2 : ℝ) ≤ recordCellDensity (fairLaw k σ t δ) (o i) := (fairDensity_bounds true k σ t δ ht hδ (o i).2.1 (o i).2.2 (o i).1).1 have hcomp (i : Fin n) : (1 / 2 : ℝ) ≤ recordCellDensity (fairComparator k t δ) (o i) := (fairDensity_bounds false k (fun _ => false) t δ ht hδ (o i).2.1 (o i).2.2 (o i).1).1 have hFlo := mixture_average_product_lower k I (fun σ i => recordCellDensity (fairLaw k σ t δ) (o i)) (fun σ i _ => hfloor σ i) have hGlo : ((2 : ℝ) ^ I.card)⁻¹ ≤ ∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i) := by calc _ = ∏ _i ∈ I, (1 / 2 : ℝ) := by simp [one_div, inv_pow] _ ≤ _ := Finset.prod_le_prod (fun _ _ => by norm_num) (fun i _ => hcomp i) have hTaylor := fairComponentDifference_taylor_bound k I t o δ M hDiff hSmooth hSecond have hDifference : |fairComponentDifference k I t o δ| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card * |δ ^ 2| := by rw [abs_of_nonneg (sq_nonneg δ)] nlinarith [sq_nonneg M, mul_nonneg (by positivity : 0 ≤ M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card) (sq_nonneg δ)] have h := mixture_component_pointwise_bound I.card M (δ ^ 2) _ _ hFlo hGlo hDifference convert h using 1 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_component_hellinger_taylor_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairMixtureParity.lean:208
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairNumeratorSmoothness 6 declarations The numerator is smooth on full neighborhoods of the closed effect range, small signed amplitudes, and the entire centering bracket.

Smooth fair numerator and Taylor-axis cancellations

The numerator is smooth on full neighborhoods of the closed effect range, small signed amplitudes, and the entire centering bracket. Sign symmetry kills its first amplitude derivative at zero; the zero-effect identity kills every amplitude derivative there. These are inputs to the two Taylor divisions.

theorem fairNumerator_shifted_risk_pos Lemma fairNumerator_shifted_risk_pos in the paper ↗

The shifted centering risk remains positive uniformly over the sign law. Under the stated assumptions. Under the stated assumptions.

Formal statement
δ ξ u :
ℝ
s :
hδ :
|δ| ≤ 1 / 100
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
0 < ξ + δ * localSignField u s
Proof (Lean source)
-- @node: fairNumerator_shifted_risk_pos lemma fairNumerator_shifted_risk_pos (δ ξ u : ℝ) (s : Bool × Bool) (hδ : |δ| ≤ 1 / 100) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) : 0 < ξ + δ * localSignField u s := by have hprod : |δ * localSignField u s| ≤ 1 / 50 := by rw [abs_mul] calc _ ≤ (1 / 100 : ℝ) * 2 := mul_le_mul hδ (localSignField_abs_le_two u s) (abs_nonneg _) (by norm_num) _ = _ := by norm_num linarith [(abs_le.mp hprod).1, hξ.1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_shifted_risk_pos · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairNumeratorSmoothness.lean:17
theorem fairNumerator_contDiffAt Lemma fairNumerator_contDiffAt in the paper ↗

Smoothness concerns the actual numerator, jointly in all four variables. Under the stated assumptions. Under the stated assumptions.

Formal statement
v :
Fin 4 → ℝ
ht :
v 0 ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|v 1| ≤ 1 / 100
hξ :
v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)
ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => fairNumerator (w 0) (w 1) (w 2) (w 3)) v
Proof (Lean source)
-- @node: fairNumerator_contDiffAt lemma fairNumerator_contDiffAt (v : Fin 4 → ℝ) (ht : v 0 ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |v 1| ≤ 1 / 100) (hξ : v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)) : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => fairNumerator (w 0) (w 1) (w 2) (w 3)) v := by have hT : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => comparatorEffect (w 0) (w 1)) v := by have hp : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => ![w 0,w 1]) v := by apply contDiffAt_pi.mpr intro i fin_cases i <;> change ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => w _) v <;> fun_prop exact (comparatorEffect_contDiffAt ![v 0,v 1] ht hδ).comp v hp unfold fairNumerator signAverage apply ContDiffAt.sub · apply ContDiffAt.mul contDiffAt_const apply ContDiffAt.sum intro s hs unfold riskShift localSignField apply ContDiffAt.div · fun_prop · fun_prop · exact ne_of_gt (riskShift_denominator_pos (v 0) (v 2 + v 1 * localSignField (v 3) s) ht.1 (fairNumerator_shifted_risk_pos _ _ _ s hδ hξ).le) · unfold riskShift apply ContDiffAt.div · fun_prop · fun_prop · have hTpos : 0 ≤ comparatorEffect (v 0) (v 1) := by linarith [(comparatorEffect_range_bounds _ _ ht hδ).1, ht.1] exact ne_of_gt (riskShift_denominator_pos _ _ hTpos (by linarith [hξ.1]))
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairNumeratorSmoothness.lean:30
theorem fairNumerator_deriv_zero_amplitude Lemma fairNumerator_deriv_zero_amplitude in the paper ↗

Evenness gives the missing linear Taylor coefficient without excluding the axes. the stated conclusion holds.

Formal statement
t ξ u :
ℝ
deriv (fun δ => fairNumerator t δ ξ u) 0 = 0
Proof (Lean source)
-- @node: fairNumerator_deriv_zero_amplitude lemma fairNumerator_deriv_zero_amplitude (t ξ u : ℝ) : deriv (fun δ => fairNumerator t δ ξ u) 0 = 0 := by have he : (fun δ => fairNumerator t (-δ) ξ u) = (fun δ => fairNumerator t δ ξ u) := funext (fun δ => fairNumerator_even t δ ξ u) have h := deriv_comp_neg (fun δ => fairNumerator t δ ξ u) 0 rw [he] at h simp only [neg_zero] at h linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_deriv_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairNumeratorSmoothness.lean:62
theorem fairNumerator_second_deriv_zero_effect Lemma fairNumerator_second_deriv_zero_effect in the paper ↗

At zero effect the whole second amplitude-derivative function vanishes. the stated conclusion holds.

Formal statement
δ ξ u :
ℝ
deriv (deriv (fun D => fairNumerator 0 D ξ u)) δ = 0
Proof (Lean source)
-- @node: fairNumerator_second_deriv_zero_effect lemma fairNumerator_second_deriv_zero_effect (δ ξ u : ℝ) : deriv (deriv (fun D => fairNumerator 0 D ξ u)) δ = 0 := by simp only [fairNumerator_zero_effect] have he : deriv (fun _ : ℝ => (0 : ℝ)) = fun _ => 0 := funext (fun x => deriv_const x 0) rw [he] exact deriv_const δ 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_second_deriv_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairNumeratorSmoothness.lean:73
theorem fairNumerator_hasDerivAt_zero_amplitude Lemma fairNumerator_hasDerivAt_zero_amplitude in the paper ↗

The zero linear coefficient is an actual derivative at every allowed effect and center, rather than only the value of a totalized derivative. the documented result Under the stated assumptions.

Formal statement
t ξ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
HasDerivAt (fun δ => fairNumerator t δ ξ u) 0 0
Proof (Lean source)
-- @node: fairNumerator_hasDerivAt_zero_amplitude lemma fairNumerator_hasDerivAt_zero_amplitude (t ξ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) : HasDerivAt (fun δ => fairNumerator t δ ξ u) 0 0 := by have hp : ContDiffAt ℝ ⊤ (fun δ : ℝ => ![t,δ,ξ,u]) 0 := by apply contDiffAt_pi.mpr intro i fin_cases i · change ContDiffAt ℝ ⊤ (fun _ : ℝ => t) 0 fun_prop · change ContDiffAt ℝ ⊤ (fun δ : ℝ => δ) 0 fun_prop · change ContDiffAt ℝ ⊤ (fun _ : ℝ => ξ) 0 fun_prop · change ContDiffAt ℝ ⊤ (fun _ : ℝ => u) 0 fun_prop have hf := (fairNumerator_contDiffAt ![t,0,ξ,u] ht (by norm_num) hξ).comp 0 hp have hd : DifferentiableAt ℝ (fun δ => fairNumerator t δ ξ u) 0 := hf.differentiableAt (by simp) simpa only [fairNumerator_deriv_zero_amplitude] using hd.hasDerivAt
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_hasDerivAt_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairNumeratorSmoothness.lean:83
theorem fairNumerator_uniform_derivative_bounds Lemma fairNumerator_uniform_derivative_bounds in the paper ↗

Every fixed-order derivative of the actual numerator has one absolute bound on the full closed effect, signed amplitude, center, and coordinate box. the documented result

Formal statement
m :
ℕ
shared
m :
ℕ
∃ B : ℝ,
0 < B
conclusion 1
v :
Fin 4 → ℝ
v 0 ∈ Icc (0 : ℝ) (1 / 4)
|v 1| ≤ 1 / 100
v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)
v 3 ∈ Icc (0 : ℝ) 1
‖iteratedFDeriv ℝ m (fun w : Fin 4 → ℝ => fairNumerator (w 0) (w 1) (w 2) (w 3)) v‖ ≤ B
Proof (Lean source)
-- @node: fairNumerator_uniform_derivative_bounds lemma fairNumerator_uniform_derivative_bounds : ∀ m : ℕ, ∃ B : ℝ, 0 < B ∧ ∀ v : Fin 4 → ℝ, v 0 ∈ Icc (0 : ℝ) (1 / 4) → |v 1| ≤ 1 / 100 → v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2) → v 3 ∈ Icc (0 : ℝ) 1 → ‖iteratedFDeriv ℝ m (fun w : Fin 4 → ℝ => fairNumerator (w 0) (w 1) (w 2) (w 3)) v‖ ≤ B := by let K : Set (Fin 4 → ℝ) := pi univ (fun i => if i = 0 then Icc (0 : ℝ) (1 / 4) else if i = 1 then Icc (-(1 / 100 : ℝ)) (1 / 100) else if i = 2 then Icc (3 / 10 : ℝ) (1 / 2) else Icc (0 : ℝ) 1) have hK : IsCompact K := isCompact_univ_pi (fun i => by split · exact isCompact_Icc · split · exact isCompact_Icc · split <;> exact isCompact_Icc) have hmem (v : Fin 4 → ℝ) : v ∈ K ↔ v 0 ∈ Icc (0 : ℝ) (1 / 4) ∧ |v 1| ≤ 1 / 100 ∧ v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2) ∧ v 3 ∈ Icc (0 : ℝ) 1 := by simp only [K, Set.mem_pi, Set.mem_univ, forall_const] constructor · intro h exact ⟨by simpa using h 0, abs_le.mpr (by simpa using h 1), by simpa using h 2, by simpa using h 3⟩ · rintro ⟨ht,hδ,hξ,hu⟩ i fin_cases i · simpa using ht · simpa using abs_le.mp hδ · simpa using hξ · simpa using hu intro m obtain ⟨B,hB,hBound⟩ := compact_smooth_derivative_bounds 4 _ K hK (fun v hv => fairNumerator_contDiffAt v (hmem v |>.mp hv).1 (hmem v |>.mp hv).2.1 (hmem v |>.mp hv).2.2.1) m exact ⟨B,hB,fun v ht hδ hξ hu => hBound v ((hmem v).mpr ⟨ht,hδ,hξ,hu⟩)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_uniform_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairNumeratorSmoothness.lean:107
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairOpenNeighbourhood 2 declarations The implicit equation supplies genuine roots on ambient neighborhoods of the zero-amplitude effect and spatial rectangle.

Common open fair-calibration neighborhood

The implicit equation supplies genuine roots on ambient neighborhoods of the zero-amplitude effect and spatial rectangle. Persistent bracket uniqueness identifies the actual selector there. Compactness then puts a closed signed amplitude box inside one open set for the root and every substituted cell.

theorem fairCalibrationZero_eventually_zero_smooth Lemma fairCalibrationZero_eventually_zero_smooth in the paper ↗

At zero amplitude the fair selector remains a genuine, unique narrow-bracket root on a full ambient parameter neighborhood. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hu :
u ∈ Icc (0 : ℝ) 1
∀ᶠ v : Fin 3 → ℝ in 𝓝 ![t,0,u], FairCalibrationZero (1/20) v ∧ ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v
Proof (Lean source)
-- @node: fairCalibrationZero_eventually_zero_smooth lemma fairCalibrationZero_eventually_zero_smooth (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hu : u ∈ Icc (0 : ℝ) 1) : ∀ᶠ v : Fin 3 → ℝ in 𝓝 ![t,0,u], FairCalibrationZero (1/20) v ∧ ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v := by obtain ⟨r,hr,hrsmall,hpos⟩ := fairEquation_uniform_center_slope_pos obtain ⟨a,ha,hasmall,hconf⟩ := fairEquation_uniform_root_confined r hr have hUnique := fairEquation_eventually_unique_of_center_control t 0 u r ht (by norm_num) hu hr hrsmall (fun x hx => hpos t 0 x u ht (by simpa using hr.le) (abs_le.mpr ⟨by linarith [hx.1],by linarith [hx.2]⟩) hu) (fun x hx he => hconf t 0 u x ht (by simpa using ha.le) hu hx he) let F : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => fairEquation (z.1 0) (z.1 1) z.2 (z.1 2) have hx : ![t,0,2/5,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨ht,by norm_num,by change (2/5 : ℝ) ∈ Icc (3/10) (1/2) constructor <;> norm_num,hu⟩ have hFevent : ∀ᶠ z : (Fin 3 → ℝ) × ℝ in 𝓝 (![t,0,u],2/5), ContDiffAt ℝ ∞ F z := by have he := (by fun_prop : ContinuousAt (fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) (![t,0,u],2/5)) (fairEquation_eventually_contDiffAt _ hx) filter_upwards [he] with z hz change ContDiffAt ℝ ∞ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) ![z.1 0,z.1 1,z.2,z.1 2] at hz exact hz.comp (f := fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) z (by apply contDiffAt_pi.mpr; intro i; fin_cases i <;> dsimp <;> fun_prop) obtain ⟨D,hDsub,hDopen,hDbase⟩ := mem_nhds_iff.mp hFevent have hSmooth : ContDiffOn ℝ ∞ F D := by intro z hz have hh : ContDiffAt ℝ ∞ F z := hDsub hz exact hh.contDiffWithinAt obtain ⟨U,V,g,hU,hbU,hV,hbV,hUV,hg,hgBase,hgRange,hgGraph⟩ := scalar_infty_implicit_function 3 F D ![t,0,u] (2/5) hDopen hDbase hSmooth (fairEquation_zero_amplitude_center t u ht) (ne_of_gt (fairEquation_center_slope_pos t u ht hu)) have hRange : ∀ᶠ v in 𝓝 ![t,0,u], g v ∈ Ioo ((2/5 : ℝ)-1/20) (2/5+1/20) := (hg.contDiffAt (hU.mem_nhds hbU)).continuousAt (by rw [hgBase]; exact isOpen_Ioo.mem_nhds (by constructor <;> norm_num)) have hevent : (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) =ᶠ[𝓝 ![t,0,u]] g := by filter_upwards [hU.mem_nhds hbU,hRange,hUnique] with v hv hgv huniq have hwide : g v ∈ Ioo (3/10 : ℝ) (1/2) := by constructor <;> linarith [hgv.1,hgv.2] have hz : fairEquation (v 0) (v 1) (g v) (v 2) = 0 := (hgGraph v hv (g v) (hgRange v hv)).mpr rfl have hs := fairRoot_spec (v 0) (v 1) (v 2) ⟨g v,hwide,hz⟩ exact huniq _ hs.1 _ hwide hs.2 hz filter_upwards [hU.mem_nhds hbU,hRange,hUnique,hevent,hevent.eventually_nhds] with v hv hgv huniq he heNear have hwide : g v ∈ Ioo (3/10 : ℝ) (1/2) := by constructor <;> linarith [hgv.1,hgv.2] have hz : fairEquation (v 0) (v 1) (g v) (v 2) = 0 := (hgGraph v hv (g v) (hgRange v hv)).mpr rfl have hs := fairRoot_spec (v 0) (v 1) (v 2) ⟨g v,hwide,hz⟩ refine ⟨⟨he.symm ▸ hgv,hs.1,hs.2,?_⟩,?_⟩ · intro p hp hep have hpwide : p ∈ Ioo (3/10 : ℝ) (1/2) := by constructor <;> linarith [hp.1,hp.2] exact huniq _ hpwide _ hs.1 hep hs.2 · exact (hg.contDiffAt (hU.mem_nhds hv)).congr_of_eventuallyEq heNear
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCalibrationZero_eventually_zero_smooth · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairOpenNeighbourhood.lean:17
theorem fair_calibration_open_neighbourhood Lemma fair_calibration_open_neighbourhood in the paper ↗

One open set contains a positive closed signed amplitude box over the entire fair effect and spatial ranges, with unique roots and smooth actual cells. the documented result

Formal statement
∃ ε : ℝ, ∃ V : Set (Fin 3 → ℝ),
0 < ε
conclusion 1
v ∈ V :
conclusion 2
ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => fairRoot (v 0) (v 1) (v 2)) V
conclusion 3
b s a y :
ContDiffOn ℝ ∞ (localFairCell b s a y) V
Proof (Lean source)
-- @node: fair_calibration_open_neighbourhood lemma fair_calibration_open_neighbourhood : ∃ ε : ℝ, ∃ V : Set (Fin 3 → ℝ), 0 < ε ∧ IsOpen V ∧ fairParameterRegion ε ⊆ V ∧ (∀ v ∈ V, FairCalibrationZero (1/20) v) ∧ ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => fairRoot (v 0) (v 1) (v 2)) V ∧ (∀ b s a y, ContDiffOn ℝ ∞ (localFairCell b s a y) V) := by let S : Set (Fin 3 → ℝ) := {v | FairCalibrationZero (1/20) v ∧ ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v ∧ ∀ b s a y, ContDiffAt ℝ ∞ (localFairCell b s a y) v} let V := interior S have hbase (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hu : u ∈ Icc (0 : ℝ) 1) : ![t,0,u] ∈ V := by have hzero := fairCalibrationZero_eventually_zero_smooth t u ht hu have hroot := hzero.mono (fun v hv => hv.2) have hq := hroot.self_of_nhds have hcells : ∀ᶠ v in 𝓝 ![t,0,u], ∀ b s a y, ContDiffAt ℝ ∞ (localFairCell b s a y) v := by simp only [Filter.eventually_all] intro b s a y exact localFairCell_eventually_contDiffAt_of_root t u ht hq.continuousAt hroot b s a y apply mem_interior_iff_mem_nhds.mpr filter_upwards [hzero,hcells] with v hv hc exact ⟨hv.1,hv.2,hc⟩ let K := Icc (0 : ℝ) (1/4) ×ˢ Icc (0 : ℝ) 1 have hevent : ∀ᶠ δ : ℝ in 𝓝 0, ∀ z ∈ K, ![z.1,δ,z.2] ∈ V := by apply (isCompact_Icc.prod isCompact_Icc).eventually_forall_of_forall_eventually intro z hz exact (by fun_prop : ContinuousAt (fun w : ℝ × (ℝ × ℝ) => ![w.2.1,w.1,w.2.2]) (0,z)) (isOpen_interior.mem_nhds (hbase z.1 z.2 hz.1 hz.2)) obtain ⟨δ,hδ,hball⟩ := Metric.mem_nhds_iff.mp hevent refine ⟨δ/2,V,by linarith,isOpen_interior,?_,?_,?_,?_⟩ · intro v hv have hmem : v 1 ∈ ball (0 : ℝ) δ := by rw [Metric.mem_ball,Real.dist_eq,sub_zero] linarith [hv.2.1] have he : ![v 0,v 1,v 2] = v := by ext i; fin_cases i <;> rfl simpa only [he] using hball hmem (v 0,v 2) ⟨hv.1,hv.2.2⟩ · intro v hv exact (interior_subset hv).1 · intro v hv exact (interior_subset hv).2.1.contDiffWithinAt · intro b s a y v hv exact ((interior_subset hv).2.2 b s a y).contDiffWithinAt
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_calibration_open_neighbourhood · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairOpenNeighbourhood.lean:84
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairProductDerivatives 2 declarations The actual hidden-sign mixture and comparator inherit the component derivative bound from their one-record smoothness and derivative envelopes.

Fair component product differentiation

The actual hidden-sign mixture and comparator inherit the component derivative bound from their one-record smoothness and derivative envelopes.

theorem fairComponentDifference_second_derivative_bound

[Product differentiation and finite averaging establish the fair component's second-derivative estimate from one-record bounds, including the comparator's substituted root and effect. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
d M :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hd :
|d| ≤ 1/100
hM :
1 ≤ M
hs :
∀ (b : Bool) σ i
if
i ∈ I
then
ContDiffAt ℝ 2 (fun z => recordCellDensity (if b then fairLaw k σ t z else fairComparator k t z) (o i)) d
hder :
∀ (b : Bool) σ i,
i ∈ I → ∀ m : ℕ, 1
≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fun z => recordCellDensity (if b then fairLaw k σ t z else fairComparator k t z) (o i)) d‖ ≤ M
≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card
Proof (Lean source)
-- @node: fairComponentDifference_second_derivative_bound lemma fairComponentDifference_second_derivative_bound {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) (d M : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hd : |d| ≤ 1/100) (hM : 1 ≤ M) (hs : ∀ (b : Bool) σ i, i ∈ I → ContDiffAt ℝ 2 (fun z => recordCellDensity (if b then fairLaw k σ t z else fairComparator k t z) (o i)) d) (hder : ∀ (b : Bool) σ i, i ∈ I → ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fun z => recordCellDensity (if b then fairLaw k σ t z else fairComparator k t z) (o i)) d‖ ≤ M) : |iteratedDeriv 2 (fairComponentDifference k I t o) d| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card := by classical let f := fun (b : Bool) (σ : Fin (k+1) → Bool) i z => recordCellDensity (if b then fairLaw k σ t z else fairComparator k t z) (o i) have hval (b : Bool) (σ : Fin (k+1) → Bool) (i : Fin n) : |f b σ i d| ≤ 2 := by have hr := fairDensity_bounds b k σ t d ht hd (o i).2.1 (o i).2.2 (o i).1 change (1/2 : ℝ) ≤ f b σ i d ∧ f b σ i d ≤ 2 at hr rw [abs_of_nonneg (by linarith [hr.1])] exact hr.2 have hfirst (b : Bool) (σ : Fin (k+1) → Bool) (i : Fin n) (hi : i ∈ I) : |deriv (f b σ i) d| ≤ M := by have h := hder b σ i hi 1 le_rfl (by norm_num) rw [norm_iteratedFDeriv_eq_norm_iteratedDeriv, iteratedDeriv_one, Real.norm_eq_abs] at h exact h have hsecond (b : Bool) (σ : Fin (k+1) → Bool) (i : Fin n) (hi : i ∈ I) : |iteratedDeriv 2 (f b σ i) d| ≤ M := by simpa only [norm_iteratedFDeriv_eq_norm_iteratedDeriv, Real.norm_eq_abs] using hder b σ i hi 2 (by norm_num) le_rfl have hprod (b : Bool) (σ : Fin (k+1) → Bool) : |iteratedDeriv 2 (fun z => ∏ i ∈ I, f b σ i z) d| ≤ M^2 * (I.card : ℝ)^2 * 2^I.card := (mixture_product_two_derivative_bounds I (f b σ) d M hM (hs b σ) (fun i _ => hval b σ i) (hfirst b σ) (hsecond b σ)).2.2 have h := mixture_average_second_derivative_bound (fun σ z => ∏ i ∈ I, f true σ i z) (fun z => ∏ i ∈ I, f false (fun _ => false) i z) d _ (fun σ => contDiffAt_prod (hs true σ)) (contDiffAt_prod (hs false (fun _ => false))) (hprod true) (hprod false (fun _ => false)) change |iteratedDeriv 2 (fairComponentDifference k I t o) d| ≤ 2 * (M^2 * (I.card : ℝ)^2 * 2^I.card) at h simpa only [mul_assoc] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairComponentDifference_second_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairProductDerivatives.lean:14
theorem fair_component_hellinger_of_record_derivatives

[The fair component Hellinger estimate now needs only the one-record analytic envelopes. Product smoothness, its second derivative, and both Taylor cancellations are assembled here rather than assumed at component level. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
t :
ℝ
o :
Fin n → Record
δ M :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hM :
1 ≤ M
hs :
∀ (b : Bool) σ i
if
i ∈ I
then
∀ z ∈ Icc 0 |δ|,
ContDiffAt ℝ 2 (fun w => recordCellDensity (if b then fairLaw k σ t w else fairComparator k t w) (o i)) z
hder :
∀ (b : Bool) σ i,
i ∈ I → ∀ z ∈ Icc 0 |δ|, ∀ m : ℕ, 1
≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fun w => recordCellDensity (if b then fairLaw k σ t w else fairComparator k t w) (o i)) z‖ ≤ M
(sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i)) - sqrt (∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i)))^2
≤ M^4 * (I.card : ℝ)^4 * 8^I.card * δ^4
Proof (Lean source)
-- @node: fair_component_hellinger_of_record_derivatives lemma fair_component_hellinger_of_record_derivatives {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (t : ℝ) (o : Fin n → Record) (δ M : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hM : 1 ≤ M) (hs : ∀ (b : Bool) σ i, i ∈ I → ∀ z ∈ Icc 0 |δ|, ContDiffAt ℝ 2 (fun w => recordCellDensity (if b then fairLaw k σ t w else fairComparator k t w) (o i)) z) (hder : ∀ (b : Bool) σ i, i ∈ I → ∀ z ∈ Icc 0 |δ|, ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fun w => recordCellDensity (if b then fairLaw k σ t w else fairComparator k t w) (o i)) z‖ ≤ M) : (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (fairLaw k σ t δ) (o i)) - sqrt (∏ i ∈ I, recordCellDensity (fairComparator k t δ) (o i)))^2 ≤ M^4 * (I.card : ℝ)^4 * 8^I.card * δ^4 := by classical have hsDiff (z : ℝ) (hz : z ∈ Icc 0 |δ|) : ContDiffAt ℝ 2 (fairComponentDifference k I t o) z := by unfold fairComponentDifference apply ContDiffAt.sub · apply ContDiffAt.mul contDiffAt_const apply ContDiffAt.sum intro σ _ exact contDiffAt_prod (fun i hi => by simpa using hs true σ i hi z hz) · exact contDiffAt_prod (fun i hi => by simpa using hs false (fun _ => false) i hi z hz) apply fair_component_hellinger_taylor_bound k I t o δ M ht hδ ((hsDiff 0 ⟨le_rfl, abs_nonneg δ⟩).differentiableAt (by norm_num)) (fun z hz => (hsDiff z hz).contDiffWithinAt) intro z hz have hz' : z ∈ Icc 0 |δ| := ⟨hz.1.le, hz.2.le⟩ have hzsmall : |z| ≤ 1/100 := by rw [abs_of_nonneg hz'.1] exact hz'.2.trans hδ exact fairComponentDifference_second_derivative_bound k I t o z M ht hzsmall hM (fun b σ i hi => hs b σ i hi z hz') (fun b σ i hi => hder b σ i hi z hz')
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_component_hellinger_of_record_derivatives · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairProductDerivatives.lean:61
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairPrognosisEnvelope 5 declarations The calibrated root's quadratic displacement and the bounded sign field keep both fair control risks near the asymmetric center.

Fair native prognosis envelope

The calibrated root's quadratic displacement and the bounded sign field keep both fair control risks near the asymmetric center. This proves the native prognosis envelope on one absolute signed neighborhood, including fallback laws.

theorem fair_control_risk_bounds_of_centering Lemma fair_control_risk_bounds_of_centering in the paper ↗

[Quadratic centering and a small sign perturbation keep both fair control risks in the interval where the native logit has magnitude at most one. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
x :
hδ :
|δ| ≤ 1/100
hp :
|fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100
(if b then fairRoot t δ (cellCoord k x)+δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x)) ∈ Icc (1/3 : ℝ) (2/3)
Proof (Lean source)
-- @node: fair_control_risk_bounds_of_centering lemma fair_control_risk_bounds_of_centering (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (x : Covariate) (hδ : |δ| ≤ 1/100) (hp : |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100) : (if b then fairRoot t δ (cellCoord k x)+δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x)) ∈ Icc (1/3 : ℝ) (2/3) := by have hprod : |δ*signFieldZ k σ x| ≤ 1/50 := by rw [abs_mul] calc _ ≤ (1/100 : ℝ)*2 := mul_le_mul hδ (signFieldZ_abs_le_two k σ x) (abs_nonneg _) (by norm_num) _ = _ := by norm_num obtain ⟨hplo,hphi⟩ := abs_le.mp hp obtain ⟨hlo,hhi⟩ := abs_le.mp hprod cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] <;> constructor <;> linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_control_risk_bounds_of_centering · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairPrognosisEnvelope.lean:16
theorem fairCells_armRisk_control Lemma fairCells_armRisk_control in the paper ↗

The exact fair arm normalization identifies its native control risk. Under the stated assumptions. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
hv :
ValidCells (fairCells b k σ t δ)
x :
= if b then fairRoot t δ (cellCoord k x)+δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x)
Proof (Lean source)
-- @node: fairCells_armRisk_control lemma fairCells_armRisk_control (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (hv : ValidCells (fairCells b k σ t δ)) (x : Covariate) : armRisk (totalCellLaw (fairCells b k σ t δ)) false x = if b then fairRoot t δ (cellCoord k x)+δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x) := by rw [armRisk, totalCellLaw_cells_of_valid _ hv] simp only [fairCells, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_armRisk_control · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairPrognosisEnvelope.lean:35
theorem fairCells_prognosis_envelope_of_centering

[Centered fair roots give the native prognosis envelope even if cell continuity has not yet been established, because the fallback has zero logit. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ :
ℝ
hδ :
|δ| ≤ 1/100
hp :
∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100
Proof (Lean source)
-- @node: fairCells_prognosis_envelope_of_centering lemma fairCells_prognosis_envelope_of_centering (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ : ℝ) (hδ : |δ| ≤ 1/100) (hp : ∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100) : PrognosisEnvelope (totalCellLaw (fairCells b k σ t δ)) := by classical intro x by_cases hv : ValidCells (fairCells b k σ t δ) · change |logit (armRisk (totalCellLaw (fairCells b k σ t δ)) false x)| ≤ 1 rw [fairCells_armRisk_control b k σ t δ hv x] exact calibrated_logit_abs_le_one _ (fair_control_risk_bounds_of_centering b k σ t δ x hδ (hp x)) · norm_num [prognosisLogit, armRisk, totalCellLaw, hv, lawFromCells, logit]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_prognosis_envelope_of_centering · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairPrognosisEnvelope.lean:46
theorem fairCells_uniform_prognosis_envelope

The calibration lemma's quadratic root bound yields one positive signed radius on which both fair constructions satisfy the model's prognosis envelope. the documented result

Formal statement
∃ r : ℝ,
0 < r
r ≤ 1/100
conclusion 1
k :
ℕ
1 ≤ k
σ :
Fin (k+1) → Bool
t δ :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ r
b :
Proof (Lean source)
-- @node: fairCells_uniform_prognosis_envelope lemma fairCells_uniform_prognosis_envelope : ∃ r : ℝ, 0 < r ∧ r ≤ 1/100 ∧ ∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k+1) → Bool, ∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ r → ∀ b, PrognosisEnvelope (totalCellLaw (fairCells b k σ t δ)) := by obtain ⟨ε, M, hε, hM, _, _, _, _, hf⟩ := exact_calibrations let r := min ε (min (1/100) (1/(100*(M+1)))) have hr : 0 < r := lt_min hε (lt_min (by norm_num) (by positivity)) have hre : r ≤ ε := min_le_left _ _ have hrs : r ≤ 1/100 := (min_le_right _ _).trans (min_le_left _ _) have hrM : r ≤ 1/(100*(M+1)) := (min_le_right _ _).trans (min_le_right _ _) have hMr : M*r ≤ 1/100 := by have hh := (le_div_iff₀ (show 0 < 100*(M+1) by positivity)).mp hrM nlinarith refine ⟨r, hr, hrs, ?_⟩ intro k hk σ t δ ht hδ b apply fairCells_prognosis_envelope_of_centering b k σ t δ (hδ.trans hrs) intro x have hh := hf t δ (cellCoord k x) ht (hδ.trans hre) (cellCoord_mem_unit k hk x) have hp := hh.2.2.2.2.2.2.2.2.1 have hs : δ^2 ≤ r^2 := by nlinarith [sq_abs δ, abs_nonneg δ] have hb : M*δ^2 ≤ M*r^2 := mul_le_mul_of_nonneg_left hs hM.le nlinarith [abs_nonneg (deriv (fairRoot t δ) (cellCoord k x))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_uniform_prognosis_envelope · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairPrognosisEnvelope.lean:62
structure CalibratedPrognosisSpatialBounds

The two remaining spatial prognosis obligations, separated from the pointwise envelope already proved from quadratic root centering.

Definition (Lean source)
β :
ℝ
k :
ℕ
prognosis_linear :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ (k : ℝ) ^ (1-β) * |(x : ℝ)-(z : ℝ)|
prognosis_oscillation :
∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ 2 * (k : ℝ) ^ (-β)
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibratedPrognosisSpatialBounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairPrognosisEnvelope.lean:88
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairRootExistence 2 declarations The strictly separated zero-amplitude bracket signs persist on one signed amplitude neighborhood by compactness in effect and spatial coordinate.

Uniform fair-root existence over the full effect range

The strictly separated zero-amplitude bracket signs persist on one signed amplitude neighborhood by compactness in effect and spatial coordinate. Continuity in the centering argument then supplies an interior root.

theorem fairEquation_uniform_bracket_signs Lemma fairEquation_uniform_bracket_signs in the paper ↗

One absolute signed amplitude neighborhood preserves the fair bracket signs for all effects and spatial coordinates in their closed prescribed ranges. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
ε ≤ 1/100
conclusion 1
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
fairEquation t δ (3/10) u < 0
0 < fairEquation t δ (1/2) u
Proof (Lean source)
-- @node: fairEquation_uniform_bracket_signs lemma fairEquation_uniform_bracket_signs : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → fairEquation t δ (3/10) u < 0 ∧ 0 < fairEquation t δ (1/2) u := by let K := Icc (0 : ℝ) (1/4) ×ˢ Icc (0 : ℝ) 1 have hK : IsCompact K := isCompact_Icc.prod isCompact_Icc have hevent : ∀ᶠ δ : ℝ in 𝓝 0, ∀ z ∈ K, fairEquation z.1 δ (3/10) z.2 < 0 ∧ 0 < fairEquation z.1 δ (1/2) z.2 := by apply hK.eventually_forall_of_forall_eventually intro z hz have hcont (q : ℝ) (hq : q ∈ Icc (3/10 : ℝ) (1/2)) : ContinuousAt (fun w : ℝ × (ℝ × ℝ) => fairEquation w.2.1 w.1 q w.2.2) (0,z) := by have hbox : ![z.1,0,q,z.2] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨hz.1,by norm_num,hq,hz.2⟩ have hp : ContDiffAt ℝ ∞ (fun w : ℝ × (ℝ × ℝ) => ![w.2.1,w.1,q,w.2.2]) (0,z) := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hh := (fairEquation_contDiffAt ![z.1,0,q,z.2] hbox).comp (0,z) hp exact hh.continuousAt have hs := fairEquation_zero_amplitude_bracket_signs z.1 z.2 hz.1 hz.2 exact ((hcont (3/10) (by constructor <;> norm_num)).eventually (gt_mem_nhds hs.1)).and ((hcont (1/2) (by constructor <;> norm_num)).eventually (lt_mem_nhds hs.2)) obtain ⟨a,ha,hball⟩ := Metric.mem_nhds_iff.mp hevent let ε := min (a/2) (1/100) refine ⟨ε,lt_min (by linarith) (by norm_num),min_le_right _ _,?_⟩ intro t δ u ht hδ hu apply hball _ (t,u) ⟨ht,hu⟩ rw [Metric.mem_ball,Real.dist_eq,sub_zero] exact lt_of_le_of_lt (hδ.trans (min_le_left _ _)) (by linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_bracket_signs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootExistence.lean:16
theorem fairEquation_uniform_exists Lemma fairEquation_uniform_exists in the paper ↗

The intermediate value theorem yields a genuine fair root in the full selector bracket on one absolute signed amplitude neighborhood. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
ε ≤ 1/100
conclusion 1
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
∃ p ∈ Ioo (3/10 : ℝ) (1/2), fairEquation t δ p u = 0
Proof (Lean source)
-- @node: fairEquation_uniform_exists lemma fairEquation_uniform_exists : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → ∃ p ∈ Ioo (3/10 : ℝ) (1/2), fairEquation t δ p u = 0 := by obtain ⟨ε,hε,hsmall,hsigns⟩ := fairEquation_uniform_bracket_signs refine ⟨ε,hε,hsmall,?_⟩ intro t δ u ht hδ hu have hcont : ContinuousOn (fun p => fairEquation t δ p u) (Icc (3/10 : ℝ) (1/2)) := by intro p hp have hbox : ![t,δ,p,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨ht,hδ.trans hsmall,hp,hu⟩ have hmap : ContDiffAt ℝ ∞ (fun x : ℝ => ![t,δ,x,u]) p := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hh := (fairEquation_contDiffAt ![t,δ,p,u] hbox).comp p hmap exact hh.continuousAt.continuousWithinAt obtain ⟨hlo,hhi⟩ := hsigns t δ u ht hδ hu obtain ⟨p,hp,he⟩ := intermediate_value_Icc (by norm_num : (3/10 : ℝ) ≤ 1/2) hcont (show (0 : ℝ) ∈ Icc (fairEquation t δ (3/10) u) (fairEquation t δ (1/2) u) from ⟨hlo.le,hhi.le⟩) refine ⟨p,⟨?_,?_⟩,he⟩ · have hn : p ≠ 3/10 := by intro h; subst p; linarith exact lt_of_le_of_ne hp.1 (Ne.symm hn) · have hn : p ≠ 1/2 := by intro h; subst p; linarith exact lt_of_le_of_ne hp.2 hn
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_exists · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootExistence.lean:53
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairRootNearZero 9 declarations The explicit zero-effect equation supplies a nonzero center slope.

Local fair-root regularity at zero effect

The explicit zero-effect equation supplies a nonzero center slope. Compactness preserves its signs and local monotonicity, identifying the literal selector with a smooth implicit branch on full neighborhoods of the zero-effect axis.

theorem fairEquation_center_deriv_zero_effect Lemma fairEquation_center_deriv_zero_effect in the paper ↗

The normalized equation has the Bernoulli-variance slope on the zero-effect axis. Under the stated assumptions. Under the stated assumptions.

Formal statement
δ ξ u :
ℝ
hδ :
|δ| ≤ 1/100
hξ :
ξ ∈ Ioo (3/10 : ℝ) (1/2)
hu :
u ∈ Icc (0 : ℝ) 1
deriv (fun x => fairEquation 0 δ x u) ξ = (1-2*ξ)/(6/25)
Proof (Lean source)
-- @node: fairEquation_center_deriv_zero_effect lemma fairEquation_center_deriv_zero_effect (δ ξ u : ℝ) (hδ : |δ| ≤ 1/100) (hξ : ξ ∈ Ioo (3/10 : ℝ) (1/2)) (hu : u ∈ Icc (0 : ℝ) 1) : deriv (fun x => fairEquation 0 δ x u) ξ = (1-2*ξ)/(6/25) := by have hd : HasDerivAt (fun x : ℝ => -1+x*(1-x)/(6/25)) ((1-2*ξ)/(6/25)) ξ := by convert (hasDerivAt_const ξ (-1 : ℝ)).add (((hasDerivAt_id ξ).mul ((hasDerivAt_const ξ (1 : ℝ)).sub (hasDerivAt_id ξ))).div_const (6/25)) using 1 <;> first | rfl | (dsimp; ring) apply (hd.congr_of_eventuallyEq ?_).deriv filter_upwards [isOpen_Ioo.mem_nhds hξ] with x hx exact fairEquation_zero_effect δ x u hδ ⟨hx.1.le,hx.2.le⟩ hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_center_deriv_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:18
theorem fairEquation_eventually_zero_effect_control Lemma fairEquation_eventually_zero_effect_control in the paper ↗

[On a full parameter neighborhood, every bracket value remains close to its explicit zero-effect value and remains jointly smooth. the documented result Under the stated assumptions.

Formal statement
u :
ℝ
hu :
u ∈ Icc (0 : ℝ) 1
∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∀ ξ ∈ Icc (3/10 : ℝ) (1/2), ContDiffAt ℝ 1 (fun z : (Fin 3 → ℝ) × ℝ => fairEquation (z.1 0) (z.1 1) z.2 (z.1 2)) (a,ξ) ∧ |fairEquation (a 0) (a 1) ξ (a 2)
- (-1+ξ*(1-ξ)/(6/25))| < 1/100
Proof (Lean source)
-- @node: fairEquation_eventually_zero_effect_control lemma fairEquation_eventually_zero_effect_control (u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∀ ξ ∈ Icc (3/10 : ℝ) (1/2), ContDiffAt ℝ 1 (fun z : (Fin 3 → ℝ) × ℝ => fairEquation (z.1 0) (z.1 1) z.2 (z.1 2)) (a,ξ) ∧ |fairEquation (a 0) (a 1) ξ (a 2) - (-1+ξ*(1-ξ)/(6/25))| < 1/100 := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro ξ hξ have hx : ![0,0,ξ,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨by constructor <;> norm_num, by norm_num, hξ, hu⟩ have hs := (fairEquation_contDiffAt _ hx).comp (![0,0,u],ξ) (show ContDiffAt ℝ ∞ (fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) (![0,0,u],ξ) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) have hc : ContinuousAt (fun z : (Fin 3 → ℝ) × ℝ => |fairEquation (z.1 0) (z.1 1) z.2 (z.1 2) - (-1+z.2*(1-z.2)/(6/25))|) (![0,0,u],ξ) := by exact (hs.continuousAt.sub (by fun_prop)).abs exact ((hs.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by norm_num)).and (hc.eventually (gt_mem_nhds (by simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val] rw [fairEquation_zero_effect 0 ξ u (by norm_num) hξ hu] norm_num)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_eventually_zero_effect_control · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:33
theorem fairEquation_eventually_center_deriv_pos Lemma fairEquation_eventually_center_deriv_pos in the paper ↗

The center derivative stays uniformly positive on a smaller bracket in full neighborhoods of zero effect and amplitude, including spatial endpoints. the documented result Under the stated assumptions.

Formal statement
u :
ℝ
hu :
u ∈ Icc (0 : ℝ) 1
∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∀ ξ ∈ Icc (7/20 : ℝ) (9/20), 1/4 < deriv (fun x => fairEquation (a 0) (a 1) x (a 2)) ξ
Proof (Lean source)
-- @node: fairEquation_eventually_center_deriv_pos lemma fairEquation_eventually_center_deriv_pos (u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∀ ξ ∈ Icc (7/20 : ℝ) (9/20), 1/4 < deriv (fun x => fairEquation (a 0) (a 1) x (a 2)) ξ := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro ξ hξ have hξ' : ξ ∈ Icc (3/10 : ℝ) (1/2) := ⟨by linarith [hξ.1],by linarith [hξ.2]⟩ have hx : ![0,0,ξ,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨by constructor <;> norm_num, by norm_num, hξ', hu⟩ have hc := (fairEquation_center_deriv_contDiffAt _ hx).continuousAt.comp (f := fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) (by fun_prop : ContinuousAt (fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) (![0,0,u],ξ)) apply hc.eventually apply lt_mem_nhds change 1/4 < deriv (fun x => fairEquation 0 0 x u) ξ rw [fairEquation_center_deriv_zero_effect 0 ξ u (by norm_num) ⟨by linarith [hξ.1],by linarith [hξ.2]⟩ hu] linarith [hξ.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_eventually_center_deriv_pos · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:62
theorem fairEquation_root_confined_near_zero Lemma fairEquation_root_confined_near_zero in the paper ↗

Uniform approximation to the limiting variance equation excludes roots outside a smaller bracket, rather than presupposing the selected root's value. the documented result Under the stated assumptions.

Formal statement
t δ u q :
ℝ
hq :
q ∈ Ioo (3/10 : ℝ) (1/2)
he :
fairEquation t δ q u = 0
hc :
|fairEquation t δ q u - (-1+q*(1-q)/(6/25))| < 1/100
q ∈ Ioo (7/20 : ℝ) (9/20)
Proof (Lean source)
-- @node: fairEquation_root_confined_near_zero lemma fairEquation_root_confined_near_zero (t δ u q : ℝ) (hq : q ∈ Ioo (3/10 : ℝ) (1/2)) (he : fairEquation t δ q u = 0) (hc : |fairEquation t δ q u - (-1+q*(1-q)/(6/25))| < 1/100) : q ∈ Ioo (7/20 : ℝ) (9/20) := by rw [he] at hc obtain ⟨hlo,hhi⟩ := abs_lt.mp hc constructor · by_contra hn have hqlo : q ≤ 7/20 := le_of_not_gt hn have hprod := mul_nonneg (show 0 ≤ 7/20-q by linarith) (show 0 ≤ 13/20-q by linarith) nlinarith · by_contra hn have hqhi : 9/20 ≤ q := le_of_not_gt hn have hprod := mul_nonneg (show 0 ≤ q-9/20 by linarith) (show 0 ≤ 11/20-q by linarith [hq.2]) nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_root_confined_near_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:86
theorem fairEquation_eventually_existsUnique_near_zero Lemma fairEquation_eventually_existsUnique_near_zero in the paper ↗

[Opposite signs give an interior root, and the derivative floor makes it unique throughout the original selector bracket on a full parameter neighborhood. the documented result Under the stated assumptions.

Formal statement
u :
ℝ
hu :
u ∈ Icc (0 : ℝ) 1
∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∃! q : ℝ, q ∈ Ioo (3/10 : ℝ) (1/2) ∧ fairEquation (a 0) (a 1) q (a 2)
= 0
Proof (Lean source)
-- @node: fairEquation_eventually_existsUnique_near_zero lemma fairEquation_eventually_existsUnique_near_zero (u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∃! q : ℝ, q ∈ Ioo (3/10 : ℝ) (1/2) ∧ fairEquation (a 0) (a 1) q (a 2) = 0 := by filter_upwards [fairEquation_eventually_zero_effect_control u hu, fairEquation_eventually_center_deriv_pos u hu] with a hcontrol hpos let f : ℝ → ℝ := fun q => fairEquation (a 0) (a 1) q (a 2) have hcont : ContinuousOn f (Icc (7/20 : ℝ) (9/20)) := by intro q hq have hq' : q ∈ Icc (3/10 : ℝ) (1/2) := ⟨by linarith [hq.1],by linarith [hq.2]⟩ exact (((hcontrol q hq').1.continuousAt).comp (f := fun q : ℝ => (a,q)) (by fun_prop)).continuousWithinAt have hlow := (hcontrol (7/20) (by constructor <;> norm_num)).2 have hhigh := (hcontrol (9/20) (by constructor <;> norm_num)).2 have hsignlo : f (7/20) < 0 := by dsimp [f] norm_num at hlow linarith [(abs_lt.mp hlow).2] have hsignhi : 0 < f (9/20) := by dsimp [f] norm_num at hhigh linarith [(abs_lt.mp hhigh).1] obtain ⟨q,hq,heq⟩ := intermediate_value_Icc (by norm_num : (7/20 : ℝ) ≤ 9/20) hcont (show (0 : ℝ) ∈ Icc (f (7/20)) (f (9/20)) from ⟨hsignlo.le,hsignhi.le⟩) have hmono : StrictMonoOn f (Icc (7/20 : ℝ) (9/20)) := by apply strictMonoOn_of_deriv_pos (convex_Icc _ _) hcont intro x hx rw [interior_Icc] at hx exact lt_trans (by norm_num : (0 : ℝ) < 1/4) (hpos x ⟨hx.1.le,hx.2.le⟩) refine ⟨q, ⟨⟨by linarith [hq.1],by linarith [hq.2]⟩,heq⟩, ?_⟩ intro p hp have hp' := fairEquation_root_confined_near_zero (a 0) (a 1) (a 2) p hp.1 hp.2 (hcontrol p ⟨hp.1.1.le,hp.1.2.le⟩).2 exact hmono.injOn ⟨hp'.1.le,hp'.2.le⟩ hq (hp.2.trans heq.symm)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_eventually_existsUnique_near_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:108
theorem fairEquation_uniform_existsUnique_near_zero Lemma fairEquation_uniform_existsUnique_near_zero in the paper ↗

One absolute signed neighborhood supplies unique fair bracket roots for all spatial coordinates, including both endpoints, when the effect is near zero. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
t δ u :
ℝ
|t| ≤ ε
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
∃! q : ℝ,
q ∈ Ioo (3/10 : ℝ) (1/2)
fairEquation t δ q u = 0
Proof (Lean source)
-- @node: fairEquation_uniform_existsUnique_near_zero lemma fairEquation_uniform_existsUnique_near_zero : ∃ ε : ℝ, 0 < ε ∧ ∀ t δ u : ℝ, |t| ≤ ε → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → ∃! q : ℝ, q ∈ Ioo (3/10 : ℝ) (1/2) ∧ fairEquation t δ q u = 0 := by have hevent : ∀ᶠ a : ℝ × ℝ in 𝓝 (0,0), ∀ u ∈ Icc (0 : ℝ) 1, ∃! q : ℝ, q ∈ Ioo (3/10 : ℝ) (1/2) ∧ fairEquation a.1 a.2 q u = 0 := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro u hu exact (by fun_prop : ContinuousAt (fun z : (ℝ × ℝ) × ℝ => ![z.1.1,z.1.2,z.2]) ((0,0),u)) (fairEquation_eventually_existsUnique_near_zero u hu) obtain ⟨d, hd, hball⟩ := Metric.mem_nhds_iff.mp hevent refine ⟨d/2, by linarith, ?_⟩ intro t δ u ht hδ hu have hmem : (t,δ) ∈ ball (0,0) d := by rw [Metric.mem_ball, Prod.dist_eq] simp only [Real.dist_eq, sub_zero] exact max_lt (by linarith) (by linarith) exact hball hmem u hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_uniform_existsUnique_near_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:148
theorem scalar_bracket_selector_contDiffAt_infty Lemma scalar_bracket_selector_contDiffAt_infty in the paper ↗

A C∞ equation and nearby uniqueness give C∞ regularity of the actual bracket selector. A C1 implicit branch first supplies continuity; the pointwise implicit theorem then upgrades it without an analyticity assumption. the documented result Under the stated assumptions.

Formal statement
d :
ℕ
F :
((Fin d → ℝ) × ℝ) → ℝ
q :
(Fin d → ℝ) → ℝ
b :
Fin d → ℝ
l r :
ℝ
hF :
ContDiffAt ℝ ∞ F (b,q b)
hb :
q b ∈ Ioo l r
hZero :
F (b,q b) = 0
hPartial :
deriv (fun x => F (b,x)) (q b) ≠ 0
hSpec :
∀ a
if
(∃ x ∈ Ioo l r, F (a,x) = 0)
then
q a ∈ Ioo l r ∧ F (a,q a) = 0
hUnique :
∀ᶠ a in 𝓝 b, ∀ x ∈ Ioo l r, ∀ y ∈ Ioo l r, F (a,x) = 0 → F (a,y) = 0 → x = y
ContDiffAt ℝ ∞ q b
Proof (Lean source)
-- @node: scalar_bracket_selector_contDiffAt_infty lemma scalar_bracket_selector_contDiffAt_infty (d : ℕ) (F : ((Fin d → ℝ) × ℝ) → ℝ) (q : (Fin d → ℝ) → ℝ) (b : Fin d → ℝ) (l r : ℝ) (hF : ContDiffAt ℝ ∞ F (b,q b)) (hb : q b ∈ Ioo l r) (hZero : F (b,q b) = 0) (hPartial : deriv (fun x => F (b,x)) (q b) ≠ 0) (hSpec : ∀ a, (∃ x ∈ Ioo l r, F (a,x) = 0) → q a ∈ Ioo l r ∧ F (a,q a) = 0) (hUnique : ∀ᶠ a in 𝓝 b, ∀ x ∈ Ioo l r, ∀ y ∈ Ioo l r, F (a,x) = 0 → F (a,y) = 0 → x = y) : ContDiffAt ℝ ∞ q b := by have hC1 := hF.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp) obtain ⟨S,hS,hSmooth⟩ := hC1.contDiffOn le_rfl (by simp) obtain ⟨D,hDsub,hDopen,hDbase⟩ := mem_nhds_iff.mp hS obtain ⟨U,V,g,hU,hbU,hV,hbV,hUV,hg,hgBase,hgRange,hgGraph⟩ := scalar_implicit_function d F D b (q b) hDopen hDbase (hSmooth.mono hDsub) hZero hPartial have hgAt := hg.contDiffAt (hU.mem_nhds hbU) have hRange : ∀ᶠ a in 𝓝 b, g a ∈ Ioo l r := hgAt.continuousAt (by rw [hgBase]; exact isOpen_Ioo.mem_nhds hb) have he : q =ᶠ[𝓝 b] g := by filter_upwards [hU.mem_nhds hbU,hRange,hUnique] with a ha hga hunique have hz : F (a,g a) = 0 := (hgGraph a ha (g a) (hgRange a ha)).mpr rfl obtain ⟨hqa,hqz⟩ := hSpec a ⟨g a,hga,hz⟩ exact hunique (q a) hqa (g a) hga hqz hz have hq : ContinuousAt q b := hgAt.continuousAt.congr_of_eventuallyEq he have hz : ∀ᶠ a in 𝓝 b, F (a,q a) = 0 := by filter_upwards [hU.mem_nhds hbU,he] with a ha hea rw [hea] exact (hgGraph a ha (g a) (hgRange a ha)).mpr rfl exact scalar_implicit_root_contDiffAt d ∞ (by simp) F q b hF hq hz hPartial
CausalSmith.Stat.LogoddsLowsmoothFrontier.scalar_bracket_selector_contDiffAt_infty · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:169
theorem fairRoot_contDiffAt_zero_effect_amplitude Lemma fairRoot_contDiffAt_zero_effect_amplitude in the paper ↗

The literal fair root is jointly C∞ at zero effect and zero amplitude, on full neighborhoods of every spatial point in the closed interval. the documented result Under the stated assumptions.

Formal statement
u :
ℝ
hu :
u ∈ Icc (0 : ℝ) 1
ContDiffAt ℝ ∞ (fun a : Fin 3 → ℝ => fairRoot (a 0) (a 1) (a 2)) ![0,0,u]
Proof (Lean source)
-- @node: fairRoot_contDiffAt_zero_effect_amplitude lemma fairRoot_contDiffAt_zero_effect_amplitude (u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) : ContDiffAt ℝ ∞ (fun a : Fin 3 → ℝ => fairRoot (a 0) (a 1) (a 2)) ![0,0,u] := by let F : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => fairEquation (z.1 0) (z.1 1) z.2 (z.1 2) have hbase : fairRoot 0 0 u = 2/5 := fairRoot_zero_effect 0 u (by norm_num) hu apply scalar_bracket_selector_contDiffAt_infty 3 F (fun a => fairRoot (a 0) (a 1) (a 2)) ![0,0,u] (3/10) (1/2) · simp only [Matrix.cons_val_zero,Matrix.cons_val_one,Matrix.cons_val,hbase] have hx : ![0,0,2/5,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨by constructor <;> norm_num,by norm_num,by change (2/5 : ℝ) ∈ Icc (3/10) (1/2) constructor <;> norm_num,hu⟩ exact (fairEquation_contDiffAt _ hx).comp (![0,0,u],2/5) (show ContDiffAt ℝ ∞ (fun z : (Fin 3 → ℝ) × ℝ => ![z.1 0,z.1 1,z.2,z.1 2]) (![0,0,u],2/5) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) · simp only [Matrix.cons_val_zero,Matrix.cons_val_one,Matrix.cons_val,hbase] constructor <;> norm_num · change fairEquation 0 0 (fairRoot 0 0 u) u = 0 rw [hbase] exact fairEquation_zero_effect_center 0 u (by norm_num) hu · change deriv (fun x => fairEquation 0 0 x u) (fairRoot 0 0 u) ≠ 0 rw [hbase,fairEquation_center_deriv_zero_effect 0 (2/5) u (by norm_num) (by constructor <;> norm_num) hu] norm_num · intro a ha exact fairRoot_spec (a 0) (a 1) (a 2) ha · filter_upwards [fairEquation_eventually_existsUnique_near_zero u hu] with a ha intro x hx y hy hex hey exact ha.unique ⟨hx,hex⟩ ⟨hy,hey⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_contDiffAt_zero_effect_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:205
theorem fairRoot_uniform_spec_near_zero Lemma fairRoot_uniform_spec_near_zero in the paper ↗

The actual selected fair root solves its normalized equation and is the only root in the prescribed bracket on one absolute neighborhood of the origin. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
t δ u :
ℝ
|t| ≤ ε
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
fairEquation t δ (fairRoot t δ u) u = 0
q ∈ Set.Ioo (3/10 : ℝ) (1/2) :
fairEquation t δ q u = 0
q = fairRoot t δ u
Proof (Lean source)
-- @node: fairRoot_uniform_spec_near_zero lemma fairRoot_uniform_spec_near_zero : ∃ ε : ℝ, 0 < ε ∧ ∀ t δ u : ℝ, |t| ≤ ε → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → fairEquation t δ (fairRoot t δ u) u = 0 ∧ ∀ q ∈ Ioo (3/10 : ℝ) (1/2), fairEquation t δ q u = 0 → q = fairRoot t δ u := by obtain ⟨ε,hε,hroots⟩ := fairEquation_uniform_existsUnique_near_zero refine ⟨ε,hε,?_⟩ intro t δ u ht hδ hu have hr := hroots t δ u ht hδ hu have hs := fairRoot_spec t δ u hr.exists exact ⟨hs.2,fun q hq he => hr.unique ⟨hq,he⟩ hs⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_uniform_spec_near_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootNearZero.lean:243
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairRootSelection 6 declarations The endpoint sign laws give identical Taylor-normalized equations and identical literal root selectors.

Fair calibration root selection

The endpoint sign laws give identical Taylor-normalized equations and identical literal root selectors. Existence and uniqueness in the prescribed bracket transport to the actual selected root, without assumptions on its value.

theorem fairNumerator_endpoint_eq Lemma fairNumerator_endpoint_eq in the paper ↗

[Endpoint sign averages agree for all amplitudes and centering values. the stated conclusion holds.

Formal statement
t δ ξ :
ℝ
fairNumerator t δ ξ 0 = fairNumerator t δ ξ 1
Proof (Lean source)
-- @node: fairNumerator_endpoint_eq lemma fairNumerator_endpoint_eq (t δ ξ : ℝ) : fairNumerator t δ ξ 0 = fairNumerator t δ ξ 1 := by unfold fairNumerator rw [fair_endpoint_sign_average (fun z => riskShift t (ξ + δ * z)) 0 (inl rfl), fair_endpoint_sign_average (fun z => riskShift t (ξ + δ * z)) 1 (inr rfl)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_endpoint_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootSelection.lean:15

Equality of the full numerator functions transports all derivatives in the integral Taylor extension, including its zero axes. the documented result

Formal statement
t δ ξ :
ℝ
fairEquation t δ ξ 0 = fairEquation t δ ξ 1
Proof (Lean source)
-- @node: fairEquation_endpoints lemma fairEquation_endpoints (t δ ξ : ℝ) : fairEquation t δ ξ 0 = fairEquation t δ ξ 1 := by unfold fairEquation simp_rw [fairNumerator_endpoint_eq]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootSelection.lean:23

Equal endpoint equations give equal literal fair selectors, even on fallback inputs where no bracket root exists. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
t δ :
ℝ
fairRoot t δ 0 = fairRoot t δ 1
Proof (Lean source)
-- @node: fairRoot_endpoints lemma fairRoot_endpoints (t δ : ℝ) : fairRoot t δ 0 = fairRoot t δ 1 := by classical exact congrArg (fun F : ℝ → ℝ => if h : ∃ p : ℝ, p ∈ Ioo (3 / 10) (1 / 2) ∧ F p = 0 then choose h else 2 / 5) (funext (fairEquation_endpoints t δ))
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootSelection.lean:31

An existing bracket root makes the totalized fair selector a genuine root. the stated conclusion holds. Under the stated assumptions.

Formal statement
t δ u :
ℝ
h :
∃ p : ℝ, p ∈ Ioo (3 / 10) (1 / 2) ∧ fairEquation t δ p u = 0
conclusion 1
fairRoot t δ u ∈ Ioo (3 / 10) (1 / 2)
conclusion 2
fairEquation t δ (fairRoot t δ u) u = 0
Proof (Lean source)
-- @node: fairRoot_spec lemma fairRoot_spec (t δ u : ℝ) (h : ∃ p : ℝ, p ∈ Ioo (3 / 10) (1 / 2) ∧ fairEquation t δ p u = 0) : fairRoot t δ u ∈ Ioo (3 / 10) (1 / 2) ∧ fairEquation t δ (fairRoot t δ u) u = 0 := by unfold fairRoot rw [dif_pos h] exact Classical.choose_spec h

The totalized selector stays in its prescribed open bracket on every input; the fallback center also lies strictly inside that bracket. the documented result

Formal statement
t δ u :
ℝ
fairRoot t δ u ∈ Ioo (3 / 10 : ℝ) (1 / 2)
Proof (Lean source)
-- @node: fairRoot_mem_bracket lemma fairRoot_mem_bracket (t δ u : ℝ) : fairRoot t δ u ∈ Ioo (3 / 10 : ℝ) (1 / 2) := by classical by_cases h : ∃ p : ℝ, p ∈ Ioo (3 / 10) (1 / 2) ∧ fairEquation t δ p u = 0 · exact (fairRoot_spec t δ u h).1 · rw [fairRoot, dif_neg h] constructor <;> norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_mem_bracket · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootSelection.lean:50

A uniquely characterized bracket root is the actual selected center. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
t δ u p :
ℝ
hp :
p ∈ Ioo (3 / 10) (1 / 2)
he :
fairEquation t δ p u = 0
hunique :
∀ q ∈ Ioo (3 / 10) (1 / 2)
if
fairEquation t δ q u = 0
then
q = p
fairRoot t δ u = p
Proof (Lean source)
-- @node: fairRoot_eq_of_unique lemma fairRoot_eq_of_unique (t δ u p : ℝ) (hp : p ∈ Ioo (3 / 10) (1 / 2)) (he : fairEquation t δ p u = 0) (hunique : ∀ q ∈ Ioo (3 / 10) (1 / 2), fairEquation t δ q u = 0 → q = p) : fairRoot t δ u = p := by obtain ⟨hBracket, hEquation⟩ := fairRoot_spec t δ u ⟨p, hp, he⟩ exact hunique _ hBracket hEquation
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_eq_of_unique · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootSelection.lean:61
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairRootTaylorBounds 7 declarations The integral Taylor estimate derives the quadratic amplitude bound for the actual root and its spatial derivative from smoothness and the axis value.

Quadratic fair-root bounds

The integral Taylor estimate derives the quadratic amplitude bound for the actual root and its spatial derivative from smoothness and the axis value.

theorem calibration_even_deriv_zero Lemma calibration_even_deriv_zero in the paper ↗

An even scalar function has zero totalized derivative at the origin. Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
ℝ → ℝ
he :
∀ x, f (-x) = f x
deriv f 0 = 0
Proof (Lean source)
-- @node: calibration_even_deriv_zero lemma calibration_even_deriv_zero (f : ℝ → ℝ) (he : ∀ x, f (-x) = f x) : deriv f 0 = 0 := by have h := deriv_comp_neg f 0 rw [show (fun x => f (-x)) = f from funext he] at h simp only [neg_zero] at h linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_even_deriv_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootTaylorBounds.lean:16
theorem calibration_even_quadratic_bound Lemma calibration_even_quadratic_bound in the paper ↗

The second integral Taylor formula bounds a smooth even function for signed increments. Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
ℝ → ℝ
a B :
ℝ
hf :
∀ x ∈ uIcc 0 a, ContDiffAt ℝ ∞ f x
he :
∀ x, f (-x) = f x
hb :
∀ x ∈ uIcc 0 a, |deriv (deriv f) x| ≤ B
|f a - f 0| ≤ B*a^2
Proof (Lean source)
-- @node: calibration_even_quadratic_bound lemma calibration_even_quadratic_bound (f : ℝ → ℝ) (a B : ℝ) (hf : ∀ x ∈ uIcc 0 a, ContDiffAt ℝ ∞ f x) (he : ∀ x, f (-x) = f x) (hb : ∀ x ∈ uIcc 0 a, |deriv (deriv f) x| ≤ B) : |f a - f 0| ≤ B*a^2 := by have hTaylor := calibration_scaled_second_taylor (fun x => f x - f 0) a (fun x hx => (hf x hx).sub contDiffAt_const) (by simp) (by rw [deriv_sub_const]; exact calibration_even_deriv_zero f he) simp only [deriv_sub_const_fun] at hTaylor have hi : |∫ v in (0 : ℝ)..1, (1-v)*deriv (deriv f) (v*a)| ≤ B := by have h := intervalIntegral.norm_integral_le_of_norm_le_const (C := B) (f := fun v => (1-v)*deriv (deriv f) (v*a)) (a := 0) (b := 1) (by intro v hv have hv' : v ∈ Icc (0 : ℝ) 1 := by rw [Set.uIoc_of_le (by norm_num)] at hv exact ⟨hv.1.le,hv.2⟩ rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (by linarith [hv'.2] : 0 ≤ 1-v)] have hd := hb _ (calibration_unit_mul_mem_segment a v hv') have hm : 0 ≤ v*|deriv (deriv f) (v*a)| := mul_nonneg hv'.1 (abs_nonneg _) nlinarith) simpa using h rw [← hTaylor, abs_mul, abs_of_nonneg (sq_nonneg a)] nlinarith [sq_nonneg a]
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_even_quadratic_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootTaylorBounds.lean:25

[Scalar coordinate partial derivative of a joint parameter function.

Definition (Lean source)
f :
(Fin 3 → ℝ) → ℝ
i :
Fin 3
w :
Fin 3 → ℝ
calibrationCoordinateDeriv f i w :
ℝ
deriv (fun D => f (update w i D)) (w i)
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrationCoordinateDeriv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootTaylorBounds.lean:52
theorem calibrationCoordinateDeriv_contDiffAt

Coordinate differentiation preserves joint smoothness at the actual parameter point. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
f :
(Fin 3 → ℝ) → ℝ
i :
Fin 3
v :
Fin 3 → ℝ
hf :
ContDiffAt ℝ ∞ f v
Proof (Lean source)
-- @node: calibrationCoordinateDeriv_contDiffAt lemma calibrationCoordinateDeriv_contDiffAt (f : (Fin 3 → ℝ) → ℝ) (i : Fin 3) (v : Fin 3 → ℝ) (hf : ContDiffAt ℝ ∞ f v) : ContDiffAt ℝ ∞ (calibrationCoordinateDeriv f i) v := by classical unfold calibrationCoordinateDeriv have hLift : ContDiffAt ℝ ∞ (fun z : (Fin 3 → ℝ) × ℝ => f (update z.1 i z.2)) (v,v i) := by have hp : ContDiffAt ℝ ∞ (fun z : (Fin 3 → ℝ) × ℝ => update z.1 i z.2) (v,v i) := by apply contDiffAt_pi.mpr intro j by_cases hj : j = i · subst j simp only [Function.update_self] fun_prop · simp only [Function.update_of_ne hj] fun_prop have hf' : ContDiffAt ℝ ∞ f (update v i (v i)) := by simpa using hf exact hf'.comp (v,v i) hp exact (hLift.fderiv (by fun_prop) (by simp)).clm_apply contDiffAt_const
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrationCoordinateDeriv_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootTaylorBounds.lean:57
theorem fairRoot_second_partial_bounds Lemma fairRoot_second_partial_bounds in the paper ↗

[Smoothness on the closed calibration region uniformly bounds the actual second amplitude derivatives of the root and its spatial derivative. the documented result Under the stated assumptions.

Formal statement
ε :
ℝ
hf :
∀ v ∈ fairParameterRegion ε,
ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v
∃ B : ℝ,
0 < B
conclusion 1
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
|deriv (deriv (fun D => fairRoot t D u)) δ| ≤ B
|deriv (deriv (fun D => deriv (fairRoot t D) u)) δ| ≤ B
Proof (Lean source)
-- @node: fairRoot_second_partial_bounds lemma fairRoot_second_partial_bounds (ε : ℝ) (hf : ∀ v ∈ fairParameterRegion ε, ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v) : ∃ B : ℝ, 0 < B ∧ ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → |deriv (deriv (fun D => fairRoot t D u)) δ| ≤ B ∧ |deriv (deriv (fun D => deriv (fairRoot t D) u)) δ| ≤ B := by let f : (Fin 3 → ℝ) → ℝ := fun w => fairRoot (w 0) (w 1) (w 2) let A := calibrationCoordinateDeriv (calibrationCoordinateDeriv f 1) 1 let U := calibrationCoordinateDeriv (calibrationCoordinateDeriv (calibrationCoordinateDeriv f 2) 1) 1 have ha : ∀ v ∈ fairParameterRegion ε, ContDiffAt ℝ ∞ A v := by intro v hv exact calibrationCoordinateDeriv_contDiffAt _ _ _ (calibrationCoordinateDeriv_contDiffAt _ _ _ (hf v hv)) have hu : ∀ v ∈ fairParameterRegion ε, ContDiffAt ℝ ∞ U v := by intro v hv exact calibrationCoordinateDeriv_contDiffAt _ _ _ (calibrationCoordinateDeriv_contDiffAt _ _ _ (calibrationCoordinateDeriv_contDiffAt _ _ _ (hf v hv))) obtain ⟨Ca,hCa⟩ := (fairParameterRegion_isCompact ε).exists_bound_of_continuousOn (fun v hv => (ha v hv).continuousAt.continuousWithinAt) obtain ⟨Cu,hCu⟩ := (fairParameterRegion_isCompact ε).exists_bound_of_continuousOn (fun v hv => (hu v hv).continuousAt.continuousWithinAt) refine ⟨max 1 (max Ca Cu), lt_of_lt_of_le (by norm_num) (le_max_left _ _), ?_⟩ intro t δ u ht hδ hu' have hv : ![t,δ,u] ∈ fairParameterRegion ε := ⟨ht,hδ,hu'⟩ have h1 := (hCa _ hv).trans ((le_max_left Ca Cu).trans (le_max_right 1 (max Ca Cu))) have h2 := (hCu _ hv).trans ((le_max_right Ca Cu).trans (le_max_right 1 (max Ca Cu))) simpa [A,U,f,calibrationCoordinateDeriv,Real.norm_eq_abs,update] using intro h1 h2
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_second_partial_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootTaylorBounds.lean:80
theorem calibration_deriv_zero_on_unit_interval Lemma calibration_deriv_zero_on_unit_interval in the paper ↗

Constancy on the closed spatial interval forces the actual derivative to vanish even at the endpoints, where two-sided smoothness is available. the documented result Under the stated assumptions.

Formal statement
f :
ℝ → ℝ
c u :
ℝ
hu :
u ∈ Icc (0 : ℝ) 1
hf :
hc :
∀ x ∈ Icc (0 : ℝ) 1, f x = c
deriv f u = 0
Proof (Lean source)
-- @node: calibration_deriv_zero_on_unit_interval lemma calibration_deriv_zero_on_unit_interval (f : ℝ → ℝ) (c u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) (hf : DifferentiableAt ℝ f u) (hc : ∀ x ∈ Icc (0 : ℝ) 1, f x = c) : deriv f u = 0 := by have huniq := uniqueDiffOn_Icc_zero_one u hu rw [← hf.derivWithin huniq] rw [derivWithin_congr (fun x hx => hc x hx) (hc u hu)] exact congrFun (derivWithin_const _ _) u
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_deriv_zero_on_unit_interval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootTaylorBounds.lean:114
theorem fairRoot_quadratic_bound_of_smooth Lemma fairRoot_quadratic_bound_of_smooth in the paper ↗

[Smoothness and the zero-amplitude center derive one uniform quadratic bound for the actual fair root and its spatial derivative. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
ε :
ℝ
hε :
0 ≤ ε
hf :
∀ v ∈ fairParameterRegion ε,
ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v
haxis :
∀ t u : ℝ
if
t ∈ Icc (0 : ℝ) (1/4)
and
u ∈ Icc (0 : ℝ) 1
then
fairRoot t 0 u = 2/5
∃ M : ℝ,
0 < M
conclusion 1
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
|fairRoot t δ u-2/5|+|deriv (fairRoot t δ) u| ≤ M*δ^2
Proof (Lean source)
-- @node: fairRoot_quadratic_bound_of_smooth lemma fairRoot_quadratic_bound_of_smooth (ε : ℝ) (hε : 0 ≤ ε) (hf : ∀ v ∈ fairParameterRegion ε, ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v) (haxis : ∀ t u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → u ∈ Icc (0 : ℝ) 1 → fairRoot t 0 u = 2/5) : ∃ M : ℝ, 0 < M ∧ ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → |fairRoot t δ u-2/5|+|deriv (fairRoot t δ) u| ≤ M*δ^2 := by obtain ⟨B,hB,hbound⟩ := fairRoot_second_partial_bounds ε hf refine ⟨2*B, by positivity, ?_⟩ intro t δ u ht hδ hu have hmem (D : ℝ) (hD : D ∈ uIcc 0 δ) : |D| ≤ ε := (calibration_segment_abs_le δ D hD).trans hδ have hp (D : ℝ) (hD : |D| ≤ ε) : ContDiffAt ℝ ∞ (fun A => fairRoot t A u) D := by exact (hf ![t,D,u] ⟨ht,hD,hu⟩).comp D (show ContDiffAt ℝ ∞ (fun A : ℝ => ![t,A,u]) D by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) have hs (D : ℝ) (hD : |D| ≤ ε) : ContDiffAt ℝ ∞ (fun A => deriv (fairRoot t A) u) D := by have h := calibrationCoordinateDeriv_contDiffAt _ 2 _ (hf ![t,D,u] ⟨ht,hD,hu⟩) have h' := h.comp D (show ContDiffAt ℝ ∞ (fun A : ℝ => ![t,A,u]) D by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) simpa [Function.comp_def,calibrationCoordinateDeriv,update] using h' have hzero : deriv (fairRoot t 0) u = 0 := by apply calibration_deriv_zero_on_unit_interval _ (2/5) u hu · exact ((hf ![t,0,u] ⟨ht,by simpa using hε,hu⟩).comp u (show ContDiffAt ℝ ∞ (fun U : ℝ => ![t,0,U]) u by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop)).differentiableAt (by simp) · exact fun x hx => haxis t x ht hx have hroot := calibration_even_quadratic_bound (fun D => fairRoot t D u) δ B (fun D hD => hp D (hmem D hD)) (fun D => fairRoot_even t D u) (fun D hD => (hbound t D u ht (hmem D hD) hu).1) have hspatial := calibration_even_quadratic_bound (fun D => deriv (fairRoot t D) u) δ B (fun D hD => hs D (hmem D hD)) (fun D => by rw [show fairRoot t (-D) = fairRoot t D from funext (fun U => fairRoot_even t D U)]) (fun D hD => (hbound t D u ht (hmem D hD) hu).2) rw [haxis t u ht hu] at hroot rw [hzero,sub_zero] at hspatial linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_quadratic_bound_of_smooth · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairRootTaylorBounds.lean:125
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairSingletonMatching 11 declarations The explicit comparator effect matches the two-point risk average at both cell endpoints.

Exact fair singleton matching

The explicit comparator effect matches the two-point risk average at both cell endpoints. The zero-effect and zero-amplitude identities also cover the axes when assembling matching from the normalized root equation.

theorem comparatorEffect_zero_amplitude

[The fair comparator preserves effect on the zero-amplitude axis. the stated conclusion holds.

Formal statement
t :
ℝ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:15
theorem comparatorEffect_zero_effect Lemma comparatorEffect_zero_effect in the paper ↗

The fair comparator vanishes on the zero-effect axis. the stated conclusion holds.

Formal statement
δ :
ℝ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:19

Zero effect makes the risk shift the identity. the stated conclusion holds.

Formal statement
ξ :
ℝ
riskShift 0 ξ = ξ
Proof (Lean source)
-- @node: riskShift_zero_effect lemma riskShift_zero_effect (ξ : ℝ) : riskShift 0 ξ = ξ := by simp [riskShift]
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:24
theorem fairNumerator_zero_amplitude Lemma fairNumerator_zero_amplitude in the paper ↗

The fair numerator vanishes for zero amplitude, at every centering value. the stated conclusion holds.

Formal statement
t ξ u :
ℝ
fairNumerator t 0 ξ u = 0
Proof (Lean source)
-- @node: fairNumerator_zero_amplitude lemma fairNumerator_zero_amplitude (t ξ u : ℝ) : fairNumerator t 0 ξ u = 0 := by simp [fairNumerator, comparatorEffect_zero_amplitude, signAverage, Fintype.sum_prod_type, Fintype.sum_bool]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:29
theorem fairNumerator_zero_effect Lemma fairNumerator_zero_effect in the paper ↗

The mean-zero sign field gives exact matching at zero effect. the stated conclusion holds.

Formal statement
δ ξ u :
ℝ
fairNumerator 0 δ ξ u = 0
Proof (Lean source)
-- @node: fairNumerator_zero_effect lemma fairNumerator_zero_effect (δ ξ u : ℝ) : fairNumerator 0 δ ξ u = 0 := by simp [fairNumerator, comparatorEffect_zero_effect, riskShift_zero_effect, signAverage, Fintype.sum_prod_type, Fintype.sum_bool, localSignField, signValue] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:35
theorem fair_matching_denominators Lemma fair_matching_denominators in the paper ↗

Positivity of the logarithm arguments and shifted-risk denominators in the fair construction. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
d :
exp t - 1
B :
1 + d*(2/5)
0 < B
0 < 1-d*δ^2/((2/5)*B)
0 < 1+d*δ^2/((1-2/5)*B)
0 < 1+d*(2/5+δ)
0 < 1+d*(2/5-δ)
Proof (Lean source)
-- @node: fair_matching_denominators lemma fair_matching_denominators (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) : let d := exp t - 1 let B := 1 + d*(2/5) 0 < B ∧ 0 < 1-d*δ^2/((2/5)*B) ∧ 0 < 1+d*δ^2/((1-2/5)*B) ∧ 0 < 1+d*(2/5+δ) ∧ 0 < 1+d*(2/5-δ) := by dsimp only obtain ⟨hdlo, hdhi⟩ := fair_exp_increment_bounds t ht have hd : 0 ≤ exp t - 1 := ht.1.trans hdlo have hd' : exp t - 1 ≤ 1/3 := by linarith [ht.2] obtain ⟨hδlo, hδhi⟩ := abs_le.mp hδ have hsq : δ^2 ≤ 1/10000 := by nlinarith have hB : 1 ≤ 1+(exp t-1)*(2/5) := by linarith have hBp : 0 < 1+(exp t-1)*(2/5) := by linarith have hprod : (exp t-1)*δ^2 ≤ 1/30000 := by nlinarith [mul_nonneg hd (sub_nonneg.mpr hsq)] refine ⟨hBp, ?_, ?_, ?_, ?_⟩ · have hden : 0 < (2/5 : ℝ)*(1+(exp t-1)*(2/5)) := by positivity have hlt : (exp t-1)*δ^2/((2/5)*(1+(exp t-1)*(2/5))) < 1 := (div_lt_one hden).mpr (by linarith) linarith · positivity · have hx : 0 ≤ 2/5+δ := by linarith positivity · have hx : 0 ≤ 2/5-δ := by linarith positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_matching_denominators · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:42
theorem comparatorEffect_exp_formula Lemma comparatorEffect_exp_formula in the paper ↗

The comparator exponential is exactly the rational odds correction in the roadmap. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
= exp t * (1-(exp t-1)*δ^2/((2/5)*(1+(exp t-1)*(2/5)))) / (1+(exp t-1)*δ^2/((1-2/5)*(1+(exp t-1)*(2/5))))
Proof (Lean source)
-- @node: comparatorEffect_exp_formula lemma comparatorEffect_exp_formula (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) : exp (comparatorEffect t δ) = exp t * (1-(exp t-1)*δ^2/((2/5)*(1+(exp t-1)*(2/5)))) / (1+(exp t-1)*δ^2/((1-2/5)*(1+(exp t-1)*(2/5)))) := by obtain ⟨_, ha, hb, _, _⟩ := fair_matching_denominators t δ ht hδ unfold comparatorEffect rw [Real.exp_sub, Real.exp_add, Real.exp_log ha, Real.exp_log hb]
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_exp_formula · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:72
theorem fair_two_point_matching Lemma fair_two_point_matching in the paper ↗

At the fixed centering value, the fair comparator matches the average of the two shifted risks. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
(riskShift t (2/5+δ)+riskShift t (2/5-δ))/2 = riskShift (comparatorEffect t δ) (2/5)
Proof (Lean source)
-- @node: fair_two_point_matching lemma fair_two_point_matching (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) : (riskShift t (2/5+δ)+riskShift t (2/5-δ))/2 = riskShift (comparatorEffect t δ) (2/5) := by obtain ⟨hB, ha, hb, hp, hm⟩ := fair_matching_denominators t δ ht hδ have he := comparatorEffect_exp_formula t δ ht hδ have hc : 0 < 1+(exp (comparatorEffect t δ)-1)*(2/5) := by nlinarith [Real.exp_pos (comparatorEffect t δ)] have hd : 0 ≤ exp t - 1 := ht.1.trans (fair_exp_increment_bounds t ht).1 unfold riskShift field_simp (disch := nlinarith [Real.exp_pos t]) at he ⊢ field_simp (disch := positivity) at he nlinarith [he]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_two_point_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:83
theorem fair_endpoint_sign_average Lemma fair_endpoint_sign_average in the paper ↗

At either cell endpoint, the sign field has the law of one fair sign. Under the stated assumptions.

Formal statement
F :
ℝ → ℝ
u :
ℝ
hu :
u = 0 ∨ u = 1
signAverage (fun s => F (localSignField u s)) = (F 1+F (-1))/2
Proof (Lean source)
-- @node: fair_endpoint_sign_average lemma fair_endpoint_sign_average (F : ℝ → ℝ) (u : ℝ) (hu : u = 0 ∨ u = 1) : signAverage (fun s => F (localSignField u s)) = (F 1+F (-1))/2 := by rcases hu with rfl | rfl · simp [signAverage, Fintype.sum_prod_type, Fintype.sum_bool, localSignField, signValue] ring · simp [signAverage, Fintype.sum_prod_type, Fintype.sum_bool, localSignField, signValue] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_endpoint_sign_average · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:99
theorem fairNumerator_endpoints Lemma fairNumerator_endpoints in the paper ↗

The explicit fair comparator has exactly zero endpoint numerator at the prescribed center. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hu :
u = 0 ∨ u = 1
fairNumerator t δ (2/5) u = 0
Proof (Lean source)
-- @node: fairNumerator_endpoints lemma fairNumerator_endpoints (t δ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hu : u = 0 ∨ u = 1) : fairNumerator t δ (2/5) u = 0 := by unfold fairNumerator rw [fair_endpoint_sign_average (fun z => riskShift t (2/5+δ*z)) u hu] simp only [mul_one, mul_neg_one, ← sub_eq_add_neg] rw [fair_two_point_matching t δ ht hδ, sub_self]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:109
theorem fair_matching_of_normalized_equation Lemma fair_matching_of_normalized_equation in the paper ↗

A normalized root gives singleton matching; the zero axes use their exact identities. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ ξ u :
ℝ
hroot :
fairEquation t δ ξ u = 0
hdiv :
t*δ ≠ 0 → fairEquation t δ ξ u = fairNumerator t δ ξ u/(t*δ^2)
signAverage (fun s => riskShift t (ξ+δ*localSignField u s))
Proof (Lean source)
-- @node: fair_matching_of_normalized_equation lemma fair_matching_of_normalized_equation (t δ ξ u : ℝ) (hroot : fairEquation t δ ξ u = 0) (hdiv : t*δ ≠ 0 → fairEquation t δ ξ u = fairNumerator t δ ξ u/(t*δ^2)) : signAverage (fun s => riskShift t (ξ+δ*localSignField u s)) = riskShift (comparatorEffect t δ) ξ := by apply sub_eq_zero.mp change fairNumerator t δ ξ u = 0 by_cases ht : t = 0 · subst t exact fairNumerator_zero_effect δ ξ u by_cases hδ : δ = 0 · subst δ exact fairNumerator_zero_amplitude t ξ u have hden : t*δ^2 ≠ 0 := mul_ne_zero ht (pow_ne_zero _ hδ) have hquot : fairNumerator t δ ξ u/(t*δ^2) = 0 := (hdiv (mul_ne_zero ht hδ)).symm.trans hroot exact (div_eq_zero_iff.mp hquot).resolve_right hden
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_matching_of_normalized_equation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSingletonMatching.lean:119
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairSpatialOscillation 5 declarations The logit is Lipschitz on the fixed interior risk interval.

Fair prognosis oscillation at the calibrated amplitude scale

The logit is Lipschitz on the fixed interior risk interval. Quadratic root centering and the bounded sign field give an exponent-uniform oscillation bound for the actual random law and deterministic comparator.

theorem calibrated_log_difference_le Lemma calibrated_log_difference_le in the paper ↗

[The logarithm has Lipschitz constant three on the interior interval used for a risk and its complement. the documented result Under the stated assumptions.

Formal statement
p q :
ℝ
hp :
p ∈ Icc (1/3 : ℝ) 1
hq :
q ∈ Icc (1/3 : ℝ) 1
|log p - log q| ≤ 3 * |p-q|
Proof (Lean source)
-- @node: calibrated_log_difference_le lemma calibrated_log_difference_le (p q : ℝ) (hp : p ∈ Icc (1/3 : ℝ) 1) (hq : q ∈ Icc (1/3 : ℝ) 1) : |log p - log q| ≤ 3 * |p-q| := by have hd : ∀ x ∈ Icc (1/3 : ℝ) 1, HasDerivWithinAt log x⁻¹ (Icc (1/3 : ℝ) 1) x := by intro x hx exact (Real.hasDerivAt_log (by linarith [hx.1])).hasDerivWithinAt have hb : ∀ x ∈ Icc (1/3 : ℝ) 1, ‖x⁻¹‖ ≤ (3 : ℝ) := by intro x hx have hxpos : 0 < x := by linarith [hx.1] rw [Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hxpos)] rw [← one_div] apply (div_le_iff₀ hxpos).mpr linarith [hx.1] simpa only [Real.norm_eq_abs] using (convex_Icc (1/3 : ℝ) 1).norm_image_sub_le_of_norm_hasDerivWithin_le hd hb hq hp
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_log_difference_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSpatialOscillation.lean:17
theorem calibrated_logit_difference_le Lemma calibrated_logit_difference_le in the paper ↗

Positive floors for a risk and its complement bound logit differences by six times the risk difference. the documented result Under the stated assumptions.

Formal statement
p q :
ℝ
hp :
p ∈ Icc (1/3 : ℝ) (2/3)
hq :
q ∈ Icc (1/3 : ℝ) (2/3)
|logit p-logit q| ≤ 6*|p-q|
Proof (Lean source)
-- @node: calibrated_logit_difference_le lemma calibrated_logit_difference_le (p q : ℝ) (hp : p ∈ Icc (1/3 : ℝ) (2/3)) (hq : q ∈ Icc (1/3 : ℝ) (2/3)) : |logit p-logit q| ≤ 6*|p-q| := by have hp0 : p ≠ 0 := by linarith [hp.1] have hq0 : q ≠ 0 := by linarith [hq.1] have hpc : 1-p ≠ 0 := by linarith [hp.2] have hqc : 1-q ≠ 0 := by linarith [hq.2] have h1 := calibrated_log_difference_le p q ⟨hp.1, by linarith [hp.2]⟩ ⟨hq.1, by linarith [hq.2]⟩ have h2 := calibrated_log_difference_le (1-p) (1-q) ⟨by linarith [hp.2], by linarith [hp.1]⟩ ⟨by linarith [hq.2], by linarith [hq.1]⟩ have hc : |(1-p)-(1-q)| = |p-q| := by rw [show (1-p)-(1-q) = -(p-q) by ring, abs_neg] rw [hc] at h2 simp only [logit, Real.log_div hp0 hpc, Real.log_div hq0 hqc] calc _ = |(log p-log q)-(log (1-p)-log (1-q))| := by congr 1; ring _ ≤ |log p-log q| + |log (1-p)-log (1-q)| := abs_sub _ _ _ ≤ 6*|p-q| := by linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_logit_difference_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSpatialOscillation.lean:37
theorem fairCells_prognosis_displacement Lemma fairCells_prognosis_displacement in the paper ↗

The actual fair native control logit stays near the fixed center with linear sign-field displacement and quadratic root displacement. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ B :
ℝ
hδ :
|δ| ≤ 1/100
hp :
∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100
hB :
∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ B*δ^2
hv :
ValidCells (fairCells b k σ t δ)
x :
|prognosisLogit (totalCellLaw (fairCells b k σ t δ)) x-logit (2/5)| ≤ 6*(B*δ^2+2*|δ|)
Proof (Lean source)
-- @node: fairCells_prognosis_displacement lemma fairCells_prognosis_displacement (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ B : ℝ) (hδ : |δ| ≤ 1/100) (hp : ∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100) (hB : ∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ B*δ^2) (hv : ValidCells (fairCells b k σ t δ)) (x : Covariate) : |prognosisLogit (totalCellLaw (fairCells b k σ t δ)) x-logit (2/5)| ≤ 6*(B*δ^2+2*|δ|) := by change |logit (armRisk (totalCellLaw (fairCells b k σ t δ)) false x)-logit (2/5)| ≤ _ rw [fairCells_armRisk_control b k σ t δ hv x] have hi := fair_control_risk_bounds_of_centering b k σ t δ x hδ (hp x) have hl := calibrated_logit_difference_le _ (2/5) hi (by norm_num) have hs : |δ*signFieldZ k σ x| ≤ 2*|δ| := by rw [abs_mul] nlinarith [mul_le_mul_of_nonneg_left (signFieldZ_abs_le_two k σ x) (abs_nonneg δ)] have hr : |(if b then fairRoot t δ (cellCoord k x)+δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x))-2/5| ≤ B*δ^2+2*|δ| := by cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] · linarith [hB x, abs_nonneg δ] · calc _ = |(fairRoot t δ (cellCoord k x)-2/5)+δ*signFieldZ k σ x| := by congr 1; ring _ ≤ |fairRoot t δ (cellCoord k x)-2/5|+|δ*signFieldZ k σ x| := abs_add_le _ _ _ ≤ _ := add_le_add (hB x) hs exact hl.trans (mul_le_mul_of_nonneg_left hr (by norm_num))
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_prognosis_displacement · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSpatialOscillation.lean:62
theorem fairCells_prognosis_oscillation_of_centering Lemma fairCells_prognosis_oscillation_of_centering in the paper ↗

[Two displacements from the same fixed center give the actual fair prognosis oscillation; fallback laws have constant zero prognosis. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
t δ B :
ℝ
hBnonneg :
0 ≤ B
hδ :
|δ| ≤ 1/100
hp :
∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100
hB :
∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ B*δ^2
x z :
≤ 12*B*δ^2+24*|δ|
Proof (Lean source)
-- @node: fairCells_prognosis_oscillation_of_centering lemma fairCells_prognosis_oscillation_of_centering (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (t δ B : ℝ) (hBnonneg : 0 ≤ B) (hδ : |δ| ≤ 1/100) (hp : ∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100) (hB : ∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ B*δ^2) (x z : Covariate) : |prognosisLogit (totalCellLaw (fairCells b k σ t δ)) x- prognosisLogit (totalCellLaw (fairCells b k σ t δ)) z| ≤ 12*B*δ^2+24*|δ| := by classical by_cases hv : ValidCells (fairCells b k σ t δ) · have hx := fairCells_prognosis_displacement b k σ t δ B hδ hp hB hv x have hz := fairCells_prognosis_displacement b k σ t δ B hδ hp hB hv z have ht := abs_sub_le (prognosisLogit (totalCellLaw (fairCells b k σ t δ)) x) (logit (2/5)) (prognosisLogit (totalCellLaw (fairCells b k σ t δ)) z) rw [abs_sub_comm (logit (2/5))] at ht linarith · have hz : ∀ w, prognosisLogit (totalCellLaw (fairCells b k σ t δ)) w = 0 := by intro w norm_num [prognosisLogit, armRisk, totalCellLaw, hv, lawFromCells, logit] rw [hz x, hz z, sub_self, abs_zero] positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_prognosis_oscillation_of_centering · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSpatialOscillation.lean:89
theorem fairCells_uniform_prognosis_oscillation Lemma fairCells_uniform_prognosis_oscillation in the paper ↗

One absolute positive amplitude radius gives the prescribed fair prognosis oscillation at every nonnegative exponent and every rank. the documented result

Formal statement
∃ r : ℝ,
0 < r
r ≤ 1/100
conclusion 1
ε :
ℝ
0 < ε
ε ≤ r
β :
ℝ
0 ≤ β
k :
ℕ
1 ≤ k
σ :
Fin (k+1) → Bool
t :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
b :
x z :
|prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) x- prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) z|
≤ 2*(k : ℝ)^(-β)
Proof (Lean source)
-- @node: fairCells_uniform_prognosis_oscillation lemma fairCells_uniform_prognosis_oscillation : ∃ r : ℝ, 0 < r ∧ r ≤ 1/100 ∧ ∀ ε : ℝ, 0 < ε → ε ≤ r → ∀ β : ℝ, 0 ≤ β → ∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k+1) → Bool, ∀ t : ℝ, t ∈ Icc (0 : ℝ) (1/4) → ∀ b, ∀ x z, |prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) x- prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) z| ≤ 2*(k : ℝ)^(-β) := by obtain ⟨a, B, ha, hB, _, _, _, _, hf⟩ := exact_calibrations let r := min a (min (1/100) (1/(100*(B+1)))) have hr : 0 < r := lt_min ha (lt_min (by norm_num) (by positivity)) have hra : r ≤ a := min_le_left _ _ have hrs : r ≤ 1/100 := (min_le_right _ _).trans (min_le_left _ _) have hrB : r ≤ 1/(100*(B+1)) := (min_le_right _ _).trans (min_le_right _ _) have hBr : B*r ≤ 1/100 := by have hh := (le_div_iff₀ (show 0 < 100*(B+1) by positivity)).mp hrB nlinarith refine ⟨r, hr, hrs, ?_⟩ intro ε hε hεr β hβ k hk σ t ht b x z let δ := ε*(k : ℝ)^(-β) have hd : |δ| ≤ ε := calibrated_amplitude_abs_le ε β hε.le hβ k hk have hdr : |δ| ≤ r := hd.trans hεr have hb : ∀ w : Covariate, |fairRoot t δ (cellCoord k w)-2/5| ≤ B*δ^2 := by intro w have hh := (hf t δ (cellCoord k w) ht (hdr.trans hra) (cellCoord_mem_unit k hk w)).2.2.2.2.2.2.2.2.1 linarith [abs_nonneg (deriv (fairRoot t δ) (cellCoord k w))] have hp : ∀ w : Covariate, |fairRoot t δ (cellCoord k w)-2/5| ≤ 1/100 := by intro w have hs : δ^2 ≤ r^2 := by nlinarith [sq_abs δ, abs_nonneg δ] have hh := mul_le_mul_of_nonneg_left hs hB.le nlinarith [hb w] have ho := fairCells_prognosis_oscillation_of_centering b k σ t δ B hB.le (hdr.trans hrs) hp hb x z have hds : δ^2 ≤ r*|δ| := by nlinarith [sq_abs δ, abs_nonneg δ] have hsmall : 12*B*r+24 ≤ 26 := by linarith have hosc : 12*B*δ^2+24*|δ| ≤ 26*|δ| := by nlinarith [mul_le_mul_of_nonneg_left hds hB.le] have heps : 26*ε ≤ 2 := by linarith [hεr.trans hrs] calc _ ≤ 12*B*δ^2+24*|δ| := ho _ ≤ 26*|δ| := hosc _ ≤ 2*(k : ℝ)^(-β) := by have hδpos : 0 ≤ δ := by dsimp [δ]; positivity have hrate : |δ| = ε*(k : ℝ)^(-β) := abs_of_nonneg hδpos have hh := mul_le_mul_of_nonneg_right heps (Real.rpow_nonneg (Nat.cast_nonneg k) (-β)) rw [hrate] nlinarith [hh]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_uniform_prognosis_oscillation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairSpatialOscillation.lean:116
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairTaylorDerivatives 10 declarations The two amplitude derivatives and subsequent effect derivative are jointly smooth on full neighborhoods of the calibration box.

Actual derivatives in the fair Taylor extension

The two amplitude derivatives and subsequent effect derivative are jointly smooth on full neighborhoods of the calibration box. These are derivatives of the actual numerator, with all four parameters allowed to vary.

theorem calibration_partial_contDiffAt Lemma calibration_partial_contDiffAt in the paper ↗

Taking a scalar partial derivative preserves joint smoothness of a smooth family. Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
E → ℝ → ℝ
g :
E → ℝ
x :
E
hf :
ContDiffAt ℝ ⊤ (uncurry f) (x, g x)
hg :
ContDiffAt ℝ ⊤ g x
ContDiffAt ℝ ⊤ (fun w => deriv (f w) (g w)) x
Proof (Lean source)
-- @node: calibration_partial_contDiffAt lemma calibration_partial_contDiffAt {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (f : E → ℝ → ℝ) (g : E → ℝ) (x : E) (hf : ContDiffAt ℝ ⊤ (uncurry f) (x, g x)) (hg : ContDiffAt ℝ ⊤ g x) : ContDiffAt ℝ ⊤ (fun w => deriv (f w) (g w)) x := by exact (hf.fderiv hg (by simp)).clm_apply contDiffAt_const
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_partial_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:18
theorem fairNumerator_amplitude_deriv_contDiffAt Lemma fairNumerator_amplitude_deriv_contDiffAt in the paper ↗

The first amplitude derivative is smooth jointly in effect, amplitude, center and position. Under the stated assumptions. Under the stated assumptions.

Formal statement
v :
Fin 4 → ℝ
ht :
v 0 ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|v 1| ≤ 1 / 100
hξ :
v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)
ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => deriv (fun D => fairNumerator (w 0) D (w 2) (w 3)) (w 1)) v
Proof (Lean source)
-- @node: fairNumerator_amplitude_deriv_contDiffAt lemma fairNumerator_amplitude_deriv_contDiffAt (v : Fin 4 → ℝ) (ht : v 0 ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |v 1| ≤ 1 / 100) (hξ : v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)) : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => deriv (fun D => fairNumerator (w 0) D (w 2) (w 3)) (w 1)) v := by apply calibration_partial_contDiffAt · exact (fairNumerator_contDiffAt ![v 0,v 1,v 2,v 3] ht hδ hξ).comp (v, v 1) (show ContDiffAt ℝ ⊤ (fun z : (Fin 4 → ℝ) × ℝ => ![z.1 0,z.2,z.1 2,z.1 3]) (v,v 1) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) · fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_amplitude_deriv_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:27
theorem fairNumerator_second_amplitude_deriv_contDiffAt Lemma fairNumerator_second_amplitude_deriv_contDiffAt in the paper ↗

Both amplitude derivatives remain jointly smooth, including at zero amplitude. Under the stated assumptions. Under the stated assumptions.

Formal statement
v :
Fin 4 → ℝ
ht :
v 0 ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|v 1| ≤ 1 / 100
hξ :
v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)
ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => deriv (deriv (fun D => fairNumerator (w 0) D (w 2) (w 3))) (w 1)) v
Proof (Lean source)
-- @node: fairNumerator_second_amplitude_deriv_contDiffAt lemma fairNumerator_second_amplitude_deriv_contDiffAt (v : Fin 4 → ℝ) (ht : v 0 ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |v 1| ≤ 1 / 100) (hξ : v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)) : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => deriv (deriv (fun D => fairNumerator (w 0) D (w 2) (w 3))) (w 1)) v := by apply calibration_partial_contDiffAt · exact (fairNumerator_amplitude_deriv_contDiffAt ![v 0,v 1,v 2,v 3] ht hδ hξ).comp (v, v 1) (show ContDiffAt ℝ ⊤ (fun z : (Fin 4 → ℝ) × ℝ => ![z.1 0,z.2,z.1 2,z.1 3]) (v,v 1) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) · fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_second_amplitude_deriv_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:43
theorem fairNumerator_taylor_deriv_contDiffAt Lemma fairNumerator_taylor_deriv_contDiffAt in the paper ↗

The actual third derivative appearing inside the double Taylor integral is jointly smooth. Under the stated assumptions. Under the stated assumptions.

Formal statement
v :
Fin 4 → ℝ
ht :
v 0 ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|v 1| ≤ 1 / 100
hξ :
v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)
ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => deriv (fun T => deriv (deriv (fun D => fairNumerator T D (w 2) (w 3))) (w 1)) (w 0)) v
Proof (Lean source)
-- @node: fairNumerator_taylor_deriv_contDiffAt lemma fairNumerator_taylor_deriv_contDiffAt (v : Fin 4 → ℝ) (ht : v 0 ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |v 1| ≤ 1 / 100) (hξ : v 2 ∈ Icc (3 / 10 : ℝ) (1 / 2)) : ContDiffAt ℝ ⊤ (fun w : Fin 4 → ℝ => deriv (fun T => deriv (deriv (fun D => fairNumerator T D (w 2) (w 3))) (w 1)) (w 0)) v := by apply calibration_partial_contDiffAt · exact (fairNumerator_second_amplitude_deriv_contDiffAt ![v 0,v 1,v 2,v 3] ht hδ hξ).comp (v, v 0) (show ContDiffAt ℝ ⊤ (fun z : (Fin 4 → ℝ) × ℝ => ![z.2,z.1 1,z.1 2,z.1 3]) (v,v 0) by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) · fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_taylor_deriv_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:59
theorem calibration_segment_abs_le Lemma calibration_segment_abs_le in the paper ↗

A segment from zero to a signed amplitude stays inside its absolute-value bound. Under the stated assumptions.

Formal statement
a x :
ℝ
hx :
x ∈ uIcc 0 a
|x| ≤ |a|
Proof (Lean source)
-- @node: calibration_segment_abs_le lemma calibration_segment_abs_le (a x : ℝ) (hx : x ∈ uIcc 0 a) : |x| ≤ |a| := by rcases le_total 0 a with ha | ha · rw [Set.uIcc_of_le ha] at hx rw [abs_of_nonneg hx.1, abs_of_nonneg ha] exact hx.2 · rw [Set.uIcc_of_ge ha] at hx rw [abs_of_nonpos hx.2, abs_of_nonpos ha] exact neg_le_neg hx.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_segment_abs_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:76
theorem calibration_unit_mul_mem_segment Lemma calibration_unit_mul_mem_segment in the paper ↗

[Multiplication by a unit-interval coordinate lies on the signed amplitude segment. the stated conclusion holds. Under the stated assumptions.

Formal statement
a s :
ℝ
hs :
s ∈ Icc (0 : ℝ) 1
s*a ∈ uIcc 0 a
Proof (Lean source)
-- @node: calibration_unit_mul_mem_segment lemma calibration_unit_mul_mem_segment (a s : ℝ) (hs : s ∈ Icc (0 : ℝ) 1) : s*a ∈ uIcc 0 a := by rcases le_total 0 a with ha | ha · rw [Set.uIcc_of_le ha] exact ⟨mul_nonneg hs.1 ha, by nlinarith [hs.2]⟩ · rw [Set.uIcc_of_ge ha] exact ⟨by nlinarith [hs.2], mul_nonpos_of_nonneg_of_nonpos hs.1 ha⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_unit_mul_mem_segment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:87
theorem calibration_scaled_fundamental_theorem Lemma calibration_scaled_fundamental_theorem in the paper ↗

Rescaling the fundamental theorem works for signed increments and at zero. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
f :
ℝ → ℝ
a :
ℝ
hf :
∀ x ∈ uIcc 0 a, ContDiffAt ℝ ⊤ f x
a * (∫ s in (0 : ℝ)..1, deriv f (s*a)) = f a - f 0
Proof (Lean source)
-- @node: calibration_scaled_fundamental_theorem lemma calibration_scaled_fundamental_theorem (f : ℝ → ℝ) (a : ℝ) (hf : ∀ x ∈ uIcc 0 a, ContDiffAt ℝ ⊤ f x) : a * (∫ s in (0 : ℝ)..1, deriv f (s*a)) = f a - f 0 := by have hmem (s : ℝ) (hs : s ∈ uIcc (0 : ℝ) 1) : s*a ∈ uIcc 0 a := by rw [Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 1)] at hs rcases le_total 0 a with ha | ha · rw [Set.uIcc_of_le ha] exact ⟨mul_nonneg hs.1 ha, by nlinarith [hs.2]⟩ · rw [Set.uIcc_of_ge ha] exact ⟨by nlinarith [hs.2], mul_nonpos_of_nonneg_of_nonpos hs.1 ha⟩ have hc : ContinuousOn (fun s => a * deriv f (s*a)) (uIcc 0 1) := by intro s hs exact (continuousAt_const.mul (((hf _ (hmem s hs)).derivWithin (m := ⊤) (by simp)).continuousAt.comp (f := fun s : ℝ => s*a) (by fun_prop : ContinuousAt (fun s : ℝ => s*a) s))).continuousWithinAt have h := intervalIntegral.integral_eq_sub_of_hasDerivAt (f := fun s => f (s*a)) (f' := fun s => a * deriv f (s*a)) (fun s hs => by simpa only [Function.comp_def, id_eq, one_mul, mul_one, mul_comm] using (((hf _ (hmem s hs)).differentiableAt (by simp)).hasDerivAt).comp s ((hasDerivAt_id s).mul_const a)) hc.intervalIntegrable simpa only [intervalIntegral.integral_const_mul, one_mul, zero_mul] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_scaled_fundamental_theorem · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:97
theorem calibration_scaled_second_taylor Lemma calibration_scaled_second_taylor in the paper ↗

[The second integral Taylor identity uses the actual zero value and slope; it remains valid for both signs of the amplitude. the documented result Under the stated assumptions.

Formal statement
f :
ℝ → ℝ
a :
ℝ
hf :
∀ x ∈ uIcc 0 a, ContDiffAt ℝ ∞ f x
hzero :
f 0 = 0
hslope :
deriv f 0 = 0
a^2 * (∫ v in (0 : ℝ)..1, (1-v)*deriv (deriv f) (v*a)) = f a
Proof (Lean source)
-- @node: calibration_scaled_second_taylor lemma calibration_scaled_second_taylor (f : ℝ → ℝ) (a : ℝ) (hf : ∀ x ∈ uIcc 0 a, ContDiffAt ℝ ∞ f x) (hzero : f 0 = 0) (hslope : deriv f 0 = 0) : a^2 * (∫ v in (0 : ℝ)..1, (1-v)*deriv (deriv f) (v*a)) = f a := by have hmem (v : ℝ) (hv : v ∈ uIcc (0 : ℝ) 1) : v*a ∈ uIcc 0 a := by rw [Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 1)] at hv rcases le_total 0 a with ha | ha · rw [Set.uIcc_of_le ha] exact ⟨mul_nonneg hv.1 ha, by nlinarith [hv.2]⟩ · rw [Set.uIcc_of_ge ha] exact ⟨by nlinarith [hv.2], mul_nonpos_of_nonneg_of_nonpos hv.1 ha⟩ have hc : ContinuousOn (fun v => a^2*((1-v)*deriv (deriv f) (v*a))) (uIcc 0 1) := by intro v hv have hd := ((hf _ (hmem v hv)).derivWithin (m := ∞) (by simp)).derivWithin (m := ∞) (by simp) exact (continuousAt_const.mul ((by fun_prop : ContinuousAt (fun v : ℝ => 1-v) v).mul (hd.continuousAt.comp (f := fun v : ℝ => v*a) (by fun_prop : ContinuousAt (fun v : ℝ => v*a) v)))).continuousWithinAt have hg (v : ℝ) (hv : v ∈ uIcc (0 : ℝ) 1) : HasDerivAt (fun v => (1-v)*deriv f (v*a)*a + f (v*a)) (a^2*((1-v)*deriv (deriv f) (v*a))) v := by have harg := (hasDerivAt_id v).mul_const a have h0 := ((hf _ (hmem v hv)).differentiableAt (by simp)).hasDerivAt have h1 := (((hf _ (hmem v hv)).derivWithin (m := ∞) (by simp)).differentiableAt (by simp)).hasDerivAt convert ((((hasDerivAt_const v (1 : ℝ)).sub (hasDerivAt_id v)).mul (h1.comp v harg)).mul_const a).add (h0.comp v harg) using 1 <;> first | rfl | (dsimp; ring) have h := intervalIntegral.integral_eq_sub_of_hasDerivAt hg hc.intervalIntegrable simpa only [intervalIntegral.integral_const_mul, one_mul, zero_mul, sub_self, zero_mul, zero_add, hzero, hslope, mul_zero, add_zero, sub_zero] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_scaled_second_taylor · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:123
theorem fairEquation_mul_parameters Lemma fairEquation_mul_parameters in the paper ↗

[Two integral Taylor identities recover the actual numerator on both axes, without division by either parameter. the documented result Under the stated assumptions.

Formal statement
t δ ξ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ 1 / 100
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
t*δ^2*fairEquation t δ ξ u = fairNumerator t δ ξ u
Proof (Lean source)
-- @node: fairEquation_mul_parameters lemma fairEquation_mul_parameters (t δ ξ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ 1 / 100) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) : t*δ^2*fairEquation t δ ξ u = fairNumerator t δ ξ u := by have hT (T : ℝ) (hT : T ∈ uIcc 0 t) : T ∈ Icc (0 : ℝ) (1/4) := by rw [Set.uIcc_of_le ht.1] at hT exact ⟨hT.1,hT.2.trans ht.2⟩ have hD (D : ℝ) (hD : D ∈ uIcc 0 δ) : |D| ≤ 1/100 := (calibration_segment_abs_le δ D hD).trans hδ let F : ℝ → ℝ → ℝ := fun s v => (1-v)*deriv (fun T => deriv (deriv (fun D => fairNumerator T D ξ u)) (v*δ)) (s*t) have hc : ContinuousOn F.uncurry (Icc (0 : ℝ) 1 ×ˢ Icc (0 : ℝ) 1) := by intro z hz have hp : ContDiffAt ℝ ⊤ (fun z : ℝ × ℝ => ![z.1*t,z.2*δ,ξ,u]) z := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hf := (fairNumerator_taylor_deriv_contDiffAt ![z.1*t,z.2*δ,ξ,u] (hT _ (calibration_unit_mul_mem_segment t z.1 hz.1)) (hD _ (calibration_unit_mul_mem_segment δ z.2 hz.2)) hξ).comp z hp exact ((by fun_prop : ContinuousAt (fun z : ℝ × ℝ => 1-z.2) z).mul hf.continuousAt).continuousWithinAt have hInt : IntegrableOn F.uncurry (Set.uIoc (0 : ℝ) 1 ×ˢ Set.uIoc (0 : ℝ) 1) := by apply (hc.integrableOn_compact (isCompact_Icc.prod isCompact_Icc)).mono_set rw [Set.uIoc_of_le (by norm_num : (0 : ℝ) ≤ 1)] exact Set.prod_mono Set.Ioc_subset_Icc_self Set.Ioc_subset_Icc_self have hswap := intervalIntegral_intervalIntegral_swap hInt have hInner (v : ℝ) (hv : v ∈ Icc (0 : ℝ) 1) : t * (∫ s in (0 : ℝ)..1, deriv (fun T => deriv (deriv (fun D => fairNumerator T D ξ u)) (v*δ)) (s*t)) = deriv (deriv (fun D => fairNumerator t D ξ u)) (v*δ) := by have h := calibration_scaled_fundamental_theorem (fun T => deriv (deriv (fun D => fairNumerator T D ξ u)) (v*δ)) t (by intro T hTT have hp : ContDiffAt ℝ ⊤ (fun T : ℝ => ![T,v*δ,ξ,u]) T := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop exact (fairNumerator_second_amplitude_deriv_contDiffAt ![T,v*δ,ξ,u] (hT T hTT) (hD _ (calibration_unit_mul_mem_segment δ v hv)) hξ).comp T hp) simpa only [fairNumerator_second_deriv_zero_effect, sub_zero] using h have hTaylor := calibration_scaled_second_taylor (fun D => fairNumerator t D ξ u) δ (by intro D hDD have hp : ContDiffAt ℝ ⊤ (fun D : ℝ => ![t,D,ξ,u]) D := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop exact ((fairNumerator_contDiffAt ![t,D,ξ,u] ht (hD D hDD) hξ).comp D hp).of_le le_top) (fairNumerator_zero_amplitude t ξ u) (fairNumerator_deriv_zero_amplitude t ξ u) calc t*δ^2*fairEquation t δ ξ u = δ^2 * (∫ v in (0 : ℝ)..1, (1-v)*(t * (∫ s in (0 : ℝ)..1, deriv (fun T => deriv (deriv (fun D => fairNumerator T D ξ u)) (v*δ)) (s*t)))) := by change t*δ^2*(∫ s in (0 : ℝ)..1, ∫ v in (0 : ℝ)..1, F s v) = _ rw [hswap, show t*δ^2 = δ^2*t by ring, mul_assoc, ← intervalIntegral.integral_const_mul] congr 1 apply intervalIntegral.integral_congr intro v hv dsimp [F] rw [intervalIntegral.integral_const_mul] ring _ = δ^2 * (∫ v in (0 : ℝ)..1, (1-v)*deriv (deriv (fun D => fairNumerator t D ξ u)) (v*δ)) := by congr 1 apply intervalIntegral.integral_congr intro v hv dsimp only rw [hInner v (by simpa using hv)] _ = fairNumerator t δ ξ u := hTaylor
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_mul_parameters · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:155

Away from the axes, the double-integral extension is exactly the normalized numerator. Under the stated assumptions. Under the stated assumptions.

Formal statement
t δ ξ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ 1 / 100
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
hne :
t*δ ≠ 0
fairEquation t δ ξ u = fairNumerator t δ ξ u / (t*δ^2)
Proof (Lean source)
-- @node: fairEquation_eq_div lemma fairEquation_eq_div (t δ ξ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ 1 / 100) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) (hne : t*δ ≠ 0) : fairEquation t δ ξ u = fairNumerator t δ ξ u / (t*δ^2) := by have htne : t ≠ 0 := (mul_ne_zero_iff.mp hne).1 have hδne : δ ≠ 0 := (mul_ne_zero_iff.mp hne).2 apply (eq_div_iff (mul_ne_zero htne (pow_ne_zero 2 hδne))).mpr simpa only [mul_comm] using fairEquation_mul_parameters t δ ξ u ht hδ hξ
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_eq_div · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairTaylorDerivatives.lean:231
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairZeroAmplitude 9 declarations The second amplitude derivative of the finite sign average depends only on the unit second moment of the sign field.

Fair calibration on the zero - amplitude axis

The second amplitude derivative of the finite sign average depends only on the unit second moment of the sign field. Thus the Taylor - normalized equation is independent of position at zero amplitude, and the exact endpoint identity supplies a center root throughout that axis.

theorem riskShift_hasDerivAt_amplitude Lemma riskShift_hasDerivAt_amplitude in the paper ↗

The derivative of the risk under an affine amplitude perturbation is the explicit squared - denominator expression. the documented result Under the stated assumptions.

Formal statement
t ξ z δ :
ℝ
hden :
1 + (exp t - 1) * (ξ + δ * z) ≠ 0
HasDerivAt (fun D => riskShift t (ξ + D * z)) (exp t * z / (1 + (exp t - 1) * (ξ + δ * z)) ^ 2) δ
Proof (Lean source)
-- @node: riskShift_hasDerivAt_amplitude lemma riskShift_hasDerivAt_amplitude (t ξ z δ : ℝ) (hden : 1 + (exp t - 1) * (ξ + δ * z) ≠ 0) : HasDerivAt (fun D => riskShift t (ξ + D * z)) (exp t * z / (1 + (exp t - 1) * (ξ + δ * z)) ^ 2) δ := by have hx := (hasDerivAt_const δ ξ).add ((hasDerivAt_id δ).mul_const z) convert (hx.const_mul (exp t)).div ((hasDerivAt_const δ (1 : ℝ)).add (hx.const_mul (exp t - 1))) hden using 1 <;> first | rfl | (dsimp; field_simp; ring)
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_hasDerivAt_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:17
theorem riskShift_hasDerivAt_deriv_zero_amplitude Lemma riskShift_hasDerivAt_deriv_zero_amplitude in the paper ↗

The second amplitude derivative of the risk at zero amplitude contains exactly the squared perturbation mark. the documented result Under the stated assumptions.

Formal statement
t ξ z :
ℝ
hden :
1 + (exp t - 1) * ξ ≠ 0
HasDerivAt (deriv (fun D => riskShift t (ξ + D * z))) (-2 * exp t * (exp t - 1) * z ^ 2 / (1 + (exp t - 1) * ξ) ^ 3) 0
Proof (Lean source)
-- @node: riskShift_hasDerivAt_deriv_zero_amplitude lemma riskShift_hasDerivAt_deriv_zero_amplitude (t ξ z : ℝ) (hden : 1 + (exp t - 1) * ξ ≠ 0) : HasDerivAt (deriv (fun D => riskShift t (ξ + D * z))) (-2 * exp t * (exp t - 1) * z ^ 2 / (1 + (exp t - 1) * ξ) ^ 3) 0 := by have hx := (hasDerivAt_const (0 : ℝ) ξ).add ((hasDerivAt_id 0).mul_const z) have hb := (hasDerivAt_const (0 : ℝ) (1 : ℝ)).add (hx.const_mul (exp t - 1)) have hd := (hasDerivAt_const (0 : ℝ) (exp t * z)).div (hb.pow 2) (by simpa using pow_ne_zero 2 hden) have hd' : HasDerivAt (fun D => exp t * z / (1 + (exp t - 1) * (ξ + D * z)) ^ 2) (-2 * exp t * (exp t - 1) * z ^ 2 / (1 + (exp t - 1) * ξ) ^ 3) 0 := by convert hd using 1 <;> first | rfl | (dsimp; field_simp [hden]; ring) apply hd'.congr_of_eventuallyEq have he : ∀ᶠ D : ℝ in 𝓝 0, 1 + (exp t - 1) * (ξ + D * z) ≠ 0 := (by fun_prop : ContinuousAt (fun D : ℝ => 1 + (exp t - 1) * (ξ + D * z)) 0).eventually_ne (by simpa using hden) filter_upwards [he] with D hD exact (riskShift_hasDerivAt_amplitude t ξ z D hD).deriv
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_hasDerivAt_deriv_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:29
theorem fairRiskAverage_second_deriv_zero_amplitude Lemma fairRiskAverage_second_deriv_zero_amplitude in the paper ↗

The second derivative of the sign - averaged risk is independent of the within - cell coordinate because every sign field has unit second moment. the documented result Under the stated assumptions.

Formal statement
t ξ u :
ℝ
hden :
1 + (exp t - 1) * ξ ≠ 0
deriv (deriv (fun D => signAverage (fun s => riskShift t (ξ + D * localSignField u s)))) 0
= -2 * exp t * (exp t - 1) / (1 + (exp t - 1) * ξ) ^ 3
Proof (Lean source)
-- @node: fairRiskAverage_second_deriv_zero_amplitude lemma fairRiskAverage_second_deriv_zero_amplitude (t ξ u : ℝ) (hden : 1 + (exp t - 1) * ξ ≠ 0) : deriv (deriv (fun D => signAverage (fun s => riskShift t (ξ + D * localSignField u s)))) 0 = -2 * exp t * (exp t - 1) / (1 + (exp t - 1) * ξ) ^ 3 := by have hz : (1 / 4 : ℝ) * ∑ s : Bool × Bool, (localSignField u s) ^ 2 = 1 := by simp [localSignField, signValue, Fintype.sum_prod_type] nlinarith [Real.sin_sq_add_cos_sq (pi * u / 2)] have h2 := (HasDerivAt.sum (u := univ) (fun s _ => riskShift_hasDerivAt_deriv_zero_amplitude t ξ (localSignField u s) hden)).const_mul (1 / 4 : ℝ) have hc : (1 / 4 : ℝ) * ∑ s : Bool × Bool, -2 * exp t * (exp t - 1) * (localSignField u s) ^ 2 / (1 + (exp t - 1) * ξ) ^ 3 = -2 * exp t * (exp t - 1) / (1 + (exp t - 1) * ξ) ^ 3 := by simp_rw [div_eq_mul_inv] calc _ = (-2 * exp t * (exp t - 1) * ((1 + (exp t - 1) * ξ) ^ 3)⁻¹) * ((1 / 4 : ℝ) * ∑ s : Bool × Bool, (localSignField u s) ^ 2) := by rw [Finset.mul_sum] simp_rw [Finset.mul_sum] apply Finset.sum_congr rfl intro s hs ring _ = _ := by rw [hz]; ring rw [hc] at h2 apply (h2.congr_of_eventuallyEq ?_).deriv have he : ∀ᶠ D : ℝ in 𝓝 0, ∀ s : Bool × Bool, 1 + (exp t - 1) * (ξ + D * localSignField u s) ≠ 0 := by rw [Filter.eventually_all] intro s exact (by fun_prop : ContinuousAt (fun D : ℝ => 1 + (exp t - 1) * (ξ + D * localSignField u s)) 0).eventually_ne (by simpa using hden) filter_upwards [he] with D hD have h1 := ((HasDerivAt.sum (u := univ) (fun s _ => riskShift_hasDerivAt_amplitude t ξ (localSignField u s) D (hD s))).const_mul (1 / 4 : ℝ)).deriv change deriv (fun D => signAverage (fun s => riskShift t (ξ + D * localSignField u s))) D = (1 / 4 : ℝ) * ∑ s : Bool × Bool, deriv (fun D => riskShift t (ξ + D * localSignField u s)) D refine h1.trans ?_ congr 1 apply Finset.sum_congr rfl intro s hs exact (riskShift_hasDerivAt_amplitude t ξ (localSignField u s) D (hD s)).deriv.symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRiskAverage_second_deriv_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:52
theorem fairNumerator_second_deriv_zero_amplitude_endpoint Lemma fairNumerator_second_deriv_zero_amplitude_endpoint in the paper ↗

The comparator term has no position argument, while the averaged risk's second derivative depends only on the unit sign variance. Hence the actual numerator's second derivative agrees with its endpoint value. the documented result Under the stated assumptions.

Formal statement
t ξ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
deriv (deriv (fun D => fairNumerator t D ξ u)) 0
= deriv (deriv (fun D => fairNumerator t D ξ 0)) 0
Proof (Lean source)
-- @node: fairNumerator_second_deriv_zero_amplitude_endpoint lemma fairNumerator_second_deriv_zero_amplitude_endpoint (t ξ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) : deriv (deriv (fun D => fairNumerator t D ξ u)) 0 = deriv (deriv (fun D => fairNumerator t D ξ 0)) 0 := by let A : ℝ → ℝ → ℝ := fun u D => signAverage (fun s => riskShift t (ξ + D * localSignField u s)) let C : ℝ → ℝ := fun D => riskShift (comparatorEffect t D) ξ have hA (u D : ℝ) (hD : |D| ≤ 1 / 100) : ContDiffAt ℝ ⊤ (A u) D := by unfold A signAverage apply ContDiffAt.mul contDiffAt_const apply ContDiffAt.sum intro s hs apply (riskShift_contDiffAt ![t,ξ + D * localSignField u s] ?_).comp D (show ContDiffAt ℝ ⊤ (fun x : ℝ => ![t,ξ + x * localSignField u s]) D by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop) exact ne_of_gt (riskShift_denominator_pos _ _ ht.1 (fairNumerator_shifted_risk_pos D ξ u s hD hξ).le) have hN (u D : ℝ) (hD : |D| ≤ 1 / 100) : ContDiffAt ℝ ⊤ (fun x => fairNumerator t x ξ u) D := by have hp : ContDiffAt ℝ ⊤ (fun x : ℝ => ![t,x,ξ,u]) D := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop exact (fairNumerator_contDiffAt ![t,D,ξ,u] ht hD hξ).comp D hp have hC (D : ℝ) (hD : |D| ≤ 1 / 100) : ContDiffAt ℝ ⊤ C D := by have he : C = fun x => A 0 x - fairNumerator t x ξ 0 := by funext x dsimp [C, A, fairNumerator] ring rw [he] exact (hA 0 D hD).sub (hN 0 D hD) have hsecond (u : ℝ) : deriv (deriv (fun D => fairNumerator t D ξ u)) 0 = deriv (deriv (A u)) 0 - deriv (deriv C) 0 := by have he : deriv (fun D => fairNumerator t D ξ u) =ᶠ[𝓝 0] fun D => deriv (A u) D - deriv C D := by filter_upwards [isOpen_Ioo.mem_nhds (show (0 : ℝ) ∈ Ioo (-(1 / 100 : ℝ)) (1 / 100) by constructor <;> norm_num)] with D hD have hδ : |D| ≤ 1 / 100 := abs_le.mpr ⟨hD.1.le,hD.2.le⟩ exact deriv_sub ((hA u D hδ).differentiableAt (by simp)) ((hC D hδ).differentiableAt (by simp)) rw [he.deriv_eq] apply deriv_sub · exact ((hA u 0 (by norm_num)).derivWithin (m := ⊤) (by simp)).differentiableAt (by simp) · exact ((hC 0 (by norm_num)).derivWithin (m := ⊤) (by simp)).differentiableAt (by simp) rw [hsecond u, hsecond 0] dsimp only [A] rw [fairRiskAverage_second_deriv_zero_amplitude t ξ u (ne_of_gt (riskShift_denominator_pos _ _ ht.1 (by linarith [hξ.1]))), fairRiskAverage_second_deriv_zero_amplitude t ξ 0 (ne_of_gt (riskShift_denominator_pos _ _ ht.1 (by linarith [hξ.1])))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_second_deriv_zero_amplitude_endpoint · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:99
theorem fairEquation_zero_amplitude_endpoint Lemma fairEquation_zero_amplitude_endpoint in the paper ↗

Both integral Taylor divisions preserve the position - independent second amplitude coefficient, including the effect - range boundary points. the documented result Under the stated assumptions.

Formal statement
t ξ u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
fairEquation t 0 ξ u = fairEquation t 0 ξ 0
Proof (Lean source)
-- @node: fairEquation_zero_amplitude_endpoint lemma fairEquation_zero_amplitude_endpoint (t ξ u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) : fairEquation t 0 ξ u = fairEquation t 0 ξ 0 := by have hdiff (T u : ℝ) (hT : T ∈ Icc (0 : ℝ) (1 / 4)) : DifferentiableAt ℝ (fun x => deriv (deriv (fun D => fairNumerator x D ξ u)) 0) T := by have hp : ContDiffAt ℝ ⊤ (fun x : ℝ => ![x,0,ξ,u]) T := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop exact ((fairNumerator_second_amplitude_deriv_contDiffAt ![T,0,ξ,u] hT (by norm_num) hξ).comp T hp).differentiableAt (by simp) have he (T : ℝ) (hT : T ∈ Icc (0 : ℝ) (1 / 4)) : deriv (fun x => deriv (deriv (fun D => fairNumerator x D ξ u)) 0) T = deriv (fun x => deriv (deriv (fun D => fairNumerator x D ξ 0)) 0) T := by have hw : HasDerivWithinAt (fun x => deriv (deriv (fun D => fairNumerator x D ξ 0)) 0) (deriv (fun x => deriv (deriv (fun D => fairNumerator x D ξ u)) 0) T) (Icc (0 : ℝ) (1 / 4)) T := (hdiff T u hT).hasDerivAt.hasDerivWithinAt.congr_of_mem (fun x hx => (fairNumerator_second_deriv_zero_amplitude_endpoint x ξ u hx hξ).symm) hT have hUnique := uniqueDiffOn_Icc (by norm_num : (0 : ℝ) < 1 / 4) T hT exact (hw.derivWithin hUnique).symm.trans ((hdiff T 0 hT).hasDerivAt.hasDerivWithinAt.derivWithin hUnique) unfold fairEquation simp only [mul_zero] apply intervalIntegral.integral_congr intro s hs rw [Set.uIcc_of_le (by norm_num : (0 : ℝ) ≤ 1)] at hs have hst : s * t ∈ Icc (0 : ℝ) (1 / 4) := ⟨mul_nonneg hs.1 ht.1, by nlinarith [hs.2,ht.1,ht.2]⟩ apply intervalIntegral.integral_congr intro v hv rw [he (s * t) hst]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_amplitude_endpoint · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:158
theorem fairEquation_zero_amplitude_center Lemma fairEquation_zero_amplitude_center in the paper ↗

The exact endpoint equation supplies the asymmetric center as a root on the entire zero - amplitude axis, uniformly in effect and position. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
fairEquation t 0 (2 / 5) u = 0
Proof (Lean source)
-- @node: fairEquation_zero_amplitude_center lemma fairEquation_zero_amplitude_center (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) : fairEquation t 0 (2 / 5) u = 0 := by rw [fairEquation_zero_amplitude_endpoint t (2 / 5) u ht (by constructor <;> norm_num)] exact fairEquation_endpoint_zero t 0 0 ht (by norm_num) (inl rfl)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_amplitude_center · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:196
theorem fairEquation_zero_amplitude_exists Lemma fairEquation_zero_amplitude_exists in the paper ↗

The center root lies strictly in the selector bracket at every point of the zero - amplitude axis. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
∃ p ∈ Ioo (3 / 10 : ℝ) (1 / 2), fairEquation t 0 p u = 0
Proof (Lean source)
-- @node: fairEquation_zero_amplitude_exists lemma fairEquation_zero_amplitude_exists (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) : ∃ p ∈ Ioo (3 / 10 : ℝ) (1 / 2), fairEquation t 0 p u = 0 := ⟨2 / 5, by constructor <;> norm_num, fairEquation_zero_amplitude_center t u ht⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_amplitude_exists · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:205
theorem fairRoot_zero_amplitude_spec Lemma fairRoot_zero_amplitude_spec in the paper ↗

An actual root exists on the zero - amplitude axis, so the literal selector satisfies the normalized equation there without invoking a fallback case. the documented result Under the stated assumptions.

Formal statement
t u :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
conclusion 1
fairRoot t 0 u ∈ Ioo (3 / 10 : ℝ) (1 / 2)
conclusion 2
fairEquation t 0 (fairRoot t 0 u) u = 0
Proof (Lean source)
-- @node: fairRoot_zero_amplitude_spec lemma fairRoot_zero_amplitude_spec (t u : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) : fairRoot t 0 u ∈ Ioo (3 / 10 : ℝ) (1 / 2) ∧ fairEquation t 0 (fairRoot t 0 u) u = 0 := fairRoot_spec t 0 u (fairEquation_zero_amplitude_exists t u ht)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_zero_amplitude_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:213
theorem fairRoot_near_zero_center_identities Lemma fairRoot_near_zero_center_identities in the paper ↗

The near - zero uniqueness neighborhood identifies the literal selector with the fixed center at the cell endpoints and on the amplitude axis. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
ε ≤ 1 / 100
ε ≤ 1 / 4
conclusion 1
t δ u :
ℝ
t ∈ Icc (0 : ℝ) ε
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
fairRoot t δ 0 = 2 / 5
fairRoot t δ 1 = 2 / 5
fairRoot t 0 u = 2 / 5
Proof (Lean source)
-- @node: fairRoot_near_zero_center_identities lemma fairRoot_near_zero_center_identities : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1 / 100 ∧ ε ≤ 1 / 4 ∧ ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) ε → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → fairRoot t δ 0 = 2 / 5 ∧ fairRoot t δ 1 = 2 / 5 ∧ fairRoot t 0 u = 2 / 5 := by obtain ⟨ε₀,hε₀,hUnique⟩ := fairRoot_uniform_spec_near_zero let ε := min ε₀ (1 / 100) have hε : 0 < ε := lt_min hε₀ (by norm_num) have hsmall : ε ≤ 1 / 100 := min_le_right _ _ have hquarter : ε ≤ 1 / 4 := by linarith refine ⟨ε,hε,hsmall,hquarter,?_⟩ intro t δ u ht hδ hu have ht' : t ∈ Icc (0 : ℝ) (1 / 4) := ⟨ht.1,ht.2.trans hquarter⟩ have ht₀ : |t| ≤ ε₀ := by rw [abs_of_nonneg ht.1] exact ht.2.trans (min_le_left _ _) have hδ₀ : |δ| ≤ ε₀ := hδ.trans (min_le_left _ _) have hb : (2 / 5 : ℝ) ∈ Ioo (3 / 10) (1 / 2) := by constructor <;> norm_num have h0 := (hUnique t δ 0 ht₀ hδ₀ (by constructor <;> norm_num)).2 (2 / 5) hb (fairEquation_endpoint_zero t δ 0 ht' (hδ.trans hsmall) (inl rfl)) have h1 := (hUnique t δ 1 ht₀ hδ₀ (by constructor <;> norm_num)).2 (2 / 5) hb (fairEquation_endpoint_zero t δ 1 ht' (hδ.trans hsmall) (inr rfl)) have ha := (hUnique t 0 u ht₀ (by simpa using hε₀.le) hu).2 (2 / 5) hb (fairEquation_zero_amplitude_center t u ht') exact ⟨h0.symm,h1.symm,ha.symm⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_near_zero_center_identities · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroAmplitude.lean:222
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FairZeroEffect 8 declarations The effect derivatives of the literal risk and comparator formulas identify the limiting normalized equation and its unique bracket root.

Fair calibration on the zero-effect axis

The effect derivatives of the literal risk and comparator formulas identify the limiting normalized equation and its unique bracket root.

theorem riskShift_hasDerivAt_zero_effect Lemma riskShift_hasDerivAt_zero_effect in the paper ↗

[At zero effect the logistic risk slope is its Bernoulli variance. the stated conclusion holds.

Formal statement
ξ :
ℝ
HasDerivAt (fun t => riskShift t ξ) (ξ*(1-ξ)) 0
Proof (Lean source)
-- @node: riskShift_hasDerivAt_zero_effect lemma riskShift_hasDerivAt_zero_effect (ξ : ℝ) : HasDerivAt (fun t => riskShift t ξ) (ξ*(1-ξ)) 0 := by unfold riskShift convert ((Real.hasDerivAt_exp 0).mul_const ξ).div ((hasDerivAt_const 0 (1 : ℝ)).add (((Real.hasDerivAt_exp 0).sub_const 1).mul_const ξ)) (by simp) using 1 <;> first | rfl | (norm_num; ring)
CausalSmith.Stat.LogoddsLowsmoothFrontier.riskShift_hasDerivAt_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:15
theorem comparatorEffect_hasDerivAt_zero_effect Lemma comparatorEffect_hasDerivAt_zero_effect in the paper ↗

The comparator's zero-effect slope accounts for the amplitude variance. the stated conclusion holds.

Formal statement
δ :
ℝ
HasDerivAt (fun t => comparatorEffect t δ) (1-δ^2/(6 / 25)) 0
Proof (Lean source)
-- @node: comparatorEffect_hasDerivAt_zero_effect lemma comparatorEffect_hasDerivAt_zero_effect (δ : ℝ) : HasDerivAt (fun t => comparatorEffect t δ) (1-δ^2/(6 / 25)) 0 := by have hd := (Real.hasDerivAt_exp 0).sub_const 1 have hB := (hasDerivAt_const 0 (1 : ℝ)).add (hd.mul_const (2 / 5)) have h1 := (hd.mul_const (δ^2)).div (hB.const_mul (2 / 5)) (by norm_num) have h2 := (hd.mul_const (δ^2)).div (hB.const_mul (1-2 / 5)) (by norm_num) have hlog1 := ((hasDerivAt_const 0 (1 : ℝ)).sub h1).log (by norm_num) have hlog2 := ((hasDerivAt_const 0 (1 : ℝ)).add h2).log (by norm_num) convert ((hasDerivAt_id 0).add hlog1).sub hlog2 using 1 <;> first | rfl | (simp; ring)
CausalSmith.Stat.LogoddsLowsmoothFrontier.comparatorEffect_hasDerivAt_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:25
theorem fairNumerator_hasDerivAt_zero_effect Lemma fairNumerator_hasDerivAt_zero_effect in the paper ↗

Differentiating the actual finite sign average at zero effect gives exactly its variance cancellation against the deterministic comparator. the documented result

Formal statement
δ ξ u :
ℝ
HasDerivAt (fun t => fairNumerator t δ ξ u) (δ^2*(-1+ξ*(1-ξ)/(6 / 25))) 0
Proof (Lean source)
-- @node: fairNumerator_hasDerivAt_zero_effect lemma fairNumerator_hasDerivAt_zero_effect (δ ξ u : ℝ) : HasDerivAt (fun t => fairNumerator t δ ξ u) (δ^2*(-1+ξ*(1-ξ)/(6 / 25))) 0 := by have hsum := HasDerivAt.sum (u := univ) (fun s _ => riskShift_hasDerivAt_zero_effect (ξ+δ*localSignField u s)) have hr : HasDerivAt (fun t => riskShift t ξ) (ξ*(1-ξ)) (comparatorEffect 0 δ) := by rw [comparatorEffect_zero_effect] exact riskShift_hasDerivAt_zero_effect ξ have hcomp := hr.comp 0 (comparatorEffect_hasDerivAt_zero_effect δ) convert (hsum.const_mul (1 / 4)).sub hcomp using 1 <;> try rfl simp [localSignField, signValue, Fintype.sum_prod_type ] nlinarith [Real.sin_sq_add_cos_sq (pi*u/2)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairNumerator_hasDerivAt_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:38
theorem fairEquation_zero_effect_nonzero_amplitude Lemma fairEquation_zero_effect_nonzero_amplitude in the paper ↗

The undivided Taylor identity identifies the normalized zero-effect value whenever the signed amplitude is nonzero. the documented result Under the stated assumptions.

Formal statement
δ ξ u :
ℝ
hδ :
|δ| ≤ 1 / 100
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
hu :
u ∈ Icc (0 : ℝ) 1
hne :
δ ≠ 0
fairEquation 0 δ ξ u = -1+ξ*(1-ξ)/(6 / 25)
Proof (Lean source)
-- @node: fairEquation_zero_effect_nonzero_amplitude lemma fairEquation_zero_effect_nonzero_amplitude (δ ξ u : ℝ) (hδ : |δ| ≤ 1 / 100) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) (hu : u ∈ Icc (0 : ℝ) 1) (hne : δ ≠ 0) : fairEquation 0 δ ξ u = -1+ξ*(1-ξ)/(6 / 25) := by have hx : ![0,δ,ξ,u] ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem _).mpr ⟨by constructor <;> norm_num, hδ, hξ, hu⟩ have hp : ContDiffAt ℝ ∞ (fun t : ℝ => ![t,δ,ξ,u]) 0 := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp <;> fun_prop have hH := ((fairEquation_contDiffAt _ hx).comp 0 hp).differentiableAt (by simp) have hd := ((hasDerivAt_id 0).mul_const (δ^2)).mul hH.hasDerivAt have hs : HasDerivWithinAt (fun t => fairNumerator t δ ξ u) (δ^2*fairEquation 0 δ ξ u) (Icc (0 : ℝ) (1 / 4)) 0 := by have hd' : HasDerivAt (fun t => t*δ^2*fairEquation t δ ξ u) (δ^2*fairEquation 0 δ ξ u) 0 := by convert hd using 1 <;> first | rfl | simp exact hd'.hasDerivWithinAt.congr_of_mem (fun t ht => (fairEquation_mul_parameters t δ ξ u ht hδ hξ).symm) (by constructor <;> norm_num) have hunique := uniqueDiffOn_Icc (by norm_num : (0 : ℝ) < 1 / 4) 0 (by constructor <;> norm_num) have he := (hs.derivWithin hunique).symm.trans ((fairNumerator_hasDerivAt_zero_effect δ ξ u).hasDerivWithinAt.derivWithin hunique) exact mul_left_cancel₀ (pow_ne_zero 2 hne) he
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_effect_nonzero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:54
theorem fairEquation_zero_effect Lemma fairEquation_zero_effect in the paper ↗

[Continuity in the signed amplitude extends the explicit zero-effect formula through the intersection of both removable axes. the documented result Under the stated assumptions.

Formal statement
δ ξ u :
ℝ
hδ :
|δ| ≤ 1 / 100
hξ :
ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)
hu :
u ∈ Icc (0 : ℝ) 1
fairEquation 0 δ ξ u = -1+ξ*(1-ξ)/(6 / 25)
Proof (Lean source)
-- @node: fairEquation_zero_effect lemma fairEquation_zero_effect (δ ξ u : ℝ) (hδ : |δ| ≤ 1 / 100) (hξ : ξ ∈ Icc (3 / 10 : ℝ) (1 / 2)) (hu : u ∈ Icc (0 : ℝ) 1) : fairEquation 0 δ ξ u = -1+ξ*(1-ξ)/(6 / 25) := by by_cases hne : δ ≠ 0 · exact fairEquation_zero_effect_nonzero_amplitude δ ξ u hδ hξ hu hne · have hz : δ = 0 := not_ne_iff.mp hne subst δ have hc : ContinuousOn (fun D => fairEquation 0 D ξ u) (Icc (0 : ℝ) (1 / 100)) := by have hp : ContinuousOn (fun D : ℝ => ![0,D,ξ,u]) (Icc (0 : ℝ) (1 / 100)) := by apply Continuous.continuousOn apply continuous_pi intro i fin_cases i <;> dsimp <;> fun_prop have h := fairEquation_continuousOn.comp hp (fun D hD => (fairTaylorParameterRegion_mem _).mpr ⟨by constructor <;> norm_num, by change |D| ≤ 1 / 100; rw [abs_of_nonneg hD.1]; exact hD.2, hξ, hu⟩) simpa only [Function.comp_def, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val] using h have he : EqOn (fun D => fairEquation 0 D ξ u) (fun _ => -1+ξ*(1-ξ)/(6 / 25)) (Ioo (0 : ℝ) (1 / 100)) := by intro D hD exact fairEquation_zero_effect_nonzero_amplitude D ξ u (by simpa only [abs_of_pos hD.1] using hD.2.le) hξ hu (ne_of_gt hD.1) exact he.of_subset_closure hc continuousOn_const Set.Ioo_subset_Icc_self (by rw [closure_Ioo (by norm_num : (0 : ℝ) ≠ 1 / 100)]) (by constructor <;> norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:83
theorem fairEquation_zero_effect_center Lemma fairEquation_zero_effect_center in the paper ↗

The prescribed asymmetric center is a root on the entire zero-effect axis. Under the stated assumptions. Under the stated assumptions.

Formal statement
δ u :
ℝ
hδ :
|δ| ≤ 1 / 100
hu :
u ∈ Icc (0 : ℝ) 1
fairEquation 0 δ (2 / 5) u = 0
Proof (Lean source)
-- @node: fairEquation_zero_effect_center lemma fairEquation_zero_effect_center (δ u : ℝ) (hδ : |δ| ≤ 1 / 100) (hu : u ∈ Icc (0 : ℝ) 1) : fairEquation 0 δ (2 / 5) u = 0 := by rw [fairEquation_zero_effect δ (2 / 5) u hδ (by constructor <;> norm_num) hu] norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_effect_center · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:114
theorem fairEquation_zero_effect_unique Lemma fairEquation_zero_effect_unique in the paper ↗

[The other quadratic root is outside the selector bracket, so the zero-effect center is uniquely characterized within that bracket. the documented result Under the stated assumptions.

Formal statement
δ u q :
ℝ
hδ :
|δ| ≤ 1 / 100
hu :
u ∈ Icc (0 : ℝ) 1
hq :
q ∈ Ioo (3 / 10 : ℝ) (1 / 2)
he :
fairEquation 0 δ q u = 0
q = 2 / 5
Proof (Lean source)
-- @node: fairEquation_zero_effect_unique lemma fairEquation_zero_effect_unique (δ u q : ℝ) (hδ : |δ| ≤ 1 / 100) (hu : u ∈ Icc (0 : ℝ) 1) (hq : q ∈ Ioo (3 / 10 : ℝ) (1 / 2)) (he : fairEquation 0 δ q u = 0) : q = 2 / 5 := by rw [fairEquation_zero_effect δ q u hδ ⟨hq.1.le, hq.2.le⟩ hu] at he have hfactor : (q-2 / 5)*(q-3 / 5) = 0 := by linarith [he] rcases mul_eq_zero.mp hfactor with h | h · linarith · linarith [hq.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairEquation_zero_effect_unique · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:122

[The literal root selector equals the paper's center for zero effect, including zero amplitude and both spatial endpoints. the documented result Under the stated assumptions.

Formal statement
δ u :
ℝ
hδ :
|δ| ≤ 1 / 100
hu :
u ∈ Icc (0 : ℝ) 1
fairRoot 0 δ u = 2 / 5
Proof (Lean source)
-- @node: fairRoot_zero_effect lemma fairRoot_zero_effect (δ u : ℝ) (hδ : |δ| ≤ 1 / 100) (hu : u ∈ Icc (0 : ℝ) 1) : fairRoot 0 δ u = 2 / 5 := by apply fairRoot_eq_of_unique · constructor <;> norm_num · exact fairEquation_zero_effect_center δ u hδ hu · intro q hq he exact fairEquation_zero_effect_unique δ u q hδ hu hq he
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FairZeroEffect.lean:136
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FinitePriorHellinger 4 declarations The original-sample mixture densities are normalized probability densities.

Hellinger testing reduction for the actual finite priors

The original-sample mixture densities are normalized probability densities. The library's affinity comparison therefore converts a squared Hellinger budget of one hundredth into the total variation budget of one tenth, unchanged by the optional independent seed.

theorem signMixtureCellDensity_integral_one

[The actual finite-prior density integrates to one under the sample reference. the stated conclusion holds. Under the stated assumptions.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
hU :
∀ σ, Measure.map covariate (laws σ).measure = uniformLaw
(∫ o, signMixtureCellDensity n k laws o ∂sampleReference n) = 1
Proof (Lean source)
-- @node: signMixtureCellDensity_integral_one lemma signMixtureCellDensity_integral_one (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (hU : ∀ σ, Measure.map covariate (laws σ).measure = uniformLaw) : (∫ o, signMixtureCellDensity n k laws o ∂sampleReference n) = 1 := by letI := finiteSignMixture_probability n k laws have h := congrArg (fun μ : Measure (Fin n → Record) => μ univ) (finiteSignMixture_withDensity n k laws hU) rw [measure_univ, withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ, ← ofReal_integral_eq_lintegral_ofReal (signMixtureCellDensity_integrable n k laws) (Filter.Eventually.of_forall (signMixtureCellDensity_nonneg n k laws))] at h have hnonneg : 0 ≤ ∫ o, signMixtureCellDensity n k laws o ∂sampleReference n := integral_nonneg (signMixtureCellDensity_nonneg n k laws) have ht := congrArg toReal h change 0 ≤ ∫ o, signMixtureCellDensity n k laws o ∂Measure.pi (fun _ : Fin n => recordReference) at hnonneg simpa only [sampleReference, iidLaw, ENNReal.toReal_one, ENNReal.toReal_ofReal hnonneg] using ht.symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.signMixtureCellDensity_integral_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorHellinger.lean:18
theorem finitePrior_originalRecordHellinger_density

The RN formulation of the distance equals the discrepancy of the literal finite averages of original-record likelihoods. the documented result Under the stated assumptions.

Formal statement
n k₀ k₁ :
ℕ
laws₀ :
(Fin (k₀+1) → Bool) → ObservedLaw
laws₁ :
(Fin (k₁+1) → Bool) → ObservedLaw
hU₀ :
∀ σ, Measure.map covariate (laws₀ σ).measure = uniformLaw
hU₁ :
∀ σ, Measure.map covariate (laws₁ σ).measure = uniformLaw
Proof (Lean source)
-- @node: finitePrior_originalRecordHellinger_density lemma finitePrior_originalRecordHellinger_density (n k₀ k₁ : ℕ) (laws₀ : (Fin (k₀+1) → Bool) → ObservedLaw) (laws₁ : (Fin (k₁+1) → Bool) → ObservedLaw) (hU₀ : ∀ σ, Measure.map covariate (laws₀ σ).measure = uniformLaw) (hU₁ : ∀ σ, Measure.map covariate (laws₁ σ).measure = uniformLaw) : originalRecordHellinger n (finiteSignMixture n k₀ laws₀) (finiteSignMixture n k₁ laws₁) = hellingerSqDensity (sampleReference n) (signMixtureCellDensity n k₀ laws₀) (signMixtureCellDensity n k₁ laws₁) := by have h0 := finiteSignMixture_rnDeriv n k₀ laws₀ hU₀ have h1 := finiteSignMixture_rnDeriv n k₁ laws₁ hU₁ unfold originalRecordHellinger hellingerSqDensity apply integral_congr_ae filter_upwards [h0, h1] with o ho0 ho1 dsimp only [sampleReference, iidLaw] rw [ho0, ho1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.finitePrior_originalRecordHellinger_density · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorHellinger.lean:39
theorem finitePrior_tv_le_sqrt_hellinger

The Cauchy–Schwarz affinity estimate controls the full sample-and-seed experiment by the square root of its original-record squared Hellinger distance. the documented result Under the stated assumptions.

Formal statement
n k₀ k₁ :
ℕ
laws₀ :
(Fin (k₀+1) → Bool) → ObservedLaw
laws₁ :
(Fin (k₁+1) → Bool) → ObservedLaw
hU₀ :
∀ σ, Measure.map covariate (laws₀ σ).measure = uniformLaw
hU₁ :
∀ σ, Measure.map covariate (laws₁ σ).measure = uniformLaw
tvDist (signPriorExperiment n k₀ laws₀) (signPriorExperiment n k₁ laws₁)
≤ sqrt (originalRecordHellinger n (finiteSignMixture n k₀ laws₀) (finiteSignMixture n k₁ laws₁))
Proof (Lean source)
-- @node: finitePrior_tv_le_sqrt_hellinger lemma finitePrior_tv_le_sqrt_hellinger (n k₀ k₁ : ℕ) (laws₀ : (Fin (k₀+1) → Bool) → ObservedLaw) (laws₁ : (Fin (k₁+1) → Bool) → ObservedLaw) (hU₀ : ∀ σ, Measure.map covariate (laws₀ σ).measure = uniformLaw) (hU₁ : ∀ σ, Measure.map covariate (laws₁ σ).measure = uniformLaw) : tvDist (signPriorExperiment n k₀ laws₀) (signPriorExperiment n k₁ laws₁) ≤ sqrt (originalRecordHellinger n (finiteSignMixture n k₀ laws₀) (finiteSignMixture n k₁ laws₁)) := by rw [signPriorExperiment_tv, finitePrior_originalRecordHellinger_density n k₀ k₁ laws₀ laws₁ hU₀ hU₁] have hf := signMixtureCellDensity_integrable n k₀ laws₀ have hg := signMixtureCellDensity_integrable n k₁ laws₁ have hf0 := signMixtureCellDensity_nonneg n k₀ laws₀ have hg0 := signMixtureCellDensity_nonneg n k₁ laws₁ have hf1 := signMixtureCellDensity_integral_one n k₀ laws₀ hU₀ have hg1 := signMixtureCellDensity_integral_one n k₁ laws₁ hU₁ rw [finiteSignMixture_withDensity n k₀ laws₀ hU₀, finiteSignMixture_withDensity n k₁ laws₁ hU₁, hellingerSqDensity_eq_two_mul_one_sub_affinity (sampleReference n) _ _ hf hg hf0 hg0 hf1 hg1] exact tvDist_le_sqrt_two_mul_one_sub_affinity (sampleReference n) _ _ hf hg hf0 hg0 hf1 hg1
CausalSmith.Stat.LogoddsLowsmoothFrontier.finitePrior_tv_le_sqrt_hellinger · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorHellinger.lean:59
theorem finitePrior_hellinger_length_lower

The paper's Hellinger budget yields its seven-tenths testing coefficient. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n k₀ k₁ :
ℕ
α β r a b :
ℝ
laws₀ :
(Fin (k₀+1) → Bool) → ObservedLaw
laws₁ :
(Fin (k₁+1) → Bool) → ObservedLaw
I :
Procedure n
hI :
HonestProcedure n α β I
hP₀ :
∀ σ, RadiusModel α β r (laws₀ σ)
hP₁ :
∀ σ, Model α β (laws₁ σ)
hθ₀ :
∀ σ, effect (laws₀ σ) = a
hθ₁ :
∀ σ, effect (laws₁ σ) = b
hU₀ :
∀ σ, Measure.map covariate (laws₀ σ).measure = uniformLaw
hU₁ :
∀ σ, Measure.map covariate (laws₁ σ).measure = uniformLaw
hH :
originalRecordHellinger n (finiteSignMixture n k₀ laws₀) (finiteSignMixture n k₁ laws₁)
≤ 1/100
(7/10 : ℝ)*|b-a| ≤ worstLength n α β r I
Proof (Lean source)
-- @node: finitePrior_hellinger_length_lower lemma finitePrior_hellinger_length_lower (n k₀ k₁ : ℕ) (α β r a b : ℝ) (laws₀ : (Fin (k₀+1) → Bool) → ObservedLaw) (laws₁ : (Fin (k₁+1) → Bool) → ObservedLaw) (I : Procedure n) (hI : HonestProcedure n α β I) (hP₀ : ∀ σ, RadiusModel α β r (laws₀ σ)) (hP₁ : ∀ σ, Model α β (laws₁ σ)) (hθ₀ : ∀ σ, effect (laws₀ σ) = a) (hθ₁ : ∀ σ, effect (laws₁ σ) = b) (hU₀ : ∀ σ, Measure.map covariate (laws₀ σ).measure = uniformLaw) (hU₁ : ∀ σ, Measure.map covariate (laws₁ σ).measure = uniformLaw) (hH : originalRecordHellinger n (finiteSignMixture n k₀ laws₀) (finiteSignMixture n k₁ laws₁) ≤ 1/100) : (7/10 : ℝ)*|b-a| ≤ worstLength n α β r I := by have htv := (finitePrior_tv_le_sqrt_hellinger n k₀ k₁ laws₀ laws₁ hU₀ hU₁).trans (Real.sqrt_le_sqrt hH) have hsqrt : sqrt (1/100 : ℝ) ≤ 1/10 := by apply (Real.sqrt_le_iff).2 constructor <;> norm_num have h := finitePrior_testing_length_lower n k₀ k₁ α β r a b (1/10) laws₀ laws₁ I hI hP₀ hP₁ hθ₀ hθ₁ (htv.trans hsqrt) convert h using 1 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.finitePrior_hellinger_length_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorHellinger.lean:86
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FinitePriorTesting 12 declarations Uniform sign averaging preserves honesty and averages expected interval length.

Finite-prior testing with the original records and independent seed

Uniform sign averaging preserves honesty and averages expected interval length. Transferring coverage by total variation then gives the two-effect length lower bound for every Borel honest procedure, including randomized procedures.

def signPriorExperiment

[The prior draws its sign once, then supplies the original sample and seed.

Definition (Lean source)
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
signPriorExperiment n k laws :
Measure (Experiment n)
ofReal ((card (Fin (k+1) → Bool) : ℝ)⁻¹) • ∑ σ, experimentLaw (laws σ) n
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:17
theorem signPriorExperiment_eq_prod

Averaging the original-record laws and then tensoring the seed gives exactly the finite prior of full experiments. the documented result

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
Proof (Lean source)
-- @node: signPriorExperiment_eq_prod lemma signPriorExperiment_eq_prod (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) : signPriorExperiment n k laws = (finiteSignMixture n k laws).prod uniformLaw := by unfold signPriorExperiment finiteSignMixture have hweight : (2 : ℝ)^(-(k+1 : ℕ) : ℤ) = (card (Fin (k+1) → Bool) : ℝ)⁻¹ := by simp only [Fintype.card_fun, Fintype.card_bool, Fintype.card_fin, Nat.cast_pow, Nat.cast_ofNat, zpow_neg, zpow_natCast] rw [hweight, Measure.prod_smul_left] congr 1 rw [← Measure.sum_fintype (fun σ => iidLaw (laws σ).measure n), Measure.prod_sum_left, Measure.sum_fintype] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_eq_prod · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:24
theorem signPriorExperiment_const

A prior concentrated on one law gives its literal full experiment. the stated conclusion holds.

Formal statement
n k :
ℕ
signPriorExperiment n k (fun _ => P) = experimentLaw P n
Proof (Lean source)
-- @node: signPriorExperiment_const lemma signPriorExperiment_const (n k : ℕ) (P : ObservedLaw) : signPriorExperiment n k (fun _ => P) = experimentLaw P n := by unfold signPriorExperiment simp only [Finset.sum_const, Finset.card_univ] rw [← Nat.cast_smul_eq_nsmul ENNReal, smul_smul, ENNReal.ofReal_inv_of_pos (by positivity), ENNReal.ofReal_natCast, ENNReal.inv_mul_cancel (by positivity) (by finiteness), one_smul]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_const · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:42
instance signPriorExperiment_probability

The sign prior has exactly unit mass. the stated conclusion holds.

Definition (Lean source)
-- @node: signPriorExperiment_probability instance signPriorExperiment_probability (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) : IsProbabilityMeasure (signPriorExperiment n k laws) := by haveI : ∀ σ, IsProbabilityMeasure (experimentLaw (laws σ) n) := fun σ => experimentLaw_probability (laws σ) n constructor simp only [signPriorExperiment, Measure.smul_apply, Measure.finsetSum_apply, MeasurableSet.univ, measure_univ, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] rw [ENNReal.ofReal_inv_of_pos (by positivity), ENNReal.ofReal_natCast, mul_one, smul_eq_mul, ENNReal.inv_mul_cancel (by positivity) (by finiteness)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:52
theorem finiteSignMixture_probability

The original-record mixture is itself a probability measure. the stated conclusion holds.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
Proof (Lean source)
-- @node: finiteSignMixture_probability lemma finiteSignMixture_probability (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) : IsProbabilityMeasure (finiteSignMixture n k laws) := by have h := (signPriorExperiment_probability n k laws).measure_univ rw [signPriorExperiment_eq_prod, ← Set.univ_prod_univ, Measure.prod_prod, (show uniformLaw univ = 1 from measure_univ), mul_one] at h exact ⟨h⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.finiteSignMixture_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:66
theorem signPriorExperiment_tv

Adding the same independent seed preserves total variation exactly. the stated conclusion holds.

Formal statement
n k₀ k₁ :
ℕ
laws₀ :
(Fin (k₀+1) → Bool) → ObservedLaw
laws₁ :
(Fin (k₁+1) → Bool) → ObservedLaw
tvDist (signPriorExperiment n k₀ laws₀) (signPriorExperiment n k₁ laws₁)
= tvDist (finiteSignMixture n k₀ laws₀) (finiteSignMixture n k₁ laws₁)
Proof (Lean source)
-- @node: signPriorExperiment_tv lemma signPriorExperiment_tv (n k₀ k₁ : ℕ) (laws₀ : (Fin (k₀+1) → Bool) → ObservedLaw) (laws₁ : (Fin (k₁+1) → Bool) → ObservedLaw) : tvDist (signPriorExperiment n k₀ laws₀) (signPriorExperiment n k₁ laws₁) = tvDist (finiteSignMixture n k₀ laws₀) (finiteSignMixture n k₁ laws₁) := by letI := finiteSignMixture_probability n k₀ laws₀ letI := finiteSignMixture_probability n k₁ laws₁ rw [signPriorExperiment_eq_prod, signPriorExperiment_eq_prod, ← Measure.compProd_const, ← Measure.compProd_const, tvDist_compProd_eq]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_tv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:76
theorem signPriorExperiment_real

Event probabilities are the finite average of the constituent experiments. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
A :
Set (Experiment n)
hA :
= (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, (experimentLaw (laws σ) n).real A
Proof (Lean source)
-- @node: signPriorExperiment_real lemma signPriorExperiment_real (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (A : Set (Experiment n)) (hA : MeasurableSet A) : (signPriorExperiment n k laws).real A = (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, (experimentLaw (laws σ) n).real A := by haveI : ∀ σ, IsProbabilityMeasure (experimentLaw (laws σ) n) := fun σ => experimentLaw_probability (laws σ) n simp only [measureReal_def, signPriorExperiment, Measure.smul_apply, Measure.finsetSum_apply, hA, smul_eq_mul, ENNReal.toReal_mul, ENNReal.toReal_ofReal (by positivity : 0 ≤ (card (Fin (k+1) → Bool) : ℝ)⁻¹), ENNReal.toReal_sum (fun σ _ => measure_ne_top _ _)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_real · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:91
theorem signPriorExperiment_integral

Integrals of an integrable observable are finite prior averages. Under the stated assumptions. Under the stated assumptions.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
f :
Experiment n → ℝ
hf :
∀ σ, Integrable f (experimentLaw (laws σ) n)
(∫ ω, f ω ∂signPriorExperiment n k laws)
= (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∫ ω, f ω ∂experimentLaw (laws σ) n
Proof (Lean source)
-- @node: signPriorExperiment_integral lemma signPriorExperiment_integral (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (f : Experiment n → ℝ) (hf : ∀ σ, Integrable f (experimentLaw (laws σ) n)) : (∫ ω, f ω ∂signPriorExperiment n k laws) = (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∫ ω, f ω ∂experimentLaw (laws σ) n := by rw [signPriorExperiment, integral_smul_measure, integral_finsetSum_measure (fun σ _ => hf σ)] simp only [ENNReal.toReal_ofReal (by positivity : 0 ≤ (card (Fin (k+1) → Bool) : ℝ)⁻¹), smul_eq_mul]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:107
theorem signPriorExperiment_length_integrable

[Bounded measurable procedure length is integrable under the finite prior. the stated conclusion holds.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
I :
Procedure n
Integrable (fun ω => intervalLength (I.output ω)) (signPriorExperiment n k laws)
Proof (Lean source)
-- @node: signPriorExperiment_length_integrable lemma signPriorExperiment_length_integrable (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (I : Procedure n) : Integrable (fun ω => intervalLength (I.output ω)) (signPriorExperiment n k laws) := by apply Integrable.of_bound I.length_measurable.aestronglyMeasurable 1 exact Filter.Eventually.of_forall (fun ω => by rw [Real.norm_eq_abs, abs_of_nonneg (intervalLength_nonneg _)] exact intervalLength_le_one _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_length_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:120
theorem signPriorExperiment_length_le_worst

If all prior draws lie in the evaluation slice, its average length is bounded by the worst expected length on that slice. the documented result Under the stated assumptions.

Formal statement
n k :
ℕ
α β r :
ℝ
laws :
(Fin (k+1) → Bool) → ObservedLaw
I :
Procedure n
hP :
∀ σ, RadiusModel α β r (laws σ)
(∫ ω, intervalLength (I.output ω) ∂signPriorExperiment n k laws) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: signPriorExperiment_length_le_worst lemma signPriorExperiment_length_le_worst (n k : ℕ) (α β r : ℝ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (I : Procedure n) (hP : ∀ σ, RadiusModel α β r (laws σ)) : (∫ ω, intervalLength (I.output ω) ∂signPriorExperiment n k laws) ≤ worstLength n α β r I := by rw [signPriorExperiment_integral n k laws _ (fun σ => procedure_length_integrable (laws σ) n I)] have h := Finset.sum_le_sum (fun σ (_ : σ ∈ univ) => expectedLength_le_worstLength (laws σ) n α β r I (hP σ)) apply (mul_le_mul_of_nonneg_left h (by positivity)).trans_eq simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] rw [← mul_assoc, inv_mul_cancel₀ (by positivity), one_mul]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_length_le_worst · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:130
theorem signPriorExperiment_coverage

Global honesty transfers to a prior with a single common scalar effect. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n k :
ℕ
α β t :
ℝ
laws :
(Fin (k+1) → Bool) → ObservedLaw
I :
Procedure n
hI :
HonestProcedure n α β I
hP :
∀ σ, Model α β (laws σ)
hθ :
∀ σ, effect (laws σ) = t
(9/10 : ℝ) ≤ (signPriorExperiment n k laws).real {ω | t ∈ intervalSet (I.output ω)}
Proof (Lean source)
-- @node: signPriorExperiment_coverage lemma signPriorExperiment_coverage (n k : ℕ) (α β t : ℝ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (I : Procedure n) (hI : HonestProcedure n α β I) (hP : ∀ σ, Model α β (laws σ)) (hθ : ∀ σ, effect (laws σ) = t) : (9/10 : ℝ) ≤ (signPriorExperiment n k laws).real {ω | t ∈ intervalSet (I.output ω)} := by rw [signPriorExperiment_real n k laws _ (I.coverage_measurable t)] have hcover (σ : Fin (k+1) → Bool) : (9/10 : ℝ) ≤ (experimentLaw (laws σ) n).real {ω | t ∈ intervalSet (I.output ω)} := by letI := experimentLaw_probability (laws σ) n have h := hI.coverage (laws σ) (hP σ) rw [hθ σ] at h have := ENNReal.toReal_mono (measure_ne_top _ _) h norm_num [measureReal_def] at this ⊢ exact this have h := mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun σ (_ : σ ∈ univ) => hcover σ)) (by positivity : 0 ≤ (card (Fin (k+1) → Bool) : ℝ)⁻¹) simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, ← mul_assoc, inv_mul_cancel₀ (by positivity : (card (Fin (k+1) → Bool) : ℝ) ≠ 0), one_mul] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPriorExperiment_coverage · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:146
theorem finitePrior_testing_length_lower

[Two common-effect finite priors give the roadmap's length bound. The second prior needs ambient membership; only the first needs slice membership. the documented result Under the stated assumptions.

Formal statement
n k₀ k₁ :
ℕ
α β r a b tv :
ℝ
laws₀ :
(Fin (k₀+1) → Bool) → ObservedLaw
laws₁ :
(Fin (k₁+1) → Bool) → ObservedLaw
I :
Procedure n
hI :
HonestProcedure n α β I
hP₀ :
∀ σ, RadiusModel α β r (laws₀ σ)
hP₁ :
∀ σ, Model α β (laws₁ σ)
hθ₀ :
∀ σ, effect (laws₀ σ) = a
hθ₁ :
∀ σ, effect (laws₁ σ) = b
htv :
tvDist (signPriorExperiment n k₀ laws₀) (signPriorExperiment n k₁ laws₁)
≤ tv
|b-a| *(4/5-tv) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: finitePrior_testing_length_lower lemma finitePrior_testing_length_lower (n k₀ k₁ : ℕ) (α β r a b tv : ℝ) (laws₀ : (Fin (k₀+1) → Bool) → ObservedLaw) (laws₁ : (Fin (k₁+1) → Bool) → ObservedLaw) (I : Procedure n) (hI : HonestProcedure n α β I) (hP₀ : ∀ σ, RadiusModel α β r (laws₀ σ)) (hP₁ : ∀ σ, Model α β (laws₁ σ)) (hθ₀ : ∀ σ, effect (laws₀ σ) = a) (hθ₁ : ∀ σ, effect (laws₁ σ) = b) (htv : Causalean.Stat.tvDist (signPriorExperiment n k₀ laws₀) (signPriorExperiment n k₁ laws₁) ≤ tv) : |b-a| *(4/5-tv) ≤ worstLength n α β r I := by classical let μ := signPriorExperiment n k₀ laws₀ let ν := signPriorExperiment n k₁ laws₁ let A := {ω | a ∈ intervalSet (I.output ω)} let B := {ω | b ∈ intervalSet (I.output ω)} have hA : MeasurableSet A := I.coverage_measurable a have hB : MeasurableSet B := I.coverage_measurable b have hcover₀ := signPriorExperiment_coverage n k₀ α β a laws₀ I hI (fun σ => (hP₀ σ).toModel) hθ₀ have hcover₁ := signPriorExperiment_coverage n k₁ α β b laws₁ I hI hP₁ hθ₁ have htransfer := measureReal_sub_le_tvDist (μ := μ) (ν := ν) hB have hunion := measureReal_union_add_inter' (μ := μ) (t := B) hA have hmass : μ.real (A ∪ B) ≤ 1 := measureReal_le_one have hboth : 4/5-tv ≤ μ.real (A ∩ B) := by change (9/10 : ℝ) ≤ μ.real A at hcover₀ change (9/10 : ℝ) ≤ ν.real B at hcover₁ change Causalean.Stat.tvDist μ ν ≤ tv at htv linarith have hint : Integrable ((A ∩ B).indicator (fun _ => |b-a|)) μ := (integrable_const |b-a|).indicator (hA.inter hB) calc _ ≤ |b-a| *μ.real (A ∩ B) := mul_le_mul_of_nonneg_left hboth (abs_nonneg _) _ = ∫ ω, (A ∩ B).indicator (fun _ => |b-a|) ω ∂μ := by rw [integral_indicator (hA.inter hB), setIntegral_const] simp [measureReal_def, mul_comm] _ ≤ ∫ ω, intervalLength (I.output ω) ∂μ := by apply integral_mono hint (signPriorExperiment_length_integrable n k₀ laws₀ I) intro ω by_cases hω : ω ∈ A ∩ B · rw [Set.indicator_of_mem hω] apply abs_le.mpr constructor · have h := intervalLength_ge_separation _ _ _ hω.2 hω.1 linarith · exact intervalLength_ge_separation _ _ _ hω.1 hω.2 · rw [Set.indicator_of_notMem hω] exact intervalLength_nonneg _ _ ≤ _ := signPriorExperiment_length_le_worst n k₀ α β r laws₀ I hP₀
CausalSmith.Stat.LogoddsLowsmoothFrontier.finitePrior_testing_length_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FinitePriorTesting.lean:171
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FrontierAssembly 7 declarations The proved upper construction supplies the operational guarantees and both upper comparisons.

Assembling the honest frontier

The proved upper construction supplies the operational guarantees and both upper comparisons. The parametric floor supplies the numerator branch above the elbow. Separate numerator and radius lower estimates combine into the full profile against every honest, possibly randomized procedure.

theorem worstLength_le_of_expectedLength_bound

[A pointwise bound on expected length bounds the radius-slice supremum; the concrete parametric null certifies that this slice is nonempty. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
α β r B :
ℝ
I :
Procedure n
hr :
0 ≤ r
h :
∀ P
if
RadiusModel α β r P
then
expectedLength P n I ≤ B
worstLength n α β r I ≤ B
Proof (Lean source)
-- @node: worstLength_le_of_expectedLength_bound lemma worstLength_le_of_expectedLength_bound (n : ℕ) (α β r B : ℝ) (I : Procedure n) (hr : 0 ≤ r) (h : ∀ P, RadiusModel α β r P → expectedLength P n I ≤ B) : worstLength n α β r I ≤ B := by apply csSup_le · exact ⟨expectedLength (parametricLaw 0) n I, parametricLaw 0, parametricLaw_null_radius α β r hr, rfl⟩ · rintro l ⟨P, hP, rfl⟩ exact h P hP
CausalSmith.Stat.LogoddsLowsmoothFrontier.worstLength_le_of_expectedLength_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierAssembly.lean:17
theorem frontier_upper_comparisons

The finite honest upper theorem certifies the literal implementation's operational guarantees and the two upper comparisons with one absolute constant. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
∃ C : ℝ,
0 < C
conclusion 1
E.Admissible
hN :
N.Admissible
α β :
ℝ
n :
ℕ
1 ≤ n
FrontierOperational E N hN n α β
r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
lengthObjective n α β r ≤ worstLength n α β r (upperInterval E N hN n α β)
worstLength n α β r (upperInterval E N hN n α β) ≤ C * rate n α β r
Proof (Lean source)
-- @node: frontier_upper_comparisons lemma frontier_upper_comparisons : ∃ C : ℝ, 0 < C ∧ ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 1 ≤ n → FrontierOperational E N hN n α β ∧ ∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → lengthObjective n α β r ≤ worstLength n α β r (upperInterval E N hN n α β) ∧ worstLength n α β r (upperInterval E N hN n α β) ≤ C * rate n α β r := by obtain ⟨C, hC, hUpper⟩ := finite_honest_upper refine ⟨C, hC, ?_⟩ intro E hE N hN α β hD n hn obtain ⟨hHonest, hLength, hShape, hOne⟩ := hUpper E hE N hN α β hD n hn refine ⟨⟨hHonest, hShape, ?_, hOne⟩, ?_⟩ · intro o u v rfl · intro r hr exact ⟨lengthObjective_le n α β r _ hHonest, worstLength_le_of_expectedLength_bound n α β r _ _ hr.1 (hLength r hr)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_upper_comparisons · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierAssembly.lean:30
theorem frontier_parametric_numerator_lower

[Above and at the numerator elbow, the parametric null comparison supplies the numerator lower rate for every honest procedure and every radius. the documented result Under the stated assumptions.

Formal statement
α β r :
ℝ
n :
ℕ
hD :
hs :
1/2 ≤ α + β
hr :
r ∈ Icc (0 : ℝ) (1/2)
hn :
1 ≤ n
I :
Procedure n
hI :
HonestProcedure n α β I
(3/16 : ℝ) * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: frontier_parametric_numerator_lower lemma frontier_parametric_numerator_lower (α β r : ℝ) (n : ℕ) (hD : ExponentDomain α β) (hs : 1/2 ≤ α + β) (hr : r ∈ Icc (0 : ℝ) (1/2)) (hn : 1 ≤ n) (I : Procedure n) (hI : HonestProcedure n α β I) : (3/16 : ℝ) * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I := by rw [exponentA_high_branch α β hD hs] exact (parametric_null_floor α β r n hD hn hr).trans (lengthObjective_le n α β r I hI)
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_parametric_numerator_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierAssembly.lean:51
theorem frontier_numerator_lower_of_rough

[A lower estimate in the rough numerator regime extends to the whole domain by taking the smaller of its constant and the proved parametric constant. the documented result Under the stated assumptions.

Formal statement
cA :
ℝ
hRough :
∀ α β r : ℝ,
ExponentDomain α β → α + β
≤ 1/2 → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → cA * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I
α β r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
n :
ℕ
1 ≤ n
I :
Procedure n
HonestProcedure n α β I
min cA (3/16) * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: frontier_numerator_lower_of_rough lemma frontier_numerator_lower_of_rough (cA : ℝ) (hRough : ∀ α β r : ℝ, ExponentDomain α β → α + β ≤ 1/2 → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → cA * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I) : ∀ α β r : ℝ, ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → min cA (3/16) * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I := by intro α β r hD hr n hn I hI by_cases hs : α + β ≤ 1/2 · exact (mul_le_mul_of_nonneg_right (min_le_left _ _) (by positivity)).trans (hRough α β r hD hs hr n hn I hI) · exact (mul_le_mul_of_nonneg_right (min_le_right _ _) (by positivity)).trans (frontier_parametric_numerator_lower α β r n hD (le_of_lt (lt_of_not_ge hs)) hr hn I hI)
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_numerator_lower_of_rough · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierAssembly.lean:63
theorem frontier_radius_lower_of_positive

The positive-radius lower estimate extends to radius zero by the nonnegativity of expected interval length, without a new comparison prior. the documented result Under the stated assumptions.

Formal statement
cB :
ℝ
hPositive :
∀ α β r : ℝ,
ExponentDomain α β → r ∈ Ioc (0 : ℝ) (1/2) → ∀ n : ℕ, 1
≤ n → ∀ I : Procedure n, HonestProcedure n α β I → cB * (r * (n : ℝ) ^ (-exponentB β)) ≤ worstLength n α β r I
α β r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
n :
ℕ
1 ≤ n
I :
Procedure n
HonestProcedure n α β I
cB * (r * (n : ℝ) ^ (-exponentB β)) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: frontier_radius_lower_of_positive lemma frontier_radius_lower_of_positive (cB : ℝ) (hPositive : ∀ α β r : ℝ, ExponentDomain α β → r ∈ Ioc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → cB * (r * (n : ℝ) ^ (-exponentB β)) ≤ worstLength n α β r I) : ∀ α β r : ℝ, ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → cB * (r * (n : ℝ) ^ (-exponentB β)) ≤ worstLength n α β r I := by intro α β r hD hr n hn I hI rcases hr.1.eq_or_lt with hzero | hpos · rw [← hzero, zero_mul, mul_zero] exact worstLength_nonneg n α β 0 I · exact hPositive α β r hD ⟨hpos, hr.2⟩ n hn I hI
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_radius_lower_of_positive · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierAssembly.lean:81
theorem frontier_rate_lower_of_two

Simultaneous numerator and radius lower estimates give half the smaller constant times their sum, as in the testing-to-length roadmap. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
α β r cA cB :
ℝ
hr :
0 ≤ r
I :
Procedure n
hA :
cA * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I
hB :
cB * (r * (n : ℝ) ^ (-exponentB β)) ≤ worstLength n α β r I
(min cA cB / 2) * rate n α β r ≤ worstLength n α β r I
Proof (Lean source)
-- @node: frontier_rate_lower_of_two lemma frontier_rate_lower_of_two (n : ℕ) (α β r cA cB : ℝ) (hr : 0 ≤ r) (I : Procedure n) (hA : cA * (n : ℝ) ^ (-exponentA α β) ≤ worstLength n α β r I) (hB : cB * (r * (n : ℝ) ^ (-exponentB β)) ≤ worstLength n α β r I) : (min cA cB / 2) * rate n α β r ≤ worstLength n α β r I := by have hA' := (mul_le_mul_of_nonneg_right (min_le_left cA cB) (by positivity : 0 ≤ (n : ℝ) ^ (-exponentA α β))).trans hA have hB' := (mul_le_mul_of_nonneg_right (min_le_right cA cB) (mul_nonneg hr (by positivity : 0 ≤ (n : ℝ) ^ (-exponentB β)))).trans hB unfold rate diagnosticEnvelope linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_rate_lower_of_two · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierAssembly.lean:97
theorem universalFrontier_of_procedure_lower

The proved operational and upper guarantees and a universal procedure lower bound give all three frontier comparisons, transferring the lower bound to the infimum over honest procedures. the documented result Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
c C :
ℝ
hUpper :
∀ (E : ArithmeticEngine),
E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 1
≤ n → FrontierOperational E N hN n α β ∧
∀ r : ℝ,
r ∈ Icc (0 : ℝ) (1/2) → lengthObjective n α β r
≤ worstLength n α β r (upperInterval E N hN n α β) ∧
worstLength n α β r (upperInterval E N hN n α β) ≤ C * rate n α β r
hLower :
∀ α β r : ℝ,
ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1
≤ n → ∀ I : Procedure n, HonestProcedure n α β I → c * rate n α β r ≤ worstLength n α β r I
Proof (Lean source)
-- @node: universalFrontier_of_procedure_lower lemma universalFrontier_of_procedure_lower (c C : ℝ) (hUpper : ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 1 ≤ n → FrontierOperational E N hN n α β ∧ ∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → lengthObjective n α β r ≤ worstLength n α β r (upperInterval E N hN n α β) ∧ worstLength n α β r (upperInterval E N hN n α β) ≤ C * rate n α β r) (hLower : ∀ α β r : ℝ, ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → c * rate n α β r ≤ worstLength n α β r I) : UniversalFrontier c C := by intro E hE N hN α β hD n hn obtain ⟨hOperational, hComparison⟩ := hUpper E hE N hN α β hD n hn refine ⟨hOperational, ?_⟩ intro r hr exact ⟨le_lengthObjective n α β r _ (hLower α β r hD hr n hn), hComparison r hr⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.universalFrontier_of_procedure_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierAssembly.lean:112
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FrontierElbows 5 declarations The explicit rate exponents give both radius-transition formulas, with positive gap and agreement at the numerator elbow.

Algebraic transitions and compact bounds for the frontier

The explicit rate exponents give both radius-transition formulas, with positive gap and agreement at the numerator elbow. Absolute positive finite constants also satisfy the compact-uniform conditions. These certificates do not use the unfinished statistical comparison theorems.

theorem exponentA_low_branch

Below the numerator elbow, the projection exponent is the active branch. Under the stated assumptions.

Formal statement
α β :
ℝ
hD :
hs :
α + β ≤ 1 / 2
exponentA α β = 2 * (α + β) / (2 * α + 2 * β + 1)
Proof (Lean source)
-- @node: exponentA_low_branch lemma exponentA_low_branch (α β : ℝ) (hD : ExponentDomain α β) (hs : α + β ≤ 1 / 2) : exponentA α β = 2 * (α + β) / (2 * α + 2 * β + 1) := by have hα : 0 < α := hD.1.trans hD.2.2.1 have hd : 0 < 2 * α + 2 * β + 1 := by linarith [hD.1] apply min_eq_right apply (div_le_iff₀ hd).mpr linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.exponentA_low_branch · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierElbows.lean:16
theorem exponentA_high_branch

At and above the numerator elbow, the parametric exponent is the active branch. Under the stated assumptions.

Formal statement
α β :
ℝ
hD :
hs :
1 / 2 ≤ α + β
exponentA α β = 1 / 2
Proof (Lean source)
-- @node: exponentA_high_branch lemma exponentA_high_branch (α β : ℝ) (hD : ExponentDomain α β) (hs : 1 / 2 ≤ α + β) : exponentA α β = 1 / 2 := by have hα : 0 < α := hD.1.trans hD.2.2.1 have hd : 0 < 2 * α + 2 * β + 1 := by linarith [hD.1] apply min_eq_left apply (le_div_iff₀ hd).mpr linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.exponentA_high_branch · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierElbows.lean:27
theorem frontier_elbow_identities

The two radius-transition expressions are exact, positive, and agree on the elbow. Under the stated assumptions.

Formal statement
α β :
ℝ
hD :
Proof (Lean source)
-- @node: frontier_elbow_identities lemma frontier_elbow_identities (α β : ℝ) (hD : ExponentDomain α β) : ElbowIdentities α β := by have hα : 0 < α := hD.1.trans hD.2.2.1 have hd : 0 < 2 * α + 2 * β + 1 := by linarith [hD.1] have he : 0 < 4 * β + 1 := by linarith [hD.1] have hlow (hs : α + β ≤ 1 / 2) : exponentA α β - exponentB β = 2 * (α - β) / ((2 * α + 2 * β + 1) * (4 * β + 1)) := by rw [exponentA_low_branch α β hD hs] dsimp only [exponentB] rw [div_sub_div _ _ (ne_of_gt hd) (ne_of_gt he)] congr 1 ring have hhigh (hs : 1 / 2 ≤ α + β) : exponentA α β - exponentB β = (1 - 4 * β) / (2 * (4 * β + 1)) := by rw [exponentA_high_branch α β hD hs] dsimp only [exponentB] field_simp [ne_of_gt he] ring refine ⟨?_, hlow, hhigh, ?_⟩ · by_cases hs : α + β ≤ 1 / 2 · rw [hlow hs] exact div_pos (mul_pos (by norm_num) (sub_pos.mpr hD.2.2.1)) (mul_pos hd he) · rw [hhigh (le_of_lt (lt_of_not_ge hs))] exact div_pos (by linarith [hD.2.1]) (mul_pos (by norm_num) he) · intro hs exact (hlow hs.le).symm.trans (hhigh hs.ge)
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_elbow_identities · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierElbows.lean:37
theorem exponentA_parametric_iff

Saturation at the parametric exponent occurs precisely on and above the elbow. Under the stated assumptions.

Formal statement
α β :
ℝ
hD :
exponentA α β = 1 / 2 ↔ 1 / 2 ≤ α + β
Proof (Lean source)
-- @node: exponentA_parametric_iff lemma exponentA_parametric_iff (α β : ℝ) (hD : ExponentDomain α β) : exponentA α β = 1 / 2 ↔ 1 / 2 ≤ α + β := by constructor · intro h by_contra hs have hbelow : α + β < 1 / 2 := lt_of_not_ge hs rw [exponentA_low_branch α β hD hbelow.le] at h have hd : 0 < 2 * α + 2 * β + 1 := by have hα := hD.1.trans hD.2.2.1 linarith [hD.1] have heq := (div_eq_iff (ne_of_gt hd)).mp h linarith · exact exponentA_high_branch α β hD
CausalSmith.Stat.LogoddsLowsmoothFrontier.exponentA_parametric_iff · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierElbows.lean:67
theorem frontier_compact_uniform

Absolute positive finite constants meet all the compact-uniform requirements. Under the stated assumptions.

Formal statement
c C :
ℝ
hc :
0 < c
Proof (Lean source)
-- @node: frontier_compact_uniform lemma frontier_compact_uniform (c C : ℝ) (hc : 0 < c) : CompactUniform c C := by intro K hK _ _ rw [hK.image_const c, hK.image_const (1 : ℕ)] simp only [csInf_singleton, csSup_singleton] refine ⟨hc, ?_, True.intro⟩ exact lt_of_le_of_lt (iSup_le fun _ => iSup_le fun _ => le_rfl) ENNReal.ofReal_lt_top
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_compact_uniform · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierElbows.lean:83
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.FrontierMixtureRates 3 declarations A single absolute ceiling multiplier controls occupancy and the two mixture Hellinger budgets.

Uniform mixture lower rates

A single absolute ceiling multiplier controls occupancy and the two mixture Hellinger budgets. The mixed and fair testing bounds then give the numerator and radius rates with the roadmap's uniform square-root ceiling factor.

theorem lower_amplitude_product Lemma lower_amplitude_product in the paper ↗

The amplitude product is the power at the sum of the native exponents. Under the stated assumptions.

Formal statement
ε α β :
ℝ
k :
ℕ
hk :
1 ≤ k
(ε*(k : ℝ)^(-α))*(ε*(k : ℝ)^(-β)) = ε^2*(k : ℝ)^(-(α+β))
Proof (Lean source)
-- @node: lower_amplitude_product lemma lower_amplitude_product (ε α β : ℝ) (k : ℕ) (hk : 1 ≤ k) : (ε*(k : ℝ)^(-α))*(ε*(k : ℝ)^(-β)) = ε^2*(k : ℝ)^(-(α+β)) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) rw [neg_add, Real.rpow_add hk0] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.lower_amplitude_product · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierMixtureRates.lean:17
theorem lower_mixed_budget_identity Lemma lower_mixed_budget_identity in the paper ↗

[The squared amplitude product and the pair-count factor combine into the balanced Hellinger power budget. the documented result Under the stated assumptions.

Formal statement
C ε α β :
ℝ
n k :
ℕ
hk :
1 ≤ k
C*(n : ℝ)^2/(k : ℝ)*(ε*(k : ℝ)^(-α))^2*(ε*(k : ℝ)^(-β))^2
= C*ε^4*((n : ℝ)^2*(k : ℝ)^(-(2*(α+β)+1)))
Proof (Lean source)
-- @node: lower_mixed_budget_identity lemma lower_mixed_budget_identity (C ε α β : ℝ) (n k : ℕ) (hk : 1 ≤ k) : C*(n : ℝ)^2/(k : ℝ)*(ε*(k : ℝ)^(-α))^2*(ε*(k : ℝ)^(-β))^2 = C*ε^4*((n : ℝ)^2*(k : ℝ)^(-(2*(α+β)+1))) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have he : (ε*(k : ℝ)^(-α))^2*(ε*(k : ℝ)^(-β))^2 = ε^4*(k : ℝ)^(-2*(α+β)) := by have hp2 : ((k : ℝ)^(-(α+β)))^2 = (k : ℝ)^(-2*(α+β)) := by rw [← Real.rpow_natCast, ← Real.rpow_mul hk0.le] congr 1 ring rw [← mul_pow, lower_amplitude_product ε α β k hk, mul_pow, hp2] ring rw [mul_assoc (C*(n : ℝ)^2/(k : ℝ)), he] have hp : (k : ℝ)^(-(2*(α+β)+1)) = (k : ℝ)^(-2*(α+β)) / (k : ℝ) := by rw [show -(2*(α+β)+1) = -2*(α+β)-1 by ring, Real.rpow_sub hk0, Real.rpow_one] rw [hp] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.lower_mixed_budget_identity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierMixtureRates.lean:25
theorem frontier_mixture_lower_rates

Both lower rates use one absolute multiplier and the same original record mixture lemma, with no restrictions beyond the paper's domain. the documented result

Formal statement
∃ cMix cRadius : ℝ,
0 < cMix
0 < cRadius
conclusion 1
α β r :
ℝ
α+β ≤ 1/2
r ∈ Icc (0 : ℝ) (1/2)
n :
ℕ
1 ≤ n
I :
Procedure n
HonestProcedure n α β I
cMix*(n : ℝ)^(-exponentA α β) ≤ worstLength n α β r I
conclusion 2
α β r :
ℝ
r ∈ Ioc (0 : ℝ) (1/2)
n :
ℕ
1 ≤ n
I :
Procedure n
HonestProcedure n α β I
cRadius*(r*(n : ℝ)^(-exponentB β)) ≤ worstLength n α β r I
Proof (Lean source)
-- @node: frontier_mixture_lower_rates lemma frontier_mixture_lower_rates : ∃ cMix cRadius : ℝ, 0 < cMix ∧ 0 < cRadius ∧ (∀ α β r : ℝ, ExponentDomain α β → α+β ≤ 1/2 → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → cMix*(n : ℝ)^(-exponentA α β) ≤ worstLength n α β r I) ∧ (∀ α β r : ℝ, ExponentDomain α β → r ∈ Ioc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → cRadius*(r*(n : ℝ)^(-exponentB β)) ≤ worstLength n α β r I) := by obtain ⟨hκ, hC, hMixtures⟩ := original_record_mixtures let L : ℝ := (⌈max 1 (max (1/mixtureKappa) (100*mixtureConstant*calibEps^4))⌉₊ : ℝ) have hmax : max 1 (max (1/mixtureKappa) (100*mixtureConstant*calibEps^4)) ≤ L := Nat.le_ceil _ have hL : 1 ≤ L := (le_max_left _ _).trans hmax have hL0 : 0 < L := by linarith have hκL : 1/L ≤ mixtureKappa := by have h := (le_max_left (1/mixtureKappa) _).trans ((le_max_right _ _).trans hmax) apply (div_le_iff₀ hL0).2 have h' := (div_le_iff₀ hκ).1 h nlinarith have hCL : mixtureConstant*calibEps^4/L ≤ 1/100 := by have h := (le_max_right (1/mixtureKappa) _).trans ((le_max_right _ _).trans hmax) apply (div_le_iff₀ hL0).2 linarith let D := (L+1)^(-(1/2 : ℝ)) have hε := calib_constants_spec.1 have hD : 0 < D := Real.rpow_pos_of_pos (by linarith) _ refine ⟨(7/10)*32*calibEps^2*D, (7/10)*(3/2)*calibEps^2*D, by positivity, by positivity, ?_, ?_⟩ · intro α β r hab hs hr n hn I hI have hs0 : 0 < α+β := by linarith [hab.1, hab.2.2.1] obtain ⟨k, hk, hkl, hku⟩ := lower_rank_ceiling_bounds L (α+β) hL hs0 n hn obtain ⟨hOccupancy, hBudget⟩ := lower_rank_budget L (α+β) hL hs0 hs n k hn hk hkl have hSep := lower_rank_separation L (α+β) hL hs0 hs n k hn hk hku have hη := calibrated_amplitude_abs_le calibEps α calib_constants_spec.1.le (by linarith [hab.1, hab.2.2.1]) k hk have hζ := calibrated_amplitude_abs_le calibEps β calib_constants_spec.1.le hab.1.le k hk have hH := (hMixtures n k hn hk (hOccupancy.trans hκL) (calibEps*(k : ℝ)^(-α)) (calibEps*(k : ℝ)^(-β)) 0 hη hζ (by simpa using calib_constants_spec.1.le)).1 rw [lower_mixed_budget_identity mixtureConstant calibEps α β n k hk] at hH have hHscaled := hH.trans (mul_le_mul_of_nonneg_left hBudget (by positivity : 0 ≤ mixtureConstant*calibEps^4)) rw [← mul_div_assoc, mul_one] at hHscaled have hHsmall := hHscaled.trans hCL have hTest := mixed_prior_length_lower α β r n k hab hr.1 hk I hI hHsmall rw [mul_assoc 32, lower_amplitude_product calibEps α β k hk] at hTest rw [exponentA_low_branch α β hab hs] have h := mul_le_mul_of_nonneg_left hSep (by positivity : 0 ≤ (7/10 : ℝ)*32*calibEps^2) dsimp only [D] at * ring_nf at hTest h ⊢ exact h.trans hTest · intro α β r hab hr n hn I hI have hrpos := hr.1 have hs0 : 0 < 2*β := by linarith [hab.1] have hs : 2*β ≤ 1/2 := by linarith [hab.2.1] obtain ⟨k, hk, hkl, hku⟩ := lower_rank_ceiling_bounds L (2*β) hL hs0 n hn obtain ⟨hOccupancy, hBudget⟩ := lower_rank_budget L (2*β) hL hs0 hs n k hn hk hkl have hSep := lower_rank_separation L (2*β) hL hs0 hs n k hn hk hku have hδ := calibrated_amplitude_abs_le calibEps β calib_constants_spec.1.le hab.1.le k hk have ht : r/2 ∈ Icc (0 : ℝ) (1/4) := ⟨by linarith [hr.1], by linarith [hr.2]⟩ have hH := (hMixtures n k hn hk (hOccupancy.trans hκL) 0 0 (calibEps*(k : ℝ)^(-β)) (by simpa using calib_constants_spec.1.le) (by simpa using calib_constants_spec.1.le) hδ).2 (r/2) ht have hId := lower_mixed_budget_identity mixtureConstant calibEps β β n k hk have hEq : (calibEps*(k : ℝ)^(-β))^2*(calibEps*(k : ℝ)^(-β))^2 = (calibEps*(k : ℝ)^(-β))^4 := by ring rw [mul_assoc (mixtureConstant*(n : ℝ)^2/(k : ℝ)), hEq] at hId rw [hId, ← two_mul β] at hH have hHscaled := hH.trans (mul_le_mul_of_nonneg_left hBudget (by positivity : 0 ≤ mixtureConstant*calibEps^4)) rw [← mul_div_assoc, mul_one] at hHscaled have hHsmall := hHscaled.trans hCL have hTest := fair_prior_length_lower α β r n k hab ⟨hr.1.le, hr.2⟩ hk I hI hHsmall have hAmp := lower_amplitude_product calibEps β β k hk have hAmp' : (calibEps*(k : ℝ)^(-β))^2 = calibEps^2*(k : ℝ)^(-(2*β)) := by simpa only [← sq, ← two_mul] using hAmp rw [hAmp'] at hTest have h := mul_le_mul_of_nonneg_left hSep (by positivity : 0 ≤ (7/10 : ℝ)*(3/2)*r*calibEps^2) dsimp only [D, exponentB] at * ring_nf at hTest h ⊢ exact h.trans hTest
CausalSmith.Stat.LogoddsLowsmoothFrontier.frontier_mixture_lower_rates · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/FrontierMixtureRates.lean:48
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.LengthSensitivity 10 declarations The clipped logarithm is globally Lipschitz in its quotient argument.

Sensitivity of the clipped odds interval

The clipped logarithm is globally Lipschitz in its quotient argument. A positive denominator floor then controls the width of the confidence rectangle on every sample, including samples outside the coverage event.

Clipping contracts absolute differences. Under the stated assumptions.

Formal statement
l u x y :
ℝ
|clip l u x - clip l u y| ≤ |x-y|
Proof (Lean source)
-- @node: clip_abs_sub_le lemma clip_abs_sub_le (l u x y : ℝ) : |clip l u x - clip l u y| ≤ |x-y| := by unfold clip calc _ ≤ max |l-l| |min u x - min u y| := abs_max_sub_max_le_max _ _ _ _ _ = |min u x - min u y| := by simp _ ≤ max |u-u| |x-y| := abs_min_sub_min_le_max _ _ _ _ _ = |x-y| := by simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.clip_abs_sub_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:17

On a positive half-line the logarithm has the reciprocal-floor Lipschitz bound. Under the stated assumptions.

Formal statement
a x y :
ℝ
ha :
0 < a
hx :
a ≤ x
hy :
a ≤ y
|log x - log y| ≤ |x-y|/a
Proof (Lean source)
-- @node: log_abs_sub_le_floor lemma log_abs_sub_le_floor (a x y : ℝ) (ha : 0 < a) (hx : a ≤ x) (hy : a ≤ y) : |log x - log y| ≤ |x-y|/a := by have hxp : 0 < x := ha.trans_le hx have hyp : 0 < y := ha.trans_le hy have hordered (v w : ℝ) (hv : a ≤ v) (hw : a ≤ w) (hvw : v ≤ w) : log w - log v ≤ (w-v)/a := by have hvp : 0 < v := ha.trans_le hv have hwp : 0 < w := ha.trans_le hw calc _ = log (w/v) := (Real.log_div hwp.ne' hvp.ne').symm _ ≤ w/v-1 := Real.log_le_sub_one_of_pos (div_pos hwp hvp) _ = (w-v)/v := by field_simp _ ≤ (w-v)/a := div_le_div_of_nonneg_left (sub_nonneg.mpr hvw) ha hv rcases le_total x y with hxy | hyx · rw [abs_of_nonpos (sub_nonpos.mpr (Real.log_le_log hxp hxy)), abs_of_nonpos (sub_nonpos.mpr hxy)] simpa only [neg_sub] using hordered x y hx hy hxy · rw [abs_of_nonneg (sub_nonneg.mpr (Real.log_le_log hyp hyx)), abs_of_nonneg (sub_nonneg.mpr hyx)] exact hordered y x hy hx hyx
CausalSmith.Stat.LogoddsLowsmoothFrontier.log_abs_sub_le_floor · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:27

[Effect clipping gives the exact global exponential Lipschitz constant in the roadmap. the stated conclusion holds.

Formal statement
c d c' d' :
ℝ
|inversion c d - inversion c' d'| ≤ exp (1/2) * |c/d-c'/d'|
Proof (Lean source)
-- @node: inversion_abs_sub_le lemma inversion_abs_sub_le (c d c' d' : ℝ) : |inversion c d - inversion c' d'| ≤ exp (1/2) * |c/d-c'/d'| := by have h := log_abs_sub_le_floor (exp (-1/2)) (clip (exp (-1/2)) (exp (1/2)) (1+c/d)) (clip (exp (-1/2)) (exp (1/2)) (1+c'/d')) (Real.exp_pos _) (le_max_left _ _) (le_max_left _ _) calc _ ≤ |clip (exp (-1/2)) (exp (1/2)) (1+c/d) - clip (exp (-1/2)) (exp (1/2)) (1+c'/d')| / exp (-1/2) := h _ ≤ |(1+c/d)-(1+c'/d')| / exp (-1/2) := by exact div_le_div_of_nonneg_right (clip_abs_sub_le _ _ _ _) (Real.exp_pos _).le _ = exp (1/2) * |c/d-c'/d'| := by rw [show (1+c/d)-(1+c'/d') = c/d-c'/d' by ring, div_eq_mul_inv, show (exp (-1/2 : ℝ))⁻¹ = exp (1/2) by rw [← Real.exp_neg]; congr 1; ring] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_abs_sub_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:50
theorem quotient_abs_sub_le_floor Lemma quotient_abs_sub_le_floor in the paper ↗

Inserting a cross quotient controls the two-coordinate perturbation. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
a c d c' d' :
ℝ
ha :
0 < a
hd :
a ≤ d
hd' :
a ≤ d'
|c/d-c'/d'| ≤ |c-c'|/a + |c'| *|d-d'|/a^2
Proof (Lean source)
-- @node: quotient_abs_sub_le_floor lemma quotient_abs_sub_le_floor (a c d c' d' : ℝ) (ha : 0 < a) (hd : a ≤ d) (hd' : a ≤ d') : |c/d-c'/d'| ≤ |c-c'|/a + |c'| *|d-d'|/a^2 := by have hdp : 0 < d := ha.trans_le hd have hd'p : 0 < d' := ha.trans_le hd' calc _ ≤ |c/d-c'/d| + |c'/d-c'/d'| := abs_sub_le _ _ _ _ = |c-c'|/d + |c'| *|d-d'|/(d*d') := by rw [← sub_div, abs_div, abs_of_pos hdp] congr 1 rw [show c'/d-c'/d' = c'*(d'-d)/(d*d') by field_simp, abs_div, abs_mul, abs_sub_comm d' d, abs_of_pos (mul_pos hdp hd'p)] _ ≤ |c-c'|/a + |c'| *|d-d'|/a^2 := by apply add_le_add · exact div_le_div_of_nonneg_left (abs_nonneg _) ha hd · apply div_le_div_of_nonneg_left (by positivity) (by positivity) nlinarith [mul_le_mul hd hd' ha.le hdp.le]
CausalSmith.Stat.LogoddsLowsmoothFrontier.quotient_abs_sub_le_floor · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:69
theorem inversion_rectangle_abs_sub_le Lemma inversion_rectangle_abs_sub_le in the paper ↗

Any two corners of a confidence rectangle obey the same length envelope. Under the stated assumptions. Under the stated assumptions.

Formal statement
a c b t c₁ c₂ d₁ d₂ :
ℝ
ha :
0 < a
hb :
0 ≤ b
ht :
0 ≤ t
hc₁ :
c₁ ∈ Icc (c-b) (c+b)
hc₂ :
c₂ ∈ Icc (c-b) (c+b)
hd₁ :
a ≤ d₁
hd₂ :
a ≤ d₂
hwidth :
|d₁-d₂| ≤ 2*t
|inversion c₁ d₁ - inversion c₂ d₂|
≤ 2*exp (1/2)/a*b + 2*exp (1/2)/a^2*t*(|c|+b)
Proof (Lean source)
-- @node: inversion_rectangle_abs_sub_le lemma inversion_rectangle_abs_sub_le (a c b t c₁ c₂ d₁ d₂ : ℝ) (ha : 0 < a) (hb : 0 ≤ b) (ht : 0 ≤ t) (hc₁ : c₁ ∈ Icc (c-b) (c+b)) (hc₂ : c₂ ∈ Icc (c-b) (c+b)) (hd₁ : a ≤ d₁) (hd₂ : a ≤ d₂) (hwidth : |d₁-d₂| ≤ 2*t) : |inversion c₁ d₁ - inversion c₂ d₂| ≤ 2*exp (1/2)/a*b + 2*exp (1/2)/a^2*t*(|c|+b) := by have hcd : |c₁-c₂| ≤ 2*b := by have := abs_sub_le_of_le_of_le hc₁.1 hc₁.2 hc₂.1 hc₂.2 linarith have hcabs : |c₂| ≤ |c|+b := by have hdist : |c₂-c| ≤ b := abs_le.mpr ⟨by linarith [hc₂.1], by linarith [hc₂.2]⟩ have := abs_sub_le c₂ c 0 have htri : |c₂| ≤ |c₂-c| + |c| := by simpa using this linarith calc _ ≤ exp (1/2) * (|c₁-c₂|/a + |c₂| *|d₁-d₂|/a^2) := (inversion_abs_sub_le _ _ _ _).trans (mul_le_mul_of_nonneg_left (quotient_abs_sub_le_floor _ _ _ _ _ ha hd₁ hd₂) (Real.exp_pos _).le) _ ≤ exp (1/2) * (2*b/a + (|c|+b)*(2*t)/a^2) := by gcongr _ = _ := by ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_rectangle_abs_sub_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:89
theorem clipped_denominator_width Lemma clipped_denominator_width in the paper ↗

Clipping the denominator preserves its floor and bounds the width by the input width. Under the stated assumptions.

Formal statement
s t :
ℝ
ht :
0 ≤ t
conclusion 1
conclusion 2
conclusion 3
|clip denominatorFloor 1 (s-t) - clip denominatorFloor 1 (s+t)| ≤ 2*t
Proof (Lean source)
-- @node: clipped_denominator_width lemma clipped_denominator_width (s t : ℝ) (ht : 0 ≤ t) : denominatorFloor ≤ clip denominatorFloor 1 (s-t) ∧ denominatorFloor ≤ clip denominatorFloor 1 (s+t) ∧ |clip denominatorFloor 1 (s-t) - clip denominatorFloor 1 (s+t)| ≤ 2*t := by refine ⟨le_max_left _ _, le_max_left _ _, ?_⟩ calc _ ≤ |(s-t)-(s+t)| := clip_abs_sub_le _ _ _ _ _ = 2*t := by rw [show (s-t)-(s+t) = -(2*t) by ring, abs_neg, abs_of_nonneg (by positivity)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.clipped_denominator_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:113
theorem inversion_four_corner_width_le Lemma inversion_four_corner_width_le in the paper ↗

The four-corner inversion width obeys an unconditional rectangle bound. Under the stated assumptions.

Formal statement
c s b t :
ℝ
hb :
0 ≤ b
ht :
0 ≤ t
max (inversion (c+b) (clip denominatorFloor 1 (s-t))) (inversion (c+b) (clip denominatorFloor 1 (s+t)))
- min (inversion (c-b) (clip denominatorFloor 1 (s-t))) (inversion (c-b) (clip denominatorFloor 1 (s+t)))
≤ 2*exp (1/2)/denominatorFloor*b + 2*exp (1/2)/denominatorFloor^2*t*(|c|+b)
Proof (Lean source)
-- @node: inversion_four_corner_width_le lemma inversion_four_corner_width_le (c s b t : ℝ) (hb : 0 ≤ b) (ht : 0 ≤ t) : max (inversion (c+b) (clip denominatorFloor 1 (s-t))) (inversion (c+b) (clip denominatorFloor 1 (s+t))) - min (inversion (c-b) (clip denominatorFloor 1 (s-t))) (inversion (c-b) (clip denominatorFloor 1 (s+t))) ≤ 2*exp (1/2)/denominatorFloor*b + 2*exp (1/2)/denominatorFloor^2*t*(|c|+b) := by obtain ⟨hm, hp, hwidth⟩ := clipped_denominator_width s t ht have ha : 0 < denominatorFloor := by norm_num [denominatorFloor] have hlow : c-b ∈ Icc (c-b) (c+b) := ⟨le_rfl, by linarith⟩ have hhigh : c+b ∈ Icc (c-b) (c+b) := ⟨by linarith, le_rfl⟩ have hsame : |clip denominatorFloor 1 (s-t) - clip denominatorFloor 1 (s-t)| ≤ 2*t := by simpa using (show 0 ≤ 2*t by positivity) have hsame' : |clip denominatorFloor 1 (s+t) - clip denominatorFloor 1 (s+t)| ≤ 2*t := by simpa using (show 0 ≤ 2*t by positivity) have hrev : |clip denominatorFloor 1 (s+t) - clip denominatorFloor 1 (s-t)| ≤ 2*t := by simpa only [abs_sub_comm] using hwidth have h₁ := (le_abs_self _).trans (inversion_rectangle_abs_sub_le _ _ _ _ _ _ _ _ ha hb ht hhigh hlow hm hm hsame) have h₂ := (le_abs_self _).trans (inversion_rectangle_abs_sub_le _ _ _ _ _ _ _ _ ha hb ht hhigh hlow hm hp hwidth) have h₃ := (le_abs_self _).trans (inversion_rectangle_abs_sub_le _ _ _ _ _ _ _ _ ha hb ht hhigh hlow hp hm hrev) have h₄ := (le_abs_self _).trans (inversion_rectangle_abs_sub_le _ _ _ _ _ _ _ _ ha hb ht hhigh hlow hp hp hsame') rcases le_total (inversion (c+b) (clip denominatorFloor 1 (s-t))) (inversion (c+b) (clip denominatorFloor 1 (s+t))) with h | h · rw [max_eq_right h] rcases le_total (inversion (c-b) (clip denominatorFloor 1 (s-t))) (inversion (c-b) (clip denominatorFloor 1 (s+t))) with h' | h' · rw [min_eq_left h']; exact h₃ · rw [min_eq_right h']; exact h₄ · rw [max_eq_left h] rcases le_total (inversion (c-b) (clip denominatorFloor 1 (s-t))) (inversion (c-b) (clip denominatorFloor 1 (s+t))) with h' | h' · rw [min_eq_left h']; exact h₁ · rw [min_eq_right h']; exact h₂
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_four_corner_width_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:124
theorem idealEndpoints_length_le

[Exact ideal endpoints satisfy the unconditional bound on every original sample. the stated conclusion holds.

Formal statement
n :
ℕ
α β :
ℝ
o :
Fin n → Record
k :
resolutions E N n α β
bC :
8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1)
bS :
25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2)
(idealEndpoints E N n α β o).2 - (idealEndpoints E N n α β o).1
≤ 2*exp (1/2)/denominatorFloor*bC
+ 2*exp (1/2)/denominatorFloor^2*bS*(|cHat n k.1 o|+bC)
Proof (Lean source)
-- @node: idealEndpoints_length_le lemma idealEndpoints_length_le (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (α β : ℝ) (o : Fin n → Record) : let k := resolutions E N n α β let bC := 8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1) let bS := 25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2) (idealEndpoints E N n α β o).2 - (idealEndpoints E N n α β o).1 ≤ 2*exp (1/2)/denominatorFloor*bC + 2*exp (1/2)/denominatorFloor^2*bS*(|cHat n k.1 o|+bC) := by dsimp only exact inversion_four_corner_width_le _ _ _ _ (by positivity) (by positivity)
CausalSmith.Stat.LogoddsLowsmoothFrontier.idealEndpoints_length_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:164
theorem upperOutput_length_le

Outward rounding adds only the prescribed two-over-n excess to the samplewise bound. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
o :
Fin n → Record
k :
resolutions E N n α β
bC :
8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1)
bS :
25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2)
intervalLength (upperOutput E N n α β o)
≤ 2*exp (1/2)/denominatorFloor*bC
+ 2*exp (1/2)/denominatorFloor^2*bS*(|cHat n k.1 o|+bC)
+ 2/(n : ℝ)
Proof (Lean source)
-- @node: upperOutput_length_le lemma upperOutput_length_le (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) (o : Fin n → Record) : let k := resolutions E N n α β let bC := 8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1) let bS := 25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2) intervalLength (upperOutput E N n α β o) ≤ 2*exp (1/2)/denominatorFloor*bC + 2*exp (1/2)/denominatorFloor^2*bS*(|cHat n k.1 o|+bC) + 2/(n : ℝ) := by obtain ⟨c, s, L, R, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, hLength, _⟩ := fixed_budget_realization.2 E hE N hN n hn α β hab o dsimp only have hIdeal := idealEndpoints_length_le E N n α β o dsimp only at hIdeal linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperOutput_length_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:177
theorem integral_abs_le_bias_sqrt_variance Lemma integral_abs_le_bias_sqrt_variance in the paper ↗

A square-integrable coordinate is controlled in absolute mean by its bias and variance. Under the stated assumptions. Under the stated assumptions.

Formal statement
Ω :
X :
Ω → ℝ
hX :
MemLp X 2 μ
c b V :
ℝ
hbias :
|(∫ ω, X ω ∂μ)-c| ≤ b
hvar :
variance X μ ≤ V
(∫ ω, |X ω| ∂μ) ≤ |c|+b+sqrt V
Proof (Lean source)
-- @node: integral_abs_le_bias_sqrt_variance lemma integral_abs_le_bias_sqrt_variance {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → ℝ) (hX : MemLp X 2 μ) (c b V : ℝ) (hbias : |(∫ ω, X ω ∂μ)-c| ≤ b) (hvar : variance X μ ≤ V) : (∫ ω, |X ω| ∂μ) ≤ |c|+b+sqrt V := by have hcenter : MemLp (fun ω => X ω - ∫ ω, X ω ∂μ) 2 μ := hX.sub (memLp_const _) have hi := hX.integrable (by norm_num : (1 : ℝ≥0∞) ≤ 2) have hic := hcenter.integrable (by norm_num : (1 : ℝ≥0∞) ≤ 2) have hcs := integral_abs_le_sqrt_integral_sq μ _ hcenter simp only [Real.norm_eq_abs, sq_abs] at hcs rw [← variance_eq_integral hX.aemeasurable] at hcs have hmean : |∫ ω, X ω ∂μ| ≤ |c|+b := by have h := abs_sub_le (∫ ω, X ω ∂μ) c 0 simp only [sub_zero] at h linarith calc _ ≤ ∫ ω, (|X ω - ∫ ω, X ω ∂μ| + |∫ ω, X ω ∂μ|) ∂μ := integral_mono hi.abs (hic.abs.add (integrable_const _)) (fun ω => by simpa only [sub_zero] using abs_sub_le (X ω) (∫ ω, X ω ∂μ) 0) _ = (∫ ω, |X ω - ∫ ω, X ω ∂μ| ∂μ) + |∫ ω, X ω ∂μ| := by rw [integral_add hic.abs (integrable_const _)] simp _ ≤ sqrt V + (|c|+b) := add_le_add (hcs.trans (Real.sqrt_le_sqrt hvar)) hmean _ = _ := by ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.integral_abs_le_bias_sqrt_variance · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LengthSensitivity.lean:195
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.LogEnclosure 7 declarations The finite geometric remainder, public rational range bound and exponential comparison certify the literal atanh sum at its fixed truncation count.

Certificates for the prescribed logarithm truncation

The finite geometric remainder, public rational range bound and exponential comparison certify the literal atanh sum at its fixed truncation count. Monotonicity then gives the primitive interval contract.

[The public logarithm range bounds both the argument and its reciprocal. the stated conclusion holds.

Formal statement
z :
ℚ
conclusion 1
2 ≤ logRangeBound z
conclusion 2
z ≤ (logRangeBound z : ℚ)
conclusion 3
1/z ≤ (logRangeBound z : ℚ)
Proof (Lean source)
-- @node: logRangeBound_spec lemma logRangeBound_spec (z : ℚ) : 2 ≤ logRangeBound z ∧ z ≤ (logRangeBound z : ℚ) ∧ 1/z ≤ (logRangeBound z : ℚ) := by have hc (x : ℚ) : x ≤ ((⌈x⌉ : ℤ).toNat : ℚ) := by exact (Int.le_ceil x).trans (by exact_mod_cast Int.self_le_toNat (⌈x⌉ : ℤ)) refine ⟨le_max_left _ _, ?_, ?_⟩ · exact (hc z).trans (by exact_mod_cast (le_max_left _ _).trans (le_max_right 2 _)) · exact (hc (1/z)).trans (by exact_mod_cast (le_max_right _ _).trans (le_max_right 2 _))
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRangeBound_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogEnclosure.lean:17

The atanh coordinate has the range and denominator bounds used by the roadmap. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
z B :
ℝ
hz :
0 < z
hB :
2 ≤ B
hzu :
z ≤ B
hzl :
1 / z ≤ B
conclusion 1
|(z-1)/(z+1)| ≤ (B-1)/(B+1)
conclusion 2
1/B ≤ 1-((z-1)/(z+1))^2
Proof (Lean source)
-- @node: log_coordinate_bounds lemma log_coordinate_bounds (z B : ℝ) (hz : 0 < z) (hB : 2 ≤ B) (hzu : z ≤ B) (hzl : 1 / z ≤ B) : |(z-1)/(z+1)| ≤ (B-1)/(B+1) ∧ 1/B ≤ 1-((z-1)/(z+1))^2 := by have hBp : 0 < B := by linarith have hden : 0 < z+1 := by linarith have hdenB : 0 < B+1 := by linarith have hlow : 1 ≤ B*z := (div_le_iff₀ hz).mp hzl have hab : |(z-1)/(z+1)| ≤ (B-1)/(B+1) := by rw [abs_le] constructor · apply (le_div_iff₀ hden).mpr rw [← neg_div, div_mul_eq_mul_div] apply (div_le_iff₀ hdenB).mpr nlinarith · apply (div_le_iff₀ hden).mpr rw [div_mul_eq_mul_div] apply (le_div_iff₀ hdenB).mpr nlinarith refine ⟨hab, ?_⟩ have hr0 : 0 ≤ (B-1)/(B+1) := div_nonneg (by linarith) hdenB.le have hs := pow_le_pow_left₀ (abs_nonneg ((z-1)/(z+1))) hab 2 rw [sq_abs] at hs have hh : 1/B ≤ 1-((B-1)/(B+1))^2 := by apply (div_le_iff₀ hBp).mpr field_simp nlinarith linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.log_coordinate_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogEnclosure.lean:28
theorem log_coordinate_power_bound Lemma log_coordinate_power_bound in the paper ↗

The exponential comparison makes a full public block decay by a dyadic factor. Under the stated assumptions. Under the stated assumptions.

Formal statement
B L :
ℕ
hB :
2 ≤ B
v :
ℝ
hv :
|v| ≤ ((B : ℝ) - 1) / (B + 1)
|v| ^ (2*(B*L)+1) ≤ (1/2 : ℝ)^L
Proof (Lean source)
-- @node: log_coordinate_power_bound lemma log_coordinate_power_bound (B L : ℕ) (hB : 2 ≤ B) (v : ℝ) (hv : |v| ≤ ((B : ℝ) - 1) / (B + 1)) : |v| ^ (2*(B*L)+1) ≤ (1/2 : ℝ)^L := by have hBp : (0 : ℝ) < B := by exact_mod_cast (by omega : 0 < B) have hB1 : (0 : ℝ) < (B : ℝ)+1 := by positivity have hBr : (2 : ℝ) ≤ B := by exact_mod_cast hB have hv1 : |v| ≤ 1-1/(B : ℝ) := by have hh : ((B : ℝ) - 1) / (B + 1) ≤ 1-1/(B : ℝ) := by apply (div_le_iff₀ hB1).mpr field_simp nlinarith exact hv.trans hh have he : |v| ≤ exp (-(1/(B : ℝ))) := hv1.trans (Real.one_sub_le_exp_neg _) have hp := pow_le_pow_left₀ (abs_nonneg v) he (2*(B*L)+1) rw [← Real.exp_nat_mul] at hp have hexp : ((2*(B*L)+1 : ℕ) : ℝ) * (-(1/(B : ℝ))) ≤ -(L : ℝ) := by push_cast field_simp nlinarith have hhalf : exp (-1 : ℝ) ≤ 1/2 := by rw [Real.exp_neg] rw [one_div] apply (inv_le_inv₀ (Real.exp_pos _) (by norm_num)).mpr have := Real.add_one_le_exp (1 : ℝ) linarith calc |v| ^ (2*(B*L)+1) ≤ exp (((2*(B*L)+1 : ℕ) : ℝ)*(-(1/(B : ℝ)))) := hp _ ≤ exp (-(L : ℝ)) := Real.exp_le_exp.mpr hexp _ = exp (-1 : ℝ)^L := by rw [← Real.exp_nat_mul]; congr 1; ring _ ≤ (1/2 : ℝ)^L := pow_le_pow_left₀ (Real.exp_pos _).le hhalf L
CausalSmith.Stat.LogoddsLowsmoothFrontier.log_coordinate_power_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogEnclosure.lean:59

[The prescribed integer count absorbs the range factor in the geometric tail. the stated conclusion holds.

Formal statement
q B :
ℕ
2*(B : ℝ)*(1/2 : ℝ)^(q+3+clog 2 (8*B)+2) ≤ (rationalError (q+3) : ℝ)
Proof (Lean source)
-- @node: log_tail_budget lemma log_tail_budget (q B : ℕ) : 2*(B : ℝ)*(1/2 : ℝ)^(q+3+clog 2 (8*B)+2) ≤ (rationalError (q+3) : ℝ) := by have hclog : (8*B : ℝ) ≤ (2 : ℝ)^clog 2 (8*B) := by exact_mod_cast Nat.le_pow_clog (by norm_num : 1 < (2 : ℕ)) (8*B) simp only [rationalError, Rat.cast_div, Rat.cast_one, Rat.cast_pow, Rat.cast_ofNat] rw [one_div_pow, pow_add, pow_add] have hpow : 0 < (2 : ℝ)^clog 2 (8*B) := by positivity have hq : 0 < (2 : ℝ)^(q+3) := by positivity field_simp nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.log_tail_budget · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogEnclosure.lean:93

The finite geometric remainder certifies the literal logarithm polynomial. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
q :
ℕ
z :
ℚ
hz :
0 < z
|log z - (logPolynomial q z : ℝ)| ≤ (rationalError (q+3) : ℝ)
Proof (Lean source)
-- @node: logPolynomial_error lemma logPolynomial_error (q : ℕ) (z : ℚ) (hz : 0 < z) : |log z - (logPolynomial q z : ℝ)| ≤ (rationalError (q+3) : ℝ) := by let B := logRangeBound z let L := q+3+clog 2 (8*B)+2 let v : ℝ := ((z : ℝ)-1)/(z+1) obtain ⟨hB, hzu, hzl⟩ := logRangeBound_spec z have hzR : (0 : ℝ) < z := by exact_mod_cast hz have hBr : (2 : ℝ) ≤ B := by exact_mod_cast hB obtain ⟨hv, hd⟩ := log_coordinate_bounds (z : ℝ) B hzR hBr (by exact_mod_cast hzu) (by exact_mod_cast hzl) have hBp : (0 : ℝ) < B := by linarith have hvlt : |v| < 1 := by apply lt_of_le_of_lt hv apply (div_lt_iff₀ (by positivity : (0 : ℝ) < B+1)).mpr linarith have hdiv : (1+v)/(1-v) = (z : ℝ) := by dsimp [v] field_simp ring have hrem := Real.sum_range_sub_log_div_le hvlt (B*L) rw [hdiv] at hrem have hpoly : (logPolynomial q z : ℝ) = 2*∑ j ∈ range (B*L), v^(2*j+1)/(2*(j : ℝ)+1) := by simp only [logPolynomial] push_cast rfl have heq : log z - (logPolynomial q z : ℝ) = 2*(1/2*log z - ∑ j ∈ range (B*L), v^(2*j+1)/(2*(j : ℝ)+1)) := by rw [hpoly] ring rw [heq, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] have hp := log_coordinate_power_bound B L hB v hv have hden : 0 < 1-v^2 := lt_of_lt_of_le (by positivity : (0 : ℝ) < 1/B) hd calc 2*|1/2*log z - ∑ j ∈ range (B*L), v^(2*j+1)/(2*(j : ℝ)+1)| ≤ 2*(|v|^(2*(B*L)+1)/(1-v^2)) := by exact mul_le_mul_of_nonneg_left hrem (by norm_num) _ ≤ 2*((1/2 : ℝ)^L/(1/B)) := by gcongr _ = 2*(B : ℝ)*(1/2 : ℝ)^L := by field_simp _ ≤ (rationalError (q+3) : ℝ) := log_tail_budget q B
CausalSmith.Stat.LogoddsLowsmoothFrontier.logPolynomial_error · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogEnclosure.lean:107

The symmetric scalar bracket contains the logarithm with the requested endpoint excess. Under the stated assumptions.

Formal statement
q :
ℕ
z :
ℚ
hz :
0 < z
conclusion 1
(paperLogScalar q z).Contains (log z)
conclusion 2
log z - (paperLogScalar q z).lo ≤ precisionError q
conclusion 3
(paperLogScalar q z).hi - log z ≤ precisionError q
Proof (Lean source)
-- @node: paperLogScalar_spec lemma paperLogScalar_spec (q : ℕ) (z : ℚ) (hz : 0 < z) : (paperLogScalar q z).Contains (log z) ∧ log z - (paperLogScalar q z).lo ≤ precisionError q ∧ (paperLogScalar q z).hi - log z ≤ precisionError q := by obtain ⟨hl, hu⟩ := abs_le.mp (logPolynomial_error q z hz) have he0 : 0 ≤ rationalError (q+3) := by unfold rationalError; positivity have hord : logPolynomial q z-rationalError (q+3) ≤ logPolynomial q z+rationalError (q+3) := by linarith have herr : 2*(rationalError (q+3) : ℝ) ≤ precisionError q := by simp only [rationalError, precisionError, Rat.cast_div, Rat.cast_one, Rat.cast_pow, Rat.cast_ofNat, zpow_neg, zpow_natCast] rw [pow_add] have hp : 0 < (2 : ℝ)^q := by positivity field_simp norm_num simp only [paperLogScalar, if_pos hz, rationalBox, min_eq_left hord, max_eq_right hord, RatInterval.Contains, Rat.cast_sub, Rat.cast_add] exact ⟨⟨by linarith, by linarith⟩, by linarith, by linarith⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperLogScalar_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogEnclosure.lean:150
theorem concreteEngine_log_contract

Monotonicity extends the certified logarithm brackets to positive rational intervals. Under the stated assumptions.

Formal statement
q :
ℕ
hI :
0 < I.lo
MonotoneContract log q I (concreteEngine.logBox q I)
Proof (Lean source)
-- @node: concreteEngine_log_contract lemma concreteEngine_log_contract (q : ℕ) (I : RatInterval) (hI : 0 < I.lo) : MonotoneContract log q I (concreteEngine.logBox q I) := by have hhi : 0 < I.hi := hI.trans_le I.lo_le_hi obtain ⟨hl, hle, hlu⟩ := paperLogScalar_spec q I.lo hI obtain ⟨hu, hue, huu⟩ := paperLogScalar_spec q I.hi hhi have hIlo : (0 : ℝ) < I.lo := by exact_mod_cast hI have horderR : ((paperLogScalar q I.lo).lo : ℝ) ≤ (paperLogScalar q I.hi).hi := hl.1.trans ((Real.log_le_log hIlo (by exact_mod_cast I.lo_le_hi)).trans hu.2) have horder : (paperLogScalar q I.lo).lo ≤ (paperLogScalar q I.hi).hi := by exact_mod_cast horderR simp only [concreteEngine, endpointExtension, rationalBox, min_eq_left horder, max_eq_right horder, MonotoneContract, RatInterval.Contains] refine ⟨?_, sub_nonneg.mpr hl.1, hle, sub_nonneg.mpr hu.2, huu⟩ intro x hx exact ⟨hl.1.trans (Real.log_le_log hIlo hx.1), (Real.log_le_log (hIlo.trans_le hx.1) hx.2).trans hu.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_log_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogEnclosure.lean:171
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.LogProgram 15 declarations Two endpoint loops compute the odd-power sum using the exact public count.

Register certificate for the prescribed logarithm recurrence

Two endpoint loops compute the odd-power sum using the exact public count. Nonpositive scalar arguments return the prescribed zero point.

[The integer range bound is computed by clamping the two signed ceilings. the stated conclusion holds.

Formal statement
z :
ℚ
max (max (↑(⌈z⌉ : ℤ) : ℚ) (↑(⌈1/z⌉ : ℤ) : ℚ)) 2 = (logRangeBound z : ℚ)
Proof (Lean source)
-- @node: logRegister_bound_cast lemma logRegister_bound_cast (z : ℚ) : max (max (↑(⌈z⌉ : ℤ) : ℚ) (↑(⌈1/z⌉ : ℤ) : ℚ)) 2 = (logRangeBound z : ℚ) := by have h (a b : ℤ) : max (max a b) 2 = ((max 2 (max a.toNat b.toNat) : ℕ) : ℤ) := by omega exact_mod_cast h (⌈z⌉ : ℤ) (⌈1/z⌉ : ℤ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegister_bound_cast · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:16

The two-endpoint logarithm register code.

Definition (Lean source)
logRegisterCode :
[.copy 16 0, .copy 20 2, .constant 18 0, .constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 7 1, .ceil 11 1, .div 13 8 1, .ceil 13 13, .max 11 11 13, .max 11 11 9, .constant 10 8, .mul 13 11 10, .clogTwo 13 13, .constant 10 5, .add 10 14 10, .add 10 10 13, .mul 2 11 10, .sub 4 1 8, .add 13 1 8, .div 4 4 13, .mul 10 4 4, .copy 5 4, .constant 6 0, .constant 3 1, .branchLe 2 12 35 29, .div 13 5 3, .add 6 6 13, .mul 5 5 10, .add 3 3 9, .sub 2 2 8, .jump 28, .branchLe 7 12 45 36, .mul 6 6 9, .constant 13 3, .add 13 14 13, .natPow 9 9 13, .div 8 8 9, .sub 0 6 8, .add 1 6 8, .copy 13 13, .jump 54, .constant 0 0, .constant 1 0, .copy 13 13, .copy 13 13, .copy 13 13, .copy 13 13, .copy 13 13, .copy 13 13, .jump 54, .min 17 0 1, .max 1 0 1, .copy 0 17, .copy 18 0, .copy 0 16, .copy 1 20, .constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 7 1, .ceil 11 1, .div 13 8 1, .ceil 13 13, .max 11 11 13, .max 11 11 9, .constant 10 8, .mul 13 11 10, .clogTwo 13 13, .constant 10 5, .add 10 14 10, .add 10 10 13, .mul 2 11 10, .sub 4 1 8, .add 13 1 8, .div 4 4 13, .mul 10 4 4, .copy 5 4, .constant 6 0, .constant 3 1, .branchLe 2 12 92 86, .div 13 5 3, .add 6 6 13, .mul 5 5 10, .add 3 3 9, .sub 2 2 8, .jump 85, .branchLe 7 12 102 93, .mul 6 6 9, .constant 13 3, .add 13 14 13, .natPow 9 9 13, .div 8 8 9, .sub 0 6 8, .add 1 6 8, .copy 13 13, .jump 111, .constant 0 0, .constant 1 0, .copy 13 13, .copy 13 13, .copy 13 13, .copy 13 13, .copy 13 13, .copy 13 13, .jump 111, .min 17 0 1, .max 1 0 1, .copy 0 17, .copy 0 18, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:25

The loop head records the odd index, power, partial sum and untouched frame.

Definition (Lean source)
right :
q j remaining :
ℕ
z :
ℚ
original left endpoint :
ℚ
pc :
s.1 = (if right then 85 else 28)
active :
s.2.2 = false
count :
s.2.1 2 = remaining
index :
s.2.1 3 = (2*j+1 : ℕ)
argument :
s.2.1 4 = (z-1)/(z+1)
term :
s.2.1 5 = ((z-1)/(z+1))^(2*j+1)
sum :
s.2.1 6 = ∑ i ∈ range j, ((z-1)/(z+1))^(2*i+1)/(2*i+1 : ℕ)
scalar :
s.2.1 7 = z
one :
s.2.1 8 = 1
two :
s.2.1 9 = 2
ratio :
s.2.1 10 = ((z-1)/(z+1))^2
zero :
s.2.1 12 = 0
precision :
s.2.1 14 = q
original :
s.2.1 16 = original
left :
s.2.1 18 = left
endpoint :
s.2.1 20 = endpoint
CausalSmith.Stat.LogoddsLowsmoothFrontier.LogRegisterInvariant · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:145
theorem logRegisterCode_initial

Initialization computes the literal logarithm truncation count. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
right :
hp :
s.1 = (if right then 60 else 3)
ha :
s.2.2 = false
q :
(⌊s.2.1 0⌋ : ℤ).toNat
z :
s.2.1 1
LogRegisterInvariant right q 0 (logRangeBound z * (q+3+clog 2 (8*logRangeBound z)+2)) z (s.2.1 16) (s.2.1 18) (s.2.1 20) (logRegisterCode.run 25 s)
Proof (Lean source)
-- @node: logRegisterCode_initial lemma logRegisterCode_initial (right : Bool) (s : RationalState) (hp : s.1 = (if right then 60 else 3)) (ha : s.2.2 = false) : let q := (⌊s.2.1 0⌋ : ℤ).toNat let z := s.2.1 1 LogRegisterInvariant right q 0 (logRangeBound z * (q+3+clog 2 (8*logRangeBound z)+2)) z (s.2.1 16) (s.2.1 18) (s.2.1 20) (logRegisterCode.run 25 s) := by have hq : max (↑(⌊s.2.1 0⌋ : ℤ) : ℚ) 0 = ((⌊s.2.1 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊s.2.1 0⌋ : ℤ) 0 = (((⌊s.2.1 0⌋ : ℤ).toNat : ℕ) : ℤ) by omega) have hb (z : ℚ) : max (max (↑(⌈z⌉ : ℤ) : ℚ) (↑(⌈z⁻¹⌉ : ℤ) : ℚ)) 2 = (logRangeBound z : ℚ) := by simpa only [one_div] using logRegister_bound_cast z have hc (z : ℚ) : (⌊(logRangeBound z : ℚ)*8⌋ : ℤ).toNat = 8*logRangeBound z := by rw [show (logRangeBound z : ℚ)*8 = (8*logRangeBound z : ℕ) by push_cast; ring] norm_cast cases right <;> generalize he : logRegisterCode.run 25 s = t all_goals norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq, hb, hc] at he subst t constructor <;> norm_num [Function.update_apply, Nat.cast_mul, Nat.cast_add, hb, hc] all_goals (ring <;> simp)
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode_initial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:169
theorem logRegisterCode_round

One seven-instruction block adds the next odd-power term. Under the stated assumptions. Under the stated assumptions.

Formal statement
right :
q j N :
ℕ
z a l e :
ℚ
h :
LogRegisterInvariant right q j (N + 1) z a l e s
LogRegisterInvariant right q (j+1) N z a l e (logRegisterCode.run 7 s)
Proof (Lean source)
-- @node: logRegisterCode_round lemma logRegisterCode_round (right : Bool) (q j N : ℕ) (z a l e : ℚ) (s : RationalState) (h : LogRegisterInvariant right q j (N + 1) z a l e s) : LogRegisterInvariant right q (j+1) N z a l e (logRegisterCode.run 7 s) := by rcases h with ⟨hp, ha, hc, hi, hz, ht, hs, hscalar, h1, h2, hr, h0, hq, ho, hl, he⟩ have hcpos : ¬ (s.2.1 2 ≤ s.2.1 12) := by rw [hc, h0] exact not_le.mpr (by positivity) cases right <;> generalize hh : logRegisterCode.run 7 s = t all_goals norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hcpos] at hh subst t constructor <;> norm_num [Function.update_apply, hc, hi, hz, ht, hs, hscalar, h1, h2, hr, h0, hq, ho, hl, he, Finset.sum_range_succ, Nat.cast_add, Nat.cast_mul] · ring · rw [show 2*(j+1)+1 = (2*j+1)+2 by omega, pow_add] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode_round · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:196
theorem logRegisterCode_exit

At zero count both branches return the prescribed sorted scalar endpoints. Under the stated assumptions.

Formal statement
right :
q j :
ℕ
z a l e :
ℚ
h :
LogRegisterInvariant right q j 0 z a l e s
S :
2*∑ i ∈ range j, ((z-1)/(z+1))^(2*i+1)/(2*i+1 : ℕ)
A :
if 0 < z then S-rationalError (q+3) else 0
B :
if 0 < z then S+rationalError (q+3) else 0
t :
logRegisterCode.run 14 s
t.1 = (if right then 114 else 57)
t.2.2 = false
t.2.1 0 = min A B
t.2.1 1 = max A B
t.2.1 16 = a
t.2.1 18 = l
t.2.1 20 = e
Proof (Lean source)
-- @node: logRegisterCode_exit lemma logRegisterCode_exit (right : Bool) (q j : ℕ) (z a l e : ℚ) (s : RationalState) (h : LogRegisterInvariant right q j 0 z a l e s) : let S := 2*∑ i ∈ range j, ((z-1)/(z+1))^(2*i+1)/(2*i+1 : ℕ) let A := if 0 < z then S-rationalError (q+3) else 0 let B := if 0 < z then S+rationalError (q+3) else 0 let t := logRegisterCode.run 14 s t.1 = (if right then 114 else 57) ∧ t.2.2 = false ∧ t.2.1 0 = min A B ∧ t.2.1 1 = max A B ∧ t.2.1 16 = a ∧ t.2.1 18 = l ∧ t.2.1 20 = e := by rcases h with ⟨hp, ha, hc, hi, hz, ht, hs, hscalar, h1, h2, hr, h0, hq, ho, hl, he⟩ have hnat : ((q : ℤ)+3).toNat = q+3 := by omega by_cases hzpos : 0 < z · have hzle : ¬ z ≤ 0 := not_le.mpr hzpos have hn : ¬ s.2.1 7 ≤ s.2.1 12 := by rw [hscalar, h0]; exact not_le.mpr hzpos cases right <;> norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, hs, hscalar, h1, h2, h0, hq, ho, hl, he, rationalError, ← Nat.cast_add, hnat, hn, hzpos, hzle] <;> ring <;> simp · have hzle : z ≤ 0 := le_of_not_gt hzpos have hn : s.2.1 7 ≤ s.2.1 12 := by rw [hscalar, h0]; exact le_of_not_gt hzpos cases right <;> norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, hs, hscalar, h1, h2, h0, hq, ho, hl, he, hn, hzpos, hzle]
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode_exit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:217
theorem logRegisterCode_loop

The fixed term loop exhausts its counter before the scalar exit. Under the stated assumptions.

Formal statement
right :
q j N :
ℕ
z a l e :
ℚ
h :
LogRegisterInvariant right q j N z a l e s
S :
2*∑ i ∈ range (j+N), ((z-1)/(z+1))^(2*i+1)/(2*i+1 : ℕ)
A :
if 0 < z then S-rationalError (q+3) else 0
B :
if 0 < z then S+rationalError (q+3) else 0
t :
logRegisterCode.run (7*N+14) s
t.1 = (if right then 114 else 57)
t.2.2 = false
t.2.1 0 = min A B
t.2.1 1 = max A B
t.2.1 16 = a
t.2.1 18 = l
t.2.1 20 = e
Proof (Lean source)
-- @node: logRegisterCode_loop lemma logRegisterCode_loop (right : Bool) (q j N : ℕ) (z a l e : ℚ) (s : RationalState) (h : LogRegisterInvariant right q j N z a l e s) : let S := 2*∑ i ∈ range (j+N), ((z-1)/(z+1))^(2*i+1)/(2*i+1 : ℕ) let A := if 0 < z then S-rationalError (q+3) else 0 let B := if 0 < z then S+rationalError (q+3) else 0 let t := logRegisterCode.run (7*N+14) s t.1 = (if right then 114 else 57) ∧ t.2.2 = false ∧ t.2.1 0 = min A B ∧ t.2.1 1 = max A B ∧ t.2.1 16 = a ∧ t.2.1 18 = l ∧ t.2.1 20 = e := by induction N generalizing j s with | zero => simpa using logRegisterCode_exit right q j z a l e s h | succ N ih => rw [show 7*(N+1)+14 = 7+(7*N+14) by omega, rationalProgram_run_add] simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (j+1) _ (logRegisterCode_round right q j N z a l e s h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode_loop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:244
theorem logRegisterCode_start

The initial frame saves the right endpoint before the left scalar loop. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
z :
xs[1]?.getD 0
LogRegisterInvariant false q 0 (logRangeBound z*(q+3+clog 2 (8*logRangeBound z)+2)) z (xs[0]?.getD 0) 0 (xs[2]?.getD 0) (logRegisterCode.run 28 (RationalProgram.initial xs))
Proof (Lean source)
-- @node: logRegisterCode_start lemma logRegisterCode_start (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let z := xs[1]?.getD 0 LogRegisterInvariant false q 0 (logRangeBound z*(q+3+clog 2 (8*logRangeBound z)+2)) z (xs[0]?.getD 0) 0 (xs[2]?.getD 0) (logRegisterCode.run 28 (RationalProgram.initial xs)) := by rw [show 28 = 3+25 by rfl, rationalProgram_run_add] have hp : (logRegisterCode.run 3 (RationalProgram.initial xs)).1 = 3 := by norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial] have ha : (logRegisterCode.run 3 (RationalProgram.initial xs)).2.2 = false := by norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial] have h := logRegisterCode_initial false _ hp ha convert h using 1 <;> norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode_start · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:262

The instruction bound includes two endpoint initializations, loops and exits.

Definition (Lean source)
xs :
List ℚ
logRegisterFuel xs :
ℕ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
count :
fun z => logRangeBound z*(q+3+clog 2 (8*logRangeBound z)+2)
86+7*(count (xs[1]?.getD 0)+count (xs[2]?.getD 0))
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:281
theorem logRegisterCode_result

Both endpoint loops return the literal endpoint extension on every rational list. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
lo :
(paperLogScalar q (xs[1]?.getD 0)).lo
hi :
(paperLogScalar q (xs[2]?.getD 0)).hi
t :
logRegisterCode.run (logRegisterFuel xs) (RationalProgram.initial xs)
t.2.2 = true
t.2.1 0 = lo
t.2.1 1 = hi
Proof (Lean source)
-- @node: logRegisterCode_result lemma logRegisterCode_result (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let lo := (paperLogScalar q (xs[1]?.getD 0)).lo let hi := (paperLogScalar q (xs[2]?.getD 0)).hi let t := logRegisterCode.run (logRegisterFuel xs) (RationalProgram.initial xs) t.2.2 = true ∧ t.2.1 0 = lo ∧ t.2.1 1 = hi := by let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let z := xs[1]?.getD 0 let w := xs[2]?.getD 0 let N := logRangeBound z*(q+3+clog 2 (8*logRangeBound z)+2) let M := logRangeBound w*(q+3+clog 2 (8*logRangeBound w)+2) have h := logRegisterCode_loop false q 0 N z _ 0 w _ (logRegisterCode_start xs) dsimp only [logRegisterFuel] have hf : 86+7*(N+M) = 28+(7*N+14)+(3+25)+(7*M+14)+2 := by omega rw [hf, rationalProgram_run_add _ (28+(7*N+14)+(3+25)+(7*M+14)) 2, rationalProgram_run_add _ (28+(7*N+14)+(3+25)) (7*M+14), rationalProgram_run_add _ (28+(7*N+14)) (3+25), rationalProgram_run_add _ 28 (7*N+14)] generalize hs : logRegisterCode.run (7*N+14) (logRegisterCode.run 28 (RationalProgram.initial xs)) = s at h ⊢ simp only [Bool.false_eq_true, ↓reduceIte, zero_add] at h rcases h with ⟨hp, ha, hlo, hhi, hq, hl, hw⟩ have hp' : (logRegisterCode.run 3 s).1 = 60 := by norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have ha' : (logRegisterCode.run 3 s).2.2 = false := by norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have hinit := logRegisterCode_initial true (logRegisterCode.run 3 s) hp' ha' have h0 : (logRegisterCode.run 3 s).2.1 0 = xs[0]?.getD 0 := by norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq] have h1 : (logRegisterCode.run 3 s).2.1 1 = w := by norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hw] have h18 : (logRegisterCode.run 3 s).2.1 18 = (paperLogScalar q z).lo := by norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hlo, paperLogScalar, rationalBox, logPolynomial, N] split <;> simp_all [RatInterval.point] simp only [h0, h1] at hinit have hright := logRegisterCode_loop true q 0 M w _ _ _ _ hinit rw [rationalProgram_run_add _ 3 25] generalize ht : logRegisterCode.run (7*M+14) (logRegisterCode.run 25 (logRegisterCode.run 3 s)) = t at hright ⊢ simp only [↓reduceIte, zero_add] at hright rcases hright with ⟨htp, hta, _, hthi, _, htl, _⟩ rw [h18] at htl norm_num [logRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hthi, htl, paperLogScalar, rationalBox, logPolynomial, M, q, z, w] split <;> simp_all [RatInterval.point]
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:288

A straight-line program computes the public count of both endpoint loops.

Definition (Lean source)
logRegisterFuelCode :
[.copy 20 2, .constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 7 1, .ceil 11 1, .div 13 8 1, .ceil 13 13, .max 11 11 13, .max 11 11 9, .constant 10 8, .mul 13 11 10, .clogTwo 13 13, .constant 10 5, .add 10 14 10, .add 10 10 13, .mul 2 11 10, .sub 4 1 8, .add 13 1 8, .div 4 4 13, .mul 10 4 4, .copy 5 4, .constant 6 0, .constant 3 1, .copy 21 2, .copy 1 20, .constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 7 1, .ceil 11 1, .div 13 8 1, .ceil 13 13, .max 11 11 13, .max 11 11 9, .constant 10 8, .mul 13 11 10, .clogTwo 13 13, .constant 10 5, .add 10 14 10, .add 10 10 13, .mul 2 11 10, .sub 4 1 8, .add 13 1 8, .div 4 4 13, .mul 10 4 4, .copy 5 4, .constant 6 0, .constant 3 1, .add 2 2 21, .constant 13 7, .mul 0 2 13, .constant 13 86, .add 0 0 13, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:340
theorem logRegisterFuel_public

The instruction count is itself a finite rational register computation. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: logRegisterFuel_public lemma logRegisterFuel_public : PublicIterationBound logRegisterFuel := by refine ⟨logRegisterFuelCode, ?_⟩ intro xs have hq : max (↑(⌊xs[0]?.getD 0⌋ : ℤ) : ℚ) 0 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊xs[0]?.getD 0⌋ : ℤ) 0 = (((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℕ) : ℤ) by omega) have hb (z : ℚ) : max (max (↑(⌈z⌉ : ℤ) : ℚ) (↑(⌈z⁻¹⌉ : ℤ) : ℚ)) 2 = (logRangeBound z : ℚ) := by simpa only [one_div] using logRegister_bound_cast z have hc (z : ℚ) : (⌊(logRangeBound z : ℚ)*8⌋ : ℤ).toNat = 8*logRangeBound z := by rw [show (logRangeBound z : ℚ)*8 = (8*logRangeBound z : ℕ) by push_cast; ring] norm_cast refine ⟨59, ?_, ?_⟩ · norm_num [logRegisterFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply] · norm_num [logRegisterFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, logRegisterFuel, Nat.cast_add, Nat.cast_mul, hq, hb, hc] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:405
theorem logRegisterCode_halts

The fixed public count halts the logarithm computation on every rational list. the stated conclusion holds.

Formal statement
xs :
List ℚ
(logRegisterCode.run (logRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true
Proof (Lean source)
-- @node: logRegisterCode_halts lemma logRegisterCode_halts (xs : List ℚ) : (logRegisterCode.run (logRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true := by exact (logRegisterCode_result xs).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterCode_halts · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:428

Certified finite rational register implementation of both logarithm endpoints.

Definition (Lean source)
logRegisterProgram :
clause 1
clause 2
iterationBound := logRegisterFuel
clause 3
public_bound := logRegisterFuel_public
clause 4
CausalSmith.Stat.LogoddsLowsmoothFrontier.logRegisterProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:434
theorem concreteEngine_log_register_certificate

The finite register result equals the prescribed logarithm endpoint extension. the stated conclusion holds.

Formal statement
q :
ℕ
concreteEngine.logBox q I
= let v := logRegisterProgram.eval [q, I.lo, I.hi]; rationalBox v.1 v.2
Proof (Lean source)
-- @node: concreteEngine_log_register_certificate lemma concreteEngine_log_register_certificate (q : ℕ) (I : RatInterval) : concreteEngine.logBox q I = let v := logRegisterProgram.eval [q, I.lo, I.hi]; rationalBox v.1 v.2 := by have h := logRegisterCode_result [(q : ℚ), I.lo, I.hi] simp only [List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] at h dsimp only [concreteEngine, endpointExtension, BoundedRationalProgram.eval, logRegisterProgram] rw [h.2.1, h.2.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_log_register_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LogProgram.lean:442
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.LowerRankRates 3 declarations One rank estimate applies with s = α + β to the mixed priors and s = 2β to the fair priors.

Ceiling ranks for the mixed and fair lower rates

One rank estimate applies with s = α + β to the mixed priors and s = 2β to the fair priors. It controls occupancy and the Hellinger budget and retains a uniform lower bound on the amplitude separation.

theorem lower_rank_ceiling_bounds Lemma lower_rank_ceiling_bounds in the paper ↗

Ceiling selection has the roadmap's two-sided rank bounds. Under the stated assumptions.

Formal statement
L s :
ℝ
hL :
1 ≤ L
hs :
0 < s
n :
ℕ
hn :
1 ≤ n
∃ k : ℕ,
conclusion 1
1 ≤ k
conclusion 2
L*(n : ℝ)^(2/(2*s+1)) ≤ k
conclusion 3
(k : ℝ) ≤ (L+1)*(n : ℝ)^(2/(2*s+1))
Proof (Lean source)
-- @node: lower_rank_ceiling_bounds lemma lower_rank_ceiling_bounds (L s : ℝ) (hL : 1 ≤ L) (hs : 0 < s) (n : ℕ) (hn : 1 ≤ n) : ∃ k : ℕ, 1 ≤ k ∧ L*(n : ℝ)^(2/(2*s+1)) ≤ k ∧ (k : ℝ) ≤ (L+1)*(n : ℝ)^(2/(2*s+1)) := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn have hn0 : (0 : ℝ) < n := lt_of_lt_of_le zero_lt_one hn1 have hp : 0 < (n : ℝ)^(2/(2*s+1)) := Real.rpow_pos_of_pos hn0 _ have hp1 : 1 ≤ (n : ℝ)^(2/(2*s+1)) := Real.one_le_rpow hn1 (by positivity) let k := ⌈L*(n : ℝ)^(2/(2*s+1))⌉₊ refine ⟨k, (Nat.one_le_ceil_iff).2 (mul_pos (by linarith) hp), Nat.le_ceil _, ?_⟩ have hceil := Nat.ceil_lt_add_one (show 0 ≤ L*(n : ℝ)^(2/(2*s+1)) by positivity) dsimp only [k] nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.lower_rank_ceiling_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LowerRankRates.lean:15

[A rank above L times the target controls both occupancy and the balanced power budget. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
L s :
ℝ
hL :
1 ≤ L
hs :
0 < s
hsu :
s ≤ 1/2
n k :
ℕ
hn :
1 ≤ n
hk :
1 ≤ k
hkl :
L*(n : ℝ)^(2/(2*s+1)) ≤ k
conclusion 1
(n : ℝ)/(k : ℝ) ≤ 1/L
conclusion 2
(n : ℝ)^2*(k : ℝ)^(-(2*s+1)) ≤ 1/L
Proof (Lean source)
-- @node: lower_rank_budget lemma lower_rank_budget (L s : ℝ) (hL : 1 ≤ L) (hs : 0 < s) (hsu : s ≤ 1/2) (n k : ℕ) (hn : 1 ≤ n) (hk : 1 ≤ k) (hkl : L*(n : ℝ)^(2/(2*s+1)) ≤ k) : (n : ℝ)/(k : ℝ) ≤ 1/L ∧ (n : ℝ)^2*(k : ℝ)^(-(2*s+1)) ≤ 1/L := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn have hn0 : (0 : ℝ) < n := lt_of_lt_of_le zero_lt_one hn1 have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hL0 : 0 < L := by linarith have hd : 0 < 2*s+1 := by linarith have hp : 1 ≤ 2/(2*s+1) := (le_div_iff₀ hd).2 (by linarith) have hnp : (n : ℝ) ≤ (n : ℝ)^(2/(2*s+1)) := by simpa only [Real.rpow_one] using Real.rpow_le_rpow_of_exponent_le hn1 hp have hLn : L*(n : ℝ) ≤ k := (mul_le_mul_of_nonneg_left hnp hL0.le).trans hkl constructor · apply (div_le_iff₀ hk0).2 rw [one_div, inv_mul_eq_div] apply (le_div_iff₀ hL0).2 simpa only [mul_comm] using hLn · have hLpow : L ≤ L^(2*s+1) := by simpa only [Real.rpow_one] using Real.rpow_le_rpow_of_exponent_le hL (by linarith : (1 : ℝ) ≤ 2*s+1) have hpower : (L*(n : ℝ)^(2/(2*s+1)))^(2*s+1) = L^(2*s+1)*(n : ℝ)^2 := by rw [Real.mul_rpow hL0.le (by positivity), ← Real.rpow_mul hn0.le] have he : 2/(2*s+1)*(2*s+1) = 2 := by field_simp rw [he, Real.rpow_two] have hden : L*(n : ℝ)^2 ≤ (k : ℝ)^(2*s+1) := by calc _ ≤ L^(2*s+1)*(n : ℝ)^2 := mul_le_mul_of_nonneg_right hLpow (sq_nonneg _) _ = _ := hpower.symm _ ≤ _ := Real.rpow_le_rpow (by positivity) hkl hd.le rw [Real.rpow_neg hk0.le, ← div_eq_mul_inv] apply (div_le_iff₀ (Real.rpow_pos_of_pos hk0 _)).2 rw [one_div, inv_mul_eq_div] apply (le_div_iff₀ hL0).2 simpa only [mul_comm] using hden
CausalSmith.Stat.LogoddsLowsmoothFrontier.lower_rank_budget · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LowerRankRates.lean:32

[The ceiling costs a fixed square-root factor, uniformly over the entire rough numerator regime and over the fair exponent s = 2β. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
L s :
ℝ
hL :
1 ≤ L
hs :
0 < s
hsu :
s ≤ 1/2
n k :
ℕ
hn :
1 ≤ n
hk :
1 ≤ k
hku :
(k : ℝ) ≤ (L+1)*(n : ℝ)^(2/(2*s+1))
(L+1)^(-(1/2 : ℝ))*(n : ℝ)^(-(2*s/(2*s+1))) ≤ (k : ℝ)^(-s)
Proof (Lean source)
-- @node: lower_rank_separation lemma lower_rank_separation (L s : ℝ) (hL : 1 ≤ L) (hs : 0 < s) (hsu : s ≤ 1/2) (n k : ℕ) (hn : 1 ≤ n) (hk : 1 ≤ k) (hku : (k : ℝ) ≤ (L+1)*(n : ℝ)^(2/(2*s+1))) : (L+1)^(-(1/2 : ℝ))*(n : ℝ)^(-(2*s/(2*s+1))) ≤ (k : ℝ)^(-s) := by have hn0 : (0 : ℝ) < n := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hn) have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hL0 : 0 < L+1 := by linarith have hcoef : (L+1)^(-(1/2 : ℝ)) ≤ (L+1)^(-s) := Real.rpow_le_rpow_of_exponent_le (by linarith) (by linarith) have he : ((L+1)*(n : ℝ)^(2/(2*s+1)))^(-s) = (L+1)^(-s)*(n : ℝ)^(-(2*s/(2*s+1))) := by rw [Real.mul_rpow hL0.le (by positivity), ← Real.rpow_mul hn0.le] congr 2 ring calc _ ≤ (L+1)^(-s)*(n : ℝ)^(-(2*s/(2*s+1))) := mul_le_mul_of_nonneg_right hcoef (by positivity) _ = _ := he.symm _ ≤ _ := Real.rpow_le_rpow_of_nonpos hk0 hku (by linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.lower_rank_separation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/LowerRankRates.lean:75
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MachinEnclosure 6 declarations Integration of the finite geometric identity bounds the two arctangent remainders.

The prescribed finite Machin enclosure

Integration of the finite geometric identity bounds the two arctangent remainders. Machin's identity and the public truncation count certify the rational pi box.

theorem machin_geometric_identity Lemma machin_geometric_identity in the paper ↗

Finite geometric cancellation leaves precisely the omitted arctangent term. Under the stated assumptions.

Formal statement
N :
ℕ
x :
ℝ
(1+x^2) * (∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j)) = 1-(-1 : ℝ)^N*x^(2*N)
Proof (Lean source)
-- @node: machin_geometric_identity lemma machin_geometric_identity (N : ℕ) (x : ℝ) : (1+x^2) * (∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j)) = 1-(-1 : ℝ)^N*x^(2*N) := by induction N with | zero => simp | succ N ih => rw [Finset.sum_range_succ, mul_add, ih] simp only [pow_succ, Nat.mul_succ] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.machin_geometric_identity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MachinEnclosure.lean:18
theorem arctanPolynomial_integral Lemma arctanPolynomial_integral in the paper ↗

[Integrating the finite geometric polynomial gives the literal rational polynomial. the stated conclusion holds.

Formal statement
N :
ℕ
v :
ℚ
(arctanPolynomial N v : ℝ)
= ∫ x in (0 : ℝ)..(v : ℝ), ∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j)
Proof (Lean source)
-- @node: arctanPolynomial_integral lemma arctanPolynomial_integral (N : ℕ) (v : ℚ) : (arctanPolynomial N v : ℝ) = ∫ x in (0 : ℝ)..(v : ℝ), ∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j) := by rw [intervalIntegral.integral_finsetSum] · simp only [arctanPolynomial, Rat.cast_sum, Rat.cast_div, Rat.cast_mul, Rat.cast_pow, Rat.cast_neg, Rat.cast_one, Rat.cast_natCast, intervalIntegral.integral_const_mul, integral_pow, zero_pow (by omega : 2*_+1 ≠ 0), sub_zero, Nat.cast_add, Nat.cast_one, Rat.cast_add, Rat.cast_one, mul_div_assoc] · intro j hj exact (by fun_prop : Continuous (fun x : ℝ => (-1 : ℝ)^j*x^(2*j))).intervalIntegrable _ _
CausalSmith.Stat.LogoddsLowsmoothFrontier.arctanPolynomial_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MachinEnclosure.lean:30

The integrated geometric remainder is bounded uniformly on a positive argument interval. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
N :
ℕ
v :
ℚ
hv :
0 ≤ v
|arctan (v : ℝ)-(arctanPolynomial N v : ℝ)| ≤ (v : ℝ)^(2*N+1)
Proof (Lean source)
-- @node: arctanPolynomial_error lemma arctanPolynomial_error (N : ℕ) (v : ℚ) (hv : 0 ≤ v) : |arctan (v : ℝ)-(arctanPolynomial N v : ℝ)| ≤ (v : ℝ)^(2*N+1) := by have hvR : (0 : ℝ) ≤ v := by exact_mod_cast hv have hgeom (x : ℝ) : 1/(1+x^2)-(∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j)) = (-1 : ℝ)^N*x^(2*N)/(1+x^2) := by have h := machin_geometric_identity N x have hp : 1+x^2 ≠ 0 := by positivity field_simp nlinarith [h] have hi : (∫ x in (0 : ℝ)..(v : ℝ), 1/(1+x^2)-(∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j))) = arctan (v : ℝ)-(arctanPolynomial N v : ℝ) := by rw [intervalIntegral.integral_sub, integral_one_div_one_add_sq, Real.arctan_zero, sub_zero, ← arctanPolynomial_integral] · exact (by have hn (x : ℝ) : 1+x^2 ≠ 0 := by positivity fun_prop : Continuous (fun x : ℝ => 1/(1+x^2))).intervalIntegrable _ _ · exact (by fun_prop : Continuous (fun x : ℝ => ∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j))).intervalIntegrable _ _ have hb := intervalIntegral.norm_integral_le_of_norm_le_const (a := (0 : ℝ)) (b := (v : ℝ)) (C := (v : ℝ)^(2*N)) (f := fun x => 1/(1+x^2)-(∑ j ∈ range N, (-1 : ℝ)^j*x^(2*j))) (by intro x hx rw [Set.uIoc_of_le hvR] at hx rw [hgeom, Real.norm_eq_abs, abs_div, abs_mul, abs_pow] simp only [abs_neg, abs_one, one_pow, one_mul, abs_of_nonneg (by positivity : 0 ≤ 1+x^2)] rw [abs_of_nonneg (pow_nonneg hx.1.le _)] apply (div_le_iff₀ (by positivity)).mpr have hp := pow_le_pow_left₀ hx.1.le hx.2 (2*N) nlinarith [sq_nonneg x, pow_nonneg hvR (2*N)]) rw [hi, Real.norm_eq_abs, sub_zero, abs_of_nonneg hvR] at hb simpa only [pow_succ, mul_comm] using hb
CausalSmith.Stat.LogoddsLowsmoothFrontier.arctanPolynomial_error · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MachinEnclosure.lean:43
theorem machin_truncation_bound Lemma machin_truncation_bound in the paper ↗

The fixed public term count controls the sum of both weighted remainders. the stated conclusion holds.

Formal statement
q :
ℕ
20*(1/5 : ℝ)^(2*(q+7)+1) ≤ 1/(2 : ℝ)^(q+3)
Proof (Lean source)
-- @node: machin_truncation_bound lemma machin_truncation_bound (q : ℕ) : 20*(1/5 : ℝ)^(2*(q+7)+1) ≤ 1/(2 : ℝ)^(q+3) := by induction q with | zero => norm_num | succ q ih => have he : 2*(q+1+7)+1 = (2*(q+7)+1)+2 := by omega rw [he, pow_add, show q+1+3 = (q+3)+1 by omega, show (2 : ℝ)^((q+3)+1) = 2^(q+3)*2 from pow_succ _ _] norm_num only [show (1/5 : ℝ)^2 = 1/25 by norm_num] have hp : 0 ≤ (1/5 : ℝ)^(2*(q+7)+1) := by positivity have ht : 0 < (2 : ℝ)^(q+3) := by positivity rw [div_mul_eq_div_div] norm_num only [one_div] at ih ⊢ nlinarith [inv_pos.mpr ht]
CausalSmith.Stat.LogoddsLowsmoothFrontier.machin_truncation_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MachinEnclosure.lean:81

Machin's identity bounds the literal rational approximation at every precision. the stated conclusion holds.

Formal statement
q :
ℕ
|pi - ((16*arctanPolynomial (q+7) (1/5)- 4*arctanPolynomial (q+7) (1/239) : ℚ) : ℝ)|
≤ (rationalError (q+3) : ℝ)
Proof (Lean source)
-- @node: paperPi_approximation lemma paperPi_approximation (q : ℕ) : |pi - ((16*arctanPolynomial (q+7) (1/5)- 4*arctanPolynomial (q+7) (1/239) : ℚ) : ℝ)| ≤ (rationalError (q+3) : ℝ) := by have h5 := arctanPolynomial_error (q+7) (1/5) (by norm_num) have h239 := arctanPolynomial_error (q+7) (1/239) (by norm_num) have hm := Real.four_mul_arctan_inv_5_sub_arctan_inv_239 have hp : (1/239 : ℝ)^(2*(q+7)+1) ≤ (1/5 : ℝ)^(2*(q+7)+1) := pow_le_pow_left₀ (by norm_num) (by norm_num) _ have htriangle := abs_add_le (16*(arctan (1/5)-(arctanPolynomial (q+7) (1/5) : ℝ))) (-(4*(arctan (1/239)-(arctanPolynomial (q+7) (1/239) : ℝ)))) simp only [abs_neg, ← sub_eq_add_neg] at htriangle norm_num only [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 16), abs_of_pos (by norm_num : (0 : ℝ) < 4)] at htriangle have he : pi - ((16*arctanPolynomial (q+7) (1/5)- 4*arctanPolynomial (q+7) (1/239) : ℚ) : ℝ) = 16*(arctan (1/5)-(arctanPolynomial (q+7) (1/5) : ℝ))- 4*(arctan (1/239)-(arctanPolynomial (q+7) (1/239) : ℝ)) := by push_cast simp only [one_div] at * linarith [hm] rw [he] have hb := machin_truncation_bound q simp only [rationalError, Rat.cast_div, Rat.cast_one, Rat.cast_pow, Rat.cast_ofNat] push_cast at h5 h239 linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperPi_approximation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MachinEnclosure.lean:98

Clipping the certified Machin approximation preserves containment and both excess bounds. the stated conclusion holds.

Formal statement
q :
ℕ
conclusion 1
(paperPi q).Contains pi
conclusion 2
3 ≤ (paperPi q).lo
conclusion 3
(paperPi q).hi ≤ 4
conclusion 4
conclusion 5
Proof (Lean source)
-- @node: paperPi_contract lemma paperPi_contract (q : ℕ) : (paperPi q).Contains pi ∧ 3 ≤ (paperPi q).lo ∧ (paperPi q).hi ≤ 4 ∧ pi-(paperPi q).lo ≤ precisionError q ∧ (paperPi q).hi-pi ≤ precisionError q := by let S : ℚ := 16*arctanPolynomial (q+7) (1/5)-4*arctanPolynomial (q+7) (1/239) let e : ℚ := rationalError (q+3) have happrox : |pi-(S : ℝ)| ≤ (e : ℝ) := paperPi_approximation q obtain ⟨hminus, hplus⟩ := abs_le.mp happrox have hlo : ((max 3 (S-e) : ℚ) : ℝ) ≤ pi := by push_cast exact max_le Real.pi_gt_three.le (by linarith) have hhi : pi ≤ ((min 4 (S+e) : ℚ) : ℝ) := by push_cast exact le_min Real.pi_lt_four.le (by linarith) have hord : max 3 (S-e) ≤ min 4 (S+e) := by exact_mod_cast hlo.trans hhi have herr : 2*(e : ℝ) ≤ precisionError q := by change 2*(rationalError (q+3) : ℝ) ≤ precisionError q simp only [rationalError, Rat.cast_div, Rat.cast_one, Rat.cast_pow, Rat.cast_ofNat, precisionError, zpow_neg, zpow_natCast] rw [pow_add] norm_num have hp : 0 < (2 : ℝ)^q := by positivity field_simp nlinarith have hbox : paperPi q = rationalBox (max 3 (S-e)) (min 4 (S+e)) := rfl rw [hbox] simp only [rationalBox, min_eq_left hord, max_eq_right hord, RatInterval.Contains] refine ⟨⟨hlo, hhi⟩, le_max_left _ _, min_le_left _ _, ?_, ?_⟩ · have hl : ((S-e : ℚ) : ℝ) ≤ ((max 3 (S-e) : ℚ) : ℝ) := by exact_mod_cast le_max_right (3 : ℚ) (S-e) push_cast at hl ⊢ linarith · have hu : ((min 4 (S+e) : ℚ) : ℝ) ≤ ((S+e : ℚ) : ℝ) := by exact_mod_cast min_le_right (4 : ℚ) (S+e) push_cast at hu ⊢ linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperPi_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MachinEnclosure.lean:127
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedAlternativePrognosisLinear 5 declarations The smooth control-logit map is locally Lipschitz on a fixed interior box.

Alternative mixed prognosis spatial bounds

The smooth control-logit map is locally Lipschitz on a fixed interior box. The spatial moduli of the calibrated margins then preserve the prognosis amplitude.

theorem mixedControlLogit_contDiffAt_center Lemma mixedControlLogit_contDiffAt_center in the paper ↗

[The control logit is smooth at the independent central table. the stated conclusion holds.

Formal statement
ContDiffAt ℝ 1 (fun v : Fin 3 → ℝ => logit (v 2-covarianceBranch (v 0) (v 1) (v 2)/(1-v 1))) ![0,1/2,1/2]
Proof (Lean source)
-- @node: mixedControlLogit_contDiffAt_center lemma mixedControlLogit_contDiffAt_center : ContDiffAt ℝ 1 (fun v : Fin 3 → ℝ => logit (v 2-covarianceBranch (v 0) (v 1) (v 2)/(1-v 1))) ![0,1/2,1/2] := by have hc := covarianceBranch_contDiffAt_center.of_le (show (1 : WithTop ℕ∞) ≤ ⊤ by simp) have hr : ContDiffAt ℝ 1 (fun v : Fin 3 → ℝ => v 2-covarianceBranch (v 0) (v 1) (v 2)/(1-v 1)) ![0,1/2,1/2] := by apply ContDiffAt.sub · fun_prop · exact hc.div (by fun_prop) (by norm_num) unfold logit apply ContDiffAt.log · exact hr.div (contDiffAt_const.sub hr) (by change 1-(1/2-covarianceBranch 0 (1/2) (1/2)/(1-1/2)) ≠ (0 : ℝ); norm_num [covarianceBranch]) · change (1/2-covarianceBranch 0 (1/2) (1/2)/(1-1/2))/(1-(1/2-covarianceBranch 0 (1/2) (1/2)/(1-1/2))) ≠ (0 : ℝ) norm_num [covarianceBranch]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedControlLogit_contDiffAt_center · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedAlternativePrognosisLinear.lean:19
theorem mixedControlLogit_uniform_lipschitz Lemma mixedControlLogit_uniform_lipschitz in the paper ↗

A fixed signed interior box has one finite control-logit Lipschitz constant. the stated conclusion holds.

Formal statement
∃ r C : ℝ,
0 < r
0 < C
conclusion 1
t ex ez mx mz :
ℝ
|t| ≤ r
|ex-1/2| ≤ r
|ez-1/2| ≤ r
|mx-1/2| ≤ r
|mz-1/2| ≤ r
|logit (mx-covarianceBranch t ex mx/(1-ex))- logit (mz-covarianceBranch t ez mz/(1-ez))|
≤ C*(|ex-ez|+|mx-mz|)
Proof (Lean source)
-- @node: mixedControlLogit_uniform_lipschitz lemma mixedControlLogit_uniform_lipschitz : ∃ r C : ℝ, 0 < r ∧ 0 < C ∧ ∀ t ex ez mx mz : ℝ, |t| ≤ r → |ex-1/2| ≤ r → |ez-1/2| ≤ r → |mx-1/2| ≤ r → |mz-1/2| ≤ r → |logit (mx-covarianceBranch t ex mx/(1-ex))- logit (mz-covarianceBranch t ez mz/(1-ez))| ≤ C*(|ex-ez|+|mx-mz|) := by obtain ⟨K,S,hS,hLip⟩ := mixedControlLogit_contDiffAt_center.exists_lipschitzOnWith obtain ⟨d,hd,hball⟩ := Metric.mem_nhds_iff.mp hS refine ⟨d/2,(K : ℝ)+1,by linarith,by positivity,?_⟩ intro t ex ez mx mz ht hex hez hmx hmz have hmem (e m : ℝ) (he : |e-1/2| ≤ d/2) (hm : |m-1/2| ≤ d/2) : ![t,e,m] ∈ S := by apply hball rw [Metric.mem_ball, dist_pi_lt_iff hd] intro i fin_cases i · change dist t 0 < d rw [Real.dist_eq, sub_zero]; linarith · change dist e (1/2) < d rw [Real.dist_eq]; linarith · change dist m (1/2) < d rw [Real.dist_eq]; linarith have hh := hLip.dist_le_mul _ (hmem ex mx hex hmx) _ (hmem ez mz hez hmz) have hv : dist (![t,ex,mx] : Fin 3 → ℝ) ![t,ez,mz] ≤ |ex-ez|+|mx-mz| := by apply (dist_pi_le_iff (by positivity)).mpr intro i fin_cases i <;> simp [Real.dist_eq] <;> positivity have hh' := mul_le_mul_of_nonneg_left hv K.coe_nonneg simp only [Real.dist_eq] at hh change |logit (mx-covarianceBranch t ex mx/(1-ex))- logit (mz-covarianceBranch t ez mz/(1-ez))| ≤ _ at hh nlinarith [abs_nonneg (ex-ez),abs_nonneg (mx-mz)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedControlLogit_uniform_lipschitz · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedAlternativePrognosisLinear.lean:36
theorem mixedCells_alternative_control_risk_eq Lemma mixedCells_alternative_control_risk_eq in the paper ↗

The actual alternative control risk uses the smooth calibrated margin map. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hv :
x :
e :
1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x
m :
1/2+ζ*signFieldZ k σ x
armRisk (mixedLaw true k σ η ζ) false x = m-covarianceBranch (32*η*ζ) e m/(1-e)
Proof (Lean source)
-- @node: mixedCells_alternative_control_risk_eq lemma mixedCells_alternative_control_risk_eq (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hv : ValidCells (mixedCells true k σ η ζ)) (x : Covariate) : let e := 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x let m := 1/2+ζ*signFieldZ k σ x armRisk (mixedLaw true k σ η ζ) false x = m-covarianceBranch (32*η*ζ) e m/(1-e) := by have he := (abs_le.mp (mixed_margin_bounds true k σ η ζ x hη hζ).1).2 simp only [if_true] at he rw [armRisk, mixedLaw, totalCellLaw_cells_of_valid _ hv] dsimp only change tableCell _ _ _ false true / (tableCell _ _ _ false false + tableCell _ _ _ false true) = _ exact mixed_table_control_risk_eq _ _ _ (by simp only [if_true]; linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_alternative_control_risk_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedAlternativePrognosisLinear.lean:72
theorem mixedCells_alternative_prognosis_linear_of_root Lemma mixedCells_alternative_prognosis_linear_of_root in the paper ↗

[Fixed local Lipschitz and root derivative bounds yield the alternative prognosis spatial modulus with its amplitude factor intact. the documented result Under the stated assumptions.

Formal statement
r C B :
ℝ
hC :
0 ≤ C
hB :
0 ≤ B
hLip :
∀ t ex ez mx mz : ℝ
if
|t| ≤ r
and
|ex-1/2| ≤ r
and
|ez-1/2| ≤ r
and
|mx-1/2| ≤ r
and
|mz-1/2| ≤ r
then
|logit (mx-covarianceBranch t ex mx/(1-ex))- logit (mz-covarianceBranch t ez mz/(1-ez))|
≤ C*(|ex-ez|+|mx-mz|)
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
horder :
|η| ≤ |ζ|
ht :
|32*η*ζ| ≤ r
he :
(5/2)*|η| ≤ r
hm :
2*|ζ| ≤ r
hd :
∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u
hb :
∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B
x z :
|prognosisLogit (mixedLaw true k σ η ζ) x- prognosisLogit (mixedLaw true k σ η ζ) z|
≤ C*(9+2*B)*|ζ| *(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedCells_alternative_prognosis_linear_of_root lemma mixedCells_alternative_prognosis_linear_of_root (r C B : ℝ) (hC : 0 ≤ C) (hB : 0 ≤ B) (hLip : ∀ t ex ez mx mz : ℝ, |t| ≤ r → |ex-1/2| ≤ r → |ez-1/2| ≤ r → |mx-1/2| ≤ r → |mz-1/2| ≤ r → |logit (mx-covarianceBranch t ex mx/(1-ex))- logit (mz-covarianceBranch t ez mz/(1-ez))| ≤ C*(|ex-ez|+|mx-mz|)) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (horder : |η| ≤ |ζ|) (ht : |32*η*ζ| ≤ r) (he : (5/2)*|η| ≤ r) (hm : 2*|ζ| ≤ r) (hd : ∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u) (hb : ∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B) (x z : Covariate) : |prognosisLogit (mixedLaw true k σ η ζ) x- prognosisLogit (mixedLaw true k σ η ζ) z| ≤ C*(9+2*B)*|ζ| *(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by classical by_cases hv : ValidCells (mixedCells true k σ η ζ) · let e := fun w : Covariate => 1/2-η*mixedRoot η ζ (cellCoord k w)*signFieldZ k σ w let m := fun w : Covariate => 1/2+ζ*signFieldZ k σ w have hew (w : Covariate) : |e w-1/2| ≤ r := (mixed_margin_displacement true k σ η ζ w).trans he have hmw (w : Covariate) : |m w-1/2| ≤ r := by dsimp [m] rw [add_sub_cancel_left,abs_mul] exact (mul_le_mul_of_nonneg_left (signFieldZ_abs_le_two k σ w) (abs_nonneg ζ)).trans (by nlinarith) have hl := hLip (32*η*ζ) (e x) (e z) (m x) (m z) ht (hew x) (hew z) (hmw x) (hmw z) have hel : |e x-e z| ≤ |η| *(5+2*B)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by dsimp [e] rw [show 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x- (1/2-η*mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z) = -η*(mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x- mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z) by ring,abs_mul,abs_neg] have hh := mul_le_mul_of_nonneg_left (mixedRoot_signField_lipschitz k hk σ η ζ B hB hd hb x z) (abs_nonneg η) nlinarith only [hh] have hml : |m x-m z| ≤ 4*|ζ| *(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by dsimp [m] rw [show 1/2+ζ*signFieldZ k σ x-(1/2+ζ*signFieldZ k σ z) = ζ*(signFieldZ k σ x-signFieldZ k σ z) by ring,abs_mul] have hh := mul_le_mul_of_nonneg_left (signFieldZ_lipschitz k hk σ x z) (abs_nonneg ζ) nlinarith only [hh] have heorder := mul_le_mul_of_nonneg_right horder (show 0 ≤ (5+2*B)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| by positivity) have hsum : |e x-e z|+|m x-m z| ≤ (9+2*B)*|ζ| *(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by nlinarith only [hel,hml,heorder] change |logit (armRisk _ false x)-logit (armRisk _ false z)| ≤ _ rw [mixedCells_alternative_control_risk_eq k σ η ζ hη hζ hv x, mixedCells_alternative_control_risk_eq k σ η ζ hη hζ hv z] exact hl.trans (by nlinarith only [mul_le_mul_of_nonneg_left hsum hC]) · have hz : ∀ w, prognosisLogit (mixedLaw true k σ η ζ) w = 0 := by intro w norm_num [prognosisLogit,armRisk,mixedLaw,totalCellLaw,hv,lawFromCells,logit] rw [hz x,hz z,sub_self,abs_zero] positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_alternative_prognosis_linear_of_root · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedAlternativePrognosisLinear.lean:87
theorem mixedCells_uniform_alternative_prognosis_linear

One positive radius fits the alternative prognosis modulus to the public rate for every legal exponent pair, including the Lipschitz endpoint. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
∃ r : ℝ,
0 < r
r ≤ 1/100
conclusion 1
ε :
ℝ
0 < ε
ε ≤ r
α β :
ℝ
k :
ℕ
1 ≤ k
σ :
Fin (k+1) → Bool
x z :
|prognosisLogit (mixedLaw true k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- prognosisLogit (mixedLaw true k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z|
≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedCells_uniform_alternative_prognosis_linear lemma mixedCells_uniform_alternative_prognosis_linear : ∃ r : ℝ, 0 < r ∧ r ≤ 1/100 ∧ ∀ ε : ℝ, 0 < ε → ε ≤ r → ∀ α β : ℝ, ExponentDomain α β → ∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k+1) → Bool, ∀ x z, |prognosisLogit (mixedLaw true k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- prognosisLogit (mixedLaw true k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z| ≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)| := by obtain ⟨d,C,hd,hC,hLip⟩ := mixedControlLogit_uniform_lipschitz obtain ⟨a,ha,hs,hbounds⟩ := mixedRoot_uniform_smooth_derivative_bounds obtain ⟨B,hB,hb⟩ := hbounds 1 let r := min a (min (1/100) (min (d/3) (1/(C*(9+2*B))))) have hr : 0 < r := lt_min ha (lt_min (by norm_num) (lt_min (by positivity) (by positivity))) have hra : r ≤ a := min_le_left _ _ have hrsmall : r ≤ 1/100 := (min_le_right _ _).trans (min_le_left _ _) have hrd : r ≤ d/3 := (min_le_right _ _).trans ((min_le_right _ _).trans (min_le_left _ _)) have hrcoef : C*(9+2*B)*r ≤ 1 := by have hh : r ≤ 1/(C*(9+2*B)) := (min_le_right _ _).trans ((min_le_right _ _).trans (min_le_right _ _)) have hh' := (le_div_iff₀ (show 0 < C*(9+2*B) by positivity)).mp hh nlinarith only [hh'] refine ⟨r,hr,hrsmall,?_⟩ intro ε hε hεr α β hab k hk σ x z let η := ε*(k : ℝ)^(-α) let ζ := ε*(k : ℝ)^(-β) have hα : 0 ≤ α := (hab.1.trans hab.2.2.1).le have hβ : 0 ≤ β := hab.1.le have hη : |η| ≤ r := (calibrated_amplitude_abs_le ε α hε.le hα k hk).trans hεr have hζ : |ζ| ≤ r := (calibrated_amplitude_abs_le ε β hε.le hβ k hk).trans hεr have hηpos : 0 ≤ η := by dsimp [η]; positivity have hζpos : 0 ≤ ζ := by dsimp [ζ]; positivity have hkpos : 0 < (k : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have horder : |η| ≤ |ζ| := by rw [abs_of_nonneg hηpos,abs_of_nonneg hζpos] exact mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hk) (neg_le_neg hab.2.2.1.le)) hε.le have ht : |32*η*ζ| ≤ d := by rw [abs_mul,abs_mul,abs_of_pos (by norm_num : (0 : ℝ) < 32)] have hh := mul_le_mul_of_nonneg_right (hη.trans hrsmall) (abs_nonneg ζ) nlinarith only [hh,hζ,hrd,hd] have he : (5/2)*|η| ≤ d := by linarith have hm : 2*|ζ| ≤ d := by linarith have hroot (u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) := mixedRoot_spatial_derivative_bound η ζ u B (hs ![η,ζ,u] (hη.trans hra) (hζ.trans hra) hu) (hb ![η,ζ,u] (hη.trans hra) (hζ.trans hra) hu) have hl := mixedCells_alternative_prognosis_linear_of_root d C B hC.le hB.le hLip k hk σ η ζ (hη.trans hrsmall) (hζ.trans hrsmall) horder ht he hm (fun u hu => (hroot u hu).1) (fun u hu => (hroot u hu).2) x z have heps : C*(9+2*B)*ε ≤ 1 := (mul_le_mul_of_nonneg_left hεr (by positivity)).trans hrcoef have hrate : (k : ℝ)^(1-β) = (k : ℝ)^(-β)*(k : ℝ) := by rw [show 1-β = -β+1 by ring,Real.rpow_add hkpos,Real.rpow_one] rw [abs_of_nonneg hζpos] at hl have hh := mul_le_mul_of_nonneg_right heps (Real.rpow_nonneg hkpos.le (-β)) have hh' := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hh hkpos.le) (abs_nonneg ((x : ℝ)-(z : ℝ))) rw [hrate] dsimp [ζ] at hl nlinarith only [hl,hh']
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_uniform_alternative_prognosis_linear · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedAlternativePrognosisLinear.lean:146
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedCellSmoothness 5 declarations The literal selected root is substituted before differentiating the cells.

Smooth actual mixed cells

The literal selected root is substituted before differentiating the cells. Positive radicands at zero amplitudes, smooth composition, and compactness give one signed neighborhood and bounds for every fixed derivative order.

theorem covarianceBranch_contDiffAt_center Lemma covarianceBranch_contDiffAt_center in the paper ↗

The covariance formula is smooth at zero effect and central margins. the stated conclusion holds.

Formal statement
ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => covarianceBranch (v 0) (v 1) (v 2)) ![0,1/2,1/2]
Proof (Lean source)
-- @node: covarianceBranch_contDiffAt_center lemma covarianceBranch_contDiffAt_center : ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => covarianceBranch (v 0) (v 1) (v 2)) ![0,1/2,1/2] := by unfold covarianceBranch dsimp only apply ContDiffAt.div · fun_prop · apply ContDiffAt.add · fun_prop · apply ContDiffAt.sqrt · fun_prop · norm_num · norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_contDiffAt_center · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCellSmoothness.lean:17
theorem localMixedCell_contDiffAt_zero Lemma localMixedCell_contDiffAt_zero in the paper ↗

With the actual root substituted, every mixed cell is smooth on a full neighborhood of every zero-amplitude spatial point. the documented result

Formal statement
b :
s :
a y :
u :
ℝ
ContDiffAt ℝ ⊤ (localMixedCell b s a y) ![0,0,u]
Proof (Lean source)
-- @node: localMixedCell_contDiffAt_zero lemma localMixedCell_contDiffAt_zero (b : Bool) (s : Bool × Bool) (a y : Bool) (u : ℝ) : ContDiffAt ℝ ⊤ (localMixedCell b s a y) ![0,0,u] := by have hq := mixedRoot_contDiffAt_zero u have hZ : ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => localSignField (v 2) s) ![0,0,u] := by unfold localSignField fun_prop have he : ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => if b then 1/2-v 0*mixedRoot (v 0) (v 1) (v 2)*localSignField (v 2) s else 1/2+v 0*mixedRoot (v 0) (v 1) (v 2)*localSignField (v 2) s) ![0,0,u] := by cases b <;> simp only [Bool.false_eq_true, if_false, if_true] <;> fun_prop have hm : ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => 1/2+v 1*localSignField (v 2) s) ![0,0,u] := by fun_prop have hc : ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => if b then covarianceBranch (32*v 0*v 1) (if b then 1/2-v 0*mixedRoot (v 0) (v 1) (v 2)*localSignField (v 2) s else 1/2+v 0*mixedRoot (v 0) (v 1) (v 2)*localSignField (v 2) s) (1/2+v 1*localSignField (v 2) s) else 0) ![0,0,u] := by cases b · exact contDiffAt_const · let f : (Fin 3 → ℝ) → (Fin 3 → ℝ) := fun v => ![32*v 0*v 1, 1/2-v 0*mixedRoot (v 0) (v 1) (v 2)*localSignField (v 2) s, 1/2+v 1*localSignField (v 2) s] have hf : ContDiffAt ℝ ⊤ f ![0,0,u] := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp [f] <;> fun_prop have hbase : f ![0,0,u] = ![0,1/2,1/2] := by simp [f] have hout := covarianceBranch_contDiffAt_center rw [← hbase] at hout exact hout.comp _ hf unfold localMixedCell tableCell dsimp only cases a <;> cases y <;> simp only [Bool.false_eq_true, if_false, if_true] <;> fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.localMixedCell_contDiffAt_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCellSmoothness.lean:33
theorem localMixedCell_uniform_contDiffAt Lemma localMixedCell_uniform_contDiffAt in the paper ↗

A single signed square makes all actual mixed cells smooth, including full neighborhoods of both spatial endpoints. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
v ∈ mixedParameterRegion ε :
b s a y :
ContDiffAt ℝ ⊤ (localMixedCell b s a y) v
Proof (Lean source)
-- @node: localMixedCell_uniform_contDiffAt lemma localMixedCell_uniform_contDiffAt : ∃ ε : ℝ, 0 < ε ∧ ∀ v ∈ mixedParameterRegion ε, ∀ b s a y, ContDiffAt ℝ ⊤ (localMixedCell b s a y) v := by have hevent : ∀ᶠ z : ℝ × ℝ in 𝓝 (0,0), ∀ u ∈ Icc (0 : ℝ) 1, ∀ b s a y, ContDiffAt ℝ ⊤ (localMixedCell b s a y) ![z.1,z.2,u] := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro u hu simp only [Filter.eventually_all] intro b s a y obtain ⟨S, hS, hSmooth⟩ := (localMixedCell_contDiffAt_zero b s a y u).contDiffOn le_rfl (by simp) obtain ⟨D, hDsub, hDopen, hDbase⟩ := mem_nhds_iff.mp hS have hpre : ∀ᶠ z : (ℝ × ℝ) × ℝ in 𝓝 ((0,0),u), ![z.1.1,z.1.2,z.2] ∈ D := (by fun_prop : ContinuousAt (fun z : (ℝ × ℝ) × ℝ => ![z.1.1,z.1.2,z.2]) ((0,0),u)) (hDopen.mem_nhds hDbase) filter_upwards [hpre] with z hz exact (hSmooth.mono hDsub).contDiffAt (hDopen.mem_nhds hz) obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhds_iff.mp hevent refine ⟨δ/2, by linarith, ?_⟩ intro v hv b s a y have hmem : (v 0,v 1) ∈ ball (0,0) δ := by rw [Metric.mem_ball, Prod.dist_eq] simp only [Real.dist_eq, sub_zero] exact max_lt (by linarith [hv.1]) (by linarith [hv.2.1]) have hvec : ![v 0,v 1,v 2] = v := by funext i fin_cases i <;> rfl simpa only [hvec] using hball hmem (v 2) hv.2.2 b s a y
CausalSmith.Stat.LogoddsLowsmoothFrontier.localMixedCell_uniform_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCellSmoothness.lean:70
theorem mixedParameterRegion_isCompact Lemma mixedParameterRegion_isCompact in the paper ↗

The closed mixed parameter square is compact. the stated conclusion holds.

Formal statement
ε :
ℝ
Proof (Lean source)
-- @node: mixedParameterRegion_isCompact lemma mixedParameterRegion_isCompact (ε : ℝ) : IsCompact (mixedParameterRegion ε) := by let K : Set (Fin 3 → ℝ) := pi univ (fun i => if i = 2 then Icc (0 : ℝ) 1 else Icc (-ε) ε) have hK : IsCompact K := isCompact_univ_pi (fun i => by split <;> exact isCompact_Icc) have heq : K = mixedParameterRegion ε := by ext v simp only [K, Set.mem_pi, Set.mem_univ, forall_const, mixedParameterRegion, Set.mem_ofPred_eq] constructor · intro h exact ⟨abs_le.mpr (by simpa using h 0), abs_le.mpr (by simpa using h 1), by simpa using h 2⟩ · rintro ⟨h0,h1,h2⟩ i fin_cases i · simpa using abs_le.mp h0 · simpa using abs_le.mp h1 · simpa using h2 rwa [heq] at hK
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedParameterRegion_isCompact · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCellSmoothness.lean:102
theorem localMixedCell_uniform_smooth_derivative_bounds Lemma localMixedCell_uniform_smooth_derivative_bounds in the paper ↗

Compactness bounds full derivatives of all finitely many actual mixed cells simultaneously, at every fixed order. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
v ∈ mixedParameterRegion ε :
b s a y :
ContDiffAt ℝ ⊤ (localMixedCell b s a y) v
conclusion 2
m :
ℕ
∃ B : ℝ,
0 < B
v ∈ mixedParameterRegion ε :
b s a y :
‖iteratedFDeriv ℝ m (localMixedCell b s a y) v‖ ≤ B
Proof (Lean source)
-- @node: localMixedCell_uniform_smooth_derivative_bounds lemma localMixedCell_uniform_smooth_derivative_bounds : ∃ ε : ℝ, 0 < ε ∧ (∀ v ∈ mixedParameterRegion ε, ∀ b s a y, ContDiffAt ℝ ⊤ (localMixedCell b s a y) v) ∧ (∀ m : ℕ, ∃ B : ℝ, 0 < B ∧ ∀ v ∈ mixedParameterRegion ε, ∀ b s a y, ‖iteratedFDeriv ℝ m (localMixedCell b s a y) v‖ ≤ B) := by obtain ⟨ε,hε,hSmooth⟩ := localMixedCell_uniform_contDiffAt refine ⟨ε,hε,hSmooth,?_⟩ intro m let I := Bool × (Bool × Bool) × Bool × Bool have hb : ∀ i : I, ∃ B : ℝ, 0 < B ∧ ∀ v ∈ mixedParameterRegion ε, ‖iteratedFDeriv ℝ m (localMixedCell i.1 i.2.1 i.2.2.1 i.2.2.2) v‖ ≤ B := by intro i exact compact_smooth_derivative_bounds 3 _ _ (mixedParameterRegion_isCompact ε) (fun v hv => hSmooth v hv _ _ _ _) m choose B hB hBound using hb refine ⟨∑ i : I, B i, ?_, ?_⟩ · exact Finset.sum_pos (fun i _ => hB i) univ_nonempty · intro v hv b s a y exact (hBound (b,s,a,y) v hv).trans (Finset.single_le_sum (fun i _ => (hB i).le) (Finset.mem_univ (b,s,a,y)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.localMixedCell_uniform_smooth_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCellSmoothness.lean:122
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedComponentSupport 3 declarations The full derivative envelope supplies scalar amplitude partials.

Mixed component bounds from calibrated record support

The full derivative envelope supplies scalar amplitude partials. Product differentiation and two-axis cancellation bound each actual block likelihood; restriction of the uniform hidden sign prior transfers the bound to components.

theorem mixed_record_derivatives_from_support

[Every scalar partial needed by the rectangular Taylor estimate follows from the actual mixed record's full derivative and smoothness envelopes. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
b :
σ :
Fin (k+1) → Bool
o :
x y :
ℝ
hx :
|x| ≤ calibEps
hy :
|y| ≤ calibEps
conclusion 1
∀ᶠ z in 𝓝 y, DifferentiableAt ℝ (fun r => recordCellDensity (mixedLaw b k σ r z) o) x
conclusion 2
DifferentiableAt ℝ (fun z => recordCellDensity (mixedLaw b k σ x z) o) y
conclusion 3
DifferentiableAt ℝ (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) o) x) y
conclusion 4
|deriv (fun r => recordCellDensity (mixedLaw b k σ r y) o) x| ≤ calibM
conclusion 5
|deriv (fun z => recordCellDensity (mixedLaw b k σ x z) o) y| ≤ calibM
conclusion 6
|deriv (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) o) x) y| ≤ calibM
Proof (Lean source)
-- @node: mixed_record_derivatives_from_support lemma mixed_record_derivatives_from_support (k : ℕ) (hk : 1 ≤ k) (b : Bool) (σ : Fin (k+1) → Bool) (o : Record) (x y : ℝ) (hx : |x| ≤ calibEps) (hy : |y| ≤ calibEps) : (∀ᶠ z in 𝓝 y, DifferentiableAt ℝ (fun r => recordCellDensity (mixedLaw b k σ r z) o) x) ∧ DifferentiableAt ℝ (fun z => recordCellDensity (mixedLaw b k σ x z) o) y ∧ DifferentiableAt ℝ (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) o) x) y ∧ |deriv (fun r => recordCellDensity (mixedLaw b k σ r y) o) x| ≤ calibM ∧ |deriv (fun z => recordCellDensity (mixedLaw b k σ x z) o) y| ≤ calibM ∧ |deriv (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) o) x) y| ≤ calibM := by have hs := calib_mixed_smoothness_spec k hk σ x y hx hy b o.2.1 o.2.2 o.1 have hd := (((calib_constants_spec.2.2.2 k hk σ).1 x y hx hy b).2 o.2.1 o.2.2 o.1).2.2 exact mixed_coordinate_derivative_bounds _ x y calibM hs (hd 1 le_rfl (by norm_num)) (hd 2 (by norm_num) le_rfl)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_record_derivatives_from_support · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedComponentSupport.lean:19
theorem mixed_block_hellinger_from_support

[The actual mixed block satisfies the two-axis component Hellinger estimate with the jointly selected support constants and no independent-record premise. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
I :
o :
Fin n → Record
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
(sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i)))^2
≤ calibM^4 * (I.card : ℝ)^4 * 8^I.card * (η*ζ)^2
Proof (Lean source)
-- @node: mixed_block_hellinger_from_support lemma mixed_block_hellinger_from_support {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (I : Finset (Fin n)) (o : Fin n → Record) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) : (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i)))^2 ≤ calibM^4 * (I.card : ℝ)^4 * 8^I.card * (η*ζ)^2 := by have hsmall (z a : ℝ) (hz : z ∈ uIcc 0 a) (ha : |a| ≤ calibEps) : |z| ≤ calibEps := by rw [Set.mem_uIcc] at hz rcases hz with hz | hz · rw [abs_of_nonneg hz.1] exact hz.2.trans ((le_abs_self a).trans ha) · rw [abs_of_nonpos hz.2] exact (neg_le_neg hz.1).trans ((neg_le_abs a).trans ha) have hp (x : ℝ) (hx : x ∈ uIcc 0 η) (y : ℝ) (hy : y ∈ uIcc 0 ζ) (b : Bool) (σ : Fin (k+1) → Bool) (i : Fin n) := mixed_record_derivatives_from_support k hk b σ (o i) x y (hsmall x η hx hη) (hsmall y ζ hy hζ) apply mixed_component_hellinger_of_record_derivatives k I o η ζ calibM (hη.trans calib_regularity_spec.1) (hζ.trans calib_regularity_spec.1) calib_regularity_spec.2.1 · intro x hx y hy simp only [Filter.eventually_all] intro b σ i hi exact (hp x hx y hy b σ i).1 · intro x hx y hy b σ i hi exact (hp x hx y hy b σ i).2.1 · intro x hx y hy b σ i hi exact (hp x hx y hy b σ i).2.2.1 · intro x hx y hy b σ i hi exact (hp x hx y hy b σ i).2.2.2.1 · intro x hx y hy b σ i hi exact (hp x hx y hy b σ i).2.2.2.2.1 · intro x hx y hy b σ i hi exact (hp x hx y hy b σ i).2.2.2.2.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_block_hellinger_from_support · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedComponentSupport.lean:40
theorem mixed_component_hellinger_from_support

[Restricting the uniform sign prior preserves the actual mixed block bound, with the exact number of original records in the selected graph component. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
l :
{i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
owner :
block :
(sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw false k (componentSignExtension owner c σ) η ζ) (x i.1,l i)) - sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw true k (componentSignExtension owner c σ) η ζ) (x i.1,l i)))^2
≤ calibM^4 * (card {i : Fin n // block i = c} : ℝ)^4 * 8^(card {i : Fin n // block i = c}) * (η*ζ)^2
Proof (Lean source)
-- @node: mixed_component_hellinger_from_support lemma mixed_component_hellinger_from_support {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (c : SignComponentBlock k x) (l : {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} → Bool × Bool) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw false k (componentSignExtension owner c σ) η ζ) (x i.1,l i)) - sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw true k (componentSignExtension owner c σ) η ζ) (x i.1,l i)))^2 ≤ calibM^4 * (card {i : Fin n // block i = c} : ℝ)^4 * 8^(card {i : Fin n // block i = c}) * (η*ζ)^2 := by classical dsimp only rw [← mixedDensity_block_average_restrict k hk x c l false η ζ hη hζ, ← mixedDensity_block_average_restrict k hk x c l true η ζ hη hζ] let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) let I := Finset.univ.filter (fun i => block i = c) let o : Fin n → Record := fun i => (x i, if h : block i = c then l ⟨i,h⟩ else (false,false)) have hp (P : ObservedLaw) : (∏ i ∈ I, recordCellDensity P (o i)) = ∏ i : {i : Fin n // block i = c}, recordCellDensity P (x i.1,l i) := by rw [Finset.prod_subtype (p := fun i => block i = c) I (by simp [I])] apply Finset.prod_congr rfl intro i _ simp only [o, dif_pos i.2] rfl have hc : I.card = card {i : Fin n // block i = c} := by rw [Fintype.card_subtype] have h := mixed_block_hellinger_from_support k hk I o η ζ hη hζ simp only [hp, hc] at h exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_component_hellinger_from_support · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedComponentSupport.lean:81
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedCoordinateDerivatives 3 declarations Coordinate lines have unit tangent vectors.

Scalar mixed partials from full derivative bounds

Coordinate lines have unit tangent vectors. The chain rule transfers the full first and second Fréchet derivative envelopes to the scalar amplitude partials.

theorem mixed_coordinate_deriv_left Lemma mixed_coordinate_deriv_left in the paper ↗

The first amplitude derivative is the full derivative on a unit coordinate direction. Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
(Fin 2 → ℝ) → ℝ
x y :
ℝ
hf :
DifferentiableAt ℝ f ![x,y]
deriv (fun r => f ![r,y]) x = fderiv ℝ f ![x,y] (single 0 1)
Proof (Lean source)
-- @node: mixed_coordinate_deriv_left lemma mixed_coordinate_deriv_left (f : (Fin 2 → ℝ) → ℝ) (x y : ℝ) (hf : DifferentiableAt ℝ f ![x,y]) : deriv (fun r => f ![r,y]) x = fderiv ℝ f ![x,y] (single 0 1) := by have hline : HasDerivAt (fun r : ℝ => ![r,y]) (single 0 1) x := by apply hasDerivAt_pi.mpr intro i fin_cases i <;> simp · exact hasDerivAt_id x · exact hasDerivAt_const x y exact (hf.hasFDerivAt.comp_hasDerivAt x hline).deriv
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_coordinate_deriv_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCoordinateDerivatives.lean:14
theorem mixed_coordinate_deriv_right Lemma mixed_coordinate_deriv_right in the paper ↗

The second amplitude derivative uses the other unit coordinate direction. Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
(Fin 2 → ℝ) → ℝ
x y :
ℝ
hf :
DifferentiableAt ℝ f ![x,y]
deriv (fun z => f ![x,z]) y = fderiv ℝ f ![x,y] (single 1 1)
Proof (Lean source)
-- @node: mixed_coordinate_deriv_right lemma mixed_coordinate_deriv_right (f : (Fin 2 → ℝ) → ℝ) (x y : ℝ) (hf : DifferentiableAt ℝ f ![x,y]) : deriv (fun z => f ![x,z]) y = fderiv ℝ f ![x,y] (single 1 1) := by have hline : HasDerivAt (fun z : ℝ => ![x,z]) (single 1 1) y := by apply hasDerivAt_pi.mpr intro i fin_cases i <;> simp · exact hasDerivAt_const y x · exact hasDerivAt_id y exact (hf.hasFDerivAt.comp_hasDerivAt y hline).deriv
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_coordinate_deriv_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCoordinateDerivatives.lean:27
theorem mixed_coordinate_derivative_bounds Lemma mixed_coordinate_derivative_bounds in the paper ↗

[Two-variable smoothness supplies the scalar mixed derivative and its literal second-order operator-norm bound. the documented result Under the stated assumptions.

Formal statement
f :
(Fin 2 → ℝ) → ℝ
x y M :
ℝ
hf :
ContDiffAt ℝ 2 f ![x,y]
h1 :
‖iteratedFDeriv ℝ 1 f ![x,y]‖ ≤ M
h2 :
‖iteratedFDeriv ℝ 2 f ![x,y]‖ ≤ M
conclusion 1
∀ᶠ z in 𝓝 y, DifferentiableAt ℝ (fun r => f ![r,z]) x
conclusion 2
DifferentiableAt ℝ (fun z => f ![x,z]) y
conclusion 3
DifferentiableAt ℝ (fun z => deriv (fun r => f ![r,z]) x) y
conclusion 4
|deriv (fun r => f ![r,y]) x| ≤ M
conclusion 5
|deriv (fun z => f ![x,z]) y| ≤ M
conclusion 6
|deriv (fun z => deriv (fun r => f ![r,z]) x) y| ≤ M
Proof (Lean source)
-- @node: mixed_coordinate_derivative_bounds lemma mixed_coordinate_derivative_bounds (f : (Fin 2 → ℝ) → ℝ) (x y M : ℝ) (hf : ContDiffAt ℝ 2 f ![x,y]) (h1 : ‖iteratedFDeriv ℝ 1 f ![x,y]‖ ≤ M) (h2 : ‖iteratedFDeriv ℝ 2 f ![x,y]‖ ≤ M) : (∀ᶠ z in 𝓝 y, DifferentiableAt ℝ (fun r => f ![r,z]) x) ∧ DifferentiableAt ℝ (fun z => f ![x,z]) y ∧ DifferentiableAt ℝ (fun z => deriv (fun r => f ![r,z]) x) y ∧ |deriv (fun r => f ![r,y]) x| ≤ M ∧ |deriv (fun z => f ![x,z]) y| ≤ M ∧ |deriv (fun z => deriv (fun r => f ![r,z]) x) y| ≤ M := by have hd := hf.differentiableAt (by norm_num) have hevent : ∀ᶠ z in 𝓝 y, ContDiffAt ℝ 2 f ![x,z] := (by fun_prop : ContinuousAt (fun z : ℝ => ![x,z]) y) (hf.eventually (by norm_num)) have hline : HasDerivAt (fun z : ℝ => ![x,z]) (single 1 1) y := by apply hasDerivAt_pi.mpr intro i fin_cases i <;> simp · exact hasDerivAt_const y x · exact hasDerivAt_id y have hfd := (hf.fderiv_right (m := 1) (by norm_num)).differentiableAt (by norm_num) have hclm := hfd.hasFDerivAt.comp_hasDerivAt y hline have happ := hclm.clm_apply (hasDerivAt_const y (single 0 (1 : ℝ))) have heq : (fun z => deriv (fun r => f ![r,z]) x) =ᶠ[𝓝 y] (fun z => fderiv ℝ f ![x,z] (single 0 1)) := by filter_upwards [hevent] with z hz exact mixed_coordinate_deriv_left f x z (hz.differentiableAt (by norm_num)) have hcross := happ.congr_of_eventuallyEq heq have hn0 : ‖(single 0 (1 : ℝ) : Fin 2 → ℝ)‖ = 1 := by rw [Pi.norm_single]; norm_num have hn1 : ‖(single 1 (1 : ℝ) : Fin 2 → ℝ)‖ = 1 := by rw [Pi.norm_single]; norm_num refine ⟨?_, hd.comp y hline.differentiableAt, hcross.differentiableAt, ?_, ?_, ?_⟩ · filter_upwards [hevent] with z hz apply (hz.differentiableAt (by norm_num)).comp x apply differentiableAt_pi.mpr intro i fin_cases i <;> simp <;> fun_prop · rw [mixed_coordinate_deriv_left f x y hd, ← Real.norm_eq_abs] calc _ ≤ ‖fderiv ℝ f ![x,y]‖ * ‖(single 0 (1 : ℝ) : Fin 2 → ℝ)‖ := (fderiv ℝ f ![x,y]).le_opNorm _ _ ≤ M := by simpa only [hn0, mul_one, norm_iteratedFDeriv_one] using h1 · rw [mixed_coordinate_deriv_right f x y hd, ← Real.norm_eq_abs] calc _ ≤ ‖fderiv ℝ f ![x,y]‖ * ‖(single 1 (1 : ℝ) : Fin 2 → ℝ)‖ := (fderiv ℝ f ![x,y]).le_opNorm _ _ ≤ M := by simpa only [hn1, mul_one, norm_iteratedFDeriv_one] using h1 · rw [hcross.deriv] simp only [ContinuousLinearMap.map_zero, add_zero] rw [← Real.norm_eq_abs] calc _ ≤ ‖fderiv ℝ (fderiv ℝ f) ![x,y] (single 1 1)‖ * ‖(single 0 (1 : ℝ) : Fin 2 → ℝ)‖ := (fderiv ℝ (fderiv ℝ f) ![x,y] (single 1 1)).le_opNorm _ _ ≤ (‖fderiv ℝ (fderiv ℝ f) ![x,y]‖ * ‖(single 1 (1 : ℝ) : Fin 2 → ℝ)‖) * ‖(single 0 (1 : ℝ) : Fin 2 → ℝ)‖ := by apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) exact (fderiv ℝ (fderiv ℝ f) ![x,y]).le_opNorm _ _ ≤ M := by simpa only [hn0, hn1, mul_one, ← norm_iteratedFDeriv_one, norm_iteratedFDeriv_fderiv] using h2
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_coordinate_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedCoordinateDerivatives.lean:40
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedDensityRanges 5 declarations The literal root bracket bounds both perturbed margins.

Mixed four-cell density bounds

The literal root bracket bounds both perturbed margins. The covariance branch bound then gives a common density floor and ceiling for the actual mixed cells, including signed amplitudes and the law constructor's fallback inputs.

[The mixed selector always lies in its bracket, including its fallback value. the stated conclusion holds.

Formal statement
η ζ u :
ℝ
mixedRoot η ζ u ∈ Ioo (3/4 : ℝ) (5/4)
Proof (Lean source)
-- @node: mixedRoot_mem_bracket lemma mixedRoot_mem_bracket (η ζ u : ℝ) : mixedRoot η ζ u ∈ Ioo (3/4 : ℝ) (5/4) := by classical by_cases h : ∃ q : ℝ, q ∈ Ioo (3/4) (5/4) ∧ mixedEquation η ζ u q = 0 · exact (mixedRoot_spec η ζ u h).1 · rw [mixedRoot, dif_neg h] constructor <;> norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_mem_bracket · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedDensityRanges.lean:15

Small signed amplitudes keep both mixed margins near one half. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
x :
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
conclusion 1
|(if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x)-1/2|
≤ 1/40
conclusion 2
|(1/2+ζ*signFieldZ k σ x)-1/2| ≤ 1/40
Proof (Lean source)
-- @node: mixed_margin_bounds lemma mixed_margin_bounds (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (x : Covariate) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) : |(if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x)-1/2| ≤ 1/40 ∧ |(1/2+ζ*signFieldZ k σ x)-1/2| ≤ 1/40 := by have hq := mixedRoot_mem_bracket η ζ (cellCoord k x) have hqabs : |mixedRoot η ζ (cellCoord k x)| ≤ 5/4 := by rw [abs_of_pos (by linarith [hq.1])] exact hq.2.le have hz := signFieldZ_abs_le_two k σ x have hprod : |η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x| ≤ 1/40 := by simp only [abs_mul] calc _ ≤ ((1/100 : ℝ)*(5/4))*2 := mul_le_mul (mul_le_mul hη hqabs (abs_nonneg _) (by norm_num)) hz (abs_nonneg _) (by norm_num) _ = _ := by norm_num have hprod' : |ζ*signFieldZ k σ x| ≤ 1/40 := by rw [abs_mul] calc _ ≤ (1/100 : ℝ)*2 := mul_le_mul hζ hz (abs_nonneg _) (by norm_num) _ ≤ _ := by norm_num constructor · cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] · simpa only [add_sub_cancel_left] using hprod · simpa only [sub_sub_cancel_left, abs_neg] using hprod · simpa only [add_sub_cancel_left] using hprod'
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_margin_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedDensityRanges.lean:25
theorem mixed_centered_product_bounds Lemma mixed_centered_product_bounds in the paper ↗

Products of the centered margins have uniform lower and upper bounds. Under the stated assumptions. Under the stated assumptions.

Formal statement
x y :
ℝ
hx :
x ∈ Icc (19/40 : ℝ) (21/40)
hy :
y ∈ Icc (19/40 : ℝ) (21/40)
conclusion 1
(361/1600 : ℝ) ≤ x*y
conclusion 2
x*y ≤ 441/1600
Proof (Lean source)
-- @node: mixed_centered_product_bounds lemma mixed_centered_product_bounds (x y : ℝ) (hx : x ∈ Icc (19/40 : ℝ) (21/40)) (hy : y ∈ Icc (19/40 : ℝ) (21/40)) : (361/1600 : ℝ) ≤ x*y ∧ x*y ≤ 441/1600 := by constructor · have h := mul_le_mul hx.1 hy.1 (by norm_num : (0 : ℝ) ≤ 19/40) (by linarith [hx.1]) norm_num at h exact h · have h := mul_le_mul hx.2 hy.2 (by linarith [hy.1]) (by norm_num) norm_num at h exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_centered_product_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedDensityRanges.lean:55
theorem mixed_table_density_bounds Lemma mixed_table_density_bounds in the paper ↗

All four mixed cells retain a fixed density floor and ceiling. Under the stated assumptions.

Formal statement
e m c :
ℝ
he :
|e-1/2| ≤ 1/40
hm :
|m-1/2| ≤ 1/40
hc :
|c| ≤ 1/24
a y :
conclusion 1
(1/2 : ℝ) ≤ 4*tableCell e m c a y
conclusion 2
4*tableCell e m c a y ≤ 2
Proof (Lean source)
-- @node: mixed_table_density_bounds lemma mixed_table_density_bounds (e m c : ℝ) (he : |e-1/2| ≤ 1/40) (hm : |m-1/2| ≤ 1/40) (hc : |c| ≤ 1/24) (a y : Bool) : (1/2 : ℝ) ≤ 4*tableCell e m c a y ∧ 4*tableCell e m c a y ≤ 2 := by obtain ⟨helo, hehi⟩ := abs_le.mp he obtain ⟨hmlo, hmhi⟩ := abs_le.mp hm obtain ⟨hclo, hchi⟩ := abs_le.mp hc have he' : e ∈ Icc (19/40 : ℝ) (21/40) := ⟨by linarith, by linarith⟩ have hm' : m ∈ Icc (19/40 : ℝ) (21/40) := ⟨by linarith, by linarith⟩ have hec : 1-e ∈ Icc (19/40 : ℝ) (21/40) := ⟨by linarith, by linarith⟩ have hmc : 1-m ∈ Icc (19/40 : ℝ) (21/40) := ⟨by linarith, by linarith⟩ have h1 := mixed_centered_product_bounds e m he' hm' have h2 := mixed_centered_product_bounds e (1-m) he' hmc have h3 := mixed_centered_product_bounds (1-e) m hec hm' have h4 := mixed_centered_product_bounds (1-e) (1-m) hec hmc cases a <;> cases y <;> simp only [tableCell, Bool.false_eq_true, ↓reduceIte] <;> constructor <;> linarith [h1.1, h1.2, h2.1, h2.2, h3.1, h3.2, h4.1, h4.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_table_density_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedDensityRanges.lean:70
theorem mixedCells_density_bounds Lemma mixedCells_density_bounds in the paper ↗

The complete substituted mixed cells satisfy the support density bounds. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
a y :
x :
conclusion 1
(1/2 : ℝ) ≤ 4*mixedCells b k σ η ζ a y x
conclusion 2
4*mixedCells b k σ η ζ a y x ≤ 2
Proof (Lean source)
-- @node: mixedCells_density_bounds lemma mixedCells_density_bounds (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (a y : Bool) (x : Covariate) : (1/2 : ℝ) ≤ 4*mixedCells b k σ η ζ a y x ∧ 4*mixedCells b k σ η ζ a y x ≤ 2 := by obtain ⟨he, hm⟩ := mixed_margin_bounds b k σ η ζ x hη hζ have ht : |32*η*ζ| ≤ 1/8 := by simp only [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 32)] have h := mul_le_mul hη hζ (abs_nonneg _) (by norm_num : (0 : ℝ) ≤ 1/100) nlinarith unfold mixedCells dsimp only apply mixed_table_density_bounds _ _ _ he hm cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] at he ⊢ · norm_num · exact (covarianceBranch_local_bounds _ _ _ ht (by linarith) (by linarith)).2.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_density_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedDensityRanges.lean:90
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedEquationSmoothness 12 declarations The exponential divided difference is smooth through zero by its analytic slope extension.

Smooth mixed calibration equation

The exponential divided difference is smooth through zero by its analytic slope extension. The positive - radicand table formula is consequently smooth jointly in the signed amplitudes, spatial coordinate, and root variable.

[The integral divided difference recovers the exponential increment, also at zero. the stated conclusion holds.

Formal statement
t :
ℝ
t * dividedExp t = exp t - 1
Proof (Lean source)
-- @node: dividedExp_mul lemma dividedExp_mul (t : ℝ) : t * dividedExp t = exp t - 1 := by unfold dividedExp rw [intervalIntegral.mul_integral_comp_mul_right, integral_exp] simp

The integral divided difference is the derivative - completed exponential slope. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: dividedExp_eq_dslope lemma dividedExp_eq_dslope : dividedExp = dslope exp 0 := by funext t by_cases ht : t = 0 · subst t simp [dividedExp, Real.deriv_exp] · rw [dslope_of_ne _ ht] simp only [slope, vsub_eq_sub, sub_zero, Real.exp_zero, smul_eq_mul] have h := dividedExp_mul t field_simp nlinarith [h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.dividedExp_eq_dslope · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:29

The actual integral formula is smooth to every order, including at zero. The stated conclusion follows.

Formal statement
Proof (Lean source)
-- @node: dividedExp_contDiff @[fun_prop] lemma dividedExp_contDiff : ContDiff ℝ ⊤ dividedExp := by rw [contDiff_iff_contDiffAt] intro t by_cases ht : t = 0 · subst t obtain ⟨p, hp⟩ := (analyticAt_rexp : AnalyticAt ℝ exp 0) have ha : AnalyticAt ℝ (dslope exp 0) 0 := ⟨p.fslope, hp.has_fpower_series_dslope_fslope⟩ rw [dividedExp_eq_dslope] exact ha.contDiffAt · have he : dividedExp =ᶠ[𝓝 t] fun x => (exp x - 1)/x := by filter_upwards [eventually_ne_nhds ht] with x hx apply (eq_div_iff hx).mpr simpa [mul_comm] using dividedExp_mul x exact ((Real.contDiff_exp.contDiffAt.sub contDiffAt_const).div contDiffAt_id ht).congr_of_eventuallyEq he
CausalSmith.Stat.LogoddsLowsmoothFrontier.dividedExp_contDiff · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:42
theorem normalizedBranch_contDiffAt Lemma normalizedBranch_contDiffAt in the paper ↗

The normalized table is jointly smooth at every positive radicand and nonzero denominator. the stated conclusion holds. Under the stated assumptions.

Formal statement
v :
Fin 3 → ℝ
hrad :
0 < (1 + (exp (v 0) - 1) * (v 1 * (1 - v 2) + (1 - v 1) * v 2)) ^ 2- 4 * (exp (v 0) - 1) ^ 2 * (v 1 * (1 - v 1) * v 2 * (1 - v 2))
hden :
1
+ (exp (v 0) - 1) * (v 1 * (1 - v 2) + (1 - v 1) * v 2)
+ sqrt ((1 + (exp (v 0) - 1) * (v 1 * (1 - v 2) + (1 - v 1) * v 2)) ^ 2- 4 * (exp (v 0) - 1) ^ 2 * (v 1 * (1 - v 1) * v 2 * (1 - v 2)))
≠ 0
ContDiffAt ℝ ⊤ (fun w : Fin 3 → ℝ => normalizedBranch (w 0) (w 1) (w 2)) v
Proof (Lean source)
-- @node: normalizedBranch_contDiffAt lemma normalizedBranch_contDiffAt (v : Fin 3 → ℝ) (hrad : 0 < (1 + (exp (v 0) - 1) * (v 1 * (1 - v 2) + (1 - v 1) * v 2)) ^ 2- 4 * (exp (v 0) - 1) ^ 2 * (v 1 * (1 - v 1) * v 2 * (1 - v 2))) (hden : 1 + (exp (v 0) - 1) * (v 1 * (1 - v 2) + (1 - v 1) * v 2) + sqrt ((1 + (exp (v 0) - 1) * (v 1 * (1 - v 2) + (1 - v 1) * v 2)) ^ 2- 4 * (exp (v 0) - 1) ^ 2 * (v 1 * (1 - v 1) * v 2 * (1 - v 2))) ≠ 0) : ContDiffAt ℝ ⊤ (fun w : Fin 3 → ℝ => normalizedBranch (w 0) (w 1) (w 2)) v := by unfold normalizedBranch dsimp only apply ContDiffAt.div · fun_prop · apply ContDiffAt.add · fun_prop · apply ContDiffAt.sqrt · fun_prop · exact ne_of_gt hrad · exact hden
CausalSmith.Stat.LogoddsLowsmoothFrontier.normalizedBranch_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:60

Radicand of a mixed normalized table, with all signed parameters substituted.

Definition (Lean source)
η ζ u q :
ℝ
s :
mixedTableRadicand η ζ u q s :
ℝ
t :
32 * η * ζ
ξ :
1/2 - η * q * localSignField u s
υ :
1/2 + ζ * localSignField u s
d :
exp t - 1
(1 + d * (ξ * (1-υ) + (1-ξ) * υ))^2 - 4 * d^2 * (ξ * (1-ξ) * υ * (1-υ))
theorem mixedEquation_contDiffAt

Smoothness of the actual mixed equation follows from its finitely many positive radicands. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
v :
(ℝ × ℝ) × (ℝ × ℝ)
hrad :
∀ s, 0 < mixedTableRadicand v.1.1 v.1.2 v.2.1 v.2.2 s
hden :
∀ s, mixedTableDenominator v.1.1 v.1.2 v.2.1 v.2.2 s ≠ 0
ContDiffAt ℝ ⊤ (fun w : (ℝ × ℝ) × (ℝ × ℝ) => mixedEquation w.1.1 w.1.2 w.2.1 w.2.2) v
Proof (Lean source)
-- @node: mixedEquation_contDiffAt lemma mixedEquation_contDiffAt (v : (ℝ × ℝ) × (ℝ × ℝ)) (hrad : ∀ s, 0 < mixedTableRadicand v.1.1 v.1.2 v.2.1 v.2.2 s) (hden : ∀ s, mixedTableDenominator v.1.1 v.1.2 v.2.1 v.2.2 s ≠ 0) : ContDiffAt ℝ ⊤ (fun w : (ℝ × ℝ) × (ℝ × ℝ) => mixedEquation w.1.1 w.1.2 w.2.1 w.2.2) v := by unfold mixedEquation signAverage apply ContDiffAt.sub · apply ContDiffAt.mul contDiffAt_const apply ContDiffAt.mul contDiffAt_const apply ContDiffAt.sum intro s hs let f : ((ℝ × ℝ) × (ℝ × ℝ)) → (Fin 3 → ℝ) := fun w => ![32 * w.1.1 * w.1.2, 1/2 - w.1.1 * w.2.2 * localSignField w.2.1 s, 1/2 + w.1.2 * localSignField w.2.1 s] have hf : ContDiffAt ℝ ⊤ f v := by apply contDiffAt_pi.mpr intro i fin_cases i <;> dsimp [f, localSignField] <;> fun_prop exact (normalizedBranch_contDiffAt (f v) (hrad s) (hden s)).comp v hf · fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:90
theorem mixedEquation_contDiffAt_zero Lemma mixedEquation_contDiffAt_zero in the paper ↗

[At every point of the zero-amplitude rectangle, the full mixed equation is smooth. the stated conclusion holds.

Formal statement
u q :
ℝ
ContDiffAt ℝ ⊤ (fun w : (ℝ × ℝ) × (ℝ × ℝ) => mixedEquation w.1.1 w.1.2 w.2.1 w.2.2) ((0,0),(u,q))
Proof (Lean source)
-- @node: mixedEquation_contDiffAt_zero lemma mixedEquation_contDiffAt_zero (u q : ℝ) : ContDiffAt ℝ ⊤ (fun w : (ℝ × ℝ) × (ℝ × ℝ) => mixedEquation w.1.1 w.1.2 w.2.1 w.2.2) ((0,0),(u,q)) := by apply mixedEquation_contDiffAt · intro s norm_num [mixedTableRadicand] · intro s norm_num [mixedTableDenominator]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_contDiffAt_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:113
theorem mixedEquation_deriv_zero Lemma mixedEquation_deriv_zero in the paper ↗

The root-variable derivative at zero amplitudes is exactly minus one. the stated conclusion holds.

Formal statement
u q :
ℝ
deriv (mixedEquation 0 0 u) q = -1
Proof (Lean source)
-- @node: mixedEquation_deriv_zero lemma mixedEquation_deriv_zero (u q : ℝ) : deriv (mixedEquation 0 0 u) q = -1 := by have he : mixedEquation 0 0 u = fun q => 1-q := funext (mixedEquation_zero_amplitudes u) rw [he] simpa using ((hasDerivAt_const q (1 : ℝ)).sub (hasDerivAt_id q)).deriv
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_deriv_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:124
theorem mixedEquation_partial_continuousAt_zero Lemma mixedEquation_partial_continuousAt_zero in the paper ↗

The root-variable derivative varies continuously jointly near each zero-amplitude point. the stated conclusion holds.

Formal statement
u q :
ℝ
ContinuousAt (fun w : (ℝ × ℝ) × (ℝ × ℝ) => deriv (mixedEquation w.1.1 w.1.2 w.2.1) w.2.2) ((0,0),(u,q))
Proof (Lean source)
-- @node: mixedEquation_partial_continuousAt_zero lemma mixedEquation_partial_continuousAt_zero (u q : ℝ) : ContinuousAt (fun w : (ℝ × ℝ) × (ℝ × ℝ) => deriv (mixedEquation w.1.1 w.1.2 w.2.1) w.2.2) ((0,0),(u,q)) := by let f : ((ℝ × ℝ) × (ℝ × ℝ)) → ℝ → ℝ := fun w χ => mixedEquation w.1.1 w.1.2 w.2.1 χ have hf : ContDiffAt ℝ ⊤ (uncurry f) (((0,0),(u,q)),q) := by exact (mixedEquation_contDiffAt_zero u q).comp (((0,0),(u,q)),q) (show ContDiffAt ℝ ⊤ (fun z : (((ℝ × ℝ) × (ℝ × ℝ)) × ℝ) => (z.1.1, (z.1.2.1, z.2))) (((0,0),(u,q)),q) by fun_prop) have hpartial := hf.fderiv (show ContDiffAt ℝ (0 : WithTop ℕ∞) (fun w : (ℝ × ℝ) × (ℝ × ℝ) => w.2.2) ((0,0),(u,q)) by fun_prop) (by simp) exact hpartial.continuousAt.clm_apply continuousAt_const
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_partial_continuousAt_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:131
theorem mixedEquation_uniform_deriv_neg Lemma mixedEquation_uniform_deriv_neg in the paper ↗

Compactness supplies one signed amplitude square with a uniform negative derivative floor. the stated conclusion holds.

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
η ζ u q :
ℝ
|η| ≤ ε
|ζ| ≤ ε
u ∈ Icc (0 : ℝ) 1
q ∈ Icc (3/4 : ℝ) (5/4)
deriv (mixedEquation η ζ u) q < -1/2
Proof (Lean source)
-- @node: mixedEquation_uniform_deriv_neg lemma mixedEquation_uniform_deriv_neg : ∃ ε : ℝ, 0 < ε ∧ ∀ η ζ u q : ℝ, |η| ≤ ε → |ζ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → q ∈ Icc (3/4 : ℝ) (5/4) → deriv (mixedEquation η ζ u) q < -1/2 := by let K := Icc (0 : ℝ) 1 ×ˢ Icc (3/4 : ℝ) (5/4) have hK : IsCompact K := isCompact_Icc.prod isCompact_Icc have hevent : ∀ᶠ a : ℝ × ℝ in 𝓝 (0,0), ∀ z ∈ K, deriv (mixedEquation a.1 a.2 z.1) z.2 < -1/2 := by apply hK.eventually_forall_of_forall_eventually intro z hz exact (mixedEquation_partial_continuousAt_zero z.1 z.2).eventually (gt_mem_nhds (by dsimp only; rw [mixedEquation_deriv_zero]; norm_num)) obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhds_iff.mp hevent refine ⟨δ/2, by linarith, ?_⟩ intro η ζ u q hη hζ hu hq have hmem : (η,ζ) ∈ ball (0,0) δ := by rw [Metric.mem_ball, Prod.dist_eq] simp only [Real.dist_eq, sub_zero] exact max_lt (by linarith) (by linarith) exact hball hmem (u,q) ⟨hu,hq⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_uniform_deriv_neg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:147
theorem mixedEquation_bracket_unique Lemma mixedEquation_bracket_unique in the paper ↗

A negative derivative floor gives uniqueness throughout the entire prescribed root bracket. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
η ζ u :
ℝ
hderiv :
∀ q ∈ Icc (3/4 : ℝ) (5/4), deriv (mixedEquation η ζ u) q < -1/2
p q :
ℝ
hp :
p ∈ Ioo (3/4 : ℝ) (5/4)
hq :
q ∈ Ioo (3/4 : ℝ) (5/4)
hep :
mixedEquation η ζ u p = 0
heq :
mixedEquation η ζ u q = 0
p = q
Proof (Lean source)
-- @node: mixedEquation_bracket_unique lemma mixedEquation_bracket_unique (η ζ u : ℝ) (hderiv : ∀ q ∈ Icc (3/4 : ℝ) (5/4), deriv (mixedEquation η ζ u) q < -1/2) (p q : ℝ) (hp : p ∈ Ioo (3/4 : ℝ) (5/4)) (hq : q ∈ Ioo (3/4 : ℝ) (5/4)) (hep : mixedEquation η ζ u p = 0) (heq : mixedEquation η ζ u q = 0) : p = q := by have hc : ContinuousOn (mixedEquation η ζ u) (Icc (3/4 : ℝ) (5/4)) := by intro x hx exact (differentiableAt_of_deriv_ne_zero (by linarith [hderiv x hx])).continuousAt.continuousWithinAt have ha : StrictAntiOn (mixedEquation η ζ u) (Icc (3/4 : ℝ) (5/4)) := strictAntiOn_of_deriv_neg (convex_Icc _ _) hc (fun x hx => lt_trans (hderiv x (interior_subset hx)) (by norm_num)) exact ha.injOn ⟨hp.1.le, hp.2.le⟩ ⟨hq.1.le, hq.2.le⟩ (hep.trans heq.symm)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_bracket_unique · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:170
theorem mixedEquation_uniform_existsUnique Lemma mixedEquation_uniform_existsUnique in the paper ↗

Existence and the uniform derivative floor give a unique mixed root on one absolute signed square. the stated conclusion holds.

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
η ζ u :
ℝ
|η| ≤ ε
|ζ| ≤ ε
u ∈ Icc (0 : ℝ) 1
∃! q : ℝ,
q ∈ Ioo (3/4 : ℝ) (5/4)
mixedEquation η ζ u q = 0
Proof (Lean source)
-- @node: mixedEquation_uniform_existsUnique lemma mixedEquation_uniform_existsUnique : ∃ ε : ℝ, 0 < ε ∧ ∀ η ζ u : ℝ, |η| ≤ ε → |ζ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → ∃! q : ℝ, q ∈ Ioo (3/4 : ℝ) (5/4) ∧ mixedEquation η ζ u q = 0 := by obtain ⟨εr, hr, hroot⟩ := mixedEquation_uniform_exists obtain ⟨εd, hd, hderiv⟩ := mixedEquation_uniform_deriv_neg refine ⟨min εr εd, lt_min hr hd, ?_⟩ intro η ζ u hη hζ hu obtain ⟨q, hq, heq⟩ := hroot η ζ u (hη.trans (min_le_left _ _)) (hζ.trans (min_le_left _ _)) hu refine ⟨q, ⟨hq, heq⟩, ?_⟩ intro p hp exact mixedEquation_bracket_unique η ζ u (fun χ hχ => hderiv η ζ u χ (hη.trans (min_le_right _ _)) (hζ.trans (min_le_right _ _)) hu hχ) p q hp.1 hq hp.2 heq
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_uniform_existsUnique · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedEquationSmoothness.lean:185
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedMixtureTaylor 7 declarations Both amplitude axes cancel for any block of original records under the hidden sign prior.

Mixed component cancellation and the rectangular Taylor estimate

Both amplitude axes cancel for any block of original records under the hidden sign prior. Two applications of the mean value theorem turn a bound on the actual mixed derivative into the product-amplitude component estimate. The smoothness and product derivative bounds remain explicit inputs, rather than being assumed by the paper's mixture theorem.

[Difference of the two actual block likelihoods, averaged over the same hidden endpoint-sign prior without assuming independence inside the block.

Definition (Lean source)
n :
ℕ
k :
ℕ
I :
o :
Fin n → Record
η ζ :
ℝ
mixedComponentDifference k I o η ζ :
ℝ
(card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ((∑ σ : Fin (k + 1) → Bool, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - ∑ σ : Fin (k + 1) → Bool, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i))
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedComponentDifference · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedMixtureTaylor.lean:18
theorem mixedComponentDifference_zero_left

On the zero propensity axis the actual block likelihoods agree draw by draw. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
I :
o :
Fin n → Record
ζ :
ℝ
Proof (Lean source)
-- @node: mixedComponentDifference_zero_left lemma mixedComponentDifference_zero_left {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (o : Fin n → Record) (ζ : ℝ) : mixedComponentDifference k I o 0 ζ = 0 := by simp only [mixedComponentDifference, mixedLaw, mixedCells_zero_left, sub_self, mul_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedComponentDifference_zero_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedMixtureTaylor.lean:27
theorem mixedComponentDifference_zero_right

On the zero prognosis axis global sign reversal reindexes the block prior. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
I :
o :
Fin n → Record
η :
ℝ
Proof (Lean source)
-- @node: mixedComponentDifference_zero_right lemma mixedComponentDifference_zero_right {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (o : Fin n → Record) (η : ℝ) : mixedComponentDifference k I o η 0 = 0 := by unfold mixedComponentDifference simp only [mixedLaw, mixedCells_zero_right_reverse] rw [endpointSign_prior_reverse k (fun σ => ∏ i ∈ I, recordCellDensity (totalCellLaw (mixedCells true k σ η 0)) (o i))] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedComponentDifference_zero_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedMixtureTaylor.lean:33
theorem mixture_rectangle_bound Lemma mixture_rectangle_bound in the paper ↗

Two mean value estimates on the signed rectangle give a product-amplitude bound when both axes vanish. The derivatives are of the fully substituted function. the documented result Under the stated assumptions.

Formal statement
f :
ℝ → ℝ → ℝ
η ζ C :
ℝ
hleft :
∀ y, f 0 y = 0
hright :
∀ x, f x 0 = 0
hDiff :
∀ x ∈ uIcc 0 η, DifferentiableAt ℝ (fun s => f s ζ) x
hCrossDiff :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ, DifferentiableAt ℝ (fun s => deriv (fun r => f r s) x) y
hCross :
∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, |deriv (fun s => deriv (fun r => f r s) x) y| ≤ C
|f η ζ| ≤ C * |η * ζ|
Proof (Lean source)
-- @node: mixture_rectangle_bound lemma mixture_rectangle_bound (f : ℝ → ℝ → ℝ) (η ζ C : ℝ) (hleft : ∀ y, f 0 y = 0) (hright : ∀ x, f x 0 = 0) (hDiff : ∀ x ∈ uIcc 0 η, DifferentiableAt ℝ (fun s => f s ζ) x) (hCrossDiff : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, DifferentiableAt ℝ (fun s => deriv (fun r => f r s) x) y) (hCross : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, |deriv (fun s => deriv (fun r => f r s) x) y| ≤ C) : |f η ζ| ≤ C * |η * ζ| := by have hAxis (x : ℝ) : deriv (fun r => f r 0) x = 0 := by have he : (fun r => f r 0) = (fun _ : ℝ => (0 : ℝ)) := funext hright rw [he, deriv_const] have hFirst (x : ℝ) (hx : x ∈ uIcc 0 η) : |deriv (fun r => f r ζ) x| ≤ C * |ζ| := by have h := Convex.norm_image_sub_le_of_norm_deriv_le (hCrossDiff x hx) (fun y hy => by simpa only [Real.norm_eq_abs] using hCross x hx y hy) (convex_uIcc (0 : ℝ) ζ) Set.left_mem_uIcc Set.right_mem_uIcc simpa only [hAxis, sub_zero, Real.norm_eq_abs] using h have h := Convex.norm_image_sub_le_of_norm_deriv_le hDiff (fun x hx => by simpa only [Real.norm_eq_abs] using hFirst x hx) (convex_uIcc (0 : ℝ) η) Set.left_mem_uIcc Set.right_mem_uIcc simp only [hleft, sub_zero, Real.norm_eq_abs] at h calc |f η ζ| ≤ C * |ζ| * |η| := h _ = C * |η * ζ| := by rw [abs_mul]; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_rectangle_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedMixtureTaylor.lean:43
theorem mixedComponentDifference_taylor_bound

[Applying the rectangular estimate to actual mixed blocks uses the two proved axis identities. Product differentiation is the remaining analytic input. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
o :
Fin n → Record
η ζ M :
ℝ
hDiff :
∀ x ∈ uIcc 0 η, DifferentiableAt ℝ (fun s => mixedComponentDifference k I o s ζ) x
hCrossDiff :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
DifferentiableAt ℝ (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y
hCross :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
|deriv (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y|
≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card
|mixedComponentDifference k I o η ζ| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card * |η * ζ|
Proof (Lean source)
-- @node: mixedComponentDifference_taylor_bound lemma mixedComponentDifference_taylor_bound {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (o : Fin n → Record) (η ζ M : ℝ) (hDiff : ∀ x ∈ uIcc 0 η, DifferentiableAt ℝ (fun s => mixedComponentDifference k I o s ζ) x) (hCrossDiff : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, DifferentiableAt ℝ (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y) (hCross : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, |deriv (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card) : |mixedComponentDifference k I o η ζ| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card * |η * ζ| := by exact mixture_rectangle_bound _ η ζ _ (mixedComponentDifference_zero_left k I o) (mixedComponentDifference_zero_right k I o) hDiff hCrossDiff hCross
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedComponentDifference_taylor_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedMixtureTaylor.lean:71
theorem mixedComponentDifference_singleton

Each singleton block cancels throughout the signed support neighborhood, using exact matching of the actual observed cell tables. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
i :
Fin n
o :
Fin n → Record
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
mixedComponentDifference k {i} o η ζ = 0
Proof (Lean source)
-- @node: mixedComponentDifference_singleton lemma mixedComponentDifference_singleton {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (i : Fin n) (o : Fin n → Record) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) : mixedComponentDifference k {i} o η ζ = 0 := by simp only [mixedComponentDifference, Finset.prod_singleton, recordCellDensity, ← Finset.mul_sum] have hmatch := (calib_singletons_spec k hk).1 η ζ hη hζ (o i).2.1 (o i).2.2 (o i).1 calc _ = 4 * ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, (mixedLaw false k σ η ζ).cells (o i).2.1 (o i).2.2 (o i).1) - 4 * ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, (mixedLaw true k σ η ζ).cells (o i).2.1 (o i).2.2 (o i).1) := by ring _ = 0 := by rw [hmatch]; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedComponentDifference_singleton · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedMixtureTaylor.lean:88
theorem mixed_component_hellinger_taylor_bound

[The actual mixed component square-root discrepancy follows from its rectangular Taylor estimate and one-record floors. No record independence inside the block is used. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
o :
Fin n → Record
η ζ M :
ℝ
hη :
|η| ≤ 1 / 100
hζ :
|ζ| ≤ 1 / 100
hDiff :
∀ x ∈ uIcc 0 η, DifferentiableAt ℝ (fun s => mixedComponentDifference k I o s ζ) x
hCrossDiff :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
DifferentiableAt ℝ (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y
hCross :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
|deriv (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y|
≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card
(sqrt ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - sqrt ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i))) ^ 2
≤ M ^ 4 * (I.card : ℝ) ^ 4 * 8 ^ I.card * (η * ζ) ^ 2
Proof (Lean source)
-- @node: mixed_component_hellinger_taylor_bound lemma mixed_component_hellinger_taylor_bound {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (o : Fin n → Record) (η ζ M : ℝ) (hη : |η| ≤ 1 / 100) (hζ : |ζ| ≤ 1 / 100) (hDiff : ∀ x ∈ uIcc 0 η, DifferentiableAt ℝ (fun s => mixedComponentDifference k I o s ζ) x) (hCrossDiff : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, DifferentiableAt ℝ (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y) (hCross : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, |deriv (fun s => deriv (fun r => mixedComponentDifference k I o r s) x) y| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card) : (sqrt ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - sqrt ((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i))) ^ 2 ≤ M ^ 4 * (I.card : ℝ) ^ 4 * 8 ^ I.card * (η * ζ) ^ 2 := by have hfloor (b : Bool) (σ : Fin (k + 1) → Bool) (i : Fin n) : (1 / 2 : ℝ) ≤ recordCellDensity (mixedLaw b k σ η ζ) (o i) := (mixedDensity_bounds b k σ η ζ hη hζ (o i).2.1 (o i).2.2 (o i).1).1 have hFlo := mixture_average_product_lower k I (fun σ i => recordCellDensity (mixedLaw false k σ η ζ) (o i)) (fun σ i _ => hfloor false σ i) have hGlo := mixture_average_product_lower k I (fun σ i => recordCellDensity (mixedLaw true k σ η ζ) (o i)) (fun σ i _ => hfloor true σ i) have hTaylor := mixedComponentDifference_taylor_bound k I o η ζ M hDiff hCrossDiff hCross have hDifference : |(card (Fin (k + 1) → Bool) : ℝ)⁻¹ * (∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - (card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i)| ≤ 2 * M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card * |η * ζ| := by simpa only [mixedComponentDifference, mul_sub] using hTaylor exact mixture_component_pointwise_bound I.card M (η * ζ) _ _ hFlo hGlo hDifference
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_component_hellinger_taylor_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedMixtureTaylor.lean:106
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedNullPrognosisLinear 6 declarations The null covariance vanishes, so its control risk is exactly the prognosis margin.

Null mixed prognosis spatial bounds

The null covariance vanishes, so its control risk is exactly the prognosis margin. The shared-sign Lipschitz estimate and interior logit bound preserve the prognosis amplitude, including the endpoint exponent one.

theorem mixed_table_control_risk_eq Lemma mixed_table_control_risk_eq in the paper ↗

[A positive treatment complement identifies the table's control risk with the prognosis margin minus its covariance correction. the documented result Under the stated assumptions.

Formal statement
e m c :
ℝ
he :
e < 1
= m-c/(1-e)
Proof (Lean source)
-- @node: mixed_table_control_risk_eq lemma mixed_table_control_risk_eq (e m c : ℝ) (he : e < 1) : tableCell e m c false true / (tableCell e m c false false + tableCell e m c false true) = m-c/(1-e) := by simp only [tableCell, Bool.false_eq_true, ↓reduceIte] rw [show (1-e)*(1-m)+c+((1-e)*m-c) = 1-e by ring] field_simp [show 1-e ≠ 0 by linarith]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_table_control_risk_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedNullPrognosisLinear.lean:16
theorem mixed_covariance_correction_difference_le Lemma mixed_covariance_correction_difference_le in the paper ↗

[On the fixed interior margin interval, changes in the covariance correction split into a covariance change and a treatment-margin change. the documented result Under the stated assumptions.

Formal statement
ex ez cx cz :
ℝ
hx :
|ex-1/2| ≤ 1/40
hz :
|ez-1/2| ≤ 1/40
|cx/(1-ex)-cz/(1-ez)| ≤ 3*|cx-cz|+9*|cz| *|ex-ez|
Proof (Lean source)
-- @node: mixed_covariance_correction_difference_le lemma mixed_covariance_correction_difference_le (ex ez cx cz : ℝ) (hx : |ex-1/2| ≤ 1/40) (hz : |ez-1/2| ≤ 1/40) : |cx/(1-ex)-cz/(1-ez)| ≤ 3*|cx-cz|+9*|cz| *|ex-ez| := by have hxpos : 0 < 1-ex := by linarith [(abs_le.mp hx).2] have hzpos : 0 < 1-ez := by linarith [(abs_le.mp hz).2] have hprod : 0 < (1-ex)*(1-ez) := mul_pos hxpos hzpos have hprodlo : 1/9 ≤ (1-ex)*(1-ez) := by have ha : (1/3 : ℝ) ≤ 1-ex := by linarith [(abs_le.mp hx).2] have hb : (1/3 : ℝ) ≤ 1-ez := by linarith [(abs_le.mp hz).2] nlinarith [mul_le_mul ha hb (by norm_num : (0 : ℝ) ≤ 1/3) hxpos.le] have ha : |(cx-cz)/(1-ex)| ≤ 3*|cx-cz| := by rw [abs_div, abs_of_pos hxpos] apply (div_le_iff₀ hxpos).mpr nlinarith [(abs_le.mp hx).2, abs_nonneg (cx-cz)] have hb : |cz*(ex-ez)/((1-ex)*(1-ez))| ≤ 9*|cz| *|ex-ez| := by rw [abs_div, abs_mul, abs_of_pos hprod] apply (div_le_iff₀ hprod).mpr nlinarith [mul_le_mul_of_nonneg_left hprodlo (mul_nonneg (abs_nonneg cz) (abs_nonneg (ex-ez)))] have heq : cx/(1-ex)-cz/(1-ez) = (cx-cz)/(1-ex)+cz*(ex-ez)/((1-ex)*(1-ez)) := by field_simp [ne_of_gt hxpos, ne_of_gt hzpos] ring rw [heq] exact (abs_add_le _ _).trans (add_le_add ha hb)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_covariance_correction_difference_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedNullPrognosisLinear.lean:26
theorem mixed_table_control_risk_difference_le Lemma mixed_table_control_risk_difference_le in the paper ↗

[The control-risk formula transfers covariance and margin moduli to an explicit risk modulus on the fixed interior box. the documented result Under the stated assumptions.

Formal statement
ex ez mx mz cx cz :
ℝ
hx :
|ex-1/2| ≤ 1/40
hz :
|ez-1/2| ≤ 1/40
|tableCell ex mx cx false true / (tableCell ex mx cx false false + tableCell ex mx cx false true)- tableCell ez mz cz false true / (tableCell ez mz cz false false + tableCell ez mz cz false true)|
≤ |mx-mz|+3*|cx-cz|+9*|cz| *|ex-ez|
Proof (Lean source)
-- @node: mixed_table_control_risk_difference_le lemma mixed_table_control_risk_difference_le (ex ez mx mz cx cz : ℝ) (hx : |ex-1/2| ≤ 1/40) (hz : |ez-1/2| ≤ 1/40) : |tableCell ex mx cx false true / (tableCell ex mx cx false false + tableCell ex mx cx false true)- tableCell ez mz cz false true / (tableCell ez mz cz false false + tableCell ez mz cz false true)| ≤ |mx-mz|+3*|cx-cz|+9*|cz| *|ex-ez| := by rw [mixed_table_control_risk_eq _ _ _ (by linarith [(abs_le.mp hx).2]), mixed_table_control_risk_eq _ _ _ (by linarith [(abs_le.mp hz).2])] rw [show mx-cx/(1-ex)-(mz-cz/(1-ez)) = (mx-mz)-(cx/(1-ex)-cz/(1-ez)) by ring] have hh := mixed_covariance_correction_difference_le ex ez cx cz hx hz exact (abs_sub _ _).trans (by linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_table_control_risk_difference_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedNullPrognosisLinear.lean:54
theorem mixedCells_null_control_risk_eq Lemma mixedCells_null_control_risk_eq in the paper ↗

The valid null mixed law has control risk equal to its prognosis margin. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hv :
x :
armRisk (mixedLaw false k σ η ζ) false x = 1/2+ζ*signFieldZ k σ x
Proof (Lean source)
-- @node: mixedCells_null_control_risk_eq lemma mixedCells_null_control_risk_eq (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hv : ValidCells (mixedCells false k σ η ζ)) (x : Covariate) : armRisk (mixedLaw false k σ η ζ) false x = 1/2+ζ*signFieldZ k σ x := by have he := (abs_le.mp (mixed_margin_bounds false k σ η ζ x hη hζ).1).2 simp only [Bool.false_eq_true, ↓reduceIte] at he rw [armRisk, mixedLaw, totalCellLaw_cells_of_valid _ hv] change tableCell _ _ 0 false true / (tableCell _ _ 0 false false + tableCell _ _ 0 false true) = _ rw [mixed_table_control_risk_eq _ _ 0 (by simp only [Bool.false_eq_true, ↓reduceIte]; linarith)] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_null_control_risk_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedNullPrognosisLinear.lean:70
theorem mixedCells_null_prognosis_linear Lemma mixedCells_null_prognosis_linear in the paper ↗

[The null native prognosis logit has a global Lipschitz constant linear in the prognosis amplitude, independently of the propensity amplitude. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
x z :
|prognosisLogit (mixedLaw false k σ η ζ) x- prognosisLogit (mixedLaw false k σ η ζ) z|
≤ 24*|ζ| *(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedCells_null_prognosis_linear lemma mixedCells_null_prognosis_linear (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (x z : Covariate) : |prognosisLogit (mixedLaw false k σ η ζ) x- prognosisLogit (mixedLaw false k σ η ζ) z| ≤ 24*|ζ| *(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by classical by_cases hv : ValidCells (mixedCells false k σ η ζ) · have hi (w : Covariate) := abs_le.mp (mixed_margin_bounds false k σ η ζ w hη hζ).2 change |logit (armRisk _ false x)-logit (armRisk _ false z)| ≤ _ rw [mixedCells_null_control_risk_eq k σ η ζ hη hζ hv x, mixedCells_null_control_risk_eq k σ η ζ hη hζ hv z] have hl := calibrated_logit_difference_le (1/2+ζ*signFieldZ k σ x) (1/2+ζ*signFieldZ k σ z) ⟨by linarith [(hi x).1], by linarith [(hi x).2]⟩ ⟨by linarith [(hi z).1], by linarith [(hi z).2]⟩ rw [show 1/2+ζ*signFieldZ k σ x-(1/2+ζ*signFieldZ k σ z) = ζ*(signFieldZ k σ x-signFieldZ k σ z) by ring, abs_mul] at hl have hs := mul_le_mul_of_nonneg_left (signFieldZ_lipschitz k hk σ x z) (abs_nonneg ζ) nlinarith only [hl, hs] · have hz : ∀ w, prognosisLogit (mixedLaw false k σ η ζ) w = 0 := by intro w norm_num [prognosisLogit, armRisk, mixedLaw, totalCellLaw, hv, lawFromCells, logit] rw [hz x, hz z, sub_self, abs_zero] positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_null_prognosis_linear · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedNullPrognosisLinear.lean:83
theorem mixedCells_uniform_null_prognosis_linear Lemma mixedCells_uniform_null_prognosis_linear in the paper ↗

[The null prognosis Lipschitz estimate fits the prescribed scale for all nonnegative public exponents and every calibrated rank. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
ε :
ℝ
hε :
0 < ε
hsmall :
ε ≤ 1/100
α β :
ℝ
hα :
0 ≤ α
hβ :
0 ≤ β
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
x z :
|prognosisLogit (mixedLaw false k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- prognosisLogit (mixedLaw false k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z|
≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedCells_uniform_null_prognosis_linear lemma mixedCells_uniform_null_prognosis_linear (ε : ℝ) (hε : 0 < ε) (hsmall : ε ≤ 1/100) (α β : ℝ) (hα : 0 ≤ α) (hβ : 0 ≤ β) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (x z : Covariate) : |prognosisLogit (mixedLaw false k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- prognosisLogit (mixedLaw false k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z| ≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)| := by have hη := calibrated_amplitude_abs_le ε α hε.le hα k hk have hζ := calibrated_amplitude_abs_le ε β hε.le hβ k hk have hl := mixedCells_null_prognosis_linear k hk σ _ _ (hη.trans hsmall) (hζ.trans hsmall) x z have hp : 0 ≤ ε*(k : ℝ)^(-β) := by positivity have hkpos : 0 < (k : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hrate : (k : ℝ)^(1-β) = (k : ℝ)^(-β)*(k : ℝ) := by rw [show 1-β = -β+1 by ring, Real.rpow_add hkpos, Real.rpow_one] rw [abs_of_nonneg hp] at hl have heps : 24*ε ≤ 1 := by linarith have hh := mul_le_mul_of_nonneg_right heps (Real.rpow_nonneg hkpos.le (-β)) have hh' := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hh hkpos.le) (abs_nonneg ((x : ℝ)-(z : ℝ))) rw [hrate] nlinarith only [hl, hh']
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_uniform_null_prognosis_linear · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedNullPrognosisLinear.lean:112
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedOpenNeighbourhood 2 declarations The implicit branch supplies actual bracket zeros near each zero-amplitude spatial point.

Common open mixed-calibration neighborhood

The implicit branch supplies actual bracket zeros near each zero-amplitude spatial point. The derivative floor identifies the selector uniquely there. Compactness of the spatial interval then gives a closed amplitude square inside one open set on which both the selector and every substituted cell are smooth.

theorem mixedCalibrationZero_eventually_zero Lemma mixedCalibrationZero_eventually_zero in the paper ↗

Bracket existence and uniqueness persist on ambient neighborhoods, including beyond the endpoints of the spatial interval. the documented result

Formal statement
u :
ℝ
∀ᶠ v : Fin 3 → ℝ in 𝓝 ![0,0,u], MixedCalibrationZero v
Proof (Lean source)
-- @node: mixedCalibrationZero_eventually_zero lemma mixedCalibrationZero_eventually_zero (u : ℝ) : ∀ᶠ v : Fin 3 → ℝ in 𝓝 ![0,0,u], MixedCalibrationZero v := by let F : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => mixedEquation (z.1 0) (z.1 1) (z.1 2) z.2 have hF : ContDiffAt ℝ ⊤ F (![0,0,u],1) := by change ContDiffAt ℝ ⊤ (fun z : (Fin 3 → ℝ) × ℝ => mixedEquation (z.1 0) (z.1 1) (z.1 2) z.2) (![0,0,u],1) exact (mixedEquation_contDiffAt_zero u 1).comp (![0,0,u],1) (by fun_prop : ContDiffAt ℝ ⊤ (fun z : (Fin 3 → ℝ) × ℝ => ((z.1 0,z.1 1),(z.1 2,z.2))) (![0,0,u],1)) obtain ⟨S,hS,hSmooth⟩ := hF.contDiffOn le_rfl (by simp) obtain ⟨D,hDsub,hDopen,hDbase⟩ := mem_nhds_iff.mp hS obtain ⟨U,V,g,hU,hbU,hV,hbV,hUV,hg,hgBase,hgRange,hgGraph⟩ := scalar_smooth_implicit_function 3 F D ![0,0,u] 1 hDopen hDbase (hSmooth.mono hDsub) (by simp [F,mixedEquation_zero_amplitudes]) (by change deriv (mixedEquation 0 0 u) 1 ≠ 0 rw [mixedEquation_deriv_zero]; norm_num) have hRange : ∀ᶠ v in 𝓝 ![0,0,u], g v ∈ Ioo (3/4 : ℝ) (5/4) := (hg.contDiffAt (hU.mem_nhds hbU)).continuousAt (by rw [hgBase]; exact isOpen_Ioo.mem_nhds (by constructor <;> norm_num)) filter_upwards [hU.mem_nhds hbU,hRange, mixedEquation_eventually_bracket_deriv_neg u] with v hv hgv hneg have hz : mixedEquation (v 0) (v 1) (v 2) (g v) = 0 := (hgGraph v hv (g v) (hgRange v hv)).mpr rfl have hs := mixedRoot_bracket_spec (v 0) (v 1) (v 2) ⟨g v,hgv,hz⟩ refine ⟨hs.1,hs.2,?_⟩ intro q hq he exact mixedEquation_bracket_unique (v 0) (v 1) (v 2) hneg q (mixedRoot (v 0) (v 1) (v 2)) hq hs.1 he hs.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCalibrationZero_eventually_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedOpenNeighbourhood.lean:17
theorem mixed_calibration_open_neighbourhood Lemma mixed_calibration_open_neighbourhood in the paper ↗

One common open set contains a positive closed signed amplitude square and preserves the genuine mixed branch and all fully substituted cell formulas. the documented result

Formal statement
∃ ε : ℝ, ∃ U : Set (Fin 3 → ℝ),
conclusion 1
v ∈ U :
conclusion 2
ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) U
conclusion 3
b s a y :
ContDiffOn ℝ ∞ (localMixedCell b s a y) U
Proof (Lean source)
-- @node: mixed_calibration_open_neighbourhood lemma mixed_calibration_open_neighbourhood : ∃ ε : ℝ, ∃ U : Set (Fin 3 → ℝ), 0 < ε ∧ IsOpen U ∧ mixedParameterRegion ε ⊆ U ∧ (∀ v ∈ U, MixedCalibrationZero v) ∧ ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) U ∧ (∀ b s a y, ContDiffOn ℝ ∞ (localMixedCell b s a y) U) := by let S : Set (Fin 3 → ℝ) := {v | MixedCalibrationZero v ∧ ContDiffAt ℝ ⊤ (fun w : Fin 3 → ℝ => mixedRoot (w 0) (w 1) (w 2)) v ∧ ∀ b s a y, ContDiffAt ℝ ⊤ (localMixedCell b s a y) v} let U := interior S have hbase (u : ℝ) : ![0,0,u] ∈ U := by apply mem_interior_iff_mem_nhds.mpr have hcells : ∀ᶠ v in 𝓝 ![0,0,u], ∀ b s a y, ContDiffAt ℝ ⊤ (localMixedCell b s a y) v := by simp only [Filter.eventually_all] intro b s a y exact (localMixedCell_contDiffAt_zero b s a y u).eventually (by simp) filter_upwards [mixedCalibrationZero_eventually_zero u, (mixedRoot_contDiffAt_zero u).eventually (by simp),hcells] with v hz hr hc exact ⟨hz,hr,hc⟩ have hevent : ∀ᶠ z : ℝ × ℝ in 𝓝 (0,0), ∀ u ∈ Icc (0 : ℝ) 1, ![z.1,z.2,u] ∈ U := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro u hu exact (by fun_prop : ContinuousAt (fun z : (ℝ × ℝ) × ℝ => ![z.1.1,z.1.2,z.2]) ((0,0),u)) (isOpen_interior.mem_nhds (hbase u)) obtain ⟨δ,hδ,hball⟩ := Metric.mem_nhds_iff.mp hevent refine ⟨δ/2,U,by linarith,isOpen_interior,?_,?_,?_,?_⟩ · intro v hv have hmem : (v 0,v 1) ∈ ball (0,0) δ := by rw [Metric.mem_ball,Prod.dist_eq] simp only [Real.dist_eq,sub_zero] exact max_lt (by linarith [hv.1]) (by linarith [hv.2.1]) have he : ![v 0,v 1,v 2] = v := by ext i; fin_cases i <;> rfl simpa only [he] using hball hmem (v 2) hv.2.2 · intro v hv exact (interior_subset hv).1 · intro v hv exact ((interior_subset hv).2.1.of_le le_top).contDiffWithinAt · intro b s a y v hv exact ((interior_subset hv).2.2 b s a y).of_le le_top |>.contDiffWithinAt
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_calibration_open_neighbourhood · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedOpenNeighbourhood.lean:51
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedProductDerivatives 4 declarations Leibniz differentiation bounds the mixed amplitude derivative of a finite product using only derivatives of its individual records.

Mixed partial derivatives of record products

Leibniz differentiation bounds the mixed amplitude derivative of a finite product using only derivatives of its individual records.

theorem mixture_product_mixed_derivative_bounds Lemma mixture_product_mixed_derivative_bounds in the paper ↗

[The mixed Leibniz estimate counts both diagonal and off-diagonal terms. First-coordinate differentiability is needed only near the second coordinate, so this applies inside a signed calibration neighborhood. the documented result Under the stated assumptions.

Formal statement
ι :
Type*
I :
f :
ι → ℝ → ℝ → ℝ
x y M :
ℝ
hM :
1 ≤ M
hx :
∀ᶠ z in 𝓝 y, ∀ i ∈ I, DifferentiableAt ℝ (fun r => f i r z) x
hy :
∀ i ∈ I, DifferentiableAt ℝ (f i x) y
hxy :
∀ i ∈ I, DifferentiableAt ℝ (fun z => deriv (fun r => f i r z) x) y
h0 :
∀ i ∈ I, |f i x y| ≤ 2
h1x :
∀ i ∈ I, |deriv (fun r => f i r y) x| ≤ M
h1y :
∀ i ∈ I, |deriv (f i x) y| ≤ M
h2 :
∀ i ∈ I, |deriv (fun z => deriv (fun r => f i r z) x) y| ≤ M
conclusion 1
DifferentiableAt ℝ (fun z => deriv (fun r => ∏ i ∈ I, f i r z) x) y
conclusion 2
|∏ i ∈ I, f i x y| ≤ 2 ^ I.card
conclusion 3
|deriv (fun r => ∏ i ∈ I, f i r y) x| ≤ M * (I.card : ℝ) * 2 ^ I.card
conclusion 4
|deriv (fun z => ∏ i ∈ I, f i x z) y| ≤ M * (I.card : ℝ) * 2 ^ I.card
conclusion 5
|deriv (fun z => deriv (fun r => ∏ i ∈ I, f i r z) x) y|
≤ M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card
Proof (Lean source)
-- @node: mixture_product_mixed_derivative_bounds lemma mixture_product_mixed_derivative_bounds {ι : Type*} (I : Finset ι) (f : ι → ℝ → ℝ → ℝ) (x y M : ℝ) (hM : 1 ≤ M) (hx : ∀ᶠ z in 𝓝 y, ∀ i ∈ I, DifferentiableAt ℝ (fun r => f i r z) x) (hy : ∀ i ∈ I, DifferentiableAt ℝ (f i x) y) (hxy : ∀ i ∈ I, DifferentiableAt ℝ (fun z => deriv (fun r => f i r z) x) y) (h0 : ∀ i ∈ I, |f i x y| ≤ 2) (h1x : ∀ i ∈ I, |deriv (fun r => f i r y) x| ≤ M) (h1y : ∀ i ∈ I, |deriv (f i x) y| ≤ M) (h2 : ∀ i ∈ I, |deriv (fun z => deriv (fun r => f i r z) x) y| ≤ M) : DifferentiableAt ℝ (fun z => deriv (fun r => ∏ i ∈ I, f i r z) x) y ∧ |∏ i ∈ I, f i x y| ≤ 2 ^ I.card ∧ |deriv (fun r => ∏ i ∈ I, f i r y) x| ≤ M * (I.card : ℝ) * 2 ^ I.card ∧ |deriv (fun z => ∏ i ∈ I, f i x z) y| ≤ M * (I.card : ℝ) * 2 ^ I.card ∧ |deriv (fun z => deriv (fun r => ∏ i ∈ I, f i r z) x) y| ≤ M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card := by classical induction I using Finset.induction_on with | empty => simp | @insert i I hi ih => have hxI : ∀ᶠ z in 𝓝 y, ∀ j ∈ I, DifferentiableAt ℝ (fun r => f j r z) x := hx.mono (fun z hz j hj => hz j (Finset.mem_insert_of_mem hj)) have hyI := fun j hj => hy j (Finset.mem_insert_of_mem hj) have hxyI := fun j hj => hxy j (Finset.mem_insert_of_mem hj) obtain ⟨hpd, hv, hdx, hdy, hdxy⟩ := ih hxI hyI hxyI (fun j hj => h0 j (Finset.mem_insert_of_mem hj)) (fun j hj => h1x j (Finset.mem_insert_of_mem hj)) (fun j hj => h1y j (Finset.mem_insert_of_mem hj)) (fun j hj => h2 j (Finset.mem_insert_of_mem hj)) have hxi := hx.self_of_nhds i (Finset.mem_insert_self i I) have hyi := hy i (Finset.mem_insert_self i I) have hxyi := hxy i (Finset.mem_insert_self i I) have hvi := h0 i (Finset.mem_insert_self i I) have hdi := h1x i (Finset.mem_insert_self i I) have hei := h1y i (Finset.mem_insert_self i I) have hdei := h2 i (Finset.mem_insert_self i I) have hpx : DifferentiableAt ℝ (fun r => ∏ j ∈ I, f j r y) x := DifferentiableAt.fun_finsetProd (fun j hj => hxI.self_of_nhds j hj) have hpy : DifferentiableAt ℝ (fun z => ∏ j ∈ I, f j x z) y := DifferentiableAt.fun_finsetProd hyI have hdxEq := (hxi.hasDerivAt.fun_mul hpx.hasDerivAt).deriv have hdyEq := (hyi.hasDerivAt.fun_mul hpy.hasDerivAt).deriv have hEq : (fun z => deriv (fun r => f i r z * ∏ j ∈ I, f j r z) x) =ᶠ[𝓝 y] (fun z => deriv (fun r => f i r z) x * (∏ j ∈ I, f j x z) + f i x z * deriv (fun r => ∏ j ∈ I, f j r z) x) := by filter_upwards [hx] with z hz exact ((hz i (Finset.mem_insert_self i I)).hasDerivAt.mul (DifferentiableAt.fun_finsetProd (fun j hj => hz j (Finset.mem_insert_of_mem hj))).hasDerivAt).deriv have hCross := ((hxyi.hasDerivAt.mul hpy.hasDerivAt).add (hyi.hasDerivAt.mul hpd.hasDerivAt)).congr_of_eventuallyEq hEq simp only [Finset.prod_insert hi, Finset.card_insert_of_notMem hi, Nat.cast_add, Nat.cast_one, pow_succ, pow_zero, one_mul] refine ⟨hCross.differentiableAt, ?_, ?_, ?_, ?_⟩ · rw [abs_mul] exact (mul_le_mul hvi hv (abs_nonneg _) (by norm_num)).trans_eq (by ring) · rw [hdxEq] calc _ ≤ |deriv (fun r => f i r y) x| * |∏ j ∈ I, f j x y| + |f i x y| * |deriv (fun r => ∏ j ∈ I, f j r y) x| := by simp only [← abs_mul] exact abs_add_le _ _ _ ≤ M * 2 ^ I.card + 2 * (M * (I.card : ℝ) * 2 ^ I.card) := by gcongr _ ≤ _ := by nlinarith [mul_nonneg (by linarith : 0 ≤ M) (by positivity : 0 ≤ (2 : ℝ)^I.card)] · rw [hdyEq] calc _ ≤ |deriv (f i x) y| * |∏ j ∈ I, f j x y| + |f i x y| * |deriv (fun z => ∏ j ∈ I, f j x z) y| := by simp only [← abs_mul] exact abs_add_le _ _ _ ≤ M * 2 ^ I.card + 2 * (M * (I.card : ℝ) * 2 ^ I.card) := by gcongr _ ≤ _ := by nlinarith [mul_nonneg (by linarith : 0 ≤ M) (by positivity : 0 ≤ (2 : ℝ)^I.card)] · rw [hCross.deriv] calc _ ≤ |deriv (fun z => deriv (fun r => f i r z) x) y| * |∏ j ∈ I, f j x y| + |deriv (fun r => f i r y) x| * |deriv (fun z => ∏ j ∈ I, f j x z) y| + (|deriv (f i x) y| * |deriv (fun r => ∏ j ∈ I, f j r y) x| + |f i x y| * |deriv (fun z => deriv (fun r => ∏ j ∈ I, f j r z) x) y|) := by simp only [← abs_mul] exact (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) (abs_add_le _ _)) _ ≤ M * 2 ^ I.card + M * (M * (I.card : ℝ) * 2 ^ I.card) + (M * (M * (I.card : ℝ) * 2 ^ I.card) + 2 * (M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card)) := by gcongr _ ≤ _ := by have hp : 0 ≤ (2 : ℝ) ^ I.card := by positivity have hm2 : M ≤ M ^ 2 := by nlinarith have hc : 0 ≤ (I.card : ℝ) := by positivity nlinarith [mul_nonneg (sub_nonneg.mpr hm2) hp, mul_nonneg (by positivity : 0 ≤ M ^ 2 * (I.card : ℝ)) hp]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_product_mixed_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedProductDerivatives.lean:15
theorem mixture_average_mixed_derivative_bound Lemma mixture_average_mixed_derivative_bound in the paper ↗

[Finite hidden-sign averages commute with the two amplitude derivatives; the difference of two averages costs a factor of two in the envelope. the documented result Under the stated assumptions.

Formal statement
σ :
Type*
Nonempty σ
f :
Bool → σ → ℝ → ℝ → ℝ
x y C :
ℝ
hx :
∀ᶠ z in 𝓝 y, ∀ b s, DifferentiableAt ℝ (fun r => f b s r z) x
hxy :
∀ b s, DifferentiableAt ℝ (fun z => deriv (fun r => f b s r z) x) y
hb :
∀ b s, |deriv (fun z => deriv (fun r => f b s r z) x) y| ≤ C
conclusion 1
DifferentiableAt ℝ (fun z => deriv (fun r => (Fintype.card σ : ℝ)⁻¹ * ((∑ s, f false s r z) - ∑ s, f true s r z)) x) y
conclusion 2
|deriv (fun z => deriv (fun r => (Fintype.card σ : ℝ)⁻¹ * ((∑ s, f false s r z) - ∑ s, f true s r z)) x) y|
≤ 2*C
Proof (Lean source)
-- @node: mixture_average_mixed_derivative_bound lemma mixture_average_mixed_derivative_bound {σ : Type*} [Fintype σ] [Nonempty σ] (f : Bool → σ → ℝ → ℝ → ℝ) (x y C : ℝ) (hx : ∀ᶠ z in 𝓝 y, ∀ b s, DifferentiableAt ℝ (fun r => f b s r z) x) (hxy : ∀ b s, DifferentiableAt ℝ (fun z => deriv (fun r => f b s r z) x) y) (hb : ∀ b s, |deriv (fun z => deriv (fun r => f b s r z) x) y| ≤ C) : DifferentiableAt ℝ (fun z => deriv (fun r => (Fintype.card σ : ℝ)⁻¹ * ((∑ s, f false s r z) - ∑ s, f true s r z)) x) y ∧ |deriv (fun z => deriv (fun r => (Fintype.card σ : ℝ)⁻¹ * ((∑ s, f false s r z) - ∑ s, f true s r z)) x) y| ≤ 2*C := by classical let a : ℝ := (Fintype.card σ : ℝ)⁻¹ let df := fun b s z => deriv (fun r => f b s r z) x have he : (fun z => deriv (fun r => a * ((∑ s, f false s r z) - ∑ s, f true s r z)) x) =ᶠ[𝓝 y] (fun z => a * ((∑ s, df false s z) - ∑ s, df true s z)) := by filter_upwards [hx] with z hz exact (((HasDerivAt.fun_sum (fun s _ => (hz false s).hasDerivAt)).sub (HasDerivAt.fun_sum (fun s _ => (hz true s).hasDerivAt))).const_mul a).deriv have hd := (((HasDerivAt.fun_sum (fun s _ => (hxy false s).hasDerivAt)).sub (HasDerivAt.fun_sum (fun s _ => (hxy true s).hasDerivAt))).const_mul a).congr_of_eventuallyEq he refine ⟨hd.differentiableAt, ?_⟩ rw [hd.deriv] have ha : 0 ≤ a := by dsimp [a]; positivity have hcard : (Fintype.card σ : ℝ) ≠ 0 := by positivity have havg (b : Bool) : |a * ∑ s, deriv (df b s) y| ≤ C := by calc _ = a * |∑ s, deriv (df b s) y| := by rw [abs_mul, abs_of_nonneg ha] _ ≤ a * ∑ s, |deriv (df b s) y| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ a * ∑ _s : σ, C := by gcongr with s exact hb b s _ = C := by simp [a, hcard] rw [mul_sub] have h := abs_sub_le (a * ∑ s, deriv (df false s) y) 0 (a * ∑ s, deriv (df true s) y) simp only [sub_zero, zero_sub, abs_neg] at h exact h.trans (by linarith [havg false, havg true])
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_average_mixed_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedProductDerivatives.lean:112
theorem mixedComponentDifference_cross_derivative_bound

[The actual mixed block inherits its mixed derivative envelope from one-record partial derivatives, with all calibration roots substituted. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
o :
Fin n → Record
x y M :
ℝ
hxsmall :
|x| ≤ 1/100
hysmall :
|y| ≤ 1/100
hM :
1 ≤ M
hx :
∀ᶠ z in 𝓝 y, ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x
hy :
∀ b σ i
if
i ∈ I
then
DifferentiableAt ℝ (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y
hxy :
∀ b σ i
if
i ∈ I
then
DifferentiableAt ℝ (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y
hdx :
∀ b σ i
if
i ∈ I
then
|deriv (fun r => recordCellDensity (mixedLaw b k σ r y) (o i)) x| ≤ M
hdy :
∀ b σ i
if
i ∈ I
then
|deriv (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y| ≤ M
hdxy :
∀ b σ i
if
i ∈ I
then
|deriv (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y| ≤ M
conclusion 1
DifferentiableAt ℝ (fun z => deriv (fun r => mixedComponentDifference k I o r z) x) y
conclusion 2
|deriv (fun z => deriv (fun r => mixedComponentDifference k I o r z) x) y|
≤ 2 * M^2 * (I.card : ℝ)^2 * 2^I.card
Proof (Lean source)
-- @node: mixedComponentDifference_cross_derivative_bound lemma mixedComponentDifference_cross_derivative_bound {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (o : Fin n → Record) (x y M : ℝ) (hxsmall : |x| ≤ 1/100) (hysmall : |y| ≤ 1/100) (hM : 1 ≤ M) (hx : ∀ᶠ z in 𝓝 y, ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) (hy : ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y) (hxy : ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y) (hdx : ∀ b σ i, i ∈ I → |deriv (fun r => recordCellDensity (mixedLaw b k σ r y) (o i)) x| ≤ M) (hdy : ∀ b σ i, i ∈ I → |deriv (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y| ≤ M) (hdxy : ∀ b σ i, i ∈ I → |deriv (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y| ≤ M) : DifferentiableAt ℝ (fun z => deriv (fun r => mixedComponentDifference k I o r z) x) y ∧ |deriv (fun z => deriv (fun r => mixedComponentDifference k I o r z) x) y| ≤ 2 * M^2 * (I.card : ℝ)^2 * 2^I.card := by classical let f := fun b σ i r z => recordCellDensity (mixedLaw b k σ r z) (o i) have hp (b : Bool) (σ : Fin (k+1) → Bool) := mixture_product_mixed_derivative_bounds I (f b σ) x y M hM (hx.mono (fun z hz => hz b σ)) (hy b σ) (hxy b σ) (fun i _ => by have hv := mixedDensity_bounds b k σ x y hxsmall hysmall (o i).2.1 (o i).2.2 (o i).1 change (1/2 : ℝ) ≤ f b σ i x y ∧ f b σ i x y ≤ 2 at hv rw [abs_of_nonneg (by linarith [hv.1])] exact hv.2) (hdx b σ) (hdy b σ) (hdxy b σ) have hprod : ∀ᶠ z in 𝓝 y, ∀ b σ, DifferentiableAt ℝ (fun r => ∏ i ∈ I, f b σ i r z) x := by filter_upwards [hx] with z hz b σ exact DifferentiableAt.fun_finsetProd (hz b σ) have h := mixture_average_mixed_derivative_bound (fun b σ r z => ∏ i ∈ I, f b σ i r z) x y (M^2 * (I.card : ℝ)^2 * 2^I.card) hprod (fun b σ => (hp b σ).1) (fun b σ => (hp b σ).2.2.2.2) simpa only [mixedComponentDifference, mul_assoc] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedComponentDifference_cross_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedProductDerivatives.lean:155
theorem mixed_component_hellinger_of_record_derivatives

[Product differentiation, sign averaging, axis cancellation, and rectangular Taylor control assemble the mixed component Hellinger bound directly from one-record analytic inputs. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
I :
o :
Fin n → Record
η ζ M :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hM :
1 ≤ M
hx :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
∀ᶠ z in 𝓝 y, ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x
hy :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
∀ b σ i,
i ∈ I → DifferentiableAt ℝ (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y
hxy :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
∀ b σ i,
i ∈ I → DifferentiableAt ℝ (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y
hdx :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
∀ b σ i, i ∈ I → |deriv (fun r => recordCellDensity (mixedLaw b k σ r y) (o i)) x| ≤ M
hdy :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
∀ b σ i, i ∈ I → |deriv (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y| ≤ M
hdxy :
∀ x ∈ uIcc 0 η,
∀ y ∈ uIcc 0 ζ,
∀ b σ i,
i ∈ I → |deriv (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y|
≤ M
(sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i)))^2
≤ M^4 * (I.card : ℝ)^4 * 8^I.card * (η*ζ)^2
Proof (Lean source)
-- @node: mixed_component_hellinger_of_record_derivatives lemma mixed_component_hellinger_of_record_derivatives {n : ℕ} (k : ℕ) (I : Finset (Fin n)) (o : Fin n → Record) (η ζ M : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hM : 1 ≤ M) (hx : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, ∀ᶠ z in 𝓝 y, ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) (hy : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y) (hxy : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, ∀ b σ i, i ∈ I → DifferentiableAt ℝ (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y) (hdx : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, ∀ b σ i, i ∈ I → |deriv (fun r => recordCellDensity (mixedLaw b k σ r y) (o i)) x| ≤ M) (hdy : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, ∀ b σ i, i ∈ I → |deriv (fun z => recordCellDensity (mixedLaw b k σ x z) (o i)) y| ≤ M) (hdxy : ∀ x ∈ uIcc 0 η, ∀ y ∈ uIcc 0 ζ, ∀ b σ i, i ∈ I → |deriv (fun z => deriv (fun r => recordCellDensity (mixedLaw b k σ r z) (o i)) x) y| ≤ M) : (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw false k σ η ζ) (o i)) - sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i ∈ I, recordCellDensity (mixedLaw true k σ η ζ) (o i)))^2 ≤ M^4 * (I.card : ℝ)^4 * 8^I.card * (η*ζ)^2 := by classical have hsmall (z a : ℝ) (hz : z ∈ uIcc 0 a) (ha : |a| ≤ 1/100) : |z| ≤ 1/100 := by rw [Set.mem_uIcc] at hz rcases hz with hz | hz · rw [abs_of_nonneg hz.1] exact hz.2.trans ((le_abs_self a).trans ha) · rw [abs_of_nonpos hz.2] exact (neg_le_neg hz.1).trans ((neg_le_abs a).trans ha) have hp (x : ℝ) (hxx : x ∈ uIcc 0 η) (y : ℝ) (hyy : y ∈ uIcc 0 ζ) := mixedComponentDifference_cross_derivative_bound k I o x y M (hsmall x η hxx hη) (hsmall y ζ hyy hζ) hM (hx x hxx y hyy) (hy x hxx y hyy) (hxy x hxx y hyy) (hdx x hxx y hyy) (hdy x hxx y hyy) (hdxy x hxx y hyy) apply mixed_component_hellinger_taylor_bound k I o η ζ M hη hζ ?_ (fun x hxx y hyy => (hp x hxx y hyy).1) (fun x hxx y hyy => (hp x hxx y hyy).2) intro x hxx unfold mixedComponentDifference apply DifferentiableAt.const_mul apply DifferentiableAt.sub <;> apply DifferentiableAt.fun_sum <;> intro σ _ · exact DifferentiableAt.fun_finsetProd ((hx x hxx ζ Set.right_mem_uIcc).self_of_nhds false σ) · exact DifferentiableAt.fun_finsetProd ((hx x hxx ζ Set.right_mem_uIcc).self_of_nhds true σ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_component_hellinger_of_record_derivatives · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedProductDerivatives.lean:199
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedPrognosisOscillation 5 declarations The rationalized covariance retains its effect factor.

Mixed prognosis oscillation

The rationalized covariance retains its effect factor. Control-risk displacement and the interior logit estimate give oscillation at the prognosis amplitude.

theorem covarianceBranch_effect_bound Lemma covarianceBranch_effect_bound in the paper ↗

The covariance is bounded linearly by the effect on the fixed interior box. Under the stated assumptions.

Formal statement
t e m :
ℝ
ht :
|t| ≤ 1/8
he :
|e-1/2| ≤ 1/8
hm :
|m-1/2| ≤ 1/8
|covarianceBranch t e m| ≤ |t|
Proof (Lean source)
-- @node: covarianceBranch_effect_bound lemma covarianceBranch_effect_bound (t e m : ℝ) (ht : |t| ≤ 1/8) (he : |e-1/2| ≤ 1/8) (hm : |m-1/2| ≤ 1/8) : |covarianceBranch t e m| ≤ |t| := by have hL := (covarianceBranch_local_bounds t e m ht he hm).1 obtain ⟨hel,heh⟩ := abs_le.mp he obtain ⟨hml,hmh⟩ := abs_le.mp hm let v := e*(1-e)*m*(1-m) let L := 1+(exp t-1)*(e*(1-m)+(1-e)*m) have hv : 0 ≤ v := by dsimp [v] exact mul_nonneg (mul_nonneg (mul_nonneg (by linarith) (by linarith)) (by linarith)) (by linarith) have hx : 0 ≤ e*(1-e) := mul_nonneg (by linarith) (by linarith) have hy : 0 ≤ m*(1-m) := mul_nonneg (by linarith) (by linarith) have hxhi : e*(1-e) ≤ 1/4 := by nlinarith [sq_nonneg (e-1/2)] have hyhi : m*(1-m) ≤ 1/4 := by nlinarith [sq_nonneg (m-1/2)] have hvhi : v ≤ 1/16 := by dsimp [v] nlinarith [mul_nonneg (sub_nonneg.mpr hxhi) hy] have hden : 3/4 ≤ L+sqrt (L^2-4*(exp t-1)^2*v) := hL.trans (le_add_of_nonneg_right (Real.sqrt_nonneg _)) have hc : |covarianceBranch t e m| * (L+sqrt (L^2-4*(exp t-1)^2*v)) = 2*|exp t-1| *v := by unfold covarianceBranch change |2*(exp t-1)*v/(L+sqrt (L^2-4*(exp t-1)^2*v))| * _ = _ rw [abs_div, abs_mul, abs_mul, abs_of_nonneg (by norm_num : (0:ℝ) ≤ 2), abs_of_nonneg hv, abs_of_pos (by linarith : 0 < L+sqrt (L^2-4*(exp t-1)^2*v))] exact div_mul_cancel₀ _ (by linarith) have hd := Real.abs_exp_sub_one_le (show |t| ≤ 1 by linarith) have hp := mul_le_mul_of_nonneg_right hd hv have hq := mul_le_mul_of_nonneg_left hvhi (abs_nonneg t) have hr := mul_le_mul_of_nonneg_left hden (abs_nonneg (covarianceBranch t e m)) nlinarith only [hc, hp, hq, hr, abs_nonneg t]
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_effect_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPrognosisOscillation.lean:15
theorem mixed_table_control_displacement Lemma mixed_table_control_displacement in the paper ↗

Subtracting the covariance correction bounds the control risk's displacement. Under the stated assumptions.

Formal statement
e m c :
ℝ
he :
|e-1/2| ≤ 1/40
|tableCell e m c false true / (tableCell e m c false false + tableCell e m c false true)-1/2|
≤ |m-1/2|+3*|c|
Proof (Lean source)
-- @node: mixed_table_control_displacement lemma mixed_table_control_displacement (e m c : ℝ) (he : |e-1/2| ≤ 1/40) : |tableCell e m c false true / (tableCell e m c false false + tableCell e m c false true)-1/2| ≤ |m-1/2|+3*|c| := by obtain ⟨hel,heh⟩ := abs_le.mp he have hd : 0 < 1-e := by linarith have hid : |c/(1-e)| ≤ 3*|c| := by rw [abs_div, abs_of_pos hd] apply (div_le_iff₀ hd).mpr nlinarith [abs_nonneg c] have heq : tableCell e m c false true / (tableCell e m c false false + tableCell e m c false true)-1/2 = (m-1/2)-c/(1-e) := by simp only [tableCell, Bool.false_eq_true, ↓reduceIte] rw [show (1-e)*(1-m)+c+((1-e)*m-c) = 1-e by ring] field_simp [ne_of_gt hd] <;> ring rw [heq] exact (abs_sub _ _).trans (add_le_add_right hid _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_table_control_displacement · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPrognosisOscillation.lean:50
theorem mixedCells_prognosis_displacement Lemma mixedCells_prognosis_displacement in the paper ↗

The actual native prognosis retains the prognosis amplitude in its envelope. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
x :
|prognosisLogit (mixedLaw b k σ η ζ) x| ≤ 18*|ζ|
Proof (Lean source)
-- @node: mixedCells_prognosis_displacement lemma mixedCells_prognosis_displacement (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (x : Covariate) : |prognosisLogit (mixedLaw b k σ η ζ) x| ≤ 18*|ζ| := by classical by_cases hv : ValidCells (mixedCells b k σ η ζ) · let e := if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x let m := 1/2+ζ*signFieldZ k σ x let c := if b then covarianceBranch (32*η*ζ) e m else 0 obtain ⟨he,hm⟩ := mixed_margin_bounds b k σ η ζ x hη hζ have ht : |32*η*ζ| ≤ 1/8 := by simp only [abs_mul, abs_of_pos (by norm_num : (0:ℝ) < 32)] nlinarith [mul_le_mul hη hζ (abs_nonneg ζ) (by norm_num : (0:ℝ) ≤ 1/100)] have hc : |c| ≤ 32*|η| *|ζ| := by dsimp [c] split · simpa only [abs_mul, abs_of_pos (by norm_num : (0:ℝ) < 32)] using covarianceBranch_effect_bound (32*η*ζ) e m ht (he.trans (by norm_num)) (hm.trans (by norm_num)) · simp; positivity have hcf : |c| ≤ 1/24 := by dsimp [c] split · exact (covarianceBranch_local_bounds _ _ _ ht (he.trans (by norm_num)) (hm.trans (by norm_num))).2.2 · norm_num have hmamp : |m-1/2| ≤ 2*|ζ| := by dsimp [m] simpa only [add_sub_cancel_left, abs_mul, mul_comm] using mul_le_mul_of_nonneg_left (signFieldZ_abs_le_two k σ x) (abs_nonneg ζ) have hr := mixed_table_control_displacement e m c he have hi := mixed_table_control_risk_bounds e m c he hm hcf have hl := calibrated_logit_difference_le _ (1/2) hi (by norm_num) have hh : logit (1/2) = 0 := by norm_num [logit] rw [hh, sub_zero] at hl change |logit (armRisk _ false x)| ≤ _ rw [armRisk, mixedLaw, totalCellLaw_cells_of_valid _ hv] change |logit (tableCell e m c false true / (tableCell e m c false false + tableCell e m c false true))| ≤ _ have hprod := mul_le_mul_of_nonneg_right hη (abs_nonneg ζ) nlinarith only [hc, hprod, hr, hl, hmamp, abs_nonneg ζ] · norm_num [prognosisLogit, armRisk, mixedLaw, totalCellLaw, hv, lawFromCells, logit]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_prognosis_displacement · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPrognosisOscillation.lean:73
theorem mixedCells_prognosis_oscillation Lemma mixedCells_prognosis_oscillation in the paper ↗

Two centered bounds control mixed prognosis oscillation. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
x z :
|prognosisLogit (mixedLaw b k σ η ζ) x-prognosisLogit (mixedLaw b k σ η ζ) z| ≤ 36*|ζ|
Proof (Lean source)
-- @node: mixedCells_prognosis_oscillation lemma mixedCells_prognosis_oscillation (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (x z : Covariate) : |prognosisLogit (mixedLaw b k σ η ζ) x-prognosisLogit (mixedLaw b k σ η ζ) z| ≤ 36*|ζ| := by have hx := mixedCells_prognosis_displacement b k σ η ζ hη hζ x have hz := mixedCells_prognosis_displacement b k σ η ζ hη hζ z exact (abs_sub _ _).trans (by linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_prognosis_oscillation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPrognosisOscillation.lean:116
theorem mixedCells_uniform_prognosis_oscillation Lemma mixedCells_uniform_prognosis_oscillation in the paper ↗

The oscillation estimate fits the prescribed scale at every calibrated rank. Under the stated assumptions.

Formal statement
ε :
ℝ
hε :
0 < ε
hsmall :
ε ≤ 1/100
α β :
ℝ
hα :
0 ≤ α
hβ :
0 ≤ β
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
b :
x z :
|prognosisLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- prognosisLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z|
≤ 2*(k : ℝ)^(-β)
Proof (Lean source)
-- @node: mixedCells_uniform_prognosis_oscillation lemma mixedCells_uniform_prognosis_oscillation (ε : ℝ) (hε : 0 < ε) (hsmall : ε ≤ 1/100) (α β : ℝ) (hα : 0 ≤ α) (hβ : 0 ≤ β) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (b : Bool) (x z : Covariate) : |prognosisLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- prognosisLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z| ≤ 2*(k : ℝ)^(-β) := by have hη := calibrated_amplitude_abs_le ε α hε.le hα k hk have hζ := calibrated_amplitude_abs_le ε β hε.le hβ k hk have ho := mixedCells_prognosis_oscillation b k σ _ _ (hη.trans hsmall) (hζ.trans hsmall) x z have hp : 0 ≤ ε*(k : ℝ)^(-β) := by positivity rw [abs_of_nonneg hp] at ho have hh := mul_le_mul_of_nonneg_right (show 36*ε ≤ 2 by linarith) (Real.rpow_nonneg (Nat.cast_nonneg k) (-β)) nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_uniform_prognosis_oscillation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPrognosisOscillation.lean:125
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedPropensityLinear 5 declarations Bounded root derivatives and shared endpoint gluing preserve the propensity amplitude in the global Lipschitz constant.

Mixed propensity spatial bounds

Bounded root derivatives and shared endpoint gluing preserve the propensity amplitude in the global Lipschitz constant.

theorem mixedRoot_spatial_derivative_bound Lemma mixedRoot_spatial_derivative_bound in the paper ↗

[Restricting the smooth root to its spatial coordinate preserves the first Fréchet derivative bound, since the coordinate tangent has norm one. the documented result Under the stated assumptions.

Formal statement
η ζ u B :
ℝ
hs :
ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) ![η,ζ,u]
hb :
‖iteratedFDeriv ℝ 1 (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) ![η,ζ,u]‖ ≤ B
conclusion 1
conclusion 2
|deriv (mixedRoot η ζ) u| ≤ B
Proof (Lean source)
-- @node: mixedRoot_spatial_derivative_bound lemma mixedRoot_spatial_derivative_bound (η ζ u B : ℝ) (hs : ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) ![η,ζ,u]) (hb : ‖iteratedFDeriv ℝ 1 (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) ![η,ζ,u]‖ ≤ B) : DifferentiableAt ℝ (mixedRoot η ζ) u ∧ |deriv (mixedRoot η ζ) u| ≤ B := by have hl : HasDerivAt (fun w : ℝ => ![η,ζ,w]) (single 2 1) u := by apply hasDerivAt_pi.mpr intro i fin_cases i <;> simp · exact hasDerivAt_const u η · exact hasDerivAt_const u ζ · exact hasDerivAt_id u have hd := (hs.differentiableAt (by simp)).hasFDerivAt.comp_hasDerivAt u hl change HasDerivAt (mixedRoot η ζ) _ u at hd refine ⟨hd.differentiableAt, ?_⟩ rw [hd.deriv, ← Real.norm_eq_abs] calc _ ≤ ‖fderiv ℝ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) ![η,ζ,u]‖ * ‖(single 2 (1 : ℝ) : Fin 3 → ℝ)‖ := ContinuousLinearMap.le_opNorm _ _ _ ≤ B := by simpa only [Pi.norm_single, norm_one, mul_one, norm_iteratedFDeriv_one] using hb
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_spatial_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityLinear.lean:15
theorem mixedRoot_spatial_lipschitz Lemma mixedRoot_spatial_lipschitz in the paper ↗

Equal endpoint roots and the derivative bound give a global spatial Lipschitz estimate without requiring matching endpoint derivatives. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
η ζ B :
ℝ
hd :
∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u
hb :
∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B
x z :
|mixedRoot η ζ (cellCoord k x)-mixedRoot η ζ (cellCoord k z)|
≤ B*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedRoot_spatial_lipschitz lemma mixedRoot_spatial_lipschitz (k : ℕ) (hk : 1 ≤ k) (η ζ B : ℝ) (hd : ∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u) (hb : ∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B) (x z : Covariate) : |mixedRoot η ζ (cellCoord k x)-mixedRoot η ζ (cellCoord k z)| ≤ B*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by apply cellCoord_comp_lipschitz k hk _ B _ (mixedRoot_endpoints η ζ).symm intro u hu v hv simpa only [Real.norm_eq_abs] using (convex_Icc (0 : ℝ) 1).norm_image_sub_le_of_norm_deriv_le hd (by simpa only [Real.norm_eq_abs] using hb) hv hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_spatial_lipschitz · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityLinear.lean:38
theorem mixedRoot_signField_lipschitz Lemma mixedRoot_signField_lipschitz in the paper ↗

[The bounded root times the sign field has Lipschitz constant at most five plus twice the root derivative bound, multiplied by rank. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
η ζ B :
ℝ
hB :
0 ≤ B
hd :
∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u
hb :
∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B
x z :
|mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x- mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z|
≤ (5+2*B)*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedRoot_signField_lipschitz lemma mixedRoot_signField_lipschitz (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (η ζ B : ℝ) (hB : 0 ≤ B) (hd : ∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u) (hb : ∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B) (x z : Covariate) : |mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x- mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z| ≤ (5+2*B)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by have hr := mixedRoot_spatial_lipschitz k hk η ζ B hd hb x z have hs := signFieldZ_lipschitz k hk σ x z have hq := mixedRoot_mem_bracket η ζ (cellCoord k x) have hqa : |mixedRoot η ζ (cellCoord k x)| ≤ 5/4 := by rw [abs_of_pos (by linarith [hq.1])]; exact hq.2.le have hsz := signFieldZ_abs_le_two k σ z calc _ = |mixedRoot η ζ (cellCoord k x)*(signFieldZ k σ x-signFieldZ k σ z)+ (mixedRoot η ζ (cellCoord k x)-mixedRoot η ζ (cellCoord k z))*signFieldZ k σ z| := by congr 1; ring _ ≤ |mixedRoot η ζ (cellCoord k x)*(signFieldZ k σ x-signFieldZ k σ z)|+ |(mixedRoot η ζ (cellCoord k x)-mixedRoot η ζ (cellCoord k z))*signFieldZ k σ z| := abs_add_le _ _ _ ≤ (5/4)*(4*(k : ℝ)*|(x : ℝ)-(z : ℝ)|)+ (B*(k : ℝ)*|(x : ℝ)-(z : ℝ)|)*2 := by simp only [abs_mul] exact add_le_add (mul_le_mul hqa hs (abs_nonneg _) (by norm_num)) (mul_le_mul hr hsz (abs_nonneg _) (by positivity)) _ = _ := by ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_signField_lipschitz · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityLinear.lean:53
theorem mixedCells_propensity_linear_of_root Lemma mixedCells_propensity_linear_of_root in the paper ↗

[Interior logits transfer the margin's amplitude-preserving spatial bound to the actual mixed law; the totalization fallback is constant. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
b :
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
η ζ B :
ℝ
hB :
0 ≤ B
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hd :
∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u
hb :
∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B
x z :
|propensityLogit (mixedLaw b k σ η ζ) x-propensityLogit (mixedLaw b k σ η ζ) z|
≤ 6*|η| *(5+2*B)*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedCells_propensity_linear_of_root lemma mixedCells_propensity_linear_of_root (b : Bool) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (η ζ B : ℝ) (hB : 0 ≤ B) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hd : ∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (mixedRoot η ζ) u) (hb : ∀ u ∈ Icc (0 : ℝ) 1, |deriv (mixedRoot η ζ) u| ≤ B) (x z : Covariate) : |propensityLogit (mixedLaw b k σ η ζ) x-propensityLogit (mixedLaw b k σ η ζ) z| ≤ 6*|η| *(5+2*B)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by classical by_cases hv : ValidCells (mixedCells b k σ η ζ) · have hi (w : Covariate) := abs_le.mp (mixed_margin_bounds b k σ η ζ w hη hζ).1 change |logit (propensity _ x)-logit (propensity _ z)| ≤ _ rw [mixedCells_propensity_eq b k σ η ζ hv x, mixedCells_propensity_eq b k σ η ζ hv z] have hl := calibrated_logit_difference_le (if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x) (if b then 1/2-η*mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z else 1/2+η*mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z) ⟨by linarith [(hi x).1], by linarith [(hi x).2]⟩ ⟨by linarith [(hi z).1], by linarith [(hi z).2]⟩ have hp := mul_le_mul_of_nonneg_left (mixedRoot_signField_lipschitz k hk σ η ζ B hB hd hb x z) (abs_nonneg η) have he : |(if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x)- (if b then 1/2-η*mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z else 1/2+η*mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z)| = |η| *|mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x-mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z| := by cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] · rw [show 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x-(1/2+η*mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z) = η*(mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x-mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z) by ring, abs_mul] · rw [show 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x-(1/2-η*mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z) = -η*(mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x-mixedRoot η ζ (cellCoord k z)*signFieldZ k σ z) by ring, abs_mul, abs_neg] rw [he] at hl nlinarith · have hz : ∀ w, propensityLogit (mixedLaw b k σ η ζ) w = 0 := by intro w norm_num [propensityLogit, propensity, mixedLaw, totalCellLaw, hv, lawFromCells, logit] rw [hz x, hz z, sub_self, abs_zero] positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_propensity_linear_of_root · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityLinear.lean:82
theorem mixedCells_uniform_propensity_linear Lemma mixedCells_uniform_propensity_linear in the paper ↗

A fixed positive radius makes the mixed propensity Lipschitz constant fit the prescribed scale for every nonnegative exponent pair and every rank. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
∃ r : ℝ,
0 < r
r ≤ 1/100
conclusion 1
ε :
ℝ
0 < ε
ε ≤ r
α β :
ℝ
0 ≤ α
0 ≤ β
k :
ℕ
1 ≤ k
σ :
Fin (k+1) → Bool
b x z :
|propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z|
≤ (k : ℝ)^(1-α)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: mixedCells_uniform_propensity_linear lemma mixedCells_uniform_propensity_linear : ∃ r : ℝ, 0 < r ∧ r ≤ 1/100 ∧ ∀ ε : ℝ, 0 < ε → ε ≤ r → ∀ α β : ℝ, 0 ≤ α → 0 ≤ β → ∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k+1) → Bool, ∀ b x z, |propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z| ≤ (k : ℝ)^(1-α)*|(x : ℝ)-(z : ℝ)| := by obtain ⟨a, ha, hs, hbounds⟩ := mixedRoot_uniform_smooth_derivative_bounds obtain ⟨B,hB,hb⟩ := hbounds 1 let r := min a (min (1/100) (1/(6*(5+2*B)))) have hr : 0 < r := lt_min ha (lt_min (by norm_num) (by positivity)) have hra : r ≤ a := min_le_left _ _ have hrsmall : r ≤ 1/100 := (min_le_right _ _).trans (min_le_left _ _) have hrcoef : 6*(5+2*B)*r ≤ 1 := by have hh : r ≤ 1/(6*(5+2*B)) := (min_le_right _ _).trans (min_le_right _ _) have hh' := (le_div_iff₀ (show 0 < 6*(5+2*B) by positivity)).mp hh nlinarith refine ⟨r,hr,hrsmall,?_⟩ intro ε hε hεr α β hα hβ k hk σ b x z let η := ε*(k : ℝ)^(-α) let ζ := ε*(k : ℝ)^(-β) have hη : |η| ≤ r := (calibrated_amplitude_abs_le ε α hε.le hα k hk).trans hεr have hζ : |ζ| ≤ r := (calibrated_amplitude_abs_le ε β hε.le hβ k hk).trans hεr have hroot (u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) := mixedRoot_spatial_derivative_bound η ζ u B (hs ![η,ζ,u] (hη.trans hra) (hζ.trans hra) hu) (hb ![η,ζ,u] (hη.trans hra) (hζ.trans hra) hu) have hl := mixedCells_propensity_linear_of_root b k hk σ η ζ B hB.le (hη.trans hrsmall) (hζ.trans hrsmall) (fun u hu => (hroot u hu).1) (fun u hu => (hroot u hu).2) x z have heps : 6*(5+2*B)*ε ≤ 1 := (mul_le_mul_of_nonneg_left hεr (by positivity)).trans hrcoef have hηpos : 0 ≤ η := by dsimp [η]; positivity have hkpos : 0 < (k : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hrate : (k : ℝ)^(1-α) = (k : ℝ)^(-α)*(k : ℝ) := by rw [show 1-α = -α+1 by ring,Real.rpow_add hkpos,Real.rpow_one] calc _ ≤ 6*|η| *(5+2*B)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := hl _ ≤ (k : ℝ)^(1-α)*|(x : ℝ)-(z : ℝ)| := by rw [hrate,abs_of_nonneg hηpos] dsimp [η] have hh := mul_le_mul_of_nonneg_right heps (Real.rpow_nonneg hkpos.le (-α)) have hh' := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hh hkpos.le) (abs_nonneg ((x : ℝ)-(z : ℝ))) nlinarith [hh']
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_uniform_propensity_linear · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityLinear.lean:119
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedPropensityOscillation 5 declarations The root bracket and bounded sign field give linear displacement from one half.

Mixed propensity oscillation

The root bracket and bounded sign field give linear displacement from one half. The interior logit bound transfers it to the native propensity and its oscillation.

theorem mixedCells_propensity_eq Lemma mixedCells_propensity_eq in the paper ↗

The literal treatment margin is the propensity whenever the cells are valid. Under the stated assumptions. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hv :
ValidCells (mixedCells b k σ η ζ)
x :
propensity (mixedLaw b k σ η ζ) x
= (if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x)
Proof (Lean source)
-- @node: mixedCells_propensity_eq lemma mixedCells_propensity_eq (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hv : ValidCells (mixedCells b k σ η ζ)) (x : Covariate) : propensity (mixedLaw b k σ η ζ) x = (if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x) := by rw [propensity, mixedLaw, totalCellLaw_cells_of_valid _ hv] simp only [mixedCells, tableCell, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_propensity_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityOscillation.lean:15
theorem mixed_margin_displacement Lemma mixed_margin_displacement in the paper ↗

Root and sign bounds retain the amplitude factor in the margin displacement. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
x :
|(if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x)-1/2|
≤ (5/2)*|η|
Proof (Lean source)
-- @node: mixed_margin_displacement lemma mixed_margin_displacement (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (x : Covariate) : |(if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x)-1/2| ≤ (5/2)*|η| := by have hq := mixedRoot_mem_bracket η ζ (cellCoord k x) have hqa : |mixedRoot η ζ (cellCoord k x)| ≤ 5/4 := by rw [abs_of_pos (by linarith [hq.1])] exact hq.2.le have hs := signFieldZ_abs_le_two k σ x have hp : |η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x| ≤ (5/2)*|η| := by simp only [abs_mul] calc _ ≤ (|η| *(5/4))*2 := mul_le_mul (mul_le_mul_of_nonneg_left hqa (abs_nonneg η)) hs (abs_nonneg _) (by positivity) _ = _ := by ring cases b <;> simpa using hp
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_margin_displacement · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityOscillation.lean:26
theorem mixedCells_propensity_displacement Lemma mixedCells_propensity_displacement in the paper ↗

The native propensity logit has linear displacement, including fallback laws. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
x :
|propensityLogit (mixedLaw b k σ η ζ) x| ≤ 15*|η|
Proof (Lean source)
-- @node: mixedCells_propensity_displacement lemma mixedCells_propensity_displacement (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (x : Covariate) : |propensityLogit (mixedLaw b k σ η ζ) x| ≤ 15*|η| := by classical by_cases hv : ValidCells (mixedCells b k σ η ζ) · have hm := (mixed_margin_bounds b k σ η ζ x hη hζ).1 have hp := mixed_margin_displacement b k σ η ζ x have hi := abs_le.mp hm change |logit (propensity (mixedLaw b k σ η ζ) x)| ≤ _ rw [mixedCells_propensity_eq b k σ η ζ hv x] have hl := calibrated_logit_difference_le (if b then 1/2-η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x else 1/2+η*mixedRoot η ζ (cellCoord k x)*signFieldZ k σ x) (1/2) ⟨by linarith [hi.1], by linarith [hi.2]⟩ (by norm_num) have hhalf : logit (1/2) = 0 := by norm_num [logit] rw [hhalf, sub_zero] at hl linarith · norm_num [propensityLogit, propensity, mixedLaw, totalCellLaw, hv, lawFromCells, logit]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_propensity_displacement · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityOscillation.lean:47
theorem mixedCells_propensity_oscillation Lemma mixedCells_propensity_oscillation in the paper ↗

Two centered displacements bound the oscillation at the propensity amplitude. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k+1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
x z :
|propensityLogit (mixedLaw b k σ η ζ) x- propensityLogit (mixedLaw b k σ η ζ) z| ≤ 30*|η|
Proof (Lean source)
-- @node: mixedCells_propensity_oscillation lemma mixedCells_propensity_oscillation (b : Bool) (k : ℕ) (σ : Fin (k+1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (x z : Covariate) : |propensityLogit (mixedLaw b k σ η ζ) x- propensityLogit (mixedLaw b k σ η ζ) z| ≤ 30*|η| := by have hx := mixedCells_propensity_displacement b k σ η ζ hη hζ x have hz := mixedCells_propensity_displacement b k σ η ζ hη hζ z exact (abs_sub _ _).trans (by linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_propensity_oscillation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityOscillation.lean:68
theorem mixedCells_uniform_propensity_oscillation Lemma mixedCells_uniform_propensity_oscillation in the paper ↗

[Every sufficiently small calibration radius gives the prescribed oscillation uniformly over ranks and nonnegative exponents, for both mixed constructions. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
ε :
ℝ
hε :
0 < ε
hsmall :
ε ≤ 1/100
α β :
ℝ
hα :
0 ≤ α
hβ :
0 ≤ β
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
b :
x z :
|propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z|
≤ 2*(k : ℝ)^(-α)
Proof (Lean source)
-- @node: mixedCells_uniform_propensity_oscillation lemma mixedCells_uniform_propensity_oscillation (ε : ℝ) (hε : 0 < ε) (hsmall : ε ≤ 1/100) (α β : ℝ) (hα : 0 ≤ α) (hβ : 0 ≤ β) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (b : Bool) (x z : Covariate) : |propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- propensityLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z| ≤ 2*(k : ℝ)^(-α) := by have hη := calibrated_amplitude_abs_le ε α hε.le hα k hk have hζ := calibrated_amplitude_abs_le ε β hε.le hβ k hk have ho := mixedCells_propensity_oscillation b k σ _ _ (hη.trans hsmall) (hζ.trans hsmall) x z have hp : 0 ≤ ε*(k : ℝ)^(-α) := by positivity rw [abs_of_nonneg hp] at ho have he : 30*ε ≤ 2 := by linarith have hh := mul_le_mul_of_nonneg_right he (Real.rpow_nonneg (Nat.cast_nonneg k) (-α)) nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_uniform_propensity_oscillation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedPropensityOscillation.lean:78
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedRootExistence 7 declarations Positive table denominators and uniform sign separation follow from continuity on the compact zero-amplitude parameter rectangle.

Uniform existence of the mixed calibration root

Positive table denominators and uniform sign separation follow from continuity on the compact zero-amplitude parameter rectangle. The intermediate value theorem then supplies a root in the prescribed open bracket for small signed amplitudes.

The exponential divided difference is continuous also at zero. The stated conclusion follows.

Formal statement
Proof (Lean source)
-- @node: dividedExp_continuous @[fun_prop] lemma dividedExp_continuous : Continuous dividedExp := by unfold dividedExp exact intervalIntegral.continuous_parametric_intervalIntegral_of_continuous' (f := fun t s : ℝ => exp (s*t)) (by fun_prop) 0 1
CausalSmith.Stat.LogoddsLowsmoothFrontier.dividedExp_continuous · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootExistence.lean:18

Denominator of one normalized mixed table, before selecting a root.

Definition (Lean source)
η ζ u q :
ℝ
s :
mixedTableDenominator η ζ u q s :
ℝ
t :
32*η*ζ
ξ :
1/2-η*q*localSignField u s
υ :
1/2+ζ*localSignField u s
d :
exp t-1
v :
ξ*(1-ξ)*υ*(1-υ)
L :
1+d*(ξ*(1-υ)+(1-ξ)*υ)
L+sqrt (L^2-4*d^2*v)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedTableDenominator · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootExistence.lean:25
theorem mixedTableDenominator_continuous

Each mixed-table denominator varies continuously with all parameters. The stated conclusion follows.

Formal statement
s :
Continuous (fun v : (ℝ × ℝ) × (ℝ × ℝ) => mixedTableDenominator v.1.1 v.1.2 v.2.1 v.2.2 s)
Proof (Lean source)
-- @node: mixedTableDenominator_continuous @[fun_prop] lemma mixedTableDenominator_continuous (s : Bool × Bool) : Continuous (fun v : (ℝ × ℝ) × (ℝ × ℝ) => mixedTableDenominator v.1.1 v.1.2 v.2.1 v.2.2 s) := by unfold mixedTableDenominator localSignField fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedTableDenominator_continuous · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootExistence.lean:36
theorem mixedEquation_continuousAt

The mixed equation is continuous wherever its finitely many denominators are nonzero. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
v :
(ℝ × ℝ) × (ℝ × ℝ)
hv :
∀ s, mixedTableDenominator v.1.1 v.1.2 v.2.1 v.2.2 s ≠ 0
ContinuousAt (fun w : (ℝ × ℝ) × (ℝ × ℝ) => mixedEquation w.1.1 w.1.2 w.2.1 w.2.2) v
Proof (Lean source)
-- @node: mixedEquation_continuousAt lemma mixedEquation_continuousAt (v : (ℝ × ℝ) × (ℝ × ℝ)) (hv : ∀ s, mixedTableDenominator v.1.1 v.1.2 v.2.1 v.2.2 s ≠ 0) : ContinuousAt (fun w : (ℝ × ℝ) × (ℝ × ℝ) => mixedEquation w.1.1 w.1.2 w.2.1 w.2.2) v := by unfold mixedEquation signAverage apply ContinuousAt.sub · apply ContinuousAt.const_mul apply ContinuousAt.const_mul apply tendsto_finsetSum intro s hs unfold normalizedBranch dsimp only apply ContinuousAt.div · unfold localSignField fun_prop · exact (mixedTableDenominator_continuous s).continuousAt · exact hv s · fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_continuousAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootExistence.lean:44
theorem mixedEquation_zero_amplitudes Lemma mixedEquation_zero_amplitudes in the paper ↗

At zero amplitudes the equation is the affine function with root one. the stated conclusion holds.

Formal statement
u q :
ℝ
mixedEquation 0 0 u q = 1-q
Proof (Lean source)
-- @node: mixedEquation_zero_amplitudes lemma mixedEquation_zero_amplitudes (u q : ℝ) : mixedEquation 0 0 u q = 1-q := by norm_num [mixedEquation, signAverage, normalizedBranch, dividedExp]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_zero_amplitudes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootExistence.lean:65
theorem mixedEquation_uniform_neighbourhood

Compactness gives one signed amplitude square with positive denominators and separated signs. the stated conclusion holds.

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
η ζ u q :
ℝ
|η| ≤ ε
|ζ| ≤ ε
u ∈ Icc (0 : ℝ) 1
q ∈ Icc (7/8 : ℝ) (9/8)
s :
0 < mixedTableDenominator η ζ u q s
|mixedEquation η ζ u q - (1-q)| < 1/16
Proof (Lean source)
-- @node: mixedEquation_uniform_neighbourhood lemma mixedEquation_uniform_neighbourhood : ∃ ε : ℝ, 0 < ε ∧ ∀ η ζ u q : ℝ, |η| ≤ ε → |ζ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → q ∈ Icc (7/8 : ℝ) (9/8) → (∀ s, 0 < mixedTableDenominator η ζ u q s) ∧ |mixedEquation η ζ u q - (1-q)| < 1/16 := by let K := Icc (0 : ℝ) 1 ×ˢ Icc (7/8 : ℝ) (9/8) have hK : IsCompact K := isCompact_Icc.prod isCompact_Icc have hevent : ∀ᶠ a : ℝ × ℝ in 𝓝 (0,0), ∀ z ∈ K, (∀ s, 0 < mixedTableDenominator a.1 a.2 z.1 z.2 s) ∧ |mixedEquation a.1 a.2 z.1 z.2 - (1-z.2)| < 1/16 := by apply hK.eventually_forall_of_forall_eventually intro z hz have hden : ∀ s, ∀ᶠ w : (ℝ × ℝ) × (ℝ × ℝ) in 𝓝 ((0,0),z), 0 < mixedTableDenominator w.1.1 w.1.2 w.2.1 w.2.2 s := by intro s exact (mixedTableDenominator_continuous s).continuousAt.eventually (lt_mem_nhds (show 0 < mixedTableDenominator 0 0 z.1 z.2 s by norm_num [mixedTableDenominator])) have hF := mixedEquation_continuousAt ((0,0),z) (by intro s; norm_num [mixedTableDenominator]) have hE : ContinuousAt (fun w : (ℝ × ℝ) × (ℝ × ℝ) => |mixedEquation w.1.1 w.1.2 w.2.1 w.2.2 - (1-w.2.2)|) ((0,0),z) := by exact (hF.sub (by fun_prop)).abs have hsmall := hE.eventually (gt_mem_nhds (by simp [mixedEquation_zero_amplitudes] : |mixedEquation 0 0 z.1 z.2 - (1-z.2)| < (1/16 : ℝ))) exact ((eventually_all.mpr hden).and hsmall) obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhds_iff.mp hevent refine ⟨δ/2, by linarith, ?_⟩ intro η ζ u q hη hζ hu hq have hmem : (η,ζ) ∈ ball (0,0) δ := by rw [Metric.mem_ball, Prod.dist_eq] simp only [Real.dist_eq, sub_zero] exact max_lt (by linarith) (by linarith) exact hball hmem (u,q) ⟨hu,hq⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_uniform_neighbourhood · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootExistence.lean:70
theorem mixedEquation_uniform_exists Lemma mixedEquation_uniform_exists in the paper ↗

Uniform sign separation and continuity provide a genuine interior mixed root. the stated conclusion holds.

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
η ζ u :
ℝ
|η| ≤ ε
|ζ| ≤ ε
u ∈ Icc (0 : ℝ) 1
∃ q : ℝ,
q ∈ Ioo (3/4) (5/4)
mixedEquation η ζ u q = 0
Proof (Lean source)
-- @node: mixedEquation_uniform_exists lemma mixedEquation_uniform_exists : ∃ ε : ℝ, 0 < ε ∧ ∀ η ζ u : ℝ, |η| ≤ ε → |ζ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → ∃ q : ℝ, q ∈ Ioo (3/4) (5/4) ∧ mixedEquation η ζ u q = 0 := by obtain ⟨ε, hε, hlocal⟩ := mixedEquation_uniform_neighbourhood refine ⟨ε,hε,?_⟩ intro η ζ u hη hζ hu have hcont : ContinuousOn (mixedEquation η ζ u) (Icc (7/8 : ℝ) (9/8)) := by intro q hq have h := mixedEquation_continuousAt ((η,ζ),(u,q)) (fun s => ne_of_gt ((hlocal η ζ u q hη hζ hu hq).1 s)) exact (h.comp (f := fun q : ℝ => ((η,ζ),(u,q))) (by fun_prop)).continuousWithinAt have hlo := (hlocal η ζ u (7/8) hη hζ hu (by constructor <;> norm_num)).2 have hhi := (hlocal η ζ u (9/8) hη hζ hu (by constructor <;> norm_num)).2 obtain ⟨q,hq,heq⟩ := intermediate_value_Icc' (by norm_num : (7/8 : ℝ) ≤ 9/8) hcont (show (0 : ℝ) ∈ Icc (mixedEquation η ζ u (9/8)) (mixedEquation η ζ u (7/8)) from ⟨by linarith [(abs_lt.mp hhi).2], by linarith [(abs_lt.mp hlo).1]⟩) exact ⟨q, ⟨by linarith [hq.1], by linarith [hq.2]⟩, heq⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_uniform_exists · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootExistence.lean:107
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedRootSmoothness 6 declarations Local implicit branches agree with the literal bracket selector by the uniform negative derivative floor.

Smoothness of the actual mixed root

Local implicit branches agree with the literal bracket selector by the uniform negative derivative floor. Compactness extends their smoothness to a single signed amplitude neighborhood, including the spatial endpoints.

The literal mixed selector chooses a bracket zero whenever one exists. the stated conclusion holds. Under the stated assumptions.

Formal statement
η ζ u :
ℝ
h :
∃ q ∈ Ioo (3/4 : ℝ) (5/4), mixedEquation η ζ u q = 0
conclusion 1
mixedRoot η ζ u ∈ Ioo (3/4 : ℝ) (5/4)
conclusion 2
mixedEquation η ζ u (mixedRoot η ζ u) = 0
Proof (Lean source)
-- @node: mixedRoot_bracket_spec lemma mixedRoot_bracket_spec (η ζ u : ℝ) (h : ∃ q ∈ Ioo (3/4 : ℝ) (5/4), mixedEquation η ζ u q = 0) : mixedRoot η ζ u ∈ Ioo (3/4 : ℝ) (5/4) ∧ mixedEquation η ζ u (mixedRoot η ζ u) = 0 := by rw [mixedRoot, dif_pos h] exact Classical.choose_spec h
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_bracket_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootSmoothness.lean:17
theorem mixedRoot_zero_amplitudes Lemma mixedRoot_zero_amplitudes in the paper ↗

At zero amplitudes the selector is exactly the affine-equation root one. the stated conclusion holds.

Formal statement
u :
ℝ
mixedRoot 0 0 u = 1
Proof (Lean source)
-- @node: mixedRoot_zero_amplitudes lemma mixedRoot_zero_amplitudes (u : ℝ) : mixedRoot 0 0 u = 1 := by have h : ∃ q ∈ Ioo (3/4 : ℝ) (5/4), mixedEquation 0 0 u q = 0 := ⟨1, by constructor <;> norm_num, by rw [mixedEquation_zero_amplitudes]; ring⟩ have hz := (mixedRoot_bracket_spec 0 0 u h).2 rw [mixedEquation_zero_amplitudes] at hz linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_zero_amplitudes · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootSmoothness.lean:26
theorem mixedEquation_eventually_bracket_deriv_neg Lemma mixedEquation_eventually_bracket_deriv_neg in the paper ↗

The derivative floor holds on the whole bracket for parameters in a full neighborhood of every zero-amplitude spatial point, even at the endpoints. the documented result

Formal statement
u :
ℝ
∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∀ q ∈ Icc (3/4 : ℝ) (5/4), deriv (mixedEquation (a 0) (a 1) (a 2)) q < -1/2
Proof (Lean source)
-- @node: mixedEquation_eventually_bracket_deriv_neg lemma mixedEquation_eventually_bracket_deriv_neg (u : ℝ) : ∀ᶠ a : Fin 3 → ℝ in 𝓝 ![0,0,u], ∀ q ∈ Icc (3/4 : ℝ) (5/4), deriv (mixedEquation (a 0) (a 1) (a 2)) q < -1/2 := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro q hq have hc : ContinuousAt (fun z : (Fin 3 → ℝ) × ℝ => deriv (mixedEquation (z.1 0) (z.1 1) (z.1 2)) z.2) (![0,0,u],q) := by exact (mixedEquation_partial_continuousAt_zero u q).comp (f := fun z : (Fin 3 → ℝ) × ℝ => ((z.1 0,z.1 1),(z.1 2,z.2))) (by fun_prop : ContinuousAt (fun z : (Fin 3 → ℝ) × ℝ => ((z.1 0,z.1 1),(z.1 2,z.2))) (![0,0,u],q)) exact hc.eventually (gt_mem_nhds (by simp only [mixedEquation_deriv_zero]; norm_num : deriv (mixedEquation 0 0 u) q < (-1/2 : ℝ)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_eventually_bracket_deriv_neg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootSmoothness.lean:35
theorem mixedRoot_contDiffAt_zero Lemma mixedRoot_contDiffAt_zero in the paper ↗

The actual selected mixed root is smooth through both signed amplitude axes at every spatial point. Local uniqueness identifies it with the implicit branch. the documented result

Formal statement
u :
ℝ
ContDiffAt ℝ ⊤ (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) ![0,0,u]
Proof (Lean source)
-- @node: mixedRoot_contDiffAt_zero lemma mixedRoot_contDiffAt_zero (u : ℝ) : ContDiffAt ℝ ⊤ (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) ![0,0,u] := by let F : ((Fin 3 → ℝ) × ℝ) → ℝ := fun z => mixedEquation (z.1 0) (z.1 1) (z.1 2) z.2 apply scalar_bracket_selector_contDiffAt 3 F (fun a => mixedRoot (a 0) (a 1) (a 2)) ![0,0,u] (3/4) (5/4) · rw [show mixedRoot (![0,0,u] 0) (![0,0,u] 1) (![0,0,u] 2) = 1 from mixedRoot_zero_amplitudes u] exact (mixedEquation_contDiffAt_zero u 1).comp (![0,0,u],1) (by fun_prop : ContDiffAt ℝ ⊤ (fun z : (Fin 3 → ℝ) × ℝ => ((z.1 0,z.1 1),(z.1 2,z.2))) (![0,0,u],1)) · simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val, mixedRoot_zero_amplitudes] constructor <;> norm_num · simp [F, mixedRoot_zero_amplitudes, mixedEquation_zero_amplitudes] · simpa [F, mixedRoot_zero_amplitudes] using (show deriv (mixedEquation 0 0 u) 1 ≠ 0 by rw [mixedEquation_deriv_zero]; norm_num) · intro a ha exact mixedRoot_bracket_spec (a 0) (a 1) (a 2) ha · filter_upwards [mixedEquation_eventually_bracket_deriv_neg u] with a ha intro p hp q hq hep heq exact mixedEquation_bracket_unique (a 0) (a 1) (a 2) ha p q hp hq hep heq
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_contDiffAt_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootSmoothness.lean:54
theorem mixedRoot_uniform_contDiffAt Lemma mixedRoot_uniform_contDiffAt in the paper ↗

Smoothness of the literal selector holds on one absolute closed signed amplitude square, on full neighborhoods even at its spatial endpoints. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
η ζ u :
ℝ
|η| ≤ ε
|ζ| ≤ ε
u ∈ Icc (0 : ℝ) 1
ContDiffAt ℝ ⊤ (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) ![η,ζ,u]
Proof (Lean source)
-- @node: mixedRoot_uniform_contDiffAt lemma mixedRoot_uniform_contDiffAt : ∃ ε : ℝ, 0 < ε ∧ ∀ η ζ u : ℝ, |η| ≤ ε → |ζ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → ContDiffAt ℝ ⊤ (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) ![η,ζ,u] := by have hevent : ∀ᶠ a : ℝ × ℝ in 𝓝 (0,0), ∀ u ∈ Icc (0 : ℝ) 1, ContDiffAt ℝ ⊤ (fun v : Fin 3 → ℝ => mixedRoot (v 0) (v 1) (v 2)) ![a.1,a.2,u] := by apply isCompact_Icc.eventually_forall_of_forall_eventually intro u hu obtain ⟨S, hS, hSmooth⟩ := (mixedRoot_contDiffAt_zero u).contDiffOn le_rfl (by simp) obtain ⟨D, hDsub, hDopen, hDbase⟩ := mem_nhds_iff.mp hS have hpre : ∀ᶠ z : (ℝ × ℝ) × ℝ in 𝓝 ((0,0),u), ![z.1.1,z.1.2,z.2] ∈ D := (by fun_prop : ContinuousAt (fun z : (ℝ × ℝ) × ℝ => ![z.1.1,z.1.2,z.2]) ((0,0),u)) (hDopen.mem_nhds hDbase) filter_upwards [hpre] with z hz exact (hSmooth.mono hDsub).contDiffAt (hDopen.mem_nhds hz) obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhds_iff.mp hevent refine ⟨δ/2, by linarith, ?_⟩ intro η ζ u hη hζ hu have hmem : (η,ζ) ∈ ball (0,0) δ := by rw [Metric.mem_ball, Prod.dist_eq] simp only [Real.dist_eq, sub_zero] exact max_lt (by linarith) (by linarith) exact hball hmem u hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_uniform_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootSmoothness.lean:80
theorem mixedRoot_uniform_smooth_derivative_bounds Lemma mixedRoot_uniform_smooth_derivative_bounds in the paper ↗

On the same signed neighborhood, every fixed derivative order of the actual mixed selector has a finite absolute bound. the documented result

Formal statement
∃ ε : ℝ,
0 < ε
conclusion 1
v :
Fin 3 → ℝ
|v 0| ≤ ε
|v 1| ≤ ε
v 2 ∈ Icc (0 : ℝ) 1
ContDiffAt ℝ ⊤ (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) v
conclusion 2
m :
ℕ
∃ B : ℝ,
0 < B
v :
Fin 3 → ℝ
|v 0| ≤ ε
|v 1| ≤ ε
v 2 ∈ Icc (0 : ℝ) 1
‖iteratedFDeriv ℝ m (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) v‖ ≤ B
Proof (Lean source)
-- @node: mixedRoot_uniform_smooth_derivative_bounds lemma mixedRoot_uniform_smooth_derivative_bounds : ∃ ε : ℝ, 0 < ε ∧ (∀ v : Fin 3 → ℝ, |v 0| ≤ ε → |v 1| ≤ ε → v 2 ∈ Icc (0 : ℝ) 1 → ContDiffAt ℝ ⊤ (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) v) ∧ (∀ m : ℕ, ∃ B : ℝ, 0 < B ∧ ∀ v : Fin 3 → ℝ, |v 0| ≤ ε → |v 1| ≤ ε → v 2 ∈ Icc (0 : ℝ) 1 → ‖iteratedFDeriv ℝ m (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) v‖ ≤ B) := by obtain ⟨ε, hε, hSmooth⟩ := mixedRoot_uniform_contDiffAt have hvec (v : Fin 3 → ℝ) : ![v 0,v 1,v 2] = v := by funext i fin_cases i <;> rfl have hAt (v : Fin 3 → ℝ) (h0 : |v 0| ≤ ε) (h1 : |v 1| ≤ ε) (h2 : v 2 ∈ Icc (0 : ℝ) 1) : ContDiffAt ℝ ⊤ (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) v := by simpa only [hvec] using hSmooth (v 0) (v 1) (v 2) h0 h1 h2 let K : Set (Fin 3 → ℝ) := pi univ (fun i => if i = 2 then Icc (0 : ℝ) 1 else Icc (-ε) ε) have hK : IsCompact K := isCompact_univ_pi (fun i => by split <;> exact isCompact_Icc) have hmem (v : Fin 3 → ℝ) : v ∈ K ↔ |v 0| ≤ ε ∧ |v 1| ≤ ε ∧ v 2 ∈ Icc (0 : ℝ) 1 := by simp only [K, Set.mem_pi, Set.mem_univ, forall_const] constructor · intro h exact ⟨abs_le.mpr (by simpa using h 0), abs_le.mpr (by simpa using h 1), by simpa using h 2⟩ · rintro ⟨h0,h1,h2⟩ i fin_cases i · simpa using abs_le.mp h0 · simpa using abs_le.mp h1 · simpa using h2 refine ⟨ε, hε, hAt, ?_⟩ intro m obtain ⟨B,hB,hBound⟩ := compact_smooth_derivative_bounds 3 (fun a : Fin 3 → ℝ => mixedRoot (a 0) (a 1) (a 2)) K hK (fun v hv => hAt v (hmem v |>.mp hv).1 (hmem v |>.mp hv).2.1 (hmem v |>.mp hv).2.2) m exact ⟨B,hB,fun v h0 h1 h2 => hBound v ((hmem v).mpr ⟨h0,h1,h2⟩)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_uniform_smooth_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedRootSmoothness.lean:106
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixedSingletonMatching 10 declarations The normalized covariance equation cancels the mixed-margin second moment in all four cells.

Exact calibrated singleton cancellation

The normalized covariance equation cancels the mixed-margin second moment in all four cells. The fair risk equation matches the comparator. Uniform finite priors reproduce both local two-sign averages, with the roots substituted.

theorem localMixedCell_singleton_matching Lemma localMixedCell_singleton_matching in the paper ↗

[The two local mixed tables have identical averages whenever the normalized root equation holds. the documented result Under the stated assumptions.

Formal statement
η ζ u :
ℝ
hroot :
mixedEquation η ζ u (mixedRoot η ζ u) = 0
a y :
signAverage (fun s => localMixedCell false s a y ![η, ζ, u])
= signAverage (fun s => localMixedCell true s a y ![η, ζ, u])
Proof (Lean source)
-- @node: localMixedCell_singleton_matching lemma localMixedCell_singleton_matching (η ζ u : ℝ) (hroot : mixedEquation η ζ u (mixedRoot η ζ u) = 0) (a y : Bool) : signAverage (fun s => localMixedCell false s a y ![η, ζ, u]) = signAverage (fun s => localMixedCell true s a y ![η, ζ, u]) := by have hcov := mixedEquation_covariance_matching η ζ u _ hroot have hmoment := Real.sin_sq_add_cos_sq (pi*u/2) simp [signAverage, Fintype.sum_prod_type, localSignField, signValue] at hcov cases a <;> cases y <;> simp [signAverage, Fintype.sum_prod_type, localMixedCell, tableCell, localSignField, signValue] · linear_combination -4*hcov + 8*η*ζ*mixedRoot η ζ u * hmoment · linear_combination 4*hcov - 8*η*ζ*mixedRoot η ζ u * hmoment · linear_combination 4*hcov - 8*η*ζ*mixedRoot η ζ u * hmoment · linear_combination -4*hcov + 8*η*ζ*mixedRoot η ζ u * hmoment
CausalSmith.Stat.LogoddsLowsmoothFrontier.localMixedCell_singleton_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:15

Two distinct coordinates of the uniform Boolean prior are independent fair signs; the other coordinates contribute exactly their multiplicity. the documented result Under the stated assumptions.

Formal statement
ι :
i j :
ι
hij :
i ≠ j
F :
Bool × Bool → ℝ
(∑ σ : ι → Bool, F (σ i, σ j)) = (card (ι → Bool) : ℝ) * signAverage F
Proof (Lean source)
-- @node: signPrior_pair_sum lemma signPrior_pair_sum {ι : Type*} [Fintype ι] [DecidableEq ι] (i j : ι) (hij : i ≠ j) (F : Bool × Bool → ℝ) : (∑ σ : ι → Bool, F (σ i, σ j)) = (card (ι → Bool) : ℝ) * signAverage F := by classical let flip (i : ι) : (ι → Bool) ≃ (ι → Bool) := { toFun := fun σ => update σ i (!(σ i)) invFun := fun σ => update σ i (!(σ i)) left_inv := by intro σ funext l by_cases h : l = i · subst l; simp · simp [Function.update_of_ne h] right_inv := by intro σ funext l by_cases h : l = i · subst l; simp · simp [Function.update_of_ne h] } have hi : (∑ σ : ι → Bool, F ((flip i σ) i, (flip i σ) j)) = ∑ σ : ι → Bool, F (σ i, σ j) := (flip i).sum_comp (fun σ => F (σ i, σ j)) have hj : (∑ σ : ι → Bool, F ((flip j σ) i, (flip j σ) j)) = ∑ σ : ι → Bool, F (σ i, σ j) := (flip j).sum_comp (fun σ => F (σ i, σ j)) have hij' : (∑ σ : ι → Bool, F ((flip i (flip j σ)) i, (flip i (flip j σ)) j)) = ∑ σ : ι → Bool, F (σ i, σ j) := ((flip j).trans (flip i)).sum_comp (fun σ => F (σ i, σ j)) have hpoint (σ : ι → Bool) : F (σ i, σ j) + F ((flip i σ) i, (flip i σ) j) + F ((flip j σ) i, (flip j σ) j) + F ((flip i (flip j σ)) i, (flip i (flip j σ)) j) = 4 * signAverage F := by simp only [flip, Equiv.coe_fn_mk, Function.update_self, Function.update_of_ne hij, Function.update_of_ne (Ne.symm hij)] cases σ i <;> cases σ j <;> simp [signAverage, Fintype.sum_prod_type, Fintype.sum_bool] <;> ring have hsum := congrArg (fun f : (ι → Bool) → ℝ => ∑ σ, f σ) (funext hpoint) simp only [Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, hi, hj, hij'] at hsum unfold signAverage at * linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPrior_pair_sum · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:33

A positive cell count gives two distinct endpoint indices. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
x :
cellIndex k x < k
Proof (Lean source)
-- @node: cellIndex_lt lemma cellIndex_lt (k : ℕ) (hk : 1 ≤ k) (x : Covariate) : cellIndex k x < k := by have h := min_le_left (k-1) ((⌊(k : ℝ)*(x : ℝ)⌋ : ℤ).toNat) unfold cellIndex omega

[Even at the rightmost endpoint, the selected within-cell coordinate lies in the closed unit interval. the documented result Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
x :
cellCoord k x ∈ Icc (0 : ℝ) 1
Proof (Lean source)
-- @node: cellCoord_mem_unit lemma cellCoord_mem_unit (k : ℕ) (hk : 1 ≤ k) (x : Covariate) : cellCoord k x ∈ Icc (0 : ℝ) 1 := by have hnonneg : 0 ≤ (k : ℝ)*(x : ℝ) := mul_nonneg (Nat.cast_nonneg _) x.property.1 have hfnonneg : 0 ≤ (⌊(k : ℝ)*(x : ℝ)⌋ : ℤ) := Int.floor_nonneg.mpr hnonneg have hcast : (((⌊(k : ℝ)*(x : ℝ)⌋ : ℤ).toNat : ℕ) : ℝ) = ((⌊(k : ℝ)*(x : ℝ)⌋ : ℤ) : ℝ) := by exact_mod_cast Int.toNat_of_nonneg hfnonneg have hfloor := Int.floor_le ((k : ℝ)*(x : ℝ)) have hnext := Int.lt_floor_add_one ((k : ℝ)*(x : ℝ)) have hupper : (k : ℝ)*(x : ℝ) ≤ k := by nlinarith [x.property.2, (Nat.cast_nonneg k : (0 : ℝ) ≤ k)] have hkcast : ((k-1 : ℕ) : ℝ) = (k : ℝ)-1 := by rw [Nat.cast_sub hk]; norm_num unfold cellCoord cellIndex rcases le_total (k-1) ((⌊(k : ℝ)*(x : ℝ)⌋ : ℤ).toNat) with h | h · rw [min_eq_left h] have hle : ((k-1 : ℕ) : ℝ) ≤ ((⌊(k : ℝ)*(x : ℝ)⌋ : ℤ).toNat : ℝ) := Nat.cast_le.mpr h constructor <;> linarith · rw [min_eq_right h, hcast] constructor <;> linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellCoord_mem_unit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:83
theorem mixedCells_singleton_matching Lemma mixedCells_singleton_matching in the paper ↗

The full finite prior reproduces the exact local cancellation at each covariate. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
η ζ :
ℝ
x :
hroot :
mixedEquation η ζ (cellCoord k x) (mixedRoot η ζ (cellCoord k x)) = 0
a y :
(∑ σ : Fin (k+1) → Bool, mixedCells false k σ η ζ a y x)
= ∑ σ : Fin (k+1) → Bool, mixedCells true k σ η ζ a y x
Proof (Lean source)
-- @node: mixedCells_singleton_matching lemma mixedCells_singleton_matching (k : ℕ) (hk : 1 ≤ k) (η ζ : ℝ) (x : Covariate) (hroot : mixedEquation η ζ (cellCoord k x) (mixedRoot η ζ (cellCoord k x)) = 0) (a y : Bool) : (∑ σ : Fin (k+1) → Bool, mixedCells false k σ η ζ a y x) = ∑ σ : Fin (k+1) → Bool, mixedCells true k σ η ζ a y x := by let i : Fin (k+1) := ⟨min (cellIndex k x) k, lt_succ_of_le (min_le_right _ _)⟩ let j : Fin (k+1) := ⟨min (cellIndex k x+1) k, lt_succ_of_le (min_le_right _ _)⟩ have hij : i ≠ j := by intro he have hv := congrArg val he dsimp [i, j] at hv have hc := cellIndex_lt k hk x omega change (∑ σ : Fin (k+1) → Bool, localMixedCell false (σ i, σ j) a y ![η, ζ, cellCoord k x]) = ∑ σ : Fin (k+1) → Bool, localMixedCell true (σ i, σ j) a y ![η, ζ, cellCoord k x] rw [signPrior_pair_sum i j hij (fun s => localMixedCell false s a y ![η, ζ, cellCoord k x]), signPrior_pair_sum i j hij (fun s => localMixedCell true s a y ![η, ζ, cellCoord k x]), localMixedCell_singleton_matching η ζ (cellCoord k x) hroot]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_singleton_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:108
theorem mixedLaw_singleton_matching Lemma mixedLaw_singleton_matching in the paper ↗

[Validity transfers the cancellation to the actual ambient laws, so the fallback of the totalized construction is never used. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
η ζ :
ℝ
hvalid :
∀ b σ, ValidCells (mixedCells b k σ η ζ)
x :
hroot :
mixedEquation η ζ (cellCoord k x) (mixedRoot η ζ (cellCoord k x)) = 0
a y :
(∑ σ : Fin (k+1) → Bool, (mixedLaw false k σ η ζ).cells a y x)
= ∑ σ : Fin (k+1) → Bool, (mixedLaw true k σ η ζ).cells a y x
Proof (Lean source)
-- @node: mixedLaw_singleton_matching lemma mixedLaw_singleton_matching (k : ℕ) (hk : 1 ≤ k) (η ζ : ℝ) (hvalid : ∀ b σ, ValidCells (mixedCells b k σ η ζ)) (x : Covariate) (hroot : mixedEquation η ζ (cellCoord k x) (mixedRoot η ζ (cellCoord k x)) = 0) (a y : Bool) : (∑ σ : Fin (k+1) → Bool, (mixedLaw false k σ η ζ).cells a y x) = ∑ σ : Fin (k+1) → Bool, (mixedLaw true k σ η ζ).cells a y x := by simp only [mixedLaw, totalCellLaw, dif_pos (hvalid _ _), lawFromCells] exact mixedCells_singleton_matching k hk η ζ x hroot a y
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedLaw_singleton_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:132
theorem localFairCell_singleton_matching Lemma localFairCell_singleton_matching in the paper ↗

[Exact calibrated risk matching implies matching of each fair singleton cell; the control arm uses the mean-zero sign field. the documented result Under the stated assumptions.

Formal statement
t δ u :
ℝ
hmatch :
signAverage (fun s => riskShift t (fairRoot t δ u + δ*localSignField u s))
a y :
signAverage (fun s => localFairCell true s a y ![t, δ, u])
= localFairCell false (false, false) a y ![t, δ, u]
Proof (Lean source)
-- @node: localFairCell_singleton_matching lemma localFairCell_singleton_matching (t δ u : ℝ) (hmatch : signAverage (fun s => riskShift t (fairRoot t δ u + δ*localSignField u s)) = riskShift (comparatorEffect t δ) (fairRoot t δ u)) (a y : Bool) : signAverage (fun s => localFairCell true s a y ![t, δ, u]) = localFairCell false (false, false) a y ![t, δ, u] := by simp [signAverage, Fintype.sum_prod_type, localSignField, signValue] at hmatch cases a <;> cases y <;> simp [signAverage, Fintype.sum_prod_type, localFairCell, localSignField, signValue] · ring · ring · linarith · linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.localFairCell_singleton_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:144
theorem fairCells_singleton_matching Lemma fairCells_singleton_matching in the paper ↗

The full fair sign prior has exactly the deterministic comparator's singleton cells whenever the calibrated risk equation holds. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
t δ :
ℝ
x :
hmatch :
signAverage (fun s => riskShift t (fairRoot t δ (cellCoord k x) + δ*localSignField (cellCoord k x) s))
a y :
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, fairCells true k σ t δ a y x)
= fairCells false k (fun _ => false) t δ a y x
Proof (Lean source)
-- @node: fairCells_singleton_matching lemma fairCells_singleton_matching (k : ℕ) (hk : 1 ≤ k) (t δ : ℝ) (x : Covariate) (hmatch : signAverage (fun s => riskShift t (fairRoot t δ (cellCoord k x) + δ*localSignField (cellCoord k x) s)) = riskShift (comparatorEffect t δ) (fairRoot t δ (cellCoord k x))) (a y : Bool) : (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, fairCells true k σ t δ a y x) = fairCells false k (fun _ => false) t δ a y x := by let i : Fin (k+1) := ⟨min (cellIndex k x) k, lt_succ_of_le (min_le_right _ _)⟩ let j : Fin (k+1) := ⟨min (cellIndex k x+1) k, lt_succ_of_le (min_le_right _ _)⟩ have hij : i ≠ j := by intro he have hv := congrArg val he dsimp [i, j] at hv have hc := cellIndex_lt k hk x omega change (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, localFairCell true (σ i, σ j) a y ![t, δ, cellCoord k x]) = localFairCell false (false, false) a y ![t, δ, cellCoord k x] rw [signPrior_pair_sum i j hij (fun s => localFairCell true s a y ![t, δ, cellCoord k x]), localFairCell_singleton_matching t δ (cellCoord k x) hmatch] have hc : (card (Fin (k+1) → Bool) : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero rw [← mul_assoc, inv_mul_cancel₀ hc, one_mul]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_singleton_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:161
theorem fairLaw_singleton_matching Lemma fairLaw_singleton_matching in the paper ↗

Validity transfers fair singleton matching to the actual law and comparator. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
t δ :
ℝ
hvalid :
∀ σ, ValidCells (fairCells true k σ t δ)
hcomparator :
ValidCells (fairCells false k (fun _ => false) t δ)
x :
hmatch :
signAverage (fun s => riskShift t (fairRoot t δ (cellCoord k x) + δ*localSignField (cellCoord k x) s))
a y :
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, (fairLaw k σ t δ).cells a y x)
= (fairComparator k t δ).cells a y x
Proof (Lean source)
-- @node: fairLaw_singleton_matching lemma fairLaw_singleton_matching (k : ℕ) (hk : 1 ≤ k) (t δ : ℝ) (hvalid : ∀ σ, ValidCells (fairCells true k σ t δ)) (hcomparator : ValidCells (fairCells false k (fun _ => false) t δ)) (x : Covariate) (hmatch : signAverage (fun s => riskShift t (fairRoot t δ (cellCoord k x) + δ*localSignField (cellCoord k x) s)) = riskShift (comparatorEffect t δ) (fairRoot t δ (cellCoord k x))) (a y : Bool) : (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, (fairLaw k σ t δ).cells a y x) = (fairComparator k t δ).cells a y x := by simp only [fairLaw, fairComparator, totalCellLaw, dif_pos (hvalid _), dif_pos hcomparator, lawFromCells] exact fairCells_singleton_matching k hk t δ x hmatch a y
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairLaw_singleton_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:190
theorem calibrated_amplitude_abs_le Lemma calibrated_amplitude_abs_le in the paper ↗

[Rate scaling by a nonnegative exponent stays inside the fixed amplitude neighborhood for every positive cell count. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
ε γ :
ℝ
hε :
0 ≤ ε
hγ :
0 ≤ γ
k :
ℕ
hk :
1 ≤ k
|ε*(k : ℝ)^(-γ)| ≤ ε
Proof (Lean source)
-- @node: calibrated_amplitude_abs_le lemma calibrated_amplitude_abs_le (ε γ : ℝ) (hε : 0 ≤ ε) (hγ : 0 ≤ γ) (k : ℕ) (hk : 1 ≤ k) : |ε*(k : ℝ)^(-γ)| ≤ ε := by have hk' : (1 : ℝ) ≤ k := by exact_mod_cast hk have hp : 0 ≤ (k : ℝ)^(-γ) := Real.rpow_nonneg (Nat.cast_nonneg _) _ rw [abs_of_nonneg (mul_nonneg hε hp)] calc _ ≤ ε*1 := mul_le_mul_of_nonneg_left (Real.rpow_le_one_of_one_le_of_nonpos hk' (neg_nonpos.mpr hγ)) hε _ = ε := mul_one ε
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_amplitude_abs_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixedSingletonMatching.lean:205
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureAxes 10 declarations On the propensity axis the two mixed laws coincide draw by draw.

Exact zero-amplitude identities for the original-record experiments

On the propensity axis the two mixed laws coincide draw by draw. On the prognosis axis reversal of all endpoint signs reindexes the complete finite prior. At zero fair amplitude every draw is the deterministic comparator. These are identities of the actual sample measures, including totalization.

Reversing every endpoint sign negates the entire shared-endpoint field. Under the stated assumptions.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
x :
signFieldZ k (fun i => !(σ i)) x = -signFieldZ k σ x
Proof (Lean source)
-- @node: signFieldZ_reverse lemma signFieldZ_reverse (k : ℕ) (σ : Fin (k + 1) → Bool) (x : Covariate) : signFieldZ k (fun i => !(σ i)) x = -signFieldZ k σ x := by have hs (b : Bool) : signValue (!b) = -signValue b := by cases b <;> norm_num [signValue] simp only [signFieldZ, endpointSign, hs] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.signFieldZ_reverse · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:17
theorem covarianceBranch_zero_effect Lemma covarianceBranch_zero_effect in the paper ↗

The covariance is exactly zero at zero effect, for any margins. the stated conclusion holds.

Formal statement
ξ υ :
ℝ
covarianceBranch 0 ξ υ = 0
Proof (Lean source)
-- @node: covarianceBranch_zero_effect lemma covarianceBranch_zero_effect (ξ υ : ℝ) : covarianceBranch 0 ξ υ = 0 := by simp [covarianceBranch]
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_zero_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:26

Zero propensity amplitude makes the two mixed tables identical. the stated conclusion holds.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
ζ :
ℝ
mixedCells false k σ 0 ζ = mixedCells true k σ 0 ζ
Proof (Lean source)
-- @node: mixedCells_zero_left lemma mixedCells_zero_left (k : ℕ) (σ : Fin (k + 1) → Bool) (ζ : ℝ) : mixedCells false k σ 0 ζ = mixedCells true k σ 0 ζ := by funext a y x simp [mixedCells, covarianceBranch_zero_effect]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_zero_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:31
theorem mixedCells_zero_right_reverse Lemma mixedCells_zero_right_reverse in the paper ↗

Zero prognosis amplitude turns sign reversal into a draw-wise table identity. the stated conclusion holds.

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
η :
ℝ
mixedCells false k σ η 0 = mixedCells true k (fun i => !(σ i)) η 0
Proof (Lean source)
-- @node: mixedCells_zero_right_reverse lemma mixedCells_zero_right_reverse (k : ℕ) (σ : Fin (k + 1) → Bool) (η : ℝ) : mixedCells false k σ η 0 = mixedCells true k (fun i => !(σ i)) η 0 := by funext a y x simp [mixedCells, signFieldZ_reverse, covarianceBranch_zero_effect]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_zero_right_reverse · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:38

The actual mixed sample measures agree on the zero propensity axis. the stated conclusion holds.

Formal statement
n k :
ℕ
ζ :
ℝ
mixedMixture false n k 0 ζ = mixedMixture true n k 0 ζ
Proof (Lean source)
-- @node: mixedMixture_zero_left lemma mixedMixture_zero_left (n k : ℕ) (ζ : ℝ) : mixedMixture false n k 0 ζ = mixedMixture true n k 0 ζ := by unfold mixedMixture finiteSignMixture congr 1 apply Finset.sum_congr rfl intro σ _ dsimp only simp only [mixedLaw, mixedCells_zero_left]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedMixture_zero_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:45
theorem endpointSign_prior_reverse Lemma endpointSign_prior_reverse in the paper ↗

The uniform finite sign prior is invariant under simultaneous reversal. the stated conclusion holds. Under the stated assumptions.

Formal statement
A :
k :
ℕ
F :
(Fin (k + 1) → Bool) → A
(∑ σ : Fin (k + 1) → Bool, F (fun i => !(σ i))) = ∑ σ, F σ
Proof (Lean source)
-- @node: endpointSign_prior_reverse lemma endpointSign_prior_reverse {A : Type*} [AddCommMonoid A] (k : ℕ) (F : (Fin (k + 1) → Bool) → A) : (∑ σ : Fin (k + 1) → Bool, F (fun i => !(σ i))) = ∑ σ, F σ := by apply Fintype.sum_bijective (fun σ : Fin (k + 1) → Bool => fun i => !(σ i)) · constructor · intro σ τ h funext i have hi := congrFun h i cases hσ : σ i <;> cases hτ : τ i <;> simp_all · intro σ refine ⟨fun i => !(σ i), ?_⟩ funext i simp · intro σ rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointSign_prior_reverse · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:56
theorem mixedMixture_zero_right Lemma mixedMixture_zero_right in the paper ↗

The actual mixed sample measures agree on the zero prognosis axis after reindexing the prior, without revealing any latent signs. the documented result

Formal statement
n k :
ℕ
η :
ℝ
mixedMixture false n k η 0 = mixedMixture true n k η 0
Proof (Lean source)
-- @node: mixedMixture_zero_right lemma mixedMixture_zero_right (n k : ℕ) (η : ℝ) : mixedMixture false n k η 0 = mixedMixture true n k η 0 := by unfold mixedMixture finiteSignMixture congr 1 calc _ = ∑ σ : Fin (k + 1) → Bool, iidLaw (mixedLaw true k (fun i => !(σ i)) η 0).measure n := by apply Finset.sum_congr rfl intro σ _ dsimp only simp only [mixedLaw, mixedCells_zero_right_reverse] _ = _ := endpointSign_prior_reverse k (fun σ => iidLaw (mixedLaw true k σ η 0).measure n)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedMixture_zero_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:74
theorem fairCells_zero_amplitude Lemma fairCells_zero_amplitude in the paper ↗

Every zero-amplitude fair draw equals the comparator's table, regardless of which value the common root selector returns. the documented result

Formal statement
k :
ℕ
σ :
Fin (k + 1) → Bool
t :
ℝ
fairCells true k σ t 0 = fairCells false k (fun _ => false) t 0
Proof (Lean source)
-- @node: fairCells_zero_amplitude lemma fairCells_zero_amplitude (k : ℕ) (σ : Fin (k + 1) → Bool) (t : ℝ) : fairCells true k σ t 0 = fairCells false k (fun _ => false) t 0 := by funext a y x simp [fairCells, comparatorEffect_zero_amplitude]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:96
theorem finiteSignMixture_const

A uniform sign mixture of one common law is exactly that law's iid experiment. the stated conclusion holds.

Formal statement
n k :
ℕ
finiteSignMixture n k (fun _ => P)
= iidLaw P.measure n
Proof (Lean source)
-- @node: finiteSignMixture_const lemma finiteSignMixture_const (n k : ℕ) (P : ObservedLaw) : finiteSignMixture n k (fun _ => P) = iidLaw P.measure n := by unfold finiteSignMixture simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fun, Fintype.card_bool, Fintype.card_fin] rw [zpow_neg, zpow_natCast, ENNReal.ofReal_inv_of_pos (by positivity), ENNReal.ofReal_pow (by norm_num)] norm_num only [ENNReal.ofReal_ofNat] rw [← Nat.cast_smul_eq_nsmul ENNReal, Nat.cast_pow, Nat.cast_ofNat, smul_smul] rw [ENNReal.inv_mul_cancel (by positivity) (by finiteness), one_smul]
CausalSmith.Stat.LogoddsLowsmoothFrontier.finiteSignMixture_const · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:104
theorem fairMixture_zero_amplitude

At zero fair amplitude the entire original-record experiment equals its comparator, including the normalization of the finite prior. the documented result

Formal statement
n k :
ℕ
t :
ℝ
fairMixture n k t 0
= iidLaw (fairComparator k t 0).measure n
Proof (Lean source)
-- @node: fairMixture_zero_amplitude lemma fairMixture_zero_amplitude (n k : ℕ) (t : ℝ) : fairMixture n k t 0 = iidLaw (fairComparator k t 0).measure n := by have hdraw (σ : Fin (k + 1) → Bool) : fairLaw k σ t 0 = fairComparator k t 0 := by simp only [fairLaw, fairComparator, fairCells_zero_amplitude] simp only [fairMixture, hdraw] exact finiteSignMixture_const n k _
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairMixture_zero_amplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureAxes.lean:118
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureConditionalIntegration 11 declarations The uniform record reference separates into the public covariate law and the uniform four-label law.

Integrating conditional original-record experiments

The uniform record reference separates into the public covariate law and the uniform four-label law. Regrouping its finite product and applying Fubini retains all original records and integrates their conditional label discrepancy.

[The four-label reference assigns probability one quarter to each label.

Definition (Lean source)
labelReference :
(1/4 : ℝ≥0∞) • Measure.count
instance labelReference_probability

The fair label reference has total mass one. the stated conclusion holds.

Definition (Lean source)
-- @node: labelReference_probability instance labelReference_probability : IsProbabilityMeasure labelReference := by constructor norm_num [labelReference, Measure.smul_apply, Measure.count_apply_finite] exact ENNReal.inv_mul_cancel (by norm_num) (by norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.labelReference_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:22
theorem labelReference_pi_eq_count

Every label array has exactly the uniform mass four to the minus n. the stated conclusion holds.

Formal statement
n :
ℕ
Measure.pi (fun _ : Fin n => labelReference)
= (1/4 : ℝ≥0∞) ^ n • (Measure.count : Measure (Fin n → Bool × Bool))
Proof (Lean source)
-- @node: labelReference_pi_eq_count lemma labelReference_pi_eq_count (n : ℕ) : Measure.pi (fun _ : Fin n => labelReference) = (1/4 : ℝ≥0∞) ^ n • (Measure.count : Measure (Fin n → Bool × Bool)) := by apply Measure.ext_of_singleton intro l rw [Measure.pi_singleton] simp [labelReference, Measure.smul_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.labelReference_pi_eq_count · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:29
theorem integral_labelReference_pi

Conditional integration over labels is a finite uniform average. the stated conclusion holds. Under the stated assumptions.

Formal statement
n :
ℕ
f :
(Fin n → Bool × Bool) → ℝ
(∫ l, f l ∂Measure.pi (fun _ : Fin n => labelReference)) = (1/4 : ℝ) ^ n * ∑ l, f l
Proof (Lean source)
-- @node: integral_labelReference_pi lemma integral_labelReference_pi (n : ℕ) (f : (Fin n → Bool × Bool) → ℝ) : (∫ l, f l ∂Measure.pi (fun _ : Fin n => labelReference)) = (1/4 : ℝ) ^ n * ∑ l, f l := by rw [labelReference_pi_eq_count, integral_smul_measure, integral_count] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.integral_labelReference_pi · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:39
theorem recordReference_eq_prod

The actual one-record reference is the product of covariates and fair labels. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: recordReference_eq_prod lemma recordReference_eq_prod : recordReference = uniformLaw.prod labelReference := by apply Measure.ext_of_lintegral intro f hf have h := lintegral_jointLaw_cells (lawFromCells (fun _ _ _ => 1/4) fairDefault_valid) f hf change (∫⁻ o, f o ∂recordReference) = _ at h rw [h, lintegral_prod _ hf.aemeasurable] apply lintegral_congr intro x simp [labelReference, lintegral_smul_measure, lintegral_count, tsum_fintype, Fintype.sum_prod_type, lawFromCells, mul_add]
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordReference_eq_prod · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:47
theorem recordReference_regroup_preserving

Regrouping a sample into its covariates and labels preserves the full reference measure. This is a bijection and discards no sample coordinates. the documented result

Formal statement
n :
ℕ
MeasurePreserving (arrowProdEquivProdArrow Covariate (Bool × Bool) (Fin n)) (Measure.pi (fun _ : Fin n => recordReference)) ((Measure.pi (fun _ : Fin n => uniformLaw)).prod (Measure.pi (fun _ : Fin n => labelReference)))
Proof (Lean source)
-- @node: recordReference_regroup_preserving lemma recordReference_regroup_preserving (n : ℕ) : MeasurePreserving (arrowProdEquivProdArrow Covariate (Bool × Bool) (Fin n)) (Measure.pi (fun _ : Fin n => recordReference)) ((Measure.pi (fun _ : Fin n => uniformLaw)).prod (Measure.pi (fun _ : Fin n => labelReference))) := by simp_rw [recordReference_eq_prod] exact measurePreserving_arrowProdEquivProdArrow _ _ _ _ _
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordReference_regroup_preserving · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:61
theorem integral_original_records_conditional

Fubini identifies the original-sample integral with the covariate integral of the conditional label integral whenever the sample integrand is integrable. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
f :
(Fin n → Record) → ℝ
hf :
Integrable f (Measure.pi (fun _ : Fin n => recordReference))
(∫ o, f o ∂Measure.pi (fun _ : Fin n => recordReference))
= ∫ x, ∫ l, f (fun i => (x i, l i)) ∂Measure.pi (fun _ : Fin n => labelReference) ∂Measure.pi (fun _ : Fin n => uniformLaw)
Proof (Lean source)
-- @node: integral_original_records_conditional lemma integral_original_records_conditional (n : ℕ) (f : (Fin n → Record) → ℝ) (hf : Integrable f (Measure.pi (fun _ : Fin n => recordReference))) : (∫ o, f o ∂Measure.pi (fun _ : Fin n => recordReference)) = ∫ x, ∫ l, f (fun i => (x i, l i)) ∂Measure.pi (fun _ : Fin n => labelReference) ∂Measure.pi (fun _ : Fin n => uniformLaw) := by let e := arrowProdEquivProdArrow Covariate (Bool × Bool) (Fin n) have hp := (recordReference_regroup_preserving n).symm e have hi : Integrable (fun z => f (e.symm z)) ((Measure.pi (fun _ : Fin n => uniformLaw)).prod (Measure.pi (fun _ : Fin n => labelReference))) := (hp.integrable_comp hf.aestronglyMeasurable).2 hf rw [← hp.integral_comp e.symm.measurableEmbedding f, integral_prod _ hi] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.integral_original_records_conditional · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:72
theorem sampleCellDensity_integrable

Product likelihoods of the actual observed laws are integrable under the sample reference. the documented result

Formal statement
n :
ℕ
Integrable (sampleCellDensity n P) (Measure.pi (fun _ : Fin n => recordReference))
Proof (Lean source)
-- @node: sampleCellDensity_integrable lemma sampleCellDensity_integrable (n : ℕ) (P : ObservedLaw) : Integrable (sampleCellDensity n P) (Measure.pi (fun _ : Fin n => recordReference)) := by exact Integrable.fintype_prod_dep (fun _ => recordCellDensity_integrable P)
CausalSmith.Stat.LogoddsLowsmoothFrontier.sampleCellDensity_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:90
theorem signMixtureCellDensity_integrable

The shared-sign finite-prior likelihood is integrable under the same sample reference, with no independence assumption on its mixture components. the documented result

Formal statement
n k :
ℕ
laws :
(Fin (k + 1) → Bool) → ObservedLaw
Integrable (signMixtureCellDensity n k laws) (Measure.pi (fun _ : Fin n => recordReference))
Proof (Lean source)
-- @node: signMixtureCellDensity_integrable lemma signMixtureCellDensity_integrable (n k : ℕ) (laws : (Fin (k + 1) → Bool) → ObservedLaw) : Integrable (signMixtureCellDensity n k laws) (Measure.pi (fun _ : Fin n => recordReference)) := by unfold signMixtureCellDensity exact (integrable_finsetSum _ (fun σ _ => sampleCellDensity_integrable n (laws σ))).const_mul _
CausalSmith.Stat.LogoddsLowsmoothFrontier.signMixtureCellDensity_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:97
theorem mixture_hellinger_integrand_integrable Lemma mixture_hellinger_integrand_integrable in the paper ↗

Nonnegative integrable densities have an integrable squared square-root discrepancy: its pointwise value is bounded by their sum. the documented result Under the stated assumptions.

Formal statement
Ω :
μ :
f g :
Ω → ℝ
hf :
hg :
hf0 :
∀ o, 0 ≤ f o
hg0 :
∀ o, 0 ≤ g o
Integrable (fun o => (sqrt (f o) - sqrt (g o)) ^ 2) μ
Proof (Lean source)
-- @node: mixture_hellinger_integrand_integrable lemma mixture_hellinger_integrand_integrable {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) (f g : Ω → ℝ) (hf : Integrable f μ) (hg : Integrable g μ) (hf0 : ∀ o, 0 ≤ f o) (hg0 : ∀ o, 0 ≤ g o) : Integrable (fun o => (sqrt (f o) - sqrt (g o)) ^ 2) μ := by apply (hf.add hg).mono' · fun_prop · filter_upwards [] with o rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] change (sqrt (f o) - sqrt (g o)) ^ 2 ≤ f o + g o nlinarith [Real.sq_sqrt (hf0 o), Real.sq_sqrt (hg0 o), mul_nonneg (Real.sqrt_nonneg (f o)) (Real.sqrt_nonneg (g o))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_hellinger_integrand_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:107
theorem mixture_hellinger_conditional_integral

[The unconditional discrepancy is exactly the covariate integral of the conditional label discrepancy, since the two experiments share their covariate marginal. Fubini applies to the integrable actual likelihood discrepancy. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
f g :
(Fin n → Record) → ℝ
hf :
Integrable f (Measure.pi (fun _ : Fin n => recordReference))
hg :
Integrable g (Measure.pi (fun _ : Fin n => recordReference))
hf0 :
∀ o, 0 ≤ f o
hg0 :
∀ o, 0 ≤ g o
hellingerSqDensity (Measure.pi (fun _ : Fin n => recordReference)) f g
= ∫ x, hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => f (fun i => (x i, l i))) (fun l => g (fun i => (x i, l i))) ∂Measure.pi (fun _ : Fin n => uniformLaw)
Proof (Lean source)
-- @node: mixture_hellinger_conditional_integral lemma mixture_hellinger_conditional_integral (n : ℕ) (f g : (Fin n → Record) → ℝ) (hf : Integrable f (Measure.pi (fun _ : Fin n => recordReference))) (hg : Integrable g (Measure.pi (fun _ : Fin n => recordReference))) (hf0 : ∀ o, 0 ≤ f o) (hg0 : ∀ o, 0 ≤ g o) : hellingerSqDensity (Measure.pi (fun _ : Fin n => recordReference)) f g = ∫ x, hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => f (fun i => (x i, l i))) (fun l => g (fun i => (x i, l i))) ∂Measure.pi (fun _ : Fin n => uniformLaw) := by exact integral_original_records_conditional n _ (mixture_hellinger_integrand_integrable _ f g hf hg hf0 hg0)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_hellinger_conditional_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureConditionalIntegration.lean:122
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureCovariateOccupancy 20 declarations Cell adjacency has child-section mass at most 3/k.

Original-covariate component occupancy

Cell adjacency has child-section mass at most 3/k. A single root for each selected vertex set avoids an extra factor of the component size in the spanning-tree union bound.

The half-open cell convention, including its endpoint totalization, is measurable. The stated conclusion follows.

Formal statement
k :
ℕ
Proof (Lean source)
-- @node: cellIndex_measurable @[fun_prop] lemma cellIndex_measurable (k : ℕ) : Measurable (cellIndex k) := by unfold cellIndex fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellIndex_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:20

A cell graph edge is a measurable event of its two original covariates.

Definition (Lean source)
n k :
ℕ
cellCoordinateGraph n k :
clause 1
edgeEvent _ _ := {z | cellIndex k z.1 ≤ cellIndex k z.2 + 1 ∧ cellIndex k z.2 ≤ cellIndex k z.1 + 1}
clause 2
measurable_edgeEvent _ _ := by apply MeasurableSet.inter · exact measurableSet_le ((cellIndex_measurable k).comp measurable_fst) (((cellIndex_measurable k).comp measurable_snd).add_const 1) · exact measurableSet_le ((cellIndex_measurable k).comp measurable_snd) (((cellIndex_measurable k).comp measurable_fst).add_const 1)
clause 3
symmetric _ _ _ _ := and_comm
theorem cellCoordinateGraph_eq

The coordinate-local graph is exactly the original-record sign graph. Under the stated assumptions. The stated conclusion follows.

Formal statement
n :
ℕ
k :
ℕ
x :
Proof (Lean source)
-- @node: cellCoordinateGraph_eq lemma cellCoordinateGraph_eq {n : ℕ} (k : ℕ) (x : Fin n → Covariate) : (cellCoordinateGraph n k).graph x = originalRecordSignGraph k x := by rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellCoordinateGraph_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:40
theorem cell_adjacent_child_interval Lemma cell_adjacent_child_interval in the paper ↗

A child's admissible cells fit inside a real interval of length 3/k. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
y z :
h :
cellIndex k z ≤ cellIndex k y + 1 ∧ cellIndex k y ≤ cellIndex k z + 1
(z : ℝ) ∈ Icc (((cellIndex k y : ℝ)-1)/(k : ℝ)) (((cellIndex k y : ℝ)+2)/(k : ℝ))
Proof (Lean source)
-- @node: cell_adjacent_child_interval lemma cell_adjacent_child_interval (k : ℕ) (hk : 1 ≤ k) (y z : Covariate) (h : cellIndex k z ≤ cellIndex k y + 1 ∧ cellIndex k y ≤ cellIndex k z + 1) : (z : ℝ) ∈ Icc (((cellIndex k y : ℝ)-1)/(k : ℝ)) (((cellIndex k y : ℝ)+2)/(k : ℝ)) := by have hkp : (0 : ℝ) < k := by exact_mod_cast hk have hz := cellCoord_mem_unit k hk z have hleft : (cellIndex k y : ℝ) ≤ (cellIndex k z : ℝ)+1 := by exact_mod_cast h.2 have hright : (cellIndex k z : ℝ) ≤ (cellIndex k y : ℝ)+1 := by exact_mod_cast h.1 unfold cellCoord at hz constructor · apply (div_le_iff₀ hkp).mpr nlinarith [hz.1] · apply (le_div_iff₀ hkp).mpr nlinarith [hz.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_adjacent_child_interval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:46
theorem cell_adjacent_child_mass_le Lemma cell_adjacent_child_mass_le in the paper ↗

Integrating one leaf costs at most 3/k, including boundary cells. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
y :
uniformLaw {z | cellIndex k z ≤ cellIndex k y + 1 ∧ cellIndex k y ≤ cellIndex k z + 1}
≤ ofReal (3/(k : ℝ))
Proof (Lean source)
-- @node: cell_adjacent_child_mass_le lemma cell_adjacent_child_mass_le (k : ℕ) (hk : 1 ≤ k) (y : Covariate) : uniformLaw {z | cellIndex k z ≤ cellIndex k y + 1 ∧ cellIndex k y ≤ cellIndex k z + 1} ≤ ofReal (3/(k : ℝ)) := by rw [uniformLaw, comap_subtype_coe_apply measurableSet_Icc] calc _ ≤ (volume : Measure ℝ) (Icc (((cellIndex k y : ℝ)-1)/(k : ℝ)) (((cellIndex k y : ℝ)+2)/(k : ℝ))) := by apply measure_mono rintro v ⟨z, hz, rfl⟩ exact cell_adjacent_child_interval k hk y z hz _ = _ := by rw [Real.volume_Icc] congr 1 ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_adjacent_child_mass_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:65
theorem component_indicator_le_rootWitness Lemma component_indicator_le_rootWitness in the paper ↗

[A specified nonempty component has one selected rooted-parent cover. The root is fixed before sampling, so no extra factor of its size is charged. the documented result Under the stated assumptions.

Formal statement
V :
Type*
V → Type*
∀ i, MeasurableSpace (X i)
S :
r :
V
hr :
r ∈ S
x :
∀ i, X i
(if IsComponent (M.graph x) S then (1 : ℝ) else 0)
≤ rootTreeWitnessCount M (fun _ => univ) r (S.erase r) x
Proof (Lean source)
-- @node: component_indicator_le_rootWitness lemma component_indicator_le_rootWitness {V : Type*} [DecidableEq V] {X : V → Type*} [∀ i, MeasurableSpace (X i)] (M : CoordinateGraph X) (S : Finset V) (r : V) (hr : r ∈ S) (x : ∀ i, X i) : (if IsComponent (M.graph x) S then (1 : ℝ) else 0) ≤ Causalean.Stat.RandomGraph.rootTreeWitnessCount M (fun _ => univ) r (S.erase r) x := by classical cases Subsingleton.elim (inferInstance : DecidableEq V) (Classical.decEq V) have hrecover : insert r (S.erase r) = S := Finset.insert_erase hr have hnonneg (P : ParentEncoding ↥(insert r (S.erase r)) ⟨r, Finset.mem_insert_self r _⟩) : 0 ≤ (if P.Valid ∧ x ∈ partialTreeEvent (selectedEmbedding _) P univ M.edgeEvent univ then (1 : ℝ) else 0) := by split_ifs <;> norm_num by_cases hc : IsComponent (M.graph x) S · rw [if_pos hc] have hc' : x ∈ componentEvent M {r} (fun _ => univ) (insert r (S.erase r)) := by refine ⟨?_, r, by simp, by simp, Set.mem_univ _⟩ simpa only [hrecover] using hc obtain ⟨r', hr', hrS, P, hP⟩ := component_event_parent_cover M {r} (fun _ => univ) _ x hc' have he : r' = r := Finset.mem_singleton.mp hr' subst r' unfold Causalean.Stat.RandomGraph.rootTreeWitnessCount dsimp only have ht : (if P.Valid ∧ x ∈ partialTreeEvent (selectedEmbedding _) P univ M.edgeEvent univ then (1 : ℝ) else 0) = 1 := if_pos hP conv_lhs => rw [← ht] exact Finset.single_le_sum (fun Q _ => hnonneg Q) (Finset.mem_univ P) · rw [if_neg hc] unfold Causalean.Stat.RandomGraph.rootTreeWitnessCount exact Finset.sum_nonneg (fun P _ => hnonneg P)
CausalSmith.Stat.LogoddsLowsmoothFrontier.component_indicator_le_rootWitness · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:83
theorem cell_componentEvent_eq

[With all roots eligible, the library event is exactly the actual component event. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
S :
Proof (Lean source)
-- @node: cell_componentEvent_eq lemma cell_componentEvent_eq {n : ℕ} (k : ℕ) (S : Finset (Fin n)) : componentEvent (cellCoordinateGraph n k) univ (fun _ => univ) S = {x | IsComponent (originalRecordSignGraph k x) S} := by ext x constructor · exact fun h => h.1 · intro hc obtain ⟨r⟩ := hc.1.nonempty exact ⟨hc, r.val, Finset.mem_univ _, r.property, Set.mem_univ _⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_componentEvent_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:126
theorem cell_component_event_measurable

The event that a selected vertex set is an actual component is measurable. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
S :
Proof (Lean source)
-- @node: cell_component_event_measurable lemma cell_component_event_measurable {n : ℕ} (k : ℕ) (S : Finset (Fin n)) : MeasurableSet {x | IsComponent (originalRecordSignGraph k x) S} := by rw [← cell_componentEvent_eq] exact measurableSet_componentEvent (cellCoordinateGraph n k) univ (fun _ => univ) S (fun _ => MeasurableSet.univ)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_component_event_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:139
theorem cell_component_indicator_integrable

The indicator of a component event is bounded and integrable. the stated conclusion holds.

Formal statement
n :
ℕ
k :
ℕ
S :
Integrable (fun x => if IsComponent (originalRecordSignGraph k x) S then (1 : ℝ) else 0) (Measure.pi (fun _ : Fin n => uniformLaw))
Proof (Lean source)
-- @node: cell_component_indicator_integrable lemma cell_component_indicator_integrable {n : ℕ} (k : ℕ) (S : Finset (Fin n)) : Integrable (fun x => if IsComponent (originalRecordSignGraph k x) S then (1 : ℝ) else 0) (Measure.pi (fun _ : Fin n => uniformLaw)) := by classical apply (integrable_const (1 : ℝ)).mono_nonneg · exact (Measurable.ite (cell_component_event_measurable k S) measurable_const measurable_const).aestronglyMeasurable · exact Filter.Eventually.of_forall (fun x => by split_ifs <;> norm_num) · exact Filter.Eventually.of_forall (fun x => by split_ifs <;> norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_component_indicator_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:149
theorem cell_component_probability_le

The expected indicator of each actual component has the finite-parent tree bound. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
S :
hS :
S.Nonempty
(∫ x, (if IsComponent (originalRecordSignGraph k x) S then (1 : ℝ) else 0) ∂Measure.pi (fun _ : Fin n => uniformLaw))
≤ (S.card : ℝ)^(S.card-1) * (3/(k : ℝ))^(S.card-1)
Proof (Lean source)
-- @node: cell_component_probability_le lemma cell_component_probability_le {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (S : Finset (Fin n)) (hS : S.Nonempty) : (∫ x, (if IsComponent (originalRecordSignGraph k x) S then (1 : ℝ) else 0) ∂Measure.pi (fun _ : Fin n => uniformLaw)) ≤ (S.card : ℝ)^(S.card-1) * (3/(k : ℝ))^(S.card-1) := by classical obtain ⟨r, hr⟩ := hS have hcover := integral_mono (cell_component_indicator_integrable k S) (integrable_rootTreeWitnessCount (fun _ : Fin n => uniformLaw) (cellCoordinateGraph n k) (fun _ => univ) r (S.erase r) MeasurableSet.univ) (component_indicator_le_rootWitness (cellCoordinateGraph n k) S r hr) have hb := integral_rootTreeWitnessCount_le (fun _ : Fin n => uniformLaw) (cellCoordinateGraph n k) (fun _ => univ) r (S.erase r) 1 (3/(k : ℝ)) (by norm_num) (by positivity) MeasurableSet.univ (by simp) (fun i j hij y => cell_adjacent_child_mass_le k hk y) apply hcover.trans simpa only [Finset.insert_erase hr, mul_one] using hb
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_component_probability_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:162

[The number of actual size-m components, each counted once by its vertex set.

Definition (Lean source)
n k m :
ℕ
x :
cellComponentCount n k m x :
ℝ
theorem cellComponentCount_eq

The literal component count equals the sum of the actual component indicators. Under the stated assumptions. The stated conclusion follows.

Formal statement
n k m :
ℕ
x :
= ∑ S ∈ (Finset.univ : Finset (Fin n)).powersetCard m, if IsComponent (originalRecordSignGraph k x) S then (1 : ℝ) else 0
Proof (Lean source)
-- @node: cellComponentCount_eq lemma cellComponentCount_eq (n k m : ℕ) (x : Fin n → Covariate) : cellComponentCount n k m x = ∑ S ∈ (Finset.univ : Finset (Fin n)).powersetCard m, if IsComponent (originalRecordSignGraph k x) S then (1 : ℝ) else 0 := by unfold cellComponentCount labeledComponentCount simp_rw [cell_componentEvent_eq] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellComponentCount_eq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:191
theorem cellComponentCount_integral_le

Expected size-m components obey the precise unrooted subset coefficient. Under the stated assumptions.

Formal statement
n k m :
ℕ
hk :
1 ≤ k
hm :
1 ≤ m
(∫ x, cellComponentCount n k m x ∂Measure.pi (fun _ : Fin n => uniformLaw))
≤ (n.choose m : ℝ) * (m : ℝ)^(m-1) * (3/(k : ℝ))^(m-1)
Proof (Lean source)
-- @node: cellComponentCount_integral_le lemma cellComponentCount_integral_le (n k m : ℕ) (hk : 1 ≤ k) (hm : 1 ≤ m) : (∫ x, cellComponentCount n k m x ∂Measure.pi (fun _ : Fin n => uniformLaw)) ≤ (n.choose m : ℝ) * (m : ℝ)^(m-1) * (3/(k : ℝ))^(m-1) := by simp_rw [cellComponentCount_eq] rw [integral_finsetSum _ (fun S _ => cell_component_indicator_integrable k S)] calc _ ≤ ∑ _S ∈ (Finset.univ : Finset (Fin n)).powersetCard m, (m : ℝ)^(m-1) * (3/(k : ℝ))^(m-1) := by apply Finset.sum_le_sum intro S hS have hcard := (Finset.mem_powersetCard.mp hS).2 have hnonempty : S.Nonempty := Finset.card_pos.mp (by omega) simpa only [hcard] using cell_component_probability_le k hk S hnonempty _ = _ := by simp; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellComponentCount_integral_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:201

[The finite weighted count of all non-singleton components. Sizes above n contribute zero.

Definition (Lean source)
n k :
ℕ
B :
ℝ
x :
cellComponentWeight n k B x :
ℝ
∑ j ∈ range n, ((j+2 : ℕ) : ℝ)^4 * B^(j+2) * cellComponentCount n k (j+2) x
theorem cellComponentWeight_integrable

The weighted component count is an integrable statistic of the original covariates. the stated conclusion holds.

Formal statement
n k :
ℕ
B :
ℝ
Integrable (cellComponentWeight n k B) (Measure.pi (fun _ : Fin n => uniformLaw))
Proof (Lean source)
-- @node: cellComponentWeight_integrable lemma cellComponentWeight_integrable (n k : ℕ) (B : ℝ) : Integrable (cellComponentWeight n k B) (Measure.pi (fun _ : Fin n => uniformLaw)) := by unfold cellComponentWeight cellComponentCount apply integrable_finsetSum intro j hj exact (integrable_labeledComponentCount (fun _ : Fin n => uniformLaw) (cellCoordinateGraph n k) univ (fun _ => univ) (j+2) (fun _ => MeasurableSet.univ)).const_mul _
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellComponentWeight_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:224
theorem cellComponentWeight_integral_tree_le

The weighted spanning-tree envelope applies to the actual original-covariate graph. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n k :
ℕ
hk :
1 ≤ k
B :
ℝ
hB :
0 ≤ B
(∫ x, cellComponentWeight n k B x ∂Measure.pi (fun _ : Fin n => uniformLaw))
≤ ∑ j ∈ range n, ((j+2 : ℕ) : ℝ)^4 * B^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1)
Proof (Lean source)
-- @node: cellComponentWeight_integral_tree_le lemma cellComponentWeight_integral_tree_le (n k : ℕ) (hk : 1 ≤ k) (B : ℝ) (hB : 0 ≤ B) : (∫ x, cellComponentWeight n k B x ∂Measure.pi (fun _ : Fin n => uniformLaw)) ≤ ∑ j ∈ range n, ((j+2 : ℕ) : ℝ)^4 * B^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1) := by unfold cellComponentWeight rw [integral_finsetSum] · apply Finset.sum_le_sum intro j hj rw [integral_const_mul] have hb := mul_le_mul_of_nonneg_left (cellComponentCount_integral_le n k (j+2) hk (by omega)) (show 0 ≤ ((j+2 : ℕ) : ℝ)^4 * B^(j+2) by positivity) simpa only [show j+2-1 = j+1 by omega, mul_assoc] using hb · intro j hj exact (integrable_labeledComponentCount (fun _ : Fin n => uniformLaw) (cellCoordinateGraph n k) univ (fun _ => univ) (j+2) (fun _ => MeasurableSet.univ)).const_mul _
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellComponentWeight_integral_tree_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:235
theorem cellComponentWeight_integral_eight_le

At the prescribed occupancy threshold, actual components have quadratic expected weight. Under the stated assumptions. Under the stated assumptions.

Formal statement
n k :
ℕ
hk :
1 ≤ k
hnk :
(n : ℝ) / (k : ℝ) ≤ 1 / (96 * exp 1)
(∫ x, cellComponentWeight n k 8 x ∂Measure.pi (fun _ : Fin n => uniformLaw))
≤ 96*exp 2*8^2*(n : ℝ)^2/(k : ℝ)
Proof (Lean source)
-- @node: cellComponentWeight_integral_eight_le lemma cellComponentWeight_integral_eight_le (n k : ℕ) (hk : 1 ≤ k) (hnk : (n : ℝ) / (k : ℝ) ≤ 1 / (96 * exp 1)) : (∫ x, cellComponentWeight n k 8 x ∂Measure.pi (fun _ : Fin n => uniformLaw)) ≤ 96*exp 2*8^2*(n : ℝ)^2/(k : ℝ) := by exact (cellComponentWeight_integral_tree_le n k hk 8 (by norm_num)).trans (mixture_tree_sum_eight_bound n k n hk hnk)
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellComponentWeight_integral_eight_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:257
theorem cellComponentCount_eq_components

[Counting component supports by size agrees with counting the graph quotient. The finite powerset representation supplies a measurable statistic despite the sample-dependent type of connected components. the documented result

Formal statement
n k m :
ℕ
x :
= let G := originalRecordSignGraph k x let : Fintype G.ConnectedComponent := Fintype.ofFinite _ ∑ c : G.ConnectedComponent, if c.supp.toFinset.card = m then (1 : ℝ) else 0
Proof (Lean source)
-- @node: cellComponentCount_eq_components lemma cellComponentCount_eq_components (n k m : ℕ) (x : Fin n → Covariate) : cellComponentCount n k m x = let G := originalRecordSignGraph k x let : Fintype G.ConnectedComponent := Fintype.ofFinite _ ∑ c : G.ConnectedComponent, if c.supp.toFinset.card = m then (1 : ℝ) else 0 := by classical dsimp only let G := originalRecordSignGraph k x let : Fintype G.ConnectedComponent := Fintype.ofFinite _ rw [cellComponentCount_eq] change (∑ S ∈ (Finset.univ : Finset (Fin n)).powersetCard m, if IsComponent G S then (1 : ℝ) else 0) = _ rw [← Finset.sum_filter] symm rw [← Finset.sum_filter] apply Finset.sum_bij (fun c _ => c.supp.toFinset) · intro c hc have hcard := (Finset.mem_filter.mp hc).2 apply Finset.mem_filter.mpr refine ⟨Finset.mem_powersetCard.mpr ⟨Finset.subset_univ _, hcard⟩, ?_⟩ apply (isComponent_iff_exists_connectedComponent G _).mpr exact ⟨c, by simp⟩ · intro c hc d hd hcd apply SimpleGraph.ConnectedComponent.supp_injective simpa using congrArg (fun S : Finset (Fin n) => (S : Set (Fin n))) hcd · intro S hS obtain ⟨c, hc⟩ := (isComponent_iff_exists_connectedComponent G S).mp (Finset.mem_filter.mp hS).2 refine ⟨c, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩, ?_⟩ · simpa only [hc, Finset.toFinset_coe] using (Finset.mem_powersetCard.mp (Finset.mem_filter.mp hS).1).2 · simp only [hc, Finset.toFinset_coe] · intro c hc rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellComponentCount_eq_components · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:266
theorem cellComponentWeight_eq_components

The finite size sum is exactly the non-singleton weighted component sum. Under the stated assumptions.

Formal statement
n k :
ℕ
B :
ℝ
x :
= let G := originalRecordSignGraph k x let : Fintype G.ConnectedComponent := Fintype.ofFinite _ ∑ c : G.ConnectedComponent, if 2 ≤ c.supp.toFinset.card then (c.supp.toFinset.card : ℝ)^4 * B^c.supp.toFinset.card else 0
Proof (Lean source)
-- @node: cellComponentWeight_eq_components lemma cellComponentWeight_eq_components (n k : ℕ) (B : ℝ) (x : Fin n → Covariate) : cellComponentWeight n k B x = let G := originalRecordSignGraph k x let : Fintype G.ConnectedComponent := Fintype.ofFinite _ ∑ c : G.ConnectedComponent, if 2 ≤ c.supp.toFinset.card then (c.supp.toFinset.card : ℝ)^4 * B^c.supp.toFinset.card else 0 := by classical dsimp only let G := originalRecordSignGraph k x let : Fintype G.ConnectedComponent := Fintype.ofFinite _ unfold cellComponentWeight simp_rw [cellComponentCount_eq_components, Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro c hc have hcard : c.supp.toFinset.card ≤ n := by simpa using Finset.card_le_card (Finset.subset_univ c.supp.toFinset) by_cases htwo : 2 ≤ c.supp.toFinset.card · rw [if_pos htwo] rw [Finset.sum_eq_single (c.supp.toFinset.card-2)] · rw [Nat.sub_add_cancel htwo] simp only [ite_true, mul_one] · intro j hj hne have hjne : c.supp.toFinset.card ≠ j+2 := by omega simp only [if_neg hjne, mul_zero] · intro hnot have hmem : c.supp.toFinset.card-2 ∈ range n := by rw [Finset.mem_range] omega exact (hnot hmem).elim · rw [if_neg htwo] apply Finset.sum_eq_zero intro j hj have hjne : c.supp.toFinset.card ≠ j+2 := by omega simp only [if_neg hjne, mul_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellComponentWeight_eq_components · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:306
theorem mixture_weighted_component_integral_bound

[The complete component Taylor coefficient integrates to the paper's explicit mixture constant, for either amplitude product. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n k :
ℕ
hk :
1 ≤ k
hnk :
(n : ℝ) / (k : ℝ) ≤ 1 / (96 * exp 1)
M ω :
ℝ
M^4 * ω^2 * (∫ x, cellComponentWeight n k 8 x ∂Measure.pi (fun _ : Fin n => uniformLaw))
≤ (96 * exp 2 * 8^2 * M^4) * (n : ℝ)^2 / (k : ℝ) * ω^2
Proof (Lean source)
-- @node: mixture_weighted_component_integral_bound lemma mixture_weighted_component_integral_bound (n k : ℕ) (hk : 1 ≤ k) (hnk : (n : ℝ) / (k : ℝ) ≤ 1 / (96 * exp 1)) (M ω : ℝ) : M^4 * ω^2 * (∫ x, cellComponentWeight n k 8 x ∂Measure.pi (fun _ : Fin n => uniformLaw)) ≤ (96 * exp 2 * 8^2 * M^4) * (n : ℝ)^2 / (k : ℝ) * ω^2 := by apply (mul_le_mul_of_nonneg_left (cellComponentWeight_integral_eight_le n k hk hnk) (show 0 ≤ M^4 * ω^2 by positivity)).trans_eq ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_weighted_component_integral_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureCovariateOccupancy.lean:345
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureDensities 17 declarations Finite cell integration identifies the one-record density relative to the uniform four-label reference, with the actual law's cells substituted.

Densities of the actual original-record laws

Finite cell integration identifies the one-record density relative to the uniform four-label reference, with the actual law's cells substituted.

def recordCellDensity

[The relative density uses the actual continuous cells of the observed law.

Definition (Lean source)
recordCellDensity P o :
ℝ
4 * P.cells o.2.1 o.2.2 o.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordCellDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:17
theorem recordCellDensity_measurable

Discrete label selection preserves measurability of continuous cell functions. The stated conclusion follows.

Formal statement
Proof (Lean source)
-- @node: recordCellDensity_measurable @[fun_prop] lemma recordCellDensity_measurable (P : ObservedLaw) : Measurable (recordCellDensity P) := by have he : recordCellDensity P = (fun o : Record => 4 * (if o.2.1 then (if o.2.2 then P.cells true true o.1 else P.cells true false o.1) else (if o.2.2 then P.cells false true o.1 else P.cells false false o.1))) := by funext o rcases o with ⟨x, a, y⟩ cases a <;> cases y <;> rfl rw [he] have hc (a y : Bool) : Measurable (fun o : Record => P.cells a y o.1) := (P.continuous_cells a y).measurable.comp measurable_fst exact ((hc true true).ite (measurableSet_eq_fun (by fun_prop) measurable_const) (hc true false)).ite (measurableSet_eq_fun (by fun_prop) measurable_const) ((hc false true).ite (measurableSet_eq_fun (by fun_prop) measurable_const) (hc false false)) |>.const_mul 4
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordCellDensity_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:22
theorem recordCellDensity_nonneg

Cell positivity makes the explicit likelihood ratio nonnegative. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: recordCellDensity_nonneg lemma recordCellDensity_nonneg (P : ObservedLaw) (o : Record) : 0 ≤ recordCellDensity P o := mul_nonneg (by norm_num) (P.interior_cells _ _ _).1.le
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordCellDensity_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:40
theorem uniformObservedLaw_withDensity

A law with public uniform design is its explicit cell density times the reference. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hP :
Measure.map covariate P.measure = uniformLaw
P.measure = recordReference.withDensity (fun o => ofReal (recordCellDensity P o))
Proof (Lean source)
-- @node: uniformObservedLaw_withDensity lemma uniformObservedLaw_withDensity (P : ObservedLaw) (hP : Measure.map covariate P.measure = uniformLaw) : P.measure = recordReference.withDensity (fun o => ofReal (recordCellDensity P o)) := by apply Measure.ext_of_lintegral intro f hf have hd := (recordCellDensity_measurable P).ennreal_ofReal rw [lintegral_withDensity_eq_lintegral_mul _ hd hf, P.disintegration, hP, lintegral_jointLaw_cells P f hf] change _ = ∫⁻ o, ofReal (recordCellDensity P o) * f o ∂jointLaw uniformLaw (fun _ _ _ => 1/4) have hnull : (lawFromCells (fun _ _ _ => 1/4) fairDefault_valid).cells = (fun _ _ _ => (1/4 : ℝ)) := rfl rw [← hnull] rw [lintegral_jointLaw_cells (lawFromCells (fun _ _ _ => 1/4) fairDefault_valid) (fun o => ofReal (recordCellDensity P o) * f o) (hd.mul hf)] apply lintegral_congr intro x apply Finset.sum_congr rfl intro a _ apply Finset.sum_congr rfl intro y _ change ofReal (P.cells a y x) * f (x,a,y) = ofReal (1/4) * (ofReal (4 * P.cells a y x) * f (x,a,y)) rw [← mul_assoc, ← ENNReal.ofReal_mul (by norm_num : (0 : ℝ) ≤ 1/4)] congr 2 ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformObservedLaw_withDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:46

[The reference is the probability law of uniform covariates and fair labels. the stated conclusion holds.

Definition (Lean source)
-- @node: recordReference_probability instance recordReference_probability : IsProbabilityMeasure recordReference := jointLaw_probability _ fairDefault_valid
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordReference_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:75
theorem recordCellDensity_integrable

Continuous interior cells give a bounded integrable relative density. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: recordCellDensity_integrable lemma recordCellDensity_integrable (P : ObservedLaw) : Integrable (recordCellDensity P) recordReference := by apply (integrable_const (4 : ℝ)).mono' (recordCellDensity_measurable P).aestronglyMeasurable filter_upwards [] with o rw [Real.norm_eq_abs, abs_of_nonneg (recordCellDensity_nonneg P o)] change 4 * P.cells o.2.1 o.2.2 o.1 ≤ 4 linarith [(P.interior_cells o.2.1 o.2.2 o.1).2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordCellDensity_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:80
def sampleCellDensity

The actual iid likelihood retains every original covariate and label.

Definition (Lean source)
n :
ℕ
o :
Fin n → Record
sampleCellDensity n P o :
ℝ
∏ i, recordCellDensity P (o i)
CausalSmith.Stat.LogoddsLowsmoothFrontier.sampleCellDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:91
theorem sampleCellDensity_measurable

Finite products of the cell densities are measurable. The stated conclusion follows.

Formal statement
n :
ℕ
Proof (Lean source)
-- @node: sampleCellDensity_measurable @[fun_prop] lemma sampleCellDensity_measurable (n : ℕ) (P : ObservedLaw) : Measurable (sampleCellDensity n P) := by unfold sampleCellDensity fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.sampleCellDensity_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:96
theorem sampleCellDensity_nonneg

The iid likelihood is nonnegative, including for an empty sample. the stated conclusion holds.

Formal statement
n :
ℕ
o :
Fin n → Record
0 ≤ sampleCellDensity n P o
Proof (Lean source)
-- @node: sampleCellDensity_nonneg lemma sampleCellDensity_nonneg (n : ℕ) (P : ObservedLaw) (o : Fin n → Record) : 0 ≤ sampleCellDensity n P o := Finset.prod_nonneg (fun i _ => recordCellDensity_nonneg P (o i))
CausalSmith.Stat.LogoddsLowsmoothFrontier.sampleCellDensity_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:103
theorem uniformObservedLaw_iid_withDensity

Rectangle integration proves the explicit product density for the actual iid law. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
hP :
Measure.map covariate P.measure = uniformLaw
iidLaw P.measure n
= (Measure.pi (fun _ : Fin n => recordReference)).withDensity (fun o => ofReal (sampleCellDensity n P o))
Proof (Lean source)
-- @node: uniformObservedLaw_iid_withDensity lemma uniformObservedLaw_iid_withDensity (n : ℕ) (P : ObservedLaw) (hP : Measure.map covariate P.measure = uniformLaw) : iidLaw P.measure n = (Measure.pi (fun _ : Fin n => recordReference)).withDensity (fun o => ofReal (sampleCellDensity n P o)) := by apply Measure.pi_eq intro s hs rw [withDensity_apply _ (MeasurableSet.univ_pi hs), Measure.restrict_pi_pi] have hi : ∀ i : Fin n, Integrable (recordCellDensity P) (recordReference.restrict (s i)) := fun i => (recordCellDensity_integrable P).restrict have hp := Integrable.fintype_prod_dep hi unfold sampleCellDensity rw [← ofReal_integral_eq_lintegral_ofReal hp (Filter.Eventually.of_forall (sampleCellDensity_nonneg n P))] rw [integral_fintype_prod_eq_prod] rw [ENNReal.ofReal_prod_of_nonneg (fun i _ => integral_nonneg (recordCellDensity_nonneg P))] apply Finset.prod_congr rfl intro i _ rw [ofReal_integral_eq_lintegral_ofReal (hi i) (Filter.Eventually.of_forall (recordCellDensity_nonneg P))] rw [uniformObservedLaw_withDensity P hP, withDensity_apply _ (hs i)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformObservedLaw_iid_withDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:109
theorem uniformObservedLaw_iid_rnDeriv

The product reference sees the explicit iid likelihood as its actual RN derivative. Under the stated assumptions.

Formal statement
n :
ℕ
hP :
Measure.map covariate P.measure = uniformLaw
(fun o => ((iidLaw P.measure n).rnDeriv (Measure.pi (fun _ : Fin n => recordReference)) o).toReal)
=ᵐ[ Measure.pi (fun _ : Fin n => recordReference)] sampleCellDensity n P
Proof (Lean source)
-- @node: uniformObservedLaw_iid_rnDeriv lemma uniformObservedLaw_iid_rnDeriv (n : ℕ) (P : ObservedLaw) (hP : Measure.map covariate P.measure = uniformLaw) : (fun o => ((iidLaw P.measure n).rnDeriv (Measure.pi (fun _ : Fin n => recordReference)) o).toReal) =ᵐ[ Measure.pi (fun _ : Fin n => recordReference)] sampleCellDensity n P := by have h := Measure.rnDeriv_withDensity (Measure.pi (fun _ : Fin n => recordReference)) (sampleCellDensity_measurable n P).ennreal_ofReal rw [← uniformObservedLaw_iid_withDensity n P hP] at h filter_upwards [h] with o ho rw [ho, ENNReal.toReal_ofReal (sampleCellDensity_nonneg n P o)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformObservedLaw_iid_rnDeriv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:134
def signMixtureCellDensity

The sign is averaged once over the entire original sample likelihood.

Definition (Lean source)
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
o :
Fin n → Record
signMixtureCellDensity n k laws o :
ℝ
(2 : ℝ)^(-(k+1 : ℕ) : ℤ) * ∑ σ, sampleCellDensity n (laws σ) o
CausalSmith.Stat.LogoddsLowsmoothFrontier.signMixtureCellDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:147
theorem signMixtureCellDensity_measurable

A finite prior of measurable likelihoods is measurable. The stated conclusion follows.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
Proof (Lean source)
-- @node: signMixtureCellDensity_measurable @[fun_prop] lemma signMixtureCellDensity_measurable (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) : Measurable (signMixtureCellDensity n k laws) := by unfold signMixtureCellDensity fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.signMixtureCellDensity_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:153
theorem signMixtureCellDensity_nonneg

Every finite-prior likelihood is nonnegative. the stated conclusion holds.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
o :
Fin n → Record
0 ≤ signMixtureCellDensity n k laws o
Proof (Lean source)
-- @node: signMixtureCellDensity_nonneg lemma signMixtureCellDensity_nonneg (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (o : Fin n → Record) : 0 ≤ signMixtureCellDensity n k laws o := by apply mul_nonneg (by positivity) exact Finset.sum_nonneg (fun σ _ => sampleCellDensity_nonneg n (laws σ) o)
CausalSmith.Stat.LogoddsLowsmoothFrontier.signMixtureCellDensity_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:161
theorem finiteSignMixture_withDensity

Finite averaging identifies the density of the actual shared-sign experiment. the stated conclusion holds. Under the stated assumptions.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
hU :
∀ σ, Measure.map covariate (laws σ).measure = uniformLaw
= (Measure.pi (fun _ : Fin n => recordReference)).withDensity (fun o => ofReal (signMixtureCellDensity n k laws o))
Proof (Lean source)
-- @node: finiteSignMixture_withDensity lemma finiteSignMixture_withDensity (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (hU : ∀ σ, Measure.map covariate (laws σ).measure = uniformLaw) : finiteSignMixture n k laws = (Measure.pi (fun _ : Fin n => recordReference)).withDensity (fun o => ofReal (signMixtureCellDensity n k laws o)) := by unfold finiteSignMixture simp_rw [uniformObservedLaw_iid_withDensity n _ (hU _)] apply Measure.ext intro s hs simp only [Measure.smul_apply, Measure.finsetSum_apply, hs, withDensity_apply] simp only [signMixtureCellDensity, ENNReal.ofReal_mul (show 0 ≤ (2 : ℝ)^(-(k+1 : ℕ) : ℤ) by positivity), ENNReal.ofReal_sum_of_nonneg (fun σ _ => sampleCellDensity_nonneg n (laws σ) _)] rw [lintegral_const_mul _ (by fun_prop), lintegral_finsetSum] · rfl · intro σ _ exact (sampleCellDensity_measurable n (laws σ)).ennreal_ofReal
CausalSmith.Stat.LogoddsLowsmoothFrontier.finiteSignMixture_withDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:169
theorem finiteSignMixture_rnDeriv

The RN derivative is the finite average of actual original-sample likelihoods. the stated conclusion holds. Under the stated assumptions.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
hU :
∀ σ, Measure.map covariate (laws σ).measure = uniformLaw
(fun o => ((finiteSignMixture n k laws).rnDeriv (Measure.pi (fun _ : Fin n => recordReference)) o).toReal)
=ᵐ[ Measure.pi (fun _ : Fin n => recordReference)] signMixtureCellDensity n k laws
Proof (Lean source)
-- @node: finiteSignMixture_rnDeriv lemma finiteSignMixture_rnDeriv (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (hU : ∀ σ, Measure.map covariate (laws σ).measure = uniformLaw) : (fun o => ((finiteSignMixture n k laws).rnDeriv (Measure.pi (fun _ : Fin n => recordReference)) o).toReal) =ᵐ[ Measure.pi (fun _ : Fin n => recordReference)] signMixtureCellDensity n k laws := by have h := Measure.rnDeriv_withDensity (Measure.pi (fun _ : Fin n => recordReference)) (signMixtureCellDensity_measurable n k laws).ennreal_ofReal rw [← finiteSignMixture_withDensity n k laws hU] at h filter_upwards [h] with o ho rw [ho, ENNReal.toReal_ofReal (signMixtureCellDensity_nonneg n k laws o)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.finiteSignMixture_rnDeriv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:190
theorem signMixtureCellDensity_card_average

The sign-prior weight equals the inverse number of sign vectors used in component factorization. the stated conclusion holds.

Formal statement
n k :
ℕ
laws :
(Fin (k+1) → Bool) → ObservedLaw
o :
Fin n → Record
= (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, recordCellDensity (laws σ) (o i)
Proof (Lean source)
-- @node: signMixtureCellDensity_card_average lemma signMixtureCellDensity_card_average (n k : ℕ) (laws : (Fin (k+1) → Bool) → ObservedLaw) (o : Fin n → Record) : signMixtureCellDensity n k laws o = (card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, recordCellDensity (laws σ) (o i) := by simp only [signMixtureCellDensity, sampleCellDensity, Fintype.card_fun, Fintype.card_bool, Fintype.card_fin, Nat.cast_pow, Nat.cast_ofNat, zpow_neg, zpow_natCast]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signMixtureCellDensity_card_average · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureDensities.lean:204
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureHellinger 8 declarations The density floor converts a component likelihood difference into the roadmap's exponential component bound.

Component Hellinger bounds for the original-record mixtures

The density floor converts a component likelihood difference into the roadmap's exponential component bound. Affinity tensorization then adds component bounds, with exactly matching singleton components removed from the sum.

theorem mixture_sqrt_difference_le Lemma mixture_sqrt_difference_le in the paper ↗

A positive common density floor controls squared square-root discrepancy. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
f g a d :
ℝ
ha :
0 < a
hf :
a ≤ f
hg :
a ≤ g
_hd :
0 ≤ d
hfg :
|f - g| ≤ d
(sqrt f - sqrt g) ^ 2 ≤ d ^ 2/(4 * a)
Proof (Lean source)
-- @node: mixture_sqrt_difference_le lemma mixture_sqrt_difference_le (f g a d : ℝ) (ha : 0 < a) (hf : a ≤ f) (hg : a ≤ g) (_hd : 0 ≤ d) (hfg : |f - g| ≤ d) : (sqrt f - sqrt g) ^ 2 ≤ d ^ 2/(4 * a) := by have hf0 := ha.le.trans hf have hg0 := ha.le.trans hg have hsf := Real.sq_sqrt hf0 have hsg := Real.sq_sqrt hg0 have hsa := Real.sq_sqrt ha.le have hfl := Real.sqrt_le_sqrt hf have hgl := Real.sqrt_le_sqrt hg have hs : 4 * a ≤ (sqrt f+sqrt g) ^ 2 := by nlinarith [Real.sqrt_nonneg a, Real.sqrt_nonneg f, Real.sqrt_nonneg g] have he : (sqrt f-sqrt g) ^ 2 * (sqrt f+sqrt g) ^ 2 = (f - g) ^ 2 := by calc _ = ((sqrt f) ^ 2-(sqrt g) ^ 2) ^ 2 := by ring _ = _ := by rw [hsf, hsg] have hsq : (f - g) ^ 2 ≤ d ^ 2 := by have := mul_self_le_mul_self (abs_nonneg (f - g)) hfg simpa only [← sq, sq_abs] using this apply (le_div_iff₀ (by positivity : 0 < 4 * a)).2 calc _ ≤ (sqrt f-sqrt g) ^ 2 * (sqrt f+sqrt g) ^ 2 := mul_le_mul_of_nonneg_left hs (sq_nonneg _) _ = (f - g) ^ 2 := he _ ≤ d ^ 2 := hsq
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_sqrt_difference_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:17
theorem mixture_component_pointwise_bound Lemma mixture_component_pointwise_bound in the paper ↗

[The component density floor and mixed Taylor difference give the exact M⁴ m⁴ 8ᵐ coefficient used by the mixture roadmap. The fair difference bound is smaller and can use this same result. the documented result Under the stated assumptions.

Formal statement
m :
ℕ
M ω f g :
ℝ
hf :
((2 : ℝ) ^ m)⁻¹ ≤ f
hg :
((2 : ℝ) ^ m)⁻¹ ≤ g
hfg :
|f - g| ≤ 2 * M ^ 2 * (m : ℝ) ^ 2 * 2 ^ m * |ω|
(sqrt f-sqrt g) ^ 2 ≤ M ^ 4 * (m : ℝ) ^ 4 * 8 ^ m * ω ^ 2
Proof (Lean source)
-- @node: mixture_component_pointwise_bound lemma mixture_component_pointwise_bound (m : ℕ) (M ω f g : ℝ) (hf : ((2 : ℝ) ^ m)⁻¹ ≤ f) (hg : ((2 : ℝ) ^ m)⁻¹ ≤ g) (hfg : |f - g| ≤ 2 * M ^ 2 * (m : ℝ) ^ 2 * 2 ^ m * |ω|) : (sqrt f-sqrt g) ^ 2 ≤ M ^ 4 * (m : ℝ) ^ 4 * 8 ^ m * ω ^ 2 := by have h := mixture_sqrt_difference_le f g ((2 : ℝ) ^ m)⁻¹ (2 * M ^ 2 * (m : ℝ) ^ 2 * 2 ^ m * |ω|) (by positivity) hf hg (by positivity) hfg apply h.trans_eq have hp : (8 : ℝ) ^ m = (2 : ℝ) ^ m * (2 : ℝ) ^ m * (2 : ℝ) ^ m := by rw [← mul_pow, ← mul_pow] norm_num rw [hp] field_simp simp only [sq_abs] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_component_pointwise_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:45
theorem mixture_component_hellinger_bound Lemma mixture_component_hellinger_bound in the paper ↗

[Integrating the component pointwise estimate against its probability reference preserves its coefficient. No independence inside a component is used. the documented result Under the stated assumptions.

Formal statement
Ω :
m :
ℕ
M ω :
ℝ
f g :
Ω → ℝ
hf :
∀ x, ((2 : ℝ) ^ m)⁻¹ ≤ f x
hg :
∀ x, ((2 : ℝ) ^ m)⁻¹ ≤ g x
hfg :
∀ x, |f x - g x| ≤ 2 * M ^ 2 * (m : ℝ) ^ 2 * 2 ^ m * |ω|
hellingerSqDensity μ f g ≤ M ^ 4 * (m : ℝ) ^ 4 * 8 ^ m * ω ^ 2
Proof (Lean source)
-- @node: mixture_component_hellinger_bound lemma mixture_component_hellinger_bound {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (m : ℕ) (M ω : ℝ) (f g : Ω → ℝ) (hf : ∀ x, ((2 : ℝ) ^ m)⁻¹ ≤ f x) (hg : ∀ x, ((2 : ℝ) ^ m)⁻¹ ≤ g x) (hfg : ∀ x, |f x - g x| ≤ 2 * M ^ 2 * (m : ℝ) ^ 2 * 2 ^ m * |ω|) : Causalean.Stat.hellingerSqDensity μ f g ≤ M ^ 4 * (m : ℝ) ^ 4 * 8 ^ m * ω ^ 2 := by unfold Causalean.Stat.hellingerSqDensity calc _ ≤ ∫ _x : Ω, M ^ 4 * (m : ℝ) ^ 4 * 8 ^ m * ω ^ 2 ∂μ := integral_mono_of_nonneg (Filter.Eventually.of_forall (fun x => sq_nonneg _)) (integrable_const _) (Filter.Eventually.of_forall (fun x => mixture_component_pointwise_bound m M ω (f x) (g x) (hf x) (hg x) (hfg x))) _ = _ := by simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_component_hellinger_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:64
theorem mixture_affinity_bounds Lemma mixture_affinity_bounds in the paper ↗

[Affinities of normalized integrable nonnegative densities lie in [0,1]. The upper bound follows from the nonnegative Hellinger discrepancy identity. the documented result Under the stated assumptions.

Formal statement
Ω :
μ :
f g :
Ω → ℝ
hf :
hg :
hf0 :
∀ x, 0 ≤ f x
hg0 :
∀ x, 0 ≤ g x
hf1 :
∫ x, f x ∂μ = 1
hg1 :
∫ x, g x ∂μ = 1
conclusion 1
0 ≤ densityAffinity μ f g
conclusion 2
densityAffinity μ f g ≤ 1
Proof (Lean source)
-- @node: mixture_affinity_bounds lemma mixture_affinity_bounds {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) (f g : Ω → ℝ) (hf : Integrable f μ) (hg : Integrable g μ) (hf0 : ∀ x, 0 ≤ f x) (hg0 : ∀ x, 0 ≤ g x) (hf1 : ∫ x, f x ∂μ = 1) (hg1 : ∫ x, g x ∂μ = 1) : 0 ≤ densityAffinity μ f g ∧ densityAffinity μ f g ≤ 1 := by refine ⟨integral_nonneg (fun x => Real.sqrt_nonneg _), ?_⟩ have hn : 0 ≤ hellingerSqDensity μ f g := integral_nonneg (fun x => sq_nonneg _) rw [hellingerSqDensity_eq_two_mul_one_sub_affinity μ f g hf hg hf0 hg0 hf1 hg1] at hn linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_affinity_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:80
theorem mixture_hellinger_tensor_le_sum Lemma mixture_hellinger_tensor_le_sum in the paper ↗

[For conditionally independent components, the full Hellinger discrepancy is at most the sum of the component discrepancies. This combines the library's exact tensorized affinity with its finite product defect inequality. the documented result Under the stated assumptions.

Formal statement
ι :
Type*
ι → Type*
∀ i, MeasurableSpace (Ω i)
μ :
∀ i, Measure (Ω i)
∀ i, SigmaFinite (μ i)
f g :
∀ i
if
Ω i
then
ℝ
hf :
∀ i, Integrable (f i) (μ i)
hg :
∀ i, Integrable (g i) (μ i)
hf0 :
∀ i x, 0 ≤ f i x
hg0 :
∀ i x, 0 ≤ g i x
hf1 :
∀ i, ∫ x, f i x ∂μ i = 1
hg1 :
∀ i, ∫ x, g i x ∂μ i = 1
hellingerSqDensity (Measure.pi μ) (fun x => ∏ i, f i (x i)) (fun x => ∏ i, g i (x i))
≤ ∑ i, hellingerSqDensity (μ i) (f i) (g i)
Proof (Lean source)
-- @node: mixture_hellinger_tensor_le_sum lemma mixture_hellinger_tensor_le_sum {ι : Type*} [Fintype ι] {Ω : ι → Type*} [∀ i, MeasurableSpace (Ω i)] (μ : ∀ i, Measure (Ω i)) [∀ i, SigmaFinite (μ i)] (f g : ∀ i, Ω i → ℝ) (hf : ∀ i, Integrable (f i) (μ i)) (hg : ∀ i, Integrable (g i) (μ i)) (hf0 : ∀ i x, 0 ≤ f i x) (hg0 : ∀ i x, 0 ≤ g i x) (hf1 : ∀ i, ∫ x, f i x ∂μ i = 1) (hg1 : ∀ i, ∫ x, g i x ∂μ i = 1) : hellingerSqDensity (Measure.pi μ) (fun x => ∏ i, f i (x i)) (fun x => ∏ i, g i (x i)) ≤ ∑ i, hellingerSqDensity (μ i) (f i) (g i) := by have hF : Integrable (fun x => ∏ i, f i (x i)) (Measure.pi μ) := Integrable.fintype_prod_dep hf have hG : Integrable (fun x => ∏ i, g i (x i)) (Measure.pi μ) := Integrable.fintype_prod_dep hg have hF0 : ∀ x : (∀ i, Ω i), 0 ≤ ∏ i, f i (x i) := fun x => Finset.prod_nonneg (fun i _ => hf0 i (x i)) have hG0 : ∀ x : (∀ i, Ω i), 0 ≤ ∏ i, g i (x i) := fun x => Finset.prod_nonneg (fun i _ => hg0 i (x i)) have hF1 : ∫ x, (∏ i, f i (x i)) ∂Measure.pi μ = 1 := by rw [integral_fintype_prod_eq_prod] simp [hf1] have hG1 : ∫ x, (∏ i, g i (x i)) ∂Measure.pi μ = 1 := by rw [integral_fintype_prod_eq_prod] simp [hg1] rw [hellingerSqDensity_eq_two_mul_one_sub_affinity (Measure.pi μ) _ _ hF hG hF0 hG0 hF1 hG1, densityAffinity_pi μ f g hf0 hg0] have hb := fun i => mixture_affinity_bounds (μ i) (f i) (g i) (hf i) (hg i) (hf0 i) (hg0 i) (hf1 i) (hg1 i) calc _ ≤ 2 * ∑ i, (1-densityAffinity (μ i) (f i) (g i)) := mul_le_mul_of_nonneg_left (one_sub_prod_le_sum _ (fun i => (hb i).1) (fun i => (hb i).2)) (by norm_num) _ = _ := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _ exact (hellingerSqDensity_eq_two_mul_one_sub_affinity (μ i) (f i) (g i) (hf i) (hg i) (hf0 i) (hg0 i) (hf1 i) (hg1 i)).symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_hellinger_tensor_le_sum · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:96
theorem mixture_hellinger_tensor_without_singletons Lemma mixture_hellinger_tensor_without_singletons in the paper ↗

[Exact singleton matching removes those components from the conditional Hellinger bound, leaving precisely the weighted sum over components of size at least two. the documented result Under the stated assumptions.

Formal statement
ι :
Type*
ι → Type*
∀ i, MeasurableSpace (Ω i)
μ :
∀ i, Measure (Ω i)
∀ i, IsProbabilityMeasure (μ i)
f g :
∀ i
if
Ω i
then
ℝ
m :
ι → ℕ
M ω :
ℝ
hf :
∀ i, Integrable (f i) (μ i)
hg :
∀ i, Integrable (g i) (μ i)
hf1 :
∀ i, ∫ x, f i x ∂μ i = 1
hg1 :
∀ i, ∫ x, g i x ∂μ i = 1
hm :
∀ i, 1 ≤ m i
hflo :
∀ i x, ((2 : ℝ) ^ (m i))⁻¹ ≤ f i x
hglo :
∀ i x, ((2 : ℝ) ^ (m i))⁻¹ ≤ g i x
hSingleton :
∀ i
if
m i = 1
then
f i = g i
hDifference :
∀ i
if
2 ≤ m i
then
∀ x, |f i x - g i x| ≤ 2 * M ^ 2 * (m i : ℝ) ^ 2 * 2 ^ (m i) * |ω|
hellingerSqDensity (Measure.pi μ) (fun x => ∏ i, f i (x i)) (fun x => ∏ i, g i (x i))
≤ M ^ 4 * ω ^ 2 * ∑ i ∈ Finset.univ.filter (fun i => 2 ≤ m i), (m i : ℝ) ^ 4 * 8 ^ (m i)
Proof (Lean source)
-- @node: mixture_hellinger_tensor_without_singletons lemma mixture_hellinger_tensor_without_singletons {ι : Type*} [Fintype ι] {Ω : ι → Type*} [∀ i, MeasurableSpace (Ω i)] (μ : ∀ i, Measure (Ω i)) [∀ i, IsProbabilityMeasure (μ i)] (f g : ∀ i, Ω i → ℝ) (m : ι → ℕ) (M ω : ℝ) (hf : ∀ i, Integrable (f i) (μ i)) (hg : ∀ i, Integrable (g i) (μ i)) (hf1 : ∀ i, ∫ x, f i x ∂μ i = 1) (hg1 : ∀ i, ∫ x, g i x ∂μ i = 1) (hm : ∀ i, 1 ≤ m i) (hflo : ∀ i x, ((2 : ℝ) ^ (m i))⁻¹ ≤ f i x) (hglo : ∀ i x, ((2 : ℝ) ^ (m i))⁻¹ ≤ g i x) (hSingleton : ∀ i, m i = 1 → f i = g i) (hDifference : ∀ i, 2 ≤ m i → ∀ x, |f i x - g i x| ≤ 2 * M ^ 2 * (m i : ℝ) ^ 2 * 2 ^ (m i) * |ω|) : hellingerSqDensity (Measure.pi μ) (fun x => ∏ i, f i (x i)) (fun x => ∏ i, g i (x i)) ≤ M ^ 4 * ω ^ 2 * ∑ i ∈ Finset.univ.filter (fun i => 2 ≤ m i), (m i : ℝ) ^ 4 * 8 ^ (m i) := by classical have hf0 : ∀ i x, 0 ≤ f i x := fun i x => (by positivity : (0 : ℝ) ≤ ((2 : ℝ) ^ (m i))⁻¹).trans (hflo i x) have hg0 : ∀ i x, 0 ≤ g i x := fun i x => (by positivity : (0 : ℝ) ≤ ((2 : ℝ) ^ (m i))⁻¹).trans (hglo i x) apply (mixture_hellinger_tensor_le_sum μ f g hf hg hf0 hg0 hf1 hg1).trans calc _ = ∑ i ∈ Finset.univ.filter (fun i => 2 ≤ m i), hellingerSqDensity (μ i) (f i) (g i) := by symm apply Finset.sum_subset (filter_subset _ _) intro i hi hn have hmi : m i = 1 := by have : ¬ 2 ≤ m i := by simpa only [mem_filter, hi, true_and] using hn have := hm i omega rw [hSingleton i hmi] simp [hellingerSqDensity] _ ≤ ∑ i ∈ Finset.univ.filter (fun i => 2 ≤ m i), M ^ 4 * (m i : ℝ) ^ 4 * 8 ^ (m i) * ω ^ 2 := by apply Finset.sum_le_sum intro i hi exact mixture_component_hellinger_bound (μ i) (m i) M ω (f i) (g i) (hflo i) (hglo i) (hDifference i (Finset.mem_filter.mp hi).2) _ = _ := by rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro i _; ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_hellinger_tensor_without_singletons · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:138
theorem mixture_cubic_geometric_tail Lemma mixture_cubic_geometric_tail in the paper ↗

[A polynomial tail majorant proves the finite cubic geometric sum bound in the occupancy roadmap. It avoids differentiating an infinite power series. the documented result Under the stated assumptions.

Formal statement
q :
ℝ
hq0 :
0 ≤ q
hq :
q ≤ 1 / 4
a N :
ℕ
∑ j ∈ range N, (((a+j : ℕ) : ℝ) + 2) ^ 3 * q ^ j
≤ 2 * (a : ℝ) ^ 3+12 * (a : ℝ) ^ 2+30 * (a : ℝ)+32
Proof (Lean source)
-- @node: mixture_cubic_geometric_tail lemma mixture_cubic_geometric_tail (q : ℝ) (hq0 : 0 ≤ q) (hq : q ≤ 1 / 4) (a N : ℕ) : ∑ j ∈ range N, (((a+j : ℕ) : ℝ) + 2) ^ 3 * q ^ j ≤ 2 * (a : ℝ) ^ 3+12 * (a : ℝ) ^ 2+30 * (a : ℝ)+32 := by induction N generalizing a with | zero => simp only [Finset.range_zero, Nat.cast_add, Finset.sum_empty]; positivity | succ N ih => rw [Finset.sum_range_succ'] have hShift : (∑ j ∈ range N, (((a+(j+1) : ℕ) : ℝ) + 2) ^ 3 * q ^ (j+1)) = q * ∑ j ∈ range N, ((((a+1)+j : ℕ) : ℝ) + 2) ^ 3 * q ^ j := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _ simp only [pow_succ, Nat.add_assoc, Nat.add_comm 1 j] ring rw [hShift] have hP : 0 ≤ 2 * ((a+1 : ℕ) : ℝ) ^ 3+12 * ((a+1 : ℕ) : ℝ) ^ 2+ 30 * ((a+1 : ℕ) : ℝ)+32 := by positivity have hA : 0 ≤ (a : ℝ) := by positivity have hA3 : 0 ≤ (a : ℝ) ^ 3 := by positivity have h1 := mul_le_mul_of_nonneg_left (ih (a+1)) hq0 have h2 := mul_le_mul_of_nonneg_right hq hP push_cast at h1 h2 ⊢ simp only [pow_zero, mul_one, add_zero] at * nlinarith [sq_nonneg (a : ℝ)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_cubic_geometric_tail · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:183
theorem mixture_cubic_geometric_bound Lemma mixture_cubic_geometric_bound in the paper ↗

[At occupancy parameter at most one quarter, the finite non-singleton cubic series is bounded by 32 times that parameter, as in the paper. the documented result Under the stated assumptions.

Formal statement
q :
ℝ
hq0 :
0 ≤ q
hq :
q ≤ 1 / 4
N :
ℕ
∑ j ∈ range N, ((j : ℝ)+2) ^ 3 * q ^ (j+1) ≤ 32 * q
Proof (Lean source)
-- @node: mixture_cubic_geometric_bound lemma mixture_cubic_geometric_bound (q : ℝ) (hq0 : 0 ≤ q) (hq : q ≤ 1 / 4) (N : ℕ) : ∑ j ∈ range N, ((j : ℝ)+2) ^ 3 * q ^ (j+1) ≤ 32 * q := by have h := mixture_cubic_geometric_tail q hq0 hq 0 N simp only [Nat.cast_zero, zero_pow (by decide : 3 ≠ 0), zero_pow (by decide : 2 ≠ 0), mul_zero, zero_add] at h calc _ = q * ∑ j ∈ range N, ((j : ℝ)+2) ^ 3 * q ^ j := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _ rw [pow_succ] ring _ ≤ q * 32 := mul_le_mul_of_nonneg_left h hq0 _ = _ := mul_comm _ _
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_cubic_geometric_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureHellinger.lean:212
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureLabelTensorization 12 declarations Finite sums over labels implement the conditional experiment at fixed original covariates.

Conditional label tensorization on the original record components

Finite sums over labels implement the conditional experiment at fixed original covariates. Regrouping record labels into ownership fibers preserves Hellinger distance; affinity tensorization then bounds it by the sum over components. The factors may themselves be finite sign mixtures, so independence is needed only between components, never between records in one component.

theorem mixture_label_hellinger_affinity Lemma mixture_label_hellinger_affinity in the paper ↗

[Normalized finite label masses have Hellinger discrepancy equal to twice their affinity defect. the documented result Under the stated assumptions.

Formal statement
L :
Type*
f g :
L → ℝ
hf0 :
∀ l, 0 ≤ f l
hg0 :
∀ l, 0 ≤ g l
hf1 :
∑ l, f l = 1
hg1 :
∑ l, g l = 1
(∑ l, (sqrt (f l) - sqrt (g l)) ^ 2) = 2 * (1 - ∑ l, sqrt (f l * g l))
Proof (Lean source)
-- @node: mixture_label_hellinger_affinity lemma mixture_label_hellinger_affinity {L : Type*} [Fintype L] (f g : L → ℝ) (hf0 : ∀ l, 0 ≤ f l) (hg0 : ∀ l, 0 ≤ g l) (hf1 : ∑ l, f l = 1) (hg1 : ∑ l, g l = 1) : (∑ l, (sqrt (f l) - sqrt (g l)) ^ 2) = 2 * (1 - ∑ l, sqrt (f l * g l)) := by have hp (l : L) : (sqrt (f l) - sqrt (g l)) ^ 2 = f l + g l - 2 * sqrt (f l * g l) := by rw [Real.sqrt_mul (hf0 l)] nlinarith [Real.sq_sqrt (hf0 l), Real.sq_sqrt (hg0 l)] simp_rw [hp] rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, ← Finset.mul_sum, hf1, hg1] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_label_hellinger_affinity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:18
theorem mixture_label_affinity_bounds Lemma mixture_label_affinity_bounds in the paper ↗

The affinity of normalized nonnegative finite label masses lies in [0,1]. Under the stated assumptions.

Formal statement
L :
Type*
f g :
L → ℝ
hf0 :
∀ l, 0 ≤ f l
hg0 :
∀ l, 0 ≤ g l
hf1 :
∑ l, f l = 1
hg1 :
∑ l, g l = 1
conclusion 1
0 ≤ ∑ l, sqrt (f l * g l)
conclusion 2
∑ l, sqrt (f l * g l) ≤ 1
Proof (Lean source)
-- @node: mixture_label_affinity_bounds lemma mixture_label_affinity_bounds {L : Type*} [Fintype L] (f g : L → ℝ) (hf0 : ∀ l, 0 ≤ f l) (hg0 : ∀ l, 0 ≤ g l) (hf1 : ∑ l, f l = 1) (hg1 : ∑ l, g l = 1) : 0 ≤ ∑ l, sqrt (f l * g l) ∧ ∑ l, sqrt (f l * g l) ≤ 1 := by refine ⟨Finset.sum_nonneg (fun _ _ => Real.sqrt_nonneg _), ?_⟩ have h := Finset.sum_nonneg (s := univ) (fun l (_ : l ∈ univ) => sq_nonneg (sqrt (f l) - sqrt (g l))) rw [mixture_label_hellinger_affinity f g hf0 hg0 hf1 hg1] at h linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_label_affinity_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:34
theorem mixture_label_tensor_le_sum Lemma mixture_label_tensor_le_sum in the paper ↗

The conditional Hellinger discrepancy of finite independent label blocks is bounded by their summed discrepancies, by exact affinity factorization. the documented result Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
κ :
Type*
κ → Type*
∀ c, Fintype (L c)
f g :
∀ c
if
L c
then
ℝ
hf0 :
∀ c l, 0 ≤ f c l
hg0 :
∀ c l, 0 ≤ g c l
hf1 :
∀ c, ∑ l, f c l = 1
hg1 :
∀ c, ∑ l, g c l = 1
(∑ l : ∀ c, L c, (sqrt (∏ c, f c (l c)) - sqrt (∏ c, g c (l c))) ^ 2)
≤ ∑ c, ∑ l, (sqrt (f c l) - sqrt (g c l)) ^ 2
Proof (Lean source)
-- @node: mixture_label_tensor_le_sum lemma mixture_label_tensor_le_sum {κ : Type*} [Fintype κ] [DecidableEq κ] {L : κ → Type*} [∀ c, Fintype (L c)] (f g : ∀ c, L c → ℝ) (hf0 : ∀ c l, 0 ≤ f c l) (hg0 : ∀ c l, 0 ≤ g c l) (hf1 : ∀ c, ∑ l, f c l = 1) (hg1 : ∀ c, ∑ l, g c l = 1) : (∑ l : ∀ c, L c, (sqrt (∏ c, f c (l c)) - sqrt (∏ c, g c (l c))) ^ 2) ≤ ∑ c, ∑ l, (sqrt (f c l) - sqrt (g c l)) ^ 2 := by have hF0 : ∀ l : ∀ c, L c, 0 ≤ ∏ c, f c (l c) := fun l => Finset.prod_nonneg (fun c _ => hf0 c (l c)) have hG0 : ∀ l : ∀ c, L c, 0 ≤ ∏ c, g c (l c) := fun l => Finset.prod_nonneg (fun c _ => hg0 c (l c)) have hF1 : (∑ l : ∀ c, L c, ∏ c, f c (l c)) = 1 := by rw [← Fintype.prod_sum]; simp [hf1] have hG1 : (∑ l : ∀ c, L c, ∏ c, g c (l c)) = 1 := by rw [← Fintype.prod_sum]; simp [hg1] have hAffinity : (∑ l : ∀ c, L c, sqrt ((∏ c, f c (l c)) * ∏ c, g c (l c))) = ∏ c, ∑ l, sqrt (f c l * g c l) := by simp_rw [← Finset.prod_mul_distrib, Real.sqrt_prod _ (fun c _ => mul_nonneg (hf0 c _) (hg0 c _))] exact (Fintype.prod_sum (fun c l => sqrt (f c l * g c l))).symm rw [mixture_label_hellinger_affinity _ _ hF0 hG0 hF1 hG1, hAffinity] have hb := fun c => mixture_label_affinity_bounds (f c) (g c) (hf0 c) (hg0 c) (hf1 c) (hg1 c) calc _ ≤ 2 * ∑ c, (1 - ∑ l, sqrt (f c l * g c l)) := mul_le_mul_of_nonneg_left (one_sub_prod_le_sum _ (fun c => (hb c).1) (fun c => (hb c).2)) (by norm_num) _ = _ := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro c _ exact (mixture_label_hellinger_affinity (f c) (g c) (hf0 c) (hg0 c) (hf1 c) (hg1 c)).symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_label_tensor_le_sum · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:46
theorem mixture_label_fiber_tensor_le_sum Lemma mixture_label_fiber_tensor_le_sum in the paper ↗

Regrouping all original labels into record-component fibers loses no information and transports the tensorized bound back to the original sample. the documented result Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
ι κ L :
block :
ι → κ
f g :
∀ c
if
({i : ι // block i = c} → L)
then
ℝ
hf0 :
∀ c l, 0 ≤ f c l
hg0 :
∀ c l, 0 ≤ g c l
hf1 :
∀ c, ∑ l, f c l = 1
hg1 :
∀ c, ∑ l, g c l = 1
(∑ l : ι → L, (sqrt (∏ c, f c (fun i => l i.1)) - sqrt (∏ c, g c (fun i => l i.1))) ^ 2)
≤ ∑ c, ∑ l, (sqrt (f c l) - sqrt (g c l)) ^ 2
Proof (Lean source)
-- @node: mixture_label_fiber_tensor_le_sum lemma mixture_label_fiber_tensor_le_sum {ι κ L : Type*} [Fintype ι] [Fintype κ] [Fintype L] [DecidableEq ι] [DecidableEq κ] (block : ι → κ) (f g : ∀ c, ({i : ι // block i = c} → L) → ℝ) (hf0 : ∀ c l, 0 ≤ f c l) (hg0 : ∀ c l, 0 ≤ g c l) (hf1 : ∀ c, ∑ l, f c l = 1) (hg1 : ∀ c, ∑ l, g c l = 1) : (∑ l : ι → L, (sqrt (∏ c, f c (fun i => l i.1)) - sqrt (∏ c, g c (fun i => l i.1))) ^ 2) ≤ ∑ c, ∑ l, (sqrt (f c l) - sqrt (g c l)) ^ 2 := by let e : (ι → L) ≃ (∀ c, {i : ι // block i = c} → L) := Equiv.piCongrFiberwise (fun _ => Equiv.refl _) calc _ = ∑ l : ∀ c, {i : ι // block i = c} → L, (sqrt (∏ c, f c (l c)) - sqrt (∏ c, g c (l c))) ^ 2 := e.sum_comp (fun l => (sqrt (∏ c, f c (l c)) - sqrt (∏ c, g c (l c))) ^ 2) _ ≤ _ := mixture_label_tensor_le_sum (κ := κ) (L := fun c => {i : ι // block i = c} → L) f g hf0 hg0 hf1 hg1
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_label_fiber_tensor_le_sum · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:84
theorem observedLaw_label_mass_normalized

[Conditional four-cell masses at any fixed covariate form a normalized finite label distribution. the documented result

Formal statement
∑ l : Bool × Bool, P.cells l.1 l.2 x = 1
Proof (Lean source)
-- @node: observedLaw_label_mass_normalized lemma observedLaw_label_mass_normalized (P : ObservedLaw) (x : Covariate) : ∑ l : Bool × Bool, P.cells l.1 l.2 x = 1 := by rw [Fintype.sum_prod_type] exact P.normalized_cells x
CausalSmith.Stat.LogoddsLowsmoothFrontier.observedLaw_label_mass_normalized · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:106
theorem mixture_component_label_mass_normalized

Averaging conditional product label masses over finitely many latent signs preserves normalization, including empty record components. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
ι S :
Type*
Nonempty S
laws :
S → ι → ObservedLaw
x :
ι → Covariate
(∑ l : ι → Bool × Bool, (Fintype.card S : ℝ)⁻¹ * ∑ σ : S, ∏ i, (laws σ i).cells (l i).1 (l i).2 (x i))
= 1
Proof (Lean source)
-- @node: mixture_component_label_mass_normalized lemma mixture_component_label_mass_normalized {ι S : Type*} [Fintype ι] [DecidableEq ι] [Fintype S] [Nonempty S] (laws : S → ι → ObservedLaw) (x : ι → Covariate) : (∑ l : ι → Bool × Bool, (Fintype.card S : ℝ)⁻¹ * ∑ σ : S, ∏ i, (laws σ i).cells (l i).1 (l i).2 (x i)) = 1 := by rw [← Finset.mul_sum, Finset.sum_comm] have h (σ : S) : (∑ l : ι → Bool × Bool, ∏ i, (laws σ i).cells (l i).1 (l i).2 (x i)) = 1 := by rw [← Fintype.prod_sum (fun i (l : Bool × Bool) => (laws σ i).cells l.1 l.2 (x i))] simp_rw [observedLaw_label_mass_normalized] simp simp_rw [h] simp [Fintype.card_ne_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_component_label_mass_normalized · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:114
theorem mixture_component_label_mass_nonneg

[Every conditional component mixture is nonnegative as a finite average of products of the actual interior four-cell probabilities. the documented result Under the stated assumptions.

Formal statement
ι S :
Type*
laws :
S → ι → ObservedLaw
x :
ι → Covariate
l :
ι → Bool × Bool
0 ≤ (Fintype.card S : ℝ)⁻¹ * ∑ σ : S, ∏ i, (laws σ i).cells (l i).1 (l i).2 (x i)
Proof (Lean source)
-- @node: mixture_component_label_mass_nonneg lemma mixture_component_label_mass_nonneg {ι S : Type*} [Fintype ι] [Fintype S] (laws : S → ι → ObservedLaw) (x : ι → Covariate) (l : ι → Bool × Bool) : 0 ≤ (Fintype.card S : ℝ)⁻¹ * ∑ σ : S, ∏ i, (laws σ i).cells (l i).1 (l i).2 (x i) := by apply mul_nonneg (by positivity) exact Finset.sum_nonneg (fun σ _ => Finset.prod_nonneg (fun i _ => (laws σ i).interior_cells _ _ _ |>.1.le))
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_component_label_mass_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:131
def conditionalComponentLabelMass

[The actual conditional label mass in one record block, averaged over its owned endpoint signs. Labels outside that block are absent from the argument.

Definition (Lean source)
ι ν κ :
owner :
ν → κ
block :
ι → κ
laws :
(ν → Bool) → ObservedLaw
x :
ι → Covariate
c :
κ
l :
{i : ι // block i = c} → Bool × Bool
conditionalComponentLabelMass owner block laws x c l :
ℝ
(card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : ν // owner s = c} → Bool, ∏ i : {i : ι // block i = c}, (laws (componentSignExtension owner c σ)).cells (l i).1 (l i).2 (x i.1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalComponentLabelMass · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:143
theorem conditionalComponentLabelMass_normalized

Conditional component masses normalize even when their block is empty. Under the stated assumptions. The stated conclusion follows.

Formal statement
ι ν κ :
owner :
ν → κ
block :
ι → κ
laws :
(ν → Bool) → ObservedLaw
x :
ι → Covariate
c :
κ
∑ l, conditionalComponentLabelMass owner block laws x c l = 1
Proof (Lean source)
-- @node: conditionalComponentLabelMass_normalized lemma conditionalComponentLabelMass_normalized {ι ν κ : Type*} [Fintype ι] [Fintype ν] [Fintype κ] [DecidableEq ι] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (block : ι → κ) (laws : (ν → Bool) → ObservedLaw) (x : ι → Covariate) (c : κ) : ∑ l, conditionalComponentLabelMass owner block laws x c l = 1 := by exact mixture_component_label_mass_normalized (ι := {i : ι // block i = c}) (S := {s : ν // owner s = c} → Bool) (fun σ _ => laws (componentSignExtension owner c σ)) (fun i => x i.1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalComponentLabelMass_normalized · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:156
theorem conditionalComponentLabelMass_nonneg

Conditional component masses inherit nonnegativity from the actual laws. Under the stated assumptions. Under the stated assumptions.

Formal statement
ι ν κ :
owner :
ν → κ
block :
ι → κ
laws :
(ν → Bool) → ObservedLaw
x :
ι → Covariate
c :
κ
l :
{i : ι // block i = c} → Bool × Bool
0 ≤ conditionalComponentLabelMass owner block laws x c l
Proof (Lean source)
-- @node: conditionalComponentLabelMass_nonneg lemma conditionalComponentLabelMass_nonneg {ι ν κ : Type*} [Fintype ι] [Fintype ν] [Fintype κ] [DecidableEq ι] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (block : ι → κ) (laws : (ν → Bool) → ObservedLaw) (x : ι → Covariate) (c : κ) (l : {i : ι // block i = c} → Bool × Bool) : 0 ≤ conditionalComponentLabelMass owner block laws x c l := by exact mixture_component_label_mass_nonneg (ι := {i : ι // block i = c}) (S := {s : ν // owner s = c} → Bool) (fun σ _ => laws (componentSignExtension owner c σ)) (fun i => x i.1) l
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalComponentLabelMass_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:167
theorem conditional_label_mass_factorization

[Local dependence on owned signs factors the actual conditional label mass on the full original record array into masses on disjoint record blocks. the documented result Under the stated assumptions.

Formal statement
ι ν κ :
owner :
ν → κ
block :
ι → κ
laws :
(ν → Bool) → ObservedLaw
x :
ι → Covariate
hlocal :
∀ i σ τ
if
(∀ s, owner s = block i → σ s = τ s)
then
∀ a y, (laws σ).cells a y (x i) = (laws τ).cells a y (x i)
l :
ι → Bool × Bool
(card (ν → Bool) : ℝ)⁻¹ * (∑ σ : ν → Bool, ∏ i, (laws σ).cells (l i).1 (l i).2 (x i))
= ∏ c, conditionalComponentLabelMass owner block laws x c (fun i => l i.1)
Proof (Lean source)
-- @node: conditional_label_mass_factorization lemma conditional_label_mass_factorization {ι ν κ : Type*} [Fintype ι] [Fintype ν] [Fintype κ] [DecidableEq ι] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (block : ι → κ) (laws : (ν → Bool) → ObservedLaw) (x : ι → Covariate) (hlocal : ∀ i σ τ, (∀ s, owner s = block i → σ s = τ s) → ∀ a y, (laws σ).cells a y (x i) = (laws τ).cells a y (x i)) (l : ι → Bool × Bool) : (card (ν → Bool) : ℝ)⁻¹ * (∑ σ : ν → Bool, ∏ i, (laws σ).cells (l i).1 (l i).2 (x i)) = ∏ c, conditionalComponentLabelMass owner block laws x c (fun i => l i.1) := by rw [signPrior_likelihood_factorization owner block (fun i σ => (laws σ).cells (l i).1 (l i).2 (x i)) (fun i σ τ h => hlocal i σ τ h _ _)] unfold conditionalComponentLabelMass apply Finset.prod_congr rfl intro c _ congr 1 apply Finset.sum_congr rfl intro σ _ exact Finset.prod_subtype _ (fun i => by simp) (fun i => (laws (componentSignExtension owner c σ)).cells (l i).1 (l i).2 (x i))
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditional_label_mass_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:179
theorem original_conditional_label_hellinger_le_components

At fixed original covariates the full finite-prior label Hellinger discrepancy is at most the sum over sign components. The proof uses the actual local-sign factorization and normalized component laws, without revealing signs or imposing independence between records inside a component. the documented result Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
ι ν κ :
owner :
ν → κ
block :
ι → κ
laws₀ laws₁ :
(ν → Bool) → ObservedLaw
x :
ι → Covariate
hlocal₀ :
∀ i σ τ
if
(∀ s, owner s = block i → σ s = τ s)
then
∀ a y, (laws₀ σ).cells a y (x i) = (laws₀ τ).cells a y (x i)
hlocal₁ :
∀ i σ τ
if
(∀ s, owner s = block i → σ s = τ s)
then
∀ a y, (laws₁ σ).cells a y (x i) = (laws₁ τ).cells a y (x i)
(∑ l : ι → Bool × Bool, (sqrt ((card (ν → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₀ σ).cells (l i).1 (l i).2 (x i)) - sqrt ((card (ν → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₁ σ).cells (l i).1 (l i).2 (x i))) ^ 2)
≤ ∑ c, ∑ l, (sqrt (conditionalComponentLabelMass owner block laws₀ x c l) - sqrt (conditionalComponentLabelMass owner block laws₁ x c l)) ^ 2
Proof (Lean source)
-- @node: original_conditional_label_hellinger_le_components lemma original_conditional_label_hellinger_le_components {ι ν κ : Type*} [Fintype ι] [Fintype ν] [Fintype κ] [DecidableEq ι] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (block : ι → κ) (laws₀ laws₁ : (ν → Bool) → ObservedLaw) (x : ι → Covariate) (hlocal₀ : ∀ i σ τ, (∀ s, owner s = block i → σ s = τ s) → ∀ a y, (laws₀ σ).cells a y (x i) = (laws₀ τ).cells a y (x i)) (hlocal₁ : ∀ i σ τ, (∀ s, owner s = block i → σ s = τ s) → ∀ a y, (laws₁ σ).cells a y (x i) = (laws₁ τ).cells a y (x i)) : (∑ l : ι → Bool × Bool, (sqrt ((card (ν → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₀ σ).cells (l i).1 (l i).2 (x i)) - sqrt ((card (ν → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₁ σ).cells (l i).1 (l i).2 (x i))) ^ 2) ≤ ∑ c, ∑ l, (sqrt (conditionalComponentLabelMass owner block laws₀ x c l) - sqrt (conditionalComponentLabelMass owner block laws₁ x c l)) ^ 2 := by simp_rw [conditional_label_mass_factorization owner block laws₀ x hlocal₀, conditional_label_mass_factorization owner block laws₁ x hlocal₁] exact mixture_label_fiber_tensor_le_sum (ι := ι) (κ := κ) (L := Bool × Bool) block (conditionalComponentLabelMass owner block laws₀ x) (conditionalComponentLabelMass owner block laws₁ x) (conditionalComponentLabelMass_nonneg owner block laws₀ x) (conditionalComponentLabelMass_nonneg owner block laws₁ x) (conditionalComponentLabelMass_normalized owner block laws₀ x) (conditionalComponentLabelMass_normalized owner block laws₁ x)
CausalSmith.Stat.LogoddsLowsmoothFrontier.original_conditional_label_hellinger_le_components · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureLabelTensorization.lean:204
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureMassNormalization 6 declarations The uniform four-label reference cancels the number of label arrays exactly.

From component densities to conditional label masses

The uniform four-label reference cancels the number of label arrays exactly. Pointwise bounds for component likelihood densities therefore give the same bound for the summed Hellinger discrepancy of component probability masses.

theorem mixture_sqrt_discrepancy_scale Lemma mixture_sqrt_discrepancy_scale in the paper ↗

[Scaling two nonnegative likelihoods scales their squared square-root discrepancy by the same factor. the documented result Under the stated assumptions.

Formal statement
c f g :
ℝ
hc :
0 ≤ c
(sqrt (c*f)-sqrt (c*g))^2 = c*(sqrt f-sqrt g)^2
Proof (Lean source)
-- @node: mixture_sqrt_discrepancy_scale lemma mixture_sqrt_discrepancy_scale (c f g : ℝ) (hc : 0 ≤ c) : (sqrt (c*f)-sqrt (c*g))^2 = c*(sqrt f-sqrt g)^2 := by rw [Real.sqrt_mul hc, Real.sqrt_mul hc, ← mul_sub, mul_pow, Real.sq_sqrt hc]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_sqrt_discrepancy_scale · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureMassNormalization.lean:17
theorem record_density_product_eq_label_mass

[A product of actual record densities is four to the block size times its conditional label probability, before any hidden-sign averaging. the documented result Under the stated assumptions.

Formal statement
ι :
Type*
P :
x :
ι → Covariate
l :
ι → Bool × Bool
(∏ i, recordCellDensity (P i) (x i,l i))
= (4 : ℝ)^card ι * ∏ i, (P i).cells (l i).1 (l i).2 (x i)
Proof (Lean source)
-- @node: record_density_product_eq_label_mass lemma record_density_product_eq_label_mass {ι : Type*} [Fintype ι] (P : ι → ObservedLaw) (x : ι → Covariate) (l : ι → Bool × Bool) : (∏ i, recordCellDensity (P i) (x i,l i)) = (4 : ℝ)^card ι * ∏ i, (P i).cells (l i).1 (l i).2 (x i) := by simp only [recordCellDensity, Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ]
CausalSmith.Stat.LogoddsLowsmoothFrontier.record_density_product_eq_label_mass · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureMassNormalization.lean:26
theorem conditionalComponent_density_eq_scaled_mass

[The owned-sign component density has exactly the same normalization factor as its component label mass, including an empty block. the documented result Under the stated assumptions.

Formal statement
ι ν κ :
owner :
ν → κ
block :
ι → κ
laws :
(ν → Bool) → ObservedLaw
x :
ι → Covariate
c :
κ
l :
{i : ι // block i = c} → Bool × Bool
(card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * (∑ σ : {s : ν // owner s = c} → Bool, ∏ i : {i : ι // block i = c}, recordCellDensity (laws (componentSignExtension owner c σ)) (x i.1,l i))
= (4 : ℝ)^card {i : ι // block i = c} * conditionalComponentLabelMass owner block laws x c l
Proof (Lean source)
-- @node: conditionalComponent_density_eq_scaled_mass lemma conditionalComponent_density_eq_scaled_mass {ι ν κ : Type*} [Fintype ι] [Fintype ν] [Fintype κ] [DecidableEq ι] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (block : ι → κ) (laws : (ν → Bool) → ObservedLaw) (x : ι → Covariate) (c : κ) (l : {i : ι // block i = c} → Bool × Bool) : (card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * (∑ σ : {s : ν // owner s = c} → Bool, ∏ i : {i : ι // block i = c}, recordCellDensity (laws (componentSignExtension owner c σ)) (x i.1,l i)) = (4 : ℝ)^card {i : ι // block i = c} * conditionalComponentLabelMass owner block laws x c l := by simp_rw [record_density_product_eq_label_mass] rw [← Finset.mul_sum] unfold conditionalComponentLabelMass ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalComponent_density_eq_scaled_mass · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureMassNormalization.lean:36
theorem mixture_label_mass_hellinger_le_density_bound Lemma mixture_label_mass_hellinger_le_density_bound in the paper ↗

[Summing a pointwise density bound over the four-label arrays costs no factor: the component reference is a probability measure. the documented result Under the stated assumptions.

Formal statement
ι :
f g :
(ι → Bool × Bool) → ℝ
B :
ℝ
h :
∀ l,
(sqrt ((4 : ℝ)^card ι*f l)- sqrt ((4 : ℝ)^card ι*g l))^2 ≤ B
(∑ l, (sqrt (f l)-sqrt (g l))^2) ≤ B
Proof (Lean source)
-- @node: mixture_label_mass_hellinger_le_density_bound lemma mixture_label_mass_hellinger_le_density_bound {ι : Type*} [Fintype ι] [DecidableEq ι] (f g : (ι → Bool × Bool) → ℝ) (B : ℝ) (h : ∀ l, (sqrt ((4 : ℝ)^card ι*f l)- sqrt ((4 : ℝ)^card ι*g l))^2 ≤ B) : (∑ l, (sqrt (f l)-sqrt (g l))^2) ≤ B := by have hc : 0 < (4 : ℝ)^card ι := by positivity simp_rw [mixture_sqrt_discrepancy_scale _ _ _ hc.le] at h have hs := Finset.sum_le_sum (fun l (_ : l ∈ univ) => h l) rw [← Finset.mul_sum] at hs have hcard : (card (ι → Bool × Bool) : ℝ) = (4 : ℝ)^card ι := by simp [Fintype.card_fun, Fintype.card_prod] simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, hcard] at hs exact (mul_le_mul_iff_right₀ hc).mp hs
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_label_mass_hellinger_le_density_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureMassNormalization.lean:56
theorem mixture_conditional_hellinger_eq_label_sum

Integration of the full conditional likelihood discrepancy equals the sum of discrepancies of its conditional probability masses. the documented result Under the stated assumptions.

Formal statement
n k :
ℕ
laws₀ laws₁ :
(Fin (k+1) → Bool) → ObservedLaw
x :
hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k laws₀ (fun i => (x i,l i))) (fun l => signMixtureCellDensity n k laws₁ (fun i => (x i,l i)))
= ∑ l : Fin n → Bool × Bool, (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₀ σ).cells (l i).1 (l i).2 (x i))- sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₁ σ).cells (l i).1 (l i).2 (x i)))^2
Proof (Lean source)
-- @node: mixture_conditional_hellinger_eq_label_sum lemma mixture_conditional_hellinger_eq_label_sum (n k : ℕ) (laws₀ laws₁ : (Fin (k+1) → Bool) → ObservedLaw) (x : Fin n → Covariate) : hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k laws₀ (fun i => (x i,l i))) (fun l => signMixtureCellDensity n k laws₁ (fun i => (x i,l i))) = ∑ l : Fin n → Bool × Bool, (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₀ σ).cells (l i).1 (l i).2 (x i))- sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (laws₁ σ).cells (l i).1 (l i).2 (x i)))^2 := by unfold hellingerSqDensity rw [integral_labelReference_pi] simp_rw [signMixtureCellDensity_card_average, record_density_product_eq_label_mass] simp only [Fintype.card_fin] simp_rw [← Finset.mul_sum] have he (a b : ℝ) : a*((4 : ℝ)^n*b) = (4 : ℝ)^n*(a*b) := by ring simp_rw [he, mixture_sqrt_discrepancy_scale ((4 : ℝ)^n) _ _ (by positivity)] rw [← Finset.mul_sum, ← mul_assoc, ← mul_pow] norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_conditional_hellinger_eq_label_sum · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureMassNormalization.lean:73
theorem conditionalComponent_mass_hellinger_le_density_bound

[A pointwise bound for the two owned-sign component densities controls the component Hellinger distance after summing its conditional label masses. the documented result Under the stated assumptions.

Formal statement
ι ν κ :
owner :
ν → κ
block :
ι → κ
laws₀ laws₁ :
(ν → Bool) → ObservedLaw
x :
ι → Covariate
c :
κ
B :
ℝ
h :
∀ l : {i : ι // block i = c} → Bool × Bool,
(sqrt ((card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, recordCellDensity (laws₀ (componentSignExtension owner c σ)) (x i.1,l i))- sqrt ((card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, recordCellDensity (laws₁ (componentSignExtension owner c σ)) (x i.1,l i)))^2
≤ B
(∑ l, (sqrt (conditionalComponentLabelMass owner block laws₀ x c l)- sqrt (conditionalComponentLabelMass owner block laws₁ x c l))^2)
≤ B
Proof (Lean source)
-- @node: conditionalComponent_mass_hellinger_le_density_bound lemma conditionalComponent_mass_hellinger_le_density_bound {ι ν κ : Type*} [Fintype ι] [Fintype ν] [Fintype κ] [DecidableEq ι] [DecidableEq ν] [DecidableEq κ] (owner : ν → κ) (block : ι → κ) (laws₀ laws₁ : (ν → Bool) → ObservedLaw) (x : ι → Covariate) (c : κ) (B : ℝ) (h : ∀ l : {i : ι // block i = c} → Bool × Bool, (sqrt ((card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, recordCellDensity (laws₀ (componentSignExtension owner c σ)) (x i.1,l i))- sqrt ((card ({s : ν // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : ι // block i = c}, recordCellDensity (laws₁ (componentSignExtension owner c σ)) (x i.1,l i)))^2 ≤ B) : (∑ l, (sqrt (conditionalComponentLabelMass owner block laws₀ x c l)- sqrt (conditionalComponentLabelMass owner block laws₁ x c l))^2) ≤ B := by apply mixture_label_mass_hellinger_le_density_bound intro l simpa only [conditionalComponent_density_eq_scaled_mass] using h l
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalComponent_mass_hellinger_le_density_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureMassNormalization.lean:96
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureOccupancySeries 5 declarations The factorial and binomial envelopes reduce the non-singleton tree sum to the finite cubic geometric series.

The numerical spanning-tree occupancy sum

The factorial and binomial envelopes reduce the non-singleton tree sum to the finite cubic geometric series. The resulting bound retains the paper's explicit 96 exp(2) B² coefficient and its occupancy threshold.

theorem mixture_parent_array_factorial_bound Lemma mixture_parent_array_factorial_bound in the paper ↗

[The exponential-series bound supplies the factorial envelope needed for rooted parent arrays of a positive number of vertices. the documented result Under the stated assumptions.

Formal statement
m :
ℕ
hm :
1 ≤ m
(m : ℝ) ^ (m-1) / (m.factorial : ℝ) ≤ exp 1 ^ m / (m : ℝ)
Proof (Lean source)
-- @node: mixture_parent_array_factorial_bound lemma mixture_parent_array_factorial_bound (m : ℕ) (hm : 1 ≤ m) : (m : ℝ) ^ (m-1) / (m.factorial : ℝ) ≤ exp 1 ^ m / (m : ℝ) := by have hmp : (0 : ℝ) < m := by exact_mod_cast hm have hf : (0 : ℝ) < m.factorial := by exact_mod_cast Nat.factorial_pos m have h := Real.pow_div_factorial_le_exp (m : ℝ) hmp.le m have he : exp (m : ℝ) = exp 1 ^ m := by simpa using Real.exp_nat_mul 1 m rw [he] at h apply (le_div_iff₀ hmp).mpr have hp : (m : ℝ) ^ (m-1) * m = (m : ℝ) ^ m := by rw [← pow_succ, Nat.sub_add_cancel hm] simpa only [div_mul_eq_mul_div, hp] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_parent_array_factorial_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureOccupancySeries.lean:16
theorem mixture_tree_sum_term_bound Lemma mixture_tree_sum_term_bound in the paper ↗

[Each non-singleton tree-count term is controlled by a cubic geometric term with occupancy parameter 3 exp(1) B n/k. the documented result Under the stated assumptions.

Formal statement
n k j :
ℕ
hk :
1 ≤ k
B :
ℝ
hB :
0 ≤ B
((j+2 : ℕ) : ℝ)^4 * B^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1)
≤ exp 1 * B * n * (((j : ℝ)+2)^3 * (3*exp 1*B*n/(k : ℝ))^(j+1))
Proof (Lean source)
-- @node: mixture_tree_sum_term_bound lemma mixture_tree_sum_term_bound (n k j : ℕ) (hk : 1 ≤ k) (B : ℝ) (hB : 0 ≤ B) : ((j+2 : ℕ) : ℝ)^4 * B^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1) ≤ exp 1 * B * n * (((j : ℝ)+2)^3 * (3*exp 1*B*n/(k : ℝ))^(j+1)) := by let m := j+2 have hm : 1 ≤ m := by omega have hmp : (0 : ℝ) < m := by exact_mod_cast hm have hkp : (0 : ℝ) < k := by exact_mod_cast hk have hc : (n.choose m : ℝ) ≤ (n : ℝ)^m / (m.factorial : ℝ) := Nat.choose_le_pow_div m n have hp := mixture_parent_array_factorial_bound m hm have h1 := mul_le_mul_of_nonneg_left hc (show 0 ≤ (m : ℝ)^4 * B^m * (m : ℝ)^(m-1) * (3/(k : ℝ))^(m-1) by positivity) have h2 := mul_le_mul_of_nonneg_left hp (show 0 ≤ (m : ℝ)^4 * B^m * (n : ℝ)^m * (3/(k : ℝ))^(m-1) by positivity) have hfirst : (m : ℝ)^4 * B^m * (n.choose m : ℝ) * (m : ℝ)^(m-1) * (3/(k : ℝ))^(m-1) ≤ (m : ℝ)^4 * B^m * (n : ℝ)^m * (exp 1^m/(m : ℝ)) * (3/(k : ℝ))^(m-1) := by calc _ ≤ (m : ℝ)^4 * B^m * ((n : ℝ)^m / (m.factorial : ℝ)) * (m : ℝ)^(m-1) * (3/(k : ℝ))^(m-1) := by nlinarith [h1] _ = ((m : ℝ)^4 * B^m * (n : ℝ)^m * (3/(k : ℝ))^(m-1)) * ((m : ℝ)^(m-1)/(m.factorial : ℝ)) := by ring _ ≤ _ := by simpa only [mul_assoc, mul_left_comm, mul_comm] using h2 have hms : m-1 = j+1 := by simp [m] rw [hms] at hfirst convert hfirst using 1 · dsimp [m] simp only [Nat.cast_add, Nat.cast_ofNat, pow_add, pow_succ, pow_one, mul_pow, div_pow] field_simp <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_tree_sum_term_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureOccupancySeries.lean:32

[The complete finite spanning-tree envelope has the paper's quadratic occupancy bound, with no singleton term. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n k N :
ℕ
hk :
1 ≤ k
B :
ℝ
hB :
0 ≤ B
hq :
3*exp 1*B*n/(k : ℝ) ≤ 1/4
(∑ j ∈ range N, ((j+2 : ℕ) : ℝ)^4 * B^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1))
≤ 96*exp 2*B^2*(n : ℝ)^2/(k : ℝ)
Proof (Lean source)
-- @node: mixture_tree_sum_bound lemma mixture_tree_sum_bound (n k N : ℕ) (hk : 1 ≤ k) (B : ℝ) (hB : 0 ≤ B) (hq : 3*exp 1*B*n/(k : ℝ) ≤ 1/4) : (∑ j ∈ range N, ((j+2 : ℕ) : ℝ)^4 * B^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1)) ≤ 96*exp 2*B^2*(n : ℝ)^2/(k : ℝ) := by have hq0 : 0 ≤ 3*exp 1*B*n/(k : ℝ) := by positivity calc _ ≤ ∑ j ∈ range N, exp 1 * B * n * (((j : ℝ)+2)^3 * (3*exp 1*B*n/(k : ℝ))^(j+1)) := by exact Finset.sum_le_sum (fun j _ => mixture_tree_sum_term_bound n k j hk B hB) _ = exp 1 * B * n * (∑ j ∈ range N, ((j : ℝ)+2)^3 * (3*exp 1*B*n/(k : ℝ))^(j+1)) := (Finset.mul_sum ..).symm _ ≤ exp 1 * B * n * (32*(3*exp 1*B*n/(k : ℝ))) := mul_le_mul_of_nonneg_left (mixture_cubic_geometric_bound _ hq0 hq N) (by positivity) _ = _ := by have he : exp 2 = exp 1 * exp 1 := by rw [← Real.exp_add]; norm_num rw [he] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_tree_sum_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureOccupancySeries.lean:70
theorem mixture_tree_sum_eight_bound Lemma mixture_tree_sum_eight_bound in the paper ↗

[The prescribed occupancy threshold controls the tree sum with B = 8, exactly the base of the component Hellinger envelope. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n k N :
ℕ
hk :
1 ≤ k
hnk :
(n : ℝ)/(k : ℝ) ≤ 1/(96*exp 1)
(∑ j ∈ range N, ((j+2 : ℕ) : ℝ)^4 * (8 : ℝ)^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1))
≤ 96*exp 2*8^2*(n : ℝ)^2/(k : ℝ)
Proof (Lean source)
-- @node: mixture_tree_sum_eight_bound lemma mixture_tree_sum_eight_bound (n k N : ℕ) (hk : 1 ≤ k) (hnk : (n : ℝ)/(k : ℝ) ≤ 1/(96*exp 1)) : (∑ j ∈ range N, ((j+2 : ℕ) : ℝ)^4 * (8 : ℝ)^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1)) ≤ 96*exp 2*8^2*(n : ℝ)^2/(k : ℝ) := by apply mixture_tree_sum_bound n k N hk 8 (by norm_num) have h := mul_le_mul_of_nonneg_left hnk (show 0 ≤ 24*exp 1 by positivity) have he : exp 1 ≠ 0 := ne_of_gt (Real.exp_pos 1) have hr : 24*exp 1 * (1/(96*exp 1)) = (1/4 : ℝ) := by field_simp <;> ring rw [hr] at h convert h using 2 <;> first | rfl | ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_tree_sum_eight_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureOccupancySeries.lean:96
theorem mixture_weighted_tree_sum_bound Lemma mixture_weighted_tree_sum_bound in the paper ↗

[Multiplying the tree envelope by the component Taylor coefficient gives the explicit constant for either choice of the amplitude product. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n k N :
ℕ
hk :
1 ≤ k
hnk :
(n : ℝ)/(k : ℝ) ≤ 1/(96*exp 1)
M ω :
ℝ
M^4*ω^2 * (∑ j ∈ range N, ((j+2 : ℕ) : ℝ)^4 * (8 : ℝ)^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1))
≤ (96*exp 2*8^2*M^4)*(n : ℝ)^2/(k : ℝ)*ω^2
Proof (Lean source)
-- @node: mixture_weighted_tree_sum_bound lemma mixture_weighted_tree_sum_bound (n k N : ℕ) (hk : 1 ≤ k) (hnk : (n : ℝ)/(k : ℝ) ≤ 1/(96*exp 1)) (M ω : ℝ) : M^4*ω^2 * (∑ j ∈ range N, ((j+2 : ℕ) : ℝ)^4 * (8 : ℝ)^(j+2) * (n.choose (j+2) : ℝ) * ((j+2 : ℕ) : ℝ)^(j+1) * (3/(k : ℝ))^(j+1)) ≤ (96*exp 2*8^2*M^4)*(n : ℝ)^2/(k : ℝ)*ω^2 := by apply (mul_le_mul_of_nonneg_left (mixture_tree_sum_eight_bound n k N hk hnk) (show 0 ≤ M^4*ω^2 by positivity)).trans_eq ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_weighted_tree_sum_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureOccupancySeries.lean:115
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.MixtureProductDerivatives 2 declarations Leibniz differentiation controls a product of bounded record densities by its record count, rather than by an amplitude-dependent exponential constant.

Finite-product derivative bounds for original-record components

Leibniz differentiation controls a product of bounded record densities by its record count, rather than by an amplitude-dependent exponential constant.

theorem mixture_product_two_derivative_bounds Lemma mixture_product_two_derivative_bounds in the paper ↗

[Simultaneous bounds for the value and the first two derivatives of a finite product. The second-order bound counts the diagonal and off-diagonal Leibniz terms, as required by the component-mixture roadmap. the documented result Under the stated assumptions.

Formal statement
ι :
Type*
I :
f :
ι → ℝ → ℝ
x M :
ℝ
hM :
1 ≤ M
hs :
∀ i ∈ I, ContDiffAt ℝ 2 (f i) x
h0 :
∀ i ∈ I, |f i x| ≤ 2
h1 :
∀ i ∈ I, |deriv (f i) x| ≤ M
h2 :
∀ i ∈ I, |iteratedDeriv 2 (f i) x| ≤ M
conclusion 1
|∏ i ∈ I, f i x| ≤ 2 ^ I.card
conclusion 2
|deriv (fun z => ∏ i ∈ I, f i z) x| ≤ M * (I.card : ℝ) * 2 ^ I.card
conclusion 3
|iteratedDeriv 2 (fun z => ∏ i ∈ I, f i z) x| ≤ M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card
Proof (Lean source)
-- @node: mixture_product_two_derivative_bounds lemma mixture_product_two_derivative_bounds {ι : Type*} (I : Finset ι) (f : ι → ℝ → ℝ) (x M : ℝ) (hM : 1 ≤ M) (hs : ∀ i ∈ I, ContDiffAt ℝ 2 (f i) x) (h0 : ∀ i ∈ I, |f i x| ≤ 2) (h1 : ∀ i ∈ I, |deriv (f i) x| ≤ M) (h2 : ∀ i ∈ I, |iteratedDeriv 2 (f i) x| ≤ M) : |∏ i ∈ I, f i x| ≤ 2 ^ I.card ∧ |deriv (fun z => ∏ i ∈ I, f i z) x| ≤ M * (I.card : ℝ) * 2 ^ I.card ∧ |iteratedDeriv 2 (fun z => ∏ i ∈ I, f i z) x| ≤ M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card := by classical induction I using Finset.induction_on with | empty => simp [iteratedDeriv_succ, iteratedDeriv_zero] | @insert i I hi ih => have hsI := fun j hj => hs j (Finset.mem_insert_of_mem hj) have h0I := fun j hj => h0 j (Finset.mem_insert_of_mem hj) have h1I := fun j hj => h1 j (Finset.mem_insert_of_mem hj) have h2I := fun j hj => h2 j (Finset.mem_insert_of_mem hj) obtain ⟨hv, hd, hdd⟩ := ih hsI h0I h1I h2I have hsi := hs i (Finset.mem_insert_self i I) have hvi := h0 i (Finset.mem_insert_self i I) have hdi := h1 i (Finset.mem_insert_self i I) have hddi := h2 i (Finset.mem_insert_self i I) have hsp : ContDiffAt ℝ 2 (fun z => ∏ j ∈ I, f j z) x := contDiffAt_prod hsI have hdprod := (hsi.differentiableAt (by norm_num)).hasDerivAt.mul (hsp.differentiableAt (by norm_num)).hasDerivAt have hsecond := iteratedDeriv_fun_mul hsi hsp norm_num [Finset.sum_range_succ, iteratedDeriv_zero, iteratedDeriv_one] at hsecond simp only [Finset.prod_insert hi, Finset.card_insert_of_notMem hi, Nat.cast_add, Nat.cast_one, pow_succ] refine ⟨?_, ?_, ?_⟩ · rw [abs_mul] exact (mul_le_mul hvi hv (abs_nonneg _) (by norm_num)).trans_eq (by ring) · rw [show deriv (fun z => f i z * ∏ j ∈ I, f j z) x = _ from hdprod.deriv] calc _ ≤ |deriv (f i) x| * |∏ j ∈ I, f j x| + |f i x| * |deriv (fun z => ∏ j ∈ I, f j z) x| := by simpa only [abs_mul] using abs_add_le (deriv (f i) x * ∏ j ∈ I, f j x) (f i x * deriv (fun z => ∏ j ∈ I, f j z) x) _ ≤ M * 2 ^ I.card + 2 * (M * (I.card : ℝ) * 2 ^ I.card) := by gcongr _ ≤ _ := by nlinarith [mul_nonneg (by linarith : 0 ≤ M) (by positivity : 0 ≤ (2 : ℝ)^I.card)] · rw [hsecond] calc _ ≤ |f i x| * |iteratedDeriv 2 (fun z => ∏ j ∈ I, f j z) x| + 2 * |deriv (f i) x| * |deriv (fun z => ∏ j ∈ I, f j z) x| + |iteratedDeriv 2 (f i) x| * |∏ j ∈ I, f j x| := by have hab := abs_add_le (f i x * iteratedDeriv 2 (fun z => ∏ j ∈ I, f j z) x) (2 * deriv (f i) x * deriv (fun z => ∏ j ∈ I, f j z) x) have habc := abs_add_le (f i x * iteratedDeriv 2 (fun z => ∏ j ∈ I, f j z) x + 2 * deriv (f i) x * deriv (fun z => ∏ j ∈ I, f j z) x) (iteratedDeriv 2 (f i) x * ∏ j ∈ I, f j x) simpa only [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] using habc.trans (add_le_add hab (le_refl |iteratedDeriv 2 (f i) x * ∏ j ∈ I, f j x|)) _ ≤ 2 * (M ^ 2 * (I.card : ℝ) ^ 2 * 2 ^ I.card) + 2 * M * (M * (I.card : ℝ) * 2 ^ I.card) + M * 2 ^ I.card := by gcongr _ ≤ _ := by have hp : 0 ≤ (2 : ℝ) ^ I.card := by positivity have hm2 : M ≤ M ^ 2 := by nlinarith have hc : 0 ≤ (I.card : ℝ) := by positivity nlinarith [mul_nonneg (sub_nonneg.mpr hm2) hp, mul_nonneg (by positivity : 0 ≤ M ^ 2 * (I.card : ℝ)) hp]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_product_two_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureProductDerivatives.lean:19
theorem mixture_average_second_derivative_bound Lemma mixture_average_second_derivative_bound in the paper ↗

[Finite uniform averaging preserves the common second-derivative envelope; subtracting a comparator costs exactly a factor of two. the documented result Under the stated assumptions.

Formal statement
σ :
Type*
Nonempty σ
f :
σ → ℝ → ℝ
g :
ℝ → ℝ
x C :
ℝ
hs :
∀ s, ContDiffAt ℝ 2 (f s) x
hg :
ContDiffAt ℝ 2 g x
hf :
∀ s, |iteratedDeriv 2 (f s) x| ≤ C
hb :
|iteratedDeriv 2 g x| ≤ C
|iteratedDeriv 2 (fun z => (Fintype.card σ : ℝ)⁻¹ * ∑ s, f s z - g z) x| ≤ 2 * C
Proof (Lean source)
-- @node: mixture_average_second_derivative_bound lemma mixture_average_second_derivative_bound {σ : Type*} [Fintype σ] [Nonempty σ] (f : σ → ℝ → ℝ) (g : ℝ → ℝ) (x C : ℝ) (hs : ∀ s, ContDiffAt ℝ 2 (f s) x) (hg : ContDiffAt ℝ 2 g x) (hf : ∀ s, |iteratedDeriv 2 (f s) x| ≤ C) (hb : |iteratedDeriv 2 g x| ≤ C) : |iteratedDeriv 2 (fun z => (Fintype.card σ : ℝ)⁻¹ * ∑ s, f s z - g z) x| ≤ 2 * C := by classical have hsum : ContDiffAt ℝ 2 (fun z => ∑ s, f s z) x := ContDiffAt.sum (fun s _ => hs s) rw [iteratedDeriv_fun_sub (contDiffAt_const.mul hsum) hg, iteratedDeriv_const_mul_field, iteratedDeriv_fun_sum (fun s _ => hs s)] have hcard : (Fintype.card σ : ℝ) ≠ 0 := by positivity have havg : |(Fintype.card σ : ℝ)⁻¹ * ∑ s, iteratedDeriv 2 (f s) x| ≤ C := by calc _ = (Fintype.card σ : ℝ)⁻¹ * |∑ s, iteratedDeriv 2 (f s) x| := by rw [abs_mul, abs_of_nonneg (by positivity)] _ ≤ (Fintype.card σ : ℝ)⁻¹ * ∑ s, |iteratedDeriv 2 (f s) x| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ (Fintype.card σ : ℝ)⁻¹ * ∑ _s : σ, C := by gcongr with s exact hf s _ = C := by simp [hcard] have htri := abs_sub_le ((Fintype.card σ : ℝ)⁻¹ * ∑ s, iteratedDeriv 2 (f s) x) 0 (iteratedDeriv 2 g x) simp only [sub_zero, zero_sub, abs_neg] at htri exact htri.trans (by linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixture_average_second_derivative_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/MixtureProductDerivatives.lean:92
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ParametricExperiment 25 declarations The null has four equiprobable labels; the alternative changes only the treated outcome risk.

Constant-logit Bernoulli comparison experiment

The null has four equiprobable labels; the alternative changes only the treated outcome risk. Both retain the public uniform covariate design and zero nuisance logits, as in the parametric-floor proof roadmap.

[Constant conditional cells with fair treatment and control outcome.

Definition (Lean source)
t :
ℝ
a y :
_x :
parametricCells t a y _x :
ℝ
(1/2) * (if y then logistic (if a then t else 0) else 1-logistic (if a then t else 0))
theorem parametricCells_valid

All four cells are continuous, interior, and normalized for every effect. the stated conclusion holds.

Formal statement
t :
ℝ
Proof (Lean source)
-- @node: parametricCells_valid lemma parametricCells_valid (t : ℝ) : ValidCells (parametricCells t) := by refine ⟨?_, ?_, ?_⟩ · intro a y unfold parametricCells fun_prop · intro a y x have hp := Real.sigmoid_pos (if a then t else 0) have hq := Real.sigmoid_lt_one (if a then t else 0) cases y <;> simp only [parametricCells, Bool.false_eq_true, ↓reduceIte, logistic] all_goals constructor <;> linarith · intro x simp only [Fintype.sum_bool, parametricCells, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricCells_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:25
def parametricLaw

The actual observed-law carrier of the constant-nuisance subexperiment.

Definition (Lean source)
t :
ℝ
parametricLaw t :
theorem parametricLaw_uniform

The comparison laws retain the uniform design. the stated conclusion holds.

Formal statement
t :
ℝ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_uniform · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:45
theorem parametricLaw_propensity

The conditional treatment probability is exactly one half. Under the stated assumptions. The stated conclusion follows.

Formal statement
t :
ℝ
x :
propensity (parametricLaw t) x = 1/2
Proof (Lean source)
-- @node: parametricLaw_propensity lemma parametricLaw_propensity (t : ℝ) (x : Covariate) : propensity (parametricLaw t) x = 1/2 := by simp only [propensity, parametricLaw, lawFromCells, parametricCells, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_propensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:50
theorem parametricLaw_armRisk

Conditional outcome risks are the prescribed Bernoulli probabilities. Under the stated assumptions.

Formal statement
t :
ℝ
a :
x :
armRisk (parametricLaw t) a x = logistic (if a then t else 0)
Proof (Lean source)
-- @node: parametricLaw_armRisk lemma parametricLaw_armRisk (t : ℝ) (a : Bool) (x : Covariate) : armRisk (parametricLaw t) a x = logistic (if a then t else 0) := by simp only [armRisk, parametricLaw, lawFromCells, parametricCells, Bool.false_eq_true, ↓reduceIte] have hd : (1/2 : ℝ)*(1-logistic (if a then t else 0)) + (1/2)*logistic (if a then t else 0) = 1/2 := by ring rw [hd] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_armRisk · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:56
theorem parametricLaw_logits

[Both native nuisance logits vanish, and the homogeneous effect is t. the stated conclusion holds.

Formal statement
t :
ℝ
conclusion 1
x :
conclusion 2
x :
conclusion 3
effect (parametricLaw t) = t
Proof (Lean source)
-- @node: parametricLaw_logits lemma parametricLaw_logits (t : ℝ) : (∀ x, propensityLogit (parametricLaw t) x = 0) ∧ (∀ x, prognosisLogit (parametricLaw t) x = 0) ∧ effect (parametricLaw t) = t := by have hg (x : Covariate) : propensityLogit (parametricLaw t) x = 0 := by rw [propensityLogit, parametricLaw_propensity] norm_num [logit] have hv (x : Covariate) : prognosisLogit (parametricLaw t) x = 0 := by rw [prognosisLogit, parametricLaw_armRisk] simpa using logit_logistic 0 refine ⟨hg, hv, ?_⟩ rw [effect, parametricLaw_armRisk, hv, sub_zero] exact logit_logistic t
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_logits · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:66

Constant zero nuisance logits satisfy every Hölder radius. the stated conclusion holds.

Formal statement
γ :
ℝ
holderSeminorm γ (fun _ => 0) = 0
Proof (Lean source)
-- @node: holderSeminorm_zero lemma holderSeminorm_zero (γ : ℝ) : holderSeminorm γ (fun _ => 0) = 0 := by simp [holderSeminorm]
CausalSmith.Stat.LogoddsLowsmoothFrontier.holderSeminorm_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:81
theorem parametricLaw_model

Legal model membership follows from the effect envelope alone. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
α β t :
ℝ
ht :
|t| ≤ 1/2
Model α β (parametricLaw t)
Proof (Lean source)
-- @node: parametricLaw_model lemma parametricLaw_model (α β t : ℝ) (ht : |t| ≤ 1/2) : Model α β (parametricLaw t) := by obtain ⟨hg, hv, he⟩ := parametricLaw_logits t refine ⟨parametricLaw_uniform t, ?_, ?_, ?_, ?_, ?_, ?_⟩ · intro x simp only [parametricLaw_armRisk, hv, he, zero_add, ↓reduceIte] · simpa only [EffectEnvelope, he] using ht · intro x rw [hg] norm_num · intro x rw [hv] norm_num · change holderSeminorm α (propensityLogit (parametricLaw t)) ≤ 2 rw [show propensityLogit (parametricLaw t) = (fun _ => 0) from funext hg, holderSeminorm_zero] norm_num · change holderSeminorm β (prognosisLogit (parametricLaw t)) ≤ 2 rw [show prognosisLogit (parametricLaw t) = (fun _ => 0) from funext hv, holderSeminorm_zero] norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_model · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:86
theorem parametricLaw_null_radius

The null is legal in every nonnegative radius slice, including radius zero. Under the stated assumptions.

Formal statement
α β r :
ℝ
hr :
0 ≤ r
Proof (Lean source)
-- @node: parametricLaw_null_radius lemma parametricLaw_null_radius (α β r : ℝ) (hr : 0 ≤ r) : RadiusModel α β r (parametricLaw 0) := by refine ⟨parametricLaw_model α β 0 (by norm_num), ?_⟩ rw [EvaluationRadius, (parametricLaw_logits 0).2.2] simpa using hr
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_null_radius · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:107

[The one-record likelihood ratio relative to the four-label fair null.

Definition (Lean source)
t :
ℝ
o :
parametricDensity t o :
ℝ
4 * parametricCells t o.2.1 o.2.2 o.1
theorem parametricDensity_continuous

The likelihood ratio is continuous, since it depends only on discrete labels. the stated conclusion holds.

Formal statement
t :
ℝ
Proof (Lean source)
-- @node: parametricDensity_continuous lemma parametricDensity_continuous (t : ℝ) : Continuous (parametricDensity t) := by change Continuous ((fun b : Bool × Bool => 4 * ((1/2) * (if b.2 then logistic (if b.1 then t else 0) else 1-logistic (if b.1 then t else 0)))) ∘ snd) exact continuous_of_discreteTopology.comp continuous_snd
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricDensity_continuous · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:118
theorem parametricDensity_nonneg

The density is nonnegative at every record. the stated conclusion holds.

Formal statement
t :
ℝ
o :
Proof (Lean source)
-- @node: parametricDensity_nonneg lemma parametricDensity_nonneg (t : ℝ) (o : Record) : 0 ≤ parametricDensity t o := by exact mul_nonneg (by norm_num) ((parametricCells_valid t).2.1 _ _ _).1.le
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricDensity_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:126
theorem parametricLaw_withDensity

Direct finite cell summation identifies the likelihood ratio, without an abstract model gate. the stated conclusion holds.

Formal statement
t :
ℝ
(parametricLaw t).measure
= (parametricLaw 0).measure.withDensity (fun o => ofReal (parametricDensity t o))
Proof (Lean source)
-- @node: parametricLaw_withDensity lemma parametricLaw_withDensity (t : ℝ) : (parametricLaw t).measure = (parametricLaw 0).measure.withDensity (fun o => ofReal (parametricDensity t o)) := by apply Measure.ext_of_lintegral intro f hf have hd := (parametricDensity_continuous t).measurable.ennreal_ofReal rw [lintegral_withDensity_eq_lintegral_mul _ hd hf] change (∫⁻ o, f o ∂jointLaw uniformLaw (parametricLaw t).cells) = ∫⁻ o, ofReal (parametricDensity t o) * f o ∂jointLaw uniformLaw (parametricLaw 0).cells rw [lintegral_jointLaw_cells (parametricLaw t) f hf, lintegral_jointLaw_cells (parametricLaw 0) (fun o => ofReal (parametricDensity t o) * f o) (hd.mul hf)] apply lintegral_congr intro x apply Finset.sum_congr rfl intro a ha apply Finset.sum_congr rfl intro y hy have hnull : (parametricLaw 0).cells a y x = 1/4 := by cases a <;> cases y <;> norm_num [parametricLaw, lawFromCells, parametricCells, logistic, Real.sigmoid_zero] have hp : 0 ≤ parametricCells t a y x := ((parametricCells_valid t).2.1 a y x).1.le rw [hnull] change ofReal (parametricCells t a y x) * f (x,a,y) = ofReal (1/4) * (ofReal (4 * parametricCells t a y x) * f (x,a,y)) rw [← mul_assoc, ← ENNReal.ofReal_mul (by norm_num : (0 : ℝ) ≤ 1/4)] congr 2 ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_withDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:131
theorem parametricLaw_rnDeriv

The real Radon--Nikodym derivative is the explicit bounded label density. the stated conclusion holds.

Formal statement
t :
ℝ
(fun o => (((parametricLaw t).measure.rnDeriv (parametricLaw 0).measure) o).toReal)
=ᵐ[(parametricLaw 0).measure] parametricDensity t
Proof (Lean source)
-- @node: parametricLaw_rnDeriv lemma parametricLaw_rnDeriv (t : ℝ) : (fun o => (((parametricLaw t).measure.rnDeriv (parametricLaw 0).measure) o).toReal) =ᵐ[(parametricLaw 0).measure] parametricDensity t := by have h := Measure.rnDeriv_withDensity (parametricLaw 0).measure (parametricDensity_continuous t).measurable.ennreal_ofReal rw [← parametricLaw_withDensity] at h filter_upwards [h] with o ho rw [ho, ENNReal.toReal_ofReal (parametricDensity_nonneg t o)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_rnDeriv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:162
theorem parametricLaw_density_integrable

The squared likelihood deviation is integrable on the actual null law. the stated conclusion holds.

Formal statement
t :
ℝ
Integrable (fun o => ((((parametricLaw t).measure.rnDeriv (parametricLaw 0).measure) o).toReal-1)^2) (parametricLaw 0).measure
Proof (Lean source)
-- @node: parametricLaw_density_integrable lemma parametricLaw_density_integrable (t : ℝ) : Integrable (fun o => ((((parametricLaw t).measure.rnDeriv (parametricLaw 0).measure) o).toReal-1)^2) (parametricLaw 0).measure := by have hc : Continuous (fun o => (parametricDensity t o-1)^2) := ((parametricDensity_continuous t).sub continuous_const).pow 2 have hi : Integrable (fun o => (parametricDensity t o-1)^2) (parametricLaw 0).measure := hc.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) apply hi.congr filter_upwards [parametricLaw_rnDeriv t] with o ho rw [ho]
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_density_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:173
theorem parametricLaw_chiSq

Direct summation gives the exact one-record chi-square value. the stated conclusion holds.

Formal statement
t :
ℝ
chiSqDiv (parametricLaw t).measure (parametricLaw 0).measure
= 2*(logistic t-1/2)^2
Proof (Lean source)
-- @node: parametricLaw_chiSq lemma parametricLaw_chiSq (t : ℝ) : chiSqDiv (parametricLaw t).measure (parametricLaw 0).measure = 2*(logistic t-1/2)^2 := by unfold chiSqDiv rw [integral_congr_ae (show (fun o => ((((parametricLaw t).measure.rnDeriv (parametricLaw 0).measure) o).toReal-1)^2) =ᵐ[(parametricLaw 0).measure] (fun o => (parametricDensity t o-1)^2) from (parametricLaw_rnDeriv t).fun_comp (fun z => (z-1)^2))] have hc : Continuous (fun o => (parametricDensity t o-1)^2) := ((parametricDensity_continuous t).sub continuous_const).pow 2 rw [integral_observed_cells _ (parametricLaw_uniform 0) _ hc] norm_num [Fintype.sum_bool, parametricLaw, lawFromCells, parametricDensity, parametricCells, logistic, Real.sigmoid_zero] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_chiSq · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:186

The sigmoid derivative is bounded by a quarter on the whole real line. the stated conclusion holds.

Formal statement
t :
ℝ
|logistic t-1/2| ≤ |t|/4
Proof (Lean source)
-- @node: logistic_quarter_bound lemma logistic_quarter_bound (t : ℝ) : |logistic t-1/2| ≤ |t|/4 := by have hderiv (x : ℝ) : ‖deriv sigmoid x‖ ≤ (1/4 : ℝ) := by rw [Real.deriv_sigmoid, Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (Real.sigmoid_pos x).le (by linarith [Real.sigmoid_lt_one x]))] nlinarith [sq_nonneg (sigmoid x-1/2)] have h := Convex.norm_image_sub_le_of_norm_deriv_le (s := univ) (f := sigmoid) (fun x _ => (Real.hasDerivAt_sigmoid x).differentiableAt) (fun x _ => hderiv x) (convex_univ) (Set.mem_univ (0 : ℝ)) (Set.mem_univ t) simpa [logistic, Real.sigmoid_zero, Real.norm_eq_abs, div_eq_mul_inv, mul_comm] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.logistic_quarter_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:203
theorem parametricLaw_chiSq_le

The roadmap's one-record information bound follows from the derivative estimate. the stated conclusion holds.

Formal statement
t :
ℝ
chiSqDiv (parametricLaw t).measure (parametricLaw 0).measure ≤ t^2/8
Proof (Lean source)
-- @node: parametricLaw_chiSq_le lemma parametricLaw_chiSq_le (t : ℝ) : chiSqDiv (parametricLaw t).measure (parametricLaw 0).measure ≤ t^2/8 := by rw [parametricLaw_chiSq] have h := logistic_quarter_bound t have hs : |logistic t-1/2|^2 ≤ (|t|/4)^2 := (sq_le_sq₀ (abs_nonneg _) (by positivity)).2 h rw [sq_abs] at hs nlinarith [sq_abs t]
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_chiSq_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:216

The public root-n scalar effect used in the two-point comparison.

Definition (Lean source)
n :
ℕ
parametricAmplitude n :
ℝ
(1/4)*(n : ℝ)^(-(1/2 : ℝ))
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricAmplitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:227
theorem parametricAmplitude_bounds

The comparison effect lies in the model envelope at every positive sample size. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
hn :
1 ≤ n
conclusion 1
conclusion 2
Proof (Lean source)
-- @node: parametricAmplitude_bounds lemma parametricAmplitude_bounds (n : ℕ) (hn : 1 ≤ n) : 0 ≤ parametricAmplitude n ∧ parametricAmplitude n ≤ 1/4 := by have hn' : (1 : ℝ) ≤ n := by exact_mod_cast hn refine ⟨by unfold parametricAmplitude; positivity, ?_⟩ unfold parametricAmplitude have hpow : (n : ℝ)^(-(1/2 : ℝ)) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hn' (by norm_num) linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricAmplitude_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:231
theorem parametricAmplitude_budget

The effect and sample-size factors cancel in the information budget. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
1 ≤ n
(n : ℝ) * (parametricAmplitude n)^2/8 = 1/128
Proof (Lean source)
-- @node: parametricAmplitude_budget lemma parametricAmplitude_budget (n : ℕ) (hn : 1 ≤ n) : (n : ℝ) * (parametricAmplitude n)^2/8 = 1/128 := by have hn' : (0 : ℝ) < n := by exact_mod_cast (show 0 < n by omega) have hp : ((n : ℝ)^(-(1/2 : ℝ)))^2 = (n : ℝ)⁻¹ := by rw [← Real.rpow_natCast, ← Real.rpow_mul hn'.le] norm_num [Real.rpow_neg_one] unfold parametricAmplitude rw [mul_pow, hp] field_simp <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricAmplitude_budget · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:241
theorem parametricLaw_iid_tv

The iid original-record laws have total variation at most one twentieth. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
1 ≤ n
≤ 1/20
Proof (Lean source)
-- @node: parametricLaw_iid_tv lemma parametricLaw_iid_tv (n : ℕ) (hn : 1 ≤ n) : tvDist (iidLaw (parametricLaw 0).measure n) (iidLaw (parametricLaw (parametricAmplitude n)).measure n) ≤ 1/20 := by let t := parametricAmplitude n let μ := (parametricLaw t).measure let ν := (parametricLaw 0).measure have hac : μ ≪ ν := by dsimp only [μ, ν] rw [parametricLaw_withDensity] exact withDensity_absolutelyContinuous _ _ have hint := parametricLaw_density_integrable t have hbudget : (n : ℝ)*chiSqDiv μ ν ≤ 1/128 := by have h := mul_le_mul_of_nonneg_left (parametricLaw_chiSq_le t) (by positivity : (0 : ℝ) ≤ n) dsimp only [μ, ν, t] at * nlinarith [parametricAmplitude_budget n hn] have hpowexp : (1+chiSqDiv μ ν)^n ≤ exp ((n : ℝ)*chiSqDiv μ ν) := by calc _ ≤ (exp (chiSqDiv μ ν))^n := pow_le_pow_left₀ (by linarith [chiSqDiv_nonneg (μ := μ) (ν := ν)]) (by simpa [add_comm] using Real.add_one_le_exp (chiSqDiv μ ν)) n _ = _ := by rw [← Real.exp_nat_mul] have hexp : exp ((n : ℝ)*chiSqDiv μ ν) ≤ 128/127 := by calc _ ≤ exp (1/128 : ℝ) := Real.exp_le_exp.mpr hbudget _ ≤ 1/(1-(1/128 : ℝ)) := Real.exp_bound_div_one_sub_of_interval (by norm_num) (by norm_num) _ = _ := by norm_num have htensor := Causalean.Stat.one_add_chiSqDiv_pi_iid_general μ ν hac hint n have hchi : chiSqDiv (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) ≤ 1/127 := by rw [← htensor] at hpowexp linarith [hpowexp.trans hexp] have htv := tvDist_le_half_sqrt_chiSqDiv (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) (pi_iid_absolutelyContinuous μ ν hac n) (pi_iid_integrable_sq_dev μ ν hac hint n) have hsqrt : sqrt (1/127 : ℝ) ≤ 1/10 := by apply (Real.sqrt_le_iff).2 constructor <;> norm_num rw [tvDist_symm] change tvDist (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν)) ≤ 1/20 calc _ ≤ (1/2)*sqrt (chiSqDiv (Measure.pi (fun _ : Fin n => μ)) (Measure.pi (fun _ : Fin n => ν))) := htv _ ≤ (1/2)*sqrt (1/127 : ℝ) := mul_le_mul_of_nonneg_left (Real.sqrt_le_sqrt hchi) (by norm_num) _ ≤ 1/20 := by linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_iid_tv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:254
theorem parametricLaw_experiment_tv

Tensoring the same independent uniform seed preserves the testing comparison. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
1 ≤ n
Proof (Lean source)
-- @node: parametricLaw_experiment_tv lemma parametricLaw_experiment_tv (n : ℕ) (hn : 1 ≤ n) : tvDist (experimentLaw (parametricLaw 0) n) (experimentLaw (parametricLaw (parametricAmplitude n)) n) ≤ 1/20 := by unfold experimentLaw iidLaw rw [← Measure.compProd_const, ← Measure.compProd_const, tvDist_compProd_eq] exact parametricLaw_iid_tv n hn
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametricLaw_experiment_tv · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:308
theorem parametric_comparison

Two concrete legal laws discharge the full parametric comparison obligation. Under the stated assumptions.

Formal statement
α β r :
ℝ
n :
ℕ
hn :
1 ≤ n
hr :
0 ≤ r
∃ P₀ P₁ : ObservedLaw,
conclusion 1
RadiusModel α β r P₀
conclusion 2
Model α β P₁
conclusion 3
effect P₀ = 0
conclusion 4
effect P₁ = (1/4 : ℝ)*(n : ℝ)^(-(1/2 : ℝ))
conclusion 5
tvDist (experimentLaw P₀ n) (experimentLaw P₁ n) ≤ 1/20
Proof (Lean source)
-- @node: parametric_comparison lemma parametric_comparison (α β r : ℝ) (n : ℕ) (hn : 1 ≤ n) (hr : 0 ≤ r) : ∃ P₀ P₁ : ObservedLaw, RadiusModel α β r P₀ ∧ Model α β P₁ ∧ effect P₀ = 0 ∧ effect P₁ = (1/4 : ℝ)*(n : ℝ)^(-(1/2 : ℝ)) ∧ tvDist (experimentLaw P₀ n) (experimentLaw P₁ n) ≤ 1/20 := by refine ⟨parametricLaw 0, parametricLaw (parametricAmplitude n), parametricLaw_null_radius α β r hr, ?_, (parametricLaw_logits 0).2.2, (parametricLaw_logits _).2.2, parametricLaw_experiment_tv n hn⟩ apply parametricLaw_model obtain ⟨hpos, hle⟩ := parametricAmplitude_bounds n hn rw [abs_of_nonneg hpos] linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametric_comparison · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ParametricExperiment.lean:318
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PiProgram 12 declarations A fixed loop advances the two alternating arctangent sums together.

Finite register certificate for the prescribed Machin enclosure

A fixed loop advances the two alternating arctangent sums together. Its public fuel is linear in the prescribed term count, including initialization and clipping.

theorem rationalProgram_run_add Lemma rationalProgram_run_add in the paper ↗

[Iteration can be divided into consecutive blocks of instructions. the stated conclusion holds.

Formal statement
a b :
ℕ
code.run (a + b) s = code.run b (code.run a s)
Proof (Lean source)
-- @node: rationalProgram_run_add lemma rationalProgram_run_add (code : RationalProgram) (a b : ℕ) (s : RationalState) : code.run (a + b) s = code.run b (code.run a s) := by induction a generalizing s with | zero => simp [RationalProgram.run] | succ a ih => simpa [Nat.succ_add, RationalProgram.run] using ih (code.step s)
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_run_add · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:15

The fixed Machin program uses the two term recurrences and clips its final endpoints.

Definition (Lean source)
piRegisterCode :
[.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .constant 10 (-1/25), .constant 11 (-1/57121), .constant 3 1, .constant 4 (1/5), .constant 5 (1/239), .constant 6 0, .constant 7 0, .constant 2 7, .add 2 14 2, .branchLe 2 12 24 15, .div 13 4 3, .add 6 6 13, .div 13 5 3, .add 7 7 13, .mul 4 4 10, .mul 5 5 11, .add 3 3 9, .sub 2 2 8, .jump 14, .constant 13 16, .mul 6 6 13, .constant 13 4, .mul 7 7 13, .sub 6 6 7, .constant 13 3, .add 14 14 13, .natPow 9 9 14, .div 8 8 9, .sub 0 6 8, .add 1 6 8, .constant 13 3, .max 0 13 0, .constant 13 4, .min 1 13 1, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:23

Loop-head register meanings after a specified number of arctangent terms.

Definition (Lean source)
q j remaining :
ℕ
pc :
s.1 = 14
active :
s.2.2 = false
count :
s.2.1 2 = remaining
odd :
s.2.1 3 = (2*j+1 : ℕ)
term5 :
s.2.1 4 = (-1 : ℚ)^j * (1/5 : ℚ)^(2*j+1)
term239 :
s.2.1 5 = (-1 : ℚ)^j * (1/239 : ℚ)^(2*j+1)
sum5 :
s.2.1 6 = arctanPolynomial j (1/5)
sum239 :
s.2.1 7 = arctanPolynomial j (1/239)
one :
s.2.1 8 = 1
two :
s.2.1 9 = 2
ratio5 :
s.2.1 10 = -1/25
ratio239 :
s.2.1 11 = -1/57121
zero :
s.2.1 12 = 0
precision :
s.2.1 14 = q
CausalSmith.Stat.LogoddsLowsmoothFrontier.PiRegisterInvariant · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:38
theorem piRegisterCode_initial

Initialization clamps arbitrary rational precisions and prepares the prescribed count. the stated conclusion holds.

Formal statement
xs :
List ℚ
PiRegisterInvariant (⌊xs[0]?.getD 0⌋ : ℤ).toNat 0 ((⌊xs[0]?.getD 0⌋ : ℤ).toNat + 7) (piRegisterCode.run 14 (RationalProgram.initial xs))
Proof (Lean source)
-- @node: piRegisterCode_initial lemma piRegisterCode_initial (xs : List ℚ) : PiRegisterInvariant (⌊xs[0]?.getD 0⌋ : ℤ).toNat 0 ((⌊xs[0]?.getD 0⌋ : ℤ).toNat + 7) (piRegisterCode.run 14 (RationalProgram.initial xs)) := by have hmax : max (⌊xs[0]?.getD 0⌋ : ℤ) 0 = (((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℕ) : ℤ) := by omega have hq : max (↑(⌊xs[0]?.getD 0⌋ : ℤ) : ℚ) 0 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast hmax constructor <;> norm_num [piRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, arctanPolynomial, hq]
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterCode_initial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:56
theorem piRegisterCode_round

One loop block adds precisely the next term of both finite sums. the stated conclusion holds. Under the stated assumptions.

Formal statement
q j N :
ℕ
h :
PiRegisterInvariant q j (N + 1) s
PiRegisterInvariant q (j+1) N (piRegisterCode.run 10 s)
Proof (Lean source)
-- @node: piRegisterCode_round lemma piRegisterCode_round (q j N : ℕ) (s : RationalState) (h : PiRegisterInvariant q j (N + 1) s) : PiRegisterInvariant q (j+1) N (piRegisterCode.run 10 s) := by rcases h with ⟨hpc, ha, hc, ho, ht5, ht239, hs5, hs239, h1, h2, hr5, hr239, hz, hq⟩ have hcpos : ¬ (s.2.1 2 ≤ s.2.1 12) := by rw [hc, hz] exact not_le.mpr (by positivity) have term (v : ℚ) : ((-1 : ℚ)^j*v^(2*j+1)) * (-v^2) = (-1 : ℚ)^(j+1)*v^(2*(j+1)+1) := by rw [show 2*(j+1)+1 = (2*j+1)+2 by omega, pow_add, pow_succ] ring generalize he : piRegisterCode.run 10 s = t norm_num [piRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hpc, ha, hcpos] at he subst t constructor <;> norm_num [Function.update_apply, hc, ho, ht5, ht239, hs5, hs239, h1, h2, hr5, hr239, hz, hq, arctanPolynomial, Finset.sum_range_succ, Nat.cast_add, Nat.cast_mul] · ring · convert term (1/5) using 1; norm_num · convert term (1/239) using 1; norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterCode_round · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:69
theorem piRegisterCode_exit

The exit block returns the literal clipped Machin endpoints and halts. Under the stated assumptions. The stated conclusion follows.

Formal statement
q j :
ℕ
h :
t :
piRegisterCode.run 17 s
t.2.2 = true
t.2.1 0
= max 3 (16*arctanPolynomial j (1/5) - 4*arctanPolynomial j (1/239) - rationalError (q+3))
t.2.1 1
= min 4 (16*arctanPolynomial j (1/5) - 4*arctanPolynomial j (1/239) + rationalError (q+3))
Proof (Lean source)
-- @node: piRegisterCode_exit lemma piRegisterCode_exit (q j : ℕ) (s : RationalState) (h : PiRegisterInvariant q j 0 s) : let t := piRegisterCode.run 17 s t.2.2 = true ∧ t.2.1 0 = max 3 (16*arctanPolynomial j (1/5) - 4*arctanPolynomial j (1/239) - rationalError (q+3)) ∧ t.2.1 1 = min 4 (16*arctanPolynomial j (1/5) - 4*arctanPolynomial j (1/239) + rationalError (q+3)) := by rcases h with ⟨hpc, ha, hc, ho, ht5, ht239, hs5, hs239, h1, h2, hr5, hr239, hz, hq⟩ have hnat : (3+(q : ℤ)).toNat = q+3 := by omega norm_num [piRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hpc, ha, hc, hs5, hs239, h1, h2, hz, hq, rationalError, ← Nat.cast_add, hnat] have hnat' : ((q : ℤ)+3).toNat = q+3 := by omega constructor <;> simp only [hnat'] <;> congr 1 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterCode_exit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:95
theorem piRegisterCode_loop

Iterating the loop exhausts its counter and returns both completed sums. Under the stated assumptions.

Formal statement
q j N :
ℕ
h :
t :
piRegisterCode.run (10*N+17) s
t.2.2 = true
t.2.1 0
= max 3 (16*arctanPolynomial (j+N) (1/5) - 4*arctanPolynomial (j+N) (1/239) - rationalError (q+3))
t.2.1 1
= min 4 (16*arctanPolynomial (j+N) (1/5) - 4*arctanPolynomial (j+N) (1/239) + rationalError (q+3))
Proof (Lean source)
-- @node: piRegisterCode_loop lemma piRegisterCode_loop (q j N : ℕ) (s : RationalState) (h : PiRegisterInvariant q j N s) : let t := piRegisterCode.run (10*N+17) s t.2.2 = true ∧ t.2.1 0 = max 3 (16*arctanPolynomial (j+N) (1/5) - 4*arctanPolynomial (j+N) (1/239) - rationalError (q+3)) ∧ t.2.1 1 = min 4 (16*arctanPolynomial (j+N) (1/5) - 4*arctanPolynomial (j+N) (1/239) + rationalError (q+3)) := by induction N generalizing j s with | zero => simpa using piRegisterCode_exit q j s h | succ N ih => rw [show 10*(N+1)+17 = 10+(10*N+17) by omega, rationalProgram_run_add] simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (j+1) _ (piRegisterCode_round q j N s h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterCode_loop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:114

Public fuel for the fixed Machin program, on every rational input list.

Definition (Lean source)
xs :
List ℚ
piRegisterFuel xs :
ℕ
14 + (10*((⌊xs[0]?.getD 0⌋ : ℤ).toNat+7)+17)
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:131
theorem piRegisterFuel_public

The public fuel is computed by a fixed straight-line register program. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: piRegisterFuel_public lemma piRegisterFuel_public : PublicIterationBound piRegisterFuel := by refine ⟨[.constant 1 0, .floor 0 0, .max 0 0 1, .constant 1 7, .add 0 0 1, .constant 1 10, .mul 0 0 1, .constant 1 31, .add 0 0 1, .halt], ?_⟩ intro xs have hmax : max (⌊xs[0]?.getD 0⌋ : ℤ) 0 = (((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℕ) : ℤ) := by omega have hq : max (↑(⌊xs[0]?.getD 0⌋ : ℤ) : ℚ) 0 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast hmax refine ⟨10, ?_, ?_⟩ <;> norm_num [RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, piRegisterFuel, hq, Nat.cast_add, Nat.cast_mul] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:136
theorem piRegisterCode_halts

The fixed public fuel halts the Machin computation for every input list. the stated conclusion holds.

Formal statement
xs :
List ℚ
(piRegisterCode.run (piRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true
Proof (Lean source)
-- @node: piRegisterCode_halts lemma piRegisterCode_halts (xs : List ℚ) : (piRegisterCode.run (piRegisterFuel xs) (RationalProgram.initial xs)).2.2 = true := by unfold piRegisterFuel rw [rationalProgram_run_add] exact (piRegisterCode_loop _ _ _ _ (piRegisterCode_initial xs)).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterCode_halts · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:151

Certified finite rational program for the Machin primitive.

Definition (Lean source)
piRegisterProgram :
clause 1
clause 2
iterationBound := piRegisterFuel
clause 3
public_bound := piRegisterFuel_public
clause 4
CausalSmith.Stat.LogoddsLowsmoothFrontier.piRegisterProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:159
theorem concreteEngine_pi_register_certificate Lemma concreteEngine_pi_register_certificate in the paper ↗

The Machin primitive is exactly the interval returned by its finite register program. the stated conclusion holds.

Formal statement
q :
ℕ
concreteEngine.piBox q = let v := piRegisterProgram.eval [q]; rationalBox v.1 v.2
Proof (Lean source)
-- @node: concreteEngine_pi_register_certificate lemma concreteEngine_pi_register_certificate (q : ℕ) : concreteEngine.piBox q = let v := piRegisterProgram.eval [q]; rationalBox v.1 v.2 := by have h := piRegisterCode_loop _ _ _ _ (piRegisterCode_initial [(q : ℚ)]) simp only [List.getElem?_cons_zero, Option.getD_some, Int.floor_natCast, Int.toNat_natCast, zero_add] at h change paperPi q = rationalBox ((piRegisterCode.run (piRegisterFuel [q]) (RationalProgram.initial [q])).2.1 0) ((piRegisterCode.run (piRegisterFuel [q]) (RationalProgram.initial [q])).2.1 1) unfold piRegisterFuel simp only [List.getElem?_cons_zero, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] rw [rationalProgram_run_add, h.2.1, h.2.2] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_pi_register_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PiProgram.lean:167
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerClipProgram 13 declarations The last stage takes the internal precision, integer base, and exponential endpoints.

Register certificate for the final power bracket

The last stage takes the internal precision, integer base, and exponential endpoints. It widens by the prescribed rational error, clips to the exact cubic range, and implements the base-one exception. Its fixed bound is itself a finite rational program. The staged scalar computation uses the certified logarithm and exponential programs. Fusing these stages into a single bounded register program remains a separate obligation.

def powerClipBox

[The final power bracket, applied to already computed exponential endpoints.

Definition (Lean source)
p b :
ℕ
lo hi :
ℚ
powerClipBox p b lo hi :
if b
= 1 then RatInterval.point 1 else let e := 96 * (max 2 b : ℚ)^3 * rationalError p rationalBox (max (1/(b : ℚ)^3) (lo-e)) (min ((b : ℚ)^3) (hi+e))
theorem paperPowerScalar_eq_powerClipBox

The literal scalar power is its exponential bracket followed by final clipping. the stated conclusion holds.

Formal statement
q b :
ℕ
v :
ℚ
L :
J :
paperExpScalar p (v*((L.lo+L.hi)/2))
paperPowerScalar q b v = powerClipBox p b J.lo J.hi
Proof (Lean source)
-- @node: paperPowerScalar_eq_powerClipBox lemma paperPowerScalar_eq_powerClipBox (q b : ℕ) (v : ℚ) : let p := powerRegisterPrecision q b let L := paperLogScalar p b let J := paperExpScalar p (v*((L.lo+L.hi)/2)) paperPowerScalar q b v = powerClipBox p b J.lo J.hi := by dsimp only by_cases hb : b = 1 · simp [paperPowerScalar, powerClipBox, hb] · simp [paperPowerScalar, powerClipBox, hb, powerRegisterPrecision, Nat.cast_max]
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperPowerScalar_eq_powerClipBox · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:27

Registers zero and one initially hold precision and base; two and three hold the exponential bracket. The output is sorted by the external rational box.

Definition (Lean source)
powerClipCode :
[.constant 12 0, .floor 14 0, .max 14 14 12, .floor 21 1, .max 21 21 12, .constant 8 1, .branchLe 21 8 7 11, .branchLe 8 21 8 11, .constant 0 1, .constant 1 1, .halt, .constant 9 2, .max 22 9 21, .constant 13 3, .natPow 22 22 13, .constant 13 96, .mul 22 22 13, .natPow 9 9 14, .div 22 22 9, .constant 13 3, .natPow 23 21 13, .div 24 8 23, .sub 2 2 22, .add 3 3 22, .max 0 24 2, .min 1 23 3, .halt]

On any active starting frame, the clipping stage computes precisely the paper's rational formula; natural-number inputs are interpreted by floor-clamping. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
p :
(⌊s.2.1 0⌋ : ℤ).toNat
b :
(⌊s.2.1 1⌋ : ℤ).toNat
e :
96 * (max 2 b : ℚ)^3 * rationalError p
t :
powerClipCode.run 27 s
t.2.2 = true
t.2.1 0 = (if b = 1 then 1 else max (1/(b : ℚ)^3) (s.2.1 2-e))
t.2.1 1 = (if b = 1 then 1 else min ((b : ℚ)^3) (s.2.1 3+e))
Proof (Lean source)
-- @node: powerClipCode_result lemma powerClipCode_result (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let p := (⌊s.2.1 0⌋ : ℤ).toNat let b := (⌊s.2.1 1⌋ : ℤ).toNat let e := 96 * (max 2 b : ℚ)^3 * rationalError p let t := powerClipCode.run 27 s t.2.2 = true ∧ t.2.1 0 = (if b = 1 then 1 else max (1/(b : ℚ)^3) (s.2.1 2-e)) ∧ t.2.1 1 = (if b = 1 then 1 else min ((b : ℚ)^3) (s.2.1 3+e)) := by dsimp only let b := (⌊s.2.1 1⌋ : ℤ).toNat let p := (⌊s.2.1 0⌋ : ℤ).toNat change let t := powerClipCode.run 27 s t.2.2 = true ∧ t.2.1 0 = (if b = 1 then 1 else max (1/(b : ℚ)^3) (s.2.1 2-96*(max 2 b : ℚ)^3*rationalError p)) ∧ t.2.1 1 = (if b = 1 then 1 else min ((b : ℚ)^3) (s.2.1 3+96*(max 2 b : ℚ)^3*rationalError p)) have hpre : let t := powerClipCode.run 6 s t.1 = 6 ∧ t.2.2 = false ∧ t.2.1 14 = p ∧ t.2.1 21 = b ∧ t.2.1 8 = 1 ∧ t.2.1 2 = s.2.1 2 ∧ t.2.1 3 = s.2.1 3 := by norm_num [powerClipCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, powerRegister_clamp_cast, p, b] rw [show 27 = 6+21 by rfl, rationalProgram_run_add] generalize he : powerClipCode.run 6 s = t at hpre ⊢ dsimp only at hpre obtain ⟨htp, hta, hprecision, hbase, hone, hlo, hhi⟩ := hpre by_cases hb : b = 1 · norm_num [powerClipCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hbase, hone, hb] · by_cases hz : b = 0 · generalize hu : powerClipCode.run 21 t = u norm_num [powerClipCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hbase, hone, hprecision, hz] at hu subst u norm_num [Function.update_apply, hlo, hhi, rationalError, hz, p, (show (3 : ℤ).toNat = 3 by rfl), div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm] · have hgt : ¬ (b : ℚ) ≤ 1 := by exact_mod_cast (show ¬ b ≤ 1 by omega) generalize hu : powerClipCode.run 21 t = u norm_num [powerClipCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hbase, hone, hprecision, hgt] at hu subst u norm_num [Function.update_apply, hlo, hhi, rationalError, hb, p, (show (3 : ℤ).toNat = 3 by rfl), div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:55

[The fixed instruction bound is computed without inspecting any input. the stated conclusion holds.

Formal statement
PublicIterationBound (fun _ => 27)
Proof (Lean source)
-- @node: powerClipFuel_public lemma powerClipFuel_public : PublicIterationBound (fun _ => 27) := by refine ⟨[.constant 0 27, .halt], ?_⟩ intro xs refine ⟨2, ?_, ?_⟩ <;> norm_num [RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:104

Certified total finite register program for the final power bracket.

Definition (Lean source)
powerClipProgram :
clause 1
clause 2
iterationBound := fun _ => 27
clause 3
public_bound := powerClipFuel_public
clause 4
halts := fun xs => (powerClipCode_result (RationalProgram.initial xs) rfl rfl).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:113
theorem powerClipProgram_eval

The certified program returns the exact clipped scalar formula. Under the stated assumptions. The stated conclusion follows.

Formal statement
p b :
ℕ
lo hi :
ℚ
v :
powerClipProgram.eval [p,b,lo,hi]
rationalBox v.1 v.2 = powerClipBox p b lo hi
Proof (Lean source)
-- @node: powerClipProgram_eval lemma powerClipProgram_eval (p b : ℕ) (lo hi : ℚ) : let v := powerClipProgram.eval [p,b,lo,hi] rationalBox v.1 v.2 = powerClipBox p b lo hi := by have h := powerClipCode_result (RationalProgram.initial [(p : ℚ),b,lo,hi]) rfl rfl simp only [RationalProgram.initial, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] at h dsimp only [BoundedRationalProgram.eval, powerClipProgram, RationalProgram.initial] rw [h.2.1, h.2.2] by_cases hb : b = 1 · simp [powerClipBox, hb, rationalBox, RatInterval.point] · simp [powerClipBox, hb]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipProgram_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:121
theorem paperPowerScalar_clip_register_certificate

Given the two exponential endpoints, the register stage returns the literal power scalar, including its exceptional constant base. the documented result

Formal statement
q b :
ℕ
v :
ℚ
L :
J :
paperExpScalar p (v*((L.lo+L.hi)/2))
endpoints :
powerClipProgram.eval [p,b,J.lo,J.hi]
paperPowerScalar q b v = rationalBox endpoints.1 endpoints.2
Proof (Lean source)
-- @node: paperPowerScalar_clip_register_certificate lemma paperPowerScalar_clip_register_certificate (q b : ℕ) (v : ℚ) : let p := powerRegisterPrecision q b let L := paperLogScalar p b let J := paperExpScalar p (v*((L.lo+L.hi)/2)) let endpoints := powerClipProgram.eval [p,b,J.lo,J.hi] paperPowerScalar q b v = rationalBox endpoints.1 endpoints.2 := by dsimp only rw [powerClipProgram_eval] exact paperPowerScalar_eq_powerClipBox q b v
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperPowerScalar_clip_register_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:135
theorem expRegisterProgram_point_eval Lemma expRegisterProgram_point_eval in the paper ↗

A point-input exponential call returns both endpoints of the scalar bracket. the stated conclusion holds.

Formal statement
p :
ℕ
z :
ℚ
expRegisterProgram.eval [p,z,z] = ((paperExpScalar p z).lo, (paperExpScalar p z).hi)
Proof (Lean source)
-- @node: expRegisterProgram_point_eval lemma expRegisterProgram_point_eval (p : ℕ) (z : ℚ) : expRegisterProgram.eval [p,z,z] = ((paperExpScalar p z).lo, (paperExpScalar p z).hi) := by have h := expRegisterCode_result [(p : ℚ),z,z] simp only [List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] at h dsimp only [BoundedRationalProgram.eval, expRegisterProgram] rw [h.2.1, h.2.2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterProgram_point_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:148
def powerScalarRegisterEval

Execute the three certified register stages for one rational exponent. The logarithm stage supplies both the precision and its midpoint; the exponential stage is called on their product with the exponent, then the final stage clips.

Definition (Lean source)
q b :
ℕ
v :
ℚ
powerScalarRegisterEval q b v :
prepared :
powerLogProgram.eval [q,b,v,v]
exponential :
expRegisterProgram.eval [prepared.1,v*prepared.2,v*prepared.2]
clipped :
powerClipProgram.eval [prepared.1,b,exponential.1,exponential.2]
rationalBox clipped.1 clipped.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarRegisterEval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:158
theorem powerScalarRegisterEval_spec

The staged finite register evaluation agrees with the full scalar power formula, on all natural precisions and bases and all rational exponents. the documented result

Formal statement
q b :
ℕ
v :
ℚ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarRegisterEval_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:168
def powerEndpointRegisterEval

Two staged scalar calls supply the monotone endpoint extension. This is a composition of bounded programs, rather than a certificate for a fused code list.

Definition (Lean source)
q b :
ℕ
powerEndpointRegisterEval q b I :
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointRegisterEval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:177
theorem concreteEngine_power_staged_certificate

Every endpoint of the concrete power engine is computed by the certified stages. The remaining recurrence obligation is to fuse these calls and their fuel. the documented result

Formal statement
q b :
ℕ
concreteEngine.powBox q b I = powerEndpointRegisterEval q b I
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_power_staged_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerClipProgram.lean:183
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerEnclosure 6 declarations The logarithm midpoint and exponential bracket compose at the prescribed internal precision; clipping preserves containment and endpoint excess.

Certified integer-base power enclosures

The logarithm midpoint and exponential bracket compose at the prescribed internal precision; clipping preserves containment and endpoint excess.

[The prescribed internal precision pays for the cubic base amplification. the stated conclusion holds.

Formal statement
q B :
ℕ
conclusion 1
193 * (B : ℝ)^3 * precisionError (q + 12 + 3 * clog 2 B) ≤ precisionError q
conclusion 2
precisionError (q + 12 + 3 * clog 2 B) ≤ 1 / 4096
Proof (Lean source)
-- @node: power_internal_budget lemma power_internal_budget (q B : ℕ) : 193 * (B : ℝ)^3 * precisionError (q + 12 + 3 * clog 2 B) ≤ precisionError q ∧ precisionError (q + 12 + 3 * clog 2 B) ≤ 1 / 4096 := by have hB : (B : ℝ) ≤ 2 ^ clog 2 B := by exact_mod_cast Nat.le_pow_clog (by norm_num : 1 < (2 : ℕ)) B have hc : (B : ℝ)^3 ≤ (2 : ℝ)^(3 * clog 2 B) := by rw [mul_comm 3, pow_mul] gcongr have hq : (1 : ℝ) ≤ 2^q := one_le_pow₀ (by norm_num) have hl : (1 : ℝ) ≤ 2^(3 * clog 2 B) := one_le_pow₀ (by norm_num) simp only [precisionError, zpow_neg, zpow_natCast, pow_add] constructor · apply (mul_le_mul_iff_left₀ (by positivity : (0 : ℝ) < 2^q * 2^12 * 2^(3 * clog 2 B))).mp field_simp nlinarith · apply (mul_le_mul_iff_left₀ (by positivity : (0 : ℝ) < 2^q * 2^12 * 2^(3 * clog 2 B))).mp field_simp nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.power_internal_budget · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEnclosure.lean:16

A positive integer base raised to an exponent in the primitive domain stays in its clip range. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
b :
ℕ
hb :
1 ≤ b
v :
ℝ
hl :
-3 ≤ v
hu :
v ≤ 3
conclusion 1
1 / (b : ℝ)^3 ≤ (b : ℝ)^v
conclusion 2
(b : ℝ)^v ≤ (b : ℝ)^3
Proof (Lean source)
-- @node: power_value_range lemma power_value_range (b : ℕ) (hb : 1 ≤ b) (v : ℝ) (hl : -3 ≤ v) (hu : v ≤ 3) : 1 / (b : ℝ)^3 ≤ (b : ℝ)^v ∧ (b : ℝ)^v ≤ (b : ℝ)^3 := by have hbR : (1 : ℝ) ≤ b := by exact_mod_cast hb constructor · have h := Real.rpow_le_rpow_of_exponent_le hbR hl rw [Real.rpow_neg (by positivity : (0 : ℝ) ≤ b)] at h norm_num only [Real.rpow_ofNat] at h simpa only [one_div] using h · simpa using Real.rpow_le_rpow_of_exponent_le hbR hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.power_value_range · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEnclosure.lean:39
theorem paperLogScalar_midpoint_error Lemma paperLogScalar_midpoint_error in the paper ↗

The certified logarithm midpoint approximates the true logarithm. Under the stated assumptions.

Formal statement
p b :
ℕ
hb :
1 ≤ b
|(((paperLogScalar p b).lo + (paperLogScalar p b).hi) / 2 : ℚ) - log b|
Proof (Lean source)
-- @node: paperLogScalar_midpoint_error lemma paperLogScalar_midpoint_error (p b : ℕ) (hb : 1 ≤ b) : |(((paperLogScalar p b).lo + (paperLogScalar p b).hi) / 2 : ℚ) - log b| ≤ precisionError p := by obtain ⟨h, he, hf⟩ := paperLogScalar_spec p b (by exact_mod_cast (Nat.zero_lt_of_lt hb)) rw [abs_le] push_cast at he hf ⊢ obtain ⟨hlo, hhi⟩ := h push_cast at hlo hhi exact ⟨by linarith, by linarith⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperLogScalar_midpoint_error · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEnclosure.lean:51
theorem power_midpoint_value_error Lemma power_midpoint_value_error in the paper ↗

The logarithm argument error gives a uniform cubic bound on the power value error. Under the stated assumptions.

Formal statement
q b :
ℕ
hb :
1 ≤ b
v :
ℚ
hl :
-3 ≤ v
hu :
v ≤ 3
B :
max 2 b
p :
q + 12 + 3 * clog 2 B
L :
|exp (v * ((L.lo + L.hi) / 2 : ℚ)) - (b : ℝ)^(v : ℝ)|
≤ 96 * (B : ℝ)^3 * precisionError p
Proof (Lean source)
-- @node: power_midpoint_value_error lemma power_midpoint_value_error (q b : ℕ) (hb : 1 ≤ b) (v : ℚ) (hl : -3 ≤ v) (hu : v ≤ 3) : let B := max 2 b let p := q + 12 + 3 * clog 2 B let L := paperLogScalar p b |exp (v * ((L.lo + L.hi) / 2 : ℚ)) - (b : ℝ)^(v : ℝ)| ≤ 96 * (B : ℝ)^3 * precisionError p := by dsimp only let B := max 2 b let p := q + 12 + 3 * clog 2 B let a : ℝ := v * (((paperLogScalar p b).lo + (paperLogScalar p b).hi) / 2 : ℚ) let c : ℝ := v * Real.log b have hv : |(v : ℝ)| ≤ 3 := by exact_mod_cast abs_le.mpr ⟨hl, hu⟩ have he : |a - c| ≤ 3 * precisionError p := by have hm := paperLogScalar_midpoint_error p b hb have hid : a - c = (v : ℝ) * ((((paperLogScalar p b).lo + (paperLogScalar p b).hi) / 2 : ℚ) - Real.log b) := by dsimp [a, c]; push_cast; ring rw [hid, abs_mul] exact mul_le_mul hv hm (abs_nonneg _) (by norm_num) have hsmall : |a - c| ≤ 1 := he.trans (by have := (power_internal_budget q B).2 dsimp [p]; linarith) have hlocal := Real.abs_exp_sub_one_le hsmall have hc : exp c = (b : ℝ)^(v : ℝ) := by rw [Real.rpow_def_of_pos (by positivity : (0 : ℝ) < b)] dsimp [c]; rw [mul_comm] have hbase : exp c ≤ (B : ℝ)^3 := by rw [hc] apply (power_value_range b hb v (by exact_mod_cast hl) (by exact_mod_cast hu)).2.trans gcongr exact_mod_cast le_max_right 2 b have hid : exp a - exp c = exp c * (exp (a-c) - 1) := by rw [mul_sub, ← Real.exp_add, mul_one] rw [show c + (a-c) = a by ring] change |exp a - (b : ℝ)^(v : ℝ)| ≤ _ rw [← hc, hid, abs_mul, abs_of_pos (Real.exp_pos c)] have h := mul_le_mul hbase hlocal (abs_nonneg _) (by positivity : (0 : ℝ) ≤ (B : ℝ)^3) have hp : 0 ≤ precisionError p := by unfold precisionError; positivity calc exp c * |exp (a-c)-1| ≤ (B : ℝ)^3 * (2 * |a-c|) := h _ ≤ (B : ℝ)^3 * (2 * (3 * precisionError p)) := by gcongr _ ≤ 96 * (B : ℝ)^3 * precisionError p := by nlinarith [show 0 ≤ (B : ℝ)^3 by positivity]
CausalSmith.Stat.LogoddsLowsmoothFrontier.power_midpoint_value_error · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEnclosure.lean:63

Clipped scalar power brackets contain the value and satisfy the requested excess bound. Under the stated assumptions.

Formal statement
q b :
ℕ
hb :
1 ≤ b
v :
ℚ
hl :
-3 ≤ v
hu :
v ≤ 3
conclusion 1
(paperPowerScalar q b v).Contains ((b : ℝ)^(v : ℝ))
conclusion 2
0 < (paperPowerScalar q b v).lo
conclusion 3
(b : ℝ)^(v : ℝ) - (paperPowerScalar q b v).lo ≤ precisionError q
conclusion 4
(paperPowerScalar q b v).hi - (b : ℝ)^(v : ℝ) ≤ precisionError q
Proof (Lean source)
-- @node: paperPowerScalar_spec lemma paperPowerScalar_spec (q b : ℕ) (hb : 1 ≤ b) (v : ℚ) (hl : -3 ≤ v) (hu : v ≤ 3) : (paperPowerScalar q b v).Contains ((b : ℝ)^(v : ℝ)) ∧ 0 < (paperPowerScalar q b v).lo ∧ (b : ℝ)^(v : ℝ) - (paperPowerScalar q b v).lo ≤ precisionError q ∧ (paperPowerScalar q b v).hi - (b : ℝ)^(v : ℝ) ≤ precisionError q := by by_cases hb1 : b = 1 · subst b simp [paperPowerScalar, RatInterval.Contains, RatInterval.point, show 0 ≤ precisionError q by unfold precisionError; positivity] let B := max 2 b let p := q + 12 + 3 * clog 2 B let L := paperLogScalar p b let z : ℚ := v * ((L.lo + L.hi) / 2) let J := paperExpScalar p z let e : ℚ := 96 * (B : ℚ)^3 * rationalError p let y : ℝ := (b : ℝ)^(v : ℝ) have heq : (e : ℝ) = 96 * (B : ℝ)^3 * precisionError p := by simp [e, rationalError, precisionError, zpow_neg, zpow_natCast] have herr : |Real.exp z - y| ≤ (e : ℝ) := by rw [heq] simpa only [z, y, L, p, B, Rat.cast_mul] using power_midpoint_value_error q b hb v hl hu obtain ⟨⟨hJlo, hJhi⟩, hJ0, hJl, hJu⟩ := paperExpScalar_spec p z change (J.lo : ℝ) ≤ Real.exp z at hJlo change Real.exp z ≤ (J.hi : ℝ) at hJhi change Real.exp z - (J.lo : ℝ) ≤ precisionError p at hJl change (J.hi : ℝ) - Real.exp z ≤ precisionError p at hJu have hcl : 1 / (b : ℝ)^3 ≤ y := (power_value_range b hb v (by exact_mod_cast hl) (by exact_mod_cast hu)).1 have hcu : y ≤ (b : ℝ)^3 := (power_value_range b hb v (by exact_mod_cast hl) (by exact_mod_cast hu)).2 have hlR : ((max (1 / (b : ℚ)^3) (J.lo-e) : ℚ) : ℝ) ≤ y := by push_cast exact max_le hcl (by linarith only [hJlo, (abs_le.mp herr).2]) have huR : y ≤ ((min ((b : ℚ)^3) (J.hi+e) : ℚ) : ℝ) := by push_cast exact le_min hcu (by linarith only [hJhi, (abs_le.mp herr).1]) have hord : max (1 / (b : ℚ)^3) (J.lo-e) ≤ min ((b : ℚ)^3) (J.hi+e) := by exact_mod_cast hlR.trans huR have hlo : J.lo - e ≤ max (1 / (b : ℚ)^3) (J.lo-e) := le_max_right _ _ have hhi : min ((b : ℚ)^3) (J.hi+e) ≤ J.hi + e := min_le_right _ _ have hloR : (J.lo : ℝ) - e ≤ (max (1 / (b : ℚ)^3) (J.lo-e) : ℚ) := by exact_mod_cast hlo have hhiR : (min ((b : ℚ)^3) (J.hi+e) : ℚ) ≤ (J.hi : ℝ) + e := by exact_mod_cast hhi have hB : (1 : ℝ) ≤ (B : ℝ)^3 := by have : (1 : ℝ) ≤ B := by dsimp [B]; exact_mod_cast (le_max_left 2 b).trans' (by norm_num : 1 ≤ (2 : ℕ)) exact one_le_pow₀ this have hp : 0 ≤ precisionError p := by unfold precisionError; positivity have hbudget : precisionError p + 2 * (e : ℝ) ≤ precisionError q := by rw [heq] have hbound : 193 * (B : ℝ)^3 * precisionError p ≤ precisionError q := (power_internal_budget q B).1 nlinarith only [hbound, mul_nonneg (sub_nonneg.mpr hB) hp] have hout : paperPowerScalar q b v = rationalBox (max (1 / (b : ℚ)^3) (J.lo-e)) (min ((b : ℚ)^3) (J.hi+e)) := by simp only [paperPowerScalar, if_neg hb1] rfl rw [hout] simp only [rationalBox, min_eq_left hord, max_eq_right hord, RatInterval.Contains] refine ⟨⟨hlR, huR⟩, ?_, ?_, ?_⟩ · exact (by positivity : (0 : ℚ) < 1 / (b : ℚ)^3).trans_le (le_max_left _ _) · change y - (max (1 / (b : ℚ)^3) (J.lo-e) : ℚ) ≤ precisionError q linarith only [hloR, hJl, hbudget, (abs_le.mp herr).1] · change (min ((b : ℚ)^3) (J.hi+e) : ℚ) - y ≤ precisionError q linarith only [hhiR, hJu, hbudget, (abs_le.mp herr).2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperPowerScalar_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEnclosure.lean:109
theorem concreteEngine_power_contract

Monotone endpoint evaluation gives the complete integer-base power primitive contract. Under the stated assumptions.

Formal statement
q b :
ℕ
hb :
1 ≤ b
hl :
-3 ≤ I.lo
hu :
I.hi ≤ 3
conclusion 1
MonotoneContract (fun v => (b : ℝ)^v) q I (concreteEngine.powBox q b I)
conclusion 2
0 < (concreteEngine.powBox q b I).lo
Proof (Lean source)
-- @node: concreteEngine_power_contract lemma concreteEngine_power_contract (q b : ℕ) (I : RatInterval) (hb : 1 ≤ b) (hl : -3 ≤ I.lo) (hu : I.hi ≤ 3) : MonotoneContract (fun v => (b : ℝ)^v) q I (concreteEngine.powBox q b I) ∧ 0 < (concreteEngine.powBox q b I).lo := by have hmono : Monotone (fun v : ℝ => (b : ℝ)^v) := fun _ _ h => Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hb) h obtain ⟨hlo, hp, hle, _⟩ := paperPowerScalar_spec q b hb I.lo hl (I.lo_le_hi.trans hu) obtain ⟨hhi, _, _, hue⟩ := paperPowerScalar_spec q b hb I.hi (hl.trans I.lo_le_hi) hu have hordR : ((paperPowerScalar q b I.lo).lo : ℝ) ≤ (paperPowerScalar q b I.hi).hi := hlo.1.trans ((hmono (by exact_mod_cast I.lo_le_hi)).trans hhi.2) have hord : (paperPowerScalar q b I.lo).lo ≤ (paperPowerScalar q b I.hi).hi := by exact_mod_cast hordR simp only [concreteEngine, endpointExtension, rationalBox, min_eq_left hord, max_eq_right hord, MonotoneContract, RatInterval.Contains] refine ⟨⟨?_, sub_nonneg.mpr hlo.1, hle, sub_nonneg.mpr hhi.2, hue⟩, hp⟩ intro x hx exact ⟨hlo.1.trans (hmono hx.1), (hmono hx.2).trans hhi.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_power_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEnclosure.lean:179
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerEndpointProgram 62 declarations This module joins two certified scalar power calls.

A fused two-endpoint power register program

This module joins two certified scalar power calls. A small bridge retains the lower endpoint of the left call in spare registers while the right call runs.

theorem powerClipCode_before_halt_of_ne_one

[Away from the base-one shortcut, the clipping routine reaches its final halt instruction after exactly twenty-six active steps. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
hb :
(⌊s.2.1 1⌋ : ℤ).toNat ≠ 1
p :
(⌊s.2.1 0⌋ : ℤ).toNat
b :
(⌊s.2.1 1⌋ : ℤ).toNat
e :
96 * (max 2 b : ℚ)^3 * rationalError p
t :
powerClipCode.run (if b = 0 then 23 else 22) s
t.1 = 26
t.2.2 = false
t.2.1 0 = max (1/(b : ℚ)^3) (s.2.1 2-e)
t.2.1 1 = min ((b : ℚ)^3) (s.2.1 3+e)
Proof (Lean source)
lemma powerClipCode_before_halt_of_ne_one (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) (hb : (⌊s.2.1 1⌋ : ℤ).toNat ≠ 1) : let p := (⌊s.2.1 0⌋ : ℤ).toNat let b := (⌊s.2.1 1⌋ : ℤ).toNat let e := 96 * (max 2 b : ℚ)^3 * rationalError p let t := powerClipCode.run (if b = 0 then 23 else 22) s t.1 = 26 ∧ t.2.2 = false ∧ t.2.1 0 = max (1/(b : ℚ)^3) (s.2.1 2-e) ∧ t.2.1 1 = min ((b : ℚ)^3) (s.2.1 3+e) := by dsimp only let b := (⌊s.2.1 1⌋ : ℤ).toNat let p := (⌊s.2.1 0⌋ : ℤ).toNat have hpre : let t := powerClipCode.run 6 s t.1 = 6 ∧ t.2.2 = false ∧ t.2.1 14 = p ∧ t.2.1 21 = b ∧ t.2.1 8 = 1 ∧ t.2.1 2 = s.2.1 2 ∧ t.2.1 3 = s.2.1 3 := by norm_num [powerClipCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, powerRegister_clamp_cast, p, b] rw [show (if b = 0 then 23 else 22) = 6 + (if b = 0 then 17 else 16) by split <;> rfl, rationalProgram_run_add] generalize he : powerClipCode.run 6 s = t at hpre ⊢ dsimp only at hpre obtain ⟨htp, hta, hprecision, hbase, hone, hlo, hhi⟩ := hpre by_cases hz : b = 0 · simp only [if_pos hz] norm_num [powerClipCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hbase, hone, hprecision, hz, hlo, hhi, rationalError, p, div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm, show (3 : ℤ).toNat = 3 by rfl] have hc : (max (⌊s.2.1 0⌋ : ℤ) 0).toNat = p := by dsimp [p]; omega rw [hc] rw [show (⌊s.2.1 0⌋ : ℤ).toNat = p by rfl, show (⌊s.2.1 1⌋ : ℤ).toNat = b by rfl] simp [hz, rationalError] constructor <;> congr 2 <;> ring · have hgt : ¬ (b : ℚ) ≤ 1 := by exact_mod_cast (show ¬ b ≤ 1 by omega) simp only [if_neg hz] norm_num [powerClipCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hbase, hone, hprecision, hgt, hlo, hhi, rationalError, hb, hz, p, div_eq_mul_inv, mul_assoc, mul_comm, mul_left_comm, show (3 : ℤ).toNat = 3 by rfl] have hc : (max (⌊s.2.1 0⌋ : ℤ) 0).toNat = p := by dsimp [p]; omega rw [hc] rw [show (⌊s.2.1 0⌋ : ℤ).toNat = p by rfl, show (⌊s.2.1 1⌋ : ℤ).toNat = b by rfl] simp [rationalError]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipCode_before_halt_of_ne_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:16
def powerClipTailActiveFuel

[Exact active fuel for the relocated clipping tail outside the base-one shortcut.

Definition (Lean source)
powerClipTailActiveFuel s :
ℕ
if (⌊s.2.1 25⌋ : ℤ).toNat = 0 then 27 else 26
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipTailActiveFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:65
theorem powerClipTail_before_halt_of_ne_one

The clipping tail reaches its final active frame with the raw clipped endpoints. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
hb :
(⌊s.2.1 25⌋ : ℤ).toNat ≠ 1
p :
(⌊s.2.1 24⌋ : ℤ).toNat
b :
(⌊s.2.1 25⌋ : ℤ).toNat
e :
96 * (max 2 b : ℚ)^3 * rationalError p
t :
powerClipTail.run (powerClipTailActiveFuel s) s
t.1 = 30
t.2.2 = false
t.2.1 0 = max (1/(b : ℚ)^3) (s.2.1 0-e)
t.2.1 1 = min ((b : ℚ)^3) (s.2.1 1+e)
Proof (Lean source)
lemma powerClipTail_before_halt_of_ne_one (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) (hb : (⌊s.2.1 25⌋ : ℤ).toNat ≠ 1) : let p := (⌊s.2.1 24⌋ : ℤ).toNat let b := (⌊s.2.1 25⌋ : ℤ).toNat let e := 96 * (max 2 b : ℚ)^3 * rationalError p let t := powerClipTail.run (powerClipTailActiveFuel s) s t.1 = 30 ∧ t.2.2 = false ∧ t.2.1 0 = max (1/(b : ℚ)^3) (s.2.1 0-e) ∧ t.2.1 1 = min ((b : ℚ)^3) (s.2.1 1+e) := by have hprep := powerClipTail_prepare s hp ha simp only [powerClipTailActiveFuel] rw [show (if (⌊s.2.1 25⌋ : ℤ).toNat = 0 then 27 else 26) = 4 + (if (⌊s.2.1 25⌋ : ℤ).toNat = 0 then 23 else 22) by split <;> rfl, rationalProgram_run_add] generalize he : powerClipTail.run 4 s = t at hprep ⊢ dsimp only at hprep obtain ⟨htp, hta, h0, h1, h2, h3⟩ := hprep let u : RationalState := (0,t.2.1,false) have ht : t = rationalState_relocate powerClipPrelude.length u := by apply Prod.ext · simpa [rationalState_relocate, powerClipPrelude, u] using htp · exact Prod.ext rfl hta have hout := powerClipCode_before_halt_of_ne_one u rfl rfl (by simpa [u, h1] using hb) dsimp only [u] at hout simp only [h0, h1, h2, h3] at hout rw [ht] rw [show powerClipTail = powerClipPrelude ++ powerClipCode.map (rationalInstruction_relocate powerClipPrelude.length) by rfl, rationalProgram_relocate_run] dsimp only [rationalState_relocate] rcases hout with ⟨hpc, hactive, hlo, hhi⟩ simp only [Int.toNat_eq_zero] at hpc hactive hlo hhi refine ⟨by simp [powerClipPrelude, u, Int.toNat_eq_zero, hpc], ?_, ?_, ?_⟩ · simpa [u, Int.toNat_eq_zero] using hactive · simpa [u, Int.toNat_eq_zero] using hlo · simpa [u, Int.toNat_eq_zero] using hhi
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipTail_before_halt_of_ne_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:69
def powerExpClipActiveFuel

[Exact active fuel of the exponential-and-clipping continuation.

Definition (Lean source)
powerExpClipActiveFuel s :
ℕ
powerExpFrameFuel s + if (⌊s.2.1 2⌋ : ℤ).toNat = 0 then 27 else 26
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipActiveFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:107
theorem powerExpClipCode_before_halt_of_ne_one

Outside base one, the fused exponential/clipping code reaches its final active halt frame and already contains the scalar power bracket. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
hb :
(⌊s.2.1 2⌋ : ℤ).toNat ≠ 1
p :
(⌊s.2.1 0⌋ : ℤ).toNat
b :
(⌊s.2.1 2⌋ : ℤ).toNat
J :
paperExpScalar p (s.2.1 3*s.2.1 1)
t :
powerExpClipCode.run (powerExpClipActiveFuel s) s
t.1 = 126
t.2.2 = false
rationalBox (t.2.1 0) (t.2.1 1) = powerClipBox p b J.lo J.hi
Proof (Lean source)
lemma powerExpClipCode_before_halt_of_ne_one (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) (hb : (⌊s.2.1 2⌋ : ℤ).toNat ≠ 1) : let p := (⌊s.2.1 0⌋ : ℤ).toNat let b := (⌊s.2.1 2⌋ : ℤ).toNat let J := paperExpScalar p (s.2.1 3*s.2.1 1) let t := powerExpClipCode.run (powerExpClipActiveFuel s) s t.1 = 126 ∧ t.2.2 = false ∧ rationalBox (t.2.1 0) (t.2.1 1) = powerClipBox p b J.lo J.hi := by have h := powerExpCode_before_halt s hp ha have hf : powerExpClipActiveFuel s = (powerExpFrameFuel s-1)+1+ (if (⌊s.2.1 2⌋ : ℤ).toNat = 0 then 27 else 26) := by simp only [powerExpClipActiveFuel, powerExpFrameFuel, expRegisterFuel] omega rw [hf, rationalProgram_run_add, rationalProgram_run_add] dsimp only at h have hrun := rationalProgram_continue_run powerExpCode powerClipTail (powerExpFrameFuel s-1) s h.2.1 change powerExpClipCode.run _ s = _ at hrun rw [hrun] generalize he : powerExpCode.run (powerExpFrameFuel s-1) s = t at h ⊢ obtain ⟨htp, hta, hlo, hhi, h24, h25, _⟩ := h rw [show powerExpClipCode.run 1 t = powerExpClipCode.step t by rfl, powerExpClipCode_connect t htp hta] rw [show powerExpClipCode = rationalProgram_continue powerExpCode powerClipTail by rfl, rationalProgram_continue_tail] have hout := powerClipTail_before_halt_of_ne_one (0,t.2.1,false) rfl rfl (by simpa [h25] using hb) dsimp only at hout simp only [h24, h25, hlo, hhi, Int.floor_natCast, Int.toNat_natCast] at hout dsimp only [rationalState_relocate] rcases hout with ⟨hpc, hactive, hrawlo, hrawhi⟩ simp only [powerClipTailActiveFuel, h25] at hpc hactive hrawlo hrawhi refine ⟨?_, hactive, ?_⟩ · have hlen : powerExpCode.length = 96 := by rfl rw [hlen, hpc] rw [hrawlo, hrawhi] simp [powerClipBox, hb]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipCode_before_halt_of_ne_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:111
def powerScalarActiveFuel

[Exact fuel to the scalar program's active final halt frame outside base one.

Definition (Lean source)
xs :
List ℚ
powerScalarActiveFuel xs :
ℕ
t :
powerLogCode.run (powerLogActiveFuel xs) (RationalProgram.initial xs)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarActiveFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:151
theorem powerScalarCode_before_halt_of_ne_one

Outside base one, the scalar code reaches its active final frame with the prescribed rational bracket. the documented result Under the stated assumptions.

Formal statement
xs :
List ℚ
hb :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
v :
xs[2]?.getD 0
t :
powerScalarCode.run (powerScalarActiveFuel xs) (RationalProgram.initial xs)
t.1 = 178
t.2.2 = false
rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v
Proof (Lean source)
lemma powerScalarCode_before_halt_of_ne_one (xs : List ℚ) (hb : (⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let v := xs[2]?.getD 0 let t := powerScalarCode.run (powerScalarActiveFuel xs) (RationalProgram.initial xs) t.1 = 178 ∧ t.2.2 = false ∧ rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v := by have h := powerLogCode_before_halt xs dsimp only at h rw [← powerLogActiveFuel] at h dsimp only [powerScalarActiveFuel] rw [rationalProgram_run_add, rationalProgram_run_add] have hrun := rationalProgram_continue_run powerLogCode powerExpClipCode (powerLogActiveFuel xs) (RationalProgram.initial xs) h.2.1 change powerScalarCode.run _ _ = _ at hrun rw [hrun] generalize he : powerLogCode.run (powerLogActiveFuel xs) (RationalProgram.initial xs) = t at h ⊢ obtain ⟨htp, hta, hq, hmid, hbreg, hv, _⟩ := h rw [show powerScalarCode.run 1 t = powerScalarCode.step t by rfl, powerScalarCode_connect t htp hta] rw [show powerScalarCode = rationalProgram_continue powerLogCode powerExpClipCode by rfl, rationalProgram_continue_tail] have hout := powerExpClipCode_before_halt_of_ne_one (0,t.2.1,false) rfl rfl (by simpa only [hbreg, Int.floor_natCast, Int.toNat_natCast] using hb) dsimp only at hout simp only [hq, hmid, hbreg, hv, Int.floor_natCast, Int.toNat_natCast] at hout dsimp only [rationalState_relocate] rcases hout with ⟨hpc, hactive, hbox⟩ refine ⟨?_, hactive, ?_⟩ · have hlen : powerLogCode.length = 52 := by rfl rw [hlen, hpc] · rw [hbox] exact (paperPowerScalar_eq_powerClipBox _ _ _).symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_before_halt_of_ne_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:156
theorem powerScalarActiveFuel_succ_le_public

The exact active scalar run plus its final halt fits inside the published fuel. the stated conclusion holds.

Formal statement
xs :
List ℚ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarActiveFuel_succ_le_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:194
theorem powerScalarCode_spare_register

The scalar routine leaves registers forty and above untouched. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
i :
ℕ
hi :
40 ≤ i
fuel :
ℕ
(powerScalarCode.run fuel s).2.1 i = s.2.1 i
Proof (Lean source)
lemma powerScalarCode_spare_register (i : ℕ) (hi : 40 ≤ i) (fuel : ℕ) (s : RationalState) : (powerScalarCode.run fuel s).2.1 i = s.2.1 i := by apply rationalProgram_run_preserves intro op hop hd have hbound : ∀ op ∈ powerScalarCode, ∀ d, rationalInstruction_destination op = some d → d < 40 := by decide exact not_lt_of_ge hi (hbound op hop i hd)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_spare_register · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:202
def powerEndpointRestoreTail

[Finalize the right scalar call while restoring the saved left lower endpoint.

Definition (Lean source)
powerEndpointRestoreTail :
[.max 1 0 1, .copy 0 43, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointRestoreTail · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:211
def powerEndpointSecondCode

A scalar call whose halt continues into endpoint restoration.

Definition (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointSecondCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:215
def powerEndpointSecondPrelude

Save the left lower endpoint and restore the original inputs for the right call.

Definition (Lean source)
powerEndpointSecondPrelude :
[.min 43 0 1, .copy 0 40, .copy 1 41, .copy 2 42, .copy 3 46, .constant 4 0, .constant 5 0, .constant 6 0, .constant 7 0, .constant 8 0, .constant 9 0, .constant 10 0, .constant 11 0, .constant 12 0, .constant 13 0, .constant 14 0, .constant 15 0, .constant 16 0, .constant 17 0, .constant 18 0, .constant 19 0, .constant 20 0, .constant 21 0, .constant 22 0, .constant 23 0, .constant 24 0, .constant 25 0, .constant 26 0, .constant 27 0, .constant 28 0, .constant 29 0, .constant 30 0, .constant 31 0, .constant 32 0, .constant 33 0, .constant 34 0, .constant 35 0, .constant 36 0, .constant 37 0, .constant 38 0, .constant 39 0]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointSecondPrelude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:219
def powerEndpointSecondTail

The bridge and relocated right scalar call.

Definition (Lean source)
powerEndpointSecondTail :
powerEndpointSecondPrelude ++ powerEndpointSecondCode.map (rationalInstruction_relocate powerEndpointSecondPrelude.length)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointSecondTail · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:224
def powerEndpointCore

Two scalar calls joined at their active final halt frames.

Definition (Lean source)
def powerEndpointPrelude

Dispatch base one directly; otherwise save inputs before entering the fused calls.

Definition (Lean source)
powerEndpointPrelude :
[.floor 44 1, .constant 45 0, .max 44 44 45, .constant 45 1, .branchLe 44 45 5 9, .branchLe 45 44 6 9, .constant 0 1, .constant 1 1, .halt, .copy 40 0, .copy 41 1, .copy 42 3, .copy 46 2, .constant 4 0, .constant 5 0, .constant 6 0, .constant 7 0, .constant 8 0, .constant 9 0, .constant 10 0, .constant 11 0, .constant 12 0, .constant 13 0, .constant 14 0, .constant 15 0, .constant 16 0, .constant 17 0, .constant 18 0, .constant 19 0, .constant 20 0, .constant 21 0, .constant 22 0, .constant 23 0, .constant 24 0, .constant 25 0, .constant 26 0, .constant 27 0, .constant 28 0, .constant 29 0, .constant 30 0, .constant 31 0, .constant 32 0, .constant 33 0, .constant 34 0, .constant 35 0, .constant 36 0, .constant 37 0, .constant 38 0, .constant 39 0]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointPrelude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:233
def powerEndpointCode

The complete two-endpoint power program.

Definition (Lean source)
powerEndpointCode :
powerEndpointPrelude ++ powerEndpointCore.map (rationalInstruction_relocate powerEndpointPrelude.length)
def powerEndpointPreludeFuel

Active prelude length outside base one.

Definition (Lean source)
xs :
List ℚ
powerEndpointPreludeFuel xs :
ℕ
if (⌊xs[1]?.getD 0⌋ : ℤ).toNat = 0 then 46 else 45
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointPreludeFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:246
theorem powerEndpointPrelude_prepare

The outer prelude saves the common inputs and right exponent. the stated conclusion holds. Under the stated assumptions.

Formal statement
xs :
List ℚ
hb :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1
t :
powerEndpointCode.run (powerEndpointPreludeFuel xs) (RationalProgram.initial xs)
t.1 = 49
t.2.2 = false
t.2.1 40 = xs[0]?.getD 0
t.2.1 41 = xs[1]?.getD 0
t.2.1 42 = xs[3]?.getD 0
t.2.1 46 = xs[2]?.getD 0
Proof (Lean source)
lemma powerEndpointPrelude_prepare (xs : List ℚ) (hb : (⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1) : let t := powerEndpointCode.run (powerEndpointPreludeFuel xs) (RationalProgram.initial xs) t.1 = 49 ∧ t.2.2 = false ∧ t.2.1 40 = xs[0]?.getD 0 ∧ t.2.1 41 = xs[1]?.getD 0 ∧ t.2.1 42 = xs[3]?.getD 0 ∧ t.2.1 46 = xs[2]?.getD 0 := by dsimp only [powerEndpointPreludeFuel] let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat have hbcast : ((b : ℕ) : ℚ) = max (⌊xs[1]?.getD 0⌋ : ℤ) 0 := by exact_mod_cast (show (b : ℤ) = max (⌊xs[1]?.getD 0⌋ : ℤ) 0 by dsimp [b]; omega) by_cases hz : b = 0 · have hle : (b : ℚ) ≤ 1 := by simp [hz] have hnle : ¬(1 : ℚ) ≤ b := by simp [hz] have hle' : ((max (⌊xs[1]?.getD 0⌋ : ℤ) 0 : ℤ) : ℚ) ≤ 1 := by rw [← hbcast]; exact hle have hnle' : ¬(1 : ℚ) ≤ ((max (⌊xs[1]?.getD 0⌋ : ℤ) 0 : ℤ) : ℚ) := by rw [← hbcast]; exact hnle have hraw : ((⌊xs[1]?.getD 0⌋ : ℤ) : ℚ) ≤ 1 := by exact_mod_cast (show (⌊xs[1]?.getD 0⌋ : ℤ) ≤ 1 by dsimp [b] at hz; omega) have hnraw : ¬(1 : ℚ) ≤ (⌊xs[1]?.getD 0⌋ : ℤ) := by exact_mod_cast (show ¬(1 : ℤ) ≤ ⌊xs[1]?.getD 0⌋ by dsimp [b] at hz; omega) norm_num [powerEndpointCode, powerEndpointPrelude, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, b, hz, hle, hnle, hle', hnle', hraw, hnraw] · have hnle : ¬(b : ℚ) ≤ 1 := by exact_mod_cast (show ¬ b ≤ 1 by omega) have hnle' : ¬((max (⌊xs[1]?.getD 0⌋ : ℤ) 0 : ℤ) : ℚ) ≤ 1 := by rw [← hbcast]; exact hnle have hraw : ¬((⌊xs[1]?.getD 0⌋ : ℤ) : ℚ) ≤ 1 := by exact_mod_cast (show ¬(⌊xs[1]?.getD 0⌋ : ℤ) ≤ 1 by dsimp [b] at hz; omega) norm_num [powerEndpointCode, powerEndpointPrelude, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, b, hz, hnle, hnle', hraw]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointPrelude_prepare · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:250
theorem powerEndpointSecondPrelude_prepare

The four-instruction bridge prepares the second scalar call. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
t :
powerEndpointSecondTail.run 41 s
t.1 = 41
t.2.2 = false
t.2.1 43 = min (s.2.1 0) (s.2.1 1)
t.2.1 0 = s.2.1 40
t.2.1 1 = s.2.1 41
t.2.1 2 = s.2.1 42
t.2.1 3 = s.2.1 46
i :
4 ≤ i
i < 40
t.2.1 i = 0
Proof (Lean source)
lemma powerEndpointSecondPrelude_prepare (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let t := powerEndpointSecondTail.run 41 s t.1 = 41 ∧ t.2.2 = false ∧ t.2.1 43 = min (s.2.1 0) (s.2.1 1) ∧ t.2.1 0 = s.2.1 40 ∧ t.2.1 1 = s.2.1 41 ∧ t.2.1 2 = s.2.1 42 ∧ t.2.1 3 = s.2.1 46 ∧ (∀ i, 4 ≤ i → i < 40 → t.2.1 i = 0) := by norm_num [powerEndpointSecondTail, powerEndpointSecondPrelude, RationalProgram.run, RationalProgram.step, hp, ha, Function.update_apply] intro i hlo hi interval_cases i <;> norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointSecondPrelude_prepare · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:286
theorem powerEndpointRestore_before_halt

The restoration tail reaches its active halt frame with the requested pair. Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
t :
powerEndpointRestoreTail.run 2 s
t.1 = 2
t.2.2 = false
t.2.1 0 = s.2.1 43
t.2.1 1 = max (s.2.1 0) (s.2.1 1)
Proof (Lean source)
lemma powerEndpointRestore_before_halt (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let t := powerEndpointRestoreTail.run 2 s t.1 = 2 ∧ t.2.2 = false ∧ t.2.1 0 = s.2.1 43 ∧ t.2.1 1 = max (s.2.1 0) (s.2.1 1) := by norm_num [powerEndpointRestoreTail, RationalProgram.run, RationalProgram.step, hp, ha, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointRestore_before_halt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:299
def rationalInstructionBelow

[Every register mentioned by an instruction lies below a fixed cutoff.

Definition (Lean source)
n :
ℕ
rationalInstructionBelow n :
clause 1
| .constant d _ => d < n
clause 2
| .copy d a | .floor d a | .ceil d a | .factorial d a | .integerSqrt d a | .clogTwo d a
=> d < n ∧
a < n
clause 3
| .add d a b | .sub d a b | .mul d a b | .div d a b | .min d a b | .max d a b | .natPow d a b
=> d < n ∧
a < n ∧
b < n
clause 4
| .branchLe a b _ _ => a < n ∧ b < n
clause 5
| .jump _ | .halt => True
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalInstructionBelow · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:308
instance instDecidableRationalInstructionBelow

The anonymous instance result states the corresponding mathematical identity, bound, or structural property.

Definition (Lean source)
instance (n : ℕ) (op : RationalInstruction) : Decidable (rationalInstructionBelow n op) := by cases op <;> simp [rationalInstructionBelow] <;> infer_instance
CausalSmith.Stat.LogoddsLowsmoothFrontier.instDecidableRationalInstructionBelow · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:317
def rationalStateAgreeBelow

Agreement of the control frame and all registers below a cutoff.

Definition (Lean source)
n :
ℕ
rationalStateAgreeBelow n s t :
Prop
clause 1
s.1 = t.1
clause 2
s.2.2 = t.2.2
clause 3
i < n :
s.2.1 i = t.2.1 i
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalStateAgreeBelow · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:322
theorem rationalProgram_step_agree_below

The rational Program step agree below result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
hcode :
∀ op ∈ code, rationalInstructionBelow n op
rationalStateAgreeBelow n (code.step s) (code.step t)
Proof (Lean source)
lemma rationalProgram_step_agree_below (code : RationalProgram) (n : ℕ) (hcode : ∀ op ∈ code, rationalInstructionBelow n op) (s t : RationalState) (hst : rationalStateAgreeBelow n s t) : rationalStateAgreeBelow n (code.step s) (code.step t) := by rcases hst with ⟨hpc, hhalt, hreg⟩ unfold RationalProgram.step rw [hhalt] split · exact ⟨hpc, hhalt, hreg⟩ · simp only rw [hpc] cases he : code[t.1]? with | none => exact ⟨rfl, rfl, hreg⟩ | some op => have hop : op ∈ code := List.mem_of_getElem? he have hb := hcode op hop cases op <;> simp_all [rationalStateAgreeBelow, rationalInstructionBelow, Function.update_apply] <;> aesop
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_step_agree_below · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:325
theorem rationalProgram_run_agree_below

The rational Program run agree below result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
hcode :
∀ op ∈ code, rationalInstructionBelow n op
fuel :
ℕ
rationalStateAgreeBelow n (code.run fuel s) (code.run fuel t)
Proof (Lean source)
lemma rationalProgram_run_agree_below (code : RationalProgram) (n : ℕ) (hcode : ∀ op ∈ code, rationalInstructionBelow n op) (fuel : ℕ) (s t : RationalState) (hst : rationalStateAgreeBelow n s t) : rationalStateAgreeBelow n (code.run fuel s) (code.run fuel t) := by induction fuel generalizing s t with | zero => exact hst | succ fuel ih => rw [RationalProgram.run, RationalProgram.run] exact ih _ _ (rationalProgram_step_agree_below code n hcode s t hst)
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_run_agree_below · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:346
theorem powerScalarCode_below

[The scalar code depends only on registers below forty. the stated conclusion holds.

Formal statement
op :
shared
op ∈ powerScalarCode :
Proof (Lean source)
lemma powerScalarCode_below : ∀ op ∈ powerScalarCode, rationalInstructionBelow 40 op := by decide
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_below · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:358
theorem powerScalarCode_before_halt_frame

The scalar active-frame certificate is stable under arbitrary spare-register data. the stated conclusion holds. Under the stated assumptions.

Formal statement
xs :
List ℚ
hs :
rationalStateAgreeBelow 40 s (RationalProgram.initial xs)
hb :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
v :
xs[2]?.getD 0
t :
powerScalarCode.run (powerScalarActiveFuel xs) s
t.1 = 178
t.2.2 = false
rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v
Proof (Lean source)
lemma powerScalarCode_before_halt_frame (xs : List ℚ) (s : RationalState) (hs : rationalStateAgreeBelow 40 s (RationalProgram.initial xs)) (hb : (⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let v := xs[2]?.getD 0 let t := powerScalarCode.run (powerScalarActiveFuel xs) s t.1 = 178 ∧ t.2.2 = false ∧ rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v := by have href := powerScalarCode_before_halt_of_ne_one xs hb have hagree := rationalProgram_run_agree_below powerScalarCode 40 powerScalarCode_below (powerScalarActiveFuel xs) s (RationalProgram.initial xs) hs dsimp only at href ⊢ rcases hagree with ⟨hpc, hhalt, hreg⟩ refine ⟨hpc.trans href.1, hhalt.trans href.2.1, ?_⟩ rw [hreg 0 (by omega), hreg 1 (by omega)] exact href.2.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_before_halt_frame · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:362
theorem powerEndpointPrelude_frame

The initial endpoint prelude changes only spare registers before the first call. the stated conclusion holds. Under the stated assumptions.

Formal statement
xs :
List ℚ
hb :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1
t :
powerEndpointCode.run (powerEndpointPreludeFuel xs) (RationalProgram.initial xs)
rationalStateAgreeBelow 40 (0,t.2.1,false) (RationalProgram.initial [xs[0]?.getD 0, xs[1]?.getD 0, xs[2]?.getD 0, xs[3]?.getD 0])
t.2.1 40 = xs[0]?.getD 0
t.2.1 41 = xs[1]?.getD 0
t.2.1 42 = xs[3]?.getD 0
t.2.1 46 = xs[2]?.getD 0
Proof (Lean source)
lemma powerEndpointPrelude_frame (xs : List ℚ) (hb : (⌊xs[1]?.getD 0⌋ : ℤ).toNat ≠ 1) : let t := powerEndpointCode.run (powerEndpointPreludeFuel xs) (RationalProgram.initial xs) rationalStateAgreeBelow 40 (0,t.2.1,false) (RationalProgram.initial [xs[0]?.getD 0, xs[1]?.getD 0, xs[2]?.getD 0, xs[3]?.getD 0]) ∧ t.2.1 40 = xs[0]?.getD 0 ∧ t.2.1 41 = xs[1]?.getD 0 ∧ t.2.1 42 = xs[3]?.getD 0 ∧ t.2.1 46 = xs[2]?.getD 0 := by dsimp only [powerEndpointPreludeFuel] let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat have hbcast : ((b : ℕ) : ℚ) = max (⌊xs[1]?.getD 0⌋ : ℤ) 0 := by exact_mod_cast (show (b : ℤ) = max (⌊xs[1]?.getD 0⌋ : ℤ) 0 by dsimp [b]; omega) by_cases hz : b = 0 · have hle : (b : ℚ) ≤ 1 := by simp [hz] have hnle : ¬(1 : ℚ) ≤ b := by simp [hz] have hle' : ((max (⌊xs[1]?.getD 0⌋ : ℤ) 0 : ℤ) : ℚ) ≤ 1 := by rw [← hbcast]; exact hle have hnle' : ¬(1 : ℚ) ≤ ((max (⌊xs[1]?.getD 0⌋ : ℤ) 0 : ℤ) : ℚ) := by rw [← hbcast]; exact hnle have hraw : ((⌊xs[1]?.getD 0⌋ : ℤ) : ℚ) ≤ 1 := by exact_mod_cast (show (⌊xs[1]?.getD 0⌋ : ℤ) ≤ 1 by dsimp [b] at hz; omega) have hnraw : ¬(1 : ℚ) ≤ (⌊xs[1]?.getD 0⌋ : ℤ) := by exact_mod_cast (show ¬(1 : ℤ) ≤ ⌊xs[1]?.getD 0⌋ by dsimp [b] at hz; omega) norm_num [powerEndpointCode, powerEndpointPrelude, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, rationalStateAgreeBelow, b, hz, hle, hnle, hle', hnle', hraw, hnraw] intro i hi interval_cases i <;> simp [RationalProgram.initial] · have hnle : ¬(b : ℚ) ≤ 1 := by exact_mod_cast (show ¬ b ≤ 1 by omega) have hnle' : ¬((max (⌊xs[1]?.getD 0⌋ : ℤ) 0 : ℤ) : ℚ) ≤ 1 := by rw [← hbcast]; exact hnle have hraw : ¬((⌊xs[1]?.getD 0⌋ : ℤ) : ℚ) ≤ 1 := by exact_mod_cast (show ¬(⌊xs[1]?.getD 0⌋ : ℤ) ≤ 1 by dsimp [b] at hz; omega) norm_num [powerEndpointCode, powerEndpointPrelude, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, rationalStateAgreeBelow, b, hz, hnle, hnle', hraw] intro i hi interval_cases i <;> simp [RationalProgram.initial]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointPrelude_frame · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:381
theorem powerEndpointCore_connect

The first scalar final halt jumps into the endpoint bridge. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 178
ha :
s.2.2 = false
powerEndpointCore.step s = rationalState_relocate powerScalarCode.length (0,s.2.1,false)
Proof (Lean source)
lemma powerEndpointCore_connect (s : RationalState) (hp : s.1 = 178) (ha : s.2.2 = false) : powerEndpointCore.step s = rationalState_relocate powerScalarCode.length (0,s.2.1,false) := by have hlen : powerScalarCode.length = 179 := by rfl have hlookup : powerScalarCode[178]? = some .halt := by rfl simp only [powerEndpointCore, rationalProgram_continue, RationalProgram.step, ha, Bool.false_eq_true, ↓reduceIte, hp, List.getElem?_append, List.length_map, hlen, show 178 < 179 by omega, ↓reduceIte, List.getElem?_map, hlookup, Option.map_some, rationalInstruction_continue, rationalState_relocate, Nat.add_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointCore_connect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:423
theorem powerEndpointSecondCode_connect

The second scalar final halt jumps into endpoint restoration. Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 178
ha :
s.2.2 = false
powerEndpointSecondCode.step s
= rationalState_relocate powerScalarCode.length (0,s.2.1,false)
Proof (Lean source)
lemma powerEndpointSecondCode_connect (s : RationalState) (hp : s.1 = 178) (ha : s.2.2 = false) : powerEndpointSecondCode.step s = rationalState_relocate powerScalarCode.length (0,s.2.1,false) := by have hlen : powerScalarCode.length = 179 := by rfl have hlookup : powerScalarCode[178]? = some .halt := by rfl simp only [powerEndpointSecondCode, rationalProgram_continue, RationalProgram.step, ha, Bool.false_eq_true, ↓reduceIte, hp, List.getElem?_append, List.length_map, hlen, show 178 < 179 by omega, ↓reduceIte, List.getElem?_map, hlookup, Option.map_some, rationalInstruction_continue, rationalState_relocate, Nat.add_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointSecondCode_connect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:435
def powerEndpointCoreActiveFuel

[Exact active fuel of the fused core for a pair of scalar inputs.

Definition (Lean source)
leftArgs rightArgs :
List ℚ
powerEndpointCoreActiveFuel leftArgs rightArgs :
ℕ
powerScalarActiveFuel leftArgs + 1 + 41 + powerScalarActiveFuel rightArgs + 1 + 2
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointCoreActiveFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:447
theorem powerEndpointCore_before_halt

The fused core returns the left lower and right upper scalar endpoints. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
leftArgs rightArgs :
List ℚ
hs :
rationalStateAgreeBelow 40 s (RationalProgram.initial leftArgs)
h40 :
s.2.1 40 = rightArgs[0]?.getD 0
h41 :
s.2.1 41 = rightArgs[1]?.getD 0
h42 :
s.2.1 42 = rightArgs[2]?.getD 0
h46 :
s.2.1 46 = rightArgs[3]?.getD 0
hrzero :
∀ i
if
4 ≤ i
and
i < 40
then
rightArgs[i]?.getD 0 = 0
hb :
(⌊leftArgs[1]?.getD 0⌋ : ℤ).toNat ≠ 1
hrb :
(⌊rightArgs[1]?.getD 0⌋ : ℤ).toNat ≠ 1
ql :
(⌊leftArgs[0]?.getD 0⌋ : ℤ).toNat
bl :
(⌊leftArgs[1]?.getD 0⌋ : ℤ).toNat
qr :
(⌊rightArgs[0]?.getD 0⌋ : ℤ).toNat
br :
(⌊rightArgs[1]?.getD 0⌋ : ℤ).toNat
t :
powerEndpointCore.run (powerEndpointCoreActiveFuel leftArgs rightArgs) s
t.1 = 401
t.2.2 = false
rationalBox (t.2.1 0) (t.2.1 1)
= rationalBox (paperPowerScalar ql bl (leftArgs[2]?.getD 0)).lo (paperPowerScalar qr br (rightArgs[2]?.getD 0)).hi
Proof (Lean source)
lemma powerEndpointCore_before_halt (leftArgs rightArgs : List ℚ) (s : RationalState) (hs : rationalStateAgreeBelow 40 s (RationalProgram.initial leftArgs)) (h40 : s.2.1 40 = rightArgs[0]?.getD 0) (h41 : s.2.1 41 = rightArgs[1]?.getD 0) (h42 : s.2.1 42 = rightArgs[2]?.getD 0) (h46 : s.2.1 46 = rightArgs[3]?.getD 0) (hrzero : ∀ i, 4 ≤ i → i < 40 → rightArgs[i]?.getD 0 = 0) (hb : (⌊leftArgs[1]?.getD 0⌋ : ℤ).toNat ≠ 1) (hrb : (⌊rightArgs[1]?.getD 0⌋ : ℤ).toNat ≠ 1) : let ql := (⌊leftArgs[0]?.getD 0⌋ : ℤ).toNat let bl := (⌊leftArgs[1]?.getD 0⌋ : ℤ).toNat let qr := (⌊rightArgs[0]?.getD 0⌋ : ℤ).toNat let br := (⌊rightArgs[1]?.getD 0⌋ : ℤ).toNat let t := powerEndpointCore.run (powerEndpointCoreActiveFuel leftArgs rightArgs) s t.1 = 401 ∧ t.2.2 = false ∧ rationalBox (t.2.1 0) (t.2.1 1) = rationalBox (paperPowerScalar ql bl (leftArgs[2]?.getD 0)).lo (paperPowerScalar qr br (rightArgs[2]?.getD 0)).hi := by have hleft := powerScalarCode_before_halt_frame leftArgs s hs hb dsimp only [powerEndpointCoreActiveFuel] rw [show powerScalarActiveFuel leftArgs + 1 + 41 + powerScalarActiveFuel rightArgs + 1 + 2 = powerScalarActiveFuel leftArgs + (1 + 41 + powerScalarActiveFuel rightArgs + 1 + 2) by omega, rationalProgram_run_add] dsimp only at hleft have hrun := rationalProgram_continue_run powerScalarCode powerEndpointSecondTail (powerScalarActiveFuel leftArgs) s hleft.2.1 change powerEndpointCore.run _ s = _ at hrun rw [hrun] generalize he : powerScalarCode.run (powerScalarActiveFuel leftArgs) s = t at hleft ⊢ rcases hleft with ⟨htp, hta, hleftbox⟩ have hs40 := powerScalarCode_spare_register 40 (by omega) (powerScalarActiveFuel leftArgs) s have hs41 := powerScalarCode_spare_register 41 (by omega) (powerScalarActiveFuel leftArgs) s have hs42 := powerScalarCode_spare_register 42 (by omega) (powerScalarActiveFuel leftArgs) s have hs46 := powerScalarCode_spare_register 46 (by omega) (powerScalarActiveFuel leftArgs) s rw [he] at hs40 hs41 hs42 hs46 rw [show 1 + 41 + powerScalarActiveFuel rightArgs + 1 + 2 = 1 + (41 + powerScalarActiveFuel rightArgs + 1 + 2) by omega, rationalProgram_run_add] rw [show powerEndpointCore.run 1 t = powerEndpointCore.step t by rfl, powerEndpointCore_connect t htp hta] rw [show powerEndpointCore = rationalProgram_continue powerScalarCode powerEndpointSecondTail by rfl, rationalProgram_continue_tail] rw [show 41 + powerScalarActiveFuel rightArgs + 1 + 2 = 41 + (powerScalarActiveFuel rightArgs + 1 + 2) by omega, rationalProgram_run_add] have hprep := powerEndpointSecondPrelude_prepare (0,t.2.1,false) rfl rfl generalize hp : powerEndpointSecondTail.run 41 (0,t.2.1,false) = u at hprep ⊢ dsimp only at hprep obtain ⟨hupc, hua, hu43, hu0, hu1, hu2, hu3, huzero⟩ := hprep have huagree : rationalStateAgreeBelow 40 (0,u.2.1,false) (RationalProgram.initial rightArgs) := by refine ⟨rfl, rfl, ?_⟩ intro i hi interval_cases i <;> simp [RationalProgram.initial, hu0, hu1, hu2, hu3, hs40, hs41, hs42, hs46, h40, h41, h42, h46, hrzero, huzero] let v : RationalState := (0,u.2.1,false) have hu : u = rationalState_relocate powerEndpointSecondPrelude.length v := by apply Prod.ext · simpa [rationalState_relocate, powerEndpointSecondPrelude, v] using hupc · exact Prod.ext rfl hua rw [hu] rw [show powerEndpointSecondTail = powerEndpointSecondPrelude ++ powerEndpointSecondCode.map (rationalInstruction_relocate powerEndpointSecondPrelude.length) by rfl, rationalProgram_relocate_run] dsimp only [rationalState_relocate] have hright := powerScalarCode_before_halt_frame rightArgs v huagree hrb dsimp only at hright rw [show powerScalarActiveFuel rightArgs + 1 + 2 = powerScalarActiveFuel rightArgs + (1 + 2) by omega, rationalProgram_run_add] have hrun2 := rationalProgram_continue_run powerScalarCode powerEndpointRestoreTail (powerScalarActiveFuel rightArgs) v hright.2.1 change powerEndpointSecondCode.run _ v = _ at hrun2 rw [hrun2] generalize hr : powerScalarCode.run (powerScalarActiveFuel rightArgs) v = w at hright ⊢ rcases hright with ⟨hwpc, hwa, hrightbox⟩ have hw43 := powerScalarCode_spare_register 43 (by omega) (powerScalarActiveFuel rightArgs) v rw [hr] at hw43 rw [rationalProgram_run_add] rw [show powerEndpointSecondCode.run 1 w = powerEndpointSecondCode.step w by rfl, powerEndpointSecondCode_connect w hwpc hwa] rw [show powerEndpointSecondCode = rationalProgram_continue powerScalarCode powerEndpointRestoreTail by rfl, rationalProgram_continue_tail] have hrestore := powerEndpointRestore_before_halt (0,w.2.1,false) rfl rfl dsimp only at hrestore dsimp only [rationalState_relocate] rcases hrestore with ⟨hrpc, hra, hr0, hr1⟩ refine ⟨?_, hra, ?_⟩ · have hslen : powerScalarCode.length = 179 := by rfl have hplen : powerEndpointSecondPrelude.length = 41 := by rfl rw [hslen, hplen, hrpc] rw [hr0, hr1, hw43] have hv43 : v.2.1 43 = min (t.2.1 0) (t.2.1 1) := by simpa [v] using hu43 rw [hv43] have hleftlo := congrArg RatInterval.lo hleftbox have hrighthi := congrArg RatInterval.hi hrightbox simp only [rationalBox] at hleftlo hrighthi rw [hleftlo, hrighthi]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointCore_before_halt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:452
def powerEndpointLeftArgs

[Arguments for the left scalar endpoint.

Definition (Lean source)
xs :
List ℚ
powerEndpointLeftArgs xs :
List ℚ
[xs[0]?.getD 0, xs[1]?.getD 0, xs[2]?.getD 0, xs[3]?.getD 0]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointLeftArgs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:558
def powerEndpointRightArgs

Arguments for the right scalar endpoint.

Definition (Lean source)
xs :
List ℚ
powerEndpointRightArgs xs :
List ℚ
[xs[0]?.getD 0, xs[1]?.getD 0, xs[3]?.getD 0, xs[2]?.getD 0]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointRightArgs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:562
def powerEndpointExactFuel

Exact fuel through the final halt of the two-endpoint program.

Definition (Lean source)
xs :
List ℚ
powerEndpointExactFuel xs :
ℕ
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointExactFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:566
theorem powerEndpointCode_result

The exact fused run halts and returns the desired endpoint extension. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
t :
powerEndpointCode.run (powerEndpointExactFuel xs) (RationalProgram.initial xs)
t.2.2 = true
rationalBox (t.2.1 0) (t.2.1 1)
= rationalBox (paperPowerScalar q b (xs[2]?.getD 0)).lo (paperPowerScalar q b (xs[3]?.getD 0)).hi
Proof (Lean source)
lemma powerEndpointCode_result (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let t := powerEndpointCode.run (powerEndpointExactFuel xs) (RationalProgram.initial xs) t.2.2 = true ∧ rationalBox (t.2.1 0) (t.2.1 1) = rationalBox (paperPowerScalar q b (xs[2]?.getD 0)).lo (paperPowerScalar q b (xs[3]?.getD 0)).hi := by let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat by_cases hb : b = 1 · have hbcast : max (⌊xs[1]?.getD 0⌋ : ℤ) 0 = (1 : ℚ) := by rw [← show (b : ℚ) = 1 by exact_mod_cast hb] exact_mod_cast (show max (⌊xs[1]?.getD 0⌋ : ℤ) 0 = (b : ℤ) by dsimp [b]; omega) have hfloor : ((⌊xs[1]?.getD 0⌋ : ℤ) : ℚ) = 1 := by exact_mod_cast (show (⌊xs[1]?.getD 0⌋ : ℤ) = 1 by dsimp [b] at hb; omega) norm_num [powerEndpointExactFuel, powerEndpointCode, powerEndpointPrelude, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, b, hb, hbcast, hfloor, paperPowerScalar, RatInterval.point, rationalBox] · have hprep := powerEndpointPrelude_prepare xs hb have hframe := powerEndpointPrelude_frame xs hb dsimp only [powerEndpointExactFuel] rw [if_neg hb, show powerEndpointPreludeFuel xs + powerEndpointCoreActiveFuel (powerEndpointLeftArgs xs) (powerEndpointRightArgs xs) + 1 = powerEndpointPreludeFuel xs + (powerEndpointCoreActiveFuel (powerEndpointLeftArgs xs) (powerEndpointRightArgs xs) + 1) by omega, rationalProgram_run_add] generalize hp : powerEndpointCode.run (powerEndpointPreludeFuel xs) (RationalProgram.initial xs) = t at hprep hframe ⊢ dsimp only at hprep hframe rcases hprep with ⟨htp, hta, h40, h41, h42, h46⟩ rcases hframe with ⟨hagree, _, _, _, _⟩ let u : RationalState := (0,t.2.1,false) have ht : t = rationalState_relocate powerEndpointPrelude.length u := by apply Prod.ext · simpa [rationalState_relocate, powerEndpointPrelude, u] using htp · exact Prod.ext rfl hta rw [ht] rw [show powerEndpointCode = powerEndpointPrelude ++ powerEndpointCore.map (rationalInstruction_relocate powerEndpointPrelude.length) by rfl, rationalProgram_relocate_run] rw [show powerEndpointCoreActiveFuel (powerEndpointLeftArgs xs) (powerEndpointRightArgs xs) + 1 = powerEndpointCoreActiveFuel (powerEndpointLeftArgs xs) (powerEndpointRightArgs xs) + 1 by rfl, rationalProgram_run_add] have hcore := powerEndpointCore_before_halt (powerEndpointLeftArgs xs) (powerEndpointRightArgs xs) u hagree (by simpa [powerEndpointRightArgs] using h40) (by simpa [powerEndpointRightArgs] using h41) (by simpa [powerEndpointRightArgs] using h42) (by simpa [powerEndpointRightArgs] using h46) (by intro i hlo hi interval_cases i <;> simp [powerEndpointRightArgs]) (by simpa [powerEndpointLeftArgs] using hb) (by simpa [powerEndpointRightArgs] using hb) dsimp only at hcore generalize hc : powerEndpointCore.run (powerEndpointCoreActiveFuel (powerEndpointLeftArgs xs) (powerEndpointRightArgs xs)) u = v at hcore ⊢ rcases hcore with ⟨hvpc, hva, hvbox⟩ have hlookup : powerEndpointCore[401]? = some .halt := by rfl have hstep : powerEndpointCore.run 1 v = (401,v.2.1,true) := by rw [show powerEndpointCore.run 1 v = powerEndpointCore.step v by rfl] simp [RationalProgram.step, hvpc, hva, hlookup] rw [hstep] simpa [rationalState_relocate, powerEndpointLeftArgs, powerEndpointRightArgs] using hvbox
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:572
theorem powerScalarPublicFuelCode_before_halt

The scalar public-fuel program reaches its active final halt frame after 55 steps. the stated conclusion holds.

Formal statement
xs :
List ℚ
t :
powerScalarPublicFuelCode.run 55 (RationalProgram.initial xs)
t.1 = 55
t.2.2 = false
t.2.1 0 = (powerScalarPublicFuel xs : ℚ)
Proof (Lean source)
lemma powerScalarPublicFuelCode_before_halt (xs : List ℚ) : let t := powerScalarPublicFuelCode.run 55 (RationalProgram.initial xs) t.1 = 55 ∧ t.2.2 = false ∧ t.2.1 0 = (powerScalarPublicFuel xs : ℚ) := by have h := powerLogCode_initial xs have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] have hceil (x : ℚ) (hx : 0 ≤ x) : max (↑(⌈x⌉ : ℤ) : ℚ) 1 = (max 1 (⌈x⌉ : ℤ).toNat : ℕ) := by have hc : ((⌈x⌉ : ℤ).toNat : ℚ) = (⌈x⌉ : ℤ) := by exact_mod_cast Int.toNat_of_nonneg (Int.ceil_nonneg hx) simp only [Nat.cast_max, Nat.cast_one, hc, max_comm] rw [show 55 = 36+19 by rfl, rationalProgram_run_add, powerScalarPublicFuelCode_prefix xs 36 (by omega)] generalize he : powerLogCode.run 36 (RationalProgram.initial xs) = t at h ⊢ rcases h with ⟨hp, ha, hc, _, _, _, _, _, h1, h2, _, _, hq, hl, _, _⟩ norm_num [powerScalarPublicFuelCode, powerLogFuelCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, h1, h2, hq, hl, powerScalarPublicFuel, powerScalarSeriesBound, powerLogTermCount, Nat.cast_add, Nat.cast_mul, Nat.cast_max, Nat.cast_pow, habs] rw [show ∀ N : ℚ, N*2*|xs[2]?.getD 0| = 2*N*|xs[2]?.getD 0| by intro N; ring] rw [hceil _ (by positivity)] push_cast ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuelCode_before_halt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:644
theorem powerScalarPublicFuelCode_below

The scalar fuel code also depends only on registers below forty. the stated conclusion holds.

Formal statement
op :
shared
op ∈ powerScalarPublicFuelCode :
Proof (Lean source)
lemma powerScalarPublicFuelCode_below : ∀ op ∈ powerScalarPublicFuelCode, rationalInstructionBelow 40 op := by decide
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuelCode_below · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:672
theorem powerScalarPublicFuelCode_before_halt_frame

The active fuel certificate is stable under spare-register data. the stated conclusion holds. Under the stated assumptions.

Formal statement
xs :
List ℚ
hs :
rationalStateAgreeBelow 40 s (RationalProgram.initial xs)
t :
powerScalarPublicFuelCode.run 55 s
t.1 = 55
t.2.2 = false
t.2.1 0 = (powerScalarPublicFuel xs : ℚ)
Proof (Lean source)
lemma powerScalarPublicFuelCode_before_halt_frame (xs : List ℚ) (s : RationalState) (hs : rationalStateAgreeBelow 40 s (RationalProgram.initial xs)) : let t := powerScalarPublicFuelCode.run 55 s t.1 = 55 ∧ t.2.2 = false ∧ t.2.1 0 = (powerScalarPublicFuel xs : ℚ) := by have href := powerScalarPublicFuelCode_before_halt xs have hagree := rationalProgram_run_agree_below powerScalarPublicFuelCode 40 powerScalarPublicFuelCode_below 55 s (RationalProgram.initial xs) hs dsimp only at href ⊢ rcases hagree with ⟨hpc, hhalt, hreg⟩ exact ⟨hpc.trans href.1, hhalt.trans href.2.1, (hreg 0 (by omega)).trans href.2.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuelCode_before_halt_frame · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:676
def powerEndpointMagnitude

A common magnitude dominating both endpoint exponents.

Definition (Lean source)
xs :
List ℚ
powerEndpointMagnitude xs :
ℚ
max |xs[2]?.getD 0| |xs[3]?.getD 0|
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointMagnitude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:689
def powerEndpointFuelArgs

One scalar-fuel query at the common endpoint magnitude.

Definition (Lean source)
xs :
List ℚ
powerEndpointFuelArgs xs :
List ℚ
[xs[0]?.getD 0, xs[1]?.getD 0, powerEndpointMagnitude xs, 0]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelArgs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:693
def powerEndpointFuelFrameArgs

A forty-register initialization matching the transformed frame, including irrelevant registers inherited from an arbitrary input list.

Definition (Lean source)
xs :
List ℚ
powerEndpointFuelFrameArgs xs :
List ℚ
List.ofFn (fun i : Fin 40 => if i = 2 then powerEndpointMagnitude xs else if i = 3 then 0 else xs[i]?.getD 0)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelFrameArgs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:697
theorem powerEndpointFuelFrameArgs_fuel

The power Endpoint Fuel Frame Args fuel result states the corresponding mathematical identity, bound, or structural property.

Formal statement
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelFrameArgs_fuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:702
def powerEndpointPublicFuel

Conservative public fuel for both scalar calls and their bridges.

Definition (Lean source)
xs :
List ℚ
powerEndpointPublicFuel xs :
ℕ
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointPublicFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:709
theorem powerScalarSeriesBound_mono_abs

The power Scalar Series Bound mono abs result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions.

Formal statement
q b :
ℕ
v w :
ℚ
h :
|v| ≤ |w|
Proof (Lean source)
lemma powerScalarSeriesBound_mono_abs (q b : ℕ) (v w : ℚ) (h : |v| ≤ |w|) : powerScalarSeriesBound q b v ≤ powerScalarSeriesBound q b w := by unfold powerScalarSeriesBound apply max_le_max_left apply Int.toNat_le_toNat apply Int.ceil_mono gcongr
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarSeriesBound_mono_abs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:712
theorem powerScalarPublicFuel_mono_abs_raw

The power Scalar Public Fuel mono abs raw result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions.

Formal statement
q b v w :
ℚ
h :
|v| ≤ |w|
Proof (Lean source)
lemma powerScalarPublicFuel_mono_abs_raw (q b v w : ℚ) (h : |v| ≤ |w|) : powerScalarPublicFuel [q,b,v,0] ≤ powerScalarPublicFuel [q,b,w,0] := by simp only [powerScalarPublicFuel, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some] have hB := powerScalarSeriesBound_mono_abs (⌊q⌋ : ℤ).toNat (⌊b⌋ : ℤ).toNat v w h gcongr
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuel_mono_abs_raw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:721
theorem powerScalarPublicFuel_endpoint_le

[Each endpoint's published scalar fuel is covered by the common-magnitude fuel. the stated conclusion holds.

Formal statement
xs :
List ℚ
i :
Fin 2
Proof (Lean source)
lemma powerScalarPublicFuel_endpoint_le (xs : List ℚ) (i : Fin 2) : powerScalarPublicFuel (if i = 0 then powerEndpointLeftArgs xs else powerEndpointRightArgs xs) ≤ powerScalarPublicFuel (powerEndpointFuelArgs xs) := by have hm0 : |xs[2]?.getD 0| ≤ |powerEndpointMagnitude xs| := by have hmnonneg : 0 ≤ powerEndpointMagnitude xs := (abs_nonneg _).trans (le_max_left _ _) rw [abs_of_nonneg hmnonneg] exact le_max_left _ _ have hm1 : |xs[3]?.getD 0| ≤ |powerEndpointMagnitude xs| := by have hmnonneg : 0 ≤ powerEndpointMagnitude xs := (abs_nonneg _).trans (le_max_left _ _) rw [abs_of_nonneg hmnonneg] exact le_max_right _ _ fin_cases i · change powerScalarPublicFuel [xs[0]?.getD 0, xs[1]?.getD 0, xs[2]?.getD 0, 0] ≤ powerScalarPublicFuel [xs[0]?.getD 0, xs[1]?.getD 0, powerEndpointMagnitude xs, 0] exact powerScalarPublicFuel_mono_abs_raw (xs[0]?.getD 0) (xs[1]?.getD 0) (xs[2]?.getD 0) (powerEndpointMagnitude xs) hm0 · change powerScalarPublicFuel [xs[0]?.getD 0, xs[1]?.getD 0, xs[3]?.getD 0, 0] ≤ powerScalarPublicFuel [xs[0]?.getD 0, xs[1]?.getD 0, powerEndpointMagnitude xs, 0] exact powerScalarPublicFuel_mono_abs_raw (xs[0]?.getD 0) (xs[1]?.getD 0) (xs[3]?.getD 0) (powerEndpointMagnitude xs) hm1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuel_endpoint_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:731
def powerEndpointFuelPrelude

Compute the common magnitude in register two without disturbing low inputs.

Definition (Lean source)
powerEndpointFuelPrelude :
[.constant 40 (-1), .mul 41 2 40, .max 2 2 41, .mul 41 3 40, .max 3 3 41, .max 2 2 3, .constant 3 0]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelPrelude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:759
def powerEndpointFuelTail

Double the common scalar fuel and add all fixed bridge steps.

Definition (Lean source)
powerEndpointFuelTail :
[.constant 1 2, .mul 0 0 1, .constant 1 90, .add 0 0 1, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelTail · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:764
def powerEndpointFuelCore

Continue the scalar fuel computation into the fixed arithmetic tail.

Definition (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelCore · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:768
def powerEndpointFuelCode

A finite rational program computing the public two-endpoint fuel.

Definition (Lean source)
powerEndpointFuelCode :
powerEndpointFuelPrelude ++ powerEndpointFuelCore.map (rationalInstruction_relocate powerEndpointFuelPrelude.length)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:772
theorem powerEndpointFuelPrelude_prepare

The power Endpoint Fuel Prelude prepare result states the corresponding mathematical identity, bound, or structural property.

Formal statement
xs :
List ℚ
t :
powerEndpointFuelCode.run 7 (RationalProgram.initial xs)
t.1 = 7
t.2.2 = false
rationalStateAgreeBelow 40 (0,t.2.1,false) (RationalProgram.initial (powerEndpointFuelFrameArgs xs))
Proof (Lean source)
lemma powerEndpointFuelPrelude_prepare (xs : List ℚ) : let t := powerEndpointFuelCode.run 7 (RationalProgram.initial xs) t.1 = 7 ∧ t.2.2 = false ∧ rationalStateAgreeBelow 40 (0,t.2.1,false) (RationalProgram.initial (powerEndpointFuelFrameArgs xs)) := by have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] norm_num [powerEndpointFuelCode, powerEndpointFuelPrelude, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, rationalStateAgreeBelow, powerEndpointFuelFrameArgs, powerEndpointMagnitude, habs] intro i hi interval_cases i <;> simp [RationalProgram.initial, powerEndpointFuelFrameArgs, Function.update_apply, habs]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelPrelude_prepare · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:776
theorem powerEndpointFuelCore_connect

The power Endpoint Fuel Core connect result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 55
ha :
s.2.2 = false
powerEndpointFuelCore.step s
= rationalState_relocate powerScalarPublicFuelCode.length (0,s.2.1,false)
Proof (Lean source)
lemma powerEndpointFuelCore_connect (s : RationalState) (hp : s.1 = 55) (ha : s.2.2 = false) : powerEndpointFuelCore.step s = rationalState_relocate powerScalarPublicFuelCode.length (0,s.2.1,false) := by have hlen : powerScalarPublicFuelCode.length = 56 := by rfl have hlookup : powerScalarPublicFuelCode[55]? = some .halt := by rfl simp only [powerEndpointFuelCore, rationalProgram_continue, RationalProgram.step, ha, Bool.false_eq_true, ↓reduceIte, hp, List.getElem?_append, List.length_map, hlen, show 55 < 56 by omega, ↓reduceIte, List.getElem?_map, hlookup, Option.map_some, rationalInstruction_continue, rationalState_relocate, Nat.add_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelCore_connect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:793
theorem powerEndpointFuelCore_before_halt_frame

[The power Endpoint Fuel Core before halt frame result states the corresponding mathematical identity, bound, or structural property. Under the stated assumptions.

Formal statement
xs :
List ℚ
hs :
rationalStateAgreeBelow 40 s (RationalProgram.initial (powerEndpointFuelFrameArgs xs))
t :
powerEndpointFuelCore.run 55 s
t.1 = 55
t.2.2 = false
Proof (Lean source)
lemma powerEndpointFuelCore_before_halt_frame (xs : List ℚ) (s : RationalState) (hs : rationalStateAgreeBelow 40 s (RationalProgram.initial (powerEndpointFuelFrameArgs xs))) : let t := powerEndpointFuelCore.run 55 s t.1 = 55 ∧ t.2.2 = false ∧ t.2.1 0 = (powerScalarPublicFuel (powerEndpointFuelArgs xs) : ℚ) := by have h := powerScalarPublicFuelCode_before_halt_frame (powerEndpointFuelFrameArgs xs) s hs dsimp only at h ⊢ have hrun := rationalProgram_continue_run powerScalarPublicFuelCode powerEndpointFuelTail 55 s h.2.1 change powerEndpointFuelCore.run 55 s = powerScalarPublicFuelCode.run 55 s at hrun rw [hrun] simpa only [powerEndpointFuelFrameArgs_fuel] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelCore_before_halt_frame · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:805
theorem powerEndpointFuelCore_result

The power Endpoint Fuel Core result result states the corresponding mathematical identity, bound, or structural property. Under the stated assumptions.

Formal statement
xs :
List ℚ
hs :
rationalStateAgreeBelow 40 s (RationalProgram.initial (powerEndpointFuelFrameArgs xs))
t :
powerEndpointFuelCore.run 61 s
t.2.2 = true
t.2.1 0 = (powerEndpointPublicFuel xs : ℚ)
Proof (Lean source)
lemma powerEndpointFuelCore_result (xs : List ℚ) (s : RationalState) (hs : rationalStateAgreeBelow 40 s (RationalProgram.initial (powerEndpointFuelFrameArgs xs))) : let t := powerEndpointFuelCore.run 61 s t.2.2 = true ∧ t.2.1 0 = (powerEndpointPublicFuel xs : ℚ) := by rw [show 61 = 55 + 1 + 5 by rfl, rationalProgram_run_add, rationalProgram_run_add] have h := powerEndpointFuelCore_before_halt_frame xs s hs generalize he : powerEndpointFuelCore.run 55 s = t at h ⊢ dsimp only at h rcases h with ⟨htp, hta, ht0⟩ rw [show powerEndpointFuelCore.run 1 t = powerEndpointFuelCore.step t by rfl, powerEndpointFuelCore_connect t htp hta] rw [show powerEndpointFuelCore = rationalProgram_continue powerScalarPublicFuelCode powerEndpointFuelTail by rfl, rationalProgram_continue_tail] norm_num [powerEndpointFuelTail, RationalProgram.run, RationalProgram.step, Function.update_apply, ht0, powerEndpointPublicFuel] simp [rationalState_relocate, Function.update_apply] push_cast ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelCore_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:822
theorem powerEndpointFuelCode_result

The power Endpoint Fuel Code result result states the corresponding mathematical identity, bound, or structural property.

Formal statement
xs :
List ℚ
t :
powerEndpointFuelCode.run 68 (RationalProgram.initial xs)
t.2.2 = true
t.2.1 0 = (powerEndpointPublicFuel xs : ℚ)
Proof (Lean source)
lemma powerEndpointFuelCode_result (xs : List ℚ) : let t := powerEndpointFuelCode.run 68 (RationalProgram.initial xs) t.2.2 = true ∧ t.2.1 0 = (powerEndpointPublicFuel xs : ℚ) := by rw [show 68 = 7 + 61 by rfl, rationalProgram_run_add] have hprep := powerEndpointFuelPrelude_prepare xs generalize hp : powerEndpointFuelCode.run 7 (RationalProgram.initial xs) = t at hprep ⊢ dsimp only at hprep rcases hprep with ⟨htp, hta, hagree⟩ let u : RationalState := (0,t.2.1,false) have ht : t = rationalState_relocate powerEndpointFuelPrelude.length u := by apply Prod.ext · simpa [rationalState_relocate, powerEndpointFuelPrelude, u] using htp · exact Prod.ext rfl hta rw [ht] rw [show powerEndpointFuelCode = powerEndpointFuelPrelude ++ powerEndpointFuelCore.map (rationalInstruction_relocate powerEndpointFuelPrelude.length) by rfl, rationalProgram_relocate_run] dsimp only [rationalState_relocate] exact powerEndpointFuelCore_result xs u hagree
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointFuelCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:847
theorem powerEndpointPublicFuel_public

The combined fuel is itself a public rational iteration bound. the stated conclusion holds.

Formal statement
Proof (Lean source)
lemma powerEndpointPublicFuel_public : PublicIterationBound powerEndpointPublicFuel := by refine ⟨powerEndpointFuelCode, fun xs => ⟨68, ?_, ?_⟩⟩ · exact (powerEndpointFuelCode_result xs).1 · exact (powerEndpointFuelCode_result xs).2
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointPublicFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:868
theorem powerEndpointExactFuel_le_public

The conservative public fuel covers the exact fused run. the stated conclusion holds.

Formal statement
xs :
List ℚ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointExactFuel_le_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:874
theorem powerEndpointCode_public_result

Sufficient public fuel leaves the already halted endpoint output unchanged. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
t :
powerEndpointCode.run (powerEndpointPublicFuel xs) (RationalProgram.initial xs)
t.2.2 = true
rationalBox (t.2.1 0) (t.2.1 1)
= rationalBox (paperPowerScalar q b (xs[2]?.getD 0)).lo (paperPowerScalar q b (xs[3]?.getD 0)).hi
Proof (Lean source)
lemma powerEndpointCode_public_result (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let t := powerEndpointCode.run (powerEndpointPublicFuel xs) (RationalProgram.initial xs) t.2.2 = true ∧ rationalBox (t.2.1 0) (t.2.1 1) = rationalBox (paperPowerScalar q b (xs[2]?.getD 0)).lo (paperPowerScalar q b (xs[3]?.getD 0)).hi := by have h := powerEndpointCode_result xs dsimp only at h have hf := powerEndpointExactFuel_le_public xs rw [show powerEndpointPublicFuel xs = powerEndpointExactFuel xs + (powerEndpointPublicFuel xs-powerEndpointExactFuel xs) by omega, rationalProgram_run_add, rationalProgram_run_halted _ _ _ h.1] exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointCode_public_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:890
def powerEndpointProgram

Certified bounded program for both power endpoints.

Definition (Lean source)
powerEndpointProgram :
clause 1
clause 2
iterationBound := powerEndpointPublicFuel
clause 3
clause 4
halts := fun xs => (powerEndpointCode_public_result xs).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:907
theorem powerEndpointProgram_eval

The endpoint program returns the left lower and right upper scalar endpoints. Under the stated assumptions. The stated conclusion follows.

Formal statement
q b :
ℕ
lo hi :
ℚ
endpoints :
powerEndpointProgram.eval [q,b,lo,hi]
rationalBox endpoints.1 endpoints.2
Proof (Lean source)
lemma powerEndpointProgram_eval (q b : ℕ) (lo hi : ℚ) : let endpoints := powerEndpointProgram.eval [q,b,lo,hi] rationalBox endpoints.1 endpoints.2 = rationalBox (paperPowerScalar q b lo).lo (paperPowerScalar q b hi).hi := by have h := powerEndpointCode_public_result [(q : ℚ),b,lo,hi] simpa only [BoundedRationalProgram.eval, powerEndpointProgram, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] using h.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerEndpointProgram_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:914
theorem concreteEngine_power_register_certificate

The fused endpoint program implements the concrete power engine. the stated conclusion holds.

Formal statement
q b :
ℕ
concreteEngine.powBox q b I
= let endpoints := powerEndpointProgram.eval [q,b,I.lo,I.hi] rationalBox endpoints.1 endpoints.2
Proof (Lean source)
lemma concreteEngine_power_register_certificate (q b : ℕ) (I : RatInterval) : concreteEngine.powBox q b I = let endpoints := powerEndpointProgram.eval [q,b,I.lo,I.hi] rationalBox endpoints.1 endpoints.2 := by rw [powerEndpointProgram_eval] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_power_register_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerEndpointProgram.lean:924
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerExpFrames 21 declarations The existing exponential recurrence can start with arbitrary spare registers.

Exponential register calls on active power frames

The existing exponential recurrence can start with arbitrary spare registers. Its exact output certificate and untouched-register law allow the power computation to retain its precision, base, and second exponent across an exponential call.

theorem expRegisterCode_start_frame

Initialization of the exponential loop from an arbitrary active frame. Under the stated assumptions.

Formal statement
hp₀ :
s.1 = 0
ha₀ :
s.2.2 = false
ExpRegisterInvariant false (⌊s.2.1 0⌋ : ℤ).toNat 0 (2*seriesCount (⌊s.2.1 0⌋ : ℤ).toNat (s.2.1 1)) (s.2.1 1) (s.2.1 0) 0 (s.2.1 2) (expRegisterCode.run 23 (s))
Proof (Lean source)
-- @node: expRegisterCode_start_frame lemma expRegisterCode_start_frame (s : RationalState) (hp₀ : s.1 = 0) (ha₀ : s.2.2 = false) : ExpRegisterInvariant false (⌊s.2.1 0⌋ : ℤ).toNat 0 (2*seriesCount (⌊s.2.1 0⌋ : ℤ).toNat (s.2.1 1)) (s.2.1 1) (s.2.1 0) 0 (s.2.1 2) (expRegisterCode.run 23 (s)) := by rw [show 23 = 3+20 by rfl, rationalProgram_run_add] have hp : (expRegisterCode.run 3 (s)).1 = 3 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp₀, ha₀] have ha : (expRegisterCode.run 3 (s)).2.2 = false := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp₀, ha₀] have h := expRegisterCode_initial false _ hp ha convert h using 1 <;> norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp₀, ha₀, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_start_frame · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:16
theorem expRegisterCode_result_frame

Both endpoint loops are certified without zeroing the spare registers. Under the stated assumptions.

Formal statement
s₀ :
hp₀ :
s₀.1 = 0
ha₀ :
s₀.2.2 = false
q :
(⌊s₀.2.1 0⌋ : ℤ).toNat
lo :
(paperExpScalar q (s₀.2.1 1)).lo
hi :
(paperExpScalar q (s₀.2.1 2)).hi
t :
expRegisterCode.run (expRegisterFuel [s₀.2.1 0,s₀.2.1 1,s₀.2.1 2]) (s₀)
t.2.2 = true
t.2.1 0 = lo
t.2.1 1 = hi
Proof (Lean source)
-- @node: expRegisterCode_result_frame lemma expRegisterCode_result_frame (s₀ : RationalState) (hp₀ : s₀.1 = 0) (ha₀ : s₀.2.2 = false) : let q := (⌊s₀.2.1 0⌋ : ℤ).toNat let lo := (paperExpScalar q (s₀.2.1 1)).lo let hi := (paperExpScalar q (s₀.2.1 2)).hi let t := expRegisterCode.run (expRegisterFuel [s₀.2.1 0,s₀.2.1 1,s₀.2.1 2]) (s₀) t.2.2 = true ∧ t.2.1 0 = lo ∧ t.2.1 1 = hi := by let q := (⌊s₀.2.1 0⌋ : ℤ).toNat let z := s₀.2.1 1 let w := s₀.2.1 2 let N := 2*seriesCount q z let M := 2*seriesCount q w have h := expRegisterCode_loop false q 0 N z _ 0 w _ (expRegisterCode_start_frame s₀ hp₀ ha₀) simp only [expRegisterFuel, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some] have hf : 78+7*(N+M) = 23+(7*N+15)+(3+20)+(7*M+15)+2 := by omega rw [hf, rationalProgram_run_add _ (23+(7*N+15)+(3+20)+(7*M+15)) 2, rationalProgram_run_add _ (23+(7*N+15)+(3+20)) (7*M+15), rationalProgram_run_add _ (23+(7*N+15)) (3+20), rationalProgram_run_add _ 23 (7*N+15)] generalize hs : expRegisterCode.run (7*N+15) (expRegisterCode.run 23 (s₀)) = s at h ⊢ simp only [Bool.false_eq_true, ↓reduceIte, zero_add] at h rcases h with ⟨hp, ha, hlo, hhi, hq, hl, hw⟩ have hp' : (expRegisterCode.run 3 s).1 = 47 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have ha' : (expRegisterCode.run 3 s).2.2 = false := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have hinit := expRegisterCode_initial true (expRegisterCode.run 3 s) hp' ha' have h0 : (expRegisterCode.run 3 s).2.1 0 = s₀.2.1 0 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq] have h1 : (expRegisterCode.run 3 s).2.1 1 = w := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hw] have h18 : (expRegisterCode.run 3 s).2.1 18 = (paperExpScalar q z).lo := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hlo, paperExpScalar, rationalBox, expPolynomial, N] simp only [h0, h1] at hinit have hright := expRegisterCode_loop true q 0 M w _ _ _ _ hinit rw [rationalProgram_run_add _ 3 20] generalize ht : expRegisterCode.run (7*M+15) (expRegisterCode.run 20 (expRegisterCode.run 3 s)) = t at hright ⊢ simp only [↓reduceIte, zero_add] at hright rcases hright with ⟨htp, hta, _, hthi, _, htl, _⟩ rw [h18] at htl norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hthi, htl, paperExpScalar, rationalBox, expPolynomial, M, q, z, w]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_result_frame · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:35

[The destination register of a writing instruction, if any.

Definition (Lean source)
rationalInstruction_destination :
clause 1
| .constant d _ | .copy d _ | .add d _ _ | .sub d _ _ | .mul d _ _
clause 2
| .div d _ _ | .min d _ _ | .max d _ _ | .floor d _ | .ceil d _
clause 3
| .factorial d _ | .integerSqrt d _ | .clogTwo d _ | .natPow d _ _ => some d
clause 4
| .branchLe _ _ _ _ | .jump _ | .halt => none
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalInstruction_destination · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:88
theorem rationalProgram_step_preserves

A register not written by the code survives one step, including halting. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
i :
ℕ
h :
∀ op ∈ code, rationalInstruction_destination op ≠ some i
(code.step s).2.1 i = s.2.1 i
Proof (Lean source)
-- @node: rationalProgram_step_preserves lemma rationalProgram_step_preserves (code : RationalProgram) (i : ℕ) (h : ∀ op ∈ code, rationalInstruction_destination op ≠ some i) (s : RationalState) : (code.step s).2.1 i = s.2.1 i := by unfold RationalProgram.step split · rfl · cases he : code[s.1]? with | none => simp [he] | some op => have hm : op ∈ code := List.mem_of_getElem? he have hn := h op hm cases op <;> simp_all [rationalInstruction_destination, Function.update_apply] <;> aesop
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_step_preserves · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:96
theorem rationalProgram_run_preserves

An untouched register survives any finite recurrence. Under the stated assumptions.

Formal statement
i :
ℕ
h :
∀ op ∈ code, rationalInstruction_destination op ≠ some i
fuel :
ℕ
(code.run fuel s).2.1 i = s.2.1 i
Proof (Lean source)
-- @node: rationalProgram_run_preserves lemma rationalProgram_run_preserves (code : RationalProgram) (i : ℕ) (h : ∀ op ∈ code, rationalInstruction_destination op ≠ some i) (fuel : ℕ) (s : RationalState) : (code.run fuel s).2.1 i = s.2.1 i := by induction fuel generalizing s with | zero => rfl | succ n ih => rw [RationalProgram.run, ih, rationalProgram_step_preserves code i h s]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_run_preserves · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:111
theorem expRegisterCode_spare_register Lemma expRegisterCode_spare_register in the paper ↗

The exponential routine never writes registers at or above twenty-one. Under the stated assumptions.

Formal statement
i :
ℕ
hi :
21 ≤ i
fuel :
ℕ
(expRegisterCode.run fuel s).2.1 i = s.2.1 i
Proof (Lean source)
-- @node: expRegisterCode_spare_register lemma expRegisterCode_spare_register (i : ℕ) (hi : 21 ≤ i) (fuel : ℕ) (s : RationalState) : (expRegisterCode.run fuel s).2.1 i = s.2.1 i := by apply rationalProgram_run_preserves intro op hop simp only [expRegisterCode, List.mem_cons, List.not_mem_nil, or_false] at hop rcases hop with h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h | h all_goals subst op <;> simp [rationalInstruction_destination] <;> omega
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_spare_register · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:121

[Relocate only control-flow targets; arithmetic registers retain their meaning.

Definition (Lean source)
offset :
ℕ
rationalInstruction_relocate offset :
clause 1
| .branchLe a b yes no => .branchLe a b (offset+yes) (offset+no)
clause 2
| .jump target => .jump (offset+target)
clause 3
| op => op
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalInstruction_relocate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:131

Shift a frame into a code block appended after a fixed prelude.

Definition (Lean source)
offset :
ℕ
rationalState_relocate offset s :
(offset+s.1,s.2.1,s.2.2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalState_relocate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:138
theorem rationalProgram_relocate_lookup

Instruction lookup in a relocated appended block agrees with the original code. the stated conclusion holds.

Formal statement
prelude code :
pc :
ℕ
(prelude ++ code.map (rationalInstruction_relocate prelude.length))[prelude.length+pc]?
= (code[pc]?).map (rationalInstruction_relocate prelude.length)
Proof (Lean source)
-- @node: rationalProgram_relocate_lookup lemma rationalProgram_relocate_lookup (prelude code : RationalProgram) (pc : ℕ) : (prelude ++ code.map (rationalInstruction_relocate prelude.length))[prelude.length+pc]? = (code[pc]?).map (rationalInstruction_relocate prelude.length) := by simp [List.getElem?_append, List.getElem?_map]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_relocate_lookup · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:143
theorem rationalProgram_relocate_step

Relocation preserves one step for every frame, including arbitrary branches and halt. the stated conclusion holds.

Formal statement
prelude code :
(prelude ++ code.map (rationalInstruction_relocate prelude.length)).step (rationalState_relocate prelude.length s)
= rationalState_relocate prelude.length (code.step s)
Proof (Lean source)
-- @node: rationalProgram_relocate_step lemma rationalProgram_relocate_step (prelude code : RationalProgram) (s : RationalState) : (prelude ++ code.map (rationalInstruction_relocate prelude.length)).step (rationalState_relocate prelude.length s) = rationalState_relocate prelude.length (code.step s) := by by_cases ha : s.2.2 = true · simp [RationalProgram.step, rationalState_relocate, ha] · simp only [RationalProgram.step, rationalState_relocate, ha, ↓reduceIte] rw [rationalProgram_relocate_lookup] cases he : code[s.1]? with | none => simp [he, rationalState_relocate] | some op => cases op <;> simp [he, rationalInstruction_relocate, rationalState_relocate, Nat.add_assoc] <;> split <;> rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_relocate_step · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:150
theorem rationalProgram_relocate_run

Every finite run of an appended relocated block is the relocated original run. the stated conclusion holds.

Formal statement
prelude code :
fuel :
ℕ
(prelude ++ code.map (rationalInstruction_relocate prelude.length)).run fuel (rationalState_relocate prelude.length s)
= rationalState_relocate prelude.length (code.run fuel s)
Proof (Lean source)
-- @node: rationalProgram_relocate_run lemma rationalProgram_relocate_run (prelude code : RationalProgram) (fuel : ℕ) (s : RationalState) : (prelude ++ code.map (rationalInstruction_relocate prelude.length)).run fuel (rationalState_relocate prelude.length s) = rationalState_relocate prelude.length (code.run fuel s) := by induction fuel generalizing s with | zero => rfl | succ n ih => rw [RationalProgram.run, rationalProgram_relocate_step, ih, RationalProgram.run]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_relocate_run · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:166

Save the power frame, then prepare a point-input exponential call for the left exponent.

Definition (Lean source)
powerExpPrelude :
[.copy 24 0, .copy 25 2, .copy 26 4, .copy 27 1, .mul 1 3 1, .copy 2 1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpPrelude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:178

The continuation is one literal code list with every exponential branch relocated.

Definition (Lean source)
powerExpCode :
powerExpPrelude ++ expRegisterCode.map (rationalInstruction_relocate powerExpPrelude.length)

Its exact finite instruction count includes preparation and both scalar loops.

Definition (Lean source)
powerExpFrameFuel s :
ℕ
6 + expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpFrameFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:188

The preparation block preserves all data needed for the later clipping and right call. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
t :
powerExpCode.run 6 s
t.1 = 6
t.2.2 = false
t.2.1 0 = s.2.1 0
t.2.1 1 = s.2.1 3*s.2.1 1
t.2.1 2 = s.2.1 3*s.2.1 1
t.2.1 24 = s.2.1 0
t.2.1 25 = s.2.1 2
t.2.1 26 = s.2.1 4
t.2.1 27 = s.2.1 1
Proof (Lean source)
-- @node: powerExpCode_prepare lemma powerExpCode_prepare (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let t := powerExpCode.run 6 s t.1 = 6 ∧ t.2.2 = false ∧ t.2.1 0 = s.2.1 0 ∧ t.2.1 1 = s.2.1 3*s.2.1 1 ∧ t.2.1 2 = s.2.1 3*s.2.1 1 ∧ t.2.1 24 = s.2.1 0 ∧ t.2.1 25 = s.2.1 2 ∧ t.2.1 26 = s.2.1 4 ∧ t.2.1 27 = s.2.1 1 := by generalize he : powerExpCode.run 6 s = t norm_num [powerExpCode, powerExpPrelude, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha] at he subst t norm_num [Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpCode_prepare · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:194
theorem powerExpCode_result

[The relocated exponential computation certifies the left power argument while retaining the internal precision, base, right exponent, and logarithm midpoint. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
p :
(⌊s.2.1 0⌋ : ℤ).toNat
J :
paperExpScalar p (s.2.1 3*s.2.1 1)
t :
powerExpCode.run (powerExpFrameFuel s) s
t.2.2 = true
t.2.1 0 = J.lo
t.2.1 1 = J.hi
t.2.1 24 = s.2.1 0
t.2.1 25 = s.2.1 2
t.2.1 26 = s.2.1 4
t.2.1 27 = s.2.1 1
Proof (Lean source)
-- @node: powerExpCode_result lemma powerExpCode_result (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let p := (⌊s.2.1 0⌋ : ℤ).toNat let J := paperExpScalar p (s.2.1 3*s.2.1 1) let t := powerExpCode.run (powerExpFrameFuel s) s t.2.2 = true ∧ t.2.1 0 = J.lo ∧ t.2.1 1 = J.hi ∧ t.2.1 24 = s.2.1 0 ∧ t.2.1 25 = s.2.1 2 ∧ t.2.1 26 = s.2.1 4 ∧ t.2.1 27 = s.2.1 1 := by have hprep := powerExpCode_prepare s hp ha dsimp only [powerExpFrameFuel] rw [rationalProgram_run_add] generalize he : powerExpCode.run 6 s = t at hprep ⊢ dsimp only at hprep obtain ⟨htp, hta, h0, h1, h2, h24, h25, h26, h27⟩ := hprep let u : RationalState := (0,t.2.1,false) have ht : t = rationalState_relocate powerExpPrelude.length u := by apply Prod.ext · simpa [rationalState_relocate, powerExpPrelude, u] using htp · apply Prod.ext · rfl · exact hta have hout := expRegisterCode_result_frame u rfl rfl have hs24 := expRegisterCode_spare_register 24 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]) u have hs25 := expRegisterCode_spare_register 25 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]) u have hs26 := expRegisterCode_spare_register 26 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]) u have hs27 := expRegisterCode_spare_register 27 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]) u dsimp only [u] at hout hs24 hs25 hs26 hs27 simp only [h0,h1,h2] at hout have hrun := rationalProgram_relocate_run powerExpPrelude expRegisterCode (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]) u change powerExpCode.run _ (rationalState_relocate powerExpPrelude.length u) = _ at hrun rw [← ht] at hrun rw [hrun] dsimp only [rationalState_relocate] dsimp only [u] exact ⟨hout.1,hout.2.1,hout.2.2,hs24.trans h24,hs25.trans h25, hs26.trans h26,hs27.trans h27⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:210

[A straight-line recurrence computes the continuation's exact step bound.

Definition (Lean source)
powerExpFuelCode :
[.mul 1 3 1, .copy 2 1] ++ [.copy 20 2] ++ [.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1] ++ [.copy 21 2, .copy 1 20] ++ [.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1] ++ [.add 2 2 21, .constant 13 7, .mul 0 2 13, .constant 13 84, .add 0 0 13, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:255
theorem powerExpFrameFuel_public

The continuation fuel is a total public rational computation on its input frame. the stated conclusion holds.

Formal statement
PublicIterationBound (fun xs => powerExpFrameFuel (RationalProgram.initial xs))
Proof (Lean source)
-- @node: powerExpFrameFuel_public lemma powerExpFrameFuel_public : PublicIterationBound (fun xs => powerExpFrameFuel (RationalProgram.initial xs)) := by refine ⟨powerExpFuelCode, ?_⟩ intro xs have hq : max (↑(⌊xs[0]?.getD 0⌋ : ℤ) : ℚ) 0 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊xs[0]?.getD 0⌋ : ℤ) 0 = (((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℕ) : ℤ) by omega) have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] have hB (z : ℚ) : max (↑(⌈|z|⌉ : ℤ) : ℚ) 1 = (seriesBound z : ℚ) := by have hn := Int.ceil_nonneg (abs_nonneg z) have hc : ((⌈|z|⌉ : ℤ).toNat : ℚ) = (⌈|z|⌉ : ℤ) := by exact_mod_cast Int.toNat_of_nonneg hn simp only [seriesBound, Nat.cast_max, Nat.cast_one, hc] exact max_comm _ _ refine ⟨51, ?_, ?_⟩ · norm_num [powerExpFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply] · norm_num [powerExpFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, powerExpFrameFuel, expRegisterFuel, seriesCount, Nat.cast_add, Nat.cast_mul, Nat.cast_max, Nat.cast_pow, hq, habs, hB] simp only [← abs_mul, hB] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpFrameFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:276

The exponential continuation is a certified bounded program on every input list.

Definition (Lean source)
powerExpProgram :
clause 1
code := powerExpCode
clause 2
iterationBound := fun xs => powerExpFrameFuel (RationalProgram.initial xs)
clause 3
public_bound := powerExpFrameFuel_public
clause 4
halts := fun xs => (powerExpCode_result (RationalProgram.initial xs) rfl rfl).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:305

The bounded continuation returns the exact point exponential bracket. Under the stated assumptions. The stated conclusion follows.

Formal statement
p b :
ℕ
mid lo hi :
ℚ
powerExpProgram.eval [p,mid,b,lo,hi]
= ((paperExpScalar p (lo*mid)).lo,(paperExpScalar p (lo*mid)).hi)
Proof (Lean source)
-- @node: powerExpProgram_eval lemma powerExpProgram_eval (p b : ℕ) (mid lo hi : ℚ) : powerExpProgram.eval [p,mid,b,lo,hi] = ((paperExpScalar p (lo*mid)).lo,(paperExpScalar p (lo*mid)).hi) := by have h := powerExpCode_result (RationalProgram.initial [(p : ℚ),mid,b,lo,hi]) rfl rfl simp only [RationalProgram.initial, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] at h dsimp only [BoundedRationalProgram.eval, powerExpProgram, RationalProgram.initial] rw [h.2.1,h.2.2.1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpProgram_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:313
theorem powerScalarContinuation_certificate Lemma powerScalarContinuation_certificate in the paper ↗

The certified continuation replaces the standalone exponential call in the power scalar assembly, returning exactly the prescribed clipped formula. the documented result

Formal statement
q b :
ℕ
v :
ℚ
prepared :
powerLogProgram.eval [q,b,v,v]
exponential :
powerExpProgram.eval [prepared.1,prepared.2,b,v,v]
clipped :
powerClipProgram.eval [prepared.1,b,exponential.1,exponential.2]
paperPowerScalar q b v = rationalBox clipped.1 clipped.2
Proof (Lean source)
-- @node: powerScalarContinuation_certificate lemma powerScalarContinuation_certificate (q b : ℕ) (v : ℚ) : let prepared := powerLogProgram.eval [q,b,v,v] let exponential := powerExpProgram.eval [prepared.1,prepared.2,b,v,v] let clipped := powerClipProgram.eval [prepared.1,b,exponential.1,exponential.2] paperPowerScalar q b v = rationalBox clipped.1 clipped.2 := by dsimp only simp only [powerLogProgram_eval, powerExpProgram_eval, powerClipProgram_eval] exact paperPowerScalar_eq_powerClipBox q b v
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarContinuation_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerExpFrames.lean:324
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerFusion 22 declarations The exponential stage reaches an active final frame before its halt instruction.

Control-flow certificates for fusion of the power recurrence

The exponential stage reaches an active final frame before its halt instruction. Replacing that halt with a relocated jump joins the prescribed clipping recurrence into one bounded register program. Its public fuel is computed by a separate finite rational recurrence. The logarithm and two endpoint calls remain to be joined.

theorem rationalProgram_run_halted Lemma rationalProgram_run_halted in the paper ↗

A halted frame is fixed by any number of further steps. Under the stated assumptions.

Formal statement
n :
ℕ
ha :
s.2.2 = true
code.run n s = s
Proof (Lean source)
-- @node: rationalProgram_run_halted lemma rationalProgram_run_halted (code : RationalProgram) (n : ℕ) (s : RationalState) (ha : s.2.2 = true) : code.run n s = s := by induction n with | zero => rfl | succ n ih => simpa [RationalProgram.run, RationalProgram.step, ha] using ih
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_run_halted · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:19
theorem rationalProgram_run_active Lemma rationalProgram_run_active in the paper ↗

[An active final frame certifies that the initial frame was active. the stated conclusion holds. Under the stated assumptions.

Formal statement
n :
ℕ
ha :
(code.run n s).2.2 = false
s.2.2 = false
Proof (Lean source)
-- @node: rationalProgram_run_active lemma rationalProgram_run_active (code : RationalProgram) (n : ℕ) (s : RationalState) (ha : (code.run n s).2.2 = false) : s.2.2 = false := by cases hs : s.2.2 · rfl · rw [rationalProgram_run_halted code n s hs, hs] at ha contradiction
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_run_active · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:27

Replace an explicit halt with a jump into an appended continuation.

Definition (Lean source)
target :
ℕ
rationalInstruction_continue target :
clause 1
| .halt => .jump target
clause 2
| op => op
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalInstruction_continue · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:36

Join two literal code lists, relocating all branches of the continuation.

Definition (Lean source)
code tail :
rationalProgram_continue code tail :
code.map (rationalInstruction_continue code.length) ++ tail.map (rationalInstruction_relocate code.length)
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_continue · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:42
theorem rationalProgram_continue_step

Before the original computation halts, joining a continuation changes no step. the stated conclusion holds. Under the stated assumptions.

Formal statement
code tail :
ha :
(code.step s).2.2 = false
(rationalProgram_continue code tail).step s = code.step s
Proof (Lean source)
-- @node: rationalProgram_continue_step lemma rationalProgram_continue_step (code tail : RationalProgram) (s : RationalState) (ha : (code.step s).2.2 = false) : (rationalProgram_continue code tail).step s = code.step s := by have hs : s.2.2 = false := rationalProgram_run_active code 1 s (by simpa [RationalProgram.run] using ha) cases he : code[s.1]? with | none => simp [RationalProgram.step, hs, he] at ha | some op => have hi : s.1 < code.length := List.getElem?_eq_some_iff.mp he |>.1 have hlookup : (rationalProgram_continue code tail)[s.1]? = some (rationalInstruction_continue code.length op) := by simp only [rationalProgram_continue, List.getElem?_append, List.length_map, if_pos hi, List.getElem?_map, he, Option.map_some] cases op <;> simp_all [RationalProgram.step, rationalInstruction_continue]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_continue_step · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:48
theorem rationalProgram_continue_run

Any active finite prefix of the original run is identical in the joined program. the stated conclusion holds. Under the stated assumptions.

Formal statement
code tail :
n :
ℕ
ha :
(code.run n s).2.2 = false
(rationalProgram_continue code tail).run n s = code.run n s
Proof (Lean source)
-- @node: rationalProgram_continue_run lemma rationalProgram_continue_run (code tail : RationalProgram) (n : ℕ) (s : RationalState) (ha : (code.run n s).2.2 = false) : (rationalProgram_continue code tail).run n s = code.run n s := by induction n generalizing s with | zero => rfl | succ n ih => change (code.run n (code.step s)).2.2 = false at ha have hstep := rationalProgram_run_active code n (code.step s) ha rw [RationalProgram.run, rationalProgram_continue_step code tail s hstep, ih (code.step s) ha, RationalProgram.run]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_continue_run · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:66
theorem rationalProgram_continue_tail

The appended block uses the same register frame as the unrelocated continuation. the stated conclusion holds.

Formal statement
code tail :
n :
ℕ
= rationalState_relocate code.length (tail.run n s)
Proof (Lean source)
-- @node: rationalProgram_continue_tail lemma rationalProgram_continue_tail (code tail : RationalProgram) (n : ℕ) (s : RationalState) : (rationalProgram_continue code tail).run n (rationalState_relocate code.length s) = rationalState_relocate code.length (tail.run n s) := by simpa [rationalProgram_continue] using rationalProgram_relocate_run (code.map (rationalInstruction_continue code.length)) tail n s
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalProgram_continue_tail · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:79
theorem expRegisterCode_before_halt

Both endpoint loops reach their active final frame without zeroing spare registers. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
s₀ :
hp₀ :
s₀.1 = 0
ha₀ :
s₀.2.2 = false
q :
(⌊s₀.2.1 0⌋ : ℤ).toNat
lo :
(paperExpScalar q (s₀.2.1 1)).lo
hi :
(paperExpScalar q (s₀.2.1 2)).hi
t :
expRegisterCode.run ((expRegisterFuel [s₀.2.1 0,s₀.2.1 1,s₀.2.1 2]-1)) (s₀)
t.1 = 89
t.2.2 = false
t.2.1 0 = lo
t.2.1 1 = hi
Proof (Lean source)
-- @node: expRegisterCode_before_halt lemma expRegisterCode_before_halt (s₀ : RationalState) (hp₀ : s₀.1 = 0) (ha₀ : s₀.2.2 = false) : let q := (⌊s₀.2.1 0⌋ : ℤ).toNat let lo := (paperExpScalar q (s₀.2.1 1)).lo let hi := (paperExpScalar q (s₀.2.1 2)).hi let t := expRegisterCode.run ((expRegisterFuel [s₀.2.1 0,s₀.2.1 1,s₀.2.1 2]-1)) (s₀) t.1 = 89 ∧ t.2.2 = false ∧ t.2.1 0 = lo ∧ t.2.1 1 = hi := by let q := (⌊s₀.2.1 0⌋ : ℤ).toNat let z := s₀.2.1 1 let w := s₀.2.1 2 let N := 2*seriesCount q z let M := 2*seriesCount q w have h := expRegisterCode_loop false q 0 N z _ 0 w _ (expRegisterCode_start_frame s₀ hp₀ ha₀) simp only [expRegisterFuel, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some] have hf : 78+7*(N+M)-1 = 23+(7*N+15)+(3+20)+(7*M+15)+1 := by omega rw [hf, rationalProgram_run_add _ (23+(7*N+15)+(3+20)+(7*M+15)) 1, rationalProgram_run_add _ (23+(7*N+15)+(3+20)) (7*M+15), rationalProgram_run_add _ (23+(7*N+15)) (3+20), rationalProgram_run_add _ 23 (7*N+15)] generalize hs : expRegisterCode.run (7*N+15) (expRegisterCode.run 23 (s₀)) = s at h ⊢ simp only [Bool.false_eq_true, ↓reduceIte, zero_add] at h rcases h with ⟨hp, ha, hlo, hhi, hq, hl, hw⟩ have hp' : (expRegisterCode.run 3 s).1 = 47 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have ha' : (expRegisterCode.run 3 s).2.2 = false := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, hp, ha] have hinit := expRegisterCode_initial true (expRegisterCode.run 3 s) hp' ha' have h0 : (expRegisterCode.run 3 s).2.1 0 = s₀.2.1 0 := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq] have h1 : (expRegisterCode.run 3 s).2.1 1 = w := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hw] have h18 : (expRegisterCode.run 3 s).2.1 18 = (paperExpScalar q z).lo := by norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hlo, paperExpScalar, rationalBox, expPolynomial, N] simp only [h0, h1] at hinit have hright := expRegisterCode_loop true q 0 M w _ _ _ _ hinit rw [rationalProgram_run_add _ 3 20] generalize ht : expRegisterCode.run (7*M+15) (expRegisterCode.run 20 (expRegisterCode.run 3 s)) = t at hright ⊢ simp only [↓reduceIte, zero_add] at hright rcases hright with ⟨htp, hta, _, hthi, _, htl, _⟩ rw [h18] at htl norm_num [expRegisterCode, RationalProgram.run, RationalProgram.step, Function.update_apply, htp, hta, hthi, htl, paperExpScalar, rationalBox, expPolynomial, M, q, z, w]
CausalSmith.Stat.LogoddsLowsmoothFrontier.expRegisterCode_before_halt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:88
theorem powerExpCode_before_halt

[The relocated exponential computation certifies the left power argument while retaining the internal precision, base, right exponent, and logarithm midpoint. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
p :
(⌊s.2.1 0⌋ : ℤ).toNat
J :
paperExpScalar p (s.2.1 3*s.2.1 1)
t :
powerExpCode.run (powerExpFrameFuel s-1) s
t.1 = 95
t.2.2 = false
t.2.1 0 = J.lo
t.2.1 1 = J.hi
t.2.1 24 = s.2.1 0
t.2.1 25 = s.2.1 2
t.2.1 26 = s.2.1 4
t.2.1 27 = s.2.1 1
Proof (Lean source)
-- @node: powerExpCode_before_halt lemma powerExpCode_before_halt (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let p := (⌊s.2.1 0⌋ : ℤ).toNat let J := paperExpScalar p (s.2.1 3*s.2.1 1) let t := powerExpCode.run (powerExpFrameFuel s-1) s t.1 = 95 ∧ t.2.2 = false ∧ t.2.1 0 = J.lo ∧ t.2.1 1 = J.hi ∧ t.2.1 24 = s.2.1 0 ∧ t.2.1 25 = s.2.1 2 ∧ t.2.1 26 = s.2.1 4 ∧ t.2.1 27 = s.2.1 1 := by have hprep := powerExpCode_prepare s hp ha dsimp only [powerExpFrameFuel] rw [show 6 + expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]-1 = 6+(expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]-1) by simp only [expRegisterFuel]; omega, rationalProgram_run_add] generalize he : powerExpCode.run 6 s = t at hprep ⊢ dsimp only at hprep obtain ⟨htp, hta, h0, h1, h2, h24, h25, h26, h27⟩ := hprep let u : RationalState := (0,t.2.1,false) have ht : t = rationalState_relocate powerExpPrelude.length u := by apply Prod.ext · simpa [rationalState_relocate, powerExpPrelude, u] using htp · apply Prod.ext · rfl · exact hta have hout := expRegisterCode_before_halt u rfl rfl have hs24 := expRegisterCode_spare_register 24 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]-1) u have hs25 := expRegisterCode_spare_register 25 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]-1) u have hs26 := expRegisterCode_spare_register 26 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]-1) u have hs27 := expRegisterCode_spare_register 27 (by omega) (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]-1) u dsimp only [u] at hout hs24 hs25 hs26 hs27 simp only [h0,h1,h2] at hout have hrun := rationalProgram_relocate_run powerExpPrelude expRegisterCode (expRegisterFuel [s.2.1 0,s.2.1 3*s.2.1 1,s.2.1 3*s.2.1 1]-1) u change powerExpCode.run _ (rationalState_relocate powerExpPrelude.length u) = _ at hrun rw [← ht] at hrun rw [hrun] dsimp only [rationalState_relocate] dsimp only [u] exact ⟨by simpa [powerExpPrelude, hout.1], hout.2.1,hout.2.2.1,hout.2.2.2,hs24.trans h24,hs25.trans h25, hs26.trans h26,hs27.trans h27⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpCode_before_halt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:143

[Move the exponential bracket and saved power parameters into the clipping frame.

Definition (Lean source)
powerClipPrelude :
[.copy 2 0, .copy 3 1, .copy 0 24, .copy 1 25]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipPrelude · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:191

The clipping continuation with all branch addresses relocated past the bridge.

Definition (Lean source)
powerClipTail :
powerClipPrelude ++ powerClipCode.map (rationalInstruction_relocate powerClipPrelude.length)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipTail · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:196

The bridge preserves the two exponential endpoints while restoring precision and base. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
t :
powerClipTail.run 4 s
t.1 = 4
t.2.2 = false
t.2.1 0 = s.2.1 24
t.2.1 1 = s.2.1 25
t.2.1 2 = s.2.1 0
t.2.1 3 = s.2.1 1
Proof (Lean source)
-- @node: powerClipTail_prepare lemma powerClipTail_prepare (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let t := powerClipTail.run 4 s t.1 = 4 ∧ t.2.2 = false ∧ t.2.1 0 = s.2.1 24 ∧ t.2.1 1 = s.2.1 25 ∧ t.2.1 2 = s.2.1 0 ∧ t.2.1 3 = s.2.1 1 := by norm_num [powerClipTail, powerClipPrelude, RationalProgram.run, RationalProgram.step, hp, ha, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipTail_prepare · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:201

The appended clipping tail halts and returns the exact raw clipping endpoints. Under the stated assumptions.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
p :
(⌊s.2.1 24⌋ : ℤ).toNat
b :
(⌊s.2.1 25⌋ : ℤ).toNat
e :
96 * (max 2 b : ℚ)^3 * rationalError p
t :
powerClipTail.run 31 s
t.2.2 = true
t.2.1 0 = (if b = 1 then 1 else max (1/(b : ℚ)^3) (s.2.1 0-e))
t.2.1 1 = (if b = 1 then 1 else min ((b : ℚ)^3) (s.2.1 1+e))
Proof (Lean source)
-- @node: powerClipTail_result lemma powerClipTail_result (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let p := (⌊s.2.1 24⌋ : ℤ).toNat let b := (⌊s.2.1 25⌋ : ℤ).toNat let e := 96 * (max 2 b : ℚ)^3 * rationalError p let t := powerClipTail.run 31 s t.2.2 = true ∧ t.2.1 0 = (if b = 1 then 1 else max (1/(b : ℚ)^3) (s.2.1 0-e)) ∧ t.2.1 1 = (if b = 1 then 1 else min ((b : ℚ)^3) (s.2.1 1+e)) := by have hprep := powerClipTail_prepare s hp ha rw [show 31 = 4+27 by rfl, rationalProgram_run_add] generalize he : powerClipTail.run 4 s = t at hprep ⊢ dsimp only at hprep obtain ⟨htp, hta, h0, h1, h2, h3⟩ := hprep let u : RationalState := (0,t.2.1,false) have ht : t = rationalState_relocate powerClipPrelude.length u := by apply Prod.ext · simpa [rationalState_relocate, powerClipPrelude, u] using htp · exact Prod.ext rfl hta have h := powerClipCode_result u rfl rfl dsimp only [u] at h simp only [h0,h1,h2,h3] at h rw [ht] rw [show powerClipTail = powerClipPrelude ++ powerClipCode.map (rationalInstruction_relocate powerClipPrelude.length) by rfl, rationalProgram_relocate_run] dsimp only [rationalState_relocate] generalize hv : powerClipCode.run 27 u = v at h ⊢ exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerClipTail_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:211

[A single literal register program performs the exponential and clipping stages.

Definition (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:243
theorem powerExpClipCode_connect

Replace the last exponential halt by the actual jump into the clipping tail. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 95
ha :
s.2.2 = false
powerExpClipCode.step s = rationalState_relocate powerExpCode.length (0,s.2.1,false)
Proof (Lean source)
-- @node: powerExpClipCode_connect lemma powerExpClipCode_connect (s : RationalState) (hp : s.1 = 95) (ha : s.2.2 = false) : powerExpClipCode.step s = rationalState_relocate powerExpCode.length (0,s.2.1,false) := by have hlen : powerExpCode.length = 96 := by rfl have hlookup : powerExpCode[95]? = some .halt := by rfl simp only [powerExpClipCode, rationalProgram_continue, RationalProgram.step, ha, Bool.false_eq_true, ↓reduceIte, hp, List.getElem?_append, List.length_map, hlen, show 95 < 96 by omega, ↓reduceIte, List.getElem?_map, hlookup, Option.map_some, rationalInstruction_continue, rationalState_relocate, Nat.add_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipCode_connect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:247

[Exact instruction bound for the joined continuation.

Definition (Lean source)
powerExpClipFuel s :
ℕ
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:259
theorem powerExpClipCode_result

The fused code computes the prescribed power bracket from a logarithm frame. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 0
ha :
s.2.2 = false
p :
(⌊s.2.1 0⌋ : ℤ).toNat
b :
(⌊s.2.1 2⌋ : ℤ).toNat
J :
paperExpScalar p (s.2.1 3*s.2.1 1)
t :
powerExpClipCode.run (powerExpClipFuel s) s
t.2.2 = true
rationalBox (t.2.1 0) (t.2.1 1) = powerClipBox p b J.lo J.hi
Proof (Lean source)
-- @node: powerExpClipCode_result lemma powerExpClipCode_result (s : RationalState) (hp : s.1 = 0) (ha : s.2.2 = false) : let p := (⌊s.2.1 0⌋ : ℤ).toNat let b := (⌊s.2.1 2⌋ : ℤ).toNat let J := paperExpScalar p (s.2.1 3*s.2.1 1) let t := powerExpClipCode.run (powerExpClipFuel s) s t.2.2 = true ∧ rationalBox (t.2.1 0) (t.2.1 1) = powerClipBox p b J.lo J.hi := by have h := powerExpCode_before_halt s hp ha have hf : powerExpClipFuel s = (powerExpFrameFuel s-1)+1+31 := by simp only [powerExpClipFuel, powerExpFrameFuel, expRegisterFuel]; omega rw [hf, rationalProgram_run_add, rationalProgram_run_add] dsimp only at h have hrun := rationalProgram_continue_run powerExpCode powerClipTail (powerExpFrameFuel s-1) s h.2.1 change powerExpClipCode.run _ s = _ at hrun rw [hrun] generalize he : powerExpCode.run (powerExpFrameFuel s-1) s = t at h ⊢ obtain ⟨htp, hta, hlo, hhi, h24, h25, _⟩ := h rw [show powerExpClipCode.run 1 t = powerExpClipCode.step t by rfl, powerExpClipCode_connect t htp hta] rw [show powerExpClipCode = rationalProgram_continue powerExpCode powerClipTail by rfl, rationalProgram_continue_tail] have hout := powerClipTail_result (0,t.2.1,false) rfl rfl dsimp only at hout simp only [h24,h25,hlo,hhi] at hout dsimp only [rationalState_relocate] generalize hv : powerClipTail.run 31 (0,t.2.1,false) = v at hout ⊢ refine ⟨hout.1, ?_⟩ rw [hout.2.1,hout.2.2] by_cases hb : (⌊s.2.1 2⌋ : ℤ).toNat = 1 · simp [powerClipBox, hb, rationalBox, RatInterval.point] · simp [powerClipBox, hb]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:263

[A straight-line recurrence computes the continuation's exact step bound.

Definition (Lean source)
powerExpClipFuelCode :
[.mul 1 3 1, .copy 2 1] ++ [.copy 20 2] ++ [.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1] ++ [.copy 21 2, .copy 1 20] ++ [.constant 12 0, .floor 14 0, .max 14 14 12, .constant 8 1, .constant 9 2, .copy 4 1, .constant 13 (-1), .mul 13 4 13, .max 11 4 13, .ceil 11 11, .max 11 11 8, .mul 2 11 11, .mul 2 2 9, .constant 13 6, .add 13 14 13, .max 2 2 13, .mul 2 2 9, .constant 5 1, .constant 6 0, .constant 3 1] ++ [.add 2 2 21, .constant 13 7, .mul 0 2 13, .constant 13 115, .add 0 0 13, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:299
theorem powerExpClipFuel_public

The continuation fuel is a total public rational computation on its input frame. the stated conclusion holds.

Formal statement
PublicIterationBound (fun xs => powerExpClipFuel (RationalProgram.initial xs))
Proof (Lean source)
-- @node: powerExpClipFuel_public lemma powerExpClipFuel_public : PublicIterationBound (fun xs => powerExpClipFuel (RationalProgram.initial xs)) := by refine ⟨powerExpClipFuelCode, ?_⟩ intro xs have hq : max (↑(⌊xs[0]?.getD 0⌋ : ℤ) : ℚ) 0 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊xs[0]?.getD 0⌋ : ℤ) 0 = (((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℕ) : ℤ) by omega) have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] have hB (z : ℚ) : max (↑(⌈|z|⌉ : ℤ) : ℚ) 1 = (seriesBound z : ℚ) := by have hn := Int.ceil_nonneg (abs_nonneg z) have hc : ((⌈|z|⌉ : ℤ).toNat : ℚ) = (⌈|z|⌉ : ℤ) := by exact_mod_cast Int.toNat_of_nonneg hn simp only [seriesBound, Nat.cast_max, Nat.cast_one, hc] exact max_comm _ _ refine ⟨51, ?_, ?_⟩ · norm_num [powerExpClipFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply] · norm_num [powerExpClipFuelCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, powerExpClipFuel, powerExpFrameFuel, expRegisterFuel, seriesCount, Nat.cast_add, Nat.cast_mul, Nat.cast_max, Nat.cast_pow, hq, habs, hB] simp only [← abs_mul, hB] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:320

Certified single register program for the exponential-to-clipping continuation.

Definition (Lean source)
powerExpClipProgram :
clause 1
clause 2
iterationBound := fun xs => powerExpClipFuel (RationalProgram.initial xs)
clause 3
public_bound := powerExpClipFuel_public
clause 4
halts := fun xs => (powerExpClipCode_result (RationalProgram.initial xs) rfl rfl).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:349
theorem powerExpClipProgram_eval

The fused continuation agrees with the literal scalar formula on prepared power data. Under the stated assumptions. The stated conclusion follows.

Formal statement
p b :
ℕ
mid lo hi :
ℚ
v :
powerExpClipProgram.eval [p,mid,b,lo,hi]
rationalBox v.1 v.2
= powerClipBox p b (paperExpScalar p (lo*mid)).lo (paperExpScalar p (lo*mid)).hi
Proof (Lean source)
-- @node: powerExpClipProgram_eval lemma powerExpClipProgram_eval (p b : ℕ) (mid lo hi : ℚ) : let v := powerExpClipProgram.eval [p,mid,b,lo,hi] rationalBox v.1 v.2 = powerClipBox p b (paperExpScalar p (lo*mid)).lo (paperExpScalar p (lo*mid)).hi := by have h := powerExpClipCode_result (RationalProgram.initial [(p : ℚ),mid,b,lo,hi]) rfl rfl dsimp only [BoundedRationalProgram.eval, powerExpClipProgram] generalize ht : powerExpClipCode.run (powerExpClipFuel (RationalProgram.initial [(p : ℚ),mid,b,lo,hi])) (RationalProgram.initial [(p : ℚ),mid,b,lo,hi]) = t at h ⊢ simp only [RationalProgram.initial, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] at h exact h.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerExpClipProgram_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:357
theorem powerScalarFusedContinuation_certificate Lemma powerScalarFusedContinuation_certificate in the paper ↗

The two-stage logarithm/fused-continuation computation is the prescribed scalar power. the stated conclusion holds.

Formal statement
q b :
ℕ
v :
ℚ
prepared :
powerLogProgram.eval [q,b,v,v]
endpoints :
powerExpClipProgram.eval [prepared.1,prepared.2,b,v,v]
paperPowerScalar q b v = rationalBox endpoints.1 endpoints.2
Proof (Lean source)
-- @node: powerScalarFusedContinuation_certificate lemma powerScalarFusedContinuation_certificate (q b : ℕ) (v : ℚ) : let prepared := powerLogProgram.eval [q,b,v,v] let endpoints := powerExpClipProgram.eval [prepared.1,prepared.2,b,v,v] paperPowerScalar q b v = rationalBox endpoints.1 endpoints.2 := by dsimp only rw [powerLogProgram_eval, powerExpClipProgram_eval] exact paperPowerScalar_eq_powerClipBox q b v
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarFusedContinuation_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerFusion.lean:372
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerLogProgram 20 declarations This stage computes the prescribed internal precision and the midpoint of its logarithm bracket.

The logarithm stage of the integer-base power register computation

This stage computes the prescribed internal precision and the midpoint of its logarithm bracket. Its output retains the integer base and both exponent endpoints for the exponential continuation. The complete power certificate remains separate.

[Internal precision used by the literal power algorithm.

Definition (Lean source)
q b :
ℕ
powerRegisterPrecision q b :
ℕ
q+12+3*clog 2 (max 2 b)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerRegisterPrecision · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:18
theorem paperLogScalar_midpoint Lemma paperLogScalar_midpoint in the paper ↗

The sorted logarithm bracket has the same midpoint as its unsorted endpoints. the stated conclusion holds.

Formal statement
p :
ℕ
z :
ℚ
((paperLogScalar p z).lo+(paperLogScalar p z).hi)/2
= if 0 < z then logPolynomial p z else 0
Proof (Lean source)
-- @node: paperLogScalar_midpoint lemma paperLogScalar_midpoint (p : ℕ) (z : ℚ) : ((paperLogScalar p z).lo+(paperLogScalar p z).hi)/2 = if 0 < z then logPolynomial p z else 0 := by by_cases hz : 0 < z · simp only [paperLogScalar, if_pos hz, rationalBox] rw [min_add_max] ring · simp [paperLogScalar, hz, RatInterval.point]
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperLogScalar_midpoint · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:22

Single logarithm loop, retaining the original base and exponent endpoints. Register zero returns the internal precision and register one the logarithm midpoint.

Definition (Lean source)
powerLogCode :
[.copy 18 2, .copy 20 3, .constant 12 0, .floor 14 0, .max 14 14 12, .floor 21 1, .max 21 21 12, .constant 9 2, .max 22 9 21, .clogTwo 13 22, .constant 10 3, .mul 13 13 10, .add 14 14 13, .constant 10 12, .add 14 14 10, .copy 7 21, .constant 8 1, .ceil 11 7, .div 13 8 7, .ceil 13 13, .max 11 11 13, .max 11 11 9, .constant 10 8, .mul 13 11 10, .clogTwo 13 13, .constant 10 5, .add 10 14 10, .add 10 10 13, .mul 2 11 10, .sub 4 7 8, .add 13 7 8, .div 4 4 13, .mul 10 4 4, .copy 5 4, .constant 6 0, .constant 3 1, .branchLe 2 12 43 37, .div 13 5 3, .add 6 6 13, .mul 5 5 10, .add 3 3 9, .sub 2 2 8, .jump 36, .branchLe 7 12 46 44, .mul 1 6 9, .jump 47, .constant 1 0, .copy 0 14, .copy 2 21, .copy 3 18, .copy 4 20, .halt]

The loop frame keeps the power data while generating the odd logarithm terms.

Definition (Lean source)
p b j remaining :
ℕ
lo hi :
ℚ
pc :
s.1 = 36
active :
s.2.2 = false
count :
s.2.1 2 = remaining
odd :
s.2.1 3 = (2*j+1 : ℕ)
coordinate :
s.2.1 4 = ((b : ℚ)-1)/((b : ℚ)+1)
term :
s.2.1 5 = (((b : ℚ)-1)/((b : ℚ)+1))^(2*j+1)
sum :
s.2.1 6 = ∑ i ∈ range j, (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ)
scalar :
s.2.1 7 = b
one :
s.2.1 8 = 1
two :
s.2.1 9 = 2
ratio :
s.2.1 10 = (((b : ℚ)-1)/((b : ℚ)+1))^2
zero :
s.2.1 12 = 0
precision :
s.2.1 14 = p
left :
s.2.1 18 = lo
right :
s.2.1 20 = hi
base :
s.2.1 21 = b
CausalSmith.Stat.LogoddsLowsmoothFrontier.PowerLogInvariant · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:57
theorem powerRegister_clamp_cast Lemma powerRegister_clamp_cast in the paper ↗

Signed rational inputs are clamped to their prescribed natural-number interpretations. Under the stated assumptions. The stated conclusion follows.

Formal statement
x :
ℚ
max (↑(⌊x⌋ : ℤ) : ℚ) 0 = ((⌊x⌋ : ℤ).toNat : ℚ)
Proof (Lean source)
-- @node: powerRegister_clamp_cast lemma powerRegister_clamp_cast (x : ℚ) : max (↑(⌊x⌋ : ℤ) : ℚ) 0 = ((⌊x⌋ : ℤ).toNat : ℚ) := by exact_mod_cast (show max (⌊x⌋ : ℤ) 0 = (((⌊x⌋ : ℤ).toNat : ℕ) : ℤ) by omega)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerRegister_clamp_cast · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:79
theorem powerLogCode_prepare

[The short preparation block clamps the two integers and computes internal precision. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
t :
powerLogCode.run 15 (RationalProgram.initial xs)
t.1 = 15
t.2.2 = false
t.2.1 14 = powerRegisterPrecision q b
t.2.1 21 = b
t.2.1 18 = xs[2]?.getD 0
t.2.1 20 = xs[3]?.getD 0
t.2.1 9 = 2
t.2.1 12 = 0
Proof (Lean source)
-- @node: powerLogCode_prepare lemma powerLogCode_prepare (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let t := powerLogCode.run 15 (RationalProgram.initial xs) t.1 = 15 ∧ t.2.2 = false ∧ t.2.1 14 = powerRegisterPrecision q b ∧ t.2.1 21 = b ∧ t.2.1 18 = xs[2]?.getD 0 ∧ t.2.1 20 = xs[3]?.getD 0 ∧ t.2.1 9 = 2 ∧ t.2.1 12 = 0 := by have hB (b : ℕ) : max (2 : ℚ) b = (max 2 b : ℕ) := by push_cast; rfl have hclog (b : ℕ) : (⌊max (2 : ℚ) b⌋ : ℤ).toNat = max 2 b := by rw [hB]; simp only [Int.floor_natCast, Int.toNat_natCast] rw [show 15 = 7+8 by rfl, rationalProgram_run_add] have hf : let t := powerLogCode.run 7 (RationalProgram.initial xs) t.1 = 7 ∧ t.2.2 = false ∧ t.2.1 14 = ((⌊xs[0]?.getD 0⌋ : ℤ).toNat : ℚ) ∧ t.2.1 21 = ((⌊xs[1]?.getD 0⌋ : ℤ).toNat : ℚ) ∧ t.2.1 18 = xs[2]?.getD 0 ∧ t.2.1 20 = xs[3]?.getD 0 ∧ t.2.1 12 = 0 := by generalize he : powerLogCode.run 7 (RationalProgram.initial xs) = t norm_num [powerLogCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, powerRegister_clamp_cast] at he subst t norm_num [Function.update_apply] generalize he : powerLogCode.run 7 (RationalProgram.initial xs) = t at hf ⊢ obtain ⟨hp, ha, hq, hb, hl, hu, h0⟩ := hf generalize he' : powerLogCode.run 8 t = u norm_num [powerLogCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq, hb, hclog] at he' subst u norm_num [Function.update_apply, hq, hb, hl, hu, h0, hclog, powerRegisterPrecision, Nat.cast_mul, Nat.cast_add] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_prepare · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:86
theorem powerLogCode_initialize_loop

The initialization suffix prepares the literal logarithm loop. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
p b :
ℕ
lo hi :
ℚ
hp :
s.1 = 15
ha :
s.2.2 = false
hq :
s.2.1 14 = p
hb' :
s.2.1 21 = b
hl :
s.2.1 18 = lo
hu :
s.2.1 20 = hi
h2 :
s.2.1 9 = 2
h0 :
s.2.1 12 = 0
PowerLogInvariant p b 0 (logRangeBound b*(p+3+clog 2 (8*logRangeBound b)+2)) lo hi (powerLogCode.run 21 s)
Proof (Lean source)
-- @node: powerLogCode_initialize_loop lemma powerLogCode_initialize_loop (p b : ℕ) (lo hi : ℚ) (s : RationalState) (hp : s.1 = 15) (ha : s.2.2 = false) (hq : s.2.1 14 = p) (hb' : s.2.1 21 = b) (hl : s.2.1 18 = lo) (hu : s.2.1 20 = hi) (h2 : s.2.1 9 = 2) (h0 : s.2.1 12 = 0) : PowerLogInvariant p b 0 (logRangeBound b*(p+3+clog 2 (8*logRangeBound b)+2)) lo hi (powerLogCode.run 21 s) := by have hb (z : ℚ) : max (max (↑(⌈z⌉ : ℤ) : ℚ) (↑(⌈z⁻¹⌉ : ℤ) : ℚ)) 2 = (logRangeBound z : ℚ) := by simpa only [one_div] using logRegister_bound_cast z have hc (z : ℚ) : (⌊(logRangeBound z : ℚ)*8⌋ : ℤ).toNat = 8*logRangeBound z := by rw [show (logRangeBound z : ℚ)*8 = (8*logRangeBound z : ℕ) by push_cast; ring] norm_cast have hbNat : max (max (b : ℚ) (↑(⌈(b : ℚ)⁻¹⌉ : ℤ) : ℚ)) 2 = (logRangeBound b : ℚ) := by simpa using hb (b : ℚ) generalize he : powerLogCode.run 21 s = t norm_num [powerLogCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hq, hb', hl, hu, h2, h0, hb, hbNat, hc] at he subst t constructor <;> norm_num [Function.update_apply, hq, hb', hl, hu, h2, h0, hbNat, hc, Nat.cast_mul, Nat.cast_add] all_goals (ring <;> try simp)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_initialize_loop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:121
theorem powerLogCode_initial

[Initialization computes exactly the internal precision and the logarithm count. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
PowerLogInvariant p b 0 (logRangeBound b*(p+3+clog 2 (8*logRangeBound b)+2)) (xs[2]?.getD 0) (xs[3]?.getD 0) (powerLogCode.run 36 (RationalProgram.initial xs))
Proof (Lean source)
-- @node: powerLogCode_initial lemma powerLogCode_initial (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let p := powerRegisterPrecision q b PowerLogInvariant p b 0 (logRangeBound b*(p+3+clog 2 (8*logRangeBound b)+2)) (xs[2]?.getD 0) (xs[3]?.getD 0) (powerLogCode.run 36 (RationalProgram.initial xs)) := by rw [show 36 = 15+21 by rfl, rationalProgram_run_add] obtain ⟨hp, ha, hq, hb, hl, hu, h2, h0⟩ := powerLogCode_prepare xs exact powerLogCode_initialize_loop _ _ _ _ _ hp ha hq hb hl hu h2 h0
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_initial · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:145
theorem powerLogCode_round

A seven-instruction block adds precisely one logarithm term. Under the stated assumptions. Under the stated assumptions. The stated conclusion follows.

Formal statement
p b j N :
ℕ
lo hi :
ℚ
h :
PowerLogInvariant p b j (N+1) lo hi s
PowerLogInvariant p b (j+1) N lo hi (powerLogCode.run 7 s)
Proof (Lean source)
-- @node: powerLogCode_round lemma powerLogCode_round (p b j N : ℕ) (lo hi : ℚ) (s : RationalState) (h : PowerLogInvariant p b j (N+1) lo hi s) : PowerLogInvariant p b (j+1) N lo hi (powerLogCode.run 7 s) := by rcases h with ⟨hp, ha, hc, hi', hz, ht, hs, hb, h1, h2, hr, h0, hq, hl, hu, hb'⟩ have hpos : ¬ s.2.1 2 ≤ s.2.1 12 := by rw [hc, h0]; exact not_le.mpr (by positivity) generalize he : powerLogCode.run 7 s = t norm_num [powerLogCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hpos] at he subst t constructor <;> norm_num [Function.update_apply, hc, hi', hz, ht, hs, hb, h1, h2, hr, h0, hq, hl, hu, hb', Finset.sum_range_succ, Nat.cast_add, Nat.cast_mul] · ring · rw [show 2*(j+1)+1 = (2*j+1)+2 by omega, pow_add] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_round · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:159
theorem powerLogCode_exit

Both domain branches return the midpoint and retain the continuation inputs. Under the stated assumptions.

Formal statement
p b j :
ℕ
lo hi :
ℚ
h :
PowerLogInvariant p b j 0 lo hi s
S :
2*∑ i ∈ range j, (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ)
t :
powerLogCode.run 9 s
t.2.2 = true
t.2.1 0 = p
t.2.1 1 = (if 0 < b then S else 0)
t.2.1 2 = b
t.2.1 3 = lo
t.2.1 4 = hi
Proof (Lean source)
-- @node: powerLogCode_exit lemma powerLogCode_exit (p b j : ℕ) (lo hi : ℚ) (s : RationalState) (h : PowerLogInvariant p b j 0 lo hi s) : let S := 2*∑ i ∈ range j, (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ) let t := powerLogCode.run 9 s t.2.2 = true ∧ t.2.1 0 = p ∧ t.2.1 1 = (if 0 < b then S else 0) ∧ t.2.1 2 = b ∧ t.2.1 3 = lo ∧ t.2.1 4 = hi := by rcases h with ⟨hp, ha, hc, hi', hz, ht, hs, hb, h1, h2, hr, h0, hq, hl, hu, hb'⟩ by_cases hpos : 0 < b · have hn : ¬ s.2.1 7 ≤ s.2.1 12 := by rw [hb, h0]; exact not_le.mpr (by exact_mod_cast hpos) rw [h0] at hn generalize he : powerLogCode.run 9 s = t norm_num [powerLogCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, h0, hn] at he subst t norm_num [Function.update_apply, hs, h2, hq, hl, hu, hb', hpos] ring · have hn : s.2.1 7 ≤ s.2.1 12 := by rw [hb, h0]; exact_mod_cast (le_of_not_gt hpos) rw [h0] at hn generalize he : powerLogCode.run 9 s = t norm_num [powerLogCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, h0, hn] at he subst t norm_num [Function.update_apply, hs, h2, hq, hl, hu, hb', hpos]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_exit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:177
theorem powerLogCode_loop

Exhaustion of the exact term count proves termination and the completed sum. Under the stated assumptions.

Formal statement
p b j N :
ℕ
lo hi :
ℚ
h :
PowerLogInvariant p b j N lo hi s
S :
2*∑ i ∈ range (j+N), (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ)
t :
powerLogCode.run (7*N+9) s
t.2.2 = true
t.2.1 0 = p
t.2.1 1 = (if 0 < b then S else 0)
t.2.1 2 = b
t.2.1 3 = lo
t.2.1 4 = hi
Proof (Lean source)
-- @node: powerLogCode_loop lemma powerLogCode_loop (p b j N : ℕ) (lo hi : ℚ) (s : RationalState) (h : PowerLogInvariant p b j N lo hi s) : let S := 2*∑ i ∈ range (j+N), (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ) let t := powerLogCode.run (7*N+9) s t.2.2 = true ∧ t.2.1 0 = p ∧ t.2.1 1 = (if 0 < b then S else 0) ∧ t.2.1 2 = b ∧ t.2.1 3 = lo ∧ t.2.1 4 = hi := by induction N generalizing j s with | zero => simpa using powerLogCode_exit p b j lo hi s h | succ N ih => rw [show 7*(N+1)+9 = 7+(7*N+9) by omega, rationalProgram_run_add] simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (j+1) _ (powerLogCode_round p b j N lo hi s h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_loop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:206

[Public fuel of the logarithm preparation stage.

Definition (Lean source)
xs :
List ℚ
powerLogFuel xs :
ℕ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
45+7*(logRangeBound b*(p+3+clog 2 (8*logRangeBound b)+2))
theorem powerLogCode_result

The stage computes the literal logarithm midpoint, including the totalized zero base. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
L :
t :
powerLogCode.run (powerLogFuel xs) (RationalProgram.initial xs)
t.2.2 = true
t.2.1 0 = p
t.2.1 1 = (L.lo+L.hi)/2
t.2.1 2 = b
t.2.1 3 = xs[2]?.getD 0
t.2.1 4 = xs[3]?.getD 0
Proof (Lean source)
-- @node: powerLogCode_result lemma powerLogCode_result (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let p := powerRegisterPrecision q b let L := paperLogScalar p b let t := powerLogCode.run (powerLogFuel xs) (RationalProgram.initial xs) t.2.2 = true ∧ t.2.1 0 = p ∧ t.2.1 1 = (L.lo+L.hi)/2 ∧ t.2.1 2 = b ∧ t.2.1 3 = xs[2]?.getD 0 ∧ t.2.1 4 = xs[3]?.getD 0 := by have h := powerLogCode_loop _ _ 0 _ _ _ _ (powerLogCode_initial xs) dsimp only [powerLogFuel] rw [show ∀ N : ℕ, 45+7*N = 36+(7*N+9) by omega, rationalProgram_run_add] simpa only [zero_add, paperLogScalar_midpoint, logPolynomial, Nat.cast_pos] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:230

Straight-line computation of the public stage bound.

Definition (Lean source)
powerLogFuelCode :
[.copy 18 2, .copy 20 3, .constant 12 0, .floor 14 0, .max 14 14 12, .floor 21 1, .max 21 21 12, .constant 9 2, .max 22 9 21, .clogTwo 13 22, .constant 10 3, .mul 13 13 10, .add 14 14 13, .constant 10 12, .add 14 14 10, .copy 7 21, .constant 8 1, .ceil 11 7, .div 13 8 7, .ceil 13 13, .max 11 11 13, .max 11 11 9, .constant 10 8, .mul 13 11 10, .clogTwo 13 13, .constant 10 5, .add 10 14 10, .add 10 10 13, .mul 2 11 10, .sub 4 7 8, .add 13 7 8, .div 4 4 13, .mul 10 4 4, .copy 5 4, .constant 6 0, .constant 3 1, .constant 3 7, .mul 0 2 3, .constant 3 45, .add 0 0 3, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:246
theorem powerLogFuelCode_prefix_step Lemma powerLogFuelCode_prefix_step in the paper ↗

The two codes have identical straight-line instructions before the loop head. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hs :
s.1 < 36
ha :
s.2.2 = false
conclusion 1
powerLogFuelCode.step s = powerLogCode.step s
conclusion 2
(powerLogCode.step s).1 = s.1+1
conclusion 3
(powerLogCode.step s).2.2 = false
Proof (Lean source)
-- @node: powerLogFuelCode_prefix_step lemma powerLogFuelCode_prefix_step (s : RationalState) (hs : s.1 < 36) (ha : s.2.2 = false) : powerLogFuelCode.step s = powerLogCode.step s ∧ (powerLogCode.step s).1 = s.1+1 ∧ (powerLogCode.step s).2.2 = false := by generalize hp : s.1 = pc at hs interval_cases pc <;> simp [powerLogFuelCode, powerLogCode, RationalProgram.step, hp, ha]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogFuelCode_prefix_step · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:263
theorem powerLogFuelCode_prefix_run Lemma powerLogFuelCode_prefix_run in the paper ↗

The straight-line prefixes agree at each of their bounded instruction positions. Under the stated assumptions.

Formal statement
xs :
List ℚ
n :
ℕ
hn :
n ≤ 36
conclusion 1
powerLogFuelCode.run n (RationalProgram.initial xs)
= powerLogCode.run n (RationalProgram.initial xs)
conclusion 2
(powerLogCode.run n (RationalProgram.initial xs)).1 = n
conclusion 3
(powerLogCode.run n (RationalProgram.initial xs)).2.2 = false
Proof (Lean source)
-- @node: powerLogFuelCode_prefix_run lemma powerLogFuelCode_prefix_run (xs : List ℚ) (n : ℕ) (hn : n ≤ 36) : powerLogFuelCode.run n (RationalProgram.initial xs) = powerLogCode.run n (RationalProgram.initial xs) ∧ (powerLogCode.run n (RationalProgram.initial xs)).1 = n ∧ (powerLogCode.run n (RationalProgram.initial xs)).2.2 = false := by induction n with | zero => simp [RationalProgram.run, RationalProgram.initial] | succ n ih => obtain ⟨he, hp, ha⟩ := ih (by omega) have hs := powerLogFuelCode_prefix_step (powerLogCode.run n (RationalProgram.initial xs)) (by rw [hp]; omega) ha rw [show n+1 = n+1 by rfl, rationalProgram_run_add, rationalProgram_run_add, he] simpa only [RationalProgram.run] using ⟨hs.1, by simpa [hp] using hs.2.1, hs.2.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogFuelCode_prefix_run · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:273
theorem powerLogFuelCode_prefix Lemma powerLogFuelCode_prefix in the paper ↗

[The shared initialization prefix is the same computation. the stated conclusion holds.

Formal statement
xs :
List ℚ
powerLogFuelCode.run 36 (RationalProgram.initial xs)
= powerLogCode.run 36 (RationalProgram.initial xs)
Proof (Lean source)
-- @node: powerLogFuelCode_prefix lemma powerLogFuelCode_prefix (xs : List ℚ) : powerLogFuelCode.run 36 (RationalProgram.initial xs) = powerLogCode.run 36 (RationalProgram.initial xs) := by exact (powerLogFuelCode_prefix_run xs 36 (by omega)).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogFuelCode_prefix · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:290
theorem powerLogFuel_public

The prescribed fuel itself is a finite rational register computation. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: powerLogFuel_public lemma powerLogFuel_public : PublicIterationBound powerLogFuel := by refine ⟨powerLogFuelCode, ?_⟩ intro xs have h := powerLogCode_initial xs refine ⟨41, ?_, ?_⟩ all_goals rw [show 41 = 36+5 by rfl, rationalProgram_run_add, powerLogFuelCode_prefix] generalize he : powerLogCode.run 36 (RationalProgram.initial xs) = t at h ⊢ rcases h with ⟨hp, ha, hc, _⟩ norm_num [powerLogFuelCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, powerLogFuel, Nat.cast_add, Nat.cast_mul] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:297

The preparation stage halts at the proved public count on every rational input.

Definition (Lean source)
powerLogProgram :
clause 1
code := powerLogCode
clause 2
iterationBound := powerLogFuel
clause 3
public_bound := powerLogFuel_public
clause 4
halts := fun xs => (powerLogCode_result xs).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:312
theorem powerLogProgram_eval

The certified program supplies the literal midpoint needed by both scalar exponentials. Under the stated assumptions. The stated conclusion follows.

Formal statement
q b :
ℕ
lo hi :
ℚ
powerLogProgram.eval [q,b,lo,hi]
= ((powerRegisterPrecision q b : ℚ), ((paperLogScalar (powerRegisterPrecision q b) b).lo+ (paperLogScalar (powerRegisterPrecision q b) b).hi)/2)
Proof (Lean source)
-- @node: powerLogProgram_eval lemma powerLogProgram_eval (q b : ℕ) (lo hi : ℚ) : powerLogProgram.eval [q,b,lo,hi] = ((powerRegisterPrecision q b : ℚ), ((paperLogScalar (powerRegisterPrecision q b) b).lo+ (paperLogScalar (powerRegisterPrecision q b) b).hi)/2) := by have h := powerLogCode_result [(q : ℚ), b, lo, hi] simp only [List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] at h exact Prod.ext h.2.1 h.2.2.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogProgram_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerLogProgram.lean:320
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerScalarBudget 13 declarations A conservative rational count bounds the literal logarithm and exponential loops on all rational inputs, including inputs outside the primitive's analytic domain.

Public fuel for the full scalar power register program

A conservative rational count bounds the literal logarithm and exponential loops on all rational inputs, including inputs outside the primitive's analytic domain. The scalar code and its argument-specific truncation counts are unchanged.

[The number of odd terms evaluated in the power logarithm.

Definition (Lean source)
q b :
ℕ
powerLogTermCount q b :
ℕ
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogTermCount · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:17
theorem powerLogPolynomial_abs_le

Each atanh term has magnitude at most one for a nonnegative integer base. the stated conclusion holds.

Formal statement
q b :
ℕ
|logPolynomial (powerRegisterPrecision q b) b| ≤ 2*(powerLogTermCount q b : ℚ)
Proof (Lean source)
-- @node: powerLogPolynomial_abs_le lemma powerLogPolynomial_abs_le (q b : ℕ) : |logPolynomial (powerRegisterPrecision q b) b| ≤ 2*(powerLogTermCount q b : ℚ) := by have hb : (0 : ℚ) ≤ b := by positivity have hr : |((b : ℚ)-1)/((b : ℚ)+1)| ≤ 1 := by rw [abs_div, abs_of_pos (by positivity : (0 : ℚ) < b+1)] apply (div_le_one (by positivity)).mpr exact abs_le.mpr ⟨by linarith, by linarith⟩ have ht (j : ℕ) : |(((b : ℚ)-1)/((b : ℚ)+1))^(2*j+1)/(2*j+1 : ℕ)| ≤ 1 := by rw [abs_div, abs_pow, abs_of_pos (by positivity : (0 : ℚ) < (2*j+1 : ℕ))] apply (div_le_one (by positivity)).mpr have hp : |((b : ℚ)-1)/((b : ℚ)+1)|^(2*j+1) ≤ 1 := pow_le_one₀ (abs_nonneg _) hr exact hp.trans (by norm_cast; omega) unfold logPolynomial rw [abs_mul, abs_of_pos (by norm_num : (0 : ℚ) < 2)] apply mul_le_mul_of_nonneg_left _ (by norm_num) calc |∑ j ∈ range (powerLogTermCount q b), (((b : ℚ)-1)/((b : ℚ)+1))^(2*j+1)/(2*j+1 : ℕ)| ≤ ∑ j ∈ range (powerLogTermCount q b), |(((b : ℚ)-1)/((b : ℚ)+1))^(2*j+1)/(2*j+1 : ℕ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ j ∈ range (powerLogTermCount q b), (1 : ℚ) := Finset.sum_le_sum (fun j _ => ht j) _ = (powerLogTermCount q b : ℚ) := by simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogPolynomial_abs_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:22

Original-input bound for the exponential argument's integer range.

Definition (Lean source)
q b :
ℕ
v :
ℚ
powerScalarSeriesBound q b v :
ℕ
max 1 (⌈2*(powerLogTermCount q b : ℚ)*|v|⌉ : ℤ).toNat
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarSeriesBound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:50

The bound depends only on the original precision, base, and rational exponent.

Definition (Lean source)
xs :
List ℚ
powerScalarPublicFuel xs :
ℕ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
B :
161+7*powerLogTermCount q b+28*max (2*B^2) (p+6)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:55
theorem powerScalarSeriesBound_le

The logarithm midpoint gives no larger range bound than the original-input count. the stated conclusion holds.

Formal statement
q b :
ℕ
v :
ℚ
Proof (Lean source)
-- @node: powerScalarSeriesBound_le lemma powerScalarSeriesBound_le (q b : ℕ) (v : ℚ) : seriesBound (v*((paperLogScalar (powerRegisterPrecision q b) b).lo+ (paperLogScalar (powerRegisterPrecision q b) b).hi)/2) ≤ powerScalarSeriesBound q b v := by rw [show v*((paperLogScalar (powerRegisterPrecision q b) b).lo+ (paperLogScalar (powerRegisterPrecision q b) b).hi)/2 = v*(((paperLogScalar (powerRegisterPrecision q b) b).lo+ (paperLogScalar (powerRegisterPrecision q b) b).hi)/2) by ring, paperLogScalar_midpoint] have h : |v*(if 0 < (b : ℚ) then logPolynomial (powerRegisterPrecision q b) b else 0)| ≤ 2*(powerLogTermCount q b : ℚ)*|v| := by rw [abs_mul] split · nlinarith [powerLogPolynomial_abs_le q b, abs_nonneg v] · simp only [abs_zero, mul_zero]; positivity exact max_le_max_left 1 (Int.toNat_le_toNat (Int.ceil_mono h))
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarSeriesBound_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:64
theorem powerScalarFuel_le_public

The fixed original-input fuel covers the exact fused scalar run. the stated conclusion holds.

Formal statement
xs :
List ℚ
Proof (Lean source)
-- @node: powerScalarFuel_le_public lemma powerScalarFuel_le_public (xs : List ℚ) : powerScalarFuel xs ≤ powerScalarPublicFuel xs := by have h := powerLogCode_before_halt xs dsimp only at h rw [← powerLogActiveFuel] at h obtain ⟨_, _, hp, hm, _, hv, _⟩ := h have hB := powerScalarSeriesBound_le (⌊xs[0]?.getD 0⌋ : ℤ).toNat (⌊xs[1]?.getD 0⌋ : ℤ).toNat (xs[2]?.getD 0) have hM : seriesCount (powerRegisterPrecision (⌊xs[0]?.getD 0⌋ : ℤ).toNat (⌊xs[1]?.getD 0⌋ : ℤ).toNat) (xs[2]?.getD 0 * (((paperLogScalar (powerRegisterPrecision (⌊xs[0]?.getD 0⌋ : ℤ).toNat (⌊xs[1]?.getD 0⌋ : ℤ).toNat) (⌊xs[1]?.getD 0⌋ : ℤ).toNat).lo+ (paperLogScalar (powerRegisterPrecision (⌊xs[0]?.getD 0⌋ : ℤ).toNat (⌊xs[1]?.getD 0⌋ : ℤ).toNat) (⌊xs[1]?.getD 0⌋ : ℤ).toNat).hi)/2)) ≤ max (2*powerScalarSeriesBound (⌊xs[0]?.getD 0⌋ : ℤ).toNat (⌊xs[1]?.getD 0⌋ : ℤ).toNat (xs[2]?.getD 0)^2) (powerRegisterPrecision (⌊xs[0]?.getD 0⌋ : ℤ).toNat (⌊xs[1]?.getD 0⌋ : ℤ).toNat+6) := by unfold seriesCount apply max_le_max_right gcongr simpa only [mul_div_assoc] using hB simp only [powerScalarFuel, powerExpClipFuel, powerExpFrameFuel, expRegisterFuel, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, hp, hm, hv, Int.floor_natCast, Int.toNat_natCast] dsimp only [powerScalarPublicFuel, powerLogActiveFuel, powerLogFuel, powerLogTermCount] at * omega
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarFuel_le_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:83

A literal straight-line program computes the conservative scalar fuel.

Definition (Lean source)
powerScalarPublicFuelCode :
powerLogFuelCode.take 36 ++ [.mul 5 2 9, .constant 10 (-1), .mul 10 18 10, .max 6 18 10, .mul 5 5 6, .ceil 5 5, .max 5 5 8, .mul 5 5 5, .mul 5 5 9, .constant 6 6, .add 6 14 6, .max 5 5 6, .constant 6 28, .mul 5 5 6, .constant 6 7, .mul 0 2 6, .add 0 0 5, .constant 6 161, .add 0 0 6, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuelCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:114
theorem powerScalarPublicFuelCode_prefix_step Lemma powerScalarPublicFuelCode_prefix_step in the paper ↗

The fuel program uses the same logarithm initialization instructions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hs :
s.1 < 36
ha :
s.2.2 = false
powerScalarPublicFuelCode.step s = powerLogCode.step s
Proof (Lean source)
-- @node: powerScalarPublicFuelCode_prefix_step lemma powerScalarPublicFuelCode_prefix_step (s : RationalState) (hs : s.1 < 36) (ha : s.2.2 = false) : powerScalarPublicFuelCode.step s = powerLogCode.step s := by generalize hp : s.1 = pc at hs interval_cases pc <;> simp [powerScalarPublicFuelCode, powerLogFuelCode, powerLogCode, RationalProgram.step, hp, ha]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuelCode_prefix_step · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:126
theorem powerScalarPublicFuelCode_prefix Lemma powerScalarPublicFuelCode_prefix in the paper ↗

Every initialization step is identical in the fuel and scalar programs. Under the stated assumptions.

Formal statement
xs :
List ℚ
n :
ℕ
hn :
n ≤ 36
powerScalarPublicFuelCode.run n (RationalProgram.initial xs)
= powerLogCode.run n (RationalProgram.initial xs)
Proof (Lean source)
-- @node: powerScalarPublicFuelCode_prefix lemma powerScalarPublicFuelCode_prefix (xs : List ℚ) (n : ℕ) (hn : n ≤ 36) : powerScalarPublicFuelCode.run n (RationalProgram.initial xs) = powerLogCode.run n (RationalProgram.initial xs) := by induction n with | zero => rfl | succ n ih => obtain ⟨_, hp, ha⟩ := powerLogFuelCode_prefix_run xs n (by omega) rw [rationalProgram_run_add _ n 1, rationalProgram_run_add _ n 1, ih (by omega)] exact powerScalarPublicFuelCode_prefix_step _ (by rw [hp]; omega) ha
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuelCode_prefix · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:136
theorem powerScalarPublicFuel_public

The complete original-input bound is computed by finite rational instructions. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: powerScalarPublicFuel_public lemma powerScalarPublicFuel_public : PublicIterationBound powerScalarPublicFuel := by refine ⟨powerScalarPublicFuelCode, ?_⟩ intro xs have h := powerLogCode_initial xs have habs (z : ℚ) : max z (-z) = |z| := by by_cases hz : 0 ≤ z · rw [abs_of_nonneg hz, max_eq_left (by linarith)] · rw [abs_of_neg (lt_of_not_ge hz), max_eq_right (by linarith)] have hceil (x : ℚ) (hx : 0 ≤ x) : max (↑(⌈x⌉ : ℤ) : ℚ) 1 = (max 1 (⌈x⌉ : ℤ).toNat : ℕ) := by have hc : ((⌈x⌉ : ℤ).toNat : ℚ) = (⌈x⌉ : ℤ) := by exact_mod_cast Int.toNat_of_nonneg (Int.ceil_nonneg hx) simp only [Nat.cast_max, Nat.cast_one, hc, max_comm] refine ⟨56, ?_, ?_⟩ all_goals rw [show 56 = 36+20 by rfl, rationalProgram_run_add, powerScalarPublicFuelCode_prefix xs 36 (by omega)] generalize he : powerLogCode.run 36 (RationalProgram.initial xs) = t at h ⊢ rcases h with ⟨hp, ha, hc, _, _, _, _, _, h1, h2, _, _, hq, hl, _, _⟩ norm_num [powerScalarPublicFuelCode, powerLogFuelCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, h1, h2, hq, hl, powerScalarPublicFuel, powerScalarSeriesBound, powerLogTermCount, Nat.cast_add, Nat.cast_mul, Nat.cast_max, Nat.cast_pow, habs] rw [show ∀ N : ℚ, N*2*|xs[2]?.getD 0| = 2*N*|xs[2]?.getD 0| by intro N; ring] rw [hceil _ (by positivity)] push_cast ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarPublicFuel_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:150
theorem powerScalarCode_public_result

Sufficient extra steps leave the already halted scalar output unchanged. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
t :
powerScalarCode.run (powerScalarPublicFuel xs) (RationalProgram.initial xs)
t.2.2 = true
rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b (xs[2]?.getD 0)
Proof (Lean source)
-- @node: powerScalarCode_public_result lemma powerScalarCode_public_result (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let t := powerScalarCode.run (powerScalarPublicFuel xs) (RationalProgram.initial xs) t.2.2 = true ∧ rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b (xs[2]?.getD 0) := by have h := powerScalarCode_result xs dsimp only at h have hf := powerScalarFuel_le_public xs rw [show powerScalarPublicFuel xs = powerScalarFuel xs+ (powerScalarPublicFuel xs-powerScalarFuel xs) by omega, rationalProgram_run_add, rationalProgram_run_halted _ _ _ h.1] exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_public_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:181

A certified single register program implements the entire scalar power routine.

Definition (Lean source)
powerScalarProgram :
clause 1
clause 2
iterationBound := powerScalarPublicFuel
clause 3
clause 4
halts := fun xs => (powerScalarCode_public_result xs).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:197
theorem powerScalarProgram_eval Lemma powerScalarProgram_eval in the paper ↗

The bounded scalar register evaluation returns the prescribed paper bracket. the stated conclusion holds.

Formal statement
q b :
ℕ
v w :
ℚ
endpoints :
powerScalarProgram.eval [q,b,v,w]
rationalBox endpoints.1 endpoints.2 = paperPowerScalar q b v
Proof (Lean source)
-- @node: powerScalarProgram_eval lemma powerScalarProgram_eval (q b : ℕ) (v w : ℚ) : let endpoints := powerScalarProgram.eval [q,b,v,w] rationalBox endpoints.1 endpoints.2 = paperPowerScalar q b v := by have h := powerScalarCode_public_result [(q : ℚ),b,v,w] simpa only [BoundedRationalProgram.eval, powerScalarProgram, List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] using h.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarProgram_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarBudget.lean:205
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.PowerScalarFusion 9 declarations The logarithm reaches an active final frame with its midpoint and power inputs.

Joining logarithm evaluation with the scalar power continuation

The logarithm reaches an active final frame with its midpoint and power inputs. Replacing its halt by a jump executes the exponential and clipping instructions in the same register machine and yields the prescribed scalar power bracket.

theorem powerLogCode_before_halt_exit

The logarithm exit reaches the active halt instruction with the complete power frame. Under the stated assumptions.

Formal statement
p b j :
ℕ
lo hi :
ℚ
h :
PowerLogInvariant p b j 0 lo hi s
S :
2*∑ i ∈ range j, (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ)
t :
powerLogCode.run (if 0 < b then 8 else 7) s
t.1 = 51
t.2.2 = false
t.2.1 0 = p
t.2.1 1 = (if 0 < b then S else 0)
t.2.1 2 = b
t.2.1 3 = lo
t.2.1 4 = hi
Proof (Lean source)
-- @node: powerLogCode_before_halt_exit lemma powerLogCode_before_halt_exit (p b j : ℕ) (lo hi : ℚ) (s : RationalState) (h : PowerLogInvariant p b j 0 lo hi s) : let S := 2*∑ i ∈ range j, (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ) let t := powerLogCode.run (if 0 < b then 8 else 7) s t.1 = 51 ∧ t.2.2 = false ∧ t.2.1 0 = p ∧ t.2.1 1 = (if 0 < b then S else 0) ∧ t.2.1 2 = b ∧ t.2.1 3 = lo ∧ t.2.1 4 = hi := by rcases h with ⟨hp, ha, hc, hi', hz, ht, hs, hb, h1, h2, hr, h0, hq, hl, hu, hb'⟩ by_cases hpos : 0 < b · have hn : ¬ s.2.1 7 ≤ s.2.1 12 := by rw [hb, h0]; exact not_le.mpr (by exact_mod_cast hpos) rw [h0] at hn generalize he : powerLogCode.run (if 0 < b then 8 else 7) s = t norm_num [hpos, powerLogCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, h0, hn] at he subst t norm_num [Function.update_apply, hs, h2, hq, hl, hu, hb', hpos] ring · have hn : s.2.1 7 ≤ s.2.1 12 := by rw [hb, h0]; exact_mod_cast (le_of_not_gt hpos) rw [h0] at hn generalize he : powerLogCode.run (if 0 < b then 8 else 7) s = t norm_num [hpos, powerLogCode, RationalProgram.run, RationalProgram.step, Function.update_apply, hp, ha, hc, h0, hn] at he subst t norm_num [Function.update_apply, hs, h2, hq, hl, hu, hb', hpos]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_before_halt_exit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:19
theorem powerLogCode_before_halt_loop

Every logarithm term is evaluated before reaching the active final frame. Under the stated assumptions.

Formal statement
p b j N :
ℕ
lo hi :
ℚ
h :
PowerLogInvariant p b j N lo hi s
S :
2*∑ i ∈ range (j+N), (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ)
t :
powerLogCode.run (7*N+(if 0 < b then 8 else 7)) s
t.1 = 51
t.2.2 = false
t.2.1 0 = p
t.2.1 1 = (if 0 < b then S else 0)
t.2.1 2 = b
t.2.1 3 = lo
t.2.1 4 = hi
Proof (Lean source)
-- @node: powerLogCode_before_halt_loop lemma powerLogCode_before_halt_loop (p b j N : ℕ) (lo hi : ℚ) (s : RationalState) (h : PowerLogInvariant p b j N lo hi s) : let S := 2*∑ i ∈ range (j+N), (((b : ℚ)-1)/((b : ℚ)+1))^(2*i+1)/(2*i+1 : ℕ) let t := powerLogCode.run (7*N+(if 0 < b then 8 else 7)) s t.1 = 51 ∧ t.2.2 = false ∧ t.2.1 0 = p ∧ t.2.1 1 = (if 0 < b then S else 0) ∧ t.2.1 2 = b ∧ t.2.1 3 = lo ∧ t.2.1 4 = hi := by induction N generalizing j s with | zero => simpa using powerLogCode_before_halt_exit p b j lo hi s h | succ N ih => rw [show 7*(N+1)+(if 0 < b then 8 else 7) = 7+(7*N+(if 0 < b then 8 else 7)) by omega, rationalProgram_run_add] simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ih (j+1) _ (powerLogCode_round p b j N lo hi s h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_before_halt_loop · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:48
theorem powerLogCode_before_halt

[The logarithm midpoint and both exponents are ready before the final halt. the stated conclusion holds.

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
L :
t :
powerLogCode.run (powerLogFuel xs-(if 0 < b then 1 else 2)) (RationalProgram.initial xs)
t.1 = 51
t.2.2 = false
t.2.1 0 = p
t.2.1 1 = (L.lo+L.hi)/2
t.2.1 2 = b
t.2.1 3 = xs[2]?.getD 0
t.2.1 4 = xs[3]?.getD 0
Proof (Lean source)
-- @node: powerLogCode_before_halt lemma powerLogCode_before_halt (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let p := powerRegisterPrecision q b let L := paperLogScalar p b let t := powerLogCode.run (powerLogFuel xs-(if 0 < b then 1 else 2)) (RationalProgram.initial xs) t.1 = 51 ∧ t.2.2 = false ∧ t.2.1 0 = p ∧ t.2.1 1 = (L.lo+L.hi)/2 ∧ t.2.1 2 = b ∧ t.2.1 3 = xs[2]?.getD 0 ∧ t.2.1 4 = xs[3]?.getD 0 := by have h := powerLogCode_before_halt_loop _ _ 0 _ _ _ _ (powerLogCode_initial xs) dsimp only [powerLogFuel] rw [show ∀ N : ℕ, 45+7*N-(if 0 < (⌊xs[1]?.getD 0⌋ : ℤ).toNat then 1 else 2) = 36+(7*N+(if 0 < (⌊xs[1]?.getD 0⌋ : ℤ).toNat then 8 else 7)) by intro N; split <;> omega, rationalProgram_run_add] simpa only [zero_add, paperLogScalar_midpoint, logPolynomial, Nat.cast_pos] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogCode_before_halt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:64

Exact active-prefix length, including the shorter totalized zero-base branch.

Definition (Lean source)
xs :
List ℚ
powerLogActiveFuel xs :
ℕ
powerLogFuel xs-(if 0 < (⌊xs[1]?.getD 0⌋ : ℤ).toNat then 1 else 2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerLogActiveFuel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:82

The logarithm and exponential-to-clipping code form one literal instruction list.

Definition (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:87
theorem powerScalarCode_connect

The active logarithm halt jumps directly to the relocated power continuation. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hp :
s.1 = 51
ha :
s.2.2 = false
powerScalarCode.step s = rationalState_relocate powerLogCode.length (0,s.2.1,false)
Proof (Lean source)
-- @node: powerScalarCode_connect lemma powerScalarCode_connect (s : RationalState) (hp : s.1 = 51) (ha : s.2.2 = false) : powerScalarCode.step s = rationalState_relocate powerLogCode.length (0,s.2.1,false) := by have hlen : powerLogCode.length = 52 := by rfl have hlookup : powerLogCode[51]? = some .halt := by rfl simp only [powerScalarCode, rationalProgram_continue, RationalProgram.step, ha, Bool.false_eq_true, ↓reduceIte, hp, List.getElem?_append, List.length_map, hlen, show 51 < 52 by omega, ↓reduceIte, List.getElem?_map, hlookup, Option.map_some, rationalInstruction_continue, rationalState_relocate, Nat.add_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_connect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:92

Exact step count of the joined scalar computation on arbitrary rational inputs.

Definition (Lean source)
xs :
List ℚ
powerScalarFuel xs :
ℕ
t :
powerLogCode.run (powerLogActiveFuel xs) (RationalProgram.initial xs)
theorem powerScalarCode_result

The fused literal program halts and returns the specified clipped scalar bracket. The logarithm and exponential contracts here are evaluation identities, not assumptions. the documented result

Formal statement
xs :
List ℚ
q :
(⌊xs[0]?.getD 0⌋ : ℤ).toNat
b :
(⌊xs[1]?.getD 0⌋ : ℤ).toNat
v :
xs[2]?.getD 0
t :
powerScalarCode.run (powerScalarFuel xs) (RationalProgram.initial xs)
t.2.2 = true
rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v
Proof (Lean source)
-- @node: powerScalarCode_result lemma powerScalarCode_result (xs : List ℚ) : let q := (⌊xs[0]?.getD 0⌋ : ℤ).toNat let b := (⌊xs[1]?.getD 0⌋ : ℤ).toNat let v := xs[2]?.getD 0 let t := powerScalarCode.run (powerScalarFuel xs) (RationalProgram.initial xs) t.2.2 = true ∧ rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v := by have h := powerLogCode_before_halt xs dsimp only at h rw [← powerLogActiveFuel] at h dsimp only [powerScalarFuel] rw [rationalProgram_run_add, rationalProgram_run_add] have hrun := rationalProgram_continue_run powerLogCode powerExpClipCode (powerLogActiveFuel xs) (RationalProgram.initial xs) h.2.1 change powerScalarCode.run _ _ = _ at hrun rw [hrun] generalize he : powerLogCode.run (powerLogActiveFuel xs) (RationalProgram.initial xs) = t at h ⊢ obtain ⟨htp, hta, hq, hmid, hb, hv, hright⟩ := h rw [show powerScalarCode.run 1 t = powerScalarCode.step t by rfl, powerScalarCode_connect t htp hta] rw [show powerScalarCode = rationalProgram_continue powerLogCode powerExpClipCode by rfl, rationalProgram_continue_tail] have hout := powerExpClipCode_result (0,t.2.1,false) rfl rfl dsimp only at hout simp only [hq, hmid, hb, hv, Int.floor_natCast, Int.toNat_natCast] at hout dsimp only [rationalState_relocate] generalize ht : powerExpClipCode.run (powerExpClipFuel (0,t.2.1,false)) (0,t.2.1,false) = u at hout ⊢ refine ⟨hout.1, ?_⟩ rw [hout.2] exact (paperPowerScalar_eq_powerClipBox _ _ _).symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_result · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:110
theorem powerScalarCode_certificate

Natural precision and base inputs recover the exact paper scalar formula. the stated conclusion holds.

Formal statement
q b :
ℕ
v w :
ℚ
t :
powerScalarCode.run (powerScalarFuel [q,b,v,w]) (RationalProgram.initial [q,b,v,w])
t.2.2 = true
rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v
Proof (Lean source)
-- @node: powerScalarCode_certificate lemma powerScalarCode_certificate (q b : ℕ) (v w : ℚ) : let t := powerScalarCode.run (powerScalarFuel [q,b,v,w]) (RationalProgram.initial [q,b,v,w]) t.2.2 = true ∧ rationalBox (t.2.1 0) (t.2.1 1) = paperPowerScalar q b v := by simpa only [List.getElem?_cons_zero, List.getElem?_cons_succ, Option.getD_some, Int.floor_natCast, Int.toNat_natCast] using powerScalarCode_result [(q : ℚ),b,v,w]
CausalSmith.Stat.LogoddsLowsmoothFrontier.powerScalarCode_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/PowerScalarFusion.lean:144
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ProjectionApproximation 10 declarations Adapter for the public cosine-projection approximation theorem

Adapter for the public cosine-projection approximation theorem

def covariateExtension

Extend a function on the covariate subtype to the real line. Only its values on [0,1] are used by the study definitions.

Definition (Lean source)
f :
Covariate → ℝ
x :
ℝ
covariateExtension f x :
ℝ
if hx : x ∈ Icc (0 : ℝ) 1 then f ⟨x, hx⟩ else 0
theorem covariateExtension_apply

The covariate Extension apply result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
Covariate → ℝ
x :
Proof (Lean source)
@[simp] lemma covariateExtension_apply (f : Covariate → ℝ) (x : Covariate) : covariateExtension f x = f x := by simp [covariateExtension, x.property]
CausalSmith.Stat.LogoddsLowsmoothFrontier.covariateExtension_apply · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:17
theorem covariateExtension_continuousOn

The covariate Extension continuous On result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions. Under the stated assumptions.

Formal statement
f :
Covariate → ℝ
hf :
Proof (Lean source)
lemma covariateExtension_continuousOn {f : Covariate → ℝ} (hf : Continuous f) : ContinuousOn (covariateExtension f) (Icc (0 : ℝ) 1) := by rw [continuousOn_iff_continuous_domRestrict] convert hf using 1 funext x exact covariateExtension_apply f x
CausalSmith.Stat.LogoddsLowsmoothFrontier.covariateExtension_continuousOn · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:22
theorem cosineBasis_study

The cosine Basis study result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions.

Formal statement
j :
ℕ
x :
cosineBasis j x
Proof (Lean source)
lemma cosineBasis_study (j : ℕ) (x : Covariate) : cosineBasis j x = cosineBasis j x := by rfl
theorem uniformInner_basis_eq_study

The uniform Inner basis eq study result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions.

Formal statement
f :
Covariate → ℝ
j :
ℕ
Proof (Lean source)
lemma uniformInner_basis_eq_study (f : Covariate → ℝ) (j : ℕ) : uniformInner f (cosineBasis j) = cosineCoefficient (covariateExtension f) j := by unfold uniformInner cosineCoefficient uniformLaw uniformMeasure rw [← integral_subtype_comap measurableSet_Icc] apply integral_congr_ae filter_upwards with x rw [covariateExtension_apply, cosineBasis_study]
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformInner_basis_eq_study · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:36
theorem cosineProjection_study

The cosine Projection study result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
f :
Covariate → ℝ
x :
cosineProjection k f x
Proof (Lean source)
lemma cosineProjection_study (k : ℕ) (f : Covariate → ℝ) (x : Covariate) : cosineProjection k f x = cosineProjection k (covariateExtension f) x := by unfold cosineProjection cosineProjection cosinePolynomial apply Finset.sum_congr rfl intro j hj rw [uniformInner_basis_eq_study] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineProjection_study · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:50
theorem holderSeminorm_study

The holder Seminorm study result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions.

Formal statement
gamma :
ℝ
f :
Covariate → ℝ
holderSeminorm gamma f
Proof (Lean source)
lemma holderSeminorm_study (gamma : ℝ) (f : Covariate → ℝ) : holderSeminorm gamma f = holderSeminorm (covariateExtension f) gamma := by unfold holderSeminorm holderSeminorm congr 1 funext x congr 1 funext z simp only [covariateExtension_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.holderSeminorm_study · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:63
theorem uniformL2Norm_study

The uniform L2 Norm study result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions.

Formal statement
g :
Covariate → ℝ
Proof (Lean source)
lemma uniformL2Norm_study (g : Covariate → ℝ) : uniformL2Norm g = extendedL2Norm (covariateExtension g) := by unfold uniformL2Norm extendedL2Norm uniformLaw uniformMeasure congr 1 rw [← lintegral_subtype_comap measurableSet_Icc] apply lintegral_congr intro x rw [covariateExtension_apply, sq_abs]
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformL2Norm_study · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:76
theorem study_extendedL2Norm_congr_Icc

The study extended L2 Norm congr Icc result states the corresponding mathematical identity, bound, or structural property Under the stated assumptions. Under the stated assumptions.

Formal statement
g h :
ℝ → ℝ
heq :
∀ x ∈ Icc (0 : ℝ) 1, g x = h x
Proof (Lean source)
lemma study_extendedL2Norm_congr_Icc {g h : ℝ → ℝ} (heq : ∀ x ∈ Icc (0 : ℝ) 1, g x = h x) : extendedL2Norm g = extendedL2Norm h := by unfold extendedL2Norm uniformMeasure congr 1 apply setLIntegral_congr_fun measurableSet_Icc intro x hx dsimp only rw [heq x hx]
CausalSmith.Stat.LogoddsLowsmoothFrontier.study_extendedL2Norm_congr_Icc · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:91
theorem cosineProjection_error_le_holderSeminorm

[The public constant-five theorem, transported to the run's subtype and uniform-design definitions without assuming a finite Hölder seminorm. the documented result Under the stated assumptions.

Formal statement
gamma :
ℝ
f :
Covariate → ℝ
hgamma :
k :
ℕ
hk :
1 ≤ k
uniformL2Norm (fun x => f x - cosineProjection k f x)
≤ 5 * holderSeminorm gamma f * ofReal ((k : ℝ) ^ (-gamma))
Proof (Lean source)
lemma cosineProjection_error_le_holderSeminorm (gamma : ℝ) (f : Covariate → ℝ) (hgamma : HolderExponentDomain gamma) (hf : ContinuousFunctionDomain f) (k : ℕ) (hk : 1 ≤ k) : uniformL2Norm (fun x => f x - cosineProjection k f x) ≤ 5 * holderSeminorm gamma f * ofReal ((k : ℝ) ^ (-gamma)) := by have h := cosineProjection_error_le_seminorm (f := covariateExtension f) (γ := gamma) (k := k) (covariateExtension_continuousOn hf) hgamma.1 hgamma.2 hk rw [← holderSeminorm_study] at h rw [uniformL2Norm_study] rw [study_extendedL2Norm_congr_Icc (g := covariateExtension (fun x => f x - cosineProjection k f x)) (h := fun x => covariateExtension f x - cosineProjection k (covariateExtension f) x) (by intro x hx simp [covariateExtension, hx] exact cosineProjection_study k f ⟨x, hx⟩)] exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineProjection_error_le_holderSeminorm · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionApproximation.lean:105
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ProjectionCrossMoments 12 declarations Integrating out a residual coordinate makes its product with any square-integrable one-record function vanish.

Cross moments of the projection residual

Integrating out a residual coordinate makes its product with any square-integrable one-record function vanish. These identities cover either shared record, and an independent third record, in the first-order/residual covariance expansion.

theorem projectionResidual_memLp

Square integrability of the degenerate residual as a function of two records. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
MemLp (fun z : Record × Record => projectionResidual P W V k z.1 z.2) 2 (P.measure.prod P.measure)
Proof (Lean source)
-- @node: projectionResidual_memLp lemma projectionResidual_memLp (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : MemLp (fun z : Record × Record => projectionResidual P W V k z.1 z.2) 2 (P.measure.prod P.measure) := by exact (memLp_two_iff_integrable_sq (projectionResidual_measurable P hDesign W V k).aestronglyMeasurable).mpr (projectionResidual_sq_integrable P hDesign W V k)
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_memLp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:16
theorem projectionResidual_cross_fst

A square-integrable function of the first record is orthogonal to the residual. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
f :
Record → ℝ
hfm :
hf :
MemLp f 2 P.measure
(∫ z : Record × Record, f z.1 * projectionResidual P W V k z.1 z.2 ∂(P.measure.prod P.measure))
= 0
Proof (Lean source)
-- @node: projectionResidual_cross_fst lemma projectionResidual_cross_fst (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) (f : Record → ℝ) (hfm : Measurable f) (hf : MemLp f 2 P.measure) : (∫ z : Record × Record, f z.1 * projectionResidual P W V k z.1 z.2 ∂(P.measure.prod P.measure)) = 0 := by have hfst : MemLp (fun z : Record × Record => f z.1) 2 (P.measure.prod P.measure) := (memLp_two_iff_integrable_sq (hfm.comp measurable_fst).aestronglyMeasurable).mpr (((memLp_two_iff_integrable_sq hfm.aestronglyMeasurable).mp hf).comp_fst P.measure) have hi : Integrable (fun z : Record × Record => f z.1 * projectionResidual P W V k z.1 z.2) (P.measure.prod P.measure) := hfst.integrable_mul (projectionResidual_memLp P hDesign W V k) rw [integral_prod _ hi] simp_rw [integral_const_mul, projectionResidual_integral_right P hDesign W V k, mul_zero] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_cross_fst · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:26
theorem projectionResidual_cross_snd

A square-integrable function of the second record is orthogonal to the residual. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
f :
Record → ℝ
hfm :
hf :
MemLp f 2 P.measure
(∫ z : Record × Record, f z.2 * projectionResidual P W V k z.1 z.2 ∂(P.measure.prod P.measure))
= 0
Proof (Lean source)
-- @node: projectionResidual_cross_snd lemma projectionResidual_cross_snd (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) (f : Record → ℝ) (hfm : Measurable f) (hf : MemLp f 2 P.measure) : (∫ z : Record × Record, f z.2 * projectionResidual P W V k z.1 z.2 ∂(P.measure.prod P.measure)) = 0 := by have hsnd : MemLp (fun z : Record × Record => f z.2) 2 (P.measure.prod P.measure) := (memLp_two_iff_integrable_sq (hfm.comp measurable_snd).aestronglyMeasurable).mpr (((memLp_two_iff_integrable_sq hfm.aestronglyMeasurable).mp hf).comp_snd P.measure) have hi : Integrable (fun z : Record × Record => f z.2 * projectionResidual P W V k z.1 z.2) (P.measure.prod P.measure) := hsnd.integrable_mul (projectionResidual_memLp P hDesign W V k) rw [integral_prod_symm _ hi] simp_rw [integral_const_mul, projectionResidual_integral_left P hDesign W V k, mul_zero] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_cross_snd · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:45
theorem projectionResidual_integral

The residual has zero population mean. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ z : Record × Record, projectionResidual P W V k z.1 z.2 ∂(P.measure.prod P.measure))
= 0
Proof (Lean source)
-- @node: projectionResidual_integral lemma projectionResidual_integral (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ z : Record × Record, projectionResidual P W V k z.1 z.2 ∂(P.measure.prod P.measure)) = 0 := by rw [integral_prod _ ((projectionResidual_memLp P hDesign W V k).integrable (by norm_num))] simp_rw [projectionResidual_integral_right P hDesign W V k] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:64
theorem projectionResidual_cross_independent

A third independent record also gives zero cross moment with the residual. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
f :
Record → ℝ
(∫ z : Record × (Record × Record), f z.1 * projectionResidual P W V k z.2.1 z.2.2 ∂(P.measure.prod (P.measure.prod P.measure)))
= 0
Proof (Lean source)
-- @node: projectionResidual_cross_independent lemma projectionResidual_cross_independent (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) (f : Record → ℝ) : (∫ z : Record × (Record × Record), f z.1 * projectionResidual P W V k z.2.1 z.2.2 ∂(P.measure.prod (P.measure.prod P.measure))) = 0 := by rw [integral_prod_mul f (fun z : Record × Record => projectionResidual P W V k z.1 z.2), projectionResidual_integral P hDesign W V k, mul_zero]
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_cross_independent · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:75
theorem projection_pair_map

Distinct sample coordinates have the product record law. Under the stated assumptions.

Formal statement
n :
ℕ
Fin n
hij :
i ≠ j
(iidLaw P.measure n).map (fun o => (o i, o j))
= P.measure.prod P.measure
Proof (Lean source)
-- @node: projection_pair_map lemma projection_pair_map (P : ObservedLaw) {n : ℕ} {i j : Fin n} (hij : i ≠ j) : (Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n).map (fun o => (o i, o j)) = P.measure.prod P.measure := by let μ := Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n letI : IsProbabilityMeasure μ := by dsimp [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] infer_instance have hcoord : iIndepFun (fun a : Fin n => fun o : Fin n → Record => o a) μ := by dsimp [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] simpa using (iIndepFun_pi (μ := fun _ : Fin n => P.measure) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have h := (hcoord.indepFun hij).map_prod_eq_prod_map_map (measurable_pi_apply i).aemeasurable (measurable_pi_apply j).aemeasurable simpa only [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw, (measurePreserving_eval (fun _ : Fin n => P.measure) i).map_eq, (measurePreserving_eval (fun _ : Fin n => P.measure) j).map_eq] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.projection_pair_map · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:85
theorem projectionResidual_finite_memLp

A residual pair is square integrable in the finite experiment. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
Fin n
hij :
i ≠ j
MemLp (fun o : Fin n → Record => projectionResidual P W V k (o i) (o j)) 2 (iidLaw P.measure n)
Proof (Lean source)
-- @node: projectionResidual_finite_memLp lemma projectionResidual_finite_memLp (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) {i j : Fin n} (hij : i ≠ j) : MemLp (fun o : Fin n → Record => projectionResidual P W V k (o i) (o j)) 2 (iidLaw P.measure n) := by have hm := projectionResidual_measurable P hDesign W V k have hp : MeasurePreserving (fun o : Fin n → Record => (o i, o j)) (iidLaw P.measure n) (P.measure.prod P.measure) := ⟨by fun_prop, projection_pair_map P hij⟩ simpa only [Function.comp_def, Function.eval, iidLaw] using (projectionResidual_memLp P hDesign W V k).comp_measurePreserving hp
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_finite_memLp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:104
theorem projectionResidual_finite_cross

Every one-record term has zero cross moment with a distinct residual pair. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
f :
Record → ℝ
hfm :
hf :
MemLp f 2 P.measure
a i j :
Fin n
hij :
i ≠ j
(∫ o : Fin n → Record, f (o a) * projectionResidual P W V k (o i) (o j) ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= 0
Proof (Lean source)
-- @node: projectionResidual_finite_cross lemma projectionResidual_finite_cross (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (f : Record → ℝ) (hfm : Measurable f) (hf : MemLp f 2 P.measure) (a i j : Fin n) (hij : i ≠ j) : (∫ o : Fin n → Record, f (o a) * projectionResidual P W V k (o i) (o j) ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = 0 := by let μ := Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n letI : IsProbabilityMeasure μ := by dsimp [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] infer_instance have hm := projectionResidual_measurable P hDesign W V k by_cases hai : a = i · subst a have hF : Measurable (fun z : Record × Record => f z.1 * projectionResidual P W V k z.1 z.2) := by fun_prop have h := integral_map (μ := μ) (φ := fun o : Fin n → Record => (o i, o j)) (by fun_prop) hF.aestronglyMeasurable rw [projection_pair_map P hij] at h exact h.symm.trans (projectionResidual_cross_fst P hDesign W V k f hfm hf) by_cases haj : a = j · subst a have hF : Measurable (fun z : Record × Record => f z.2 * projectionResidual P W V k z.1 z.2) := by fun_prop have h := integral_map (μ := μ) (φ := fun o : Fin n → Record => (o i, o j)) (by fun_prop) hF.aestronglyMeasurable rw [projection_pair_map P hij] at h exact h.symm.trans (projectionResidual_cross_snd P hDesign W V k f hfm hf) · have hcoord : iIndepFun (fun b : Fin n => fun o : Fin n → Record => o b) μ := by dsimp [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] simpa using (iIndepFun_pi (μ := fun _ : Fin n => P.measure) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hind := hcoord.indepFun_prodMk (fun b => measurable_pi_apply b) i j a (Ne.symm hai) (Ne.symm haj) have hmap : μ.map (fun o : Fin n → Record => (o a, (o i, o j))) = P.measure.prod (P.measure.prod P.measure) := by have h := hind.symm.map_prod_eq_prod_map_map (measurable_pi_apply a).aemeasurable ((measurable_pi_apply i).prodMk (measurable_pi_apply j)).aemeasurable rw [projection_pair_map P hij] at h simpa only [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw, (measurePreserving_eval (fun _ : Fin n => P.measure) a).map_eq] using h have hF : Measurable (fun z : Record × (Record × Record) => f z.1 * projectionResidual P W V k z.2.1 z.2.2) := by fun_prop have h := integral_map (μ := μ) (φ := fun o : Fin n → Record => (o a, (o i, o j))) (by fun_prop) hF.aestronglyMeasurable rw [hmap] at h exact h.symm.trans (projectionResidual_cross_independent P hDesign W V k f)
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_finite_cross · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:118
theorem projectionFirst_finite_memLp

The first-order finite sum is square integrable. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
MemLp (fun o : Fin n → Record => 2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k)) 2 (iidLaw P.measure n)
Proof (Lean source)
-- @node: projectionFirst_finite_memLp lemma projectionFirst_finite_memLp (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) : MemLp (fun o : Fin n → Record => 2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k)) 2 (iidLaw P.measure n) := by classical have hi (i : Fin n) : MemLp (fun o : Fin n → Record => projectionFirst P W V k (o i) - projectionMean P W V k) 2 (iidLaw P.measure n) := by simpa only [Function.comp_def, Function.eval, iidLaw] using (projectionFirst_centered_memLp P hDesign W V k).comp_measurePreserving (measurePreserving_eval (fun _ : Fin n => P.measure) i) exact (memLp_finsetSum _ (fun i _ => hi i)).const_mul _
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_finite_memLp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:171
theorem projectionResidual_average_memLp

The residual average is square integrable in the finite experiment. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
MemLp (fun o : Fin n → Record => ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2)) 2 (iidLaw P.measure n)
Proof (Lean source)
-- @node: projectionResidual_average_memLp lemma projectionResidual_average_memLp (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) : MemLp (fun o : Fin n → Record => ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2)) 2 (iidLaw P.measure n) := by classical exact (memLp_finsetSum _ (fun ij hij => projectionResidual_finite_memLp P hDesign W V k n (Finset.mem_offDiag.mp hij).2.2)).const_mul _
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_average_memLp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:188
theorem projection_hoeffding_cross

The two finite Hoeffding components are orthogonal. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
(∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k)) * (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2)) ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= 0
Proof (Lean source)
-- @node: projection_hoeffding_cross lemma projection_hoeffding_cross (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) : (∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k)) * (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2)) ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = 0 := by classical let f := fun x => projectionFirst P W V k x - projectionMean P W V k let μ := iidLaw P.measure n let s := (Finset.univ : Finset (Fin n)).offDiag have hfm : Measurable f := (projectionFirst_measurable P hDesign W V k).sub_const _ have hf : MemLp f 2 P.measure := projectionFirst_centered_memLp P hDesign W V k have hfi (i : Fin n) : MemLp (fun o : Fin n → Record => f (o i)) 2 μ := by simpa only [Function.comp_def, Function.eval, μ, iidLaw] using hf.comp_measurePreserving (measurePreserving_eval (fun _ : Fin n => P.measure) i) have hi (a : Fin n) (ij : Fin n × Fin n) (hij : ij ∈ s) : Integrable (fun o : Fin n → Record => f (o a) * projectionResidual P W V k (o ij.1) (o ij.2)) μ := (hfi a).integrable_mul (projectionResidual_finite_memLp P hDesign W V k n (Finset.mem_offDiag.mp hij).2.2) have he (o : Fin n → Record) : (2 / (n : ℝ) * ∑ i, f (o i)) * (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ s, projectionResidual P W V k (o ij.1) (o ij.2)) = (2 / (n : ℝ) * ((n : ℝ) * ((n : ℝ) - 1))⁻¹) * ∑ a, ∑ ij ∈ s, f (o a) * projectionResidual P W V k (o ij.1) (o ij.2) := by simp_rw [← Finset.mul_sum] rw [← Finset.sum_mul] ring change (∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, f (o i)) * (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ s, projectionResidual P W V k (o ij.1) (o ij.2)) ∂μ) = 0 simp_rw [he] rw [integral_const_mul, integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun ij hij => hi a ij hij))] have hz (a : Fin n) : (∫ o : Fin n → Record, ∑ ij ∈ s, f (o a) * projectionResidual P W V k (o ij.1) (o ij.2) ∂μ) = 0 := by rw [integral_finsetSum _ (fun ij hij => hi a ij hij)] apply Finset.sum_eq_zero intro ij hij exact projectionResidual_finite_cross P hDesign W V k n f hfm hf a ij.1 ij.2 (Finset.mem_offDiag.mp hij).2.2 simp_rw [hz] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.projection_hoeffding_cross · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:200
theorem projectionStatistic_variance_le

Exact orthogonality assembles the sharp finite-sample variance bound. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
hn :
2 ≤ n
(∫ o : Fin n → Record, (projectionStatistic n k W.value V.value o - ∫ p, projectionStatistic n k W.value V.value p ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
≤ 4 / (n : ℝ) + 2 * k / ((n : ℝ) * ((n : ℝ) - 1))
Proof (Lean source)
-- @node: projectionStatistic_variance_le lemma projectionStatistic_variance_le (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) : (∫ o : Fin n → Record, (projectionStatistic n k W.value V.value o - ∫ p, projectionStatistic n k W.value V.value p ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) ≤ 4 / (n : ℝ) + 2 * k / ((n : ℝ) * ((n : ℝ) - 1)) := by classical let μ := iidLaw P.measure n let L := fun o : Fin n → Record => 2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k) let R := fun o : Fin n → Record => ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2) have hLm : MemLp L 2 μ := projectionFirst_finite_memLp P hDesign W V k n have hRm : MemLp R 2 μ := projectionResidual_average_memLp P hDesign W V k n have hLs : Integrable (fun o => (L o)^2) μ := (memLp_two_iff_integrable_sq hLm.aestronglyMeasurable).mp hLm have hRs : Integrable (fun o => (R o)^2) μ := (memLp_two_iff_integrable_sq hRm.aestronglyMeasurable).mp hRm have hLR : Integrable (fun o => L o * R o) μ := hLm.integrable_mul hRm have hcross : (∫ o, L o * R o ∂μ) = 0 := projection_hoeffding_cross P hDesign W V k n have hLbound : (∫ o, (L o)^2 ∂μ) ≤ 4 / (n : ℝ) := projectionFirst_finite_secondMoment_le P hDesign W V k n hn have hRbound : (∫ o, (R o)^2 ∂μ) ≤ 2 * k / ((n : ℝ) * ((n : ℝ) - 1)) := projectionResidual_finite_secondMoment_le P hDesign W V k n hn rw [projectionStatistic_integral P hDesign W V k n hn] change (∫ o, (projectionStatistic n k W.value V.value o - projectionMean P W V k)^2 ∂μ) ≤ _ simp_rw [projectionStatistic_hoeffding P W V k n hn] change (∫ o, (L o + R o)^2 ∂μ) ≤ _ have hexpand (o : Fin n → Record) : (L o + R o)^2 = (L o)^2 + (R o)^2 + 2 * (L o * R o) := by ring simp_rw [hexpand] integral_linearity rw [hcross, mul_zero, add_zero] exact add_le_add hLbound hRbound
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic_variance_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionCrossMoments.lean:250
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ProjectionMoments 20 declarations Disintegration and iid coordinate transport give the exact mean and bias.

Projection statistic moments

Disintegration and iid coordinate transport give the exact mean and bias. The first uncentered projection has squared energy at most one, and the symmetric kernel has squared energy at most its rank.

Every subtype cosine mode is continuous. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
j :
ℕ
Continuous (cosineBasis j)
Proof (Lean source)
-- @node: cosineBasis_continuous @[fun_prop] lemma cosineBasis_continuous (j : ℕ) : Continuous (cosineBasis j) := by unfold cosineBasis split_ifs <;> fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineBasis_continuous · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:18
theorem integral_observed_cells_borel

Borel tests integrate through the four-cell law whenever their weighted slices are integrable. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hDesign :
f :
Record → ℝ
hf :
hi :
∀ a y, Integrable (fun x => P.cells a y x * f (x,a,y)) uniformLaw
(∫ o, f o ∂P.measure) = ∑ a : Bool, ∑ y : Bool, ∫ x, P.cells a y x * f (x,a,y) ∂uniformLaw
Proof (Lean source)
-- @node: integral_observed_cells_borel lemma integral_observed_cells_borel (P : ObservedLaw) (hDesign : UniformDesign P) (f : Record → ℝ) (hf : Measurable f) (hi : ∀ a y, Integrable (fun x => P.cells a y x * f (x,a,y)) uniformLaw) : (∫ o, f o ∂P.measure) = ∑ a : Bool, ∑ y : Bool, ∫ x, P.cells a y x * f (x,a,y) ∂uniformLaw := by have hm (a y : Bool) : Measurable (fun x => ofReal (P.cells a y x)) := ENNReal.measurable_ofReal.comp (P.continuous_cells a y).measurable have hi' (a y : Bool) : Integrable f (Measure.map (fun x : Covariate => (x,a,y)) (uniformLaw.withDensity (fun x => ofReal (P.cells a y x)))) := by apply (integrable_map_measure hf.aestronglyMeasurable (by fun_prop)).2 apply (integrable_withDensity_iff_integrable_smul' (hm a y) (Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))).2 simpa only [ENNReal.toReal_ofReal (P.interior_cells a y _).1.le, smul_eq_mul, Function.comp_def] using hi a y rw [P.disintegration, hDesign] unfold jointLaw rw [integral_finsetSum_measure] · apply Finset.sum_congr rfl intro a ha rw [integral_finsetSum_measure (fun y _ => hi' a y)] apply Finset.sum_congr rfl intro y hy rw [integral_map (by fun_prop) hf.aestronglyMeasurable, integral_withDensity_eq_integral_toReal_smul (hm a y) (Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))] simp only [ENNReal.toReal_ofReal (P.interior_cells a y _).1.le, smul_eq_mul] · intro a ha exact integrable_finsetSum_measure.2 (fun y _ => hi' a y)
CausalSmith.Stat.LogoddsLowsmoothFrontier.integral_observed_cells_borel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:25
theorem boundedMark_integral_covariate

Disintegration identifies the design-weighted mean of every Borel bounded mark. Under the stated assumptions.

Formal statement
hDesign :
g :
Covariate → ℝ
hg :
(∫ o, W.value o * g (covariate o) ∂P.measure) = uniformInner (conditionalMarkMean P W) g
Proof (Lean source)
-- @node: boundedMark_integral_covariate lemma boundedMark_integral_covariate (P : ObservedLaw) (hDesign : UniformDesign P) (W : BoundedMark) (g : Covariate → ℝ) (hg : Measurable g) (hgi : Integrable g uniformLaw) : (∫ o, W.value o * g (covariate o) ∂P.measure) = uniformInner (conditionalMarkMean P W) g := by have hm := W.measurable_value have hi (a y : Bool) : Integrable (fun x => P.cells a y x * (W.value (x,a,y) * g x)) uniformLaw := by have hw : Measurable (fun x : Covariate => P.cells a y x * W.value (x,a,y)) := by have hc := (P.continuous_cells a y).measurable fun_prop have hb : ∀ x : Covariate, ‖P.cells a y x * W.value (x,a,y)‖ ≤ (1 : ℝ) := by intro x rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (P.interior_cells a y x).1.le (W.range_value _).1)] exact (mul_le_of_le_one_right (P.interior_cells a y x).1.le (W.range_value _).2).trans (P.interior_cells a y x).2.le exact (hgi.bdd_mul (c := 1) hw.aestronglyMeasurable (Filter.Eventually.of_forall hb)).congr (Filter.Eventually.of_forall (fun x => by ring)) rw [integral_observed_cells_borel P hDesign _ (by unfold covariate; fun_prop) hi] unfold uniformInner conditionalMarkMean simp_rw [Finset.sum_mul] rw [integral_finsetSum _ (fun a ha => integrable_finsetSum _ (fun y hy => (hi a y).congr (Filter.Eventually.of_forall (fun x => by ring))))] apply Finset.sum_congr rfl intro a ha rw [integral_finsetSum _ (fun y hy => (hi a y).congr (Filter.Eventually.of_forall (fun x => by ring)))] apply Finset.sum_congr rfl intro y hy congr 1 funext x simp only [covariate] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.boundedMark_integral_covariate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:56
theorem boundedMark_mul_continuous_integrable

Products of a Borel bounded mark and a continuous record function are integrable. Under the stated assumptions.

Formal statement
g :
Record → ℝ
hg :
Integrable (fun o => W.value o * g o) P.measure
Proof (Lean source)
-- @node: boundedMark_mul_continuous_integrable lemma boundedMark_mul_continuous_integrable (P : ObservedLaw) (W : BoundedMark) (g : Record → ℝ) (hg : Continuous g) : Integrable (fun o => W.value o * g o) P.measure := by apply (hg.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)).bdd_mul (c := 1) W.measurable_value.aestronglyMeasurable filter_upwards [] with o rw [Real.norm_eq_abs, abs_of_nonneg (W.range_value o).1] exact (W.range_value o).2
CausalSmith.Stat.LogoddsLowsmoothFrontier.boundedMark_mul_continuous_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:94
theorem projectionKernel_mark_integral

Integrating one asymmetric kernel slice gives the projected conditional mark mean. Under the stated assumptions.

Formal statement
hDesign :
k :
ℕ
x :
(∫ p, projectionKernel k x (covariate p) * V.value p ∂P.measure)
= cosineProjection k (conditionalMarkMean P V) x
Proof (Lean source)
-- @node: projectionKernel_mark_integral lemma projectionKernel_mark_integral (P : ObservedLaw) (hDesign : UniformDesign P) (V : BoundedMark) (k : ℕ) (x : Covariate) : (∫ p, projectionKernel k x (covariate p) * V.value p ∂P.measure) = cosineProjection k (conditionalMarkMean P V) x := by have hc (j : ℕ) : Continuous (cosineBasis j) := by unfold cosineBasis split_ifs <;> fun_prop have hi (j : ℕ) : Integrable (fun p => cosineBasis j (covariate p) * V.value p) P.measure := by simpa only [mul_comm] using boundedMark_mul_continuous_integrable P V (fun p => cosineBasis j (covariate p)) ((hc j).comp (by unfold covariate; fun_prop)) unfold projectionKernel cosineProjection simp_rw [Finset.sum_mul] rw [integral_finsetSum _ (fun j hj => ((hi j).const_mul _).congr (Filter.Eventually.of_forall (fun p => by ring)))] apply Finset.sum_congr rfl intro j hj rw [show (fun p => cosineBasis j x * cosineBasis j (covariate p) * V.value p) = (fun p => cosineBasis j x * (V.value p * cosineBasis j (covariate p))) by funext p; ring, integral_const_mul, boundedMark_integral_covariate P hDesign V _ (hc j).measurable (cosineBasis_integrable j)] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionKernel_mark_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:105
theorem symmetricProjectionKernel_integral_right

The first uncentered Hoeffding projection is the average of the two projected marks. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
o :
(∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)
= (W.value o * cosineProjection k (conditionalMarkMean P V) (covariate o) + V.value o * cosineProjection k (conditionalMarkMean P W) (covariate o)) / 2
Proof (Lean source)
-- @node: symmetricProjectionKernel_integral_right lemma symmetricProjectionKernel_integral_right (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) (o : Record) : (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure) = (W.value o * cosineProjection k (conditionalMarkMean P V) (covariate o) + V.value o * cosineProjection k (conditionalMarkMean P W) (covariate o)) / 2 := by have hc : Continuous (fun p : Record => projectionKernel k (covariate o) (covariate p)) := by unfold projectionKernel covariate fun_prop have hi (B : BoundedMark) : Integrable (fun p => projectionKernel k (covariate o) (covariate p) * B.value p) P.measure := by simpa only [mul_comm] using boundedMark_mul_continuous_integrable P B _ hc have he (p : Record) : symmetricProjectionKernel k W.value V.value o p = (W.value o * (projectionKernel k (covariate o) (covariate p) * V.value p) + V.value o * (projectionKernel k (covariate o) (covariate p) * W.value p)) / 2 := by unfold symmetricProjectionKernel ring simp_rw [he] rw [integral_div, integral_add ((hi V).const_mul _) ((hi W).const_mul _), integral_const_mul, integral_const_mul, projectionKernel_mark_integral P hDesign V, projectionKernel_mark_integral P hDesign W]
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_integral_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:129
theorem symmetricProjectionKernel_integral

Independence and finite cosine orthogonality give the mean of the symmetric kernel. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ o, ∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure ∂P.measure)
= uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V))
Proof (Lean source)
-- @node: symmetricProjectionKernel_integral lemma symmetricProjectionKernel_integral (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ o, ∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure ∂P.measure) = uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V)) := by letI : IsProbabilityMeasure uniformLaw := hDesign ▸ Measure.isProbabilityMeasure_map (by unfold covariate; fun_prop : Measurable covariate).aemeasurable have hc (B : BoundedMark) : Continuous (cosineProjection k (conditionalMarkMean P B)) := by unfold cosineProjection fun_prop have hi (B D : BoundedMark) : Integrable (fun o => B.value o * cosineProjection k (conditionalMarkMean P D) (covariate o)) P.measure := boundedMark_mul_continuous_integrable P B _ ((hc D).comp (by unfold covariate; fun_prop)) have hp (B : BoundedMark) : Integrable (cosineProjection k (conditionalMarkMean P B)) uniformLaw := (hc B).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) simp_rw [symmetricProjectionKernel_integral_right P hDesign W V k] rw [integral_div, integral_add (hi W V) (hi V W), boundedMark_integral_covariate P hDesign W _ (hc V).measurable (hp V), boundedMark_integral_covariate P hDesign V _ (hc W).measurable (hp W), uniformInner_cosineProjection k _ _ (fun j => conditionalMarkMean_mul_integrable P W (cosineBasis_integrable j)), uniformInner_cosineProjection k _ _ (fun j => conditionalMarkMean_mul_integrable P V (cosineBasis_integrable j)), cosineProjection_uniformInner] have hs : (∑ j ∈ range k, uniformInner (conditionalMarkMean P V) (cosineBasis j) * uniformInner (conditionalMarkMean P W) (cosineBasis j)) = ∑ j ∈ range k, uniformInner (conditionalMarkMean P W) (cosineBasis j) * uniformInner (conditionalMarkMean P V) (cosineBasis j) := by apply Finset.sum_congr rfl intro j hj ring rw [hs] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:152
theorem symmetricProjectionKernel_measurable

[The symmetric marked kernel is Borel measurable on the record pair space. the documented result

Formal statement
k :
ℕ
W V :
Measurable (fun z : Record × Record => symmetricProjectionKernel k W.value V.value z.1 z.2)
Proof (Lean source)
-- @node: symmetricProjectionKernel_measurable @[fun_prop] lemma symmetricProjectionKernel_measurable (k : ℕ) (W V : BoundedMark) : Measurable (fun z : Record × Record => symmetricProjectionKernel k W.value V.value z.1 z.2) := by have hW := W.measurable_value have hV := V.measurable_value unfold symmetricProjectionKernel projectionKernel covariate fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:190
theorem symmetricProjectionKernel_integrable

Bounded marks preserve integrability of the symmetric kernel under two independent records. the stated conclusion holds.

Formal statement
k :
ℕ
W V :
Integrable (fun z : Record × Record => symmetricProjectionKernel k W.value V.value z.1 z.2) (P.measure.prod P.measure)
Proof (Lean source)
-- @node: symmetricProjectionKernel_integrable lemma symmetricProjectionKernel_integrable (P : ObservedLaw) (k : ℕ) (W V : BoundedMark) : Integrable (fun z : Record × Record => symmetricProjectionKernel k W.value V.value z.1 z.2) (P.measure.prod P.measure) := by have hc : Continuous (fun z : Record × Record => projectionKernel k (covariate z.1) (covariate z.2)) := by unfold projectionKernel covariate fun_prop have hi := hc.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) (μ := P.measure.prod P.measure) have hm (B : BoundedMark) (o : Record) : ‖B.value o‖ ≤ (1 : ℝ) := by rw [Real.norm_eq_abs, abs_of_nonneg (B.range_value o).1] exact (B.range_value o).2 have ht (B D : BoundedMark) : Integrable (fun z : Record × Record => projectionKernel k (covariate z.1) (covariate z.2) * B.value z.1 * D.value z.2) (P.measure.prod P.measure) := by have hB : Measurable (fun z : Record × Record => B.value z.1) := B.measurable_value.comp measurable_fst have hD : Measurable (fun z : Record × Record => D.value z.2) := D.measurable_value.comp measurable_snd have hb := hi.bdd_mul hB.aestronglyMeasurable (Filter.Eventually.of_forall (fun z => hm B z.1)) have hd := hb.bdd_mul hD.aestronglyMeasurable (Filter.Eventually.of_forall (fun z => hm D z.2)) exact hd.congr (Filter.Eventually.of_forall (fun z => by ring)) exact ((ht W V).add (ht V W)).div_const 2 |>.congr (Filter.Eventually.of_forall (fun z => by unfold symmetricProjectionKernel; dsimp; ring))
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:200
theorem integral_orderedPair_average

Averaging over all distinct ordered iid coordinates preserves the two-record mean. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
hn :
2 ≤ n
H :
Record → Record → ℝ
hH :
Measurable (fun z : Record × Record => H z.1 z.2)
hInt :
Integrable (fun z : Record × Record => H z.1 z.2) (P.measure.prod P.measure)
(∫ o, ((n : ℝ) * ((n : ℝ)-1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), H (o ij.1) (o ij.2) ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= ∫ z : Record × Record, H z.1 z.2 ∂(P.measure.prod P.measure)
Proof (Lean source)
-- @node: integral_orderedPair_average lemma integral_orderedPair_average (P : ObservedLaw) (n : ℕ) (hn : 2 ≤ n) (H : Record → Record → ℝ) (hH : Measurable (fun z : Record × Record => H z.1 z.2)) (hInt : Integrable (fun z : Record × Record => H z.1 z.2) (P.measure.prod P.measure)) : (∫ o, ((n : ℝ) * ((n : ℝ)-1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), H (o ij.1) (o ij.2) ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = ∫ z : Record × Record, H z.1 z.2 ∂(P.measure.prod P.measure) := by let μ := Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n letI : IsProbabilityMeasure μ := by dsimp [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] infer_instance let s := (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2) have hcoord : iIndepFun (fun a : Fin n => fun o : Fin n → Record => o a) μ := by simpa [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] using (iIndepFun_pi (μ := fun _ : Fin n => P.measure) (X := fun _ : Fin n => id) (fun _ => aemeasurable_id)) have hpair (ij : Fin n × Fin n) (hij : ij ∈ s) : μ.map (fun o => (o ij.1, o ij.2)) = P.measure.prod P.measure := by have hne : ij.1 ≠ ij.2 := (Finset.mem_filter.mp hij).2 simpa only [(measurePreserving_eval (fun _ : Fin n => P.measure) ij.1).map_eq, (measurePreserving_eval (fun _ : Fin n => P.measure) ij.2).map_eq, μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] using ((hcoord.indepFun hne).map_prod_eq_prod_map_map (measurable_pi_apply ij.1).aemeasurable (measurable_pi_apply ij.2).aemeasurable) have hi (ij : Fin n × Fin n) (hij : ij ∈ s) : Integrable (fun o => H (o ij.1) (o ij.2)) μ := by have hm : Measurable (fun o : Fin n → Record => (o ij.1, o ij.2)) := by fun_prop have hp : Integrable (fun z : Record × Record => H z.1 z.2) (μ.map (fun o => (o ij.1, o ij.2))) := by rw [hpair ij hij]; exact hInt exact hp.comp_measurable hm have hcard : (s.card : ℝ) = (n : ℝ) * ((n : ℝ)-1) := by have hs : s = (Finset.univ : Finset (Fin n)).offDiag := by ext ij simp [s, Finset.mem_offDiag] rw [hs, Finset.offDiag_card] simp only [Finset.card_univ, Fintype.card_fin] rw [Nat.cast_sub (by nlinarith : n ≤ n*n), Nat.cast_mul] ring have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (by omega : n ≠ 0) have hn1 : (n : ℝ)-1 ≠ 0 := by have : (2 : ℝ) ≤ n := by exact_mod_cast hn linarith change (∫ o, _ * ∑ ij ∈ s, H (o ij.1) (o ij.2) ∂μ) = _ rw [integral_const_mul, integral_finsetSum s hi] have he (ij : Fin n × Fin n) (hij : ij ∈ s) : (∫ o, H (o ij.1) (o ij.2) ∂μ) = ∫ z : Record × Record, H z.1 z.2 ∂(P.measure.prod P.measure) := integral_two_coordinates_integrable P.measure (Finset.mem_filter.mp hij).2 H hH rw [Finset.sum_congr rfl he] simp only [Finset.sum_const, nsmul_eq_mul, hcard] rw [inv_mul_cancel_left₀ (mul_ne_zero hn0 hn1)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.integral_orderedPair_average · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:229
theorem projectionStatistic_integral

The original finite-sample ordered statistic has the projected conditional-means inner product. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
hn :
2 ≤ n
(∫ o, projectionStatistic n k W.value V.value o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V))
Proof (Lean source)
-- @node: projectionStatistic_integral lemma projectionStatistic_integral (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) : (∫ o, projectionStatistic n k W.value V.value o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V)) := by simp_rw [projectionStatistic_eq_symmetric] rw [integral_orderedPair_average P n hn _ (symmetricProjectionKernel_measurable k W V) (symmetricProjectionKernel_integrable P k W V), integral_prod _ (symmetricProjectionKernel_integrable P k W V)] exact symmetricProjectionKernel_integral P hDesign W V k
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:285
theorem projectionStatistic_bias

The finite-sample projection statistic has exactly the orthogonal residual bias. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
hn :
2 ≤ n
- (∫ o, projectionStatistic n k W.value V.value o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= uniformInner (fun x => conditionalMarkMean P W x - cosineProjection k (conditionalMarkMean P W) x) (fun x => conditionalMarkMean P V x - cosineProjection k (conditionalMarkMean P V) x)
Proof (Lean source)
-- @node: projectionStatistic_bias lemma projectionStatistic_bias (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) : uniformInner (conditionalMarkMean P W) (conditionalMarkMean P V) - (∫ o, projectionStatistic n k W.value V.value o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = uniformInner (fun x => conditionalMarkMean P W x - cosineProjection k (conditionalMarkMean P W) x) (fun x => conditionalMarkMean P V x - cosineProjection k (conditionalMarkMean P V) x) := by rw [projectionStatistic_integral P hDesign W V k n hn] exact conditionalMarkMean_residual_inner P W V k
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic_bias · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:299
theorem integral_continuous_covariate

Uniform design transports every continuous covariate integral to the record law. Under the stated assumptions.

Formal statement
hDesign :
f :
Covariate → ℝ
hf :
(∫ o, f (covariate o) ∂P.measure) = ∫ x, f x ∂uniformLaw
Proof (Lean source)
-- @node: integral_continuous_covariate lemma integral_continuous_covariate (P : ObservedLaw) (hDesign : UniformDesign P) (f : Covariate → ℝ) (hf : Continuous f) : (∫ o, f (covariate o) ∂P.measure) = ∫ x, f x ∂uniformLaw := by rw [← hDesign, integral_map (by unfold covariate; fun_prop) hf.aestronglyMeasurable]
CausalSmith.Stat.LogoddsLowsmoothFrontier.integral_continuous_covariate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:312
theorem symmetricProjectionKernel_first_sq_le

The first uncentered projection is dominated by the average projected-mark energies. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
o :
(∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2
≤ ((cosineProjection k (conditionalMarkMean P V) (covariate o))^2 + (cosineProjection k (conditionalMarkMean P W) (covariate o))^2) / 2
Proof (Lean source)
-- @node: symmetricProjectionKernel_first_sq_le lemma symmetricProjectionKernel_first_sq_le (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) (o : Record) : (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2 ≤ ((cosineProjection k (conditionalMarkMean P V) (covariate o))^2 + (cosineProjection k (conditionalMarkMean P W) (covariate o))^2) / 2 := by rw [symmetricProjectionKernel_integral_right P hDesign W V k o] have hm (B : BoundedMark) : (B.value o)^2 ≤ 1 := by have hb := B.range_value o nlinarith have hW := mul_le_mul_of_nonneg_right (hm W) (sq_nonneg (cosineProjection k (conditionalMarkMean P V) (covariate o))) have hV := mul_le_mul_of_nonneg_right (hm V) (sq_nonneg (cosineProjection k (conditionalMarkMean P W) (covariate o))) have hd := sq_nonneg (W.value o * cosineProjection k (conditionalMarkMean P V) (covariate o) - V.value o * cosineProjection k (conditionalMarkMean P W) (covariate o)) nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_first_sq_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:319
theorem symmetricProjectionKernel_first_sq_integrable

The squared first projection is integrable under the record law. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
Integrable (fun o => (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2) P.measure
Proof (Lean source)
-- @node: symmetricProjectionKernel_first_sq_integrable lemma symmetricProjectionKernel_first_sq_integrable (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : Integrable (fun o => (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2) P.measure := by have hc (B : BoundedMark) : Continuous (cosineProjection k (conditionalMarkMean P B)) := by unfold cosineProjection fun_prop have hb : Continuous (fun o : Record => ((cosineProjection k (conditionalMarkMean P V) (covariate o))^2 + (cosineProjection k (conditionalMarkMean P W) (covariate o))^2) / 2) := by unfold covariate fun_prop have hm : Measurable (fun o : Record => (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2) := by simp_rw [symmetricProjectionKernel_integral_right P hDesign W V k] have hw := W.measurable_value have hv := V.measurable_value unfold covariate fun_prop apply (hb.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)).mono' hm.aestronglyMeasurable filter_upwards [] with o rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] exact symmetricProjectionKernel_first_sq_le P hDesign W V k o
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_first_sq_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:339
theorem symmetricProjectionKernel_first_centered_energy

Centering the first projection subtracts the squared kernel mean from its energy. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
τ :
uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V))
(∫ o, ((∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure) - τ)^2 ∂P.measure)
= (∫ o, (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2 ∂P.measure)
- τ^2
Proof (Lean source)
-- @node: symmetricProjectionKernel_first_centered_energy lemma symmetricProjectionKernel_first_centered_energy (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : let τ := uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V)) (∫ o, ((∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure) - τ)^2 ∂P.measure) = (∫ o, (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2 ∂P.measure) - τ^2 := by dsimp only let f := fun o => ∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure let τ := uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V)) have hf : Integrable f P.measure := by dsimp [f] simp_rw [symmetricProjectionKernel_integral_right P hDesign W V k] have hc (B : BoundedMark) : Continuous (cosineProjection k (conditionalMarkMean P B)) := by unfold cosineProjection fun_prop exact ((boundedMark_mul_continuous_integrable P W _ ((hc V).comp (by unfold covariate; fun_prop))).add (boundedMark_mul_continuous_integrable P V _ ((hc W).comp (by unfold covariate; fun_prop)))).div_const 2 have hsq : Integrable (fun o => (f o)^2) P.measure := symmetricProjectionKernel_first_sq_integrable P hDesign W V k have hmean : (∫ o, f o ∂P.measure) = τ := symmetricProjectionKernel_integral P hDesign W V k change (∫ o, (f o - τ)^2 ∂P.measure) = (∫ o, (f o)^2 ∂P.measure) - τ^2 have he (o : Record) : (f o - τ)^2 = (f o)^2 - 2 * τ * f o + τ^2 := by ring simp_rw [he] integral_linearity rw [hmean, integral_const] simp only [Measure.real, measure_univ, ENNReal.toReal_one, smul_eq_mul, one_mul] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_first_centered_energy · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:366
theorem symmetricProjectionKernel_first_energy_le_one

Its uncentered first projection has squared energy at most one. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ o, (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2 ∂P.measure) ≤ 1
Proof (Lean source)
-- @node: symmetricProjectionKernel_first_energy_le_one lemma symmetricProjectionKernel_first_energy_le_one (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ o, (∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure)^2 ∂P.measure) ≤ 1 := by have hc (B : BoundedMark) : Continuous (cosineProjection k (conditionalMarkMean P B)) := by unfold cosineProjection fun_prop have hbound : Continuous (fun o : Record => ((cosineProjection k (conditionalMarkMean P V) (covariate o))^2 + (cosineProjection k (conditionalMarkMean P W) (covariate o))^2) / 2) := by unfold covariate fun_prop have hi := hbound.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) (μ := P.measure) have hfirst := symmetricProjectionKernel_first_sq_integrable P hDesign W V k apply (integral_mono hfirst hi (symmetricProjectionKernel_first_sq_le P hDesign W V k)).trans have hiB (B : BoundedMark) : Integrable (fun o => (cosineProjection k (conditionalMarkMean P B) (covariate o))^2) P.measure := by apply Continuous.integrable_of_hasCompactSupport _ (HasCompactSupport.of_compactSpace _) unfold covariate fun_prop rw [integral_div, integral_add (hiB V) (hiB W), integral_continuous_covariate P hDesign (fun x => (cosineProjection k (conditionalMarkMean P V) x)^2) (by fun_prop), integral_continuous_covariate P hDesign (fun x => (cosineProjection k (conditionalMarkMean P W) x)^2) (by fun_prop)] have hV := conditionalMarkMean_projection_energy_le_one P hDesign V k have hW := conditionalMarkMean_projection_energy_le_one P hDesign W k simp only [uniformInner, ← pow_two] at hV hW linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_first_energy_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:401
theorem symmetricProjectionKernel_first_centered_energy_le_one

The centered first Hoeffding projection has squared energy at most one. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ o, ((∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure) - uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V)))^2 ∂P.measure)
≤ 1
Proof (Lean source)
-- @node: symmetricProjectionKernel_first_centered_energy_le_one lemma symmetricProjectionKernel_first_centered_energy_le_one (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ o, ((∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure) - uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V)))^2 ∂P.measure) ≤ 1 := by rw [symmetricProjectionKernel_first_centered_energy P hDesign W V k] exact (sub_le_self _ (sq_nonneg _)).trans (symmetricProjectionKernel_first_energy_le_one P hDesign W V k)
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_first_centered_energy_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:432
theorem symmetricProjectionKernel_sq_integrable

[The square of the symmetric marked kernel is integrable by its continuous kernel envelope. the stated conclusion holds.

Formal statement
k :
ℕ
W V :
Integrable (fun z : Record × Record => (symmetricProjectionKernel k W.value V.value z.1 z.2)^2) (P.measure.prod P.measure)
Proof (Lean source)
-- @node: symmetricProjectionKernel_sq_integrable lemma symmetricProjectionKernel_sq_integrable (P : ObservedLaw) (k : ℕ) (W V : BoundedMark) : Integrable (fun z : Record × Record => (symmetricProjectionKernel k W.value V.value z.1 z.2)^2) (P.measure.prod P.measure) := by have hc : Continuous (fun z : Record × Record => (projectionKernel k (covariate z.1) (covariate z.2))^2) := by unfold projectionKernel covariate fun_prop apply (hc.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)).mono' ((symmetricProjectionKernel_measurable k W V).pow_const 2).aestronglyMeasurable filter_upwards [] with z rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] exact symmetricProjectionKernel_sq_le k W V z.1 z.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_sq_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:443
theorem symmetricProjectionKernel_energy_le_rank

Uniform-design transport and finite cosine orthogonality bound the marked kernel energy by k. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ z : Record × Record, (symmetricProjectionKernel k W.value V.value z.1 z.2)^2 ∂(P.measure.prod P.measure))
≤ (k : ℝ)
Proof (Lean source)
-- @node: symmetricProjectionKernel_energy_le_rank lemma symmetricProjectionKernel_energy_le_rank (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ z : Record × Record, (symmetricProjectionKernel k W.value V.value z.1 z.2)^2 ∂(P.measure.prod P.measure)) ≤ (k : ℝ) := by have hc : Continuous (fun z : Record × Record => (projectionKernel k (covariate z.1) (covariate z.2))^2) := by unfold projectionKernel covariate fun_prop have hi := hc.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) (μ := P.measure.prod P.measure) apply (integral_mono (symmetricProjectionKernel_sq_integrable P k W V) hi (fun z => symmetricProjectionKernel_sq_le k W V z.1 z.2)).trans_eq rw [integral_prod _ hi] have hs (o : Record) : (∫ p, (projectionKernel k (covariate o) (covariate p))^2 ∂P.measure) = ∑ j ∈ range k, (cosineBasis j (covariate o))^2 := by rw [integral_continuous_covariate P hDesign (fun x => (projectionKernel k (covariate o) x)^2) (by unfold projectionKernel; fun_prop), projectionKernel_sq_integral_right] simp_rw [hs] rw [integral_continuous_covariate P hDesign (fun x => ∑ j ∈ range k, (cosineBasis j x)^2) (by fun_prop)] simpa only [projectionKernel_sq_integral_right] using projectionKernel_sq_integral k
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_energy_le_rank · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionMoments.lean:458
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ProjectionOrthogonality 25 declarations Conditional mark means retain the unit-interval range.

Projection orthogonality

Conditional mark means retain the unit-interval range. Finite cosine orthogonality proves the residual bias and projected energy identities. Symmetrization preserves the ordered statistic and its squared envelope.

theorem conditionalMarkMean_nonneg

The conditional mean of a unit-interval mark is nonnegative. Under the stated assumptions.

Formal statement
Proof (Lean source)
-- @node: conditionalMarkMean_nonneg lemma conditionalMarkMean_nonneg (P : ObservedLaw) (W : BoundedMark) (x : Covariate) : 0 ≤ conditionalMarkMean P W x := by unfold conditionalMarkMean apply Finset.sum_nonneg intro a ha apply Finset.sum_nonneg intro y hy exact mul_nonneg (P.interior_cells a y x).1.le (W.range_value (x, a, y)).1
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_nonneg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:18
theorem conditionalMarkMean_le_one

Normalization of the conditional cells keeps the conditional mark mean below one. Under the stated assumptions.

Formal statement
Proof (Lean source)
-- @node: conditionalMarkMean_le_one lemma conditionalMarkMean_le_one (P : ObservedLaw) (W : BoundedMark) (x : Covariate) : conditionalMarkMean P W x ≤ 1 := by rw [← P.normalized_cells x] unfold conditionalMarkMean apply Finset.sum_le_sum intro a ha apply Finset.sum_le_sum intro y hy exact mul_le_of_le_one_right (P.interior_cells a y x).1.le (W.range_value (x, a, y)).2
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:29
theorem conditionalMarkMean_measurable

[A Borel mark and continuous conditional cells give a Borel conditional mean. the documented result

Formal statement
Proof (Lean source)
-- @node: conditionalMarkMean_measurable @[fun_prop] lemma conditionalMarkMean_measurable (P : ObservedLaw) (W : BoundedMark) : Measurable (conditionalMarkMean P W) := by unfold conditionalMarkMean have hcells (a y : Bool) : Measurable (P.cells a y) := (P.continuous_cells a y).measurable have hmark : Measurable W.value := W.measurable_value fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:42
theorem conditionalMarkMean_sq_le_one

The squared conditional mean has the unit envelope used in the first-order variance bound. Under the stated assumptions. The stated conclusion follows.

Formal statement
(conditionalMarkMean P W x)^2 ≤ 1
Proof (Lean source)
-- @node: conditionalMarkMean_sq_le_one lemma conditionalMarkMean_sq_le_one (P : ObservedLaw) (W : BoundedMark) (x : Covariate) : (conditionalMarkMean P W x)^2 ≤ 1 := by have hlo := conditionalMarkMean_nonneg P W x have hhi := conditionalMarkMean_le_one P W x nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_sq_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:53
theorem cosineBasis_uniformInner Lemma cosineBasis_uniformInner in the paper ↗

[The subtype cosine modes inherit the exact orthonormality of the public library. the stated conclusion holds.

Formal statement
i j :
ℕ
uniformInner (cosineBasis i) (cosineBasis j) = if i = j then 1 else 0
Proof (Lean source)
-- @node: cosineBasis_uniformInner lemma cosineBasis_uniformInner (i j : ℕ) : uniformInner (cosineBasis i) (cosineBasis j) = if i = j then 1 else 0 := by unfold uniformInner uniformLaw have h := cosineBasis_orthonormal i j unfold uniformMeasure at h rw [← integral_subtype_comap measurableSet_Icc] at h exact h
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineBasis_uniformInner · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:61
theorem cosineBasis_mul_integrable Lemma cosineBasis_mul_integrable in the paper ↗

Products of finitely many cosine modes are integrable under the public design. the stated conclusion holds.

Formal statement
i j :
ℕ
Integrable (fun x => cosineBasis i x * cosineBasis j x) uniformLaw
Proof (Lean source)
-- @node: cosineBasis_mul_integrable lemma cosineBasis_mul_integrable (i j : ℕ) : Integrable (fun x => cosineBasis i x * cosineBasis j x) uniformLaw := by have h := ((continuous_cosineBasis i).mul (continuous_cosineBasis j)).integrableOn_Icc (μ := volume) (a := (0 : ℝ)) (b := 1) exact (integrableOn_iff_comap_subtypeVal measurableSet_Icc).mp h
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineBasis_mul_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:72
theorem cosineProjection_uniformInner Lemma cosineProjection_uniformInner in the paper ↗

The inner product of the two literal finite projections is the coefficient product sum. Under the stated assumptions. The stated conclusion follows.

Formal statement
k :
ℕ
f g :
Covariate → ℝ
uniformInner (cosineProjection k f) (cosineProjection k g)
= ∑ j ∈ range k, uniformInner f (cosineBasis j) * uniformInner g (cosineBasis j)
Proof (Lean source)
-- @node: cosineProjection_uniformInner lemma cosineProjection_uniformInner (k : ℕ) (f g : Covariate → ℝ) : uniformInner (cosineProjection k f) (cosineProjection k g) = ∑ j ∈ range k, uniformInner f (cosineBasis j) * uniformInner g (cosineBasis j) := by have hpoint (x : Covariate) : cosineProjection k f x * cosineProjection k g x = ∑ i ∈ range k, ∑ j ∈ range k, (uniformInner f (cosineBasis i) * uniformInner g (cosineBasis j)) * (cosineBasis i x * cosineBasis j x) := by unfold cosineProjection rw [Finset.sum_mul] apply Finset.sum_congr rfl intro i hi rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j hj ring unfold uniformInner at ⊢ simp_rw [hpoint] rw [integral_finsetSum _ (fun i hi => integrable_finsetSum _ (fun j hj => (cosineBasis_mul_integrable i j).const_mul _))] apply Finset.sum_congr rfl intro i hi rw [integral_finsetSum _ (fun j hj => (cosineBasis_mul_integrable i j).const_mul _)] simp_rw [integral_const_mul] change (∑ j ∈ range k, (uniformInner f (cosineBasis i) * uniformInner g (cosineBasis j)) * uniformInner (cosineBasis i) (cosineBasis j)) = _ simp_rw [cosineBasis_uniformInner] simp [hi, uniformInner]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineProjection_uniformInner · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:82

[Each cosine mode is integrable under the public design. the stated conclusion holds.

Formal statement
j :
ℕ
Integrable (cosineBasis j) uniformLaw
Proof (Lean source)
-- @node: cosineBasis_integrable lemma cosineBasis_integrable (j : ℕ) : Integrable (cosineBasis j) uniformLaw := by have h0 : cosineBasis 0 = fun _ => 1 := by funext x; simp [cosineBasis] simpa only [h0, mul_one] using cosineBasis_mul_integrable j 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineBasis_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:113
theorem conditionalMarkMean_mul_integrable

A bounded conditional mark mean can multiply any integrable design function. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
Proof (Lean source)
-- @node: conditionalMarkMean_mul_integrable lemma conditionalMarkMean_mul_integrable (P : ObservedLaw) (W : BoundedMark) {g : Covariate → ℝ} (hg : Integrable g uniformLaw) : Integrable (fun x => conditionalMarkMean P W x * g x) uniformLaw := by apply hg.bdd_mul (c := 1) (conditionalMarkMean_measurable P W).aestronglyMeasurable filter_upwards [] with x rw [Real.norm_eq_abs, abs_of_nonneg (conditionalMarkMean_nonneg P W x)] exact conditionalMarkMean_le_one P W x
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_mul_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:119
theorem uniformInner_cosineProjection Lemma uniformInner_cosineProjection in the paper ↗

Finite projection against a target is the sum of their coefficient products. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
f g :
Covariate → ℝ
hf :
∀ j, Integrable (fun x => f x * cosineBasis j x) uniformLaw
uniformInner f (cosineProjection k g)
= ∑ j ∈ range k, uniformInner f (cosineBasis j) * uniformInner g (cosineBasis j)
Proof (Lean source)
-- @node: uniformInner_cosineProjection lemma uniformInner_cosineProjection (k : ℕ) (f g : Covariate → ℝ) (hf : ∀ j, Integrable (fun x => f x * cosineBasis j x) uniformLaw) : uniformInner f (cosineProjection k g) = ∑ j ∈ range k, uniformInner f (cosineBasis j) * uniformInner g (cosineBasis j) := by unfold uniformInner cosineProjection simp_rw [Finset.mul_sum] rw [integral_finsetSum _ (fun j hj => (hf j).mul_const _ |>.congr (Filter.Eventually.of_forall (fun x => by ring)))] apply Finset.sum_congr rfl intro j hj unfold uniformInner rw [show (fun x => f x * ((∫ z, g z * cosineBasis j z ∂uniformLaw) * cosineBasis j x)) = (fun x => (f x * cosineBasis j x) * (∫ z, g z * cosineBasis j z ∂uniformLaw)) by funext x; ring, integral_mul_const]
CausalSmith.Stat.LogoddsLowsmoothFrontier.uniformInner_cosineProjection · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:129

The public inner product is symmetric. Under the stated assumptions.

Formal statement
f g :
Covariate → ℝ
Proof (Lean source)
-- @node: uniformInner_comm lemma uniformInner_comm (f g : Covariate → ℝ) : uniformInner f g = uniformInner g f := by unfold uniformInner congr 1 funext x exact mul_comm _ _
theorem mul_cosineProjection_integrable Lemma mul_cosineProjection_integrable in the paper ↗

A target times a finite projection is integrable whenever its mode products are. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
f g :
Covariate → ℝ
hf :
∀ j, Integrable (fun x => f x * cosineBasis j x) uniformLaw
Integrable (fun x => f x * cosineProjection k g x) uniformLaw
Proof (Lean source)
-- @node: mul_cosineProjection_integrable lemma mul_cosineProjection_integrable (k : ℕ) (f g : Covariate → ℝ) (hf : ∀ j, Integrable (fun x => f x * cosineBasis j x) uniformLaw) : Integrable (fun x => f x * cosineProjection k g x) uniformLaw := by simp only [cosineProjection, Finset.mul_sum] apply integrable_finsetSum intro j hj exact ((hf j).mul_const _).congr (Filter.Eventually.of_forall (fun x => by ring))
CausalSmith.Stat.LogoddsLowsmoothFrontier.mul_cosineProjection_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:154
theorem cosineProjection_residual_inner Lemma cosineProjection_residual_inner in the paper ↗

Orthogonality of the finite cosine modes gives the exact residual-product bias identity. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
f g :
Covariate → ℝ
hfg :
Integrable (fun x => f x * g x) uniformLaw
hf :
∀ j, Integrable (fun x => f x * cosineBasis j x) uniformLaw
hg :
∀ j, Integrable (fun x => g x * cosineBasis j x) uniformLaw
uniformInner f g - uniformInner (cosineProjection k f) (cosineProjection k g)
= uniformInner (fun x => f x - cosineProjection k f x) (fun x => g x - cosineProjection k g x)
Proof (Lean source)
-- @node: cosineProjection_residual_inner lemma cosineProjection_residual_inner (k : ℕ) (f g : Covariate → ℝ) (hfg : Integrable (fun x => f x * g x) uniformLaw) (hf : ∀ j, Integrable (fun x => f x * cosineBasis j x) uniformLaw) (hg : ∀ j, Integrable (fun x => g x * cosineBasis j x) uniformLaw) : uniformInner f g - uniformInner (cosineProjection k f) (cosineProjection k g) = uniformInner (fun x => f x - cosineProjection k f x) (fun x => g x - cosineProjection k g x) := by have hfp := mul_cosineProjection_integrable k f g hf have hgp := mul_cosineProjection_integrable k g f hg have hpp : Integrable (fun x => cosineProjection k f x * cosineProjection k g x) uniformLaw := by apply mul_cosineProjection_integrable intro j simp_rw [mul_comm _ (cosineBasis j _)] apply mul_cosineProjection_integrable exact fun i => cosineBasis_mul_integrable j i have hpoint (x : Covariate) : (f x - cosineProjection k f x) * (g x - cosineProjection k g x) = (f x * g x - f x * cosineProjection k g x) - g x * cosineProjection k f x + cosineProjection k f x * cosineProjection k g x := by ring unfold uniformInner rw [show (fun x => (f x - cosineProjection k f x) * (g x - cosineProjection k g x)) = _ from funext hpoint] integral_linearity change uniformInner f g - uniformInner (cosineProjection k f) (cosineProjection k g) = uniformInner f g - uniformInner f (cosineProjection k g) - uniformInner g (cosineProjection k f) + uniformInner (cosineProjection k f) (cosineProjection k g) rw [uniformInner_cosineProjection k f g hf, uniformInner_cosineProjection k g f hg, cosineProjection_uniformInner] have hs : (∑ j ∈ range k, uniformInner g (cosineBasis j) * uniformInner f (cosineBasis j)) = ∑ j ∈ range k, uniformInner f (cosineBasis j) * uniformInner g (cosineBasis j) := by apply Finset.sum_congr rfl intro j hj exact mul_comm _ _ rw [hs] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosineProjection_residual_inner · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:164
theorem conditionalMarkMean_integrable

[Conditional mark means are integrable without continuity of the mark. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: conditionalMarkMean_integrable lemma conditionalMarkMean_integrable (P : ObservedLaw) (W : BoundedMark) : Integrable (conditionalMarkMean P W) uniformLaw := by have h0 : cosineBasis 0 = fun _ => 1 := by funext x; simp [cosineBasis] simpa only [h0, mul_one] using conditionalMarkMean_mul_integrable P W (cosineBasis_integrable 0)
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:203
theorem conditionalMarkMean_residual_inner

The conditional means of Borel bounded marks satisfy the residual-bias identity. the stated conclusion holds.

Formal statement
W V :
k :
ℕ
- uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V))
= uniformInner (fun x => conditionalMarkMean P W x - cosineProjection k (conditionalMarkMean P W) x) (fun x => conditionalMarkMean P V x - cosineProjection k (conditionalMarkMean P V) x)
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_residual_inner · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:211
theorem conditionalMarkMean_projection_energy_le

A finite cosine projection cannot increase the squared energy of a conditional mark mean. the stated conclusion holds.

Formal statement
k :
ℕ
uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P W))
Proof (Lean source)
-- @node: conditionalMarkMean_projection_energy_le lemma conditionalMarkMean_projection_energy_le (P : ObservedLaw) (W : BoundedMark) (k : ℕ) : uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P W)) ≤ uniformInner (conditionalMarkMean P W) (conditionalMarkMean P W) := by have h := conditionalMarkMean_residual_inner P W W k have hn : 0 ≤ uniformInner (fun x => conditionalMarkMean P W x - cosineProjection k (conditionalMarkMean P W) x) (fun x => conditionalMarkMean P W x - cosineProjection k (conditionalMarkMean P W) x) := by apply integral_nonneg intro x exact mul_self_nonneg _ linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_projection_energy_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:224
theorem conditionalMarkMean_projection_energy_le_one

Under uniform design each projected conditional mark mean has squared energy at most one. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hDesign :
k :
ℕ
uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P W))
≤ 1
Proof (Lean source)
-- @node: conditionalMarkMean_projection_energy_le_one lemma conditionalMarkMean_projection_energy_le_one (P : ObservedLaw) (hDesign : UniformDesign P) (W : BoundedMark) (k : ℕ) : uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P W)) ≤ 1 := by let : IsProbabilityMeasure uniformLaw := hDesign ▸ Measure.isProbabilityMeasure_map (by unfold covariate; fun_prop : Measurable covariate).aemeasurable apply (conditionalMarkMean_projection_energy_le P W k).trans have hi := conditionalMarkMean_mul_integrable P W (conditionalMarkMean_integrable P W) have hbound (x : Covariate) : conditionalMarkMean P W x * conditionalMarkMean P W x ≤ 1 := by simpa only [pow_two] using conditionalMarkMean_sq_le_one P W x simpa [uniformInner] using integral_mono hi (integrable_const (1 : ℝ)) hbound
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditionalMarkMean_projection_energy_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:239

The finite cosine kernel is symmetric in its covariate arguments. Under the stated assumptions.

Formal statement
k :
ℕ
x z :
Proof (Lean source)
-- @node: projectionKernel_symm lemma projectionKernel_symm (k : ℕ) (x z : Covariate) : projectionKernel k x z = projectionKernel k z x := by unfold projectionKernel apply Finset.sum_congr rfl intro j hj exact mul_comm _ _
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionKernel_symm · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:253
theorem projectionKernel_sq_integral_right Lemma projectionKernel_sq_integral_right in the paper ↗

Integrating one squared kernel slice gives the diagonal sum of squared cosine modes. Under the stated assumptions.

Formal statement
k :
ℕ
x :
(∫ z, (projectionKernel k x z)^2 ∂uniformLaw) = ∑ j ∈ range k, (cosineBasis j x)^2
Proof (Lean source)
-- @node: projectionKernel_sq_integral_right lemma projectionKernel_sq_integral_right (k : ℕ) (x : Covariate) : (∫ z, (projectionKernel k x z)^2 ∂uniformLaw) = ∑ j ∈ range k, (cosineBasis j x)^2 := by have hpoint (z : Covariate) : (projectionKernel k x z)^2 = ∑ i ∈ range k, ∑ j ∈ range k, (cosineBasis i x * cosineBasis j x) * (cosineBasis i z * cosineBasis j z) := by unfold projectionKernel rw [pow_two, Finset.sum_mul] apply Finset.sum_congr rfl intro i hi rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j hj ring simp_rw [hpoint] rw [integral_finsetSum _ (fun i hi => integrable_finsetSum _ (fun j hj => (cosineBasis_mul_integrable i j).const_mul _))] apply Finset.sum_congr rfl intro i hi rw [integral_finsetSum _ (fun j hj => (cosineBasis_mul_integrable i j).const_mul _)] simp_rw [integral_const_mul] change (∑ j ∈ range k, (cosineBasis i x * cosineBasis j x) * uniformInner (cosineBasis i) (cosineBasis j)) = _ simp_rw [cosineBasis_uniformInner] simp [hi, pow_two]
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionKernel_sq_integral_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:262
theorem projectionKernel_sq_integral Lemma projectionKernel_sq_integral in the paper ↗

[The squared cosine kernel has exactly rank-k energy under two uniform covariates. the stated conclusion holds.

Formal statement
k :
ℕ
(∫ x, ∫ z, (projectionKernel k x z)^2 ∂uniformLaw ∂uniformLaw) = (k : ℝ)
Proof (Lean source)
-- @node: projectionKernel_sq_integral lemma projectionKernel_sq_integral (k : ℕ) : (∫ x, ∫ z, (projectionKernel k x z)^2 ∂uniformLaw ∂uniformLaw) = (k : ℝ) := by simp_rw [projectionKernel_sq_integral_right] have hi (j : ℕ) : Integrable (fun x => (cosineBasis j x)^2) uniformLaw := by simpa only [pow_two] using cosineBasis_mul_integrable j j rw [integral_finsetSum _ (fun j hj => hi j)] have he (j : ℕ) : (∫ x, (cosineBasis j x)^2 ∂uniformLaw) = 1 := by simpa only [uniformInner, pow_two, ↓reduceIte] using cosineBasis_uniformInner j j simp_rw [he] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionKernel_sq_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:290

The symmetric two-record kernel of the ordered marked statistic.

Definition (Lean source)
k :
ℕ
W V :
Record → ℝ
o p :
symmetricProjectionKernel k W V o p :
ℝ
projectionKernel k (covariate o) (covariate p) * (W o * V p + V o * W p) / 2
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:303
theorem symmetricProjectionKernel_symm

Symmetrizing the marks gives an exactly symmetric record kernel. the stated conclusion holds.

Formal statement
k :
ℕ
W V :
Record → ℝ
o p :
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_symm · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:309

Swapping the two distinct indices preserves the complete ordered-pair sum. Under the stated assumptions. The stated conclusion follows.

Formal statement
n :
ℕ
F :
Fin n → Fin n → ℝ
(∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), F ij.1 ij.2)
= ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), F ij.2 ij.1
Proof (Lean source)
-- @node: orderedPair_sum_swap lemma orderedPair_sum_swap (n : ℕ) (F : Fin n → Fin n → ℝ) : (∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), F ij.1 ij.2) = ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), F ij.2 ij.1 := by apply Finset.sum_bij (fun ij _ => (ij.2, ij.1)) · intro ij hij simpa only [mem_filter, Finset.mem_univ, true_and, ne_eq] using Ne.symm (Finset.mem_filter.mp hij).2 · intro ij hij pq hpq heq exact Prod.ext (congrArg snd heq) (congrArg fst heq) · intro ij hij refine ⟨(ij.2, ij.1), ?_, ?_⟩ · simpa only [mem_filter, Finset.mem_univ, true_and, ne_eq] using Ne.symm (Finset.mem_filter.mp hij).2 · exact Prod.ext rfl rfl · intro ij hij rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.orderedPair_sum_swap · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:317
theorem projectionStatistic_eq_symmetric

Averaging an ordered kernel with its transpose leaves the statistic unchanged. the stated conclusion holds.

Formal statement
n k :
ℕ
W V :
Record → ℝ
o :
Fin n → Record
= ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), symmetricProjectionKernel k W V (o ij.1) (o ij.2)
Proof (Lean source)
-- @node: projectionStatistic_eq_symmetric lemma projectionStatistic_eq_symmetric (n k : ℕ) (W V : Record → ℝ) (o : Fin n → Record) : projectionStatistic n k W V o = ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2), symmetricProjectionKernel k W V (o ij.1) (o ij.2) := by have hswap := orderedPair_sum_swap n (fun i j => projectionKernel k (covariate (o i)) (covariate (o j)) * W (o i) * V (o j)) have hpoint (ij : Fin n × Fin n) : symmetricProjectionKernel k W V (o ij.1) (o ij.2) = (projectionKernel k (covariate (o ij.1)) (covariate (o ij.2)) * W (o ij.1) * V (o ij.2) + projectionKernel k (covariate (o ij.2)) (covariate (o ij.1)) * W (o ij.2) * V (o ij.1)) / 2 := by unfold symmetricProjectionKernel rw [projectionKernel_symm k (covariate (o ij.2)) (covariate (o ij.1))] ring unfold projectionStatistic simp_rw [hpoint] rw [← Finset.sum_div, Finset.sum_add_distrib, ← hswap] congr 1 ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic_eq_symmetric · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:338
theorem symmetricProjectionKernel_sq_le

The symmetrized unit-interval marks never enlarge the squared cosine kernel. the stated conclusion holds.

Formal statement
k :
ℕ
W V :
o p :
(symmetricProjectionKernel k W.value V.value o p)^2
Proof (Lean source)
-- @node: symmetricProjectionKernel_sq_le lemma symmetricProjectionKernel_sq_le (k : ℕ) (W V : BoundedMark) (o p : Record) : (symmetricProjectionKernel k W.value V.value o p)^2 ≤ (projectionKernel k (covariate o) (covariate p))^2 := by have h₁ : 0 ≤ W.value o * V.value p := mul_nonneg (W.range_value o).1 (V.range_value p).1 have h₂ : 0 ≤ V.value o * W.value p := mul_nonneg (V.range_value o).1 (W.range_value p).1 have h₃ : W.value o * V.value p ≤ 1 := (mul_le_of_le_one_right (W.range_value o).1 (V.range_value p).2).trans (W.range_value o).2 have h₄ : V.value o * W.value p ≤ 1 := (mul_le_of_le_one_right (V.range_value o).1 (W.range_value p).2).trans (V.range_value o).2 have hsq : ((W.value o * V.value p + V.value o * W.value p) / 2)^2 ≤ 1 := by nlinarith unfold symmetricProjectionKernel rw [mul_div_assoc, mul_pow] exact (mul_le_mul_of_nonneg_left hsq (sq_nonneg _)).trans_eq (mul_one _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_sq_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionOrthogonality.lean:361
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ProjectionResidual 22 declarations The order-two Hoeffding residual has zero conditional mean in both coordinates.

The degenerate projection-kernel residual

The order-two Hoeffding residual has zero conditional mean in both coordinates. Its energy is the kernel energy minus the constant and first-order energies.

def projectionFirst

[The uncentered first projection of the symmetric marked kernel.

Definition (Lean source)
W V :
k :
ℕ
o :
projectionFirst P W V k o :
ℝ
∫ p, symmetricProjectionKernel k W.value V.value o p ∂P.measure
def projectionMean

The constant term of the Hoeffding decomposition.

Definition (Lean source)
W V :
k :
ℕ
projectionMean P W V k :
ℝ
uniformInner (cosineProjection k (conditionalMarkMean P W)) (cosineProjection k (conditionalMarkMean P V))
def projectionResidual

The completely degenerate second-order residual.

Definition (Lean source)
W V :
k :
ℕ
o p :
projectionResidual P W V k o p :
ℝ
symmetricProjectionKernel k W.value V.value o p
- projectionFirst P W V k o
- projectionFirst P W V k p
+ projectionMean P W V k
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:26
theorem symmetricProjectionKernel_section_integrable

Each kernel section is integrable, including at records in null sets. the stated conclusion holds.

Formal statement
W V :
k :
ℕ
o :
Integrable (symmetricProjectionKernel k W.value V.value o) P.measure
Proof (Lean source)
-- @node: symmetricProjectionKernel_section_integrable lemma symmetricProjectionKernel_section_integrable (P : ObservedLaw) (W V : BoundedMark) (k : ℕ) (o : Record) : Integrable (symmetricProjectionKernel k W.value V.value o) P.measure := by have hc : Continuous (fun p : Record => projectionKernel k (covariate o) (covariate p)) := by unfold projectionKernel covariate fun_prop have hi (B : BoundedMark) := boundedMark_mul_continuous_integrable P B _ hc exact (((hi V).const_mul (W.value o)).add ((hi W).const_mul (V.value o))).div_const 2 |>.congr (Filter.Eventually.of_forall (fun p => by unfold symmetricProjectionKernel; dsimp; ring))
CausalSmith.Stat.LogoddsLowsmoothFrontier.symmetricProjectionKernel_section_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:33
theorem projectionFirst_measurable

The first projection is measurable by its explicit conditional-mean formula. the documented result Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
Proof (Lean source)
-- @node: projectionFirst_measurable @[fun_prop] lemma projectionFirst_measurable (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : Measurable (projectionFirst P W V k) := by unfold projectionFirst simp_rw [symmetricProjectionKernel_integral_right P hDesign W V k] have hw := W.measurable_value have hv := V.measurable_value unfold cosineProjection covariate fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:45
theorem projectionFirst_integrable

[Fubini gives integrability of the first projection. the stated conclusion holds.

Formal statement
W V :
k :
ℕ
Integrable (projectionFirst P W V k) P.measure
Proof (Lean source)
-- @node: projectionFirst_integrable lemma projectionFirst_integrable (P : ObservedLaw) (W V : BoundedMark) (k : ℕ) : Integrable (projectionFirst P W V k) P.measure := (symmetricProjectionKernel_integrable P k W V).integral_prod_left
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:57
theorem projectionFirst_integral

The mean of the first projection is the kernel mean. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ o, projectionFirst P W V k o ∂P.measure) = projectionMean P W V k
Proof (Lean source)
-- @node: projectionFirst_integral lemma projectionFirst_integral (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ o, projectionFirst P W V k o ∂P.measure) = projectionMean P W V k := symmetricProjectionKernel_integral P hDesign W V k
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:63
theorem projectionResidual_symm

[Symmetry is preserved when removing the two first projections. the stated conclusion holds.

Formal statement
W V :
k :
ℕ
o p :
projectionResidual P W V k o p = projectionResidual P W V k p o
Proof (Lean source)
-- @node: projectionResidual_symm lemma projectionResidual_symm (P : ObservedLaw) (W V : BoundedMark) (k : ℕ) (o p : Record) : projectionResidual P W V k o p = projectionResidual P W V k p o := by unfold projectionResidual rw [symmetricProjectionKernel_symm k W.value V.value o p] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_symm · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:70
theorem projectionResidual_integral_right

Integrating out the second coordinate kills the residual exactly. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hDesign :
W V :
k :
ℕ
o :
(∫ p, projectionResidual P W V k o p ∂P.measure) = 0
Proof (Lean source)
-- @node: projectionResidual_integral_right lemma projectionResidual_integral_right (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) (o : Record) : (∫ p, projectionResidual P W V k o p ∂P.measure) = 0 := by unfold projectionResidual have hi := symmetricProjectionKernel_section_integrable P W V k o have hf := projectionFirst_integrable P W V k integral_linearity rw [projectionFirst_integral P hDesign W V k] simp only [integral_const, Measure.real, measure_univ, ENNReal.toReal_one, smul_eq_mul, one_mul] unfold projectionFirst ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_integral_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:78
theorem projectionResidual_integral_left

Symmetry gives the other coordinate's degeneracy. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
p :
(∫ o, projectionResidual P W V k o p ∂P.measure) = 0
Proof (Lean source)
-- @node: projectionResidual_integral_left lemma projectionResidual_integral_left (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) (p : Record) : (∫ o, projectionResidual P W V k o p ∂P.measure) = 0 := by simp_rw [projectionResidual_symm P W V k _ p] exact projectionResidual_integral_right P hDesign W V k p
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_integral_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:93
theorem projectionResidual_measurable

[The residual is Borel measurable on the product record space. the documented result Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
Measurable (fun z : Record × Record => projectionResidual P W V k z.1 z.2)
Proof (Lean source)
-- @node: projectionResidual_measurable @[fun_prop] lemma projectionResidual_measurable (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : Measurable (fun z : Record × Record => projectionResidual P W V k z.1 z.2) := by have hq := symmetricProjectionKernel_measurable k W V have hf := projectionFirst_measurable P hDesign W V k unfold projectionResidual fun_prop
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_measurable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:101
theorem projectionResidual_sq_integrable

Removing square-integrable projections preserves square integrability. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
Integrable (fun z : Record × Record => (projectionResidual P W V k z.1 z.2)^2) (P.measure.prod P.measure)
Proof (Lean source)
-- @node: projectionResidual_sq_integrable lemma projectionResidual_sq_integrable (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : Integrable (fun z : Record × Record => (projectionResidual P W V k z.1 z.2)^2) (P.measure.prod P.measure) := by have hq : MemLp (fun z : Record × Record => symmetricProjectionKernel k W.value V.value z.1 z.2) 2 (P.measure.prod P.measure) := (memLp_two_iff_integrable_sq (symmetricProjectionKernel_measurable k W V).aestronglyMeasurable).mpr (symmetricProjectionKernel_sq_integrable P k W V) have hf := projectionFirst_measurable P hDesign W V k have hs := symmetricProjectionKernel_first_sq_integrable P hDesign W V k have hfst : MemLp (fun z : Record × Record => projectionFirst P W V k z.1) 2 (P.measure.prod P.measure) := (memLp_two_iff_integrable_sq (hf.comp measurable_fst).aestronglyMeasurable).mpr (hs.comp_fst P.measure) have hsnd : MemLp (fun z : Record × Record => projectionFirst P W V k z.2) 2 (P.measure.prod P.measure) := (memLp_two_iff_integrable_sq (hf.comp measurable_snd).aestronglyMeasurable).mpr (hs.comp_snd P.measure) exact (memLp_two_iff_integrable_sq (projectionResidual_measurable P hDesign W V k).aestronglyMeasurable).mp (((hq.sub hfst).sub hsnd).add (memLp_const (projectionMean P W V k)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_sq_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:112
theorem projectionResidual_energy

Orthogonality removes twice the first-projection energy from the kernel energy. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure))
= (∫ z : Record × Record, (symmetricProjectionKernel k W.value V.value z.1 z.2)^2 ∂(P.measure.prod P.measure))
- 2 * (∫ o, (projectionFirst P W V k o)^2 ∂P.measure)
+ (projectionMean P W V k)^2
Proof (Lean source)
-- @node: projectionResidual_energy lemma projectionResidual_energy (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) = (∫ z : Record × Record, (symmetricProjectionKernel k W.value V.value z.1 z.2)^2 ∂(P.measure.prod P.measure)) - 2 * (∫ o, (projectionFirst P W V k o)^2 ∂P.measure) + (projectionMean P W V k)^2 := by let q := fun z : Record × Record => symmetricProjectionKernel k W.value V.value z.1 z.2 let f := projectionFirst P W V k let τ := projectionMean P W V k let μ := P.measure.prod P.measure have hf : Integrable f P.measure := projectionFirst_integrable P W V k have hfm : Measurable f := projectionFirst_measurable P hDesign W V k have hfmean : (∫ o, f o ∂P.measure) = τ := projectionFirst_integral P hDesign W V k have hs : Integrable (fun o => (f o)^2) P.measure := symmetricProjectionKernel_first_sq_integrable P hDesign W V k have hq : MemLp q 2 μ := (memLp_two_iff_integrable_sq (symmetricProjectionKernel_measurable k W V).aestronglyMeasurable).mpr (symmetricProjectionKernel_sq_integrable P k W V) have hf1 : MemLp (fun z : Record × Record => f z.1) 2 μ := (memLp_two_iff_integrable_sq (hfm.comp measurable_fst).aestronglyMeasurable).mpr (hs.comp_fst P.measure) have hf2 : MemLp (fun z : Record × Record => f z.2) 2 μ := (memLp_two_iff_integrable_sq (hfm.comp measurable_snd).aestronglyMeasurable).mpr (hs.comp_snd P.measure) have hqf1 : Integrable (fun z : Record × Record => q z * f z.1) μ := hq.integrable_mul hf1 have hqf2 : Integrable (fun z : Record × Record => q z * f z.2) μ := hq.integrable_mul hf2 have h12 : Integrable (fun z : Record × Record => f z.1 * f z.2) μ := hf.mul_prod hf have hcross1 : (∫ z : Record × Record, q z * f z.1 ∂μ) = ∫ o, (f o)^2 ∂P.measure := by rw [integral_prod _ hqf1] simp_rw [integral_mul_const] change (∫ o, f o * f o ∂P.measure) = _ simp only [← pow_two] have hcross2 : (∫ z : Record × Record, q z * f z.2 ∂μ) = ∫ o, (f o)^2 ∂P.measure := by rw [integral_prod_symm _ hqf2] simp_rw [integral_mul_const] have he (p : Record) : (∫ o, q (o, p) ∂P.measure) = f p := by dsimp [q, f, projectionFirst] simp_rw [symmetricProjectionKernel_symm k W.value V.value _ p] simp_rw [he, ← pow_two] have hfirst1 : (∫ z : Record × Record, f z.1 ∂μ) = τ := by rw [integral_prod _ (hf.comp_fst P.measure)] simpa using hfmean have hfirst2 : (∫ z : Record × Record, f z.2 ∂μ) = τ := by rw [integral_prod_symm _ (hf.comp_snd P.measure)] simpa using hfmean have hs1 : (∫ z : Record × Record, (f z.1)^2 ∂μ) = ∫ o, (f o)^2 ∂P.measure := by rw [integral_prod _ (hs.comp_fst P.measure)] simp have hs2 : (∫ z : Record × Record, (f z.2)^2 ∂μ) = ∫ o, (f o)^2 ∂P.measure := by rw [integral_prod_symm _ (hs.comp_snd P.measure)] simp have hcross12 : (∫ z : Record × Record, f z.1 * f z.2 ∂μ) = τ^2 := by rw [integral_prod_mul, hfmean] ring have hqmean : (∫ z, q z ∂μ) = τ := by rw [integral_prod _ (symmetricProjectionKernel_integrable P k W V)] exact symmetricProjectionKernel_integral P hDesign W V k change (∫ z : Record × Record, (q z - f z.1 - f z.2 + τ)^2 ∂μ) = (∫ z, (q z)^2 ∂μ) - 2 * (∫ o, (f o)^2 ∂P.measure) + τ^2 have he (z : Record × Record) : (q z - f z.1 - f z.2 + τ)^2 = (q z)^2 + (f z.1)^2 + (f z.2)^2 + τ^2 - 2 * (q z * f z.1) - 2 * (q z * f z.2) + 2 * (q z * τ) + 2 * (f z.1 * f z.2) - 2 * (f z.1 * τ) - 2 * (f z.2 * τ) := by ring simp_rw [he] have hqs := symmetricProjectionKernel_sq_integrable P k W V have hqi := symmetricProjectionKernel_integrable P k W V have hfs1 := hs.comp_fst P.measure have hfs2 := hs.comp_snd P.measure have hfi1 := hf.comp_fst P.measure have hfi2 := hf.comp_snd P.measure have h0 : Integrable (fun z => (q z)^2 + (f z.1)^2) μ := hqs.add hfs1 have h1 := h0.add hfs2 have h2 := h1.add (integrable_const (τ^2) : Integrable (fun _ : Record × Record => τ^2) μ) have h3 := h2.sub (hqf1.const_mul 2) have h4 := h3.sub (hqf2.const_mul 2) have h5 := h4.add ((hqi.mul_const τ).const_mul 2) have h6 := h5.add (h12.const_mul 2) have h7 := h6.sub ((hfi1.mul_const τ).const_mul 2) have ht1 := hqf1.const_mul 2 have ht2 := hqf2.const_mul 2 have ht3 := (hqi.mul_const τ).const_mul 2 have ht4 := h12.const_mul 2 have ht5 := (hfi1.mul_const τ).const_mul 2 have ht6 := (hfi2.mul_const τ).const_mul 2 integral_linearity rw [hs1, hs2, hcross1, hcross2, hcross12, hqmean, hfirst1, hfirst2] simp only [integral_const, Measure.real, measure_univ, ENNReal.toReal_one, smul_eq_mul, one_mul] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_energy · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:136
theorem projectionResidual_energy_le_rank

The residual energy is bounded by k, with the exact Hoeffding constant preserved. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure))
≤ (k : ℝ)
Proof (Lean source)
-- @node: projectionResidual_energy_le_rank lemma projectionResidual_energy_le_rank (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) ≤ (k : ℝ) := by rw [projectionResidual_energy P hDesign W V k] have hc := symmetricProjectionKernel_first_centered_energy P hDesign W V k have hn : 0 ≤ ∫ o, (projectionFirst P W V k o - projectionMean P W V k)^2 ∂P.measure := integral_nonneg (fun o => sq_nonneg _) have hs : 0 ≤ ∫ o, (projectionFirst P W V k o)^2 ∂P.measure := integral_nonneg (fun o => sq_nonneg _) change (∫ o, (projectionFirst P W V k o - projectionMean P W V k)^2 ∂P.measure) = (∫ o, (projectionFirst P W V k o)^2 ∂P.measure) - (projectionMean P W V k)^2 at hc have hk := symmetricProjectionKernel_energy_le_rank P hDesign W V k linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_energy_le_rank · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:232
theorem projectionResidual_degenKernel

The run's residual satisfies the library's exact order-two variance interface. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
DegenKernel P.measure (projectionResidual P W V k)
Proof (Lean source)
-- @node: projectionResidual_degenKernel lemma projectionResidual_degenKernel (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : DegenKernel P.measure (projectionResidual P W V k) := ⟨projectionResidual_measurable P hDesign W V k, projectionResidual_symm P W V k, projectionResidual_integral_right P hDesign W V k, projectionResidual_sq_integrable P hDesign W V k⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_degenKernel · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:250
theorem projectionFirst_centered_integral

The first Hoeffding component is centered under the record law. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
(∫ o, (projectionFirst P W V k o - projectionMean P W V k) ∂P.measure) = 0
Proof (Lean source)
-- @node: projectionFirst_centered_integral lemma projectionFirst_centered_integral (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : (∫ o, (projectionFirst P W V k o - projectionMean P W V k) ∂P.measure) = 0 := by rw [integral_sub (projectionFirst_integrable P W V k) (integrable_const _), projectionFirst_integral P hDesign W V k] simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_centered_integral · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:260
theorem projectionResidual_rescaled_secondMoment

Exact fixed-order variance specializes to the run's degenerate residual. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
Ω :
S :
IIDSample Ω Record μ P.measure
n :
ℕ
hn :
2 ≤ n
(∫ ω, (sqrt (n : ℝ) * uStatistic S (projectionResidual P W V k) n ω)^2 ∂μ)
= 2 * (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) / ((n : ℝ) - 1)
Proof (Lean source)
-- @node: projectionResidual_rescaled_secondMoment lemma projectionResidual_rescaled_secondMoment (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} (S : IIDSample Ω Record μ P.measure) (n : ℕ) (hn : 2 ≤ n) : (∫ ω, (sqrt (n : ℝ) * uStatistic S (projectionResidual P W V k) n ω)^2 ∂μ) = 2 * (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) / ((n : ℝ) - 1) := by exact S.integral_rescaled_sq (projectionResidual_degenKernel P hDesign W V k) hn
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_rescaled_secondMoment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:269
theorem projectionResidual_secondMoment

Removing the square-root rescaling gives the sharp residual second moment. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
Ω :
S :
IIDSample Ω Record μ P.measure
n :
ℕ
hn :
2 ≤ n
(∫ ω, (uStatistic S (projectionResidual P W V k) n ω)^2 ∂μ)
= 2 * (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) / ((n : ℝ) * ((n : ℝ) - 1))
Proof (Lean source)
-- @node: projectionResidual_secondMoment lemma projectionResidual_secondMoment (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} (S : IIDSample Ω Record μ P.measure) (n : ℕ) (hn : 2 ≤ n) : (∫ ω, (uStatistic S (projectionResidual P W V k) n ω)^2 ∂μ) = 2 * (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) / ((n : ℝ) * ((n : ℝ) - 1)) := by have hn2 : (2 : ℝ) ≤ n := by exact_mod_cast hn have hn0 : (n : ℝ) ≠ 0 := by linarith have hn1 : (n : ℝ) - 1 ≠ 0 := by linarith have h := projectionResidual_rescaled_secondMoment P hDesign W V k S n hn simp_rw [mul_pow, Real.sq_sqrt (by positivity : (0 : ℝ) ≤ n)] at h rw [integral_const_mul] at h apply (eq_div_iff (mul_ne_zero hn0 hn1)).mpr have h' := (eq_div_iff hn1).mp h nlinarith [h']
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_secondMoment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:281
theorem projectionResidual_secondMoment_le

The residual contributes exactly the required 2k/(n(n-1)) upper bound. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
Ω :
S :
IIDSample Ω Record μ P.measure
n :
ℕ
hn :
2 ≤ n
(∫ ω, (uStatistic S (projectionResidual P W V k) n ω)^2 ∂μ)
≤ 2 * k / ((n : ℝ) * ((n : ℝ) - 1))
Proof (Lean source)
-- @node: projectionResidual_secondMoment_le lemma projectionResidual_secondMoment_le (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} (S : IIDSample Ω Record μ P.measure) (n : ℕ) (hn : 2 ≤ n) : (∫ ω, (uStatistic S (projectionResidual P W V k) n ω)^2 ∂μ) ≤ 2 * k / ((n : ℝ) * ((n : ℝ) - 1)) := by rw [projectionResidual_secondMoment P hDesign W V k S n hn] have hn2 : (2 : ℝ) ≤ n := by exact_mod_cast hn exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (projectionResidual_energy_le_rank P hDesign W V k) (by norm_num)) (mul_nonneg (by positivity) (by linarith))
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_secondMoment_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:300
theorem projection_offDiag_sum_first Lemma projection_offDiag_sum_first in the paper ↗

Each record occurs n-1 times as the first coordinate of the ordered pair sum. Under the stated assumptions.

Formal statement
n :
ℕ
f :
Fin n → ℝ
(∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, f ij.1) = ((n : ℝ) - 1) * ∑ i, f i
Proof (Lean source)
-- @node: projection_offDiag_sum_first lemma projection_offDiag_sum_first (n : ℕ) (f : Fin n → ℝ) : (∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, f ij.1) = ((n : ℝ) - 1) * ∑ i, f i := by classical have h := Finset.sum_union (Finset.disjoint_diag_offDiag (Finset.univ : Finset (Fin n))) (f := fun ij => f ij.1) rw [Finset.diag_union_offDiag, Finset.sum_product] at h simp only [Finset.sum_diag, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, ← Finset.mul_sum] at h nlinarith [h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.projection_offDiag_sum_first · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:315
theorem projection_offDiag_sum_second Lemma projection_offDiag_sum_second in the paper ↗

Each record occurs n-1 times as the second coordinate of the ordered pair sum. Under the stated assumptions.

Formal statement
n :
ℕ
f :
Fin n → ℝ
(∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, f ij.2) = ((n : ℝ) - 1) * ∑ i, f i
Proof (Lean source)
-- @node: projection_offDiag_sum_second lemma projection_offDiag_sum_second (n : ℕ) (f : Fin n → ℝ) : (∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, f ij.2) = ((n : ℝ) - 1) * ∑ i, f i := by classical have h := Finset.sum_union (Finset.disjoint_diag_offDiag (Finset.univ : Finset (Fin n))) (f := fun ij => f ij.2) rw [Finset.diag_union_offDiag, Finset.sum_product] at h simp only [Finset.sum_diag, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at h nlinarith [h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.projection_offDiag_sum_second · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:328
theorem projectionStatistic_hoeffding

The original statistic has the exact finite-sample Hoeffding decomposition. Under the stated assumptions.

Formal statement
W V :
k n :
ℕ
hn :
2 ≤ n
o :
Fin n → Record
projectionStatistic n k W.value V.value o - projectionMean P W V k
= 2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k)
+ ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2)
Proof (Lean source)
-- @node: projectionStatistic_hoeffding lemma projectionStatistic_hoeffding (P : ObservedLaw) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) (o : Fin n → Record) : projectionStatistic n k W.value V.value o - projectionMean P W V k = 2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k) + ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2) := by classical let s := (Finset.univ : Finset (Fin n)).offDiag have hs : (Finset.univ : Finset (Fin n × Fin n)).filter (fun ij => ij.1 ≠ ij.2) = s := by ext ij simp [s, Finset.mem_offDiag] have hcard : (s.card : ℝ) = (n : ℝ) * ((n : ℝ) - 1) := by dsimp [s] rw [Finset.offDiag_card] simp only [Finset.card_univ, Fintype.card_fin] rw [Nat.cast_sub (by nlinarith : n ≤ n*n), Nat.cast_mul] ring have hn2 : (2 : ℝ) ≤ n := by exact_mod_cast hn have hn0 : (n : ℝ) ≠ 0 := by linarith have hn1 : (n : ℝ) - 1 ≠ 0 := by linarith have hsum : (∑ ij ∈ s, projectionResidual P W V k (o ij.1) (o ij.2)) = (∑ ij ∈ s, symmetricProjectionKernel k W.value V.value (o ij.1) (o ij.2)) - 2 * (((n : ℝ) - 1) * ∑ i, projectionFirst P W V k (o i)) + (n : ℝ) * ((n : ℝ) - 1) * projectionMean P W V k := by simp only [projectionResidual, Finset.sum_add_distrib, Finset.sum_sub_distrib, Finset.sum_const, nsmul_eq_mul, hcard] dsimp only [s] rw [projection_offDiag_sum_first n (fun i => projectionFirst P W V k (o i)), projection_offDiag_sum_second n (fun i => projectionFirst P W V k (o i))] ring rw [projectionStatistic_eq_symmetric, hs] rw [Finset.sum_sub_distrib] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] rw [hsum] field_simp <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionStatistic_hoeffding · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionResidual.lean:341
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.ProjectionSampling 8 declarations The finite product experiment is the pushforward of a canonical infinite IID sample.

Finite sampling transport for projection variance

The finite product experiment is the pushforward of a canonical infinite IID sample. Reindexing ordered pairs transports the exact residual second moment.

theorem projection_offDiag_sum_reindex Lemma projection_offDiag_sum_reindex in the paper ↗

Ordered distinct finite indices and natural indices below n have identical sums. Under the stated assumptions.

Formal statement
n :
ℕ
F :
ℕ → ℕ → ℝ
(∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, F ij.1.val ij.2.val)
= ∑ ij ∈ (range n).offDiag, F ij.1 ij.2
Proof (Lean source)
-- @node: projection_offDiag_sum_reindex lemma projection_offDiag_sum_reindex (n : ℕ) (F : ℕ → ℕ → ℝ) : (∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, F ij.1.val ij.2.val) = ∑ ij ∈ (range n).offDiag, F ij.1 ij.2 := by classical apply Finset.sum_bij (fun ij _ => (ij.1.val, ij.2.val)) · intro ij hij simp only [Finset.mem_offDiag, Finset.mem_range] refine ⟨ij.1.isLt, ij.2.isLt, ?_⟩ exact fun h => (Finset.mem_offDiag.mp hij).2.2 (Fin.ext h) · intro ij hij pq hpq heq exact Prod.ext (Fin.ext (congrArg fst heq)) (Fin.ext (congrArg snd heq)) · intro ij hij obtain ⟨hi, hj, hne⟩ := Finset.mem_offDiag.mp hij refine ⟨(⟨ij.1, Finset.mem_range.mp hi⟩, ⟨ij.2, Finset.mem_range.mp hj⟩), ?_, rfl⟩ simp only [Finset.mem_offDiag, Finset.mem_univ, true_and] exact fun h => hne (congrArg (fun z : Fin n => z.val) h) · intro ij hij rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.projection_offDiag_sum_reindex · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:17
theorem projectionResidual_average_eq_uStatistic

The residual ordered average is the library U-statistic along the finite IID observable. Under the stated assumptions.

Formal statement
W V :
k n :
ℕ
Ω :
S :
IIDSample Ω Record μ P.measure
ω :
Ω
((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (S.Z ij.1 ω) (S.Z ij.2 ω)
= uStatistic S (projectionResidual P W V k) n ω
Proof (Lean source)
-- @node: projectionResidual_average_eq_uStatistic lemma projectionResidual_average_eq_uStatistic (P : ObservedLaw) (W V : BoundedMark) (k n : ℕ) {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} (S : IIDSample Ω Record μ P.measure) (ω : Ω) : ((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (S.Z ij.1 ω) (S.Z ij.2 ω) = uStatistic S (projectionResidual P W V k) n ω := by unfold uStatistic rw [projection_offDiag_sum_reindex n (fun i j => projectionResidual P W V k (S.Z i ω) (S.Z j ω))]
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_average_eq_uStatistic · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:38
theorem projection_integral_iid_transport

Finite product expectations equal expectations along the finite observable of an IID sample. Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
Ω :
S :
IIDSample Ω Record μ P.measure
F :
(Fin n → Record) → ℝ
hF :
(∫ o, F o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= ∫ ω, F (fun i : Fin n => S.Z i ω) ∂μ
Proof (Lean source)
-- @node: projection_integral_iid_transport lemma projection_integral_iid_transport (P : ObservedLaw) (n : ℕ) {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} (S : IIDSample Ω Record μ P.measure) (F : (Fin n → Record) → ℝ) (hF : Measurable F) : (∫ o, F o ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = ∫ ω, F (fun i : Fin n => S.Z i ω) ∂μ := by unfold iidLaw rw [← iidSample_finN_pushforward S n] exact integral_map (iidSample_finN_measurable S n).aemeasurable hF.aestronglyMeasurable
CausalSmith.Stat.LogoddsLowsmoothFrontier.projection_integral_iid_transport · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:51
theorem projectionResidual_finite_secondMoment

The sharp residual second moment holds under the original finite product law. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
hn :
2 ≤ n
(∫ o : Fin n → Record, (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= 2 * (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) / ((n : ℝ) * ((n : ℝ) - 1))
Proof (Lean source)
-- @node: projectionResidual_finite_secondMoment lemma projectionResidual_finite_secondMoment (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) : (∫ o : Fin n → Record, (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = 2 * (∫ z : Record × Record, (projectionResidual P W V k z.1 z.2)^2 ∂(P.measure.prod P.measure)) / ((n : ℝ) * ((n : ℝ) - 1)) := by let S := iidSample_infinitePi P.measure have hm := projectionResidual_measurable P hDesign W V k rw [projection_integral_iid_transport P n S _ (by fun_prop)] simp_rw [projectionResidual_average_eq_uStatistic] exact projectionResidual_secondMoment P hDesign W V k S n hn
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_finite_secondMoment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:64
theorem projectionResidual_finite_secondMoment_le

The finite experiment's residual contributes at most the sharp rank term. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
hn :
2 ≤ n
(∫ o : Fin n → Record, (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
≤ 2 * k / ((n : ℝ) * ((n : ℝ) - 1))
Proof (Lean source)
-- @node: projectionResidual_finite_secondMoment_le lemma projectionResidual_finite_secondMoment_le (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) : (∫ o : Fin n → Record, (((n : ℝ) * ((n : ℝ) - 1))⁻¹ * ∑ ij ∈ (Finset.univ : Finset (Fin n)).offDiag, projectionResidual P W V k (o ij.1) (o ij.2))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) ≤ 2 * k / ((n : ℝ) * ((n : ℝ) - 1)) := by rw [projectionResidual_finite_secondMoment P hDesign W V k n hn] have hn2 : (2 : ℝ) ≤ n := by exact_mod_cast hn exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (projectionResidual_energy_le_rank P hDesign W V k) (by norm_num)) (mul_nonneg (by positivity) (by linarith))
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionResidual_finite_secondMoment_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:80
theorem projectionFirst_centered_memLp

The centered first projection is square integrable. Under the stated assumptions.

Formal statement
hDesign :
W V :
k :
ℕ
MemLp (fun o => projectionFirst P W V k o - projectionMean P W V k) 2 P.measure
Proof (Lean source)
-- @node: projectionFirst_centered_memLp lemma projectionFirst_centered_memLp (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k : ℕ) : MemLp (fun o => projectionFirst P W V k o - projectionMean P W V k) 2 P.measure := by have hf : MemLp (projectionFirst P W V k) 2 P.measure := (memLp_two_iff_integrable_sq (projectionFirst_measurable P hDesign W V k).aestronglyMeasurable).mpr (symmetricProjectionKernel_first_sq_integrable P hDesign W V k) exact hf.sub (memLp_const _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_centered_memLp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:95
theorem projectionFirst_finite_secondMoment

Independence gives the exact first-order contribution in the finite experiment. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
hn :
2 ≤ n
(∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
= 4 / (n : ℝ) * (∫ x, (projectionFirst P W V k x - projectionMean P W V k)^2 ∂P.measure)
Proof (Lean source)
-- @node: projectionFirst_finite_secondMoment lemma projectionFirst_finite_secondMoment (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) : (∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) = 4 / (n : ℝ) * (∫ x, (projectionFirst P W V k x - projectionMean P W V k)^2 ∂P.measure) := by let f := fun x => projectionFirst P W V k x - projectionMean P W V k let μ := Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n let : IsProbabilityMeasure μ := by dsimp [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] infer_instance have hm : Measurable f := (projectionFirst_measurable P hDesign W V k).sub_const _ have hf : MemLp f 2 P.measure := projectionFirst_centered_memLp P hDesign W V k have hz : (∫ x, f x ∂P.measure) = 0 := projectionFirst_centered_integral P hDesign W V k have hi (i : Fin n) : Integrable (fun o : Fin n → Record => f (o i)) μ := integrable_comp_eval (μ := fun _ : Fin n => P.measure) (hf.integrable (by norm_num)) have hmean : (∫ o : Fin n → Record, ∑ i, f (o i) ∂μ) = 0 := by rw [integral_finsetSum _ (fun i _ => hi i)] have he (i : Fin n) : (∫ o : Fin n → Record, f (o i) ∂μ) = 0 := by rw [show μ = Measure.pi (fun _ : Fin n => P.measure) from rfl, integral_comp_eval hm.aestronglyMeasurable, hz] simp_rw [he] simp have hsm : Measurable (fun o : Fin n → Record => ∑ i, f (o i)) := by fun_prop have hv : Var[fun o : Fin n → Record => ∑ i, f (o i); μ] = (n : ℝ) * (∫ x, (f x)^2 ∂P.measure) := by have h := variance_sum_pi (ι := Fin n) (X := fun _ => f) (fun _ => hf) have he : (∑ i : Fin n, fun o : Fin n → Record => f (o i)) = (fun o => ∑ i, f (o i)) := by funext o simp rw [he] at h dsimp only [μ, Causalean.Stat.UStatistic.LocalizedVariance.iidLaw] rw [h] simp_rw [variance_eq_integral hm.aemeasurable, hz, sub_zero] simp rw [variance_eq_integral hsm.aemeasurable, hmean] at hv simp only [sub_zero] at hv change (∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, f (o i))^2 ∂μ) = _ simp_rw [mul_pow] rw [integral_const_mul, hv] have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (by omega : n ≠ 0) dsimp only [f] field_simp ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_finite_secondMoment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:106
theorem projectionFirst_finite_secondMoment_le

The first-order term contributes at most 4/n under the finite product law. Under the stated assumptions.

Formal statement
hDesign :
W V :
k n :
ℕ
hn :
2 ≤ n
(∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n)
≤ 4 / (n : ℝ)
Proof (Lean source)
-- @node: projectionFirst_finite_secondMoment_le lemma projectionFirst_finite_secondMoment_le (P : ObservedLaw) (hDesign : UniformDesign P) (W V : BoundedMark) (k n : ℕ) (hn : 2 ≤ n) : (∫ o : Fin n → Record, (2 / (n : ℝ) * ∑ i, (projectionFirst P W V k (o i) - projectionMean P W V k))^2 ∂Causalean.Stat.UStatistic.LocalizedVariance.iidLaw P.measure n) ≤ 4 / (n : ℝ) := by rw [projectionFirst_finite_secondMoment P hDesign W V k n hn] have he := symmetricProjectionKernel_first_centered_energy_le_one P hDesign W V k exact (mul_le_mul_of_nonneg_left he (by positivity)).trans_eq (mul_one _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.projectionFirst_finite_secondMoment_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/ProjectionSampling.lean:155
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.RankEnclosures 7 declarations Valid exponent names intersect the public rectangle.

Domain safety and containment for the represented rank computation

Valid exponent names intersect the public rectangle. Positive affine denominators produce exponent boxes in [0,2]. A derivative bound for integer-base powers and the cubic precision budget then give unit-width enclosures for both exact rank targets.

theorem boxIntersection_exists_contains

A shared real point certifies that the literal rational intersection succeeds. Under the stated assumptions.

Formal statement
I J :
x :
ℝ
hI :
I.Contains x
hJ :
J.Contains x
∃ B,
conclusion 1
boxIntersection I J = some B
conclusion 2
B.Contains x
conclusion 3
B.Subinterval J
Proof (Lean source)
-- @node: boxIntersection_exists_contains lemma boxIntersection_exists_contains (I J : RatInterval) (x : ℝ) (hI : I.Contains x) (hJ : J.Contains x) : ∃ B, boxIntersection I J = some B ∧ B.Contains x ∧ B.Subinterval J := by have hlo : ((max I.lo J.lo : ℚ) : ℝ) ≤ x := by push_cast exact max_le hI.1 hJ.1 have hhi : x ≤ ((min I.hi J.hi : ℚ) : ℝ) := by push_cast exact le_min hI.2 hJ.2 have horder : max I.lo J.lo ≤ min I.hi J.hi := by exact_mod_cast hlo.trans hhi refine ⟨⟨max I.lo J.lo, min I.hi J.hi, horder⟩, ?_, ⟨hlo, hhi⟩, ⟨le_max_right _ _, min_le_right _ _⟩⟩ simp [boxIntersection, horder]
CausalSmith.Stat.LogoddsLowsmoothFrontier.boxIntersection_exists_contains · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankEnclosures.lean:17
theorem rank_point_mul_endpoints

Multiplication by a nonnegative point is the exact monotone endpoint operation. Under the stated assumptions.

Formal statement
a :
ℚ
ha :
0 ≤ a
conclusion 1
((RatInterval.point a).mul I).lo = a * I.lo
conclusion 2
((RatInterval.point a).mul I).hi = a * I.hi
Proof (Lean source)
-- @node: rank_point_mul_endpoints lemma rank_point_mul_endpoints (a : ℚ) (ha : 0 ≤ a) (I : RatInterval) : ((RatInterval.point a).mul I).lo = a * I.lo ∧ ((RatInterval.point a).mul I).hi = a * I.hi := by have h := mul_le_mul_of_nonneg_left I.lo_le_hi ha simp [RatInterval.mul, RatInterval.point, min_eq_left h, max_eq_right h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_point_mul_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankEnclosures.lean:33
theorem rank_division_safe

A positive denominator above one gives a safe exponent box in [0,2]. Under the stated assumptions.

Formal statement
hD :
1 ≤ D.lo
d :
ℝ
hd :
D.Contains d
∃ C,
conclusion 1
boxDiv (RatInterval.point 2) D = some C
conclusion 2
C.Contains (2/d)
conclusion 3
0 ≤ C.lo
conclusion 4
C.hi ≤ 2
conclusion 5
C.width ≤ 2*D.width
Proof (Lean source)
-- @node: rank_division_safe lemma rank_division_safe (D : RatInterval) (hD : 1 ≤ D.lo) (d : ℝ) (hd : D.Contains d) : ∃ C, boxDiv (RatInterval.point 2) D = some C ∧ C.Contains (2/d) ∧ 0 ≤ C.lo ∧ C.hi ≤ 2 ∧ C.width ≤ 2*D.width := by have hpos : 0 < D.lo := lt_of_lt_of_le (by norm_num) hD let C := (RatInterval.point 2).div D (inr hpos) have he := rank_point_mul_endpoints 2 (by norm_num) (D.inv (inr hpos)) have hlo : C.lo = 2 * D.hi⁻¹ := he.1 have hhi : C.hi = 2 * D.lo⁻¹ := he.2 refine ⟨C, ?_, RatInterval.div_sound (inr hpos) (by norm_num [RatInterval.Contains, RatInterval.point]) hd, ?_, ?_, ?_⟩ · simp [boxDiv, hpos, C] · rw [hlo] exact mul_nonneg (by norm_num) (inv_nonneg.mpr (hpos.le.trans D.lo_le_hi)) · rw [hhi] have hi : D.lo⁻¹ ≤ (1 : ℚ) := by simpa using (inv_le_inv₀ hpos (by norm_num : (0 : ℚ) < 1)).2 hD linarith · have hdhi : 0 < D.hi := hpos.trans_le D.lo_le_hi have hdprod : 1 ≤ D.lo * D.hi := by nlinarith [D.lo_le_hi] have hdelta : 0 ≤ D.hi - D.lo := sub_nonneg.mpr D.lo_le_hi rw [RatInterval.width, hlo, hhi] change 2 * D.lo⁻¹ - 2 * D.hi⁻¹ ≤ 2*(D.hi-D.lo) have hid : D.lo⁻¹ - D.hi⁻¹ = (D.hi-D.lo)/(D.lo*D.hi) := by field_simp <;> ring have hle : (D.hi-D.lo)/(D.lo*D.hi) ≤ D.hi-D.lo := by apply (div_le_iff₀ (mul_pos hpos hdhi)).2 nlinarith linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_division_safe · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankEnclosures.lean:41
theorem rank_power_range_width

The derivative bound on [0,2] controls the exact power range before primitive excess. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
1 ≤ n
hlo :
0 ≤ I.lo
hhi :
I.hi ≤ 2
(n : ℝ)^(I.hi : ℝ) - (n : ℝ)^(I.lo : ℝ) ≤ (n : ℝ)^3 * (I.width : ℝ)
Proof (Lean source)
-- @node: rank_power_range_width lemma rank_power_range_width (n : ℕ) (hn : 1 ≤ n) (I : RatInterval) (hlo : 0 ≤ I.lo) (hhi : I.hi ≤ 2) : (n : ℝ)^(I.hi : ℝ) - (n : ℝ)^(I.lo : ℝ) ≤ (n : ℝ)^3 * (I.width : ℝ) := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn have hn0 : (0 : ℝ) < n := lt_of_lt_of_le zero_lt_one hn1 have hl : (0 : ℝ) ≤ I.lo := by exact_mod_cast hlo have hh : (I.hi : ℝ) ≤ 2 := by exact_mod_cast hhi have ho : (I.lo : ℝ) ≤ I.hi := by exact_mod_cast I.lo_le_hi have hb (v : ℝ) (hv : v ∈ Icc (0 : ℝ) 2) : ‖(n : ℝ)^v * log n‖ ≤ (n : ℝ)^3 := by rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (Real.rpow_nonneg hn0.le _) (Real.log_nonneg hn1))] have hp : (n : ℝ)^v ≤ (n : ℝ)^2 := by simpa using Real.rpow_le_rpow_of_exponent_le hn1 hv.2 have hlog : log (n : ℝ) ≤ n := (Real.log_le_sub_one_of_pos hn0).trans (by linarith) calc (n : ℝ)^v * log n ≤ (n : ℝ)^2 * (n : ℝ) := mul_le_mul hp hlog (Real.log_nonneg hn1) (by positivity) _ = (n : ℝ)^3 := by ring have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le (f := fun v : ℝ => (n : ℝ)^v) (f' := fun v => (n : ℝ)^v * log n) (fun v _ => by simpa [mul_comm] using ((hasDerivAt_id v).const_rpow hn0).hasDerivWithinAt) hb (convex_Icc (0 : ℝ) 2) ⟨hl, ho.trans hh⟩ ⟨hl.trans ho, hh⟩ rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr ho)] at h exact (le_abs_self _).trans (by simpa [RatInterval.width] using h)
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_power_range_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankEnclosures.lean:75
theorem rank_engine_power_width

Power endpoint excess adds at most two precision errors to the exact range width. Under the stated assumptions.

Formal statement
hE :
E.Admissible
q n :
ℕ
hn :
1 ≤ n
hlo :
0 ≤ I.lo
hhi :
I.hi ≤ 2
((E.powBox q n I).width : ℝ) ≤ (n : ℝ)^3 * (I.width : ℝ) + 2*precisionError q
Proof (Lean source)
-- @node: rank_engine_power_width lemma rank_engine_power_width (E : ArithmeticEngine) (hE : E.Admissible) (q n : ℕ) (hn : 1 ≤ n) (I : RatInterval) (hlo : 0 ≤ I.lo) (hhi : I.hi ≤ 2) : ((E.powBox q n I).width : ℝ) ≤ (n : ℝ)^3 * (I.width : ℝ) + 2*precisionError q := by have h := hE.2.2.2.2.2.1 q n I hn (by linarith) (by linarith) have hw := rank_power_range_width n hn I hlo hhi have hleft := h.1.2.2.1 have hright := h.1.2.2.2.2 simp only [RatInterval.width, Rat.cast_sub] at * linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_engine_power_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankEnclosures.lean:106
theorem rank_precision_cubic_bound Lemma rank_precision_cubic_bound in the paper ↗

[The prescribed rank precision satisfies the cubic sample-size error budget. the stated conclusion holds.

Formal statement
n :
ℕ
(128 : ℝ) * (n : ℝ)^3 * precisionError (qRank n) ≤ 1
Proof (Lean source)
-- @node: rank_precision_cubic_bound lemma rank_precision_cubic_bound (n : ℕ) : (128 : ℝ) * (n : ℝ)^3 * precisionError (qRank n) ≤ 1 := by have hpow : (n : ℝ) ≤ (2 : ℝ)^(clog 2 n) := by exact_mod_cast Nat.le_pow_clog (by norm_num : 1 < 2) n have hc : (n : ℝ)^3 ≤ ((2 : ℝ)^(clog 2 n))^3 := by gcongr rw [precisionError, qRank, zpow_neg, zpow_natCast] apply (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hc (by norm_num)) (by positivity)).trans apply le_of_eq rw [pow_add, pow_mul] norm_num field_simp rw [← pow_mul, Nat.mul_comm, pow_mul] norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_precision_cubic_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankEnclosures.lean:118
theorem rankBoxes_rank_budget_contract

Both rank computations succeed, contain their exact targets, and have width at most one at the prescribed budget, uniformly over admissible engines and naming policies. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
1 ≤ n
α β :
ℝ
hab :
∃ c s,
conclusion 1
rankBoxes E N n α β = some (c,s)
conclusion 2
c.Contains ((n : ℝ)^(2/(2*α+2*β+1)))
conclusion 3
s.Contains ((n : ℝ)^(2/(4*β+1)))
conclusion 4
c.width ≤ 1
conclusion 5
s.width ≤ 1
Proof (Lean source)
-- @node: rankBoxes_rank_budget_contract lemma rankBoxes_rank_budget_contract (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 1 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) : ∃ c s, rankBoxes E N n α β = some (c,s) ∧ c.Contains ((n : ℝ)^(2/(2*α+2*β+1))) ∧ s.Contains ((n : ℝ)^(2/(4*β+1))) ∧ c.width ≤ 1 ∧ s.width ≤ 1 := by have hα : 0 < α := hab.1.trans hab.2.2.1 have hβ : 0 < β := hab.1 have haName := ((hN.1 n α β).1.1 (qRank n)).2.2.1 have hbName := ((hN.1 n α β).2.1 (qRank n)).2.2.1 have haPublic : (rationalBox 0 1).Contains α := by norm_num [rationalBox, RatInterval.Contains] exact ⟨hα.le, hab.2.2.2⟩ have hbPublic : (rationalBox 0 (1/4)).Contains β := by norm_num [rationalBox, RatInterval.Contains] exact ⟨hβ.le, hab.2.1.le⟩ obtain ⟨a, ha, haC, haS⟩ := boxIntersection_exists_contains _ _ α haName haPublic obtain ⟨b, hb, hbC, hbS⟩ := boxIntersection_exists_contains _ _ β hbName hbPublic have ha0 : 0 ≤ a.lo := by simpa [rationalBox] using haS.1 have hb0 : 0 ≤ b.lo := by simpa [rationalBox] using hbS.1 let DC := ((RatInterval.point 2).mul a |>.add ((RatInterval.point 2).mul b) |>.add (RatInterval.point 1)) let DS := ((RatInterval.point 4).mul b).add (RatInterval.point 1) have hDC : 1 ≤ DC.lo := by change 1 ≤ ((RatInterval.point 2).mul a).lo + ((RatInterval.point 2).mul b).lo + 1 rw [(rank_point_mul_endpoints 2 (by norm_num) a).1, (rank_point_mul_endpoints 2 (by norm_num) b).1] linarith have hDS : 1 ≤ DS.lo := by change 1 ≤ ((RatInterval.point 4).mul b).lo + 1 rw [(rank_point_mul_endpoints 4 (by norm_num) b).1] linarith have hDCc : DC.Contains (2*α+2*β+1) := by exact RatInterval.add_sound (RatInterval.add_sound (RatInterval.mul_sound (by norm_num [RatInterval.Contains, RatInterval.point]) haC) (RatInterval.mul_sound (by norm_num [RatInterval.Contains, RatInterval.point]) hbC)) (by norm_num [RatInterval.Contains, RatInterval.point]) have hDSc : DS.Contains (4*β+1) := by exact RatInterval.add_sound (RatInterval.mul_sound (by norm_num [RatInterval.Contains, RatInterval.point]) hbC) (by norm_num [RatInterval.Contains, RatInterval.point]) obtain ⟨C, hc, hCc, hC0, hC2, hCW⟩ := rank_division_safe DC hDC _ hDCc obtain ⟨S, hs, hSc, hS0, hS2, hSW⟩ := rank_division_safe DS hDS _ hDSc have hcPow := hE.2.2.2.2.2.1 (qRank n) n C hn (by linarith) (by linarith) have hsPow := hE.2.2.2.2.2.1 (qRank n) n S hn (by linarith) (by linarith) have haW : (a.width : ℝ) ≤ precisionError (qRank n) := by have haS' : a.Subinterval (N.alphaName n α β (qRank n)) := by unfold boxIntersection at ha split at ha · cases ha exact ⟨le_max_left _ _, min_le_left _ _⟩ · cases ha have hw : (a.width : ℝ) ≤ (N.alphaName n α β (qRank n)).width := by exact_mod_cast RatInterval.width_mono haS' exact hw.trans (((hN.1 n α β).1.1 (qRank n)).2.2.2) have hbW : (b.width : ℝ) ≤ precisionError (qRank n) := by have hbS' : b.Subinterval (N.betaName n α β (qRank n)) := by unfold boxIntersection at hb split at hb · cases hb exact ⟨le_max_left _ _, min_le_left _ _⟩ · cases hb have hw : (b.width : ℝ) ≤ (N.betaName n α β (qRank n)).width := by exact_mod_cast RatInterval.width_mono hbS' exact hw.trans (((hN.1 n α β).2.1 (qRank n)).2.2.2) have hDCW : (DC.width : ℝ) ≤ 4*precisionError (qRank n) := by have hEq : DC.width = 2*a.width + 2*b.width := by simp only [DC, RatInterval.width_add] simp only [RatInterval.width, (rank_point_mul_endpoints 2 (by norm_num) a).1, (rank_point_mul_endpoints 2 (by norm_num) a).2, (rank_point_mul_endpoints 2 (by norm_num) b).1, (rank_point_mul_endpoints 2 (by norm_num) b).2] simp only [RatInterval.point] ring rw [hEq] push_cast linarith have hDSW : (DS.width : ℝ) ≤ 4*precisionError (qRank n) := by have hEq : DS.width = 4*b.width := by simp only [DS, RatInterval.width_add] simp only [RatInterval.width, (rank_point_mul_endpoints 4 (by norm_num) b).1, (rank_point_mul_endpoints 4 (by norm_num) b).2] simp only [RatInterval.point] ring rw [hEq] push_cast linarith have hCW' : (C.width : ℝ) ≤ 8*precisionError (qRank n) := by have hw : (C.width : ℝ) ≤ 2*(DC.width : ℝ) := by exact_mod_cast hCW linarith have hSW' : (S.width : ℝ) ≤ 8*precisionError (qRank n) := by have hw : (S.width : ℝ) ≤ 2*(DS.width : ℝ) := by exact_mod_cast hSW linarith have hbudget : 8*(n : ℝ)^3*precisionError (qRank n) + 2*precisionError (qRank n) ≤ 1 := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast hn have hn3 : (1 : ℝ) ≤ (n : ℝ)^3 := one_le_pow₀ hn1 have he : 0 ≤ precisionError (qRank n) := by unfold precisionError; positivity have hp := rank_precision_cubic_bound n nlinarith refine ⟨E.powBox (qRank n) n C, E.powBox (qRank n) n S, ?_, hcPow.1.1 _ hCc, hsPow.1.1 _ hSc, ?_, ?_⟩ · simp only [rankBoxes, ha, hb, Option.bind_some, hc, hs, pure] change (do let c ← boxDiv (RatInterval.point 2) DC let s ← boxDiv (RatInterval.point 2) DS pure (E.powBox (qRank n) n c, E.powBox (qRank n) n s)) = _ rw [hc, hs] rfl · have hw := rank_engine_power_width E hE (qRank n) n hn C hC0 hC2 have hr : ((E.powBox (qRank n) n C).width : ℝ) ≤ 1 := hw.trans ((by gcongr : (n : ℝ)^3*(C.width : ℝ)+2*precisionError (qRank n) ≤ (n : ℝ)^3*(8*precisionError (qRank n))+2*precisionError (qRank n)).trans (by nlinarith [hbudget])) exact_mod_cast hr · have hw := rank_engine_power_width E hE (qRank n) n hn S hS0 hS2 have hr : ((E.powBox (qRank n) n S).width : ℝ) ≤ 1 := hw.trans ((by gcongr : (n : ℝ)^3*(S.width : ℝ)+2*precisionError (qRank n) ≤ (n : ℝ)^3*(8*precisionError (qRank n))+2*precisionError (qRank n)).trans (by nlinarith [hbudget])) exact_mod_cast hr
CausalSmith.Stat.LogoddsLowsmoothFrontier.rankBoxes_rank_budget_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankEnclosures.lean:135
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.RankRates 9 declarations The represented rank bounds imply uniform bias and noise rates.

Deterministic rank and radius rates

The represented rank bounds imply uniform bias and noise rates. These estimates use only the rank-budget contract, independently of endpoint realization.

theorem resolutions_target_bounds

Rank selection obeys the exact target and its threefold upper bound. Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
k :
resolutions E N n α β
(n : ℝ)^(2/(2*α+2*β+1)) ≤ k.1
(k.1 : ℝ) ≤ 3*(n : ℝ)^(2/(2*α+2*β+1))
(n : ℝ)^(2/(4*β+1)) ≤ k.2
(k.2 : ℝ) ≤ 3*(n : ℝ)^(2/(4*β+1))
Proof (Lean source)
-- @node: resolutions_target_bounds lemma resolutions_target_bounds (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) : let k := resolutions E N n α β (n : ℝ)^(2/(2*α+2*β+1)) ≤ k.1 ∧ (k.1 : ℝ) ≤ 3*(n : ℝ)^(2/(2*α+2*β+1)) ∧ (n : ℝ)^(2/(4*β+1)) ≤ k.2 ∧ (k.2 : ℝ) ≤ 3*(n : ℝ)^(2/(4*β+1)) := by obtain ⟨c, s, hr, hc, hs, hwc, hws⟩ := rankBoxes_rank_budget_contract E hE N hN n (by omega) α β hab obtain ⟨hco, hso⟩ := rank_targets_one_le n hn α β hab obtain ⟨hcl, hcu, hct⟩ := enclosure_ceiling_rank_bounds c _ hco hc hwc obtain ⟨hsl, hsu, hst⟩ := enclosure_ceiling_rank_bounds s _ hso hs hws simpa only [resolutions, hr] using intro hcl (intro (hcu.le.trans hct) (intro hsl (hsu.le.trans hst)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.resolutions_target_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:13
theorem sample_pair_denominator_lower Lemma sample_pair_denominator_lower in the paper ↗

The ordered-pair denominator is at least half the squared sample size. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
2 ≤ n
(n : ℝ)^2/2 ≤ (n : ℝ)*((n : ℝ)-1)
Proof (Lean source)
-- @node: sample_pair_denominator_lower lemma sample_pair_denominator_lower (n : ℕ) (hn : 2 ≤ n) : (n : ℝ)^2/2 ≤ (n : ℝ)*((n : ℝ)-1) := by have hn' : (2 : ℝ) ≤ n := by exact_mod_cast hn nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.sample_pair_denominator_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:31

Bias at a rank above its target has exactly the balanced power rate. Under the stated assumptions. Under the stated assumptions.

Formal statement
x k s :
ℝ
hx :
1 ≤ x
hs :
0 < s
hk :
x^(2/(2*s+1)) ≤ k
k^(-s) ≤ x^(-(2*s/(2*s+1)))
Proof (Lean source)
-- @node: rank_bias_power_bound lemma rank_bias_power_bound (x k s : ℝ) (hx : 1 ≤ x) (hs : 0 < s) (hk : x^(2/(2*s+1)) ≤ k) : k^(-s) ≤ x^(-(2*s/(2*s+1))) := by have hx0 : 0 < x := lt_of_lt_of_le zero_lt_one hx have h := Real.rpow_le_rpow_of_nonpos (Real.rpow_pos_of_pos hx0 _) hk (by linarith : -s ≤ 0) rw [← Real.rpow_mul hx0.le] at h convert h using 1 <;> congr 1 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_bias_power_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:38

A selected rank at most three times its target gives a uniform noise rate. Under the stated assumptions. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
s :
ℝ
hs :
0 < s
hk :
(k : ℝ) ≤ 3*(n : ℝ)^(2/(2*s+1))
sqrt (20*varianceRadius n k) ≤ 40*((n : ℝ)^(-(1/2 : ℝ))+(n : ℝ)^(-(2*s/(2*s+1))))
Proof (Lean source)
-- @node: rank_noise_power_bound lemma rank_noise_power_bound (n k : ℕ) (hn : 2 ≤ n) (s : ℝ) (hs : 0 < s) (hk : (k : ℝ) ≤ 3*(n : ℝ)^(2/(2*s+1))) : sqrt (20*varianceRadius n k) ≤ 40*((n : ℝ)^(-(1/2 : ℝ))+(n : ℝ)^(-(2*s/(2*s+1)))) := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by omega) have hn0 : (0 : ℝ) < n := lt_of_lt_of_le zero_lt_one hn1 have hn2 : 0 < (n : ℝ)^2 := sq_pos_of_pos hn0 have hden := sample_pair_denominator_lower n hn have hden0 : 0 < (n : ℝ)*((n : ℝ)-1) := by nlinarith have hv : 20*varianceRadius n k ≤ 200/(n : ℝ)+480*((n : ℝ)^(2/(2*s+1))/(n : ℝ)^2) := by have hd : 4*(k : ℝ)/((n : ℝ)*((n : ℝ)-1)) ≤ 24*((n : ℝ)^(2/(2*s+1))/(n : ℝ)^2) := by apply (div_le_iff₀ hden0).mpr have ht : (k : ℝ)*(n : ℝ)^2 ≤ 6*(n : ℝ)^(2/(2*s+1))*((n : ℝ)*((n : ℝ)-1)) := by have hp := Real.rpow_nonneg hn0.le (2/(2*s+1)) nlinarith [mul_le_mul_of_nonneg_right hk hn2.le, mul_le_mul_of_nonneg_left hden hp] have he : 24*((n : ℝ)^(2/(2*s+1))/(n : ℝ)^2)*((n : ℝ)*((n : ℝ)-1)) = (24*(n : ℝ)^(2/(2*s+1))*((n : ℝ)*((n : ℝ)-1)))/(n : ℝ)^2 := by ring rw [he] apply (le_div_iff₀ hn2).mpr convert (show 4*(k : ℝ)*(n : ℝ)^2 ≤ 24*(n : ℝ)^(2/(2*s+1))*((n : ℝ)*((n : ℝ)-1)) by nlinarith) using 1 <;> ring dsimp only [varianceRadius] calc 20*(10/(n : ℝ)+4*(k : ℝ)/((n : ℝ)*((n : ℝ)-1))) = 200/(n : ℝ)+20*(4*(k : ℝ)/((n : ℝ)*((n : ℝ)-1))) := by ring _ ≤ _ := by linarith have ht : ((n : ℝ)^(-(1/2 : ℝ)))^2 = 1/(n : ℝ) := by rw [← Real.rpow_natCast, ← Real.rpow_mul hn0.le] norm_num simp [Real.rpow_neg_one, one_div] have hu : ((n : ℝ)^(-(2*s/(2*s+1))))^2 = (n : ℝ)^(2/(2*s+1))/(n : ℝ)^2 := by rw [← Real.rpow_natCast, ← Real.rpow_mul hn0.le, ← Real.rpow_natCast, ← Real.rpow_sub hn0] congr 1 field_simp ring have ht0 := Real.rpow_nonneg hn0.le (-(1/2 : ℝ)) have hu0 := Real.rpow_nonneg hn0.le (-(2*s/(2*s+1))) have hv0 : 0 ≤ 20*varianceRadius n k := by dsimp [varianceRadius]; positivity apply (Real.sqrt_le_iff).2 refine ⟨by positivity, ?_⟩ have htn : 200/(n : ℝ) = 200*((n : ℝ)^(-(1/2 : ℝ)))^2 := by rw [ht]; ring rw [htn, ← hu] at hv nlinarith [mul_nonneg ht0 hu0]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_noise_power_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:48
theorem rank_radius_power_bound Lemma rank_radius_power_bound in the paper ↗

Both bias and noise are bounded by the slower of the balanced and parametric rates. Under the stated assumptions. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
s B :
ℝ
hs :
0 < s
hB :
0 ≤ B
hkl :
(n : ℝ)^(2/(2*s+1)) ≤ k
hku :
(k : ℝ) ≤ 3*(n : ℝ)^(2/(2*s+1))
B*(k : ℝ)^(-s)+sqrt (20*varianceRadius n k)
≤ (B+80)*(n : ℝ)^(-min (1/2) (2*s/(2*s+1)))
Proof (Lean source)
-- @node: rank_radius_power_bound lemma rank_radius_power_bound (n k : ℕ) (hn : 2 ≤ n) (s B : ℝ) (hs : 0 < s) (hB : 0 ≤ B) (hkl : (n : ℝ)^(2/(2*s+1)) ≤ k) (hku : (k : ℝ) ≤ 3*(n : ℝ)^(2/(2*s+1))) : B*(k : ℝ)^(-s)+sqrt (20*varianceRadius n k) ≤ (B+80)*(n : ℝ)^(-min (1/2) (2*s/(2*s+1))) := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by omega) have hb := rank_bias_power_bound (n : ℝ) k s hn1 hs hkl have hv := rank_noise_power_bound n k hn s hs hku have ht := Real.rpow_le_rpow_of_exponent_le hn1 (neg_le_neg (min_le_left (1/2 : ℝ) (2*s/(2*s+1)))) have hu := Real.rpow_le_rpow_of_exponent_le hn1 (neg_le_neg (min_le_right (1/2 : ℝ) (2*s/(2*s+1)))) nlinarith [mul_le_mul_of_nonneg_left hb hB, mul_le_mul_of_nonneg_left hu hB]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_radius_power_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:100
theorem coordinate_radii_power_bounds

The two prescribed coordinate radii have absolute uniform power bounds. Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
k :
resolutions E N n α β
8*(k.1 : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k.1) ≤ 128*(n : ℝ)^(-exponentA α β)
25*(k.2 : ℝ)^(-2*β)+sqrt (20*varianceRadius n k.2) ≤ 128*(n : ℝ)^(-exponentB β)
Proof (Lean source)
-- @node: coordinate_radii_power_bounds lemma coordinate_radii_power_bounds (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) : let k := resolutions E N n α β (8*(k.1 : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k.1) ≤ 128*(n : ℝ)^(-exponentA α β)) ∧ (25*(k.2 : ℝ)^(-2*β)+sqrt (20*varianceRadius n k.2) ≤ 128*(n : ℝ)^(-exponentB β)) := by obtain ⟨hcl, hcu, hsl, hsu⟩ := resolutions_target_bounds E hE N hN n hn α β hab have hα : 0 < α := hab.1.trans hab.2.2.1 have hc := rank_radius_power_bound n (resolutions E N n α β).1 hn (α+β) 8 (by linarith [hab.1]) (by norm_num) (by convert hcl using 1 <;> congr 1 <;> ring) (by convert hcu using 1 <;> congr 1 <;> ring) have hs := rank_radius_power_bound n (resolutions E N n α β).2 hn (2*β) 25 (by linarith [hab.1]) (by norm_num) (by convert hsl using 1 <;> congr 1 <;> ring) (by convert hsu using 1 <;> congr 1 <;> ring) have hmin : min (1/2 : ℝ) (2*(2*β)/(2*(2*β)+1)) = exponentB β := by dsimp [exponentB] rw [min_eq_right] · congr 1 <;> ring · apply (div_le_iff₀ (by linarith [hab.1] : 0 < 2*(2*β)+1)).mpr linarith [hab.2.1] have hca : min (1/2 : ℝ) (2*(α+β)/(2*(α+β)+1)) = exponentA α β := by dsimp [exponentA] congr 2 <;> ring rw [hca] at hc rw [hmin] at hs dsimp only constructor · exact hc.trans (mul_le_mul_of_nonneg_right (by norm_num) (by positivity)) · convert hs.trans (mul_le_mul_of_nonneg_right (show (25 : ℝ)+80 ≤ 128 by norm_num) (Real.rpow_nonneg (Nat.cast_nonneg n) _)) using 1 <;> congr 2 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinate_radii_power_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:117
theorem diagnostic_power_bounds

The diagnostic powers are at most one, and the numerator absorbs inverse sample size. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
conclusion 1
(n : ℝ)^(-exponentA α β) ≤ 1
conclusion 2
(n : ℝ)^(-exponentB β) ≤ 1
conclusion 3
1/(n : ℝ) ≤ (n : ℝ)^(-exponentA α β)
Proof (Lean source)
-- @node: diagnostic_power_bounds lemma diagnostic_power_bounds (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) : (n : ℝ)^(-exponentA α β) ≤ 1 ∧ (n : ℝ)^(-exponentB β) ≤ 1 ∧ 1/(n : ℝ) ≤ (n : ℝ)^(-exponentA α β) := by have hn1 : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by omega) have hα : 0 < α := hab.1.trans hab.2.2.1 have hβ : 0 < β := hab.1 have ha0 : 0 ≤ exponentA α β := by dsimp [exponentA]; positivity have hb0 : 0 ≤ exponentB β := by dsimp [exponentB]; positivity have ha1 : exponentA α β ≤ 1 := (min_le_left (1/2 : ℝ) _).trans (by norm_num) refine ⟨Real.rpow_le_one_of_one_le_of_nonpos hn1 (by linarith), Real.rpow_le_one_of_one_le_of_nonpos hn1 (by linarith), ?_⟩ simpa [Real.rpow_neg_one, one_div] using Real.rpow_le_rpow_of_exponent_le hn1 (neg_le_neg ha1)
CausalSmith.Stat.LogoddsLowsmoothFrontier.diagnostic_power_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:152
theorem radius_sensitivity_rate_assembly Lemma radius_sensitivity_rate_assembly in the paper ↗

The sensitivity formula assembles into the diagnostic profile without a remainder. Under the stated assumptions.

Formal statement
x A B bC bS L H T r :
ℝ
hx :
0 < x
hA :
0 ≤ A
hB :
0 ≤ B
hB1 :
B ≤ 1
hc0 :
0 ≤ bC
hs0 :
0 ≤ bS
hc :
bC ≤ 128*A
hs :
bS ≤ 128*B
hInv :
1/x ≤ A
hL :
0 ≤ L
hH :
0 ≤ H
hT :
0 ≤ T
hr :
0 ≤ r
L*bC+H*bS*(T*r+2*bC)+2/x ≤ (128*L+32768*H+128*H*T+2)*(A+r*B)
Proof (Lean source)
-- @node: radius_sensitivity_rate_assembly lemma radius_sensitivity_rate_assembly (x A B bC bS L H T r : ℝ) (hx : 0 < x) (hA : 0 ≤ A) (hB : 0 ≤ B) (hB1 : B ≤ 1) (hc0 : 0 ≤ bC) (hs0 : 0 ≤ bS) (hc : bC ≤ 128*A) (hs : bS ≤ 128*B) (hInv : 1/x ≤ A) (hL : 0 ≤ L) (hH : 0 ≤ H) (hT : 0 ≤ T) (hr : 0 ≤ r) : L*bC+H*bS*(T*r+2*bC)+2/x ≤ (128*L+32768*H+128*H*T+2)*(A+r*B) := by have hcross : H*B*A ≤ H*A := by have h := mul_le_mul_of_nonneg_right hB1 hA have h' := mul_le_mul_of_nonneg_left h hH simpa [mul_assoc] using h' calc L*bC+H*bS*(T*r+2*bC)+2/x ≤ L*(128*A)+H*(128*B)*(T*r+2*(128*A))+2*A := by have hi : 2/x ≤ 2*A := by calc 2/x = 2*(1/x) := by ring _ ≤ 2*A := mul_le_mul_of_nonneg_left hInv (by norm_num) gcongr _ ≤ (128*L+32768*H+2)*A+(128*H*T)*(r*B) := by nlinarith only [hcross] _ ≤ _ := by have h1 : 0 ≤ (128*H*T)*A := by positivity have h2 : 0 ≤ (128*L+32768*H+2)*(r*B) := by positivity nlinarith only [h1, h2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.radius_sensitivity_rate_assembly · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:171
theorem upper_radii_uniform_rate

A single absolute constant bounds the full rank-dependent sensitivity expression. Under the stated assumptions. The stated conclusion follows.

Formal statement
∃ K : ℝ,
1 ≤ K
conclusion 1
E.Admissible
hN :
N.Admissible
α β :
ℝ
n :
ℕ
2 ≤ n
r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
k :
resolutions E N n α β
bC :
8*(k.1 : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k.1)
bS :
25*(k.2 : ℝ)^(-2*β)+sqrt (20*varianceRadius n k.2)
2*exp (1/2)/denominatorFloor*bC+ 2*exp (1/2)/denominatorFloor^2*bS*(exp (1/2)*r+2*bC)+2/(n : ℝ)
≤ K*diagnosticEnvelope n α β r
Proof (Lean source)
-- @node: upper_radii_uniform_rate lemma upper_radii_uniform_rate : ∃ K : ℝ, 1 ≤ K ∧ ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 2 ≤ n → ∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → let k := resolutions E N n α β let bC := 8*(k.1 : ℝ)^(-(α+β))+sqrt (20*varianceRadius n k.1) let bS := 25*(k.2 : ℝ)^(-2*β)+sqrt (20*varianceRadius n k.2) 2*exp (1/2)/denominatorFloor*bC+ 2*exp (1/2)/denominatorFloor^2*bS*(exp (1/2)*r+2*bC)+2/(n : ℝ) ≤ K*diagnosticEnvelope n α β r := by let L := 2*exp (1/2)/denominatorFloor let H := 2*exp (1/2)/denominatorFloor^2 let T := exp (1/2 : ℝ) have hL : 0 ≤ L := by dsimp [L, denominatorFloor]; positivity have hH : 0 ≤ H := by dsimp [H, denominatorFloor]; positivity have hT : 0 ≤ T := (Real.exp_pos _).le refine ⟨128*L+32768*H+128*H*T+2, by nlinarith [mul_nonneg hH hT], ?_⟩ intro E hE N hN α β hab n hn r hr obtain ⟨hc, hs⟩ := coordinate_radii_power_bounds E hE N hN n hn α β hab obtain ⟨_, hB, hInv⟩ := diagnostic_power_bounds n hn α β hab exact radius_sensitivity_rate_assembly (n : ℝ) _ _ _ _ L H T r (by exact_mod_cast (show 0 < n by omega)) (by positivity) (by positivity) hB (by positivity) (by positivity) hc hs hInv hL hH hT hr.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.upper_radii_uniform_rate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/RankRates.lean:198
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.SeriesEnclosures 16 declarations The last half of the factorial dominates the public range bound.

Factorial tails for the prescribed scalar series

The last half of the factorial dominates the public range bound. The resulting geometric remainder certifies both literal polynomials. Monotonicity extends the exponential enclosure, and cosine Lipschitz continuity extends its midpoint bracket.

theorem series_half_factorial_bound Lemma series_half_factorial_bound in the paper ↗

[The last half of the factorial supplies the roadmap's power lower bound. the stated conclusion holds.

Formal statement
m :
ℕ
m ^ m ≤ factorial (2 * m)
Proof (Lean source)
-- @node: series_half_factorial_bound lemma series_half_factorial_bound (m : ℕ) : m ^ m ≤ factorial (2 * m) := by have h := Nat.factorial_mul_pow_sub_le_factorial (n := m) (m := 2 * m) (by omega) have hp : 1 ≤ factorial m := Nat.factorial_pos m rw [show 2 * m - m = m by omega] at h nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.series_half_factorial_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:20

The rational range bound dominates the absolute scalar argument. the stated conclusion holds.

Formal statement
z :
ℚ
|(z : ℝ)| ≤ (seriesBound z : ℝ)
Proof (Lean source)
-- @node: seriesBound_abs_le lemma seriesBound_abs_le (z : ℚ) : |(z : ℝ)| ≤ (seriesBound z : ℝ) := by have hceil := Int.le_ceil |z| have hn : (0 : ℤ) ≤ ⌈|z|⌉ := Int.ceil_nonneg (abs_nonneg z) have hc : (⌈|z|⌉ : ℤ) ≤ (seriesBound z : ℕ) := by unfold seriesBound rw [← Int.toNat_of_nonneg hn] exact_mod_cast le_max_right 1 (⌈|z|⌉ : ℤ).toNat have hz : |z| ≤ (seriesBound z : ℚ) := hceil.trans (by exact_mod_cast hc) exact_mod_cast hz
CausalSmith.Stat.LogoddsLowsmoothFrontier.seriesBound_abs_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:28
theorem series_first_omitted_bound Lemma series_first_omitted_bound in the paper ↗

A factorial term at the prescribed quadratic cutoff is at most a dyadic power. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
x :
ℝ
B m :
ℕ
hB :
|x| ≤ B
hm :
2 * B ^ 2 ≤ m
hm0 :
0 < m
|x| ^ (2 * m) / (factorial (2 * m) : ℝ) ≤ (1 / 2 : ℝ) ^ m
Proof (Lean source)
-- @node: series_first_omitted_bound lemma series_first_omitted_bound (x : ℝ) (B m : ℕ) (hB : |x| ≤ B) (hm : 2 * B ^ 2 ≤ m) (hm0 : 0 < m) : |x| ^ (2 * m) / (factorial (2 * m) : ℝ) ≤ (1 / 2 : ℝ) ^ m := by have hmR : (0 : ℝ) < m := by exact_mod_cast hm0 have hf : (m : ℝ) ^ m ≤ (factorial (2 * m) : ℝ) := by exact_mod_cast series_half_factorial_bound m calc |x| ^ (2 * m) / (factorial (2 * m) : ℝ) ≤ (B : ℝ) ^ (2 * m) / (m : ℝ) ^ m := by gcongr _ = ((B : ℝ) ^ 2 / m) ^ m := by rw [div_pow, ← pow_mul] _ ≤ (1 / 2 : ℝ) ^ m := by apply pow_le_pow_left₀ (by positivity) apply (div_le_iff₀ hmR).mpr have hh : 2 * (B : ℝ) ^ 2 ≤ m := by exact_mod_cast hm linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.series_first_omitted_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:40

[The public cutoff makes twice the first omitted term smaller than the scalar error. the stated conclusion holds.

Formal statement
q :
ℕ
z :
ℚ
|(z : ℝ)| ^ (2 * seriesCount q z) / (factorial (2 * seriesCount q z) : ℝ) * 2
≤ (rationalError (q + 3) : ℝ)
Proof (Lean source)
-- @node: series_tail_budget lemma series_tail_budget (q : ℕ) (z : ℚ) : |(z : ℝ)| ^ (2 * seriesCount q z) / (factorial (2 * seriesCount q z) : ℝ) * 2 ≤ (rationalError (q + 3) : ℝ) := by have hm : q + 6 ≤ seriesCount q z := le_max_right _ _ have hfirst := series_first_omitted_bound (z : ℝ) (seriesBound z) (seriesCount q z) (seriesBound_abs_le z) (le_max_left _ _) (by omega) calc _ ≤ (1 / 2 : ℝ) ^ seriesCount q z * 2 := mul_le_mul_of_nonneg_right hfirst (by norm_num) _ ≤ (1 / 2 : ℝ) ^ (q + 4) * 2 := by apply mul_le_mul_of_nonneg_right _ (by norm_num) exact pow_le_pow_of_le_one (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num) (by omega) _ = (rationalError (q + 3) : ℝ) := by push_cast [rationalError] rw [div_pow, one_pow, show q + 4 = (q + 3) + 1 by omega, pow_succ] field_simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.series_tail_budget · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:58

The geometric tail estimate for the real exponential series, including negative inputs. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
x :
ℝ
n :
ℕ
h :
|x| / (n + 1) ≤ 1 / 2
|exp x - ∑ j ∈ range n, x ^ j / (Nat.factorial j : ℝ)|
≤ |x| ^ n / (Nat.factorial n : ℝ) * 2
Proof (Lean source)
-- @node: series_exp_remainder lemma series_exp_remainder (x : ℝ) (n : ℕ) (h : |x| / (n + 1) ≤ 1 / 2) : |exp x - ∑ j ∈ range n, x ^ j / (Nat.factorial j : ℝ)| ≤ |x| ^ n / (Nat.factorial n : ℝ) * 2 := by have hc := Complex.exp_bound' (x := (x : ℂ)) (n := n) (by simpa using h) simpa only [← Complex.ofReal_pow, ← Complex.ofReal_natCast, ← Complex.ofReal_div, ← Complex.ofReal_sum, ← Complex.ofReal_exp, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using hc
CausalSmith.Stat.LogoddsLowsmoothFrontier.series_exp_remainder · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:76

[Successive tail terms have ratio at most one half at the public cutoff. the stated conclusion holds.

Formal statement
q :
ℕ
z :
ℚ
|(z : ℝ)| / (2 * seriesCount q z + 1) ≤ 1 / 2
Proof (Lean source)
-- @node: series_argument_ratio lemma series_argument_ratio (q : ℕ) (z : ℚ) : |(z : ℝ)| / (2 * seriesCount q z + 1) ≤ 1 / 2 := by have hB : 1 ≤ seriesBound z := le_max_left _ _ have hm : 2 * seriesBound z ^ 2 ≤ seriesCount q z := le_max_left _ _ apply (div_le_iff₀ (by positivity : (0 : ℝ) < 2 * seriesCount q z + 1)).mpr have hBR : (1 : ℝ) ≤ seriesBound z := by exact_mod_cast hB have hmR : 2 * (seriesBound z : ℝ) ^ 2 ≤ seriesCount q z := by exact_mod_cast hm nlinarith [seriesBound_abs_le z]
CausalSmith.Stat.LogoddsLowsmoothFrontier.series_argument_ratio · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:86

The specified exponential polynomial approximates its scalar value at the internal precision. the stated conclusion holds.

Formal statement
q :
ℕ
z :
ℚ
|exp (z : ℝ) - (expPolynomial q z : ℝ)| ≤ (rationalError (q + 3) : ℝ)
Proof (Lean source)
-- @node: expPolynomial_error lemma expPolynomial_error (q : ℕ) (z : ℚ) : |exp (z : ℝ) - (expPolynomial q z : ℝ)| ≤ (rationalError (q + 3) : ℝ) := by have hrat := series_argument_ratio q z have h := (series_exp_remainder (z : ℝ) (2 * seriesCount q z) (by simpa only [Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one] using hrat)).trans (series_tail_budget q z) simpa only [expPolynomial, Rat.cast_sum, Rat.cast_div, Rat.cast_pow, Rat.cast_natCast] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.expPolynomial_error · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:97
theorem paperExpScalar_floor_le Lemma paperExpScalar_floor_le in the paper ↗

The positive floor in the scalar exponential bracket lies below its true value. the stated conclusion holds.

Formal statement
z :
ℚ
(1 / (3 : ℚ) ^ seriesBound z : ℝ) ≤ exp (z : ℝ)
Proof (Lean source)
-- @node: paperExpScalar_floor_le lemma paperExpScalar_floor_le (z : ℚ) : (1 / (3 : ℚ) ^ seriesBound z : ℝ) ≤ exp (z : ℝ) := by have hz : -(seriesBound z : ℝ) ≤ (z : ℝ) := by have h := (abs_le.mp (seriesBound_abs_le z)).1 exact h calc _ = 1 / (3 : ℝ) ^ seriesBound z := by push_cast; rfl _ ≤ 1 / (exp 1) ^ seriesBound z := by apply one_div_le_one_div_of_le (by positivity) exact pow_le_pow_left₀ (Real.exp_pos 1).le Real.exp_one_lt_three.le (seriesBound z) _ = exp (-(seriesBound z : ℝ)) := by rw [Real.exp_neg, ← Real.exp_nat_mul] simp _ ≤ exp (z : ℝ) := Real.exp_le_exp.mpr hz
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperExpScalar_floor_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:107
theorem series_scalar_error_budget Lemma series_scalar_error_budget in the paper ↗

The internal two-sided error is smaller than the primitive tolerance. the stated conclusion holds.

Formal statement
q :
ℕ
2 * (rationalError (q + 3) : ℝ) ≤ precisionError q
Proof (Lean source)
-- @node: series_scalar_error_budget lemma series_scalar_error_budget (q : ℕ) : 2 * (rationalError (q + 3) : ℝ) ≤ precisionError q := by simp only [rationalError, precisionError, zpow_neg, zpow_natCast] push_cast rw [pow_add] norm_num have hp : (0 : ℝ) < 2 ^ q := by positivity have hi : (0 : ℝ) ≤ (2 ^ q)⁻¹ := by positivity linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.series_scalar_error_budget · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:124

The scalar bracket contains the exponential, has positive floor, and bounded endpoint excess. the stated conclusion holds.

Formal statement
q :
ℕ
z :
ℚ
conclusion 1
(paperExpScalar q z).Contains (exp z)
conclusion 2
0 < (paperExpScalar q z).lo
conclusion 3
exp z - (paperExpScalar q z).lo ≤ precisionError q
conclusion 4
(paperExpScalar q z).hi - exp z ≤ precisionError q
Proof (Lean source)
-- @node: paperExpScalar_spec lemma paperExpScalar_spec (q : ℕ) (z : ℚ) : (paperExpScalar q z).Contains (exp z) ∧ 0 < (paperExpScalar q z).lo ∧ exp z - (paperExpScalar q z).lo ≤ precisionError q ∧ (paperExpScalar q z).hi - exp z ≤ precisionError q := by have he := abs_le.mp (expPolynomial_error q z) have hf := paperExpScalar_floor_le z have hord : max (1 / (3 : ℚ) ^ seriesBound z) (expPolynomial q z - rationalError (q + 3)) ≤ expPolynomial q z + rationalError (q + 3) := by have hl : ((max (1 / (3 : ℚ) ^ seriesBound z) (expPolynomial q z - rationalError (q + 3))) : ℝ) ≤ exp z := by push_cast exact max_le hf (by linarith) have hu : exp z ≤ ((expPolynomial q z + rationalError (q + 3)) : ℝ) := by linarith exact_mod_cast hl.trans hu simp only [paperExpScalar, rationalBox, min_eq_left hord, max_eq_right hord, RatInterval.Contains] have hfloor : (0 : ℚ) < 1 / (3 : ℚ) ^ seriesBound z := by positivity have hbudget := series_scalar_error_budget q refine ⟨⟨?_, ?_⟩, hfloor.trans_le (le_max_left _ _), ?_, ?_⟩ · push_cast exact max_le hf (by linarith) · push_cast linarith · have hmax : (expPolynomial q z : ℝ) - rationalError (q + 3) ≤ ((max (1 / (3 : ℚ) ^ seriesBound z) (expPolynomial q z - rationalError (q + 3))) : ℝ) := by push_cast exact le_max_right _ _ push_cast linarith · push_cast linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperExpScalar_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:136
theorem endpointExtension_monotone_contract

Monotonicity extends scalar containment and excess to the two endpoint evaluations. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
F :
ℝ → ℝ
hF :
S :
ℕ → ℚ → RatInterval
q :
ℕ
hS :
∀ z,
(S q z).Contains (F z) ∧
F z - (S q z).lo ≤ precisionError q ∧
(S q z).hi - F z ≤ precisionError q
conclusion 1
conclusion 2
(endpointExtension S q I).lo = (S q I.lo).lo
Proof (Lean source)
-- @node: endpointExtension_monotone_contract lemma endpointExtension_monotone_contract (F : ℝ → ℝ) (hF : Monotone F) (S : ℕ → ℚ → RatInterval) (q : ℕ) (I : RatInterval) (hS : ∀ z, (S q z).Contains (F z) ∧ F z - (S q z).lo ≤ precisionError q ∧ (S q z).hi - F z ≤ precisionError q) : MonotoneContract F q I (endpointExtension S q I) ∧ (endpointExtension S q I).lo = (S q I.lo).lo := by obtain ⟨hl, hlE, _⟩ := hS I.lo obtain ⟨hu, _, huE⟩ := hS I.hi have horderR : ((S q I.lo).lo : ℝ) ≤ (S q I.hi).hi := hl.1.trans ((hF (by exact_mod_cast I.lo_le_hi)).trans hu.2) have horder : (S q I.lo).lo ≤ (S q I.hi).hi := by exact_mod_cast horderR simp only [endpointExtension, rationalBox, min_eq_left horder, max_eq_right horder, MonotoneContract, RatInterval.Contains] refine ⟨⟨?_, sub_nonneg.mpr hl.1, hlE, sub_nonneg.mpr hu.2, huE⟩, True.intro⟩ intro x hx exact ⟨hl.1.trans (hF hx.1), (hF hx.2).trans hu.2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.endpointExtension_monotone_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:174
theorem concreteEngine_exp_contract

The literal concrete exponential routine meets the primitive image and excess contract. the stated conclusion holds.

Formal statement
q :
ℕ
conclusion 1
MonotoneContract exp q I (concreteEngine.expBox q I)
conclusion 2
0 < (concreteEngine.expBox q I).lo
Proof (Lean source)
-- @node: concreteEngine_exp_contract lemma concreteEngine_exp_contract (q : ℕ) (I : RatInterval) : MonotoneContract exp q I (concreteEngine.expBox q I) ∧ 0 < (concreteEngine.expBox q I).lo := by have h := endpointExtension_monotone_contract exp Real.exp_monotone paperExpScalar q I (fun z => ⟨(paperExpScalar_spec q z).1, (paperExpScalar_spec q z).2.2⟩) refine ⟨h.1, ?_⟩ change 0 < (endpointExtension paperExpScalar q I).lo rw [h.2] exact (paperExpScalar_spec q I.lo).2.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_exp_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:193

The real part of the even-length imaginary exponential polynomial is the cosine polynomial. the stated conclusion holds.

Formal statement
z :
ℝ
m :
ℕ
(∑ j ∈ range (2*m), ((z : ℂ)*I)^j / (Nat.factorial j : ℂ)).re
= ∑ j ∈ range m, (-1 : ℝ)^j*z^(2*j)/(Nat.factorial (2*j) : ℝ)
Proof (Lean source)
-- @node: cosine_exp_partial_re lemma cosine_exp_partial_re (z : ℝ) (m : ℕ) : (∑ j ∈ range (2*m), ((z : ℂ)*I)^j / (Nat.factorial j : ℂ)).re = ∑ j ∈ range m, (-1 : ℝ)^j*z^(2*j)/(Nat.factorial (2*j) : ℝ) := by induction m with | zero => simp | succ m ih => rw [show 2*(m+1) = (2*m+1)+1 by omega, Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_succ] simp only [Complex.add_re, ih] have he : ((z : ℂ)*I)^(2*m) = (z : ℂ)^(2*m)*(-1 : ℂ)^m := by rw [mul_pow, pow_mul I 2 m, Complex.I_sq] rw [pow_succ, he] simp only [← Complex.ofReal_one, ← Complex.ofReal_neg, ← Complex.ofReal_pow, Complex.div_natCast_re, Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, Complex.I_im] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosine_exp_partial_re · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:206

The cosine remainder is the real part of an exponential remainder at an imaginary argument. the stated conclusion holds.

Formal statement
q :
ℕ
z :
ℚ
|cos (z : ℝ) - (cosPolynomial q z : ℝ)| ≤ (rationalError (q + 3) : ℝ)
Proof (Lean source)
-- @node: cosPolynomial_error lemma cosPolynomial_error (q : ℕ) (z : ℚ) : |cos (z : ℝ) - (cosPolynomial q z : ℝ)| ≤ (rationalError (q + 3) : ℝ) := by have hr := series_argument_ratio q z have hx : ‖((z : ℝ) : ℂ) * Complex.I‖ / (2 * seriesCount q z + 1 : ℕ) ≤ 1 / 2 := by simpa only [norm_mul, Complex.norm_real, Real.norm_eq_abs, Complex.norm_I, mul_one, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one] using hr have h := Complex.exp_bound' (x := ((z : ℝ) : ℂ) * I) (n := 2 * seriesCount q z) hx have hRe := (Complex.abs_re_le_norm (exp (((z : ℝ) : ℂ) * I) - ∑ j ∈ range (2 * seriesCount q z), (((z : ℝ) : ℂ) * I) ^ j / (Nat.factorial j : ℂ))).trans h simp only [Complex.sub_re, Complex.exp_ofReal_mul_I_re, cosine_exp_partial_re, norm_mul, Complex.norm_real, Real.norm_eq_abs, Complex.norm_I, mul_one] at hRe apply le_trans _ (series_tail_budget q z) simpa only [cosPolynomial, Rat.cast_sum, Rat.cast_div, Rat.cast_mul, Rat.cast_pow, Rat.cast_neg, Rat.cast_one, Rat.cast_natCast] using hRe
CausalSmith.Stat.LogoddsLowsmoothFrontier.cosPolynomial_error · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:225

Clipping the scalar cosine bracket preserves containment and bounds both endpoint excesses. the stated conclusion holds.

Formal statement
q :
ℕ
z :
ℚ
conclusion 1
(paperCosScalar q z).Contains (cos z)
conclusion 2
cos z - (paperCosScalar q z).lo ≤ precisionError q
conclusion 3
(paperCosScalar q z).hi - cos z ≤ precisionError q
conclusion 4
-1 ≤ (paperCosScalar q z).lo
conclusion 5
(paperCosScalar q z).hi ≤ 1
Proof (Lean source)
-- @node: paperCosScalar_spec lemma paperCosScalar_spec (q : ℕ) (z : ℚ) : (paperCosScalar q z).Contains (cos z) ∧ cos z - (paperCosScalar q z).lo ≤ precisionError q ∧ (paperCosScalar q z).hi - cos z ≤ precisionError q ∧ -1 ≤ (paperCosScalar q z).lo ∧ (paperCosScalar q z).hi ≤ 1 := by have he := abs_le.mp (cosPolynomial_error q z) have hlo : ((max (-1) (cosPolynomial q z - rationalError (q + 3)) : ℚ) : ℝ) ≤ cos z := by push_cast exact max_le (Real.neg_one_le_cos _) (by linarith) have hhi : cos z ≤ ((min 1 (cosPolynomial q z + rationalError (q + 3)) : ℚ) : ℝ) := by push_cast exact le_min (Real.cos_le_one _) (by linarith) have hord : max (-1) (cosPolynomial q z - rationalError (q + 3)) ≤ min 1 (cosPolynomial q z + rationalError (q + 3)) := by exact_mod_cast hlo.trans hhi simp only [paperCosScalar, rationalBox, min_eq_left hord, max_eq_right hord, RatInterval.Contains] have hbudget := series_scalar_error_budget q refine ⟨⟨hlo, hhi⟩, ?_, ?_, le_max_left _ _, min_le_left _ _⟩ · have hl : (cosPolynomial q z : ℝ) - rationalError (q + 3) ≤ ((max (-1) (cosPolynomial q z - rationalError (q + 3)) : ℚ) : ℝ) := by push_cast exact le_max_right _ _ push_cast at * linarith · have hu : ((min 1 (cosPolynomial q z + rationalError (q + 3)) : ℚ) : ℝ) ≤ (cosPolynomial q z : ℝ) + rationalError (q + 3) := by push_cast exact min_le_right _ _ push_cast at * linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperCosScalar_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:246
theorem concreteEngine_cos_contract

The midpoint bracket, enlarged by the half width and clipped, satisfies the cosine primitive. the stated conclusion holds.

Formal statement
q :
ℕ
m :
((I.lo : ℝ) + I.hi) / 2 (: ℝ)
w :
((I.hi : ℝ) - I.lo) / 2 (: ℝ)
x :
I.Contains x
(concreteEngine.cosBox q I).Contains (cos x)
∃ a b : ℚ,
(a : ℝ) ≤ cos m
cos m ≤ b
cos m - a ≤ precisionError q
(b : ℝ) - cos m ≤ precisionError q
-1 ≤ a
b ≤ 1
(concreteEngine.cosBox q I).lo = max (-1) (a - (I.hi - I.lo) / 2)
(concreteEngine.cosBox q I).hi = min 1 (b + (I.hi - I.lo) / 2)
((concreteEngine.cosBox q I).width : ℝ) ≤ 2 * w + 2 * precisionError q
Proof (Lean source)
-- @node: concreteEngine_cos_contract lemma concreteEngine_cos_contract (q : ℕ) (I : RatInterval) : let m : ℝ := ((I.lo : ℝ) + I.hi) / 2 let w : ℝ := ((I.hi : ℝ) - I.lo) / 2 (∀ x, I.Contains x → (concreteEngine.cosBox q I).Contains (cos x)) ∧ ∃ a b : ℚ, (a : ℝ) ≤ cos m ∧ cos m ≤ b ∧ cos m - a ≤ precisionError q ∧ (b : ℝ) - cos m ≤ precisionError q ∧ -1 ≤ a ∧ b ≤ 1 ∧ (concreteEngine.cosBox q I).lo = max (-1) (a - (I.hi - I.lo) / 2) ∧ (concreteEngine.cosBox q I).hi = min 1 (b + (I.hi - I.lo) / 2) ∧ ((concreteEngine.cosBox q I).width : ℝ) ≤ 2 * w + 2 * precisionError q := by dsimp only let z : ℚ := (I.lo + I.hi) / 2 let J := paperCosScalar q z obtain ⟨hJ, hlE, huE, hl, hu⟩ := paperCosScalar_spec q z have hz : (z : ℝ) = ((I.lo : ℝ) + I.hi) / 2 := by dsimp [z]; push_cast; rfl have hw : (0 : ℚ) ≤ I.width / 2 := div_nonneg I.width_nonneg (by norm_num) have hwR : (0 : ℝ) ≤ ((I.hi : ℝ) - I.lo) / 2 := by exact div_nonneg (sub_nonneg.mpr (by exact_mod_cast I.lo_le_hi)) (by norm_num) have horder : max (-1) (J.lo - I.width / 2) ≤ min 1 (J.hi + I.width / 2) := by apply max_le · exact le_min (by norm_num) (by linarith [J.lo_le_hi]) · exact le_min (by linarith [J.lo_le_hi]) (by linarith [J.lo_le_hi]) have hlo : (concreteEngine.cosBox q I).lo = max (-1) (J.lo - I.width / 2) := by change min (max (-1) (J.lo - I.width / 2)) (min 1 (J.hi + I.width / 2)) = _ exact min_eq_left horder have hhi : (concreteEngine.cosBox q I).hi = min 1 (J.hi + I.width / 2) := by change max (max (-1) (J.lo - I.width / 2)) (min 1 (J.hi + I.width / 2)) = _ exact max_eq_right horder constructor · intro x hx have hdist : |x - (z : ℝ)| ≤ ((I.hi : ℝ) - I.lo) / 2 := by rw [hz, abs_le] constructor <;> linarith [hx.1, hx.2] have hc := abs_le.mp ((Real.abs_cos_sub_cos_le x z).trans hdist) simp only [RatInterval.Contains, hlo, hhi] push_cast [RatInterval.width] constructor · exact max_le (Real.neg_one_le_cos _) (by linarith [hJ.1]) · exact le_min (Real.cos_le_one _) (by linarith [hJ.2]) · refine ⟨J.lo, J.hi, ?_, ?_, ?_, ?_, hl, hu, ?_, ?_, ?_⟩ · simpa only [← hz] using hJ.1 · simpa only [← hz] using hJ.2 · simpa only [← hz] using hlE · simpa only [← hz] using huE · simpa only [RatInterval.width] using hlo · simpa only [RatInterval.width] using hhi · have hLo : (J.lo : ℝ) - ((I.hi : ℝ) - I.lo) / 2 ≤ ((concreteEngine.cosBox q I).lo : ℝ) := by rw [hlo] push_cast [RatInterval.width] exact le_max_right _ _ have hHi : ((concreteEngine.cosBox q I).hi : ℝ) ≤ (J.hi : ℝ) + ((I.hi : ℝ) - I.lo) / 2 := by rw [hhi] push_cast [RatInterval.width] exact min_le_right _ _ simp only [RatInterval.width, Rat.cast_sub] linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_cos_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SeriesEnclosures.lean:281
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.SignComponents 18 declarations Original records sharing an endpoint sign are adjacent in the cell graph.

Factorization of the finite endpoint-sign prior

Original records sharing an endpoint sign are adjacent in the cell graph. Distinct connected components therefore use disjoint signs. Regrouping the uniform prior by sign ownership factors arbitrary component likelihoods.

[The two endpoint indices on which a record depends.

Definition (Lean source)
k :
ℕ
x :
recordSignEndpoints k x :
Finset ℕ
{cellIndex k x, cellIndex k x + 1}
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordSignEndpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:17

Equal and adjacent cells join distinct original records.

Definition (Lean source)
n :
ℕ
k :
ℕ
x :
originalRecordSignGraph k x :
clause 1
Adj i j := i ≠ j ∧
cellIndex k (x i) ≤ cellIndex k (x j) + 1 ∧
cellIndex k (x j) ≤ cellIndex k (x i) + 1
clause 2
symm := ⟨fun _ _ h => ⟨h.1.symm, h.2.2, h.2.1⟩⟩
clause 3
loopless := ⟨fun _ h => h.1 rfl⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.originalRecordSignGraph · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:22
theorem shared_sign_records_reachable

A shared latent endpoint forces the records into the same connected component. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
k :
ℕ
x :
i j :
Fin n
s :
ℕ
hi :
s ∈ recordSignEndpoints k (x i)
hj :
s ∈ recordSignEndpoints k (x j)
Proof (Lean source)
-- @node: shared_sign_records_reachable lemma shared_sign_records_reachable {n : ℕ} (k : ℕ) (x : Fin n → Covariate) (i j : Fin n) (s : ℕ) (hi : s ∈ recordSignEndpoints k (x i)) (hj : s ∈ recordSignEndpoints k (x j)) : (originalRecordSignGraph k x).Reachable i j := by by_cases hij : i = j · subst j; exact SimpleGraph.Reachable.refl _ · apply SimpleGraph.Adj.reachable refine ⟨hij, ?_, ?_⟩ all_goals simp only [recordSignEndpoints, Finset.mem_insert, Finset.mem_singleton] at hi hj omega
CausalSmith.Stat.LogoddsLowsmoothFrontier.shared_sign_records_reachable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:31
theorem distinct_components_disjoint_signs

Distinct latent-sign components have disjoint endpoint sets. Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
x :
i j :
Fin n
hij :
Proof (Lean source)
-- @node: distinct_components_disjoint_signs lemma distinct_components_disjoint_signs {n : ℕ} (k : ℕ) (x : Fin n → Covariate) (i j : Fin n) (hij : ¬ (originalRecordSignGraph k x).Reachable i j) : Disjoint (recordSignEndpoints k (x i)) (recordSignEndpoints k (x j)) := by apply Finset.disjoint_left.mpr intro s hi hj exact hij (shared_sign_records_reachable k x i j s hi hj)
CausalSmith.Stat.LogoddsLowsmoothFrontier.distinct_components_disjoint_signs · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:45
theorem signPrior_fiber_factorization Lemma signPrior_fiber_factorization in the paper ↗

[Regrouping independent uniform signs into arbitrary ownership fibers factors all component averages, including empty fibers for unused signs. the documented result Under the stated assumptions.

Formal statement
ι κ :
owner :
ι → κ
F :
∀ c : κ
if
({s : ι // owner s = c} → Bool)
then
ℝ
(card (ι → Bool) : ℝ)⁻¹ * (∑ σ : ι → Bool, ∏ c : κ, F c (fun s => σ s.1))
= ∏ c : κ, (card ({s : ι // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : ι // owner s = c} → Bool, F c σ
Proof (Lean source)
-- @node: signPrior_fiber_factorization lemma signPrior_fiber_factorization {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] (owner : ι → κ) (F : ∀ c : κ, ({s : ι // owner s = c} → Bool) → ℝ) : (card (ι → Bool) : ℝ)⁻¹ * (∑ σ : ι → Bool, ∏ c : κ, F c (fun s => σ s.1)) = ∏ c : κ, (card ({s : ι // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : ι // owner s = c} → Bool, F c σ := by classical let e : (ι → Bool) ≃ (∀ c : κ, {s : ι // owner s = c} → Bool) := Equiv.piCongrFiberwise (fun _ => Equiv.refl _) have hsum : (∑ σ : ι → Bool, ∏ c : κ, F c (fun s => σ s.1)) = ∏ c : κ, ∑ σ : {s : ι // owner s = c} → Bool, F c σ := by calc _ = ∑ σ : (∀ c : κ, {s : ι // owner s = c} → Bool), ∏ c, F c (σ c) := e.sum_comp (fun σ => ∏ c, F c (σ c)) _ = _ := (Fintype.prod_sum F).symm have hcard : (card (ι → Bool) : ℝ) = ∏ c : κ, (card ({s : ι // owner s = c} → Bool) : ℝ) := by rw [Fintype.card_congr e, Fintype.card_pi, Nat.cast_prod] rw [hsum, hcard, ← Finset.prod_inv_distrib, ← Finset.prod_mul_distrib]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPrior_fiber_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:54

Extend one component's signs arbitrarily outside its ownership fiber.

Definition (Lean source)
ι κ :
Type*
owner :
ι → κ
c :
κ
σ :
{s : ι // owner s = c} → Bool
s :
ι
componentSignExtension owner c σ s :
if h : owner s = c then σ ⟨s, h⟩ else false
CausalSmith.Stat.LogoddsLowsmoothFrontier.componentSignExtension · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:78
theorem signPrior_likelihood_factorization

Likelihood products factor under the finite prior when each record uses only signs assigned to its block. This allows dependence between records in a block. the documented result Under the stated assumptions.

Formal statement
ι κ ν :
owner :
ι → κ
block :
ν → κ
f :
ν → (ι → Bool) → ℝ
hlocal :
∀ i σ τ
if
(∀ s, owner s = block i → σ s = τ s)
then
f i σ = f i τ
(card (ι → Bool) : ℝ)⁻¹ * (∑ σ : ι → Bool, ∏ i : ν, f i σ)
= ∏ c : κ, (card ({s : ι // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : ι // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), f i (componentSignExtension owner c σ)
Proof (Lean source)
-- @node: signPrior_likelihood_factorization lemma signPrior_likelihood_factorization {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν] [DecidableEq ι] [DecidableEq κ] (owner : ι → κ) (block : ν → κ) (f : ν → (ι → Bool) → ℝ) (hlocal : ∀ i σ τ, (∀ s, owner s = block i → σ s = τ s) → f i σ = f i τ) : (card (ι → Bool) : ℝ)⁻¹ * (∑ σ : ι → Bool, ∏ i : ν, f i σ) = ∏ c : κ, (card ({s : ι // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : ι // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), f i (componentSignExtension owner c σ) := by classical let F (c : κ) (σ : {s : ι // owner s = c} → Bool) : ℝ := ∏ i ∈ Finset.univ.filter (fun i => block i = c), f i (componentSignExtension owner c σ) have hprod (σ : ι → Bool) : (∏ i : ν, f i σ) = ∏ c : κ, F c (fun s => σ s.1) := by rw [← Finset.prod_fiberwise univ block (fun i => f i σ)] apply Finset.prod_congr rfl intro c hc apply Finset.prod_congr rfl intro i hi apply hlocal intro s hs have hic := (Finset.mem_filter.mp hi).2 simp [componentSignExtension, hs, hic] simp_rw [hprod] exact signPrior_fiber_factorization owner F
CausalSmith.Stat.LogoddsLowsmoothFrontier.signPrior_likelihood_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:84
theorem signFieldZ_endpoint_congr

A record's sign field depends only on its two endpoint signs. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
k :
ℕ
σ τ :
Fin (k+1) → Bool
x :
h :
∀ j ∈ recordSignEndpoints k x, endpointSign k σ j = endpointSign k τ j
signFieldZ k σ x = signFieldZ k τ x
Proof (Lean source)
-- @node: signFieldZ_endpoint_congr lemma signFieldZ_endpoint_congr (k : ℕ) (σ τ : Fin (k+1) → Bool) (x : Covariate) (h : ∀ j ∈ recordSignEndpoints k x, endpointSign k σ j = endpointSign k τ j) : signFieldZ k σ x = signFieldZ k τ x := by unfold signFieldZ dsimp only rw [h (cellIndex k x) (by simp [recordSignEndpoints]), h (cellIndex k x + 1) (by simp [recordSignEndpoints])]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signFieldZ_endpoint_congr · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:114
theorem mixedCells_endpoint_congr

Both mixed hypotheses use precisely the same local endpoint support. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ τ :
Fin (k+1) → Bool
η ζ :
ℝ
a y :
x :
h :
∀ j ∈ recordSignEndpoints k x, endpointSign k σ j = endpointSign k τ j
mixedCells b k σ η ζ a y x = mixedCells b k τ η ζ a y x
Proof (Lean source)
-- @node: mixedCells_endpoint_congr lemma mixedCells_endpoint_congr (b : Bool) (k : ℕ) (σ τ : Fin (k+1) → Bool) (η ζ : ℝ) (a y : Bool) (x : Covariate) (h : ∀ j ∈ recordSignEndpoints k x, endpointSign k σ j = endpointSign k τ j) : mixedCells b k σ η ζ a y x = mixedCells b k τ η ζ a y x := by unfold mixedCells rw [signFieldZ_endpoint_congr k σ τ x h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_endpoint_congr · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:124
theorem fairCells_endpoint_congr

The random fair family and the comparator use no signs outside these endpoints. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ τ :
Fin (k+1) → Bool
t δ :
ℝ
a y :
x :
h :
∀ j ∈ recordSignEndpoints k x, endpointSign k σ j = endpointSign k τ j
fairCells b k σ t δ a y x = fairCells b k τ t δ a y x
Proof (Lean source)
-- @node: fairCells_endpoint_congr lemma fairCells_endpoint_congr (b : Bool) (k : ℕ) (σ τ : Fin (k+1) → Bool) (t δ : ℝ) (a y : Bool) (x : Covariate) (h : ∀ j ∈ recordSignEndpoints k x, endpointSign k σ j = endpointSign k τ j) : fairCells b k σ t δ a y x = fairCells b k τ t δ a y x := by unfold fairCells rw [signFieldZ_endpoint_congr k σ τ x h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_endpoint_congr · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:133
theorem recordCells_prior_factorization

Local cell likelihoods factor whenever each endpoint is owned by its record's block. Under the stated assumptions. Under the stated assumptions.

Formal statement
n k :
ℕ
κ :
x :
owner :
Fin (k+1) → κ
block :
Fin n → κ
cell :
Fin n → (Fin (k+1) → Bool) → ℝ
hcell :
∀ i σ τ
if
(∀ j ∈ recordSignEndpoints k (x i), endpointSign k σ j = endpointSign k τ j)
then
cell i σ = cell i τ
howner :
∀ i j
if
j ∈ recordSignEndpoints k (x i)
then
owner ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ = block i
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ)
= ∏ c : κ, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ)
Proof (Lean source)
-- @node: recordCells_prior_factorization lemma recordCells_prior_factorization {n k : ℕ} {κ : Type*} [Fintype κ] [DecidableEq κ] (x : Fin n → Covariate) (owner : Fin (k+1) → κ) (block : Fin n → κ) (cell : Fin n → (Fin (k+1) → Bool) → ℝ) (hcell : ∀ i σ τ, (∀ j ∈ recordSignEndpoints k (x i), endpointSign k σ j = endpointSign k τ j) → cell i σ = cell i τ) (howner : ∀ i j, j ∈ recordSignEndpoints k (x i) → owner ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ = block i) : (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ) = ∏ c : κ, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ) := by apply signPrior_likelihood_factorization owner block cell intro i σ τ hsign apply hcell intro j hj unfold endpointSign rw [hsign _ (howner i j hj)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordCells_prior_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:142
theorem mixedCells_prior_factorization

[The conditional likelihood of the actual mixed formula factors without replacing original records or asserting independence inside a block. the documented result Under the stated assumptions.

Formal statement
n k :
ℕ
κ :
b :
η ζ :
ℝ
x :
a y :
Fin n → Bool
owner :
Fin (k+1) → κ
block :
Fin n → κ
howner :
∀ i j
if
j ∈ recordSignEndpoints k (x i)
then
owner ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ = block i
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, 4*mixedCells b k σ η ζ (a i) (y i) (x i))
= ∏ c : κ, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), 4*mixedCells b k (componentSignExtension owner c σ) η ζ (a i) (y i) (x i)
Proof (Lean source)
-- @node: mixedCells_prior_factorization lemma mixedCells_prior_factorization {n k : ℕ} {κ : Type*} [Fintype κ] [DecidableEq κ] (b : Bool) (η ζ : ℝ) (x : Fin n → Covariate) (a y : Fin n → Bool) (owner : Fin (k+1) → κ) (block : Fin n → κ) (howner : ∀ i j, j ∈ recordSignEndpoints k (x i) → owner ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ = block i) : (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, 4*mixedCells b k σ η ζ (a i) (y i) (x i)) = ∏ c : κ, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), 4*mixedCells b k (componentSignExtension owner c σ) η ζ (a i) (y i) (x i) := by apply recordCells_prior_factorization x owner block _ _ howner intro i σ τ h rw [mixedCells_endpoint_congr b k σ τ η ζ (a i) (y i) (x i) h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_prior_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:166
theorem fairCells_prior_factorization

[The same exact finite-prior factorization holds for the actual fair cells, including the deterministic comparator and both amplitude axes. the documented result Under the stated assumptions.

Formal statement
n k :
ℕ
κ :
b :
t δ :
ℝ
x :
a y :
Fin n → Bool
owner :
Fin (k+1) → κ
block :
Fin n → κ
howner :
∀ i j
if
j ∈ recordSignEndpoints k (x i)
then
owner ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ = block i
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, 4*fairCells b k σ t δ (a i) (y i) (x i))
= ∏ c : κ, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), 4*fairCells b k (componentSignExtension owner c σ) t δ (a i) (y i) (x i)
Proof (Lean source)
-- @node: fairCells_prior_factorization lemma fairCells_prior_factorization {n k : ℕ} {κ : Type*} [Fintype κ] [DecidableEq κ] (b : Bool) (t δ : ℝ) (x : Fin n → Covariate) (a y : Fin n → Bool) (owner : Fin (k+1) → κ) (block : Fin n → κ) (howner : ∀ i j, j ∈ recordSignEndpoints k (x i) → owner ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ = block i) : (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, 4*fairCells b k σ t δ (a i) (y i) (x i)) = ∏ c : κ, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), 4*fairCells b k (componentSignExtension owner c σ) t δ (a i) (y i) (x i) := by apply recordCells_prior_factorization x owner block _ _ howner intro i σ τ h rw [fairCells_endpoint_congr b k σ τ t δ (a i) (y i) (x i) h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_prior_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:185

[Components plus one empty record block accommodate unused endpoint signs.

Definition (Lean source)
n :
ℕ
k :
ℕ
x :
SignComponentBlock k x :
Type
CausalSmith.Stat.LogoddsLowsmoothFrontier.SignComponentBlock · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:204
instance signComponentBlock_fintype

The finite component quotient supports literal finite sign averages.](goal) Under the stated assumptions.

Definition (Lean source)
-- @node: signComponentBlock_fintype instance signComponentBlock_fintype {n : ℕ} (k : ℕ) (x : Fin n → Covariate) : Fintype (SignComponentBlock k x) := ofFinite _
CausalSmith.Stat.LogoddsLowsmoothFrontier.signComponentBlock_fintype · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:209
def signComponentOwner

[Assign a used endpoint sign to any incident record's component; unused signs are assigned to the empty block. Reachability makes this choice harmless.

Definition (Lean source)
n :
ℕ
k :
ℕ
x :
s :
Fin (k+1)
signComponentOwner k x s :
if h : ∃ i : Fin n, (s : ℕ) ∈ recordSignEndpoints k (x i) then some ((originalRecordSignGraph k x).connectedComponentMk (choose h)) else none
CausalSmith.Stat.LogoddsLowsmoothFrontier.signComponentOwner · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:214
theorem signComponentOwner_incident

Each record's two signs are owned by its actual graph component. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
i :
Fin n
j :
ℕ
hj :
j ∈ recordSignEndpoints k (x i)
Proof (Lean source)
-- @node: signComponentOwner_incident lemma signComponentOwner_incident {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (i : Fin n) (j : ℕ) (hj : j ∈ recordSignEndpoints k (x i)) : signComponentOwner k x ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ = some ((originalRecordSignGraph k x).connectedComponentMk i) := by classical have hjk : j ≤ k := by have hi := cellIndex_lt k hk (x i) simp only [recordSignEndpoints, Finset.mem_insert, Finset.mem_singleton] at hj omega let s : Fin (k+1) := ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩ have hs : (s : ℕ) = j := min_eq_left hjk have hex : ∃ i' : Fin n, (s : ℕ) ∈ recordSignEndpoints k (x i') := ⟨i, by simpa only [hs] using hj⟩ change signComponentOwner k x s = _ rw [signComponentOwner, dif_pos hex] congr 1 exact SimpleGraph.ConnectedComponent.sound (shared_sign_records_reachable k x (choose hex) i (s : ℕ) (Classical.choose_spec hex) (by simpa only [hs] using hj))
CausalSmith.Stat.LogoddsLowsmoothFrontier.signComponentOwner_incident · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:223
theorem recordCells_component_factorization

[Conditional finite-prior likelihoods factor over the actual connected components. The unused-sign block contributes an empty record product equal to one. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
x :
cell :
Fin n → (Fin (k+1) → Bool) → ℝ
hcell :
∀ i σ τ
if
(∀ j ∈ recordSignEndpoints k (x i), endpointSign k σ j = endpointSign k τ j)
then
cell i σ = cell i τ
owner :
block :
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ)
= ∏ c : SignComponentBlock k x, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ)
Proof (Lean source)
-- @node: recordCells_component_factorization lemma recordCells_component_factorization {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (x : Fin n → Covariate) (cell : Fin n → (Fin (k+1) → Bool) → ℝ) (hcell : ∀ i σ τ, (∀ j ∈ recordSignEndpoints k (x i), endpointSign k σ j = endpointSign k τ j) → cell i σ = cell i τ) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ) = ∏ c : SignComponentBlock k x, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ) := by classical exact recordCells_prior_factorization x (signComponentOwner k x) (fun i => some ((originalRecordSignGraph k x).connectedComponentMk i)) cell hcell (signComponentOwner_incident k hk x)
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordCells_component_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SignComponents.lean:246
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.SpatialGluing 6 declarations Closed cells cover the covariate interval.

Shared-endpoint spatial gluing

Closed cells cover the covariate interval. Matching endpoint values allow continuous local formulas to pass through the discontinuous cell selector.

On a closed cell the selector is its index, except possibly at its right endpoint. Under the stated assumptions. Under the stated assumptions.

Formal statement
k j :
ℕ
hj :
j < k
x :
hx :
(k : ℝ) * (x : ℝ) ∈ Icc (j : ℝ) (j + 1)
cellIndex k x = j ∨ (cellIndex k x = j + 1 ∧ (k : ℝ) * (x : ℝ) = j + 1)
Proof (Lean source)
-- @node: cellIndex_closed_cell lemma cellIndex_closed_cell (k j : ℕ) (hj : j < k) (x : Covariate) (hx : (k : ℝ) * (x : ℝ) ∈ Icc (j : ℝ) (j + 1)) : cellIndex k x = j ∨ (cellIndex k x = j + 1 ∧ (k : ℝ) * (x : ℝ) = j + 1) := by have hk : 1 ≤ k := by omega have hlo : j ≤ (⌊(k : ℝ) * (x : ℝ)⌋ : ℤ).toNat := by have h : (j : ℤ) ≤ ⌊(k : ℝ) * (x : ℝ)⌋ := Int.le_floor.mpr (by exact_mod_cast hx.1) omega have hlow : j ≤ cellIndex k x := by unfold cellIndex omega have hcoord := cellCoord_mem_unit k hk x have hhigh : cellIndex k x ≤ j + 1 := by have h : (cellIndex k x : ℝ) ≤ (j + 1 : ℕ) := by dsimp [cellCoord] at hcoord push_cast linarith [hx.2, hcoord.1] exact_mod_cast h by_cases he : cellIndex k x = j · exact Or.inl he · have he' : cellIndex k x = j + 1 := by omega refine inr ⟨he', ?_⟩ dsimp [cellCoord] at hcoord rw [he'] at hcoord push_cast at hcoord linarith [hx.2, hcoord.1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellIndex_closed_cell · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialGluing.lean:14
theorem continuous_cell_profile Lemma continuous_cell_profile in the paper ↗

A finite chain of continuous local profiles glues when adjacent endpoint values agree. No matching derivatives at endpoints are required. the documented result Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
k :
ℕ
hk :
1 ≤ k
F :
ℕ → ℝ → ℝ
hc :
∀ j < k, ContinuousOn (F j) (Icc (0 : ℝ) 1)
he :
∀ j
if
j + 1 < k
then
F j 1 = F (j + 1) 0
Continuous (fun x : Covariate => F (cellIndex k x) (cellCoord k x))
Proof (Lean source)
-- @node: continuous_cell_profile lemma continuous_cell_profile (k : ℕ) (hk : 1 ≤ k) (F : ℕ → ℝ → ℝ) (hc : ∀ j < k, ContinuousOn (F j) (Icc (0 : ℝ) 1)) (he : ∀ j, j + 1 < k → F j 1 = F (j + 1) 0) : Continuous (fun x : Covariate => F (cellIndex k x) (cellCoord k x)) := by let S (j : Fin k) : Set Covariate := {x | (k : ℝ) * (x : ℝ) ∈ Icc (j : ℝ) (j + 1)} have hclosed : ∀ j, IsClosed (S j) := by intro j exact isClosed_Icc.preimage (by fun_prop) have hcover : (⋃ j, S j) = univ := by apply Set.eq_univ_of_forall intro x refine Set.mem_iUnion.mpr ⟨⟨cellIndex k x, cellIndex_lt k hk x⟩, ?_⟩ have h := cellCoord_mem_unit k hk x change (k : ℝ) * (x : ℝ) ∈ Icc (cellIndex k x : ℝ) (cellIndex k x+1) dsimp [cellCoord] at h constructor <;> linarith [h.1,h.2] apply (locallyFinite_of_finite S).continuous hcover hclosed intro j have hmap : Continuous (fun x : Covariate => (k : ℝ) * (x : ℝ)-(j : ℝ)) := by fun_prop have hm : Set.MapsTo (fun x : Covariate => (k : ℝ) * (x : ℝ)-(j : ℝ)) (S j) (Icc (0 : ℝ) 1) := by intro x hx constructor <;> linarith [hx.1,hx.2] apply ((hc j j.isLt).comp hmap.continuousOn hm).congr intro x hx change F (cellIndex k x) (cellCoord k x) = F j ((k : ℝ) * (x : ℝ)-(j : ℝ)) rcases cellIndex_closed_cell k j j.isLt x hx with hi | ⟨hi,hxend⟩ · simp only [hi, cellCoord] · have hnext : (j : ℕ)+1 < k := by rw [← hi] exact cellIndex_lt k hk x have hu : cellCoord k x = 0 := by simp [cellCoord, hi, hxend] have hv : (k : ℝ) * (x : ℝ)-(j : ℝ) = 1 := by linarith rw [hi, hu, hv] exact (he j hnext).symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.continuous_cell_profile · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialGluing.lean:43

The shared endpoint sign field is continuous for every realization. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k + 1) → Bool
Proof (Lean source)
-- @node: signFieldZ_continuous lemma signFieldZ_continuous (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k + 1) → Bool) : Continuous (signFieldZ k σ) := by apply continuous_cell_profile k hk (fun j u => endpointSign k σ j * cos (pi*u/2) + endpointSign k σ (j + 1) * sin (pi*u/2)) · intro j hj fun_prop · intro j hj simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.signFieldZ_continuous · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialGluing.lean:84
theorem continuous_cellCoord_comp Lemma continuous_cellCoord_comp in the paper ↗

A periodic endpoint profile remains continuous after the cell-coordinate selector, despite that selector jumping from one to zero. the documented result Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
k :
ℕ
hk :
1 ≤ k
f :
ℝ → ℝ
hf :
ContinuousOn f (Icc (0 : ℝ) 1)
hend :
f 1 = f 0
Continuous (fun x : Covariate => f (cellCoord k x))
Proof (Lean source)
-- @node: continuous_cellCoord_comp lemma continuous_cellCoord_comp (k : ℕ) (hk : 1 ≤ k) (f : ℝ → ℝ) (hf : ContinuousOn f (Icc (0 : ℝ) 1)) (hend : f 1 = f 0) : Continuous (fun x : Covariate => f (cellCoord k x)) := by exact continuous_cell_profile k hk (fun _ => f) (fun _ _ => hf) (fun _ _ => hend)
CausalSmith.Stat.LogoddsLowsmoothFrontier.continuous_cellCoord_comp · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialGluing.lean:96
theorem mixedCells_continuous_of_smooth Lemma mixedCells_continuous_of_smooth in the paper ↗

[Mixed local tables glue because their root has equal endpoint values and the two adjacent sign profiles share the same sign there. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
ε :
ℝ
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k + 1) → Bool
η ζ :
ℝ
hη :
|η| ≤ ε
hζ :
|ζ| ≤ ε
b a y :
Continuous (mixedCells b k σ η ζ a y)
Proof (Lean source)
-- @node: mixedCells_continuous_of_smooth lemma mixedCells_continuous_of_smooth (ε : ℝ) (hs : CalibrationSmooth ε) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k + 1) → Bool) (η ζ : ℝ) (hη : |η| ≤ ε) (hζ : |ζ| ≤ ε) (b a y : Bool) : Continuous (mixedCells b k σ η ζ a y) := by let s (j : ℕ) : Bool × Bool := (σ ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩, σ ⟨min (j + 1) k, lt_succ_of_le (min_le_right _ _)⟩) change Continuous (fun x : Covariate => localMixedCell b (s (cellIndex k x)) a y ![η,ζ,cellCoord k x]) apply continuous_cell_profile k hk (fun j u => localMixedCell b (s j) a y ![η,ζ,u]) · intro j hj have hm : Continuous (fun u : ℝ => ![η,ζ,u]) := by fun_prop exact (hs.2.2.1 b (s j) a y).continuousOn.comp hm.continuousOn (by intro u hu; exact ⟨hη,hζ,hu⟩) · intro j hj simp [localMixedCell, localSignField, s, ← mixedRoot_endpoints]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_continuous_of_smooth · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialGluing.lean:103
theorem fairCells_continuous_of_smooth Lemma fairCells_continuous_of_smooth in the paper ↗

[Both fair local tables glue: their centers agree at the two endpoints, and the random risks use the same shared sign. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
ε :
ℝ
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k + 1) → Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1 / 4)
hδ :
|δ| ≤ ε
b a y :
Continuous (fairCells b k σ t δ a y)
Proof (Lean source)
-- @node: fairCells_continuous_of_smooth lemma fairCells_continuous_of_smooth (ε : ℝ) (hs : CalibrationSmooth ε) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k + 1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1 / 4)) (hδ : |δ| ≤ ε) (b a y : Bool) : Continuous (fairCells b k σ t δ a y) := by let s (j : ℕ) : Bool × Bool := (σ ⟨min j k, lt_succ_of_le (min_le_right _ _)⟩, σ ⟨min (j + 1) k, lt_succ_of_le (min_le_right _ _)⟩) change Continuous (fun x : Covariate => localFairCell b (s (cellIndex k x)) a y ![t,δ,cellCoord k x]) apply continuous_cell_profile k hk (fun j u => localFairCell b (s j) a y ![t,δ,u]) · intro j hj have hm : Continuous (fun u : ℝ => ![t,δ,u]) := by fun_prop exact (hs.2.2.2 b (s j) a y).continuousOn.comp hm.continuousOn (by intro u hu; exact ⟨ht,hδ,hu⟩) · intro j hj simp [localFairCell, localSignField, s, ← fairRoot_endpoints]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_continuous_of_smooth · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialGluing.lean:123
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.SpatialLipschitz 8 declarations Local Lipschitz bounds telescope across the finite chain of cells.

Shared-endpoint Lipschitz gluing

Local Lipschitz bounds telescope across the finite chain of cells. This is the roadmap's subdivision argument and does not require matching endpoint derivatives.

theorem cell_profile_chain_bound Lemma cell_profile_chain_bound in the paper ↗

Given a finite number of cells, a profile on each cell, and a common local constant, local bounds and matching endpoint values telescope for cell indices satisfying their order and range condition, and for cell coordinates satisfying the first unit-interval condition, the second unit-interval condition, and global coordinate order, to exactly the distance between the two cell coordinates.

Formal statement
k :
ℕ
F :
ℕ → ℝ → ℝ
C :
ℝ
hlocal :
∀ j < k, ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, |F j u-F j v| ≤ C*|u-v|
hend :
∀ j
if
j+1 < k
then
F j 1 = F (j+1) 0
i j :
ℕ
hij :
i ≤ j
hjk :
j < k
u v :
ℝ
hu :
u ∈ Icc (0 : ℝ) 1
hv :
v ∈ Icc (0 : ℝ) 1
horder :
(i : ℝ)+u ≤ (j : ℝ)+v
|F i u-F j v| ≤ C*((j : ℝ)-(i : ℝ)+v-u)
Proof (Lean source)
-- @node: cell_profile_chain_bound lemma cell_profile_chain_bound (k : ℕ) (F : ℕ → ℝ → ℝ) (C : ℝ) (hlocal : ∀ j < k, ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, |F j u-F j v| ≤ C*|u-v|) (hend : ∀ j, j+1 < k → F j 1 = F (j+1) 0) (i j : ℕ) (hij : i ≤ j) (hjk : j < k) (u v : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) (hv : v ∈ Icc (0 : ℝ) 1) (horder : (i : ℝ)+u ≤ (j : ℝ)+v) : |F i u-F j v| ≤ C*((j : ℝ)-(i : ℝ)+v-u) := by exact piecewiseLipschitz_chain_bound k F C hlocal hend i j hij hjk u v hu hv horder
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_profile_chain_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:19

The cell selector is monotone in the covariate. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
x z :
hxz :
(x : ℝ) ≤ z
cellIndex k x ≤ cellIndex k z
Proof (Lean source)
-- @node: cellIndex_mono lemma cellIndex_mono (k : ℕ) (x z : Covariate) (hxz : (x : ℝ) ≤ z) : cellIndex k x ≤ cellIndex k z := by have hf := Int.floor_mono (mul_le_mul_of_nonneg_left hxz (Nat.cast_nonneg k)) have hn : (⌊(k : ℝ)*(x : ℝ)⌋ : ℤ).toNat ≤ (⌊(k : ℝ)*(z : ℝ)⌋ : ℤ).toNat := by omega exact min_le_min_left _ hn
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellIndex_mono · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:37

[A common local Lipschitz constant becomes a global constant multiplied by rank after gluing the shared endpoints, including points in different cells. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
F :
ℕ → ℝ → ℝ
C :
ℝ
hlocal :
∀ j < k, ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, |F j u-F j v| ≤ C*|u-v|
hend :
∀ j
if
j+1 < k
then
F j 1 = F (j+1) 0
x z :
|F (cellIndex k x) (cellCoord k x)-F (cellIndex k z) (cellCoord k z)|
≤ C*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: cell_profile_lipschitz lemma cell_profile_lipschitz (k : ℕ) (hk : 1 ≤ k) (F : ℕ → ℝ → ℝ) (C : ℝ) (hlocal : ∀ j < k, ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, |F j u-F j v| ≤ C*|u-v|) (hend : ∀ j, j+1 < k → F j 1 = F (j+1) 0) (x z : Covariate) : |F (cellIndex k x) (cellCoord k x)-F (cellIndex k z) (cellCoord k z)| ≤ C*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by have ordered (x z : Covariate) (hxz : (x : ℝ) ≤ z) : |F (cellIndex k x) (cellCoord k x)-F (cellIndex k z) (cellCoord k z)| ≤ C*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by have hb := cell_profile_chain_bound k F C hlocal hend _ _ (cellIndex_mono k x z hxz) (cellIndex_lt k hk z) _ _ (cellCoord_mem_unit k hk x) (cellCoord_mem_unit k hk z) (by dsimp [cellCoord]; nlinarith [show (0 : ℝ) ≤ k from Nat.cast_nonneg k]) rw [abs_of_nonpos (sub_nonpos.mpr hxz)] convert hb using 1; dsimp [cellCoord]; ring rcases le_total (x : ℝ) (z : ℝ) with h | h · exact ordered x z h · simpa only [abs_sub_comm] using ordered z x h
CausalSmith.Stat.LogoddsLowsmoothFrontier.cell_profile_lipschitz · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:46
theorem cellCoord_comp_lipschitz Lemma cellCoord_comp_lipschitz in the paper ↗

[A profile whose endpoint values agree inherits the global rank-scaled Lipschitz bound through the discontinuous within-cell coordinate selector. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
f :
ℝ → ℝ
C :
ℝ
hf :
∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, |f u-f v| ≤ C*|u-v|
hend :
f 1 = f 0
x z :
|f (cellCoord k x)-f (cellCoord k z)| ≤ C*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: cellCoord_comp_lipschitz lemma cellCoord_comp_lipschitz (k : ℕ) (hk : 1 ≤ k) (f : ℝ → ℝ) (C : ℝ) (hf : ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, |f u-f v| ≤ C*|u-v|) (hend : f 1 = f 0) (x z : Covariate) : |f (cellCoord k x)-f (cellCoord k z)| ≤ C*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by exact cell_profile_lipschitz k hk (fun _ => f) C (fun _ _ => hf) (fun _ _ => hend) x z
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellCoord_comp_lipschitz · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:67

[The shared sign field has a global Lipschitz constant at most four times rank, obtained from the two trigonometric profiles and endpoint gluing. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
x z :
|signFieldZ k σ x-signFieldZ k σ z| ≤ 4*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: signFieldZ_lipschitz lemma signFieldZ_lipschitz (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (x z : Covariate) : |signFieldZ k σ x-signFieldZ k σ z| ≤ 4*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by apply cell_profile_lipschitz k hk (fun j u => endpointSign k σ j*cos (pi*u/2)+ endpointSign k σ (j+1)*sin (pi*u/2)) 4 · intro j hj u hu v hv have hc := Real.abs_cos_sub_cos_le (pi*u/2) (pi*v/2) have hs := Real.abs_sin_sub_sin_le (pi*u/2) (pi*v/2) have hab : |pi*u/2-pi*v/2| = (pi/2)*|u-v| := by rw [show pi*u/2-pi*v/2 = (pi/2)*(u-v) by ring, abs_mul, abs_of_pos (by positivity : 0 < pi/2)] rw [hab] at hc hs have he (j : ℕ) : |endpointSign k σ j| = 1 := by unfold endpointSign signValue split <;> norm_num calc _ = |endpointSign k σ j*(cos (pi*u/2)-cos (pi*v/2))+ endpointSign k σ (j+1)*(sin (pi*u/2)-sin (pi*v/2))| := by congr 1; ring _ ≤ |endpointSign k σ j*(cos (pi*u/2)-cos (pi*v/2))|+ |endpointSign k σ (j+1)*(sin (pi*u/2)-sin (pi*v/2))| := abs_add_le _ _ _ ≤ 4*|u-v| := by simp only [abs_mul, he, one_mul] nlinarith [Real.pi_lt_four, abs_nonneg (u-v)] · intro j hj simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.signFieldZ_lipschitz · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:76
theorem fairRoot_spatial_lipschitz Lemma fairRoot_spatial_lipschitz in the paper ↗

[The fair root's quadratic spatial derivative bound becomes a global quadratic Lipschitz bound; its two endpoint values agree. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
t δ B :
ℝ
hd :
∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (fairRoot t δ) u
hb :
∀ u ∈ Icc (0 : ℝ) 1, |deriv (fairRoot t δ) u| ≤ B*δ^2
x z :
|fairRoot t δ (cellCoord k x)-fairRoot t δ (cellCoord k z)|
≤ B*δ^2*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: fairRoot_spatial_lipschitz lemma fairRoot_spatial_lipschitz (k : ℕ) (hk : 1 ≤ k) (t δ B : ℝ) (hd : ∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (fairRoot t δ) u) (hb : ∀ u ∈ Icc (0 : ℝ) 1, |deriv (fairRoot t δ) u| ≤ B*δ^2) (x z : Covariate) : |fairRoot t δ (cellCoord k x)-fairRoot t δ (cellCoord k z)| ≤ B*δ^2*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by apply cellCoord_comp_lipschitz k hk _ (B*δ^2) _ (fairRoot_endpoints t δ).symm intro u hu v hv simpa only [Real.norm_eq_abs] using (convex_Icc (0 : ℝ) 1).norm_image_sub_le_of_norm_deriv_le hd (by simpa only [Real.norm_eq_abs] using hb) hv hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairRoot_spatial_lipschitz · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:107
theorem fairCells_prognosis_linear_of_centering Lemma fairCells_prognosis_linear_of_centering in the paper ↗

[Global fair root and sign bounds give a linear spatial bound for the native prognosis logit of either construction, with zero on fallback laws. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
b :
k :
ℕ
hk :
1 ≤ k
σ :
Fin (k+1) → Bool
t δ B :
ℝ
hB :
0 ≤ B
hδ :
|δ| ≤ 1/100
hp :
∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100
hd :
∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (fairRoot t δ) u
hb :
∀ u ∈ Icc (0 : ℝ) 1, |deriv (fairRoot t δ) u| ≤ B*δ^2
x z :
≤ 6*(B*δ^2+4*|δ|)*(k : ℝ)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: fairCells_prognosis_linear_of_centering lemma fairCells_prognosis_linear_of_centering (b : Bool) (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (t δ B : ℝ) (hB : 0 ≤ B) (hδ : |δ| ≤ 1/100) (hp : ∀ x : Covariate, |fairRoot t δ (cellCoord k x)-2/5| ≤ 1/100) (hd : ∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (fairRoot t δ) u) (hb : ∀ u ∈ Icc (0 : ℝ) 1, |deriv (fairRoot t δ) u| ≤ B*δ^2) (x z : Covariate) : |prognosisLogit (totalCellLaw (fairCells b k σ t δ)) x- prognosisLogit (totalCellLaw (fairCells b k σ t δ)) z| ≤ 6*(B*δ^2+4*|δ|)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by classical by_cases hv : ValidCells (fairCells b k σ t δ) · change |logit (armRisk _ false x)-logit (armRisk _ false z)| ≤ _ rw [fairCells_armRisk_control b k σ t δ hv x, fairCells_armRisk_control b k σ t δ hv z] have hl := calibrated_logit_difference_le _ _ (fair_control_risk_bounds_of_centering b k σ t δ x hδ (hp x)) (fair_control_risk_bounds_of_centering b k σ t δ z hδ (hp z)) have hr := fairRoot_spatial_lipschitz k hk t δ B hd hb x z have hs := signFieldZ_lipschitz k hk σ x z have hprod := mul_le_mul_of_nonneg_left hs (abs_nonneg δ) have hctrl : |(if b then fairRoot t δ (cellCoord k x)+δ*signFieldZ k σ x else fairRoot t δ (cellCoord k x))- (if b then fairRoot t δ (cellCoord k z)+δ*signFieldZ k σ z else fairRoot t δ (cellCoord k z))| ≤ (B*δ^2+4*|δ|)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := by cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] · nlinarith [mul_nonneg (abs_nonneg δ) (mul_nonneg (Nat.cast_nonneg k) (abs_nonneg ((x : ℝ)-(z : ℝ))))] · calc _ = |(fairRoot t δ (cellCoord k x)-fairRoot t δ (cellCoord k z))+ δ*(signFieldZ k σ x-signFieldZ k σ z)| := by congr 1; ring _ ≤ |fairRoot t δ (cellCoord k x)-fairRoot t δ (cellCoord k z)|+ |δ*(signFieldZ k σ x-signFieldZ k σ z)| := abs_add_le _ _ _ ≤ _ := by rw [abs_mul]; nlinarith nlinarith · have hz : ∀ w, prognosisLogit (totalCellLaw (fairCells b k σ t δ)) w = 0 := by intro w norm_num [prognosisLogit, armRisk, totalCellLaw, hv, lawFromCells, logit] rw [hz x, hz z, sub_self, abs_zero] positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_prognosis_linear_of_centering · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:122
theorem fairCells_uniform_prognosis_linear Lemma fairCells_uniform_prognosis_linear in the paper ↗

One absolute positive radius proves the fair prognosis linear scale bound for every nonnegative exponent and every rank, for both calibrated laws. the documented result Under the stated assumptions. The stated conclusion follows.

Formal statement
∃ r : ℝ,
0 < r
r ≤ 1/100
conclusion 1
ε :
ℝ
0 < ε
ε ≤ r
β :
ℝ
0 ≤ β
k :
ℕ
1 ≤ k
σ :
Fin (k+1) → Bool
t :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
b :
x z :
|prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) x- prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) z|
≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)|
Proof (Lean source)
-- @node: fairCells_uniform_prognosis_linear lemma fairCells_uniform_prognosis_linear : ∃ r : ℝ, 0 < r ∧ r ≤ 1/100 ∧ ∀ ε : ℝ, 0 < ε → ε ≤ r → ∀ β : ℝ, 0 ≤ β → ∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k+1) → Bool, ∀ t : ℝ, t ∈ Icc (0 : ℝ) (1/4) → ∀ b, ∀ x z, |prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) x- prognosisLogit (totalCellLaw (fairCells b k σ t (ε*(k : ℝ)^(-β)))) z| ≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)| := by obtain ⟨a, B, ha, hB, _, _, _, _, hf⟩ := exact_calibrations obtain ⟨s, hs, _, hsm⟩ := fairRoot_uniform_contDiffAt let r := min a (min s (min (1/100) (1/(100*(B+1))))) have hr : 0 < r := lt_min ha (lt_min hs (lt_min (by norm_num) (by positivity))) have hra : r ≤ a := min_le_left _ _ have hrs : r ≤ s := (min_le_right _ _).trans (min_le_left _ _) have hrt : r ≤ min (1/100) (1/(100*(B+1))) := (min_le_right _ _).trans (min_le_right _ _) have hrsmall : r ≤ 1/100 := hrt.trans (min_le_left _ _) have hrB : r ≤ 1/(100*(B+1)) := hrt.trans (min_le_right _ _) have hBr : B*r ≤ 1/100 := by have hh := (le_div_iff₀ (show 0 < 100*(B+1) by positivity)).mp hrB nlinarith refine ⟨r,hr,hrsmall,?_⟩ intro ε hε hεr β hβ k hk σ t ht b x z let δ := ε*(k : ℝ)^(-β) have hd : |δ| ≤ ε := calibrated_amplitude_abs_le ε β hε.le hβ k hk have hdr : |δ| ≤ r := hd.trans hεr have hbounds (u : ℝ) (hu : u ∈ Icc (0 : ℝ) 1) : |fairRoot t δ u-2/5|+|deriv (fairRoot t δ) u| ≤ B*δ^2 := (hf t δ u ht (hdr.trans hra) hu).2.2.2.2.2.2.2.2.1 have hp : ∀ w : Covariate, |fairRoot t δ (cellCoord k w)-2/5| ≤ 1/100 := by intro w have hb := hbounds _ (cellCoord_mem_unit k hk w) have hsquare : δ^2 ≤ r^2 := by nlinarith [sq_abs δ, abs_nonneg δ] have hh := mul_le_mul_of_nonneg_left hsquare hB.le nlinarith [abs_nonneg (deriv (fairRoot t δ) (cellCoord k w))] have hdiff : ∀ u ∈ Icc (0 : ℝ) 1, DifferentiableAt ℝ (fairRoot t δ) u := by intro u hu have hc := hsm ![t,δ,u] (by exact ⟨ht,hdr.trans hrs,hu⟩) have hm : ContDiffAt ℝ ∞ (fun v : ℝ => ![t,δ,v]) u := by apply contDiffAt_pi.mpr intro i fin_cases i · change ContDiffAt ℝ ∞ (fun _ : ℝ => t) u fun_prop · change ContDiffAt ℝ ∞ (fun _ : ℝ => δ) u fun_prop · change ContDiffAt ℝ ∞ (fun v : ℝ => v) u fun_prop exact (hc.comp u hm).differentiableAt (by simp) have hb : ∀ u ∈ Icc (0 : ℝ) 1, |deriv (fairRoot t δ) u| ≤ B*δ^2 := by intro u hu linarith [hbounds u hu, abs_nonneg (fairRoot t δ u-2/5)] have hl := fairCells_prognosis_linear_of_centering b k hk σ t δ B hB.le (hdr.trans hrsmall) hp hdiff hb x z have hsq : δ^2 ≤ r*|δ| := by nlinarith [sq_abs δ,abs_nonneg δ] have hcoef : 6*(B*δ^2+4*|δ|) ≤ 25*|δ| := by nlinarith [mul_le_mul_of_nonneg_left hsq hB.le] have heps : 25*ε ≤ 1 := by linarith [hεr.trans hrsmall] have hδpos : 0 ≤ δ := by dsimp [δ]; positivity have hkpos : 0 < (k : ℝ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hrate : (k : ℝ)^(1-β) = (k : ℝ)^(-β)*(k : ℝ) := by rw [show 1-β = -β+1 by ring,Real.rpow_add hkpos,Real.rpow_one] calc _ ≤ 6*(B*δ^2+4*|δ|)*(k : ℝ)*|(x : ℝ)-(z : ℝ)| := hl _ ≤ 25*|δ| *(k : ℝ)*|(x : ℝ)-(z : ℝ)| := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hcoef hkpos.le) (abs_nonneg _) _ ≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)| := by rw [hrate,abs_of_nonneg hδpos] dsimp [δ] have hh := mul_le_mul_of_nonneg_right heps (Real.rpow_nonneg hkpos.le (-β)) have hh' := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hh hkpos.le) (abs_nonneg ((x : ℝ)-(z : ℝ))) nlinarith [hh']
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_uniform_prognosis_linear · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SpatialLipschitz.lean:165
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.SqrtProgram 13 declarations The binary-loop invariant identifies its result with the integer-square-root instruction.

Finite register certificate for the prescribed square-root routine

The binary-loop invariant identifies its result with the integer-square-root instruction. A fixed straight-line program computes both dyadic endpoints, with a constant, independently certified public fuel bound.

theorem integerSqrtStep_bracket Lemma integerSqrtStep_bracket in the paper ↗

A binary step preserves the integer square-root bracket. Under the stated assumptions.

Formal statement
N l u :
ℕ
hl :
l ^ 2 ≤ N
hu :
N < u ^ 2
hlu :
l < u
v :
v.1 ^ 2 ≤ N
N < v.2 ^ 2
v.1 < v.2
Proof (Lean source)
-- @node: integerSqrtStep_bracket lemma integerSqrtStep_bracket (N l u : ℕ) (hl : l ^ 2 ≤ N) (hu : N < u ^ 2) (hlu : l < u) : let v := integerSqrtStep N (l,u) v.1 ^ 2 ≤ N ∧ N < v.2 ^ 2 ∧ v.1 < v.2 := by unfold integerSqrtStep split · exact ⟨hl, hu, hlu⟩ · rename_i hwidth have hmid : l < (l + u) / 2 ∧ (l + u) / 2 < u := by omega dsimp only split · rename_i hsq exact ⟨hsq, hu, hmid.2⟩ · rename_i hsq exact ⟨hl, Nat.lt_of_not_ge hsq, hmid.1⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.integerSqrtStep_bracket · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:15

A nonterminal binary step halves a power-of-two width budget. Under the stated assumptions. Under the stated assumptions.

Formal statement
N l u q :
ℕ
hlu :
l < u
hw :
u - l ≤ 2 ^ (q + 1)
(integerSqrtStep N (l,u)).2 - (integerSqrtStep N (l,u)).1 ≤ 2 ^ q
Proof (Lean source)
-- @node: integerSqrtStep_width lemma integerSqrtStep_width (N l u q : ℕ) (hlu : l < u) (hw : u - l ≤ 2 ^ (q + 1)) : (integerSqrtStep N (l,u)).2 - (integerSqrtStep N (l,u)).1 ≤ 2 ^ q := by have hp : 0 < 2 ^ q := by positivity rw [pow_succ] at hw unfold integerSqrtStep split · rename_i h simp only [h] omega · dsimp only split <;> dsimp <;> omega
CausalSmith.Stat.LogoddsLowsmoothFrontier.integerSqrtStep_width · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:33

The structurally recursive fixed-count loop preserves the bracket and exhausts its width. Under the stated assumptions.

Formal statement
N q l u :
ℕ
hl :
l ^ 2 ≤ N
hu :
N < u ^ 2
hlu :
l < u
hw :
u - l ≤ 2 ^ q
v :
integerSqrtLoop N q (l,u)
v.1 ^ 2 ≤ N
N < v.2 ^ 2
v.2 = v.1 + 1
Proof (Lean source)
-- @node: integerSqrtLoop_spec lemma integerSqrtLoop_spec (N q l u : ℕ) (hl : l ^ 2 ≤ N) (hu : N < u ^ 2) (hlu : l < u) (hw : u - l ≤ 2 ^ q) : let v := integerSqrtLoop N q (l,u) v.1 ^ 2 ≤ N ∧ N < v.2 ^ 2 ∧ v.2 = v.1 + 1 := by induction q generalizing l u with | zero => simp only [integerSqrtLoop, pow_zero] at * exact ⟨hl, hu, by omega⟩ | succ q ih => obtain ⟨hl', hu', hlu'⟩ := integerSqrtStep_bracket N l u hl hu hlu exact ih _ _ hl' hu' hlu' (integerSqrtStep_width N l u q hlu hw)
CausalSmith.Stat.LogoddsLowsmoothFrontier.integerSqrtLoop_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:48

[The prescribed number of binary steps returns the unique integer square-root bracket. the stated conclusion holds.

Formal statement
N :
ℕ
conclusion 1
paperIntegerSqrt N ^ 2 ≤ N
conclusion 2
N < (paperIntegerSqrt N + 1) ^ 2
Proof (Lean source)
-- @node: paperIntegerSqrt_spec lemma paperIntegerSqrt_spec (N : ℕ) : paperIntegerSqrt N ^ 2 ≤ N ∧ N < (paperIntegerSqrt N + 1) ^ 2 := by have hw : (N + 1) - 0 ≤ 2 ^ (clog 2 (N + 1) + 1) := by have h := Nat.le_pow_clog (by norm_num : 1 < (2 : ℕ)) (N + 1) rw [pow_succ] omega obtain ⟨hl, hu, heq⟩ := integerSqrtLoop_spec N (clog 2 (N + 1) + 1) 0 (N + 1) (by simp) (by nlinarith) (by omega) hw refine ⟨hl, ?_⟩ simpa only [paperIntegerSqrt, heq] using hu
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperIntegerSqrt_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:63
theorem paperIntegerSqrt_eq_sqrt Lemma paperIntegerSqrt_eq_sqrt in the paper ↗

The paper's binary recurrence agrees with the integer-square-root instruction. the stated conclusion holds.

Formal statement
N :
ℕ
Proof (Lean source)
-- @node: paperIntegerSqrt_eq_sqrt lemma paperIntegerSqrt_eq_sqrt (N : ℕ) : paperIntegerSqrt N = sqrt N := by exact Nat.eq_sqrt'.mpr (paperIntegerSqrt_spec N)
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperIntegerSqrt_eq_sqrt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:76

Straight-line dyadic square-root endpoint program; inputs are precision, lower, upper.

Definition (Lean source)
sqrtRegisterCode :
[.constant 3 3, .add 3 0 3, .constant 4 2, .natPow 4 4 3, .mul 5 4 4, .mul 6 5 1, .integerSqrt 6 6, .div 0 6 4, .mul 7 5 2, .integerSqrt 7 7, .constant 8 1, .add 7 7 8, .div 1 7 4, .halt]
CausalSmith.Stat.LogoddsLowsmoothFrontier.sqrtRegisterCode · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:81

Every rational input halts after the fixed instruction count. the stated conclusion holds.

Formal statement
xs :
List ℚ
(sqrtRegisterCode.run 14 (RationalProgram.initial xs)).2.2 = true
Proof (Lean source)
-- @node: sqrtRegisterCode_halts lemma sqrtRegisterCode_halts (xs : List ℚ) : (sqrtRegisterCode.run 14 (RationalProgram.initial xs)).2.2 = true := by norm_num [sqrtRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.sqrtRegisterCode_halts · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:89
theorem sqrtRegisterBound_public Lemma sqrtRegisterBound_public in the paper ↗

The public fuel bound is itself computed by a two-step rational program. the stated conclusion holds.

Formal statement
PublicIterationBound (fun _ => 14)
Proof (Lean source)
-- @node: sqrtRegisterBound_public lemma sqrtRegisterBound_public : PublicIterationBound (fun _ => 14) := by refine ⟨[.constant 0 14, .halt], ?_⟩ intro xs refine ⟨2, ?_, ?_⟩ <;> norm_num [RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply]
CausalSmith.Stat.LogoddsLowsmoothFrontier.sqrtRegisterBound_public · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:96

The certified square-root register program.

Definition (Lean source)
sqrtRegisterProgram :
clause 1
clause 2
iterationBound := fun _ => 14
clause 3
public_bound := sqrtRegisterBound_public
clause 4
CausalSmith.Stat.LogoddsLowsmoothFrontier.sqrtRegisterProgram · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:105
theorem sqrtRegisterProgram_eval Lemma sqrtRegisterProgram_eval in the paper ↗

Executing the program on valid precision inputs returns the two raw dyadic endpoints. Under the stated assumptions. The stated conclusion follows.

Formal statement
q :
ℕ
l u :
ℚ
sqrtRegisterProgram.eval [q, l, u]
= (((sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * l⌋ : ℤ).toNat : ℚ) / 2 ^ (q + 3)), (((sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * u⌋ : ℤ).toNat : ℚ) + 1) / 2 ^ (q + 3)))
Proof (Lean source)
-- @node: sqrtRegisterProgram_eval lemma sqrtRegisterProgram_eval (q : ℕ) (l u : ℚ) : sqrtRegisterProgram.eval [q, l, u] = (((sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * l⌋ : ℤ).toNat : ℚ) / 2 ^ (q + 3)), (((sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * u⌋ : ℤ).toNat : ℚ) + 1) / 2 ^ (q + 3))) := by norm_num [BoundedRationalProgram.eval, sqrtRegisterProgram, sqrtRegisterCode, RationalProgram.run, RationalProgram.step, RationalProgram.initial, Function.update_apply, ← Nat.cast_add, pow_mul, mul_comm 2] have hp : ((q : ℤ) + 3).toNat = q + 3 := by omega simp [hp, pow_two]
CausalSmith.Stat.LogoddsLowsmoothFrontier.sqrtRegisterProgram_eval · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:113
theorem paperSqrtScalar_endpoints Lemma paperSqrtScalar_endpoints in the paper ↗

The scalar dyadic bracket endpoints are in their literal monotone order for all inputs. the stated conclusion holds.

Formal statement
q :
ℕ
z :
ℚ
conclusion 1
= (sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * z⌋ : ℤ).toNat : ℚ) / 2 ^ (q + 3)
conclusion 2
= ((sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * z⌋ : ℤ).toNat : ℚ) + 1) / 2 ^ (q + 3)
Proof (Lean source)
-- @node: paperSqrtScalar_endpoints lemma paperSqrtScalar_endpoints (q : ℕ) (z : ℚ) : (paperSqrtScalar q z).lo = (sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * z⌋ : ℤ).toNat : ℚ) / 2 ^ (q + 3) ∧ (paperSqrtScalar q z).hi = ((sqrt (⌊(2 : ℚ) ^ (2 * (q + 3)) * z⌋ : ℤ).toNat : ℚ) + 1) / 2 ^ (q + 3) := by have horder (a : ℕ) : (a : ℚ) / 2 ^ (q + 3) ≤ ((a : ℚ) + 1) / 2 ^ (q + 3) := by apply div_le_div_of_nonneg_right <;> first | positivity | linarith simp [paperSqrtScalar, paperIntegerSqrt_eq_sqrt, rationalBox, min_eq_left (horder _), max_eq_right (horder _)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperSqrtScalar_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:125
theorem concreteEngine_sqrt_register_certificate

The concrete square-root map has a bounded finite rational register implementation. the stated conclusion holds.

Formal statement
q :
ℕ
concreteEngine.sqrtBox q I
= let v := sqrtRegisterProgram.eval [q, I.lo, I.hi] rationalBox v.1 v.2
Proof (Lean source)
-- @node: concreteEngine_sqrt_register_certificate lemma concreteEngine_sqrt_register_certificate (q : ℕ) (I : RatInterval) : concreteEngine.sqrtBox q I = let v := sqrtRegisterProgram.eval [q, I.lo, I.hi] rationalBox v.1 v.2 := by rw [sqrtRegisterProgram_eval] change rationalBox (paperSqrtScalar q I.lo).lo (paperSqrtScalar q I.hi).hi = _ rw [(paperSqrtScalar_endpoints q I.lo).1, (paperSqrtScalar_endpoints q I.hi).2]
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_sqrt_register_certificate · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:137
theorem concreteEngine_registers_of_other_primitives Lemma concreteEngine_registers_of_other_primitives in the paper ↗

Assemble the remaining five certificates with the independently proved square-root program. the stated conclusion holds. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
pi exp cos log power :
hpi :
∀ q, concreteEngine.piBox q = let v := pi.eval [q]; rationalBox v.1 v.2
hexp :
∀ q I, concreteEngine.expBox q I = let v := exp.eval [q, I.lo, I.hi]; rationalBox v.1 v.2
hcos :
∀ q I, concreteEngine.cosBox q I = let v := cos.eval [q, I.lo, I.hi]; rationalBox v.1 v.2
hlog :
∀ q I, concreteEngine.logBox q I = let v := log.eval [q, I.lo, I.hi]; rationalBox v.1 v.2
hpower :
∀ q b I,
concreteEngine.powBox q b I = let v := power.eval [q, b, I.lo, I.hi]; rationalBox v.1 v.2
Proof (Lean source)
-- @node: concreteEngine_registers_of_other_primitives lemma concreteEngine_registers_of_other_primitives (pi exp cos log power : BoundedRationalProgram) (hpi : ∀ q, concreteEngine.piBox q = let v := pi.eval [q]; rationalBox v.1 v.2) (hexp : ∀ q I, concreteEngine.expBox q I = let v := exp.eval [q, I.lo, I.hi]; rationalBox v.1 v.2) (hcos : ∀ q I, concreteEngine.cosBox q I = let v := cos.eval [q, I.lo, I.hi]; rationalBox v.1 v.2) (hlog : ∀ q I, concreteEngine.logBox q I = let v := log.eval [q, I.lo, I.hi]; rationalBox v.1 v.2) (hpower : ∀ q b I, concreteEngine.powBox q b I = let v := power.eval [q, b, I.lo, I.hi]; rationalBox v.1 v.2) : RationalRecurrences concreteEngine := by refine ⟨(fun kind => match kind with | .pi => pi | .exp => exp | .cos => cos | .log => log | .sqrt => sqrtRegisterProgram | .power => power), hpi, hexp, hcos, hlog, concreteEngine_sqrt_register_certificate, hpower⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_registers_of_other_primitives · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/SqrtProgram.lean:147
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.Helpers.TwoPointLength 9 declarations Coverage is transferred between the full sample-and-seed experiments by total variation.

Two-law testing bounds for honest interval length

Coverage is transferred between the full sample-and-seed experiments by total variation. Intervals covering two effects have length at least their separation, which yields a lower bound on expected, worst-case, and minimax length.

[Encoded intervals have length at most the width of the public effect region. the stated conclusion holds.

Formal statement
intervalLength B ≤ 1
Proof (Lean source)
-- @node: intervalLength_le_one lemma intervalLength_le_one (B : EffectInterval) : intervalLength B ≤ 1 := by have hlo := B.property.1 have hhi := B.property.2.1 unfold intervalLength linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.intervalLength_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:17
theorem intervalSet_endpoint_bounds

Membership implies the usual weak endpoint inequalities, including open endpoints. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
t :
ℝ
ht :
t ∈ intervalSet B
conclusion 1
B.val.1 ≤ t
conclusion 2
t ≤ B.val.2.1
Proof (Lean source)
-- @node: intervalSet_endpoint_bounds lemma intervalSet_endpoint_bounds (B : EffectInterval) (t : ℝ) (ht : t ∈ intervalSet B) : B.val.1 ≤ t ∧ t ≤ B.val.2.1 := by rcases ht with ⟨hl, hu⟩ constructor · rcases hl with h | ⟨_, h⟩ · exact h.le · exact h.le · rcases hu with h | ⟨_, h⟩ · exact h.le · exact h.le
CausalSmith.Stat.LogoddsLowsmoothFrontier.intervalSet_endpoint_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:25
theorem intervalLength_ge_separation

Any connected encoded interval containing two points spans their separation. Under the stated assumptions.

Formal statement
a b :
ℝ
ha :
a ∈ intervalSet B
hb :
b ∈ intervalSet B
b-a ≤ intervalLength B
Proof (Lean source)
-- @node: intervalLength_ge_separation lemma intervalLength_ge_separation (B : EffectInterval) (a b : ℝ) (ha : a ∈ intervalSet B) (hb : b ∈ intervalSet B) : b-a ≤ intervalLength B := by obtain ⟨hal, _⟩ := intervalSet_endpoint_bounds B a ha obtain ⟨_, hbu⟩ := intervalSet_endpoint_bounds B b hb unfold intervalLength linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.intervalLength_ge_separation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:38
theorem experimentLaw_probability

[The independent uniform seed and finite iid records form a probability experiment. the stated conclusion holds.

Formal statement
n :
ℕ
Proof (Lean source)
-- @node: experimentLaw_probability lemma experimentLaw_probability (P : ObservedLaw) (n : ℕ) : IsProbabilityMeasure (experimentLaw P n) := by have : IsProbabilityMeasure uniformLaw := by constructor rw [uniformLaw, comap_subtype_coe_apply measurableSet_Icc] rw [Set.image_univ, Subtype.range_coe, Real.volume_Icc] norm_num unfold experimentLaw iidLaw infer_instance
CausalSmith.Stat.LogoddsLowsmoothFrontier.experimentLaw_probability · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:48
theorem procedure_length_integrable

Length is integrable because procedures are measurable and length lies in [0,1]. the stated conclusion holds.

Formal statement
n :
ℕ
I :
Procedure n
Integrable (fun ω => intervalLength (I.output ω)) (experimentLaw P n)
Proof (Lean source)
-- @node: procedure_length_integrable lemma procedure_length_integrable (P : ObservedLaw) (n : ℕ) (I : Procedure n) : Integrable (fun ω => intervalLength (I.output ω)) (experimentLaw P n) := by letI := experimentLaw_probability P n apply Integrable.of_bound I.length_measurable.aestronglyMeasurable 1 exact Filter.Eventually.of_forall (fun ω => by rw [Real.norm_eq_abs, abs_of_nonneg (intervalLength_nonneg _)] exact intervalLength_le_one _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.procedure_length_integrable · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:60
theorem expectedLength_le_one

Expected length stays within the public unit width. the stated conclusion holds.

Formal statement
n :
ℕ
I :
Procedure n
expectedLength P n I ≤ 1
Proof (Lean source)
-- @node: expectedLength_le_one lemma expectedLength_le_one (P : ObservedLaw) (n : ℕ) (I : Procedure n) : expectedLength P n I ≤ 1 := by letI := experimentLaw_probability P n calc expectedLength P n I ≤ ∫ _ω, (1 : ℝ) ∂experimentLaw P n := integral_mono (procedure_length_integrable P n I) (integrable_const 1) (fun ω => intervalLength_le_one _) _ = 1 := by simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.expectedLength_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:70
theorem expectedLength_le_worstLength

Every law in the radius slice gives a lower bound on its supremum risk. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
n :
ℕ
α β r :
ℝ
I :
Procedure n
hP :
RadiusModel α β r P
expectedLength P n I ≤ worstLength n α β r I
Proof (Lean source)
-- @node: expectedLength_le_worstLength lemma expectedLength_le_worstLength (P : ObservedLaw) (n : ℕ) (α β r : ℝ) (I : Procedure n) (hP : RadiusModel α β r P) : expectedLength P n I ≤ worstLength n α β r I := by apply le_csSup · refine ⟨1, ?_⟩ rintro l ⟨Q, _, rfl⟩ exact expectedLength_le_one Q n I · exact ⟨P, hP, rfl⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.expectedLength_le_worstLength · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:81
theorem twoPoint_expectedLength_lower

[Two coverage events under nearby full experiments give a length lower bound. The seed is already included in the two laws; independent randomization is allowed. the documented result Under the stated assumptions.

Formal statement
P₀ P₁ :
n :
ℕ
I :
Procedure n
a b coverage₀ coverage₁ tv :
ℝ
hab :
a ≤ b
hcover₀ :
coverage₀ ≤ (experimentLaw P₀ n).real {ω | a ∈ intervalSet (I.output ω)}
hcover₁ :
coverage₁ ≤ (experimentLaw P₁ n).real {ω | b ∈ intervalSet (I.output ω)}
htv :
tvDist (experimentLaw P₀ n) (experimentLaw P₁ n) ≤ tv
(b-a)*(coverage₀+coverage₁-1-tv) ≤ expectedLength P₀ n I
Proof (Lean source)
-- @node: twoPoint_expectedLength_lower lemma twoPoint_expectedLength_lower (P₀ P₁ : ObservedLaw) (n : ℕ) (I : Procedure n) (a b coverage₀ coverage₁ tv : ℝ) (hab : a ≤ b) (hcover₀ : coverage₀ ≤ (experimentLaw P₀ n).real {ω | a ∈ intervalSet (I.output ω)}) (hcover₁ : coverage₁ ≤ (experimentLaw P₁ n).real {ω | b ∈ intervalSet (I.output ω)}) (htv : tvDist (experimentLaw P₀ n) (experimentLaw P₁ n) ≤ tv) : (b-a)*(coverage₀+coverage₁-1-tv) ≤ expectedLength P₀ n I := by classical letI := experimentLaw_probability P₀ n letI := experimentLaw_probability P₁ n let A := {ω | a ∈ intervalSet (I.output ω)} let B := {ω | b ∈ intervalSet (I.output ω)} let μ := experimentLaw P₀ n have hA : MeasurableSet A := I.coverage_measurable a have hB : MeasurableSet B := I.coverage_measurable b have htransfer := measureReal_sub_le_tvDist (μ := experimentLaw P₀ n) (ν := experimentLaw P₁ n) hB have hunion := measureReal_union_add_inter' (μ := μ) (t := B) hA have hmass : μ.real (A ∪ B) ≤ 1 := measureReal_le_one have hboth : coverage₀+coverage₁-1-tv ≤ μ.real (A ∩ B) := by dsimp only [μ, A, B] at * linarith have hint : Integrable ((A ∩ B).indicator (fun _ => b-a)) μ := (integrable_const (b-a)).indicator (hA.inter hB) have hpoint : ∀ ω, (A ∩ B).indicator (fun _ => b-a) ω ≤ intervalLength (I.output ω) := by intro ω by_cases hω : ω ∈ A ∩ B · rw [Set.indicator_of_mem hω] exact intervalLength_ge_separation _ _ _ hω.1 hω.2 · rw [Set.indicator_of_notMem hω] exact intervalLength_nonneg _ calc (b-a)*(coverage₀+coverage₁-1-tv) ≤ (b-a)*μ.real (A ∩ B) := mul_le_mul_of_nonneg_left hboth (sub_nonneg.mpr hab) _ = ∫ ω, (A ∩ B).indicator (fun _ => b-a) ω ∂μ := by rw [integral_indicator (hA.inter hB), setIntegral_const] simp [measureReal_def, mul_comm] _ ≤ expectedLength P₀ n I := integral_mono hint (procedure_length_integrable P₀ n I) hpoint
CausalSmith.Stat.LogoddsLowsmoothFrontier.twoPoint_expectedLength_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:92
theorem twoPoint_lengthObjective_lower

Honest coverage at two model laws turns a testing comparison into a minimax floor. Under the stated assumptions. Under the stated assumptions.

Formal statement
P₀ P₁ :
n :
ℕ
α β r tv :
ℝ
hP₀ :
RadiusModel α β r P₀
hP₁ :
Model α β P₁
horder :
effect P₀ ≤ effect P₁
htv :
tvDist (experimentLaw P₀ n) (experimentLaw P₁ n) ≤ tv
(effect P₁-effect P₀)*(4/5-tv) ≤ lengthObjective n α β r
Proof (Lean source)
-- @node: twoPoint_lengthObjective_lower lemma twoPoint_lengthObjective_lower (P₀ P₁ : ObservedLaw) (n : ℕ) (α β r tv : ℝ) (hP₀ : RadiusModel α β r P₀) (hP₁ : Model α β P₁) (horder : effect P₀ ≤ effect P₁) (htv : tvDist (experimentLaw P₀ n) (experimentLaw P₁ n) ≤ tv) : (effect P₁-effect P₀)*(4/5-tv) ≤ lengthObjective n α β r := by apply le_lengthObjective intro I hI have hcover (P : ObservedLaw) (hP : Model α β P) : (9/10 : ℝ) ≤ (experimentLaw P n).real {ω | effect P ∈ intervalSet (I.output ω)} := by letI := experimentLaw_probability P n have h := hI.coverage P hP have ht : experimentLaw P n {ω | effect P ∈ intervalSet (I.output ω)} ≠ ⊤ := measure_ne_top _ _ have := ENNReal.toReal_mono ht h norm_num [measureReal_def] at this ⊢ exact this have hbound := twoPoint_expectedLength_lower P₀ P₁ n I (effect P₀) (effect P₁) (9/10) (9/10) tv horder (hcover P₀ hP₀.toModel) (hcover P₁ hP₁) htv have hbound' : (effect P₁-effect P₀)*(4/5-tv) ≤ expectedLength P₀ n I := by convert hbound using 1 <;> ring exact hbound'.trans (expectedLength_le_worstLength P₀ n α β r I hP₀)
CausalSmith.Stat.LogoddsLowsmoothFrontier.twoPoint_lengthObjective_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/Helpers/TwoPointLength.lean:138
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_CalibratedSupport 27 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

T CalibratedSupport

Paper-owned scaffold obligations; proofs are filled in Stage 3.

def recordReference

[The one-record reference is uniform covariate and uniform four-label measure.

Definition (Lean source)
recordReference :
jointLaw uniformLaw (fun _ _ _ => 1/4)
CausalSmith.Stat.LogoddsLowsmoothFrontier.recordReference · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:27
def mixedDensity

Actual mixed-law density, with roots and construction fully substituted.

Definition (Lean source)
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
a y :
x :
v :
Fin 2 → ℝ
mixedDensity b k σ a y x v :
ℝ
4*(mixedLaw b k σ (v 0) (v 1)).cells a y x
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:29
def fairDensity

Actual fair-law density, including the comparator.

Definition (Lean source)
random :
k :
ℕ
σ :
Fin (k + 1) → Bool
t :
ℝ
a y :
x :
δ :
ℝ
fairDensity random k σ t a y x δ :
ℝ
4*(if random then fairLaw k σ t δ else fairComparator k t δ).cells a y x
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairDensity · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:32
def CalibratedMembership

Substantive membership, effect, and singleton-matching claims at the rate-scaled amplitudes.

Definition (Lean source)
ε :
ℝ
α β :
ℝ
k :
ℕ
1 ≤ k
CalibratedMembership ε :
Prop
η :
ε*(k : ℝ)^(-α)
ζ :
ε*(k : ℝ)^(-β)
δ :
ε*(k : ℝ)^(-β)
σ :
Fin (k + 1) → Bool
Model α β (mixedLaw false k σ η ζ)
Model α β (mixedLaw true k σ η ζ)
effect (mixedLaw false k σ η ζ) = 0
effect (mixedLaw true k σ η ζ) = 32*η*ζ
a y x :
(∑ σ : Fin (k + 1) → Bool, (mixedLaw false k σ η ζ).cells a y x)
= (∑ σ : Fin (k + 1) → Bool, (mixedLaw true k σ η ζ).cells a y x)
t :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
σ :
Fin (k + 1) → Bool
Model α β (fairLaw k σ t δ)
effect (fairLaw k σ t δ) = t
Model α β (fairComparator k t δ)
effect (fairComparator k t δ) = comparatorEffect t δ
a y x :
((card (Fin (k + 1) → Bool) : ℝ)⁻¹ * ∑ σ : Fin (k + 1) → Bool, (fairLaw k σ t δ).cells a y x)
= (fairComparator k t δ).cells a y x
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibratedMembership · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:35

The model and homogeneous-effect obligations, separated from singleton matching, which follows from the exact calibration equations.

Definition (Lean source)
ε :
ℝ
α β :
ℝ
k :
ℕ
1 ≤ k
CalibratedModels ε :
Prop
η :
ε*(k : ℝ)^(-α)
ζ :
ε*(k : ℝ)^(-β)
δ :
ε*(k : ℝ)^(-β)
σ :
Fin (k + 1) → Bool
Model α β (mixedLaw false k σ η ζ)
Model α β (mixedLaw true k σ η ζ)
effect (mixedLaw false k σ η ζ) = 0
effect (mixedLaw true k σ η ζ) = 32*η*ζ
t :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
σ :
Fin (k + 1) → Bool
Model α β (fairLaw k σ t δ)
effect (fairLaw k σ t δ) = t
Model α β (fairComparator k t δ)
effect (fairComparator k t δ) = comparatorEffect t δ
CausalSmith.Stat.LogoddsLowsmoothFrontier.CalibratedModels · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:55
def DensityNeighbourhood

On one fixed signed neighbourhood the actual cell laws are valid, and their relative densities and first two amplitude derivatives have one universal envelope.

Definition (Lean source)
ε M :
ℝ
k :
ℕ
1 ≤ k
σ :
Fin (k + 1) → Bool
DensityNeighbourhood ε M :
Prop
clause 1
η ζ :
ℝ
|η| ≤ ε
|ζ| ≤ ε
b :
ValidCells (mixedCells b k σ η ζ)
a y x :
(1/2 : ℝ) ≤ mixedDensity b k σ a y x ![η,ζ]
mixedDensity b k σ a y x ![η,ζ] ≤ 2
m :
ℕ
1 ≤ m
m ≤ 2
‖iteratedFDeriv ℝ m (mixedDensity b k σ a y x) ![η,ζ]‖ ≤ M
clause 2
t δ :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
b :
ValidCells (fairCells b k σ t δ)
a y x :
(1/2 : ℝ) ≤ fairDensity b k σ t a y x δ
fairDensity b k σ t a y x δ ≤ 2
m :
ℕ
1 ≤ m
m ≤ 2
‖iteratedFDeriv ℝ m (fairDensity b k σ t a y x) δ‖ ≤ M
CausalSmith.Stat.LogoddsLowsmoothFrontier.DensityNeighbourhood · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:70

Actual fair record densities are twice continuously differentiable on the closed support neighborhood, inside the smooth signed calibration domain.

Definition (Lean source)
ε :
ℝ
k :
ℕ
1 ≤ k
σ :
Fin (k + 1) → Bool
t δ :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
b a y x :
FairDensitySmoothness ε :
Prop
ContDiffAt ℝ 2 (fairDensity b k σ t a y x) δ
CausalSmith.Stat.LogoddsLowsmoothFrontier.FairDensitySmoothness · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:87

Actual mixed record densities are twice continuously differentiable on the signed support square, including full neighborhoods of its boundary.

Definition (Lean source)
ε :
ℝ
k :
ℕ
1 ≤ k
σ :
Fin (k + 1) → Bool
η ζ :
ℝ
|η| ≤ ε
|ζ| ≤ ε
b a y x :
MixedDensitySmoothness ε :
Prop
ContDiffAt ℝ 2 (mixedDensity b k σ a y x) ![η,ζ]
CausalSmith.Stat.LogoddsLowsmoothFrontier.MixedDensitySmoothness · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:95

The actual one-record densities are infinitely differentiable on open amplitude neighborhoods containing the very same closed signed support box. The fair clause includes both the random law and the deterministic comparator.

Definition (Lean source)
ε :
ℝ
DensitySmoothNeighbourhood ε :
Prop
clause 1
∃ U : Set (Fin 2 → ℝ),
{v : Fin 2 → ℝ | |v 0| ≤ ε ∧ |v 1| ≤ ε} ⊆ U
k :
ℕ
1 ≤ k
σ :
Fin (k + 1) → Bool
b a y x :
ContDiffOn ℝ ∞ (mixedDensity b k σ a y x) U
clause 2
∃ U : Set ℝ,
{δ : ℝ | |δ| ≤ ε} ⊆ U
k :
ℕ
1 ≤ k
σ :
Fin (k + 1) → Bool
t :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
b a y x :
ContDiffOn ℝ ∞ (fairDensity b k σ t a y x) U
CausalSmith.Stat.LogoddsLowsmoothFrontier.DensitySmoothNeighbourhood · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:103

Exact singleton cancellation throughout the signed support neighborhood.

Definition (Lean source)
ε :
ℝ
k :
ℕ
1 ≤ k
SingletonNeighbourhood ε :
Prop
clause 1
η ζ :
ℝ
|η| ≤ ε
|ζ| ≤ ε
a y x :
(∑ σ : Fin (k + 1) → Bool, (mixedLaw false k σ η ζ).cells a y x)
= ∑ σ : Fin (k + 1) → Bool, (mixedLaw true k σ η ζ).cells a y x
clause 2
t δ :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
a y x :
(card (Fin (k + 1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k + 1) → Bool, (fairLaw k σ t δ).cells a y x)
= (fairComparator k t δ).cells a y x
CausalSmith.Stat.LogoddsLowsmoothFrontier.SingletonNeighbourhood · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:117

The actual fair laws inherit the literal four-cell bounds, even on totalization fallback inputs. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
a y :
x :
conclusion 1
(1/2 : ℝ) ≤ fairDensity b k σ t a y x δ
conclusion 2
fairDensity b k σ t a y x δ ≤ 2
Proof (Lean source)
-- @node: fairDensity_bounds lemma fairDensity_bounds (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (a y : Bool) (x : Covariate) : (1/2 : ℝ) ≤ fairDensity b k σ t a y x δ ∧ fairDensity b k σ t a y x δ ≤ 2 := by cases b · exact totalCellLaw_density_bounds _ (fairCells_density_bounds false k (fun _ => false) t δ ht hδ) a y x · exact totalCellLaw_density_bounds _ (fairCells_density_bounds true k σ t δ ht hδ) a y x
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairDensity_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:129

The actual mixed laws inherit the literal four-cell bounds, including fallback inputs. Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
a y :
x :
conclusion 1
(1/2 : ℝ) ≤ mixedDensity b k σ a y x ![η,ζ]
conclusion 2
mixedDensity b k σ a y x ![η,ζ] ≤ 2
Proof (Lean source)
-- @node: mixedDensity_bounds lemma mixedDensity_bounds (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (a y : Bool) (x : Covariate) : (1/2 : ℝ) ≤ mixedDensity b k σ a y x ![η,ζ] ∧ mixedDensity b k σ a y x ![η,ζ] ≤ 2 := by exact totalCellLaw_density_bounds _ (mixedCells_density_bounds b k σ η ζ hη hζ) a y x
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedDensity_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:142
theorem mixedCells_valid_of_continuous Lemma mixedCells_valid_of_continuous in the paper ↗

[The established mixed density bounds and exact table normalization reduce validity to spatial continuity. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
η ζ :
ℝ
hη :
|η| ≤ 1/100
hζ :
|ζ| ≤ 1/100
hc :
∀ a y, Continuous (mixedCells b k σ η ζ a y)
ValidCells (mixedCells b k σ η ζ)
Proof (Lean source)
-- @node: mixedCells_valid_of_continuous lemma mixedCells_valid_of_continuous (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (η ζ : ℝ) (hη : |η| ≤ 1/100) (hζ : |ζ| ≤ 1/100) (hc : ∀ a y, Continuous (mixedCells b k σ η ζ a y)) : ValidCells (mixedCells b k σ η ζ) := by refine ⟨hc, ?_, ?_⟩ · intro a y x obtain ⟨hlo,hhi⟩ := mixedCells_density_bounds b k σ η ζ hη hζ a y x constructor <;> linarith · intro x simp only [mixedCells, tableCell, Fintype.sum_bool, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedCells_valid_of_continuous · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:151
theorem fairCells_valid_of_continuous Lemma fairCells_valid_of_continuous in the paper ↗

[The established fair density bounds and exact arm normalization reduce validity, for the random law and comparator alike, to spatial continuity. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ 1/100
hc :
∀ a y, Continuous (fairCells b k σ t δ a y)
ValidCells (fairCells b k σ t δ)
Proof (Lean source)
-- @node: fairCells_valid_of_continuous lemma fairCells_valid_of_continuous (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ 1/100) (hc : ∀ a y, Continuous (fairCells b k σ t δ a y)) : ValidCells (fairCells b k σ t δ) := by refine ⟨hc, ?_, ?_⟩ · intro a y x obtain ⟨hlo,hhi⟩ := fairCells_density_bounds b k σ t δ ht hδ a y x constructor <;> linarith · intro x simp only [fairCells, Fintype.sum_bool, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairCells_valid_of_continuous · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:167
theorem mixedDensity_contDiffAt_of_valid Lemma mixedDensity_contDiffAt_of_valid in the paper ↗

[A valid mixed construction on a neighborhood has the smooth amplitude slice of its fully substituted local cell formula. the documented result Under the stated assumptions.

Formal statement
n :
ℕ∞ω
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
a y :
x :
v :
Fin 2 → ℝ
hvalid :
∀ᶠ w in nhds v, ValidCells (mixedCells b k σ (w 0) (w 1))
hsmooth :
∀ s, ContDiffAt ℝ n (localMixedCell b s a y) ![v 0,v 1,cellCoord k x]
ContDiffAt ℝ n (mixedDensity b k σ a y x) v
Proof (Lean source)
-- @node: mixedDensity_contDiffAt_of_valid lemma mixedDensity_contDiffAt_of_valid {n : ℕ∞ω} (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (a y : Bool) (x : Covariate) (v : Fin 2 → ℝ) (hvalid : ∀ᶠ w in nhds v, ValidCells (mixedCells b k σ (w 0) (w 1))) (hsmooth : ∀ s, ContDiffAt ℝ n (localMixedCell b s a y) ![v 0,v 1,cellCoord k x]) : ContDiffAt ℝ n (mixedDensity b k σ a y x) v := by let s : Bool × Bool := (σ ⟨min (cellIndex k x) k, lt_succ_of_le (min_le_right _ _)⟩, σ ⟨min (cellIndex k x + 1) k, lt_succ_of_le (min_le_right _ _)⟩) have hmap : ContDiffAt ℝ n (fun w : Fin 2 → ℝ => ![w 0,w 1,cellCoord k x]) v := by apply contDiffAt_pi.mpr intro i fin_cases i · change ContDiffAt ℝ n (fun w : Fin 2 → ℝ => w 0) v fun_prop · change ContDiffAt ℝ n (fun w : Fin 2 → ℝ => w 1) v fun_prop · change ContDiffAt ℝ n (fun _ : Fin 2 → ℝ => cellCoord k x) v fun_prop have hslice := (hsmooth s).comp v hmap have hd : ContDiffAt ℝ n (fun w : Fin 2 → ℝ => 4 * localMixedCell b s a y ![w 0,w 1,cellCoord k x]) v := contDiffAt_const.mul hslice apply hd.congr_of_eventuallyEq filter_upwards [hvalid] with w hw simp only [mixedDensity, mixedLaw, totalCellLaw_cells_of_valid _ hw] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedDensity_contDiffAt_of_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:183
theorem fairDensity_contDiffAt_of_valid Lemma fairDensity_contDiffAt_of_valid in the paper ↗

[Both fair constructions inherit amplitude smoothness from the local calibration formula wherever their cell-law constructor is valid nearby. the documented result Under the stated assumptions.

Formal statement
n :
ℕ∞ω
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
t :
ℝ
a y :
x :
δ :
ℝ
hvalid :
∀ᶠ d in nhds δ, ValidCells (fairCells b k (if b then σ else fun _ => false) t d)
hsmooth :
∀ s, ContDiffAt ℝ n (localFairCell b s a y) ![t,δ,cellCoord k x]
ContDiffAt ℝ n (fairDensity b k σ t a y x) δ
Proof (Lean source)
-- @node: fairDensity_contDiffAt_of_valid lemma fairDensity_contDiffAt_of_valid {n : ℕ∞ω} (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (t : ℝ) (a y : Bool) (x : Covariate) (δ : ℝ) (hvalid : ∀ᶠ d in nhds δ, ValidCells (fairCells b k (if b then σ else fun _ => false) t d)) (hsmooth : ∀ s, ContDiffAt ℝ n (localFairCell b s a y) ![t,δ,cellCoord k x]) : ContDiffAt ℝ n (fairDensity b k σ t a y x) δ := by let τ : Fin (k + 1) → Bool := if b then σ else fun _ => false let s : Bool × Bool := (τ ⟨min (cellIndex k x) k, lt_succ_of_le (min_le_right _ _)⟩, τ ⟨min (cellIndex k x + 1) k, lt_succ_of_le (min_le_right _ _)⟩) have hmap : ContDiffAt ℝ n (fun d : ℝ => ![t,d,cellCoord k x]) δ := by apply contDiffAt_pi.mpr intro i fin_cases i · change ContDiffAt ℝ n (fun _ : ℝ => t) δ fun_prop · change ContDiffAt ℝ n (fun d : ℝ => d) δ fun_prop · change ContDiffAt ℝ n (fun _ : ℝ => cellCoord k x) δ fun_prop have hslice := (hsmooth s).comp δ hmap have hd : ContDiffAt ℝ n (fun d : ℝ => 4 * localFairCell b s a y ![t,d,cellCoord k x]) δ := contDiffAt_const.mul hslice apply hd.congr_of_eventuallyEq filter_upwards [hvalid] with d hd cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] at hd ⊢ all_goals simp only [fairDensity, Bool.false_eq_true, ↓reduceIte, fairComparator, fairLaw, totalCellLaw_cells_of_valid _ hd] rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairDensity_contDiffAt_of_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:215
theorem calibrated_density_smoothness_of_valid

[A smaller closed amplitude region lies strictly inside the validity region. Smooth local calibration formulas therefore give smooth actual record densities even at the boundary of the closed region. the documented result

Formal statement
∃ ρ : ℝ,
0 < ρ
conclusion 1
ε :
ℝ
0 < ε
ε ≤ ρ
(∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k + 1) → Bool, (∀ η ζ : ℝ, |η| ≤ 2*ε → |ζ| ≤ 2*ε → ∀ b, ValidCells (mixedCells b k σ η ζ)) ∧ (∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ 2*ε → ∀ b, ValidCells (fairCells b k σ t δ)))
Proof (Lean source)
-- @node: calibrated_density_smoothness_of_valid lemma calibrated_density_smoothness_of_valid : ∃ ρ : ℝ, 0 < ρ ∧ ∀ ε : ℝ, 0 < ε → ε ≤ ρ → (∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k + 1) → Bool, (∀ η ζ : ℝ, |η| ≤ 2*ε → |ζ| ≤ 2*ε → ∀ b, ValidCells (mixedCells b k σ η ζ)) ∧ (∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ 2*ε → ∀ b, ValidCells (fairCells b k σ t δ))) → FairDensitySmoothness ε ∧ MixedDensitySmoothness ε ∧ DensitySmoothNeighbourhood ε := by obtain ⟨ρm,hρm,hm⟩ := localMixedCell_uniform_contDiffAt obtain ⟨ρf,hρf,hsmall,hf⟩ := fairRoot_uniform_contDiffAt refine ⟨min ρm ρf / 2, by positivity, ?_⟩ intro ε hε hρ hv have hem : 2*ε ≤ ρm := by linarith [min_le_left ρm ρf] have hef : 2*ε ≤ ρf := by linarith [min_le_right ρm ρf] have hfair (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| < 2*ε) (b a y : Bool) (x : Covariate) : ContDiffAt ℝ ∞ (fairDensity b k σ t a y x) δ := by apply fairDensity_contDiffAt_of_valid · have hn : ∀ᶠ d : ℝ in nhds δ, |d| < 2*ε := (by fun_prop : ContinuousAt (fun d : ℝ => |d|) δ).eventually_lt_const hδ filter_upwards [hn] with d hd exact (hv k hk (if b then σ else fun _ => false)).2 t d ht hd.le b · intro s have hroot := hf ![t,δ,cellCoord k x] ⟨ht,hδ.le.trans hef,cellCoord_mem_unit k hk x⟩ exact (localFairCell_contDiffAt_of_root _ ht ((hδ.le.trans hef).trans hsmall) hroot b s a y) have hmixed (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k+1) → Bool) (v : Fin 2 → ℝ) (hη : |v 0| < 2*ε) (hζ : |v 1| < 2*ε) (b a y : Bool) (x : Covariate) : ContDiffAt ℝ ∞ (mixedDensity b k σ a y x) v := by apply mixedDensity_contDiffAt_of_valid · have hn0 : ∀ᶠ w : Fin 2 → ℝ in nhds v, |w 0| < 2*ε := ((continuous_apply 0).abs.continuousAt).eventually_lt_const hη have hn1 : ∀ᶠ w : Fin 2 → ℝ in nhds v, |w 1| < 2*ε := ((continuous_apply 1).abs.continuousAt).eventually_lt_const hζ filter_upwards [hn0,hn1] with w h0 h1 exact (hv k hk σ).1 (w 0) (w 1) h0.le h1.le b · intro s exact (hm ![v 0,v 1,cellCoord k x] ⟨hη.le.trans hem,hζ.le.trans hem,cellCoord_mem_unit k hk x⟩ b s a y).of_le le_top refine ⟨?_, ?_, ?_, ?_⟩ · intro k hk σ t δ ht hδ b a y x exact (hfair k hk σ t δ ht (by linarith) b a y x).of_le (WithTop.coe_le_coe.mpr le_top) · intro k hk σ η ζ hη hζ b a y x exact (hmixed k hk σ ![η,ζ] (by simpa using (show |η| < 2*ε by linarith)) (by simpa using (show |ζ| < 2*ε by linarith)) b a y x).of_le (WithTop.coe_le_coe.mpr le_top) · refine ⟨{v : Fin 2 → ℝ | |v 0| < 2*ε ∧ |v 1| < 2*ε}, ?_, ?_, ?_⟩ · exact (isOpen_lt (continuous_apply 0).abs continuous_const).inter (isOpen_lt (continuous_apply 1).abs continuous_const) · intro v hv exact ⟨by linarith [hv.1], by linarith [hv.2]⟩ · intro k hk σ b a y x v hv exact (hmixed k hk σ v hv.1 hv.2 b a y x).contDiffWithinAt · refine ⟨{δ : ℝ | |δ| < 2*ε}, ?_, ?_, ?_⟩ · exact isOpen_lt continuous_abs continuous_const · intro δ hδ change |δ| ≤ ε at hδ exact lt_of_le_of_lt hδ (by linarith) · intro k hk σ t ht b a y x δ hδ exact (hfair k hk σ t δ ht hδ b a y x).contDiffWithinAt
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_density_smoothness_of_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:251
theorem mixedDensity_iteratedFDeriv_of_valid Lemma mixedDensity_iteratedFDeriv_of_valid in the paper ↗

Nearby validity identifies the derivatives of an actual mixed density with the derivatives of its local formula, with the spatial coordinate fixed. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
a y :
x :
v :
Fin 2 → ℝ
hvalid :
∀ᶠ w in nhds v, ValidCells (mixedCells b k σ (w 0) (w 1))
m :
ℕ
∃ s : Bool × Bool,
iteratedFDeriv ℝ m (mixedDensity b k σ a y x) v
= iteratedFDeriv ℝ m (fun w : Fin 2 → ℝ => 4*localMixedCell b s a y ![w 0,w 1,cellCoord k x]) v
Proof (Lean source)
-- @node: mixedDensity_iteratedFDeriv_of_valid lemma mixedDensity_iteratedFDeriv_of_valid (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (a y : Bool) (x : Covariate) (v : Fin 2 → ℝ) (hvalid : ∀ᶠ w in nhds v, ValidCells (mixedCells b k σ (w 0) (w 1))) (m : ℕ) : ∃ s : Bool × Bool, iteratedFDeriv ℝ m (mixedDensity b k σ a y x) v = iteratedFDeriv ℝ m (fun w : Fin 2 → ℝ => 4*localMixedCell b s a y ![w 0,w 1,cellCoord k x]) v := by let s : Bool × Bool := (σ ⟨min (cellIndex k x) k, lt_succ_of_le (min_le_right _ _)⟩, σ ⟨min (cellIndex k x + 1) k, lt_succ_of_le (min_le_right _ _)⟩) refine ⟨s,?_⟩ have heq : mixedDensity b k σ a y x =ᶠ[nhds v] (fun w : Fin 2 → ℝ => 4*localMixedCell b s a y ![w 0,w 1,cellCoord k x]) := by filter_upwards [hvalid] with w hw simp only [mixedDensity, mixedLaw, totalCellLaw_cells_of_valid _ hw] rfl exact (heq.iteratedFDeriv ℝ m).eq_of_nhds
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedDensity_iteratedFDeriv_of_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:321
theorem fairDensity_iteratedFDeriv_of_valid Lemma fairDensity_iteratedFDeriv_of_valid in the paper ↗

[Nearby validity identifies an actual fair or comparator density with its local amplitude slice to every derivative order. the documented result Under the stated assumptions.

Formal statement
b :
k :
ℕ
σ :
Fin (k + 1) → Bool
t :
ℝ
a y :
x :
δ :
ℝ
hvalid :
∀ᶠ d in nhds δ, ValidCells (fairCells b k (if b then σ else fun _ => false) t d)
m :
ℕ
∃ s : Bool × Bool,
iteratedFDeriv ℝ m (fairDensity b k σ t a y x) δ
= iteratedFDeriv ℝ m (fun d : ℝ => 4*localFairCell b s a y ![t,d,cellCoord k x]) δ
Proof (Lean source)
-- @node: fairDensity_iteratedFDeriv_of_valid lemma fairDensity_iteratedFDeriv_of_valid (b : Bool) (k : ℕ) (σ : Fin (k + 1) → Bool) (t : ℝ) (a y : Bool) (x : Covariate) (δ : ℝ) (hvalid : ∀ᶠ d in nhds δ, ValidCells (fairCells b k (if b then σ else fun _ => false) t d)) (m : ℕ) : ∃ s : Bool × Bool, iteratedFDeriv ℝ m (fairDensity b k σ t a y x) δ = iteratedFDeriv ℝ m (fun d : ℝ => 4*localFairCell b s a y ![t,d,cellCoord k x]) δ := by let τ : Fin (k + 1) → Bool := if b then σ else fun _ => false let s : Bool × Bool := (τ ⟨min (cellIndex k x) k, lt_succ_of_le (min_le_right _ _)⟩, τ ⟨min (cellIndex k x + 1) k, lt_succ_of_le (min_le_right _ _)⟩) refine ⟨s,?_⟩ have heq : fairDensity b k σ t a y x =ᶠ[nhds δ] (fun d : ℝ => 4*localFairCell b s a y ![t,d,cellCoord k x]) := by filter_upwards [hvalid] with d hd cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] at hd ⊢ all_goals simp only [fairDensity, Bool.false_eq_true, ↓reduceIte, fairComparator, fairLaw, totalCellLaw_cells_of_valid _ hd] rfl exact (heq.iteratedFDeriv ℝ m).eq_of_nhds
CausalSmith.Stat.LogoddsLowsmoothFrontier.fairDensity_iteratedFDeriv_of_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:342
theorem calibrated_density_derivative_envelopes_of_valid Lemma calibrated_density_derivative_envelopes_of_valid in the paper ↗

Validity on the larger signed box transfers the compact local density envelopes to both actual density families on every smaller closed box. the documented result

Formal statement
∃ r M : ℝ,
0 < r
1 ≤ M
conclusion 1
ε :
ℝ
0 < ε
ε ≤ r
(∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k + 1) → Bool, (∀ η ζ : ℝ, |η| ≤ 2*ε → |ζ| ≤ 2*ε → ∀ b, ValidCells (mixedCells b k σ η ζ)) ∧ (∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ 2*ε → ∀ b, ValidCells (fairCells b k σ t δ)))
k :
ℕ
1 ≤ k
σ :
Fin (k + 1) → Bool
η ζ :
ℝ
|η| ≤ ε
|ζ| ≤ ε
b a y x :
m :
ℕ
1 ≤ m
m ≤ 2
‖iteratedFDeriv ℝ m (mixedDensity b k σ a y x) ![η,ζ]‖ ≤ M
k :
ℕ
1 ≤ k
σ :
Fin (k + 1) → Bool
t δ :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
b a y x :
m :
ℕ
1 ≤ m
m ≤ 2
‖iteratedFDeriv ℝ m (fairDensity b k σ t a y x) δ‖ ≤ M
Proof (Lean source)
-- @node: calibrated_density_derivative_envelopes_of_valid lemma calibrated_density_derivative_envelopes_of_valid : ∃ r M : ℝ, 0 < r ∧ 1 ≤ M ∧ ∀ ε : ℝ, 0 < ε → ε ≤ r → (∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k + 1) → Bool, (∀ η ζ : ℝ, |η| ≤ 2*ε → |ζ| ≤ 2*ε → ∀ b, ValidCells (mixedCells b k σ η ζ)) ∧ (∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ 2*ε → ∀ b, ValidCells (fairCells b k σ t δ))) → (∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k + 1) → Bool, ∀ η ζ : ℝ, |η| ≤ ε → |ζ| ≤ ε → ∀ b a y x, ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (mixedDensity b k σ a y x) ![η,ζ]‖ ≤ M) ∧ (∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k + 1) → Bool, ∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → ∀ b a y x, ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fairDensity b k σ t a y x) δ‖ ≤ M) := by obtain ⟨r,M,hr,hM,hm,hf⟩ := calibrated_local_density_derivative_envelopes refine ⟨r,M,hr,hM,?_⟩ intro ε hε her hv constructor · intro k hk σ η ζ hη hζ b a y x m hmlo hmhi have hvalid : ∀ᶠ w : Fin 2 → ℝ in nhds ![η,ζ], ValidCells (mixedCells b k σ (w 0) (w 1)) := by have hn0 : ∀ᶠ w : Fin 2 → ℝ in nhds ![η,ζ], |w 0| < 2*ε := ((continuous_apply 0).abs.continuousAt).eventually_lt_const (by simpa using (show |η| < 2*ε by linarith)) have hn1 : ∀ᶠ w : Fin 2 → ℝ in nhds ![η,ζ], |w 1| < 2*ε := ((continuous_apply 1).abs.continuousAt).eventually_lt_const (by simpa using (show |ζ| < 2*ε by linarith)) filter_upwards [hn0,hn1] with w h0 h1 exact (hv k hk σ).1 (w 0) (w 1) h0.le h1.le b obtain ⟨s,heq⟩ := mixedDensity_iteratedFDeriv_of_valid b k σ a y x ![η,ζ] hvalid m rw [heq] exact hm η ζ (cellCoord k x) (hη.trans her) (hζ.trans her) (cellCoord_mem_unit k hk x) b s a y m hmlo hmhi · intro k hk σ t δ ht hδ b a y x m hmlo hmhi have hvalid : ∀ᶠ d in nhds δ, ValidCells (fairCells b k (if b then σ else fun _ => false) t d) := by have hn : ∀ᶠ d : ℝ in nhds δ, |d| < 2*ε := (by fun_prop : ContinuousAt (fun d : ℝ => |d|) δ).eventually_lt_const (by linarith) filter_upwards [hn] with d hd exact (hv k hk (if b then σ else fun _ => false)).2 t d ht hd.le b obtain ⟨s,heq⟩ := fairDensity_iteratedFDeriv_of_valid b k σ t a y x δ hvalid m rw [heq] exact hf t δ (cellCoord k x) ht (hδ.trans her) (cellCoord_mem_unit k hk x) b s a y m hmlo hmhi
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_density_derivative_envelopes_of_valid · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:366
theorem calibrated_support

One absolute calibration radius and derivative envelope support every legal exponent pair and certify infinitely differentiable densities on open neighborhoods containing that same closed signed amplitude box. the documented result

Formal statement
∃ ε M : ℝ,
conclusion 1
0 < ε
conclusion 2
0 < M
conclusion 3
conclusion 4
conclusion 5
conclusion 6
ε ≤ 1/100
conclusion 7
1 ≤ M
conclusion 8
conclusion 9
Proof (Lean source)
lemma calibrated_support : ∃ ε M : ℝ, 0 < ε ∧ 0 < M ∧ CalibratedMembership ε ∧ DensityNeighbourhood ε M ∧ SingletonNeighbourhood ε ∧ ε ≤ 1/100 ∧ 1 ≤ M ∧ FairDensitySmoothness ε ∧ MixedDensitySmoothness ε ∧ DensitySmoothNeighbourhood ε := by obtain ⟨εcal, Mcal, hεcal, hMcal, hSmooth, hDerivatives, hBranch, hMixedCalibration, hFairCalibration⟩ := exact_calibrations obtain ⟨ρ, hρ, hDensitySmooth⟩ := calibrated_density_smoothness_of_valid obtain ⟨rD, M, hrD, hM, hDensityDeriv⟩ := calibrated_density_derivative_envelopes_of_valid obtain ⟨rE, hrE, _, hFairEnvelope⟩ := fairCells_uniform_prognosis_envelope obtain ⟨rO, hrO, _, hFairOscillation⟩ := fairCells_uniform_prognosis_oscillation obtain ⟨rL, hrL, _, hFairLinear⟩ := fairCells_uniform_prognosis_linear obtain ⟨rP, hrP, _, hMixedLinear⟩ := mixedCells_uniform_propensity_linear obtain ⟨rN, hrN, _, hAlternativeLinear⟩ := mixedCells_uniform_alternative_prognosis_linear obtain ⟨ε, hε, hsmall, hcalSmall, hModelBounds, hSmoothRadius, hDerivRadius, hEnvelopeRadius, hWideSmall, hCalWide, hOscRadius, hLinRadius⟩ : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ε ≤ εcal ∧ (∀ α β : ℝ, ExponentDomain α β → ∀ k : ℕ, 1 ≤ k → (∀ σ : Fin (k+1) → Bool, CalibratedSpatialBounds α β k (mixedLaw false k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) ∧ CalibratedSpatialBounds α β k (mixedLaw true k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))))) ∧ ε ≤ ρ ∧ ε ≤ rD ∧ ε ≤ rE ∧ 2*ε ≤ 1/100 ∧ 2*ε ≤ εcal ∧ ε ≤ rO ∧ ε ≤ rL := by obtain ⟨ε, hε, hsmall, hcal, hRemaining, hs, hd, he, hw, hc, ho, hl, hpRadius⟩ : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ε ≤ εcal ∧ (∀ α β : ℝ, ExponentDomain α β → ∀ k : ℕ, 1 ≤ k → ∀ σ : Fin (k+1) → Bool, let P := mixedLaw true k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β)) (∀ x z, |prognosisLogit P x-prognosisLogit P z| ≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)|)) ∧ ε ≤ ρ ∧ ε ≤ rD ∧ ε ≤ rE ∧ 2*ε ≤ 1/100 ∧ 2*ε ≤ εcal ∧ ε ≤ rO ∧ ε ≤ rL ∧ ε ≤ rP := by let R := min εcal (min ρ (min rD (min rE (min rO (min rL (min rP (min rN (1/100)))))))) have hR : 0 < R := by dsimp [R] positivity have hRs : R ≤ εcal ∧ R ≤ ρ ∧ R ≤ rD ∧ R ≤ rE ∧ R ≤ rO ∧ R ≤ rL ∧ R ≤ rP ∧ R ≤ rN ∧ R ≤ 1/100 := by simp [R,min_le_iff] refine ⟨R/2,by positivity,by linarith [hRs.2.2.2.2.2.2.2.2],by linarith [hRs.1], ?_,by linarith [hRs.2.1],by linarith [hRs.2.2.1],by linarith [hRs.2.2.2.1], by linarith [hRs.2.2.2.2.2.2.2.2],by linarith [hRs.1], by linarith [hRs.2.2.2.2.1],by linarith [hRs.2.2.2.2.2.1], by linarith [hRs.2.2.2.2.2.2.1]⟩ intro α β hab k hk σ exact hAlternativeLinear (R/2) (by positivity) (by linarith [hRs.2.2.2.2.2.2.2.1]) α β hab k hk σ refine ⟨ε, hε, hsmall, hcal, ?_, hs, hd, he, hw, hc, ho, hl⟩ intro α β hab k hk σ have hsp (b : Bool) : CalibratedSpatialBounds α β k (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) := by have hn : ∀ x z, |prognosisLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) x- prognosisLogit (mixedLaw b k σ (ε*(k : ℝ)^(-α)) (ε*(k : ℝ)^(-β))) z| ≤ (k : ℝ)^(1-β)*|(x : ℝ)-(z : ℝ)| := by cases b · exact mixedCells_uniform_null_prognosis_linear ε hε hsmall α β (hab.1.trans hab.2.2.1).le hab.1.le k hk σ · exact hRemaining α β hab k hk σ exact ⟨hMixedLinear ε hε hpRadius α β (hab.1.trans hab.2.2.1).le hab.1.le k hk σ b, mixedCells_uniform_propensity_oscillation ε hε hsmall α β (hab.1.trans hab.2.2.1).le hab.1.le k hk σ b, hn, mixedCells_uniform_prognosis_oscillation ε hε hsmall α β (hab.1.trans hab.2.2.1).le hab.1.le k hk σ b⟩ exact ⟨hsp false, hsp true⟩ have hContinuousWide (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k + 1) → Bool) : (∀ η ζ : ℝ, |η| ≤ 2*ε → |ζ| ≤ 2*ε → ∀ b, ∀ a y, Continuous (mixedCells b k σ η ζ a y)) ∧ (∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ 2*ε → ∀ b, ∀ a y, Continuous (fairCells b k σ t δ a y)) := by constructor · intro η ζ hη hζ b a y exact mixedCells_continuous_of_smooth εcal hSmooth k hk σ η ζ (hη.trans hCalWide) (hζ.trans hCalWide) b a y · intro t δ ht hδ b a y exact fairCells_continuous_of_smooth εcal hSmooth k hk σ t δ ht (hδ.trans hCalWide) b a y have hValidWide (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k + 1) → Bool) : (∀ η ζ : ℝ, |η| ≤ 2*ε → |ζ| ≤ 2*ε → ∀ b, ValidCells (mixedCells b k σ η ζ)) ∧ (∀ t δ : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ 2*ε → ∀ b, ValidCells (fairCells b k σ t δ)) := by constructor · intro η ζ hη hζ b exact mixedCells_valid_of_continuous b k σ η ζ (hη.trans hWideSmall) (hζ.trans hWideSmall) ((hContinuousWide k hk σ).1 η ζ hη hζ b) · intro t δ ht hδ b exact fairCells_valid_of_continuous b k σ t δ ht (hδ.trans hWideSmall) ((hContinuousWide k hk σ).2 t δ ht hδ b) obtain ⟨hMixedDeriv,hFairDeriv⟩ := hDensityDeriv ε hε hDerivRadius hValidWide have hMixed (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k + 1) → Bool) (η ζ : ℝ) (hη : |η| ≤ ε) (hζ : |ζ| ≤ ε) (b : Bool) : ValidCells (mixedCells b k σ η ζ) ∧ (∀ a y x, ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (mixedDensity b k σ a y x) ![η,ζ]‖ ≤ M) := ⟨(hValidWide k hk σ).1 η ζ (by linarith) (by linarith) b, hMixedDeriv k hk σ η ζ hη hζ b⟩ have hFair (k : ℕ) (hk : 1 ≤ k) (σ : Fin (k + 1) → Bool) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ ε) (b : Bool) : ValidCells (fairCells b k σ t δ) ∧ (∀ a y x, ∀ m : ℕ, 1 ≤ m → m ≤ 2 → ‖iteratedFDeriv ℝ m (fairDensity b k σ t a y x) δ‖ ≤ M) := ⟨(hValidWide k hk σ).2 t δ ht (by linarith) b, hFairDeriv k hk σ t δ ht hδ b⟩ obtain ⟨hFairSmooth, hMixedSmooth, hDensitySmoothNeighbourhood⟩ := hDensitySmooth ε hε hSmoothRadius hValidWide have hModels : CalibratedModels ε := by intro α β hab k hk dsimp only have hη : |ε*(k : ℝ)^(-α)| ≤ ε := calibrated_amplitude_abs_le ε α hε.le (hab.1.trans hab.2.2.1).le k hk have hζ : |ε*(k : ℝ)^(-β)| ≤ ε := calibrated_amplitude_abs_le ε β hε.le hab.1.le k hk have hm := hModelBounds α β hab k hk constructor · intro σ obtain ⟨hm0, hm1⟩ := hm σ have hm0 := calibrated_model_of_bounds α β k _ hab hk (mixedCells_model_bounds_of_spatial α β false k σ _ _ (hη.trans hsmall) (hζ.trans hsmall) (hMixed k hk σ _ _ hη hζ false).1 hm0) have hm1 := calibrated_model_of_bounds α β k _ hab hk (mixedCells_model_bounds_of_spatial α β true k σ _ _ (hη.trans hsmall) (hζ.trans hsmall) (hMixed k hk σ _ _ hη hζ true).1 hm1) have he0 := (mixedCells_homogeneous_effect false k σ _ _ (hη.trans hsmall) (hζ.trans hsmall) (hMixed k hk σ _ _ hη hζ false).1).1 have he1 := (mixedCells_homogeneous_effect true k σ _ _ (hη.trans hsmall) (hζ.trans hsmall) (hMixed k hk σ _ _ hη hζ true).1).1 exact ⟨hm0, hm1, he0, he1⟩ · intro t ht have hr (σ : Fin (k+1) → Bool) := hFairLinear ε hε hLinRadius β hab.1.le k hk σ t ht true have hc := hFairLinear ε hε hLinRadius β hab.1.le k hk (fun _ => false) t ht false have hc := fairCells_model_bounds_of_prognosis α β false k (fun _ => false) t _ ht (hζ.trans hsmall) (hFair k hk (fun _ => false) t _ ht hζ false).1 ⟨hFairEnvelope k hk (fun _ => false) t _ ht (hζ.trans hEnvelopeRadius) false, hc, hFairOscillation ε hε hOscRadius β hab.1.le k hk (fun _ => false) t ht false⟩ refine ⟨?_, calibrated_model_of_bounds α β k _ hab hk hc, ?_⟩ · intro σ have hr := fairCells_model_bounds_of_prognosis α β true k σ t _ ht (hζ.trans hsmall) (hFair k hk σ t _ ht hζ true).1 ⟨hFairEnvelope k hk σ t _ ht (hζ.trans hEnvelopeRadius) true, hr σ, hFairOscillation ε hε hOscRadius β hab.1.le k hk σ t ht true⟩ exact ⟨calibrated_model_of_bounds α β k _ hab hk hr, (fairCells_homogeneous_effect true k σ t _ (hζ.trans hsmall) (hFair k hk σ t _ ht hζ true).1).1⟩ · exact (fairCells_homogeneous_effect false k (fun _ => false) t _ (hζ.trans hsmall) (hFair k hk (fun _ => false) t _ ht hζ false).1).1 have hMembership : CalibratedMembership ε := by intro α β hab k hk dsimp only obtain ⟨hm, hf⟩ := hModels α β hab k hk have hη : |ε*(k : ℝ)^(-α)| ≤ ε := calibrated_amplitude_abs_le ε α hε.le (hab.1.trans hab.2.2.1).le k hk have hζ : |ε*(k : ℝ)^(-β)| ≤ ε := calibrated_amplitude_abs_le ε β hε.le hab.1.le k hk refine ⟨hm, ?_, ?_⟩ · intro a y x have hroot := hMixedCalibration _ _ (cellCoord k x) (hη.trans hcalSmall) (hζ.trans hcalSmall) (cellCoord_mem_unit k hk x) apply mixedLaw_singleton_matching k hk _ _ (fun b σ => (hMixed k hk σ _ _ hη hζ b).1) x hroot.2.2.1 a y · intro t ht obtain ⟨hmodels, hcomp, heffect⟩ := hf t ht refine ⟨hmodels, hcomp, heffect, ?_⟩ intro a y x obtain ⟨_, _, _, _, _, _, _, hmatch, _⟩ := hFairCalibration t _ (cellCoord k x) ht (hζ.trans hcalSmall) (cellCoord_mem_unit k hk x) exact fairLaw_singleton_matching k hk t _ (fun σ => (hFair k hk σ t _ ht hζ true).1) (hFair k hk (fun _ => false) t _ ht hζ false).1 x hmatch a y have hSingletons : SingletonNeighbourhood ε := by intro k hk constructor · intro η ζ hη hζ a y x have hroot := hMixedCalibration η ζ (cellCoord k x) (hη.trans hcalSmall) (hζ.trans hcalSmall) (cellCoord_mem_unit k hk x) exact mixedLaw_singleton_matching k hk η ζ (fun b σ => (hMixed k hk σ η ζ hη hζ b).1) x hroot.2.2.1 a y · intro t δ ht hδ a y x obtain ⟨_, _, _, _, _, _, _, hmatch, _⟩ := hFairCalibration t δ (cellCoord k x) ht (hδ.trans hcalSmall) (cellCoord_mem_unit k hk x) exact fairLaw_singleton_matching k hk t δ (fun σ => (hFair k hk σ t δ ht hδ true).1) (hFair k hk (fun _ => false) t δ ht hδ false).1 x hmatch a y refine ⟨ε, M, hε, lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hM, hMembership, ?_, hSingletons, hsmall, hM, hFairSmooth, hMixedSmooth, hDensitySmoothNeighbourhood⟩ intro k hk σ constructor · intro η ζ hη hζ b obtain ⟨hValid, hDeriv⟩ := hMixed k hk σ η ζ hη hζ b refine ⟨hValid, ?_⟩ intro a y x obtain ⟨hLower, hUpper⟩ := mixedDensity_bounds b k σ η ζ (hη.trans hsmall) (hζ.trans hsmall) a y x exact ⟨hLower, hUpper, hDeriv a y x⟩ · intro t δ ht hδ b obtain ⟨hValid, hDeriv⟩ := hFair k hk σ t δ ht hδ b refine ⟨hValid, ?_⟩ intro a y x obtain ⟨hLower, hUpper⟩ := fairDensity_bounds b k σ t δ ht (hδ.trans hsmall) a y x exact ⟨hLower, hUpper, hDeriv a y x⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibrated_support · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:417
def calibEps

The support radius chosen from the actual support theorem.

Definition (Lean source)
calibEps :
ℝ
def calibM

The derivative envelope chosen together with that same radius.

Definition (Lean source)
calibM :
ℝ
choose (Classical.choose_spec calibrated_support)

Export the jointly selected constants, rather than mismatching separate existential witnesses. the stated conclusion holds.

Formal statement
conclusion 1
conclusion 2
0 < calibM
Proof (Lean source)
-- @node: calib_constants_spec lemma calib_constants_spec : 0 < calibEps ∧ 0 < calibM ∧ CalibratedMembership calibEps ∧ DensityNeighbourhood calibEps calibM := by obtain ⟨hε, hM, hMembership, hDensity, _, _⟩ := Classical.choose_spec (Classical.choose_spec calibrated_support) exact ⟨hε, hM, hMembership, hDensity⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.calib_constants_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:628
theorem calib_singletons_spec

The same chosen support radius supplies exact singleton matching, with no rate scaling restriction on the signed amplitudes. the documented result

Formal statement
Proof (Lean source)
-- @node: calib_singletons_spec lemma calib_singletons_spec : SingletonNeighbourhood calibEps := by exact (Classical.choose_spec (Classical.choose_spec calibrated_support)).2.2.2.2.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.calib_singletons_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:636
theorem calib_regularity_spec

The jointly chosen radius is inside the explicit cell-bound square, its common derivative envelope is at least one, and fair densities are smooth. the documented result

Formal statement
conclusion 1
calibEps ≤ 1/100
conclusion 2
1 ≤ calibM
Proof (Lean source)
-- @node: calib_regularity_spec lemma calib_regularity_spec : calibEps ≤ 1/100 ∧ 1 ≤ calibM ∧ FairDensitySmoothness calibEps := by obtain ⟨hsmall, hM, hFair, hMixed⟩ := (Classical.choose_spec (Classical.choose_spec calibrated_support)).2.2.2.2.2 exact ⟨hsmall, hM, hFair⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.calib_regularity_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:641
theorem calib_mixed_smoothness_spec

The same selected support square supplies mixed-density smoothness. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: calib_mixed_smoothness_spec lemma calib_mixed_smoothness_spec : MixedDensitySmoothness calibEps := by exact (Classical.choose_spec (Classical.choose_spec calibrated_support)).2.2.2.2.2.2.2.2.1
CausalSmith.Stat.LogoddsLowsmoothFrontier.calib_mixed_smoothness_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_CalibratedSupport.lean:650
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_ConcreteArithmeticEngine 5 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

T ConcreteArithmeticEngine

Paper-owned scaffold obligations; proofs are filled in Stage 3.

The scalar square-root algorithm contains the true root and has the exact dyadic width. Under the stated assumptions.

Formal statement
q :
ℕ
z :
ℚ
hz :
0 ≤ z
conclusion 1
(paperSqrtScalar q z).Contains (sqrt z)
conclusion 2
0 ≤ (paperSqrtScalar q z).lo
conclusion 3
(paperSqrtScalar q z).width = rationalError (q + 3)
Proof (Lean source)
-- @node: paperSqrtScalar_spec lemma paperSqrtScalar_spec (q : ℕ) (z : ℚ) (hz : 0 ≤ z) : (paperSqrtScalar q z).Contains (sqrt z) ∧ 0 ≤ (paperSqrtScalar q z).lo ∧ (paperSqrtScalar q z).width = rationalError (q + 3) := by let p := q + 3 let N := (⌊(2 : ℚ) ^ (2 * p) * z⌋ : ℤ).toNat let a := paperIntegerSqrt N have hpow : 0 < (2 : ℚ) ^ p := by positivity have hfloor : 0 ≤ (⌊(2 : ℚ) ^ (2 * p) * z⌋ : ℤ) := Int.floor_nonneg.mpr (by positivity) have hcast : (N : ℚ) = (⌊(2 : ℚ) ^ (2 * p) * z⌋ : ℤ) := by dsimp only [N] exact_mod_cast Int.toNat_of_nonneg hfloor have hflo := Int.floor_le ((2 : ℚ) ^ (2 * p) * z) have hfhi := Int.lt_floor_add_one ((2 : ℚ) ^ (2 * p) * z) rw [← hcast] at hflo hfhi obtain ⟨ha, hb⟩ := paperIntegerSqrt_spec N have haQ : (a : ℚ) ^ 2 ≤ (N : ℚ) := by exact_mod_cast ha have hbQ : (N : ℚ) + 1 ≤ ((a : ℚ) + 1) ^ 2 := by exact_mod_cast hb have hloSq : ((a : ℚ) / 2 ^ p) ^ 2 ≤ z := by rw [div_pow] apply (div_le_iff₀ (sq_pos_of_pos hpow)).mpr rw [show 2 * p = p * 2 by omega, pow_mul] at hflo nlinarith have hhiSq : z ≤ (((a : ℚ) + 1) / 2 ^ p) ^ 2 := by rw [div_pow] apply (le_div_iff₀ (sq_pos_of_pos hpow)).mpr rw [show 2 * p = p * 2 by omega, pow_mul] at hfhi nlinarith have hord : (a : ℚ) / 2 ^ p ≤ ((a : ℚ) + 1) / 2 ^ p := by apply div_le_div_of_nonneg_right <;> first | positivity | linarith change let J := rationalBox ((a : ℚ) / 2 ^ p) (((a : ℚ) + 1) / 2 ^ p) J.Contains (sqrt z) ∧ 0 ≤ J.lo ∧ J.width = rationalError p simp only [rationalBox, min_eq_left hord, max_eq_right hord, Contains, width] refine ⟨⟨?_, ?_⟩, by positivity, ?_⟩ · apply Real.le_sqrt_of_sq_le exact_mod_cast hloSq · apply (Real.sqrt_le_left (by positivity)).mpr exact_mod_cast hhiSq · change ((a : ℚ) + 1) / 2 ^ p - (a : ℚ) / 2 ^ p = 1 / 2 ^ p ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperSqrtScalar_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ConcreteArithmeticEngine.lean:28

[The rational and real precision errors represent the same dyadic number. the stated conclusion holds.

Formal statement
q :
ℕ
(rationalError q : ℝ) = precisionError q
Proof (Lean source)
-- @node: rationalError_coe lemma rationalError_coe (q : ℕ) : (rationalError q : ℝ) = precisionError q := by simp [rationalError, precisionError, zpow_neg, zpow_natCast]
CausalSmith.Stat.LogoddsLowsmoothFrontier.rationalError_coe · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ConcreteArithmeticEngine.lean:74
theorem paperSqrtScalar_width_le Lemma paperSqrtScalar_width_le in the paper ↗

The scalar dyadic width is below the requested primitive tolerance. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
q :
ℕ
z :
ℚ
hz :
0 ≤ z
((paperSqrtScalar q z).width : ℝ) ≤ precisionError q
Proof (Lean source)
-- @node: paperSqrtScalar_width_le lemma paperSqrtScalar_width_le (q : ℕ) (z : ℚ) (hz : 0 ≤ z) : ((paperSqrtScalar q z).width : ℝ) ≤ precisionError q := by rw [(paperSqrtScalar_spec q z hz).2.2, ← rationalError_coe] simp only [rationalError, Rat.cast_div, Rat.cast_one, Rat.cast_pow, Rat.cast_ofNat] apply one_div_le_one_div_of_le (by positivity) gcongr <;> norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.paperSqrtScalar_width_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ConcreteArithmeticEngine.lean:79
theorem concreteEngine_sqrt_contract

Monotone endpoint extension of the certified scalar brackets satisfies the square-root contract. Under the stated assumptions.

Formal statement
q :
ℕ
hI :
0 ≤ I.lo
conclusion 1
MonotoneContract sqrt q I (concreteEngine.sqrtBox q I)
conclusion 2
0 ≤ (concreteEngine.sqrtBox q I).lo
Proof (Lean source)
-- @node: concreteEngine_sqrt_contract lemma concreteEngine_sqrt_contract (q : ℕ) (I : RatInterval) (hI : 0 ≤ I.lo) : MonotoneContract sqrt q I (concreteEngine.sqrtBox q I) ∧ 0 ≤ (concreteEngine.sqrtBox q I).lo := by have hhi : 0 ≤ I.hi := hI.trans I.lo_le_hi obtain ⟨hl, hl0, _⟩ := paperSqrtScalar_spec q I.lo hI obtain ⟨hu, _, _⟩ := paperSqrtScalar_spec q I.hi hhi have hlohi : (I.lo : ℝ) ≤ I.hi := by exact_mod_cast I.lo_le_hi have horderR : ((paperSqrtScalar q I.lo).lo : ℝ) ≤ (paperSqrtScalar q I.hi).hi := hl.1.trans ((Real.sqrt_le_sqrt hlohi).trans hu.2) have horder : (paperSqrtScalar q I.lo).lo ≤ (paperSqrtScalar q I.hi).hi := by exact_mod_cast horderR have hwl := paperSqrtScalar_width_le q I.lo hI have hwu := paperSqrtScalar_width_le q I.hi hhi simp only [width, Rat.cast_sub] at hwl hwu simp only [concreteEngine, endpointExtension, rationalBox, min_eq_left horder, max_eq_right horder, MonotoneContract, Contains] refine ⟨⟨?_, sub_nonneg.mpr hl.1, ?_, sub_nonneg.mpr hu.2, ?_⟩, hl0⟩ · intro x hx exact ⟨hl.1.trans (Real.sqrt_le_sqrt hx.1), (Real.sqrt_le_sqrt hx.2).trans hu.2⟩ · linarith [hl.2] · linarith [hu.1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_sqrt_contract · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ConcreteArithmeticEngine.lean:88
theorem concreteEngine_admissible Lemma 3 in the paper ↗

The literal fixed-count rational routines satisfy every primitive engine contract. the stated conclusion holds.

Formal statement
ArithmeticEngine.Admissible concreteEngine
Proof (Lean source)
lemma concreteEngine_admissible : ArithmeticEngine.Admissible concreteEngine := by refine ⟨?_, ?_, ?_, ?_, concreteEngine_sqrt_contract, ?_, ?_⟩ · obtain ⟨power, hpower⟩ : ∃ power : BoundedRationalProgram, ∀ q b I, concreteEngine.powBox q b I = let v := power.eval [q, b, I.lo, I.hi]; rationalBox v.1 v.2 := by exact ⟨powerEndpointProgram, concreteEngine_power_register_certificate⟩ exact concreteEngine_registers_of_other_primitives piRegisterProgram expRegisterProgram cosRegisterProgram logRegisterProgram power concreteEngine_pi_register_certificate concreteEngine_exp_register_certificate concreteEngine_cos_register_certificate concreteEngine_log_register_certificate hpower · exact paperPi_contract · exact concreteEngine_exp_contract · exact concreteEngine_log_contract · exact concreteEngine_power_contract · exact concreteEngine_cos_contract
CausalSmith.Stat.LogoddsLowsmoothFrontier.concreteEngine_admissible · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ConcreteArithmeticEngine.lean:117
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_ExactCalibrations 35 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

T ExactCalibrations

Paper-owned scaffold obligations; proofs are filled in Stage 3.

[The normalized branch has the prescribed value on the zero-effect axis. the stated conclusion holds.

Formal statement
ξ υ :
ℝ
normalizedBranch 0 ξ υ = ξ*(1-ξ)*υ*(1-υ)
Proof (Lean source)
-- @node: normalizedBranch_zero lemma normalizedBranch_zero (ξ υ : ℝ) : normalizedBranch 0 ξ υ = ξ*(1-ξ)*υ*(1-υ) := by norm_num [normalizedBranch, dividedExp]
CausalSmith.Stat.LogoddsLowsmoothFrontier.normalizedBranch_zero · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:34
theorem covarianceBranch_eq_mul_normalizedBranch Lemma covarianceBranch_eq_mul_normalizedBranch in the paper ↗

Multiplication by the effect removes the divided difference without excluding zero. the stated conclusion holds.

Formal statement
t ξ υ :
ℝ
covarianceBranch t ξ υ = t * normalizedBranch t ξ υ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_eq_mul_normalizedBranch · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:40
theorem normalizedBranch_eq_div Lemma normalizedBranch_eq_div in the paper ↗

Off zero the normalization is exactly division by the effect. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
t ξ υ :
ℝ
ht :
t ≠ 0
normalizedBranch t ξ υ = covarianceBranch t ξ υ / t
Proof (Lean source)
-- @node: normalizedBranch_eq_div lemma normalizedBranch_eq_div (t ξ υ : ℝ) (ht : t ≠ 0) : normalizedBranch t ξ υ = covarianceBranch t ξ υ / t := by rw [covarianceBranch_eq_mul_normalizedBranch] field_simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.normalizedBranch_eq_div · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:48

[The table retains its first margin for every covariance. the stated conclusion holds.

Formal statement
ξ υ c :
ℝ
(∑ y : Bool, tableCell ξ υ c true y) = ξ
Proof (Lean source)
-- @node: tableCell_first_margin lemma tableCell_first_margin (ξ υ c : ℝ) : (∑ y : Bool, tableCell ξ υ c true y) = ξ := by simp [tableCell] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.tableCell_first_margin · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:55
theorem tableCell_second_margin Lemma tableCell_second_margin in the paper ↗

The table retains its second margin for every covariance. the stated conclusion holds.

Formal statement
ξ υ c :
ℝ
(∑ a : Bool, tableCell ξ υ c a true) = υ
Proof (Lean source)
-- @node: tableCell_second_margin lemma tableCell_second_margin (ξ υ c : ℝ) : (∑ a : Bool, tableCell ξ υ c a true) = υ := by simp [tableCell] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.tableCell_second_margin · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:62

The four cells sum to one for every covariance. the stated conclusion holds.

Formal statement
ξ υ c :
ℝ
(∑ a : Bool, ∑ y : Bool, tableCell ξ υ c a y) = 1
Proof (Lean source)
-- @node: tableCell_total lemma tableCell_total (ξ υ c : ℝ) : (∑ a : Bool, ∑ y : Bool, tableCell ξ υ c a y) = 1 := by simp [tableCell] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.tableCell_total · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:69
theorem mixedEquation_covariance_matching Lemma mixedEquation_covariance_matching in the paper ↗

A root of the normalized mixed equation gives exact singleton covariance matching. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
η ζ u q :
ℝ
hq :
mixedEquation η ζ u q = 0
signAverage (fun s => covarianceBranch (32*η*ζ) (1/2-η*q*localSignField u s) (1/2+ζ*localSignField u s))
= 2*η*ζ*q
Proof (Lean source)
-- @node: mixedEquation_covariance_matching lemma mixedEquation_covariance_matching (η ζ u q : ℝ) (hq : mixedEquation η ζ u q = 0) : signAverage (fun s => covarianceBranch (32*η*ζ) (1/2-η*q*localSignField u s) (1/2+ζ*localSignField u s)) = 2*η*ζ*q := by simp only [covarianceBranch_eq_mul_normalizedBranch, signAverage, ← Finset.mul_sum] unfold mixedEquation signAverage at hq linear_combination (2*η*ζ) * hq
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_covariance_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:76

[The two independent fair signs have zero averaged field. the stated conclusion holds.

Formal statement
u :
ℝ
signAverage (localSignField u) = 0
Proof (Lean source)
-- @node: localSignField_mean lemma localSignField_mean (u : ℝ) : signAverage (localSignField u) = 0 := by simp [signAverage, Fintype.sum_prod_type, localSignField, signValue] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.localSignField_mean · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:87
theorem localSignField_second_moment Lemma localSignField_second_moment in the paper ↗

The cosine-sine sign interpolation has unit second moment. the stated conclusion holds.

Formal statement
u :
ℝ
signAverage (fun s => localSignField u s ^ 2) = 1
Proof (Lean source)
-- @node: localSignField_second_moment lemma localSignField_second_moment (u : ℝ) : signAverage (fun s => localSignField u s ^ 2) = 1 := by simp [signAverage, Fintype.sum_prod_type, localSignField, signValue] nlinarith [Real.sin_sq_add_cos_sq (pi*u/2)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.localSignField_second_moment · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:93
theorem mixedEquation_zero_left Lemma mixedEquation_zero_left in the paper ↗

On the zero-propensity-amplitude axis, the equation is affine in the root. the stated conclusion holds.

Formal statement
ζ u q :
ℝ
mixedEquation 0 ζ u q = 1-4*ζ^2-q
Proof (Lean source)
-- @node: mixedEquation_zero_left lemma mixedEquation_zero_left (ζ u q : ℝ) : mixedEquation 0 ζ u q = 1-4*ζ^2-q := by unfold mixedEquation simp only [mul_zero, zero_mul, sub_zero, normalizedBranch_zero] unfold signAverage simp [Fintype.sum_prod_type, localSignField, signValue] nlinarith [Real.sin_sq_add_cos_sq (pi*u/2)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_zero_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:100

The prescribed local selector has the exact zero-axis value for small signed amplitudes. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
ζ u :
ℝ
hζ :
|ζ| ≤ 1 / 8
mixedRoot 0 ζ u = 1-4*ζ^2
Proof (Lean source)
-- @node: mixedRoot_zero_left lemma mixedRoot_zero_left (ζ u : ℝ) (hζ : |ζ| ≤ 1 / 8) : mixedRoot 0 ζ u = 1-4*ζ^2 := by have hsq : ζ^2 ≤ (1/8 : ℝ)^2 := by nlinarith [sq_abs ζ, abs_nonneg ζ] have hex : ∃ q : ℝ, q ∈ Ioo (3 / 4) (5 / 4) ∧ mixedEquation 0 ζ u q = 0 := by refine ⟨1-4*ζ^2, ⟨?_, ?_⟩, ?_⟩ · nlinarith [sq_nonneg ζ] · nlinarith [sq_nonneg ζ] · rw [mixedEquation_zero_left] ring unfold mixedRoot rw [dif_pos hex] have hroot := (Classical.choose_spec hex).2 rw [mixedEquation_zero_left] at hroot linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_zero_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:110
theorem mixedEquation_endpoints Lemma mixedEquation_endpoints in the paper ↗

[At either cell endpoint the finite sign average gives the same root equation. the stated conclusion holds.

Formal statement
η ζ q :
ℝ
mixedEquation η ζ 0 q = mixedEquation η ζ 1 q
Proof (Lean source)
-- @node: mixedEquation_endpoints lemma mixedEquation_endpoints (η ζ q : ℝ) : mixedEquation η ζ 0 q = mixedEquation η ζ 1 q := by simp [mixedEquation, signAverage, Fintype.sum_prod_type, localSignField, signValue, Real.cos_pi_div_two, Real.sin_pi_div_two] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:128

The literal selectors agree at cell endpoints because their equations agree. the stated conclusion holds.

Formal statement
η ζ :
ℝ
mixedRoot η ζ 0 = mixedRoot η ζ 1
Proof (Lean source)
-- @node: mixedRoot_endpoints lemma mixedRoot_endpoints (η ζ : ℝ) : mixedRoot η ζ 0 = mixedRoot η ζ 1 := by have he : mixedEquation η ζ 0 = mixedEquation η ζ 1 := funext (mixedEquation_endpoints η ζ) unfold mixedRoot rw [he]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:136

An existing bracket root makes the totalized selector a genuine bracket root. the stated conclusion holds. Under the stated assumptions.

Formal statement
η ζ u :
ℝ
h :
∃ q : ℝ, q ∈ Ioo (3 / 4) (5 / 4) ∧ mixedEquation η ζ u q = 0
conclusion 1
mixedRoot η ζ u ∈ Ioo (3 / 4) (5 / 4)
conclusion 2
mixedEquation η ζ u (mixedRoot η ζ u) = 0
Proof (Lean source)
-- @node: mixedRoot_spec lemma mixedRoot_spec (η ζ u : ℝ) (h : ∃ q : ℝ, q ∈ Ioo (3 / 4) (5 / 4) ∧ mixedEquation η ζ u q = 0) : mixedRoot η ζ u ∈ Ioo (3 / 4) (5 / 4) ∧ mixedEquation η ζ u (mixedRoot η ζ u) = 0 := by unfold mixedRoot rw [dif_pos h] exact Classical.choose_spec h
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_spec · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:144
theorem mixedEquation_zero_right Lemma mixedEquation_zero_right in the paper ↗

On the other zero-amplitude axis the mixed equation reduces to the stated quadratic. the stated conclusion holds.

Formal statement
η u q :
ℝ
mixedEquation η 0 u q = 1-4*η^2*q^2-q
Proof (Lean source)
-- @node: mixedEquation_zero_right lemma mixedEquation_zero_right (η u q : ℝ) : mixedEquation η 0 u q = 1-4*η^2*q^2-q := by unfold mixedEquation simp only [mul_zero, zero_mul, add_zero, normalizedBranch_zero] unfold signAverage simp [Fintype.sum_prod_type, localSignField, signValue] linear_combination (-4*η^2*q^2) * Real.sin_sq_add_cos_sq (pi*u/2)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_zero_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:154
theorem mixedEquation_zero_right_exists Lemma mixedEquation_zero_right_exists in the paper ↗

The zero-prognosis-amplitude quadratic has a bracket root by the intermediate value theorem. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
η u :
ℝ
hη :
|η| ≤ 1 / 8
∃ q : ℝ,
conclusion 1
q ∈ Ioo (3 / 4) (5 / 4)
conclusion 2
mixedEquation η 0 u q = 0
Proof (Lean source)
-- @node: mixedEquation_zero_right_exists lemma mixedEquation_zero_right_exists (η u : ℝ) (hη : |η| ≤ 1 / 8) : ∃ q : ℝ, q ∈ Ioo (3 / 4) (5 / 4) ∧ mixedEquation η 0 u q = 0 := by have hsq : η^2 ≤ (1/8 : ℝ)^2 := by nlinarith [sq_abs η, abs_nonneg η] have hcont : ContinuousOn (fun q : ℝ => 1-4*η^2*q^2-q) (Icc (7/8) 1) := by fun_prop obtain ⟨q, hq, heq⟩ := intermediate_value_Icc' (by norm_num : (7/8 : ℝ) ≤ 1) hcont (show (0 : ℝ) ∈ Icc (1-4*η^2*1^2-1) (1-4*η^2*(7/8)^2-7/8) by constructor <;> nlinarith [sq_nonneg η]) refine ⟨q, ⟨?_, ?_⟩, ?_⟩ · linarith [hq.1] · linarith [hq.2] · rw [mixedEquation_zero_right] exact heq
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_zero_right_exists · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:164

The actual selected root satisfies the zero-axis quadratic, including signed amplitudes. Under the stated assumptions.

Formal statement
η u :
ℝ
hη :
|η| ≤ 1 / 8
mixedRoot η 0 u+4*η^2*(mixedRoot η 0 u)^2 = 1
Proof (Lean source)
-- @node: mixedRoot_zero_right lemma mixedRoot_zero_right (η u : ℝ) (hη : |η| ≤ 1 / 8) : mixedRoot η 0 u+4*η^2*(mixedRoot η 0 u)^2 = 1 := by have heq := (mixedRoot_spec η 0 u (mixedEquation_zero_right_exists η u hη)).2 rw [mixedEquation_zero_right] at heq linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_zero_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:181
theorem calibration_exp_increment_bound Lemma calibration_exp_increment_bound in the paper ↗

Small effects have a uniformly small exponential increment. Under the stated assumptions.

Formal statement
t :
ℝ
ht :
|t| ≤ 1 / 8
|exp t - 1| ≤ 1 / 4
Proof (Lean source)
-- @node: calibration_exp_increment_bound lemma calibration_exp_increment_bound (t : ℝ) (ht : |t| ≤ 1 / 8) : |exp t - 1| ≤ 1 / 4 := by have h := Real.abs_exp_sub_one_le (show |t| ≤ 1 by linarith) linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_exp_increment_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:189
theorem covarianceBranch_local_bounds Lemma covarianceBranch_local_bounds in the paper ↗

The rationalized branch has a positive denominator and small covariance. Under the stated assumptions.

Formal statement
t ξ υ :
ℝ
ht :
|t| ≤ 1 / 8
hξ :
|ξ - 1 / 2| ≤ 1 / 8
hυ :
|υ - 1 / 2| ≤ 1 / 8
d :
exp t - 1
v :
ξ * (1 - ξ) * υ * (1 - υ)
L :
1 + d * (ξ * (1 - υ) + (1 - ξ) * υ)
3 / 4 ≤ L
0 ≤ L ^ 2 - 4 * d ^ 2 * v
|covarianceBranch t ξ υ| ≤ 1 / 24
Proof (Lean source)
-- @node: covarianceBranch_local_bounds lemma covarianceBranch_local_bounds (t ξ υ : ℝ) (ht : |t| ≤ 1 / 8) (hξ : |ξ - 1 / 2| ≤ 1 / 8) (hυ : |υ - 1 / 2| ≤ 1 / 8) : let d := exp t - 1 let v := ξ * (1 - ξ) * υ * (1 - υ) let L := 1 + d * (ξ * (1 - υ) + (1 - ξ) * υ) 3 / 4 ≤ L ∧ 0 ≤ L ^ 2 - 4 * d ^ 2 * v ∧ |covarianceBranch t ξ υ| ≤ 1 / 24 := by dsimp only obtain ⟨hdlo, hdhi⟩ := abs_le.mp (calibration_exp_increment_bound t ht) obtain ⟨hξlo, hξhi⟩ := abs_le.mp hξ obtain ⟨hυlo, hυhi⟩ := abs_le.mp hυ let d := exp t - 1 let v := ξ * (1 - ξ) * υ * (1 - υ) let L := 1 + d * (ξ * (1 - υ) + (1 - ξ) * υ) have hx : 0 ≤ ξ * (1 - ξ) := mul_nonneg (by linarith) (by linarith) have hy : 0 ≤ υ * (1 - υ) := mul_nonneg (by linarith) (by linarith) have hxhi : ξ * (1 - ξ) ≤ 1 / 4 := by nlinarith [sq_nonneg (ξ - 1 / 2)] have hyhi : υ * (1 - υ) ≤ 1 / 4 := by nlinarith [sq_nonneg (υ - 1 / 2)] have hv : 0 ≤ v := by dsimp [v]; exact mul_nonneg (mul_nonneg hx (by linarith)) (by linarith) have hvhi : v ≤ 1 / 16 := by dsimp [v] nlinarith [mul_nonneg (sub_nonneg.mpr hxhi) hy] have hs : 0 ≤ ξ * (1 - υ) + (1 - ξ) * υ := by exact add_nonneg (mul_nonneg (by linarith) (by linarith)) (mul_nonneg (by linarith) (by linarith)) have hshi : ξ * (1 - υ) + (1 - ξ) * υ ≤ 1 := by nlinarith [mul_nonneg (show 0 ≤ ξ by linarith) (show 0 ≤ υ by linarith), mul_nonneg (show 0 ≤ 1 - ξ by linarith) (show 0 ≤ 1 - υ by linarith)] have hL : 3 / 4 ≤ L := by dsimp [L, d] nlinarith [mul_nonneg (show 0 ≤ exp t - 1 + 1 / 4 by linarith) hs] have hd2 : d ^ 2 ≤ 1 / 16 := by dsimp [d]; nlinarith have hrad : 0 ≤ L ^ 2 - 4 * d ^ 2 * v := by nlinarith [mul_nonneg (sub_nonneg.mpr hd2) hv, sq_nonneg (L - 3 / 4)] have hden : 3 / 4 ≤ L + sqrt (L ^ 2 - 4 * d ^ 2 * v) := le_trans hL (le_add_of_nonneg_right (Real.sqrt_nonneg _)) have hc : |covarianceBranch t ξ υ| * (L + sqrt (L ^ 2 - 4 * d ^ 2 * v)) = 2 * |d| * v := by unfold covarianceBranch change |2 * d * v / (L + sqrt (L ^ 2 - 4 * d ^ 2 * v))| * _ = _ rw [abs_div, abs_mul, abs_mul, abs_of_nonneg (by norm_num : (0:ℝ) ≤ 2), abs_of_nonneg hv, abs_of_pos (by linarith : 0 < L + sqrt (L ^ 2 - 4 * d ^ 2 * v))] exact div_mul_cancel₀ _ (by linarith) refine ⟨hL, hrad, ?_⟩ have hdabs : |d| ≤ 1 / 4 := calibration_exp_increment_bound t ht nlinarith [mul_nonneg (sub_nonneg.mpr hdabs) hv, mul_nonneg (abs_nonneg (covarianceBranch t ξ υ)) (sub_nonneg.mpr hden)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_local_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:196
theorem calibration_product_lower Lemma calibration_product_lower in the paper ↗

Every centered product is separated from zero on the chosen margin neighbourhood. Under the stated assumptions.

Formal statement
x y :
ℝ
hx :
3 / 8 ≤ x
hy :
3 / 8 ≤ y
(9 / 64 : ℝ) ≤ x * y
Proof (Lean source)
-- @node: calibration_product_lower lemma calibration_product_lower (x y : ℝ) (hx : 3 / 8 ≤ x) (hy : 3 / 8 ≤ y) : (9 / 64 : ℝ) ≤ x * y := by nlinarith [mul_nonneg (sub_nonneg.mpr hx) (sub_nonneg.mpr hy)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_product_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:244
theorem covarianceBranch_table_positive Lemma covarianceBranch_table_positive in the paper ↗

All four actual cells are positive throughout a fixed absolute neighbourhood. Under the stated assumptions.

Formal statement
t ξ υ :
ℝ
ht :
|t| ≤ 1 / 8
hξ :
|ξ - 1 / 2| ≤ 1 / 8
hυ :
|υ - 1 / 2| ≤ 1 / 8
a y :
0 < tableCell ξ υ (covarianceBranch t ξ υ) a y
Proof (Lean source)
-- @node: covarianceBranch_table_positive lemma covarianceBranch_table_positive (t ξ υ : ℝ) (ht : |t| ≤ 1 / 8) (hξ : |ξ - 1 / 2| ≤ 1 / 8) (hυ : |υ - 1 / 2| ≤ 1 / 8) : ∀ a y, 0 < tableCell ξ υ (covarianceBranch t ξ υ) a y := by have hc := (covarianceBranch_local_bounds t ξ υ ht hξ hυ).2.2 obtain ⟨hclo, hchi⟩ := abs_le.mp hc obtain ⟨hxlo, hxhi⟩ := abs_le.mp hξ obtain ⟨hylo, hyhi⟩ := abs_le.mp hυ have h1 := calibration_product_lower ξ υ (by linarith) (by linarith) have h2 := calibration_product_lower ξ (1 - υ) (by linarith) (by linarith) have h3 := calibration_product_lower (1 - ξ) υ (by linarith) (by linarith) have h4 := calibration_product_lower (1 - ξ) (1 - υ) (by linarith) (by linarith) intro a y cases a <;> cases y <;> simp only [tableCell, Bool.false_eq_true, ↓reduceIte] <;> linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_table_positive · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:250
theorem calibration_rationalized_quadratic Lemma calibration_rationalized_quadratic in the paper ↗

Rationalizing the small quadratic root preserves its defining polynomial at zero. Under the stated assumptions. Under the stated assumptions.

Formal statement
d v L :
ℝ
hrad :
0 ≤ L ^ 2 - 4 * d ^ 2 * v
hden :
L + sqrt (L ^ 2 - 4 * d ^ 2 * v) ≠ 0
d * (2 * d * v / (L + sqrt (L ^ 2 - 4 * d ^ 2 * v))) ^ 2
- L * (2 * d * v / (L + sqrt (L ^ 2 - 4 * d ^ 2 * v)))
+ d * v
= 0
Proof (Lean source)
-- @node: calibration_rationalized_quadratic lemma calibration_rationalized_quadratic (d v L : ℝ) (hrad : 0 ≤ L ^ 2 - 4 * d ^ 2 * v) (hden : L + sqrt (L ^ 2 - 4 * d ^ 2 * v) ≠ 0) : d * (2 * d * v / (L + sqrt (L ^ 2 - 4 * d ^ 2 * v))) ^ 2 - L * (2 * d * v / (L + sqrt (L ^ 2 - 4 * d ^ 2 * v))) + d * v = 0 := by have hs := Real.sq_sqrt hrad generalize sqrt (L ^ 2 - 4 * d ^ 2 * v) = s at * field_simp [hden] linear_combination (d * v) * hs
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_rationalized_quadratic · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:266
theorem covarianceBranch_quadratic Lemma covarianceBranch_quadratic in the paper ↗

The covariance branch solves the odds-ratio quadratic on the absolute neighbourhood. Under the stated assumptions.

Formal statement
t ξ υ :
ℝ
ht :
|t| ≤ 1 / 8
hξ :
|ξ - 1 / 2| ≤ 1 / 8
hυ :
|υ - 1 / 2| ≤ 1 / 8
d :
exp t - 1
c :
d * c ^ 2 - (1 + d * (ξ * (1 - υ) + (1 - ξ) * υ)) * c + d * (ξ * (1 - ξ) * υ * (1 - υ))
= 0
Proof (Lean source)
-- @node: covarianceBranch_quadratic lemma covarianceBranch_quadratic (t ξ υ : ℝ) (ht : |t| ≤ 1 / 8) (hξ : |ξ - 1 / 2| ≤ 1 / 8) (hυ : |υ - 1 / 2| ≤ 1 / 8) : let d := exp t - 1 let c := covarianceBranch t ξ υ d * c ^ 2 - (1 + d * (ξ * (1 - υ) + (1 - ξ) * υ)) * c + d * (ξ * (1 - ξ) * υ * (1 - υ)) = 0 := by have hb := covarianceBranch_local_bounds t ξ υ ht hξ hυ unfold covarianceBranch dsimp only apply calibration_rationalized_quadratic _ _ _ hb.2.1 have hs := Real.sqrt_nonneg ((1 + (exp t - 1) * (ξ * (1 - υ) + (1 - ξ) * υ)) ^ 2 - 4 * (exp t - 1) ^ 2 * (ξ * (1 - ξ) * υ * (1 - υ))) linarith [hb.1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_quadratic · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:277
theorem covarianceBranch_odds_ratio Lemma covarianceBranch_odds_ratio in the paper ↗

The determinant identity turns the solved quadratic into the exact odds ratio. Under the stated assumptions.

Formal statement
t ξ υ :
ℝ
ht :
|t| ≤ 1 / 8
hξ :
|ξ - 1 / 2| ≤ 1 / 8
hυ :
|υ - 1 / 2| ≤ 1 / 8
c :
tableCell ξ υ c true true * tableCell ξ υ c false false / (tableCell ξ υ c true false * tableCell ξ υ c false true)
= exp t
Proof (Lean source)
-- @node: covarianceBranch_odds_ratio lemma covarianceBranch_odds_ratio (t ξ υ : ℝ) (ht : |t| ≤ 1 / 8) (hξ : |ξ - 1 / 2| ≤ 1 / 8) (hυ : |υ - 1 / 2| ≤ 1 / 8) : let c := covarianceBranch t ξ υ tableCell ξ υ c true true * tableCell ξ υ c false false / (tableCell ξ υ c true false * tableCell ξ υ c false true) = exp t := by dsimp only have hp := covarianceBranch_table_positive t ξ υ ht hξ hυ apply (div_eq_iff (ne_of_gt (mul_pos (hp true false) (hp false true)))).mpr have hq := covarianceBranch_quadratic t ξ υ ht hξ hυ dsimp only at hq simp only [tableCell, Bool.false_eq_true, ↓reduceIte] linear_combination - hq
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceBranch_odds_ratio · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:293

[Reversing the effect scales its smooth exponential divided difference. the stated conclusion holds.

Formal statement
t :
ℝ
Proof (Lean source)
-- @node: dividedExp_neg lemma dividedExp_neg (t : ℝ) : dividedExp (-t) = dividedExp t / exp t := by by_cases ht : t = 0 · subst t simp have hpos := Real.exp_pos t have hp := dividedExp_mul t have hn := dividedExp_mul (-t) rw [Real.exp_neg] at hn field_simp at hn ⊢ apply mul_left_cancel₀ ht linear_combination -hn -hp
CausalSmith.Stat.LogoddsLowsmoothFrontier.dividedExp_neg · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:308
theorem calibration_normalized_scale Lemma calibration_normalized_scale in the paper ↗

Scaling the quadratic coefficients by a positive factor preserves the normalized branch. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
D d v L E :
ℝ
hE :
0 < E
2*(D/E)*v/(L/E+sqrt ((L/E)^2-4*(-d/E)^2*v)) = 2*D*v/(L+sqrt (L^2-4*d^2*v))
Proof (Lean source)
-- @node: calibration_normalized_scale lemma calibration_normalized_scale (D d v L E : ℝ) (hE : 0 < E) : 2*(D/E)*v/(L/E+sqrt ((L/E)^2-4*(-d/E)^2*v)) = 2*D*v/(L+sqrt (L^2-4*d^2*v)) := by have hrad : (L/E)^2-4*(-d/E)^2*v = (L^2-4*d^2*v)/E^2 := by ring rw [hrad, Real.sqrt_div' _ (sq_nonneg E), Real.sqrt_sq hE.le, ← add_div] by_cases hden : L+sqrt (L^2-4*d^2*v) = 0 · simp [hden] · field_simp
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_normalized_scale · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:322
theorem normalizedBranch_complement_left Lemma normalizedBranch_complement_left in the paper ↗

Complementing the first binary margin reverses the effect in the normalized branch. the stated conclusion holds.

Formal statement
t ξ υ :
ℝ
normalizedBranch (-t) (1-ξ) υ = normalizedBranch t ξ υ
Proof (Lean source)
-- @node: normalizedBranch_complement_left lemma normalizedBranch_complement_left (t ξ υ : ℝ) : normalizedBranch (-t) (1-ξ) υ = normalizedBranch t ξ υ := by have hE := Real.exp_pos t have hv : (1-ξ)*(1-(1-ξ))*υ*(1-υ) = ξ*(1-ξ)*υ*(1-υ) := by ring have hL : 1+(exp (-t)-1)*((1-ξ)*(1-υ)+(1-(1-ξ))*υ) = (1+(exp t-1)*(ξ*(1-υ)+(1-ξ)*υ))/exp t := by rw [Real.exp_neg] field_simp ring have hd : exp (-t)-1 = -(exp t-1)/exp t := by rw [Real.exp_neg] field_simp ring unfold normalizedBranch dsimp only rw [hv, hL, hd, dividedExp_neg] exact calibration_normalized_scale _ _ _ _ _ hE
CausalSmith.Stat.LogoddsLowsmoothFrontier.normalizedBranch_complement_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:333

Exchanging the two margins preserves the normalized covariance branch. the stated conclusion holds.

Formal statement
t ξ υ :
ℝ
Proof (Lean source)
-- @node: normalizedBranch_swap lemma normalizedBranch_swap (t ξ υ : ℝ) : normalizedBranch t ξ υ = normalizedBranch t υ ξ := by unfold normalizedBranch have hv : ξ*(1-ξ)*υ*(1-υ) = υ*(1-υ)*ξ*(1-ξ) := by ring have hL : ξ*(1-υ)+(1-ξ)*υ = υ*(1-ξ)+(1-υ)*ξ := by ring dsimp only rw [hv, hL]
CausalSmith.Stat.LogoddsLowsmoothFrontier.normalizedBranch_swap · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:353
theorem normalizedBranch_complement_right Lemma normalizedBranch_complement_right in the paper ↗

Complementing the second binary margin also reverses the effect. the stated conclusion holds.

Formal statement
t ξ υ :
ℝ
normalizedBranch (-t) ξ (1-υ) = normalizedBranch t ξ υ
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.normalizedBranch_complement_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:363
theorem mixedEquation_even_left Lemma mixedEquation_even_left in the paper ↗

The mixed root equation is even in its propensity amplitude. the stated conclusion holds.

Formal statement
η ζ u q :
ℝ
mixedEquation (-η) ζ u q = mixedEquation η ζ u q
Proof (Lean source)
-- @node: mixedEquation_even_left lemma mixedEquation_even_left (η ζ u q : ℝ) : mixedEquation (-η) ζ u q = mixedEquation η ζ u q := by unfold mixedEquation congr 2 apply congrArg signAverage funext s have ht : 32*(-η)*ζ = -(32*η*ζ) := by ring have hx : 1/2-(-η)*q*localSignField u s = 1-(1/2-η*q*localSignField u s) := by ring rw [ht, hx, normalizedBranch_complement_left]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_even_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:369
theorem mixedEquation_even_right Lemma mixedEquation_even_right in the paper ↗

The mixed root equation is even in its prognosis amplitude. the stated conclusion holds.

Formal statement
η ζ u q :
ℝ
mixedEquation η (-ζ) u q = mixedEquation η ζ u q
Proof (Lean source)
-- @node: mixedEquation_even_right lemma mixedEquation_even_right (η ζ u q : ℝ) : mixedEquation η (-ζ) u q = mixedEquation η ζ u q := by unfold mixedEquation congr 2 apply congrArg signAverage funext s have ht : 32*η*(-ζ) = -(32*η*ζ) := by ring have hy : 1/2+(-ζ)*localSignField u s = 1-(1/2+ζ*localSignField u s) := by ring rw [ht, hy, normalizedBranch_complement_right]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedEquation_even_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:381

Identical equations give identical literal mixed-root selectors. the stated conclusion holds.

Formal statement
η ζ u :
ℝ
mixedRoot (-η) ζ u = mixedRoot η ζ u
Proof (Lean source)
-- @node: mixedRoot_even_left lemma mixedRoot_even_left (η ζ u : ℝ) : mixedRoot (-η) ζ u = mixedRoot η ζ u := by have he : mixedEquation (-η) ζ u = mixedEquation η ζ u := funext (mixedEquation_even_left η ζ u) unfold mixedRoot rw [he]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_even_left · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:393

The literal mixed-root selector is even in the prognosis amplitude. the stated conclusion holds.

Formal statement
η ζ u :
ℝ
mixedRoot η (-ζ) u = mixedRoot η ζ u
Proof (Lean source)
-- @node: mixedRoot_even_right lemma mixedRoot_even_right (η ζ u : ℝ) : mixedRoot η (-ζ) u = mixedRoot η ζ u := by have he : mixedEquation η (-ζ) u = mixedEquation η ζ u := funext (mixedEquation_even_right η ζ u) unfold mixedRoot rw [he]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixedRoot_even_right · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:401
theorem calibration_branch_neighbourhood_exists Lemma calibration_branch_neighbourhood_exists in the paper ↗

Existing uniform uniqueness, confinement, and pointwise smoothness supply one common signed branch certificate with explicit ambient open neighborhoods, including the fair equation's removable extension on the full centered bracket. the documented result

Formal statement
∃ ε : ℝ,
conclusion 1
0 < ε
Proof (Lean source)
-- @node: calibration_branch_neighbourhood_exists lemma calibration_branch_neighbourhood_exists : ∃ ε : ℝ, 0 < ε ∧ CalibrationBranchNeighbourhood ε := by obtain ⟨Rmix, U, hRmix, hU, hmU, hmZero, hmSmooth, hmCells⟩ := mixed_calibration_open_neighbourhood obtain ⟨Rfair₀, V, hRfair₀, hV, hfV₀, hfZero, hfSmooth, hfCells⟩ := fair_calibration_open_neighbourhood let Rfair := min Rfair₀ (1/100) have hRfair : 0 < Rfair := lt_min hRfair₀ (by norm_num) have hFairSmall : Rfair ≤ 1/100 := min_le_right _ _ have hfV : fairParameterRegion Rfair ⊆ V := by intro v hv exact hfV₀ ⟨hv.1, hv.2.1.trans (min_le_left _ _), hv.2.2⟩ let W : Set (Fin 4 → ℝ) := interior {w | ContDiffAt ℝ ∞ (fun z : Fin 4 → ℝ => fairEquation (z 0) (z 1) (z 2) (z 3)) w} have hWCore : {w : Fin 4 → ℝ | w 0 ∈ Icc (0 : ℝ) (1/4) ∧ |w 1| ≤ Rfair ∧ w 2 ∈ Ioo ((2/5 : ℝ)-1/20) (2/5+1/20) ∧ w 3 ∈ Icc (0 : ℝ) 1} ⊆ W := by intro w hw have hTaylor : w ∈ fairTaylorParameterRegion := (fairTaylorParameterRegion_mem w).mpr ⟨hw.1, hw.2.1.trans hFairSmall, ⟨by linarith [hw.2.2.1.1], by linarith [hw.2.2.1.2]⟩, hw.2.2.2⟩ -- Compactness of both Taylor integration coordinates gives one neighborhood -- on which every finite smoothness order holds simultaneously. exact mem_interior_iff_mem_nhds.mpr (fairEquation_eventually_contDiffAt w hTaylor) have hWSmooth : ContDiffOn ℝ ∞ (fun w : Fin 4 → ℝ => fairEquation (w 0) (w 1) (w 2) (w 3)) W := by intro w hw have hAt : ContDiffAt ℝ ∞ (fun z : Fin 4 → ℝ => fairEquation (z 0) (z 1) (z 2) (z 3)) w := interior_subset hw exact hAt.contDiffWithinAt have hDiv : ∀ t δ ξ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ Rfair → ξ ∈ Ioo ((2/5 : ℝ)-1/20) (2/5+1/20) → u ∈ Icc (0 : ℝ) 1 → t*δ ≠ 0 → fairEquation t δ ξ u = fairNumerator t δ ξ u/(t*δ^2) := by intro t δ ξ u ht hδ hξ _hu hne exact fairEquation_eq_div t δ ξ u ht (hδ.trans hFairSmall) ⟨by linarith [hξ.1], by linarith [hξ.2]⟩ hne let ε := min Rmix Rfair / 2 have hε : 0 < ε := by dsimp [ε]; positivity have hεmix : ε < Rmix := by have h := min_le_left Rmix Rfair dsimp [ε] linarith have hεfair : ε < Rfair := by have h := min_le_right Rmix Rfair dsimp [ε] linarith exact ⟨ε, hε, Rmix, Rfair, 1/20, U, V, hRmix, hεmix, hRfair, hεfair, by norm_num, by norm_num, hU, hV, hmU, hfV, hmZero, hfZero, hmSmooth, hfSmooth, hmCells, hfCells, W, isOpen_interior, hWCore, hWSmooth, hDiv⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.calibration_branch_neighbourhood_exists · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:409
theorem exact_calibrations Lemma 6 in the paper ↗

Exact signed singleton matching, unique selected branches on fixed brackets, open smooth neighborhoods, smooth zero-axis extensions, and the effect separation. the documented result

Formal statement
∃ ε M : ℝ,
0 < ε
0 < M
conclusion 2
t ξ υ :
ℝ
|t| ≤ ε
|ξ-1/2| ≤ ε
|υ-1/2| ≤ ε
c :
a y :
0 < tableCell ξ υ c a y
(∑ y : Bool, tableCell ξ υ c true y) = ξ
(∑ a : Bool, tableCell ξ υ c a true) = υ
(∑ a : Bool, ∑ y : Bool, tableCell ξ υ c a y) = 1
= exp t
t ≠ 0
normalizedBranch t ξ υ = c/t
normalizedBranch 0 ξ υ = ξ*(1-ξ)*υ*(1-υ)
conclusion 3
η ζ u :
ℝ
|η| ≤ ε
|ζ| ≤ ε
u ∈ Icc (0 : ℝ) 1
q :
mixedRoot η ζ u
3/4 < q
q < 5/4
mixedEquation η ζ u q = 0
mixedRoot η ζ 0 = mixedRoot η ζ 1
signAverage (fun s => covarianceBranch (32*η*ζ) (1/2-η*q*localSignField u s) (1/2+ζ*localSignField u s))
= 2*η*ζ*q
mixedRoot (-η) ζ u = q
mixedRoot η (-ζ) u = q
mixedRoot 0 ζ u = 1-4*ζ^2
mixedRoot η 0 u+4*η^2*(mixedRoot η 0 u)^2 = 1
conclusion 4
t δ u :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
|δ| ≤ ε
u ∈ Icc (0 : ℝ) 1
p :
fairRoot t δ u
fairRoot t δ 0 = 2/5
fairRoot t δ 1 = 2/5
fairRoot t 0 u = 2/5
fairRoot 0 δ u = 2/5
fairRoot t (-δ) u = p
fairEquation t δ p u = 0
t*δ ≠ 0
fairEquation t δ p u = fairNumerator t δ p u/(t*δ^2)
signAverage (fun s => riskShift t (p+δ*localSignField u s))
|p-2/5|+|deriv (fairRoot t δ) u| ≤ M*δ^2
3*t*δ^2 ≤ t-comparatorEffect t δ
t-comparatorEffect t δ ≤ 6*t*δ^2
t/2 ≤ comparatorEffect t δ
comparatorEffect t δ ≤ t
Proof (Lean source)
lemma exact_calibrations : ∃ ε M : ℝ, 0 < ε ∧ 0 < M ∧ CalibrationSmooth ε ∧ (CalibrationDerivativeBounds ε ∧ CalibrationBranchNeighbourhood ε) ∧ (∀ t ξ υ : ℝ, |t| ≤ ε → |ξ-1/2| ≤ ε → |υ-1/2| ≤ ε → let c := covarianceBranch t ξ υ (∀ a y, 0 < tableCell ξ υ c a y) ∧ (∑ y : Bool, tableCell ξ υ c true y) = ξ ∧ (∑ a : Bool, tableCell ξ υ c a true) = υ ∧ (∑ a : Bool, ∑ y : Bool, tableCell ξ υ c a y) = 1 ∧ tableCell ξ υ c true true*tableCell ξ υ c false false / (tableCell ξ υ c true false*tableCell ξ υ c false true) = exp t ∧ (t ≠ 0 → normalizedBranch t ξ υ = c/t) ∧ normalizedBranch 0 ξ υ = ξ*(1-ξ)*υ*(1-υ)) ∧ (∀ η ζ u : ℝ, |η| ≤ ε → |ζ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → let q := mixedRoot η ζ u 3/4 < q ∧ q < 5/4 ∧ mixedEquation η ζ u q = 0 ∧ mixedRoot η ζ 0 = mixedRoot η ζ 1 ∧ signAverage (fun s => covarianceBranch (32*η*ζ) (1/2-η*q*localSignField u s) (1/2+ζ*localSignField u s)) = 2*η*ζ*q ∧ mixedRoot (-η) ζ u = q ∧ mixedRoot η (-ζ) u = q ∧ mixedRoot 0 ζ u = 1-4*ζ^2 ∧ mixedRoot η 0 u+4*η^2*(mixedRoot η 0 u)^2 = 1) ∧ (∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε → u ∈ Icc (0 : ℝ) 1 → let p := fairRoot t δ u fairRoot t δ 0 = 2/5 ∧ fairRoot t δ 1 = 2/5 ∧ fairRoot t 0 u = 2/5 ∧ fairRoot 0 δ u = 2/5 ∧ fairRoot t (-δ) u = p ∧ fairEquation t δ p u = 0 ∧ (t*δ ≠ 0 → fairEquation t δ p u = fairNumerator t δ p u/(t*δ^2)) ∧ signAverage (fun s => riskShift t (p+δ*localSignField u s)) = riskShift (comparatorEffect t δ) p ∧ |p-2/5|+|deriv (fairRoot t δ) u| ≤ M*δ^2 ∧ 3*t*δ^2 ≤ t-comparatorEffect t δ ∧ t-comparatorEffect t δ ≤ 6*t*δ^2 ∧ t/2 ≤ comparatorEffect t δ ∧ comparatorEffect t δ ≤ t) := by obtain ⟨εroot, hεroot, hroots⟩ := mixedEquation_uniform_existsUnique obtain ⟨εmix, hεmix, hMixAt, hMixBounds⟩ := mixedRoot_uniform_smooth_derivative_bounds obtain ⟨εcell, hεcell, hCellAt, hCellBounds⟩ := localMixedCell_uniform_smooth_derivative_bounds obtain ⟨εfair, hεfair, hfairSmall, hfairExists⟩ := fairEquation_uniform_exists obtain ⟨εpre, hεpre, hfairSmallPre, hεmixPre, hεcellPre, hFairAtPre⟩ : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1/100 ∧ ε ≤ εmix ∧ ε ≤ εcell ∧ ∀ v ∈ fairParameterRegion ε, ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v := by obtain ⟨εsmooth,hεsmooth,hsmallSmooth,hSmoothFair⟩ := fairRoot_uniform_contDiffAt let ε := min εsmooth (min εmix εcell) have heSmooth : ε ≤ εsmooth := min_le_left _ _ have heMix : ε ≤ εmix := (min_le_right _ _).trans (min_le_left _ _) have heCell : ε ≤ εcell := (min_le_right _ _).trans (min_le_right _ _) refine ⟨ε,lt_min hεsmooth (lt_min hεmix hεcell), heSmooth.trans hsmallSmooth,heMix,heCell,?_⟩ intro v hv exact hSmoothFair v ⟨hv.1,hv.2.1.trans heSmooth,hv.2.2⟩ let ε₀ := min εpre εfair have hε₀ : 0 < ε₀ := lt_min hεpre hεfair have hfairSmall₀ : ε₀ ≤ 1/100 := (min_le_left _ _).trans hfairSmallPre have hεmix₀ : ε₀ ≤ εmix := (min_le_left _ _).trans hεmixPre have hεcell₀ : ε₀ ≤ εcell := (min_le_left _ _).trans hεcellPre have hFairAt₀ : ∀ v ∈ fairParameterRegion ε₀, ContDiffAt ℝ ∞ (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v := by intro v hv exact hFairAtPre v ⟨hv.1,hv.2.1.trans (min_le_left _ _),hv.2.2⟩ have hFairRoots₀ : ∀ t δ u : ℝ, t ∈ Icc (0 : ℝ) (1/4) → |δ| ≤ ε₀ → u ∈ Icc (0 : ℝ) 1 → fairRoot t δ 0 = 2/5 ∧ fairRoot t 0 u = 2/5 ∧ fairRoot 0 δ u = 2/5 ∧ (∃ p ∈ Ioo (3/10 : ℝ) (1/2), fairEquation t δ p u = 0) := by intro t δ u ht hδ hu exact ⟨fairRoot_endpoint_center t δ 0 ht (hδ.trans hfairSmall₀) (inl rfl), fairRoot_zero_amplitude t u ht hu, fairRoot_zero_effect δ u (hδ.trans hfairSmall₀) hu, hfairExists t δ u ht (hδ.trans (min_le_right _ _)) hu⟩ obtain ⟨M, hM, hFairQuadratic⟩ := fairRoot_quadratic_bound_of_smooth ε₀ hε₀.le hFairAt₀ (fun t u ht hu => (hFairRoots₀ t 0 u ht (by simpa using hε₀.le) hu).2.1) have hsmall₀ : ε₀ ≤ 1/8 := hfairSmall₀.trans (by norm_num) have hFairSmooth₀ : ContDiffOn ℝ ∞ (fun v : Fin 3 → ℝ => fairRoot (v 0) (v 1) (v 2)) (fairParameterRegion ε₀) := fun v hv => (hFairAt₀ v hv).contDiffWithinAt obtain ⟨hFairCells₀, hFairBounds⟩ := localFairCell_smooth_derivative_bounds_of_root ε₀ hfairSmall₀ hFairAt₀ have hCellRegion : mixedParameterRegion ε₀ ⊆ mixedParameterRegion εcell := by rintro v ⟨hη, hζ, hu⟩ exact ⟨hη.trans hεcell₀, hζ.trans hεcell₀, hu⟩ have hMixCells₀ : ∀ b s a y, ContDiffOn ℝ ⊤ (localMixedCell b s a y) (mixedParameterRegion ε₀) := by intro b s a y v hv exact (hCellAt v (hCellRegion hv) b s a y).contDiffWithinAt have hRemainingBounds : ∀ m : ℕ, ∃ B : ℝ, 0 < B ∧ (∀ v ∈ mixedParameterRegion ε₀, ∀ b s a y, ‖iteratedFDeriv ℝ m (localMixedCell b s a y) v‖ ≤ B) ∧ (∀ v ∈ fairParameterRegion ε₀, ‖iteratedFDeriv ℝ m (fun w : Fin 3 → ℝ => fairRoot (w 0) (w 1) (w 2)) v‖ ≤ B ∧ ∀ b s a y, ‖iteratedFDeriv ℝ m (localFairCell b s a y) v‖ ≤ B) := by intro m obtain ⟨Bm, hBm, hm⟩ := hCellBounds m obtain ⟨Bf, hBf, hf⟩ := hFairBounds m refine ⟨max Bm Bf, lt_of_lt_of_le hBm (le_max_left _ _), ?_, ?_⟩ · intro v hv b s a y exact (hm v (hCellRegion hv) b s a y).trans (le_max_left _ _) · intro v hv exact ⟨(hf v hv).1.trans (le_max_right _ _), fun b s a y => ((hf v hv).2 b s a y).trans (le_max_right _ _)⟩ have hSmooth₀ : CalibrationSmooth ε₀ := by refine ⟨?_, hFairSmooth₀, fun b s a y => (hMixCells₀ b s a y).of_le le_top, fun b s a y => hFairCells₀ b s a y⟩ intro v hv exact (hMixAt v (hv.1.trans hεmix₀) (hv.2.1.trans hεmix₀) hv.2.2).of_le le_top |>.contDiffWithinAt have hDerivatives₀ : CalibrationDerivativeBounds ε₀ := by intro m obtain ⟨Bq, hBq, hq⟩ := hMixBounds m obtain ⟨Bc, hBc, hmc, hfc⟩ := hRemainingBounds m refine ⟨max Bq Bc, lt_of_lt_of_le hBq (le_max_left _ _), ?_, ?_⟩ · intro v hv refine ⟨(hq v (hv.1.trans hεmix₀) (hv.2.1.trans hεmix₀) hv.2.2).trans (le_max_left _ _), ?_⟩ intro b s a y exact (hmc v hv b s a y).trans (le_max_right _ _) · intro v hv exact ⟨(hfc v hv).1.trans (le_max_right _ _), fun b s a y => ((hfc v hv).2 b s a y).trans (le_max_right _ _)⟩ obtain ⟨εbranch, hεbranch, hBranchNeighbourhood⟩ := calibration_branch_neighbourhood_exists let ε := min ε₀ (min εroot (min (1/100) εbranch)) have hε : 0 < ε := lt_min hε₀ (lt_min hεroot (lt_min (by norm_num) hεbranch)) have hsmall : ε ≤ 1/8 := (min_le_left _ _).trans hsmall₀ have hMixed : mixedParameterRegion ε ⊆ mixedParameterRegion ε₀ := by rintro v ⟨hη, hζ, hu⟩ exact ⟨hη.trans (min_le_left _ _), hζ.trans (min_le_left _ _), hu⟩ have hFair : fairParameterRegion ε ⊆ fairParameterRegion ε₀ := by rintro v ⟨ht, hδ, hu⟩ exact ⟨ht, hδ.trans (min_le_left _ _), hu⟩ have hSmooth : CalibrationSmooth ε := ⟨hSmooth₀.1.mono hMixed, hSmooth₀.2.1.mono hFair, fun b s a y => (hSmooth₀.2.2.1 b s a y).mono hMixed, fun b s a y => (hSmooth₀.2.2.2 b s a y).mono hFair⟩ have hDerivatives : CalibrationDerivativeBounds ε := by intro m obtain ⟨B, hB, hMix, hF⟩ := hDerivatives₀ m exact ⟨B, hB, fun v hv => hMix v (hMixed hv), fun v hv => hF v (hFair hv)⟩ have hBranchNeighbourhoodε : CalibrationBranchNeighbourhood ε := by obtain ⟨εmix, εfair, b, U, V, hm, hem, hf, hef, hb, hbsmall, hRest⟩ := hBranchNeighbourhood have he : ε ≤ εbranch := (min_le_right _ _).trans ((min_le_right _ _).trans (min_le_right _ _)) exact ⟨εmix, εfair, b, U, V, hm, he.trans_lt hem, hf, he.trans_lt hef, hb, hbsmall, hRest⟩ refine ⟨ε, M, hε, hM, hSmooth, ⟨hDerivatives, hBranchNeighbourhoodε⟩, ?_, ?_, ?_⟩ · intro t ξ υ ht hξ hυ dsimp only refine ⟨?_, tableCell_first_margin _ _ _, tableCell_second_margin _ _ _, tableCell_total _ _ _, ?_, normalizedBranch_eq_div _ _ _, normalizedBranch_zero _ _⟩ · exact covarianceBranch_table_positive t ξ υ (ht.trans hsmall) (hξ.trans hsmall) (hυ.trans hsmall) · exact covarianceBranch_odds_ratio t ξ υ (ht.trans hsmall) (hξ.trans hsmall) (hυ.trans hsmall) · intro η ζ u hη hζ hu dsimp only have hExists : ∃ q : ℝ, q ∈ Ioo (3 / 4) (5 / 4) ∧ mixedEquation η ζ u q = 0 := by exact (hroots η ζ u ((hη.trans (min_le_right _ _)).trans (min_le_left _ _)) ((hζ.trans (min_le_right _ _)).trans (min_le_left _ _)) hu).exists obtain ⟨hBracket, hEquation⟩ := mixedRoot_spec η ζ u hExists refine ⟨hBracket.1, hBracket.2, hEquation, mixedRoot_endpoints η ζ, mixedEquation_covariance_matching η ζ u _ hEquation, ?_, ?_, mixedRoot_zero_left ζ u (hζ.trans hsmall), mixedRoot_zero_right η u (hη.trans hsmall)⟩ · exact mixedRoot_even_left η ζ u · exact mixedRoot_even_right η ζ u · intro t δ u ht hδ hu dsimp only have hδsmall : |δ| ≤ 1/100 := (hδ.trans (min_le_right _ _)).trans ((min_le_right _ _).trans (min_le_left _ _)) obtain ⟨hLower, hUpper⟩ := comparatorEffect_gap_bounds t δ ht hδsmall obtain ⟨hHalf, hLe⟩ := comparatorEffect_range_bounds t δ ht hδsmall obtain ⟨h0, hδ0, ht0, hExists⟩ := hFairRoots₀ t δ u ht (hδ.trans (min_le_left _ _)) hu have hBound := hFairQuadratic t δ u ht (hδ.trans (min_le_left _ _)) hu have hBracket := fairRoot_mem_bracket t δ u have hDiv : t*δ ≠ 0 → fairEquation t δ (fairRoot t δ u) u = fairNumerator t δ (fairRoot t δ u) u/(t*δ^2) := fun hne => fairEquation_eq_div t δ (fairRoot t δ u) u ht hδsmall ⟨hBracket.1.le, hBracket.2.le⟩ hne have hEq : fairEquation t δ (fairRoot t δ u) u = 0 := by by_cases hδzero : δ = 0 · subst δ exact (fairRoot_zero_amplitude_spec t u ht).2 by_cases huEnd : u = 0 ∨ u = 1 · exact (fairRoot_endpoint_spec t δ u ht hδsmall huEnd).2 · exact (fairRoot_spec t δ u hExists).2 have hMatch := fair_matching_of_equation t δ (fairRoot t δ u) u ht hδsmall ⟨hBracket.1.le, hBracket.2.le⟩ hEq exact ⟨h0, (fairRoot_endpoints t δ).symm.trans h0, hδ0, ht0, fairRoot_even t δ u, hEq, hDiv, hMatch, hBound, hLower, hUpper, hHalf, hLe⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.exact_calibrations · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ExactCalibrations.lean:466
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_FiniteHonestUpper 20 declarations Confidence-rectangle inversion covers the observable causal effect.

T FiniteHonestUpper

Confidence-rectangle inversion covers the observable causal effect. Finite second moments and Chebyshev concentration give ninety-percent coverage once the coordinate bias bounds are supplied. The literal single-record branch is honest with unit length. Native-logit Hölder bounds and projection approximation prove both coordinate biases. Unconditional rectangle sensitivity and absolute numerator moments give a radius-sensitive expected-length inequality; proved rank-budget estimates give an absolute uniform diagnostic rate bound. Endpoint realization remains an imported open dependency.

theorem inversion_le_of_quotient_le Lemma inversion_le_of_quotient_le in the paper ↗

Clipped logarithmic inversion preserves the ordering of its quotient argument. Under the stated assumptions.

Formal statement
c d c' d' :
ℝ
h :
c / d ≤ c' / d'
inversion c d ≤ inversion c' d'
Proof (Lean source)
-- @node: inversion_le_of_quotient_le lemma inversion_le_of_quotient_le (c d c' d' : ℝ) (h : c / d ≤ c' / d') : inversion c d ≤ inversion c' d' := by apply Real.log_le_log · exact (Real.exp_pos (-1/2 : ℝ)).trans_le (le_max_left _ _) · exact max_le_max_left _ (min_le_min_left _ (by linarith : 1 + c / d ≤ 1 + c' / d'))
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_le_of_quotient_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:26
theorem inversion_denominator_corners Lemma inversion_denominator_corners in the paper ↗

[On a positive denominator interval the extrema occur at its two endpoints, with the direction determined by the sign of the numerator. the documented result Under the stated assumptions.

Formal statement
c dm d dp :
ℝ
hm :
0 < dm
hmd :
dm ≤ d
hdp :
d ≤ dp
conclusion 1
min (inversion c dm) (inversion c dp) ≤ inversion c d
conclusion 2
inversion c d ≤ max (inversion c dm) (inversion c dp)
Proof (Lean source)
-- @node: inversion_denominator_corners lemma inversion_denominator_corners (c dm d dp : ℝ) (hm : 0 < dm) (hmd : dm ≤ d) (hdp : d ≤ dp) : min (inversion c dm) (inversion c dp) ≤ inversion c d ∧ inversion c d ≤ max (inversion c dm) (inversion c dp) := by have hd : 0 < d := hm.trans_le hmd have hp : 0 < dp := hd.trans_le hdp by_cases hc : 0 ≤ c · have hlow : inversion c dp ≤ inversion c d := by apply inversion_le_of_quotient_le apply (div_le_div_iff₀ hp hd).2 exact mul_le_mul_of_nonneg_left hdp hc have hhigh : inversion c d ≤ inversion c dm := by apply inversion_le_of_quotient_le apply (div_le_div_iff₀ hd hm).2 exact mul_le_mul_of_nonneg_left hmd hc exact ⟨(min_le_right _ _).trans hlow, hhigh.trans (le_max_left _ _)⟩ · have hc' : c ≤ 0 := (lt_of_not_ge hc).le have hlow : inversion c dm ≤ inversion c d := by apply inversion_le_of_quotient_le apply (div_le_div_iff₀ hm hd).2 exact mul_le_mul_of_nonpos_left hmd hc' have hhigh : inversion c d ≤ inversion c dp := by apply inversion_le_of_quotient_le apply (div_le_div_iff₀ hd hp).2 exact mul_le_mul_of_nonpos_left hdp hc' exact ⟨(min_le_left _ _).trans hlow, hhigh.trans (le_max_right _ _)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_denominator_corners · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:34
theorem inversion_rectangle_coverage Lemma inversion_rectangle_coverage in the paper ↗

[The two selected corners cover the inversion of every point of a positive confidence rectangle. the documented result Under the stated assumptions.

Formal statement
cm c cp dm d dp :
ℝ
hcm :
cm ≤ c
hcp :
c ≤ cp
hm :
0 < dm
hmd :
dm ≤ d
hdp :
d ≤ dp
inversion c d ∈ Icc (min (inversion cm dm) (inversion cm dp)) (max (inversion cp dm) (inversion cp dp))
Proof (Lean source)
-- @node: inversion_rectangle_coverage lemma inversion_rectangle_coverage (cm c cp dm d dp : ℝ) (hcm : cm ≤ c) (hcp : c ≤ cp) (hm : 0 < dm) (hmd : dm ≤ d) (hdp : d ≤ dp) : inversion c d ∈ Icc (min (inversion cm dm) (inversion cm dp)) (max (inversion cp dm) (inversion cp dp)) := by have hd : 0 < d := hm.trans_le hmd exact ⟨(inversion_denominator_corners cm dm d dp hm hmd hdp).1.trans (inversion_mono_numerator d hd hcm), (inversion_mono_numerator d hd hcp).trans (inversion_denominator_corners cp dm d dp hm hmd hdp).2⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_rectangle_coverage · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:64
theorem inversion_model_coordinates

[The clipped inversion identifies the causal effect on the model, since the observable odds already lie inside the public exponential effect envelope. the documented result Under the stated assumptions.

Formal statement
α β :
ℝ
hP :
Model α β P
Proof (Lean source)
-- @node: inversion_model_coordinates lemma inversion_model_coordinates (α β : ℝ) (P : ObservedLaw) (hP : Model α β P) : inversion (covarianceCoordinate P) (denominatorCoordinate P) = effect P := by have hS := denominatorCoordinate_lower α β P hP have hpos : 0 < denominatorCoordinate P := by have : (0 : ℝ) < denominatorFloor := by norm_num [denominatorFloor] exact this.trans_le hS have hC := covarianceCoordinate_eq_odds P hP.uniform hP.homogeneous have hquot : 1 + covarianceCoordinate P/denominatorCoordinate P = exp (effect P) := by rw [hC, mul_div_cancel_right₀ _ (ne_of_gt hpos)] ring obtain ⟨hlo, hhi⟩ := abs_le.mp hP.effect_envelope rw [inversion, hquot, clip, min_eq_right (Real.exp_le_exp.mpr hhi), max_eq_right (Real.exp_le_exp.mpr (by linarith : -1/2 ≤ effect P)), Real.log_exp]
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_model_coordinates · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:79
theorem clip_error_interval_contains Lemma clip_error_interval_contains in the paper ↗

[Denominator clipping retains any true coordinate in the public interval that was contained in the original error interval. the documented result Under the stated assumptions.

Formal statement
l u shat s b :
ℝ
hs :
s ∈ Icc l u
herr :
|shat - s| ≤ b
conclusion 1
clip l u (shat - b) ≤ s
conclusion 2
s ≤ clip l u (shat + b)
Proof (Lean source)
-- @node: clip_error_interval_contains lemma clip_error_interval_contains (l u shat s b : ℝ) (hs : s ∈ Icc l u) (herr : |shat - s| ≤ b) : clip l u (shat - b) ≤ s ∧ s ≤ clip l u (shat + b) := by obtain ⟨hminus, hplus⟩ := abs_le.mp herr constructor · exact max_le hs.1 ((min_le_right _ _).trans (by linarith)) · exact (le_min hs.2 (by linarith)).trans (le_max_right _ _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.clip_error_interval_contains · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:97
theorem inversion_confidence_rectangle Lemma inversion_confidence_rectangle in the paper ↗

[A coordinate confidence event covers the inverted target at the exact minimum and maximum corners used by the upper construction. the documented result Under the stated assumptions.

Formal statement
chat shat c s bC bS l u :
ℝ
hl :
0 < l
hs :
s ∈ Icc l u
hc :
|chat - c| ≤ bC
hserr :
|shat - s| ≤ bS
inversion c s ∈ Icc (min (inversion (chat - bC) (clip l u (shat - bS))) (inversion (chat - bC) (clip l u (shat + bS)))) (max (inversion (chat + bC) (clip l u (shat - bS))) (inversion (chat + bC) (clip l u (shat + bS))))
Proof (Lean source)
-- @node: inversion_confidence_rectangle lemma inversion_confidence_rectangle (chat shat c s bC bS l u : ℝ) (hl : 0 < l) (hs : s ∈ Icc l u) (hc : |chat - c| ≤ bC) (hserr : |shat - s| ≤ bS) : inversion c s ∈ Icc (min (inversion (chat - bC) (clip l u (shat - bS))) (inversion (chat - bC) (clip l u (shat + bS)))) (max (inversion (chat + bC) (clip l u (shat - bS))) (inversion (chat + bC) (clip l u (shat + bS)))) := by obtain ⟨hcm, hcp⟩ := abs_le.mp hc obtain ⟨hsm, hsp⟩ := clip_error_interval_contains l u shat s bS hs hserr apply inversion_rectangle_coverage · linarith · linarith · exact hl.trans_le (le_max_left _ _) · exact hsm · exact hsp
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_confidence_rectangle · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:108
theorem denominatorCoordinate_le_one

[The integrated off-diagonal product is at most one under the public design. the stated conclusion holds.

Formal statement
Proof (Lean source)
-- @node: denominatorCoordinate_le_one lemma denominatorCoordinate_le_one (P : ObservedLaw) : denominatorCoordinate P ≤ 1 := by have hprob : IsProbabilityMeasure uniformLaw := by constructor rw [uniformLaw, comap_subtype_coe_apply measurableSet_Icc] rw [Set.image_univ, Subtype.range_coe, Real.volume_Icc] norm_num let := hprob have hi : Integrable (fun x => P.cells true false x * P.cells false true x) uniformLaw := ((P.continuous_cells true false).mul (P.continuous_cells false true)).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hb (x : Covariate) : P.cells true false x * P.cells false true x ≤ 1 := (mul_le_mul (P.interior_cells true false x).2.le (P.interior_cells false true x).2.le (P.interior_cells false true x).1.le (by norm_num)).trans (by norm_num) have h := integral_mono hi (integrable_const (1 : ℝ)) hb simpa only [denominatorCoordinate, cellProbability_eq_cells, integral_const, probReal_univ, one_smul] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.denominatorCoordinate_le_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:128
theorem idealEndpoints_cover_effect

The paper's two coordinate error bounds imply coverage of the causal effect by the exact ideal interval, prior to outward rational rounding. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
α β :
ℝ
o :
Fin n → Record
hP :
Model α β P
hc :
|cHat n (resolutions E N n α β).1 o - covarianceCoordinate P|
≤ 8 * ((resolutions E N n α β).1 : ℝ) ^ (-(α + β))
+ sqrt (20 * varianceRadius n (resolutions E N n α β).1)
hs :
|sHat n (resolutions E N n α β).2 o - denominatorCoordinate P|
≤ 25 * ((resolutions E N n α β).2 : ℝ) ^ (-2 * β)
+ sqrt (20 * varianceRadius n (resolutions E N n α β).2)
effect P ∈ Icc (idealEndpoints E N n α β o).1 (idealEndpoints E N n α β o).2
Proof (Lean source)
-- @node: idealEndpoints_cover_effect lemma idealEndpoints_cover_effect (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (α β : ℝ) (o : Fin n → Record) (P : ObservedLaw) (hP : Model α β P) (hc : |cHat n (resolutions E N n α β).1 o - covarianceCoordinate P| ≤ 8 * ((resolutions E N n α β).1 : ℝ) ^ (-(α + β)) + sqrt (20 * varianceRadius n (resolutions E N n α β).1)) (hs : |sHat n (resolutions E N n α β).2 o - denominatorCoordinate P| ≤ 25 * ((resolutions E N n α β).2 : ℝ) ^ (-2 * β) + sqrt (20 * varianceRadius n (resolutions E N n α β).2)) : effect P ∈ Icc (idealEndpoints E N n α β o).1 (idealEndpoints E N n α β o).2 := by rw [← inversion_model_coordinates α β P hP] exact inversion_confidence_rectangle _ _ _ _ _ _ _ _ (by norm_num [denominatorFloor]) ⟨denominatorCoordinate_lower α β P hP, denominatorCoordinate_le_one P⟩ hc hs
CausalSmith.Stat.LogoddsLowsmoothFrontier.idealEndpoints_cover_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:148
theorem upperInterval_one_set

The literal single-record output is the full public effect interval. Under the stated assumptions.

Formal statement
hN :
N.Admissible
α β :
ℝ
ω :
Experiment 1
intervalSet ((upperInterval E N hN 1 α β).output ω) = Icc (-(1/2 : ℝ)) (1/2)
Proof (Lean source)
-- @node: upperInterval_one_set lemma upperInterval_one_set (E : ArithmeticEngine) (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ) (ω : Experiment 1) : intervalSet ((upperInterval E N hN 1 α β).output ω) = Icc (-(1/2 : ℝ)) (1/2) := by ext t simp only [upperInterval, upperOutput, upperRawBox, show (1 : ℕ) < 2 by omega, ↓reduceIte, intervalSet, fullEffectBox, rationalBox, Set.mem_ofPred_eq, Set.mem_Icc] norm_num constructor · rintro ⟨hlo, hhi⟩ exact ⟨le_of_lt_or_eq hlo, le_of_lt_or_eq hhi⟩ · rintro ⟨hlo, hhi⟩ exact ⟨lt_or_eq_of_le hlo, lt_or_eq_of_le hhi⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperInterval_one_set · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:166
theorem upperInterval_one_honest

[The single-record procedure has coverage one because it returns the full effect envelope on every input. the documented result Under the stated assumptions.

Formal statement
hN :
N.Admissible
α β :
ℝ
HonestProcedure 1 α β (upperInterval E N hN 1 α β)
Proof (Lean source)
-- @node: upperInterval_one_honest lemma upperInterval_one_honest (E : ArithmeticEngine) (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ) : HonestProcedure 1 α β (upperInterval E N hN 1 α β) := by constructor intro P hP let := experimentLaw_probability P 1 have hAll : {ω : Experiment 1 | effect P ∈ intervalSet ((upperInterval E N hN 1 α β).output ω)} = univ := by ext ω simp only [Set.mem_ofPred_eq, upperInterval_one_set, Set.mem_Icc, Set.mem_univ, iff_true] exact abs_le.mp hP.effect_envelope rw [hAll, measure_univ] exact ENNReal.div_le_of_le_mul (by norm_num)
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperInterval_one_honest · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:182
theorem upperInterval_one_length

The literal single-record interval has length one. Under the stated assumptions.

Formal statement
hN :
N.Admissible
α β :
ℝ
ω :
Experiment 1
intervalLength ((upperInterval E N hN 1 α β).output ω) = 1
Proof (Lean source)
-- @node: upperInterval_one_length lemma upperInterval_one_length (E : ArithmeticEngine) (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ) (ω : Experiment 1) : intervalLength ((upperInterval E N hN 1 α β).output ω) = 1 := by norm_num [upperInterval, intervalLength, upperOutput, upperRawBox, fullEffectBox, rationalBox]
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperInterval_one_length · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:199
theorem upperInterval_one_expectedLength_bound

[At one record the expected length obeys the diagnostic bound for any constant at least one and any nonnegative radius. the documented result Under the stated assumptions.

Formal statement
hN :
N.Admissible
α β r K :
ℝ
hr :
0 ≤ r
hK :
1 ≤ K
expectedLength P 1 (upperInterval E N hN 1 α β) ≤ K*diagnosticEnvelope 1 α β r
Proof (Lean source)
-- @node: upperInterval_one_expectedLength_bound lemma upperInterval_one_expectedLength_bound (E : ArithmeticEngine) (N : NamingPolicy) (hN : N.Admissible) (α β r K : ℝ) (hr : 0 ≤ r) (hK : 1 ≤ K) (P : ObservedLaw) : expectedLength P 1 (upperInterval E N hN 1 α β) ≤ K*diagnosticEnvelope 1 α β r := by let := experimentLaw_probability P 1 have hLen : expectedLength P 1 (upperInterval E N hN 1 α β) = 1 := by simp [expectedLength, upperInterval_one_length] rw [hLen] norm_num [diagnosticEnvelope] nlinarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperInterval_one_expectedLength_bound · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:206
theorem coordinate_error_probability_le Lemma coordinate_error_probability_le in the paper ↗

[A bias bound and the sharp variance radius give the one-twentieth coordinate failure probability used in the paper's Chebyshev step. the documented result Under the stated assumptions.

Formal statement
Ω :
X :
Ω → ℝ
hX :
MemLp X 2 μ
c b V :
ℝ
hV :
0 < V
hbias :
|(∫ ω, X ω ∂μ) - c| ≤ b
hvar :
variance X μ ≤ V
μ {ω | b + sqrt (20*V) < |X ω - c|} ≤ (1/20 : ℝ≥0∞)
Proof (Lean source)
-- @node: coordinate_error_probability_le lemma coordinate_error_probability_le {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → ℝ) (hX : MemLp X 2 μ) (c b V : ℝ) (hV : 0 < V) (hbias : |(∫ ω, X ω ∂μ) - c| ≤ b) (hvar : variance X μ ≤ V) : μ {ω | b + sqrt (20*V) < |X ω - c|} ≤ (1/20 : ℝ≥0∞) := by have hsqrt : 0 < sqrt (20*V) := Real.sqrt_pos.2 (by positivity) have hsquare : (sqrt (20*V))^2 = 20*V := Real.sq_sqrt (by positivity) have hsub : {ω | b + sqrt (20*V) < |X ω - c|} ⊆ {ω | sqrt (20*V) ≤ |X ω - ∫ x, X x ∂μ|} := by intro ω hω have htri : |X ω - c| ≤ |X ω - ∫ x, X x ∂μ| + |(∫ x, X x ∂μ) - c| := by exact abs_sub_le (X ω) (∫ x, X x ∂μ) c change b + sqrt (20*V) < |X ω - c| at hω change sqrt (20*V) ≤ |X ω - ∫ x, X x ∂μ| linarith calc μ {ω | b + sqrt (20*V) < |X ω - c|} ≤ μ {ω | sqrt (20*V) ≤ |X ω - ∫ x, X x ∂μ|} := measure_mono hsub _ ≤ ofReal (variance X μ / (sqrt (20*V))^2) := meas_ge_le_variance_div_sq hX hsqrt _ ≤ ofReal (1/20) := by apply ENNReal.ofReal_le_ofReal rw [hsquare] apply (div_le_iff₀ (by positivity : 0 < 20*V)).2 linarith _ = (1/20 : ℝ≥0∞) := by rw [ENNReal.ofReal_div_of_pos (by norm_num)] norm_num
CausalSmith.Stat.LogoddsLowsmoothFrontier.coordinate_error_probability_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:219

The public variance radius is strictly positive for every multi-record sample. Under the stated assumptions.

Formal statement
n k :
ℕ
hn :
2 ≤ n
Proof (Lean source)
-- @node: varianceRadius_pos lemma varianceRadius_pos (n k : ℕ) (hn : 2 ≤ n) : 0 < varianceRadius n k := by have hn' : (1 : ℝ) < n := by exact_mod_cast (show 1 < n by omega) unfold varianceRadius positivity
CausalSmith.Stat.LogoddsLowsmoothFrontier.varianceRadius_pos · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:251
theorem upperInterval_coverage_of_coordinate_moments

[The union of the two coordinate failure events has probability at most one tenth. Endpoint realization then transfers rectangle coverage to the literal output. the documented result Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
hP :
Model α β P
hcBias :
|(∫ ω : Experiment n, cHat n (resolutions E N n α β).1 ω.1 ∂experimentLaw P n)
≤ 8 * ((resolutions E N n α β).1 : ℝ) ^ (-(α + β))
hsBias :
|(∫ ω : Experiment n, sHat n (resolutions E N n α β).2 ω.1 ∂experimentLaw P n)
≤ 25 * ((resolutions E N n α β).2 : ℝ) ^ (-2 * β)
hcVar :
variance (fun ω : Experiment n => cHat n (resolutions E N n α β).1 ω.1) (experimentLaw P n)
≤ varianceRadius n (resolutions E N n α β).1
hsVar :
variance (fun ω : Experiment n => sHat n (resolutions E N n α β).2 ω.1) (experimentLaw P n)
≤ varianceRadius n (resolutions E N n α β).2
(9/10 : ℝ≥0∞)
≤ experimentLaw P n {ω | effect P ∈ intervalSet ((upperInterval E N hN n α β).output ω)}
Proof (Lean source)
-- @node: upperInterval_coverage_of_coordinate_moments lemma upperInterval_coverage_of_coordinate_moments (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) (P : ObservedLaw) (hP : Model α β P) (hcBias : |(∫ ω : Experiment n, cHat n (resolutions E N n α β).1 ω.1 ∂experimentLaw P n) - covarianceCoordinate P| ≤ 8 * ((resolutions E N n α β).1 : ℝ) ^ (-(α + β))) (hsBias : |(∫ ω : Experiment n, sHat n (resolutions E N n α β).2 ω.1 ∂experimentLaw P n) - denominatorCoordinate P| ≤ 25 * ((resolutions E N n α β).2 : ℝ) ^ (-2 * β)) (hcVar : variance (fun ω : Experiment n => cHat n (resolutions E N n α β).1 ω.1) (experimentLaw P n) ≤ varianceRadius n (resolutions E N n α β).1) (hsVar : variance (fun ω : Experiment n => sHat n (resolutions E N n α β).2 ω.1) (experimentLaw P n) ≤ varianceRadius n (resolutions E N n α β).2) : (9/10 : ℝ≥0∞) ≤ experimentLaw P n {ω | effect P ∈ intervalSet ((upperInterval E N hN n α β).output ω)} := by let := experimentLaw_probability P n let k := resolutions E N n α β let bC := 8*(k.1 : ℝ) ^ (-(α + β)) + sqrt (20*varianceRadius n k.1) let bS := 25*(k.2 : ℝ) ^ (-2 * β) + sqrt (20*varianceRadius n k.2) let badC : Set (Experiment n) := {ω | bC < |cHat n k.1 ω.1 - covarianceCoordinate P|} let badS : Set (Experiment n) := {ω | bS < |sHat n k.2 ω.1 - denominatorCoordinate P|} obtain ⟨hcLp, hsLp⟩ := coordinateEstimates_memLp P n k.1 k.2 have hcProb : experimentLaw P n badC ≤ (1/20 : ℝ≥0∞) := coordinate_error_probability_le _ _ hcLp _ _ _ (varianceRadius_pos n k.1 hn) hcBias hcVar have hsProb : experimentLaw P n badS ≤ (1/20 : ℝ≥0∞) := coordinate_error_probability_le _ _ hsLp _ _ _ (varianceRadius_pos n k.2 hn) hsBias hsVar have hBad : experimentLaw P n (badC ∪ badS) ≤ (1/10 : ℝ≥0∞) := by calc _ ≤ experimentLaw P n badC + experimentLaw P n badS := measure_union_le _ _ _ ≤ (1/20 : ℝ≥0∞) + 1/20 := add_le_add hcProb hsProb _ = _ := by simpa only [ENNReal.coe_add, ENNReal.coe_div (by norm_num : (20 : NNReal) ≠ 0), ENNReal.coe_div (by norm_num : (10 : NNReal) ≠ 0), ENNReal.coe_one, ENNReal.coe_ofNat] using congrArg (fun x : NNReal => (x : ℝ≥0∞)) (by norm_num : (1/20 : NNReal) + 1/20 = 1/10) have hAll : univ ⊆ {ω | effect P ∈ intervalSet ((upperInterval E N hN n α β).output ω)} ∪ (badC ∪ badS) := by intro ω _ by_cases hc : ω ∈ badC · exact inr (inl hc) by_cases hs : ω ∈ badS · exact inr (inr hs) apply inl have hCover := idealEndpoints_cover_effect E N n α β ω.1 P hP (le_of_not_gt hc) (le_of_not_gt hs) obtain ⟨c, s, L, R, _, _, _, _, _, _, _, _, _, _, _, _, _, _, hSubset, _⟩ := fixed_budget_realization.2 E hE N hN n hn α β hab ω.1 exact hSubset hCover have hTotal : (1 : ℝ≥0∞) ≤ experimentLaw P n {ω | effect P ∈ intervalSet ((upperInterval E N hN n α β).output ω)} + 1/10 := by calc 1 = experimentLaw P n univ := (measure_univ).symm _ ≤ experimentLaw P n ({ω | effect P ∈ intervalSet ((upperInterval E N hN n α β).output ω)} ∪ (badC ∪ badS)) := measure_mono hAll _ ≤ experimentLaw P n {ω | effect P ∈ intervalSet ((upperInterval E N hN n α β).output ω)} + experimentLaw P n (badC ∪ badS) := measure_union_le _ _ _ ≤ _ := add_le_add_right hBad _ have hnum : (9/10 : ℝ≥0∞) = 1 - 1/10 := by simpa only [ENNReal.coe_sub, ENNReal.coe_div (by norm_num : (10 : NNReal) ≠ 0), ENNReal.coe_one, ENNReal.coe_ofNat] using congrArg (fun x : NNReal => (x : ℝ≥0∞)) (show (9/10 : NNReal) = 1 - 1/10 from by apply NNReal.coe_injective norm_num [NNReal.sub_def, Real.coe_toNNReal]) rw [hnum] exact (tsub_le_iff_right).2 hTotal
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperInterval_coverage_of_coordinate_moments · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:258
theorem resolutions_one_le

The ranks selected before sampling are positive, using only the rank contract. Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
conclusion 1
1 ≤ (resolutions E N n α β).1
conclusion 2
1 ≤ (resolutions E N n α β).2
Proof (Lean source)
-- @node: resolutions_one_le lemma resolutions_one_le (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) : 1 ≤ (resolutions E N n α β).1 ∧ 1 ≤ (resolutions E N n α β).2 := by obtain ⟨c, s, hRank, hcR, hsR, hcW, hsW⟩ := rankBoxes_rank_budget_contract E hE N hN n (by omega) α β hab obtain ⟨hcOne, hsOne⟩ := rank_targets_one_le n hn α β hab have hc := hcOne.trans (enclosure_ceiling_rank_bounds c _ hcOne hcR hcW).1 have hs := hsOne.trans (enclosure_ceiling_rank_bounds s _ hsOne hsR hsW).1 have hc' : 1 ≤ (⌈c.hi⌉ : ℤ).toNat := by exact_mod_cast hc have hs' : 1 ≤ (⌈s.hi⌉ : ℤ).toNat := by exact_mod_cast hs simpa only [resolutions, hRank] using intro hc' hs'
CausalSmith.Stat.LogoddsLowsmoothFrontier.resolutions_one_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:330
theorem covarianceCoordinate_abs_le_effect

The effect envelope controls the observable numerator linearly, with the roadmap's constant. Under the stated assumptions.

Formal statement
α β :
ℝ
hP :
Model α β P
|covarianceCoordinate P| ≤ exp (1/2) * |effect P|
Proof (Lean source)
-- @node: covarianceCoordinate_abs_le_effect lemma covarianceCoordinate_abs_le_effect (α β : ℝ) (P : ObservedLaw) (hP : Model α β P) : |covarianceCoordinate P| ≤ exp (1/2) * |effect P| := by have he : |exp (effect P) - 1| ≤ exp (1/2) * |effect P| := by have h := Convex.norm_image_sub_le_of_norm_deriv_le (f := exp) (s := Icc (-(1/2 : ℝ)) (1/2)) (fun x _ => Real.differentiableAt_exp) (fun x hx => by rw [Real.deriv_exp, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] exact Real.exp_le_exp.mpr hx.2) (convex_Icc _ _) (show (0 : ℝ) ∈ Icc (-(1/2 : ℝ)) (1/2) by norm_num) (abs_le.mp hP.effect_envelope) simpa only [Real.exp_zero, Real.norm_eq_abs, sub_zero] using h have hs : 0 ≤ denominatorCoordinate P := by have := denominatorCoordinate_lower α β P hP have : 0 < denominatorFloor := by norm_num [denominatorFloor] linarith rw [covarianceCoordinate_eq_odds P hP.uniform hP.homogeneous, abs_mul, abs_of_nonneg hs] exact (mul_le_mul_of_nonneg_left (denominatorCoordinate_le_one P) (abs_nonneg _)).trans (by simpa using he)
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceCoordinate_abs_le_effect · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:345
theorem cHat_integral_abs_le

Bias and sharp variance control the unconditional absolute numerator mean. Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
hP :
Model α β P
k :
resolutions E N n α β
bC :
8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1)
(∫ ω : Experiment n, |cHat n k.1 ω.1| ∂experimentLaw P n) ≤ |covarianceCoordinate P|+bC
Proof (Lean source)
-- @node: cHat_integral_abs_le lemma cHat_integral_abs_le (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) (P : ObservedLaw) (hP : Model α β P) : let k := resolutions E N n α β let bC := 8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1) (∫ ω : Experiment n, |cHat n k.1 ω.1| ∂experimentLaw P n) ≤ |covarianceCoordinate P|+bC := by letI := experimentLaw_probability P n obtain ⟨hcMem, _⟩ := coordinateEstimates_memLp P n (resolutions E N n α β).1 (resolutions E N n α β).2 obtain ⟨hcVar, _⟩ := coordinateEstimates_variance_bounds P hP.uniform n (resolutions E N n α β).1 (resolutions E N n α β).2 hn obtain ⟨hcIdentity, _⟩ := coordinateEstimates_bias_identities P hP.uniform n (resolutions E N n α β).1 (resolutions E N n α β).2 hn obtain ⟨hk, _⟩ := resolutions_one_le E hE N hN n hn α β hab have hcBias : |(∫ ω : Experiment n, cHat n (resolutions E N n α β).1 ω.1 ∂experimentLaw P n) - covarianceCoordinate P| ≤ 8*((resolutions E N n α β).1 : ℝ)^(-(α+β)) := by rw [hcIdentity] exact numerator_projection_bias_bound P α β hab hP _ hk have h := integral_abs_le_bias_sqrt_variance _ _ hcMem _ _ _ hcBias hcVar have hV := (varianceRadius_pos n (resolutions E N n α β).1 hn).le have hS : sqrt (varianceRadius n (resolutions E N n α β).1) ≤ sqrt (20*varianceRadius n (resolutions E N n α β).1) := Real.sqrt_le_sqrt (by linarith) dsimp only linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.cHat_integral_abs_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:367
theorem upperInterval_expectedLength_le_radii

Integrating the samplewise rectangle bound gives the unconditional radius-sensitive length bound. Under the stated assumptions.

Formal statement
hE :
E.Admissible
hN :
N.Admissible
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
r :
ℝ
hP :
RadiusModel α β r P
k :
resolutions E N n α β
bC :
8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1)
bS :
25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2)
expectedLength P n (upperInterval E N hN n α β)
≤ 2*exp (1/2)/denominatorFloor*bC
+ 2*exp (1/2)/denominatorFloor^2*bS*(exp (1/2)*r+2*bC)
+ 2/(n : ℝ)
Proof (Lean source)
-- @node: upperInterval_expectedLength_le_radii lemma upperInterval_expectedLength_le_radii (E : ArithmeticEngine) (hE : E.Admissible) (N : NamingPolicy) (hN : N.Admissible) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) (r : ℝ) (P : ObservedLaw) (hP : RadiusModel α β r P) : let k := resolutions E N n α β let bC := 8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1) let bS := 25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2) expectedLength P n (upperInterval E N hN n α β) ≤ 2*exp (1/2)/denominatorFloor*bC + 2*exp (1/2)/denominatorFloor^2*bS*(exp (1/2)*r+2*bC) + 2/(n : ℝ) := by letI := experimentLaw_probability P n let k := resolutions E N n α β let bC := 8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1) let bS := 25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2) obtain ⟨hcMem, _⟩ := coordinateEstimates_memLp P n k.1 k.2 have hi := (hcMem.integrable (by norm_num : (1 : ℝ≥0∞) ≤ 2)).abs have hm : (∫ ω : Experiment n, |cHat n k.1 ω.1| ∂experimentLaw P n) ≤ exp (1/2)*r+bC := by have hc := cHat_integral_abs_le E hE N hN n hn α β hab P hP.toModel have he := (covarianceCoordinate_abs_le_effect α β P hP.toModel).trans (mul_le_mul_of_nonneg_left hP.radius (Real.exp_pos _).le) dsimp only at hc change _ ≤ exp (1/2)*r + bC linarith calc expectedLength P n (upperInterval E N hN n α β) ≤ ∫ ω : Experiment n, (2*exp (1/2)/denominatorFloor*bC + 2*exp (1/2)/denominatorFloor^2*bS*(|cHat n k.1 ω.1|+bC) + 2/(n : ℝ)) ∂experimentLaw P n := by apply integral_mono (procedure_length_integrable P n (upperInterval E N hN n α β)) (((integrable_const _).add ((hi.add (integrable_const bC)).const_mul _)).add (integrable_const _)) intro ω exact upperOutput_length_le E hE N hN n hn α β hab ω.1 _ = 2*exp (1/2)/denominatorFloor*bC + 2*exp (1/2)/denominatorFloor^2*bS* ((∫ ω : Experiment n, |cHat n k.1 ω.1| ∂experimentLaw P n)+bC) + 2/(n : ℝ) := by integral_linearity simp _ ≤ _ := by have hm' : (∫ ω : Experiment n, |cHat n k.1 ω.1| ∂experimentLaw P n)+bC ≤ exp (1/2)*r+2*bC := by linarith have hc : 0 ≤ 2*exp (1/2)/denominatorFloor^2*bS := by dsimp [bS]; positivity have ht := mul_le_mul_of_nonneg_left hm' hc change _ ≤ 2*exp (1/2)/denominatorFloor*bC + 2*exp (1/2)/denominatorFloor^2*bS*(exp (1/2)*r+2*bC) + 2/(n : ℝ) linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperInterval_expectedLength_le_radii · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:396
theorem finite_honest_upper

An absolute expected-length bound and global honesty for every supplied implementation. Under the stated assumptions. The stated conclusion follows.

Formal statement
∃ K₀ : ℝ,
0 < K₀
conclusion 1
E.Admissible
hN :
N.Admissible
α β :
ℝ
n :
ℕ
1 ≤ n
HonestProcedure n α β (upperInterval E N hN n α β)
r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
RadiusModel α β r P
expectedLength P n (upperInterval E N hN n α β) ≤ K₀*diagnosticEnvelope n α β r
ω :
RationalOutputShape ((upperInterval E N hN n α β).output ω)
n = 1
ω :
intervalSet ((upperInterval E N hN n α β).output ω) = Icc (-(1/2 : ℝ)) (1/2)
Proof (Lean source)
theorem finite_honest_upper : ∃ K₀ : ℝ, 0 < K₀ ∧ ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 1 ≤ n → HonestProcedure n α β (upperInterval E N hN n α β) ∧ (∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → ∀ P : ObservedLaw, RadiusModel α β r P → expectedLength P n (upperInterval E N hN n α β) ≤ K₀*diagnosticEnvelope n α β r) ∧ (∀ ω, RationalOutputShape ((upperInterval E N hN n α β).output ω)) ∧ (n = 1 → ∀ ω, intervalSet ((upperInterval E N hN n α β).output ω) = Icc (-(1/2 : ℝ)) (1/2)) := by -- Assemble coordinate moments, coverage, unconditional sensitivity, and the -- deterministic uniform power estimates for the represented ranks. obtain ⟨K, hK, hMulti⟩ : ∃ K : ℝ, 1 ≤ K ∧ ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 2 ≤ n → HonestProcedure n α β (upperInterval E N hN n α β) ∧ (∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → ∀ P : ObservedLaw, RadiusModel α β r P → expectedLength P n (upperInterval E N hN n α β) ≤ K*diagnosticEnvelope n α β r) := by obtain ⟨K, hK, hLength⟩ : ∃ K : ℝ, 1 ≤ K ∧ ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 2 ≤ n → ∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → ∀ P : ObservedLaw, RadiusModel α β r P → expectedLength P n (upperInterval E N hN n α β) ≤ K*diagnosticEnvelope n α β r := by obtain ⟨K, hK, hRates⟩ : ∃ K : ℝ, 1 ≤ K ∧ ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (α β : ℝ), ExponentDomain α β → ∀ n : ℕ, 2 ≤ n → ∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → let k := resolutions E N n α β let bC := 8*(k.1 : ℝ)^(-(α+β)) + sqrt (20*varianceRadius n k.1) let bS := 25*(k.2 : ℝ)^(-2*β) + sqrt (20*varianceRadius n k.2) 2*exp (1/2)/denominatorFloor*bC + 2*exp (1/2)/denominatorFloor^2*bS*(exp (1/2)*r+2*bC) + 2/(n : ℝ) ≤ K*diagnosticEnvelope n α β r := by exact upper_radii_uniform_rate refine ⟨K, hK, ?_⟩ intro E hE N hN α β hab n hn r hr P hP exact (upperInterval_expectedLength_le_radii E hE N hN n hn α β hab r P hP).trans (hRates E hE N hN α β hab n hn r hr) refine ⟨K, hK, ?_⟩ intro E hE N hN α β hab n hn refine ⟨⟨?_⟩, hLength E hE N hN α β hab n hn⟩ intro P hP obtain ⟨hcBias, hsBias, hcVar, hsVar⟩ : |(∫ ω : Experiment n, cHat n (resolutions E N n α β).1 ω.1 ∂experimentLaw P n) - covarianceCoordinate P| ≤ 8 * ((resolutions E N n α β).1 : ℝ) ^ (-(α + β)) ∧ |(∫ ω : Experiment n, sHat n (resolutions E N n α β).2 ω.1 ∂experimentLaw P n) - denominatorCoordinate P| ≤ 25 * ((resolutions E N n α β).2 : ℝ) ^ (-2 * β) ∧ variance (fun ω : Experiment n => cHat n (resolutions E N n α β).1 ω.1) (experimentLaw P n) ≤ varianceRadius n (resolutions E N n α β).1 ∧ variance (fun ω : Experiment n => sHat n (resolutions E N n α β).2 ω.1) (experimentLaw P n) ≤ varianceRadius n (resolutions E N n α β).2 := by obtain ⟨hcVar, hsVar⟩ := coordinateEstimates_variance_bounds P hP.uniform n (resolutions E N n α β).1 (resolutions E N n α β).2 hn obtain ⟨hcIdentity, hsIdentity⟩ := coordinateEstimates_bias_identities P hP.uniform n (resolutions E N n α β).1 (resolutions E N n α β).2 hn obtain ⟨hkC, hkS⟩ := resolutions_one_le E hE N hN n hn α β hab refine ⟨?_, ?_, hcVar, hsVar⟩ · rw [hcIdentity] exact numerator_projection_bias_bound P α β hab hP _ hkC · rw [hsIdentity, abs_neg] exact denominator_projection_bias_bound P α β hab hP _ hkS exact upperInterval_coverage_of_coordinate_moments E hE N hN n hn α β hab P hP hcBias hsBias hcVar hsVar refine ⟨K, lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1) hK, ?_⟩ intro E hE N hN α β hab n hn refine ⟨?_, ?_, ?_, ?_⟩ · by_cases hOne : n = 1 · subst n exact upperInterval_one_honest E N hN α β · exact (hMulti E hE N hN α β hab n (by omega)).1 · intro r hr P hP by_cases hOne : n = 1 · subst n exact upperInterval_one_expectedLength_bound E N hN α β r K hr.1 hK P · exact (hMulti E hE N hN α β hab n (by omega)).2 r hr P hP · intro ω exact upperOutput_rational_shape E N n α β ω.1 · intro hOne subst n exact upperInterval_one_set E N hN α β
CausalSmith.Stat.LogoddsLowsmoothFrontier.finite_honest_upper · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FiniteHonestUpper.lean:447
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_FixedBudgetRealization 9 declarations Unit-width enclosure rounding controls the selected ranks.

T FixedBudgetRealization

Unit-width enclosure rounding controls the selected ranks. Ideal endpoint ordering, rational output shape, and outward clipping assemble realization from the proved rank-budget contract and the proved literal endpoint box-evaluation estimates.

[The literal output has rational closed ordered endpoints in the public effect region.

Definition (Lean source)
RationalOutputShape B :
Prop
∃ l u : ℚ,
clause 1
B.val = ((l : ℝ),(u : ℝ),true,true)
clause 2
-1/2 ≤ l
clause 3
l ≤ u
clause 4
u ≤ 1/2
CausalSmith.Stat.LogoddsLowsmoothFrontier.RationalOutputShape · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:16
theorem upperOutput_rational_shape

The rational output has the prescribed shape even on totalized inputs. the stated conclusion holds.

Formal statement
n :
ℕ
α β :
ℝ
o :
Fin n → Record
Proof (Lean source)
-- @node: upperOutput_rational_shape lemma upperOutput_rational_shape (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (α β : ℝ) (o : Fin n → Record) : RationalOutputShape (upperOutput E N n α β o) := by have h := upperRawBox_subinterval E N n α β o refine ⟨(upperRawBox E N n α β o).lo, (upperRawBox E N n α β o).hi, rfl, ?_, (upperRawBox E N n α β o).lo_le_hi, ?_⟩ · norm_num [fullEffectBox, rationalBox] at h convert h.1 using 1; norm_num · norm_num [fullEffectBox, rationalBox] at h exact h.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperOutput_rational_shape · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:21
theorem enclosure_ceiling_rank_bounds

Ceiling the upper endpoint of a unit-width enclosure gives the strict two-unit rank excess in the roadmap; the target's unit lower bound controls the multiplicative excess. the documented result Under the stated assumptions.

Formal statement
R :
ℝ
hR :
1 ≤ R
hContains :
I.Contains R
hWidth :
I.width ≤ 1
conclusion 1
R ≤ (((⌈I.hi⌉ : ℤ).toNat : ℕ) : ℝ)
conclusion 2
(((⌈I.hi⌉ : ℤ).toNat : ℕ) : ℝ) < R+2
conclusion 3
R+2 ≤ 3*R
Proof (Lean source)
-- @node: enclosure_ceiling_rank_bounds lemma enclosure_ceiling_rank_bounds (I : RatInterval) (R : ℝ) (hR : 1 ≤ R) (hContains : I.Contains R) (hWidth : I.width ≤ 1) : R ≤ (((⌈I.hi⌉ : ℤ).toNat : ℕ) : ℝ) ∧ (((⌈I.hi⌉ : ℤ).toNat : ℕ) : ℝ) < R+2 ∧ R+2 ≤ 3*R := by have hhi : (0 : ℚ) ≤ I.hi := by exact_mod_cast (show (0 : ℝ) ≤ I.hi from (by linarith [hContains.2])) have hceil : (0 : ℤ) ≤ ⌈I.hi⌉ := Int.ceil_nonneg hhi have hcast : (((⌈I.hi⌉ : ℤ).toNat : ℕ) : ℝ) = (⌈I.hi⌉ : ℤ) := by rw [← Int.cast_natCast, Int.toNat_of_nonneg hceil] rw [hcast] have hceilLower : (I.hi : ℝ) ≤ (⌈I.hi⌉ : ℤ) := by exact_mod_cast Int.le_ceil I.hi have hceilUpper : ((⌈I.hi⌉ : ℤ) : ℝ) < (I.hi : ℝ)+1 := by exact_mod_cast Int.ceil_lt_add_one I.hi have hwidth : (I.hi : ℝ) - I.lo ≤ 1 := by exact_mod_cast hWidth exact ⟨hContains.2.trans hceilLower, by linarith [hContains.1], by linarith⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.enclosure_ceiling_rank_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:34
theorem rank_targets_one_le

Both exact rank targets are at least one on the public exponent domain. Under the stated assumptions.

Formal statement
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
hab :
conclusion 1
1 ≤ (n : ℝ)^(2/(2*α+2*β+1))
conclusion 2
1 ≤ (n : ℝ)^(2/(4*β+1))
Proof (Lean source)
-- @node: rank_targets_one_le lemma rank_targets_one_le (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (hab : ExponentDomain α β) : 1 ≤ (n : ℝ)^(2/(2*α+2*β+1)) ∧ 1 ≤ (n : ℝ)^(2/(4*β+1)) := by have hn' : (1 : ℝ) ≤ n := by exact_mod_cast (show 1 ≤ n by omega) have hα : 0 < α := hab.1.trans hab.2.2.1 have hβ : 0 < β := hab.1 exact ⟨Real.one_le_rpow hn' (by positivity), Real.one_le_rpow hn' (by positivity)⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.rank_targets_one_le · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:56
theorem inversion_effect_bounds Lemma inversion_effect_bounds in the paper ↗

[Clipped odds inversion stays inside the public effect interval. the stated conclusion holds.

Formal statement
c d :
ℝ
conclusion 1
-(1/2 : ℝ) ≤ inversion c d
conclusion 2
inversion c d ≤ 1/2
Proof (Lean source)
-- @node: inversion_effect_bounds lemma inversion_effect_bounds (c d : ℝ) : -(1/2 : ℝ) ≤ inversion c d ∧ inversion c d ≤ 1/2 := by have hExp : exp (-1/2 : ℝ) ≤ exp (1/2) := Real.exp_le_exp.mpr (by norm_num) have hlo : exp (-(1/2 : ℝ)) ≤ clip (exp (-1/2)) (exp (1/2)) (1+c/d) := by simpa only [clip, neg_div] using le_max_left (exp (-1/2)) (min (exp (1/2)) (1+c/d)) have hhi : clip (exp (-1/2)) (exp (1/2)) (1+c/d) ≤ exp (1/2) := max_le hExp (min_le_left _ _) constructor · simpa [inversion] using Real.log_le_log (Real.exp_pos (-(1/2 : ℝ))) hlo · simpa [inversion] using Real.log_le_log ((Real.exp_pos (-(1/2 : ℝ))).trans_le hlo) hhi
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_effect_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:66
theorem inversion_mono_numerator Lemma inversion_mono_numerator in the paper ↗

For a positive denominator, clipped odds inversion is nondecreasing in its numerator. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
d :
ℝ
hd :
0 < d
Monotone (fun c => inversion c d)
Proof (Lean source)
-- @node: inversion_mono_numerator lemma inversion_mono_numerator (d : ℝ) (hd : 0 < d) : Monotone (fun c => inversion c d) := by intro c c' hcc' have hclip : clip (exp (-1/2)) (exp (1/2)) (1+c/d) ≤ clip (exp (-1/2)) (exp (1/2)) (1+c'/d) := by apply max_le_max_left apply min_le_min_left exact add_le_add_right (div_le_div_of_nonneg_right hcc' hd.le) 1 apply Real.log_le_log _ hclip simpa only [clip] using (Real.exp_pos (-1/2 : ℝ)).trans_le (le_max_left (exp (-1/2)) (min (exp (1/2)) (1+c/d)))
CausalSmith.Stat.LogoddsLowsmoothFrontier.inversion_mono_numerator · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:82
theorem idealEndpoints_ordered_bounded

[The ideal interval is ordered on every sample and lies in the public effect region. the stated conclusion holds.

Formal statement
n :
ℕ
α β :
ℝ
o :
Fin n → Record
conclusion 1
-(1/2 : ℝ) ≤ (idealEndpoints E N n α β o).1
conclusion 2
(idealEndpoints E N n α β o).1 ≤ (idealEndpoints E N n α β o).2
conclusion 3
(idealEndpoints E N n α β o).2 ≤ 1/2
Proof (Lean source)
-- @node: idealEndpoints_ordered_bounded lemma idealEndpoints_ordered_bounded (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (α β : ℝ) (o : Fin n → Record) : -(1/2 : ℝ) ≤ (idealEndpoints E N n α β o).1 ∧ (idealEndpoints E N n α β o).1 ≤ (idealEndpoints E N n α β o).2 ∧ (idealEndpoints E N n α β o).2 ≤ 1/2 := by unfold idealEndpoints dsimp only refine ⟨le_min (inversion_effect_bounds _ _).1 (inversion_effect_bounds _ _).1, ?_, max_le (inversion_effect_bounds _ _).2 (inversion_effect_bounds _ _).2⟩ apply (min_le_left _ _).trans apply le_trans _ (le_max_left _ _) apply inversion_mono_numerator · have hfloor : (0 : ℝ) < denominatorFloor := by norm_num [denominatorFloor] exact hfloor.trans_le (le_max_left _ _) · have hb : 0 ≤ 8 * ((resolutions E N n α β).1 : ℝ)^(-(α+β)) + sqrt (20 * varianceRadius n (resolutions E N n α β).1) := by positivity linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.idealEndpoints_ordered_bounded · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:96
theorem upperOutput_enclosure_guarantees

Outward endpoint enclosures survive intersection with the effect region, and their widths bound the extra length. This step uses no arithmetic approximation estimate. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
hn :
2 ≤ n
α β :
ℝ
o :
Fin n → Record
c s L R :
hRank :
rankBoxes E N n α β = some (c, s)
hEnd :
endpointBoxes E N n α β o = some (L, R)
hL :
L.Contains (idealEndpoints E N n α β o).1
hR :
R.Contains (idealEndpoints E N n α β o).2
ε :
ℝ
hLW :
(L.width : ℝ) ≤ ε
hRW :
(R.width : ℝ) ≤ ε
conclusion 1
Icc (idealEndpoints E N n α β o).1 (idealEndpoints E N n α β o).2 ⊆ intervalSet (upperOutput E N n α β o)
conclusion 2
intervalLength (upperOutput E N n α β o)
≤ (idealEndpoints E N n α β o).2 - (idealEndpoints E N n α β o).1 + 2*ε
Proof (Lean source)
-- @node: upperOutput_enclosure_guarantees lemma upperOutput_enclosure_guarantees (E : ArithmeticEngine) (N : NamingPolicy) (n : ℕ) (hn : 2 ≤ n) (α β : ℝ) (o : Fin n → Record) (c s L R : RatInterval) (hRank : rankBoxes E N n α β = some (c, s)) (hEnd : endpointBoxes E N n α β o = some (L, R)) (hL : L.Contains (idealEndpoints E N n α β o).1) (hR : R.Contains (idealEndpoints E N n α β o).2) (ε : ℝ) (hLW : (L.width : ℝ) ≤ ε) (hRW : (R.width : ℝ) ≤ ε) : Icc (idealEndpoints E N n α β o).1 (idealEndpoints E N n α β o).2 ⊆ intervalSet (upperOutput E N n α β o) ∧ intervalLength (upperOutput E N n α β o) ≤ (idealEndpoints E N n α β o).2 - (idealEndpoints E N n α β o).1 + 2*ε := by obtain ⟨hlo, horder, hhi⟩ := idealEndpoints_ordered_bounded E N n α β o have hLR : L.lo ≤ R.hi := by exact_mod_cast hL.1.trans (horder.trans hR.2) have hLoClip : ((max L.lo (-1/2) : ℚ) : ℝ) ≤ (idealEndpoints E N n α β o).1 := by push_cast exact max_le hL.1 (by linarith) have hHiClip : (idealEndpoints E N n α β o).2 ≤ ((min R.hi (1/2) : ℚ) : ℝ) := by push_cast exact le_min hR.2 hhi have hClip : max L.lo (-1/2) ≤ min R.hi (1/2) := by exact_mod_cast hLoClip.trans (horder.trans hHiClip) have hraw : upperRawBox E N n α β o = ⟨max L.lo (-1/2), min R.hi (1/2), hClip⟩ := by unfold upperRawBox rw [if_neg (by omega), hRank, hEnd] simp only [rationalBox, min_eq_left hLR, max_eq_right hLR] have hflo : fullEffectBox.lo = (-1/2 : ℚ) := by norm_num [fullEffectBox, rationalBox] have hfhi : fullEffectBox.hi = (1/2 : ℚ) := by norm_num [fullEffectBox, rationalBox] simp only [boxIntersection, hflo, hfhi] rw [dif_pos hClip] have hLength : intervalLength (upperOutput E N n α β o) = ((min R.hi (1/2) : ℚ) : ℝ) - ((max L.lo (-1/2) : ℚ) : ℝ) := by simp only [intervalLength, upperOutput, hraw] constructor · intro x hx have hxlo := hLoClip.trans hx.1 have hxhi := hx.2.trans hHiClip simp only [intervalSet, upperOutput, hraw, Set.mem_ofPred_eq] exact ⟨(lt_or_eq_of_le hxlo).imp_right (fun h => ⟨True.intro, h⟩), (lt_or_eq_of_le hxhi).imp_right (fun h => ⟨True.intro, h⟩)⟩ · rw [hLength] have hLW' : (L.hi : ℝ) - L.lo ≤ ε := by exact_mod_cast hLW have hRW' : (R.hi : ℝ) - R.lo ≤ ε := by exact_mod_cast hRW have hmax : (L.lo : ℝ) ≤ ((max L.lo (-1/2) : ℚ) : ℝ) := by exact_mod_cast le_max_left L.lo (-1/2) have hmin : ((min R.hi (1/2) : ℚ) : ℝ) ≤ R.hi := by exact_mod_cast min_le_left R.hi (1/2) linarith [hL.2, hR.1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.upperOutput_enclosure_guarantees · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:116
theorem fixed_budget_realization

Primitive contracts alone suffice at both prescribed budgets, and the floor policy is valid. Under the stated assumptions. The stated conclusion follows.

Formal statement
conclusion 1
NamingPolicy.Admissible dyadicFloorPolicy
conclusion 2
E.Admissible
hN :
N.Admissible
n :
ℕ
2 ≤ n
α β :
ℝ
o :
Fin n → Record
k :
resolutions E N n α β
RC :
(n : ℝ)^(2/(2*α+2*β+1))
RS :
(n : ℝ)^(2/(4*β+1))
lr :
idealEndpoints E N n α β o
∃ c s L R : RatInterval,
rankBoxes E N n α β = some (c,s)
c.width ≤ 1
s.width ≤ 1
RC ≤ k.1
(k.1 : ℝ) < RC+2
RC+2 ≤ 3*RC
RS ≤ k.2
(k.2 : ℝ) < RS+2
RS+2 ≤ 3*RS
endpointBoxes E N n α β o = some (L,R)
L.Contains lr.1
R.Contains lr.2
(L.width : ℝ) ≤ 1/(n : ℝ)
(R.width : ℝ) ≤ 1/(n : ℝ)
Icc lr.1 lr.2 ⊆ intervalSet (upperOutput E N n α β o)
intervalLength (upperOutput E N n α β o) ≤ lr.2-lr.1+2/(n : ℝ)
Measurable (upperInterval E N hN n α β).output
Proof (Lean source)
lemma fixed_budget_realization : NamingPolicy.Admissible dyadicFloorPolicy ∧ ∀ (E : ArithmeticEngine), E.Admissible → ∀ (N : NamingPolicy) (hN : N.Admissible) (n : ℕ), 2 ≤ n → ∀ (α β : ℝ), ExponentDomain α β → ∀ o : Fin n → Record, let k := resolutions E N n α β let RC := (n : ℝ)^(2/(2*α+2*β+1)) let RS := (n : ℝ)^(2/(4*β+1)) let lr := idealEndpoints E N n α β o ∃ c s L R : RatInterval, rankBoxes E N n α β = some (c,s) ∧ c.width ≤ 1 ∧ s.width ≤ 1 ∧ RC ≤ k.1 ∧ (k.1 : ℝ) < RC+2 ∧ RC+2 ≤ 3*RC ∧ RS ≤ k.2 ∧ (k.2 : ℝ) < RS+2 ∧ RS+2 ≤ 3*RS ∧ endpointBoxes E N n α β o = some (L,R) ∧ L.Contains lr.1 ∧ R.Contains lr.2 ∧ (L.width : ℝ) ≤ 1/(n : ℝ) ∧ (R.width : ℝ) ≤ 1/(n : ℝ) ∧ Icc lr.1 lr.2 ⊆ intervalSet (upperOutput E N n α β o) ∧ intervalLength (upperOutput E N n α β o) ≤ lr.2-lr.1+2/(n : ℝ) ∧ RationalOutputShape (upperOutput E N n α β o) ∧ Measurable (upperInterval E N hN n α β).output := by refine ⟨dyadicFloorPolicy_admissible, ?_⟩ intro E hE N hN n hn α β hab o dsimp only -- The rank-box contract includes domain safety, containment, and unit width. obtain ⟨c, s, hRank, hcW, hsW, hcR, hsR⟩ : ∃ c s : RatInterval, rankBoxes E N n α β = some (c, s) ∧ c.width ≤ 1 ∧ s.width ≤ 1 ∧ c.Contains ((n : ℝ)^(2/(2*α+2*β+1))) ∧ s.Contains ((n : ℝ)^(2/(4*β+1))) := by obtain ⟨c, s, hRank, hcR, hsR, hcW, hsW⟩ := rankBoxes_rank_budget_contract E hE N hN n (by omega) α β hab exact ⟨c, s, hRank, hcW, hsW, hcR, hsR⟩ obtain ⟨hcOne, hsOne⟩ := rank_targets_one_le n hn α β hab obtain ⟨hcLower, hcUpper, hcTriple⟩ := enclosure_ceiling_rank_bounds c _ hcOne hcR hcW obtain ⟨hsLower, hsUpper, hsTriple⟩ := enclosure_ceiling_rank_bounds s _ hsOne hsR hsW have hk : resolutions E N n α β = ((⌈c.hi⌉ : ℤ).toNat, (⌈s.hi⌉ : ℤ).toNat) := by simp only [resolutions, hRank] -- Literal coordinates now have the roadmap widths at the actual endpoint inputs. obtain ⟨L, R, hEnd, hL, hR, hLW, hRW⟩ : ∃ L R : RatInterval, endpointBoxes E N n α β o = some (L, R) ∧ L.Contains (idealEndpoints E N n α β o).1 ∧ R.Contains (idealEndpoints E N n α β o).2 ∧ (L.width : ℝ) ≤ 1/(n : ℝ) ∧ (R.width : ℝ) ≤ 1/(n : ℝ) := by obtain ⟨xs, C, S, hInputs, hC, hS, hContainsC, hContainsS, hWidthC, hWidthS⟩ := endpoint_coordinates_budget_contract E hE N hN n (resolutions E N n α β).1 (resolutions E N n α β).2 hn α β hab o have hkC : 1 ≤ (resolutions E N n α β).1 := by have h : (1 : ℝ) ≤ (resolutions E N n α β).1 := by rw [hk] exact hcOne.trans hcLower exact_mod_cast h have hkS : 1 ≤ (resolutions E N n α β).2 := by have h : (1 : ℝ) ≤ (resolutions E N n α β).2 := by rw [hk] exact hsOne.trans hsLower exact_mod_cast h obtain ⟨BC, BS, hEvalBC, hEvalBS, hContainsBC, hContainsBS, hWidthBC, hWidthBS⟩ := endpoint_radii_budget_contract E hE N hN n (resolutions E N n α β).1 (resolutions E N n α β).2 hn hkC hkS α β hab o xs hInputs obtain ⟨Dm, Dp, hEvalDm, hEvalDp, hContainsDm, hContainsDp, hDmLo, hDmHi, hDpLo, hDpHi, hWidthDm, hWidthDp⟩ := endpoint_denominator_corners E (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) n (resolutions E N n α β).1 (resolutions E N n α β).2 hkS xs o β S BS hS hEvalBS hContainsS hContainsBS hWidthS hWidthBS obtain ⟨L, R, hEvalL, hEvalR, hContainsL, hContainsR, hWidthL, hWidthR⟩ : ∃ L R : RatInterval, (endpointExpressions n (resolutions E N n α β).1 (resolutions E N n α β).2 o).1.eval E (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) xs = some L ∧ (endpointExpressions n (resolutions E N n α β).1 (resolutions E N n α β).2 o).2.eval E (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) xs = some R ∧ L.Contains (idealEndpoints E N n α β o).1 ∧ R.Contains (idealEndpoints E N n α β o).2 ∧ (L.width : ℝ) ≤ 1/(n : ℝ) ∧ (R.width : ℝ) ≤ 1/(n : ℝ) := by obtain ⟨Cm, Cp, heCm, heCp, hvCm, hvCp, hmLo, hmHi, hpLo, hpHi, hwCm, hwCp⟩ := endpoint_numerator_corners E n (resolutions E N n α β).1 (resolutions E N n α β).2 hn hkC α β hab o xs C BC hC hEvalBC hContainsC hContainsBC hWidthC hWidthBC obtain ⟨Lmm, heLmm, hvLmm, hwLmm⟩ := endpoint_inversion_budget_contract E hE n (resolutions E N n α β).1 (resolutions E N n α β).2 hn xs _ _ Cm Dm _ _ heCm hEvalDm hvCm hContainsDm hDmLo hmLo hmHi hwCm hWidthDm obtain ⟨Lmp, heLmp, hvLmp, hwLmp⟩ := endpoint_inversion_budget_contract E hE n (resolutions E N n α β).1 (resolutions E N n α β).2 hn xs _ _ Cm Dp _ _ heCm hEvalDp hvCm hContainsDp hDpLo hmLo hmHi hwCm hWidthDp obtain ⟨Rpm, heRpm, hvRpm, hwRpm⟩ := endpoint_inversion_budget_contract E hE n (resolutions E N n α β).1 (resolutions E N n α β).2 hn xs _ _ Cp Dm _ _ heCp hEvalDm hvCp hContainsDm hDmLo hpLo hpHi hwCp hWidthDm obtain ⟨Rpp, heRpp, hvRpp, hwRpp⟩ := endpoint_inversion_budget_contract E hE n (resolutions E N n α β).1 (resolutions E N n α β).2 hn xs _ _ Cp Dp _ _ heCp hEvalDp hvCp hContainsDp hDpLo hpLo hpHi hwCp hWidthDp simp only [endpointRadiusExpressions] at heLmm heLmp heRpm heRpp refine ⟨boxMin Lmm Lmp, boxMax Rpm Rpp, ?_, ?_, ?_, ?_, ?_, ?_⟩ · change (do let A ← (inversionExpression _ _).eval E (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) xs let B ← (inversionExpression _ _).eval E (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) xs pure (boxMin A B)) = _ rw [heLmm, heLmp]; rfl · change (do let A ← (inversionExpression _ _).eval E (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) xs let B ← (inversionExpression _ _).eval E (qEnd n (resolutions E N n α β).1 (resolutions E N n α β).2) xs pure (boxMax A B)) = _ rw [heRpm, heRpp]; rfl · simpa only [idealEndpoints] using (endpoint_min_max_contains _ _ _ _ hvLmm hvLmp).1 · simpa only [idealEndpoints] using (endpoint_min_max_contains _ _ _ _ hvRpm hvRpp).2 · have h : ((boxMin Lmm Lmp).width : ℝ) ≤ max (Lmm.width : ℝ) (Lmp.width : ℝ) := by exact_mod_cast (endpoint_min_max_width Lmm Lmp).1 exact h.trans (max_le hwLmm hwLmp) · have h : ((boxMax Rpm Rpp).width : ℝ) ≤ max (Rpm.width : ℝ) (Rpp.width : ℝ) := by exact_mod_cast (endpoint_min_max_width Rpm Rpp).2 exact h.trans (max_le hwRpm hwRpp) refine ⟨L, R, ?_, hContainsL, hContainsR, hWidthL, hWidthR⟩ simp [endpointBoxes, hInputs, hEvalL, hEvalR] obtain ⟨hSubset, hLength⟩ := upperOutput_enclosure_guarantees E N n hn α β o c s L R hRank hEnd hL hR _ hLW hRW refine ⟨c, s, L, R, hRank, hcW, hsW, ?_, ?_, hcTriple, ?_, ?_, hsTriple, hEnd, hL, hR, hLW, hRW, hSubset, ?_, upperOutput_rational_shape E N n α β o, (upperInterval E N hN n α β).borel⟩ · simpa only [hk] using hcLower · simpa only [hk] using hcUpper · simpa only [hk] using hsLower · simpa only [hk] using hsUpper · simpa only [mul_one_div] using hLength
CausalSmith.Stat.LogoddsLowsmoothFrontier.fixed_budget_realization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FixedBudgetRealization.lean:170
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_FullHonestFrontierAnswer 1 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

T FullHonestFrontierAnswer

Paper-owned scaffold obligations; proofs are filled in Stage 3.

theorem full_honest_frontier_answer

The explicit power profile and one concrete data-only sequence answer the full honest-frontier question. the stated conclusion holds.

Formal statement
∃ c C : ℝ,
conclusion 1
α β :
ℝ
conclusion 2
α β :
ℝ
n :
ℕ
1 ≤ n
HonestProcedure n α β (starInterval n α β)
ω :
RationalOutputShape ((starInterval n α β).output ω)
r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
ρ :
(n : ℝ)^(-min (1/2) (2*(α+β)/(2*α+2*β+1)))+ r*(n : ℝ)^(-(4*β/(4*β+1)))
c*ρ ≤ lengthObjective n α β r
lengthObjective n α β r ≤ worstLength n α β r (starInterval n α β)
worstLength n α β r (starInterval n α β) ≤ C*ρ
conclusion 3
α β r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
n :
ℕ
1 ≤ n
I :
Procedure n
HonestProcedure n α β I
c*rate n α β r ≤ worstLength n α β r I
Proof (Lean source)
theorem full_honest_frontier_answer : ∃ c C : ℝ, 0 < c ∧ 0 < C ∧ UniversalFrontier c C ∧ CompactUniform c C ∧ (∀ α β : ℝ, ExponentDomain α β → ElbowIdentities α β) ∧ (∀ α β : ℝ, ExponentDomain α β → ∀ n : ℕ, 1 ≤ n → HonestProcedure n α β (starInterval n α β) ∧ (∀ ω, RationalOutputShape ((starInterval n α β).output ω)) ∧ (∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → let ρ := (n : ℝ)^(-min (1/2) (2*(α+β)/(2*α+2*β+1)))+ r*(n : ℝ)^(-(4*β/(4*β+1))) c*ρ ≤ lengthObjective n α β r ∧ lengthObjective n α β r ≤ worstLength n α β r (starInterval n α β) ∧ worstLength n α β r (starInterval n α β) ≤ C*ρ)) ∧ (∀ α β r : ℝ, ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → c*rate n α β r ≤ worstLength n α β r I) := by obtain ⟨c, C, hc, hC, hUniversal, hCompact, hElbows, hConcrete, hLower⟩ := full_honest_frontier_solution refine ⟨c, C, hc, hC, hUniversal, hCompact, hElbows, ?_, hLower⟩ intro α β hDomain n hn obtain ⟨hHonest, hRational, hComparison⟩ := hConcrete α β hDomain n hn refine ⟨hHonest, hRational, ?_⟩ intro r hr simpa only [rate, diagnosticEnvelope, exponentA, exponentB] using hComparison r hr
CausalSmith.Stat.LogoddsLowsmoothFrontier.full_honest_frontier_answer · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FullHonestFrontierAnswer.lean:15
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_FullHonestFrontierSolution 1 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

T FullHonestFrontierSolution

Paper-owned scaffold obligations; proofs are filled in Stage 3.

theorem full_honest_frontier_solution

The full solution includes the concrete sequence and the same absolute guarantees for every implementation. the stated conclusion holds.

Formal statement
∃ c C : ℝ,
conclusion 1
α β :
ℝ
conclusion 2
α β :
ℝ
n :
ℕ
1 ≤ n
HonestProcedure n α β (starInterval n α β)
ω :
RationalOutputShape ((starInterval n α β).output ω)
r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
c*rate n α β r ≤ lengthObjective n α β r
lengthObjective n α β r ≤ worstLength n α β r (starInterval n α β)
worstLength n α β r (starInterval n α β) ≤ C*rate n α β r
conclusion 3
α β r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
n :
ℕ
1 ≤ n
I :
Procedure n
HonestProcedure n α β I
c*rate n α β r ≤ worstLength n α β r I
Proof (Lean source)
theorem full_honest_frontier_solution : ∃ c C : ℝ, 0 < c ∧ 0 < C ∧ UniversalFrontier c C ∧ CompactUniform c C ∧ (∀ α β : ℝ, ExponentDomain α β → ElbowIdentities α β) ∧ (∀ α β : ℝ, ExponentDomain α β → ∀ n : ℕ, 1 ≤ n → HonestProcedure n α β (starInterval n α β) ∧ (∀ ω, RationalOutputShape ((starInterval n α β).output ω)) ∧ (∀ r : ℝ, r ∈ Icc (0 : ℝ) (1/2) → c*rate n α β r ≤ lengthObjective n α β r ∧ lengthObjective n α β r ≤ worstLength n α β r (starInterval n α β) ∧ worstLength n α β r (starInterval n α β) ≤ C*rate n α β r)) ∧ (∀ α β r : ℝ, ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → c*rate n α β r ≤ worstLength n α β r I) := by obtain ⟨c, C, hc, hC, hUniversal, hCompact, hElbows, hLower⟩ := sharp_honest_frontier refine ⟨c, C, hc, hC, hUniversal, hCompact, hElbows, ?_, hLower⟩ intro α β hDomain n hn obtain ⟨hOperational, hComparison⟩ := hUniversal concreteEngine concreteEngine_admissible dyadicFloorPolicy fixed_budget_realization.1 α β hDomain n hn refine ⟨hOperational.1, hOperational.2.1, ?_⟩ intro r hr exact hComparison r hr
CausalSmith.Stat.LogoddsLowsmoothFrontier.full_honest_frontier_solution · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_FullHonestFrontierSolution.lean:16
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_ObservableOdds 26 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

T ObservableOdds

Paper-owned scaffold obligations; proofs are filled in Stage 3.

theorem armRisk_interior

Both conditional arm risks are strictly interior. Under the stated assumptions.

Formal statement
a :
x :
conclusion 1
0 < armRisk P a x
conclusion 2
armRisk P a x < 1
Proof (Lean source)
-- @node: armRisk_interior lemma armRisk_interior (P : ObservedLaw) (a : Bool) (x : Covariate) : 0 < armRisk P a x ∧ armRisk P a x < 1 := by have h0 := (P.interior_cells a false x).1 have h1 := (P.interior_cells a true x).1 unfold armRisk constructor · exact div_pos h1 (add_pos h0 h1) · exact (div_lt_one (add_pos h0 h1)).2 (by linarith)
CausalSmith.Stat.LogoddsLowsmoothFrontier.armRisk_interior · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:15
theorem cellProbability_eq_cells

The Bernoulli factorization recovers each of the original four cells. Under the stated assumptions.

Formal statement
a y :
x :
cellProbability P a y x = P.cells a y x
Proof (Lean source)
-- @node: cellProbability_eq_cells lemma cellProbability_eq_cells (P : ObservedLaw) (a y : Bool) (x : Covariate) : cellProbability P a y x = P.cells a y x := by have hn := P.normalized_cells x simp only [Fintype.sum_bool] at hn have h0 : P.cells false false x + P.cells false true x ≠ 0 := ne_of_gt (add_pos (P.interior_cells false false x).1 (P.interior_cells false true x).1) have h1 : P.cells true false x + P.cells true true x ≠ 0 := ne_of_gt (add_pos (P.interior_cells true false x).1 (P.interior_cells true true x).1) have hc : 1 - (P.cells true false x + P.cells true true x) = P.cells false false x + P.cells false true x := by linarith cases a <;> cases y <;> simp only [cellProbability, propensity, armRisk, Bool.false_eq_true, ↓reduceIte] all_goals try rw [hc] all_goals field_simp all_goals ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.cellProbability_eq_cells · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:26
theorem marginalMean_eq_cells

The conditional outcome mean is the sum of the two outcome-one cells. Under the stated assumptions.

Formal statement
marginalMean P x = P.cells false true x + P.cells true true x
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.marginalMean_eq_cells · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:46
theorem conditional_covariance_eq_determinant

Expanding the two margins yields the determinant of the binary table. Under the stated assumptions.

Formal statement
P.cells true true x - propensity P x * marginalMean P x
= P.cells true true x * P.cells false false x
- P.cells true false x * P.cells false true x
Proof (Lean source)
-- @node: conditional_covariance_eq_determinant lemma conditional_covariance_eq_determinant (P : ObservedLaw) (x : Covariate) : P.cells true true x - propensity P x * marginalMean P x = P.cells true true x * P.cells false false x - P.cells true false x * P.cells false true x := by have hn := P.normalized_cells x simp only [Fintype.sum_bool] at hn rw [marginalMean_eq_cells] unfold propensity have hc : P.cells false false x = 1 - P.cells true true x - P.cells true false x - P.cells false true x := by linarith rw [hc] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.conditional_covariance_eq_determinant · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:54

[Log odds invert the logistic map on every real argument. the stated conclusion holds.

Formal statement
t :
ℝ
logit (logistic t) = t
Proof (Lean source)
-- @node: logit_logistic lemma logit_logistic (t : ℝ) : logit (logistic t) = t := by have hs : logistic t / (1 - logistic t) = exp t := by unfold logistic rw [← Real.sigmoid_neg, ← Real.sigmoid_mul_rexp_neg] rw [mul_comm, div_mul_cancel_right₀ (ne_of_gt (Real.sigmoid_pos t))] simp [Real.exp_neg] rw [logit, hs, Real.log_exp]
CausalSmith.Stat.LogoddsLowsmoothFrontier.logit_logistic · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:70
theorem homogeneous_logit_difference

Homogeneity gives the same log-odds contrast at every covariate. Under the stated assumptions. The stated conclusion follows.

Formal statement
logit (armRisk P true x) - logit (armRisk P false x) = effect P
Proof (Lean source)
-- @node: homogeneous_logit_difference lemma homogeneous_logit_difference (P : ObservedLaw) (h : HomogeneousLogit P) (x : Covariate) : logit (armRisk P true x) - logit (armRisk P false x) = effect P := by rw [h x, logit_logistic] change logit (armRisk P false x) + effect P - logit (armRisk P false x) = effect P ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.homogeneous_logit_difference · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:80
theorem homogeneous_cell_odds

Homogeneous log odds give the four-cell odds-ratio identity pointwise. Under the stated assumptions.

Formal statement
P.cells true true x * P.cells false false x
= exp (effect P) * (P.cells true false x * P.cells false true x)
Proof (Lean source)
-- @node: homogeneous_cell_odds lemma homogeneous_cell_odds (P : ObservedLaw) (h : HomogeneousLogit P) (x : Covariate) : P.cells true true x * P.cells false false x = exp (effect P) * (P.cells true false x * P.cells false true x) := by have h0 := armRisk_interior P false x have h1 := armRisk_interior P true x have he : exp (effect P) = (armRisk P true x / (1-armRisk P true x)) / (armRisk P false x / (1-armRisk P false x)) := by rw [← homogeneous_logit_difference P h x, logit, logit, Real.exp_sub, Real.exp_log (div_pos h1.1 (sub_pos.mpr h1.2)), Real.exp_log (div_pos h0.1 (sub_pos.mpr h0.2))] rw [← cellProbability_eq_cells P true true x, ← cellProbability_eq_cells P false false x, ← cellProbability_eq_cells P true false x, ← cellProbability_eq_cells P false true x, he] simp only [cellProbability, Bool.false_eq_true, ↓reduceIte] field_simp [ne_of_gt h0.1, ne_of_gt (sub_pos.mpr h0.2), ne_of_gt (sub_pos.mpr h1.2)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.homogeneous_cell_odds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:89
theorem effect_eq_log_of_coordinates

Division by the positive denominator recovers the scalar effect. Under the stated assumptions. Under the stated assumptions.

Formal statement
Proof (Lean source)
-- @node: effect_eq_log_of_coordinates lemma effect_eq_log_of_coordinates (P : ObservedLaw) (hC : covarianceCoordinate P = (exp (effect P) - 1) * denominatorCoordinate P) (hS : denominatorFloor ≤ denominatorCoordinate P) : effect P = log (1+covarianceCoordinate P/denominatorCoordinate P) := by have hs : denominatorCoordinate P ≠ 0 := by have hf : 0 < denominatorFloor := by norm_num [denominatorFloor] exact ne_of_gt (lt_of_lt_of_le hf hS) rw [hC, mul_div_cancel_right₀ _ hs] simp only [add_sub_cancel] exact (Real.log_exp (effect P)).symm
CausalSmith.Stat.LogoddsLowsmoothFrontier.effect_eq_log_of_coordinates · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:111
theorem observedMap_consistency Lemma observedMap_consistency in the paper ↗

[The observed outcome obeys literal potential-outcome consistency. the stated conclusion holds.

Formal statement
= (1-(if o.2 then 1 else 0 : ℝ))*potentialControl o
+ (if o.2 then 1 else 0 : ℝ)*potentialTreated o
Proof (Lean source)
-- @node: observedMap_consistency lemma observedMap_consistency (o : FullRecord) : outcome (observedMap o) = (1-(if o.2 then 1 else 0 : ℝ))*potentialControl o + (if o.2 then 1 else 0 : ℝ)*potentialTreated o := by rcases o with ⟨⟨x, y0, y1⟩, a⟩ cases a <;> simp [outcome, observedMap, potentialControl, potentialTreated]
CausalSmith.Stat.LogoddsLowsmoothFrontier.observedMap_consistency · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:125
theorem fullConditionalLaw_independent

Conditional treatment is independent of the potential-outcome pair. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
Proof (Lean source)
-- @node: fullConditionalLaw_independent lemma fullConditionalLaw_independent (P : ObservedLaw) (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ) (x : Covariate) : IndepFun fst snd (fullConditionalLaw P Γ x) := by let : IsMarkovKernel Γ := hΓ.1 let : IsProbabilityMeasure (bernoulliLaw (propensity P x)) := bernoulliLaw_probability _ (propensity_interior P x).1.le (propensity_interior P x).2.le exact indepFun_prod measurable_id measurable_id
CausalSmith.Stat.LogoddsLowsmoothFrontier.fullConditionalLaw_independent · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:134

A Bernoulli law has its parameter as the binary expectation. Under the stated assumptions.

Formal statement
p :
ℝ
hp :
0 ≤ p
(∫ b : Bool, (if b then 1 else 0 : ℝ) ∂bernoulliLaw p) = p
Proof (Lean source)
-- @node: bernoulliLaw_mean lemma bernoulliLaw_mean (p : ℝ) (hp : 0 ≤ p) : (∫ b : Bool, (if b then 1 else 0 : ℝ) ∂bernoulliLaw p) = p := by unfold bernoulliLaw rw [integral_add_measure (Integrable.of_finite.smul_measure ENNReal.ofReal_ne_top) (Integrable.of_finite.smul_measure ENNReal.ofReal_ne_top)] simp [integral_smul_measure, ENNReal.toReal_ofReal hp]
CausalSmith.Stat.LogoddsLowsmoothFrontier.bernoulliLaw_mean · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:145
theorem admissibleCoupling_means

Admissible coupling margins give the two potential-outcome means. Under the stated assumptions.

Formal statement
conclusion 1
(∫ b, (if b.1 then 1 else 0 : ℝ) ∂Γ x) = armRisk P false x
conclusion 2
(∫ b, (if b.2 then 1 else 0 : ℝ) ∂Γ x) = armRisk P true x
Proof (Lean source)
-- @node: admissibleCoupling_means lemma admissibleCoupling_means (P : ObservedLaw) (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ) (x : Covariate) : (∫ b, (if b.1 then 1 else 0 : ℝ) ∂Γ x) = armRisk P false x ∧ (∫ b, (if b.2 then 1 else 0 : ℝ) ∂Γ x) = armRisk P true x := by have hm : Measurable (fun b : Bool => (if b then 1 else 0 : ℝ)) := by fun_prop constructor · rw [← integral_map measurable_fst.aemeasurable hm.aestronglyMeasurable, (hΓ.2 x).1] exact bernoulliLaw_mean _ (armRisk_interior P false x).1.le · rw [← integral_map measurable_snd.aemeasurable hm.aestronglyMeasurable, (hΓ.2 x).2] exact bernoulliLaw_mean _ (armRisk_interior P true x).1.le
CausalSmith.Stat.LogoddsLowsmoothFrontier.admissibleCoupling_means · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:155
theorem integral_observed_cells

Continuous marks integrate against the explicit conditional cell disintegration. Under the stated assumptions.

Formal statement
hU :
f :
Record → ℝ
hf :
(∫ o, f o ∂P.measure) = ∑ a : Bool, ∑ y : Bool, ∫ x, P.cells a y x * f (x,a,y) ∂uniformLaw
Proof (Lean source)
-- @node: integral_observed_cells lemma integral_observed_cells (P : ObservedLaw) (hU : UniformDesign P) (f : Record → ℝ) (hf : Continuous f) : (∫ o, f o ∂P.measure) = ∑ a : Bool, ∑ y : Bool, ∫ x, P.cells a y x * f (x,a,y) ∂uniformLaw := by have hm (a y : Bool) : Measurable (fun x => ofReal (P.cells a y x)) := ENNReal.measurable_ofReal.comp (P.continuous_cells a y).measurable have hi (a y : Bool) : Integrable f (Measure.map (fun x : Covariate => (x,a,y)) (uniformLaw.withDensity (fun x => ofReal (P.cells a y x)))) := by apply (integrable_map_measure hf.aestronglyMeasurable (by fun_prop)).2 apply (integrable_withDensity_iff_integrable_smul' (hm a y) (Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))).2 simp only [ENNReal.toReal_ofReal (P.interior_cells a y _).1.le, smul_eq_mul] exact ((P.continuous_cells a y).mul (hf.comp (by fun_prop))).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) rw [P.disintegration, hU] unfold jointLaw rw [integral_finsetSum_measure] · apply Finset.sum_congr rfl intro a ha rw [integral_finsetSum_measure (fun y _ => hi a y)] apply Finset.sum_congr rfl intro y hy rw [integral_map (by fun_prop) hf.aestronglyMeasurable, integral_withDensity_eq_integral_toReal_smul (hm a y) (Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))] simp only [ENNReal.toReal_ofReal (P.interior_cells a y _).1.le, smul_eq_mul] · intro a ha exact integrable_finsetSum_measure.2 (fun y _ => hi a y)
CausalSmith.Stat.LogoddsLowsmoothFrontier.integral_observed_cells · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:171
theorem treatment_outcome_mean

The treatment-outcome product has conditional expectation equal to the (1,1) cell. Under the stated assumptions.

Formal statement
(∫ o, treatment o * outcome o ∂P.measure) = ∫ x, P.cells true true x ∂uniformLaw
Proof (Lean source)
-- @node: treatment_outcome_mean lemma treatment_outcome_mean (P : ObservedLaw) (hU : UniformDesign P) : (∫ o, treatment o * outcome o ∂P.measure) = ∫ x, P.cells true true x ∂uniformLaw := by have hb : Continuous (fun b : Bool => (if b then 1 else 0 : ℝ)) := continuous_of_discreteTopology have ht : Continuous treatment := hb.comp (continuous_snd.fst) have hy : Continuous outcome := hb.comp (continuous_snd.snd) rw [integral_observed_cells P hU (fun o => treatment o * outcome o) (ht.mul hy)] simp [Fintype.sum_bool, treatment, outcome]
CausalSmith.Stat.LogoddsLowsmoothFrontier.treatment_outcome_mean · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:203
theorem covarianceCoordinate_eq_odds

Integrating the homogeneous determinant identity gives the observable covariance coordinate. Under the stated assumptions.

Formal statement
Proof (Lean source)
-- @node: covarianceCoordinate_eq_odds lemma covarianceCoordinate_eq_odds (P : ObservedLaw) (hU : UniformDesign P) (hH : HomogeneousLogit P) : covarianceCoordinate P = (exp (effect P)-1) * denominatorCoordinate P := by have he : Continuous (propensity P) := (P.continuous_cells true false).add (P.continuous_cells true true) have hm : Continuous (marginalMean P) := by rw [show marginalMean P = fun x => P.cells false true x + P.cells true true x from funext (marginalMean_eq_cells P)] exact (P.continuous_cells false true).add (P.continuous_cells true true) have hi : Integrable (fun x => propensity P x * marginalMean P x) uniformLaw := (he.mul hm).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hj : Integrable (P.cells true true) uniformLaw := (P.continuous_cells true true).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) unfold covarianceCoordinate denominatorCoordinate rw [treatment_outcome_mean P hU, ← integral_sub hj hi, ← integral_const_mul] apply integral_congr_ae filter_upwards [] with x rw [conditional_covariance_eq_determinant, homogeneous_cell_odds P hH, cellProbability_eq_cells, cellProbability_eq_cells] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.covarianceCoordinate_eq_odds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:214

Logistic and log odds are inverse at interior probabilities. Under the stated assumptions.

Formal statement
p :
ℝ
hp :
0 < p
hp1 :
p < 1
logistic (logit p) = p
Proof (Lean source)
-- @node: logistic_logit lemma logistic_logit (p : ℝ) (hp : 0 < p) (hp1 : p < 1) : logistic (logit p) = p := by rw [logistic, Real.sigmoid_def, logit, Real.exp_neg, Real.exp_log (div_pos hp (sub_pos.mpr hp1))] field_simp <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.logistic_logit · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:238
theorem logistic_envelope_endpoints Lemma logistic_envelope_endpoints in the paper ↗

[Numerical exponential bounds certify the two envelope endpoint values. the stated conclusion holds.

Formal statement
conclusion 1
(4/15 : ℝ) ≤ logistic (-1)
conclusion 2
(2/11 : ℝ) ≤ logistic (-(3/2))
Proof (Lean source)
-- @node: logistic_envelope_endpoints lemma logistic_envelope_endpoints : (4/15 : ℝ) ≤ logistic (-1) ∧ (2/11 : ℝ) ≤ logistic (-(3/2)) := by have h1 : exp 1 < (11/4 : ℝ) := lt_trans Real.exp_one_lt_d9 (by norm_num) have h15 : exp (3/2 : ℝ) < (9/2 : ℝ) := by have he : exp (3/2 : ℝ) ^ 2 = exp 1 ^ 3 := by rw [← Real.exp_nat_mul, ← Real.exp_nat_mul] norm_num have hb : exp 1 < (2719/1000 : ℝ) := lt_trans Real.exp_one_lt_d9 (by norm_num) have hc := pow_lt_pow_left₀ hb (Real.exp_pos 1).le (by norm_num : 3 ≠ 0) nlinarith [Real.exp_pos (3/2 : ℝ)] simp only [logistic, Real.sigmoid_def, neg_neg] constructor · rw [inv_eq_one_div] apply (le_div_iff₀ (by positivity)).2 linarith · rw [inv_eq_one_div] apply (le_div_iff₀ (by positivity)).2 linarith
CausalSmith.Stat.LogoddsLowsmoothFrontier.logistic_envelope_endpoints · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:247
theorem model_bernoulli_factors_lower

The native logit envelopes bound all four Bernoulli factors away from zero. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
α β :
ℝ
hP :
Model α β P
x :
conclusion 1
(4/15 : ℝ) ≤ propensity P x
conclusion 2
(4/15 : ℝ) ≤ 1-propensity P x
conclusion 3
(2/11 : ℝ) ≤ armRisk P false x
conclusion 4
(2/11 : ℝ) ≤ 1-armRisk P true x
Proof (Lean source)
-- @node: model_bernoulli_factors_lower lemma model_bernoulli_factors_lower (α β : ℝ) (P : ObservedLaw) (hP : Model α β P) (x : Covariate) : (4/15 : ℝ) ≤ propensity P x ∧ (4/15 : ℝ) ≤ 1-propensity P x ∧ (2/11 : ℝ) ≤ armRisk P false x ∧ (2/11 : ℝ) ≤ 1-armRisk P true x := by have he := abs_le.mp (hP.propensity_envelope x) have hn := abs_le.mp (hP.prognosis_envelope x) have ht := abs_le.mp hP.effect_envelope have ep := propensity_interior P x have mp := armRisk_interior P false x have hr : logistic (propensityLogit P x) = propensity P x := logistic_logit _ ep.1 ep.2 have hm : logistic (prognosisLogit P x) = armRisk P false x := logistic_logit _ mp.1 mp.2 have hneg (t : ℝ) : logistic (-t) = 1-logistic t := Real.sigmoid_neg t refine ⟨?_, ?_, ?_, ?_⟩ · exact logistic_envelope_endpoints.1.trans (hr ▸ Real.sigmoid_le he.1) · rw [← hr, ← hneg] exact logistic_envelope_endpoints.1.trans (Real.sigmoid_le (by linarith)) · have hl : (4/15 : ℝ) ≤ logistic (prognosisLogit P x) := logistic_envelope_endpoints.1.trans (Real.sigmoid_le hn.1) rw [hm] at hl linarith · rw [hP.homogeneous x, ← hneg] exact logistic_envelope_endpoints.2.trans (Real.sigmoid_le (by linarith))
CausalSmith.Stat.LogoddsLowsmoothFrontier.model_bernoulli_factors_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:269
theorem model_cell_product_lower

The off-diagonal product exceeds the public numerical denominator floor pointwise. Under the stated assumptions.

Formal statement
α β :
ℝ
hP :
Model α β P
x :
denominatorFloor ≤ cellProbability P true false x * cellProbability P false true x
Proof (Lean source)
-- @node: model_cell_product_lower lemma model_cell_product_lower (α β : ℝ) (P : ObservedLaw) (hP : Model α β P) (x : Covariate) : denominatorFloor ≤ cellProbability P true false x * cellProbability P false true x := by obtain ⟨he, he', hm, ht⟩ := model_bernoulli_factors_lower α β P hP x have hl : (4/15 : ℝ)*(2/11)*(4/15)*(2/11) ≤ propensity P x * (1-armRisk P true x) * (1-propensity P x) * armRisk P false x := by gcongr <;> linarith simp only [cellProbability, Bool.false_eq_true, ↓reduceIte] unfold denominatorFloor nlinarith [hl]
CausalSmith.Stat.LogoddsLowsmoothFrontier.model_cell_product_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:296
theorem denominatorCoordinate_lower

Integration of the pointwise floor under the known uniform probability design. Under the stated assumptions.

Formal statement
α β :
ℝ
hP :
Model α β P
Proof (Lean source)
-- @node: denominatorCoordinate_lower lemma denominatorCoordinate_lower (α β : ℝ) (P : ObservedLaw) (hP : Model α β P) : denominatorFloor ≤ denominatorCoordinate P := by letI : IsProbabilityMeasure uniformLaw := hP.uniform ▸ Measure.isProbabilityMeasure_map (by unfold covariate; fun_prop : Measurable covariate).aemeasurable have hi : Integrable (fun x => P.cells true false x * P.cells false true x) uniformLaw := ((P.continuous_cells true false).mul (P.continuous_cells false true)).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) have hj : Integrable (fun x => cellProbability P true false x * cellProbability P false true x) uniformLaw := by simpa only [cellProbability_eq_cells] using hi have hl := integral_mono (integrable_const denominatorFloor) hj (model_cell_product_lower α β P hP) simpa [denominatorCoordinate] using hl
CausalSmith.Stat.LogoddsLowsmoothFrontier.denominatorCoordinate_lower · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:309

Integrating a binary test function against the explicit Bernoulli law. Under the stated assumptions.

Formal statement
p :
ℝ
f :
Bool → ℝ≥0∞
(∫⁻ b, f b ∂bernoulliLaw p) = ofReal (1-p) * f false + ofReal p * f true
Proof (Lean source)
-- @node: lintegral_bernoulliLaw lemma lintegral_bernoulliLaw (p : ℝ) (f : Bool → ℝ≥0∞) : (∫⁻ b, f b ∂bernoulliLaw p) = ofReal (1-p) * f false + ofReal p * f true := by simp [bernoulliLaw, lintegral_add_measure, lintegral_smul_measure]
CausalSmith.Stat.LogoddsLowsmoothFrontier.lintegral_bernoulliLaw · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:325
theorem lintegral_coupling_arm

Coupling margins determine every nonnegative test of either potential outcome. Under the stated assumptions.

Formal statement
hΓ :
x :
a :
f :
Bool → ℝ≥0∞
(∫⁻ b, f (if a then b.2 else b.1) ∂Γ x)
= ofReal (1-armRisk P a x) * f false + ofReal (armRisk P a x) * f true
Proof (Lean source)
-- @node: lintegral_coupling_arm lemma lintegral_coupling_arm (P : ObservedLaw) (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ) (x : Covariate) (a : Bool) (f : Bool → ℝ≥0∞) : (∫⁻ b, f (if a then b.2 else b.1) ∂Γ x) = ofReal (1-armRisk P a x) * f false + ofReal (armRisk P a x) * f true := by have hf : Measurable f := by fun_prop cases a · rw [show (fun b : Bool × Bool => f (if false then b.2 else b.1)) = (fun b => f b.1) from rfl, ← lintegral_map hf measurable_fst, (hΓ.2 x).1, lintegral_bernoulliLaw] · rw [show (fun b : Bool × Bool => f (if true then b.2 else b.1)) = (fun b => f b.2) from rfl, ← lintegral_map hf measurable_snd, (hΓ.2 x).2, lintegral_bernoulliLaw]
CausalSmith.Stat.LogoddsLowsmoothFrontier.lintegral_coupling_arm · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:332
theorem lintegral_conditional_observation

The conditional observation test recovers the four original cells. Under the stated assumptions.

Formal statement
hΓ :
x :
f :
Bool → Bool → ℝ≥0∞
(∫⁻ b, ∫⁻ a, f a (if a then b.2 else b.1) ∂bernoulliLaw (propensity P x) ∂Γ x)
= ∑ a : Bool, ∑ y : Bool, ofReal (P.cells a y x) * f a y
Proof (Lean source)
-- @node: lintegral_conditional_observation lemma lintegral_conditional_observation (P : ObservedLaw) (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ) (x : Covariate) (f : Bool → Bool → ℝ≥0∞) : (∫⁻ b, ∫⁻ a, f a (if a then b.2 else b.1) ∂bernoulliLaw (propensity P x) ∂Γ x) = ∑ a : Bool, ∑ y : Bool, ofReal (P.cells a y x) * f a y := by simp_rw [lintegral_bernoulliLaw] rw [lintegral_add_left (by fun_prop), lintegral_const_mul _ (by fun_prop), lintegral_const_mul _ (by fun_prop)] have h0 := lintegral_coupling_arm P Γ hΓ x false (f false) have h1 := lintegral_coupling_arm P Γ hΓ x true (f true) simp only [Bool.false_eq_true, ↓reduceIte] at h0 h1 ⊢ rw [h0, h1] simp only [Fintype.sum_bool, mul_add, ← mul_assoc, ← ENNReal.ofReal_mul (propensity_interior P x).1.le, ← ENNReal.ofReal_mul (sub_nonneg.mpr (propensity_interior P x).2.le)] simp only [← cellProbability_eq_cells, cellProbability, Bool.false_eq_true, ↓reduceIte] ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.lintegral_conditional_observation · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:349
theorem lintegral_jointLaw_cells

The conditional cell construction integrates any nonnegative measurable test. Under the stated assumptions.

Formal statement
f :
Record → ℝ≥0∞
hf :
(∫⁻ o, f o ∂jointLaw uniformLaw P.cells)
= ∫⁻ x, ∑ a : Bool, ∑ y : Bool, ofReal (P.cells a y x) * f (x,a,y) ∂uniformLaw
Proof (Lean source)
-- @node: lintegral_jointLaw_cells lemma lintegral_jointLaw_cells (P : ObservedLaw) (f : Record → ℝ≥0∞) (hf : Measurable f) : (∫⁻ o, f o ∂jointLaw uniformLaw P.cells) = ∫⁻ x, ∑ a : Bool, ∑ y : Bool, ofReal (P.cells a y x) * f (x,a,y) ∂uniformLaw := by have hm (a y : Bool) : Measurable (fun x => ofReal (P.cells a y x)) := ENNReal.measurable_ofReal.comp (P.continuous_cells a y).measurable have hi (a y : Bool) : Measurable (fun x : Covariate => f (x,a,y)) := by fun_prop calc _ = ∑ a : Bool, ∑ y : Bool, ∫⁻ x, ofReal (P.cells a y x) * f (x,a,y) ∂uniformLaw := by simp only [jointLaw, lintegral_finsetSum_measure] apply Finset.sum_congr rfl intro a ha apply Finset.sum_congr rfl intro y hy rw [lintegral_map hf (by fun_prop : Measurable (fun x : Covariate => (x,a,y))), lintegral_withDensity_eq_lintegral_mul _ (hm a y) (hi a y)] rfl _ = _ := by rw [lintegral_finset_sum] · apply Finset.sum_congr rfl intro a ha rw [lintegral_finset_sum] exact fun y _ => (hm a y).mul (hi a y) · intro a ha exact Finset.measurable_sum _ (fun y _ => (hm a y).mul (hi a y))
CausalSmith.Stat.LogoddsLowsmoothFrontier.lintegral_jointLaw_cells · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:370
theorem causalExtension_observed_marginal

The full-data extension has precisely the original observed marginal. Under the stated assumptions.

Formal statement
Measure.map observedMap (causalExtension P Γ) = P.measure
Proof (Lean source)
-- @node: causalExtension_observed_marginal lemma causalExtension_observed_marginal (P : ObservedLaw) (hU : UniformDesign P) (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ) : Measure.map observedMap (causalExtension P Γ) = P.measure := by letI : IsMarkovKernel Γ := hΓ.1 letI : IsMarkovKernel (treatmentKernel P) := ⟨fun z => bernoulliLaw_probability _ (propensity_interior P z.1).1.le (propensity_interior P z.1).2.le⟩ have ho : Measurable observedMap := by unfold observedMap apply prodMk (by fun_prop) apply prodMk (by fun_prop) exact Measurable.ite (measurable_snd (measurableSet_singleton true)) (by fun_prop) (by fun_prop) apply Measure.ext_of_lintegral intro f hf rw [lintegral_map hf ho, causalExtension, Measure.lintegral_compProd (show Measurable (fun o => f (observedMap o)) from hf.comp ho), Measure.lintegral_compProd] · change (∫⁻ x, ∫⁻ b, ∫⁻ a, f (x,a,if a then b.2 else b.1) ∂bernoulliLaw (propensity P x) ∂Γ x ∂uniformLaw) = _ rw [P.disintegration, hU, lintegral_jointLaw_cells P f hf] exact lintegral_congr (fun x => lintegral_conditional_observation P Γ hΓ x (fun a y => f (x,a,y))) · exact (hf.comp ho).lintegral_kernel_prod_right'
CausalSmith.Stat.LogoddsLowsmoothFrontier.causalExtension_observed_marginal · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:400
theorem observable_odds

On the public exponent domain 0 < β < 1/4 and β < α ≤ 1, each model law has the observable odds identity, denominator floor, and causal interpretation. The full conditional laws disintegrate the causal extension by the canonical reassociation from X × ((Y⁰, Y¹) × A) to (X × (Y⁰, Y¹)) × A. the documented result Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
α β :
ℝ
hD :
hP :
Model α β P
conclusion 1
conclusion 3
conclusion 4
Measure.map observedMap (causalExtension P Γ) = P.measure
= (1-(if o.2 then 1 else 0 : ℝ))*potentialControl o
+ (if o.2 then 1 else 0 : ℝ)*potentialTreated o
causalExtension P Γ = (uniformLaw.compProd Γ).compProd (treatmentKernel P)
x :
logit (∫ b, (if b.2 then 1 else 0 : ℝ) ∂Γ x)
- logit (∫ b, (if b.1 then 1 else 0 : ℝ) ∂Γ x)
= effect P
= Measure.map (fun z : Covariate × ((Bool × Bool) × Bool) => ((z.1, z.2.1), z.2.2)) (uniformLaw.compProd ({ toFun := fullConditionalLaw P Γ measurable' := fullConditionalLaw_measurable P Γ hΓ } : Kernel Covariate ((Bool × Bool) × Bool)))
Proof (Lean source)
lemma observable_odds (α β : ℝ) (hD : ExponentDomain α β) (P : ObservedLaw) (hP : Model α β P) : covarianceCoordinate P = (exp (effect P) - 1) * denominatorCoordinate P ∧ denominatorFloor ≤ denominatorCoordinate P ∧ effect P = log (1+covarianceCoordinate P/denominatorCoordinate P) ∧ ∀ (Γ : Kernel Covariate (Bool × Bool)) (hΓ : AdmissibleCoupling P Γ), Measure.map observedMap (causalExtension P Γ) = P.measure ∧ (∀ o : FullRecord, outcome (observedMap o) = (1-(if o.2 then 1 else 0 : ℝ))*potentialControl o + (if o.2 then 1 else 0 : ℝ)*potentialTreated o) ∧ (causalExtension P Γ = (uniformLaw.compProd Γ).compProd (treatmentKernel P) ∧ ∀ x, IndepFun fst snd (fullConditionalLaw P Γ x)) ∧ (∀ x, logit (∫ b, (if b.2 then 1 else 0 : ℝ) ∂Γ x) - logit (∫ b, (if b.1 then 1 else 0 : ℝ) ∂Γ x) = effect P) ∧ causalExtension P Γ = Measure.map (fun z : Covariate × ((Bool × Bool) × Bool) => ((z.1, z.2.1), z.2.2)) (uniformLaw.compProd ({ toFun := fullConditionalLaw P Γ measurable' := fullConditionalLaw_measurable P Γ hΓ } : Kernel Covariate ((Bool × Bool) × Bool))) := by have hC : covarianceCoordinate P = (exp (effect P) - 1) * denominatorCoordinate P := by exact covarianceCoordinate_eq_odds P hP.uniform hP.homogeneous have hS : denominatorFloor ≤ denominatorCoordinate P := by exact denominatorCoordinate_lower α β P hP refine ⟨hC, hS, effect_eq_log_of_coordinates P hC hS, ?_⟩ intro Γ hΓ have hconditional : causalExtension P Γ = Measure.map (fun z : Covariate × ((Bool × Bool) × Bool) => ((z.1, z.2.1), z.2.2)) (uniformLaw.compProd ({ toFun := fullConditionalLaw P Γ measurable' := fullConditionalLaw_measurable P Γ hΓ } : Kernel Covariate ((Bool × Bool) × Bool))) := by have hk : ({ toFun := fullConditionalLaw P Γ measurable' := fullConditionalLaw_measurable P Γ hΓ } : Kernel Covariate ((Bool × Bool) × Bool)) = Γ ⊗ₖ treatmentKernel P := by ext x : 1 exact fullConditionalLaw_eq_compProd P Γ hΓ x rw [hk] exact (Measure.compProd_assoc (μ := uniformLaw) (κ := Γ) (η := treatmentKernel P)).symm refine ⟨?_, observedMap_consistency, ?_, ?_, hconditional⟩ · exact causalExtension_observed_marginal P hP.uniform Γ hΓ · exact ⟨rfl, fullConditionalLaw_independent P Γ hΓ⟩ · intro x rw [(admissibleCoupling_means P Γ hΓ x).1, (admissibleCoupling_means P Γ hΓ x).2] exact homogeneous_logit_difference P hP.homogeneous x
CausalSmith.Stat.LogoddsLowsmoothFrontier.observable_odds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ObservableOdds.lean:428
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_OriginalRecordMixtures 22 declarations Paper-owned scaffold obligations; proofs are filled in Stage 3.

T OriginalRecordMixtures

Paper-owned scaffold obligations; proofs are filled in Stage 3.

def signComponentWeight

[Non-singleton occupancy weight of a sign block; the unused-sign block has no records and contributes zero.

Definition (Lean source)
n :
ℕ
k :
ℕ
x :
B :
ℝ
signComponentWeight k x B c :
ℝ
match c with | none
=> 0 | some v => if 2 ≤ v.supp.toFinset.card then (v.supp.toFinset.card : ℝ)^4 * B^v.supp.toFinset.card else 0
CausalSmith.Stat.LogoddsLowsmoothFrontier.signComponentWeight · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:32
theorem signComponentWeight_eq_zero_of_small

The occupancy weight vanishes exactly on the empty and singleton record fibers. Their Hellinger contribution must be canceled rather than bounded crudely. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
x :
B :
ℝ
hcard :
≤ 1
Proof (Lean source)
-- @node: signComponentWeight_eq_zero_of_small lemma signComponentWeight_eq_zero_of_small {n : ℕ} (k : ℕ) (x : Fin n → Covariate) (B : ℝ) (c : SignComponentBlock k x) (hcard : card {i : Fin n // some ((originalRecordSignGraph k x).connectedComponentMk i) = c} ≤ 1) : signComponentWeight k x B c = 0 := by rw [signComponent_record_card] at hcard cases c with | none => rfl | some v => dsimp only at hcard simp only [signComponentWeight, if_neg (by omega : ¬2 ≤ v.supp.toFinset.card)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.signComponentWeight_eq_zero_of_small · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:42
theorem signComponentWeight_sum

[Adding the empty unused-sign block leaves the exact component occupancy sum unchanged, so singleton cancellation is retained. the documented result

Formal statement
n k :
ℕ
x :
B :
ℝ
Proof (Lean source)
-- @node: signComponentWeight_sum lemma signComponentWeight_sum (n k : ℕ) (x : Fin n → Covariate) (B : ℝ) : (∑ c : SignComponentBlock k x, signComponentWeight k x B c) = cellComponentWeight n k B x := by classical rw [cellComponentWeight_eq_components] let G := originalRecordSignGraph k x let : Fintype G.ConnectedComponent := Fintype.ofFinite _ have huniv : (Finset.univ : Finset (SignComponentBlock k x)) = Finset.insertNone (Finset.univ : Finset G.ConnectedComponent) := by ext c cases c <;> simp rw [huniv, Finset.sum_insertNone] simp only [signComponentWeight, zero_add] apply Finset.sum_congr · ext c; simp · intro c hc; rfl
CausalSmith.Stat.LogoddsLowsmoothFrontier.signComponentWeight_sum · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:57
theorem mixed_original_component_factorization

[The actual mixed conditional likelihood factors over the original-record sign graph, with every root and cell formula substituted. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
b :
η ζ :
ℝ
x :
a y :
Fin n → Bool
owner :
block :
cell :
fun i σ => 4*mixedCells b k σ η ζ (a i) (y i) (x i)
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ)
= ∏ c : SignComponentBlock k x, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ)
Proof (Lean source)
-- @node: mixed_original_component_factorization lemma mixed_original_component_factorization {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (b : Bool) (η ζ : ℝ) (x : Fin n → Covariate) (a y : Fin n → Bool) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) let cell := fun i σ => 4*mixedCells b k σ η ζ (a i) (y i) (x i) (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ) = ∏ c : SignComponentBlock k x, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ) := by apply recordCells_component_factorization k hk x intro i σ τ h rw [mixedCells_endpoint_congr b k σ τ η ζ (a i) (y i) (x i) h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_original_component_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:77
theorem fair_original_component_factorization

[The actual fair mixture and comparator conditional likelihoods factor over that same graph, uniformly through zero amplitudes and effects. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
b :
t δ :
ℝ
x :
a y :
Fin n → Bool
owner :
block :
cell :
fun i σ => 4*fairCells b k σ t δ (a i) (y i) (x i)
(card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ)
= ∏ c : SignComponentBlock k x, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ)
Proof (Lean source)
-- @node: fair_original_component_factorization lemma fair_original_component_factorization {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (b : Bool) (t δ : ℝ) (x : Fin n → Covariate) (a y : Fin n → Bool) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) let cell := fun i σ => 4*fairCells b k σ t δ (a i) (y i) (x i) (card (Fin (k+1) → Bool) : ℝ)⁻¹ * (∑ σ : Fin (k+1) → Bool, ∏ i : Fin n, cell i σ) = ∏ c : SignComponentBlock k x, (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i ∈ Finset.univ.filter (fun i => block i = c), cell i (componentSignExtension owner c σ) := by apply recordCells_component_factorization k hk x intro i σ τ h rw [fairCells_endpoint_congr b k σ τ t δ (a i) (y i) (x i) h]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_original_component_factorization · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:96
theorem mixed_conditional_label_hellinger_le_components

[Tensorization applies to the actual mixed laws conditional on every original covariate, with labels regrouped only along latent-sign components. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
x :
owner :
block :
(∑ l : Fin n → Bool × Bool, (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (mixedLaw false k σ η ζ).cells (l i).1 (l i).2 (x i)) - sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (mixedLaw true k σ η ζ).cells (l i).1 (l i).2 (x i))) ^ 2)
≤ ∑ c : SignComponentBlock k x, ∑ l, (sqrt (conditionalComponentLabelMass owner block (fun σ => mixedLaw false k σ η ζ) x c l) - sqrt (conditionalComponentLabelMass owner block (fun σ => mixedLaw true k σ η ζ) x c l)) ^ 2
Proof (Lean source)
-- @node: mixed_conditional_label_hellinger_le_components lemma mixed_conditional_label_hellinger_le_components {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) (x : Fin n → Covariate) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (∑ l : Fin n → Bool × Bool, (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (mixedLaw false k σ η ζ).cells (l i).1 (l i).2 (x i)) - sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (mixedLaw true k σ η ζ).cells (l i).1 (l i).2 (x i))) ^ 2) ≤ ∑ c : SignComponentBlock k x, ∑ l, (sqrt (conditionalComponentLabelMass owner block (fun σ => mixedLaw false k σ η ζ) x c l) - sqrt (conditionalComponentLabelMass owner block (fun σ => mixedLaw true k σ η ζ) x c l)) ^ 2 := by have hvalid (b : Bool) (σ : Fin (k+1) → Bool) : ValidCells (mixedCells b k σ η ζ) := ((calib_constants_spec.2.2.2 k hk σ).1 η ζ hη hζ b).1 apply original_conditional_label_hellinger_le_components all_goals intro i σ τ hsign a y simp only [mixedLaw, totalCellLaw, dif_pos (hvalid _ _), lawFromCells] apply mixedCells_endpoint_congr intro j hj unfold endpointSign rw [hsign _ (signComponentOwner_incident k hk x i j hj)]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_conditional_label_hellinger_le_components · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:115
theorem fair_conditional_label_hellinger_le_components

[The fair mixture is tensorized against its deterministic comparator on exactly the same original covariate-dependent components. the documented result Under the stated assumptions.

Formal statement
n :
ℕ
k :
ℕ
hk :
1 ≤ k
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ calibEps
x :
owner :
block :
(∑ l : Fin n → Bool × Bool, (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (fairLaw k σ t δ).cells (l i).1 (l i).2 (x i)) - sqrt (∏ i, (fairComparator k t δ).cells (l i).1 (l i).2 (x i))) ^ 2)
≤ ∑ c : SignComponentBlock k x, ∑ l, (sqrt (conditionalComponentLabelMass owner block (fun σ => fairLaw k σ t δ) x c l) - sqrt (conditionalComponentLabelMass owner block (fun _ => fairComparator k t δ) x c l)) ^ 2
Proof (Lean source)
-- @node: fair_conditional_label_hellinger_le_components lemma fair_conditional_label_hellinger_le_components {n : ℕ} (k : ℕ) (hk : 1 ≤ k) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ calibEps) (x : Fin n → Covariate) : let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) (∑ l : Fin n → Bool × Bool, (sqrt ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i, (fairLaw k σ t δ).cells (l i).1 (l i).2 (x i)) - sqrt (∏ i, (fairComparator k t δ).cells (l i).1 (l i).2 (x i))) ^ 2) ≤ ∑ c : SignComponentBlock k x, ∑ l, (sqrt (conditionalComponentLabelMass owner block (fun σ => fairLaw k σ t δ) x c l) - sqrt (conditionalComponentLabelMass owner block (fun _ => fairComparator k t δ) x c l)) ^ 2 := by have hvalid (σ : Fin (k+1) → Bool) : ValidCells (fairCells true k σ t δ) := ((calib_constants_spec.2.2.2 k hk σ).2 t δ ht hδ true).1 have h := original_conditional_label_hellinger_le_components (signComponentOwner k x) (fun i => some ((originalRecordSignGraph k x).connectedComponentMk i)) (fun σ => fairLaw k σ t δ) (fun _ => fairComparator k t δ) x (by intro i σ τ hsign a y simp only [fairLaw, totalCellLaw, dif_pos (hvalid _), lawFromCells] apply fairCells_endpoint_congr intro j hj unfold endpointSign rw [hsign _ (signComponentOwner_incident k hk x i j hj)]) (by intro i σ τ hsign a y; rfl) simpa [Fintype.card_ne_zero] using h
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_conditional_label_hellinger_le_components · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:145
def sampleReference

[Common dominating reference for exactly n records.

Definition (Lean source)
n :
ℕ
sampleReference n :
CausalSmith.Stat.LogoddsLowsmoothFrontier.sampleReference · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:179
def originalRecordHellinger

Unhalved squared Hellinger distance, through the actual Radon--Nikodym densities.

Definition (Lean source)
n :
ℕ
Q Q' :
originalRecordHellinger n Q Q' :
ℝ
hellingerSqDensity (sampleReference n) (fun o => (Q.rnDeriv (sampleReference n) o).toReal) (fun o => (Q'.rnDeriv (sampleReference n) o).toReal)
CausalSmith.Stat.LogoddsLowsmoothFrontier.originalRecordHellinger · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:182
theorem originalRecordHellinger_self Lemma originalRecordHellinger_self in the paper ↗

Identical original-record measures have zero squared Hellinger distance. the stated conclusion holds.

Formal statement
n :
ℕ
Q :
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.originalRecordHellinger_self · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:187
theorem mixed_originalRecordHellinger_density

The mixed distance is exactly the integral of the actual finite-prior likelihoods. the stated conclusion holds.

Formal statement
n k :
ℕ
η ζ :
ℝ
Proof (Lean source)
-- @node: mixed_originalRecordHellinger_density lemma mixed_originalRecordHellinger_density (n k : ℕ) (η ζ : ℝ) : originalRecordHellinger n (mixedMixture false n k η ζ) (mixedMixture true n k η ζ) = hellingerSqDensity (sampleReference n) (signMixtureCellDensity n k (fun σ => mixedLaw false k σ η ζ)) (signMixtureCellDensity n k (fun σ => mixedLaw true k σ η ζ)) := by have h0 := finiteSignMixture_rnDeriv n k (fun σ => mixedLaw false k σ η ζ) (fun σ => totalCellLaw_uniform _) have h1 := finiteSignMixture_rnDeriv n k (fun σ => mixedLaw true k σ η ζ) (fun σ => totalCellLaw_uniform _) unfold originalRecordHellinger hellingerSqDensity apply integral_congr_ae filter_upwards [h0, h1] with o ho0 ho1 dsimp only [mixedMixture, fairMixture, sampleReference, iidLaw] at ho0 ho1 ⊢ rw [ho0, ho1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_originalRecordHellinger_density · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:192
theorem fair_originalRecordHellinger_density

The fair distance uses the averaged random likelihood and the actual iid comparator likelihood. the stated conclusion holds.

Formal statement
n k :
ℕ
t δ :
ℝ
Proof (Lean source)
-- @node: fair_originalRecordHellinger_density lemma fair_originalRecordHellinger_density (n k : ℕ) (t δ : ℝ) : originalRecordHellinger n (fairMixture n k t δ) (iidLaw (fairComparator k t δ).measure n) = hellingerSqDensity (sampleReference n) (signMixtureCellDensity n k (fun σ => fairLaw k σ t δ)) (sampleCellDensity n (fairComparator k t δ)) := by have h0 := finiteSignMixture_rnDeriv n k (fun σ => fairLaw k σ t δ) (fun σ => totalCellLaw_uniform _) have h1 := uniformObservedLaw_iid_rnDeriv n (fairComparator k t δ) (totalCellLaw_uniform _) unfold originalRecordHellinger hellingerSqDensity apply integral_congr_ae filter_upwards [h0, h1] with o ho0 ho1 dsimp only [mixedMixture, fairMixture, sampleReference, iidLaw] at ho0 ho1 ⊢ rw [ho0, ho1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_originalRecordHellinger_density · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:210
theorem mixed_originalRecordHellinger_conditional

The mixed full-sample distance integrates the conditional label distance against the common original covariate law, with no loss of observations. the documented result

Formal statement
n k :
ℕ
η ζ :
ℝ
= ∫ x, hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k (fun σ => mixedLaw false k σ η ζ) (fun i => (x i, l i))) (fun l => signMixtureCellDensity n k (fun σ => mixedLaw true k σ η ζ) (fun i => (x i, l i))) ∂Measure.pi (fun _ : Fin n => uniformLaw)
Proof (Lean source)
-- @node: mixed_originalRecordHellinger_conditional lemma mixed_originalRecordHellinger_conditional (n k : ℕ) (η ζ : ℝ) : originalRecordHellinger n (mixedMixture false n k η ζ) (mixedMixture true n k η ζ) = ∫ x, hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k (fun σ => mixedLaw false k σ η ζ) (fun i => (x i, l i))) (fun l => signMixtureCellDensity n k (fun σ => mixedLaw true k σ η ζ) (fun i => (x i, l i))) ∂Measure.pi (fun _ : Fin n => uniformLaw) := by rw [mixed_originalRecordHellinger_density] exact mixture_hellinger_conditional_integral n _ _ (signMixtureCellDensity_integrable n k _) (signMixtureCellDensity_integrable n k _) (signMixtureCellDensity_nonneg n k _) (signMixtureCellDensity_nonneg n k _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_originalRecordHellinger_conditional · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:229
theorem fair_originalRecordHellinger_conditional

The fair mixture and comparator also share exactly the original covariate marginal, so their distance is the integral of their conditional label distance. the documented result

Formal statement
n k :
ℕ
t δ :
ℝ
originalRecordHellinger n (fairMixture n k t δ) (iidLaw (fairComparator k t δ).measure n)
= ∫ x, hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k (fun σ => fairLaw k σ t δ) (fun i => (x i, l i))) (fun l => sampleCellDensity n (fairComparator k t δ) (fun i => (x i, l i))) ∂Measure.pi (fun _ : Fin n => uniformLaw)
Proof (Lean source)
-- @node: fair_originalRecordHellinger_conditional lemma fair_originalRecordHellinger_conditional (n k : ℕ) (t δ : ℝ) : originalRecordHellinger n (fairMixture n k t δ) (iidLaw (fairComparator k t δ).measure n) = ∫ x, hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k (fun σ => fairLaw k σ t δ) (fun i => (x i, l i))) (fun l => sampleCellDensity n (fairComparator k t δ) (fun i => (x i, l i))) ∂Measure.pi (fun _ : Fin n => uniformLaw) := by rw [fair_originalRecordHellinger_density] exact mixture_hellinger_conditional_integral n _ _ (signMixtureCellDensity_integrable n k _) (sampleCellDensity_integrable n _) (signMixtureCellDensity_nonneg n k _) (sampleCellDensity_nonneg n _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_originalRecordHellinger_conditional · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:244
theorem sampleCellDensity_one

A one-record likelihood is just the original record's four-cell density. the stated conclusion holds.

Formal statement
o :
Fin 1 → Record
Proof (Lean source)
CausalSmith.Stat.LogoddsLowsmoothFrontier.sampleCellDensity_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:260
theorem mixed_singleton_density_matching

Exact mixed singleton matching identifies the actual one-record mixture densities. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
k :
ℕ
hk :
1 ≤ k
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
signMixtureCellDensity 1 k (fun σ => mixedLaw false k σ η ζ)
= signMixtureCellDensity 1 k (fun σ => mixedLaw true k σ η ζ)
Proof (Lean source)
-- @node: mixed_singleton_density_matching lemma mixed_singleton_density_matching (k : ℕ) (hk : 1 ≤ k) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) : signMixtureCellDensity 1 k (fun σ => mixedLaw false k σ η ζ) = signMixtureCellDensity 1 k (fun σ => mixedLaw true k σ η ζ) := by funext o simp only [signMixtureCellDensity, sampleCellDensity_one, recordCellDensity, ← Finset.mul_sum] rw [(calib_singletons_spec k hk).1 η ζ hη hζ (o 0).2.1 (o 0).2.2 (o 0).1]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_singleton_density_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:266
theorem fair_singleton_density_matching

[Exact fair singleton matching identifies the actual one-record mixture with the comparator density, uniformly in the effect. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ calibEps
signMixtureCellDensity 1 k (fun σ => fairLaw k σ t δ)
Proof (Lean source)
-- @node: fair_singleton_density_matching lemma fair_singleton_density_matching (k : ℕ) (hk : 1 ≤ k) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ calibEps) : signMixtureCellDensity 1 k (fun σ => fairLaw k σ t δ) = sampleCellDensity 1 (fairComparator k t δ) := by funext o rw [signMixtureCellDensity_card_average] simp only [Fin.prod_univ_one, sampleCellDensity_one, recordCellDensity, ← Finset.mul_sum] have hmatch := (calib_singletons_spec k hk).2 t δ ht hδ (o 0).2.1 (o 0).2.2 (o 0).1 calc _ = 4 * ((card (Fin (k+1) → Bool) : ℝ)⁻¹ * ∑ σ, (fairLaw k σ t δ).cells (o 0).2.1 (o 0).2.2 (o 0).1) := by ring _ = _ := by rw [hmatch]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_singleton_density_matching · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:277
theorem mixed_originalRecordHellinger_one Lemma mixed_originalRecordHellinger_one in the paper ↗

With one original record the mixed Hellinger discrepancy vanishes exactly. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
η ζ :
ℝ
hη :
|η| ≤ calibEps
hζ :
|ζ| ≤ calibEps
Proof (Lean source)
-- @node: mixed_originalRecordHellinger_one lemma mixed_originalRecordHellinger_one (k : ℕ) (hk : 1 ≤ k) (η ζ : ℝ) (hη : |η| ≤ calibEps) (hζ : |ζ| ≤ calibEps) : originalRecordHellinger 1 (mixedMixture false 1 k η ζ) (mixedMixture true 1 k η ζ) = 0 := by rw [mixed_originalRecordHellinger_density, mixed_singleton_density_matching k hk η ζ hη hζ] simp [hellingerSqDensity]
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixed_originalRecordHellinger_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:295
theorem fair_originalRecordHellinger_one

With one original record the fair Hellinger discrepancy vanishes exactly. Under the stated assumptions. Under the stated assumptions.

Formal statement
k :
ℕ
hk :
1 ≤ k
t δ :
ℝ
ht :
t ∈ Icc (0 : ℝ) (1/4)
hδ :
|δ| ≤ calibEps
originalRecordHellinger 1 (fairMixture 1 k t δ) (iidLaw (fairComparator k t δ).measure 1)
= 0
Proof (Lean source)
-- @node: fair_originalRecordHellinger_one lemma fair_originalRecordHellinger_one (k : ℕ) (hk : 1 ≤ k) (t δ : ℝ) (ht : t ∈ Icc (0 : ℝ) (1/4)) (hδ : |δ| ≤ calibEps) : originalRecordHellinger 1 (fairMixture 1 k t δ) (iidLaw (fairComparator k t δ).measure 1) = 0 := by rw [fair_originalRecordHellinger_density, fair_singleton_density_matching k hk t δ ht hδ] simp [hellingerSqDensity]
CausalSmith.Stat.LogoddsLowsmoothFrontier.fair_originalRecordHellinger_one · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:305
def mixtureKappa

Public occupancy threshold.

Definition (Lean source)
mixtureKappa :
ℝ
1/(96*exp 1)
def mixtureConstant

The explicit envelope constant uses the support theorem's same M.

Definition (Lean source)
mixtureConstant :
ℝ
96*exp 2*8^2*calibM^4
CausalSmith.Stat.LogoddsLowsmoothFrontier.mixtureConstant · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:318
theorem original_record_mixtures Lemma 8 in the paper ↗

Both original-record mixture bounds, uniformly in effect, with no singleton remainder. the stated conclusion holds.

Formal statement
conclusion 1
conclusion 2
conclusion 3
n k :
ℕ
1 ≤ n
1 ≤ k
(n : ℝ)/(k : ℝ) ≤ mixtureKappa
η ζ δ :
ℝ
|η| ≤ calibEps
|ζ| ≤ calibEps
|δ| ≤ calibEps
≤ mixtureConstant*(n : ℝ)^2/(k : ℝ)*η^2*ζ^2
t :
ℝ
t ∈ Icc (0 : ℝ) (1/4)
originalRecordHellinger n (fairMixture n k t δ) (iidLaw (fairComparator k t δ).measure n)
≤ mixtureConstant*(n : ℝ)^2/(k : ℝ)*δ^4
Proof (Lean source)
lemma original_record_mixtures : 0 < mixtureKappa ∧ 0 < mixtureConstant ∧ ∀ n k : ℕ, 1 ≤ n → 1 ≤ k → (n : ℝ)/(k : ℝ) ≤ mixtureKappa → ∀ η ζ δ : ℝ, |η| ≤ calibEps → |ζ| ≤ calibEps → |δ| ≤ calibEps → originalRecordHellinger n (mixedMixture false n k η ζ) (mixedMixture true n k η ζ) ≤ mixtureConstant*(n : ℝ)^2/(k : ℝ)*η^2*ζ^2 ∧ ∀ t : ℝ, t ∈ Icc (0 : ℝ) (1/4) → originalRecordHellinger n (fairMixture n k t δ) (iidLaw (fairComparator k t δ).measure n) ≤ mixtureConstant*(n : ℝ)^2/(k : ℝ)*δ^4 := by have hConstants := calib_constants_spec refine ⟨?_, ?_, ?_⟩ · unfold mixtureKappa positivity · unfold mixtureConstant have hM : 0 < calibM := hConstants.2.1 positivity · intro n k hn hk hnk η ζ δ hη hζ hδ let componentWeight : ℝ := ∫ x, cellComponentWeight n k 8 x ∂Measure.pi (fun _ : Fin n => uniformLaw) have hOccupancyBound (ω : ℝ) : calibM^4*ω^2*componentWeight ≤ mixtureConstant*(n : ℝ)^2/(k : ℝ)*ω^2 := mixture_weighted_component_integral_bound n k hk hnk calibM ω constructor · by_cases hn1 : n = 1 · subst n rw [mixed_originalRecordHellinger_one k hk η ζ hη hζ] unfold mixtureConstant positivity by_cases hη0 : η = 0 · subst η rw [mixedMixture_zero_left, originalRecordHellinger_self] simp by_cases hζ0 : ζ = 0 · subst ζ rw [mixedMixture_zero_right, originalRecordHellinger_self] simp have hReduction : originalRecordHellinger n (mixedMixture false n k η ζ) (mixedMixture true n k η ζ) ≤ calibM^4*(η*ζ)^2*componentWeight := by rw [mixed_originalRecordHellinger_conditional] have hConditional (x : Fin n → Covariate) : hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k (fun σ => mixedLaw false k σ η ζ) (fun i => (x i, l i))) (fun l => signMixtureCellDensity n k (fun σ => mixedLaw true k σ η ζ) (fun i => (x i, l i))) ≤ calibM^4*(η*ζ)^2*cellComponentWeight n k 8 x := by rw [mixture_conditional_hellinger_eq_label_sum] apply (mixed_conditional_label_hellinger_le_components k hk η ζ hη hζ x).trans let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) have hDensity : ∀ c : SignComponentBlock k x, ∀ l : {i : Fin n // block i = c} → Bool × Bool, (sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw false k (componentSignExtension owner c σ) η ζ) (x i.1,l i))- sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (mixedLaw true k (componentSignExtension owner c σ) η ζ) (x i.1,l i)))^2 ≤ calibM^4*(η*ζ)^2*signComponentWeight k x 8 c := by intro c l by_cases hsmall : card {i : Fin n // block i = c} ≤ 1 · have he := mixedDensity_small_block_matching k hk x c l η ζ hη hζ hsmall rw [he, sub_self, zero_pow (by decide : 2 ≠ 0), signComponentWeight_eq_zero_of_small k x 8 c hsmall, mul_zero] · have hb := mixed_component_hellinger_from_support k hk x c l η ζ hη hζ have hcard : 2 ≤ card {i : Fin n // block i = c} := by omega have hw : signComponentWeight k x 8 c = (card {i : Fin n // block i = c} : ℝ)^4 * 8^(card {i : Fin n // block i = c}) := by rw [signComponent_record_card] at hcard ⊢ cases c with | none => simp at hcard | some v => simp only [signComponentWeight, if_pos hcard] apply hb.trans_eq rw [hw] ring calc _ ≤ ∑ c : SignComponentBlock k x, calibM^4*(η*ζ)^2*signComponentWeight k x 8 c := by apply Finset.sum_le_sum intro c hc exact conditionalComponent_mass_hellinger_le_density_bound owner block _ _ x c _ (hDensity c) _ = _ := by rw [← Finset.mul_sum, signComponentWeight_sum] calc _ ≤ ∫ x, calibM^4*(η*ζ)^2*cellComponentWeight n k 8 x ∂Measure.pi (fun _ : Fin n => uniformLaw) := integral_mono_of_nonneg (Filter.Eventually.of_forall (fun x => integral_nonneg (fun l => sq_nonneg _))) ((cellComponentWeight_integrable n k 8).const_mul _) (Filter.Eventually.of_forall hConditional) _ = _ := integral_const_mul _ _ apply hReduction.trans apply (hOccupancyBound (η*ζ)).trans_eq ring · intro t ht by_cases hn1 : n = 1 · subst n rw [fair_originalRecordHellinger_one k hk t δ ht hδ] unfold mixtureConstant positivity by_cases hδ0 : δ = 0 · subst δ rw [fairMixture_zero_amplitude, originalRecordHellinger_self] simp have hReductionNonneg (d : ℝ) (hd : 0 ≤ d) (hdsmall : d ≤ calibEps) : originalRecordHellinger n (fairMixture n k t d) (iidLaw (fairComparator k t d).measure n) ≤ calibM^4*(d^2)^2*componentWeight := by rw [fair_originalRecordHellinger_conditional] have hConditional (x : Fin n → Covariate) : hellingerSqDensity (Measure.pi (fun _ : Fin n => labelReference)) (fun l => signMixtureCellDensity n k (fun σ => fairLaw k σ t d) (fun i => (x i, l i))) (fun l => sampleCellDensity n (fairComparator k t d) (fun i => (x i, l i))) ≤ calibM^4*(d^2)^2*cellComponentWeight n k 8 x := by have hconstant (l : Fin n → Bool × Bool) : sampleCellDensity n (fairComparator k t d) (fun i => (x i,l i)) = signMixtureCellDensity n k (fun _ => fairComparator k t d) (fun i => (x i,l i)) := by rw [signMixtureCellDensity_card_average] simp [sampleCellDensity, Fintype.card_ne_zero] simp_rw [hconstant] rw [mixture_conditional_hellinger_eq_label_sum] have hTensor := fair_conditional_label_hellinger_le_components k hk t d ht (by rw [abs_of_nonneg hd]; exact hdsmall) x simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, ← mul_assoc, inv_mul_cancel₀ (by positivity : (card (Fin (k+1) → Bool) : ℝ) ≠ 0), one_mul] at hTensor ⊢ apply hTensor.trans let owner := signComponentOwner k x let block := fun i => some ((originalRecordSignGraph k x).connectedComponentMk i) have hDensity : ∀ c : SignComponentBlock k x, ∀ l : {i : Fin n // block i = c} → Bool × Bool, (sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairLaw k (componentSignExtension owner c σ) t d) (x i.1,l i))- sqrt ((card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ)⁻¹ * ∑ σ : {s : Fin (k+1) // owner s = c} → Bool, ∏ i : {i : Fin n // block i = c}, recordCellDensity (fairComparator k t d) (x i.1,l i)))^2 ≤ calibM^4*(d^2)^2*signComponentWeight k x 8 c := by intro c l by_cases hsmall : card {i : Fin n // block i = c} ≤ 1 · have he := fairDensity_small_block_matching k hk x c l t d ht (by rw [abs_of_nonneg hd]; exact hdsmall) hsmall rw [he, sub_self, zero_pow (by decide : 2 ≠ 0), signComponentWeight_eq_zero_of_small k x 8 c hsmall, mul_zero] · have hb := fair_component_hellinger_from_support k hk x c l t d ht (by rw [abs_of_nonneg hd]; exact hdsmall) have hcard : 2 ≤ card {i : Fin n // block i = c} := by omega have hw : signComponentWeight k x 8 c = (card {i : Fin n // block i = c} : ℝ)^4 * 8^(card {i : Fin n // block i = c}) := by rw [signComponent_record_card] at hcard ⊢ cases c with | none => simp at hcard | some v => simp only [signComponentWeight, if_pos hcard] simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, ← mul_assoc, inv_mul_cancel₀ (by positivity : (card ({s : Fin (k+1) // owner s = c} → Bool) : ℝ) ≠ 0), one_mul] apply hb.trans_eq rw [hw] ring calc _ ≤ ∑ c : SignComponentBlock k x, calibM^4*(d^2)^2*signComponentWeight k x 8 c := by apply Finset.sum_le_sum intro c hc exact conditionalComponent_mass_hellinger_le_density_bound owner block _ _ x c _ (hDensity c) _ = _ := by rw [← Finset.mul_sum, signComponentWeight_sum] calc _ ≤ ∫ x, calibM^4*(d^2)^2*cellComponentWeight n k 8 x ∂Measure.pi (fun _ : Fin n => uniformLaw) := integral_mono_of_nonneg (Filter.Eventually.of_forall (fun x => integral_nonneg (fun l => sq_nonneg _))) ((cellComponentWeight_integrable n k 8).const_mul _) (Filter.Eventually.of_forall hConditional) _ = _ := integral_const_mul _ _ have hSigned : originalRecordHellinger n (fairMixture n k t δ) (iidLaw (fairComparator k t δ).measure n) = originalRecordHellinger n (fairMixture n k t |δ|) (iidLaw (fairComparator k t |δ|).measure n) := by by_cases hd : 0 ≤ δ · rw [abs_of_nonneg hd] · rw [abs_of_neg (lt_of_not_ge hd), fairMixture_even, fairComparator_even] have hReduction : originalRecordHellinger n (fairMixture n k t δ) (iidLaw (fairComparator k t δ).measure n) ≤ calibM^4*(δ^2)^2*componentWeight := by rw [hSigned] simpa only [sq_abs] using hReductionNonneg |δ| (abs_nonneg δ) hδ apply hReduction.trans apply (hOccupancyBound (δ^2)).trans_eq ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.original_record_mixtures · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_OriginalRecordMixtures.lean:321
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_ParametricNullFloor 1 declarations The constant-logit Bernoulli comparison and total-variation transfer give the finite-sample root-n minimax length floor, including the radius-zero slice.

T ParametricNullFloor

The constant-logit Bernoulli comparison and total-variation transfer give the finite-sample root-n minimax length floor, including the radius-zero slice.

theorem parametric_null_floor

A root-n length floor, including the radius-zero evaluation slice. Under the stated assumptions. Under the stated assumptions.

Formal statement
α β r :
ℝ
n :
ℕ
hD :
hn :
1 ≤ n
hr :
r ∈ Icc (0 : ℝ) (1 / 2)
(3/16 : ℝ)*(n : ℝ)^(-(1/2 : ℝ)) ≤ lengthObjective n α β r
Proof (Lean source)
lemma parametric_null_floor (α β r : ℝ) (n : ℕ) (hD : ExponentDomain α β) (hn : 1 ≤ n) (hr : r ∈ Icc (0 : ℝ) (1 / 2)) : (3/16 : ℝ)*(n : ℝ)^(-(1/2 : ℝ)) ≤ lengthObjective n α β r := by -- The concrete comparison uses the fair null and a treated-outcome logistic shift. obtain ⟨P₀, P₁, hP₀, hP₁, hθ₀, hθ₁, htv⟩ : ∃ P₀ P₁ : ObservedLaw, RadiusModel α β r P₀ ∧ Model α β P₁ ∧ effect P₀ = 0 ∧ effect P₁ = (1/4 : ℝ)*(n : ℝ)^(-(1/2 : ℝ)) ∧ tvDist (experimentLaw P₀ n) (experimentLaw P₁ n) ≤ 1/20 := by exact parametric_comparison α β r n hn hr.1 have horder : effect P₀ ≤ effect P₁ := by rw [hθ₀, hθ₁] positivity have hbound := twoPoint_lengthObjective_lower P₀ P₁ n α β r (1/20) hP₀ hP₁ horder htv rw [hθ₀, hθ₁] at hbound convert hbound using 1 <;> ring
CausalSmith.Stat.LogoddsLowsmoothFrontier.parametric_null_floor · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ParametricNullFloor.lean:16
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_ProjectionControl 1 declarations The cosine approximation, mean and bias identities, and sharp variance bound follow from projection orthogonality and the exact finite-sample Hoeffding decomposition.

Projection control

The cosine approximation, mean and bias identities, and sharp variance bound follow from projection orthogonality and the exact finite-sample Hoeffding decomposition. Both variance components have zero cross moment.

theorem projection_control

Jackson approximation and all three moment identities for the original ordered-pair statistic. Under the stated assumptions. Under the stated assumptions. The stated hypotheses hold, and the stated conclusion follows.

Formal statement
hDesign :
conclusion 1
γ :
ℝ
f :
Covariate → ℝ
k :
ℕ
1 ≤ k
uniformL2Norm (fun x => f x-cosineProjection k f x)
≤ 5*holderSeminorm γ f*ofReal ((k : ℝ)^(-γ))
conclusion 2
W V :
k n :
ℕ
1 ≤ k
2 ≤ n
μ :
iidLaw P.measure n
m :
∫ o, projectionStatistic n k W.value V.value o ∂μ
m = uniformInner (cosineProjection k w) (cosineProjection k v)
= uniformInner (fun x => w x-cosineProjection k w x) (fun x => v x-cosineProjection k v x)
(∫ o, (projectionStatistic n k W.value V.value o-m)^2 ∂μ)
≤ 4/(n : ℝ)+2*k/((n : ℝ)*((n : ℝ)-1))
Proof (Lean source)
lemma projection_control (P : ObservedLaw) (hDesign : UniformDesign P) : (∀ (γ : ℝ) (f : Covariate → ℝ), HolderExponentDomain γ → ContinuousFunctionDomain f → -- @realizes \gamma(generic exponent in its domain) @realizes f(generic continuous function) ∀ k : ℕ, 1 ≤ k → uniformL2Norm (fun x => f x-cosineProjection k f x) ≤ 5*holderSeminorm γ f*ofReal ((k : ℝ)^(-γ))) ∧ (∀ (W V : BoundedMark) (k n : ℕ), 1 ≤ k → 2 ≤ n → let w := conditionalMarkMean P W let v := conditionalMarkMean P V let μ := iidLaw P.measure n let m := ∫ o, projectionStatistic n k W.value V.value o ∂μ m = uniformInner (cosineProjection k w) (cosineProjection k v) ∧ uniformInner w v-m = uniformInner (fun x => w x-cosineProjection k w x) (fun x => v x-cosineProjection k v x) ∧ (∫ o, (projectionStatistic n k W.value V.value o-m)^2 ∂μ) ≤ 4/(n : ℝ)+2*k/((n : ℝ)*((n : ℝ)-1))) := by constructor · exact cosineProjection_error_le_holderSeminorm · intro W V k n hk hn dsimp only refine ⟨projectionStatistic_integral P hDesign W V k n hn, projectionStatistic_bias P hDesign W V k n hn, ?_⟩ exact projectionStatistic_variance_le P hDesign W V k n hn
CausalSmith.Stat.LogoddsLowsmoothFrontier.projection_control · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ProjectionControl.lean:16
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_ScalarImplicitFunction 5 declarations The scalar product-domain implicit-function theorem, with open coordinate neighborhoods and local uniqueness of the zero graph.

T ScalarImplicitFunction

The scalar product-domain implicit-function theorem, with open coordinate neighborhoods and local uniqueness of the zero graph.

theorem scalar_implicit_function Lemma 5 in the paper ↗

A scalar zero set is locally the graph of a unique C1 function. Under the stated assumptions. Under the stated assumptions.

Formal statement
d :
ℕ
F :
((Fin d → ℝ) × ℝ) → ℝ
D :
Set ((Fin d → ℝ) × ℝ)
b₀ :
Fin d → ℝ
χ₀ :
ℝ
hOpen :
hMem :
(b₀, χ₀) ∈ D
hC1 :
ContDiffOn ℝ 1 F D
hZero :
F (b₀, χ₀) = 0
hPartial :
deriv (fun χ => F (b₀, χ)) χ₀ ≠ 0
∃ (U : Set (Fin d → ℝ)) (V : Set ℝ) (q : (Fin d → ℝ) → ℝ),
b₀ ∈ U
χ₀ ∈ V
U ×ˢ V ⊆ D
ContDiffOn ℝ 1 q U
q b₀ = χ₀
conclusion 1
b ∈ U :
q b ∈ V
conclusion 2
b ∈ U :
χ ∈ V :
F (b,χ) = 0 ↔ χ = q b
Proof (Lean source)
lemma scalar_implicit_function (d : ℕ) (F : ((Fin d → ℝ) × ℝ) → ℝ) (D : Set ((Fin d → ℝ) × ℝ)) (b₀ : Fin d → ℝ) (χ₀ : ℝ) (hOpen : IsOpen D) (hMem : (b₀, χ₀) ∈ D) (hC1 : ContDiffOn ℝ 1 F D) (hZero : F (b₀, χ₀) = 0) (hPartial : deriv (fun χ => F (b₀, χ)) χ₀ ≠ 0) : ∃ (U : Set (Fin d → ℝ)) (V : Set ℝ) (q : (Fin d → ℝ) → ℝ), IsOpen U ∧ b₀ ∈ U ∧ IsOpen V ∧ χ₀ ∈ V ∧ U ×ˢ V ⊆ D ∧ ContDiffOn ℝ 1 q U ∧ q b₀ = χ₀ ∧ (∀ b ∈ U, q b ∈ V) ∧ (∀ b ∈ U, ∀ χ ∈ V, F (b,χ) = 0 ↔ χ = q b) := by have hAt : ContDiffAt ℝ 1 F (b₀, χ₀) := hC1.contDiffAt (hOpen.mem_nhds hMem) let L := fderiv ℝ F (b₀, χ₀) ∘L ContinuousLinearMap.inr ℝ (Fin d → ℝ) ℝ have hDeriv : HasDerivAt (fun χ => F (b₀, χ)) (L 1) χ₀ := ((hAt.differentiableAt one_ne_zero).hasFDerivAt.comp χ₀ (hasFDerivAt_prodMk_right b₀ χ₀)).hasDerivAt have hL : L 1 ≠ 0 := by rw [← hDeriv.deriv] exact hPartial have hScale (x : ℝ) : L x = x * L 1 := by simpa using L.map_smul x (1 : ℝ) have hInv : L.IsInvertible := by apply ContinuousLinearMap.IsInvertible.of_inverse (g := (L 1)⁻¹ • id ℝ ℝ) · ext simp only [ContinuousLinearMap.comp_apply, smul_apply, ContinuousLinearMap.id_apply, smul_eq_mul] rw [hScale] field_simp · ext simp only [ContinuousLinearMap.comp_apply, smul_apply, ContinuousLinearMap.id_apply, smul_eq_mul] rw [hScale] field_simp let q := hAt.implicitFunction one_ne_zero hInv have hqBase : q b₀ = χ₀ := hAt.implicitFunction_apply_self one_ne_zero hInv have hqSmooth : ContDiffAt ℝ 1 q b₀ := hAt.contDiffAt_implicitFunction one_ne_zero hInv have hGraph : ∀ᶠ z in 𝓝 (b₀, χ₀), F z = 0 ↔ q z.1 = z.2 := by simpa [hZero] using hAt.eventually_apply_eq_iff_implicitFunction one_ne_zero hInv have hRect : {z | F z = 0 ↔ q z.1 = z.2} ∩ D ∈ 𝓝 (b₀, χ₀) := inter_mem hGraph (hOpen.mem_nhds hMem) rw [nhds_prod_eq] at hRect obtain ⟨U₁, hU₁, V₁, hV₁, hUV⟩ := mem_prod_iff.mp hRect obtain ⟨U₂, hU₂sub, hU₂open, hU₂base⟩ := mem_nhds_iff.mp hU₁ obtain ⟨V, hVsub, hVopen, hVbase⟩ := mem_nhds_iff.mp hV₁ obtain ⟨S, hS, hSmooth⟩ := hqSmooth.contDiffOn le_rfl (by simp) have hPre : q ⁻¹' V ∈ 𝓝 b₀ := hqSmooth.continuousAt (by simpa [hqBase] using hVopen.mem_nhds hVbase) obtain ⟨U, hUsub, hUopen, hUbase⟩ := mem_nhds_iff.mp (inter_mem (inter_mem (hU₂open.mem_nhds hU₂base) hS) hPre) refine ⟨U, V, q, hUopen, hUbase, hVopen, hVbase, ?_, ?_, hqBase, ?_, ?_⟩ · intro z hz exact (hUV ⟨hU₂sub (hUsub hz.1).1.1, hVsub hz.2⟩).2 · exact hSmooth.mono (fun b hb => (hUsub hb).1.2) · intro b hb exact (hUsub hb).2 · intro b hb χ hχ exact ((hUV ⟨hU₂sub (hUsub hb).1.1, hVsub hχ⟩).1).trans eq_comm
CausalSmith.Stat.LogoddsLowsmoothFrontier.scalar_implicit_function · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ScalarImplicitFunction.lean:18
theorem scalar_implicit_root_contDiffAt Lemma scalar_implicit_root_contDiffAt in the paper ↗

[A continuous zero-graph inherits every smoothness order of its scalar implicit equation. This identifies the actual selected root with Mathlib's local branch, rather than proving regularity of an unrelated witness. the documented result Under the stated assumptions. Under the stated assumptions.

Formal statement
d :
ℕ
n :
ℕ∞ω
hn :
n ≠ 0
F :
((Fin d → ℝ) × ℝ) → ℝ
q :
(Fin d → ℝ) → ℝ
b :
Fin d → ℝ
hF :
ContDiffAt ℝ n F (b, q b)
hq :
hZero :
∀ᶠ a in 𝓝 b, F (a, q a) = 0
hPartial :
deriv (fun χ => F (b, χ)) (q b) ≠ 0
ContDiffAt ℝ n q b
Proof (Lean source)
-- @node: scalar_implicit_root_contDiffAt lemma scalar_implicit_root_contDiffAt (d : ℕ) (n : ℕ∞ω) (hn : n ≠ 0) (F : ((Fin d → ℝ) × ℝ) → ℝ) (q : (Fin d → ℝ) → ℝ) (b : Fin d → ℝ) (hF : ContDiffAt ℝ n F (b, q b)) (hq : ContinuousAt q b) (hZero : ∀ᶠ a in 𝓝 b, F (a, q a) = 0) (hPartial : deriv (fun χ => F (b, χ)) (q b) ≠ 0) : ContDiffAt ℝ n q b := by let L := fderiv ℝ F (b, q b) ∘L ContinuousLinearMap.inr ℝ (Fin d → ℝ) ℝ have hDeriv : HasDerivAt (fun χ => F (b, χ)) (L 1) (q b) := ((hF.differentiableAt hn).hasFDerivAt.comp (q b) (hasFDerivAt_prodMk_right b (q b))).hasDerivAt have hL : L 1 ≠ 0 := by rw [← hDeriv.deriv] exact hPartial have hScale (x : ℝ) : L x = x * L 1 := by simpa using L.map_smul x (1 : ℝ) have hInv : L.IsInvertible := by apply ContinuousLinearMap.IsInvertible.of_inverse (g := (L 1)⁻¹ • id ℝ ℝ) · ext simp only [ContinuousLinearMap.comp_apply, smul_apply, ContinuousLinearMap.id_apply, smul_eq_mul] rw [hScale] field_simp · ext simp only [ContinuousLinearMap.comp_apply, smul_apply, ContinuousLinearMap.id_apply, smul_eq_mul] rw [hScale] field_simp have hBase : F (b, q b) = 0 := by exact hZero.self_of_nhds have hGraph := hF.eventually_apply_eq_iff_implicitFunction hn hInv have hPull := (continuousAt_id.prodMk hq) hGraph have he : q =ᶠ[𝓝 b] hF.implicitFunction hn hInv := by filter_upwards [hPull, hZero] with a ha hz exact ((ha).mp (hz.trans hBase.symm)).symm exact (hF.contDiffAt_implicitFunction hn hInv).congr_of_eventuallyEq he
CausalSmith.Stat.LogoddsLowsmoothFrontier.scalar_implicit_root_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ScalarImplicitFunction.lean:78
theorem scalar_smooth_implicit_function Lemma scalar_smooth_implicit_function in the paper ↗

[Smooth scalar equations have a single smooth local zero-graph on open coordinate neighborhoods. The C1 graph is upgraded pointwise by local implicit uniqueness, so all finite derivative orders concern the same root. the documented result Under the stated assumptions.

Formal statement
d :
ℕ
F :
((Fin d → ℝ) × ℝ) → ℝ
D :
Set ((Fin d → ℝ) × ℝ)
b₀ :
Fin d → ℝ
χ₀ :
ℝ
hOpen :
hMem :
(b₀, χ₀) ∈ D
hSmooth :
ContDiffOn ℝ ⊤ F D
hZero :
F (b₀, χ₀) = 0
hPartial :
deriv (fun χ => F (b₀, χ)) χ₀ ≠ 0
∃ (U : Set (Fin d → ℝ)) (V : Set ℝ) (q : (Fin d → ℝ) → ℝ),
b₀ ∈ U
χ₀ ∈ V
U ×ˢ V ⊆ D
ContDiffOn ℝ ⊤ q U
q b₀ = χ₀
conclusion 1
b ∈ U :
q b ∈ V
conclusion 2
b ∈ U :
χ ∈ V :
F (b,χ) = 0 ↔ χ = q b
Proof (Lean source)
-- @node: scalar_smooth_implicit_function lemma scalar_smooth_implicit_function (d : ℕ) (F : ((Fin d → ℝ) × ℝ) → ℝ) (D : Set ((Fin d → ℝ) × ℝ)) (b₀ : Fin d → ℝ) (χ₀ : ℝ) (hOpen : IsOpen D) (hMem : (b₀, χ₀) ∈ D) (hSmooth : ContDiffOn ℝ ⊤ F D) (hZero : F (b₀, χ₀) = 0) (hPartial : deriv (fun χ => F (b₀, χ)) χ₀ ≠ 0) : ∃ (U : Set (Fin d → ℝ)) (V : Set ℝ) (q : (Fin d → ℝ) → ℝ), IsOpen U ∧ b₀ ∈ U ∧ IsOpen V ∧ χ₀ ∈ V ∧ U ×ˢ V ⊆ D ∧ ContDiffOn ℝ ⊤ q U ∧ q b₀ = χ₀ ∧ (∀ b ∈ U, q b ∈ V) ∧ (∀ b ∈ U, ∀ χ ∈ V, F (b,χ) = 0 ↔ χ = q b) := by have hCoeff (z : (Fin d → ℝ) × ℝ) (hz : z ∈ D) : deriv (fun χ => F (z.1, χ)) z.2 = fderiv ℝ F z (0, 1) := by have hAt := (hSmooth.contDiffAt (hOpen.mem_nhds hz)).differentiableAt (by simp : (⊤ : ℕ∞ω) ≠ 0) exact (hAt.hasFDerivAt.comp z.2 (hasFDerivAt_prodMk_right z.1 z.2)).hasDerivAt.deriv have hc : ContinuousAt (fun z => fderiv ℝ F z (0, 1)) (b₀, χ₀) := by exact ((hSmooth.continuousOn_fderiv_of_isOpen hOpen (by simp)).continuousAt (hOpen.mem_nhds hMem)).clm_apply continuousAt_const have hne : ∀ᶠ z in 𝓝 (b₀, χ₀), fderiv ℝ F z (0, 1) ≠ 0 := hc.eventually_ne (by rwa [← hCoeff (b₀, χ₀) hMem]) obtain ⟨W, hWsub, hWopen, hWmem⟩ := mem_nhds_iff.mp hne obtain ⟨U, V, q, hU, hb, hV, hχ, hUV, hC1, hBase, hRange, hGraph⟩ := scalar_implicit_function d F (D ∩ W) b₀ χ₀ (hOpen.inter hWopen) ⟨hMem, hWmem⟩ ((hSmooth.of_le (by simp)).mono Set.inter_subset_left) hZero hPartial refine ⟨U, V, q, hU, hb, hV, hχ, ?_, ?_, hBase, hRange, hGraph⟩ · intro z hz exact (hUV hz).1 · intro b hb have hz : (b, q b) ∈ D ∩ W := hUV ⟨hb, hRange b hb⟩ have hq := (hC1.contDiffAt (hU.mem_nhds hb)).continuousAt have he : ∀ᶠ a in 𝓝 b, F (a, q a) = 0 := by filter_upwards [hU.mem_nhds hb] with a ha exact (hGraph a ha (q a) (hRange a ha)).mpr rfl apply (scalar_implicit_root_contDiffAt d ⊤ (by simp) F q b (hSmooth.contDiffAt (hOpen.mem_nhds hz.1)) hq he ?_).contDiffWithinAt rw [hCoeff (b, q b) hz.1] exact hWsub hz.2
CausalSmith.Stat.LogoddsLowsmoothFrontier.scalar_smooth_implicit_function · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ScalarImplicitFunction.lean:119
theorem scalar_bracket_selector_contDiffAt Lemma scalar_bracket_selector_contDiffAt in the paper ↗

[A bracket selector inherits smoothness from the local implicit branch when nearby bracket roots are unique. No continuity assumption on the selector is needed: uniqueness identifies it with the smooth branch on a neighborhood. the documented result Under the stated assumptions.

Formal statement
d :
ℕ
F :
((Fin d → ℝ) × ℝ) → ℝ
q :
(Fin d → ℝ) → ℝ
b :
Fin d → ℝ
l r :
ℝ
hF :
ContDiffAt ℝ ⊤ F (b, q b)
hb :
q b ∈ Ioo l r
hZero :
F (b, q b) = 0
hPartial :
deriv (fun χ => F (b, χ)) (q b) ≠ 0
hSpec :
∀ a
if
(∃ χ ∈ Ioo l r, F (a, χ) = 0)
then
q a ∈ Ioo l r ∧ F (a, q a) = 0
hUnique :
∀ᶠ a in 𝓝 b, ∀ χ ∈ Ioo l r, ∀ ψ ∈ Ioo l r, F (a, χ) = 0 → F (a, ψ) = 0 → χ = ψ
ContDiffAt ℝ ⊤ q b
Proof (Lean source)
-- @node: scalar_bracket_selector_contDiffAt lemma scalar_bracket_selector_contDiffAt (d : ℕ) (F : ((Fin d → ℝ) × ℝ) → ℝ) (q : (Fin d → ℝ) → ℝ) (b : Fin d → ℝ) (l r : ℝ) (hF : ContDiffAt ℝ ⊤ F (b, q b)) (hb : q b ∈ Ioo l r) (hZero : F (b, q b) = 0) (hPartial : deriv (fun χ => F (b, χ)) (q b) ≠ 0) (hSpec : ∀ a, (∃ χ ∈ Ioo l r, F (a, χ) = 0) → q a ∈ Ioo l r ∧ F (a, q a) = 0) (hUnique : ∀ᶠ a in 𝓝 b, ∀ χ ∈ Ioo l r, ∀ ψ ∈ Ioo l r, F (a, χ) = 0 → F (a, ψ) = 0 → χ = ψ) : ContDiffAt ℝ ⊤ q b := by obtain ⟨S, hS, hSmooth⟩ := hF.contDiffOn le_rfl (by simp) obtain ⟨D, hDsub, hDopen, hDbase⟩ := mem_nhds_iff.mp hS obtain ⟨U, V, g, hU, hbU, hV, hbV, hUV, hg, hgBase, hgRange, hgGraph⟩ := scalar_smooth_implicit_function d F D b (q b) hDopen hDbase (hSmooth.mono hDsub) hZero hPartial have hgAt := hg.contDiffAt (hU.mem_nhds hbU) have hRange : ∀ᶠ a in 𝓝 b, g a ∈ Ioo l r := hgAt.continuousAt (by rw [hgBase]; exact isOpen_Ioo.mem_nhds hb) have he : q =ᶠ[𝓝 b] g := by filter_upwards [hU.mem_nhds hbU, hRange, hUnique] with a ha hga hunique have hz : F (a, g a) = 0 := (hgGraph a ha (g a) (hgRange a ha)).mpr rfl obtain ⟨hqa, hqz⟩ := hSpec a ⟨g a, hga, hz⟩ exact hunique (q a) hqa (g a) hga hqz hz exact hgAt.congr_of_eventuallyEq he
CausalSmith.Stat.LogoddsLowsmoothFrontier.scalar_bracket_selector_contDiffAt · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ScalarImplicitFunction.lean:163
theorem compact_smooth_derivative_bounds Lemma compact_smooth_derivative_bounds in the paper ↗

[Compactness bounds each fixed derivative order of the actual smooth map. Smoothness is required on neighborhoods of the compact set, so the derivatives are unrestricted derivatives even at boundary points. the documented result Under the stated assumptions.

Formal statement
d :
ℕ
f :
(Fin d → ℝ) → ℝ
K :
Set (Fin d → ℝ)
hK :
hf :
∀ b ∈ K, ContDiffAt ℝ ⊤ f b
m :
ℕ
∃ B : ℝ,
0 < B
conclusion 1
b ∈ K :
‖iteratedFDeriv ℝ m f b‖ ≤ B
Proof (Lean source)
-- @node: compact_smooth_derivative_bounds lemma compact_smooth_derivative_bounds (d : ℕ) (f : (Fin d → ℝ) → ℝ) (K : Set (Fin d → ℝ)) (hK : IsCompact K) (hf : ∀ b ∈ K, ContDiffAt ℝ ⊤ f b) : ∀ m : ℕ, ∃ B : ℝ, 0 < B ∧ ∀ b ∈ K, ‖iteratedFDeriv ℝ m f b‖ ≤ B := by intro m have hc : ContinuousOn (iteratedFDeriv ℝ m f) K := by intro b hb exact ((hf b hb).differentiableAt_iteratedFDeriv (by simp)).continuousAt.continuousWithinAt obtain ⟨C, hC⟩ := hK.exists_bound_of_continuousOn hc refine ⟨max C 1, lt_of_lt_of_le (by norm_num) (le_max_right _ _), ?_⟩ intro b hb exact (hC b hb).trans (le_max_left _ _)
CausalSmith.Stat.LogoddsLowsmoothFrontier.compact_smooth_derivative_bounds · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_ScalarImplicitFunction.lean:193
CausalSmith.Stat.STAT_LogoddsLowsmoothFrontier_Research.T_SharpHonestFrontier 1 declarations The upper comparisons, operational guarantees, parametric numerator branch, and combination of the lower rates use supporting lemmas.

T SharpHonestFrontier

The upper comparisons, operational guarantees, parametric numerator branch, and combination of the lower rates use supporting lemmas. The mixture lower rates follow from calibrated supports, original-record Hellinger bounds, finite-prior testing, and uniform ceiling-rank estimates.

theorem sharp_honest_frontier

Positive absolute constants certify the entire domain and every radius, including randomized competitors. the stated conclusion holds.

Formal statement
∃ c C : ℝ,
conclusion 1
α β :
ℝ
conclusion 2
α β r :
ℝ
r ∈ Icc (0 : ℝ) (1/2)
n :
ℕ
1 ≤ n
I :
Procedure n
HonestProcedure n α β I
c*rate n α β r ≤ worstLength n α β r I
Proof (Lean source)
theorem sharp_honest_frontier : ∃ c C : ℝ, 0 < c ∧ 0 < C ∧ UniversalFrontier c C ∧ CompactUniform c C ∧ (∀ α β : ℝ, ExponentDomain α β → ElbowIdentities α β) ∧ (∀ α β r : ℝ, ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → c*rate n α β r ≤ worstLength n α β r I) := by obtain ⟨cMix, cRadius, hcMix, hcRadius, hRough, hRadiusPositive⟩ := frontier_mixture_lower_rates obtain ⟨C, hC, hUpper⟩ := frontier_upper_comparisons let cA : ℝ := min cMix (3/16) let c : ℝ := min cA cRadius / 2 have hcA : 0 < cA := lt_min hcMix (by norm_num) have hc : 0 < c := div_pos (lt_min hcA hcRadius) (by norm_num) have hNumerator := frontier_numerator_lower_of_rough cMix hRough have hRadius := frontier_radius_lower_of_positive cRadius hRadiusPositive have hLower : ∀ α β r : ℝ, ExponentDomain α β → r ∈ Icc (0 : ℝ) (1/2) → ∀ n : ℕ, 1 ≤ n → ∀ I : Procedure n, HonestProcedure n α β I → c*rate n α β r ≤ worstLength n α β r I := by intro α β r hD hr n hn I hI exact frontier_rate_lower_of_two n α β r cA cRadius hr.1 I (hNumerator α β r hD hr n hn I hI) (hRadius α β r hD hr n hn I hI) have hFrontier := universalFrontier_of_procedure_lower c C hUpper hLower exact ⟨c, C, hc, hC, hFrontier, frontier_compact_uniform c C hc, frontier_elbow_identities, hLower⟩
CausalSmith.Stat.LogoddsLowsmoothFrontier.sharp_honest_frontier · CausalSmith/Stat/STAT_LogoddsLowsmoothFrontier_Research/T_SharpHonestFrontier.lean:24