Formalization: Minimax Mean Squared Error for Low-order Network Interference under Bernoulli Assignment

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.

Basic 26 declarations This file defines the finite-population graph, raw polynomial potential outcomes, and the two model classes used throughout the paper.

SNIPE degree-frontier model

This file defines the finite-population graph, raw polynomial potential outcomes, and the two model classes used throughout the paper. The Causalean Bernoulli product design supplies the assignment law; a bare directed relation is used for the interference graph because self-loops are part of the model.

Substrate survey: Causalean.Experimentation.DesignBased.Designs.Bernoulli is reused for the assignment law. The exposure-mapping potential-outcome layer and Causalean.Graph.DAG are bypassed because the former hides the raw polynomial coefficients and the latter forbids the required self-loops.

The in-neighborhood {j | G j i} of an outcome unit.

Definition (Lean source)
noncomputable def nbhd (G : V → V → Prop) (i : V) : Finset V := by classical exact Finset.univ.filter (fun j => G j i)
CausalSmith.Experimentation.SnipeDegreeFrontier.nbhd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:34
def outNbhd

The out-neighborhood {i | G j i} of an assignment coordinate.

Definition (Lean source)
noncomputable def outNbhd (G : V → V → Prop) (j : V) : Finset V := by classical exact Finset.univ.filter (fun i => G j i)
CausalSmith.Experimentation.SnipeDegreeFrontier.outNbhd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:42

The Bernoulli contrast (1-p)^r - (-p)^r.

Definition (Lean source)
def bernoulliContrast (p : ℝ) (r : ℕ) : ℝ := (1 - p) ^ r - (-p) ^ r
CausalSmith.Experimentation.SnipeDegreeFrontier.bernoulliContrast · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:48

The effective interaction order min β d.

Definition (Lean source)
def effBeta (β d : ℕ) : ℕ := min β d
CausalSmith.Experimentation.SnipeDegreeFrontier.effBeta · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:53

The standing degree-index restriction d ≤ n = |V|.

Definition (Lean source)
def DegreeIndex (V : Type*) [Fintype V] (d : ℕ) : Prop := d ≤ card V
CausalSmith.Experimentation.SnipeDegreeFrontier.DegreeIndex · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:58
def OrderIndex

A nonconstant interaction order in {1,...,min β d}.

Definition (Lean source)
def OrderIndex (β d r : ℕ) : Prop := 1 ≤ r ∧ r ≤ effBeta β d
CausalSmith.Experimentation.SnipeDegreeFrontier.OrderIndex · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:63
def NeighborhoodSubset

A finite subset of the in-neighborhood of i.

Definition (Lean source)
def NeighborhoodSubset (G : V → V → Prop) (i : V) (S : Finset V) : Prop := S ⊆ nbhd G i
CausalSmith.Experimentation.SnipeDegreeFrontier.NeighborhoodSubset · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:68

The largest exposed order, with value zero when the exposed set is empty.

Definition (Lean source)
-- @node: def:exposed-order noncomputable def kStar (d β : ℕ) (p : ℝ) : ℕ := let exposed : Finset ℕ := (Icc 1 (effBeta β d)).filter (fun r => bernoulliContrast p r ≠ 0) if h : exposed.Nonempty then exposed.max' h else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.kStar · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:74
def IsProductBernoulli Assumption 1 in the paper ↗

A finite design is the common-probability product Bernoulli design, with the paper's strict overlap condition 0 < p < 1.

Definition (Lean source)
-- @node: ass:bernoulli-design def IsProductBernoulli (D : FiniteDesign (V → Bool)) (p : ℝ) : Prop := 0 < p ∧ p < 1 ∧ ∃ (hp0 : ∀ _ : V, (0 : ℝ) ≤ p) (hp1 : ∀ _ : V, p ≤ 1), D = bernoulliDesign (fun _ => p) hp0 hp1
CausalSmith.Experimentation.SnipeDegreeFrontier.IsProductBernoulli · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:82

Both directed degrees are at most d; loops are neither removed nor treated specially, and hence are counted in both finsets.

Definition (Lean source)
-- @node: ass:bounded-degree def BoundedDegree (G : V → V → Prop) (d : ℕ) : Prop := (∀ i, (nbhd G i).card ≤ d) ∧ ∀ j, (outNbhd G j).card ≤ d
CausalSmith.Experimentation.SnipeDegreeFrontier.BoundedDegree · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:93

Raw polynomial coefficients above order β vanish.

Definition (Lean source)
-- @node: ass:low-order def LowOrder (c : V → Finset V → ℝ) (β : ℕ) : Prop := ∀ i S, β < S.card → c i S = 0
CausalSmith.Experimentation.SnipeDegreeFrontier.LowOrder · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:100
def BoundedCoeffMass Assumption 4 in the paper ↗

The raw coefficient mass in every outcome neighborhood is at most B.

Definition (Lean source)
-- @node: ass:bounded-coefficient-mass noncomputable def BoundedCoeffMass (G : V → V → Prop) (c : V → Finset V → ℝ) (B : ℝ) : Prop := ∀ i, ∑ S ∈ (nbhd G i).powerset, |c i S| ≤ B
CausalSmith.Experimentation.SnipeDegreeFrontier.BoundedCoeffMass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:107
def potentialOutcome Definition 5 in the paper ↗

A raw-monomial potential outcome on the in-neighborhood of i.

Definition (Lean source)
-- @env: S2 noncomputable def potentialOutcome (G : V → V → Prop) (c : V → Finset V → ℝ) (i : V) (z : V → Bool) : ℝ := -- @realizes z(generic assignment z : V → Bool) ∑ S ∈ (nbhd G i).powerset, c i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.potentialOutcome · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:114

The observed-outcome vector obtained by evaluating the fixed schedule at the realized assignment.

Definition (Lean source)
noncomputable def obsOutcome (G : V → V → Prop) (c : V → Finset V → ℝ) (Z : V → Bool) : V → ℝ := -- @realizes Z(realized assignment Z : V → Bool) fun i => potentialOutcome G c i Z
CausalSmith.Experimentation.SnipeDegreeFrontier.obsOutcome · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:123

The finite-population all-treated versus all-control contrast.

Definition (Lean source)
noncomputable def tte (G : V → V → Prop) (c : V → Finset V → ℝ) : ℝ := (Fintype.card V : ℝ)⁻¹ * ∑ i : V, (potentialOutcome G c i (fun _ => true) - potentialOutcome G c i (fun _ => false))
CausalSmith.Experimentation.SnipeDegreeFrontier.tte · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:131
structure GraphClass

A directed graph with both degrees bounded by d.

Definition (Lean source)
V :
d :
edge :
V → V → Prop
decEdge :
degree_le :
CausalSmith.Experimentation.SnipeDegreeFrontier.GraphClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:140
structure CoeffClass

A neighborhood-supported, low-order coefficient schedule with bounded raw coefficient mass.

Definition (Lean source)
G :
V → V → Prop
β :
B :
coef :
V → Finset V → ℝ
supported :
∀ i S
if
¬ S ⊆ nbhd G i
then
coef i S = 0
low_order :
LowOrder coef β
mass_le :
CausalSmith.Experimentation.SnipeDegreeFrontier.CoeffClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:147
structure ModelClass

The graph-and-schedule class used by the coefficient-mass minimax risk.

Definition (Lean source)
V :
d β :
B :
edge :
V → V → Prop
decEdge :
coef :
V → Finset V → ℝ
supported :
∀ i S
if
¬ S ⊆ nbhd edge i
then
coef i S = 0
degree_le :
low_order :
LowOrder coef β
mass_le :
BoundedCoeffMass edge coef B
CausalSmith.Experimentation.SnipeDegreeFrontier.ModelClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:157
def ofComponents

Assemble the flat model class from its graph and schedule components.

Definition (Lean source)
def ofComponents (g : GraphClass V d) (c : CoeffClass g.edge β B) : ModelClass V d β B := { edge := g.edge decEdge := g.decEdge coef := c.coef supported := c.supported degree_le := g.degree_le low_order := c.low_order mass_le := c.mass_le }
CausalSmith.Experimentation.SnipeDegreeFrontier.ModelClass.ofComponents · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:171
def toGraphClass

Project a model to its bounded-degree graph.

Definition (Lean source)
def toGraphClass (M : ModelClass V d β B) : GraphClass V d := { edge := M.edge, decEdge := M.decEdge, degree_le := M.degree_le }
CausalSmith.Experimentation.SnipeDegreeFrontier.ModelClass.toGraphClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:182
def toCoeffClass

Project a model to its coefficient schedule.

Definition (Lean source)
def toCoeffClass (M : ModelClass V d β B) : CoeffClass M.edge β B := { coef := M.coef supported := M.supported low_order := M.low_order mass_le := M.mass_le }
CausalSmith.Experimentation.SnipeDegreeFrontier.ModelClass.toCoeffClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:186
structure BddOutcomeCoeffClass

A low-order schedule whose induced potential outcomes are uniformly bounded by B.

Definition (Lean source)
G :
V → V → Prop
β :
B :
coef :
V → Finset V → ℝ
supported :
∀ i S
if
¬ S ⊆ nbhd G i
then
coef i S = 0
low_order :
LowOrder coef β
outcome_bound :
∀ i z, |potentialOutcome G coef i z| ≤ B
CausalSmith.Experimentation.SnipeDegreeFrontier.BddOutcomeCoeffClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:195
structure BddOutcomeModelClass

The graph-and-schedule class with uniformly bounded potential outcomes.

Definition (Lean source)
V :
d β :
B :
edge :
V → V → Prop
decEdge :
coef :
V → Finset V → ℝ
supported :
∀ i S
if
¬ S ⊆ nbhd edge i
then
coef i S = 0
degree_le :
low_order :
LowOrder coef β
outcome_bound :
∀ i z, |potentialOutcome edge coef i z| ≤ B
CausalSmith.Experimentation.SnipeDegreeFrontier.BddOutcomeModelClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:205
def ofComponents

Assemble the flat bounded-outcome model from component classes.

Definition (Lean source)
def ofComponents (g : GraphClass V d) (c : BddOutcomeCoeffClass g.edge β B) : BddOutcomeModelClass V d β B := { edge := g.edge decEdge := g.decEdge coef := c.coef supported := c.supported degree_le := g.degree_le low_order := c.low_order outcome_bound := c.outcome_bound }
CausalSmith.Experimentation.SnipeDegreeFrontier.BddOutcomeModelClass.ofComponents · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:219
def toGraphClass

Project a bounded-outcome model to its graph component.

Definition (Lean source)
def toGraphClass (M : BddOutcomeModelClass V d β B) : GraphClass V d := { edge := M.edge, decEdge := M.decEdge, degree_le := M.degree_le }
CausalSmith.Experimentation.SnipeDegreeFrontier.BddOutcomeModelClass.toGraphClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:230
def toBddOutcomeCoeffClass

Project a bounded-outcome model to its schedule component.

Definition (Lean source)
def toBddOutcomeCoeffClass (M : BddOutcomeModelClass V d β B) : BddOutcomeCoeffClass M.edge β B := { coef := M.coef supported := M.supported low_order := M.low_order outcome_bound := M.outcome_bound }
CausalSmith.Experimentation.SnipeDegreeFrontier.BddOutcomeModelClass.toBddOutcomeCoeffClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Basic.lean:234
Estimator 21 declarations The estimator receives the known graph together with assignment and observed outcomes.

Graph-aware SNIPE estimators and minimax risks

The estimator receives the known graph together with assignment and observed outcomes. The risk then composes one global estimator with each model's own graph before applying FiniteDesign.mse.

def nbhdB

A Boolean graph's in-neighborhood.

Definition (Lean source)
def nbhdB (G : V → V → Bool) (i : V) : Finset V := Finset.univ.filter (fun j => G j i)
CausalSmith.Experimentation.SnipeDegreeFrontier.nbhdB · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:23

Turn a model's decidable relation into estimator data.

Definition (Lean source)
def edgeFn (M : ModelClass V d β B) : V → V → Bool := fun j i => @decide (M.edge j i) (M.decEdge j i)
CausalSmith.Experimentation.SnipeDegreeFrontier.edgeFn · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:27

The same graph encoding for the bounded-outcome class.

Definition (Lean source)
def edgeFnBdd (M : BddOutcomeModelClass V d β B) : V → V → Bool := fun j i => @decide (M.edge j i) (M.decEdge j i)
CausalSmith.Experimentation.SnipeDegreeFrontier.edgeFnBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:31
def Estimator

A graph-aware estimator of the finite-population contrast.

Definition (Lean source)
-- @env: S3 abbrev Estimator (V : Type*) := (V → V → Bool) → (V → Bool) → (V → ℝ) → ℝ
CausalSmith.Experimentation.SnipeDegreeFrontier.Estimator · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:35

Measurability in the outcome vector, with graph and assignment fixed.

Definition (Lean source)
def OutcomeMeasurable (est : Estimator V) : Prop := ∀ G z, Measurable (fun y : V → ℝ => est G z y)
CausalSmith.Experimentation.SnipeDegreeFrontier.OutcomeMeasurable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:41

The centered SNIPE score read from the estimator's graph argument.

Definition (Lean source)
-- @node: def:snipe-score noncomputable def snipeScore (G : V → V → Bool) (β : ℕ) (p : ℝ) (i : V) (z : V → Bool) : ℝ := ∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), (bernoulliContrast p r / (p * (1 - p)) ^ r) * ∑ S ∈ ((nbhdB G i).powerset.filter (fun S => S.card = r)), ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:45
def clipTo

Clip a scalar to [-radius,radius].

Definition (Lean source)
def clipTo (radius x : ℝ) : ℝ := max (-radius) (min radius x)
CausalSmith.Experimentation.SnipeDegreeFrontier.clipTo · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:55

SNIPE, as one graph-aware estimator valid for every model in the supremum.

Definition (Lean source)
noncomputable def snipeEstimator (β : ℕ) (p : ℝ) : Estimator V := fun G z y => (Fintype.card V : ℝ)⁻¹ * ∑ i : V, y i * snipeScore G β p i z
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeEstimator · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:59

SNIPE projected onto the coefficient-class target interval [-B,B].

Definition (Lean source)
noncomputable def snipeClipped (B : ℝ) (β : ℕ) (p : ℝ) : Estimator V := fun G z y => clipTo B (snipeEstimator β p G z y)
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeClipped · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:66
def snipeEstimatorBundle Definition 8 in the paper ↗

The paper's two jointly defined SNIPE estimators: the raw estimator and its Euclidean projection onto [-B,B].

Definition (Lean source)
-- @node: def:snipe-estimator noncomputable def snipeEstimatorBundle (B : ℝ) (β : ℕ) (p : ℝ) : Estimator V × Estimator V := (snipeEstimator β p, snipeClipped B β p)
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeEstimatorBundle · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:71
def riskAt

Design MSE of one graph-aware estimator at a coefficient-mass model.

Definition (Lean source)
noncomputable def riskAt (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (M : ModelClass V d β B) (est : Estimator V) : ℝ := (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).mse (fun z => est (edgeFn M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)
CausalSmith.Experimentation.SnipeDegreeFrontier.riskAt · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:78

Worst-case MSE over the coefficient-mass model class.

Definition (Lean source)
noncomputable def worstRisk (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) (est : Estimator V) : ℝ := sSup (Set.range fun M : ModelClass V d β B => riskAt p hp0 hp1 M est)
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRisk · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:86

A measurable estimator is admissible for the real-valued minimax infimum only when its modelwise risk range is bounded above. This excludes the conditionally-complete sSup junk value for unbounded competitors.

Definition (Lean source)
def AdmissibleEstimator (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) (est : Estimator V) : Prop := OutcomeMeasurable est ∧ BddAbove (Set.range fun M : ModelClass V d β B => riskAt p hp0 hp1 M est)
CausalSmith.Experimentation.SnipeDegreeFrontier.AdmissibleEstimator · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:92

Infimum, over measurable graph-aware estimators, of worst-case MSE.

Definition (Lean source)
-- @node: def:minimax-risk noncomputable def minimaxRisk (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) : ℝ := sInf {r : ℝ | ∃ est : Estimator V, AdmissibleEstimator p hp0 hp1 d β B est ∧ r = worstRisk p hp0 hp1 d β B est}
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRisk · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:102
def riskAtBdd

Design MSE at a uniformly bounded-outcome model.

Definition (Lean source)
noncomputable def riskAtBdd (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (M : BddOutcomeModelClass V d β B) (est : Estimator V) : ℝ := (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).mse (fun z => est (edgeFnBdd M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)
CausalSmith.Experimentation.SnipeDegreeFrontier.riskAtBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:112

Worst-case MSE over uniformly bounded potential outcomes.

Definition (Lean source)
noncomputable def worstRiskBdd (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) (est : Estimator V) : ℝ := sSup (Set.range fun M : BddOutcomeModelClass V d β B => riskAtBdd p hp0 hp1 M est)
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRiskBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:120

Bounded-outcome analogue of AdmissibleEstimator.

Definition (Lean source)
def AdmissibleEstimatorBdd (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) (est : Estimator V) : Prop := OutcomeMeasurable est ∧ BddAbove (Set.range fun M : BddOutcomeModelClass V d β B => riskAtBdd p hp0 hp1 M est)
CausalSmith.Experimentation.SnipeDegreeFrontier.AdmissibleEstimatorBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:127

The coefficient-mass minimax risk in the two-class notation.

Definition (Lean source)
noncomputable def minimaxRiskL1 (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) : ℝ := @minimaxRisk V _ _ p hp0 hp1 d β B
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRiskL1 · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:135

The minimax risk over the uniformly bounded-outcome class.

Definition (Lean source)
noncomputable def minimaxRiskBddOutcome (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) : ℝ := sInf {r : ℝ | ∃ est : Estimator V, AdmissibleEstimatorBdd p hp0 hp1 d β B est ∧ r = worstRiskBdd p hp0 hp1 d β B est}
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRiskBddOutcome · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:142
def twoClassMinimaxRisks Definition 13 in the paper ↗

The two minimax risks introduced simultaneously in the paper.

Definition (Lean source)
-- @node: def:two-class-minimax-risks noncomputable def twoClassMinimaxRisks (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) : ℝ × ℝ := (minimaxRiskL1 (V := V) p hp0 hp1 d β B, minimaxRiskBddOutcome (V := V) p hp0 hp1 d β B)
CausalSmith.Experimentation.SnipeDegreeFrontier.twoClassMinimaxRisks · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:151

SNIPE projected onto the bounded-outcome target interval [-2B,2B].

Definition (Lean source)
-- @node: def:bounded-outcome-clipped-snipe noncomputable def snipeClippedBdd (B : ℝ) (β : ℕ) (p : ℝ) : Estimator V := fun G z y => clipTo (2 * B) (snipeEstimator β p G z y)
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeClippedBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Estimator.lean:159
Helpers.BernoulliFourier 4 declarations These are the two product-design identities used by both the block representer and the global SNIPE variance argument.

Bernoulli Fourier moments

These are the two product-design identities used by both the block representer and the global SNIPE variance argument.

def centeredMonomial

A centered Bernoulli monomial.

Definition (Lean source)
noncomputable def centeredMonomial {d : ℕ} (p : ℝ) (S : Finset (Fin d)) : (Fin d → Bool) → ℝ := fun z => ∏ j ∈ S, (blockInd z j - p)
CausalSmith.Experimentation.SnipeDegreeFrontier.centeredMonomial · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BernoulliFourier.lean:19

Expectation of a coordinatewise product under the common-probability Bernoulli block design.

Formal statement
d :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
g :
Fin d → Bool → ℝ
(blockDesign d p hp0 hp1).E (fun z => ∏ i, g i (z i))
= ∏ i, (p * g i true + (1 - p) * g i false)
Proof (Lean source)
lemma E_coordinate_prod (d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (g : Fin d → Bool → ℝ) : (blockDesign d p hp0 hp1).E (fun z => ∏ i, g i (z i)) = ∏ i, (p * g i true + (1 - p) * g i false) := by unfold blockDesign bernoulliDesign rw [FiniteDesign.E_prod_prod] apply Finset.prod_congr rfl intro i _ rw [coinDesign_E]
CausalSmith.Experimentation.SnipeDegreeFrontier.E_coordinate_prod · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BernoulliFourier.lean:24
theorem E_centeredMonomial_mul

Centered monomials are orthogonal under the product Bernoulli design.

Formal statement
d :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
S T :
(blockDesign d p hp0 hp1).E (fun z => centeredMonomial p S z * centeredMonomial p T z)
= if S = T then (p * (1 - p)) ^ S.card else 0
Proof (Lean source)
lemma E_centeredMonomial_mul (d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (S T : Finset (Fin d)) : (blockDesign d p hp0 hp1).E (fun z => centeredMonomial p S z * centeredMonomial p T z) = if S = T then (p * (1 - p)) ^ S.card else 0 := by let x : Bool → ℝ := fun b => (if b then 1 else 0) - p have hpoint (z : Fin d → Bool) : centeredMonomial p S z * centeredMonomial p T z = ∏ i, (if i ∈ S then x (z i) else 1) * (if i ∈ T then x (z i) else 1) := by simp only [centeredMonomial, blockInd, x] rw [Finset.prod_mul_distrib] congr 1 <;> simp rw [show (fun z => centeredMonomial p S z * centeredMonomial p T z) = (fun z => ∏ i, ((if i ∈ S then x (z i) else 1) * (if i ∈ T then x (z i) else 1))) by funext z rw [hpoint z, Finset.prod_mul_distrib]] rw [E_coordinate_prod d p hp0 hp1 (fun i b => (if i ∈ S then x b else 1) * (if i ∈ T then x b else 1))] by_cases hST : S = T · subst T rw [if_pos rfl] have hfactor (i : Fin d) : p * ((if i ∈ S then x true else 1) * (if i ∈ S then x true else 1)) + (1 - p) * ((if i ∈ S then x false else 1) * (if i ∈ S then x false else 1)) = if i ∈ S then p * (1 - p) else 1 := by by_cases hi : i ∈ S <;> simp [hi, x] <;> ring simp_rw [hfactor] rw [Finset.prod_ite_mem] simp · rw [if_neg hST] have hdiff : ∃ i, (i ∈ S ∧ i ∉ T) ∨ (i ∈ T ∧ i ∉ S) := by by_contra h apply hST ext i constructor · intro hiS by_contra hiT exact h ⟨i, inl ⟨hiS, hiT⟩⟩ · intro hiT by_contra hiS exact h ⟨i, inr ⟨hiT, hiS⟩⟩ obtain ⟨i, hi⟩ := hdiff apply Finset.prod_eq_zero (Finset.mem_univ i) rcases hi with hi | hi · simp [hi.1, hi.2, x] <;> ring · simp [hi.1, hi.2, x] <;> ring
CausalSmith.Experimentation.SnipeDegreeFrontier.E_centeredMonomial_mul · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BernoulliFourier.lean:37
theorem E_centeredMonomial_mul_raw

A centered monomial pairs with a raw monomial exactly when its support is contained in the raw support.

Formal statement
d :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
S T :
hS :
S.Nonempty
(blockDesign d p hp0 hp1).E (fun z => centeredMonomial p S z * rawMonomial T z)
= if S ⊆ T then (p * (1 - p)) ^ S.card * p ^ (T.card - S.card) else 0
Proof (Lean source)
lemma E_centeredMonomial_mul_raw (d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (S T : Finset (Fin d)) (hS : S.Nonempty) : (blockDesign d p hp0 hp1).E (fun z => centeredMonomial p S z * rawMonomial T z) = if S ⊆ T then (p * (1 - p)) ^ S.card * p ^ (T.card - S.card) else 0 := by let x : Bool → ℝ := fun b => (if b then 1 else 0) - p let y : Bool → ℝ := fun b => if b then 1 else 0 rw [show (fun z => centeredMonomial p S z * rawMonomial T z) = (fun z => ∏ i, ((if i ∈ S then x (z i) else 1) * (if i ∈ T then y (z i) else 1))) by funext z simp only [centeredMonomial, rawMonomial, blockInd, x, y] rw [Finset.prod_mul_distrib] congr 1 <;> simp] rw [E_coordinate_prod d p hp0 hp1 (fun i b => (if i ∈ S then x b else 1) * (if i ∈ T then y b else 1))] have hfactor (i : Fin d) : p * ((if i ∈ S then x true else 1) * (if i ∈ T then y true else 1)) + (1 - p) * ((if i ∈ S then x false else 1) * (if i ∈ T then y false else 1)) = if i ∈ S then (if i ∈ T then p * (1 - p) else 0) else if i ∈ T then p else 1 := by by_cases hiS : i ∈ S <;> by_cases hiT : i ∈ T <;> simp [hiS, hiT, x, y] <;> ring simp_rw [hfactor] by_cases hsub : S ⊆ T · rw [if_pos hsub] have hsimp (i : Fin d) : (if i ∈ S then (if i ∈ T then p * (1 - p) else 0) else if i ∈ T then p else 1) = if i ∈ S then p * (1 - p) else if i ∈ T then p else 1 := by by_cases hi : i ∈ S · simp [hi, hsub hi] · simp [hi] simp_rw [hsimp] have hsplit (i : Fin d) : (if i ∈ S then p * (1 - p) else if i ∈ T then p else 1) = (if i ∈ S then p * (1 - p) else 1) * (if i ∈ T \ S then p else 1) := by by_cases hiS : i ∈ S <;> by_cases hiT : i ∈ T <;> simp [hiS, hiT] simp_rw [hsplit, Finset.prod_mul_distrib] have hcard : (T \ S).card = T.card - S.card := by rw [Finset.card_sdiff, Finset.inter_eq_left.mpr hsub] rw [Finset.prod_ite_mem_eq, Finset.prod_ite_mem_eq] simp [hcard] · rw [if_neg hsub] obtain ⟨i, hiS, hiT⟩ : ∃ i, i ∈ S ∧ i ∉ T := by simpa only [Finset.not_subset] using hsub apply Finset.prod_eq_zero (Finset.mem_univ i) simp [hiS, hiT]
CausalSmith.Experimentation.SnipeDegreeFrontier.E_centeredMonomial_mul_raw · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BernoulliFourier.lean:91
Helpers.BlockPriorHellinger 9 declarations Hellinger control for the continuous block prior

Hellinger control for the continuous block prior

theorem E_prod_equiv

Expectation under an identical-coordinate product design is invariant under a bijective relabeling of the coordinate type.

Formal statement
ι κ W :
e :
κ ≃ ι
D :
g :
(κ → W) → ℝ
(prodDesign (fun _ : ι => D)).E (fun z => g (fun k => z (e k)))
= (prodDesign (fun _ : κ => D)).E g
Proof (Lean source)
lemma FiniteDesign.E_prod_equiv {ι κ W : Type*} [Fintype ι] [Fintype κ] [Fintype W] [DecidableEq ι] [DecidableEq κ] (e : κ ≃ ι) (D : FiniteDesign W) (g : (κ → W) → ℝ) : (prodDesign (fun _ : ι => D)).E (fun z => g (fun k => z (e k))) = (prodDesign (fun _ : κ => D)).E g := by classical let q : (κ → W) ≃ (ι → W) := Equiv.arrowCongr e (Equiv.refl W) simp only [FiniteDesign.E, prodDesign_p] rw [← Equiv.sum_comp q] apply Finset.sum_congr rfl intro w hw have hq (i : ι) : q w i = w (e.symm i) := by simp [q, Equiv.arrowCongr] have harg : (fun k => q w (e k)) = w := by funext k rw [hq, e.symm_apply_apply] have hprod : (∏ i : ι, D.p (q w i)) = ∏ k : κ, D.p (w k) := by rw [← Equiv.prod_comp e (fun i : ι => D.p (q w i))] apply Finset.prod_congr rfl intro k hk rw [hq, e.symm_apply_apply] rw [harg, hprod]
CausalSmith.Experimentation.SnipeDegreeFrontier.FiniteDesign.E_prod_equiv · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:19
theorem E_blockAssignment

The global Bernoulli expectation of a function of one active block is the corresponding d-coordinate block expectation.

Formal statement
n d :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
b :
g :
(Fin d → Bool) → ℝ
(bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => g (blockAssignment n d b z))
= (blockDesign d p hp0 hp1).E g
Proof (Lean source)
lemma E_blockAssignment (n d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (b : Fin (blockCount n d)) (g : (Fin d → Bool) → ℝ) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => g (blockAssignment n d b z)) = (blockDesign d p hp0 hp1).E g := by classical let emb : Fin d → Fin n := fun k => ⟨b.val * d + k.val, by have hb : b.val < n / d := by simpa [blockCount] using b.isLt calc b.val * d + k.val < b.val * d + d := Nat.add_lt_add_left k.isLt _ _ = (b.val + 1) * d := by simp [Nat.add_mul] _ ≤ (n / d) * d := Nat.mul_le_mul_right d hb _ ≤ n := Nat.div_mul_le_self n d⟩ have hemb : Injective emb := by intro k l hkl apply Fin.ext have := congrArg val hkl dsimp [emb] at this omega let S : Finset (Fin n) := Finset.univ.image emb let e : Fin d ≃ ↥S := Equiv.ofBijective (fun k => (⟨emb k, Finset.mem_image.mpr ⟨k, Finset.mem_univ _, rfl⟩⟩ : ↥S)) ⟨by intro k l h exact hemb (congrArg val h), by intro j obtain ⟨k, hk, hkj⟩ := Finset.mem_image.mp j.property refine ⟨k, ?_⟩ apply Subtype.ext exact hkj⟩ let Dc : FiniteDesign Bool := coinDesign p hp0 hp1 let Dn : FiniteDesign (Fin n → Bool) := bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1) have hrestrict (z : Fin n → Bool) : blockAssignment n d b z = fun k => (S.restrict z) (e k) := by funext k rfl rw [show (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => g (blockAssignment n d b z)) = ∫ z, g (blockAssignment n d b z) ∂Dn.toMeasure by exact (Dn.integral_toMeasure _).symm] rw [show Dn.toMeasure = Measure.pi (fun _ : Fin n => Dc.toMeasure) by exact prodDesign_toMeasure_eq_pi (fun _ : Fin n => Dc)] rw [← Measure.infinitePi_eq_pi] rw [show (fun z : Fin n → Bool => g (blockAssignment n d b z)) = (fun z => (fun w : ↥S → Bool => g (fun k => w (e k))) (S.restrict z)) by funext z rw [hrestrict]] have hr := MeasureTheory.integral_restrict_infinitePi (fun _ : Fin n => Dc.toMeasure) (s := S) (f := fun w : ↥S → Bool => g (fun k => w (e k))) (measurable_of_finite _).aestronglyMeasurable rw [hr] · rw [← prodDesign_toMeasure_eq_pi (fun _ : ↥S => Dc)] rw [FiniteDesign.integral_toMeasure] exact FiniteDesign.E_prod_equiv e Dc g
CausalSmith.Experimentation.SnipeDegreeFrontier.E_blockAssignment · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:48
theorem blockPriorDensity_nonneg

Establishes the stated mathematical result for block prior density nonneg.

Formal statement
n d β :
B p σ :
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
0 ≤ blockPriorDensity n d β B p σ
Proof (Lean source)
lemma blockPriorDensity_nonneg (n d β : ℕ) (B p σ : ℝ) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) : 0 ≤ blockPriorDensity n d β B p σ := by intro x unfold blockPriorDensity assignmentMass apply mul_nonneg · apply Finset.prod_nonneg intro i hi split_ifs <;> linarith · apply Finset.prod_nonneg intro b hb exact cosSqDensity_nonneg (B / 2) (by linarith) _
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorDensity_nonneg · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:127
theorem blockPriorDensity_integrable

Establishes the stated mathematical result for block prior density integrable.

Formal statement
n d β :
B p σ :
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
Proof (Lean source)
lemma blockPriorDensity_integrable (n d β : ℕ) (B p σ : ℝ) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) : Integrable (blockPriorDensity n d β B p σ) (blockDominatingMeasure n d) := by classical let shift : (Fin n → Bool) → Fin (blockCount n d) → ℝ := fun z b => σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z) have hinner (z : Fin n → Bool) : Integrable (fun y : Fin (blockCount n d) → ℝ => blockPriorDensity n d β B p σ (z, y)) (Measure.pi (fun _ : Fin (blockCount n d) => volume)) := by change Integrable (fun y => assignmentMass n p z * ∏ b, cosSqDensity (B / 2) (y b - shift z b)) (Measure.pi (fun _ : Fin (blockCount n d) => volume)) exact (Integrable.fintype_prod fun b => cosSqDensity_translate_integrable (B / 2) (shift z b)).const_mul _ have hmeas : AEStronglyMeasurable (blockPriorDensity n d β B p σ) (blockDominatingMeasure n d) := by apply Measurable.aestronglyMeasurable unfold blockPriorDensity apply mul · exact (measurable_of_finite (assignmentMass n p)).comp measurable_fst · apply Finset.measurable_prod intro b hb apply (cosSqDensity_measurable (B / 2)).comp apply Measurable.sub · exact (measurable_pi_apply b).comp measurable_snd · exact (measurable_of_finite (fun z : Fin n → Bool => shift z b)).comp measurable_fst rw [blockDominatingMeasure] at hmeas ⊢ rw [integrable_prod_iff hmeas] exact ⟨Filter.Eventually.of_forall hinner, Integrable.of_finite⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorDensity_integrable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:143
theorem hellingerSqDensity_pi_eq_two_mul_one_sub_affinity

For normalized nonnegative coordinate densities, the squared Hellinger integral of their finite products is twice the product-affinity defect.

Formal statement
ι :
f g :
ι → ℝ → ℝ
hf0 :
∀ i u, 0 ≤ f i u
hg0 :
∀ i u, 0 ≤ g i u
hfint :
∀ i, Integrable (f i) volume
hgint :
∀ i, Integrable (g i) volume
hf1 :
∀ i, ∫ u, f i u = 1
hg1 :
∀ i, ∫ u, g i u = 1
haint :
∀ i, Integrable (fun u => sqrt (f i u * g i u)) volume
hellingerSqDensity (Measure.pi (fun _ : ι => volume)) (fun x => ∏ i, f i (x i)) (fun x => ∏ i, g i (x i))
= 2 * (1 - ∏ i, ∫ u, sqrt (f i u * g i u))
Proof (Lean source)
lemma hellingerSqDensity_pi_eq_two_mul_one_sub_affinity {ι : Type*} [Fintype ι] [DecidableEq ι] (f g : ι → ℝ → ℝ) (hf0 : ∀ i u, 0 ≤ f i u) (hg0 : ∀ i u, 0 ≤ g i u) (hfint : ∀ i, Integrable (f i) volume) (hgint : ∀ i, Integrable (g i) volume) (hf1 : ∀ i, ∫ u, f i u = 1) (hg1 : ∀ i, ∫ u, g i u = 1) (haint : ∀ i, Integrable (fun u => sqrt (f i u * g i u)) volume) : hellingerSqDensity (Measure.pi (fun _ : ι => volume)) (fun x => ∏ i, f i (x i)) (fun x => ∏ i, g i (x i)) = 2 * (1 - ∏ i, ∫ u, sqrt (f i u * g i u)) := by classical let F : (ι → ℝ) → ℝ := fun x => ∏ i, f i (x i) let G : (ι → ℝ) → ℝ := fun x => ∏ i, g i (x i) have hFint : Integrable F (Measure.pi (fun _ : ι => volume)) := Integrable.fintype_prod hfint have hGint : Integrable G (Measure.pi (fun _ : ι => volume)) := Integrable.fintype_prod hgint have hF0 : ∀ x, 0 ≤ F x := fun x => Finset.prod_nonneg fun i _ => hf0 i (x i) have hG0 : ∀ x, 0 ≤ G x := fun x => Finset.prod_nonneg fun i _ => hg0 i (x i) have hcross : Integrable (fun x => sqrt (F x * G x)) (Measure.pi (fun _ : ι => volume)) := by rw [show (fun x => sqrt (F x * G x)) = (fun x => ∏ i, sqrt (f i (x i) * g i (x i))) by funext x dsimp [F, G] rw [← Finset.prod_mul_distrib, Real.sqrt_prod] intro i hi exact mul_nonneg (hf0 i (x i)) (hg0 i (x i))] exact Integrable.fintype_prod haint unfold hellingerSqDensity have hpoint : (fun x => (sqrt (F x) - sqrt (G x)) ^ 2) = (fun x => F x + G x - 2 * sqrt (F x * G x)) := by funext x rw [Real.sqrt_mul (hF0 x)] nlinarith [Real.sq_sqrt (hF0 x), Real.sq_sqrt (hG0 x)] change ∫ x, (sqrt (F x) - sqrt (G x)) ^ 2 ∂(Measure.pi (fun _ : ι => volume)) = 2 * (1 - ∏ i, ∫ u, sqrt (f i u * g i u)) rw [hpoint] change ∫ x, (F + G) x - 2 * sqrt (F x * G x) ∂(Measure.pi (fun _ : ι => volume)) = 2 * (1 - ∏ i, ∫ u, sqrt (f i u * g i u)) rw [integral_sub (hFint.add hGint) (hcross.const_mul 2), show (∫ x, (F + G) x ∂Measure.pi (fun _ : ι => volume)) = ∫ x, F x + G x ∂Measure.pi (fun _ : ι => volume) by rfl, integral_add hFint hGint, integral_const_mul] rw [show (∫ x, F x ∂Measure.pi (fun _ : ι => volume)) = 1 by dsimp [F] rw [MeasureTheory.integral_fintype_prod_eq_prod] simp [hf1]] rw [show (∫ x, G x ∂Measure.pi (fun _ : ι => volume)) = 1 by dsimp [G] rw [MeasureTheory.integral_fintype_prod_eq_prod] simp [hg1]] rw [show (∫ x, sqrt (F x * G x) ∂Measure.pi (fun _ : ι => volume)) = ∏ i, ∫ u, sqrt (f i u * g i u) by exact densityAffinity_pi _ f g hf0 hg0] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.hellingerSqDensity_pi_eq_two_mul_one_sub_affinity · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:183
theorem conditional_block_hellinger_le

Conditional on an assignment, the two translated cosine-product densities have Hellinger square controlled by the sum of squared block representers.

Formal statement
n d β :
B p :
hB :
0 < B
z :
Fin n → Bool
hellingerSqDensity (Measure.pi (fun _ : Fin (blockCount n d) => volume)) (fun y => ∏ b : Fin (blockCount n d), cosSqDensity (B / 2) (y b - tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))) (fun y => ∏ b : Fin (blockCount n d), cosSqDensity (B / 2) (y b + tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)))
≤ 4 * pi ^ 2 * tiltAmplitude B β p (blockCount n d) d ^ 2 / B ^ 2 * ∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2
Proof (Lean source)
lemma conditional_block_hellinger_le (n d β : ℕ) (B p : ℝ) (hB : 0 < B) (z : Fin n → Bool) : hellingerSqDensity (Measure.pi (fun _ : Fin (blockCount n d) => volume)) (fun y => ∏ b : Fin (blockCount n d), cosSqDensity (B / 2) (y b - tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))) (fun y => ∏ b : Fin (blockCount n d), cosSqDensity (B / 2) (y b + tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))) ≤ 4 * pi ^ 2 * tiltAmplitude B β p (blockCount n d) d ^ 2 / B ^ 2 * ∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2 := by classical let s : ℝ := B / 2 let δ : ℝ := tiltAmplitude B β p (blockCount n d) d let h : Fin (blockCount n d) → ℝ := fun b => blockRepresenter β p d (blockAssignment n d b z) let f : Fin (blockCount n d) → ℝ → ℝ := fun b u => cosSqDensity s (u - δ * h b) let g : Fin (blockCount n d) → ℝ → ℝ := fun b u => cosSqDensity s (u + δ * h b) have hs : 0 < s := by dsimp [s]; linarith have hf0 : ∀ b u, 0 ≤ f b u := fun b u => cosSqDensity_nonneg s hs _ have hg0 : ∀ b u, 0 ≤ g b u := fun b u => cosSqDensity_nonneg s hs _ have hfint : ∀ b, Integrable (f b) volume := fun b => cosSqDensity_translate_integrable s (δ * h b) have hgint : ∀ b, Integrable (g b) volume := by intro b simpa [g, sub_eq_add_neg, add_comm] using cosSqDensity_translate_integrable s (-δ * h b) have hf1 : ∀ b, ∫ u, f b u = 1 := fun b => cosSqDensity_translate_integral_one s (δ * h b) hs have hg1 : ∀ b, ∫ u, g b u = 1 := by intro b simpa [g, sub_eq_add_neg, add_comm] using cosSqDensity_translate_integral_one s (-δ * h b) hs have hflp (b : Fin (blockCount n d)) : MemLp (fun u => sqrt (f b u)) 2 volume := by have hasm : AEStronglyMeasurable (fun u => sqrt (f b u)) volume := (Real.continuous_sqrt.measurable.comp_aemeasurable (hfint b).aestronglyMeasurable.aemeasurable).aestronglyMeasurable rw [memLp_two_iff_integrable_sq hasm] rw [show (fun u => sqrt (f b u) ^ 2) = f b from funext fun u => Real.sq_sqrt (hf0 b u)] exact hfint b have hglp (b : Fin (blockCount n d)) : MemLp (fun u => sqrt (g b u)) 2 volume := by have hasm : AEStronglyMeasurable (fun u => sqrt (g b u)) volume := (Real.continuous_sqrt.measurable.comp_aemeasurable (hgint b).aestronglyMeasurable.aemeasurable).aestronglyMeasurable rw [memLp_two_iff_integrable_sq hasm] rw [show (fun u => sqrt (g b u) ^ 2) = g b from funext fun u => Real.sq_sqrt (hg0 b u)] exact hgint b have haint : ∀ b, Integrable (fun u => sqrt (f b u * g b u)) volume := by intro b have hEq : (fun u => sqrt (f b u * g b u)) = (fun u => sqrt (f b u)) * fun u => sqrt (g b u) := by funext u simp only [Pi.mul_apply] rw [Real.sqrt_mul (hf0 b u)] rw [hEq] exact (hflp b).integrable_mul (hglp b) change hellingerSqDensity (Measure.pi (fun _ : Fin (blockCount n d) => volume)) (fun y => ∏ b, f b (y b)) (fun y => ∏ b, g b (y b)) ≤ 4 * pi ^ 2 * δ ^ 2 / B ^ 2 * ∑ b, h b ^ 2 rw [hellingerSqDensity_pi_eq_two_mul_one_sub_affinity f g hf0 hg0 hfint hgint hf1 hg1 haint] calc 2 * (1 - ∏ b, ∫ u, sqrt (f b u * g b u)) ≤ 2 * ∑ b, (1 - ∫ u, sqrt (f b u * g b u)) := by gcongr apply one_sub_prod_le_sum · intro b exact integral_nonneg_of_ae (Filter.Eventually.of_forall fun u => Real.sqrt_nonneg _) · intro b have hcs := MeasureTheory.integral_mul_le_Lp_mul_Lq_of_nonneg (p := (2 : ℝ)) (q := (2 : ℝ)) Real.HolderConjugate.two_two (Filter.Eventually.of_forall fun u => Real.sqrt_nonneg (f b u)) (Filter.Eventually.of_forall fun u => Real.sqrt_nonneg (g b u)) (by simpa using hflp b) (by simpa using hglp b) simp_rw [Real.rpow_two, Real.sq_sqrt (hf0 b _), Real.sq_sqrt (hg0 b _), hf1 b, hg1 b] at hcs simpa [Real.sqrt_mul (hf0 b _)] using hcs _ ≤ 2 * ∑ b, (pi ^ 2 * ((δ * h b) - (-δ * h b)) ^ 2 / (8 * s ^ 2)) := by gcongr with b simpa [f, g, sub_eq_add_neg] using cosSqDensity_affinity_defect_sharp s (δ * h b) (-δ * h b) hs _ = 4 * pi ^ 2 * δ ^ 2 / B ^ 2 * ∑ b, h b ^ 2 := by rw [Finset.mul_sum, Finset.mul_sum] apply Finset.sum_congr rfl intro b hb dsimp [s] field_simp ring
CausalSmith.Experimentation.SnipeDegreeFrontier.conditional_block_hellinger_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:255
theorem E_sum_blockRepresenter_sq

The Bernoulli average of the summed squared block representers is m / A_d.

Formal statement
n d β :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
(bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2)
= blockCount n d / blockEnergy β p d
Proof (Lean source)
lemma E_sum_blockRepresenter_sq (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2) = blockCount n d / blockEnergy β p d := by classical rw [FiniteDesign.E_sum] have hblock : (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun w => blockRepresenter β p d w ^ 2) = (blockEnergy β p d)⁻¹ := by let D := blockDesign d p (le_of_lt hp0) (le_of_lt hp1) have hD : IsProductBernoulli D p := by exact ⟨hp0, hp1, ⟨fun _ => le_of_lt hp0, fun _ => le_of_lt hp1, rfl⟩⟩ exact (blockRepresenter_contrast_energy β d p D hD hβ hd).2 rw [show (∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => blockRepresenter β p d (blockAssignment n d b z) ^ 2)) = ∑ _b : Fin (blockCount n d), (blockEnergy β p d)⁻¹ by apply Finset.sum_congr rfl intro b hb calc (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => blockRepresenter β p d (blockAssignment n d b z) ^ 2) = (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun w => blockRepresenter β p d w ^ 2) := E_blockAssignment n d p (le_of_lt hp0) (le_of_lt hp1) b (fun w => blockRepresenter β p d w ^ 2) _ = (blockEnergy β p d)⁻¹ := hblock] rw [Finset.sum_const] simp [nsmul_eq_mul, div_eq_mul_inv]
CausalSmith.Experimentation.SnipeDegreeFrontier.E_sum_blockRepresenter_sq · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:369
theorem sum_assignmentMass_mul_sum_blockRepresenter_sq

The same identity in the explicit assignment-mass notation used by the common dominating density.

Formal statement
n d β :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
∑ z : Fin n → Bool, assignmentMass n p z * (∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2)
= blockCount n d / blockEnergy β p d
Proof (Lean source)
lemma sum_assignmentMass_mul_sum_blockRepresenter_sq (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : ∑ z : Fin n → Bool, assignmentMass n p z * (∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2) = blockCount n d / blockEnergy β p d := by let D := bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1) have hprob (z : Fin n → Bool) : assignmentMass n p z = D.p z := by simp only [assignmentMass, D, bernoulliDesign, prodDesign_p, coinDesign] apply Finset.prod_congr rfl intro i hi cases z i <;> simp simp_rw [hprob] exact E_sum_blockRepresenter_sq n d β p hβ hd hp0 hp1
CausalSmith.Experimentation.SnipeDegreeFrontier.sum_assignmentMass_mul_sum_blockRepresenter_sq · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:413
theorem blockPrior_hellinger_le Lemma 4 in the paper ↗

The two explicit prior-predictive densities obey the displayed global Hellinger bound.

Formal statement
n d β :
B p :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
hB :
0 < B
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
≤ 4 * pi ^ 2 * blockCount n d * tiltAmplitude B β p (blockCount n d) d ^ 2 / (B ^ 2 * blockEnergy β p d)
Proof (Lean source)
lemma blockPrior_hellinger_le (n d β : ℕ) (B p : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 < B) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) : hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1)) ≤ 4 * pi ^ 2 * blockCount n d * tiltAmplitude B β p (blockCount n d) d ^ 2 / (B ^ 2 * blockEnergy β p d) := by classical let μy : Measure (Fin (blockCount n d) → ℝ) := Measure.pi (fun _ : Fin (blockCount n d) => volume) let δ := tiltAmplitude B β p (blockCount n d) d let Cplus : (Fin n → Bool) → (Fin (blockCount n d) → ℝ) → ℝ := fun z y => ∏ b, cosSqDensity (B / 2) (y b - δ * blockRepresenter β p d (blockAssignment n d b z)) let Cminus : (Fin n → Bool) → (Fin (blockCount n d) → ℝ) → ℝ := fun z y => ∏ b, cosSqDensity (B / 2) (y b + δ * blockRepresenter β p d (blockAssignment n d b z)) have hs : 0 < B / 2 := by linarith have ha0 (z : Fin n → Bool) : 0 ≤ assignmentMass n p z := by unfold assignmentMass apply Finset.prod_nonneg intro i hi split_ifs <;> linarith have hCplus0 (z) (y) : 0 ≤ Cplus z y := by dsimp [Cplus] exact Finset.prod_nonneg fun b _ => cosSqDensity_nonneg (B / 2) hs _ have hCminus0 (z) (y) : 0 ≤ Cminus z y := by dsimp [Cminus] exact Finset.prod_nonneg fun b _ => cosSqDensity_nonneg (B / 2) hs _ have hCplusInt (z) : Integrable (Cplus z) μy := by dsimp [Cplus, μy] exact Integrable.fintype_prod fun b => cosSqDensity_translate_integrable (B / 2) (δ * blockRepresenter β p d (blockAssignment n d b z)) have hCminusInt (z) : Integrable (Cminus z) μy := by dsimp [Cminus, μy] rw [show (fun y : Fin (blockCount n d) → ℝ => ∏ b, cosSqDensity (B / 2) (y b + δ * blockRepresenter β p d (blockAssignment n d b z))) = (fun y => ∏ b, cosSqDensity (B / 2) (y b - (-δ * blockRepresenter β p d (blockAssignment n d b z)))) by funext y apply Finset.prod_congr rfl intro b hb congr 2 ring] exact Integrable.fintype_prod fun b => cosSqDensity_translate_integrable (B / 2) (-δ * blockRepresenter β p d (blockAssignment n d b z)) have hhellInt (z) : Integrable (fun y => (sqrt (Cplus z y) - sqrt (Cminus z y)) ^ 2) μy := by have hmeas : AEStronglyMeasurable (fun y => (sqrt (Cplus z y) - sqrt (Cminus z y)) ^ 2) μy := by fun_prop apply Integrable.mono' ((hCplusInt z).const_mul 2 |>.add ((hCminusInt z).const_mul 2)) hmeas exact Filter.Eventually.of_forall fun y => by simp only [Pi.add_apply] rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] nlinarith [Real.sq_sqrt (hCplus0 z y), Real.sq_sqrt (hCminus0 z y), sq_nonneg (sqrt (Cplus z y) + sqrt (Cminus z y))] have hjointInt : Integrable (fun x : (Fin n → Bool) × (Fin (blockCount n d) → ℝ) => (sqrt (blockPriorDensity n d β B p 1 x) - sqrt (blockPriorDensity n d β B p (-1) x)) ^ 2) (blockDominatingMeasure n d) := by rw [blockDominatingMeasure] have hdensMeas (σ : ℝ) : Measurable (blockPriorDensity n d β B p σ) := by unfold blockPriorDensity apply mul · exact (measurable_of_finite (assignmentMass n p)).comp measurable_fst · apply Finset.measurable_prod intro b hb apply (cosSqDensity_measurable (B / 2)).comp apply Measurable.sub · exact (measurable_pi_apply b).comp measurable_snd · exact (measurable_of_finite (fun z : Fin n → Bool => σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))).comp measurable_fst have hmeas : AEStronglyMeasurable (fun x : (Fin n → Bool) × (Fin (blockCount n d) → ℝ) => (sqrt (blockPriorDensity n d β B p 1 x) - sqrt (blockPriorDensity n d β B p (-1) x)) ^ 2) (Measure.count.prod μy) := by exact (((Real.continuous_sqrt.measurable.comp (hdensMeas 1)).sub (Real.continuous_sqrt.measurable.comp (hdensMeas (-1)))).pow_const 2).aestronglyMeasurable rw [integrable_prod_iff hmeas] constructor · exact Filter.Eventually.of_forall fun z => by have hz : (fun y => (sqrt (blockPriorDensity n d β B p 1 (z, y)) - sqrt (blockPriorDensity n d β B p (-1) (z, y))) ^ 2) = (fun y => assignmentMass n p z * (sqrt (Cplus z y) - sqrt (Cminus z y)) ^ 2) := by funext y simp only [blockPriorDensity, Cplus, Cminus, δ, one_mul, neg_one_mul, neg_mul, sub_neg_eq_add] change (sqrt (assignmentMass n p z * Cplus z y) - sqrt (assignmentMass n p z * Cminus z y)) ^ 2 = assignmentMass n p z * (sqrt (Cplus z y) - sqrt (Cminus z y)) ^ 2 rw [Real.sqrt_mul (ha0 z), Real.sqrt_mul (ha0 z), ← mul_sub, mul_pow] rw [Real.sq_sqrt (ha0 z)] rw [hz] exact (hhellInt z).const_mul (assignmentMass n p z) · exact Integrable.of_finite unfold hellingerSqDensity rw [blockDominatingMeasure, integral_prod _ hjointInt] have hinner (z : Fin n → Bool) : (∫ y, (sqrt (blockPriorDensity n d β B p 1 (z, y)) - sqrt (blockPriorDensity n d β B p (-1) (z, y))) ^ 2 ∂μy) = assignmentMass n p z * hellingerSqDensity μy (Cplus z) (Cminus z) := by rw [show (fun y => (sqrt (blockPriorDensity n d β B p 1 (z, y)) - sqrt (blockPriorDensity n d β B p (-1) (z, y))) ^ 2) = (fun y => assignmentMass n p z * (sqrt (Cplus z y) - sqrt (Cminus z y)) ^ 2) by funext y simp only [blockPriorDensity, Cplus, Cminus, δ, one_mul, neg_one_mul, neg_mul, sub_neg_eq_add] change (sqrt (assignmentMass n p z * Cplus z y) - sqrt (assignmentMass n p z * Cminus z y)) ^ 2 = assignmentMass n p z * (sqrt (Cplus z y) - sqrt (Cminus z y)) ^ 2 rw [Real.sqrt_mul (ha0 z), Real.sqrt_mul (ha0 z), ← mul_sub, mul_pow, Real.sq_sqrt (ha0 z)]] rw [integral_const_mul] rfl rw [show (fun z : Fin n → Bool => ∫ y, (sqrt (blockPriorDensity n d β B p 1 (z, y)) - sqrt (blockPriorDensity n d β B p (-1) (z, y))) ^ 2 ∂μy) = (fun z => assignmentMass n p z * hellingerSqDensity μy (Cplus z) (Cminus z)) by funext z exact hinner z] rw [MeasureTheory.integral_fintype] · have hcount (z : Fin n → Bool) : Measure.count.real ({z} : Set (Fin n → Bool)) = 1 := by rw [measureReal_def, Measure.count_apply_finite] · simp · exact Set.finite_singleton z simp_rw [hcount, one_smul] calc ∑ z : Fin n → Bool, assignmentMass n p z * hellingerSqDensity μy (Cplus z) (Cminus z) ≤ ∑ z : Fin n → Bool, assignmentMass n p z * (4 * pi ^ 2 * δ ^ 2 / B ^ 2 * ∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2) := by apply Finset.sum_le_sum intro z hz apply mul_le_mul_of_nonneg_left _ (ha0 z) exact conditional_block_hellinger_le n d β B p hB z _ = 4 * pi ^ 2 * δ ^ 2 / B ^ 2 * (blockCount n d / blockEnergy β p d) := by rw [show (∑ z : Fin n → Bool, assignmentMass n p z * (4 * pi ^ 2 * δ ^ 2 / B ^ 2 * ∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2)) = 4 * pi ^ 2 * δ ^ 2 / B ^ 2 * ∑ z : Fin n → Bool, assignmentMass n p z * (∑ b : Fin (blockCount n d), blockRepresenter β p d (blockAssignment n d b z) ^ 2) by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro z hz ring] rw [sum_assignmentMass_mul_sum_blockRepresenter_sq n d β p hβ hd hp0 hp1] _ = 4 * pi ^ 2 * blockCount n d * δ ^ 2 / (B ^ 2 * blockEnergy β p d) := by have hA : blockEnergy β p d ≠ 0 := ne_of_gt (blockEnergy_pos β d p hβ hd hp0 hp1) have hB0 : B ≠ 0 := ne_of_gt hB field_simp · exact Integrable.of_finite
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPrior_hellinger_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockPriorHellinger.lean:434
Helpers.BlockRepresenter 8 declarations This file builds the optimization and uniform coefficient bounds on top of the finite Bernoulli identities in BlockRepresenterCore.

Block representer optimization and uniform bounds

This file builds the optimization and uniform coefficient bounds on top of the finite Bernoulli identities in BlockRepresenterCore.

theorem blockDesign_sq_eq_zero_iff Lemma blockDesign_sq_eq_zero_iff in the paper ↗

Strict product Bernoulli expectation is faithful on squares.

Formal statement
d :
p :
hp0 :
0 < p
hp1 :
p < 1
f :
(Fin d → Bool) → ℝ
(blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => f z ^ 2) = 0 ↔ f = 0
Proof (Lean source)
lemma blockDesign_sq_eq_zero_iff (d : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (f : (Fin d → Bool) → ℝ) : (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => f z ^ 2) = 0 ↔ f = 0 := by constructor · intro hf let D := blockDesign d p (le_of_lt hp0) (le_of_lt hp1) funext z have hnonneg (x : Fin d → Bool) : 0 ≤ D.p x * f x ^ 2 := mul_nonneg (D.p_nonneg x) (sq_nonneg (f x)) have hle : D.p z * f z ^ 2 ≤ ∑ x, D.p x * f x ^ 2 := Finset.single_le_sum (fun x _ => hnonneg x) (Finset.mem_univ z) have hterm : D.p z * f z ^ 2 = 0 := by apply le_antisymm · simpa [D, FiniteDesign.E] using hle.trans_eq hf · exact hnonneg z have hpz : 0 < D.p z := by dsimp [D] simp only [blockDesign, bernoulliDesign, prodDesign_p] apply Finset.prod_pos intro i hi simp only [coinDesign] cases h : z i <;> simp [h, hp0, hp1] exact sq_eq_zero_iff.mp (mul_eq_zero.mp hterm |>.resolve_left hpz.ne') · rintro rfl simp
CausalSmith.Experimentation.SnipeDegreeFrontier.blockDesign_sq_eq_zero_iff · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:18
theorem blockScore_mem_polySpace Lemma blockScore_mem_polySpace in the paper ↗

The centered score belongs to the raw low-order polynomial span.

Formal statement
β d :
p :
blockScore β p d ∈ polySpace β d
Proof (Lean source)
lemma blockScore_mem_polySpace (β d : ℕ) (p : ℝ) : blockScore β p d ∈ polySpace β d := by rw [show blockScore β p d = fun z => ∑ r ∈ Icc 1 (effBeta β d), (bernoulliContrast p r / (p * (1 - p)) ^ r) * ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), ∏ j ∈ S, (blockInd z j - p) by rfl] rw [show (fun z => ∑ r ∈ Icc 1 (effBeta β d), (bernoulliContrast p r / (p * (1 - p)) ^ r) * ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), ∏ j ∈ S, (blockInd z j - p)) = ∑ r ∈ Icc 1 (effBeta β d), (bernoulliContrast p r / (p * (1 - p)) ^ r) • (fun z => ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), ∏ j ∈ S, (blockInd z j - p)) by funext z simp] apply Submodule.sum_mem intro r hr apply Submodule.smul_mem rw [show (fun z => ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), ∏ j ∈ S, (blockInd z j - p)) = ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), (fun z => ∏ j ∈ S, (blockInd z j - p)) by funext z simp] apply Submodule.sum_mem intro S hS have hScard : S.card = r := (Finset.mem_filter.mp hS).2 have hrle : r ≤ effBeta β d := (Finset.mem_Icc.mp hr).2 rw [show (fun z => ∏ j ∈ S, (blockInd z j - p)) = ∑ T ∈ S.powerset, (-p) ^ (S.card - T.card) • rawMonomial T by funext z simpa using centeredMonomial_raw_expansion d p S z] apply Submodule.sum_mem intro T hT apply Submodule.smul_mem rw [polySpace] apply Submodule.subset_span exact ⟨T, by refine ⟨?_, rfl⟩ exact (Finset.card_le_card (Finset.mem_powerset.mp hT)).trans (hScard.le.trans hrle)⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore_mem_polySpace · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:49
theorem weightFeasibleAt_represents Lemma weightFeasibleAt_represents in the paper ↗

Weight feasibility extends from raw generators to their full span.

Formal statement
β d :
D :
w :
(Fin d → Bool) → ℝ
hw :
f :
(Fin d → Bool) → ℝ
hf :
f ∈ polySpace β d
D.E (fun z => w z * f z) = contrastFunctional f
Proof (Lean source)
lemma weightFeasibleAt_represents (β d : ℕ) (D : FiniteDesign (Fin d → Bool)) (w : (Fin d → Bool) → ℝ) (hw : WeightFeasibleAt D β w) (f : (Fin d → Bool) → ℝ) (hf : f ∈ polySpace β d) : D.E (fun z => w z * f z) = contrastFunctional f := by rw [polySpace] at hf refine Submodule.span_induction (p := fun f _ => D.E (fun z => w z * f z) = contrastFunctional f) ?_ ?_ ?_ ?_ hf · intro f hf rcases hf with ⟨S, hScard, rfl⟩ by_cases hS : S.Nonempty · rw [hw.2 S hS hScard] unfold contrastFunctional rawMonomial have hz : (∏ j ∈ S, blockInd (fun _ => false) j) = 0 := by obtain ⟨j, hj⟩ := hS exact Finset.prod_eq_zero hj (by simp [blockInd]) rw [hz] simp [blockInd] · rw [Finset.not_nonempty_iff_eq_empty.mp hS] simpa [rawMonomial, contrastFunctional] using hw.1 · simp [contrastFunctional] · intro f g _ _ hf hg rw [show (fun z => w z * (f + g) z) = (fun z => w z * f z + w z * g z) by funext z simp [mul_add]] rw [D.E_add, hf, hg] simp [contrastFunctional] ring · intro a f _ hf rw [show (fun z => w z * (a • f) z) = (fun z => a * (w z * f z)) by funext z change w z * (a * f z) = a * (w z * f z) ring] rw [D.E_const_mul, hf] simp [contrastFunctional, mul_sub]
CausalSmith.Experimentation.SnipeDegreeFrontier.weightFeasibleAt_represents · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:102
theorem perturbFeasible_energy_unique Lemma perturbFeasible_energy_unique in the paper ↗

The normalized score is the unique perturbation-program optimizer.

Formal statement
β d :
p :
D :
:
1 ≤ β
hd :
1 ≤ d
h :
(Fin d → Bool) → ℝ
hh :
(blockEnergy β p d)⁻¹ ≤ D.E (fun z => h z ^ 2) ∧
(D.E (fun z => h z ^ 2) = (blockEnergy β p d)⁻¹ ↔ h = blockRepresenter β p d)
Proof (Lean source)
lemma perturbFeasible_energy_unique (β d : ℕ) (p : ℝ) (D : FiniteDesign (Fin d → Bool)) (hD : IsProductBernoulli D p) (hβ : 1 ≤ β) (hd : 1 ≤ d) (h : (Fin d → Bool) → ℝ) (hh : PerturbFeasible β d h) : (blockEnergy β p d)⁻¹ ≤ D.E (fun z => h z ^ 2) ∧ (D.E (fun z => h z ^ 2) = (blockEnergy β p d)⁻¹ ↔ h = blockRepresenter β p d) := by let A := blockEnergy β p d let g := blockScore β p d have hA : 0 < A := blockEnergy_pos β d p hβ hd hD.1 hD.2.1 have hgh : D.E (fun z => g z * h z) = 1 := by simpa [g, hh.2] using blockScore_represents β d p D hD h hh.1 have hgg : D.E (fun z => g z ^ 2) = A := blockScore_sq_expectation β d p D hD have hsq : D.E (fun z => (A * h z - g z) ^ 2) = A ^ 2 * D.E (fun z => h z ^ 2) - A := by rw [show (fun z => (A * h z - g z) ^ 2) = (fun z => A ^ 2 * h z ^ 2 - 2 * A * (g z * h z) + g z ^ 2) by funext z ring] rw [D.E_add, D.E_sub, D.E_const_mul, D.E_const_mul, hgh, hgg] ring constructor · have hn := D.E_nonneg (fun z => sq_nonneg (A * h z - g z)) rw [hsq] at hn rw [inv_le_iff_one_le_mul₀ hA] nlinarith · constructor · intro heq change D.E (fun z => h z ^ 2) = A⁻¹ at heq have hz : D.E (fun z => (A * h z - g z) ^ 2) = 0 := by rw [hsq, heq] field_simp [hA.ne'] ring rcases hD with ⟨hp, hp', hpD⟩ have hDeq : D = blockDesign d p (le_of_lt hp) (le_of_lt hp') := by rcases hpD with ⟨hp0', hp1', rfl⟩ unfold blockDesign congr have hzero : (fun z => A * h z - g z) = 0 := by rw [hDeq] at hz exact (blockDesign_sq_eq_zero_iff d p hp hp' (fun z => A * h z - g z)).mp hz have hfun : h = fun z => g z / A := by funext z have hz := congrFun hzero z simp only [Pi.zero_apply] at hz apply (eq_div_iff hA.ne').2 linarith rw [hfun] funext z simp [blockRepresenter, Nat.ne_of_gt hd, g, A] · rintro rfl exact (blockRepresenter_contrast_energy β d p D hD hβ hd).2
CausalSmith.Experimentation.SnipeDegreeFrontier.perturbFeasible_energy_unique · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:142
theorem weightFeasibleAt_energy_unique Lemma weightFeasibleAt_energy_unique in the paper ↗

The score is the unique weight-program optimizer.

Formal statement
β d :
p :
D :
w :
(Fin d → Bool) → ℝ
hw :
blockEnergy β p d ≤ D.E (fun z => w z ^ 2) ∧
(D.E (fun z => w z ^ 2) = blockEnergy β p d ↔ w = blockScore β p d)
Proof (Lean source)
lemma weightFeasibleAt_energy_unique (β d : ℕ) (p : ℝ) (D : FiniteDesign (Fin d → Bool)) (hD : IsProductBernoulli D p) (w : (Fin d → Bool) → ℝ) (hw : WeightFeasibleAt D β w) : blockEnergy β p d ≤ D.E (fun z => w z ^ 2) ∧ (D.E (fun z => w z ^ 2) = blockEnergy β p d ↔ w = blockScore β p d) := by let A := blockEnergy β p d let g := blockScore β p d have hwg : D.E (fun z => w z * g z) = A := by rw [show A = contrastFunctional g by exact (blockScore_contrast β d p).symm] exact weightFeasibleAt_represents β d D w hw g (blockScore_mem_polySpace β d p) have hgg : D.E (fun z => g z ^ 2) = A := blockScore_sq_expectation β d p D hD have hsq : D.E (fun z => (w z - g z) ^ 2) = D.E (fun z => w z ^ 2) - A := by rw [show (fun z => (w z - g z) ^ 2) = (fun z => w z ^ 2 - 2 * (w z * g z) + g z ^ 2) by funext z ring] rw [D.E_add, D.E_sub, D.E_const_mul, hwg, hgg] ring constructor · have hn := D.E_nonneg (fun z => sq_nonneg (w z - g z)) rw [hsq] at hn linarith · constructor · intro heq have hz : D.E (fun z => (w z - g z) ^ 2) = 0 := by rw [hsq, heq] ring rcases hD with ⟨hp, hp', hpD⟩ have hDeq : D = blockDesign d p (le_of_lt hp) (le_of_lt hp') := by rcases hpD with ⟨hp0', hp1', rfl⟩ unfold blockDesign congr have hzero : (fun z => w z - g z) = 0 := by rw [hDeq] at hz exact (blockDesign_sq_eq_zero_iff d p hp hp' (fun z => w z - g z)).mp hz funext z have hz := congrFun hzero z simpa using sub_eq_zero.mp hz · rintro rfl exact hgg
CausalSmith.Experimentation.SnipeDegreeFrontier.weightFeasibleAt_energy_unique · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:200
theorem blockRepresenter_perturbFeasible

The normalized block score satisfies the perturbation constraints.

Formal statement
β d :
p :
D :
:
1 ≤ β
hd :
1 ≤ d
Proof (Lean source)
lemma blockRepresenter_perturbFeasible (β d : ℕ) (p : ℝ) (D : FiniteDesign (Fin d → Bool)) (hD : IsProductBernoulli D p) (hβ : 1 ≤ β) (hd : 1 ≤ d) : PerturbFeasible β d (blockRepresenter β p d) := by constructor · rw [show blockRepresenter β p d = (blockEnergy β p d)⁻¹ • blockScore β p d by funext z simp [blockRepresenter, Nat.ne_of_gt hd, div_eq_inv_mul]] exact Submodule.smul_mem _ _ (blockScore_mem_polySpace β d p) · exact (blockRepresenter_contrast_energy β d p D hD hβ hd).1
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRepresenter_perturbFeasible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:251

Both finite-dimensional programs attain their stated exact values.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hp0' :
0 < p
hp1' :
p < 1
perturbProg β d p hp0 hp1 = (blockEnergy β p d)⁻¹ ∧
weightProg β d p hp0 hp1 = blockEnergy β p d
Proof (Lean source)
lemma blockPrograms_exact (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hp0' : 0 < p) (hp1' : p < 1) : perturbProg β d p hp0 hp1 = (blockEnergy β p d)⁻¹ ∧ weightProg β d p hp0 hp1 = blockEnergy β p d := by let D := blockDesign d p hp0 hp1 have hD : IsProductBernoulli D p := by exact ⟨hp0', hp1', ⟨fun _ => hp0, fun _ => hp1, rfl⟩⟩ have hrepFeas : PerturbFeasible β d (blockRepresenter β p d) := blockRepresenter_perturbFeasible β d p D hD hβ hd constructor · apply le_antisymm · apply csInf_le · refine ⟨0, ?_⟩ rintro q ⟨h, _hh, rfl⟩ exact D.E_nonneg (fun z => sq_nonneg (h z)) · refine ⟨blockRepresenter β p d, hrepFeas, ?_⟩ exact (blockRepresenter_contrast_energy β d p D hD hβ hd).2.symm · apply le_csInf · refine ⟨D.E (fun z => blockRepresenter β p d z ^ 2), ?_⟩ exact ⟨blockRepresenter β p d, hrepFeas, rfl⟩ intro q hq rcases hq with ⟨h, hh, rfl⟩ exact (perturbFeasible_energy_unique β d p D hD hβ hd h hh).1 · apply le_antisymm · apply csInf_le · refine ⟨0, ?_⟩ rintro q ⟨w, _hw, rfl⟩ exact D.E_nonneg (fun z => sq_nonneg (w z)) · refine ⟨blockScore β p d, ?_, ?_⟩ · exact blockScore_weightFeasibleAt β d p D hD · exact (blockScore_sq_expectation β d p D hD).symm · apply le_csInf · refine ⟨D.E (fun z => blockScore β p d z ^ 2), ?_⟩ exact ⟨blockScore β p d, blockScore_weightFeasibleAt β d p D hD, rfl⟩ intro q hq rcases hq with ⟨w, hw, rfl⟩ exact (weightFeasibleAt_energy_unique β d p D hD w hw).1
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPrograms_exact · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:264
theorem blockEnergy_representer Lemma 1 in the paper ↗

The full block representer result, including both optimization programs and constants uniform in block size.

Formal statement
∀ (β : ℕ) (p : ℝ),
1
≤ β → 0 < p → p < 1 → ∃ c₁ c₂ H : ℝ, 0 < c₁ ∧ c₁ ≤ c₂ ∧ 0 < H ∧ ∀ (d : ℕ), 1 ≤ d → c₁ * (choose d (kStar d β p) : ℝ) ≤ blockEnergy β p d ∧ blockEnergy β p d ≤ c₂ * (choose d (kStar d β p) : ℝ) ∧ (∀ (D : FiniteDesign (Fin d → Bool)), IsProductBernoulli D p → (∀ f : (Fin d → Bool) → ℝ, f ∈ polySpace β d → D.E (fun z => blockScore β p d z * f z) = contrastFunctional f) ∧ contrastFunctional (blockRepresenter β p d) = 1 ∧ D.E (fun z => blockRepresenter β p d z ^ 2) = (blockEnergy β p d)⁻¹ ∧ PerturbFeasible β d (blockRepresenter β p d) ∧ (∀ h : (Fin d → Bool) → ℝ, PerturbFeasible β d h → (blockEnergy β p d)⁻¹ ≤ D.E (fun z => h z ^ 2) ∧ (D.E (fun z => h z ^ 2) = (blockEnergy β p d)⁻¹ ↔ h = blockRepresenter β p d)) ∧ (∀ w : (Fin d → Bool) → ℝ, WeightFeasibleAt D β w → blockEnergy β p d ≤ D.E (fun z => w z ^ 2) ∧ (D.E (fun z => w z ^ 2) = blockEnergy β p d ↔ w = blockScore β p d))) ∧ (∀ (hp0 : 0 ≤ p) (hp1 : p ≤ 1), perturbProg β d p hp0 hp1 = (blockEnergy β p d)⁻¹ ∧ weightProg β d p hp0 hp1 = blockEnergy β p d) ∧ (∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|) ≤ H
Proof (Lean source)
-- @node: lem:block-energy-representer lemma blockEnergy_representer : ∀ (β : ℕ) (p : ℝ), 1 ≤ β → 0 < p → p < 1 → ∃ c₁ c₂ H : ℝ, 0 < c₁ ∧ c₁ ≤ c₂ ∧ 0 < H ∧ ∀ (d : ℕ), 1 ≤ d → c₁ * (choose d (kStar d β p) : ℝ) ≤ blockEnergy β p d ∧ blockEnergy β p d ≤ c₂ * (choose d (kStar d β p) : ℝ) ∧ (∀ (D : FiniteDesign (Fin d → Bool)), IsProductBernoulli D p → (∀ f : (Fin d → Bool) → ℝ, f ∈ polySpace β d → D.E (fun z => blockScore β p d z * f z) = contrastFunctional f) ∧ contrastFunctional (blockRepresenter β p d) = 1 ∧ D.E (fun z => blockRepresenter β p d z ^ 2) = (blockEnergy β p d)⁻¹ ∧ PerturbFeasible β d (blockRepresenter β p d) ∧ (∀ h : (Fin d → Bool) → ℝ, PerturbFeasible β d h → (blockEnergy β p d)⁻¹ ≤ D.E (fun z => h z ^ 2) ∧ (D.E (fun z => h z ^ 2) = (blockEnergy β p d)⁻¹ ↔ h = blockRepresenter β p d)) ∧ (∀ w : (Fin d → Bool) → ℝ, WeightFeasibleAt D β w → blockEnergy β p d ≤ D.E (fun z => w z ^ 2) ∧ (D.E (fun z => w z ^ 2) = blockEnergy β p d ↔ w = blockScore β p d))) ∧ (∀ (hp0 : 0 ≤ p) (hp1 : p ≤ 1), perturbProg β d p hp0 hp1 = (blockEnergy β p d)⁻¹ ∧ weightProg β d p hp0 hp1 = blockEnergy β p d) ∧ (∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|) ≤ H := by intro β p hβ hp0 hp1 let c₁ := blockLowerConst β p let c₂ := blockUpperConst β p let H := blockRawMassConst β p have hc₁ : 0 < c₁ := (blockLowerConst_spec β p hβ hp0 hp1).1 have hcomp1 := blockEnergy_uniform_compare β 1 p hβ (by omega) hp0 hp1 have hK : 0 < (choose 1 (kStar 1 β p) : ℝ) := by have hk := kStar_mem_exposedOrder β 1 p hβ (by omega) have hkle : kStar 1 β p ≤ 1 := (Finset.mem_Icc.mp (Finset.mem_filter.mp hk).1).2.trans (min_le_right β 1) exact_mod_cast Nat.choose_pos hkle have hc₁c₂ : c₁ ≤ c₂ := by dsimp [c₁, c₂] at hcomp1 ⊢ nlinarith have hH : 0 < H := by dsimp [H, blockRawMassConst, c₁] have hsum : 0 ≤ (((2 ^ β : ℕ) : ℝ) * ∑ r ∈ Icc 1 β, rawMassCoeff p r) / blockLowerConst β p := by apply div_nonneg · apply mul_nonneg (by positivity) apply sum_nonneg intro r hr simp only [rawMassCoeff] exact mul_nonneg (div_nonneg (abs_nonneg _) (pow_nonneg (mul_nonneg (le_of_lt hp0) (le_of_lt (sub_pos.mpr hp1))) r)) (pow_nonneg (by linarith) r) · exact le_of_lt ((blockLowerConst_spec β p hβ hp0 hp1).1) linarith refine ⟨c₁, c₂, H, hc₁, hc₁c₂, hH, ?_⟩ intro d hd have hcomp := blockEnergy_uniform_compare β d p hβ hd hp0 hp1 refine ⟨hcomp.1, hcomp.2, ?_, ?_, ?_⟩ · intro D hD refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ · intro f hf exact blockScore_represents β d p D hD f hf · exact (blockRepresenter_contrast_energy β d p D hD hβ hd).1 · exact (blockRepresenter_contrast_energy β d p D hD hβ hd).2 · exact blockRepresenter_perturbFeasible β d p D hD hβ hd · intro h hh exact perturbFeasible_energy_unique β d p D hD hβ hd h hh · intro w hw exact weightFeasibleAt_energy_unique β d p D hD w hw · intro hp0' hp1' exact blockPrograms_exact β d p hβ hd hp0' hp1' hp0 hp1 · exact blockRawCoef_mass_uniform β d p hβ hd hp0 hp1
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEnergy_representer · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenter.lean:304
Helpers.BlockRepresenterCore 16 declarations This file states the Bernoulli Riesz identities, the two unique minimizer claims, the binomial comparison, and the uniform raw-coefficient bound.

Block representer identities

This file states the Bernoulli Riesz identities, the two unique minimizer claims, the binomial comparison, and the uniform raw-coefficient bound.

def WeightFeasibleAt

Weight feasibility phrased directly against an arbitrary finite design.

Definition (Lean source)
def WeightFeasibleAt {d : ℕ} (D : FiniteDesign (Fin d → Bool)) (β : ℕ) (w : (Fin d → Bool) → ℝ) : Prop := D.E w = 0 ∧ ∀ S : Finset (Fin d), S.Nonempty → S.card ≤ effBeta β d → D.E (fun z => w z * rawMonomial S z) = 1
CausalSmith.Experimentation.SnipeDegreeFrontier.WeightFeasibleAt · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:19

The finite binomial identity underlying the representer moment.

Formal statement
p :
t :
ht :
1 ≤ t
∑ r ∈ Icc 1 t, (Nat.choose t r : ℝ) * bernoulliContrast p r * p ^ (t - r) = 1
Proof (Lean source)
lemma blockContrast_binomial (p : ℝ) (t : ℕ) (ht : 1 ≤ t) : ∑ r ∈ Icc 1 t, (Nat.choose t r : ℝ) * bernoulliContrast p r * p ^ (t - r) = 1 := by have hfull : (∑ r ∈ range (t + 1), (Nat.choose t r : ℝ) * bernoulliContrast p r * p ^ (t - r)) = 1 := by simp only [bernoulliContrast] rw [show (fun r => (Nat.choose t r : ℝ) * ((1 - p) ^ r - (-p) ^ r) * p ^ (t - r)) = (fun r => (Nat.choose t r : ℝ) * (1 - p) ^ r * p ^ (t - r) - (Nat.choose t r : ℝ) * (-p) ^ r * p ^ (t - r)) by funext r ring] rw [Finset.sum_sub_distrib] have h1 : (∑ r ∈ range (t + 1), (Nat.choose t r : ℝ) * (1 - p) ^ r * p ^ (t - r)) = 1 := by simpa [mul_comm, mul_left_comm, mul_assoc] using (add_pow (1 - p) p t).symm have h2 : (∑ r ∈ range (t + 1), (Nat.choose t r : ℝ) * (-p) ^ r * p ^ (t - r)) = 0 := by have ht0 : t ≠ 0 := by omega simpa [mul_comm, mul_left_comm, mul_assoc, ht0] using (add_pow (-p) p t).symm rw [h1, h2] norm_num rw [← hfull] apply Finset.sum_subset · intro r hr simp only [Finset.mem_Icc] at hr simp [hr.2] · intro r hrange hnot have hr0 : r = 0 := by simp only [Finset.mem_range] at hrange simp only [Finset.mem_Icc, not_and_or] at hnot omega subst r simp [bernoulliContrast]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockContrast_binomial · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:27

The score pairs to one with every eligible nonconstant raw monomial.

Formal statement
β d :
p :
hp0 :
0 < p
hp1 :
p < 1
T :
hT :
T.Nonempty
hTcard :
T.card ≤ effBeta β d
(blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => blockScore β p d z * rawMonomial T z)
= 1
Proof (Lean source)
lemma blockScore_raw_moment (β d : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (T : Finset (Fin d)) (hT : T.Nonempty) (hTcard : T.card ≤ effBeta β d) : (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => blockScore β p d z * rawMonomial T z) = 1 := by let v := p * (1 - p) have hv : v ≠ 0 := mul_ne_zero (ne_of_gt hp0) (ne_of_gt (sub_pos.mpr hp1)) have hmoment (S : Finset (Fin d)) (hS : S.Nonempty) : (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => (∏ j ∈ S, (blockInd z j - p)) * rawMonomial T z) = if S ⊆ T then v ^ S.card * p ^ (T.card - S.card) else 0 := by exact E_centeredMonomial_mul_raw d p (le_of_lt hp0) (le_of_lt hp1) S T hS simp only [blockScore, Finset.sum_mul, Finset.mul_sum, FiniteDesign.E_sum] simp_rw [mul_assoc, FiniteDesign.E_const_mul] rw [show (∑ r ∈ Icc 1 (effBeta β d), ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), bernoulliContrast p r / v ^ r * (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => (∏ j ∈ S, (blockInd z j - p)) * rawMonomial T z)) = ∑ r ∈ Icc 1 (effBeta β d), ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), bernoulliContrast p r / v ^ r * (if S ⊆ T then v ^ S.card * p ^ (T.card - S.card) else 0) by apply Finset.sum_congr rfl intro r hr apply Finset.sum_congr rfl intro S hS have hc : S.card = r := (Finset.mem_filter.mp hS).2 have hr1 : 1 ≤ r := (Finset.mem_Icc.mp hr).1 rw [hmoment S (Finset.card_pos.mp (by omega))]] rw [show (∑ r ∈ Icc 1 (effBeta β d), ∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), bernoulliContrast p r / v ^ r * (if S ⊆ T then v ^ S.card * p ^ (T.card - S.card) else 0)) = ∑ r ∈ Icc 1 (effBeta β d), (Nat.choose T.card r : ℝ) * bernoulliContrast p r * p ^ (T.card - r) by apply Finset.sum_congr rfl intro r hr rw [show Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r) = Finset.univ.powersetCard r by ext S simp [Finset.mem_powersetCard, eq_comm]] rw [show (∑ S ∈ Finset.univ.powersetCard r, bernoulliContrast p r / v ^ r * (if S ⊆ T then v ^ S.card * p ^ (T.card - S.card) else 0)) = ∑ S ∈ Finset.univ.powersetCard r, if S ⊆ T then bernoulliContrast p r * p ^ (T.card - r) else 0 by apply Finset.sum_congr rfl intro S hS have hScard : S.card = r := (Finset.mem_powersetCard.mp hS).2 rw [hScard] by_cases hs : S ⊆ T · simp only [if_pos hs] field_simp · simp [hs]] rw [← Finset.sum_filter] rw [show (Finset.univ.powersetCard r).filter (fun S => S ⊆ T) = T.powersetCard r by ext S simp [Finset.mem_powersetCard, and_comm]] rw [Finset.sum_const, Finset.card_powersetCard] simp [mul_assoc]] rw [show (∑ r ∈ Icc 1 (effBeta β d), (Nat.choose T.card r : ℝ) * bernoulliContrast p r * p ^ (T.card - r)) = ∑ r ∈ Icc 1 T.card, (Nat.choose T.card r : ℝ) * bernoulliContrast p r * p ^ (T.card - r) by symm apply Finset.sum_subset_zero_on_sdiff · intro r hr simp only [Finset.mem_Icc] at hr ⊢ exact ⟨hr.1, le_trans hr.2 hTcard⟩ · intro r hr have hlt : T.card < r := by simp only [mem_sdiff, Finset.mem_Icc, not_and_or] at hr omega simp [Nat.choose_eq_zero_of_lt hlt] · intro r hr rfl] exact blockContrast_binomial p T.card (Finset.card_pos.mpr hT)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore_raw_moment · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:68

The block score is centered under its product Bernoulli design.

Formal statement
β d :
p :
hp0 :
0 < p
hp1 :
p < 1
(blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (blockScore β p d) = 0
Proof (Lean source)
lemma blockScore_mean_zero (β d : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) : (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (blockScore β p d) = 0 := by have hmoment (S : Finset (Fin d)) (hS : S.Nonempty) : (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => ∏ j ∈ S, (blockInd z j - p)) = 0 := by have h := E_centeredMonomial_mul_raw d p (le_of_lt hp0) (le_of_lt hp1) S ∅ hS simpa [centeredMonomial, rawMonomial, hS.ne_empty] using h change (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => blockScore β p d z) = 0 simp only [blockScore] rw [FiniteDesign.E_sum] apply Finset.sum_eq_zero intro r hr rw [FiniteDesign.E_const_mul] rw [FiniteDesign.E_sum] rw [show (∑ S ∈ Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r), (blockDesign d p (le_of_lt hp0) (le_of_lt hp1)).E (fun z => ∏ j ∈ S, (blockInd z j - p))) = 0 by apply Finset.sum_eq_zero intro S hS have hScard : S.card = r := (Finset.mem_filter.mp hS).2 have hr1 : 1 ≤ r := (Finset.mem_Icc.mp hr).1 rw [hmoment S (Finset.card_pos.mp (by omega))]] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore_mean_zero · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:162
theorem blockScore_weightFeasibleAt Lemma blockScore_weightFeasibleAt in the paper ↗

The canonical block score satisfies all unbiased-weight moment restrictions.

Formal statement
β d :
p :
D :
Proof (Lean source)
lemma blockScore_weightFeasibleAt (β d : ℕ) (p : ℝ) (D : FiniteDesign (Fin d → Bool)) (hD : IsProductBernoulli D p) : WeightFeasibleAt D β (blockScore β p d) := by have hDeq : D = blockDesign d p (le_of_lt hD.1) (le_of_lt hD.2.1) := by rcases hD with ⟨hp, hp', hp0, hp1, rfl⟩ unfold blockDesign congr constructor · rw [hDeq] exact blockScore_mean_zero β d p hD.1 hD.2.1 · intro S hS hScard rw [hDeq] exact blockScore_raw_moment β d p hD.1 hD.2.1 S hS hScard
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore_weightFeasibleAt · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:194
theorem blockScore_represents

The block score represents the all-one versus all-zero contrast on the low-order polynomial space.

Formal statement
β d :
p :
D :
f :
(Fin d → Bool) → ℝ
hf :
f ∈ polySpace β d
D.E (fun z => blockScore β p d z * f z) = contrastFunctional f
Proof (Lean source)
lemma blockScore_represents (β d : ℕ) (p : ℝ) (D : FiniteDesign (Fin d → Bool)) (hD : IsProductBernoulli D p) (f : (Fin d → Bool) → ℝ) (hf : f ∈ polySpace β d) : D.E (fun z => blockScore β p d z * f z) = contrastFunctional f := by have hDeq : D = blockDesign d p (le_of_lt hD.1) (le_of_lt hD.2.1) := by rcases hD with ⟨hp, hp', hp0, hp1, rfl⟩ unfold blockDesign congr rw [hDeq] rw [polySpace] at hf refine Submodule.span_induction (p := fun f _ => (blockDesign d p (le_of_lt hD.1) (le_of_lt hD.2.1)).E (fun z => blockScore β p d z * f z) = contrastFunctional f) ?_ ?_ ?_ ?_ hf · intro f hf rcases hf with ⟨S, hScard, rfl⟩ by_cases hS : S.Nonempty · rw [blockScore_raw_moment β d p hD.1 hD.2.1 S hS hScard] have hfalse : (∏ j ∈ S, blockInd (fun _ : Fin d => false) j) = 0 := by obtain ⟨j, hj⟩ := hS apply Finset.prod_eq_zero hj simp [blockInd] unfold contrastFunctional rawMonomial rw [hfalse] simp [blockInd] · rw [Finset.not_nonempty_iff_eq_empty.mp hS] simpa [rawMonomial, contrastFunctional] using blockScore_mean_zero β d p hD.1 hD.2.1 · simp [contrastFunctional] · intro f g _ _ hf hg rw [show (fun z => blockScore β p d z * (f + g) z) = (fun z => blockScore β p d z * f z + blockScore β p d z * g z) by funext z simp [mul_add]] rw [FiniteDesign.E_add, hf, hg] simp [contrastFunctional] ring · intro a f _ hf rw [show (fun z => blockScore β p d z * (a • f) z) = (fun z => a * (blockScore β p d z * f z)) by funext z change blockScore β p d z * (a * f z) = a * (blockScore β p d z * f z) ring] rw [FiniteDesign.E_const_mul, hf] simp [contrastFunctional, mul_sub]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore_represents · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:212
theorem blockScore_sq_expectation

The block score's second moment is exactly A_d.

Formal statement
β d :
p :
D :
D.E (fun z => blockScore β p d z ^ 2) = blockEnergy β p d
Proof (Lean source)
lemma blockScore_sq_expectation (β d : ℕ) (p : ℝ) (D : FiniteDesign (Fin d → Bool)) (hD : IsProductBernoulli D p) : D.E (fun z => blockScore β p d z ^ 2) = blockEnergy β p d := by have hDeq : D = blockDesign d p (le_of_lt hD.1) (le_of_lt hD.2.1) := by rcases hD with ⟨hp, hp', hp0, hp1, rfl⟩ unfold blockDesign congr rw [hDeq] let hp0 : 0 ≤ p := le_of_lt hD.1 let hp1 : p ≤ 1 := le_of_lt hD.2.1 simp only [blockScore, pow_two, Finset.sum_mul, Finset.mul_sum, FiniteDesign.E_sum] have hmoment (r q : ℕ) (S T : Finset (Fin d)) : (blockDesign d p hp0 hp1).E (fun z => (bernoulliContrast p q / (p * (1 - p)) ^ q * ∏ j ∈ T, (blockInd z j - p)) * (bernoulliContrast p r / (p * (1 - p)) ^ r * ∏ j ∈ S, (blockInd z j - p))) = (bernoulliContrast p q / (p * (1 - p)) ^ q) * (bernoulliContrast p r / (p * (1 - p)) ^ r) * (if T = S then (p * (1 - p)) ^ T.card else 0) := by rw [show (fun z => (bernoulliContrast p q / (p * (1 - p)) ^ q * ∏ j ∈ T, (blockInd z j - p)) * (bernoulliContrast p r / (p * (1 - p)) ^ r * ∏ j ∈ S, (blockInd z j - p))) = (fun z => ((bernoulliContrast p q / (p * (1 - p)) ^ q) * (bernoulliContrast p r / (p * (1 - p)) ^ r)) * (centeredMonomial p T z * centeredMonomial p S z)) by funext z simp only [centeredMonomial] ring] rw [FiniteDesign.E_const_mul] rw [E_centeredMonomial_mul] simp_rw [hmoment] simp [blockEnergy] apply Finset.sum_congr rfl intro r hr have hr1 : 1 ≤ r := (Finset.mem_Icc.mp hr).1 have hrle : r ≤ effBeta β d := (Finset.mem_Icc.mp hr).2 rw [show (∑ S ∈ Finset.univ.powersetCard r, if S.Nonempty ∧ S.card ≤ effBeta β d then bernoulliContrast p S.card / (p * (1 - p)) ^ S.card * (bernoulliContrast p r / (p * (1 - p)) ^ r) * (p * (1 - p)) ^ S.card else 0) = ∑ _S ∈ Finset.univ.powersetCard r, bernoulliContrast p r / (p * (1 - p)) ^ r * (bernoulliContrast p r / (p * (1 - p)) ^ r) * (p * (1 - p)) ^ r by apply Finset.sum_congr rfl intro S hS have hScard : S.card = r := (Finset.mem_powersetCard.mp hS).2 have hSnonempty : S.Nonempty := by rw [Finset.nonempty_iff_ne_empty] intro h subst S simp at hScard omega simp [hScard, hSnonempty, hrle]] rw [Finset.sum_const, Finset.card_powersetCard] simp only [Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hv : p * (1 - p) ≠ 0 := mul_ne_zero (ne_of_gt hD.1) (ne_of_gt (sub_pos.mpr hD.2.1)) field_simp
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore_sq_expectation · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:265
theorem weightProg_le_blockEnergy Lemma weightProg_le_blockEnergy in the paper ↗

The canonical score gives the upper bound in the weight program.

Formal statement
β d :
p :
hp0 :
0 < p
hp1 :
p < 1
weightProg β d p (le_of_lt hp0) (le_of_lt hp1) ≤ blockEnergy β p d
Proof (Lean source)
lemma weightProg_le_blockEnergy (β d : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) : weightProg β d p (le_of_lt hp0) (le_of_lt hp1) ≤ blockEnergy β p d := by let D := blockDesign d p (le_of_lt hp0) (le_of_lt hp1) have hD : IsProductBernoulli D p := by exact ⟨hp0, hp1, ⟨fun _ => le_of_lt hp0, fun _ => le_of_lt hp1, rfl⟩⟩ apply csInf_le · refine ⟨0, ?_⟩ rintro q ⟨w, _hw, rfl⟩ exact D.E_nonneg (fun z => sq_nonneg (w z)) · refine ⟨blockScore β p d, ?_, ?_⟩ · exact blockScore_weightFeasibleAt β d p D hD · exact (blockScore_sq_expectation β d p D hD).symm
CausalSmith.Experimentation.SnipeDegreeFrontier.weightProg_le_blockEnergy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:337

The contrast of the unnormalized score is its squared energy.

Formal statement
β d :
p :
Proof (Lean source)
lemma blockScore_contrast (β d : ℕ) (p : ℝ) : contrastFunctional (blockScore β p d) = blockEnergy β p d := by simp only [contrastFunctional, blockScore, blockInd, blockEnergy, Finset.sum_mul, Finset.sum_sub_distrib] have hsum_true (r : ℕ) : (∑ S ∈ (Finset.univ : Finset (Fin d)).powersetCard r, (1 - p) ^ S.card) = (Nat.choose d r : ℝ) * (1 - p) ^ r := by rw [show (∑ S ∈ (Finset.univ : Finset (Fin d)).powersetCard r, (1 - p) ^ S.card) = ∑ _S ∈ (Finset.univ : Finset (Fin d)).powersetCard r, (1 - p) ^ r by apply Finset.sum_congr rfl intro S hS rw [(Finset.mem_powersetCard.mp hS).2]] rw [Finset.sum_const, Finset.card_powersetCard] simp only [Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hsum_false (r : ℕ) : (∑ S ∈ (Finset.univ : Finset (Fin d)).powersetCard r, (-p) ^ S.card) = (Nat.choose d r : ℝ) * (-p) ^ r := by rw [show (∑ S ∈ (Finset.univ : Finset (Fin d)).powersetCard r, (-p) ^ S.card) = ∑ _S ∈ (Finset.univ : Finset (Fin d)).powersetCard r, (-p) ^ r by apply Finset.sum_congr rfl intro S hS rw [(Finset.mem_powersetCard.mp hS).2]] rw [Finset.sum_const, Finset.card_powersetCard] simp only [Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro r hr simp only [if_true, Bool.false_eq_true, if_false, Finset.prod_const] rw [show (Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r)) = (Finset.univ : Finset (Fin d)).powersetCard r by ext S simp [Finset.mem_powersetCard, eq_comm]] simp only [zero_sub] rw [hsum_true r, hsum_false r] simp only [bernoulliContrast] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore_contrast · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:353

The block energy is positive under the paper's nondegenerate parameters.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
0 < blockEnergy β p d
Proof (Lean source)
lemma blockEnergy_pos (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : 0 < blockEnergy β p d := by have heff : 1 ≤ effBeta β d := by simp [effBeta, hβ, hd] have hmem : 1 ∈ Icc 1 (effBeta β d) := Finset.mem_Icc.mpr ⟨le_rfl, heff⟩ have hq : 0 < p * (1 - p) := mul_pos hp0 (sub_pos.mpr hp1) have hterm_nonneg (r : ℕ) : 0 ≤ (Nat.choose d r : ℝ) * bernoulliContrast p r ^ 2 / (p * (1 - p)) ^ r := by positivity have hterm_pos : 0 < (Nat.choose d 1 : ℝ) * bernoulliContrast p 1 ^ 2 / (p * (1 - p)) ^ 1 := by simp only [Nat.choose_one_right, bernoulliContrast, pow_one, neg_neg] have hdpos : 0 < (d : ℝ) := by exact_mod_cast hd rw [show (1 : ℝ) - p - -p = 1 by ring, one_pow, mul_one] exact div_pos hdpos hq unfold blockEnergy exact lt_of_lt_of_le hterm_pos (Finset.single_le_sum (fun r hr => hterm_nonneg r) hmem)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEnergy_pos · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:394
theorem blockRepresenter_contrast_energy

The normalized representer has unit contrast and reciprocal energy.

Formal statement
β d :
p :
D :
:
1 ≤ β
hd :
1 ≤ d
D.E (fun z => blockRepresenter β p d z ^ 2) = (blockEnergy β p d)⁻¹
Proof (Lean source)
lemma blockRepresenter_contrast_energy (β d : ℕ) (p : ℝ) (D : FiniteDesign (Fin d → Bool)) (hD : IsProductBernoulli D p) (hβ : 1 ≤ β) (hd : 1 ≤ d) : contrastFunctional (blockRepresenter β p d) = 1 ∧ D.E (fun z => blockRepresenter β p d z ^ 2) = (blockEnergy β p d)⁻¹ := by have hApos := blockEnergy_pos β d p hβ hd hD.1 hD.2.1 have hdz : d ≠ 0 := Nat.ne_of_gt hd constructor · unfold contrastFunctional simp only [blockRepresenter, if_neg hdz] rw [← sub_div] rw [show blockScore β p d (fun _ => true) - blockScore β p d (fun _ => false) = blockEnergy β p d from blockScore_contrast β d p] exact div_self hApos.ne' · rw [show (fun z => blockRepresenter β p d z ^ 2) = (fun z => (blockEnergy β p d)⁻¹ ^ 2 * blockScore β p d z ^ 2) by funext z simp only [blockRepresenter, if_neg hdz] field_simp [hApos.ne']] rw [FiniteDesign.E_const_mul, blockScore_sq_expectation β d p D hD] field_simp [hApos.ne']
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRepresenter_contrast_energy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:417
theorem centeredMonomial_raw_expansion Lemma centeredMonomial_raw_expansion in the paper ↗

Expansion of a centered monomial in the raw-monomial basis.

Formal statement
d :
p :
S :
z :
Fin d → Bool
∏ j ∈ S, (blockInd z j - p) = ∑ T ∈ S.powerset, (-p) ^ (S.card - T.card) * rawMonomial T z
Proof (Lean source)
lemma centeredMonomial_raw_expansion (d : ℕ) (p : ℝ) (S : Finset (Fin d)) (z : Fin d → Bool) : ∏ j ∈ S, (blockInd z j - p) = ∑ T ∈ S.powerset, (-p) ^ (S.card - T.card) * rawMonomial T z := by rw [show (∏ j ∈ S, (blockInd z j - p)) = ∏ j ∈ S, (blockInd z j + (-p)) by simp [sub_eq_add_neg]] rw [Finset.prod_add] apply Finset.sum_congr rfl intro T hT have hsub : T ⊆ S := Finset.mem_powerset.mp hT rw [show (∏ i ∈ T, blockInd z i) = rawMonomial T z by rfl] rw [Finset.prod_const] rw [Finset.card_sdiff, Finset.inter_eq_left.mpr hsub] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.centeredMonomial_raw_expansion · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:442
theorem sum_powerset_subset_exchange Lemma sum_powerset_subset_exchange in the paper ↗

Exchange a sum over all subsets with a sum over their supersets.

Formal statement
α :
A :
F :
Finset α → Finset α → ℝ
∑ T ∈ (Finset.univ : Finset α).powerset, ∑ S ∈ A, (if T ⊆ S then F S T else 0)
= ∑ S ∈ A, ∑ T ∈ S.powerset, F S T
Proof (Lean source)
lemma sum_powerset_subset_exchange {α : Type*} [Fintype α] [DecidableEq α] (A : Finset (Finset α)) (F : Finset α → Finset α → ℝ) : ∑ T ∈ (Finset.univ : Finset α).powerset, ∑ S ∈ A, (if T ⊆ S then F S T else 0) = ∑ S ∈ A, ∑ T ∈ S.powerset, F S T := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro S hS rw [← Finset.sum_filter] rw [show (Finset.univ : Finset α).powerset.filter (fun T => T ⊆ S) = S.powerset by ext T simp]
CausalSmith.Experimentation.SnipeDegreeFrontier.sum_powerset_subset_exchange · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:460
theorem blockRepresenter_raw_expansion

The raw coefficients reconstruct the normalized representer.

Formal statement
β d :
p :
hd :
1 ≤ d
z :
Fin d → Bool
= ∑ T ∈ Finset.univ.powerset, blockRawCoef β p d T * rawMonomial T z
Proof (Lean source)
lemma blockRepresenter_raw_expansion (β d : ℕ) (p : ℝ) (hd : 1 ≤ d) (z : Fin d → Bool) : blockRepresenter β p d z = ∑ T ∈ Finset.univ.powerset, blockRawCoef β p d T * rawMonomial T z := by have hd0 : d ≠ 0 := Nat.ne_of_gt hd simp only [blockRepresenter, blockRawCoef, if_neg hd0, div_eq_inv_mul, blockScore] simp_rw [centeredMonomial_raw_expansion] let R := Icc 1 (effBeta β d) let A : ℕ → Finset (Finset (Fin d)) := fun r => Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r) let c : ℕ → ℝ := fun r => ((p * (1 - p)) ^ r)⁻¹ * bernoulliContrast p r let q : Finset (Fin d) → Finset (Fin d) → ℝ := fun S T => (-p) ^ (S.card - T.card) * rawMonomial T z change (blockEnergy β p d)⁻¹ * ∑ r ∈ R, c r * ∑ S ∈ A r, ∑ T ∈ S.powerset, q S T = ∑ T ∈ Finset.univ.powerset, ((blockEnergy β p d)⁻¹ * ∑ r ∈ R, ∑ S ∈ A r, if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0) * rawMonomial T z calc _ = (blockEnergy β p d)⁻¹ * ∑ r ∈ R, ∑ S ∈ A r, ∑ T ∈ S.powerset, c r * q S T := by congr 1 apply Finset.sum_congr rfl intro r hr rw [Finset.mul_sum] apply Finset.sum_congr rfl intro S hS rw [Finset.mul_sum] _ = (blockEnergy β p d)⁻¹ * ∑ r ∈ R, ∑ T ∈ Finset.univ.powerset, ∑ S ∈ A r, (if T ⊆ S then c r * q S T else 0) := by congr 1 apply Finset.sum_congr rfl intro r hr rw [sum_powerset_subset_exchange (A r) (fun S T => c r * q S T)] _ = (blockEnergy β p d)⁻¹ * ∑ T ∈ Finset.univ.powerset, ∑ r ∈ R, ∑ S ∈ A r, (if T ⊆ S then c r * q S T else 0) := by rw [Finset.sum_comm] _ = _ := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro T hT rw [show (∑ r ∈ R, ∑ S ∈ A r, if T ⊆ S then c r * q S T else 0) = (∑ r ∈ R, ∑ S ∈ A r, if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0) * rawMonomial T z by rw [Finset.sum_mul] apply Finset.sum_congr rfl intro r hr rw [Finset.sum_mul] apply Finset.sum_congr rfl intro S hS dsimp [q] by_cases hsub : T ⊆ S · simp only [if_pos hsub] ring · simp [hsub]] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRepresenter_raw_expansion · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:477

Under the nondegenerate paper parameters, the exposed-order set is nonempty and kStar belongs to it.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
kStar d β p ∈ (Icc 1 (effBeta β d)).filter (fun r => bernoulliContrast p r ≠ 0)
Proof (Lean source)
lemma kStar_mem_exposedOrder (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) : kStar d β p ∈ (Icc 1 (effBeta β d)).filter (fun r => bernoulliContrast p r ≠ 0) := by let exposed := (Icc 1 (effBeta β d)).filter (fun r => bernoulliContrast p r ≠ 0) have heff : 1 ≤ effBeta β d := by simp [effBeta, hβ, hd] have hone : 1 ∈ exposed := by simp only [exposed, mem_filter, Finset.mem_Icc] exact ⟨⟨le_rfl, heff⟩, by norm_num [bernoulliContrast]⟩ have hne : exposed.Nonempty := ⟨1, hone⟩ rw [show kStar d β p = exposed.max' hne by simp only [kStar, exposed] rw [dif_pos hne]] exact Finset.max'_mem exposed hne
CausalSmith.Experimentation.SnipeDegreeFrontier.kStar_mem_exposedOrder · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:546
theorem blockEnergy_topExposed_le Lemma blockEnergy_topExposed_le in the paper ↗

The top exposed summand supplies the pointwise lower comparison used in the block-energy asymptotics.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
(choose d (kStar d β p) : ℝ) * bernoulliContrast p (kStar d β p) ^ 2 / (p * (1 - p)) ^ kStar d β p
blockEnergy β p d
Proof (Lean source)
lemma blockEnergy_topExposed_le (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : (Nat.choose d (kStar d β p) : ℝ) * bernoulliContrast p (kStar d β p) ^ 2 / (p * (1 - p)) ^ kStar d β p ≤ blockEnergy β p d := by have hk := kStar_mem_exposedOrder β d p hβ hd have hkIcc : kStar d β p ∈ Icc 1 (effBeta β d) := (Finset.mem_filter.mp hk).1 have hv : 0 < p * (1 - p) := mul_pos hp0 (sub_pos.mpr hp1) unfold blockEnergy exact Finset.single_le_sum (fun r _ => show 0 ≤ (Nat.choose d r : ℝ) * bernoulliContrast p r ^ 2 / (p * (1 - p)) ^ r by positivity) hkIcc
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEnergy_topExposed_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterCore.lean:567
Helpers.BlockRepresenterUniform 12 declarations Uniform block-energy and raw-coefficient bounds

Uniform block-energy and raw-coefficient bounds

def fixedExposed

Exposed orders among the fixed paper orders 1,...,β.

Definition (Lean source)
noncomputable def fixedExposed (β : ℕ) (p : ℝ) : Finset ℕ := (Icc 1 β).filter (fun r => bernoulliContrast p r ≠ 0)
def energyCoeff

The positive coefficient multiplying the order-r binomial term.

Definition (Lean source)
noncomputable def energyCoeff (p : ℝ) (r : ℕ) : ℝ := bernoulliContrast p r ^ 2 / (p * (1 - p)) ^ r
def rawMassCoeff

The coefficient occurring after expanding centered into raw monomials.

Definition (Lean source)
noncomputable def rawMassCoeff (p : ℝ) (r : ℕ) : ℝ := |bernoulliContrast p r| / (p * (1 - p)) ^ r * (1 + p) ^ r
def blockLowerConst

Minimum positive exposed coefficient at the finitely many fixed orders.

Definition (Lean source)
noncomputable def blockLowerConst (β : ℕ) (p : ℝ) : ℝ := if h : (fixedExposed β p).Nonempty then (fixedExposed β p).image (energyCoeff p) |>.min' ((Finset.image_nonempty).mpr h) else 1
def blockUpperConst

A uniform upper comparison constant for block energy.

Definition (Lean source)
noncomputable def blockUpperConst (β : ℕ) (p : ℝ) : ℝ := ((2 ^ β : ℕ) : ℝ) * ∑ r ∈ Icc 1 β, energyCoeff p r
def blockRawMassConst

A uniform bound for the normalized raw coefficient mass.

Definition (Lean source)
noncomputable def blockRawMassConst (β : ℕ) (p : ℝ) : ℝ := blockLowerConst β p + (((2 ^ β : ℕ) : ℝ) * ∑ r ∈ Icc 1 β, rawMassCoeff p r) / blockLowerConst β p
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRawMassConst · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterUniform.lean:35
theorem choose_le_pow_mul_choose Lemma choose_le_pow_mul_choose in the paper ↗

Fixed-order binomial coefficients are uniformly controlled by the largest exposed-order coefficient.

Formal statement
d r k β :
hrk :
r ≤ k
hkd :
k ≤ d
hkβ :
k ≤ β
choose d r ≤ 2 ^ β * choose d k
Proof (Lean source)
lemma choose_le_pow_mul_choose (d r k β : ℕ) (hrk : r ≤ k) (hkd : k ≤ d) (hkβ : k ≤ β) : choose d r ≤ 2 ^ β * choose d k := by have hid := Nat.choose_mul (n := d) (k := k) (s := r) hrk have hone : 1 ≤ choose (d - r) (k - r) := Nat.choose_pos (by omega) have hfirst : choose d r ≤ choose d k * choose k r := by calc choose d r ≤ choose d r * choose (d - r) (k - r) := by nlinarith _ = choose d k * choose k r := hid.symm have hpow : choose k r ≤ 2 ^ β := by calc choose k r ≤ 2 ^ k := Nat.choose_le_two_pow k r _ ≤ 2 ^ β := Nat.pow_le_pow_right (by omega) hkβ nlinarith
CausalSmith.Experimentation.SnipeDegreeFrontier.choose_le_pow_mul_choose · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterUniform.lean:41

Every nonzero eligible order is at most the largest exposed order.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
r :
hr :
r ∈ Icc 1 (effBeta β d)
hrnz :
r ≤ kStar d β p
Proof (Lean source)
lemma eligibleOrder_le_kStar (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (r : ℕ) (hr : r ∈ Icc 1 (effBeta β d)) (hrnz : bernoulliContrast p r ≠ 0) : r ≤ kStar d β p := by let exposed := (Icc 1 (effBeta β d)).filter (fun q => bernoulliContrast p q ≠ 0) have heff : 1 ≤ effBeta β d := by simp [effBeta, hβ, hd] have hone : 1 ∈ exposed := by simp only [exposed, mem_filter, Finset.mem_Icc] exact ⟨⟨le_rfl, heff⟩, by norm_num [bernoulliContrast]⟩ have hne : exposed.Nonempty := ⟨1, hone⟩ have hrmem : r ∈ exposed := Finset.mem_filter.mpr ⟨hr, hrnz⟩ rw [show kStar d β p = exposed.max' hne by simp only [kStar, exposed] rw [dif_pos hne]] exact Finset.le_max' exposed r hrmem
CausalSmith.Experimentation.SnipeDegreeFrontier.eligibleOrder_le_kStar · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterUniform.lean:61

The fixed-order lower constant is positive and bounds every exposed coefficient from below.

Formal statement
β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
0 < blockLowerConst β p ∧ ∀ r ∈ fixedExposed β p, blockLowerConst β p ≤ energyCoeff p r
Proof (Lean source)
lemma blockLowerConst_spec (β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) : 0 < blockLowerConst β p ∧ ∀ r ∈ fixedExposed β p, blockLowerConst β p ≤ energyCoeff p r := by have hone : 1 ∈ fixedExposed β p := by simp only [fixedExposed, mem_filter, Finset.mem_Icc] exact ⟨⟨le_rfl, hβ⟩, by norm_num [bernoulliContrast]⟩ have hne : (fixedExposed β p).Nonempty := ⟨1, hone⟩ rw [blockLowerConst, dif_pos hne] constructor · have hm := Finset.min'_mem ((fixedExposed β p).image (energyCoeff p)) ((Finset.image_nonempty).mpr hne) rcases Finset.mem_image.mp hm with ⟨r, hr, heq⟩ rw [← heq] simp only [energyCoeff] have hrnz := (Finset.mem_filter.mp hr).2 exact div_pos (sq_pos_of_ne_zero hrnz) (pow_pos (mul_pos hp0 (sub_pos.mpr hp1)) r) · intro r hr apply Finset.min'_le exact Finset.mem_image.mpr ⟨r, hr, rfl⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.blockLowerConst_spec · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterUniform.lean:81
theorem blockEnergy_uniform_compare Lemma blockEnergy_uniform_compare in the paper ↗

Uniform two-sided comparison of block energy with the top exposed binomial coefficient.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
blockLowerConst β p * (choose d (kStar d β p) : ℝ) ≤ blockEnergy β p d ∧
blockEnergy β p d ≤ blockUpperConst β p * (choose d (kStar d β p) : ℝ)
Proof (Lean source)
lemma blockEnergy_uniform_compare (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : blockLowerConst β p * (Nat.choose d (kStar d β p) : ℝ) ≤ blockEnergy β p d ∧ blockEnergy β p d ≤ blockUpperConst β p * (Nat.choose d (kStar d β p) : ℝ) := by have hk := kStar_mem_exposedOrder β d p hβ hd have hkIcc := (Finset.mem_filter.mp hk).1 have hkd : kStar d β p ≤ d := (Finset.mem_Icc.mp hkIcc).2.trans (min_le_right β d) have hkβ : kStar d β p ≤ β := (Finset.mem_Icc.mp hkIcc).2.trans (min_le_left β d) have hkc : blockLowerConst β p ≤ energyCoeff p (kStar d β p) := by exact (blockLowerConst_spec β p hβ hp0 hp1).2 _ <| Finset.mem_filter.mpr ⟨ Finset.mem_Icc.mpr ⟨(Finset.mem_Icc.mp hkIcc).1, hkβ⟩, (Finset.mem_filter.mp hk).2⟩ constructor · calc blockLowerConst β p * (Nat.choose d (kStar d β p) : ℝ) ≤ (Nat.choose d (kStar d β p) : ℝ) * energyCoeff p (kStar d β p) := by rw [mul_comm] exact mul_le_mul_of_nonneg_left hkc (by positivity) _ ≤ blockEnergy β p d := by convert blockEnergy_topExposed_le β d p hβ hd hp0 hp1 using 1 <;> simp [energyCoeff] <;> ring · unfold blockUpperConst rw [show blockEnergy β p d = ∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * energyCoeff p r by unfold blockEnergy apply Finset.sum_congr rfl intro r hr simp only [energyCoeff] ring] calc (∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * energyCoeff p r) ≤ ∑ r ∈ Icc 1 (effBeta β d), (((2 ^ β : ℕ) : ℝ) * Nat.choose d (kStar d β p)) * energyCoeff p r := by apply Finset.sum_le_sum intro r hr by_cases hrnz : bernoulliContrast p r = 0 · simp [hrnz, energyCoeff] · have hc := choose_le_pow_mul_choose d r (kStar d β p) β (eligibleOrder_le_kStar β d p hβ hd r hr hrnz) hkd hkβ have hcoef : 0 ≤ energyCoeff p r := by simp only [energyCoeff] exact div_nonneg (sq_nonneg _) (pow_nonneg (mul_nonneg (le_of_lt hp0) (le_of_lt (sub_pos.mpr hp1))) r) gcongr exact_mod_cast hc _ ≤ ∑ r ∈ Icc 1 β, (((2 ^ β : ℕ) : ℝ) * Nat.choose d (kStar d β p)) * energyCoeff p r := by apply Finset.sum_le_sum_of_subset_of_nonneg · intro r hr simp only [Finset.mem_Icc] at hr ⊢ exact ⟨hr.1, hr.2.trans (min_le_left β d)⟩ · intro r _ _ simp only [energyCoeff] exact mul_nonneg (by positivity) <| div_nonneg (sq_nonneg _) (pow_nonneg (mul_nonneg (le_of_lt hp0) (le_of_lt (sub_pos.mpr hp1))) r) _ = (((2 ^ β : ℕ) : ℝ) * ∑ r ∈ Icc 1 β, energyCoeff p r) * Nat.choose d (kStar d β p) := by rw [← Finset.mul_sum] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEnergy_uniform_compare · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterUniform.lean:107
theorem blockRawCoef_mass_estimate Lemma blockRawCoef_mass_estimate in the paper ↗

Direct triangle-inequality estimate after expanding centered monomials in the raw basis.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
(∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|)
≤ (blockEnergy β p d)⁻¹ * ∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * rawMassCoeff p r
Proof (Lean source)
lemma blockRawCoef_mass_estimate (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : (∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|) ≤ (blockEnergy β p d)⁻¹ * ∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * rawMassCoeff p r := by let A := blockEnergy β p d have hA : 0 < A := blockEnergy_pos β d p hβ hd hp0 hp1 have hd0 : d ≠ 0 := Nat.ne_of_gt hd let R := Icc 1 (effBeta β d) let F : ℕ → Finset (Finset (Fin d)) := fun r => Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r) let c : ℕ → ℝ := fun r => bernoulliContrast p r / (p * (1 - p)) ^ r simp only [blockRawCoef, if_neg hd0] rw [show (∑ T ∈ Finset.univ.powerset, |A⁻¹ * ∑ r ∈ R, ∑ S ∈ F r, if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0|) = A⁻¹ * ∑ T ∈ Finset.univ.powerset, |∑ r ∈ R, ∑ S ∈ F r, if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0| by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro T hT rw [abs_mul, abs_inv, abs_of_pos hA]] apply mul_le_mul_of_nonneg_left ?_ (le_of_lt (inv_pos.mpr hA)) calc (∑ T ∈ Finset.univ.powerset, |∑ r ∈ R, ∑ S ∈ F r, if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0|) ≤ ∑ T ∈ Finset.univ.powerset, ∑ r ∈ R, ∑ S ∈ F r, |if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0| := by apply Finset.sum_le_sum intro T hT calc |∑ r ∈ R, ∑ S ∈ F r, if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0| ≤ ∑ r ∈ R, |∑ S ∈ F r, if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0| := Finset.abs_sum_le_sum_abs _ _ _ ≤ _ := by apply Finset.sum_le_sum intro r hr exact Finset.abs_sum_le_sum_abs _ _ _ = ∑ r ∈ R, ∑ S ∈ F r, ∑ T ∈ S.powerset, |c r * (-p) ^ (S.card - T.card)| := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro r hr rw [show (∑ T ∈ Finset.univ.powerset, ∑ S ∈ F r, |if T ⊆ S then c r * (-p) ^ (S.card - T.card) else 0|) = ∑ T ∈ Finset.univ.powerset, ∑ S ∈ F r, if T ⊆ S then |c r * (-p) ^ (S.card - T.card)| else 0 by apply Finset.sum_congr rfl intro T hT apply Finset.sum_congr rfl intro S hS by_cases hsub : T ⊆ S <;> simp [hsub]] exact sum_powerset_subset_exchange (F r) (fun S T => |c r * (-p) ^ (S.card - T.card)|) _ = ∑ r ∈ R, (Nat.choose d r : ℝ) * rawMassCoeff p r := by apply Finset.sum_congr rfl intro r hr rw [show (∑ S ∈ F r, ∑ T ∈ S.powerset, |c r * (-p) ^ (S.card - T.card)|) = ∑ S ∈ F r, (|c r| * (1 + p) ^ r) by apply Finset.sum_congr rfl intro S hS have hScard : S.card = r := (Finset.mem_filter.mp hS).2 rw [show (∑ T ∈ S.powerset, |c r * (-p) ^ (S.card - T.card)|) = |c r| * ∑ T ∈ S.powerset, (1 : ℝ) ^ T.card * p ^ (S.card - T.card) by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro T hT rw [abs_mul, abs_pow, abs_neg, abs_of_pos hp0] simp] rw [Finset.sum_pow_mul_eq_add_pow, hScard]] rw [Finset.sum_const, show (F r).card = Nat.choose d r by simp [F, Finset.card_powersetCard]] simp only [nsmul_eq_mul, c, rawMassCoeff, abs_div, abs_pow, abs_of_pos (mul_pos hp0 (sub_pos.mpr hp1))]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRawCoef_mass_estimate · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterUniform.lean:184
theorem blockRawCoef_mass_uniform Lemma blockRawCoef_mass_uniform in the paper ↗

The normalized raw coefficient mass is bounded uniformly in block size.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
(∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|) ≤ blockRawMassConst β p
Proof (Lean source)
lemma blockRawCoef_mass_uniform (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : (∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|) ≤ blockRawMassConst β p := by let c₁ := blockLowerConst β p let C := ((2 ^ β : ℕ) : ℝ) * ∑ r ∈ Icc 1 β, rawMassCoeff p r let K : ℝ := Nat.choose d (kStar d β p) let A := blockEnergy β p d have hc₁ : 0 < c₁ := (blockLowerConst_spec β p hβ hp0 hp1).1 have hA : 0 < A := blockEnergy_pos β d p hβ hd hp0 hp1 have hk := kStar_mem_exposedOrder β d p hβ hd have hkIcc := (Finset.mem_filter.mp hk).1 have hkd : kStar d β p ≤ d := (Finset.mem_Icc.mp hkIcc).2.trans (min_le_right β d) have hkβ : kStar d β p ≤ β := (Finset.mem_Icc.mp hkIcc).2.trans (min_le_left β d) have hK : 0 < K := by dsimp [K] exact_mod_cast Nat.choose_pos hkd have hC : 0 ≤ C := by dsimp [C] exact mul_nonneg (by positivity) <| sum_nonneg fun r hr => mul_nonneg (div_nonneg (abs_nonneg _) (pow_nonneg (mul_nonneg (le_of_lt hp0) (le_of_lt (sub_pos.mpr hp1))) r)) (pow_nonneg (by linarith) r) have hnum : (∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * rawMassCoeff p r) ≤ C * K := by calc (∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * rawMassCoeff p r) ≤ ∑ r ∈ Icc 1 (effBeta β d), (((2 ^ β : ℕ) : ℝ) * Nat.choose d (kStar d β p)) * rawMassCoeff p r := by apply Finset.sum_le_sum intro r hr by_cases hrnz : bernoulliContrast p r = 0 · simp [hrnz, rawMassCoeff] · have hc := choose_le_pow_mul_choose d r (kStar d β p) β (eligibleOrder_le_kStar β d p hβ hd r hr hrnz) hkd hkβ have hcoef : 0 ≤ rawMassCoeff p r := by simp only [rawMassCoeff] exact mul_nonneg (div_nonneg (abs_nonneg _) (pow_nonneg (mul_nonneg (le_of_lt hp0) (le_of_lt (sub_pos.mpr hp1))) r)) (pow_nonneg (by linarith) r) gcongr exact_mod_cast hc _ ≤ ∑ r ∈ Icc 1 β, (((2 ^ β : ℕ) : ℝ) * Nat.choose d (kStar d β p)) * rawMassCoeff p r := by apply Finset.sum_le_sum_of_subset_of_nonneg · intro r hr simp only [Finset.mem_Icc] at hr ⊢ exact ⟨hr.1, hr.2.trans (min_le_left β d)⟩ · intro r _ _ simp only [rawMassCoeff] exact mul_nonneg (by positivity) <| mul_nonneg (div_nonneg (abs_nonneg _) (pow_nonneg (mul_nonneg (le_of_lt hp0) (le_of_lt (sub_pos.mpr hp1))) r)) (pow_nonneg (by linarith) r) _ = C * K := by dsimp [C, K] rw [← Finset.mul_sum] ring have hlower : c₁ * K ≤ A := by exact (blockEnergy_uniform_compare β d p hβ hd hp0 hp1).1 calc (∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|) ≤ A⁻¹ * ∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * rawMassCoeff p r := blockRawCoef_mass_estimate β d p hβ hd hp0 hp1 _ ≤ A⁻¹ * (C * K) := by gcongr _ ≤ C / c₁ := by rw [show A⁻¹ * (C * K) = C * K / A by field_simp [hA.ne']] rw [div_le_iff₀ hA] calc C * K = (C / c₁) * (c₁ * K) := by field_simp [hc₁.ne'] _ ≤ (C / c₁) * A := mul_le_mul_of_nonneg_left hlower (div_nonneg hC (le_of_lt hc₁)) _ ≤ blockRawMassConst β p := by dsimp [blockRawMassConst, c₁, C] linarith
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRawCoef_mass_uniform · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockRepresenterUniform.lean:275
Helpers.BlockScore 16 declarations All objects here live on the finite assignment space Fin d → Bool.

Bernoulli block score and the two Riesz programs

All objects here live on the finite assignment space Fin d → Bool. The bilinear form is the expectation of Causalean's finite Bernoulli design, so no measure-theoretic wrapper is needed.

def blockInd

A Boolean coordinate viewed as a real treatment indicator.

Definition (Lean source)
def blockInd {d : ℕ} (z : Fin d → Bool) (j : Fin d) : ℝ := if z j then 1 else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.blockInd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:23
def blockScore

The centered contrast score on a complete d-block.

Definition (Lean source)
noncomputable def blockScore (β : ℕ) (p : ℝ) (d : ℕ) (z : Fin d → Bool) : ℝ := ∑ r ∈ Icc 1 (effBeta β d), (bernoulliContrast p r / (p * (1 - p)) ^ r) * ∑ S ∈ (Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r)), ∏ j ∈ S, (blockInd z j - p)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScore · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:27

The exact squared norm of the block score.

Definition (Lean source)
noncomputable def blockEnergy (β : ℕ) (p : ℝ) (d : ℕ) : ℝ := ∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * (bernoulliContrast p r) ^ 2 / (p * (1 - p)) ^ r
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEnergy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:35
def blockRepresenter

The normalized representer, with the degree-zero convention imposed without ever forming 0 / 0.

Definition (Lean source)
noncomputable def blockRepresenter (β : ℕ) (p : ℝ) (d : ℕ) (z : Fin d → Bool) : ℝ := if d = 0 then 0 else blockScore β p d z / blockEnergy β p d
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRepresenter · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:42
def blockRawCoef

The raw-monomial coefficient of the normalized representer.

Definition (Lean source)
noncomputable def blockRawCoef (β : ℕ) (p : ℝ) (d : ℕ) (T : Finset (Fin d)) : ℝ := -- @realizes T(block-coordinate subset T : Finset (Fin d)) if d = 0 then 0 else (blockEnergy β p d)⁻¹ * ∑ r ∈ Icc 1 (effBeta β d), ∑ S ∈ (Finset.univ.powerset.filter (fun S : Finset (Fin d) => S.card = r)), if T ⊆ S then (bernoulliContrast p r / (p * (1 - p)) ^ r) * (-p) ^ (S.card - T.card) else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRawCoef · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:49
def blockScoreEnergyBundle Definition 10 in the paper ↗

The four objects jointly introduced by the block score/energy definition: g_d, A_d, the normalized representer h_d, and all raw coefficients h_{d,T}.

Definition (Lean source)
-- @node: def:block-score-energy noncomputable def blockScoreEnergyBundle (β : ℕ) (p : ℝ) (d : ℕ) : ((Fin d → Bool) → ℝ) × ℝ × ((Fin d → Bool) → ℝ) × (Finset (Fin d) → ℝ) := (blockScore β p d, blockEnergy β p d, blockRepresenter β p d, blockRawCoef β p d)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScoreEnergyBundle · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:63
def rawMonomial

A raw block monomial.

Definition (Lean source)
-- @env: S5 noncomputable def rawMonomial {d : ℕ} (S : Finset (Fin d)) : (Fin d → Bool) → ℝ := fun z => ∏ j ∈ S, blockInd z j
CausalSmith.Experimentation.SnipeDegreeFrontier.rawMonomial · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:73
def polySpace

The span of raw monomials through effective order.

Definition (Lean source)
noncomputable def polySpace (β d : ℕ) : Submodule ℝ ((Fin d → Bool) → ℝ) := span ℝ {f | ∃ S : Finset (Fin d), S.card ≤ effBeta β d ∧ f = rawMonomial S}
CausalSmith.Experimentation.SnipeDegreeFrontier.polySpace · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:79
def contrastFunctional

The all-one versus all-zero functional.

Definition (Lean source)
def contrastFunctional {d : ℕ} (f : (Fin d → Bool) → ℝ) : ℝ := f (fun _ => true) - f (fun _ => false)
CausalSmith.Experimentation.SnipeDegreeFrontier.contrastFunctional · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:89
def blockDesign

The common-probability Bernoulli design on a block.

Definition (Lean source)
noncomputable def blockDesign (d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : FiniteDesign (Fin d → Bool) := bernoulliDesign (fun _ => p) (fun _ => hp0) (fun _ => hp1)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockDesign · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:94
def PerturbFeasible

Feasibility for the normalized perturbation program.

Definition (Lean source)
def PerturbFeasible (β d : ℕ) (h : (Fin d → Bool) → ℝ) : Prop := h ∈ polySpace β d ∧ contrastFunctional h = 1
CausalSmith.Experimentation.SnipeDegreeFrontier.PerturbFeasible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:100

The normalized perturbation program.

Definition (Lean source)
-- @node: def:perturbation-program noncomputable def perturbProg (β d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : ℝ := sInf {q : ℝ | ∃ h : (Fin d → Bool) → ℝ, PerturbFeasible β d h ∧ q = (blockDesign d p hp0 hp1).E (fun z => h z ^ 2)}
CausalSmith.Experimentation.SnipeDegreeFrontier.perturbProg · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:104
def WeightFeasible

Feasibility for a design-unbiased block weight.

Definition (Lean source)
def WeightFeasible (β d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : (Fin d → Bool) → ℝ) : Prop := (blockDesign d p hp0 hp1).E w = 0 ∧ ∀ S : Finset (Fin d), S.Nonempty → S.card ≤ effBeta β d → (blockDesign d p hp0 hp1).E (fun z => w z * rawMonomial S z) = 1
CausalSmith.Experimentation.SnipeDegreeFrontier.WeightFeasible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:113

The minimum-energy unbiased-weight program.

Definition (Lean source)
-- @node: def:weight-program noncomputable def weightProg (β d : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : ℝ := sInf {q : ℝ | ∃ w : (Fin d → Bool) → ℝ, WeightFeasible β d p hp0 hp1 w ∧ q = (blockDesign d p hp0 hp1).E (fun z => w z ^ 2)}
CausalSmith.Experimentation.SnipeDegreeFrontier.weightProg · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:123
def ZeroDegreeConventions Definition 2 in the paper ↗

The paper's degree-zero conventions, including the guarded normalized representer and its raw coefficients.

Definition (Lean source)
-- @node: def:zero-degree-conventions def ZeroDegreeConventions (β : ℕ) (p : ℝ) : Prop := effBeta β 0 = 0 ∧ kStar 0 β p = 0 ∧ blockScore β p 0 = 0 ∧ blockEnergy β p 0 = 0 ∧ blockRepresenter β p 0 = 0 ∧ blockRawCoef β p 0 = 0
CausalSmith.Experimentation.SnipeDegreeFrontier.ZeroDegreeConventions · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:132
theorem zeroDegreeConventions_holds

The degree-zero conventions follow from the finite empty sums and the guard in blockRepresenter.

Formal statement
β :
p :
Proof (Lean source)
lemma zeroDegreeConventions_holds (β : ℕ) (p : ℝ) : ZeroDegreeConventions β p := by constructor · simp [effBeta] constructor · simp [kStar, effBeta] constructor · funext z simp [blockScore, effBeta] constructor · simp [blockEnergy, effBeta] constructor · funext z simp [blockRepresenter] · funext T simp [blockRawCoef]
CausalSmith.Experimentation.SnipeDegreeFrontier.zeroDegreeConventions_holds · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/BlockScore.lean:143
Helpers.ContinuousPriorConverse 32 declarations Continuous-prior minimax converse

Continuous-prior minimax converse

def baselineProductDensity

Defines baseline product density.

Definition (Lean source)
noncomputable def baselineProductDensity (B : ℝ) (m : ℕ) (U : Fin m → ℝ) : ℝ := ∏ b, cosSqDensity (B / 2) (U b)
CausalSmith.Experimentation.SnipeDegreeFrontier.baselineProductDensity · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:18
def baselineProductMeasure

Defines baseline product measure.

Definition (Lean source)
noncomputable def baselineProductMeasure (B : ℝ) (m : ℕ) : Measure (Fin m → ℝ) := (Measure.pi (fun _ : Fin m => volume)).withDensity (fun U => ofReal (baselineProductDensity B m U))
CausalSmith.Experimentation.SnipeDegreeFrontier.baselineProductMeasure · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:25
theorem baselineProductDensity_nonneg

Establishes the stated mathematical result for baseline product density nonneg.

Formal statement
B :
m :
hB :
0 < B
Proof (Lean source)
lemma baselineProductDensity_nonneg (B : ℝ) (m : ℕ) (hB : 0 < B) : 0 ≤ baselineProductDensity B m := by intro U unfold baselineProductDensity apply Finset.prod_nonneg intro b hb unfold cosSqDensity split_ifs <;> positivity
CausalSmith.Experimentation.SnipeDegreeFrontier.baselineProductDensity_nonneg · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:31
theorem baselineProductDensity_integrable

Establishes the stated mathematical result for baseline product density integrable.

Formal statement
B :
m :
Integrable (baselineProductDensity B m) (Measure.pi (fun _ : Fin m => volume))
Proof (Lean source)
lemma baselineProductDensity_integrable (B : ℝ) (m : ℕ) : Integrable (baselineProductDensity B m) (Measure.pi (fun _ : Fin m => volume)) := by unfold baselineProductDensity exact Integrable.fintype_prod fun _ => cosSqDensity_integrable (B / 2)
CausalSmith.Experimentation.SnipeDegreeFrontier.baselineProductDensity_integrable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:42
theorem baselineProductDensity_integral_one

Establishes the stated mathematical result for baseline product density integral one.

Formal statement
B :
m :
hB :
0 < B
∫ U, baselineProductDensity B m U ∂(Measure.pi (fun _ : Fin m => volume)) = 1
Proof (Lean source)
lemma baselineProductDensity_integral_one (B : ℝ) (m : ℕ) (hB : 0 < B) : ∫ U, baselineProductDensity B m U ∂(Measure.pi (fun _ : Fin m => volume)) = 1 := by unfold baselineProductDensity rw [MeasureTheory.integral_fintype_prod_eq_prod] simp_rw [cosSqDensity_integral_one (B / 2) (by linarith)] simp
CausalSmith.Experimentation.SnipeDegreeFrontier.baselineProductDensity_integral_one · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:50
theorem baselineProductMeasure_isProbability

Establishes the stated mathematical result for baseline product measure is probability.

Formal statement
B :
m :
hB :
0 < B
Proof (Lean source)
lemma baselineProductMeasure_isProbability (B : ℝ) (m : ℕ) (hB : 0 < B) : IsProbabilityMeasure (baselineProductMeasure B m) := by rw [isProbabilityMeasure_iff_real] unfold baselineProductMeasure rw [measureReal_def, withDensity_apply _ MeasurableSet.univ] rw [setLIntegral_univ] rw [← MeasureTheory.ofReal_integral_eq_lintegral_ofReal (baselineProductDensity_integrable B m)] · rw [baselineProductDensity_integral_one B m hB] simp · exact Filter.Eventually.of_forall (baselineProductDensity_nonneg B m hB)
CausalSmith.Experimentation.SnipeDegreeFrontier.baselineProductMeasure_isProbability · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:60
def blockObservedVector

Repeat the observed block statistic over all active units and put zero on the inactive remainder.

Definition (Lean source)
noncomputable def blockObservedVector (n d : ℕ) (x : (Fin n → Bool) × (Fin (blockCount n d) → ℝ)) : Fin n → ℝ := fun i => if hi : i.val < activeCount n d then x.2 ⟨i.val / d, by have hd0 : 0 < d := by by_contra hd have hd' : d = 0 := Nat.eq_zero_of_not_pos hd simp [activeCount, hd'] at hi rw [div_lt_iff_lt_mul hd0] simpa [activeCount, blockCount, mul_comm] using hi⟩ else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.blockObservedVector · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:75
def blockEstimatorStatistic

Defines block estimator statistic.

Definition (Lean source)
noncomputable def blockEstimatorStatistic (n d : ℕ) (est : Estimator (Fin n)) : ((Fin n → Bool) × (Fin (blockCount n d) → ℝ)) → ℝ := by classical exact fun x => est (fun j i => decide (blockGraph n d j i)) x.1 (blockObservedVector n d x)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEstimatorStatistic · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:92
theorem blockObservedVector_measurable

Establishes the stated mathematical result for block observed vector measurable.

Formal statement
n d :
Proof (Lean source)
lemma blockObservedVector_measurable (n d : ℕ) : Measurable (blockObservedVector n d) := by apply measurable_pi_lambda intro i by_cases hi : i.val < activeCount n d · simp only [blockObservedVector, dif_pos hi] fun_prop · simp [blockObservedVector, hi]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockObservedVector_measurable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:101
theorem blockEstimatorStatistic_measurable

Establishes the stated mathematical result for block estimator statistic measurable.

Formal statement
n d :
est :
hest :
Proof (Lean source)
lemma blockEstimatorStatistic_measurable (n d : ℕ) (est : Estimator (Fin n)) (hest : OutcomeMeasurable est) : Measurable (blockEstimatorStatistic n d est) := by classical let G : Fin n → Fin n → Bool := fun j i => decide (blockGraph n d j i) have hsum : Measurable (fun x : (Fin n → Bool) × (Fin (blockCount n d) → ℝ) => ∑ z : Fin n → Bool, if x.1 = z then est G z (blockObservedVector n d x) else 0) := by apply measurable_sum univ intro z hz apply Measurable.ite · exact (measurableSet_singleton z).preimage measurable_fst · apply (hest G z).comp exact blockObservedVector_measurable n d · exact measurable_const convert hsum using 1 funext x simp [blockEstimatorStatistic, G]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEstimatorStatistic_measurable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:111
theorem blockObservedVector_translate

Establishes the stated mathematical result for block observed vector translate.

Formal statement
n d β :
B p σ :
hd :
1 ≤ d
:
σ = -1 ∨ σ = 1
z :
Fin n → Bool
U :
Fin (blockCount n d) → ℝ
blockObservedVector n d (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))
= obsOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) z
Proof (Lean source)
lemma blockObservedVector_translate (n d β : ℕ) (B p σ : ℝ) (hd : 1 ≤ d) (hσ : σ = -1 ∨ σ = 1) (z : Fin n → Bool) (U : Fin (blockCount n d) → ℝ) : blockObservedVector n d (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) = obsOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) z := by funext i by_cases hi : i.val < activeCount n d · rw [show blockObservedVector n d (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) i = U ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ z) by simp [blockObservedVector, hi]] exact (potentialOutcome_blockSchedule n d β B p σ hd hσ U i hi z).symm · rw [show blockObservedVector n d (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) i = 0 by simp [blockObservedVector, hi]] exact (potentialOutcome_blockSchedule_inactive n d β B p σ hσ U i hi z).symm
CausalSmith.Experimentation.SnipeDegreeFrontier.blockObservedVector_translate · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:134
theorem blockPrior_integral_eq_baseline

A translated-coordinate Fubini identity for bounded measurable test functions.

Formal statement
n d β :
B p σ :
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
φ :
((Fin n → Bool) × (Fin (blockCount n d) → ℝ)) → ℝ
:
hφ0 :
∀ x, 0 ≤ φ x
hφ1 :
∀ x, φ x ≤ 1
∫ x, blockPriorDensity n d β B p σ x * φ x ∂blockDominatingMeasure n d
= ∫ U, baselineProductDensity B (blockCount n d) U * ∑ z : Fin n → Bool, assignmentMass n p z * φ (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) ∂(Measure.pi (fun _ : Fin (blockCount n d) => volume))
Proof (Lean source)
lemma blockPrior_integral_eq_baseline (n d β : ℕ) (B p σ : ℝ) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) (φ : ((Fin n → Bool) × (Fin (blockCount n d) → ℝ)) → ℝ) (hφ : Measurable φ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) : ∫ x, blockPriorDensity n d β B p σ x * φ x ∂blockDominatingMeasure n d = ∫ U, baselineProductDensity B (blockCount n d) U * ∑ z : Fin n → Bool, assignmentMass n p z * φ (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) ∂(Measure.pi (fun _ : Fin (blockCount n d) => volume)) := by classical let μy : Measure (Fin (blockCount n d) → ℝ) := Measure.pi (fun _ : Fin (blockCount n d) => volume) let shift : (Fin n → Bool) → Fin (blockCount n d) → ℝ := fun z b => σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z) have hleftInt : Integrable (fun x => blockPriorDensity n d β B p σ x * φ x) (blockDominatingMeasure n d) := by apply Integrable.mono' (blockPriorDensity_integrable n d β B p σ hB hp0 hp1) ((blockPriorDensity_integrable n d β B p σ hB hp0 hp1).1.mul hφ.aestronglyMeasurable) exact Filter.Eventually.of_forall fun x => by change |blockPriorDensity n d β B p σ x * φ x| ≤ blockPriorDensity n d β B p σ x rw [abs_mul, abs_of_nonneg (blockPriorDensity_nonneg n d β B p σ hB hp0 hp1 x), abs_of_nonneg (hφ0 x)] exact mul_le_of_le_one_right (blockPriorDensity_nonneg n d β B p σ hB hp0 hp1 x) (hφ1 x) rw [blockDominatingMeasure, integral_prod _ hleftInt] have htranslate (z : Fin n → Bool) : (∫ y, blockPriorDensity n d β B p σ (z, y) * φ (z, y) ∂μy) = assignmentMass n p z * ∫ U, baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b) ∂μy := by change (∫ y, (assignmentMass n p z * ∏ b, cosSqDensity (B / 2) (y b - shift z b)) * φ (z, y) ∂μy) = assignmentMass n p z * ∫ U, baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b) ∂μy rw [show (∫ y, (assignmentMass n p z * ∏ b, cosSqDensity (B / 2) (y b - shift z b)) * φ (z, y) ∂μy) = assignmentMass n p z * ∫ y, (∏ b, cosSqDensity (B / 2) (y b - shift z b)) * φ (z, y) ∂μy by rw [← integral_const_mul] apply integral_congr_ae exact Filter.Eventually.of_forall fun y => by ring] congr 1 rw [← MeasureTheory.integral_add_right_eq_self (fun y => (∏ b, cosSqDensity (B / 2) (y b - shift z b)) * φ (z, y)) (shift z)] apply integral_congr_ae exact Filter.Eventually.of_forall fun U => by change (∏ b, cosSqDensity (B / 2) ((U + shift z) b - shift z b)) * φ (z, U + shift z) = baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b) congr 1 · unfold baselineProductDensity apply Finset.prod_congr rfl intro b hb congr 2 simp change (∫ x, ∫ y, blockPriorDensity n d β B p σ (x, y) * φ (x, y) ∂μy ∂Measure.count) = ∫ U, baselineProductDensity B (blockCount n d) U * ∑ z : Fin n → Bool, assignmentMass n p z * φ (z, fun b => U b + shift z b) ∂μy simp_rw [htranslate] rw [MeasureTheory.integral_fintype] · have hcount (z : Fin n → Bool) : Measure.count.real ({z} : Set (Fin n → Bool)) = 1 := by rw [measureReal_def, Measure.count_apply_finite] · simp · exact Set.finite_singleton z simp_rw [hcount, one_smul] rw [show (∑ z : Fin n → Bool, assignmentMass n p z * ∫ U, baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b) ∂μy) = ∫ U, ∑ z : Fin n → Bool, assignmentMass n p z * (baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b)) ∂μy by rw [integral_finset_sum] · apply Finset.sum_congr rfl intro z hz rw [integral_const_mul] · intro z hz have hcomp : AEStronglyMeasurable (fun U : Fin (blockCount n d) → ℝ => φ (z, fun b => U b + shift z b)) μy := (hφ.comp (measurable_const.prodMk (measurable_id.add measurable_const))).aestronglyMeasurable have hmul : Integrable (fun U : Fin (blockCount n d) → ℝ => baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b)) μy := (baselineProductDensity_integrable B (blockCount n d)).mono' ((baselineProductDensity_integrable B (blockCount n d)).1.mul hcomp) (Filter.Eventually.of_forall fun U => by change |baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b)| ≤ baselineProductDensity B (blockCount n d) U rw [abs_mul, abs_of_nonneg (baselineProductDensity_nonneg B (blockCount n d) hB U), abs_of_nonneg (hφ0 _)] exact mul_le_of_le_one_right (baselineProductDensity_nonneg B (blockCount n d) hB U) (hφ1 _)) exact hmul.const_mul (assignmentMass n p z)] apply integral_congr_ae exact Filter.Eventually.of_forall fun U => by change (∑ z : Fin n → Bool, assignmentMass n p z * (baselineProductDensity B (blockCount n d) U * φ (z, fun b => U b + shift z b))) = baselineProductDensity B (blockCount n d) U * ∑ z : Fin n → Bool, assignmentMass n p z * φ (z, fun b => U b + shift z b) rw [Finset.mul_sum] apply Finset.sum_congr rfl intro z hz ring · exact Integrable.of_finite
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPrior_integral_eq_baseline · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:171
theorem blockPriorLaw_isProbability

Establishes the stated mathematical result for block prior law is probability.

Formal statement
n d β :
B p σ :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
:
σ = -1 ∨ σ = 1
Proof (Lean source)
lemma blockPriorLaw_isProbability (n d β : ℕ) (B p σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) (hσ : σ = -1 ∨ σ = 1) : IsProbabilityMeasure (blockPriorLaw n d β B p σ) := by rw [isProbabilityMeasure_iff_real] unfold blockPriorLaw rw [measureReal_def, withDensity_apply _ MeasurableSet.univ, setLIntegral_univ] rw [← MeasureTheory.ofReal_integral_eq_lintegral_ofReal (blockPriorDensity_integrable n d β B p σ hB hp0 hp1)] · rw [blockPriorDensity_integral_one n d β B p σ hn hd hdn hB hp0 hp1 hσ] simp · exact Filter.Eventually.of_forall (blockPriorDensity_nonneg n d β B p σ hB hp0 hp1)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorLaw_isProbability · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:310
theorem blockPrior_tvDist_le_sqrt_hellinger

Establishes the stated mathematical result for block prior tv dist le sqrt hellinger.

Formal statement
n d β :
B p :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
tvDist (blockPriorLaw n d β B p 1) (blockPriorLaw n d β B p (-1))
Proof (Lean source)
lemma blockPrior_tvDist_le_sqrt_hellinger (n d β : ℕ) (B p : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) : tvDist (blockPriorLaw n d β B p 1) (blockPriorLaw n d β B p (-1)) ≤ sqrt (hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1))) := by let μ := blockDominatingMeasure n d let f := blockPriorDensity n d β B p 1 let g := blockPriorDensity n d β B p (-1) have hf := blockPriorDensity_integrable n d β B p 1 hB hp0 hp1 have hg := blockPriorDensity_integrable n d β B p (-1) hB hp0 hp1 have hf0 := blockPriorDensity_nonneg n d β B p 1 hB hp0 hp1 have hg0 := blockPriorDensity_nonneg n d β B p (-1) hB hp0 hp1 have hf1 := blockPriorDensity_integral_one n d β B p 1 hn hd hdn hB hp0 hp1 (inr rfl) have hg1 := blockPriorDensity_integral_one n d β B p (-1) hn hd hdn hB hp0 hp1 (inl rfl) have htv := tvDist_le_sqrt_two_mul_one_sub_affinity μ f g hf hg hf0 hg0 hf1 hg1 have hhell := hellingerSqDensity_eq_two_mul_one_sub_affinity μ f g hf hg hf0 hg0 hf1 hg1 simpa [blockPriorLaw, μ, f, g, hhell] using htv
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPrior_tvDist_le_sqrt_hellinger · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:329
def missIndicator

Defines miss indicator.

Definition (Lean source)
noncomputable def missIndicator {Ω : Type*} (T : Ω → ℝ) (θ s : ℝ) (x : Ω) : ℝ := if s ≤ |T x - θ| then 1 else 0
theorem missIndicator_measurable

Establishes the stated mathematical result for miss indicator measurable.

Formal statement
Ω :
T :
Ω → ℝ
hT :
θ s :
Proof (Lean source)
lemma missIndicator_measurable {Ω : Type*} [MeasurableSpace Ω] (T : Ω → ℝ) (hT : Measurable T) (θ s : ℝ) : Measurable (missIndicator T θ s) := by unfold missIndicator apply Measurable.ite · exact measurableSet_le measurable_const ((continuous_abs.measurable).comp (hT.sub measurable_const)) · exact measurable_const · exact measurable_const
CausalSmith.Experimentation.SnipeDegreeFrontier.missIndicator_measurable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:362
theorem missIndicator_nonneg

Establishes the stated mathematical result for miss indicator nonneg.

Formal statement
Ω :
Type*
T :
Ω → ℝ
θ s :
0 ≤ missIndicator T θ s
Proof (Lean source)
lemma missIndicator_nonneg {Ω : Type*} (T : Ω → ℝ) (θ s : ℝ) : 0 ≤ missIndicator T θ s := by intro x unfold missIndicator split <;> norm_num
CausalSmith.Experimentation.SnipeDegreeFrontier.missIndicator_nonneg · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:374
theorem missIndicator_le_one

Establishes the stated mathematical result for miss indicator le one.

Formal statement
Ω :
Type*
T :
Ω → ℝ
θ s :
missIndicator T θ s ≤ 1
Proof (Lean source)
lemma missIndicator_le_one {Ω : Type*} (T : Ω → ℝ) (θ s : ℝ) : missIndicator T θ s ≤ 1 := by intro x unfold missIndicator split <;> norm_num
CausalSmith.Experimentation.SnipeDegreeFrontier.missIndicator_le_one · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:381
theorem assignmentMass_eq_bernoulli_p

Establishes the stated mathematical result for assignment mass eq bernoulli p.

Formal statement
n :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
z :
Fin n → Bool
= (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).p z
Proof (Lean source)
lemma assignmentMass_eq_bernoulli_p (n : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (z : Fin n → Bool) : assignmentMass n p z = (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).p z := by simp [assignmentMass, bernoulliDesign, prodDesign_p, coinDesign] apply Finset.prod_congr rfl intro i hi cases hzi : z i <;> simp [hzi]
CausalSmith.Experimentation.SnipeDegreeFrontier.assignmentMass_eq_bernoulli_p · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:388
theorem sum_assignmentMass_one

Establishes the stated mathematical result for sum assignment mass one.

Formal statement
n :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
∑ z : Fin n → Bool, assignmentMass n p z = 1
Proof (Lean source)
lemma sum_assignmentMass_one (n : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : ∑ z : Fin n → Bool, assignmentMass n p z = 1 := by simp_rw [assignmentMass_eq_bernoulli_p n p hp0 hp1] exact (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).p_sum
CausalSmith.Experimentation.SnipeDegreeFrontier.sum_assignmentMass_one · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:401
theorem blockPriorLaw_real_miss

Establishes the stated mathematical result for block prior law real miss.

Formal statement
n d β :
B p σ θ s :
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
est :
hest :
(blockPriorLaw n d β B p σ).real {x | s ≤ |blockEstimatorStatistic n d est x - θ|}
= ∫ U, baselineProductDensity B (blockCount n d) U * ∑ z : Fin n → Bool, assignmentMass n p z * missIndicator (blockEstimatorStatistic n d est) θ s (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) ∂(Measure.pi (fun _ : Fin (blockCount n d) => volume))
Proof (Lean source)
lemma blockPriorLaw_real_miss (n d β : ℕ) (B p σ θ s : ℝ) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) (est : Estimator (Fin n)) (hest : OutcomeMeasurable est) : (blockPriorLaw n d β B p σ).real {x | s ≤ |blockEstimatorStatistic n d est x - θ|} = ∫ U, baselineProductDensity B (blockCount n d) U * ∑ z : Fin n → Bool, assignmentMass n p z * missIndicator (blockEstimatorStatistic n d est) θ s (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) ∂(Measure.pi (fun _ : Fin (blockCount n d) => volume)) := by let T := blockEstimatorStatistic n d est have hT : Measurable T := blockEstimatorStatistic_measurable n d est hest have hmiss : Measurable (missIndicator T θ s) := missIndicator_measurable T hT θ s have hdens := blockPriorDensity_integrable n d β B p σ hB hp0 hp1 have hset : MeasurableSet {x | s ≤ |T x - θ|} := by exact measurableSet_le measurable_const ((continuous_abs.measurable).comp (hT.sub measurable_const)) have hreal : (blockPriorLaw n d β B p σ).real {x | s ≤ |T x - θ|} = ∫ x in {x | s ≤ |T x - θ|}, blockPriorDensity n d β B p σ x ∂blockDominatingMeasure n d := by rw [blockPriorLaw, measureReal_def, withDensity_apply _ hset] rw [← MeasureTheory.ofReal_integral_eq_lintegral_ofReal hdens.integrableOn] · rw [ENNReal.toReal_ofReal] exact integral_nonneg_of_ae (Filter.Eventually.of_forall fun x => blockPriorDensity_nonneg n d β B p σ hB hp0 hp1 x) · exact Filter.Eventually.of_forall (blockPriorDensity_nonneg n d β B p σ hB hp0 hp1) rw [hreal] rw [← integral_indicator hset] have hind : indicator {x | s ≤ |T x - θ|} (blockPriorDensity n d β B p σ) = fun x => blockPriorDensity n d β B p σ x * missIndicator T θ s x := by funext x by_cases hx : s ≤ |T x - θ| · simp [indicator, missIndicator, hx] · simp [indicator, missIndicator, hx] rw [hind] exact blockPrior_integral_eq_baseline n d β B p σ hB hp0 hp1 (missIndicator T θ s) hmiss (missIndicator_nonneg T θ s) (missIndicator_le_one T θ s)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorLaw_real_miss · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:409
def blockBaselineSupport

Defines block baseline support.

Definition (Lean source)
def blockBaselineSupport (B : ℝ) {m : ℕ} (U : Fin m → ℝ) : Prop := ∀ b, |U b| ≤ B / 2
CausalSmith.Experimentation.SnipeDegreeFrontier.blockBaselineSupport · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:461
theorem measurableSet_blockBaselineSupport

Establishes the stated mathematical result for measurable set block baseline support.

Formal statement
B :
m :
MeasurableSet {U : Fin m → ℝ | blockBaselineSupport B U}
Proof (Lean source)
lemma measurableSet_blockBaselineSupport (B : ℝ) (m : ℕ) : MeasurableSet {U : Fin m → ℝ | blockBaselineSupport B U} := by rw [show {U : Fin m → ℝ | blockBaselineSupport B U} = ⋂ b : Fin m, {U | |U b| ≤ B / 2} by ext U simp [blockBaselineSupport]] exact MeasurableSet.iInter fun b => measurableSet_le ((continuous_abs.measurable).comp (measurable_pi_apply b)) measurable_const
CausalSmith.Experimentation.SnipeDegreeFrontier.measurableSet_blockBaselineSupport · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:465
theorem baselineProductDensity_eq_zero_of_not_support

Establishes the stated mathematical result for baseline product density eq zero of not support.

Formal statement
B :
m :
U :
Fin m → ℝ
hU :
Proof (Lean source)
lemma baselineProductDensity_eq_zero_of_not_support (B : ℝ) (m : ℕ) (U : Fin m → ℝ) (hU : ¬ blockBaselineSupport B U) : baselineProductDensity B m U = 0 := by classical obtain ⟨b, hb⟩ := not_forall.mp hU unfold baselineProductDensity apply Finset.prod_eq_zero (Finset.mem_univ b) unfold cosSqDensity rw [if_neg hb]
CausalSmith.Experimentation.SnipeDegreeFrontier.baselineProductDensity_eq_zero_of_not_support · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:477
def blockMissProbability

Defines block miss probability.

Definition (Lean source)
noncomputable def blockMissProbability (n d β : ℕ) (B p σ θ s : ℝ) (est : Estimator (Fin n)) (U : Fin (blockCount n d) → ℝ) : ℝ := ∑ z : Fin n → Bool, assignmentMass n p z * missIndicator (blockEstimatorStatistic n d est) θ s (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockMissProbability · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:489
theorem blockMissProbability_measurable

Establishes the stated mathematical result for block miss probability measurable.

Formal statement
n d β :
B p σ θ s :
est :
hest :
Measurable (blockMissProbability n d β B p σ θ s est)
Proof (Lean source)
lemma blockMissProbability_measurable (n d β : ℕ) (B p σ θ s : ℝ) (est : Estimator (Fin n)) (hest : OutcomeMeasurable est) : Measurable (blockMissProbability n d β B p σ θ s est) := by classical unfold blockMissProbability apply measurable_sum intro z hz apply const_mul exact (missIndicator_measurable _ (blockEstimatorStatistic_measurable n d est hest) θ s).comp (measurable_const.prodMk (measurable_id.add measurable_const))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockMissProbability_measurable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:499
theorem blockMissProbability_bounds

Establishes the stated mathematical result for block miss probability bounds.

Formal statement
n d β :
B p σ θ s :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
est :
U :
Fin (blockCount n d) → ℝ
0 ≤ blockMissProbability n d β B p σ θ s est U ∧
blockMissProbability n d β B p σ θ s est U ≤ 1
Proof (Lean source)
lemma blockMissProbability_bounds (n d β : ℕ) (B p σ θ s : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (est : Estimator (Fin n)) (U : Fin (blockCount n d) → ℝ) : 0 ≤ blockMissProbability n d β B p σ θ s est U ∧ blockMissProbability n d β B p σ θ s est U ≤ 1 := by constructor · unfold blockMissProbability apply sum_nonneg intro z hz exact mul_nonneg (by rw [assignmentMass_eq_bernoulli_p n p hp0 hp1]; exact (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).p_nonneg z) (missIndicator_nonneg _ θ s _) · calc blockMissProbability n d β B p σ θ s est U ≤ ∑ z : Fin n → Bool, assignmentMass n p z * 1 := by unfold blockMissProbability apply Finset.sum_le_sum intro z hz apply mul_le_mul_of_nonneg_left (missIndicator_le_one _ θ s _) rw [assignmentMass_eq_bernoulli_p n p hp0 hp1] exact (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).p_nonneg z _ = 1 := by rw [← Finset.sum_mul, sum_assignmentMass_one n p hp0 hp1] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.blockMissProbability_bounds · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:513
theorem blockPrior_miss_sq_le_worstRisk

The continuous least-favourable prior converts a miss probability into the coefficient-class worst squared risk. This is the paper-specific use of integral_le_sSup_range_of_isProbabilityMeasure.

Formal statement
n d β :
B p σ :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
hB :
0 < B
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
:
σ = -1 ∨ σ = 1
est :
hest :
AdmissibleEstimator p (le_of_lt hp0) (le_of_lt hp1) d β B est
let s := activeShare n d * tiltAmplitude B β p (blockCount n d) d s ^ 2 * (blockPriorLaw n d β B p σ).real {x | s ≤ |blockEstimatorStatistic n d est x - σ * s|}
≤ worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B est
Proof (Lean source)
lemma blockPrior_miss_sq_le_worstRisk (n d β : ℕ) (B p σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 < B) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hσ : σ = -1 ∨ σ = 1) (est : Estimator (Fin n)) (hest : AdmissibleEstimator p (le_of_lt hp0) (le_of_lt hp1) d β B est) : let s := activeShare n d * tiltAmplitude B β p (blockCount n d) d s ^ 2 * (blockPriorLaw n d β B p σ).real {x | s ≤ |blockEstimatorStatistic n d est x - σ * s|} ≤ worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B est := by classical let s := activeShare n d * tiltAmplitude B β p (blockCount n d) d let q := blockMissProbability n d β B p σ (σ * s) s est let r : (Fin (blockCount n d) → ℝ) → ℝ := fun U => if blockBaselineSupport B U then s ^ 2 * q U else 0 let ν := baselineProductMeasure B (blockCount n d) let R := worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B est have hρ0 : 0 ≤ activeShare n d := by unfold activeShare positivity have hH : 0 < representerMassSup β p := representerMassSup_pos β p hβ hp0 hp1 have hδ0 : 0 ≤ tiltAmplitude B β p (blockCount n d) d := by unfold tiltAmplitude positivity have hs0 : 0 ≤ s := mul_nonneg hρ0 hδ0 have hR0 : 0 ≤ R := by let U0 : Fin (blockCount n d) → ℝ := fun _ => 0 have hU0 : blockBaselineSupport B U0 := by intro b change |(0 : ℝ)| ≤ B / 2 norm_num linarith let M0 := blockScheduleModel n d β B p σ hn hd hdn hB.le hβ hp0 hp1 hσ U0 hU0 have hr0 : 0 ≤ riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 est := by unfold riskAt exact (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).mse_nonneg _ _ exact hr0.trans (le_csSup hest.2 (Set.mem_range_self M0)) have hpoint (U : Fin (blockCount n d) → ℝ) : r U ≤ R := by by_cases hU : blockBaselineSupport B U · rw [show r U = s ^ 2 * q U by simp [r, hU]] let M := blockScheduleModel n d β B p σ hn hd hdn hB.le hβ hp0 hp1 hσ U hU have hrange : riskAt p (le_of_lt hp0) (le_of_lt hp1) M est ≤ R := le_csSup hest.2 (Set.mem_range_self M) apply le_trans _ hrange unfold riskAt mse unfold q blockMissProbability rw [Finset.mul_sum] apply Finset.sum_le_sum intro z hz rw [show s ^ 2 * (assignmentMass n p z * missIndicator (blockEstimatorStatistic n d est) (σ * s) s (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))) = assignmentMass n p z * (s ^ 2 * missIndicator (blockEstimatorStatistic n d est) (σ * s) s (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))) by ring] rw [assignmentMass_eq_bernoulli_p n p (le_of_lt hp0) (le_of_lt hp1)] apply mul_le_mul_of_nonneg_left _ <| (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_nonneg z have ht : tte M.edge M.coef = σ * s := by change tte (blockGraph n d) (blockSchedule n d β B p σ hσ U) = σ * s rw [tte_blockSchedule n d β B p σ hn hd hβ hp0 hp1 hσ U] dsimp [s] ring have hobs := blockObservedVector_translate n d β B p σ hd hσ z U change s ^ 2 * missIndicator (blockEstimatorStatistic n d est) (σ * s) s (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) ≤ (est (edgeFn M) z (obsOutcome M.edge M.coef z) - tte M.edge M.coef) ^ 2 rw [ht] have hedge : edgeFn M = fun j i => decide (blockGraph n d j i) := by rfl rw [hedge] change s ^ 2 * missIndicator (blockEstimatorStatistic n d est) (σ * s) s (z, fun b => U b + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z)) ≤ (est (fun j i => decide (blockGraph n d j i)) z (obsOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) z) - σ * s) ^ 2 rw [← hobs] unfold blockEstimatorStatistic missIndicator split_ifs with he · simpa [sq_abs] using (sq_le_sq₀ hs0 (abs_nonneg _)|>.2 he) · simp positivity · simp [r, hU, hR0] have hrmeas : Measurable r := by unfold r apply Measurable.ite (measurableSet_blockBaselineSupport B _) · exact measurable_const.mul (blockMissProbability_measurable n d β B p σ (σ * s) s est hest.1) · exact measurable_const letI : IsProbabilityMeasure ν := baselineProductMeasure_isProbability B (blockCount n d) hB have hrint : Integrable r ν := by apply Integrable.of_bound hrmeas.aestronglyMeasurable |R| exact Filter.Eventually.of_forall fun U => by rw [Real.norm_eq_abs, abs_of_nonneg] · exact (hpoint U).trans (le_abs_self R) · unfold r split_ifs · exact mul_nonneg (sq_nonneg _) (blockMissProbability_bounds n d β B p σ (σ * s) s (le_of_lt hp0) (le_of_lt hp1) est U).1 · norm_num have hrbdd : BddAbove (range r) := ⟨R, by rintro _ ⟨U, rfl⟩ exact hpoint U⟩ have havg : ∫ U, r U ∂ν ≤ sSup (range r) := integral_le_sSup_range_of_isProbabilityMeasure ν r hrint hrbdd have hsup : sSup (range r) ≤ R := csSup_le (Set.range_nonempty r) (fun _ h => by rcases h with ⟨U, rfl⟩ exact hpoint U) calc s ^ 2 * (blockPriorLaw n d β B p σ).real {x | s ≤ |blockEstimatorStatistic n d est x - σ * s|} = ∫ U, r U ∂ν := by rw [blockPriorLaw_real_miss n d β B p σ (σ * s) s hB hp0 hp1 est hest.1] unfold ν baselineProductMeasure rw [integral_withDensity_eq_integral_toReal_smul₀] · rw [← integral_const_mul] apply integral_congr_ae exact Filter.Eventually.of_forall fun U => by change s ^ 2 * (baselineProductDensity B (blockCount n d) U * q U) = (ofReal (baselineProductDensity B (blockCount n d) U)).toReal * r U by_cases hU : blockBaselineSupport B U · rw [ENNReal.toReal_ofReal (baselineProductDensity_nonneg B (blockCount n d) hB U)] simp only [r, hU, if_pos] unfold q blockMissProbability ring · rw [baselineProductDensity_eq_zero_of_not_support B _ U hU] simp [r, hU] · exact (baselineProductDensity_integrable B (blockCount n d)).1.aemeasurable.ennreal_ofReal · exact Filter.Eventually.of_forall fun U => ENNReal.ofReal_lt_top _ ≤ sSup (range r) := havg _ ≤ R := hsup
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPrior_miss_sq_le_worstRisk · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:544
theorem potentialOutcome_abs_le_mass

Establishes the stated mathematical result for potential outcome abs le mass.

Formal statement
V :
Type*
V → V → Prop
V → Finset V → ℝ
B :
hmass :
i :
V
z :
V → Bool
|potentialOutcome G c i z| ≤ B
Proof (Lean source)
lemma potentialOutcome_abs_le_mass {V : Type*} [Fintype V] [DecidableEq V] {G : V → V → Prop} {c : V → Finset V → ℝ} {B : ℝ} (hmass : BoundedCoeffMass G c B) (i : V) (z : V → Bool) : |potentialOutcome G c i z| ≤ B := by classical unfold potentialOutcome calc |∑ S ∈ (nbhd G i).powerset, c i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0| ≤ ∑ S ∈ (nbhd G i).powerset, |c i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ S ∈ (nbhd G i).powerset, |c i S| := by apply Finset.sum_le_sum intro S hS rw [abs_mul] apply mul_le_of_le_one_right (abs_nonneg _) rw [Finset.abs_prod] exact Finset.prod_le_one (fun _ _ => abs_nonneg _) (fun j _ => by cases z j <;> norm_num) _ ≤ B := hmass i
CausalSmith.Experimentation.SnipeDegreeFrontier.potentialOutcome_abs_le_mass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:715
theorem tte_abs_le_two_mul_of_modelClass

Establishes the stated mathematical result for tte abs le two mul of model class.

Formal statement
V :
Type*
Nonempty V
d β :
B :
M :
ModelClass V d β B
|tte M.edge M.coef| ≤ 2 * B
Proof (Lean source)
lemma tte_abs_le_two_mul_of_modelClass {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] {d β : ℕ} {B : ℝ} (M : ModelClass V d β B) : |tte M.edge M.coef| ≤ 2 * B := by classical have hcard : (0 : ℝ) < Fintype.card V := by exact_mod_cast Fintype.card_pos unfold tte rw [abs_mul, abs_of_pos (inv_pos.mpr hcard)] calc (Fintype.card V : ℝ)⁻¹ * |∑ i : V, (potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false))| ≤ (Fintype.card V : ℝ)⁻¹ * ∑ i : V, |potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false)| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ (Fintype.card V : ℝ)⁻¹ * ∑ _i : V, (2 * B) := by gcongr with i calc |_ - _| ≤ |potentialOutcome M.edge M.coef i (fun _ => true)| + |potentialOutcome M.edge M.coef i (fun _ => false)| := abs_sub _ _ _ ≤ B + B := add_le_add (potentialOutcome_abs_le_mass M.mass_le i _) (potentialOutcome_abs_le_mass M.mass_le i _) _ = 2 * B := by ring _ = 2 * B := by simp [ne_of_gt hcard]
CausalSmith.Experimentation.SnipeDegreeFrontier.tte_abs_le_two_mul_of_modelClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:739
theorem zeroEstimator_admissible

Establishes the stated mathematical result for zero estimator admissible.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
d β :
B :
AdmissibleEstimator (V := V) p hp0 hp1 d β B (fun _ _ _ => 0)
Proof (Lean source)
lemma zeroEstimator_admissible {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) : AdmissibleEstimator (V := V) p hp0 hp1 d β B (fun _ _ _ => 0) := by constructor · intro G z exact measurable_const · refine ⟨4 * B ^ 2, ?_⟩ rintro _ ⟨M, rfl⟩ unfold riskAt mse simp only change (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun _ => (0 - tte M.edge M.coef) ^ 2) ≤ 4 * B ^ 2 rw [E_const] have ht := tte_abs_le_two_mul_of_modelClass M have hB0 : 0 ≤ B := by let i := Classical.choice ‹Nonempty V› exact (sum_nonneg fun _ _ => abs_nonneg _).trans (M.mass_le i) have hsquare := (sq_le_sq₀ (abs_nonneg (tte M.edge M.coef)) (by positivity)).2 ht rw [sq_abs] at hsquare nlinarith
CausalSmith.Experimentation.SnipeDegreeFrontier.zeroEstimator_admissible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:769
theorem minimaxRisk_blockPrior_lower

Continuous-prior Le Cam converse for the block family.

Formal statement
n d β :
B p :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
hB :
0 < B
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hhell :
≤ 1 / 4
let s := activeShare n d * tiltAmplitude B β p (blockCount n d) d s ^ 2 / 4
minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B
Proof (Lean source)
lemma minimaxRisk_blockPrior_lower (n d β : ℕ) (B p : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 < B) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hhell : hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1)) ≤ 1 / 4) : let s := activeShare n d * tiltAmplitude B β p (blockCount n d) d s ^ 2 / 4 ≤ minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B := by classical let s := activeShare n d * tiltAmplitude B β p (blockCount n d) d have hs0 : 0 ≤ s := by unfold s activeShare tiltAmplitude have hH := representerMassSup_pos β p hβ hp0 hp1 positivity let Pplus := blockPriorLaw n d β B p 1 let Pminus := blockPriorLaw n d β B p (-1) letI : IsProbabilityMeasure Pplus := blockPriorLaw_isProbability n d β B p 1 hn hd hdn hB hp0 hp1 (inr rfl) letI : IsProbabilityMeasure Pminus := blockPriorLaw_isProbability n d β B p (-1) hn hd hdn hB hp0 hp1 (inl rfl) have htv0 := blockPrior_tvDist_le_sqrt_hellinger n d β B p hn hd hdn hB hp0 hp1 have htv : tvDist Pplus Pminus ≤ 1 / 2 := by apply htv0.trans calc sqrt (hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1))) ≤ sqrt (1 / 4) := Real.sqrt_le_sqrt hhell _ = 1 / 2 := by rw [show (1 / 4 : ℝ) = (1 / 2 : ℝ) ^ 2 by ring, Real.sqrt_sq_eq_abs] norm_num letI : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩ unfold minimaxRisk apply le_csInf · refine ⟨worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ((fun _ _ _ => (0 : ℝ)) : Estimator (Fin n)), ?_⟩ exact ⟨(fun _ _ _ => (0 : ℝ) : Estimator (Fin n)), zeroEstimator_admissible p (le_of_lt hp0) (le_of_lt hp1) d β B, rfl⟩ · intro R hR rcases hR with ⟨est, hest, rfl⟩ let T := blockEstimatorStatistic n d est have hT : Measurable T := blockEstimatorStatistic_measurable n d est hest.1 have hsep : 2 * s ≤ |s - (-s)| := by rw [sub_neg_eq_add] rw [abs_of_nonneg (add_nonneg hs0 hs0)] ring_nf exact le_rfl have hcam := two_point_lower_bound_of_tvDist_le (P₀ := Pplus) (P₁ := Pminus) hT hsep htv have hplus := blockPrior_miss_sq_le_worstRisk n d β B p 1 hn hd hdn hB hβ hp0 hp1 (inr rfl) est hest have hminus := blockPrior_miss_sq_le_worstRisk n d β B p (-1) hn hd hdn hB hβ hp0 hp1 (inl rfl) est hest change (1 - (1 / 2 : ℝ)) / 2 ≤ max (Pplus.real {x | s ≤ |T x - s|}) (Pminus.real {x | s ≤ |T x - -s|}) at hcam dsimp only at hplus hminus simp only [one_mul] at hplus simp only [neg_one_mul] at hminus change s ^ 2 * Pplus.real {x | s ≤ |T x - s|} ≤ worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B est at hplus change s ^ 2 * Pminus.real {x | s ≤ |T x - -s|} ≤ worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B est at hminus have hmax : s ^ 2 * max (Pplus.real {x | s ≤ |T x - s|}) (Pminus.real {x | s ≤ |T x - -s|}) ≤ worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B est := by by_cases hle : Pplus.real {x | s ≤ |T x - s|} ≤ Pminus.real {x | s ≤ |T x - -s|} · rw [max_eq_right hle] exact hminus · rw [max_eq_left (le_of_not_ge hle)] exact hplus have hquarter : (1 / 4 : ℝ) ≤ max (Pplus.real {x | s ≤ |T x - s|}) (Pminus.real {x | s ≤ |T x - -s|}) := by convert hcam using 1 <;> norm_num nlinarith [mul_le_mul_of_nonneg_left hquarter (sq_nonneg s)]
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRisk_blockPrior_lower · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/ContinuousPriorConverse.lean:795
Helpers.HeadlineSupport 12 declarations
theorem tte_abs_le_of_modelClass

Establishes the stated mathematical result for tte abs le of model class.

Formal statement
V :
Type*
Nonempty V
d β :
B :
M :
ModelClass V d β B
|tte M.edge M.coef| ≤ B
Proof (Lean source)
lemma tte_abs_le_of_modelClass {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] {d β : ℕ} {B : ℝ} (M : ModelClass V d β B) : |tte M.edge M.coef| ≤ B := by classical have hn : (0 : ℝ) < Fintype.card V := by exact_mod_cast Fintype.card_pos unfold tte rw [abs_mul, abs_of_pos (inv_pos.mpr hn)] calc (Fintype.card V : ℝ)⁻¹ * |∑ i : V, (potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false))| ≤ (Fintype.card V : ℝ)⁻¹ * ∑ i : V, |potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false)| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ (Fintype.card V : ℝ)⁻¹ * ∑ _i : V, B := by gcongr with i have htrue : potentialOutcome M.edge M.coef i (fun _ => true) = ∑ S ∈ (nbhd M.edge i).powerset, M.coef i S := by simp [potentialOutcome] have hfalse : potentialOutcome M.edge M.coef i (fun _ => false) = M.coef i ∅ := by unfold potentialOutcome simp_rw [Finset.prod_const] rw [Finset.sum_eq_single ∅] · simp · intro S hS hS0 have hcard : 0 < S.card := Finset.card_pos.mpr (Finset.nonempty_iff_ne_empty.mpr hS0) simp only [Bool.false_eq_true, ↓reduceIte] rw [zero_pow (Nat.ne_of_gt hcard), mul_zero] · simp rw [htrue, hfalse] rw [show (∑ S ∈ (nbhd M.edge i).powerset, M.coef i S) - M.coef i ∅ = ∑ S ∈ (nbhd M.edge i).powerset, if S = ∅ then 0 else M.coef i S by rw [show M.coef i ∅ = ∑ S ∈ (nbhd M.edge i).powerset, if S = ∅ then M.coef i ∅ else 0 by simp] rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro S hS by_cases hS0 : S = ∅ · subst S simp · have hSne : S.Nonempty := Finset.nonempty_iff_ne_empty.mpr hS0 simp [hS0, hSne]] calc |∑ S ∈ (nbhd M.edge i).powerset, if S = ∅ then 0 else M.coef i S| ≤ ∑ S ∈ (nbhd M.edge i).powerset, |if S = ∅ then 0 else M.coef i S| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ S ∈ (nbhd M.edge i).powerset, |M.coef i S| := by apply Finset.sum_le_sum intro S hS split_ifs <;> simp _ ≤ B := M.mass_le i _ = B := by simp [hn.ne']
CausalSmith.Experimentation.SnipeDegreeFrontier.tte_abs_le_of_modelClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:11
theorem tte_abs_le_of_bddModelClass

Establishes the stated mathematical result for tte abs le of bdd model class.

Formal statement
V :
Type*
Nonempty V
d β :
B :
M :
|tte M.edge M.coef| ≤ 2 * B
Proof (Lean source)
lemma tte_abs_le_of_bddModelClass {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] {d β : ℕ} {B : ℝ} (M : BddOutcomeModelClass V d β B) : |tte M.edge M.coef| ≤ 2 * B := by classical have hn : (0 : ℝ) < Fintype.card V := by exact_mod_cast Fintype.card_pos unfold tte rw [abs_mul, abs_of_pos (inv_pos.mpr hn)] calc (Fintype.card V : ℝ)⁻¹ * |∑ i : V, (_ - _)| ≤ (Fintype.card V : ℝ)⁻¹ * ∑ i : V, |potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false)| := by gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ (Fintype.card V : ℝ)⁻¹ * ∑ _i : V, (2 * B) := by gcongr with i exact (abs_sub _ _).trans <| (add_le_add (M.outcome_bound i _) (M.outcome_bound i _)).trans_eq (by ring) _ = 2 * B := by simp [hn.ne']
CausalSmith.Experimentation.SnipeDegreeFrontier.tte_abs_le_of_bddModelClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:77
theorem clipTo_sq_sub_le

Establishes the stated mathematical result for clip to sq sub le.

Formal statement
R x t :
hR :
0 ≤ R
ht :
|t| ≤ R
(clipTo R x - t) ^ 2 ≤ (x - t) ^ 2
Proof (Lean source)
lemma clipTo_sq_sub_le (R x t : ℝ) (hR : 0 ≤ R) (ht : |t| ≤ R) : (clipTo R x - t) ^ 2 ≤ (x - t) ^ 2 := by rw [abs_le] at ht unfold clipTo by_cases hxlo : x < -R · rw [min_eq_right (le_trans hxlo.le (neg_le_self hR)), max_eq_left hxlo.le] nlinarith · have hxlo' : -R ≤ x := le_of_not_gt hxlo by_cases hxhi : R < x · rw [min_eq_left hxhi.le, max_eq_right (by linarith)] nlinarith · rw [min_eq_right (le_of_not_gt hxhi), max_eq_right hxlo']
CausalSmith.Experimentation.SnipeDegreeFrontier.clipTo_sq_sub_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:100
theorem riskAt_clipped_le_raw

Establishes the stated mathematical result for risk at clipped le raw.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
d β :
B :
hB :
0 ≤ B
M :
ModelClass V d β B
riskAt p hp0 hp1 M (snipeClipped B β p) ≤ riskAt p hp0 hp1 M (snipeEstimator β p)
Proof (Lean source)
lemma riskAt_clipped_le_raw {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) {d β : ℕ} {B : ℝ} (hB : 0 ≤ B) (M : ModelClass V d β B) : riskAt p hp0 hp1 M (snipeClipped B β p) ≤ riskAt p hp0 hp1 M (snipeEstimator β p) := by unfold riskAt FiniteDesign.mse FiniteDesign.E apply Finset.sum_le_sum intro z hz apply mul_le_mul_of_nonneg_left _ <| (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).p_nonneg z exact clipTo_sq_sub_le B _ _ hB (tte_abs_le_of_modelClass M)
CausalSmith.Experimentation.SnipeDegreeFrontier.riskAt_clipped_le_raw · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:115
theorem riskAtBdd_clipped_le_raw

Establishes the stated mathematical result for risk at bdd clipped le raw.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
d β :
B :
hB :
0 ≤ B
M :
riskAtBdd p hp0 hp1 M (snipeClippedBdd B β p) ≤ riskAtBdd p hp0 hp1 M (snipeEstimator β p)
Proof (Lean source)
lemma riskAtBdd_clipped_le_raw {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) {d β : ℕ} {B : ℝ} (hB : 0 ≤ B) (M : BddOutcomeModelClass V d β B) : riskAtBdd p hp0 hp1 M (snipeClippedBdd B β p) ≤ riskAtBdd p hp0 hp1 M (snipeEstimator β p) := by unfold riskAtBdd FiniteDesign.mse FiniteDesign.E apply Finset.sum_le_sum intro z hz apply mul_le_mul_of_nonneg_left _ <| (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).p_nonneg z exact clipTo_sq_sub_le (2 * B) _ _ (by positivity) (tte_abs_le_of_bddModelClass M)
CausalSmith.Experimentation.SnipeDegreeFrontier.riskAtBdd_clipped_le_raw · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:130
theorem worstRisk_clipped_le_min

Establishes the stated mathematical result for worst risk clipped le min.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 < p
hp1 :
p < 1
d β :
B :
hB :
0 ≤ B
worstRisk (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p)
≤ 4 * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / card V)
Proof (Lean source)
lemma worstRisk_clipped_le_min {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (d β : ℕ) (B : ℝ) (hB : 0 ≤ B) : worstRisk (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ≤ 4 * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / card V) := by unfold worstRisk let M0 : ModelClass V d β B := { edge := fun _ _ => False decEdge := fun _ _ => inferInstance coef := fun _ _ => 0 supported := by simp degree_le := by simp [BoundedDegree, nbhd, outNbhd] low_order := by simp [LowOrder] mass_le := by intro i; simpa [BoundedCoeffMass] using hB } apply csSup_le · exact ⟨riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 (snipeClipped B β p), ⟨M0, rfl⟩⟩ · rintro _ ⟨M, rfl⟩ have hraw := riskAt_clipped_le_raw p (le_of_lt hp0) (le_of_lt hp1) hB M have hsat : riskAt p (le_of_lt hp0) (le_of_lt hp1) M (snipeClipped B β p) ≤ 4 * B ^ 2 := by unfold riskAt FiniteDesign.mse FiniteDesign.E calc _ ≤ ∑ z, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p z * (4 * B ^ 2) := by apply Finset.sum_le_sum intro z hz apply mul_le_mul_of_nonneg_left _ <| (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_nonneg z have hc : |snipeClipped B β p (edgeFn M) z (obsOutcome M.edge M.coef z)| ≤ B := by unfold snipeClipped clipTo rw [abs_le] simp [hB] have ht := tte_abs_le_of_modelClass M have he := (abs_sub _ _).trans (add_le_add hc ht) have he2 := (sq_le_sq₀ (abs_nonneg _) (by positivity)).2 he rw [sq_abs] at he2 nlinarith _ = 4 * B ^ 2 := by rw [← Finset.sum_mul, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_sum, one_mul] by_cases hx : (d : ℝ) * blockEnergy β p d / card V ≤ 1 · rw [min_eq_right hx] have hx0 : 0 ≤ (d : ℝ) * blockEnergy β p d / card V := by apply div_nonneg · apply mul_nonneg (by positivity) unfold blockEnergy apply sum_nonneg intro r hr apply div_nonneg · exact mul_nonneg (by positivity) (sq_nonneg _) · exact pow_nonneg (mul_nonneg (le_of_lt hp0) (sub_nonneg.mpr (le_of_lt hp1))) _ · positivity exact hraw.trans <| (riskAt_snipe_le p hp0 hp1 M).trans (by have hpdt : 0 ≤ B ^ 2 * ((d : ℝ) * blockEnergy β p d / card V) := mul_nonneg (sq_nonneg B) hx0 ring_nf at hpdt ⊢ nlinarith) · rw [min_eq_left (le_of_not_ge hx)] simpa using hsat
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRisk_clipped_le_min · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:146
theorem worstRiskBdd_clipped_le_min

Establishes the stated mathematical result for worst risk bdd clipped le min.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 < p
hp1 :
p < 1
d β :
B :
hB :
0 ≤ B
worstRiskBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p)
≤ 16 * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / card V)
Proof (Lean source)
lemma worstRiskBdd_clipped_le_min {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (d β : ℕ) (B : ℝ) (hB : 0 ≤ B) : worstRiskBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p) ≤ 16 * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / Fintype.card V) := by unfold worstRiskBdd let M0 : BddOutcomeModelClass V d β B := { edge := fun _ _ => False decEdge := fun _ _ => inferInstance coef := fun _ _ => 0 supported := by simp degree_le := by simp [BoundedDegree, nbhd, outNbhd] low_order := by simp [LowOrder] outcome_bound := by intro i z simpa [potentialOutcome, nbhd] using hB } apply csSup_le · exact ⟨riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) M0 (snipeClippedBdd B β p), ⟨M0, rfl⟩⟩ · rintro _ ⟨M, rfl⟩ have hraw := riskAtBdd_clipped_le_raw p (le_of_lt hp0) (le_of_lt hp1) hB M have hsat : riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) M (snipeClippedBdd B β p) ≤ 16 * B ^ 2 := by unfold riskAtBdd FiniteDesign.mse FiniteDesign.E calc _ ≤ ∑ z, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p z * (16 * B ^ 2) := by apply Finset.sum_le_sum intro z hz apply mul_le_mul_of_nonneg_left _ <| (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_nonneg z have hc : |snipeClippedBdd B β p (edgeFnBdd M) z (obsOutcome M.edge M.coef z)| ≤ 2 * B := by unfold snipeClippedBdd clipTo rw [abs_le] simp [hB] have ht := tte_abs_le_of_bddModelClass M have he := (abs_sub _ _).trans (add_le_add hc ht) have he2 := (sq_le_sq₀ (abs_nonneg _) (by positivity)).2 he rw [sq_abs] at he2 nlinarith _ = 16 * B ^ 2 := by rw [← Finset.sum_mul, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_sum, one_mul] let x : ℝ := (d : ℝ) * blockEnergy β p d / Fintype.card V have hx0 : 0 ≤ x := by dsimp [x] apply div_nonneg · apply mul_nonneg (by positivity) unfold blockEnergy apply sum_nonneg intro r hr apply div_nonneg · exact mul_nonneg (by positivity) (sq_nonneg _) · exact pow_nonneg (mul_nonneg (le_of_lt hp0) (sub_nonneg.mpr (le_of_lt hp1))) _ · positivity by_cases hx : x ≤ 1 · rw [min_eq_right hx] exact hraw.trans <| (riskAtBdd_snipe_le p hp0 hp1 M).trans (by have hnonneg : 0 ≤ B ^ 2 * x := mul_nonneg (sq_nonneg B) hx0 dsimp [x] at hnonneg ⊢ ring_nf at hnonneg ⊢ nlinarith) · rw [min_eq_left (le_of_not_ge hx)] simpa using hsat
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRiskBdd_clipped_le_min · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:217
theorem snipeClippedBdd_admissible

Establishes the stated mathematical result for snipe clipped bdd admissible.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 < p
hp1 :
p < 1
d β :
B :
hB :
0 ≤ B
AdmissibleEstimatorBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p)
Proof (Lean source)
lemma snipeClippedBdd_admissible {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (d β : ℕ) (B : ℝ) (hB : 0 ≤ B) : AdmissibleEstimatorBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p) := by constructor · intro G z unfold snipeClippedBdd clipTo snipeEstimator fun_prop · refine ⟨16 * B ^ 2, ?_⟩ rintro _ ⟨M, rfl⟩ exact le_trans (show riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) M (snipeClippedBdd B β p) ≤ 16 * B ^ 2 by unfold riskAtBdd FiniteDesign.mse FiniteDesign.E calc _ ≤ ∑ z, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p z * (16 * B ^ 2) := by apply Finset.sum_le_sum intro z hz apply mul_le_mul_of_nonneg_left _ <| (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_nonneg z have hc : |snipeClippedBdd B β p (edgeFnBdd M) z (obsOutcome M.edge M.coef z)| ≤ 2 * B := by unfold snipeClippedBdd clipTo rw [abs_le] simp [hB] have ht := tte_abs_le_of_bddModelClass M have he := (abs_sub _ _).trans (add_le_add hc ht) have he2 := (sq_le_sq₀ (abs_nonneg _) (by positivity)).2 he rw [sq_abs] at he2 nlinarith _ = 16 * B ^ 2 := by rw [← Finset.sum_mul, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_sum, one_mul]) le_rfl
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeClippedBdd_admissible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:293
theorem minimaxRiskBdd_le_clipped

Establishes the stated mathematical result for minimax risk bdd le clipped.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 < p
hp1 :
p < 1
d β :
B :
hB :
0 ≤ B
minimaxRiskBddOutcome (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B
worstRiskBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p)
Proof (Lean source)
lemma minimaxRiskBdd_le_clipped {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (d β : ℕ) (B : ℝ) (hB : 0 ≤ B) : minimaxRiskBddOutcome (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B ≤ worstRiskBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p) := by unfold minimaxRiskBddOutcome apply csInf_le · refine ⟨0, ?_⟩ rintro _ ⟨est, hest, rfl⟩ let M0 : BddOutcomeModelClass V d β B := { edge := fun _ _ => False decEdge := fun _ _ => inferInstance coef := fun _ _ => 0 supported := by simp degree_le := by simp [BoundedDegree, nbhd, outNbhd] low_order := by simp [LowOrder] outcome_bound := by intro i z simpa [potentialOutcome, nbhd] using hB } have hr0 : 0 ≤ riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) M0 est := by unfold riskAtBdd exact (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).mse_nonneg _ _ exact hr0.trans (le_csSup hest.2 (Set.mem_range_self M0)) · exact ⟨snipeClippedBdd B β p, snipeClippedBdd_admissible p hp0 hp1 d β B hB, rfl⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRiskBdd_le_clipped · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:335
def modelClassToBdd

Defines model class to bdd.

Definition (Lean source)
noncomputable def modelClassToBdd {V : Type*} [Fintype V] [DecidableEq V] {d β : ℕ} {B : ℝ} (M : ModelClass V d β B) : BddOutcomeModelClass V d β B := { edge := M.edge decEdge := M.decEdge coef := M.coef supported := M.supported degree_le := M.degree_le low_order := M.low_order outcome_bound := fun i z => potentialOutcome_abs_le_mass M.mass_le i z }
CausalSmith.Experimentation.SnipeDegreeFrontier.modelClassToBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:365
theorem riskAt_modelClassToBdd

Establishes the stated mathematical result for risk at model class to bdd.

Formal statement
V :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
d β :
B :
M :
ModelClass V d β B
est :
riskAtBdd p hp0 hp1 (modelClassToBdd M) est = riskAt p hp0 hp1 M est
Proof (Lean source)
lemma riskAt_modelClassToBdd {V : Type*} [Fintype V] [DecidableEq V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) {d β : ℕ} {B : ℝ} (M : ModelClass V d β B) (est : Estimator V) : riskAtBdd p hp0 hp1 (modelClassToBdd M) est = riskAt p hp0 hp1 M est := by rfl
CausalSmith.Experimentation.SnipeDegreeFrontier.riskAt_modelClassToBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:378
theorem minimaxRiskL1_le_minimaxRiskBdd

Establishes the stated mathematical result for minimax risk l1 le minimax risk bdd.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 < p
hp1 :
p < 1
d β :
B :
hB :
0 ≤ B
minimaxRiskL1 (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B
minimaxRiskBddOutcome (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B
Proof (Lean source)
lemma minimaxRiskL1_le_minimaxRiskBdd {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (d β : ℕ) (B : ℝ) (hB : 0 ≤ B) : minimaxRiskL1 (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B ≤ minimaxRiskBddOutcome (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B := by unfold minimaxRiskL1 minimaxRisk minimaxRiskBddOutcome apply le_csInf · exact ⟨worstRiskBdd p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p), ⟨snipeClippedBdd B β p, snipeClippedBdd_admissible p hp0 hp1 d β B hB, rfl⟩⟩ · intro r hr rcases hr with ⟨est, hest, rfl⟩ have hbounded : BddAbove (Set.range fun M : ModelClass V d β B => riskAt p (le_of_lt hp0) (le_of_lt hp1) M est) := by obtain ⟨C, hC⟩ := hest.2 refine ⟨C, ?_⟩ rintro _ ⟨M, rfl⟩ change riskAt p (le_of_lt hp0) (le_of_lt hp1) M est ≤ C rw [← riskAt_modelClassToBdd p (le_of_lt hp0) (le_of_lt hp1) M est] exact hC ⟨modelClassToBdd M, rfl⟩ have had : AdmissibleEstimator p (le_of_lt hp0) (le_of_lt hp1) d β B est := ⟨hest.1, hbounded⟩ apply (csInf_le (show BddBelow {r : ℝ | ∃ e : Estimator V, AdmissibleEstimator p (le_of_lt hp0) (le_of_lt hp1) d β B e ∧ r = worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B e} from ⟨0, by rintro _ ⟨e, he, rfl⟩ let M0 : ModelClass V d β B := { edge := fun _ _ => False decEdge := fun _ _ => inferInstance coef := fun _ _ => 0 supported := by simp degree_le := by simp [BoundedDegree, nbhd, outNbhd] low_order := by simp [LowOrder] mass_le := by intro i; simpa using hB } have hr0 : 0 ≤ riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 e := by unfold riskAt exact (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).mse_nonneg _ _ exact hr0.trans (le_csSup he.2 (Set.mem_range_self M0))⟩) (show ∃ e : Estimator V, AdmissibleEstimator p (le_of_lt hp0) (le_of_lt hp1) d β B e ∧ worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B est = worstRisk p (le_of_lt hp0) (le_of_lt hp1) d β B e from ⟨est, had, rfl⟩)).trans unfold worstRisk worstRiskBdd apply csSup_le · let M0 : ModelClass V d β B := { edge := fun _ _ => False decEdge := fun _ _ => inferInstance coef := fun _ _ => 0 supported := by simp degree_le := by simp [BoundedDegree, nbhd, outNbhd] low_order := by simp [LowOrder] mass_le := by intro i; simpa using hB } exact ⟨riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 est, ⟨M0, rfl⟩⟩ · rintro _ ⟨M, rfl⟩ change riskAt p (le_of_lt hp0) (le_of_lt hp1) M est ≤ sSup (Set.range fun N : BddOutcomeModelClass V d β B => riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) N est) rw [← riskAt_modelClassToBdd p (le_of_lt hp0) (le_of_lt hp1) M est] exact le_csSup hest.2 (Set.mem_range_self (modelClassToBdd M))
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRiskL1_le_minimaxRiskBdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HeadlineSupport.lean:388
Helpers.HellingerAffinity 3 declarations The general common-density affinity interface (densityAffinity, hellingerSqDensity, their identity, the total-variation comparison, and product tensorization) now lives in Causalean/Stat/Minimax/HellingerAffinity.lean; t

Affinity defect of the cosine-squared least-favourable pair

The general common-density affinity interface (densityAffinity, hellingerSqDensity, their identity, the total-variation comparison, and product tensorization) now lives in Causalean/Stat/Minimax/HellingerAffinity.lean; this file re-exports it and adds the computation specific to this run's least-favourable prior: the exact affinity of two translates of the cosine-squared bump cosSqDensity, and the resulting quadratic bound on its affinity defect.

theorem cosSqDensity_affinity_formula

Establishes the stated mathematical result for cos sq density affinity formula.

Formal statement
s a b :
hs :
0 < s
hab :
a ≤ b
hgap :
b - a < s
∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b))
= (1 - (b - a) / (2 * s)) * cos (pi * (b - a) / (2 * s))
+ sin (pi * (b - a) / (2 * s)) / pi
Proof (Lean source)
lemma cosSqDensity_affinity_formula (s a b : ℝ) (hs : 0 < s) (hab : a ≤ b) (hgap : b - a < s) : ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) = (1 - (b - a) / (2 * s)) * cos (pi * (b - a) / (2 * s)) + sin (pi * (b - a) / (2 * s)) / pi := by let k : ℝ := pi / (2 * s) have hk : 0 < k := by dsimp [k]; positivity have hk0 : k ≠ 0 := ne_of_gt hk have hks : k * s = pi / 2 := by dsimp [k] field_simp let F : ℝ → ℝ := fun u => s⁻¹ * cos (k * (u - a)) * cos (k * (u - b)) have hfun : (fun u => sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b))) = indicator (Icc (b - s) (a + s)) F := by funext u by_cases hu : u ∈ Icc (b - s) (a + s) · have hua : |u - a| ≤ s := by rw [abs_le] constructor <;> linarith [hu.1, hu.2] have hub : |u - b| ≤ s := by rw [abs_le] constructor <;> linarith [hu.1, hu.2] rw [Set.indicator_of_mem hu, cosSqDensity, if_pos hua, cosSqDensity, if_pos hub] have hanga : -(pi / 2) ≤ k * (u - a) ∧ k * (u - a) ≤ pi / 2 := by rw [abs_le] at hua constructor · calc -(pi / 2) = k * (-s) := by rw [mul_neg, hks] _ ≤ k * (u - a) := mul_le_mul_of_nonneg_left hua.1 (le_of_lt hk) · calc k * (u - a) ≤ k * s := mul_le_mul_of_nonneg_left hua.2 (le_of_lt hk) _ = pi / 2 := hks have hangb : -(pi / 2) ≤ k * (u - b) ∧ k * (u - b) ≤ pi / 2 := by rw [abs_le] at hub constructor · calc -(pi / 2) = k * (-s) := by rw [mul_neg, hks] _ ≤ k * (u - b) := mul_le_mul_of_nonneg_left hub.1 (le_of_lt hk) · calc k * (u - b) ≤ k * s := mul_le_mul_of_nonneg_left hub.2 (le_of_lt hk) _ = pi / 2 := hks have hcosa : 0 ≤ cos (k * (u - a)) := Real.cos_nonneg_of_mem_Icc hanga have hcosb : 0 ≤ cos (k * (u - b)) := Real.cos_nonneg_of_mem_Icc hangb dsimp [F] rw [show s⁻¹ * cos (pi * (u - a) / (2 * s)) ^ 2 * (s⁻¹ * cos (pi * (u - b) / (2 * s)) ^ 2) = (s⁻¹ * cos (k * (u - a)) * cos (k * (u - b))) ^ 2 by dsimp [k] ring] rw [Real.sqrt_sq_eq_abs, abs_of_nonneg] exact mul_nonneg (mul_nonneg (inv_nonneg.mpr (le_of_lt hs)) hcosa) hcosb · rw [Set.indicator_of_notMem hu] by_cases hua : |u - a| ≤ s · by_cases hub : |u - b| ≤ s · exfalso apply hu rw [abs_le] at hua hub exact ⟨by linarith, by linarith⟩ · rw [cosSqDensity, if_pos hua, cosSqDensity, if_neg hub] simp · rw [cosSqDensity, if_neg hua] simp rw [hfun, integral_indicator measurableSet_Icc, integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le (by linarith : b - s ≤ a + s)] dsimp [F] rw [show (fun u => s⁻¹ * cos (k * (u - a)) * cos (k * (u - b))) = (fun u => s⁻¹ * (cos (k * (u - a)) * cos (k * (u - b)))) by funext u ring] rw [intervalIntegral.integral_const_mul] have htrig : (fun u => cos (k * (u - a)) * cos (k * (u - b))) = (fun u => (cos (k * (b - a)) + cos ((2 * k) * u - k * (a + b))) / 2) := by funext u apply (eq_div_iff (by norm_num : (2 : ℝ) ≠ 0)).2 rw [show cos (k * (u - a)) * cos (k * (u - b)) * 2 = 2 * cos (k * (u - a)) * cos (k * (u - b)) by ring, Real.two_mul_cos_mul_cos] congr 1 <;> congr 1 <;> ring rw [htrig] rw [show (fun u => (cos (k * (b - a)) + cos ((2 * k) * u - k * (a + b))) / 2) = (fun u => (1 / 2 : ℝ) * cos (k * (b - a)) + (1 / 2 : ℝ) * cos ((2 * k) * u - k * (a + b))) by funext u ring] rw [intervalIntegral.integral_add ((by fun_prop : Continuous fun u => (1 / 2 : ℝ) * cos (k * (b - a))).continuousOn.intervalIntegrable) ((by fun_prop : Continuous fun u => (1 / 2 : ℝ) * cos ((2 * k) * u - k * (a + b)) ).continuousOn.intervalIntegrable), intervalIntegral.integral_const, intervalIntegral.integral_const_mul] have h2k : 2 * k ≠ 0 := mul_ne_zero two_ne_zero hk0 rw [intervalIntegral.integral_comp_mul_sub cos h2k (k * (a + b))] rw [integral_cos] have huarg : 2 * k * (a + s) - k * (a + b) = pi - k * (b - a) := by have hpi_eq : pi = 2 * k * s := by nlinarith [hks] rw [hpi_eq] ring have hlarg : 2 * k * (b - s) - k * (a + b) = k * (b - a) - pi := by have hpi_eq : pi = 2 * k * s := by nlinarith [hks] rw [hpi_eq] ring rw [huarg, hlarg] rw [show sin (pi - k * (b - a)) = sin (k * (b - a)) by rw [Real.sin_sub] simp, show sin (k * (b - a) - pi) = -sin (k * (b - a)) by rw [Real.sin_sub] simp] dsimp [k] field_simp ring
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_affinity_formula · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HellingerAffinity.lean:25
theorem cosSqDensity_affinity_defect

The cosine-squared translate has quadratic affinity defect.

Formal statement
s a b :
hs :
0 < s
1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b))
pi ^ 2 * (a - b) ^ 2 / (4 * s ^ 2)
Proof (Lean source)
lemma cosSqDensity_affinity_defect (s a b : ℝ) (hs : 0 < s) : 1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) ≤ Real.pi ^ 2 * (a - b) ^ 2 / (4 * s ^ 2) := by let A : ℝ := ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) have hA0 : 0 ≤ A := by dsimp [A] exact integral_nonneg_of_ae (Filter.Eventually.of_forall fun u => Real.sqrt_nonneg _) by_cases hlarge : s ≤ |a - b| · have hs_sq : 0 < s ^ 2 := sq_pos_of_pos hs have hdiff_sq : s ^ 2 ≤ (a - b) ^ 2 := by simpa [sq_abs] using ((sq_le_sq₀ (le_of_lt hs) (abs_nonneg (a - b))).2 (by simpa [abs_of_pos hs] using hlarge)) have hpi : 3 < Real.pi := Real.pi_gt_three have hpi_sq : (4 : ℝ) ≤ Real.pi ^ 2 := by nlinarith have hscale : 4 * s ^ 2 ≤ Real.pi ^ 2 * (a - b) ^ 2 := calc 4 * s ^ 2 ≤ 4 * (a - b) ^ 2 := mul_le_mul_of_nonneg_left hdiff_sq (by norm_num) _ ≤ Real.pi ^ 2 * (a - b) ^ 2 := mul_le_mul_of_nonneg_right hpi_sq (sq_nonneg (a - b)) have hone : (1 : ℝ) ≤ Real.pi ^ 2 * (a - b) ^ 2 / (4 * s ^ 2) := by rw [le_div_iff₀ (by positivity : 0 < 4 * s ^ 2)] simpa using hscale exact (by linarith : 1 - A ≤ 1) |>.trans hone · have hsmall : |a - b| < s := lt_of_not_ge hlarge have hordered (x y : ℝ) (hxy : x ≤ y) (hgap : y - x < s) : 1 - ∫ u, sqrt (cosSqDensity s (u - x) * cosSqDensity s (u - y)) ≤ Real.pi ^ 2 * (x - y) ^ 2 / (4 * s ^ 2) := by let t : ℝ := y - x let q : ℝ := Real.pi * t / (2 * s) have ht0 : 0 ≤ t := by dsimp [t]; linarith have ht : t < s := by simpa [t] using hgap have hq0 : 0 ≤ q := by dsimp [q]; positivity have hqlt : q < Real.pi / 2 := by dsimp [q] rw [div_lt_iff₀ (by positivity : 0 < 2 * s)] nlinarith [Real.pi_pos] have hcospos : 0 < cos q := Real.cos_pos_of_mem_Ioo ⟨by nlinarith [Real.pi_pos], hqlt⟩ have hqtan : q ≤ Real.tan q := Real.le_tan hq0 hqlt rw [Real.tan_eq_sin_div_cos] at hqtan have hqcos : q * cos q ≤ sin q := (le_div_iff₀ hcospos).mp hqtan have hformula := cosSqDensity_affinity_formula s x y hs hxy hgap have hdefect_nonneg : 0 ≤ sin q / Real.pi - t / (2 * s) * cos q := by have heq : t / (2 * s) * cos q = (q * cos q) / Real.pi := by dsimp [q] field_simp rw [heq] exact sub_nonneg.mpr (div_le_div_of_nonneg_right hqcos (le_of_lt Real.pi_pos)) have hAgecos : cos q ≤ ∫ u, sqrt (cosSqDensity s (u - x) * cosSqDensity s (u - y)) := by rw [hformula] change cos q ≤ (1 - t / (2 * s)) * cos q + sin q / Real.pi nlinarith have hcoslower : 1 - q ^ 2 / 2 ≤ cos q := Real.one_sub_sq_div_two_le_cos (x := q) have hq_sq : 0 ≤ q ^ 2 := sq_nonneg q calc 1 - ∫ u, sqrt (cosSqDensity s (u - x) * cosSqDensity s (u - y)) ≤ 1 - cos q := sub_le_sub_left hAgecos 1 _ ≤ q ^ 2 / 2 := by linarith _ ≤ q ^ 2 := by linarith _ = Real.pi ^ 2 * (x - y) ^ 2 / (4 * s ^ 2) := by dsimp [q, t] field_simp ring rcases le_total a b with hab | hba · exact hordered a b hab (by have := hsmall rw [abs_of_nonpos (sub_nonpos.mpr hab)] at this linarith) · have h := hordered b a hba (by have := hsmall rw [abs_of_nonneg (sub_nonneg.mpr hba)] at this linarith) have h' : 1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) ≤ Real.pi ^ 2 * (b - a) ^ 2 / (4 * s ^ 2) := by simpa only [mul_comm] using h calc 1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) ≤ Real.pi ^ 2 * (b - a) ^ 2 / (4 * s ^ 2) := h' _ = Real.pi ^ 2 * (a - b) ^ 2 / (4 * s ^ 2) := by congr 2 ring
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_affinity_defect · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HellingerAffinity.lean:170
theorem cosSqDensity_affinity_defect_sharp

The sharper constant needed when affinity defect is converted to the unhalved squared-Hellinger convention used in this development.

Formal statement
s a b :
hs :
0 < s
1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b))
pi ^ 2 * (a - b) ^ 2 / (8 * s ^ 2)
Proof (Lean source)
lemma cosSqDensity_affinity_defect_sharp (s a b : ℝ) (hs : 0 < s) : 1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) ≤ Real.pi ^ 2 * (a - b) ^ 2 / (8 * s ^ 2) := by let A : ℝ := ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) have hA0 : 0 ≤ A := by dsimp [A] exact integral_nonneg_of_ae (Filter.Eventually.of_forall fun u => Real.sqrt_nonneg _) by_cases hlarge : s ≤ |a - b| · have hs_sq : 0 < s ^ 2 := sq_pos_of_pos hs have hdiff_sq : s ^ 2 ≤ (a - b) ^ 2 := by simpa [sq_abs] using ((sq_le_sq₀ (le_of_lt hs) (abs_nonneg (a - b))).2 (by simpa [abs_of_pos hs] using hlarge)) have hpi_sq : (8 : ℝ) < Real.pi ^ 2 := by nlinarith [Real.pi_gt_three] have hscale : 8 * s ^ 2 ≤ Real.pi ^ 2 * (a - b) ^ 2 := calc 8 * s ^ 2 ≤ 8 * (a - b) ^ 2 := mul_le_mul_of_nonneg_left hdiff_sq (by norm_num) _ ≤ Real.pi ^ 2 * (a - b) ^ 2 := mul_le_mul_of_nonneg_right (le_of_lt hpi_sq) (sq_nonneg (a - b)) have hone : (1 : ℝ) ≤ Real.pi ^ 2 * (a - b) ^ 2 / (8 * s ^ 2) := by rw [le_div_iff₀ (by positivity : 0 < 8 * s ^ 2)] simpa using hscale exact (by linarith : 1 - A ≤ 1) |>.trans hone · have hsmall : |a - b| < s := lt_of_not_ge hlarge have hordered (x y : ℝ) (hxy : x ≤ y) (hgap : y - x < s) : 1 - ∫ u, sqrt (cosSqDensity s (u - x) * cosSqDensity s (u - y)) ≤ Real.pi ^ 2 * (x - y) ^ 2 / (8 * s ^ 2) := by let t : ℝ := y - x let q : ℝ := Real.pi * t / (2 * s) have ht0 : 0 ≤ t := by dsimp [t]; linarith have ht : t < s := by simpa [t] using hgap have hq0 : 0 ≤ q := by dsimp [q]; positivity have hqlt : q < Real.pi / 2 := by dsimp [q] rw [div_lt_iff₀ (by positivity : 0 < 2 * s)] nlinarith [Real.pi_pos] have hcospos : 0 < cos q := Real.cos_pos_of_mem_Ioo ⟨by nlinarith [Real.pi_pos], hqlt⟩ have hqtan : q ≤ Real.tan q := Real.le_tan hq0 hqlt rw [Real.tan_eq_sin_div_cos] at hqtan have hqcos : q * cos q ≤ sin q := (le_div_iff₀ hcospos).mp hqtan have hformula := cosSqDensity_affinity_formula s x y hs hxy hgap have hdefect_nonneg : 0 ≤ sin q / Real.pi - t / (2 * s) * cos q := by have heq : t / (2 * s) * cos q = (q * cos q) / Real.pi := by dsimp [q] field_simp rw [heq] exact sub_nonneg.mpr (div_le_div_of_nonneg_right hqcos (le_of_lt Real.pi_pos)) have hAgecos : cos q ≤ ∫ u, sqrt (cosSqDensity s (u - x) * cosSqDensity s (u - y)) := by rw [hformula] change cos q ≤ (1 - t / (2 * s)) * cos q + sin q / Real.pi nlinarith have hcoslower : 1 - q ^ 2 / 2 ≤ cos q := Real.one_sub_sq_div_two_le_cos (x := q) calc 1 - ∫ u, sqrt (cosSqDensity s (u - x) * cosSqDensity s (u - y)) ≤ 1 - cos q := sub_le_sub_left hAgecos 1 _ ≤ q ^ 2 / 2 := by linarith _ = Real.pi ^ 2 * (x - y) ^ 2 / (8 * s ^ 2) := by dsimp [q, t] field_simp ring rcases le_total a b with hab | hba · exact hordered a b hab (by have := hsmall rw [abs_of_nonpos (sub_nonpos.mpr hab)] at this linarith) · have h := hordered b a hba (by have := hsmall rw [abs_of_nonneg (sub_nonneg.mpr hba)] at this linarith) have h' : 1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) ≤ Real.pi ^ 2 * (b - a) ^ 2 / (8 * s ^ 2) := by simpa only [mul_comm] using h calc 1 - ∫ u, sqrt (cosSqDensity s (u - a) * cosSqDensity s (u - b)) ≤ Real.pi ^ 2 * (b - a) ^ 2 / (8 * s ^ 2) := h' _ = Real.pi ^ 2 * (a - b) ^ 2 / (8 * s ^ 2) := by congr 2 ring
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_affinity_defect_sharp · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/HellingerAffinity.lean:278
Helpers.LeastFavourable 29 declarations The compressed prior-predictive law on the sufficient statistic (Z,(Y_b)) is defined explicitly as a density with respect to counting measure times finite-dimensional Lebesgue measure.

Continuous-baseline least-favourable block family

The compressed prior-predictive law on the sufficient statistic (Z,(Y_b)) is defined explicitly as a density with respect to counting measure times finite-dimensional Lebesgue measure. The paper's full observed-data law on (Z,(Y_i^{obs})) is its pushforward under repetition of each active block outcome and zero extension to the inactive units.

Number of complete active blocks.

Definition (Lean source)
def blockCount (n d : ℕ) : ℕ := n / d
def activeCount

Number of active units.

Definition (Lean source)
def activeCount (n d : ℕ) : ℕ := blockCount n d * d
CausalSmith.Experimentation.SnipeDegreeFrontier.activeCount · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:29

Active population share.

Definition (Lean source)
noncomputable def activeShare (n d : ℕ) : ℝ := (activeCount n d : ℝ) / n
CausalSmith.Experimentation.SnipeDegreeFrontier.activeShare · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:33

The complete directed block graph, including loops, on active units; inactive units are isolated.

Definition (Lean source)
def blockGraph (n d : ℕ) (j i : Fin n) : Prop := j.val < activeCount n d ∧ i.val < activeCount n d ∧ j.val / d = i.val / d
def baselineAt

A baseline value indexed by a natural block number, zero outside the typed block range.

Definition (Lean source)
noncomputable def baselineAt {m : ℕ} (U : Fin m → ℝ) (b : ℕ) : ℝ := if h : b < m then U ⟨b, h⟩ else 0
def cosSqDensity

The cosine-squared density on [-s,s].

Definition (Lean source)
noncomputable def cosSqDensity (s u : ℝ) : ℝ := if |u| ≤ s then s⁻¹ * cos (pi * u / (2 * s)) ^ 2 else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:53
theorem cosSqDensity_measurable

The cosine-squared baseline density with halfwidth s is a measurable function of the baseline value: it is the indicator of the interval from −s to s times a continuous function. This is the regularity needed before the density can be integrated against or used to build the least-favourable prior.

Formal statement
s :
Proof (Lean source)
lemma cosSqDensity_measurable (s : ℝ) : Measurable (cosSqDensity s) := by rw [show cosSqDensity s = indicator (Icc (-s) s) (fun u => s⁻¹ * cos (pi * u / (2 * s)) ^ 2) by funext u rw [cosSqDensity] by_cases hu : |u| ≤ s · rw [if_pos hu, Set.indicator_of_mem] simpa [abs_le] using hu · rw [if_neg hu, Set.indicator_of_notMem] simpa [abs_le] using hu] exact (by fun_prop : Measurable fun u => s⁻¹ * cos (pi * u / (2 * s)) ^ 2).indicator measurableSet_Icc
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_measurable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:59
theorem cosSqDensity_integrable

Establishes the stated mathematical result for cos sq density integrable.

Formal statement
s :
Proof (Lean source)
lemma cosSqDensity_integrable (s : ℝ) : Integrable (cosSqDensity s) := by rw [show cosSqDensity s = indicator (Icc (-s) s) (fun u => s⁻¹ * cos (pi * u / (2 * s)) ^ 2) by funext u rw [cosSqDensity] by_cases hu : |u| ≤ s · rw [if_pos hu, Set.indicator_of_mem] simpa [abs_le] using hu · rw [if_neg hu, Set.indicator_of_notMem] simpa [abs_le] using hu] exact ((by fun_prop : Continuous fun u => s⁻¹ * cos (pi * u / (2 * s)) ^ 2).continuousOn |>.integrableOn_Icc).integrable_indicator measurableSet_Icc
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_integrable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:78
theorem cosSqDensity_integral_one

Establishes the stated mathematical result for cos sq density integral one.

Formal statement
s :
hs :
0 < s
∫ u, cosSqDensity s u = 1
Proof (Lean source)
lemma cosSqDensity_integral_one (s : ℝ) (hs : 0 < s) : ∫ u, cosSqDensity s u = 1 := by have hs0 : s ≠ 0 := ne_of_gt hs have hpi : pi ≠ 0 := ne_of_gt Real.pi_pos rw [show cosSqDensity s = indicator (Icc (-s) s) (fun u => s⁻¹ * cos (pi * u / (2 * s)) ^ 2) by funext u rw [cosSqDensity] by_cases hu : |u| ≤ s · rw [if_pos hu, Set.indicator_of_mem] simpa [abs_le] using hu · rw [if_neg hu, Set.indicator_of_notMem] simpa [abs_le] using hu] rw [integral_indicator measurableSet_Icc] rw [integral_Icc_eq_integral_Ioc] rw [← intervalIntegral.integral_of_le (by linarith : -s ≤ s)] rw [intervalIntegral.integral_const_mul] have hc : pi / (2 * s) ≠ 0 := div_ne_zero hpi (by positivity) rw [show (fun u => cos (pi * u / (2 * s)) ^ 2) = (fun u => cos ((pi / (2 * s)) * u) ^ 2) by funext u congr 2 field_simp] rw [intervalIntegral.integral_comp_mul_left (fun x => cos x ^ 2) hc] rw [show (pi / (2 * s)) * -s = -(pi / 2) by field_simp, show (pi / (2 * s)) * s = pi / 2 by field_simp] rw [integral_cos_sq] rw [Real.cos_neg, Real.sin_neg, Real.cos_pi_div_two, Real.sin_pi_div_two] norm_num [smul_eq_mul] field_simp
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_integral_one · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:95
theorem cosSqDensity_translate_integral_one

Establishes the stated mathematical result for cos sq density translate integral one.

Formal statement
s c :
hs :
0 < s
∫ u, cosSqDensity s (u - c) = 1
Proof (Lean source)
lemma cosSqDensity_translate_integral_one (s c : ℝ) (hs : 0 < s) : ∫ u, cosSqDensity s (u - c) = 1 := by rw [show (fun u => cosSqDensity s (u - c)) = (fun u => cosSqDensity s (u + (-c))) by funext u congr 2] rw [integral_add_right_eq_self] exact cosSqDensity_integral_one s hs
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_translate_integral_one · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:133
theorem cosSqDensity_translate_integrable

Establishes the stated mathematical result for cos sq density translate integrable.

Formal statement
s c :
Integrable (fun u => cosSqDensity s (u - c))
Proof (Lean source)
lemma cosSqDensity_translate_integrable (s c : ℝ) : Integrable (fun u => cosSqDensity s (u - c)) := by simpa [sub_eq_add_neg] using (cosSqDensity_integrable s).comp_add_right (-c)
CausalSmith.Experimentation.SnipeDegreeFrontier.cosSqDensity_translate_integrable · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:144
def representerMass

Raw coefficient mass of the normalized block representer.

Definition (Lean source)
noncomputable def representerMass (β : ℕ) (p : ℝ) (d : ℕ) : ℝ := ∑ T ∈ Finset.univ.powerset, |blockRawCoef β p d T|
CausalSmith.Experimentation.SnipeDegreeFrontier.representerMass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:150
def representerMassSup

The paper's exact representer-mass constant sup_{d≥1} ∑_T |h_{d,T}|.

Definition (Lean source)
noncomputable def representerMassSup (β : ℕ) (p : ℝ) : ℝ := sSup (Set.range fun d : {d : ℕ // 1 ≤ d} => representerMass β p d.1)
CausalSmith.Experimentation.SnipeDegreeFrontier.representerMassSup · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:154

The score-aligned tilt amplitude.

Definition (Lean source)
noncomputable def tiltAmplitude (B : ℝ) (β : ℕ) (p : ℝ) (m d : ℕ) : ℝ := B * min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹) * min 1 (sqrt (blockEnergy β p d / m))
CausalSmith.Experimentation.SnipeDegreeFrontier.tiltAmplitude · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:161
def localSubset

Map a global subset to its within-block coordinate subset.

Definition (Lean source)
noncomputable def localSubset (n d : ℕ) (T : Finset (Fin n)) : Finset (Fin d) := if hd : 0 < d then T.image (fun j => ⟨j.val % d, Nat.mod_lt _ hd⟩) else ∅

The score-aligned coefficient schedule for one fixed baseline vector and one sign.

Definition (Lean source)
noncomputable def blockSchedule (n d β : ℕ) (B p σ : ℝ) (_hσ : σ = -1 ∨ σ = 1) -- @realizes \sigma(range {-1,1}) (U : Fin (blockCount n d) → ℝ) (i : Fin n) (T : Finset (Fin n)) : ℝ := if hi : i.val < activeCount n d then if hT : ∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d then (if T = ∅ then baselineAt U (i.val / d) else 0) + σ * tiltAmplitude B β p (blockCount n d) d * blockRawCoef β p d (localSubset n d T) else 0 else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.blockSchedule · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:175
def blockBaselineLaw

The independent cosine-squared baseline law on the active block coefficients.

Definition (Lean source)
-- @env: S4 noncomputable def blockBaselineLaw (B : ℝ) (m : ℕ) : Measure (Fin m → ℝ) := Measure.pi (fun _ : Fin m => volume.withDensity (fun u => ofReal (cosSqDensity (B / 2) u)))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockBaselineLaw · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:190
def blockSchedulePrior

The fuzzy prior on fixed coefficient schedules, obtained by pushing the independent baseline law through the score-aligned schedule construction.

Definition (Lean source)
noncomputable def blockSchedulePrior (n d β : ℕ) (B p σ : ℝ) (hσ : σ = -1 ∨ σ = 1) : Measure (Fin n → Finset (Fin n) → ℝ) := Measure.map (fun U : Fin (blockCount n d) → ℝ => blockSchedule n d β B p σ hσ U) (blockBaselineLaw B (blockCount n d))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockSchedulePrior · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:198
def blockFamilyBundle Definition 15 in the paper ↗

Mechanical anchor for the complete least-favourable block construction: block count, active count and share, complete-block graph, and prior on fixed coefficient schedules.

Definition (Lean source)
-- @node: def:block-family noncomputable def blockFamilyBundle (n d β : ℕ) (B p σ : ℝ) (hB : 0 < B) (hd : 1 ≤ d) (hdn : d ≤ n) (hσ : σ = -1 ∨ σ = 1) : ℕ × ℕ × ℝ × (Fin n → Fin n → Prop) × Measure (Fin n → Finset (Fin n) → ℝ) := (blockCount n d, activeCount n d, activeShare n d, blockGraph n d, blockSchedulePrior n d β B p σ hσ)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockFamilyBundle · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:209
def blockAssignment

Restrict a global assignment to a typed active block.

Definition (Lean source)
def blockAssignment (n d : ℕ) (b : Fin (blockCount n d)) (z : Fin n → Bool) : Fin d → Bool := fun j => z ⟨b.val * d + j.val, by have hb : b.val < n / d := by simpa [blockCount] using b.isLt have hj : j.val < d := j.isLt have hmul : (n / d) * d ≤ n := Nat.div_mul_le_self n d calc b.val * d + j.val < b.val * d + d := Nat.add_lt_add_left hj _ _ = (b.val + 1) * d := by simp [Nat.add_mul] _ ≤ (n / d) * d := Nat.mul_le_mul_right d hb _ ≤ n := hmul⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.blockAssignment · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:222
def assignmentMass

Product Bernoulli mass of one assignment.

Definition (Lean source)
noncomputable def assignmentMass (n : ℕ) (p : ℝ) (z : Fin n → Bool) : ℝ := ∏ i : Fin n, if z i then p else 1 - p
CausalSmith.Experimentation.SnipeDegreeFrontier.assignmentMass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:238

Density of the sufficient observed statistic under one prior sign.

Definition (Lean source)
noncomputable def blockPriorDensity (n d β : ℕ) (B p σ : ℝ) (x : (Fin n → Bool) × (Fin (blockCount n d) → ℝ)) : ℝ := assignmentMass n p x.1 * ∏ b : Fin (blockCount n d), cosSqDensity (B / 2) (x.2 b - σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b x.1))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorDensity · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:242

The common counting-times-Lebesgue dominating measure.

Definition (Lean source)
noncomputable def blockDominatingMeasure (n d : ℕ) : Measure ((Fin n → Bool) × (Fin (blockCount n d) → ℝ)) := Measure.count.prod (Measure.pi (fun _ : Fin (blockCount n d) => volume))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockDominatingMeasure · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:253
def blockPriorLaw

The prior-predictive law of assignment and repeated block outcomes.

Definition (Lean source)
noncomputable def blockPriorLaw (n d β : ℕ) (B p σ : ℝ) : Measure ((Fin n → Bool) × (Fin (blockCount n d) → ℝ)) := (blockDominatingMeasure n d).withDensity (fun x => ofReal (blockPriorDensity n d β B p σ x))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorLaw · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:258
def repeatedBlockOutcome

Repeat each active block's observed outcome across its d units and set the outcomes of the inactive remainder to zero.

Definition (Lean source)
noncomputable def repeatedBlockOutcome (n d : ℕ) (y : Fin (blockCount n d) → ℝ) : Fin n → ℝ := fun i => baselineAt y (i.val / d)
CausalSmith.Experimentation.SnipeDegreeFrontier.repeatedBlockOutcome · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:265
def repeatedBlockObservedData

Expand the sufficient observed statistic to the full observed data.

Definition (Lean source)
noncomputable def repeatedBlockObservedData (n d : ℕ) (x : (Fin n → Bool) × (Fin (blockCount n d) → ℝ)) : (Fin n → Bool) × (Fin n → ℝ) := (x.1, repeatedBlockOutcome n d x.2)
CausalSmith.Experimentation.SnipeDegreeFrontier.repeatedBlockObservedData · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:271
def priorPredictiveLaw

The full prior-predictive law of assignment and all n observed outcomes, obtained from the compressed block-statistic law by the deterministic repeated-block-outcome map.

Definition (Lean source)
-- @realizes P_\sigma(prior-predictive Measure on assignments × full observed outcomes) noncomputable def priorPredictiveLaw (n d β : ℕ) (B p σ : ℝ) : Measure ((Fin n → Bool) × (Fin n → ℝ)) := Measure.map (repeatedBlockObservedData n d) (blockPriorLaw n d β B p σ)
CausalSmith.Experimentation.SnipeDegreeFrontier.priorPredictiveLaw · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:278
theorem blockPriorLaw_eq_withDensity

The displayed density representation of blockPriorLaw.

Formal statement
n d β :
B p σ :
blockPriorLaw n d β B p σ
= (blockDominatingMeasure n d).withDensity (fun x => ofReal (blockPriorDensity n d β B p σ x))
Proof (Lean source)
lemma blockPriorLaw_eq_withDensity (n d β : ℕ) (B p σ : ℝ) : blockPriorLaw n d β B p σ = (blockDominatingMeasure n d).withDensity (fun x => ofReal (blockPriorDensity n d β B p σ x)) := by rfl
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorLaw_eq_withDensity · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:288
theorem blockPriorDensity_integral_one Lemma 3 in the paper ↗

Under the paper's parameter restrictions the prior density integrates to one against the common dominating measure.

Formal statement
n d β :
B p σ :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
:
σ = -1 ∨ σ = 1
∫ x, blockPriorDensity n d β B p σ x ∂blockDominatingMeasure n d = 1
Proof (Lean source)
lemma blockPriorDensity_integral_one (n d β : ℕ) (B p σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) (hσ : σ = -1 ∨ σ = 1) : ∫ x, blockPriorDensity n d β B p σ x ∂blockDominatingMeasure n d = 1 := by classical let s : ℝ := B / 2 have hs : 0 < s := by dsimp [s]; linarith let shift : (Fin n → Bool) → Fin (blockCount n d) → ℝ := fun z b => σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z) have hcoord (z : Fin n → Bool) (b : Fin (blockCount n d)) : Integrable (fun u => cosSqDensity s (u - shift z b)) volume := cosSqDensity_translate_integrable s (shift z b) have hprod (z : Fin n → Bool) : Integrable (fun y : Fin (blockCount n d) → ℝ => ∏ b, cosSqDensity s (y b - shift z b)) (Measure.pi (fun _ : Fin (blockCount n d) => volume)) := Integrable.fintype_prod (fun b => hcoord z b) have hinner (z : Fin n → Bool) : ∫ y, blockPriorDensity n d β B p σ (z, y) ∂(Measure.pi (fun _ : Fin (blockCount n d) => volume)) = assignmentMass n p z := by change ∫ y, assignmentMass n p z * ∏ b, cosSqDensity s (y b - shift z b) ∂(Measure.pi (fun _ : Fin (blockCount n d) => volume)) = assignmentMass n p z rw [integral_const_mul] rw [show (∫ y : Fin (blockCount n d) → ℝ, ∏ b, cosSqDensity s (y b - shift z b) ∂(Measure.pi (fun _ : Fin (blockCount n d) => volume))) = ∏ b, ∫ u, cosSqDensity s (u - shift z b) by exact MeasureTheory.integral_fintype_prod_eq_prod (fun b u => cosSqDensity s (u - shift z b))] have hone : ∀ b : Fin (blockCount n d), ∫ u, cosSqDensity s (u - shift z b) = 1 := fun b => cosSqDensity_translate_integral_one s (shift z b) hs simp_rw [hone] simp have hmeas : AEStronglyMeasurable (blockPriorDensity n d β B p σ) (blockDominatingMeasure n d) := by apply Measurable.aestronglyMeasurable unfold blockPriorDensity apply mul · exact (measurable_of_finite (assignmentMass n p)).comp measurable_fst · apply Finset.measurable_prod intro b hb apply (cosSqDensity_measurable (B / 2)).comp apply Measurable.sub · exact (measurable_pi_apply b).comp measurable_snd · exact (measurable_of_finite (fun z : Fin n → Bool => σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z))).comp measurable_fst have hfull : Integrable (blockPriorDensity n d β B p σ) (blockDominatingMeasure n d) := by rw [blockDominatingMeasure] at hmeas ⊢ rw [integrable_prod_iff hmeas] constructor · exact Filter.Eventually.of_forall fun z => (hprod z).const_mul (assignmentMass n p z) · exact Integrable.of_finite rw [blockDominatingMeasure, integral_prod _ hfull] simp_rw [hinner] rw [MeasureTheory.integral_fintype] · have hcount (z : Fin n → Bool) : Measure.count.real ({z} : Set (Fin n → Bool)) = 1 := by rw [measureReal_def, Measure.count_apply_finite] · simp · exact Set.finite_singleton z simp_rw [hcount, one_smul] have hmass := (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p_sum rw [show (∑ z : Fin n → Bool, assignmentMass n p z) = ∑ z : Fin n → Bool, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).p z by apply Finset.sum_congr rfl intro z hz simp only [assignmentMass, bernoulliDesign, prodDesign_p, coinDesign] apply Finset.prod_congr rfl intro i hi cases z i <;> simp] exact hmass · exact Integrable.of_finite
CausalSmith.Experimentation.SnipeDegreeFrontier.blockPriorDensity_integral_one · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourable.lean:296
Helpers.LeastFavourableProperties_Part1 19 declarations Counting facts about complete blocks and the active population, the degree and neighbourhood structure of the block graph, the support and low-order vanishing of the block schedule, and the representer-mass bounds that k

Arithmetic, graph, and mass facts for the block family

Counting facts about complete blocks and the active population, the degree and neighbourhood structure of the block graph, the support and low-order vanishing of the block schedule, and the representer-mass bounds that keep the tilt amplitude admissible.

theorem blockCount_pos

At least one complete block is active whenever 1 ≤ d ≤ n.

Formal statement
n d :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
0 < blockCount n d
Proof (Lean source)
lemma blockCount_pos (n d : ℕ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) : 0 < blockCount n d := by simp only [blockCount] exact Nat.div_pos hdn (by omega)
theorem activeCount_le

The active part never exceeds the population.

Formal statement
n d :
activeCount n d ≤ n
Proof (Lean source)
lemma activeCount_le (n d : ℕ) : activeCount n d ≤ n := by simpa [activeCount, blockCount] using Nat.div_mul_le_self n d
theorem n_lt_two_mul_activeCount

With at least one complete block, the active part contains more than half of the population.

Formal statement
n d :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
n < 2 * activeCount n d
Proof (Lean source)
lemma n_lt_two_mul_activeCount (n d : ℕ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) : n < 2 * activeCount n d := by have hd0 : 0 < d := by omega have hq : 1 ≤ n / d := by exact (Nat.one_le_div_iff hd0).2 hdn have hr : n % d < d := Nat.mod_lt n hd0 have hdq : d ≤ (n / d) * d := by simpa using Nat.mul_le_mul_right d hq have hdecomp : n / d * d + n % d = n := by simpa [mul_comm] using Nat.div_add_mod n d simp only [activeCount, blockCount] omega
CausalSmith.Experimentation.SnipeDegreeFrontier.n_lt_two_mul_activeCount · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:30
theorem activeShare_bounds

The active population share lies in [1/2,1].

Formal statement
n d :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
(1 / 2 : ℝ) ≤ activeShare n d ∧ activeShare n d ≤ 1
Proof (Lean source)
lemma activeShare_bounds (n d : ℕ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) : (1 / 2 : ℝ) ≤ activeShare n d ∧ activeShare n d ≤ 1 := by have hnR : (0 : ℝ) < n := by exact_mod_cast hn have hlo := n_lt_two_mul_activeCount n d hn hd hdn have hhi := activeCount_le n d unfold activeShare constructor · apply (div_le_div_iff₀ (by norm_num : (0 : ℝ) < 2) hnR).2 norm_num only [one_mul] have hnat : n ≤ activeCount n d * 2 := by simpa [mul_comm] using le_of_lt hlo exact_mod_cast hnat · apply (div_le_one hnR).2 exact_mod_cast hhi
theorem blockEnergy_div_blockCount

The block/population normalization identity used in the lower-bound calculation.

Formal statement
n d β :
p :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
blockEnergy β p d / blockCount n d = ((d : ℝ) * blockEnergy β p d / n) / activeShare n d
Proof (Lean source)
lemma blockEnergy_div_blockCount (n d β : ℕ) (p : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) : blockEnergy β p d / blockCount n d = ((d : ℝ) * blockEnergy β p d / n) / activeShare n d := by have hn0 : (n : ℝ) ≠ 0 := by positivity have hm : 0 < blockCount n d := blockCount_pos n d hn hd hdn have hm0 : ((blockCount n d : ℕ) : ℝ) ≠ 0 := by positivity unfold activeShare activeCount push_cast field_simp
CausalSmith.Experimentation.SnipeDegreeFrontier.blockEnergy_div_blockCount · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:63
theorem blockGraph_nbhd_card_le

Every in-neighborhood of the (possibly truncated) block graph has at most d vertices.

Formal statement
n d :
hd :
1 ≤ d
i :
Fin n
(nbhd (blockGraph n d) i).card ≤ d
Proof (Lean source)
lemma blockGraph_nbhd_card_le (n d : ℕ) (hd : 1 ≤ d) (i : Fin n) : (nbhd (blockGraph n d) i).card ≤ d := by classical let f : Fin n → Fin d := fun j => ⟨j.val % d, Nat.mod_lt _ (by omega)⟩ have hmap : Set.MapsTo f (↑(nbhd (blockGraph n d) i) : Set (Fin n)) (↑(Finset.univ : Finset (Fin d)) : Set (Fin d)) := by intro j hj simp have hinj : InjOn f (↑(nbhd (blockGraph n d) i) : Set (Fin n)) := by intro j hj k hk heq have hjq : j.val / d = i.val / d := by exact ((Finset.mem_filter.mp hj).2).2.2 have hkq : k.val / d = i.val / d := by exact ((Finset.mem_filter.mp hk).2).2.2 apply Fin.ext have hmod : j.val % d = k.val % d := Fin.ext_iff.mp heq calc j.val = d * (j.val / d) + j.val % d := (Nat.div_add_mod j.val d).symm _ = d * (k.val / d) + k.val % d := by rw [hjq, hkq, hmod] _ = k.val := Nat.div_add_mod k.val d simpa using (Finset.card_le_card_of_injOn f hmap hinj)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockGraph_nbhd_card_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:78
theorem blockGraph_outNbhd_eq_nbhd

In- and out-neighborhoods agree for the symmetric block relation.

Formal statement
n d :
j :
Fin n
outNbhd (blockGraph n d) j = nbhd (blockGraph n d) j
Proof (Lean source)
lemma blockGraph_outNbhd_eq_nbhd (n d : ℕ) (j : Fin n) : outNbhd (blockGraph n d) j = nbhd (blockGraph n d) j := by classical ext i simp only [outNbhd, nbhd, mem_filter, Finset.mem_univ, true_and] simp only [blockGraph] aesop
CausalSmith.Experimentation.SnipeDegreeFrontier.blockGraph_outNbhd_eq_nbhd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:107
theorem blockGraph_degree_le

The truncated complete-block relation belongs to the degree-d graph class.

Formal statement
n d :
hd :
1 ≤ d
Proof (Lean source)
lemma blockGraph_degree_le (n d : ℕ) (hd : 1 ≤ d) : BoundedDegree (blockGraph n d) d := by refine ⟨blockGraph_nbhd_card_le n d hd, ?_⟩ intro j rw [blockGraph_outNbhd_eq_nbhd] exact blockGraph_nbhd_card_le n d hd j
theorem blockRawCoef_eq_zero_of_card_gt

Raw coefficients of the normalized block representer vanish above the prescribed interaction order.

Formal statement
β d :
p :
T :
hT :
β < T.card
blockRawCoef β p d T = 0
Proof (Lean source)
lemma blockRawCoef_eq_zero_of_card_gt (β d : ℕ) (p : ℝ) (T : Finset (Fin d)) (hT : β < T.card) : blockRawCoef β p d T = 0 := by classical by_cases hd0 : d = 0 · simp [blockRawCoef, hd0] simp only [blockRawCoef, if_neg hd0] apply mul_eq_zero_of_right apply Finset.sum_eq_zero intro r hr apply Finset.sum_eq_zero intro S hS have hrβ : r ≤ β := by exact (Finset.mem_Icc.mp hr).2.trans (min_le_left β d) have hScard : S.card = r := (Finset.mem_filter.mp hS).2 have hnsub : ¬ T ⊆ S := by intro hsub have := Finset.card_le_card hsub omega simp [hnsub]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockRawCoef_eq_zero_of_card_gt · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:127
theorem localSubset_card_eq

On one active block, reduction modulo d is injective.

Formal statement
n d :
hd :
1 ≤ d
i :
Fin n
T :
hT :
∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d
(localSubset n d T).card = T.card
Proof (Lean source)
lemma localSubset_card_eq (n d : ℕ) (hd : 1 ≤ d) (i : Fin n) (T : Finset (Fin n)) (hT : ∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d) : (localSubset n d T).card = T.card := by classical rw [localSubset, dif_pos (by omega)] rw [Finset.card_image_iff.mpr] intro j hj k hk heq apply Fin.ext have hmod : j.val % d = k.val % d := Fin.ext_iff.mp heq have hjq := (hT j hj).2 have hkq := (hT k hk).2 calc j.val = d * (j.val / d) + j.val % d := (Nat.div_add_mod j.val d).symm _ = d * (k.val / d) + k.val % d := by rw [hjq, hkq, hmod] _ = k.val := Nat.div_add_mod k.val d
theorem blockSchedule_supported

The schedule is zero away from its prescribed block neighborhood.

Formal statement
n d β :
B p σ :
:
σ = -1 ∨ σ = 1
U :
Fin (blockCount n d) → ℝ
∀ i T
if
¬ T ⊆ nbhd (blockGraph n d) i
then
blockSchedule n d β B p σ hσ U i T = 0
Proof (Lean source)
lemma blockSchedule_supported (n d β : ℕ) (B p σ : ℝ) (hσ : σ = -1 ∨ σ = 1) (U : Fin (blockCount n d) → ℝ) : ∀ i T, ¬ T ⊆ nbhd (blockGraph n d) i → blockSchedule n d β B p σ hσ U i T = 0 := by classical intro i T hnsub unfold blockSchedule by_cases hi : i.val < activeCount n d · rw [dif_pos hi] by_cases hT : ∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d · exfalso apply hnsub intro j hj simp only [nbhd, mem_filter, Finset.mem_univ, true_and] simp only [blockGraph] exact ⟨(hT j hj).1, hi, (hT j hj).2⟩ · simp [hT] · simp [hi]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockSchedule_supported · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:169
theorem blockSchedule_lowOrder

The block schedule has interaction order at most β.

Formal statement
n d β :
B p σ :
hd :
1 ≤ d
:
σ = -1 ∨ σ = 1
U :
Fin (blockCount n d) → ℝ
LowOrder (blockSchedule n d β B p σ hσ U) β
Proof (Lean source)
lemma blockSchedule_lowOrder (n d β : ℕ) (B p σ : ℝ) (hd : 1 ≤ d) (hσ : σ = -1 ∨ σ = 1) (U : Fin (blockCount n d) → ℝ) : LowOrder (blockSchedule n d β B p σ hσ U) β := by classical intro i T hcard unfold blockSchedule by_cases hi : i.val < activeCount n d · rw [dif_pos hi] by_cases hT : ∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d · rw [dif_pos hT] have hTne : T ≠ ∅ := by intro he subst T simp at hcard rw [if_neg hTne] rw [blockRawCoef_eq_zero_of_card_gt β d p (localSubset n d T)] · ring · simpa [localSubset_card_eq n d hd i T hT] using hcard · simp [hT] · simp [hi]
CausalSmith.Experimentation.SnipeDegreeFrontier.blockSchedule_lowOrder · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:193
theorem one_le_representerMass

The raw coefficient mass of a normalized representer is at least its unit all-treated/all-control contrast.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
1 ≤ representerMass β p d
Proof (Lean source)
lemma one_le_representerMass (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : 1 ≤ representerMass β p d := by classical let z₁ : Fin d → Bool := fun _ => true let z₀ : Fin d → Bool := fun _ => false have hcontrast : blockRepresenter β p d z₁ - blockRepresenter β p d z₀ = 1 := by let D := blockDesign d p (le_of_lt hp0) (le_of_lt hp1) have hD : IsProductBernoulli D p := by refine ⟨hp0, hp1, ?_⟩ refine ⟨fun _ => le_of_lt hp0, fun _ => le_of_lt hp1, rfl⟩ simpa [contrastFunctional, z₁, z₀] using (blockRepresenter_contrast_energy β d p D hD hβ hd).1 rw [blockRepresenter_raw_expansion β d p hd z₁, blockRepresenter_raw_expansion β d p hd z₀] at hcontrast have hraw₁ (T : Finset (Fin d)) : rawMonomial T z₁ = 1 := by simp [rawMonomial, blockInd, z₁] have hraw₀ (T : Finset (Fin d)) : rawMonomial T z₀ = if T = ∅ then 1 else 0 := by by_cases hT : T = ∅ · subst T simp [rawMonomial] · obtain ⟨j, hj⟩ := Finset.nonempty_iff_ne_empty.mpr hT unfold rawMonomial rw [if_neg hT] apply Finset.prod_eq_zero hj simp [blockInd, z₀] simp_rw [hraw₁, hraw₀] at hcontrast have habs : |(∑ T ∈ (Finset.univ : Finset (Fin d)).powerset, blockRawCoef β p d T) - ∑ T ∈ (Finset.univ : Finset (Fin d)).powerset, blockRawCoef β p d T * (if T = ∅ then 1 else 0)| ≤ representerMass β p d := by calc |_ - _| = |∑ T ∈ (Finset.univ : Finset (Fin d)).powerset, (blockRawCoef β p d T - blockRawCoef β p d T * (if T = ∅ then 1 else 0))| := by rw [← Finset.sum_sub_distrib] _ ≤ ∑ T ∈ (Finset.univ : Finset (Fin d)).powerset, |blockRawCoef β p d T - blockRawCoef β p d T * (if T = ∅ then 1 else 0)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ T ∈ (Finset.univ : Finset (Fin d)).powerset, |blockRawCoef β p d T| := by apply Finset.sum_le_sum intro T hT by_cases hTe : T = ∅ <;> simp [hTe] _ = representerMass β p d := rfl have hcontrast' : (∑ T ∈ (Finset.univ : Finset (Fin d)).powerset, blockRawCoef β p d T) - ∑ T ∈ (Finset.univ : Finset (Fin d)).powerset, blockRawCoef β p d T * (if T = ∅ then 1 else 0) = 1 := by simpa only [mul_one] using hcontrast rw [hcontrast'] at habs simpa using habs
CausalSmith.Experimentation.SnipeDegreeFrontier.one_le_representerMass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:220
theorem representerMass_le_representerMassSup

Each finite-size representer mass is bounded by the exact supremum used in the tilt definition.

Formal statement
β d :
p :
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
Proof (Lean source)
lemma representerMass_le_representerMassSup (β d : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : representerMass β p d ≤ representerMassSup β p := by obtain ⟨c₁, c₂, H, hc₁, hc₁c₂, hH, hrep⟩ := blockEnergy_representer β p hβ hp0 hp1 unfold representerMassSup apply le_csSup · refine ⟨H, ?_⟩ rintro x ⟨e, rfl⟩ exact (hrep e.1 e.2).2.2.2.2 · exact Set.mem_range_self (⟨d, hd⟩ : {d : ℕ // 1 ≤ d})
CausalSmith.Experimentation.SnipeDegreeFrontier.representerMass_le_representerMassSup · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:283
theorem representerMassSup_pos

The exact supremum of representer masses is positive.

Formal statement
β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
Proof (Lean source)
lemma representerMassSup_pos (β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) : 0 < representerMassSup β p := by have hle := representerMass_le_representerMassSup β 1 p hβ (by omega) hp0 hp1 have hone := one_le_representerMass β 1 p hβ (by omega) hp0 hp1 linarith
CausalSmith.Experimentation.SnipeDegreeFrontier.representerMassSup_pos · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:298
theorem tiltAmplitude_mul_representerMass_le_half

The score tilt consumes at most half of the coefficient budget after multiplication by one representer mass.

Formal statement
B :
β d m :
p :
hB :
0 ≤ B
:
1 ≤ β
hd :
1 ≤ d
hp0 :
0 < p
hp1 :
p < 1
|tiltAmplitude B β p m d| * representerMass β p d ≤ B / 2
Proof (Lean source)
lemma tiltAmplitude_mul_representerMass_le_half (B : ℝ) (β d m : ℕ) (p : ℝ) (hB : 0 ≤ B) (hβ : 1 ≤ β) (hd : 1 ≤ d) (hp0 : 0 < p) (hp1 : p < 1) : |tiltAmplitude B β p m d| * representerMass β p d ≤ B / 2 := by have hH : 0 < representerMassSup β p := representerMassSup_pos β p hβ hp0 hp1 have hmass0 : 0 ≤ representerMass β p d := by unfold representerMass positivity have hmass : representerMass β p d ≤ representerMassSup β p := representerMass_le_representerMassSup β d p hβ hd hp0 hp1 have hsqrt : 0 ≤ min 1 (sqrt (blockEnergy β p d / m)) := by rw [le_min_iff] exact ⟨by norm_num, Real.sqrt_nonneg _⟩ have hsqrt1 : min 1 (sqrt (blockEnergy β p d / m)) ≤ 1 := min_le_left _ _ have hk0 : 0 ≤ min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹) := by rw [le_min_iff] constructor <;> positivity have hkH : min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹) * representerMass β p d ≤ 1 / 2 := by calc min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹) * representerMass β p d ≤ (2 * representerMassSup β p)⁻¹ * representerMassSup β p := by apply mul_le_mul · exact min_le_left _ _ · exact hmass · exact hmass0 · positivity _ = 1 / 2 := by field_simp rw [tiltAmplitude, abs_mul, abs_mul, abs_of_nonneg hB, abs_of_nonneg hk0, abs_of_nonneg hsqrt] calc B * min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹) * min 1 (sqrt (blockEnergy β p d / ↑m)) * representerMass β p d = B * (min 1 (sqrt (blockEnergy β p d / ↑m)) * (min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹) * representerMass β p d)) := by ring _ ≤ B * (1 * (1 / 2)) := by gcongr _ = B / 2 := by ring
CausalSmith.Experimentation.SnipeDegreeFrontier.tiltAmplitude_mul_representerMass_le_half · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:308
theorem sum_block_powerset_localSubset

Reduction modulo d gives a bijection between subsets of one active global block and subsets of Fin d.

Formal statement
n d :
hd :
1 ≤ d
i :
Fin n
hi :
i.val < activeCount n d
F :
Finset (Fin d) → ℝ
∑ T ∈ (nbhd (blockGraph n d) i).powerset, F (localSubset n d T)
= ∑ S ∈ (Finset.univ : Finset (Fin d)).powerset, F S
Proof (Lean source)
lemma sum_block_powerset_localSubset (n d : ℕ) (hd : 1 ≤ d) (i : Fin n) (hi : i.val < activeCount n d) (F : Finset (Fin d) → ℝ) : ∑ T ∈ (nbhd (blockGraph n d) i).powerset, F (localSubset n d T) = ∑ S ∈ (Finset.univ : Finset (Fin d)).powerset, F S := by classical have hb : i.val / d < blockCount n d := by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi let e : Fin d → Fin n := fun k => ⟨(i.val / d) * d + k.val, by have hblock : (i.val / d + 1) * d ≤ blockCount n d * d := by exact Nat.mul_le_mul_right d hb calc (i.val / d) * d + k.val < (i.val / d) * d + d := Nat.add_lt_add_left k.isLt _ _ = (i.val / d + 1) * d := by simp [Nat.add_mul] _ ≤ blockCount n d * d := hblock _ = activeCount n d := rfl _ ≤ n := activeCount_le n d⟩ have he_mem (k : Fin d) : e k ∈ nbhd (blockGraph n d) i := by simp only [nbhd, mem_filter, Finset.mem_univ, true_and] simp only [blockGraph] have hval : (e k).val < activeCount n d := by dsimp [e] have hblock : (i.val / d + 1) * d ≤ blockCount n d * d := Nat.mul_le_mul_right d hb calc (i.val / d) * d + k.val < (i.val / d) * d + d := Nat.add_lt_add_left k.isLt _ _ = (i.val / d + 1) * d := by simp [Nat.add_mul] _ ≤ blockCount n d * d := hblock _ = activeCount n d := rfl refine ⟨hval, hi, ?_⟩ dsimp [e] rw [Nat.add_comm, mul_comm (i.val / d) d, Nat.add_mul_div_left k.val (i.val / d) (by omega), Nat.div_eq_of_lt k.isLt] simp have he_mod (k : Fin d) : (e k).val % d = k.val := by dsimp [e] rw [Nat.add_comm, mul_comm (i.val / d) d, Nat.add_mul_mod_self_left, Nat.mod_eq_of_lt k.isLt] have hlocal_embed (S : Finset (Fin d)) : localSubset n d (S.image e) = S := by rw [localSubset, dif_pos (by omega)] ext k constructor · intro hk obtain ⟨j, hj, hjk⟩ := Finset.mem_image.mp hk obtain ⟨l, hl, rfl⟩ := Finset.mem_image.mp hj have hlk : l = k := by apply Fin.ext simpa [he_mod] using Fin.ext_iff.mp hjk simpa [hlk] using hl · intro hk apply Finset.mem_image.mpr refine ⟨e k, Finset.mem_image.mpr ⟨k, hk, rfl⟩, ?_⟩ apply Fin.ext simpa using he_mod k have he_inj : Injective e := by intro k l hkl apply Fin.ext have := Fin.ext_iff.mp hkl dsimp [e] at this omega have he_local (j : Fin n) (hj : j ∈ nbhd (blockGraph n d) i) : e ⟨j.val % d, Nat.mod_lt _ (by omega)⟩ = j := by apply Fin.ext have hjq : j.val / d = i.val / d := ((Finset.mem_filter.mp hj).2).2.2 dsimp [e] rw [← hjq] simpa [mul_comm] using Nat.div_add_mod j.val d apply Finset.sum_bij' (fun T _ => localSubset n d T) (fun S _ => S.image e) · intro T hT simp · intro S hS apply Finset.mem_powerset.mpr intro j hj obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hj exact he_mem k · intro T hT ext j constructor · intro hj obtain ⟨k, hk, hkj⟩ := Finset.mem_image.mp hj have hk' : k ∈ localSubset n d T := hk rw [localSubset, dif_pos (by omega)] at hk' obtain ⟨l, hl, hlk⟩ := Finset.mem_image.mp hk' have hlN : l ∈ nbhd (blockGraph n d) i := Finset.mem_powerset.mp hT hl rw [← hkj, ← hlk, he_local l hlN] exact hl · intro hj apply Finset.mem_image.mpr let k : Fin d := ⟨j.val % d, Nat.mod_lt _ (by omega)⟩ refine ⟨k, ?_, ?_⟩ · rw [localSubset, dif_pos (by omega)] exact Finset.mem_image.mpr ⟨j, hj, rfl⟩ · exact he_local j (Finset.mem_powerset.mp hT hj) · intro S hS exact hlocal_embed S · intro T hT rfl
CausalSmith.Experimentation.SnipeDegreeFrontier.sum_block_powerset_localSubset · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:360
theorem sum_abs_blockRawCoef_localSubset

The raw-coefficient contribution of a block schedule has exactly the single-block representer mass.

Formal statement
n d β :
p :
hd :
1 ≤ d
i :
Fin n
hi :
i.val < activeCount n d
∑ T ∈ (nbhd (blockGraph n d) i).powerset, |blockRawCoef β p d (localSubset n d T)|
Proof (Lean source)
lemma sum_abs_blockRawCoef_localSubset (n d β : ℕ) (p : ℝ) (hd : 1 ≤ d) (i : Fin n) (hi : i.val < activeCount n d) : ∑ T ∈ (nbhd (blockGraph n d) i).powerset, |blockRawCoef β p d (localSubset n d T)| = representerMass β p d := by simpa [representerMass] using sum_block_powerset_localSubset n d hd i hi (fun S => |blockRawCoef β p d S|)
CausalSmith.Experimentation.SnipeDegreeFrontier.sum_abs_blockRawCoef_localSubset · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part1.lean:479
theorem blockSchedule_mass_le

A supported cosine-prior schedule obeys the raw coefficient-mass envelope whenever its baseline lies in [-B/2,B/2].

Formal statement
n d β :
B p σ :
hn :
1 ≤ n
hd :
1 ≤ d
hdn :
d ≤ n
hB :
0 ≤ B
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
:
σ = -1 ∨ σ = 1
U :
Fin (blockCount n d) → ℝ
hU :
∀ b, |U b| ≤ B / 2
BoundedCoeffMass (blockGraph n d) (blockSchedule n d β B p σ hσ U) B
Proof (Lean source)
lemma blockSchedule_mass_le (n d β : ℕ) (B p σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 ≤ B) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hσ : σ = -1 ∨ σ = 1) (U : Fin (blockCount n d) → ℝ) (hU : ∀ b, |U b| ≤ B / 2) : BoundedCoeffMass (blockGraph n d) (blockSchedule n d β B p σ hσ U) B := by classical intro i by_cases hi : i.val < activeCount n d · have hb : i.val / d < blockCount n d := by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi have hcond (T : Finset (Fin n)) (hT : T ∈ (nbhd (blockGraph n d) i).powerset) : ∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d := by intro j hj have hjN := Finset.mem_powerset.mp hT hj exact ⟨((Finset.mem_filter.mp hjN).2).1, ((Finset.mem_filter.mp hjN).2).2.2⟩ have hsigma : |σ| = 1 := by rcases hσ with rfl | rfl <;> norm_num calc ∑ T ∈ (nbhd (blockGraph n d) i).powerset, |blockSchedule n d β B p σ hσ U i T| = ∑ T ∈ (nbhd (blockGraph n d) i).powerset, |(if T = ∅ then U ⟨i.val / d, hb⟩ else 0) + σ * tiltAmplitude B β p (blockCount n d) d * blockRawCoef β p d (localSubset n d T)| := by apply Finset.sum_congr rfl intro T hT rw [blockSchedule, dif_pos hi, dif_pos (hcond T hT)] simp [baselineAt, hb] _ ≤ ∑ T ∈ (nbhd (blockGraph n d) i).powerset, |if T = ∅ then U ⟨i.val / d, hb⟩ else 0| + ∑ T ∈ (nbhd (blockGraph n d) i).powerset, |σ * tiltAmplitude B β p (blockCount n d) d * blockRawCoef β p d (localSubset n d T)| := by rw [← Finset.sum_add_distrib] apply Finset.sum_le_sum intro T hT exact abs_add_le _ _ _ = |U ⟨i.val / d, hb⟩| + |tiltAmplitude B β p (blockCount n d) d| * representerMass β p d := by have hempty : (∅ : Finset (Fin n)) ∈ (nbhd (blockGraph n d) i).powerset := by simp rw [show (∑ T ∈ (nbhd (blockGraph n d) i).powerset, |if T = ∅ then U ⟨i.val / d, hb⟩ else 0|) = |U ⟨i.val / d, hb⟩| by rw [Finset.sum_eq_single ∅] · simp · intro T hT hTne simp [hTne] · intro hnot exact (hnot hempty).elim] simp_rw [abs_mul, hsigma, one_mul] rw [← Finset.mul_sum, sum_abs_blockRawCoef_localSubset n d β p hd i hi] _ ≤ B / 2 + B / 2 := add_le_add (hU _) <| tiltAmplitude_mul_representerMass_le_half B β d (blockCount n d) p hB hβ hd hp0 hp1 _ = B := by ring · have hnbhd : nbhd (blockGraph n d) i = ∅ := by ext j simp [nbhd, blockGraph, hi] simp [hnbhd, blockSchedule, hi, hB]
Helpers.LeastFavourableProperties_Part2 6 declarations Builds the model whose response is the block schedule, evaluates its potential outcomes on active and inactive units, and computes the resulting total treatment effect.

The least-favourable schedule model and its potential outcomes

Builds the model whose response is the block schedule, evaluates its potential outcomes on active and inactive units, and computes the resulting total treatment effect.

def blockScheduleModel

Every schedule in the displayed least-favourable family is a member of the coefficient-mass model class.

Definition (Lean source)
noncomputable def blockScheduleModel (n d β : ℕ) (B p σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdn : d ≤ n) (hB : 0 ≤ B) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hσ : σ = -1 ∨ σ = 1) (U : Fin (blockCount n d) → ℝ) (hU : ∀ b, |U b| ≤ B / 2) : ModelClass (Fin n) d β B := { edge := blockGraph n d decEdge := Classical.decRel _ coef := blockSchedule n d β B p σ hσ U supported := blockSchedule_supported n d β B p σ hσ U degree_le := blockGraph_degree_le n d hd low_order := blockSchedule_lowOrder n d β B p σ hd hσ U mass_le := blockSchedule_mass_le n d β B p σ hn hd hdn hB hβ hp0 hp1 hσ U hU }
theorem rawMonomial_localSubset_blockAssignment

A global raw monomial inside one active block is the corresponding local raw monomial after restriction of the assignment.

Formal statement
n d :
hd :
1 ≤ d
i :
Fin n
hi :
i.val < activeCount n d
T :
hT :
∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d
z :
Fin n → Bool
(∏ j ∈ T, if z j then (1 : ℝ) else 0)
= rawMonomial (localSubset n d T) (blockAssignment n d ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ z)
Proof (Lean source)
lemma rawMonomial_localSubset_blockAssignment (n d : ℕ) (hd : 1 ≤ d) (i : Fin n) (hi : i.val < activeCount n d) (T : Finset (Fin n)) (hT : ∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d) (z : Fin n → Bool) : (∏ j ∈ T, if z j then (1 : ℝ) else 0) = rawMonomial (localSubset n d T) (blockAssignment n d ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ z) := by classical let f : Fin n → Fin d := fun j => ⟨j.val % d, Nat.mod_lt _ (by omega)⟩ have hinj : ∀ j ∈ T, ∀ k ∈ T, f j = f k → j = k := by intro j hj k hk heq apply Fin.ext have hmod : j.val % d = k.val % d := Fin.ext_iff.mp heq have hjq := (hT j hj).2 have hkq := (hT k hk).2 calc j.val = d * (j.val / d) + j.val % d := (Nat.div_add_mod j.val d).symm _ = d * (k.val / d) + k.val % d := by rw [hjq, hkq, hmod] _ = k.val := Nat.div_add_mod k.val d rw [localSubset, dif_pos (by omega)] unfold rawMonomial rw [Finset.prod_image] · apply Finset.prod_congr rfl intro j hj have hjq := (hT j hj).2 have hidx : (⟨(i.val / d) * d + (f j).val, by have hactive := (hT j hj).1 simpa [f, ← hjq, mul_comm] using (show d * (j.val / d) + j.val % d < n by rw [Nat.div_add_mod] exact j.isLt)⟩ : Fin n) = j := by apply Fin.ext dsimp [f] rw [← hjq] simpa [mul_comm] using Nat.div_add_mod j.val d simp only [blockInd, blockAssignment] let q : Fin n := ⟨(i.val / d) * d + (f j).val, by have hactive := (hT j hj).1 simpa [f, ← hjq, mul_comm] using (show d * (j.val / d) + j.val % d < n by rw [Nat.div_add_mod] exact j.isLt)⟩ change (if z j then (1 : ℝ) else 0) = if z q then (1 : ℝ) else 0 have hz : z j = z q := congrArg z (by simpa [q] using hidx.symm) cases hjz : z j <;> cases hqz : z q <;> simp_all · exact hinj
CausalSmith.Experimentation.SnipeDegreeFrontier.rawMonomial_localSubset_blockAssignment · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part2.lean:38
theorem potentialOutcome_blockSchedule

Evaluation of an active block schedule is a translated normalized block representer.

Formal statement
n d β :
B p σ :
hd :
1 ≤ d
:
σ = -1 ∨ σ = 1
U :
Fin (blockCount n d) → ℝ
i :
Fin n
hi :
i.val < activeCount n d
z :
Fin n → Bool
potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i z
= U ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩
+ σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ z)
Proof (Lean source)
lemma potentialOutcome_blockSchedule (n d β : ℕ) (B p σ : ℝ) (hd : 1 ≤ d) (hσ : σ = -1 ∨ σ = 1) (U : Fin (blockCount n d) → ℝ) (i : Fin n) (hi : i.val < activeCount n d) (z : Fin n → Bool) : potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i z = U ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ z) := by classical let b : Fin (blockCount n d) := ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ have hcond (T : Finset (Fin n)) (hmem : T ∈ (nbhd (blockGraph n d) i).powerset) : ∀ j ∈ T, j.val < activeCount n d ∧ j.val / d = i.val / d := by intro j hj have hjN := Finset.mem_powerset.mp hmem hj exact ⟨((Finset.mem_filter.mp hjN).2).1, ((Finset.mem_filter.mp hjN).2).2.2⟩ unfold potentialOutcome rw [show (∑ T ∈ (nbhd (blockGraph n d) i).powerset, blockSchedule n d β B p σ hσ U i T * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = (∑ T ∈ (nbhd (blockGraph n d) i).powerset, (if T = ∅ then U b else 0) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) + (∑ T ∈ (nbhd (blockGraph n d) i).powerset, (σ * tiltAmplitude B β p (blockCount n d) d * blockRawCoef β p d (localSubset n d T)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) by rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro T hmem rw [blockSchedule, dif_pos hi, dif_pos (hcond T hmem)] have hb' : i.val / d < blockCount n d := b.isLt by_cases hTe : T = ∅ · simp [hTe, baselineAt, hb', b] · simp [hTe]] have hbase : (∑ T ∈ (nbhd (blockGraph n d) i).powerset, (if T = ∅ then U b else 0) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = U b := by rw [Finset.sum_eq_single ∅] · simp · intro T hT hTne simp [hTne] · intro hnot exact (hnot (by simp)).elim rw [hbase] have hpert : (∑ T ∈ (nbhd (blockGraph n d) i).powerset, (σ * tiltAmplitude B β p (blockCount n d) d * blockRawCoef β p d (localSubset n d T)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (blockAssignment n d b z) := by rw [show (∑ T ∈ (nbhd (blockGraph n d) i).powerset, (σ * tiltAmplitude B β p (blockCount n d) d * blockRawCoef β p d (localSubset n d T)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = σ * tiltAmplitude B β p (blockCount n d) d * ∑ T ∈ (nbhd (blockGraph n d) i).powerset, blockRawCoef β p d (localSubset n d T) * ∏ j ∈ T, if z j then (1 : ℝ) else 0 by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro T hT ring] congr 1 rw [blockRepresenter_raw_expansion β d p hd] rw [← sum_block_powerset_localSubset n d hd i hi (fun S => blockRawCoef β p d S * rawMonomial S (blockAssignment n d b z))] apply Finset.sum_congr rfl intro T hmem rw [rawMonomial_localSubset_blockAssignment n d hd i hi T (hcond T hmem) z] rw [hpert]
CausalSmith.Experimentation.SnipeDegreeFrontier.potentialOutcome_blockSchedule · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part2.lean:98
theorem potentialOutcome_blockSchedule_inactive

Inactive units in the block construction have zero potential outcome.

Formal statement
n d β :
B p σ :
:
σ = -1 ∨ σ = 1
U :
Fin (blockCount n d) → ℝ
i :
Fin n
hi :
¬ i.val < activeCount n d
z :
Fin n → Bool
potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i z = 0
Proof (Lean source)
lemma potentialOutcome_blockSchedule_inactive (n d β : ℕ) (B p σ : ℝ) (hσ : σ = -1 ∨ σ = 1) (U : Fin (blockCount n d) → ℝ) (i : Fin n) (hi : ¬ i.val < activeCount n d) (z : Fin n → Bool) : potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i z = 0 := by classical have hnbhd : nbhd (blockGraph n d) i = ∅ := by ext j simp [nbhd, blockGraph, hi] simp [potentialOutcome, hnbhd, blockSchedule, hi]
CausalSmith.Experimentation.SnipeDegreeFrontier.potentialOutcome_blockSchedule_inactive · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LeastFavourableProperties_Part2.lean:195
theorem card_active_units

The number of active Fin n indices is activeCount n d.

Formal statement
n d :
((Finset.univ : Finset (Fin n)).filter (fun i => i.val < activeCount n d)).card
Proof (Lean source)
lemma card_active_units (n d : ℕ) : ((Finset.univ : Finset (Fin n)).filter (fun i => i.val < activeCount n d)).card = activeCount n d := by have hle := activeCount_le n d have hcard : ((Finset.univ : Finset (Fin n)).filter (fun i => i.val < activeCount n d)).card = (Finset.univ : Finset (Fin (activeCount n d))).card := by apply Finset.card_bij (fun i _ => (⟨i.val, by exact (Finset.mem_filter.mp ‹i ∈ (Finset.univ : Finset (Fin n)).filter (fun i => i.val < activeCount n d)›).2⟩ : Fin (activeCount n d))) · intro i hi simp · intro i hi j hj heq apply Fin.ext exact congrArg (fun x : Fin (activeCount n d) => x.val) heq · intro k hk refine ⟨⟨k.val, k.isLt.trans_le hle⟩, ?_, ?_⟩ · simp [k.isLt] · rfl simpa using hcard
theorem tte_blockSchedule

The all-treated/all-control contrast of a least-favourable schedule is the active share times its signed tilt.

Formal statement
n d β :
B p σ :
hn :
1 ≤ n
hd :
1 ≤ d
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
:
σ = -1 ∨ σ = 1
U :
Fin (blockCount n d) → ℝ
tte (blockGraph n d) (blockSchedule n d β B p σ hσ U)
= σ * activeShare n d * tiltAmplitude B β p (blockCount n d) d
Proof (Lean source)
lemma tte_blockSchedule (n d β : ℕ) (B p σ : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hσ : σ = -1 ∨ σ = 1) (U : Fin (blockCount n d) → ℝ) : tte (blockGraph n d) (blockSchedule n d β B p σ hσ U) = σ * activeShare n d * tiltAmplitude B β p (blockCount n d) d := by classical let D := blockDesign d p (le_of_lt hp0) (le_of_lt hp1) have hD : IsProductBernoulli D p := by refine ⟨hp0, hp1, ?_⟩ exact ⟨fun _ => le_of_lt hp0, fun _ => le_of_lt hp1, rfl⟩ have hcontrast : blockRepresenter β p d (fun _ => true) - blockRepresenter β p d (fun _ => false) = 1 := by simpa [contrastFunctional] using (blockRepresenter_contrast_energy β d p D hD hβ hd).1 have hunit (i : Fin n) (hi : i.val < activeCount n d) : potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i (fun _ => true) - potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i (fun _ => false) = σ * tiltAmplitude B β p (blockCount n d) d := by rw [potentialOutcome_blockSchedule n d β B p σ hd hσ U i hi, potentialOutcome_blockSchedule n d β B p σ hd hσ U i hi] have htrue : blockAssignment n d ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ (fun _ => true) = (fun _ => true) := by funext j; rfl have hfalse : blockAssignment n d ⟨i.val / d, by simp only [activeCount] at hi rw [div_lt_iff_lt_mul (by omega)] simpa [mul_comm] using hi⟩ (fun _ => false) = (fun _ => false) := by funext j; rfl rw [htrue, hfalse] calc (U _ + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (fun _ => true)) - (U _ + σ * tiltAmplitude B β p (blockCount n d) d * blockRepresenter β p d (fun _ => false)) = σ * tiltAmplitude B β p (blockCount n d) d * (blockRepresenter β p d (fun _ => true) - blockRepresenter β p d (fun _ => false)) := by ring _ = σ * tiltAmplitude B β p (blockCount n d) d := by rw [hcontrast] ring have hinactive (i : Fin n) (hi : ¬ i.val < activeCount n d) : potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i (fun _ => true) - potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i (fun _ => false) = 0 := by rw [potentialOutcome_blockSchedule_inactive n d β B p σ hσ U i hi, potentialOutcome_blockSchedule_inactive n d β B p σ hσ U i hi] ring unfold tte rw [show (∑ i : Fin n, (potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i (fun _ => true) - potentialOutcome (blockGraph n d) (blockSchedule n d β B p σ hσ U) i (fun _ => false))) = ∑ i : Fin n, if i.val < activeCount n d then σ * tiltAmplitude B β p (blockCount n d) d else 0 by apply Finset.sum_congr rfl intro i hi by_cases hia : i.val < activeCount n d · rw [if_pos hia, hunit i hia] · rw [if_neg hia, hinactive i hia]] rw [Finset.sum_ite, Finset.sum_const_zero, add_zero, Finset.sum_const, card_active_units] simp only [nsmul_eq_mul] unfold activeShare have hn0 : (n : ℝ) ≠ 0 := by positivity simp only [Fintype.card_fin] push_cast field_simp
Helpers.LocalLinearClass 8 declarations The graph is fixed in this restricted problem.

Fixed-graph block-local linear class

The graph is fixed in this restricted problem. Locality is expressed directly: a unit's weight is unchanged whenever two assignments agree on its in-neighborhood. The moment restrictions then encode design unbiasedness for all eligible raw monomials.

structure LocLinSchedClass

Low-order bounded-mass schedules on one fixed graph.

Definition (Lean source)
G :
V → V → Prop
d β :
B :
coef :
V → Finset V → ℝ
supported :
∀ i S
if
¬ S ⊆ nbhd G i
then
coef i S = 0
low_order :
LowOrder coef (effBeta β d)
mass_le :
CausalSmith.Experimentation.SnipeDegreeFrontier.LocLinSchedClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:28

A collection of block-local weights satisfying all unbiasedness moments.

Definition (Lean source)
G :
V → V → Prop
d β :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
weight :
V → (V → Bool) → ℝ
blockIndex :
V → Fin (card V / d)
@realizes b(i)(typed block index in Fin (n_t/d_t))
complete_block :
∀ i j, j ∈ nbhd G i ↔ blockIndex j = blockIndex i
local_dep :
∀ i z z'
if
(∀ j ∈ nbhd G i, z j = z' j)
then
weight i z = weight i z'
mean_zero :
∀ i, (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (weight i) = 0
moment_one :
∀ i (S : Finset V)
if
S.Nonempty
and
S ⊆ nbhd G i
and
S.card ≤ effBeta β d
then
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => weight i z * ∏ j ∈ S, if z j then (1 : ℝ) else 0)
= 1
CausalSmith.Experimentation.SnipeDegreeFrontier.LocLinWeights · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:42
def locLinEstimator

The block-local linear data rule generated by a weight collection.

Definition (Lean source)
noncomputable def locLinEstimator (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (z : V → Bool) (y : V → ℝ) : ℝ := (Fintype.card V : ℝ)⁻¹ * ∑ i : V, w.weight i z * y i
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinEstimator · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:62
def locLinEstimatorClass Definition 17 in the paper ↗

The block-local linear design-unbiased estimator class. Membership is type-level: a rule is generated by a weight collection carrying the locality, centering, and raw-monomial moment restrictions above.

Definition (Lean source)
-- @node: def:local-linear-estimator-class noncomputable def locLinEstimatorClass (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : Set ((V → Bool) → (V → ℝ) → ℝ) := range (locLinEstimator G d β p hp0 hp1)
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinEstimatorClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:71
def locLinRiskAt

MSE of a fixed local weight collection at a fixed schedule.

Definition (Lean source)
noncomputable def locLinRiskAt (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) : ℝ := (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).mse (fun z => locLinEstimator G d β p hp0 hp1 w z (obsOutcome G M.coef z)) (tte G M.coef)
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinRiskAt · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:82

Worst-case fixed-graph risk of local weights.

Definition (Lean source)
noncomputable def locLinWorstRisk (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) : ℝ := sSup (Set.range fun M : LocLinSchedClass G d β B => locLinRiskAt G d β B p hp0 hp1 w M)
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinWorstRisk · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:94

Restricted minimax risk over block-local linear unbiased weights.

Definition (Lean source)
-- @node: def:local-linear-risk noncomputable def locLinMinimaxRisk (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : ℝ := sInf (Set.range fun w : LocLinWeights G d β p hp0 hp1 => locLinWorstRisk G d β B p hp0 hp1 w)
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinMinimaxRisk · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:102

The exact finite block extremal functional. block is the set of units in the block whose joint error is maximized over signed raw-monomial extreme points.

Definition (Lean source)
noncomputable def blockExtremal (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (block : Finset V) : ℝ := by classical let candidates : Finset ((V → Bool) × (V → Finset V)) := Finset.univ.filter (fun choice => ∀ i ∈ block, choice.2 i ⊆ block ∧ (choice.2 i).card ≤ effBeta β d) have hne : candidates.Nonempty := by refine ⟨(fun _ => false, fun _ => ∅), ?_⟩ simp [candidates] exact candidates.sup' hne (fun choice => (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ block, (if choice.1 i then (1 : ℝ) else -1) * (w.weight i z * (∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) - if (choice.2 i).Nonempty then 1 else 0)) ^ 2))
CausalSmith.Experimentation.SnipeDegreeFrontier.blockExtremal · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearClass.lean:111
Helpers.LocalLinearCompleteBlocks_Part1 15 declarations Defines the canonical local-linear weight scheme, the complete-block index and unit sets, and the per-unit estimation error, then develops the error expansion, unbiasedness, and the global second-moment identity for the

Canonical local-linear weights and the estimator error expansion

Defines the canonical local-linear weight scheme, the complete-block index and unit sets, and the per-unit estimation error, then develops the error expansion, unbiasedness, and the global second-moment identity for the SNIPE score together with the weight-energy and centred-moment lemmas.

theorem activeCount_eq_of_dvd

When the block size divides the population size, every unit is active.

Formal statement
n d :
hdiv :
d ∣ n
activeCount n d = n
Proof (Lean source)
lemma activeCount_eq_of_dvd (n d : ℕ) (hdiv : d ∣ n) : activeCount n d = n := by simp only [activeCount, blockCount] exact Nat.div_mul_cancel hdiv
theorem blockGraph_nbhd_card

In a complete block design, every unit’s neighborhood contains exactly the block size number of units.

Formal statement
n d :
hd :
1 ≤ d
hdiv :
d ∣ n
i :
Fin n
(nbhd (blockGraph n d) i).card = d
Proof (Lean source)
lemma blockGraph_nbhd_card (n d : ℕ) (hd : 1 ≤ d) (hdiv : d ∣ n) (i : Fin n) : (nbhd (blockGraph n d) i).card = d := by have hactive : activeCount n d = n := activeCount_eq_of_dvd n d hdiv have hq : i.val / d < n / d := by rw [div_lt_iff_lt_mul (by omega)] simpa [Nat.div_mul_cancel hdiv] using i.isLt rw [show nbhd (blockGraph n d) i = Finset.univ.filter (fun j : Fin n => j.val / d = i.val / d) by ext j simp [nbhd, blockGraph, hactive, i.isLt, j.isLt]] have hcard : (Finset.univ : Finset (Fin d)).card = (Finset.univ.filter (fun j : Fin n => j.val / d = i.val / d)).card := by apply Finset.card_bij (fun k _ => (⟨(i.val / d) * d + k.val, by calc (i.val / d) * d + k.val < (i.val / d) * d + d := Nat.add_lt_add_left k.isLt _ _ = (i.val / d + 1) * d := by rw [Nat.add_mul] omega _ ≤ (n / d) * d := Nat.mul_le_mul_right d hq _ = n := Nat.div_mul_cancel hdiv⟩ : Fin n)) · intro k hk simp only [mem_filter, Finset.mem_univ, true_and] rw [Nat.add_comm, mul_comm (i.val / d) d, Nat.add_mul_div_left k.val (i.val / d) (by omega), Nat.div_eq_of_lt k.isLt] omega · intro k₁ hk₁ k₂ hk₂ heq have hv := Fin.ext_iff.mp heq exact Fin.ext (Nat.add_left_cancel hv) · intro j hj simp only [mem_filter, Finset.mem_univ, true_and] at hj have hmod : j.val % d < d := Nat.mod_lt _ (by omega) refine ⟨⟨j.val % d, hmod⟩, Finset.mem_univ _, ?_⟩ apply Fin.ext simp only rw [← hj] simpa [mul_comm] using Nat.div_add_mod j.val d simpa using hcard.symm
def canonicalLocLinWeights

Constructs canonical local-linear weights for the complete block graph, satisfying the required locality, mean-zero, and moment conditions.

Definition (Lean source)
noncomputable def canonicalLocLinWeights (n d β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) : LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) := by classical have hm : 0 < blockCount n d := by rcases hdiv with ⟨m, rfl⟩ simp only [blockCount] have hm : 0 < m := by by_contra hz have : m = 0 := Nat.eq_zero_of_not_pos hz subst m simp at hn have hdm : d ≤ d * m := by simpa using Nat.mul_le_mul_left d hm have hdpos : 0 < d := by omega simp [hdpos, hdm, hm] let bidx : Fin n → Fin (card (Fin n) / d) := fun i => ⟨i.val / d, by simp only [Fintype.card_fin] rw [div_lt_iff_lt_mul (by omega)] simpa [Nat.div_mul_cancel hdiv] using i.isLt⟩ refine { weight := fun i z => snipeScore (fun j i => decide (blockGraph n d j i)) β p i z blockIndex := bidx complete_block := ?_ local_dep := ?_ mean_zero := ?_ moment_one := ?_ } · intro i j simp only [nbhd, mem_filter, Finset.mem_univ, true_and, blockGraph, bidx, Fin.ext_iff] have hactive : activeCount n d = n := activeCount_eq_of_dvd n d hdiv simp [hactive, i.isLt, j.isLt] · intro i z z' hzz simp only [snipeScore] apply Finset.sum_congr rfl intro r hr apply congrArg apply Finset.sum_congr rfl intro S hS apply Finset.prod_congr rfl intro j hj have hjN : j ∈ nbhd (blockGraph n d) i := by have hSB : S ⊆ nbhdB (fun j i => decide (blockGraph n d j i)) i := Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1 have := hSB hj simpa [nbhdB, nbhd] using this rw [hzz j hjN] · intro i exact snipeScore_mean_zero (fun j i => decide (blockGraph n d j i)) β p hp0 hp1 i · intro i S hS hSN hScard apply snipeScore_raw_moment (fun j i => decide (blockGraph n d j i)) β p hp0 hp1 i S hS · simpa [nbhdB, nbhd] using hSN · rw [show nbhdB (fun j i => decide (blockGraph n d j i)) i = nbhd (blockGraph n d) i by ext j simp [nbhdB, nbhd]] simpa [blockGraph_nbhd_card n d hd hdiv i] using hScard
CausalSmith.Experimentation.SnipeDegreeFrontier.canonicalLocLinWeights · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:73
def completeBlockUnits

Defines the units in a block as the active population units with the specified block index.

Definition (Lean source)
noncomputable def completeBlockUnits (n d : ℕ) (b : Fin (blockCount n d)) : Finset (Fin n) := Finset.univ.filter (fun i => i.val < activeCount n d ∧ i.val / d = b.val)
def blockFirstUnit

Returns the first population unit in the specified complete block.

Definition (Lean source)
def blockFirstUnit (n d : ℕ) (hd : 1 ≤ d) (hdiv : d ∣ n) (b : Fin (blockCount n d)) : Fin n := ⟨b.val * d, by have hb : b.val < n / d := by simpa [blockCount] using b.isLt calc b.val * d < (n / d) * d := Nat.mul_lt_mul_of_pos_right hb (by omega) _ = n := Nat.div_mul_cancel hdiv⟩
def completeBlockIndex

Assigns each population unit to its complete-block index.

Definition (Lean source)
def completeBlockIndex (n d : ℕ) (hd : 1 ≤ d) (hdiv : d ∣ n) (i : Fin n) : Fin (blockCount n d) := ⟨i.val / d, by simp only [blockCount] rw [div_lt_iff_lt_mul (by omega)] simpa [Nat.div_mul_cancel hdiv] using i.isLt⟩
theorem mem_completeBlockIndex

Every population unit belongs to the complete block selected by its block index.

Formal statement
n d :
hd :
1 ≤ d
hdiv :
d ∣ n
i :
Fin n
i ∈ completeBlockUnits n d (completeBlockIndex n d hd hdiv i)
Proof (Lean source)
lemma mem_completeBlockIndex (n d : ℕ) (hd : 1 ≤ d) (hdiv : d ∣ n) (i : Fin n) : i ∈ completeBlockUnits n d (completeBlockIndex n d hd hdiv i) := by have hactive : activeCount n d = n := activeCount_eq_of_dvd n d hdiv simp [completeBlockUnits, completeBlockIndex, hactive, i.isLt]
CausalSmith.Experimentation.SnipeDegreeFrontier.mem_completeBlockIndex · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:165
def locLinUnitError

Defines a unit-and-subset contribution to estimation error as the weighted observed monomial minus its target.

Definition (Lean source)
noncomputable def locLinUnitError {V : Type*} [Fintype V] [DecidableEq V] {G : V → V → Prop} {d β : ℕ} {p : ℝ} {hp0 : 0 ≤ p} {hp1 : p ≤ 1} (w : LocLinWeights G d β p hp0 hp1) (i : V) (S : Finset V) (z : V → Bool) : ℝ := w.weight i z * (∏ j ∈ S, if z j then (1 : ℝ) else 0) - if S.Nonempty then 1 else 0
theorem locLinEstimator_error_expansion

The local-linear estimator’s error equals the population average of coefficient-weighted unit errors over all local subsets.

Formal statement
V :
G :
V → V → Prop
d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
M :
z :
V → Bool
locLinEstimator G d β p hp0 hp1 w z (obsOutcome G M.coef z) - tte G M.coef
= (Fintype.card V : ℝ)⁻¹ * ∑ i : V, ∑ S ∈ (nbhd G i).powerset, M.coef i S * locLinUnitError w i S z
Proof (Lean source)
lemma locLinEstimator_error_expansion {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) (z : V → Bool) : locLinEstimator G d β p hp0 hp1 w z (obsOutcome G M.coef z) - tte G M.coef = (Fintype.card V : ℝ)⁻¹ * ∑ i : V, ∑ S ∈ (nbhd G i).powerset, M.coef i S * locLinUnitError w i S z := by classical unfold locLinEstimator obsOutcome tte potentialOutcome locLinUnitError rw [← mul_sub] congr 1 rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro i hi rw [Finset.mul_sum] rw [show (∑ S ∈ (nbhd G i).powerset, w.weight i z * (M.coef i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0)) = ∑ S ∈ (nbhd G i).powerset, M.coef i S * (w.weight i z * ∏ j ∈ S, if z j then (1 : ℝ) else 0) by apply Finset.sum_congr rfl intro S hS ring] rw [← Finset.sum_sub_distrib] rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro S hS by_cases hSne : S.Nonempty · have htrue : (∏ j ∈ S, if (fun _ : V => true) j then (1 : ℝ) else 0) = 1 := by simp have hfalse : (∏ j ∈ S, if (fun _ : V => false) j then (1 : ℝ) else 0) = 0 := by obtain ⟨j, hj⟩ := hSne exact Finset.prod_eq_zero hj (by simp) rw [htrue, hfalse, if_pos hSne] ring · have hSe : S = ∅ := Finset.not_nonempty_iff_eq_empty.mp hSne subst S simp
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinEstimator_error_expansion · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:182
theorem locLinEstimator_unbiased

Under Bernoulli assignment, valid local-linear weights yield an unbiased estimator of the total treatment effect.

Formal statement
V :
G :
V → V → Prop
d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
M :
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).Unbiased (fun z => locLinEstimator G d β p hp0 hp1 w z (obsOutcome G M.coef z)) (tte G M.coef)
Proof (Lean source)
lemma locLinEstimator_unbiased {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).Unbiased (fun z => locLinEstimator G d β p hp0 hp1 w z (obsOutcome G M.coef z)) (tte G M.coef) := by classical unfold FiniteDesign.Unbiased rw [show (fun z => locLinEstimator G d β p hp0 hp1 w z (obsOutcome G M.coef z)) = fun z => tte G M.coef + (Fintype.card V : ℝ)⁻¹ * ∑ i : V, ∑ S ∈ (nbhd G i).powerset, M.coef i S * locLinUnitError w i S z by funext z rw [← locLinEstimator_error_expansion G d β B p hp0 hp1 w M z] ring] rw [FiniteDesign.E_add, FiniteDesign.E_const, FiniteDesign.E_const_mul, FiniteDesign.E_sum] rw [show (∑ i : V, (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => ∑ S ∈ (nbhd G i).powerset, M.coef i S * locLinUnitError w i S z)) = 0 by apply Finset.sum_eq_zero intro i hi rw [FiniteDesign.E_sum] apply Finset.sum_eq_zero intro S hS rw [FiniteDesign.E_const_mul] by_cases hcard : S.card ≤ effBeta β d · rw [show (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (locLinUnitError w i S) = 0 by unfold locLinUnitError rw [FiniteDesign.E_sub, FiniteDesign.E_const] by_cases hSne : S.Nonempty · rw [if_pos hSne, w.moment_one i S hSne (Finset.mem_powerset.mp hS) hcard] ring · rw [if_neg hSne] simpa [Finset.not_nonempty_iff_eq_empty.mp hSne] using w.mean_zero i] ring · have hβcard : effBeta β d < S.card := Nat.lt_of_not_ge hcard have hc : M.coef i S = 0 := M.low_order i S (by simp only [effBeta] at hβcard omega) rw [hc] simp] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinEstimator_unbiased · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:231
theorem E_global_centeredMonomial_mul

The expectation of a centered Bernoulli monomial times a raw monomial has the stated product-form value.

Formal statement
V :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
S T :
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, ((if z j then (1 : ℝ) else 0) - p))
= if S = T then (p * (1 - p)) ^ S.card else 0
Proof (Lean source)
lemma E_global_centeredMonomial_mul {V : Type*} [Fintype V] [DecidableEq V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (S T : Finset V) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, ((if z j then (1 : ℝ) else 0) - p)) = if S = T then (p * (1 - p)) ^ S.card else 0 := by let x : Bool → ℝ := fun b => (if b then 1 else 0) - p rw [show (fun z : V → Bool => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, ((if z j then (1 : ℝ) else 0) - p)) = (fun z => ∏ j, (if j ∈ S then x (z j) else 1) * (if j ∈ T then x (z j) else 1)) by funext z rw [Finset.prod_mul_distrib] simp [x]] rw [E_global_coordinate_prod p hp0 hp1 (fun j b => (if j ∈ S then x b else 1) * (if j ∈ T then x b else 1))] by_cases hST : S = T · subst T rw [if_pos rfl] have hfactor (j : V) : p * ((if j ∈ S then x true else 1) * (if j ∈ S then x true else 1)) + (1 - p) * ((if j ∈ S then x false else 1) * (if j ∈ S then x false else 1)) = if j ∈ S then p * (1 - p) else 1 := by by_cases hj : j ∈ S <;> simp [hj, x] <;> ring simp_rw [hfactor] rw [Finset.prod_ite_mem] simp · rw [if_neg hST] have hdiff : ∃ j, (j ∈ S ∧ j ∉ T) ∨ (j ∈ T ∧ j ∉ S) := by by_contra h apply hST ext j constructor · intro hjS by_contra hjT exact h ⟨j, inl ⟨hjS, hjT⟩⟩ · intro hjT by_contra hjS exact h ⟨j, inr ⟨hjT, hjS⟩⟩ obtain ⟨j, hj⟩ := hdiff apply Finset.prod_eq_zero (Finset.mem_univ j) rcases hj with hj | hj · simp [hj.1, hj.2, x] ring · simp [hj.1, hj.2, x] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.E_global_centeredMonomial_mul · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:291
theorem snipeScore_sq_expectation_global

The global second moment of the SNIPE score equals its stated block-energy expression.

Formal statement
V :
G :
V → V → Bool
β :
p :
hp0 :
0 < p
hp1 :
p < 1
i :
V
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore G β p i z ^ 2)
= blockEnergy β p (nbhdB G i).card
Proof (Lean source)
lemma snipeScore_sq_expectation_global {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Bool) (β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (i : V) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore G β p i z ^ 2) = blockEnergy β p (nbhdB G i).card := by let N := nbhdB G i let v := p * (1 - p) have hv : v ≠ 0 := mul_ne_zero hp0.ne' (sub_pos.mpr hp1).ne' simp only [snipeScore, pow_two, Finset.sum_mul, Finset.mul_sum, FiniteDesign.E_sum] have hmoment (r q : ℕ) (S T : Finset V) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (bernoulliContrast p q / v ^ q * (∏ j ∈ T, ((if z j then (1 : ℝ) else 0) - p))) * (bernoulliContrast p r / v ^ r * (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)))) = (bernoulliContrast p q / v ^ q) * (bernoulliContrast p r / v ^ r) * (if T = S then v ^ T.card else 0) := by calc _ = (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((bernoulliContrast p q / v ^ q) * (bernoulliContrast p r / v ^ r)) * ((∏ j ∈ T, ((if z j then (1 : ℝ) else 0) - p)) * (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)))) := by apply FiniteDesign.E_congr intro z ring _ = _ := by rw [FiniteDesign.E_const_mul, E_global_centeredMonomial_mul p (le_of_lt hp0) (le_of_lt hp1)] dsimp [v] at hmoment simp_rw [hmoment] simp [blockEnergy] apply Finset.sum_congr rfl intro r hr have hr1 : 1 ≤ r := (Finset.mem_Icc.mp hr).1 have hrle : r ≤ effBeta β (nbhdB G i).card := (Finset.mem_Icc.mp hr).2 rw [show (∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), ∑ q ∈ Icc 1 (effBeta β (nbhdB G i).card), if S ⊆ nbhdB G i ∧ S.card = q then bernoulliContrast p q / (p * (1 - p)) ^ q * (bernoulliContrast p r / (p * (1 - p)) ^ r) * (p * (1 - p)) ^ S.card else 0) = ∑ _S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), bernoulliContrast p r / (p * (1 - p)) ^ r * (bernoulliContrast p r / (p * (1 - p)) ^ r) * (p * (1 - p)) ^ r by apply Finset.sum_congr rfl intro S hS have hSmem := Finset.mem_filter.mp hS have hSsub := Finset.mem_powerset.mp hSmem.1 have hScard := hSmem.2 rw [Finset.sum_eq_single r] · simp [hSsub, hScard, hr] · intro q hq hqr simp [hScard, hqr.symm] · intro hnot exact (hnot hr).elim] rw [show (nbhdB G i).powerset.filter (fun S => S.card = r) = (nbhdB G i).powersetCard r by ext S simp [Finset.mem_powersetCard]] rw [Finset.sum_const, Finset.card_powersetCard] simp only [nsmul_eq_mul] field_simp
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore_sq_expectation_global · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:350
theorem canonicalLocLinWeights_energy

The total expected squared energy of canonical local-linear weights equals the stated multiple of block energy.

Formal statement
n d β :
p :
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
i :
Fin n
(bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z ^ 2)
= blockEnergy β p d
Proof (Lean source)
lemma canonicalLocLinWeights_energy (n d β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (i : Fin n) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z ^ 2) = blockEnergy β p d := by classical change (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore (fun j i => decide (blockGraph n d j i)) β p i z ^ 2) = blockEnergy β p d rw [snipeScore_sq_expectation_global (hp0 := hp0) (hp1 := hp1)] congr 1 rw [show nbhdB (fun j i => decide (blockGraph n d j i)) i = nbhd (blockGraph n d) i by ext j simp [nbhdB, nbhd]] exact blockGraph_nbhd_card n d hd hdiv i
CausalSmith.Experimentation.SnipeDegreeFrontier.canonicalLocLinWeights_energy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:430
theorem locLinWeight_centered_moment

Canonical local-linear weights have the stated centered moments for the specified local subsets.

Formal statement
V :
G :
V → V → Prop
d β :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
i :
V
S :
hSne :
S.Nonempty
hSN :
S ⊆ nbhd G i
hScard :
S.card ≤ effBeta β d
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p))
Proof (Lean source)
lemma locLinWeight_centered_moment {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (i : V) (S : Finset V) (hSne : S.Nonempty) (hSN : S ⊆ nbhd G i) (hScard : S.card ≤ effBeta β d) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) = bernoulliContrast p S.card := by classical rw [show (fun z => w.weight i z * ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) = (fun z => ∑ T ∈ S.powerset, (-p) ^ (S.card - T.card) * (w.weight i z * ∏ j ∈ T, if z j then (1 : ℝ) else 0)) by funext z have hprod : (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) = ∑ T ∈ S.powerset, (-p) ^ (S.card - T.card) * ∏ j ∈ T, if z j then (1 : ℝ) else 0 := by rw [show (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) = ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) + (-p)) by apply Finset.prod_congr rfl intro j hj ring] rw [Finset.prod_add] apply Finset.sum_congr rfl intro T hT have hsub := Finset.mem_powerset.mp hT rw [Finset.prod_const, Finset.card_sdiff, Finset.inter_eq_left.mpr hsub] ring rw [hprod, Finset.mul_sum] apply Finset.sum_congr rfl intro T hT ring] rw [FiniteDesign.E_sum] simp_rw [FiniteDesign.E_const_mul] rw [show (∑ T ∈ S.powerset, (-p) ^ (S.card - T.card) * (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * ∏ j ∈ T, if z j then (1 : ℝ) else 0)) = ∑ T ∈ S.powerset, if T.Nonempty then (-p) ^ (S.card - T.card) else 0 by apply Finset.sum_congr rfl intro T hT by_cases hTne : T.Nonempty · rw [if_pos hTne, w.moment_one i T hTne ((Finset.mem_powerset.mp hT).trans hSN)] · ring · exact (Finset.card_le_card (Finset.mem_powerset.mp hT)).trans hScard · rw [if_neg hTne] have hTe : T = ∅ := Finset.not_nonempty_iff_eq_empty.mp hTne subst T rw [show (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * ∏ j ∈ (∅ : Finset V), if z j then (1 : ℝ) else 0) = 0 by simpa using w.mean_zero i] ring] rw [show (∑ T ∈ S.powerset, if T.Nonempty then (-p) ^ (S.card - T.card) else 0) = (1 - p) ^ S.card - (-p) ^ S.card by rw [show (∑ T ∈ S.powerset, if T.Nonempty then (-p) ^ (S.card - T.card) else 0) = (∑ T ∈ S.powerset, (-p) ^ (S.card - T.card)) - (-p) ^ S.card by rw [← Finset.sum_filter] have hfilter : S.powerset.filter (fun T => T.Nonempty) = S.powerset.erase ∅ := by ext T simp [Finset.nonempty_iff_ne_empty, and_comm] rw [hfilter] have herase := Finset.sum_erase_add (s := S.powerset) (f := fun T => (-p) ^ (S.card - T.card)) (Finset.mem_powerset.mpr (empty_subset S)) simp only [Finset.card_empty, Nat.sub_zero] at herase linarith] rw [show (∑ T ∈ S.powerset, (-p) ^ (S.card - T.card)) = (1 - p) ^ S.card by rw [← Finset.prod_const (s := S) (1 - p)] rw [show (∏ _j ∈ S, (1 - p)) = ∏ _j ∈ S, ((1 : ℝ) + (-p)) by apply Finset.prod_congr rfl intro j hj ring] rw [Finset.prod_add] apply Finset.sum_congr rfl intro T hT have hsub := Finset.mem_powerset.mp hT rw [Finset.prod_const, Finset.prod_const, Finset.card_sdiff, Finset.inter_eq_left.mpr hsub] simp]] rfl
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinWeight_centered_moment · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:456
theorem locLinWeight_snipeScore_pair

The canonical local-linear weight paired with a SNIPE score has the stated expectation.

Formal statement
V :
G :
V → V → Prop
d β :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
i :
V
hcard :
(nbhd G i).card = d
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * snipeScore (fun j i => decide (G j i)) β p i z)
= blockEnergy β p d
Proof (Lean source)
lemma locLinWeight_snipeScore_pair {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) [DecidableRel G] (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (i : V) (hcard : (nbhd G i).card = d) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * snipeScore (fun j i => decide (G j i)) β p i z) = blockEnergy β p d := by classical have hN : nbhdB (fun j i => decide (G j i)) i = nbhd G i := by ext j simp [nbhdB, nbhd] simp only [snipeScore, Finset.mul_sum, FiniteDesign.E_sum] simp_rw [mul_left_comm, FiniteDesign.E_const_mul] rw [show (∑ r ∈ Icc 1 (effBeta β (nbhdB (fun j i => decide (G j i)) i).card), ∑ S ∈ (nbhdB (fun j i => decide (G j i)) i).powerset.filter (fun S => S.card = r), bernoulliContrast p r / (p * (1 - p)) ^ r * (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p))) = blockEnergy β p d by rw [hN, hcard] unfold blockEnergy apply Finset.sum_congr rfl intro r hr have hrle : r ≤ effBeta β d := (Finset.mem_Icc.mp hr).2 rw [show (∑ S ∈ (nbhd G i).powerset.filter (fun S => S.card = r), bernoulliContrast p r / (p * (1 - p)) ^ r * (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => w.weight i z * ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p))) = ∑ _S ∈ (nbhd G i).powersetCard r, bernoulliContrast p r / (p * (1 - p)) ^ r * bernoulliContrast p r by rw [show (nbhd G i).powerset.filter (fun S => S.card = r) = (nbhd G i).powersetCard r by ext S simp [Finset.mem_powersetCard]] apply Finset.sum_congr rfl intro S hS have hSmem := Finset.mem_powersetCard.mp hS have hSne : S.Nonempty := Finset.card_pos.mp (by have := (Finset.mem_Icc.mp hr).1 omega) have hdeg : S.card ≤ effBeta β d := by simpa [hSmem.2] using hrle congr 1 simpa [hSmem.2] using (locLinWeight_centered_moment (G := G) (d := d) (β := β) (p := p) (hp0 := hp0) (hp1 := hp1) (w := w) (i := i) (S := S) (hSne := hSne) (hSN := hSmem.1) (hScard := hdeg))] rw [Finset.sum_const, Finset.card_powersetCard, hcard] simp only [nsmul_eq_mul] ring]
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinWeight_snipeScore_pair · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part1.lean:568
Helpers.LocalLinearCompleteBlocks_Part2 7 declarations Identifies the units of a complete block with a graph neighbourhood and pins the blockwise extremal value from both sides, the upper bound being attained by the canonical weights.

The complete-block extremal value: lower and upper bounds

Identifies the units of a complete block with a graph neighbourhood and pins the blockwise extremal value from both sides, the upper bound being attained by the canonical weights.

theorem blockExtremal_all_empty_le

Establishes the stated mathematical result for block extremal all empty le.

Formal statement
V :
G :
V → V → Prop
d β :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
block :
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ block, w.weight i z) ^ 2)
blockExtremal G d β p hp0 hp1 w block
Proof (Lean source)
lemma blockExtremal_all_empty_le {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (block : Finset V) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ block, w.weight i z) ^ 2) ≤ blockExtremal G d β p hp0 hp1 w block := by classical unfold blockExtremal dsimp only convert Finset.le_sup' (s := Finset.univ.filter (fun choice => ∀ i ∈ block, choice.2 i ⊆ block ∧ (choice.2 i).card ≤ effBeta β d)) (f := fun choice => (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ block, (if choice.1 i then (1 : ℝ) else -1) * (w.weight i z * (∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) - if (choice.2 i).Nonempty then 1 else 0)) ^ 2)) (b := ((fun _ => true), (fun _ => ∅))) (by simp) using 1 case e'_2 => rfl case e'_3 => apply FiniteDesign.E_congr intro z simp
CausalSmith.Experimentation.SnipeDegreeFrontier.blockExtremal_all_empty_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part2.lean:21
theorem blockFirstUnit_mem_completeBlockUnits

Establishes the stated mathematical result for block first unit mem complete block units.

Formal statement
n d :
hd :
1 ≤ d
hdiv :
d ∣ n
b :
blockFirstUnit n d hd hdiv b ∈ completeBlockUnits n d b
Proof (Lean source)
lemma blockFirstUnit_mem_completeBlockUnits (n d : ℕ) (hd : 1 ≤ d) (hdiv : d ∣ n) (b : Fin (blockCount n d)) : blockFirstUnit n d hd hdiv b ∈ completeBlockUnits n d b := by have hactive : activeCount n d = n := activeCount_eq_of_dvd n d hdiv simp only [completeBlockUnits, mem_filter, Finset.mem_univ, true_and, blockFirstUnit] constructor · rw [hactive] exact (blockFirstUnit n d hd hdiv b).isLt · rw [Nat.mul_div_left] omega
CausalSmith.Experimentation.SnipeDegreeFrontier.blockFirstUnit_mem_completeBlockUnits · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part2.lean:54
theorem completeBlockUnits_eq_nbhd

Establishes the stated mathematical result for complete block units eq nbhd.

Formal statement
n d :
hdiv :
d ∣ n
b :
i :
Fin n
hi :
i ∈ completeBlockUnits n d b
completeBlockUnits n d b = nbhd (blockGraph n d) i
Proof (Lean source)
lemma completeBlockUnits_eq_nbhd (n d : ℕ) (hdiv : d ∣ n) (b : Fin (blockCount n d)) (i : Fin n) (hi : i ∈ completeBlockUnits n d b) : completeBlockUnits n d b = nbhd (blockGraph n d) i := by have hactive : activeCount n d = n := activeCount_eq_of_dvd n d hdiv have hib := (Finset.mem_filter.mp hi).2.2 ext j simp [completeBlockUnits, nbhd, blockGraph, hactive, i.isLt, j.isLt, hib]
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlockUnits_eq_nbhd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part2.lean:68
theorem completeBlockUnits_card

Establishes the stated mathematical result for complete block units card.

Formal statement
n d :
hd :
1 ≤ d
hdiv :
d ∣ n
b :
(completeBlockUnits n d b).card = d
Proof (Lean source)
lemma completeBlockUnits_card (n d : ℕ) (hd : 1 ≤ d) (hdiv : d ∣ n) (b : Fin (blockCount n d)) : (completeBlockUnits n d b).card = d := by rw [completeBlockUnits_eq_nbhd n d hdiv b (blockFirstUnit n d hd hdiv b) (blockFirstUnit_mem_completeBlockUnits n d hd hdiv b)] exact blockGraph_nbhd_card n d hd hdiv _
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlockUnits_card · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part2.lean:79
theorem snipeScore_eq_of_nbhd_eq

Establishes the stated mathematical result for snipe score eq of nbhd eq.

Formal statement
V :
G :
V → V → Prop
β :
p :
i k :
V
hN :
nbhd G i = nbhd G k
snipeScore (fun j i => decide (G j i)) β p i
= snipeScore (fun j i => decide (G j i)) β p k
Proof (Lean source)
lemma snipeScore_eq_of_nbhd_eq {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) [DecidableRel G] (β : ℕ) (p : ℝ) (i k : V) (hN : nbhd G i = nbhd G k) : snipeScore (fun j i => decide (G j i)) β p i = snipeScore (fun j i => decide (G j i)) β p k := by classical have hNB : nbhdB (fun j i => decide (G j i)) i = nbhdB (fun j i => decide (G j i)) k := by ext j simpa [nbhdB, nbhd] using Finset.ext_iff.mp hN j unfold snipeScore rw [hNB]
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore_eq_of_nbhd_eq · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part2.lean:89
theorem completeBlock_blockExtremal_lower

Establishes the stated mathematical result for complete block block extremal lower.

Formal statement
n d β :
p :
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)
b :
(d : ℝ) ^ 2 * blockEnergy β p d
blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b)
Proof (Lean source)
lemma completeBlock_blockExtremal_lower (n d β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)) (b : Fin (blockCount n d)) : (d : ℝ) ^ 2 * blockEnergy β p d ≤ blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) := by classical let D := bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1) let i₀ := blockFirstUnit n d hd hdiv b let g : (Fin n → Bool) → ℝ := snipeScore (fun j i => decide (blockGraph n d j i)) β p i₀ have hi₀ : i₀ ∈ completeBlockUnits n d b := blockFirstUnit_mem_completeBlockUnits n d hd hdiv b have hblockcard : (completeBlockUnits n d b).card = d := completeBlockUnits_card n d hd hdiv b have hN₀ : nbhd (blockGraph n d) i₀ = completeBlockUnits n d b := (completeBlockUnits_eq_nbhd n d hdiv b i₀ hi₀).symm have hgg : D.E (fun z => g z ^ 2) = blockEnergy β p d := by dsimp [D, g] rw [snipeScore_sq_expectation_global (hp0 := hp0) (hp1 := hp1)] congr 1 rw [show nbhdB (fun j i => decide (blockGraph n d j i)) i₀ = nbhd (blockGraph n d) i₀ by ext j simp [nbhdB, nbhd]] rw [hN₀, hblockcard] have hpair (i : Fin n) (hi : i ∈ completeBlockUnits n d b) : D.E (fun z => w.weight i z * g z) = blockEnergy β p d := by have hNi : nbhd (blockGraph n d) i = completeBlockUnits n d b := (completeBlockUnits_eq_nbhd n d hdiv b i hi).symm have hscore : snipeScore (fun j i => decide (blockGraph n d j i)) β p i = g := by dsimp [g] exact snipeScore_eq_of_nbhd_eq (blockGraph n d) β p i i₀ (hNi.trans hN₀.symm) rw [← hscore] exact locLinWeight_snipeScore_pair (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w i (by rw [hNi, hblockcard]) have hsumPair : D.E (fun z => (∑ i ∈ completeBlockUnits n d b, w.weight i z) * g z) = (d : ℝ) * blockEnergy β p d := by rw [show (fun z => (∑ i ∈ completeBlockUnits n d b, w.weight i z) * g z) = (fun z => ∑ i ∈ completeBlockUnits n d b, w.weight i z * g z) by funext z rw [Finset.sum_mul]] rw [FiniteDesign.E_sum] rw [show (∑ i ∈ completeBlockUnits n d b, D.E (fun z => w.weight i z * g z)) = ∑ _i ∈ completeBlockUnits n d b, blockEnergy β p d by apply Finset.sum_congr rfl intro i hi exact hpair i hi] rw [Finset.sum_const, hblockcard] simp have hsq : D.E (fun z => ((∑ i ∈ completeBlockUnits n d b, w.weight i z) - (d : ℝ) * g z) ^ 2) = D.E (fun z => (∑ i ∈ completeBlockUnits n d b, w.weight i z) ^ 2) - (d : ℝ) ^ 2 * blockEnergy β p d := by rw [show (fun z => ((∑ i ∈ completeBlockUnits n d b, w.weight i z) - (d : ℝ) * g z) ^ 2) = (fun z => (∑ i ∈ completeBlockUnits n d b, w.weight i z) ^ 2 - 2 * (d : ℝ) * ((∑ i ∈ completeBlockUnits n d b, w.weight i z) * g z) + (d : ℝ) ^ 2 * g z ^ 2) by funext z ring] rw [FiniteDesign.E_add, FiniteDesign.E_sub, FiniteDesign.E_const_mul, FiniteDesign.E_const_mul, hsumPair, hgg] ring have hnneg := D.E_nonneg (fun z => sq_nonneg ((∑ i ∈ completeBlockUnits n d b, w.weight i z) - (d : ℝ) * g z)) rw [hsq] at hnneg have hlower : (d : ℝ) ^ 2 * blockEnergy β p d ≤ D.E (fun z => (∑ i ∈ completeBlockUnits n d b, w.weight i z) ^ 2) := by linarith exact hlower.trans (by simpa [D] using blockExtremal_all_empty_le (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b))
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlock_blockExtremal_lower · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part2.lean:106
theorem canonical_completeBlock_blockExtremal_upper

Establishes the stated mathematical result for canonical complete block block extremal upper.

Formal statement
n d β :
p :
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
b :
blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv) (completeBlockUnits n d b)
≤ (d : ℝ) ^ 2 * blockEnergy β p d
Proof (Lean source)
lemma canonical_completeBlock_blockExtremal_upper (n d β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (b : Fin (blockCount n d)) : blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv) (completeBlockUnits n d b) ≤ (d : ℝ) ^ 2 * blockEnergy β p d := by classical let D := bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1) let w := canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv let i₀ := blockFirstUnit n d hd hdiv b let g : (Fin n → Bool) → ℝ := w.weight i₀ have hi₀ : i₀ ∈ completeBlockUnits n d b := blockFirstUnit_mem_completeBlockUnits n d hd hdiv b have hblockcard : (completeBlockUnits n d b).card = d := completeBlockUnits_card n d hd hdiv b have hN₀ : nbhd (blockGraph n d) i₀ = completeBlockUnits n d b := (completeBlockUnits_eq_nbhd n d hdiv b i₀ hi₀).symm have hweight (i : Fin n) (hi : i ∈ completeBlockUnits n d b) : w.weight i = g := by dsimp [w, g, canonicalLocLinWeights] exact snipeScore_eq_of_nbhd_eq (blockGraph n d) β p i i₀ ((completeBlockUnits_eq_nbhd n d hdiv b i hi).symm.trans hN₀.symm) have hgg : D.E (fun z => g z ^ 2) = blockEnergy β p d := by dsimp [D, g, w] exact canonicalLocLinWeights_energy n d β p hp0 hp1 hn hd hdiv i₀ unfold blockExtremal dsimp only apply Finset.sup'_le intro choice hchoice have hc : ∀ i ∈ completeBlockUnits n d b, choice.2 i ⊆ completeBlockUnits n d b ∧ (choice.2 i).card ≤ effBeta β d := by simpa using hchoice let f : (Fin n → Bool) → ℝ := fun z => ∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0 let L : ℝ := ∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * if (choice.2 i).Nonempty then 1 else 0 have hmean : D.E (fun z => g z * f z) = L := by rw [show (fun z => g z * f z) = (fun z => ∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * (g z * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0)) by funext z dsimp [f] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i hi ring] rw [FiniteDesign.E_sum] simp_rw [FiniteDesign.E_const_mul] dsimp [L] apply Finset.sum_congr rfl intro i hi congr 1 rw [← hweight i hi] by_cases hSne : (choice.2 i).Nonempty · rw [if_pos hSne] exact w.moment_one i (choice.2 i) hSne (((hc i hi).1).trans (by rw [completeBlockUnits_eq_nbhd n d hdiv b i hi])) (hc i hi).2 · rw [if_neg hSne] have hSe : choice.2 i = ∅ := Finset.not_nonempty_iff_eq_empty.mp hSne rw [hSe] simpa using w.mean_zero i have hfsq (z : Fin n → Bool) : f z ^ 2 ≤ (d : ℝ) ^ 2 := by have habs : |f z| ≤ (d : ℝ) := by calc |f z| ≤ ∑ i ∈ completeBlockUnits n d b, |(if choice.1 i then (1 : ℝ) else -1) * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0| := by dsimp [f] exact Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _i ∈ completeBlockUnits n d b, (1 : ℝ) := by apply Finset.sum_le_sum intro i hi rw [abs_mul] have hsign : |(if choice.1 i then (1 : ℝ) else -1)| = 1 := by by_cases h : choice.1 i <;> simp [h] rw [hsign, one_mul] have hmono0 : 0 ≤ ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0 := by apply Finset.prod_nonneg intro j hj by_cases hz : z j <;> simp [hz] rw [abs_of_nonneg hmono0] apply Finset.prod_le_one · intro j hj by_cases hz : z j <;> simp [hz] · intro j hj by_cases hz : z j <;> simp [hz] _ = (d : ℝ) := by rw [Finset.sum_const, hblockcard] simp have hd0 : 0 ≤ (d : ℝ) := by positivity have hmul := mul_self_le_mul_self (abs_nonneg (f z)) habs simpa [pow_two] using hmul have hgf : D.E (fun z => (g z * f z) ^ 2) ≤ (d : ℝ) ^ 2 * blockEnergy β p d := by have hpoint (z : Fin n → Bool) : 0 ≤ (d : ℝ) ^ 2 * g z ^ 2 - (g z * f z) ^ 2 := by have := hfsq z nlinarith [sq_nonneg (g z)] have hn := D.E_nonneg hpoint rw [FiniteDesign.E_sub, FiniteDesign.E_const_mul, hgg] at hn linarith have hvar : D.E (fun z => (g z * f z - L) ^ 2) ≤ D.E (fun z => (g z * f z) ^ 2) := by rw [show (fun z => (g z * f z - L) ^ 2) = (fun z => (g z * f z) ^ 2 - 2 * L * (g z * f z) + L ^ 2) by funext z ring] rw [FiniteDesign.E_add, FiniteDesign.E_sub, FiniteDesign.E_const_mul, FiniteDesign.E_const, hmean] nlinarith [sq_nonneg L] calc D.E (fun z => (∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * (w.weight i z * (∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) - if (choice.2 i).Nonempty then 1 else 0)) ^ 2) = D.E (fun z => (g z * f z - L) ^ 2) := by apply FiniteDesign.E_congr intro z congr 1 dsimp [f, L] rw [Finset.mul_sum, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro i hi rw [hweight i hi] ring _ ≤ D.E (fun z => (g z * f z) ^ 2) := hvar _ ≤ (d : ℝ) ^ 2 * blockEnergy β p d := hgf
CausalSmith.Experimentation.SnipeDegreeFrontier.canonical_completeBlock_blockExtremal_upper · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part2.lean:209
Helpers.LocalLinearCompleteBlocks_Part3 3 declarations A self-contained convexity chain: the absolute row sums of a signed convex combination are controlled by a signed supremum, and the supremum over rows of a quadratic form is attained at a signed extreme point.

Signed convex weights: absolute-sum bounds and extreme-point attainment

A self-contained convexity chain: the absolute row sums of a signed convex combination are controlled by a signed supremum, and the supremum over rows of a quadratic form is attained at a signed extreme point.

theorem absSum_signed_convex_weights

Establishes the stated mathematical result for abs sum signed convex weights.

Formal statement
K :
J :
hJ :
J.Nonempty
B :
hB :
0 < B
a :
K → ℝ
ha :
∑ j ∈ J, |a j| ≤ B
∃ lam : Bool × K → ℝ,
(∀ c, 0 ≤ lam c) ∧
(∀ c, c.2 ∉ J → lam c = 0) ∧
(∑ c, lam c) = 1 ∧
∀ (X : K → ℝ),
∑ c, lam c * ((if c.1 then (1 : ℝ) else -1) * B * X c.2) = ∑ j ∈ J, a j * X j
Proof (Lean source)
lemma absSum_signed_convex_weights {K : Type*} [Fintype K] [DecidableEq K] (J : Finset K) (hJ : J.Nonempty) (B : ℝ) (hB : 0 < B) (a : K → ℝ) (ha : ∑ j ∈ J, |a j| ≤ B) : ∃ lam : Bool × K → ℝ, (∀ c, 0 ≤ lam c) ∧ (∀ c, c.2 ∉ J → lam c = 0) ∧ (∑ c, lam c) = 1 ∧ ∀ (X : K → ℝ), ∑ c, lam c * ((if c.1 then (1 : ℝ) else -1) * B * X c.2) = ∑ j ∈ J, a j * X j := by classical let j₀ := hJ.choose have hj₀ : j₀ ∈ J := hJ.choose_spec let q : K → ℝ := fun j => |a j| / B let r : ℝ := 1 - ∑ j ∈ J, q j have hq (j : K) : 0 ≤ q j := div_nonneg (abs_nonneg _) hB.le have hr : 0 ≤ r := by dsimp [r, q] rw [sub_nonneg, ← Finset.sum_div] exact (div_le_one hB).2 ha let sgn : K → Bool := fun j => if 0 ≤ a j then true else false let lam : Bool × K → ℝ := fun c => (if c.2 ∈ J ∧ c.1 = sgn c.2 then q c.2 else 0) + if c.2 = j₀ then r / 2 else 0 refine ⟨lam, ?_, ?_, ?_, ?_⟩ · intro c dsimp [lam] positivity · intro c hc dsimp [lam] have hcj : c.2 ≠ j₀ := by intro h apply hc simpa [h] using hj₀ simp [hc, hcj] · rw [Fintype.sum_prod_type] rw [Finset.sum_comm] rw [show (∑ j : K, ∑ b : Bool, lam (b, j)) = (∑ j ∈ J, q j) + r by rw [show (∑ j : K, ∑ b : Bool, lam (b, j)) = ∑ j : K, ((if j ∈ J then q j else 0) + (if j = j₀ then r else 0)) by apply Finset.sum_congr rfl intro j hj by_cases hjJ : j ∈ J · by_cases hs : 0 ≤ a j <;> simp [lam, sgn, hs, hjJ, Bool.false_eq_true, Bool.true_eq_false] <;> split_ifs <;> ring · simp [lam, hjJ] split_ifs <;> ring] rw [Finset.sum_add_distrib] simp [hj₀]] dsimp [r] ring · intro X rw [Fintype.sum_prod_type] rw [Finset.sum_comm] rw [show (∑ j : K, ∑ b : Bool, lam (b, j) * ((if b then (1 : ℝ) else -1) * B * X j)) = ∑ j ∈ J, a j * X j by rw [show (∑ j ∈ J, a j * X j) = ∑ j : K, if j ∈ J then a j * X j else 0 by simp] apply Finset.sum_congr rfl intro j hjmem by_cases hj : j ∈ J · by_cases hs : 0 ≤ a j · have habs : |a j| = a j := abs_of_nonneg hs by_cases hj0 : j = j₀ · have hs0 : 0 ≤ a j₀ := by simpa [← hj0] using hs have habs0 : |a j₀| = a j₀ := abs_of_nonneg hs0 simp [lam, sgn, hj, hs, q, habs, hj0, hj₀, hs0, habs0] field_simp [hB.ne'] <;> ring · simp [lam, sgn, hj, hs, q, habs, hj0] field_simp [hB.ne'] <;> ring · have hs' : a j < 0 := lt_of_not_ge hs have habs : |a j| = -a j := abs_of_neg hs' by_cases hj0 : j = j₀ · have hs0 : ¬0 ≤ a j₀ := by simpa [← hj0] using hs have hs0' : a j₀ < 0 := lt_of_not_ge hs0 have habs0 : |a j₀| = -a j₀ := abs_of_neg hs0' simp [lam, sgn, hj, hs, q, habs, hj0, hj₀, hs0, habs0] field_simp [hB.ne'] <;> ring · simp [lam, sgn, hj, hs, q, habs, hj0] field_simp [hB.ne'] <;> ring · simp [lam, hj]]
CausalSmith.Experimentation.SnipeDegreeFrontier.absSum_signed_convex_weights · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part3.lean:22
theorem absSum_row_quadratic_le_signed_sup

Establishes the stated mathematical result for abs sum row quadratic le signed sup.

Formal statement
Ω K :
D :
J :
hJ :
J.Nonempty
B :
hB :
0 < B
a :
K → ℝ
ha :
∑ j ∈ J, |a j| ≤ B
X :
K → Ω → ℝ
Y :
Ω → ℝ
D.E (fun z => (Y z + ∑ j ∈ J, a j * X j z) ^ 2)
≤ (Finset.univ.filter (fun c : Bool × K => c.2 ∈ J)).sup' (by rcases hJ with ⟨j, hj⟩ exact ⟨(true, j), by simp [hj]⟩) (fun c => D.E (fun z => (Y z + (if c.1 then (1 : ℝ) else -1) * B * X c.2 z) ^ 2))
Proof (Lean source)
lemma absSum_row_quadratic_le_signed_sup {Ω K : Type*} [Fintype Ω] [Fintype K] [DecidableEq K] (D : FiniteDesign Ω) (J : Finset K) (hJ : J.Nonempty) (B : ℝ) (hB : 0 < B) (a : K → ℝ) (ha : ∑ j ∈ J, |a j| ≤ B) (X : K → Ω → ℝ) (Y : Ω → ℝ) : D.E (fun z => (Y z + ∑ j ∈ J, a j * X j z) ^ 2) ≤ (Finset.univ.filter (fun c : Bool × K => c.2 ∈ J)).sup' (by rcases hJ with ⟨j, hj⟩ exact ⟨(true, j), by simp [hj]⟩) (fun c => D.E (fun z => (Y z + (if c.1 then (1 : ℝ) else -1) * B * X c.2 z) ^ 2)) := by classical obtain ⟨lam, hlam0, hlamsupp, hlamsum, hlamrep⟩ := absSum_signed_convex_weights J hJ B hB a ha let C : Finset (Bool × K) := Finset.univ.filter (fun c : Bool × K => c.2 ∈ J) let Q : (Bool × K) → Ω → ℝ := fun c z => Y z + (if c.1 then (1 : ℝ) else -1) * B * X c.2 z have hrepr (z : Ω) : Y z + ∑ j ∈ J, a j * X j z = ∑ c, lam c * Q c z := by rw [show (Y z : ℝ) = ∑ c, lam c * Y z by rw [← Finset.sum_mul, hlamsum, one_mul]] rw [← hlamrep (fun j => X j z)] symm rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro c hc dsimp [Q] ring have hjensen (z : Ω) : (∑ c, lam c * Q c z) ^ 2 ≤ ∑ c, lam c * (Q c z) ^ 2 := by have hn : 0 ≤ ∑ c, lam c * (Q c z - ∑ e, lam e * Q e z) ^ 2 := by apply sum_nonneg intro c hc exact mul_nonneg (hlam0 c) (sq_nonneg _) rw [show (∑ c, lam c * (Q c z - ∑ e, lam e * Q e z) ^ 2) = (∑ c, lam c * (Q c z) ^ 2) - (∑ c, lam c * Q c z) ^ 2 by let m := ∑ e, lam e * Q e z have hexpand : (∑ c, lam c * (Q c z - m) ^ 2) = (∑ c, lam c * (Q c z) ^ 2) - 2 * m * (∑ c, lam c * Q c z) + m ^ 2 * ∑ c, lam c := by rw [show (∑ c, lam c * (Q c z - m) ^ 2) = ∑ c, ((lam c * (Q c z) ^ 2 - 2 * m * (lam c * Q c z)) + m ^ 2 * lam c) by apply Finset.sum_congr rfl intro c hc ring] rw [Finset.sum_add_distrib, Finset.sum_sub_distrib] rw [← Finset.mul_sum, ← Finset.mul_sum] rw [hexpand] rw [hlamsum] dsimp [m] ring] at hn linarith rw [show (fun z => (Y z + ∑ j ∈ J, a j * X j z) ^ 2) = (fun z => (∑ c, lam c * Q c z) ^ 2) by funext z rw [hrepr z]] calc D.E (fun z => (∑ c, lam c * Q c z) ^ 2) ≤ D.E (fun z => ∑ c, lam c * (Q c z) ^ 2) := by have hp (z : Ω) : 0 ≤ (∑ c, lam c * (Q c z) ^ 2) - (∑ c, lam c * Q c z) ^ 2 := sub_nonneg.mpr (hjensen z) have hn := D.E_nonneg hp rw [FiniteDesign.E_sub] at hn linarith _ = ∑ c, lam c * D.E (fun z => (Q c z) ^ 2) := by rw [FiniteDesign.E_sum] apply Finset.sum_congr rfl intro c hc rw [FiniteDesign.E_const_mul] _ ≤ ∑ c, lam c * (C.sup' (by rcases hJ with ⟨j, hj⟩ exact ⟨(true, j), by simp [C, hj]⟩) (fun c => D.E (fun z => (Q c z) ^ 2))) := by apply Finset.sum_le_sum intro c hc by_cases hcC : c ∈ C · exact mul_le_mul_of_nonneg_left (Finset.le_sup' (fun c => D.E (fun z => (Q c z) ^ 2)) hcC) (hlam0 c) · have hzero : lam c = 0 := by apply hlamsupp simpa [C] using hcC rw [hzero] simp _ = C.sup' (by rcases hJ with ⟨j, hj⟩ exact ⟨(true, j), by simp [C, hj]⟩) (fun c => D.E (fun z => (Q c z) ^ 2)) := by rw [← Finset.sum_mul, hlamsum, one_mul] _ = (Finset.univ.filter (fun c : Bool × K => c.2 ∈ J)).sup' (by rcases hJ with ⟨j, hj⟩ exact ⟨(true, j), by simp [hj]⟩) (fun c => D.E (fun z => (Y z + (if c.1 then (1 : ℝ) else -1) * B * X c.2 z) ^ 2)) := by rfl
CausalSmith.Experimentation.SnipeDegreeFrontier.absSum_row_quadratic_le_signed_sup · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part3.lean:118
theorem absSum_rows_quadratic_exists_signed_extreme

Establishes the stated mathematical result for abs sum rows quadratic exists signed extreme.

Formal statement
D :
rows :
J :
I → Finset K
hJ :
∀ i, (J i).Nonempty
B :
hB :
0 < B
a :
I → K → ℝ
ha :
∀ i ∈ rows, ∑ j ∈ J i, |a i j| ≤ B
X :
I → K → Ω → ℝ
Y :
Ω → ℝ
∃ c : I → Bool × K,
(∀ i ∈ rows, (c i).2 ∈ J i) ∧
D.E (fun z => (Y z + ∑ i ∈ rows, ∑ j ∈ J i, a i j * X i j z) ^ 2)
≤ D.E (fun z => (Y z + ∑ i ∈ rows, (if (c i).1 then (1 : ℝ) else -1) * B * X i (c i).2 z) ^ 2)
Proof (Lean source)
lemma absSum_rows_quadratic_exists_signed_extreme {Ω I K : Type*} [Fintype Ω] [Fintype I] [Fintype K] [DecidableEq I] [DecidableEq K] (D : FiniteDesign Ω) (rows : Finset I) (J : I → Finset K) (hJ : ∀ i, (J i).Nonempty) (B : ℝ) (hB : 0 < B) (a : I → K → ℝ) (ha : ∀ i ∈ rows, ∑ j ∈ J i, |a i j| ≤ B) (X : I → K → Ω → ℝ) (Y : Ω → ℝ) : ∃ c : I → Bool × K, (∀ i ∈ rows, (c i).2 ∈ J i) ∧ D.E (fun z => (Y z + ∑ i ∈ rows, ∑ j ∈ J i, a i j * X i j z) ^ 2) ≤ D.E (fun z => (Y z + ∑ i ∈ rows, (if (c i).1 then (1 : ℝ) else -1) * B * X i (c i).2 z) ^ 2) := by classical induction rows using Finset.induction_on generalizing Y with | empty => let c : I → Bool × K := fun i => (true, (hJ i).choose) refine ⟨c, ?_, ?_⟩ · intro i hi simp at hi · simp | @insert i rows hi ih => let Yrest : Ω → ℝ := fun z => Y z + ∑ k ∈ rows, ∑ j ∈ J k, a k j * X k j z let C : Finset (Bool × K) := Finset.univ.filter (fun c : Bool × K => c.2 ∈ J i) have hC : C.Nonempty := by rcases hJ i with ⟨j, hj⟩ exact ⟨(true, j), by simp [C, hj]⟩ have hrow := absSum_row_quadratic_le_signed_sup D (J i) (hJ i) B hB (a i) (ha i (by simp)) (X i) Yrest obtain ⟨ci, hciC, hciMax⟩ := Finset.exists_mem_eq_sup' hC (fun c : Bool × K => D.E (fun z => (Yrest z + (if c.1 then (1 : ℝ) else -1) * B * X i c.2 z) ^ 2)) have hrow' : D.E (fun z => (Yrest z + ∑ j ∈ J i, a i j * X i j z) ^ 2) ≤ D.E (fun z => (Yrest z + (if ci.1 then (1 : ℝ) else -1) * B * X i ci.2 z) ^ 2) := by rw [← hciMax] exact hrow let Yi : Ω → ℝ := fun z => Y z + (if ci.1 then (1 : ℝ) else -1) * B * X i ci.2 z have haRows : ∀ k ∈ rows, ∑ j ∈ J k, |a k j| ≤ B := by intro k hk exact ha k (by simp [hk]) obtain ⟨c, hcJ, hcBound⟩ := ih haRows Yi let c' : I → Bool × K := update c i ci refine ⟨c', ?_, ?_⟩ · intro k hk rcases Finset.mem_insert.mp hk with hki | hk · subst k simpa [c'] using (show ci.2 ∈ J i by simpa [C] using hciC) · have hne : k ≠ i := by intro h apply hi simpa [h] using hk simpa [c', hne] using hcJ k hk · calc D.E (fun z => (Y z + ∑ k ∈ insert i rows, ∑ j ∈ J k, a k j * X k j z) ^ 2) = D.E (fun z => (Yrest z + ∑ j ∈ J i, a i j * X i j z) ^ 2) := by congr 1 funext z rw [Finset.sum_insert hi] simp only [Yrest] ring _ ≤ D.E (fun z => (Yrest z + (if ci.1 then (1 : ℝ) else -1) * B * X i ci.2 z) ^ 2) := hrow' _ = D.E (fun z => (Yi z + ∑ k ∈ rows, ∑ j ∈ J k, a k j * X k j z) ^ 2) := by congr 1 funext z simp only [Yrest, Yi] ring _ ≤ D.E (fun z => (Yi z + ∑ k ∈ rows, (if (c k).1 then (1 : ℝ) else -1) * B * X k (c k).2 z) ^ 2) := hcBound _ = D.E (fun z => (Y z + ∑ k ∈ insert i rows, (if (c' k).1 then (1 : ℝ) else -1) * B * X k (c' k).2 z) ^ 2) := by congr 1 funext z rw [Finset.sum_insert hi] simp only [Yi] have hc'i : c' i = ci := by simp [c'] rw [hc'i] have hsum : ∑ k ∈ rows, (if ((update c i ci) k).1 then (1 : ℝ) else -1) * B * X k ((update c i ci) k).2 z = ∑ k ∈ rows, (if (c k).1 then (1 : ℝ) else -1) * B * X k (c k).2 z := by apply Finset.sum_congr rfl intro k hk have hne : k ≠ i := by intro h apply hi simpa [h] using hk simp [hne] rw [hsum] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.absSum_rows_quadratic_exists_signed_extreme · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part3.lean:238
Helpers.LocalLinearCompleteBlocks_Part4 12 declarations Defines the eligible block sets and the block-schedule estimation error, proves it is mean zero and depends only on its own block, and decomposes the local-linear risk at a schedule into a sum of blockwise contributions.

The block-schedule error and the blockwise risk decomposition

Defines the eligible block sets and the block-schedule estimation error, proves it is mean zero and depends only on its own block, and decomposes the local-linear risk at a schedule into a sum of blockwise contributions.

def eligibleBlockSets

Defines eligible block sets.

Definition (Lean source)
noncomputable def eligibleBlockSets {V : Type*} [Fintype V] [DecidableEq V] (d β : ℕ) (block : Finset V) : Finset (Finset V) := block.powerset.filter (fun S => S.card ≤ effBeta β d)
def blockScheduleError

Defines block schedule error.

Definition (Lean source)
noncomputable def blockScheduleError {V : Type*} [Fintype V] [DecidableEq V] {G : V → V → Prop} {d β : ℕ} {B p : ℝ} {hp0 : 0 ≤ p} {hp1 : p ≤ 1} (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) (block : Finset V) (z : V → Bool) : ℝ := ∑ i ∈ block, ∑ S ∈ eligibleBlockSets d β block, M.coef i S * locLinUnitError w i S z
theorem locLinUnitError_mean_zero

Establishes the stated mathematical result for loc lin unit error mean zero.

Formal statement
V :
G :
V → V → Prop
d β :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
i :
V
S :
hSN :
S ⊆ nbhd G i
hScard :
S.card ≤ effBeta β d
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (locLinUnitError w i S)
= 0
Proof (Lean source)
lemma locLinUnitError_mean_zero {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (i : V) (S : Finset V) (hSN : S ⊆ nbhd G i) (hScard : S.card ≤ effBeta β d) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (locLinUnitError w i S) = 0 := by unfold locLinUnitError rw [FiniteDesign.E_sub, FiniteDesign.E_const] by_cases hSne : S.Nonempty · rw [if_pos hSne, w.moment_one i S hSne hSN hScard] ring · rw [if_neg hSne] simpa [Finset.not_nonempty_iff_eq_empty.mp hSne] using w.mean_zero i
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinUnitError_mean_zero · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:40
theorem blockScheduleError_mean_zero

Establishes the stated mathematical result for block schedule error mean zero.

Formal statement
V :
G :
V → V → Prop
d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
M :
block :
hblock :
∀ i ∈ block, block = nbhd G i
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (blockScheduleError w M block)
= 0
Proof (Lean source)
lemma blockScheduleError_mean_zero {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) (block : Finset V) (hblock : ∀ i ∈ block, block = nbhd G i) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (blockScheduleError w M block) = 0 := by classical unfold blockScheduleError rw [FiniteDesign.E_sum] apply Finset.sum_eq_zero intro i hi rw [FiniteDesign.E_sum] apply Finset.sum_eq_zero intro S hS rw [FiniteDesign.E_const_mul] rw [locLinUnitError_mean_zero G d β p hp0 hp1 w i S] · ring · have hsub : S ⊆ block := Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1 simpa [hblock i hi] using hsub · exact (Finset.mem_filter.mp hS).2
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScheduleError_mean_zero · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:58
theorem blockScheduleError_local

Establishes the stated mathematical result for block schedule error local.

Formal statement
V :
G :
V → V → Prop
d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
M :
block :
hblock :
∀ i ∈ block, block = nbhd G i
z z' :
V → Bool
hzz :
∀ j ∈ block, z j = z' j
blockScheduleError w M block z = blockScheduleError w M block z'
Proof (Lean source)
lemma blockScheduleError_local {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) (block : Finset V) (hblock : ∀ i ∈ block, block = nbhd G i) (z z' : V → Bool) (hzz : ∀ j ∈ block, z j = z' j) : blockScheduleError w M block z = blockScheduleError w M block z' := by classical unfold blockScheduleError apply Finset.sum_congr rfl intro i hi apply Finset.sum_congr rfl intro S hS congr 1 unfold locLinUnitError have hw : w.weight i z = w.weight i z' := by apply w.local_dep i z z' intro j hj exact hzz j (by simpa [hblock i hi] using hj) rw [hw] congr 2 apply Finset.prod_congr rfl intro j hj rw [hzz j] exact Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1 hj
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScheduleError_local · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:85
theorem completeBlockUnits_disjoint

Establishes the stated mathematical result for complete block units disjoint.

Formal statement
n d :
b c :
hbc :
b ≠ c
Proof (Lean source)
lemma completeBlockUnits_disjoint (n d : ℕ) (b c : Fin (blockCount n d)) (hbc : b ≠ c) : Disjoint (completeBlockUnits n d b) (completeBlockUnits n d c) := by rw [Finset.disjoint_left] intro i hib hic apply hbc apply Fin.ext exact ((Finset.mem_filter.mp hib).2.2).symm.trans (Finset.mem_filter.mp hic).2.2
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlockUnits_disjoint · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:116
theorem sum_completeBlockUnits

Establishes the stated mathematical result for sum complete block units.

Formal statement
n d :
hd :
1 ≤ d
hdiv :
d ∣ n
f :
Fin n → ℝ
∑ b : Fin (blockCount n d), ∑ i ∈ completeBlockUnits n d b, f i = ∑ i : Fin n, f i
Proof (Lean source)
lemma sum_completeBlockUnits (n d : ℕ) (hd : 1 ≤ d) (hdiv : d ∣ n) (f : Fin n → ℝ) : ∑ b : Fin (blockCount n d), ∑ i ∈ completeBlockUnits n d b, f i = ∑ i : Fin n, f i := by classical have hactive : activeCount n d = n := activeCount_eq_of_dvd n d hdiv let idx : Fin n → Fin (blockCount n d) := fun i => ⟨i.val / d, by simp only [blockCount] rw [div_lt_iff_lt_mul (by omega)] simpa [Nat.div_mul_cancel hdiv] using i.isLt⟩ unfold completeBlockUnits simp_rw [hactive] simp only [Finset.sum_filter, Finset.mem_univ, true_and] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro i hi rw [Finset.sum_eq_single (idx i)] · simp [idx, i.isLt] · intro b hb hbi have hne : b.val ≠ i.val / d := by intro h apply hbi apply Fin.ext simpa [idx] using h have hne' : i.val / d ≠ b.val := Ne.symm hne simp [i.isLt, hne'] · intro h exact (h (Finset.mem_univ _)).elim
CausalSmith.Experimentation.SnipeDegreeFrontier.sum_completeBlockUnits · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:127
theorem completeBlock_scheduleError_mul_zero

Establishes the stated mathematical result for complete block schedule error mul zero.

Formal statement
n d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p hp0 hp1
M :
b c :
hbc :
b ≠ c
(bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z * blockScheduleError w M (completeBlockUnits n d c) z)
= 0
Proof (Lean source)
lemma completeBlock_scheduleError_mul_zero (n d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) (M : LocLinSchedClass (blockGraph n d) d β B) (b c : Fin (blockCount n d)) (hbc : b ≠ c) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z * blockScheduleError w M (completeBlockUnits n d c) z) = 0 := by classical let Db : ∀ _i : Fin n, FiniteDesign Bool := fun _ => coinDesign p hp0 hp1 have hbLocal : ∀ z z' : Fin n → Bool, (∀ i ∈ completeBlockUnits n d b, z i = z' i) → blockScheduleError w M (completeBlockUnits n d b) z = blockScheduleError w M (completeBlockUnits n d b) z' := by intro z z' hzz exact blockScheduleError_local (blockGraph n d) d β B p hp0 hp1 w M (completeBlockUnits n d b) (fun i hi => completeBlockUnits_eq_nbhd n d hdiv b i hi) z z' hzz have hcLocal : ∀ z z' : Fin n → Bool, (∀ i ∉ completeBlockUnits n d b, z i = z' i) → blockScheduleError w M (completeBlockUnits n d c) z = blockScheduleError w M (completeBlockUnits n d c) z' := by intro z z' hzz apply blockScheduleError_local (blockGraph n d) d β B p hp0 hp1 w M (completeBlockUnits n d c) (fun i hi => completeBlockUnits_eq_nbhd n d hdiv c i hi) intro i hic exact hzz i (fun hib => Finset.disjoint_left.mp (completeBlockUnits_disjoint n d b c hbc) hib hic) change (prodDesign Db).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z * blockScheduleError w M (completeBlockUnits n d c) z) = 0 rw [FiniteDesign.E_prod_block_mul Db (completeBlockUnits n d b) (blockScheduleError w M (completeBlockUnits n d b)) (blockScheduleError w M (completeBlockUnits n d c)) hbLocal hcLocal] rw [show (prodDesign Db).E (blockScheduleError w M (completeBlockUnits n d b)) = 0 by change (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (blockScheduleError w M (completeBlockUnits n d b)) = 0 exact blockScheduleError_mean_zero (blockGraph n d) d β B p hp0 hp1 w M (completeBlockUnits n d b) (fun i hi => completeBlockUnits_eq_nbhd n d hdiv b i hi)] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlock_scheduleError_mul_zero · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:159
theorem E_completeBlock_scheduleError_sum_sq

Establishes the stated mathematical result for e complete block schedule error sum sq.

Formal statement
n d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p hp0 hp1
M :
(bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ b : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z) ^ 2)
= ∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z ^ 2)
Proof (Lean source)
lemma E_completeBlock_scheduleError_sum_sq (n d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) (M : LocLinSchedClass (blockGraph n d) d β B) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ b : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z) ^ 2) = ∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z ^ 2) := by classical let Db := bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1) rw [show (fun z => (∑ b : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z) ^ 2) = (fun z => ∑ b : Fin (blockCount n d), ∑ c : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z * blockScheduleError w M (completeBlockUnits n d c) z) by funext z simp only [pow_two, Finset.sum_mul, Finset.mul_sum] rw [Finset.sum_comm]] rw [FiniteDesign.E_sum] apply Finset.sum_congr rfl intro b hb rw [FiniteDesign.E_sum, Finset.sum_eq_single b] · simp [pow_two] · intro c hc hcb exact completeBlock_scheduleError_mul_zero n d β B p hp0 hp1 hd hdiv w M b c (Ne.symm hcb) · intro hb' exact (hb' (Finset.mem_univ b)).elim
CausalSmith.Experimentation.SnipeDegreeFrontier.E_completeBlock_scheduleError_sum_sq · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:221
theorem schedule_inner_eq_eligible

Establishes the stated mathematical result for schedule inner eq eligible.

Formal statement
V :
G :
V → V → Prop
d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
M :
i :
V
block :
hblock :
block = nbhd G i
z :
V → Bool
∑ S ∈ (nbhd G i).powerset, M.coef i S * locLinUnitError w i S z
= ∑ S ∈ eligibleBlockSets d β block, M.coef i S * locLinUnitError w i S z
Proof (Lean source)
lemma schedule_inner_eq_eligible {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) (i : V) (block : Finset V) (hblock : block = nbhd G i) (z : V → Bool) : ∑ S ∈ (nbhd G i).powerset, M.coef i S * locLinUnitError w i S z = ∑ S ∈ eligibleBlockSets d β block, M.coef i S * locLinUnitError w i S z := by classical subst block unfold eligibleBlockSets symm rw [Finset.sum_filter] apply Finset.sum_congr rfl intro S hS by_cases hcard : S.card ≤ effBeta β d · simp [hcard] · have hzero : M.coef i S = 0 := by apply M.low_order i S omega simp [hcard, hzero]
CausalSmith.Experimentation.SnipeDegreeFrontier.schedule_inner_eq_eligible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:262
theorem sum_blockScheduleError_eq_total

Establishes the stated mathematical result for sum block schedule error eq total.

Formal statement
n d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p hp0 hp1
M :
z :
Fin n → Bool
= ∑ i : Fin n, ∑ S ∈ (nbhd (blockGraph n d) i).powerset, M.coef i S * locLinUnitError w i S z
Proof (Lean source)
lemma sum_blockScheduleError_eq_total (n d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) (M : LocLinSchedClass (blockGraph n d) d β B) (z : Fin n → Bool) : ∑ b : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z = ∑ i : Fin n, ∑ S ∈ (nbhd (blockGraph n d) i).powerset, M.coef i S * locLinUnitError w i S z := by classical rw [← sum_completeBlockUnits n d hd hdiv (fun i => ∑ S ∈ (nbhd (blockGraph n d) i).powerset, M.coef i S * locLinUnitError w i S z)] apply Finset.sum_congr rfl intro b hb unfold blockScheduleError apply Finset.sum_congr rfl intro i hi exact (schedule_inner_eq_eligible (blockGraph n d) d β B p hp0 hp1 w M i (completeBlockUnits n d b) (completeBlockUnits_eq_nbhd n d hdiv b i hi) z).symm
CausalSmith.Experimentation.SnipeDegreeFrontier.sum_blockScheduleError_eq_total · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:289
theorem locLinRiskAt_block_decomposition

Establishes the stated mathematical result for loc lin risk at block decomposition.

Formal statement
n d β :
B p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p hp0 hp1
M :
locLinRiskAt (blockGraph n d) d β B p hp0 hp1 w M
= (n : ℝ)⁻¹ ^ 2 * ∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z ^ 2)
Proof (Lean source)
lemma locLinRiskAt_block_decomposition (n d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) (M : LocLinSchedClass (blockGraph n d) d β B) : locLinRiskAt (blockGraph n d) d β B p hp0 hp1 w M = (n : ℝ)⁻¹ ^ 2 * ∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z ^ 2) := by classical unfold locLinRiskAt FiniteDesign.mse rw [show (fun z => (locLinEstimator (blockGraph n d) d β p hp0 hp1 w z (obsOutcome (blockGraph n d) M.coef z) - tte (blockGraph n d) M.coef) ^ 2) = (fun z => ((n : ℝ)⁻¹ * ∑ b : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z) ^ 2) by funext z rw [locLinEstimator_error_expansion (blockGraph n d) d β B p hp0 hp1 w M z] simp only [Fintype.card_fin] rw [sum_blockScheduleError_eq_total n d β B p hp0 hp1 hd hdiv w M z]] rw [show (fun z => ((n : ℝ)⁻¹ * ∑ b : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z) ^ 2) = (fun z => (n : ℝ)⁻¹ ^ 2 * (∑ b : Fin (blockCount n d), blockScheduleError w M (completeBlockUnits n d b) z) ^ 2) by funext z ring] rw [FiniteDesign.E_const_mul, E_completeBlock_scheduleError_sum_sq n d β B p hp0 hp1 hd hdiv w M]
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinRiskAt_block_decomposition · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part4.lean:314
Helpers.LocalLinearCompleteBlocks_Part5 6 declarations Bounds each blockwise squared error by the block extremal value, constructs the extreme block schedule attaining it, and evaluates the worst-case local-linear risk exactly in terms of the blockwise extremal values.

Exact worst-case local-linear risk via extreme block schedules

Bounds each blockwise squared error by the block extremal value, constructs the extreme block schedule attaining it, and evaluates the worst-case local-linear risk exactly in terms of the blockwise extremal values.

theorem blockScheduleError_sq_le_extremal

Establishes the stated mathematical result for block schedule error sq le extremal.

Formal statement
V :
G :
V → V → Prop
d β :
B p :
hB :
0 < B
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
M :
block :
hblock :
∀ i ∈ block, block = nbhd G i
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M block z ^ 2)
≤ B ^ 2 * blockExtremal G d β p hp0 hp1 w block
Proof (Lean source)
lemma blockScheduleError_sq_le_extremal {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (B p : ℝ) (hB : 0 < B) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (M : LocLinSchedClass G d β B) (block : Finset V) (hblock : ∀ i ∈ block, block = nbhd G i) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M block z ^ 2) ≤ B ^ 2 * blockExtremal G d β p hp0 hp1 w block := by classical let D := bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1) let J : V → Finset (Finset V) := fun _ => eligibleBlockSets d β block have hJ : ∀ i, (J i).Nonempty := by intro i refine ⟨∅, ?_⟩ simp [J, eligibleBlockSets] have ha : ∀ i ∈ block, ∑ S ∈ J i, |M.coef i S| ≤ B := by intro i hi calc ∑ S ∈ J i, |M.coef i S| ≤ ∑ S ∈ (nbhd G i).powerset, |M.coef i S| := by apply Finset.sum_le_sum_of_subset_of_nonneg · intro S hS have hsub : S ⊆ block := Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1 have : S ⊆ nbhd G i := by simpa [← hblock i hi] using hsub exact Finset.mem_powerset.mpr this · intro S hS hnot exact abs_nonneg _ _ ≤ B := M.mass_le i obtain ⟨c, hcJ, hcBound⟩ := absSum_rows_quadratic_exists_signed_extreme D block J hJ B hB M.coef ha (fun i S => locLinUnitError w i S) (fun _ => 0) let choice : (V → Bool) × (V → Finset V) := (fun i => (c i).1, fun i => (c i).2) have hchoice : choice ∈ Finset.univ.filter (fun choice => ∀ i ∈ block, choice.2 i ⊆ block ∧ (choice.2 i).card ≤ effBeta β d) := by simp only [mem_filter, Finset.mem_univ, true_and] intro i hi have hc := hcJ i hi exact ⟨Finset.mem_powerset.mp (Finset.mem_filter.mp hc).1, (Finset.mem_filter.mp hc).2⟩ have hextreme : D.E (fun z => (∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * B * locLinUnitError w i (c i).2 z) ^ 2) = B ^ 2 * D.E (fun z => (∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * locLinUnitError w i (c i).2 z) ^ 2) := by rw [show (fun z => (∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * B * locLinUnitError w i (c i).2 z) ^ 2) = (fun z => B ^ 2 * (∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * locLinUnitError w i (c i).2 z) ^ 2) by funext z rw [show (∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * B * locLinUnitError w i (c i).2 z) = B * ∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * locLinUnitError w i (c i).2 z by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i hi ring] ring] rw [FiniteDesign.E_const_mul] calc D.E (fun z => blockScheduleError w M block z ^ 2) ≤ D.E (fun z => (∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * B * locLinUnitError w i (c i).2 z) ^ 2) := by simpa [D, J, blockScheduleError] using hcBound _ = B ^ 2 * D.E (fun z => (∑ i ∈ block, (if (c i).1 then (1 : ℝ) else -1) * locLinUnitError w i (c i).2 z) ^ 2) := hextreme _ ≤ B ^ 2 * blockExtremal G d β p hp0 hp1 w block := by apply mul_le_mul_of_nonneg_left · unfold blockExtremal dsimp only convert Finset.le_sup' (f := fun choice => D.E (fun z => (∑ i ∈ block, (if choice.1 i then (1 : ℝ) else -1) * (w.weight i z * (∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) - if (choice.2 i).Nonempty then 1 else 0)) ^ 2)) hchoice using 1 rfl · positivity
CausalSmith.Experimentation.SnipeDegreeFrontier.blockScheduleError_sq_le_extremal · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part5.lean:24
def extremeBlockSchedule

Defines extreme block schedule.

Definition (Lean source)
noncomputable def extremeBlockSchedule (n d β : ℕ) (B : ℝ) (hd : 1 ≤ d) (hdiv : d ∣ n) (choice : Fin (blockCount n d) → (Fin n → Bool) × (Fin n → Finset (Fin n))) (hchoice : ∀ b i, i ∈ completeBlockUnits n d b → (choice b).2 i ⊆ completeBlockUnits n d b ∧ ((choice b).2 i).card ≤ effBeta β d) (hB : 0 ≤ B) : LocLinSchedClass (blockGraph n d) d β B := by classical let idx := completeBlockIndex n d hd hdiv let coef : Fin n → Finset (Fin n) → ℝ := fun i S => if S = (choice (idx i)).2 i then (if (choice (idx i)).1 i then (1 : ℝ) else -1) * B else 0 refine { coef := coef supported := ?_ low_order := ?_ mass_le := ?_ } · intro i S hS by_cases heq : S = (choice (idx i)).2 i · exfalso apply hS subst S have hc := hchoice (idx i) i (mem_completeBlockIndex n d hd hdiv i) exact hc.1.trans (by rw [completeBlockUnits_eq_nbhd n d hdiv (idx i) i (mem_completeBlockIndex n d hd hdiv i)]) · simp [coef, heq] · intro i S hcard by_cases heq : S = (choice (idx i)).2 i · have hc := (hchoice (idx i) i (mem_completeBlockIndex n d hd hdiv i)).2 subst S omega · simp [coef, heq] · intro i have hmem : (choice (idx i)).2 i ∈ (nbhd (blockGraph n d) i).powerset := by apply Finset.mem_powerset.mpr exact (hchoice (idx i) i (mem_completeBlockIndex n d hd hdiv i)).1.trans (by rw [completeBlockUnits_eq_nbhd n d hdiv (idx i) i (mem_completeBlockIndex n d hd hdiv i)]) rw [Finset.sum_eq_single ((choice (idx i)).2 i)] · cases hs : (choice (idx i)).1 i <;> simp [coef, hs, abs_of_nonneg hB] · intro S hS hne simp [coef, hne] · intro hnot exact (hnot hmem).elim
theorem extremeBlockSchedule_blockError

Establishes the stated mathematical result for extreme block schedule block error.

Formal statement
n d β :
B p :
hd :
1 ≤ d
hdiv :
d ∣ n
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights (blockGraph n d) d β p hp0 hp1
choice :
Fin (blockCount n d) → (Fin n → Bool) × (Fin n → Finset (Fin n))
hchoice :
∀ b i
if
i ∈ completeBlockUnits n d b
then
(choice b).2 i ⊆ completeBlockUnits n d b ∧ ((choice b).2 i).card ≤ effBeta β d
hB :
0 ≤ B
b :
z :
Fin n → Bool
blockScheduleError w (extremeBlockSchedule n d β B hd hdiv choice hchoice hB) (completeBlockUnits n d b) z
= B * ∑ i ∈ completeBlockUnits n d b, (if (choice b).1 i then (1 : ℝ) else -1) * locLinUnitError w i ((choice b).2 i) z
Proof (Lean source)
lemma extremeBlockSchedule_blockError (n d β : ℕ) (B p : ℝ) (hd : 1 ≤ d) (hdiv : d ∣ n) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) (choice : Fin (blockCount n d) → (Fin n → Bool) × (Fin n → Finset (Fin n))) (hchoice : ∀ b i, i ∈ completeBlockUnits n d b → (choice b).2 i ⊆ completeBlockUnits n d b ∧ ((choice b).2 i).card ≤ effBeta β d) (hB : 0 ≤ B) (b : Fin (blockCount n d)) (z : Fin n → Bool) : blockScheduleError w (extremeBlockSchedule n d β B hd hdiv choice hchoice hB) (completeBlockUnits n d b) z = B * ∑ i ∈ completeBlockUnits n d b, (if (choice b).1 i then (1 : ℝ) else -1) * locLinUnitError w i ((choice b).2 i) z := by classical unfold blockScheduleError rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i hi have hidx : completeBlockIndex n d hd hdiv i = b := by apply Fin.ext exact (Finset.mem_filter.mp hi).2.2 rw [Finset.sum_eq_single ((choice b).2 i)] · simp only [extremeBlockSchedule, hidx, if_pos rfl] simp only [if_true] ring · intro S hS hne simp [extremeBlockSchedule, hidx, hne] · intro hnot have hc := hchoice b i hi have hmem : (choice b).2 i ∈ eligibleBlockSets d β (completeBlockUnits n d b) := by simp [eligibleBlockSets, hc.1, hc.2] exact (hnot hmem).elim
CausalSmith.Experimentation.SnipeDegreeFrontier.extremeBlockSchedule_blockError · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part5.lean:191
theorem exists_blockExtremal_choice

Establishes the stated mathematical result for exists block extremal choice.

Formal statement
V :
G :
V → V → Prop
d β :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
w :
LocLinWeights G d β p hp0 hp1
block :
∃ choice : (V → Bool) × (V → Finset V),
(∀ i ∈ block, choice.2 i ⊆ block ∧ (choice.2 i).card ≤ effBeta β d) ∧
blockExtremal G d β p hp0 hp1 w block
= (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ block, (if choice.1 i then (1 : ℝ) else -1) * locLinUnitError w i (choice.2 i) z) ^ 2)
Proof (Lean source)
lemma exists_blockExtremal_choice {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights G d β p hp0 hp1) (block : Finset V) : ∃ choice : (V → Bool) × (V → Finset V), (∀ i ∈ block, choice.2 i ⊆ block ∧ (choice.2 i).card ≤ effBeta β d) ∧ blockExtremal G d β p hp0 hp1 w block = (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ block, (if choice.1 i then (1 : ℝ) else -1) * locLinUnitError w i (choice.2 i) z) ^ 2) := by classical unfold blockExtremal dsimp only let candidates : Finset ((V → Bool) × (V → Finset V)) := Finset.univ.filter (fun choice => ∀ i ∈ block, choice.2 i ⊆ block ∧ (choice.2 i).card ≤ effBeta β d) have hne : candidates.Nonempty := by refine ⟨(fun _ => false, fun _ => ∅), ?_⟩ simp [candidates] obtain ⟨choice, hmem, hmax⟩ := Finset.exists_mem_eq_sup' hne (fun choice => (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ block, (if choice.1 i then (1 : ℝ) else -1) * (w.weight i z * (∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) - if (choice.2 i).Nonempty then 1 else 0)) ^ 2)) refine ⟨choice, ?_, ?_⟩ · simpa [candidates] using hmem · simpa [candidates, locLinUnitError] using hmax
CausalSmith.Experimentation.SnipeDegreeFrontier.exists_blockExtremal_choice · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part5.lean:229
theorem locLinWorstRisk_exact_blockExtremal

Establishes the stated mathematical result for loc lin worst risk exact block extremal.

Formal statement
n d β :
B p :
hB :
0 < B
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p hp0 hp1
locLinWorstRisk (blockGraph n d) d β B p hp0 hp1 w
= B ^ 2 / (n : ℝ) ^ 2 * ∑ b : Fin (blockCount n d), blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b)
Proof (Lean source)
lemma locLinWorstRisk_exact_blockExtremal (n d β : ℕ) (B p : ℝ) (hB : 0 < B) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) : locLinWorstRisk (blockGraph n d) d β B p hp0 hp1 w = B ^ 2 / (n : ℝ) ^ 2 * ∑ b : Fin (blockCount n d), blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) := by classical let R : ℝ := B ^ 2 / (n : ℝ) ^ 2 * ∑ b : Fin (blockCount n d), blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) have hupper (M : LocLinSchedClass (blockGraph n d) d β B) : locLinRiskAt (blockGraph n d) d β B p hp0 hp1 w M ≤ R := by rw [locLinRiskAt_block_decomposition n d β B p hp0 hp1 hn hd hdiv w M] have hsum : ∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z ^ 2) ≤ ∑ b : Fin (blockCount n d), B ^ 2 * blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) := by apply Finset.sum_le_sum intro b hb exact blockScheduleError_sq_le_extremal (blockGraph n d) d β B p hB hp0 hp1 w M (completeBlockUnits n d b) (fun i hi => completeBlockUnits_eq_nbhd n d hdiv b i hi) have hinv : 0 ≤ (n : ℝ)⁻¹ ^ 2 := sq_nonneg _ calc (n : ℝ)⁻¹ ^ 2 * ∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w M (completeBlockUnits n d b) z ^ 2) ≤ (n : ℝ)⁻¹ ^ 2 * ∑ b : Fin (blockCount n d), B ^ 2 * blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) := mul_le_mul_of_nonneg_left hsum hinv _ = R := by dsimp [R] rw [← Finset.mul_sum] have hn0 : (n : ℝ) ≠ 0 := by positivity field_simp have hexists : ∀ b : Fin (blockCount n d), ∃ choice : (Fin n → Bool) × (Fin n → Finset (Fin n)), (∀ i ∈ completeBlockUnits n d b, choice.2 i ⊆ completeBlockUnits n d b ∧ (choice.2 i).card ≤ effBeta β d) ∧ blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) = (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * locLinUnitError w i (choice.2 i) z) ^ 2) := fun b => exists_blockExtremal_choice (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) let choice : Fin (blockCount n d) → (Fin n → Bool) × (Fin n → Finset (Fin n)) := fun b => (hexists b).choose have hchoice : ∀ b i, i ∈ completeBlockUnits n d b → (choice b).2 i ⊆ completeBlockUnits n d b ∧ ((choice b).2 i).card ≤ effBeta β d := by intro b i hi exact (hexists b).choose_spec.1 i hi have hchoiceMax (b : Fin (blockCount n d)) : blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) = (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ completeBlockUnits n d b, (if (choice b).1 i then (1 : ℝ) else -1) * locLinUnitError w i ((choice b).2 i) z) ^ 2) := (hexists b).choose_spec.2 let Mstar := extremeBlockSchedule n d β B hd hdiv choice hchoice hB.le have hMstar : locLinRiskAt (blockGraph n d) d β B p hp0 hp1 w Mstar = R := by rw [locLinRiskAt_block_decomposition n d β B p hp0 hp1 hn hd hdiv w Mstar] have hblock (b : Fin (blockCount n d)) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w Mstar (completeBlockUnits n d b) z ^ 2) = B ^ 2 * blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) := by rw [show blockScheduleError w Mstar (completeBlockUnits n d b) = fun z => B * ∑ i ∈ completeBlockUnits n d b, (if (choice b).1 i then (1 : ℝ) else -1) * locLinUnitError w i ((choice b).2 i) z by funext z exact extremeBlockSchedule_blockError n d β B p hd hdiv hp0 hp1 w choice hchoice hB.le b z] rw [show (fun z => (B * ∑ i ∈ completeBlockUnits n d b, (if (choice b).1 i then (1 : ℝ) else -1) * locLinUnitError w i ((choice b).2 i) z) ^ 2) = (fun z => B ^ 2 * (∑ i ∈ completeBlockUnits n d b, (if (choice b).1 i then (1 : ℝ) else -1) * locLinUnitError w i ((choice b).2 i) z) ^ 2) by funext z ring] rw [FiniteDesign.E_const_mul, ← hchoiceMax b] rw [show (∑ b : Fin (blockCount n d), (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => blockScheduleError w Mstar (completeBlockUnits n d b) z ^ 2)) = ∑ b : Fin (blockCount n d), B ^ 2 * blockExtremal (blockGraph n d) d β p hp0 hp1 w (completeBlockUnits n d b) by apply Finset.sum_congr rfl intro b hb exact hblock b] dsimp [R] rw [← Finset.mul_sum] have hn0 : (n : ℝ) ≠ 0 := by positivity field_simp apply le_antisymm · unfold locLinWorstRisk apply csSup_le · exact ⟨locLinRiskAt (blockGraph n d) d β B p hp0 hp1 w Mstar, ⟨Mstar, rfl⟩⟩ · intro r hr rcases hr with ⟨M, rfl⟩ exact hupper M · unfold locLinWorstRisk apply le_csSup · refine ⟨R, ?_⟩ intro r hr rcases hr with ⟨M, rfl⟩ exact hupper M · exact ⟨Mstar, hMstar⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinWorstRisk_exact_blockExtremal · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part5.lean:268
theorem completeBlock_benchmark_algebra

Establishes the stated mathematical result for complete block benchmark algebra.

Formal statement
n d :
B A :
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
B ^ 2 / (n : ℝ) ^ 2 * ∑ _b : Fin (blockCount n d), (d : ℝ) ^ 2 * A
= B ^ 2 * A / blockCount n d
Proof (Lean source)
lemma completeBlock_benchmark_algebra (n d : ℕ) (B A : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) : B ^ 2 / (n : ℝ) ^ 2 * ∑ _b : Fin (blockCount n d), (d : ℝ) ^ 2 * A = B ^ 2 * A / blockCount n d := by have hq : 0 < blockCount n d := by rcases hdiv with ⟨q, rfl⟩ simp only [blockCount] have hq : 0 < q := by by_contra hz have : q = 0 := Nat.eq_zero_of_not_pos hz subst q simp at hn have hd0 : 0 < d := by omega simp [hd0, hq] rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin] simp only [nsmul_eq_mul] have hncast : (n : ℝ) = (blockCount n d : ℝ) * (d : ℝ) := by norm_cast simpa [blockCount, mul_comm] using (Nat.div_mul_cancel hdiv).symm rw [hncast] have hqr : (blockCount n d : ℝ) ≠ 0 := by positivity have hdr : (d : ℝ) ≠ 0 := by positivity field_simp
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlock_benchmark_algebra · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part5.lean:425
Helpers.LocalLinearCompleteBlocks_Part6 6 declarations Evaluates the local-linear minimax risk exactly, then collects the design-based Cauchy-Schwarz inequalities and the energy bounds for candidate weight perturbations that the witness construction consumes.

Exact minimax risk and perturbation-energy bounds

Evaluates the local-linear minimax risk exactly, then collects the design-based Cauchy-Schwarz inequalities and the energy bounds for candidate weight perturbations that the witness construction consumes.

theorem locLinMinimaxRisk_exact

Establishes the stated mathematical result for loc lin minimax risk exact.

Formal statement
n d β :
B p :
:
1 ≤ β
hB :
0 < B
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
locLinMinimaxRisk (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1)
= B ^ 2 * blockEnergy β p d / blockCount n d
Proof (Lean source)
lemma locLinMinimaxRisk_exact (n d β : ℕ) (B p : ℝ) (hβ : 1 ≤ β) (hB : 0 < B) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) : locLinMinimaxRisk (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1) = B ^ 2 * blockEnergy β p d / blockCount n d := by classical let R0 := B ^ 2 * blockEnergy β p d / blockCount n d let w0 := canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv have hlower (w : LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)) : R0 ≤ locLinWorstRisk (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1) w := by rw [locLinWorstRisk_exact_blockExtremal n d β B p hB (le_of_lt hp0) (le_of_lt hp1) hn hd hdiv w] have hsum : ∑ _b : Fin (blockCount n d), (d : ℝ) ^ 2 * blockEnergy β p d ≤ ∑ b : Fin (blockCount n d), blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) := by apply Finset.sum_le_sum intro b hb exact completeBlock_blockExtremal_lower n d β p hp0 hp1 hn hd hdiv w b have hcoef : 0 ≤ B ^ 2 / (n : ℝ) ^ 2 := by positivity calc R0 = B ^ 2 / (n : ℝ) ^ 2 * ∑ _b : Fin (blockCount n d), (d : ℝ) ^ 2 * blockEnergy β p d := by symm exact completeBlock_benchmark_algebra n d B (blockEnergy β p d) hn hd hdiv _ ≤ B ^ 2 / (n : ℝ) ^ 2 * ∑ b : Fin (blockCount n d), blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) := mul_le_mul_of_nonneg_left hsum hcoef have hw0 : locLinWorstRisk (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1) w0 = R0 := by rw [locLinWorstRisk_exact_blockExtremal n d β B p hB (le_of_lt hp0) (le_of_lt hp1) hn hd hdiv w0] have heq (b : Fin (blockCount n d)) : blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w0 (completeBlockUnits n d b) = (d : ℝ) ^ 2 * blockEnergy β p d := by apply le_antisymm · exact canonical_completeBlock_blockExtremal_upper n d β p hp0 hp1 hn hd hdiv b · exact completeBlock_blockExtremal_lower n d β p hp0 hp1 hn hd hdiv w0 b rw [show (∑ b : Fin (blockCount n d), blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w0 (completeBlockUnits n d b)) = ∑ _b : Fin (blockCount n d), (d : ℝ) ^ 2 * blockEnergy β p d by apply Finset.sum_congr rfl intro b hb exact heq b] exact completeBlock_benchmark_algebra n d B (blockEnergy β p d) hn hd hdiv unfold locLinMinimaxRisk apply le_antisymm · apply csInf_le · refine ⟨R0, ?_⟩ intro r hr rcases hr with ⟨w, rfl⟩ exact hlower w · exact ⟨w0, hw0⟩ · apply le_csInf · exact ⟨locLinWorstRisk (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1) w0, ⟨w0, rfl⟩⟩ · intro r hr rcases hr with ⟨w, rfl⟩ exact hlower w
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinMinimaxRisk_exact · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part6.lean:26
theorem finiteDesign_abs_E_mul_le_sqrt

Establishes the stated mathematical result for finite design abs e mul le sqrt.

Formal statement
Ω :
Type*
D :
f g :
Ω → ℝ
|D.E (fun z => f z * g z)|
sqrt (D.E (fun z => f z ^ 2)) * sqrt (D.E (fun z => g z ^ 2))
Proof (Lean source)
lemma finiteDesign_abs_E_mul_le_sqrt {Ω : Type*} [Fintype Ω] (D : FiniteDesign Ω) (f g : Ω → ℝ) : |D.E (fun z => f z * g z)| ≤ sqrt (D.E (fun z => f z ^ 2)) * sqrt (D.E (fun z => g z ^ 2)) := by unfold FiniteDesign.E exact abs_weighted_inner_le (Finset.univ : Finset Ω) D.p f g (fun i _ => D.p_nonneg i)
CausalSmith.Experimentation.SnipeDegreeFrontier.finiteDesign_abs_E_mul_le_sqrt · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part6.lean:112
theorem finiteDesign_E_add_sq_le

Establishes the stated mathematical result for finite design e add sq le.

Formal statement
Ω :
Type*
D :
f g :
Ω → ℝ
F G :
hF :
D.E (fun z => f z ^ 2) ≤ F
hG :
D.E (fun z => g z ^ 2) ≤ G
hF0 :
0 ≤ F
hG0 :
0 ≤ G
D.E (fun z => (f z + g z) ^ 2) ≤ F + 2 * sqrt F * sqrt G + G
Proof (Lean source)
lemma finiteDesign_E_add_sq_le {Ω : Type*} [Fintype Ω] (D : FiniteDesign Ω) (f g : Ω → ℝ) (F G : ℝ) (hF : D.E (fun z => f z ^ 2) ≤ F) (hG : D.E (fun z => g z ^ 2) ≤ G) (hF0 : 0 ≤ F) (hG0 : 0 ≤ G) : D.E (fun z => (f z + g z) ^ 2) ≤ F + 2 * sqrt F * sqrt G + G := by have hf0 : 0 ≤ D.E (fun z => f z ^ 2) := D.E_nonneg (fun z => sq_nonneg _) have hg0 : 0 ≤ D.E (fun z => g z ^ 2) := D.E_nonneg (fun z => sq_nonneg _) have hcross := finiteDesign_abs_E_mul_le_sqrt D f g have hsqrtF : sqrt (D.E (fun z => f z ^ 2)) ≤ sqrt F := Real.sqrt_le_sqrt hF have hsqrtG : sqrt (D.E (fun z => g z ^ 2)) ≤ sqrt G := Real.sqrt_le_sqrt hG have hprod : sqrt (D.E (fun z => f z ^ 2)) * sqrt (D.E (fun z => g z ^ 2)) ≤ sqrt F * sqrt G := by exact mul_le_mul hsqrtF hsqrtG (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) rw [show (fun z => (f z + g z) ^ 2) = (fun z => f z ^ 2 + 2 * (f z * g z) + g z ^ 2) by funext z ring] rw [D.E_add, D.E_add, D.E_const_mul] have habs : D.E (fun z => f z * g z) ≤ sqrt (D.E (fun z => f z ^ 2)) * sqrt (D.E (fun z => g z ^ 2)) := (le_abs_self _).trans hcross nlinarith
CausalSmith.Experimentation.SnipeDegreeFrontier.finiteDesign_E_add_sq_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part6.lean:123
theorem blockCandidatePerturb_energy_le

Establishes the stated mathematical result for block candidate perturb energy le.

Formal statement
n d β :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
hd :
1 ≤ d
hdiv :
d ∣ n
w w0 :
LocLinWeights (blockGraph n d) d β p hp0 hp1
b :
choice :
(Fin n → Bool) × (Fin n → Finset (Fin n))
hchoice :
∀ i ∈ completeBlockUnits n d b, choice.2 i ⊆ completeBlockUnits n d b
(bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * ((w.weight i z - w0.weight i z) * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0)) ^ 2)
≤ (d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (w.weight i z - w0.weight i z) ^ 2)
Proof (Lean source)
lemma blockCandidatePerturb_energy_le (n d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (hd : 1 ≤ d) (hdiv : d ∣ n) (w w0 : LocLinWeights (blockGraph n d) d β p hp0 hp1) (b : Fin (blockCount n d)) (choice : (Fin n → Bool) × (Fin n → Finset (Fin n))) (hchoice : ∀ i ∈ completeBlockUnits n d b, choice.2 i ⊆ completeBlockUnits n d b) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * ((w.weight i z - w0.weight i z) * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0)) ^ 2) ≤ (d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (w.weight i z - w0.weight i z) ^ 2) := by classical let D := bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1) let x : (Fin n → Bool) → Fin n → ℝ := fun z i => (if choice.1 i then (1 : ℝ) else -1) * ((w.weight i z - w0.weight i z) * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) have hpoint (z : Fin n → Bool) : (∑ i ∈ completeBlockUnits n d b, x z i) ^ 2 ≤ (d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (w.weight i z - w0.weight i z) ^ 2 := by calc (∑ i ∈ completeBlockUnits n d b, x z i) ^ 2 ≤ ((completeBlockUnits n d b).card : ℝ) * ∑ i ∈ completeBlockUnits n d b, (x z i) ^ 2 := by exact_mod_cast sq_sum_le_card_mul_sum_sq (s := completeBlockUnits n d b) (f := x z) _ = (d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (x z i) ^ 2 := by rw [completeBlockUnits_card n d hd hdiv b] _ ≤ (d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (w.weight i z - w0.weight i z) ^ 2 := by apply mul_le_mul_of_nonneg_left · apply Finset.sum_le_sum intro i hi dsimp [x] have hm : 0 ≤ ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0 := by apply Finset.prod_nonneg intro j hj split <;> positivity have hm1 : (∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) ≤ 1 := by apply Finset.prod_le_one · intro j hj split <;> positivity · intro j hj split <;> simp_all have hmsq : (∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) ^ 2 ≤ 1 := by nlinarith split <;> simp only [one_mul, neg_mul, neg_sq] · nlinarith [sq_nonneg (w.weight i z - w0.weight i z)] · nlinarith [sq_nonneg (w.weight i z - w0.weight i z)] · positivity have hn := D.E_nonneg (fun z => sub_nonneg.mpr (hpoint z)) rw [FiniteDesign.E_sub, FiniteDesign.E_const_mul, FiniteDesign.E_sum] at hn simpa [D, x] using hn
CausalSmith.Experimentation.SnipeDegreeFrontier.blockCandidatePerturb_energy_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part6.lean:161
theorem blockExtremal_le_of_weight_distance

Establishes the stated mathematical result for block extremal le of weight distance.

Formal statement
n d β :
p :
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)
b :
blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b)
≤ (d : ℝ) ^ 2 * blockEnergy β p d
+ 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt ((d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2))
+ (d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2)
Proof (Lean source)
lemma blockExtremal_le_of_weight_distance (n d β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)) (b : Fin (blockCount n d)) : blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) ≤ (d : ℝ) ^ 2 * blockEnergy β p d + 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt ((d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2)) + (d : ℝ) * ∑ i ∈ completeBlockUnits n d b, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2) := by classical let D := bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1) let w0 := canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv let Eδ : ℝ := ∑ i ∈ completeBlockUnits n d b, D.E (fun z => (w.weight i z - w0.weight i z) ^ 2) have hEδ0 : 0 ≤ Eδ := by dsimp [Eδ] apply sum_nonneg intro i hi exact D.E_nonneg (fun z => sq_nonneg _) unfold blockExtremal dsimp only apply Finset.sup'_le intro choice hchoiceMem have hchoice : ∀ i ∈ completeBlockUnits n d b, choice.2 i ⊆ completeBlockUnits n d b ∧ (choice.2 i).card ≤ effBeta β d := by simpa using hchoiceMem let f : (Fin n → Bool) → ℝ := fun z => ∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * locLinUnitError w0 i (choice.2 i) z let g : (Fin n → Bool) → ℝ := fun z => ∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * ((w.weight i z - w0.weight i z) * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) have hf : D.E (fun z => f z ^ 2) ≤ (d : ℝ) ^ 2 * blockEnergy β p d := by calc D.E (fun z => f z ^ 2) ≤ blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w0 (completeBlockUnits n d b) := by unfold blockExtremal dsimp only convert Finset.le_sup' (f := fun choice => D.E (fun z => (∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * locLinUnitError w0 i (choice.2 i) z) ^ 2)) hchoiceMem using 1 case e'_2 => rfl case e'_4 => rfl _ ≤ (d : ℝ) ^ 2 * blockEnergy β p d := canonical_completeBlock_blockExtremal_upper n d β p hp0 hp1 hn hd hdiv b have hg : D.E (fun z => g z ^ 2) ≤ (d : ℝ) * Eδ := by exact blockCandidatePerturb_energy_le n d β p (le_of_lt hp0) (le_of_lt hp1) hd hdiv w w0 b choice (fun i hi => (hchoice i hi).1) have hA0 : 0 ≤ (d : ℝ) ^ 2 * blockEnergy β p d := by apply mul_nonneg (sq_nonneg _) unfold blockEnergy apply sum_nonneg intro r hr apply div_nonneg · exact mul_nonneg (by positivity) (sq_nonneg _) · exact pow_nonneg (mul_nonneg hp0.le (sub_nonneg.mpr hp1.le)) _ have hDE0 : 0 ≤ (d : ℝ) * Eδ := mul_nonneg (by positivity) hEδ0 have hadd := finiteDesign_E_add_sq_le D f g ((d : ℝ) ^ 2 * blockEnergy β p d) ((d : ℝ) * Eδ) hf hg hA0 hDE0 convert hadd using 1 case e'_2 => rfl · apply FiniteDesign.E_congr intro z congr 1 dsimp [f, g, w0, locLinUnitError] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i hi ring
CausalSmith.Experimentation.SnipeDegreeFrontier.blockExtremal_le_of_weight_distance · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part6.lean:237
theorem E_global_centered_mul_raw_eq_zero

Establishes the stated mathematical result for e global centered mul raw eq zero.

Formal statement
V :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
S T :
hTS :
T ⊆ S
hcard :
T.card < S.card
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0)
= 0
Proof (Lean source)
lemma E_global_centered_mul_raw_eq_zero {V : Type*} [Fintype V] [DecidableEq V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (S T : Finset V) (hTS : T ⊆ S) (hcard : T.card < S.card) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = 0 := by let x : Bool → ℝ := fun b => (if b then 1 else 0) - p let y : Bool → ℝ := fun b => if b then 1 else 0 rw [show (fun z : V → Bool => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = (fun z => ∏ j, (if j ∈ S then x (z j) else 1) * (if j ∈ T then y (z j) else 1)) by funext z rw [Finset.prod_mul_distrib] simp [x, y]] rw [E_global_coordinate_prod p hp0 hp1 (fun j b => (if j ∈ S then x b else 1) * (if j ∈ T then y b else 1))] have hex : ∃ j, j ∈ S ∧ j ∉ T := by by_contra h push_neg at h have hST : S ⊆ T := fun j hj => h j hj have := Finset.card_le_card hST omega obtain ⟨j, hjS, hjT⟩ := hex apply Finset.prod_eq_zero (Finset.mem_univ j) simp [hjS, hjT, x, y] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.E_global_centered_mul_raw_eq_zero · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part6.lean:344
Helpers.LocalLinearCompleteBlocks_Part7 6 declarations Constructs the orthogonal block perturbation and the associated witness weights, computes their energy and distance, and derives the witness upper bound on the blockwise extremal value.

The sparse orthogonal-complement witness

Constructs the orthogonal block perturbation and the associated witness weights, computes their energy and distance, and derives the witness upper bound on the blockwise extremal value.

def orthogonalBlockPerturb

Defines orthogonal block perturb.

Definition (Lean source)
noncomputable def orthogonalBlockPerturb (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (i : Fin n) (z : Fin n → Bool) : ℝ := if hhigh : β < d then if i = blockFirstUnit n d hd hdiv (completeBlockIndex n d hd hdiv i) then sqrt (2 * (d : ℝ) * blockEnergy β p d / (p * (1 - p)) ^ d) * ∏ j ∈ completeBlockUnits n d (completeBlockIndex n d hd hdiv i), ((if z j then (1 : ℝ) else 0) - p) else 0 else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalBlockPerturb · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part7.lean:26
def orthogonalWitnessWeights

Defines orthogonal witness weights.

Definition (Lean source)
noncomputable def orthogonalWitnessWeights (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) : LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) := by classical let w0 := canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv refine { weight := fun i z => w0.weight i z + orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i z blockIndex := w0.blockIndex complete_block := w0.complete_block local_dep := ?_ mean_zero := ?_ moment_one := ?_ } · intro i z z' hzz rw [w0.local_dep i z z' hzz] congr 1 unfold orthogonalBlockPerturb split_ifs with hhigh hfirst · congr 1 apply Finset.prod_congr rfl intro j hj rw [hzz j] have hi := mem_completeBlockIndex n d hd hdiv i simpa [completeBlockUnits_eq_nbhd n d hdiv (completeBlockIndex n d hd hdiv i) i hi] using hj · rfl · rfl · intro i rw [FiniteDesign.E_add, w0.mean_zero i] suffices (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i) = 0 by linarith unfold orthogonalBlockPerturb split_ifs with hhigh hfirst · rw [FiniteDesign.E_const_mul] rw [show (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ∏ j ∈ completeBlockUnits n d (completeBlockIndex n d hd hdiv i), ((if z j then (1 : ℝ) else 0) - p)) = 0 by simpa using E_global_centered_mul_raw_eq_zero p (le_of_lt hp0) (le_of_lt hp1) (completeBlockUnits n d (completeBlockIndex n d hd hdiv i)) ∅ (empty_subset _) (by rw [Finset.card_empty, completeBlockUnits_card n d hd hdiv] omega)] ring · simp · simp · intro i S hSne hSN hScard rw [show (fun z => (w0.weight i z + orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i z) * ∏ j ∈ S, if z j then (1 : ℝ) else 0) = (fun z => w0.weight i z * (∏ j ∈ S, if z j then (1 : ℝ) else 0) + orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i z * ∏ j ∈ S, if z j then (1 : ℝ) else 0) by funext z ring] rw [FiniteDesign.E_add, w0.moment_one i S hSne hSN hScard] suffices (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i z * ∏ j ∈ S, if z j then (1 : ℝ) else 0) = 0 by linarith unfold orthogonalBlockPerturb split_ifs with hhigh hfirst · rw [show (fun z : Fin n → Bool => (sqrt (2 * (d : ℝ) * blockEnergy β p d / (p * (1 - p)) ^ d) * ∏ j ∈ completeBlockUnits n d (completeBlockIndex n d hd hdiv i), ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ S, if z j then (1 : ℝ) else 0) = (fun z : Fin n → Bool => sqrt (2 * (d : ℝ) * blockEnergy β p d / (p * (1 - p)) ^ d) * ((∏ j ∈ completeBlockUnits n d (completeBlockIndex n d hd hdiv i), ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ S, if z j then (1 : ℝ) else 0)) by funext z ring] rw [FiniteDesign.E_const_mul, E_global_centered_mul_raw_eq_zero p (le_of_lt hp0) (le_of_lt hp1) (completeBlockUnits n d (completeBlockIndex n d hd hdiv i)) S] · ring · have hi := mem_completeBlockIndex n d hd hdiv i simpa [completeBlockUnits_eq_nbhd n d hdiv (completeBlockIndex n d hd hdiv i) i hi] using hSN · rw [completeBlockUnits_card n d hd hdiv] have hsβ : S.card ≤ β := hScard.trans (by simp [effBeta]) omega · simp · simp
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalWitnessWeights · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part7.lean:42
theorem orthogonalBlockPerturb_energy

Establishes the stated mathematical result for orthogonal block perturb energy.

Formal statement
n d β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
hhigh :
β < d
i :
Fin n
(bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i z ^ 2)
= if i = blockFirstUnit n d hd hdiv (completeBlockIndex n d hd hdiv i) then 2 * (d : ℝ) * blockEnergy β p d else 0
Proof (Lean source)
lemma orthogonalBlockPerturb_energy (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (hhigh : β < d) (i : Fin n) : (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i z ^ 2) = if i = blockFirstUnit n d hd hdiv (completeBlockIndex n d hd hdiv i) then 2 * (d : ℝ) * blockEnergy β p d else 0 := by classical simp only [orthogonalBlockPerturb, dif_pos hhigh] split_ifs with hfirst · let block := completeBlockUnits n d (completeBlockIndex n d hd hdiv i) let v := p * (1 - p) have hv : 0 < v := mul_pos hp0 (sub_pos.mpr hp1) have hA : 0 < blockEnergy β p d := blockEnergy_pos β d p hβ hd hp0 hp1 have hfrac : 0 ≤ 2 * (d : ℝ) * blockEnergy β p d / v ^ d := by positivity change (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (sqrt (2 * (d : ℝ) * blockEnergy β p d / v ^ d) * ∏ j ∈ block, ((if z j then (1 : ℝ) else 0) - p)) ^ 2) = 2 * (d : ℝ) * blockEnergy β p d rw [show (fun z : Fin n → Bool => (sqrt (2 * (d : ℝ) * blockEnergy β p d / v ^ d) * ∏ j ∈ block, ((if z j then (1 : ℝ) else 0) - p)) ^ 2) = (fun z : Fin n → Bool => (sqrt (2 * (d : ℝ) * blockEnergy β p d / v ^ d)) ^ 2 * ((∏ j ∈ block, ((if z j then (1 : ℝ) else 0) - p)) * (∏ j ∈ block, ((if z j then (1 : ℝ) else 0) - p)))) by funext z ring] rw [FiniteDesign.E_const_mul, E_global_centeredMonomial_mul p (le_of_lt hp0) (le_of_lt hp1) block block, if_pos rfl, Real.sq_sqrt hfrac] rw [show block.card = d by exact completeBlockUnits_card n d hd hdiv _] dsimp [v] have hvpow : (p * (1 - p)) ^ d ≠ 0 := pow_ne_zero d (mul_ne_zero hp0.ne' (sub_pos.mpr hp1).ne') field_simp [hvpow] · simp
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalBlockPerturb_energy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part7.lean:158
theorem orthogonalWitnessWeights_distance_energy

Establishes the stated mathematical result for orthogonal witness weights distance energy.

Formal statement
n d β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
hhigh :
β < d
∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv).weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2)
= (blockCount n d : ℝ) * (2 * (d : ℝ) * blockEnergy β p d)
Proof (Lean source)
lemma orthogonalWitnessWeights_distance_energy (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (hhigh : β < d) : ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv).weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2) = (blockCount n d : ℝ) * (2 * (d : ℝ) * blockEnergy β p d) := by classical rw [← sum_completeBlockUnits n d hd hdiv (fun i => (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv).weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2))] rw [show (∑ b : Fin (blockCount n d), ∑ i ∈ completeBlockUnits n d b, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv).weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2)) = ∑ _b : Fin (blockCount n d), 2 * (d : ℝ) * blockEnergy β p d by apply Finset.sum_congr rfl intro b hb rw [Finset.sum_eq_single (blockFirstUnit n d hd hdiv b)] · have hidx : completeBlockIndex n d hd hdiv (blockFirstUnit n d hd hdiv b) = b := by apply Fin.ext change b.val * d / d = b.val rw [mul_comm] exact Nat.mul_div_cancel_left b.val (by omega : 0 < d) simp only [orthogonalWitnessWeights, add_sub_cancel_left] rw [orthogonalBlockPerturb_energy n d β p hβ hp0 hp1 hn hd hdiv hhigh] simp [hidx] · intro i hi hne simp only [orthogonalWitnessWeights, add_sub_cancel_left] rw [orthogonalBlockPerturb_energy n d β p hβ hp0 hp1 hn hd hdiv hhigh] have hidx : completeBlockIndex n d hd hdiv i = b := by apply Fin.ext exact (Finset.mem_filter.mp hi).2.2 simp [hidx, hne] · intro hnot exact (hnot (blockFirstUnit_mem_completeBlockUnits n d hd hdiv b)).elim] rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin] simp
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalWitnessWeights_distance_energy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part7.lean:217
theorem monomial_mul_sq_energy_le

Establishes the stated mathematical result for monomial mul sq energy le.

Formal statement
V :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
u :
(V → Bool) → ℝ
S :
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (u z * ∏ j ∈ S, if z j then (1 : ℝ) else 0) ^ 2)
≤ (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => u z ^ 2)
Proof (Lean source)
lemma monomial_mul_sq_energy_le {V : Type*} [Fintype V] [DecidableEq V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (u : (V → Bool) → ℝ) (S : Finset V) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (u z * ∏ j ∈ S, if z j then (1 : ℝ) else 0) ^ 2) ≤ (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => u z ^ 2) := by let D := bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1) have hpoint (z : V → Bool) : (u z * ∏ j ∈ S, if z j then (1 : ℝ) else 0) ^ 2 ≤ u z ^ 2 := by have hm0 : 0 ≤ ∏ j ∈ S, if z j then (1 : ℝ) else 0 := by apply Finset.prod_nonneg intro j hj split <;> positivity have hm1 : (∏ j ∈ S, if z j then (1 : ℝ) else 0) ≤ 1 := by apply Finset.prod_le_one · intro j hj split <;> positivity · intro j hj split <;> simp_all have hmsq : (∏ j ∈ S, if z j then (1 : ℝ) else 0) ^ 2 ≤ 1 := by simpa [pow_two] using mul_self_le_mul_self hm0 hm1 nlinarith [sq_nonneg (u z)] have hn := D.E_nonneg (fun z => sub_nonneg.mpr (hpoint z)) rw [FiniteDesign.E_sub] at hn exact sub_nonneg.mp hn
CausalSmith.Experimentation.SnipeDegreeFrontier.monomial_mul_sq_energy_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part7.lean:282
theorem orthogonalWitness_blockExtremal_upper

Establishes the stated mathematical result for orthogonal witness block extremal upper.

Formal statement
n d β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
hhigh :
β < d
b :
blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv) (completeBlockUnits n d b)
≤ (d : ℝ) ^ 2 * blockEnergy β p d
+ 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt (2 * (d : ℝ) * blockEnergy β p d)
+ 2 * (d : ℝ) * blockEnergy β p d
Proof (Lean source)
lemma orthogonalWitness_blockExtremal_upper (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (hhigh : β < d) (b : Fin (blockCount n d)) : blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv) (completeBlockUnits n d b) ≤ (d : ℝ) ^ 2 * blockEnergy β p d + 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt (2 * (d : ℝ) * blockEnergy β p d) + 2 * (d : ℝ) * blockEnergy β p d := by classical let D := bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1) let w0 := canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv let w := orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv let i0 := blockFirstUnit n d hd hdiv b unfold blockExtremal dsimp only apply Finset.sup'_le intro choice hchoiceMem have hchoice : ∀ i ∈ completeBlockUnits n d b, choice.2 i ⊆ completeBlockUnits n d b ∧ (choice.2 i).card ≤ effBeta β d := by simpa using hchoiceMem let f : (Fin n → Bool) → ℝ := fun z => ∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * locLinUnitError w0 i (choice.2 i) z let g : (Fin n → Bool) → ℝ := fun z => ∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * (orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i z * ∏ j ∈ choice.2 i, if z j then (1 : ℝ) else 0) have hf : D.E (fun z => f z ^ 2) ≤ (d : ℝ) ^ 2 * blockEnergy β p d := by calc D.E (fun z => f z ^ 2) ≤ blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w0 (completeBlockUnits n d b) := by unfold blockExtremal dsimp only convert Finset.le_sup' (f := fun choice => D.E (fun z => (∑ i ∈ completeBlockUnits n d b, (if choice.1 i then (1 : ℝ) else -1) * locLinUnitError w0 i (choice.2 i) z) ^ 2)) hchoiceMem using 1 case e'_2 => rfl case e'_4 => rfl _ ≤ (d : ℝ) ^ 2 * blockEnergy β p d := canonical_completeBlock_blockExtremal_upper n d β p hp0 hp1 hn hd hdiv b have hgfun : g = fun z => (if choice.1 i0 then (1 : ℝ) else -1) * (orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i0 z * ∏ j ∈ choice.2 i0, if z j then (1 : ℝ) else 0) := by funext z dsimp [g, i0] rw [Finset.sum_eq_single (blockFirstUnit n d hd hdiv b)] · intro i hi hne have hidx : completeBlockIndex n d hd hdiv i = b := by apply Fin.ext exact (Finset.mem_filter.mp hi).2.2 have hnot : i ≠ blockFirstUnit n d hd hdiv (completeBlockIndex n d hd hdiv i) := by simpa [hidx] using hne simp [orthogonalBlockPerturb, hhigh, hnot] · intro hnot exact (hnot (blockFirstUnit_mem_completeBlockUnits n d hd hdiv b)).elim have hg : D.E (fun z => g z ^ 2) ≤ 2 * (d : ℝ) * blockEnergy β p d := by rw [hgfun] have hmono := monomial_mul_sq_energy_le p (le_of_lt hp0) (le_of_lt hp1) (orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i0) (choice.2 i0) have hsign : (fun z => ((if choice.1 i0 then (1 : ℝ) else -1) * (orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i0 z * ∏ j ∈ choice.2 i0, if z j then (1 : ℝ) else 0)) ^ 2) = (fun z => (orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i0 z * ∏ j ∈ choice.2 i0, if z j then (1 : ℝ) else 0) ^ 2) := by funext z split <;> ring rw [hsign] calc D.E (fun z => (orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i0 z * ∏ j ∈ choice.2 i0, if z j then (1 : ℝ) else 0) ^ 2) ≤ D.E (fun z => orthogonalBlockPerturb n d β p hβ hp0 hp1 hn hd hdiv i0 z ^ 2) := hmono _ = 2 * (d : ℝ) * blockEnergy β p d := by rw [orthogonalBlockPerturb_energy n d β p hβ hp0 hp1 hn hd hdiv hhigh] have hidx : completeBlockIndex n d hd hdiv i0 = b := by apply Fin.ext dsimp [i0] change b.val * d / d = b.val rw [mul_comm] exact Nat.mul_div_cancel_left b.val (by omega : 0 < d) simp [i0, hidx] have hA : 0 < blockEnergy β p d := blockEnergy_pos β d p hβ hd hp0 hp1 have hA0 : 0 ≤ (d : ℝ) ^ 2 * blockEnergy β p d := mul_nonneg (sq_nonneg _) hA.le have hG0 : 0 ≤ 2 * (d : ℝ) * blockEnergy β p d := mul_nonneg (by positivity) hA.le have hadd := finiteDesign_E_add_sq_le D f g ((d : ℝ) ^ 2 * blockEnergy β p d) (2 * (d : ℝ) * blockEnergy β p d) hf hg hA0 hG0 convert hadd using 1 case e'_2 => rfl apply FiniteDesign.E_congr intro z congr 1 dsimp [f, g, w, w0, orthogonalWitnessWeights, locLinUnitError] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i hi ring
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalWitness_blockExtremal_upper · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part7.lean:317
Helpers.LocalLinearCompleteBlocks_Part8 2 declarations Bounds the excess of the blockwise extremal value over its canonical value by the weight distance, and records the invariance of the SNIPE score under relabelling.

Excess of the complete-block extremal value, and score relabelling

Bounds the excess of the blockwise extremal value over its canonical value by the weight distance, and records the invariance of the SNIPE score under relabelling.

theorem completeBlockExtremal_excess_le_distance

Establishes the stated mathematical result for complete block extremal excess le distance.

Formal statement
n d β :
p :
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)
∑ b : Fin (blockCount n d), (blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) - (d : ℝ) ^ 2 * blockEnergy β p d)
≤ 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt (blockCount n d : ℝ) * sqrt ((d : ℝ) * ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2))
+ (d : ℝ) * ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2)
Proof (Lean source)
lemma completeBlockExtremal_excess_le_distance (n d β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)) : ∑ b : Fin (blockCount n d), (blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) - (d : ℝ) ^ 2 * blockEnergy β p d) ≤ 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt (blockCount n d : ℝ) * sqrt ((d : ℝ) * ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2)) + (d : ℝ) * ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (w.weight i z - (canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv).weight i z) ^ 2) := by classical let D := bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1) let w0 := canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv let e : Fin (blockCount n d) → ℝ := fun b => ∑ i ∈ completeBlockUnits n d b, D.E (fun z => (w.weight i z - w0.weight i z) ^ 2) let Etotal : ℝ := ∑ i : Fin n, D.E (fun z => (w.weight i z - w0.weight i z) ^ 2) have he0 (b : Fin (blockCount n d)) : 0 ≤ e b := by dsimp [e] apply sum_nonneg intro i hi exact D.E_nonneg (fun z => sq_nonneg _) have hEtot : ∑ b : Fin (blockCount n d), e b = Etotal := by dsimp [e, Etotal] exact sum_completeBlockUnits n d hd hdiv (fun i => D.E (fun z => (w.weight i z - w0.weight i z) ^ 2)) have hsqrt : ∑ b : Fin (blockCount n d), sqrt ((d : ℝ) * e b) ≤ sqrt (blockCount n d : ℝ) * sqrt ((d : ℝ) * Etotal) := by calc ∑ b : Fin (blockCount n d), sqrt ((d : ℝ) * e b) = ∑ b ∈ (Finset.univ : Finset (Fin (blockCount n d))), (1 : ℝ) * sqrt ((d : ℝ) * e b) := by simp _ ≤ sqrt (∑ b ∈ (Finset.univ : Finset (Fin (blockCount n d))), (1 : ℝ) ^ 2) * sqrt (∑ b ∈ (Finset.univ : Finset (Fin (blockCount n d))), sqrt ((d : ℝ) * e b) ^ 2) := Real.sum_mul_le_sqrt_mul_sqrt (Finset.univ : Finset (Fin (blockCount n d))) (fun _ => (1 : ℝ)) (fun b => sqrt ((d : ℝ) * e b)) _ = sqrt (blockCount n d : ℝ) * sqrt ((d : ℝ) * Etotal) := by congr 2 · simp · rw [show (∑ b ∈ (Finset.univ : Finset (Fin (blockCount n d))), sqrt ((d : ℝ) * e b) ^ 2) = ∑ b : Fin (blockCount n d), (d : ℝ) * e b by apply Finset.sum_congr rfl intro b hb rw [Real.sq_sqrt (mul_nonneg (by positivity) (he0 b))]] rw [← Finset.mul_sum, hEtot] calc ∑ b : Fin (blockCount n d), (blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) - (d : ℝ) ^ 2 * blockEnergy β p d) ≤ ∑ b : Fin (blockCount n d), (2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt ((d : ℝ) * e b) + (d : ℝ) * e b) := by apply Finset.sum_le_sum intro b hb have h := blockExtremal_le_of_weight_distance n d β p hp0 hp1 hn hd hdiv w b dsimp [e, D, w0] at h ⊢ linarith _ = 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * (∑ b : Fin (blockCount n d), sqrt ((d : ℝ) * e b)) + (d : ℝ) * Etotal := by rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum, hEtot] _ ≤ 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * (sqrt (blockCount n d : ℝ) * sqrt ((d : ℝ) * Etotal)) + (d : ℝ) * Etotal := by gcongr _ = 2 * sqrt ((d : ℝ) ^ 2 * blockEnergy β p d) * sqrt (blockCount n d : ℝ) * sqrt ((d : ℝ) * Etotal) + (d : ℝ) * Etotal := by ring
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlockExtremal_excess_le_distance · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/LocalLinearCompleteBlocks_Part8.lean:26
theorem snipeScore_relabel

Establishes the stated mathematical result for snipe score relabel.

Formal statement
V :
G :
V → V → Prop
π :
V ≃ V
hG :
∀ j i, G (π j) (π i) ↔ G j i
β :
p :
i :
V
z :
V → Bool
snipeScore (fun j i => decide (G j i)) β p (π i) (fun j => z (π.symm j))
= snipeScore (fun j i => decide (G j i)) β p i z
Proof (Lean source)
lemma snipeScore_relabel {V : Type*} [Fintype V] [DecidableEq V] (G : V → V → Prop) [DecidableRel G] (π : V ≃ V) (hG : ∀ j i, G (π j) (π i) ↔ G j i) (β : ℕ) (p : ℝ) (i : V) (z : V → Bool) : snipeScore (fun j i => decide (G j i)) β p (π i) (fun j => z (π.symm j)) = snipeScore (fun j i => decide (G j i)) β p i z := by classical let N := nbhdB (fun j i => decide (G j i)) i have hN : nbhdB (fun j i => decide (G j i)) (π i) = N.map π.toEmbedding := by ext k simp only [nbhdB, mem_filter, Finset.mem_univ, true_and, Finset.mem_map, Equiv.coe_toEmbedding] constructor · intro hk refine ⟨π.symm k, ?_, by simp⟩ dsimp [N] simp only [nbhdB, mem_filter, Finset.mem_univ, true_and] apply decide_eq_true_eq.mpr exact (hG (π.symm k) i).mp (decide_eq_true_eq.mp (by simpa using hk)) · rintro ⟨j, hj, rfl⟩ dsimp [N] at hj simp only [nbhdB, mem_filter, Finset.mem_univ, true_and] at hj apply decide_eq_true_eq.mpr exact (hG j i).mpr (decide_eq_true_eq.mp hj) unfold snipeScore rw [hN] change (∑ r ∈ Icc 1 (effBeta β (N.map π.toEmbedding).card), (bernoulliContrast p r / (p * (1 - p)) ^ r) * ∑ S ∈ (N.map π.toEmbedding).powerset.filter (fun S => S.card = r), ∏ j ∈ S, ((if z (π.symm j) then (1 : ℝ) else 0) - p)) = ∑ r ∈ Icc 1 (effBeta β N.card), (bernoulliContrast p r / (p * (1 - p)) ^ r) * ∑ S ∈ N.powerset.filter (fun S => S.card = r), ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p) rw [Finset.card_map] apply Finset.sum_congr rfl intro r hr congr 1 apply Finset.sum_bij (fun S (_hS : S ∈ (N.map π.toEmbedding).powerset.filter (fun S => S.card = r)) => S.map π.symm.toEmbedding) · intro S hS have hSmem := Finset.mem_filter.mp hS have hSsub := Finset.mem_powerset.mp hSmem.1 apply Finset.mem_filter.mpr constructor · apply Finset.mem_powerset.mpr intro j hj obtain ⟨k, hkS, hkj⟩ := Finset.mem_map.mp hj subst j have hkMap := hSsub hkS obtain ⟨j, hjN, hjk⟩ := Finset.mem_map.mp hkMap have : j = π.symm k := by apply π.injective simpa using hjk simpa [this] using hjN · simpa using hSmem.2 · intro S hS T hT hmap apply Finset.map_injective (f := π.symm.toEmbedding) exact hmap · intro T hT refine ⟨T.map π.toEmbedding, ?_, ?_⟩ · have hTmem := Finset.mem_filter.mp hT apply Finset.mem_filter.mpr constructor · apply Finset.mem_powerset.mpr intro k hk obtain ⟨j, hjT, rfl⟩ := Finset.mem_map.mp hk exact Finset.mem_map.mpr ⟨j, Finset.mem_powerset.mp hTmem.1 hjT, rfl⟩ · simpa using hTmem.2 · ext j simp · intro S hS rw [Finset.prod_map] apply Finset.prod_congr rfl intro j hj simp
Helpers.OverlapCount 2 declarations The identity double-counts pairs consisting of an overlapping neighborhood and an r-subset.

Single-out-degree overlap count

The identity double-counts pairs consisting of an overlapping neighborhood and an r-subset. Its upper bound charges the graph's out-degree once.

The number of outcome neighborhoods containing a fixed subset.

Definition (Lean source)
noncomputable def containingNeighborhoods (G : V → V → Prop) (S : Finset V) : ℕ := (Finset.univ.filter (fun l => S ⊆ nbhd G l)).card
CausalSmith.Experimentation.SnipeDegreeFrontier.containingNeighborhoods · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/OverlapCount.lean:18
theorem overlap_count_le Lemma 2 in the paper ↗

The exact overlap double-count and its degree-sharp upper bounds.

Formal statement
G :
V → V → Prop
d r :
i :
V
hdegree :
hr :
1 ≤ r
(∑ l : V, choose ((nbhd G i ∩ nbhd G l).card) r)
= ∑ S ∈ ((nbhd G i).powerset.filter (fun S => S.card = r)), containingNeighborhoods G S ∧
(∑ S ∈ ((nbhd G i).powerset.filter (fun S => S.card = r)), containingNeighborhoods G S)
≤ d * choose (nbhd G i).card r ∧
d * choose (nbhd G i).card r ≤ d * choose d r
Proof (Lean source)
-- @node: lem:overlap-count lemma overlap_count_le (G : V → V → Prop) (d r : ℕ) (i : V) (hdegree : BoundedDegree G d) (hr : 1 ≤ r) : (∑ l : V, choose ((nbhd G i ∩ nbhd G l).card) r) = ∑ S ∈ ((nbhd G i).powerset.filter (fun S => S.card = r)), containingNeighborhoods G S ∧ (∑ S ∈ ((nbhd G i).powerset.filter (fun S => S.card = r)), containingNeighborhoods G S) ≤ d * choose (nbhd G i).card r ∧ d * choose (nbhd G i).card r ≤ d * choose d r := by classical let F := (nbhd G i).powerset.filter (fun S => S.card = r) have hchoose (l : V) : choose ((nbhd G i ∩ nbhd G l).card) r = ∑ S ∈ F, if S ⊆ nbhd G l then 1 else 0 := by rw [← Finset.card_powersetCard] rw [← Finset.card_filter] congr 1 ext S simp only [F, Finset.mem_powersetCard, mem_filter, Finset.mem_powerset, Finset.subset_inter_iff] aesop have hcontain (S : Finset V) (hS : S ∈ F) : containingNeighborhoods G S ≤ d := by have hcard : S.card = r := (Finset.mem_filter.mp hS).2 have hne : S.Nonempty := Finset.card_pos.mp (by omega) obtain ⟨j, hj⟩ := hne have hsub : Finset.univ.filter (fun l => S ⊆ nbhd G l) ⊆ outNbhd G j := by intro l hl have hjl : j ∈ nbhd G l := (Finset.mem_filter.mp hl).2 hj simpa [nbhd, outNbhd] using hjl calc containingNeighborhoods G S = (Finset.univ.filter (fun l => S ⊆ nbhd G l)).card := rfl _ ≤ (outNbhd G j).card := Finset.card_le_card hsub _ ≤ d := hdegree.2 j have hcardF : F.card = choose (nbhd G i).card r := by rw [← Finset.card_powersetCard] congr 1 ext S simp [F, Finset.mem_powersetCard] constructor · calc (∑ l : V, choose ((nbhd G i ∩ nbhd G l).card) r) = ∑ l : V, ∑ S ∈ F, if S ⊆ nbhd G l then 1 else 0 := by apply Finset.sum_congr rfl intro l hl exact hchoose l _ = ∑ S ∈ F, ∑ l : V, if S ⊆ nbhd G l then 1 else 0 := Finset.sum_comm _ = ∑ S ∈ F, containingNeighborhoods G S := by apply Finset.sum_congr rfl intro S hS rw [containingNeighborhoods, Finset.card_filter] constructor · calc (∑ S ∈ F, containingNeighborhoods G S) ≤ ∑ S ∈ F, d := by exact Finset.sum_le_sum fun S hS => hcontain S hS _ = d * choose (nbhd G i).card r := by simp [hcardF, mul_comm] · exact Nat.mul_le_mul_left d (Nat.choose_le_choose r (hdegree.1 i))
CausalSmith.Experimentation.SnipeDegreeFrontier.overlap_count_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/OverlapCount.lean:23
Helpers.SnipeVariance_Part1 10 declarations Computes the raw and centred moments of the SNIPE score under the Bernoulli design, shows the score has mean zero, defines the local score energy and compares it with the block energy, and proves the estimator is unbiase

SNIPE score moments, local energy, and unbiasedness

Computes the raw and centred moments of the SNIPE score under the Bernoulli design, shows the score has mean zero, defines the local score energy and compares it with the block energy, and proves the estimator is unbiased in both the coefficient-mass and bounded-outcome model classes.

The Boolean graph encoding has exactly the original relation's neighborhood.

Formal statement
M :
ModelClass V d β B
i :
V
nbhdB (edgeFn M) i = nbhd M.edge i
Proof (Lean source)
lemma nbhdB_edgeFn_eq_nbhd (M : ModelClass V d β B) (i : V) : nbhdB (edgeFn M) i = nbhd M.edge i := by ext j simp only [nbhdB, nbhd, mem_filter, Finset.mem_univ, true_and] simp [edgeFn]
CausalSmith.Experimentation.SnipeDegreeFrontier.nbhdB_edgeFn_eq_nbhd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:25
theorem nbhdB_edgeFnBdd_eq_nbhd Lemma nbhdB_edgeFnBdd_eq_nbhd in the paper ↗

The bounded-outcome graph encoding has exactly the original relation's neighborhood.

Formal statement
M :
i :
V
nbhdB (edgeFnBdd M) i = nbhd M.edge i
Proof (Lean source)
lemma nbhdB_edgeFnBdd_eq_nbhd (M : BddOutcomeModelClass V d β B) (i : V) : nbhdB (edgeFnBdd M) i = nbhd M.edge i := by ext j simp only [nbhdB, nbhd, mem_filter, Finset.mem_univ, true_and] simp [edgeFnBdd]
CausalSmith.Experimentation.SnipeDegreeFrontier.nbhdB_edgeFnBdd_eq_nbhd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:32
theorem E_global_coordinate_prod Lemma E_global_coordinate_prod in the paper ↗

Coordinatewise products factor under a common-probability Bernoulli design.

Formal statement
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
g :
V → Bool → ℝ
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => ∏ i, g i (z i))
= ∏ i, (p * g i true + (1 - p) * g i false)
Proof (Lean source)
lemma E_global_coordinate_prod (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (g : V → Bool → ℝ) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => ∏ i, g i (z i)) = ∏ i, (p * g i true + (1 - p) * g i false) := by unfold bernoulliDesign rw [FiniteDesign.E_prod_prod] apply Finset.prod_congr rfl intro i _ rw [coinDesign_E]
CausalSmith.Experimentation.SnipeDegreeFrontier.E_global_coordinate_prod · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:39

A global SNIPE score has the required raw-monomial moment on its neighborhood.

Formal statement
G :
V → V → Bool
β :
p :
hp0 :
0 < p
hp1 :
p < 1
i :
V
T :
hT :
T.Nonempty
hTN :
T ⊆ nbhdB G i
hTcard :
T.card ≤ effBeta β (nbhdB G i).card
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore G β p i z * ∏ j ∈ T, if z j then (1 : ℝ) else 0)
= 1
Proof (Lean source)
lemma snipeScore_raw_moment (G : V → V → Bool) (β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (i : V) (T : Finset V) (hT : T.Nonempty) (hTN : T ⊆ nbhdB G i) (hTcard : T.card ≤ effBeta β (nbhdB G i).card) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore G β p i z * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = 1 := by let v := p * (1 - p) have hv : v ≠ 0 := mul_ne_zero (ne_of_gt hp0) (ne_of_gt (sub_pos.mpr hp1)) have hmoment (S : Finset V) (hS : S.Nonempty) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = if S ⊆ T then v ^ S.card * p ^ (T.card - S.card) else 0 := by -- This is the coordinate-free form of the product calculation in -- `E_centeredMonomial_mul_raw`. let x : Bool → ℝ := fun b => (if b then 1 else 0) - p let y : Bool → ℝ := fun b => if b then 1 else 0 rw [show (fun z : V → Bool => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0) = (fun z => ∏ j, ((if j ∈ S then x (z j) else 1) * (if j ∈ T then y (z j) else 1))) by funext z rw [Finset.prod_mul_distrib] simp [x, y]] rw [E_global_coordinate_prod (V := V) p (le_of_lt hp0) (le_of_lt hp1) (fun j b => (if j ∈ S then x b else 1) * (if j ∈ T then y b else 1))] by_cases hsub : S ⊆ T · rw [if_pos hsub] have hfactor (j : V) : p * ((if j ∈ S then x true else 1) * (if j ∈ T then y true else 1)) + (1 - p) * ((if j ∈ S then x false else 1) * (if j ∈ T then y false else 1)) = if j ∈ S then p * (1 - p) else if j ∈ T then p else 1 := by by_cases hjS : j ∈ S · have hjT : j ∈ T := hsub hjS simp [hjS, hjT, x, y] · by_cases hjT : j ∈ T <;> simp [hjS, hjT, x, y] <;> ring simp_rw [hfactor] have hsplit (j : V) : (if j ∈ S then p * (1 - p) else if j ∈ T then p else 1) = (if j ∈ S then p * (1 - p) else 1) * (if j ∈ T \ S then p else 1) := by by_cases hjS : j ∈ S <;> by_cases hjT : j ∈ T <;> simp [hjS, hjT] simp_rw [hsplit, Finset.prod_mul_distrib] rw [Finset.prod_ite_mem_eq, Finset.prod_ite_mem_eq] simp only [Finset.prod_const, nsmul_eq_mul, Nat.cast_ofNat, Nat.cast_id, mul_one] rw [Finset.card_sdiff, Finset.inter_eq_left.mpr hsub] · rw [if_neg hsub] obtain ⟨j, hjS, hjT⟩ : ∃ j, j ∈ S ∧ j ∉ T := by simpa only [Finset.not_subset] using hsub apply Finset.prod_eq_zero (Finset.mem_univ j) simp [hjS, hjT, x, y] ring simp only [snipeScore, Finset.sum_mul, Finset.mul_sum, FiniteDesign.E_sum] simp_rw [mul_assoc, FiniteDesign.E_const_mul] rw [show (∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), ∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), bernoulliContrast p r / (p * (1 - p)) ^ r * (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) * ∏ j ∈ T, if z j then (1 : ℝ) else 0)) = ∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), ∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), bernoulliContrast p r / v ^ r * (if S ⊆ T then v ^ S.card * p ^ (T.card - S.card) else 0) by apply Finset.sum_congr rfl intro r hr apply Finset.sum_congr rfl intro S hS have hScard : S.card = r := (Finset.mem_filter.mp hS).2 have hr1 : 1 ≤ r := (Finset.mem_Icc.mp hr).1 rw [hmoment S (Finset.card_pos.mp (by omega))] ] rw [show (∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), ∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), bernoulliContrast p r / v ^ r * (if S ⊆ T then v ^ S.card * p ^ (T.card - S.card) else 0)) = ∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), (Nat.choose T.card r : ℝ) * bernoulliContrast p r * p ^ (T.card - r) by apply Finset.sum_congr rfl intro r hr simp_rw [mul_ite, mul_zero] rw [← Finset.sum_filter] rw [show ((nbhdB G i).powerset.filter (fun S => S.card = r)).filter (fun S => S ⊆ T) = T.powersetCard r by ext S simp only [mem_filter, Finset.mem_powerset, Finset.mem_powersetCard] constructor · rintro ⟨⟨_, hc⟩, hST⟩ exact ⟨hST, hc⟩ · rintro ⟨hST, hc⟩ exact ⟨⟨hST.trans hTN, hc⟩, hST⟩] rw [show (∑ S ∈ T.powersetCard r, bernoulliContrast p r / v ^ r * (v ^ S.card * p ^ (T.card - S.card))) = ∑ _S ∈ T.powersetCard r, bernoulliContrast p r * p ^ (T.card - r) by apply Finset.sum_congr rfl intro S hS have hs := Finset.mem_powersetCard.mp hS simp only [hs.2] field_simp] rw [Finset.sum_const, Finset.card_powersetCard] simp ring] rw [show (∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), (Nat.choose T.card r : ℝ) * bernoulliContrast p r * p ^ (T.card - r)) = ∑ r ∈ Icc 1 T.card, (Nat.choose T.card r : ℝ) * bernoulliContrast p r * p ^ (T.card - r) by symm apply Finset.sum_subset_zero_on_sdiff · intro r hr simp only [Finset.mem_Icc] at hr ⊢ exact ⟨hr.1, le_trans hr.2 hTcard⟩ · intro r hr have hlt : T.card < r := by simp only [mem_sdiff, Finset.mem_Icc, not_and_or] at hr omega simp [Nat.choose_eq_zero_of_lt hlt] · intro r hr rfl] exact blockContrast_binomial p T.card (Finset.card_pos.mpr hT)
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore_raw_moment · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:51

A global SNIPE score is centered.

Formal statement
G :
V → V → Bool
β :
p :
hp0 :
0 < p
hp1 :
p < 1
i :
V
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (snipeScore G β p i)
= 0
Proof (Lean source)
lemma snipeScore_mean_zero (G : V → V → Bool) (β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (i : V) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (snipeScore G β p i) = 0 := by have hcenter (S : Finset V) (hS : S.Nonempty) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) = 0 := by rw [show (fun z : V → Bool => ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)) = (fun z => ∏ j, if j ∈ S then ((if z j then (1 : ℝ) else 0) - p) else 1) by funext z simp] rw [E_global_coordinate_prod (V := V) p (le_of_lt hp0) (le_of_lt hp1) (fun j b => if j ∈ S then ((if b then (1 : ℝ) else 0) - p) else 1)] obtain ⟨j, hj⟩ := hS apply Finset.prod_eq_zero (Finset.mem_univ j) simp [hj] ring rw [show snipeScore G β p i = fun z => ∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), (bernoulliContrast p r / (p * (1 - p)) ^ r) * ∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p) by rfl] rw [FiniteDesign.E_sum] apply Finset.sum_eq_zero intro r hr rw [FiniteDesign.E_const_mul, FiniteDesign.E_sum] rw [show (∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p))) = 0 by apply Finset.sum_eq_zero intro S hS have hc : S.card = r := (Finset.mem_filter.mp hS).2 exact hcenter S (Finset.card_pos.mp (by have := (Finset.mem_Icc.mp hr).1 omega))] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore_mean_zero · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:198
theorem snipeScore_potentialOutcome_moment Lemma snipeScore_potentialOutcome_moment in the paper ↗

Pairing a SNIPE score with one unit's low-order polynomial gives that unit's all-treated versus all-control contrast.

Formal statement
G :
V → V → Prop
c :
V → Finset V → ℝ
β :
hlow :
p :
hp0 :
0 < p
hp1 :
p < 1
i :
V
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore (fun j i => decide (G j i)) β p i z * potentialOutcome G c i z)
= potentialOutcome G c i (fun _ => true) - potentialOutcome G c i (fun _ => false)
Proof (Lean source)
lemma snipeScore_potentialOutcome_moment (G : V → V → Prop) [DecidableRel G] (c : V → Finset V → ℝ) (β : ℕ) (hlow : LowOrder c β) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (i : V) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore (fun j i => decide (G j i)) β p i z * potentialOutcome G c i z) = potentialOutcome G c i (fun _ => true) - potentialOutcome G c i (fun _ => false) := by let GB : V → V → Bool := fun j i => decide (G j i) have hN : nbhdB GB i = nbhd G i := by ext j simp [GB, nbhdB, nbhd] unfold potentialOutcome rw [show (fun z => snipeScore GB β p i z * ∑ S ∈ (nbhd G i).powerset, c i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0) = (fun z => ∑ S ∈ (nbhd G i).powerset, snipeScore GB β p i z * (c i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0)) by funext z rw [Finset.mul_sum]] rw [FiniteDesign.E_sum, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro S hS rw [show (fun z => snipeScore GB β p i z * (c i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0)) = (fun z => c i S * (snipeScore GB β p i z * ∏ j ∈ S, if z j then (1 : ℝ) else 0)) by funext z ring] rw [FiniteDesign.E_const_mul] by_cases hSne : S.Nonempty · have hSN : S ⊆ nbhdB GB i := by rw [hN] exact Finset.mem_powerset.mp hS by_cases hcard : S.card ≤ effBeta β (nbhdB GB i).card · rw [snipeScore_raw_moment GB β p hp0 hp1 i S hSne hSN hcard] simp [Finset.card_ne_zero.mpr hSne] · have hβcard : β < S.card := by have hSlen : S.card ≤ (nbhdB GB i).card := by rw [hN] exact Finset.card_le_card (Finset.mem_powerset.mp hS) simp only [effBeta] at hcard omega rw [hlow i S hβcard] simp · have hSempty := Finset.not_nonempty_iff_eq_empty.mp hSne subst S simp only [Finset.prod_empty] rw [show (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore GB β p i z * 1) = 0 by simpa using snipeScore_mean_zero GB β p hp0 hp1 i] simp
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore_potentialOutcome_moment · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:242

Exact score energy for an outcome unit.

Definition (Lean source)
noncomputable def localEnergy (G : V → V → Prop) (β : ℕ) (p : ℝ) (i : V) : ℝ := ∑ r ∈ Icc 1 (effBeta β (nbhd G i).card), (choose (nbhd G i).card r : ℝ) * (bernoulliContrast p r) ^ 2 / (p * (1 - p)) ^ r
theorem snipe_unbiased

SNIPE is design-unbiased at every coefficient-mass model.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
M :
ModelClass V d β B
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).Unbiased (fun z => snipeEstimator β p (edgeFn M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)
Proof (Lean source)
lemma snipe_unbiased (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (M : ModelClass V d β B) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).Unbiased (fun z => snipeEstimator β p (edgeFn M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef) := by letI : DecidableRel M.edge := M.decEdge unfold FiniteDesign.Unbiased snipeEstimator tte rw [FiniteDesign.E_const_mul, FiniteDesign.E_sum] congr 1 apply Finset.sum_congr rfl intro i hi change (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => potentialOutcome M.edge M.coef i z * snipeScore (edgeFn M) β p i z) = potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false) rw [show (fun z => potentialOutcome M.edge M.coef i z * snipeScore (edgeFn M) β p i z) = (fun z => snipeScore (edgeFn M) β p i z * potentialOutcome M.edge M.coef i z) by funext z ring] exact snipeScore_potentialOutcome_moment M.edge M.coef β M.low_order p hp0 hp1 i
CausalSmith.Experimentation.SnipeDegreeFrontier.snipe_unbiased · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:313
theorem snipe_unbiased_bdd

The same unbiasedness assertion on the uniformly bounded-outcome class.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
M :
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).Unbiased (fun z => snipeEstimator β p (edgeFnBdd M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)
Proof (Lean source)
lemma snipe_unbiased_bdd (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (M : BddOutcomeModelClass V d β B) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).Unbiased (fun z => snipeEstimator β p (edgeFnBdd M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef) := by letI : DecidableRel M.edge := M.decEdge unfold FiniteDesign.Unbiased snipeEstimator tte rw [FiniteDesign.E_const_mul, FiniteDesign.E_sum] congr 1 apply Finset.sum_congr rfl intro i hi change (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => potentialOutcome M.edge M.coef i z * snipeScore (edgeFnBdd M) β p i z) = potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false) rw [show (fun z => potentialOutcome M.edge M.coef i z * snipeScore (edgeFnBdd M) β p i z) = (fun z => snipeScore (edgeFnBdd M) β p i z * potentialOutcome M.edge M.coef i z) by funext z ring] exact snipeScore_potentialOutcome_moment M.edge M.coef β M.low_order p hp0 hp1 i
CausalSmith.Experimentation.SnipeDegreeFrontier.snipe_unbiased_bdd · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:343
theorem localEnergy_le_blockEnergy Lemma localEnergy_le_blockEnergy in the paper ↗

Actual local score energy is at most complete-block energy at the degree bound.

Formal statement
G :
V → V → Prop
d β :
p :
hp0 :
0 < p
hp1 :
p < 1
hdegree :
i :
V
localEnergy G β p i ≤ blockEnergy β p d
Proof (Lean source)
lemma localEnergy_le_blockEnergy (G : V → V → Prop) (d β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hdegree : BoundedDegree G d) (i : V) : localEnergy G β p i ≤ blockEnergy β p d := by have hcard : (nbhd G i).card ≤ d := hdegree.1 i have heff : effBeta β (nbhd G i).card ≤ effBeta β d := by simp only [effBeta] omega have hq : 0 < p * (1 - p) := mul_pos hp0 (sub_pos.mpr hp1) unfold localEnergy blockEnergy calc (∑ r ∈ Icc 1 (effBeta β (nbhd G i).card), (Nat.choose (nbhd G i).card r : ℝ) * bernoulliContrast p r ^ 2 / (p * (1 - p)) ^ r) ≤ ∑ r ∈ Icc 1 (effBeta β (nbhd G i).card), (Nat.choose d r : ℝ) * bernoulliContrast p r ^ 2 / (p * (1 - p)) ^ r := by apply Finset.sum_le_sum intro r hr have hchoose : Nat.choose (nbhd G i).card r ≤ Nat.choose d r := Nat.choose_le_choose r hcard gcongr _ ≤ ∑ r ∈ Icc 1 (effBeta β d), (Nat.choose d r : ℝ) * bernoulliContrast p r ^ 2 / (p * (1 - p)) ^ r := by apply Finset.sum_le_sum_of_subset_of_nonneg · intro r hr simp only [Finset.mem_Icc] at hr ⊢ exact ⟨hr.1, le_trans hr.2 heff⟩ · intro r _ _ positivity
CausalSmith.Experimentation.SnipeDegreeFrontier.localEnergy_le_blockEnergy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part1.lean:373
Helpers.SnipeVariance_Part2 7 declarations Expands a potential outcome in the centred monomial basis of the Bernoulli design, records the orthogonality and energy identities of that expansion, and shows the coefficients vanish outside the relevant block support.

Centred-monomial expansion of the SNIPE score

Expands a potential outcome in the centred monomial basis of the Bernoulli design, records the orthogonality and energy identities of that expansion, and shows the coefficients vanish outside the relevant block support.

def globalCenteredMonomial

A centered monomial on the global assignment cube.

Definition (Lean source)
noncomputable def globalCenteredMonomial (p : ℝ) (S : Finset V) (z : V → Bool) : ℝ := ∏ j ∈ S, ((if z j then (1 : ℝ) else 0) - p)
CausalSmith.Experimentation.SnipeDegreeFrontier.globalCenteredMonomial · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part2.lean:25
theorem exists_globalCenteredMonomial_expansion

Every real function on a finite Boolean cube has a Bernoulli-centered Fourier expansion.

Formal statement
p :
F :
(V → Bool) → ℝ
∃ a : Finset V → ℝ,
∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z
Proof (Lean source)
lemma exists_globalCenteredMonomial_expansion (p : ℝ) (F : (V → Bool) → ℝ) : ∃ a : Finset V → ℝ, ∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z := by classical let sgn : Bool → ℝ := fun b => if b then 1 else -1 let base : Bool → ℝ := fun b => if b then p else 1 - p let a : Finset V → ℝ := fun S => ∑ w : V → Bool, F w * (∏ j ∈ S, sgn (w j)) * ∏ j ∈ (Finset.univ : Finset V) \ S, base (w j) refine ⟨a, fun z => ?_⟩ have hdelta (w : V → Bool) : (if z = w then (1 : ℝ) else 0) = ∑ S ∈ (Finset.univ : Finset V).powerset, ((∏ j ∈ S, sgn (w j)) * ∏ j ∈ (Finset.univ : Finset V) \ S, base (w j)) * globalCenteredMonomial p S z := by rw [show (if z = w then (1 : ℝ) else 0) = ∏ j : V, if z j = w j then (1 : ℝ) else 0 by by_cases hzw : z = w · subst w simp · rw [if_neg hzw] obtain ⟨j, hj⟩ : ∃ j, z j ≠ w j := by simpa [funext_iff] using hzw exact (Finset.prod_eq_zero (Finset.mem_univ j) (by simp [hj])).symm] rw [show (∏ j : V, if z j = w j then (1 : ℝ) else 0) = ∏ j : V, (sgn (w j) * ((if z j then (1 : ℝ) else 0) - p) + base (w j)) by apply Finset.prod_congr rfl intro j hj cases hz : z j <;> cases hw : w j <;> simp [hz, hw, sgn, base] <;> ring] rw [Finset.prod_add] apply Finset.sum_congr rfl intro S hS rw [show (∏ i ∈ S, sgn (w i) * ((if z i then (1 : ℝ) else 0) - p)) = (∏ i ∈ S, sgn (w i)) * globalCenteredMonomial p S z by rw [Finset.prod_mul_distrib] rfl] ring calc F z = ∑ w : V → Bool, F w * (if z = w then (1 : ℝ) else 0) := by rw [Finset.sum_eq_single z] · simp · intro w hw hwz simp [Ne.symm hwz] · simp _ = ∑ w : V → Bool, F w * ∑ S ∈ (Finset.univ : Finset V).powerset, ((∏ j ∈ S, sgn (w j)) * ∏ j ∈ (Finset.univ : Finset V) \ S, base (w j)) * globalCenteredMonomial p S z := by apply Finset.sum_congr rfl intro w hw rw [hdelta w] _ = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z := by simp only [Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro S hS dsimp [a] rw [Finset.sum_mul] apply Finset.sum_congr rfl intro w hw ring
CausalSmith.Experimentation.SnipeDegreeFrontier.exists_globalCenteredMonomial_expansion · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part2.lean:30
theorem E_globalCenteredMonomial_mul

Orthogonality of global Bernoulli-centered monomials.

Formal statement
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
S T :
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => globalCenteredMonomial p S z * globalCenteredMonomial p T z)
= if S = T then (p * (1 - p)) ^ S.card else 0
Proof (Lean source)
lemma E_globalCenteredMonomial_mul (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (S T : Finset V) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => globalCenteredMonomial p S z * globalCenteredMonomial p T z) = if S = T then (p * (1 - p)) ^ S.card else 0 := by let x : Bool → ℝ := fun b => (if b then 1 else 0) - p rw [show (fun z : V → Bool => globalCenteredMonomial p S z * globalCenteredMonomial p T z) = (fun z => ∏ j, (if j ∈ S then x (z j) else 1) * (if j ∈ T then x (z j) else 1)) by funext z rw [Finset.prod_mul_distrib] simp [globalCenteredMonomial, x]] rw [E_global_coordinate_prod p hp0 hp1 (fun j b => (if j ∈ S then x b else 1) * (if j ∈ T then x b else 1))] by_cases hST : S = T · subst T rw [if_pos rfl] have hfactor (j : V) : p * ((if j ∈ S then x true else 1) * (if j ∈ S then x true else 1)) + (1 - p) * ((if j ∈ S then x false else 1) * (if j ∈ S then x false else 1)) = if j ∈ S then p * (1 - p) else 1 := by by_cases hj : j ∈ S <;> simp [hj, x] <;> ring simp_rw [hfactor] rw [Finset.prod_ite_mem] simp · rw [if_neg hST] have hdiff : ∃ j, (j ∈ S ∧ j ∉ T) ∨ (j ∈ T ∧ j ∉ S) := by by_contra h apply hST ext j constructor · intro hjS by_contra hjT exact h ⟨j, inl ⟨hjS, hjT⟩⟩ · intro hjT by_contra hjS exact h ⟨j, inr ⟨hjT, hjS⟩⟩ obtain ⟨j, hj⟩ := hdiff apply Finset.prod_eq_zero (Finset.mem_univ j) rcases hj with hj | hj · simp [hj.1, hj.2, x] ring · simp [hj.1, hj.2, x] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.E_globalCenteredMonomial_mul · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part2.lean:107
theorem globalCenteredMonomial_expansion_energy

Parseval's identity for a displayed global Bernoulli-Fourier expansion.

Formal statement
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
F :
(V → Bool) → ℝ
a :
Finset V → ℝ
ha :
∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => F z ^ 2)
= ∑ S ∈ (Finset.univ : Finset V).powerset, a S ^ 2 * (p * (1 - p)) ^ S.card
Proof (Lean source)
lemma globalCenteredMonomial_expansion_energy (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (F : (V → Bool) → ℝ) (a : Finset V → ℝ) (ha : ∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z) : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => F z ^ 2) = ∑ S ∈ (Finset.univ : Finset V).powerset, a S ^ 2 * (p * (1 - p)) ^ S.card := by let D := bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1) rw [show (fun z => F z ^ 2) = (fun z => (∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z) * (∑ T ∈ (Finset.univ : Finset V).powerset, a T * globalCenteredMonomial p T z)) by funext z rw [ha z] ring] simp only [Finset.sum_mul, Finset.mul_sum, FiniteDesign.E_sum] have hterm (S T : Finset V) : D.E (fun z => (a S * globalCenteredMonomial p S z) * (a T * globalCenteredMonomial p T z)) = a S * a T * (if S = T then (p * (1 - p)) ^ S.card else 0) := by rw [show (fun z => (a S * globalCenteredMonomial p S z) * (a T * globalCenteredMonomial p T z)) = (fun z => (a S * a T) * (globalCenteredMonomial p S z * globalCenteredMonomial p T z)) by funext z ring] rw [FiniteDesign.E_const_mul, E_globalCenteredMonomial_mul p hp0 hp1 S T] dsimp [D] at hterm simp_rw [hterm] apply Finset.sum_congr rfl intro S hS rw [Finset.sum_eq_single S] · rw [if_pos rfl] ring · intro T hT hTS rw [if_neg hTS] ring · intro hS' exact (hS' hS).elim
CausalSmith.Experimentation.SnipeDegreeFrontier.globalCenteredMonomial_expansion_energy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part2.lean:165
theorem globalCenteredMonomial_empty_coef_eq_zero

A displayed centered Fourier expansion has zero constant coefficient when the expanded function is centered.

Formal statement
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
F :
(V → Bool) → ℝ
a :
Finset V → ℝ
ha :
∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z
hmean :
(bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E F = 0
a ∅ = 0
Proof (Lean source)
lemma globalCenteredMonomial_empty_coef_eq_zero (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (F : (V → Bool) → ℝ) (a : Finset V → ℝ) (ha : ∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z) (hmean : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E F = 0) : a ∅ = 0 := by let D := bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1) rw [show F = fun z => ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z by funext z exact ha z, FiniteDesign.E_sum] at hmean have hterm (S : Finset V) : D.E (fun z => a S * globalCenteredMonomial p S z) = if S = ∅ then a S else 0 := by rw [FiniteDesign.E_const_mul] have h := E_globalCenteredMonomial_mul (V := V) p hp0 hp1 S ∅ have h' : (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (globalCenteredMonomial p S) = if S = ∅ then (p * (1 - p)) ^ S.card else 0 := by have hempty : globalCenteredMonomial p (∅ : Finset V) = fun _ => (1 : ℝ) := funext fun _ => Finset.prod_empty rw [hempty] at h simpa using h change a S * (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (globalCenteredMonomial p S) = if S = ∅ then a S else 0 rw [h'] by_cases hS : S = ∅ <;> simp [hS] dsimp [D] at hterm simp_rw [hterm] at hmean simpa using hmean
CausalSmith.Experimentation.SnipeDegreeFrontier.globalCenteredMonomial_empty_coef_eq_zero · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part2.lean:218
def DependsOnBlock

Dependence on a designated finite coordinate block.

Definition (Lean source)
def DependsOnBlock (N : Finset V) (F : (V → Bool) → ℝ) : Prop := ∀ z z', (∀ j ∈ N, z j = z' j) → F z = F z'
CausalSmith.Experimentation.SnipeDegreeFrontier.DependsOnBlock · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part2.lean:260
theorem globalCenteredMonomial_coef_eq_zero_of_not_subset

A centered Fourier coefficient outside the coordinate block on which a function depends vanishes.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
N :
F :
(V → Bool) → ℝ
hF :
DependsOnBlock N F
a :
Finset V → ℝ
ha :
∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z
S :
hS :
S ∈ (Finset.univ : Finset V).powerset
hSN :
¬ S ⊆ N
a S = 0
Proof (Lean source)
lemma globalCenteredMonomial_coef_eq_zero_of_not_subset (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (N : Finset V) (F : (V → Bool) → ℝ) (hF : DependsOnBlock N F) (a : Finset V → ℝ) (ha : ∀ z, F z = ∑ S ∈ (Finset.univ : Finset V).powerset, a S * globalCenteredMonomial p S z) (S : Finset V) (hS : S ∈ (Finset.univ : Finset V).powerset) (hSN : ¬ S ⊆ N) : a S = 0 := by classical obtain ⟨j, hjS, hjN⟩ : ∃ j, j ∈ S ∧ j ∉ N := by simpa only [Finset.not_subset] using hSN let Dcoin : V → FiniteDesign Bool := fun _ => coinDesign p (le_of_lt hp0) (le_of_lt hp1) let x : Bool → ℝ := fun b => (if b then 1 else 0) - p let R : (V → Bool) → ℝ := fun z => F z * globalCenteredMonomial p (S.erase j) z have hfactor : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => F z * globalCenteredMonomial p S z) = 0 := by unfold bernoulliDesign rw [show (fun z => F z * globalCenteredMonomial p S z) = (fun z => x (z j) * R z) by funext z dsimp [R, x, globalCenteredMonomial] rw [← Finset.mul_prod_erase S (fun k => (if z k then (1 : ℝ) else 0) - p) hjS] ring] rw [FiniteDesign.E_prod_block_mul Dcoin {j} (fun z => x (z j)) R] · have hx : (prodDesign Dcoin).E (fun z => x (z j)) = 0 := by change (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => x (z j)) = 0 rw [show (fun z : V → Bool => x (z j)) = (fun z => ∏ k, if k = j then x (z k) else 1) by funext z rw [Finset.prod_eq_single j] · simp · intro k hk hkj simp [hkj] · simp] rw [E_global_coordinate_prod p (le_of_lt hp0) (le_of_lt hp1) (fun k b => if k = j then x b else 1)] apply Finset.prod_eq_zero (Finset.mem_univ j) simp [x] ring rw [hx, zero_mul] · intro z z' hzz exact congrArg x (hzz j (by simp)) · intro z z' hzz dsimp [R] congr 1 · apply hF z z' intro k hkN exact hzz k (by simp only [mem_singleton] intro hkj subst k exact hjN hkN) · unfold globalCenteredMonomial apply Finset.prod_congr rfl intro k hk rw [hzz k] simp only [mem_singleton] exact Finset.ne_of_mem_erase hk have hcoef : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => F z * globalCenteredMonomial p S z) = a S * (p * (1 - p)) ^ S.card := by rw [show (fun z => F z * globalCenteredMonomial p S z) = (fun z => ∑ T ∈ (Finset.univ : Finset V).powerset, a T * (globalCenteredMonomial p T z * globalCenteredMonomial p S z)) by funext z rw [ha z, Finset.sum_mul] apply Finset.sum_congr rfl intro T hT ring] rw [FiniteDesign.E_sum] simp_rw [FiniteDesign.E_const_mul, E_globalCenteredMonomial_mul p (le_of_lt hp0) (le_of_lt hp1)] rw [Finset.sum_eq_single S] · simp · intro T hT hTS simp [hTS] · exact fun h => (h hS).elim rw [hfactor] at hcoef have hv : 0 < p * (1 - p) := mul_pos hp0 (sub_pos.mpr hp1) exact (mul_eq_zero.mp hcoef.symm).resolve_right (pow_ne_zero _ hv.ne')
CausalSmith.Experimentation.SnipeDegreeFrontier.globalCenteredMonomial_coef_eq_zero_of_not_subset · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part2.lean:265
Helpers.SnipeVariance_Part3 4 declarations Bounds the second moment of a sum of block-dependent terms by the maximum degree times the total energy, and applies it to the SNIPE score to obtain the single-overlap variance bound.

The degree-weighted second-moment bound

Bounds the second moment of a sum of block-dependent terms by the maximum degree times the total energy, and applies it to the SNIPE score to obtain the single-overlap variance bound.

theorem E_sum_sq_le_degree_mul_sum_energy

The variance of a sum of centered block-dependent functions is bounded by one out-degree charge times the sum of their individual energies.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
G :
V → V → Prop
d :
hdegree :
F :
V → (V → Bool) → ℝ
hmean :
∀ i,
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (F i)
= 0
hdep :
∀ i, DependsOnBlock (nbhd G i) (F i)
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (∑ i : V, F i z) ^ 2)
≤ (d : ℝ) * ∑ i : V, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => F i z ^ 2)
Proof (Lean source)
lemma E_sum_sq_le_degree_mul_sum_energy (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (G : V → V → Prop) (d : ℕ) (hdegree : BoundedDegree G d) (F : V → (V → Bool) → ℝ) (hmean : ∀ i, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (F i) = 0) (hdep : ∀ i, DependsOnBlock (nbhd G i) (F i)) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (∑ i : V, F i z) ^ 2) ≤ (d : ℝ) * ∑ i : V, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => F i z ^ 2) := by classical choose a ha using fun i => exists_globalCenteredMonomial_expansion (V := V) p (F i) have ha0 (i : V) : a i ∅ = 0 := globalCenteredMonomial_empty_coef_eq_zero p (le_of_lt hp0) (le_of_lt hp1) (F i) (a i) (ha i) (hmean i) have haOut (i : V) (S : Finset V) (hS : S ∈ (Finset.univ : Finset V).powerset) (hSN : ¬ S ⊆ nbhd G i) : a i S = 0 := globalCenteredMonomial_coef_eq_zero_of_not_subset p hp0 hp1 (nbhd G i) (F i) (hdep i) (a i) (ha i) S hS hSN let I : Finset V → Finset V := fun S => Finset.univ.filter (fun i => S ⊆ nbhd G i) have hcardI (S : Finset V) (hSne : S.Nonempty) : (I S).card ≤ d := by obtain ⟨j, hjS⟩ := hSne have hsub : I S ⊆ outNbhd G j := by intro i hi have hSi : S ⊆ nbhd G i := (Finset.mem_filter.mp hi).2 have hji : j ∈ nbhd G i := hSi hjS simpa [outNbhd, nbhd] using hji exact (Finset.card_le_card hsub).trans (hdegree.2 j) have hsumI (S : Finset V) (hS : S ∈ (Finset.univ : Finset V).powerset) : (∑ i : V, a i S) = ∑ i ∈ I S, a i S := by symm apply Finset.sum_subset_zero_on_sdiff · exact Finset.subset_univ _ · intro i hi apply haOut i S hS simpa [I] using (Finset.mem_sdiff.mp hi).2 · intro i hi rfl let A : Finset V → ℝ := fun S => ∑ i : V, a i S have hsumExpansion (z : V → Bool) : (∑ i : V, F i z) = ∑ S ∈ (Finset.univ : Finset V).powerset, A S * globalCenteredMonomial p S z := by simp_rw [ha] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro S hS dsimp [A] rw [Finset.sum_mul] rw [globalCenteredMonomial_expansion_energy p (le_of_lt hp0) (le_of_lt hp1) (fun z => ∑ i : V, F i z) A hsumExpansion] calc (∑ S ∈ (Finset.univ : Finset V).powerset, A S ^ 2 * (p * (1 - p)) ^ S.card) ≤ ∑ S ∈ (Finset.univ : Finset V).powerset, (d : ℝ) * (∑ i : V, (a i S) ^ 2) * (p * (1 - p)) ^ S.card := by apply Finset.sum_le_sum intro S hS by_cases hSne : S.Nonempty · have hCS : (∑ i ∈ I S, a i S) ^ 2 ≤ ((I S).card : ℝ) * ∑ i ∈ I S, (a i S) ^ 2 := sq_sum_le_card_mul_sum_sq have hcardR : ((I S).card : ℝ) ≤ d := by exact_mod_cast hcardI S hSne have hsquares : 0 ≤ ∑ i ∈ I S, (a i S) ^ 2 := by positivity have hCS' : A S ^ 2 ≤ (d : ℝ) * ∑ i : V, (a i S) ^ 2 := by rw [show A S = ∑ i ∈ I S, a i S by exact hsumI S hS] calc (∑ i ∈ I S, a i S) ^ 2 ≤ ((I S).card : ℝ) * ∑ i ∈ I S, (a i S) ^ 2 := hCS _ ≤ (d : ℝ) * ∑ i ∈ I S, (a i S) ^ 2 := mul_le_mul_of_nonneg_right hcardR hsquares _ ≤ (d : ℝ) * ∑ i : V, (a i S) ^ 2 := by apply mul_le_mul_of_nonneg_left · exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) (fun _ _ _ => sq_nonneg _) · positivity exact mul_le_mul_of_nonneg_right hCS' (pow_nonneg (mul_nonneg (le_of_lt hp0) (le_of_lt (sub_pos.mpr hp1))) _) · have hSe : S = ∅ := Finset.not_nonempty_iff_eq_empty.mp hSne subst S simp [A, ha0] _ = (d : ℝ) * ∑ i : V, ∑ S ∈ (Finset.univ : Finset V).powerset, (a i S) ^ 2 * (p * (1 - p)) ^ S.card := by rw [show (∑ S ∈ (Finset.univ : Finset V).powerset, (d : ℝ) * (∑ i : V, (a i S) ^ 2) * (p * (1 - p)) ^ S.card) = ∑ S ∈ (Finset.univ : Finset V).powerset, ∑ i : V, (d : ℝ) * (a i S) ^ 2 * (p * (1 - p)) ^ S.card by apply Finset.sum_congr rfl intro S hS rw [Finset.mul_sum, Finset.sum_mul]] rw [Finset.sum_comm, Finset.mul_sum] apply Finset.sum_congr rfl intro i hi rw [Finset.mul_sum] apply Finset.sum_congr rfl intro S hS ring _ = (d : ℝ) * ∑ i : V, (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => F i z ^ 2) := by apply congrArg apply Finset.sum_congr rfl intro i hi symm exact globalCenteredMonomial_expansion_energy p (le_of_lt hp0) (le_of_lt hp1) (F i) (a i) (ha i)
CausalSmith.Experimentation.SnipeDegreeFrontier.E_sum_sq_le_degree_mul_sum_energy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part3.lean:26
theorem snipeScore_sq_expectation_for_variance

Exact second moment of a global SNIPE score.

Formal statement
G :
V → V → Bool
β :
p :
hp0 :
0 < p
hp1 :
p < 1
i :
V
(bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore G β p i z ^ 2)
= blockEnergy β p (nbhdB G i).card
Proof (Lean source)
lemma snipeScore_sq_expectation_for_variance (G : V → V → Bool) (β : ℕ) (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (i : V) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => snipeScore G β p i z ^ 2) = blockEnergy β p (nbhdB G i).card := by let v := p * (1 - p) have hv : v ≠ 0 := mul_ne_zero hp0.ne' (sub_pos.mpr hp1).ne' simp only [snipeScore, pow_two, Finset.sum_mul, Finset.mul_sum, FiniteDesign.E_sum] have hmoment (r q : ℕ) (S T : Finset V) : (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (bernoulliContrast p q / v ^ q * globalCenteredMonomial p T z) * (bernoulliContrast p r / v ^ r * globalCenteredMonomial p S z)) = (bernoulliContrast p q / v ^ q) * (bernoulliContrast p r / v ^ r) * (if T = S then v ^ T.card else 0) := by calc _ = (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((bernoulliContrast p q / v ^ q) * (bernoulliContrast p r / v ^ r)) * (globalCenteredMonomial p T z * globalCenteredMonomial p S z)) := by apply FiniteDesign.E_congr intro z ring _ = _ := by rw [FiniteDesign.E_const_mul, E_globalCenteredMonomial_mul p (le_of_lt hp0) (le_of_lt hp1)] simpa only [globalCenteredMonomial] using (show (∑ r ∈ Icc 1 (effBeta β (nbhdB G i).card), ∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), ∑ q ∈ Icc 1 (effBeta β (nbhdB G i).card), ∑ T ∈ (nbhdB G i).powerset.filter (fun T => T.card = q), (bernoulliDesign (fun _ : V => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => (bernoulliContrast p q / (p * (1 - p)) ^ q * globalCenteredMonomial p T z) * (bernoulliContrast p r / (p * (1 - p)) ^ r * globalCenteredMonomial p S z))) = blockEnergy β p (nbhdB G i).card by dsimp [v] at hmoment simp_rw [hmoment] simp [blockEnergy] apply Finset.sum_congr rfl intro r hr have hrle : r ≤ effBeta β (nbhdB G i).card := (Finset.mem_Icc.mp hr).2 rw [show (∑ S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), ∑ q ∈ Icc 1 (effBeta β (nbhdB G i).card), if S ⊆ nbhdB G i ∧ S.card = q then bernoulliContrast p q / (p * (1 - p)) ^ q * (bernoulliContrast p r / (p * (1 - p)) ^ r) * (p * (1 - p)) ^ S.card else 0) = ∑ _S ∈ (nbhdB G i).powerset.filter (fun S => S.card = r), bernoulliContrast p r / (p * (1 - p)) ^ r * (bernoulliContrast p r / (p * (1 - p)) ^ r) * (p * (1 - p)) ^ r by apply Finset.sum_congr rfl intro S hS have hSmem := Finset.mem_filter.mp hS have hSsub := Finset.mem_powerset.mp hSmem.1 have hScard := hSmem.2 rw [Finset.sum_eq_single r] · simp [hSsub, hScard, hr] · intro q hq hqr simp [hScard, hqr.symm] · intro hnot exact (hnot hr).elim] rw [show (nbhdB G i).powerset.filter (fun S => S.card = r) = (nbhdB G i).powersetCard r by ext S simp [Finset.mem_powersetCard]] rw [Finset.sum_const, Finset.card_powersetCard] simp only [nsmul_eq_mul] field_simp)
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore_sq_expectation_for_variance · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part3.lean:157
theorem potentialOutcome_dependsOnBlock

A potential outcome depends only on its graph neighborhood.

Formal statement
G :
V → V → Prop
c :
V → Finset V → ℝ
i :
V
DependsOnBlock (nbhd G i) (potentialOutcome G c i)
Proof (Lean source)
lemma potentialOutcome_dependsOnBlock (G : V → V → Prop) (c : V → Finset V → ℝ) (i : V) : DependsOnBlock (nbhd G i) (potentialOutcome G c i) := by intro z z' hzz unfold potentialOutcome apply Finset.sum_congr rfl intro S hS congr 1 apply Finset.prod_congr rfl intro j hj rw [hzz j ((Finset.mem_powerset.mp hS) hj)]
CausalSmith.Experimentation.SnipeDegreeFrontier.potentialOutcome_dependsOnBlock · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part3.lean:247
theorem snipeScore_dependsOnBlock

A SNIPE score depends only on the neighborhood read from its graph argument.

Formal statement
G :
V → V → Bool
β :
p :
i :
V
DependsOnBlock (nbhdB G i) (snipeScore G β p i)
Proof (Lean source)
lemma snipeScore_dependsOnBlock (G : V → V → Bool) (β : ℕ) (p : ℝ) (i : V) : DependsOnBlock (nbhdB G i) (snipeScore G β p i) := by intro z z' hzz unfold snipeScore apply Finset.sum_congr rfl intro r hr congr 1 apply Finset.sum_congr rfl intro S hS apply Finset.prod_congr rfl intro j hj rw [hzz j ((Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1) hj)]
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeScore_dependsOnBlock · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part3.lean:260
Helpers.SnipeVariance_Part4 4 declarations Assembles the variance bound into a mean-squared-error bound for the estimator at a fixed model, then takes worst cases to bound the risk over the coefficient-mass and bounded-outcome model classes.

Mean-squared error and worst-case risk of the SNIPE estimator

Assembles the variance bound into a mean-squared-error bound for the estimator at a fixed model, then takes worst cases to bound the risk over the coefficient-mass and bounded-outcome model classes.

theorem riskAt_snipe_le

Modelwise form of the sharp coefficient-class SNIPE risk bound.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
M :
ModelClass V d β B
riskAt p (le_of_lt hp0) (le_of_lt hp1) M (snipeEstimator β p)
≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V
Proof (Lean source)
lemma riskAt_snipe_le (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (M : ModelClass V d β B) : riskAt p (le_of_lt hp0) (le_of_lt hp1) M (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V := by letI : DecidableRel M.edge := M.decEdge unfold riskAt edgeFn exact snipe_model_mse_le p hp0 hp1 M.edge M.coef d β B M.degree_le M.low_order (potentialOutcome_abs_le_of_mass M.edge M.coef B M.mass_le)
CausalSmith.Experimentation.SnipeDegreeFrontier.riskAt_snipe_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part4.lean:222
theorem riskAtBdd_snipe_le

Modelwise form of the sharp bounded-outcome SNIPE risk bound.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
M :
riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) M (snipeEstimator β p)
≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V
Proof (Lean source)
lemma riskAtBdd_snipe_le (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (M : BddOutcomeModelClass V d β B) : riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) M (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V := by letI : DecidableRel M.edge := M.decEdge unfold riskAtBdd edgeFnBdd exact snipe_model_mse_le p hp0 hp1 M.edge M.coef d β B M.degree_le M.low_order M.outcome_bound
CausalSmith.Experimentation.SnipeDegreeFrontier.riskAtBdd_snipe_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part4.lean:235
theorem worstRisk_snipe_le

The unclipped coefficient-class worst risk has the sharp unit constant.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
d β :
B :
worstRisk (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p)
≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V
Proof (Lean source)
lemma worstRisk_snipe_le (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (d β : ℕ) (B : ℝ) : worstRisk (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V := by unfold worstRisk by_cases hM : Nonempty (ModelClass V d β B) · apply csSup_le · exact Set.range_nonempty _ · intro r hr rcases hr with ⟨M, rfl⟩ letI : DecidableRel M.edge := M.decEdge unfold riskAt edgeFn exact snipe_model_mse_le p hp0 hp1 M.edge M.coef d β B M.degree_le M.low_order (potentialOutcome_abs_le_of_mass M.edge M.coef B M.mass_le) · have hrange : range (fun M : ModelClass V d β B => riskAt p (le_of_lt hp0) (le_of_lt hp1) M (snipeEstimator β p)) = ∅ := by ext r simp only [Set.mem_range, Set.mem_empty_iff_false, iff_false] rintro ⟨M, rfl⟩ exact hM ⟨M⟩ rw [hrange, Real.sSup_empty] apply div_nonneg · apply mul_nonneg · apply mul_nonneg (sq_nonneg B) positivity · unfold blockEnergy apply sum_nonneg intro r hr apply div_nonneg · positivity · exact pow_nonneg (mul_nonneg (le_of_lt hp0) (sub_nonneg.mpr (le_of_lt hp1))) _ · positivity
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRisk_snipe_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part4.lean:247
theorem worstRiskBdd_snipe_le

The identical unclipped bound holds on the bounded-outcome class.

Formal statement
p :
hp0 :
0 < p
hp1 :
p < 1
d β :
B :
worstRiskBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p)
≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V
Proof (Lean source)
lemma worstRiskBdd_snipe_le (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (d β : ℕ) (B : ℝ) : worstRiskBdd (V := V) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / card V := by unfold worstRiskBdd by_cases hM : Nonempty (BddOutcomeModelClass V d β B) · apply csSup_le · exact Set.range_nonempty _ · intro r hr rcases hr with ⟨M, rfl⟩ letI : DecidableRel M.edge := M.decEdge unfold riskAtBdd edgeFnBdd exact snipe_model_mse_le p hp0 hp1 M.edge M.coef d β B M.degree_le M.low_order M.outcome_bound · have hrange : range (fun M : BddOutcomeModelClass V d β B => riskAtBdd p (le_of_lt hp0) (le_of_lt hp1) M (snipeEstimator β p)) = ∅ := by ext r simp only [Set.mem_range, Set.mem_empty_iff_false, iff_false] rintro ⟨M, rfl⟩ exact hM ⟨M⟩ rw [hrange, Real.sSup_empty] apply div_nonneg · apply mul_nonneg · apply mul_nonneg (sq_nonneg B) positivity · unfold blockEnergy apply sum_nonneg intro r hr apply div_nonneg · positivity · exact pow_nonneg (mul_nonneg (le_of_lt hp0) (sub_nonneg.mpr (le_of_lt hp1))) _ · positivity
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRiskBdd_snipe_le · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/Helpers/SnipeVariance_Part4.lean:287
T_bounded_outcome_frontier 1 declarations This is the paper's headline finite-population theorem.

Simultaneous coefficient-mass and bounded-outcome degree frontier

This is the paper's headline finite-population theorem. Its constants are quantified outside population size, degree, and envelope, so they depend only on the fixed interaction order and Bernoulli probability. The supporting model-class and exact-risk lemmas live in the two sibling parts imported above.

theorem bounded_outcome_degree_frontier Theorem 2 in the paper ↗

The simultaneous matched degree frontier over both bounded model classes.

Formal statement
β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
∃ cLower cUpper : ℝ
if
0 < cLower ∧
cLower ≤ cUpper ∧
∀ (n : ℕ) (D : FiniteDesign (Fin n → Bool)) (d : ℕ) (B : ℝ), 1 ≤ n
and
and
0 ≤ B
then
ModelClassIncluded (Fin n) d β B ∧
(0 < B → 1 ≤ d → ModelClassStrict (Fin n) d β B) ∧
cLower * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n)
minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧
minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B
= minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧
minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B
minimaxRiskBddOutcome (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧
minimaxRiskBddOutcome (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B
worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p) ∧
worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p)
≤ cUpper * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) ∧
worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p)
≤ cUpper * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) ∧
(∀ M : ModelClass (Fin n) d β B, D.Unbiased (fun z => snipeEstimator β p (edgeFn M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)) ∧
(∀ M : BddOutcomeModelClass (Fin n) d β B, D.Unbiased (fun z => snipeEstimator β p (edgeFnBdd M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)) ∧
worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p)
≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / n ∧
worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p)
≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / n ∧
(∀ M : ModelClass (Fin n) d β B, ∀ i, localEnergy M.edge β p i ≤ blockEnergy β p d) ∧
(∀ M : BddOutcomeModelClass (Fin n) d β B, ∀ i, localEnergy M.edge β p i ≤ blockEnergy β p d) ∧
cLower * (d : ℝ) * choose d (kStar d β p) ≤ (d : ℝ) * blockEnergy β p d ∧
(d : ℝ) * blockEnergy β p d ≤ cUpper * (d : ℝ) * choose d (kStar d β p) ∧
(1 ≤ d → d ∣ n → let m := n / d worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRiskBddFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ B ^ 2 * blockEnergy β p d / m = B ^ 2 * (d : ℝ) * blockEnergy β p d / n) ∧
(0 < B → 1 ≤ d → let m := blockCount n d let ρ := activeShare n d let δ := tiltAmplitude B β p m d (∀ U : Fin m → ℝ, (∀ b, |U b| ≤ B / 2) → (∃ Mplus : ModelClass (Fin n) d β B, Mplus.edge = blockGraph n d ∧ Mplus.coef = blockSchedule n d β B p 1 (by norm_num) U) ∧ (∃ Mminus : ModelClass (Fin n) d β B, Mminus.edge = blockGraph n d ∧ Mminus.coef = blockSchedule n d β B p (-1) (by norm_num) U) ∧ tte (blockGraph n d) (blockSchedule n d β B p 1 (by norm_num) U) = ρ * δ ∧ tte (blockGraph n d) (blockSchedule n d β B p (-1) (by norm_num) U) = -ρ * δ) ∧ hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1)) ≤ 4 * pi ^ 2 * m * δ ^ 2 / (B ^ 2 * blockEnergy β p d) ∧ (1 / 2 : ℝ) ≤ ρ ∧ ρ ≤ 1 ∧ blockEnergy β p d / m = ((d : ℝ) * blockEnergy β p d / n) / ρ)
Proof (Lean source)
-- @node: thm:bounded-outcome-degree-frontier theorem bounded_outcome_degree_frontier (β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) : ∃ cLower cUpper : ℝ, 0 < cLower ∧ cLower ≤ cUpper ∧ ∀ (n : ℕ) (D : FiniteDesign (Fin n → Bool)) (d : ℕ) (B : ℝ), 1 ≤ n → DegreeIndex (Fin n) d → 0 ≤ B → IsProductBernoulli D p → ModelClassIncluded (Fin n) d β B ∧ (0 < B → 1 ≤ d → ModelClassStrict (Fin n) d β B) ∧ cLower * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) ≤ minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧ minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B = minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧ minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ≤ minimaxRiskBddOutcome (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧ minimaxRiskBddOutcome (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ≤ worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p) ∧ worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p) ≤ cUpper * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) ∧ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ≤ cUpper * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) ∧ (∀ M : ModelClass (Fin n) d β B, D.Unbiased (fun z => snipeEstimator β p (edgeFn M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)) ∧ (∀ M : BddOutcomeModelClass (Fin n) d β B, D.Unbiased (fun z => snipeEstimator β p (edgeFnBdd M) z (obsOutcome M.edge M.coef z)) (tte M.edge M.coef)) ∧ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / n ∧ worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / n ∧ (∀ M : ModelClass (Fin n) d β B, ∀ i, localEnergy M.edge β p i ≤ blockEnergy β p d) ∧ (∀ M : BddOutcomeModelClass (Fin n) d β B, ∀ i, localEnergy M.edge β p i ≤ blockEnergy β p d) ∧ cLower * (d : ℝ) * choose d (kStar d β p) ≤ (d : ℝ) * blockEnergy β p d ∧ (d : ℝ) * blockEnergy β p d ≤ cUpper * (d : ℝ) * choose d (kStar d β p) ∧ (1 ≤ d → d ∣ n → let m := n / d worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRiskBddFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ B ^ 2 * blockEnergy β p d / m = B ^ 2 * (d : ℝ) * blockEnergy β p d / n) ∧ (0 < B → 1 ≤ d → let m := blockCount n d let ρ := activeShare n d let δ := tiltAmplitude B β p m d (∀ U : Fin m → ℝ, (∀ b, |U b| ≤ B / 2) → (∃ Mplus : ModelClass (Fin n) d β B, Mplus.edge = blockGraph n d ∧ Mplus.coef = blockSchedule n d β B p 1 (by norm_num) U) ∧ (∃ Mminus : ModelClass (Fin n) d β B, Mminus.edge = blockGraph n d ∧ Mminus.coef = blockSchedule n d β B p (-1) (by norm_num) U) ∧ tte (blockGraph n d) (blockSchedule n d β B p 1 (by norm_num) U) = ρ * δ ∧ tte (blockGraph n d) (blockSchedule n d β B p (-1) (by norm_num) U) = -ρ * δ) ∧ hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1)) ≤ 4 * pi ^ 2 * m * δ ^ 2 / (B ^ 2 * blockEnergy β p d) ∧ (1 / 2 : ℝ) ≤ ρ ∧ ρ ≤ 1 ∧ blockEnergy β p d / m = ((d : ℝ) * blockEnergy β p d / n) / ρ) := by obtain ⟨c₁, c₂, H, hc₁, hc₁₂, hH, henergy⟩ := blockEnergy_representer β p hβ hp0 hp1 let κ : ℝ := min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹) let cLower : ℝ := min c₁ (κ ^ 2 / 16) let cUpper : ℝ := max 16 c₂ have hκ : 0 < κ := by dsimp [κ] have hmass := representerMassSup_pos β p hβ hp0 hp1 positivity have hcLower : 0 < cLower := by dsimp [cLower] positivity have hcUpper : cLower ≤ cUpper := by calc cLower ≤ c₁ := min_le_left _ _ _ ≤ c₂ := hc₁₂ _ ≤ cUpper := le_max_right _ _ refine ⟨cLower, cUpper, hcLower, hcUpper, ?_⟩ intro n D d B hn hdeg hB hD have hdn : d ≤ n := by simpa [DegreeIndex] using hdeg letI : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩ have hinc := modelClassIncluded_of_coeffMass (V := Fin n) d β B have hraw : worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / n := by simpa using worstRisk_snipe_le (V := Fin n) p hp0 hp1 d β B have hrawBdd : worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / n := by simpa using worstRiskBdd_snipe_le (V := Fin n) p hp0 hp1 d β B have hclip : worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ≤ 4 * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) := by simpa using worstRisk_clipped_le_min (V := Fin n) p hp0 hp1 d β B hB have hclipBdd : worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClippedBdd B β p) ≤ 16 * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) := by simpa using worstRiskBdd_clipped_le_min (V := Fin n) p hp0 hp1 d β B hB have hA0 : 0 ≤ blockEnergy β p d := by unfold blockEnergy apply sum_nonneg intro r hr apply div_nonneg · positivity · exact pow_nonneg (mul_nonneg (le_of_lt hp0) (sub_nonneg.mpr (le_of_lt hp1))) _ have hminiBdd := minimaxRiskBdd_le_clipped (V := Fin n) p hp0 hp1 d β B hB have hmono := minimaxRiskL1_le_minimaxRiskBdd (V := Fin n) p hp0 hp1 d β B hB refine ⟨hinc, ?_, ?_, rfl, hmono, hminiBdd, ?_, ?_, ?_, ?_, hraw, hrawBdd, ?_, ?_, ?_, ?_, ?_, ?_⟩ · intro hBpos hd exact strictModelClass_completeWitness n d β B hn hd hBpos hβ · exact minimaxRisk_scaled_block_lower β p hβ hp0 hp1 κ cLower rfl (min_le_right _ _) n d B hn hdeg hB · exact hclipBdd.trans (by have hc : (16 : ℝ) ≤ cUpper := le_max_left _ _ have hmin : 0 ≤ min 1 ((d : ℝ) * blockEnergy β p d / n) := by positivity simpa [mul_assoc] using mul_le_mul_of_nonneg_right hc (mul_nonneg (sq_nonneg B) hmin)) · exact hclip.trans (by have hc : (4 : ℝ) ≤ cUpper := (by norm_num : (4 : ℝ) ≤ 16) |>.trans (le_max_left _ _) have hmin : 0 ≤ min 1 ((d : ℝ) * blockEnergy β p d / n) := by positivity simpa [mul_assoc] using mul_le_mul_of_nonneg_right hc (mul_nonneg (sq_nonneg B) hmin)) · intro M obtain ⟨hpD0, hpD1, hp0D, hp1D, hDeq⟩ := hD subst D simpa using snipe_unbiased p hp0 hp1 M · intro M obtain ⟨hpD0, hpD1, hp0D, hp1D, hDeq⟩ := hD subst D simpa using snipe_unbiased_bdd p hp0 hp1 M · intro M i exact localEnergy_le_blockEnergy M.edge d β p hp0 hp1 M.degree_le i · intro M i exact localEnergy_le_blockEnergy M.edge d β p hp0 hp1 M.degree_le i · by_cases hd : 1 ≤ d · have hc : cLower ≤ c₁ := min_le_left _ _ calc cLower * (d : ℝ) * choose d (kStar d β p) = (d : ℝ) * (cLower * choose d (kStar d β p)) := by ring _ ≤ (d : ℝ) * (c₁ * choose d (kStar d β p)) := by gcongr _ ≤ (d : ℝ) * blockEnergy β p d := by gcongr exact (henergy d hd).1 · have hd0 : d = 0 := by omega simp [hd0] · have hc : c₂ ≤ cUpper := le_max_right _ _ by_cases hd : 1 ≤ d · have he := (henergy d hd).2.1 nlinarith [mul_nonneg (show 0 ≤ (d : ℝ) by positivity) (show 0 ≤ (choose d (kStar d β p) : ℝ) by positivity)] · have hd0 : d = 0 := by omega simp [hd0] · exact completeBlock_all_risks_exact n d β B p hp0 hp1 hn hβ hB · intro hBpos hd dsimp only constructor · intro U hU refine ⟨⟨blockScheduleModel n d β B p 1 hn hd hdn hB hβ hp0 hp1 (inr rfl) U hU, rfl, rfl⟩, ⟨blockScheduleModel n d β B p (-1) hn hd hdn hB hβ hp0 hp1 (inl rfl) U hU, rfl, rfl⟩, ?_, ?_⟩ · simpa [mul_assoc] using tte_blockSchedule n d β B p 1 hn hd hβ hp0 hp1 (inr rfl) U · simpa [mul_assoc] using tte_blockSchedule n d β B p (-1) hn hd hβ hp0 hp1 (inl rfl) U · refine ⟨blockPrior_hellinger_le n d β B p hn hd hdn hBpos hβ hp0 hp1, ?_⟩ obtain ⟨hρlo, hρhi⟩ := activeShare_bounds n d hn hd hdn exact ⟨hρlo, hρhi, blockEnergy_div_blockCount n d β p hn hd hdn⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.bounded_outcome_degree_frontier · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier.lean:27
T_bounded_outcome_frontier_Part1 8 declarations Relates the coefficient-mass and bounded-outcome model classes, defines the worst-case risks at a fixed interaction graph, exhibits a strict witness model, and proves the scaled-block lower bound on the minimax risk.

Model-class inclusion and the scaled-block minimax lower bound

Relates the coefficient-mass and bounded-outcome model classes, defines the worst-case risks at a fixed interaction graph, exhibits a strict witness model, and proves the scaled-block lower bound on the minimax risk.

Carrier-preserving inclusion of the coefficient-mass model in the bounded-outcome model.

Definition (Lean source)
def ModelClassIncluded (V : Type*) [Fintype V] [DecidableEq V] (d β : ℕ) (B : ℝ) : Prop := ∀ M : ModelClass V d β B, ∃ N : BddOutcomeModelClass V d β B, N.edge = M.edge ∧ N.coef = M.coef
CausalSmith.Experimentation.SnipeDegreeFrontier.ModelClassIncluded · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part1.lean:24

Strictness means that some bounded-outcome carrier pair has no coefficient-mass realization with the same graph and schedule.

Definition (Lean source)
def ModelClassStrict (V : Type*) [Fintype V] [DecidableEq V] (d β : ℕ) (B : ℝ) : Prop := ModelClassIncluded V d β B ∧ ∃ N : BddOutcomeModelClass V d β B, ¬ ∃ M : ModelClass V d β B, N.edge = M.edge ∧ N.coef = M.coef
theorem modelClassIncluded_of_coeffMass Lemma modelClassIncluded_of_coeffMass in the paper ↗

The coefficient-mass envelope implies the uniform potential-outcome envelope, without changing either carrier component.

Formal statement
V :
d β :
B :
Proof (Lean source)
lemma modelClassIncluded_of_coeffMass {V : Type*} [Fintype V] [DecidableEq V] (d β : ℕ) (B : ℝ) : ModelClassIncluded V d β B := by classical intro M let N : BddOutcomeModelClass V d β B := { edge := M.edge decEdge := M.decEdge coef := M.coef supported := M.supported degree_le := M.degree_le low_order := M.low_order outcome_bound := by intro i z unfold potentialOutcome calc |∑ S ∈ (nbhd M.edge i).powerset, M.coef i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0| ≤ ∑ S ∈ (nbhd M.edge i).powerset, |M.coef i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ S ∈ (nbhd M.edge i).powerset, |M.coef i S| := by apply Finset.sum_le_sum intro S hS rw [abs_mul] apply mul_le_of_le_one_right (abs_nonneg _) rw [Finset.abs_prod] exact Finset.prod_le_one (fun _ _ => abs_nonneg _) (fun j _ => by cases z j <;> norm_num) _ ≤ B := M.mass_le i } exact ⟨N, rfl, rfl⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.modelClassIncluded_of_coeffMass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part1.lean:41

Worst risk restricted to models whose graph is a prescribed relation.

Definition (Lean source)
noncomputable def worstRiskFixedGraph {V : Type*} [Fintype V] [DecidableEq V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (G : V → V → Prop) (d β : ℕ) (B : ℝ) (est : Estimator V) : ℝ := sSup {r : ℝ | ∃ M : ModelClass V d β B, M.edge = G ∧ r = riskAt p hp0 hp1 M est}
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRiskFixedGraph · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part1.lean:78

Bounded-outcome analogue of worstRiskFixedGraph.

Definition (Lean source)
noncomputable def worstRiskBddFixedGraph {V : Type*} [Fintype V] [DecidableEq V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (G : V → V → Prop) (d β : ℕ) (B : ℝ) (est : Estimator V) : ℝ := sSup {r : ℝ | ∃ M : BddOutcomeModelClass V d β B, M.edge = G ∧ r = riskAtBdd p hp0 hp1 M est}
CausalSmith.Experimentation.SnipeDegreeFrontier.worstRiskBddFixedGraph · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part1.lean:86
theorem strictModelClass_completeWitness

A one-loop schedule with coefficients B and -2B has outcomes in [-B,B] but coefficient mass 3B, witnessing strict inclusion.

Formal statement
n d β :
B :
hn :
1 ≤ n
hd :
1 ≤ d
hB :
0 < B
:
1 ≤ β
Proof (Lean source)
lemma strictModelClass_completeWitness (n d β : ℕ) (B : ℝ) (hn : 1 ≤ n) (hd : 1 ≤ d) (hB : 0 < B) (hβ : 1 ≤ β) : ModelClassStrict (Fin n) d β B := by classical let i0 : Fin n := ⟨0, by omega⟩ let G : Fin n → Fin n → Prop := fun j i => j = i0 ∧ i = i0 let c : Fin n → Finset (Fin n) → ℝ := fun i S => if i = i0 then if S = ∅ then B else if S = {i0} then -2 * B else 0 else 0 have hnbhd0 : nbhd G i0 = {i0} := by ext j simp [nbhd, G] have hnbhd (i : Fin n) (hi : i ≠ i0) : nbhd G i = ∅ := by ext j simp [nbhd, G, hi] have hpowerset : (({i0} : Finset (Fin n)).powerset) = ({∅, {i0}} : Finset (Finset (Fin n))) := by ext S simp [Finset.subset_singleton_iff] have hout0 : outNbhd G i0 = {i0} := by ext i simp [outNbhd, G] have hout (j : Fin n) (hj : j ≠ i0) : outNbhd G j = ∅ := by ext i simp [outNbhd, G, hj] let N : BddOutcomeModelClass (Fin n) d β B := { edge := G decEdge := Classical.decRel _ coef := c supported := by intro i S hS by_cases hi : i = i0 · subst i by_cases hS0 : S = ∅ · subst S exact (hS (by simp)).elim · by_cases hS1 : S = {i0} · subst S exact (hS (by simp [hnbhd0])).elim · simp [c, hS0, hS1] · simp [c, hi] degree_le := by constructor · intro i by_cases hi : i = i0 · subst i simp [hnbhd0, hd] · simp [hnbhd i hi] · intro j by_cases hj : j = i0 · subst j simp [hout0, hd] · simp [hout j hj] low_order := by intro i S hcard by_cases hi : i = i0 · subst i have hS0 : S ≠ ∅ := by intro h subst S simp at hcard have hS1 : S ≠ {i0} := by intro h subst S simp at hcard omega simp [c, hS0, hS1] · simp [c, hi] outcome_bound := by intro i z by_cases hi : i = i0 · subst i cases hz : z i0 · simp [potentialOutcome, hnbhd0, hpowerset, c, hz, abs_of_pos hB] · simp [potentialOutcome, hnbhd0, hpowerset, c, hz] rw [show B + -(2 * B) = -B by ring, abs_neg, abs_of_pos hB] · simp [potentialOutcome, hnbhd i hi, c, hi, hB.le] } refine ⟨modelClassIncluded_of_coeffMass d β B, N, ?_⟩ rintro ⟨M, hEdge, hCoef⟩ have hmass := M.mass_le i0 rw [← hEdge, ← hCoef] at hmass simp only [N, hnbhd0, hpowerset, c, if_pos] at hmass simp [abs_of_pos hB] at hmass linarith
CausalSmith.Experimentation.SnipeDegreeFrontier.strictModelClass_completeWitness · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part1.lean:94
theorem minimaxRisk_nonneg_of_nonneg

The coefficient-class minimax risk is nonnegative when the envelope is nonnegative.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
d β :
B :
hB :
0 ≤ B
0 ≤ minimaxRisk (V := V) p hp0 hp1 d β B
Proof (Lean source)
lemma minimaxRisk_nonneg_of_nonneg {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) (hB : 0 ≤ B) : 0 ≤ minimaxRisk (V := V) p hp0 hp1 d β B := by let M0 : ModelClass V d β B := { edge := fun _ _ => False decEdge := fun _ _ => inferInstance coef := fun _ _ => 0 supported := by simp degree_le := by simp [BoundedDegree, nbhd, outNbhd] low_order := by simp [LowOrder] mass_le := by intro i; simpa [BoundedCoeffMass] using hB } unfold minimaxRisk apply le_csInf · refine ⟨worstRisk (V := V) p hp0 hp1 d β B ((fun _ _ _ => (0 : ℝ)) : Estimator V), ?_⟩ exact ⟨(fun _ _ _ => (0 : ℝ) : Estimator V), zeroEstimator_admissible p hp0 hp1 d β B, rfl⟩ · intro r hr rcases hr with ⟨est, hest, rfl⟩ have hrisk : 0 ≤ riskAt p hp0 hp1 M0 est := by unfold riskAt exact (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).mse_nonneg _ _ exact hrisk.trans (le_csSup hest.2 (Set.mem_range_self M0))
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRisk_nonneg_of_nonneg · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part1.lean:185
theorem minimaxRisk_scaled_block_lower

The continuous block prior, with the universal tilt used in the theorem, gives the saturated finite-size lower frontier.

Formal statement
β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
κ cLower :
hκdef :
κ = min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹)
hcLower :
cLower ≤ κ ^ 2 / 16
n d :
B :
hn :
1 ≤ n
hdeg :
hB :
0 ≤ B
cLower * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n)
minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B
Proof (Lean source)
lemma minimaxRisk_scaled_block_lower (β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (κ cLower : ℝ) (hκdef : κ = min ((2 * representerMassSup β p)⁻¹) ((4 * pi)⁻¹)) (hcLower : cLower ≤ κ ^ 2 / 16) (n d : ℕ) (B : ℝ) (hn : 1 ≤ n) (hdeg : DegreeIndex (Fin n) d) (hB : 0 ≤ B) : cLower * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) ≤ minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B := by have hdn : d ≤ n := by simpa [DegreeIndex] using hdeg letI : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩ by_cases hd : 1 ≤ d · by_cases hBpos : 0 < B · let m := blockCount n d let ρ := activeShare n d let A := blockEnergy β p d let t := min 1 (sqrt (A / m)) let δ := tiltAmplitude B β p m d have hm : 0 < m := blockCount_pos n d hn hd hdn have hmR : (0 : ℝ) < m := by exact_mod_cast hm have hA : 0 < A := blockEnergy_pos β d p hβ hd hp0 hp1 have hA0 : 0 ≤ A := hA.le have hρ := activeShare_bounds n d hn hd hdn have hρ0 : 0 < ρ := lt_of_lt_of_le (by norm_num : (0 : ℝ) < 1 / 2) hρ.1 have hκ0 : 0 ≤ κ := by have hmass : 0 < representerMassSup β p := representerMassSup_pos β p hβ hp0 hp1 rw [hκdef] rw [le_min_iff] constructor · exact inv_nonneg.mpr (mul_nonneg (by norm_num) hmass.le) · exact inv_nonneg.mpr (mul_nonneg (by norm_num) Real.pi_pos.le) have hκpi : κ ≤ (4 * pi)⁻¹ := by rw [hκdef] exact min_le_right _ _ have ht0 : 0 ≤ t := by dsimp [t] rw [le_min_iff] exact ⟨by norm_num, Real.sqrt_nonneg _⟩ have ht_le_sqrt : t ≤ sqrt (A / m) := by dsimp [t] exact min_le_right _ _ have hsqrtSq : sqrt (A / m) ^ 2 = A / m := by exact Real.sq_sqrt (div_nonneg hA0 hmR.le) have htSqLe : t ^ 2 ≤ A / m := by calc t ^ 2 ≤ sqrt (A / m) ^ 2 := (sq_le_sq₀ ht0 (Real.sqrt_nonneg _)).2 ht_le_sqrt _ = A / m := hsqrtSq have hmt : (m : ℝ) * t ^ 2 ≤ A := by have := (le_div_iff₀ hmR).mp htSqLe nlinarith have hκsq : 16 * pi ^ 2 * κ ^ 2 ≤ 1 := by have hmul : 4 * pi * κ ≤ 1 := by calc 4 * pi * κ ≤ 4 * pi * (4 * pi)⁻¹ := by gcongr _ = 1 := by field_simp have hmul0 : 0 ≤ 4 * pi * κ := by positivity nlinarith [sq_nonneg (4 * pi * κ)] have hδ : δ = B * κ * t := by simp [δ, tiltAmplitude, m, A, t, hκdef] have hhell : hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1)) ≤ 1 / 4 := by refine (blockPrior_hellinger_le n d β B p hn hd hdn hBpos hβ hp0 hp1).trans ?_ change 4 * pi ^ 2 * (m : ℝ) * δ ^ 2 / (B ^ 2 * A) ≤ 1 / 4 rw [hδ] have hden : 0 < B ^ 2 * A := mul_pos (sq_pos_of_pos hBpos) hA rw [div_le_iff₀ hden] calc 4 * pi ^ 2 * (m : ℝ) * (B * κ * t) ^ 2 = B ^ 2 * (4 * pi ^ 2 * κ ^ 2) * ((m : ℝ) * t ^ 2) := by ring _ ≤ B ^ 2 * (1 / 4) * A := by gcongr nlinarith _ = (1 / 4 : ℝ) * (B ^ 2 * A) := by ring have hprior := minimaxRisk_blockPrior_lower n d β B p hn hd hdn hBpos hβ hp0 hp1 hhell have hratio := blockEnergy_div_blockCount n d β p hn hd hdn have hxy : (d : ℝ) * A / n = ρ * (A / m) := by dsimp [ρ, A, m] at hratio ⊢ have hρne : activeShare n d ≠ 0 := hρ0.ne' field_simp [hρne] at hratio ⊢ nlinarith have hxle : (d : ℝ) * A / n ≤ A / m := by rw [hxy] exact mul_le_of_le_one_left (div_nonneg hA0 hmR.le) hρ.2 have htsq : t ^ 2 = min 1 (A / m) := by by_cases hs : sqrt (A / m) ≤ 1 · have hy : A / m ≤ 1 := by rw [← hsqrtSq] nlinarith [Real.sqrt_nonneg (A / m)] rw [show t = min 1 (sqrt (A / m)) by rfl, min_eq_right hs, hsqrtSq, min_eq_right hy] · have hs' : 1 ≤ sqrt (A / m) := le_of_not_ge hs have hy : 1 ≤ A / m := by rw [← hsqrtSq] nlinarith [Real.sqrt_nonneg (A / m)] rw [show t = min 1 (sqrt (A / m)) by rfl, min_eq_left hs', one_pow, min_eq_left hy] have hmin : min 1 ((d : ℝ) * A / n) ≤ t ^ 2 := by rw [htsq] exact min_le_min_left 1 hxle have hscale : cLower * B ^ 2 * min 1 ((d : ℝ) * A / n) ≤ (ρ * δ) ^ 2 / 4 := by rw [hδ] have hρsq : (1 / 4 : ℝ) ≤ ρ ^ 2 := by have hs := (sq_le_sq₀ (by norm_num : (0 : ℝ) ≤ 1 / 2) hρ0.le).2 hρ.1 norm_num at hs ⊢ exact hs have hcommon : 0 ≤ B ^ 2 * t ^ 2 := mul_nonneg (sq_nonneg B) (sq_nonneg t) have hK : 0 ≤ κ ^ 2 / 16 := by positivity have hquarter : (1 / 16 : ℝ) ≤ ρ ^ 2 / 4 := by apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 4)).2 norm_num exact hρsq have hfac : κ ^ 2 / 16 ≤ ρ ^ 2 / 4 * κ ^ 2 := by calc κ ^ 2 / 16 = (1 / 16 : ℝ) * κ ^ 2 := by ring _ ≤ (ρ ^ 2 / 4) * κ ^ 2 := mul_le_mul_of_nonneg_right hquarter (sq_nonneg κ) calc cLower * B ^ 2 * min 1 ((d : ℝ) * A / n) ≤ (κ ^ 2 / 16) * B ^ 2 * t ^ 2 := by calc cLower * B ^ 2 * min 1 ((d : ℝ) * A / n) ≤ (κ ^ 2 / 16) * B ^ 2 * min 1 ((d : ℝ) * A / n) := by simpa [mul_assoc] using mul_le_mul_of_nonneg_right hcLower (mul_nonneg (sq_nonneg B) (by positivity : 0 ≤ min 1 ((d : ℝ) * A / n))) _ ≤ (κ ^ 2 / 16) * B ^ 2 * t ^ 2 := by exact mul_le_mul_of_nonneg_left hmin (mul_nonneg hK (sq_nonneg B)) _ ≤ (ρ ^ 2 / 4) * (B ^ 2 * κ ^ 2 * t ^ 2) := by calc (κ ^ 2 / 16) * B ^ 2 * t ^ 2 = (κ ^ 2 / 16) * (B ^ 2 * t ^ 2) := by ring _ ≤ (ρ ^ 2 / 4 * κ ^ 2) * (B ^ 2 * t ^ 2) := mul_le_mul_of_nonneg_right hfac hcommon _ = (ρ ^ 2 / 4) * (B ^ 2 * κ ^ 2 * t ^ 2) := by ring _ = (ρ * (B * κ * t)) ^ 2 / 4 := by ring dsimp only at hprior change (ρ * δ) ^ 2 / 4 ≤ minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B at hprior change cLower * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) ≤ minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B exact hscale.trans hprior · have hB0 : B = 0 := by linarith subst B simpa only [zero_pow (by norm_num : 2 ≠ 0), mul_zero, zero_mul, minimaxRiskL1] using minimaxRisk_nonneg_of_nonneg (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β 0 (by norm_num) · have hd0 : d = 0 := by omega subst d simpa only [cast_zero, zero_mul, zero_div, min_eq_right (by norm_num : (0 : ℝ) ≤ 1), mul_zero, minimaxRiskL1] using minimaxRisk_nonneg_of_nonneg (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) 0 β B hB
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRisk_scaled_block_lower · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part1.lean:217
T_bounded_outcome_frontier_Part2 1 declarations Evaluates every risk functional appearing in the frontier theorem exactly on the complete-block interaction graph.

Exact risks on the complete-block design

Evaluates every risk functional appearing in the frontier theorem exactly on the complete-block interaction graph.

theorem completeBlock_all_risks_exact

Complete blocks attain the sharp SNIPE upper bound in both model classes, for the fixed graph and for the unrestricted worst risk.

Formal statement
n d β :
B p :
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
:
1 ≤ β
hB :
0 ≤ B
1
≤ d → d ∣ n → let m := n / d worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧
worstRiskBddFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p)
= B ^ 2 * blockEnergy β p d / m ∧
worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p)
= B ^ 2 * blockEnergy β p d / m ∧
worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p)
= B ^ 2 * blockEnergy β p d / m ∧
B ^ 2 * blockEnergy β p d / m = B ^ 2 * (d : ℝ) * blockEnergy β p d / n
Proof (Lean source)
lemma completeBlock_all_risks_exact (n d β : ℕ) (B p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hβ : 1 ≤ β) (hB : 0 ≤ B) : 1 ≤ d → d ∣ n → let m := n / d worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRiskBddFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) = B ^ 2 * blockEnergy β p d / m ∧ B ^ 2 * blockEnergy β p d / m = B ^ 2 * (d : ℝ) * blockEnergy β p d / n := by classical intro hd hdiv dsimp only let m := blockCount n d let A := blockEnergy β p d let target := B ^ 2 * A / m have hdn : d ≤ n := Nat.le_of_dvd (Nat.zero_lt_of_lt hn) hdiv have hm : 0 < m := blockCount_pos n d hn hd hdn have hscale : target = B ^ 2 * (d : ℝ) * A / n := by have hncast : (n : ℝ) = (m : ℝ) * d := by norm_cast simpa [m, blockCount, mul_comm] using (Nat.div_mul_cancel hdiv).symm dsimp [target] rw [hncast] field_simp have hfixed : worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) = target := by by_cases hBpos : 0 < B · let w := canonicalLocLinWeights n d β p hp0 hp1 hn hd hdiv have heq (b : Fin m) : blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b) = (d : ℝ) ^ 2 * A := by apply le_antisymm · simpa [w, m, A] using canonical_completeBlock_blockExtremal_upper n d β p hp0 hp1 hn hd hdiv b · simpa [w, m, A] using completeBlock_blockExtremal_lower n d β p hp0 hp1 hn hd hdiv w b have hw : locLinWorstRisk (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1) w = target := by rw [locLinWorstRisk_exact_blockExtremal n d β B p hBpos (le_of_lt hp0) (le_of_lt hp1) hn hd hdiv w] rw [show (∑ b : Fin m, blockExtremal (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w (completeBlockUnits n d b)) = ∑ _b : Fin m, (d : ℝ) ^ 2 * A by apply Finset.sum_congr rfl intro b hb exact heq b] simpa [target, m, A] using completeBlock_benchmark_algebra n d B A hn hd hdiv have hest (z : Fin n → Bool) (y : Fin n → ℝ) : snipeEstimator β p (fun j i => decide (blockGraph n d j i)) z y = locLinEstimator (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w z y := by unfold snipeEstimator locLinEstimator congr 1 apply Finset.sum_congr rfl intro i hi simp [w, canonicalLocLinWeights] ring have hfixedUpper : worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) ≤ target := by unfold worstRiskFixedGraph apply csSup_le · let M0 : ModelClass (Fin n) d β B := { edge := blockGraph n d decEdge := Classical.decRel _ coef := fun _ _ => 0 supported := by simp degree_le := blockGraph_degree_le n d hd low_order := by simp [LowOrder] mass_le := by intro i simpa [BoundedCoeffMass] using hB } exact ⟨riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 (snipeEstimator β p), M0, rfl, rfl⟩ · rintro r ⟨M, hG, rfl⟩ exact (riskAt_snipe_le p hp0 hp1 M).trans (by simpa [A] using hscale.symm.le) have hlocal_le_fixed : locLinWorstRisk (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1) w ≤ worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) := by unfold locLinWorstRisk worstRiskFixedGraph apply csSup_le · let L0 : LocLinSchedClass (blockGraph n d) d β B := { coef := fun _ _ => 0 supported := by simp low_order := by simp [LowOrder] mass_le := by intro i simpa [BoundedCoeffMass] using hB } exact ⟨locLinRiskAt (blockGraph n d) d β B p (le_of_lt hp0) (le_of_lt hp1) w L0, L0, rfl⟩ · rintro r ⟨L, rfl⟩ let M : ModelClass (Fin n) d β B := { edge := blockGraph n d decEdge := Classical.decRel _ coef := L.coef supported := L.supported degree_le := blockGraph_degree_le n d hd low_order := by intro i S hcard exact L.low_order i S (lt_of_le_of_lt (min_le_left _ _) hcard) mass_le := L.mass_le } apply le_csSup · refine ⟨target, ?_⟩ rintro _ ⟨N, hNG, rfl⟩ exact (riskAt_snipe_le p hp0 hp1 N).trans (by simpa [A] using hscale.symm.le) · refine ⟨M, rfl, ?_⟩ unfold riskAt locLinRiskAt have hedge : edgeFn M = fun j i => decide (blockGraph n d j i) := by rfl have hf : (fun z => locLinEstimator (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1) w z (obsOutcome (blockGraph n d) L.coef z)) = fun z => snipeEstimator β p (edgeFn M) z (obsOutcome M.edge M.coef z) := by funext z rw [hedge] exact (hest z (obsOutcome (blockGraph n d) L.coef z)).symm dsimp only rw [hf] exact le_antisymm hfixedUpper (hw ▸ hlocal_le_fixed) · have hB0 : B = 0 := by linarith subst B dsimp [target] rw [zero_pow (by norm_num : 2 ≠ 0), zero_mul, zero_div] change worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β 0 (snipeEstimator β p) = 0 let M0 : ModelClass (Fin n) d β 0 := { edge := blockGraph n d decEdge := Classical.decRel _ coef := fun _ _ => 0 supported := by simp degree_le := blockGraph_degree_le n d hd low_order := by simp [LowOrder] mass_le := by simp [BoundedCoeffMass] } have hbdd : BddAbove {r : ℝ | ∃ M : ModelClass (Fin n) d β 0, M.edge = blockGraph n d ∧ r = riskAt p (le_of_lt hp0) (le_of_lt hp1) M (snipeEstimator β p)} := by refine ⟨0, ?_⟩ rintro r ⟨M, hG, rfl⟩ simpa using riskAt_snipe_le p hp0 hp1 M apply le_antisymm · unfold worstRiskFixedGraph apply csSup_le · exact ⟨riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 (snipeEstimator β p), M0, rfl, rfl⟩ · rintro r ⟨M, hG, rfl⟩ simpa using riskAt_snipe_le p hp0 hp1 M · have hrisk : 0 ≤ riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 (snipeEstimator β p) := by unfold riskAt exact (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).mse_nonneg _ _ unfold worstRiskFixedGraph exact hrisk.trans (le_csSup hbdd ⟨M0, rfl, rfl⟩) have hglobalUpper : worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ target := by rw [hscale] simpa [A] using worstRisk_snipe_le (V := Fin n) p hp0 hp1 d β B have hfixed_le_global : worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) ≤ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) := by unfold worstRiskFixedGraph worstRisk apply csSup_le · let M0 : ModelClass (Fin n) d β B := { edge := blockGraph n d decEdge := Classical.decRel _ coef := fun _ _ => 0 supported := by simp degree_le := blockGraph_degree_le n d hd low_order := by simp [LowOrder] mass_le := by intro i simpa [BoundedCoeffMass] using hB } exact ⟨riskAt p (le_of_lt hp0) (le_of_lt hp1) M0 (snipeEstimator β p), M0, rfl, rfl⟩ · rintro r ⟨M, hG, rfl⟩ apply le_csSup · refine ⟨target, ?_⟩ rintro _ ⟨N, rfl⟩ exact (riskAt_snipe_le p hp0 hp1 N).trans (by simpa [A] using hscale.symm.le) · exact Set.mem_range_self M have hglobal : worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) = target := le_antisymm hglobalUpper (hfixed ▸ hfixed_le_global) have hbddGlobalUpper : worstRiskBdd (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ target := by rw [hscale] simpa [A] using worstRiskBdd_snipe_le (V := Fin n) p hp0 hp1 d β B have hfixed_le_bddFixed : worstRiskFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) ≤ worstRiskBddFixedGraph (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) (blockGraph n d) d β B (snipeEstimator β p) := by unfold worstRiskFixedGraph worstRiskBddFixedGraph apply csSup_le · let M0 : ModelClass (Fin n) d β B := { edge := blockGraph n d decEdge := Classical.decRel _ coef := fun _ _ => 0 supported := by simp -- … truncated; follow the source link for the rest …
CausalSmith.Experimentation.SnipeDegreeFrontier.completeBlock_all_risks_exact · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_bounded_outcome_frontier_Part2.lean:26
T_degree_frontier 5 declarations This specializes the simultaneous two-class theorem and replaces block energy by its exposed-order binomial comparison.

Coefficient-mass degree frontier

This specializes the simultaneous two-class theorem and replaces block energy by its exposed-order binomial comparison.

theorem potentialOutcome_abs_le_of_mem_modelClass Lemma potentialOutcome_abs_le_of_mem_modelClass in the paper ↗

Coefficient mass bounds every realized potential outcome.

Formal statement
V :
d β :
B :
M :
ModelClass V d β B
i :
V
z :
V → Bool
|potentialOutcome M.edge M.coef i z| ≤ B
Proof (Lean source)
lemma potentialOutcome_abs_le_of_mem_modelClass {V : Type*} [Fintype V] [DecidableEq V] {d β : ℕ} {B : ℝ} (M : ModelClass V d β B) (i : V) (z : V → Bool) : |potentialOutcome M.edge M.coef i z| ≤ B := by classical unfold potentialOutcome calc |∑ S ∈ (nbhd M.edge i).powerset, M.coef i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0| ≤ ∑ S ∈ (nbhd M.edge i).powerset, |M.coef i S * ∏ j ∈ S, if z j then (1 : ℝ) else 0| := by exact Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ S ∈ (nbhd M.edge i).powerset, |M.coef i S| := by apply Finset.sum_le_sum intro S hS simp only [abs_mul] have hprod : |∏ j ∈ S, if z j then (1 : ℝ) else 0| ≤ 1 := by rw [Finset.abs_prod] exact Finset.prod_le_one (fun _ _ => abs_nonneg _) (fun j _ => by cases z j <;> norm_num) exact mul_le_of_le_one_right (abs_nonneg _) hprod _ ≤ B := M.mass_le i
CausalSmith.Experimentation.SnipeDegreeFrontier.potentialOutcome_abs_le_of_mem_modelClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_degree_frontier.lean:16
theorem tte_abs_le_two_mul_of_mem_modelClass Lemma tte_abs_le_two_mul_of_mem_modelClass in the paper ↗

The coefficient-mass target is bounded by twice the envelope.

Formal statement
V :
Type*
Nonempty V
d β :
B :
M :
ModelClass V d β B
|tte M.edge M.coef| ≤ 2 * B
Proof (Lean source)
lemma tte_abs_le_two_mul_of_mem_modelClass {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] {d β : ℕ} {B : ℝ} (M : ModelClass V d β B) : |tte M.edge M.coef| ≤ 2 * B := by classical have hcard : (0 : ℝ) < Fintype.card V := by exact_mod_cast Fintype.card_pos unfold tte rw [abs_mul] calc |(Fintype.card V : ℝ)⁻¹| * |∑ i : V, (potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false))| ≤ (Fintype.card V : ℝ)⁻¹ * ∑ i : V, |potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false)| := by rw [abs_of_pos (inv_pos.mpr hcard)] gcongr exact Finset.abs_sum_le_sum_abs _ _ _ ≤ (Fintype.card V : ℝ)⁻¹ * ∑ _i : V, (2 * B) := by gcongr with i calc |potentialOutcome M.edge M.coef i (fun _ => true) - potentialOutcome M.edge M.coef i (fun _ => false)| ≤ |potentialOutcome M.edge M.coef i (fun _ => true)| + |potentialOutcome M.edge M.coef i (fun _ => false)| := abs_sub _ _ _ ≤ B + B := add_le_add (potentialOutcome_abs_le_of_mem_modelClass M i _) (potentialOutcome_abs_le_of_mem_modelClass M i _) _ = 2 * B := by ring _ = 2 * B := by simp [ne_of_gt hcard]
CausalSmith.Experimentation.SnipeDegreeFrontier.tte_abs_le_two_mul_of_mem_modelClass · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_degree_frontier.lean:41
theorem snipeClipped_admissible Lemma snipeClipped_admissible in the paper ↗

The clipped SNIPE estimator is an admissible competitor on the coefficient-mass class.

Formal statement
V :
Type*
Nonempty V
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
d β :
B :
hB :
0 ≤ B
AdmissibleEstimator (V := V) p hp0 hp1 d β B (snipeClipped B β p)
Proof (Lean source)
lemma snipeClipped_admissible {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) (hB : 0 ≤ B) : AdmissibleEstimator (V := V) p hp0 hp1 d β B (snipeClipped B β p) := by constructor · intro G z unfold snipeClipped clipTo snipeEstimator fun_prop · refine ⟨9 * B ^ 2, ?_⟩ rintro _ ⟨M, rfl⟩ unfold riskAt mse have ht := tte_abs_le_two_mul_of_mem_modelClass M have hclip (z : V → Bool) : |snipeClipped B β p (edgeFn M) z (obsOutcome M.edge M.coef z)| ≤ B := by unfold snipeClipped clipTo rw [abs_le] simp [hB] calc (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (snipeClipped B β p (edgeFn M) z (obsOutcome M.edge M.coef z) - tte M.edge M.coef) ^ 2) ≤ (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).E (fun _ => 9 * B ^ 2) := by unfold Causalean.Experimentation.DesignBased.FiniteDesign.E apply Finset.sum_le_sum intro z hz have hdiff : |snipeClipped B β p (edgeFn M) z (obsOutcome M.edge M.coef z) - tte M.edge M.coef| ≤ 3 * B := by calc |_ - _| ≤ |snipeClipped B β p (edgeFn M) z (obsOutcome M.edge M.coef z)| + |tte M.edge M.coef| := abs_sub _ _ _ ≤ B + 2 * B := add_le_add (hclip z) ht _ = 3 * B := by ring apply mul_le_mul_of_nonneg_left · change (snipeClipped B β p (edgeFn M) z (obsOutcome M.edge M.coef z) - tte M.edge M.coef) ^ 2 ≤ 9 * B ^ 2 have hsquare : |snipeClipped B β p (edgeFn M) z (obsOutcome M.edge M.coef z) - tte M.edge M.coef| ^ 2 ≤ (3 * B) ^ 2 := (sq_le_sq₀ (abs_nonneg _) (by positivity)).2 hdiff rw [sq_abs] at hsquare nlinarith · exact (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).p_nonneg z _ = 9 * B ^ 2 := by rw [E_const]
CausalSmith.Experimentation.SnipeDegreeFrontier.snipeClipped_admissible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_degree_frontier.lean:78
theorem minimaxRisk_le_worstRisk_of_admissible Lemma minimaxRisk_le_worstRisk_of_admissible in the paper ↗

Any admissible estimator supplies an upper bound on the minimax risk.

Formal statement
V :
p :
hp0 :
0 ≤ p
hp1 :
p ≤ 1
d β :
B :
est :
hne :
Nonempty (ModelClass V d β B)
hest :
AdmissibleEstimator p hp0 hp1 d β B est
minimaxRisk (V := V) p hp0 hp1 d β B ≤ worstRisk (V := V) p hp0 hp1 d β B est
Proof (Lean source)
lemma minimaxRisk_le_worstRisk_of_admissible {V : Type*} [Fintype V] [DecidableEq V] (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (d β : ℕ) (B : ℝ) (est : Estimator V) (hne : Nonempty (ModelClass V d β B)) (hest : AdmissibleEstimator p hp0 hp1 d β B est) : minimaxRisk (V := V) p hp0 hp1 d β B ≤ worstRisk (V := V) p hp0 hp1 d β B est := by unfold minimaxRisk apply csInf_le · refine ⟨0, ?_⟩ rintro r ⟨est', _hest', rfl⟩ unfold worstRisk let M : ModelClass V d β B := Classical.choice hne have hrisk : 0 ≤ riskAt p hp0 hp1 M est' := by unfold riskAt exact (bernoulliDesign (fun _ : V => p) (fun _ => hp0) (fun _ => hp1)).mse_nonneg _ _ exact hrisk.trans (le_csSup _hest'.2 (Set.mem_range_self M)) · exact ⟨est, hest, rfl⟩
CausalSmith.Experimentation.SnipeDegreeFrontier.minimaxRisk_le_worstRisk_of_admissible · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_degree_frontier.lean:140
theorem degree_frontier Theorem 1 in the paper ↗

The original coefficient-mass frontier, including the nonsaturated unclipped-SNIPE assertion.

Formal statement
β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
∃ cLower cUpper : ℝ
if
0 < cLower ∧ cLower ≤ cUpper ∧ ∀ (n d : ℕ) (B : ℝ), 1 ≤ n
and
and
0 ≤ B
then
cLower * B ^ 2 * min 1 ((d : ℝ) * choose d (kStar d β p) / n)
minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧
minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B
≤ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ∧
worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p)
≤ cUpper * B ^ 2 * min 1 ((d : ℝ) * choose d (kStar d β p) / n) ∧
worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p)
≤ cUpper * B ^ 2 * ((d : ℝ) * choose d (kStar d β p) / n) ∧
(∀ M : ModelClass (Fin n) d β B, ∀ i, localEnergy M.edge β p i ≤ blockEnergy β p d) ∧
(∀ M : ModelClass (Fin n) d β B, ∀ (r : ℕ) (i : Fin n), 1 ≤ r → (∑ l : Fin n, choose ((nbhd M.edge i ∩ nbhd M.edge l).card) r) = ∑ S ∈ ((nbhd M.edge i).powerset.filter (fun S => S.card = r)), containingNeighborhoods M.edge S ∧ (∑ S ∈ ((nbhd M.edge i).powerset.filter (fun S => S.card = r)), containingNeighborhoods M.edge S) ≤ d * choose (nbhd M.edge i).card r ∧ d * choose (nbhd M.edge i).card r ≤ d * choose d r) ∧
(0 < B → 1 ≤ d → let m := blockCount n d let ρ := activeShare n d let δ := tiltAmplitude B β p m d (∀ U : Fin m → ℝ, (∀ b, |U b| ≤ B / 2) → (∃ Mplus : ModelClass (Fin n) d β B, Mplus.edge = blockGraph n d ∧ Mplus.coef = blockSchedule n d β B p 1 (by norm_num) U) ∧ (∃ Mminus : ModelClass (Fin n) d β B, Mminus.edge = blockGraph n d ∧ Mminus.coef = blockSchedule n d β B p (-1) (by norm_num) U) ∧ tte (blockGraph n d) (blockSchedule n d β B p 1 (by norm_num) U) = ρ * δ ∧ tte (blockGraph n d) (blockSchedule n d β B p (-1) (by norm_num) U) = -ρ * δ) ∧ hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1)) ≤ 4 * pi ^ 2 * m * δ ^ 2 / (B ^ 2 * blockEnergy β p d) ∧ (1 / 2 : ℝ) ≤ ρ ∧ ρ ≤ 1 ∧ blockEnergy β p d / m = ((d : ℝ) * blockEnergy β p d / n) / ρ)
Proof (Lean source)
-- @node: thm:degree-frontier theorem degree_frontier (β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) : ∃ cLower cUpper : ℝ, 0 < cLower ∧ cLower ≤ cUpper ∧ ∀ (n d : ℕ) (B : ℝ), 1 ≤ n → DegreeIndex (Fin n) d → 0 ≤ B → cLower * B ^ 2 * min 1 ((d : ℝ) * choose d (kStar d β p) / n) ≤ minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ∧ minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ≤ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ∧ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ≤ cUpper * B ^ 2 * min 1 ((d : ℝ) * choose d (kStar d β p) / n) ∧ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ cUpper * B ^ 2 * ((d : ℝ) * choose d (kStar d β p) / n) ∧ (∀ M : ModelClass (Fin n) d β B, ∀ i, localEnergy M.edge β p i ≤ blockEnergy β p d) ∧ (∀ M : ModelClass (Fin n) d β B, ∀ (r : ℕ) (i : Fin n), 1 ≤ r → (∑ l : Fin n, choose ((nbhd M.edge i ∩ nbhd M.edge l).card) r) = ∑ S ∈ ((nbhd M.edge i).powerset.filter (fun S => S.card = r)), containingNeighborhoods M.edge S ∧ (∑ S ∈ ((nbhd M.edge i).powerset.filter (fun S => S.card = r)), containingNeighborhoods M.edge S) ≤ d * choose (nbhd M.edge i).card r ∧ d * choose (nbhd M.edge i).card r ≤ d * choose d r) ∧ (0 < B → 1 ≤ d → let m := blockCount n d let ρ := activeShare n d let δ := tiltAmplitude B β p m d (∀ U : Fin m → ℝ, (∀ b, |U b| ≤ B / 2) → (∃ Mplus : ModelClass (Fin n) d β B, Mplus.edge = blockGraph n d ∧ Mplus.coef = blockSchedule n d β B p 1 (by norm_num) U) ∧ (∃ Mminus : ModelClass (Fin n) d β B, Mminus.edge = blockGraph n d ∧ Mminus.coef = blockSchedule n d β B p (-1) (by norm_num) U) ∧ tte (blockGraph n d) (blockSchedule n d β B p 1 (by norm_num) U) = ρ * δ ∧ tte (blockGraph n d) (blockSchedule n d β B p (-1) (by norm_num) U) = -ρ * δ) ∧ hellingerSqDensity (blockDominatingMeasure n d) (blockPriorDensity n d β B p 1) (blockPriorDensity n d β B p (-1)) ≤ 4 * pi ^ 2 * m * δ ^ 2 / (B ^ 2 * blockEnergy β p d) ∧ (1 / 2 : ℝ) ≤ ρ ∧ ρ ≤ 1 ∧ blockEnergy β p d / m = ((d : ℝ) * blockEnergy β p d / n) / ρ) := by obtain ⟨a, b, ha, hab, hfrontier⟩ := bounded_outcome_degree_frontier β p hβ hp0 hp1 let cLower : ℝ := min 1 (a ^ 2) let cUpper : ℝ := max 1 (b ^ 2) have hb : 0 < b := lt_of_lt_of_le ha hab have hcLower : 0 < cLower := by dsimp [cLower] positivity have hcUpper : 0 < cUpper := by dsimp [cUpper] positivity refine ⟨cLower, cUpper, hcLower, ?_, ?_⟩ · exact le_trans (min_le_left _ _) (le_max_left _ _) · intro n d B hn hdeg hB let D : FiniteDesign (Fin n → Bool) := blockDesign n p (le_of_lt hp0) (le_of_lt hp1) have hD : IsProductBernoulli D p := by refine ⟨hp0, hp1, ?_⟩ refine ⟨fun _ => le_of_lt hp0, fun _ => le_of_lt hp1, ?_⟩ rfl obtain ⟨_hinc, _hstrict, hlower, hriskEq, _hclassMono, _hbddToWorst, _hworstUpper, hl1Upper, _hunbiasedL1, _hunbiasedBdd, hsnipeL1, _hsnipeBdd, hlocalL1, _hlocalBdd, hchooseLower, hchooseUpper, _hexact, hmixture⟩ := hfrontier n D d B hn hdeg hB hD have hnpos : (0 : ℝ) < n := by exact_mod_cast hn let x : ℝ := (d : ℝ) * choose d (kStar d β p) / n let y : ℝ := (d : ℝ) * blockEnergy β p d / n have hx : 0 ≤ x := by dsimp [x] positivity have haxy : a * x ≤ y := by simpa [x, y, div_eq_mul_inv, mul_assoc] using mul_le_mul_of_nonneg_right hchooseLower (le_of_lt (inv_pos.mpr hnpos)) have hybx : y ≤ b * x := by simpa [x, y, div_eq_mul_inv, mul_assoc] using mul_le_mul_of_nonneg_right hchooseUpper (le_of_lt (inv_pos.mpr hnpos)) have hminLower : min 1 (a * x) ≤ min 1 y := min_le_min_left 1 haxy have hminUpper : min 1 y ≤ min 1 (b * x) := min_le_min_left 1 hybx have hsmallA : min 1 (a ^ 2) ≤ a := by by_cases ha1 : a ≤ 1 · exact (min_le_right _ _).trans (by nlinarith) · exact (min_le_left _ _).trans (le_of_not_ge ha1) have hscaleLower : min 1 (a ^ 2) * min 1 x ≤ a * min 1 (a * x) := by by_cases hx1 : x ≤ 1 · rw [min_eq_right hx1] by_cases hax1 : a * x ≤ 1 · rw [min_eq_right hax1] calc min 1 (a ^ 2) * x ≤ a ^ 2 * x := mul_le_mul_of_nonneg_right (min_le_right 1 (a ^ 2)) hx _ = a * (a * x) := by ring · rw [min_eq_left (le_of_not_ge hax1)] calc min 1 (a ^ 2) * x ≤ a * x := mul_le_mul_of_nonneg_right hsmallA hx _ ≤ a * 1 := mul_le_mul_of_nonneg_left hx1 (le_of_lt ha) · rw [min_eq_left (le_of_not_ge hx1)] by_cases hax1 : a * x ≤ 1 · rw [min_eq_right hax1] calc min 1 (a ^ 2) * 1 = min 1 (a ^ 2) := by ring _ ≤ a ^ 2 := min_le_right _ _ _ ≤ a ^ 2 * x := le_mul_of_one_le_right (sq_nonneg a) (le_of_not_ge hx1) _ = a * (a * x) := by ring · rw [min_eq_left (le_of_not_ge hax1)] simpa using hsmallA have hlargeB : b ≤ max 1 (b ^ 2) := by by_cases hb1 : b ≤ 1 · exact hb1.trans (le_max_left _ _) · exact (by nlinarith : b ≤ b ^ 2) |>.trans (le_max_right _ _) have hscaleUpper : b * min 1 (b * x) ≤ max 1 (b ^ 2) * min 1 x := by by_cases hx1 : x ≤ 1 · rw [min_eq_right hx1] by_cases hbx1 : b * x ≤ 1 · rw [min_eq_right hbx1] calc b * (b * x) = b ^ 2 * x := by ring _ ≤ max 1 (b ^ 2) * x := mul_le_mul_of_nonneg_right (le_max_right 1 (b ^ 2)) hx · rw [min_eq_left (le_of_not_ge hbx1)] calc b * 1 ≤ b * (b * x) := by simpa only [mul_one] using le_mul_of_one_le_right (le_of_lt hb) (le_of_not_ge hbx1) _ = b ^ 2 * x := by ring _ ≤ max 1 (b ^ 2) * x := mul_le_mul_of_nonneg_right (le_max_right _ _) hx · rw [min_eq_left (le_of_not_ge hx1)] by_cases hbx1 : b * x ≤ 1 · rw [min_eq_right hbx1] calc b * (b * x) ≤ b * 1 := mul_le_mul_of_nonneg_left hbx1 (le_of_lt hb) _ = b := by ring _ ≤ 1 := by have : b < 1 := by by_contra h have hxb : x ≤ b * x := le_mul_of_one_le_left hx (le_of_not_gt h) have : 1 < b * x := (lt_of_not_ge hx1).trans_le hxb exact (not_lt_of_ge hbx1) this exact le_of_lt this _ ≤ max 1 (b ^ 2) * 1 := by simpa only [mul_one] using (le_max_left 1 (b ^ 2)) · rw [min_eq_left (le_of_not_ge hbx1)] simpa only [mul_one] using hlargeB have hlower' : cLower * B ^ 2 * min 1 x ≤ minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B := by calc cLower * B ^ 2 * min 1 x = B ^ 2 * (min 1 (a ^ 2) * min 1 x) := by simp only [cLower] ring _ ≤ B ^ 2 * (a * min 1 (a * x)) := mul_le_mul_of_nonneg_left hscaleLower (sq_nonneg B) _ ≤ B ^ 2 * (a * min 1 y) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hminLower (le_of_lt ha)) (sq_nonneg B) _ = a * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) := by dsimp [y] ring _ ≤ minimaxRiskL1 (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B := hlower _ = minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B := hriskEq have hupper' : worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ≤ cUpper * B ^ 2 * min 1 x := by calc worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) ≤ b * B ^ 2 * min 1 ((d : ℝ) * blockEnergy β p d / n) := hl1Upper _ = B ^ 2 * (b * min 1 y) := by dsimp [y] ring _ ≤ B ^ 2 * (b * min 1 (b * x)) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hminUpper (le_of_lt hb)) (sq_nonneg B) _ ≤ B ^ 2 * (max 1 (b ^ 2) * min 1 x) := mul_le_mul_of_nonneg_left hscaleUpper (sq_nonneg B) _ = cUpper * B ^ 2 * min 1 x := by simp only [cUpper] ring have hnonempty : Nonempty (ModelClass (Fin n) d β B) := by let M0 : ModelClass (Fin n) d β B := { edge := fun _ _ => False decEdge := fun _ _ => inferInstance coef := fun _ _ => 0 supported := by simp degree_le := by simp [BoundedDegree, nbhd, outNbhd] low_order := by simp [LowOrder] mass_le := by intro i simpa [BoundedCoeffMass] using hB } exact ⟨M0⟩ let i0 : Fin n := ⟨0, by omega⟩ letI : Nonempty (Fin n) := ⟨i0⟩ have hmini : minimaxRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B ≤ worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) := minimaxRisk_le_worstRisk_of_admissible p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeClipped B β p) hnonempty (snipeClipped_admissible p (le_of_lt hp0) (le_of_lt hp1) d β B hB) have hsnipe' : worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ cUpper * B ^ 2 * x := by calc worstRisk (V := Fin n) p (le_of_lt hp0) (le_of_lt hp1) d β B (snipeEstimator β p) ≤ B ^ 2 * (d : ℝ) * blockEnergy β p d / n := hsnipeL1 _ = B ^ 2 * y := by dsimp [y] ring -- … truncated; follow the source link for the rest …
CausalSmith.Experimentation.SnipeDegreeFrontier.degree_frontier · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_degree_frontier.lean:163
T_fair_coin_frontier 5 declarations At probability one half the even Bernoulli contrasts cancel, leaving four times the sum of the eligible odd binomial coefficients.

Fair-coin energy frontier

At probability one half the even Bernoulli contrasts cancel, leaving four times the sum of the eligible odd binomial coefficients.

Largest odd integer no greater than k, with zero at k = 0.

Definition (Lean source)
noncomputable def largestOddLE (k : ℕ) : ℕ := let odds : Finset ℕ := (Icc 1 k).filter Odd if h : odds.Nonempty then odds.max' h else 0
CausalSmith.Experimentation.SnipeDegreeFrontier.largestOddLE · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_fair_coin_frontier.lean:15

At a fair coin, the Bernoulli contrast vanishes exactly at even orders.

Formal statement
r :
bernoulliContrast (1 / 2 : ℝ) r = if Odd r then 2 ^ (1 - (r : ℤ)) else 0
Proof (Lean source)
lemma fairCoinContrast (r : ℕ) : bernoulliContrast (1 / 2 : ℝ) r = if Odd r then 2 ^ (1 - (r : ℤ)) else 0 := by rw [bernoulliContrast] norm_num only [one_div, one_sub_div, one_mul, OfNat.ofNat] rw [show -(1 / 2 : ℝ) = (-1) * (1 / 2 : ℝ) by ring, mul_pow] by_cases hodd : Odd r · rw [if_pos hodd, hodd.neg_one_pow] rw [neg_one_mul] have hpow : (2 : ℝ) ^ (1 - (r : ℤ)) = 2 * ((2 : ℝ) ^ r)⁻¹ := by rw [zpow_sub₀ (by norm_num : (2 : ℝ) ≠ 0), zpow_one, zpow_natCast] simp only [div_eq_mul_inv] rw [hpow, one_div_pow] ring · rw [if_neg hodd] have heven : Even r := Nat.not_odd_iff_even.mp hodd rw [heven.neg_one_pow] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.fairCoinContrast · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_fair_coin_frontier.lean:20

Each exposed fair-coin order contributes four times its binomial count.

Formal statement
β d :
blockEnergy β (1 / 2 : ℝ) d
= 4 * ∑ r ∈ (Icc 1 (effBeta β d)).filter Odd, (Nat.choose d r : ℝ)
Proof (Lean source)
lemma fairCoinEnergy (β d : ℕ) : blockEnergy β (1 / 2 : ℝ) d = 4 * ∑ r ∈ (Icc 1 (effBeta β d)).filter Odd, (Nat.choose d r : ℝ) := by have hterm (r : ℕ) (hr : 1 ≤ r) : (Nat.choose d r : ℝ) * (bernoulliContrast (1 / 2 : ℝ) r) ^ 2 / ((1 / 2 : ℝ) * (1 - 1 / 2)) ^ r = if Odd r then 4 * (Nat.choose d r : ℝ) else 0 := by rw [fairCoinContrast r] by_cases hodd : Odd r · rw [if_pos hodd, if_pos hodd] norm_num only [one_div, one_sub_div, one_mul] rw [show (2 : ℝ) ^ (1 - (r : ℤ)) = 2 * ((2 : ℝ) ^ r)⁻¹ by rw [zpow_sub₀ (by norm_num : (2 : ℝ) ≠ 0), zpow_one, zpow_natCast] simp only [div_eq_mul_inv]] rw [one_div_pow] field_simp have hfour : (4 : ℝ) ^ r = 2 ^ (r * 2) := by calc (4 : ℝ) ^ r = ((2 : ℝ) ^ 2) ^ r := by norm_num _ = 2 ^ (2 * r) := (pow_mul 2 2 r).symm _ = 2 ^ (r * 2) := by rw [mul_comm] have htwo : ((2 : ℝ) ^ r) ^ 2 = 2 ^ (r * 2) := (pow_mul 2 r 2).symm rw [hfour, htwo] ring · rw [if_neg hodd, if_neg hodd] ring rw [blockEnergy, Finset.mul_sum, Finset.sum_filter] apply Finset.sum_congr rfl intro r hr rw [hterm r (Finset.mem_Icc.mp hr).1]
CausalSmith.Experimentation.SnipeDegreeFrontier.fairCoinEnergy · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_fair_coin_frontier.lean:40

The largest exposed fair-coin order is the largest eligible odd order.

Formal statement
d β :
kStar d β (1 / 2 : ℝ) = largestOddLE (effBeta β d)
Proof (Lean source)
lemma fairCoinKStar (d β : ℕ) : kStar d β (1 / 2 : ℝ) = largestOddLE (effBeta β d) := by have hset : (Icc 1 (effBeta β d)).filter (fun r => bernoulliContrast (1 / 2 : ℝ) r ≠ 0) = (Icc 1 (effBeta β d)).filter Odd := by ext r simp only [mem_filter, Finset.mem_Icc] by_cases hr : 1 ≤ r ∧ r ≤ effBeta β d · simp only [hr, true_and] rw [fairCoinContrast r] by_cases hodd : Odd r · simp [hodd, zpow_ne_zero (1 - (r : ℤ)) (by norm_num : (2 : ℝ) ≠ 0)] · simp [hodd] · simp [hr] unfold kStar largestOddLE rw [hset]
CausalSmith.Experimentation.SnipeDegreeFrontier.fairCoinKStar · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_fair_coin_frontier.lean:75
theorem fair_coin_energy_frontier Theorem 4 in the paper ↗

The fair-coin cancellation identity and its linear-interference frontier.

Formal statement
(∀ (n d β : ℕ) (B : ℝ), 1 ≤ n → 1 ≤ d → DegreeIndex (Fin n) d → 1 ≤ β → 0 ≤ B → (∀ r : ℕ, 1 ≤ r → bernoulliContrast (1 / 2 : ℝ) r = if Odd r then 2 ^ (1 - (r : ℤ)) else 0) ∧ blockEnergy β (1 / 2 : ℝ) d = 4 * ∑ r ∈ (Icc 1 (effBeta β d)).filter Odd, (Nat.choose d r : ℝ) ∧ kStar d β (1 / 2 : ℝ) = largestOddLE (effBeta β d)) ∧
∃ cLower cUpper : ℝ,
0 < cLower ∧
cLower ≤ cUpper ∧
∀ (n d : ℕ) (B : ℝ),
1 ≤ n → 1 ≤ d → DegreeIndex (Fin n) d → 0 ≤ B → blockEnergy 1 (1 / 2 : ℝ) d = 4 * d ∧
cLower * B ^ 2 * min 1 ((d : ℝ) ^ 2 / n)
minimaxRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ∧
minimaxRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B
= minimaxRiskL1 (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ∧
minimaxRiskL1 (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B
minimaxRiskBddOutcome (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ∧
minimaxRiskBddOutcome (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B
≤ cUpper * B ^ 2 * min 1 ((d : ℝ) ^ 2 / n) ∧
(d ∣ n → worstRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B (snipeEstimator 1 (1 / 2 : ℝ)) = 4 * B ^ 2 * d ^ 2 / n ∧ worstRiskBdd (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B (snipeEstimator 1 (1 / 2 : ℝ)) = 4 * B ^ 2 * d ^ 2 / n)
Proof (Lean source)
-- @node: thm:fair-coin-energy-frontier theorem fair_coin_energy_frontier : (∀ (n d β : ℕ) (B : ℝ), 1 ≤ n → 1 ≤ d → DegreeIndex (Fin n) d → 1 ≤ β → 0 ≤ B → (∀ r : ℕ, 1 ≤ r → bernoulliContrast (1 / 2 : ℝ) r = if Odd r then 2 ^ (1 - (r : ℤ)) else 0) ∧ blockEnergy β (1 / 2 : ℝ) d = 4 * ∑ r ∈ (Icc 1 (effBeta β d)).filter Odd, (Nat.choose d r : ℝ) ∧ kStar d β (1 / 2 : ℝ) = largestOddLE (effBeta β d)) ∧ ∃ cLower cUpper : ℝ, 0 < cLower ∧ cLower ≤ cUpper ∧ ∀ (n d : ℕ) (B : ℝ), 1 ≤ n → 1 ≤ d → DegreeIndex (Fin n) d → 0 ≤ B → blockEnergy 1 (1 / 2 : ℝ) d = 4 * d ∧ cLower * B ^ 2 * min 1 ((d : ℝ) ^ 2 / n) ≤ minimaxRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ∧ minimaxRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B = minimaxRiskL1 (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ∧ minimaxRiskL1 (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ≤ minimaxRiskBddOutcome (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ∧ minimaxRiskBddOutcome (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ≤ cUpper * B ^ 2 * min 1 ((d : ℝ) ^ 2 / n) ∧ (d ∣ n → worstRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B (snipeEstimator 1 (1 / 2 : ℝ)) = 4 * B ^ 2 * d ^ 2 / n ∧ worstRiskBdd (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B (snipeEstimator 1 (1 / 2 : ℝ)) = 4 * B ^ 2 * d ^ 2 / n) := by constructor · intro n d β B _hn _hd _hdeg _hβ _hB exact ⟨fun r _hr => fairCoinContrast r, fairCoinEnergy β d, fairCoinKStar d β⟩ · obtain ⟨cLower, cUpper, hcLower, hconstants, hfrontier⟩ := bounded_outcome_degree_frontier 1 (1 / 2 : ℝ) (by omega) (by norm_num) (by norm_num) refine ⟨cLower, 4 * cUpper, hcLower, ?_, ?_⟩ · have hcUpper : 0 < cUpper := lt_of_lt_of_le hcLower hconstants nlinarith · intro n d B hn hd hdeg hB let D : FiniteDesign (Fin n → Bool) := blockDesign n (1 / 2 : ℝ) (by norm_num) (by norm_num) have hD : IsProductBernoulli D (1 / 2 : ℝ) := by refine ⟨by norm_num, by norm_num, ?_⟩ refine ⟨fun _ => by norm_num, fun _ => by norm_num, ?_⟩ rfl obtain ⟨_hinc, _hstrict, hlower, hriskEq, hclassMono, hbddToWorst, hworstUpper, _hl1Upper, _hunbiasedL1, _hunbiasedBdd, _hsnipeL1, _hsnipeBdd, _hlocalL1, _hlocalBdd, _hchooseLower, _hchooseUpper, hexact, _hmixture⟩ := hfrontier n D d B hn hdeg hB hD have henergy : blockEnergy 1 (1 / 2 : ℝ) d = 4 * d := by rw [fairCoinEnergy] rw [show effBeta 1 d = 1 by simp [effBeta, Nat.min_eq_left hd]] have hfilter : (Icc 1 1).filter Odd = {1} := by ext r simp only [mem_filter, Finset.mem_Icc, mem_singleton] constructor · exact fun h => Nat.le_antisymm h.1.2 h.1.1 · intro hr subst r exact ⟨⟨le_rfl, le_rfl⟩, by decide⟩ rw [hfilter] simp have hnpos : (0 : ℝ) < n := by exact_mod_cast hn let x : ℝ := (d : ℝ) ^ 2 / n have hx : 0 ≤ x := by dsimp [x] positivity have henergyArg : (d : ℝ) * blockEnergy 1 (1 / 2 : ℝ) d / n = 4 * x := by rw [henergy] dsimp [x] ring have hminLower : min 1 x ≤ min 1 (4 * x) := by exact min_le_min_left 1 (by nlinarith) have hminUpper : min 1 (4 * x) ≤ 4 * min 1 x := by by_cases hx1 : x ≤ 1 · rw [min_eq_right hx1] by_cases h4x : 4 * x ≤ 1 · rw [min_eq_right h4x] · rw [min_eq_left (le_of_not_ge h4x)] nlinarith · rw [min_eq_left (le_of_not_ge hx1)] exact min_le_of_left_le (by norm_num) have hcoef : 0 ≤ cLower * B ^ 2 := by positivity have hlower' : cLower * B ^ 2 * min 1 x ≤ minimaxRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B := by calc cLower * B ^ 2 * min 1 x ≤ cLower * B ^ 2 * min 1 (4 * x) := mul_le_mul_of_nonneg_left hminLower hcoef _ = cLower * B ^ 2 * min 1 ((d : ℝ) * blockEnergy 1 (1 / 2 : ℝ) d / n) := by rw [henergyArg] _ ≤ minimaxRiskL1 (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B := hlower _ = minimaxRisk (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B := hriskEq have hcUpper : 0 ≤ cUpper := le_of_lt (lt_of_lt_of_le hcLower hconstants) have hupper' : minimaxRiskBddOutcome (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ≤ (4 * cUpper) * B ^ 2 * min 1 x := by calc minimaxRiskBddOutcome (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B ≤ worstRiskBdd (V := Fin n) (1 / 2 : ℝ) (by norm_num) (by norm_num) d 1 B (snipeClippedBdd B 1 (1 / 2 : ℝ)) := hbddToWorst _ ≤ cUpper * B ^ 2 * min 1 ((d : ℝ) * blockEnergy 1 (1 / 2 : ℝ) d / n) := hworstUpper _ = cUpper * B ^ 2 * min 1 (4 * x) := by rw [henergyArg] _ ≤ cUpper * B ^ 2 * (4 * min 1 x) := mul_le_mul_of_nonneg_left hminUpper (by positivity) _ = (4 * cUpper) * B ^ 2 * min 1 x := by ring refine ⟨henergy, ?_, hriskEq, hclassMono, hupper', ?_⟩ · simpa [x] using hlower' · intro hdiv obtain ⟨_hfixedL1, _hfixedBdd, hglobalL1, hglobalBdd, hratio⟩ := hexact hd hdiv constructor · rw [hglobalL1, hratio, henergy] ring · rw [hglobalBdd, hratio, henergy] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.fair_coin_energy_frontier · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_fair_coin_frontier.lean:94
T_sharp_local_linear 15 declarations The population at each index is the standard disjoint union of complete directed blocks.

Exact block-local linear constant and representer characterization

The population at each index is the standard disjoint union of complete directed blocks. The theorem states the exact finite minimax constant, the finite extreme-point risk formula, the asymptotic excess criterion, and the distance-two non-necessity witness.

The units in a typed active block.

Definition (Lean source)
noncomputable def blockUnits (n d : ℕ) (b : Fin (blockCount n d)) : Finset (Fin n) := Finset.univ.filter (fun i => i.val < activeCount n d ∧ i.val / d = b.val)
CausalSmith.Experimentation.SnipeDegreeFrontier.blockUnits · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:22
def canonicalBlockScore

The canonical complete-block score viewed on the global assignment.

Definition (Lean source)
noncomputable def canonicalBlockScore (n d β : ℕ) (p : ℝ) (i : Fin n) (z : Fin n → Bool) : ℝ := by classical exact snipeScore (fun j i => decide (blockGraph n d j i)) β p i z
CausalSmith.Experimentation.SnipeDegreeFrontier.canonicalBlockScore · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:27

Worst-risk ratio relative to the exact block benchmark.

Definition (Lean source)
noncomputable def locLinRiskRatio (n d β : ℕ) (B p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) : ℝ := locLinWorstRisk (blockGraph n d) d β B p hp0 hp1 w / (B ^ 2 * blockEnergy β p d / blockCount n d)
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinRiskRatio · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:35

Normalized sum of per-block extremal excesses.

Definition (Lean source)
noncomputable def normalizedBlockExcess (n d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) : ℝ := ((blockCount n d : ℝ) * d ^ 2 * blockEnergy β p d)⁻¹ * ∑ b : Fin (blockCount n d), (blockExtremal (blockGraph n d) d β p hp0 hp1 w (blockUnits n d b) - d ^ 2 * blockEnergy β p d)
CausalSmith.Experimentation.SnipeDegreeFrontier.normalizedBlockExcess · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:42

Normalized average squared distance from canonical SNIPE weights.

Definition (Lean source)
noncomputable def normalizedWeightDistance (n d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) : ℝ := ((n : ℝ) * blockEnergy β p d)⁻¹ * ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (w.weight i z - canonicalBlockScore n d β p i z) ^ 2)
CausalSmith.Experimentation.SnipeDegreeFrontier.normalizedWeightDistance · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:51

Distance to a caller-supplied relabeling of the symmetric canonical complete-block score.

Definition (Lean source)
noncomputable def normalizedWeightDistanceRelabeled (n d β : ℕ) (p : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) (w : LocLinWeights (blockGraph n d) d β p hp0 hp1) (π : Fin n ≃ Fin n) : ℝ := ((n : ℝ) * blockEnergy β p d)⁻¹ * ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => hp0) (fun _ => hp1)).E (fun z => (w.weight i z - canonicalBlockScore n d β p (π i) (fun j => z (π.symm j))) ^ 2)
CausalSmith.Experimentation.SnipeDegreeFrontier.normalizedWeightDistanceRelabeled · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:60
theorem locLinRiskRatio_eq_one_add_normalizedBlockExcess

When the population splits exactly into complete blocks of size d (so d divides n), a local-linear weighting's worst-case risk relative to the exact block benchmark equals one plus the normalized total of the per-block extremal excesses. In other words, the risk ratio exceeds one by exactly the amount — measured in units of the benchmark — by which the blocks' worst-case contributions overshoot the benchmark value they would attain under the canonical block weights.

Formal statement
n d β :
B p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hB :
0 < B
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
w :
LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)
locLinRiskRatio n d β B p (le_of_lt hp0) (le_of_lt hp1) w
= 1 + normalizedBlockExcess n d β p (le_of_lt hp0) (le_of_lt hp1) w
Proof (Lean source)
lemma locLinRiskRatio_eq_one_add_normalizedBlockExcess (n d β : ℕ) (B p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hB : 0 < B) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (w : LocLinWeights (blockGraph n d) d β p (le_of_lt hp0) (le_of_lt hp1)) : locLinRiskRatio n d β B p (le_of_lt hp0) (le_of_lt hp1) w = 1 + normalizedBlockExcess n d β p (le_of_lt hp0) (le_of_lt hp1) w := by rw [locLinRiskRatio, locLinWorstRisk_exact_blockExtremal n d β B p hB (le_of_lt hp0) (le_of_lt hp1) hn hd hdiv w] unfold normalizedBlockExcess rw [show blockUnits n d = completeBlockUnits n d by rfl] have hA : 0 < blockEnergy β p d := blockEnergy_pos β d p hβ hd hp0 hp1 have hq : 0 < blockCount n d := Nat.div_pos (Nat.le_of_dvd (Nat.zero_lt_of_lt hn) hdiv) (Nat.zero_lt_of_lt hd) have hncast : (n : ℝ) = (blockCount n d : ℝ) * (d : ℝ) := by norm_cast simpa [blockCount, mul_comm] using (Nat.div_mul_cancel hdiv).symm rw [Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, Fintype.card_fin] simp only [nsmul_eq_mul] rw [hncast] have hBr : B ≠ 0 := hB.ne' have hAr : blockEnergy β p d ≠ 0 := hA.ne' have hqr : (blockCount n d : ℝ) ≠ 0 := by positivity have hdr : (d : ℝ) ≠ 0 := by positivity field_simp ring
CausalSmith.Experimentation.SnipeDegreeFrontier.locLinRiskRatio_eq_one_add_normalizedBlockExcess · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:73
theorem normalized_sqrt_excess_identity

Establishes the stated mathematical result for normalized sqrt excess identity.

Formal statement
q d n :
A E :
hq :
1 ≤ q
hd :
1 ≤ d
hn :
n = q * d
hA :
0 < A
hE :
0 ≤ E
((q : ℝ) * (d : ℝ) ^ 2 * A)⁻¹ * (2 * sqrt ((d : ℝ) ^ 2 * A) * sqrt (q : ℝ) * sqrt ((d : ℝ) * E) + (d : ℝ) * E)
= 2 * sqrt (((n : ℝ) * A)⁻¹ * E) + ((n : ℝ) * A)⁻¹ * E
Proof (Lean source)
lemma normalized_sqrt_excess_identity (q d n : ℕ) (A E : ℝ) (hq : 1 ≤ q) (hd : 1 ≤ d) (hn : n = q * d) (hA : 0 < A) (hE : 0 ≤ E) : ((q : ℝ) * (d : ℝ) ^ 2 * A)⁻¹ * (2 * sqrt ((d : ℝ) ^ 2 * A) * sqrt (q : ℝ) * sqrt ((d : ℝ) * E) + (d : ℝ) * E) = 2 * sqrt (((n : ℝ) * A)⁻¹ * E) + ((n : ℝ) * A)⁻¹ * E := by have hqr : 0 < (q : ℝ) := by positivity have hdr : 0 < (d : ℝ) := by positivity have hnr : (n : ℝ) = (q : ℝ) * (d : ℝ) := by exact_mod_cast hn have hnpos : 0 < (n : ℝ) := by rw [hnr]; positivity have hsqrtq : sqrt (q : ℝ) ≠ 0 := (Real.sqrt_pos.2 hqr).ne' have hsqrtd : sqrt (d : ℝ) ≠ 0 := (Real.sqrt_pos.2 hdr).ne' have hsqrtA : sqrt A ≠ 0 := (Real.sqrt_pos.2 hA).ne' rw [Real.sqrt_mul (sq_nonneg (d : ℝ)) A, Real.sqrt_sq_eq_abs, abs_of_pos hdr] have hsqrtqd : sqrt (q : ℝ) * sqrt ((d : ℝ) * E) = sqrt ((n : ℝ) * E) := by rw [← Real.sqrt_mul hqr.le] congr 1 rw [hnr] ring rw [show 2 * ((d : ℝ) * sqrt A) * sqrt (q : ℝ) * sqrt ((d : ℝ) * E) = 2 * (d : ℝ) * sqrt A * sqrt ((n : ℝ) * E) by rw [← hsqrtqd] ring] rw [Real.sqrt_mul hnpos.le E] rw [show ((n : ℝ) * A)⁻¹ * E = E / ((n : ℝ) * A) by field_simp] rw [Real.sqrt_div hE ((n : ℝ) * A), Real.sqrt_mul hnpos.le A] rw [hnr] rw [Real.sqrt_mul hqr.le (d : ℝ)] have hsqrtq_sq : sqrt (q : ℝ) ^ 2 = (q : ℝ) := Real.sq_sqrt hqr.le have hsqrtd_sq : sqrt (d : ℝ) ^ 2 = (d : ℝ) := Real.sq_sqrt hdr.le have hsqrtA_sq : sqrt A ^ 2 = A := Real.sq_sqrt hA.le field_simp [hsqrtq, hsqrtd, hsqrtA] rw [← hsqrtq_sq, ← hsqrtd_sq, ← hsqrtA_sq] simp only [Real.sqrt_sq_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] ring
CausalSmith.Experimentation.SnipeDegreeFrontier.normalized_sqrt_excess_identity · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:115
theorem canonicalBlockScore_relabel_within_blocks

Establishes the stated mathematical result for canonical block score relabel within blocks.

Formal statement
n d β :
p :
hdiv :
d ∣ n
π :
Fin n ≃ Fin n
:
∀ i, (π i).val / d = i.val / d
i :
Fin n
z :
Fin n → Bool
canonicalBlockScore n d β p (π i) (fun j => z (π.symm j))
= canonicalBlockScore n d β p i z
Proof (Lean source)
lemma canonicalBlockScore_relabel_within_blocks (n d β : ℕ) (p : ℝ) (hdiv : d ∣ n) (π : Fin n ≃ Fin n) (hπ : ∀ i, (π i).val / d = i.val / d) (i : Fin n) (z : Fin n → Bool) : canonicalBlockScore n d β p (π i) (fun j => z (π.symm j)) = canonicalBlockScore n d β p i z := by classical unfold canonicalBlockScore apply snipeScore_relabel (blockGraph n d) π intro j k have hactive : activeCount n d = n := activeCount_eq_of_dvd n d hdiv simp only [blockGraph, hactive, j.isLt, k.isLt, (π j).isLt, (π k).isLt, true_and] rw [hπ j, hπ k]
CausalSmith.Experimentation.SnipeDegreeFrontier.canonicalBlockScore_relabel_within_blocks · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:171
theorem riskRatio_tendsto_iff_normalizedBlockExcess

Establishes the stated mathematical result for risk ratio tendsto iff normalized block excess.

Formal statement
β :
p B :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hB :
0 < B
n d :
ℕ → ℕ
hn :
∀ t, 1 ≤ n t
hd :
∀ t, 1 ≤ d t
hdiv :
∀ t, d t ∣ n t
w :
∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1)
Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1)
Tendsto (fun t => normalizedBlockExcess (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0)
Proof (Lean source)
lemma riskRatio_tendsto_iff_normalizedBlockExcess (β : ℕ) (p B : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hB : 0 < B) (n d : ℕ → ℕ) (hn : ∀ t, 1 ≤ n t) (hd : ∀ t, 1 ≤ d t) (hdiv : ∀ t, d t ∣ n t) (w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1)) : Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1) ↔ Tendsto (fun t => normalizedBlockExcess (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0) := by have hid (t : ℕ) : locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t) = 1 + normalizedBlockExcess (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) := locLinRiskRatio_eq_one_add_normalizedBlockExcess (n t) (d t) β B p hβ hp0 hp1 hB (hn t) (hd t) (hdiv t) (w t) constructor · intro h have hs := h.sub (tendsto_const_nhds : Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)) convert hs using 1 · funext t rw [hid t] ring · ring · intro h have hs := (tendsto_const_nhds : Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)).add h convert hs using 1 · funext t exact hid t · ring
CausalSmith.Experimentation.SnipeDegreeFrontier.riskRatio_tendsto_iff_normalizedBlockExcess · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:189
theorem normalizedWeightDistance_tendsto_implies_riskRatio

Establishes the stated mathematical result for normalized weight distance tendsto implies risk ratio.

Formal statement
β :
p B :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hB :
0 < B
n d :
ℕ → ℕ
hn :
∀ t, 1 ≤ n t
hd :
∀ t, 1 ≤ d t
hdiv :
∀ t, d t ∣ n t
w :
∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1)
hdist :
Tendsto (fun t => normalizedWeightDistance (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0)
Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1)
Proof (Lean source)
lemma normalizedWeightDistance_tendsto_implies_riskRatio (β : ℕ) (p B : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hB : 0 < B) (n d : ℕ → ℕ) (hn : ∀ t, 1 ≤ n t) (hd : ∀ t, 1 ≤ d t) (hdiv : ∀ t, d t ∣ n t) (w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1)) (hdist : Tendsto (fun t => normalizedWeightDistance (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0)) : Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1) := by let x : ℕ → ℝ := fun t => normalizedWeightDistance (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) let y : ℕ → ℝ := fun t => normalizedBlockExcess (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) have hx : Tendsto x atTop (𝓝 0) := hdist have hy0 (t : ℕ) : 0 ≤ y t := by dsimp [y, normalizedBlockExcess] apply mul_nonneg · apply inv_nonneg.mpr exact mul_nonneg (mul_nonneg (by positivity) (sq_nonneg _)) (blockEnergy_pos β (d t) p hβ (hd t) hp0 hp1).le · apply sum_nonneg intro b hb exact sub_nonneg.mpr (by simpa [blockUnits, completeBlockUnits] using completeBlock_blockExtremal_lower (n t) (d t) β p hp0 hp1 (hn t) (hd t) (hdiv t) (w t) b) have hyupper (t : ℕ) : y t ≤ 2 * sqrt (x t) + x t := by let A := blockEnergy β p (d t) let Etotal := ∑ i : Fin (n t), (bernoulliDesign (fun _ : Fin (n t) => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((w t).weight i z - (canonicalLocLinWeights (n t) (d t) β p hp0 hp1 (hn t) (hd t) (hdiv t)).weight i z) ^ 2) have hA : 0 < A := blockEnergy_pos β (d t) p hβ (hd t) hp0 hp1 have hq : 1 ≤ blockCount (n t) (d t) := by exact Nat.one_le_iff_ne_zero.mpr (Nat.ne_of_gt (Nat.div_pos (Nat.le_of_dvd (Nat.zero_lt_of_lt (hn t)) (hdiv t)) (Nat.zero_lt_of_lt (hd t)))) have hE : 0 ≤ Etotal := by dsimp [Etotal] apply sum_nonneg intro i hi exact (bernoulliDesign (fun _ : Fin (n t) => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E_nonneg (fun z => sq_nonneg _) have hraw := completeBlockExtremal_excess_le_distance (n t) (d t) β p hp0 hp1 (hn t) (hd t) (hdiv t) (w t) have hden : 0 ≤ ((blockCount (n t) (d t) : ℝ) * (d t : ℝ) ^ 2 * A)⁻¹ := by positivity calc y t = ((blockCount (n t) (d t) : ℝ) * (d t : ℝ) ^ 2 * A)⁻¹ * ∑ b : Fin (blockCount (n t) (d t)), (blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) (completeBlockUnits (n t) (d t) b) - (d t : ℝ) ^ 2 * A) := by rfl _ ≤ ((blockCount (n t) (d t) : ℝ) * (d t : ℝ) ^ 2 * A)⁻¹ * (2 * sqrt ((d t : ℝ) ^ 2 * A) * sqrt (blockCount (n t) (d t) : ℝ) * sqrt ((d t : ℝ) * Etotal) + (d t : ℝ) * Etotal) := mul_le_mul_of_nonneg_left (by simpa [A, Etotal] using hraw) hden _ = 2 * sqrt (x t) + x t := by rw [normalized_sqrt_excess_identity (blockCount (n t) (d t)) (d t) (n t) A Etotal hq (hd t) (by simpa [blockCount, mul_comm] using (Nat.div_mul_cancel (hdiv t)).symm) hA hE] rfl have hsqrt : Tendsto (fun t => sqrt (x t)) atTop (𝓝 0) := by simpa [Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp hx have hu : Tendsto (fun t => 2 * sqrt (x t) + x t) atTop (𝓝 0) := by convert (hsqrt.const_mul 2).add hx using 1 <;> ring have hy : Tendsto y atTop (𝓝 0) := squeeze_zero hy0 hyupper hu have hrisk : (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) = fun t => 1 + y t := by funext t exact locLinRiskRatio_eq_one_add_normalizedBlockExcess (n t) (d t) β B p hβ hp0 hp1 hB (hn t) (hd t) (hdiv t) (w t) rw [hrisk] convert ((tendsto_const_nhds : Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)).add hy) using 1 <;> ring
CausalSmith.Experimentation.SnipeDegreeFrontier.normalizedWeightDistance_tendsto_implies_riskRatio · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:229
theorem orthogonalWitness_normalized_distance_eq_two

Establishes the stated mathematical result for orthogonal witness normalized distance eq two.

Formal statement
n d β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
hhigh :
β < d
normalizedWeightDistance n d β p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv)
= 2
Proof (Lean source)
lemma orthogonalWitness_normalized_distance_eq_two (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (hhigh : β < d) : normalizedWeightDistance n d β p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv) = 2 := by classical unfold normalizedWeightDistance canonicalBlockScore rw [show (∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv).weight i z - snipeScore (fun j i => decide (blockGraph n d j i)) β p i z) ^ 2)) = (blockCount n d : ℝ) * (2 * (d : ℝ) * blockEnergy β p d) by exact orthogonalWitnessWeights_distance_energy n d β p hβ hp0 hp1 hn hd hdiv hhigh] have hA : 0 < blockEnergy β p d := blockEnergy_pos β d p hβ hd hp0 hp1 have hq : 0 < blockCount n d := Nat.div_pos (Nat.le_of_dvd (Nat.zero_lt_of_lt hn) hdiv) (Nat.zero_lt_of_lt hd) have hncast : (n : ℝ) = (blockCount n d : ℝ) * (d : ℝ) := by norm_cast simpa [blockCount, mul_comm] using (Nat.div_mul_cancel hdiv).symm rw [hncast] have hqr : (blockCount n d : ℝ) ≠ 0 := by positivity have hdr : (d : ℝ) ≠ 0 := by positivity have hAr : blockEnergy β p d ≠ 0 := hA.ne' field_simp
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalWitness_normalized_distance_eq_two · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:341
theorem orthogonalWitness_normalized_relabel_distance_eq_two

Establishes the stated mathematical result for orthogonal witness normalized relabel distance eq two.

Formal statement
n d β :
p :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hn :
1 ≤ n
hd :
1 ≤ d
hdiv :
d ∣ n
hhigh :
β < d
π :
Fin n ≃ Fin n
:
∀ i, (π i).val / d = i.val / d
normalizedWeightDistanceRelabeled n d β p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv) π
= 2
Proof (Lean source)
lemma orthogonalWitness_normalized_relabel_distance_eq_two (n d β : ℕ) (p : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hn : 1 ≤ n) (hd : 1 ≤ d) (hdiv : d ∣ n) (hhigh : β < d) (π : Fin n ≃ Fin n) (hπ : ∀ i, (π i).val / d = i.val / d) : normalizedWeightDistanceRelabeled n d β p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv) π = 2 := by unfold normalizedWeightDistanceRelabeled rw [show (∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv).weight i z - canonicalBlockScore n d β p (π i) (fun j => z (π.symm j))) ^ 2)) = ∑ i : Fin n, (bernoulliDesign (fun _ : Fin n => p) (fun _ => le_of_lt hp0) (fun _ => le_of_lt hp1)).E (fun z => ((orthogonalWitnessWeights n d β p hβ hp0 hp1 hn hd hdiv).weight i z - canonicalBlockScore n d β p i z) ^ 2) by apply Finset.sum_congr rfl intro i hi apply FiniteDesign.E_congr intro z rw [canonicalBlockScore_relabel_within_blocks n d β p hdiv π hπ i z]] exact orthogonalWitness_normalized_distance_eq_two n d β p hβ hp0 hp1 hn hd hdiv hhigh
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalWitness_normalized_relabel_distance_eq_two · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:380
theorem orthogonalWitness_riskRatio_tendsto_one

Establishes the stated mathematical result for orthogonal witness risk ratio tendsto one.

Formal statement
β :
p B :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hB :
0 < B
n d :
ℕ → ℕ
hn :
∀ t, 1 ≤ n t
hd :
∀ t, 1 ≤ d t
hdiv :
∀ t, d t ∣ n t
hdtop :
Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights (n t) (d t) β p hβ hp0 hp1 (hn t) (hd t) (hdiv t))) atTop (𝓝 1)
Proof (Lean source)
lemma orthogonalWitness_riskRatio_tendsto_one (β : ℕ) (p B : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hB : 0 < B) (n d : ℕ → ℕ) (hn : ∀ t, 1 ≤ n t) (hd : ∀ t, 1 ≤ d t) (hdiv : ∀ t, d t ∣ n t) (hdtop : Tendsto d atTop atTop) : Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (orthogonalWitnessWeights (n t) (d t) β p hβ hp0 hp1 (hn t) (hd t) (hdiv t))) atTop (𝓝 1) := by let w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) := fun t => orthogonalWitnessWeights (n t) (d t) β p hβ hp0 hp1 (hn t) (hd t) (hdiv t) let x : ℕ → ℝ := fun t => ((d t : ℝ))⁻¹ have hdreal : Tendsto (fun t => (d t : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp hdtop have hx : Tendsto x atTop (𝓝 0) := tendsto_inv_atTop_zero.comp hdreal have hx2 : Tendsto (fun t => 2 * x t) atTop (𝓝 0) := by convert hx.const_mul 2 using 1 <;> ring have hsqrt : Tendsto (fun t => sqrt (2 * x t)) atTop (𝓝 0) := by simpa [Function.comp_def] using (Real.continuous_sqrt.tendsto 0).comp hx2 have hu : Tendsto (fun t => 1 + 2 * sqrt (2 * x t) + 2 * x t) atTop (𝓝 1) := by convert ((tendsto_const_nhds : Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)).add (hsqrt.const_mul 2) |>.add hx2) using 1 <;> ring have hhigh : ∀ᶠ t in atTop, β < d t := by filter_upwards [tendsto_atTop.1 hdtop (β + 1)] with t ht omega have hlower (t : ℕ) : 1 ≤ locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t) := by rw [locLinRiskRatio_eq_one_add_normalizedBlockExcess (n t) (d t) β B p hβ hp0 hp1 hB (hn t) (hd t) (hdiv t) (w t)] have hcoef : 0 ≤ ((blockCount (n t) (d t) : ℝ) * (d t : ℝ) ^ 2 * blockEnergy β p (d t))⁻¹ := by apply inv_nonneg.mpr exact mul_nonneg (mul_nonneg (by positivity) (sq_nonneg _)) (blockEnergy_pos β (d t) p hβ (hd t) hp0 hp1).le unfold normalizedBlockExcess rw [show blockUnits (n t) (d t) = completeBlockUnits (n t) (d t) by rfl] have hsum : 0 ≤ ∑ b : Fin (blockCount (n t) (d t)), (blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) (completeBlockUnits (n t) (d t) b) - (d t : ℝ) ^ 2 * blockEnergy β p (d t)) := by apply sum_nonneg intro b hb exact sub_nonneg.mpr (completeBlock_blockExtremal_lower (n t) (d t) β p hp0 hp1 (hn t) (hd t) (hdiv t) (w t) b) nlinarith [mul_nonneg hcoef hsum] have hupper : ∀ᶠ t in atTop, locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t) ≤ 1 + 2 * sqrt (2 * x t) + 2 * x t := by filter_upwards [hhigh] with t hdt rw [locLinRiskRatio_eq_one_add_normalizedBlockExcess (n t) (d t) β B p hβ hp0 hp1 hB (hn t) (hd t) (hdiv t) (w t)] unfold normalizedBlockExcess rw [show blockUnits (n t) (d t) = completeBlockUnits (n t) (d t) by rfl] let A := blockEnergy β p (d t) let C := 2 * sqrt ((d t : ℝ) ^ 2 * A) * sqrt (2 * (d t : ℝ) * A) + 2 * (d t : ℝ) * A have hA : 0 < A := blockEnergy_pos β (d t) p hβ (hd t) hp0 hp1 have hb (b : Fin (blockCount (n t) (d t))) : blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) (completeBlockUnits (n t) (d t) b) - (d t : ℝ) ^ 2 * A ≤ C := by have hbound := orthogonalWitness_blockExtremal_upper (n t) (d t) β p hβ hp0 hp1 (hn t) (hd t) (hdiv t) hdt b dsimp [w, A, C] at hbound ⊢ linarith have hsum : ∑ b : Fin (blockCount (n t) (d t)), (blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) (completeBlockUnits (n t) (d t) b) - (d t : ℝ) ^ 2 * A) ≤ (blockCount (n t) (d t) : ℝ) * C := by calc _ ≤ ∑ _b : Fin (blockCount (n t) (d t)), C := by apply Finset.sum_le_sum intro b hbmem exact hb b _ = _ := by simp have hq : 1 ≤ blockCount (n t) (d t) := by exact Nat.one_le_iff_ne_zero.mpr (Nat.ne_of_gt (Nat.div_pos (Nat.le_of_dvd (Nat.zero_lt_of_lt (hn t)) (hdiv t)) (Nat.zero_lt_of_lt (hd t)))) have hid := normalized_sqrt_excess_identity 1 (d t) (d t) A (2 * A) (by omega) (hd t) (by simp) hA (by positivity) have hq0 : (blockCount (n t) (d t) : ℝ) ≠ 0 := by positivity have hd0 : (d t : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (Nat.zero_lt_of_lt (hd t))) calc 1 + ((blockCount (n t) (d t) : ℝ) * (d t : ℝ) ^ 2 * A)⁻¹ * ∑ b : Fin (blockCount (n t) (d t)), (blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) (completeBlockUnits (n t) (d t) b) - (d t : ℝ) ^ 2 * A) ≤ 1 + ((blockCount (n t) (d t) : ℝ) * (d t : ℝ) ^ 2 * A)⁻¹ * ((blockCount (n t) (d t) : ℝ) * C) := by gcongr _ = 1 + ((d t : ℝ) ^ 2 * A)⁻¹ * C := by field_simp [hq0, hd0, hA.ne'] _ = 1 + 2 * sqrt (2 * x t) + 2 * x t := by have hCeq : C = 2 * sqrt ((d t : ℝ) ^ 2 * A) * sqrt (1 : ℝ) * sqrt ((d t : ℝ) * (2 * A)) + (d t : ℝ) * (2 * A) := by dsimp [C] rw [show 2 * (d t : ℝ) * A = (d t : ℝ) * (2 * A) by ring, Real.sqrt_one] ring rw [hCeq] simp only [Real.sqrt_one, mul_one] simp only [cast_one, one_mul, Real.sqrt_one, mul_one] at hid rw [hid] have hin : ((d t : ℝ) * A)⁻¹ * (2 * A) = 2 * (d t : ℝ)⁻¹ := by field_simp [hd0, hA.ne'] rw [hin] dsimp [x] ring exact Filter.Tendsto.squeeze' (tendsto_const_nhds : Tendsto (fun _ : ℕ => (1 : ℝ)) atTop (𝓝 1)) hu (Eventually.of_forall hlower) hupper
CausalSmith.Experimentation.SnipeDegreeFrontier.orthogonalWitness_riskRatio_tendsto_one · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:417
theorem sharp_local_linear_constant_and_representers Theorem 3 in the paper ↗

Exact finite minimaxity and the full asymptotic representer characterization on complete blocks.

Formal statement
β :
p B :
:
1 ≤ β
hp0 :
0 < p
hp1 :
p < 1
hB :
0 < B
n d :
ℕ → ℕ
D :
∀ t, FiniteDesign (Fin (n t) → Bool)
hn :
∀ t, 1 ≤ n t
hd :
∀ t, 1 ≤ d t
hdiv :
∀ t, d t ∣ n t
hD :
∀ t, IsProductBernoulli (D t) p
(∀ t, locLinMinimaxRisk (blockGraph (n t) (d t)) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) = B ^ 2 * blockEnergy β p (d t) / blockCount (n t) (d t) ∧ B ^ 2 * blockEnergy β p (d t) / blockCount (n t) (d t) = B ^ 2 * (d t : ℝ) * blockEnergy β p (d t) / n t) ∧
(∀ t (w : LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1)), locLinWorstRisk (blockGraph (n t) (d t)) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) w = B ^ 2 / (n t : ℝ) ^ 2 * ∑ b : Fin (blockCount (n t) (d t)), blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) w (blockUnits (n t) (d t) b) ∧ ∀ b : Fin (blockCount (n t) (d t)), (d t : ℝ) ^ 2 * blockEnergy β p (d t) ≤ blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) w (blockUnits (n t) (d t) b)) ∧
(∀ w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1), Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1) ↔ Tendsto (fun t => normalizedBlockExcess (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0)) ∧
(∀ w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1), Tendsto (fun t => normalizedWeightDistance (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0) → Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1)) ∧
(Tendsto d atTop atTop → ∃ w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1), Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1) ∧ ∀ᶠ t in atTop, normalizedWeightDistance (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) = 2 ∧ ∀ π : Fin (n t) ≃ Fin (n t), (∀ i, (π i).val / d t = i.val / d t) → normalizedWeightDistanceRelabeled (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) π = 2)
Proof (Lean source)
-- @node: thm:sharp-local-linear-constant-and-representers theorem sharp_local_linear_constant_and_representers (β : ℕ) (p B : ℝ) (hβ : 1 ≤ β) (hp0 : 0 < p) (hp1 : p < 1) (hB : 0 < B) (n d : ℕ → ℕ) (D : ∀ t, FiniteDesign (Fin (n t) → Bool)) (hn : ∀ t, 1 ≤ n t) (hd : ∀ t, 1 ≤ d t) (hdiv : ∀ t, d t ∣ n t) (hD : ∀ t, IsProductBernoulli (D t) p) : (∀ t, locLinMinimaxRisk (blockGraph (n t) (d t)) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) = B ^ 2 * blockEnergy β p (d t) / blockCount (n t) (d t) ∧ B ^ 2 * blockEnergy β p (d t) / blockCount (n t) (d t) = B ^ 2 * (d t : ℝ) * blockEnergy β p (d t) / n t) ∧ (∀ t (w : LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1)), locLinWorstRisk (blockGraph (n t) (d t)) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) w = B ^ 2 / (n t : ℝ) ^ 2 * ∑ b : Fin (blockCount (n t) (d t)), blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) w (blockUnits (n t) (d t) b) ∧ ∀ b : Fin (blockCount (n t) (d t)), (d t : ℝ) ^ 2 * blockEnergy β p (d t) ≤ blockExtremal (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) w (blockUnits (n t) (d t) b)) ∧ (∀ w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1), Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1) ↔ Tendsto (fun t => normalizedBlockExcess (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0)) ∧ (∀ w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1), Tendsto (fun t => normalizedWeightDistance (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 0) → Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1)) ∧ (Tendsto d atTop atTop → ∃ w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1), Tendsto (fun t => locLinRiskRatio (n t) (d t) β B p (le_of_lt hp0) (le_of_lt hp1) (w t)) atTop (𝓝 1) ∧ ∀ᶠ t in atTop, normalizedWeightDistance (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) = 2 ∧ ∀ π : Fin (n t) ≃ Fin (n t), (∀ i, (π i).val / d t = i.val / d t) → normalizedWeightDistanceRelabeled (n t) (d t) β p (le_of_lt hp0) (le_of_lt hp1) (w t) π = 2) := by refine ⟨?_, ?_, ?_, ?_, ?_⟩ · intro t constructor · exact locLinMinimaxRisk_exact (n t) (d t) β B p hβ hB hp0 hp1 (hn t) (hd t) (hdiv t) · have hncast : (n t : ℝ) = (blockCount (n t) (d t) : ℝ) * (d t : ℝ) := by norm_cast simpa [blockCount, mul_comm] using (Nat.div_mul_cancel (hdiv t)).symm rw [hncast] have hq : (blockCount (n t) (d t) : ℝ) ≠ 0 := by have : 0 < blockCount (n t) (d t) := by exact Nat.div_pos (Nat.le_of_dvd (Nat.zero_lt_of_lt (hn t)) (hdiv t)) (Nat.zero_lt_of_lt (hd t)) positivity have hdr : (d t : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt (Nat.zero_lt_of_lt (hd t))) field_simp · intro t w constructor · exact locLinWorstRisk_exact_blockExtremal (n t) (d t) β B p hB (le_of_lt hp0) (le_of_lt hp1) (hn t) (hd t) (hdiv t) w · intro b exact completeBlock_blockExtremal_lower (n t) (d t) β p hp0 hp1 (hn t) (hd t) (hdiv t) w b · intro w exact riskRatio_tendsto_iff_normalizedBlockExcess β p B hβ hp0 hp1 hB n d hn hd hdiv w · intro w hdist exact normalizedWeightDistance_tendsto_implies_riskRatio β p B hβ hp0 hp1 hB n d hn hd hdiv w hdist · intro hdtop let w : ∀ t, LocLinWeights (blockGraph (n t) (d t)) (d t) β p (le_of_lt hp0) (le_of_lt hp1) := fun t => orthogonalWitnessWeights (n t) (d t) β p hβ hp0 hp1 (hn t) (hd t) (hdiv t) refine ⟨w, ?_, ?_⟩ · exact orthogonalWitness_riskRatio_tendsto_one β p B hβ hp0 hp1 hB n d hn hd hdiv hdtop · have hhigh : ∀ᶠ t in atTop, β < d t := by filter_upwards [tendsto_atTop.1 hdtop (β + 1)] with t ht omega filter_upwards [hhigh] with t hdt constructor · exact orthogonalWitness_normalized_distance_eq_two (n t) (d t) β p hβ hp0 hp1 (hn t) (hd t) (hdiv t) hdt · intro π hπ exact orthogonalWitness_normalized_relabel_distance_eq_two (n t) (d t) β p hβ hp0 hp1 (hn t) (hd t) (hdiv t) hdt π hπ
CausalSmith.Experimentation.SnipeDegreeFrontier.sharp_local_linear_constant_and_representers · CausalSmith/Experimentation/EXP_SnipeDegreeFrontier_Research/T_sharp_local_linear.lean:577