PO.ID.Exact.Variable­Intensity­IV

Variable-intensity instrumental variables: Angrist-Imbens average causal response over ordered treatment margins.

Ordered­Treatment 8 core · 3 supporting This file provides algebra for finite ordered treatment or intensity levels: it defines adjacent margins, crossing indicators, and telescoping identities that express a change across ordered levels as the sum of crossed ★ ordered_telescope_identity

Variable-Intensity IV Ordered Treatment

This file provides algebra for finite ordered treatment or intensity levels: it defines adjacent margins, crossing indicators, and telescoping identities that express a change across ordered levels as the sum of crossed marginal increments, and re-exports the generic normalized finite weights. These are used in variable-intensity instrumental-variable characterizations.

def lowerLevel reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

For a sequence of JJ adjacent margins and a margin, the lower treatment level is the lower endpoint of that margin in the ordered list of J+1J+1 levels.

Definition (Lean source)
J :
j :
Fin J
lowerLevel j :
Fin (J + 1)
j.castSucc
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.lowerLevel · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:35
def upperLevel reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

For a sequence of JJ adjacent margins and a margin, the upper treatment level is the upper endpoint of that margin in the ordered list of J+1J+1 levels.

Definition (Lean source)
J :
j :
Fin J
upperLevel j :
Fin (J + 1)
j.succ
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.upperLevel · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:39
def intensityValue reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

For a sequence of JJ adjacent margins and an ordered treatment level, the numeric intensity value is that level's position in the ordered list, expressed as a real number.

Definition (Lean source)
J :
d :
Fin (J + 1)
intensityValue d :
d.val
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.intensityValue · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:43
def marginIncrement reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

For a sequence of JJ adjacent margins, a real-valued function on the J+1J+1 ordered treatment levels, and a margin, the margin increment is the function value at that margin's upper endpoint minus its value at the lower endpoint.

Definition (Lean source)
J :
f :
Fin (J + 1) → ℝ
j :
Fin J
marginIncrement f j :
f (upperLevel j) - f (lowerLevel j)
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.marginIncrement · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:47
def Crossing reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

For a sequence of JJ adjacent margins, an initial treatment level, a final treatment level, and a margin, the crossing condition holds exactly when the movement starts below that margin's upper endpoint and ends at or above it.

Definition (Lean source)
J :
a b :
Fin (J + 1)
j :
Fin J
Crossing a b j :
Prop
clause 1
upperLevel j ≤ b
clause 2
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.Crossing · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:51
def crossingIndicator reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

For a sequence of JJ adjacent margins, an initial treatment level, a final treatment level, and a margin, the crossing indicator equals one when the movement crosses that margin and zero otherwise.

Definition (Lean source)
J :
a b :
Fin (J + 1)
j :
Fin J
crossingIndicator a b j :
by classical exact if Crossing a b j then 1 else 0
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.crossingIndicator · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:55
lemma ordered_telescope_identity reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

Ordered telescoping for the identity intensity map. For an ordered treatment level a no larger than b among J + 1 ordered intensity levels, the numeric gap b − a equals the number of unit margins j → j+1 that the movement from a to b crosses.

Formal statement
J :
Fin (J + 1)
hab :
a ≤ b
Proof (Lean source)
lemma ordered_telescope_identity {J : ℕ} {a b : Fin (J + 1)} (hab : a ≤ b) : intensityValue b - intensityValue a = ∑ j : Fin J, crossingIndicator a b j := by simpa [intensityValue, marginIncrement, lowerLevel, upperLevel] using (ordered_telescope_indicator (J := J) (fun d : Fin (J + 1) => intensityValue d) hab)
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.ordered_telescope_identity · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:108 · uses crossingIndicator , intensityValue
abbrev normalizedWeight reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment

Given a finite collection of indices, a real weight assigned to each index, and one index, the normalized finite weight is that index's weight divided by the sum of all weights.

Definition (Lean source)
ι :
Type*
a :
ι → ℝ
i :
ι
normalizedWeight a i :
Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.normalizedWeight · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:117
3 supporting declarations (lemmas, instances)
  • ordered_telescope_indicator lemma — Ordered telescoping across crossed margins for an arbitrary real-valued function on finite ordered levels.
    J :
    f :
    Fin (J + 1) → ℝ
    a b :
    Fin (J + 1)
    hab :
    a ≤ b
    f b - f a = ∑ j : Fin J, marginIncrement f j * crossingIndicator a b j
    Proof (Lean source)
    lemma ordered_telescope_indicator {J : ℕ} (f : Fin (J + 1) → ℝ) {a b : Fin (J + 1)} (hab : a ≤ b) : f b - f a = ∑ j : Fin J, marginIncrement f j * crossingIndicator a b j := by classical let F : ℕ → ℝ := fun n => if h : n < J + 1 then f ⟨n, h⟩ else 0 have hNat : a.val ≤ b.val := (Fin.val_fin_le).2 hab calc f b - f a = F b.val - F a.val := by have haJ : a.val ≤ J := Nat.le_of_lt_succ a.isLt have hbJ : b.val ≤ J := Nat.le_of_lt_succ b.isLt simp [F, haJ, hbJ] _ = ∑ i ∈ Ico a.val b.val, (F (i + 1) - F i) := by rw [Finset.sum_Ico_sub F hNat] _ = ∑ j : Fin J, marginIncrement f j * crossingIndicator a b j := by have hIco : Ico a.val b.val = (range J).filter (fun x => a.val ≤ x ∧ x < b.val) := by ext x simp [Finset.mem_Ico] omega rw [hIco, Finset.sum_filter, Finset.sum_fin_eq_sum_range] apply Finset.sum_congr rfl intro x hx have hxJ : x < J := by simpa using hx have hxleJ : x ≤ J := by omega simp [F, marginIncrement, lowerLevel, upperLevel, crossingIndicator_eq_ite_val, hxJ, hxleJ]
    Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.ordered_telescope_indicator · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:78
  • normalizedWeight_nonneg lemma — Nonnegativity of normalized weights from nonnegative raw weights and a positive normalizing sum.
    ι :
    Type*
    a :
    ι → ℝ
    ha :
    ∀ i, 0 ≤ a i
    hsum :
    0 < ∑ i, a i
    i :
    ι
    0 ≤ normalizedWeight a i
    Proof (Lean source)
    lemma normalizedWeight_nonneg {ι : Type*} [Fintype ι] (a : ι → ℝ) (ha : ∀ i, 0 ≤ a i) (hsum : 0 < ∑ i, a i) (i : ι) : 0 ≤ normalizedWeight a i := by exact normalizedWeight_nonneg a ha hsum i
    Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.normalizedWeight_nonneg · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:121
  • sum_normalizedWeight_eq_one lemma — Normalized finite weights sum to one when the normalizing sum is positive.
    ι :
    Type*
    a :
    ι → ℝ
    hsum :
    0 < ∑ i, a i
    ∑ i, normalizedWeight a i = 1
    Proof (Lean source)
    lemma sum_normalizedWeight_eq_one {ι : Type*} [Fintype ι] (a : ι → ℝ) (hsum : 0 < ∑ i, a i) : ∑ i, normalizedWeight a i = 1 := by exact sum_normalizedWeight_eq_one a hsum.ne'
    Causalean.PO.ID.Exact.VariableIntensityIV.OrderedTreatment.sum_normalizedWeight_eq_one · Causalean/PO/ID/Exact/VariableIntensityIV/OrderedTreatment.lean:128
Variable­Intensity 41 core · 23 supporting This file formalizes a finite ordered-treatment instrumental-variable system for an Angrist-Imbens style directed instrument contrast, inside the potential-outcome framework (POSystem). ★ VariableIntensityIVSystem★ reducedForm_eq_sum_crossingEffects★ indicatorWeightedACR_eq_averageCausalResponse★ wald_eq_averageCausalResponse★ wald_eq_late_of_binaryIntensity★ wald_eq_marginResponseAverage

Variable-Intensity Instrumental Variables

This file formalizes a finite ordered-treatment instrumental-variable system for an Angrist-Imbens style directed instrument contrast, inside the potential-outcome framework (POSystem). The instrument, treatment intensity, and outcome are system variables; potential intensities D(z) and treatment-indexed potential outcomes Y(d) are genuine counterfactuals (POVar.cfUnder), and consistency / instrument-independence are the project's canonical PO assumptions (POSystem.Consistency, POSystem.IndepCF) rather than ad-hoc structure fields.

It defines margin-specific causal responses, crossing events, and the population objects needed to express average causal responses over crossed treatment margins; the directed Wald estimand; the headline average-causal-response characterization; binary-treatment and constant-response specializations; and an interface-only population 2SLS score/decomposition layer.

structure VariableIntensityIVSystem reviewed
Causalean.PO.ID.Exact.VariableIntensityIV

A variable-intensity IV system records an instrument, an ordered treatment intensity, and an outcome inside a potential-outcome system, with the treatment taking at least one margin.

Definition (Lean source)
P :
J :
The ordered treatment has at least one margin.
hJ_pos :
0 < J
Instrument system variable.
Z :
P.V
Treatment-intensity system variable.
D :
P.V
Outcome system variable.
Y :
P.V
The instrument value space is identified with the finite set `𝒵`.
hZ𝒵 :
P.X Z ≃ᵐ 𝒵
The treatment value space is identified with the ordered levels `Fin (J+1)`.
hDintensity :
P.X D ≃ᵐ Fin (J + 1)
The outcome value space is identified with `ℝ`.
hYreal :
P.X Y ≃ᵐ ℝ
Instrument and treatment are distinct variables.
hZD :
Z ≠ D
Treatment and outcome are distinct variables.
hDY :
D ≠ Y
Instrument and outcome are distinct variables.
hZY :
Z ≠ Y
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:44 · uses POSystem
def zVar reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, the instrument potential-outcome variable is that system's instrument, represented with its finite instrument-value space.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
zVar S :
POVar P 𝒵
⟨S.Z, S.hZ𝒵⟩
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.zVar · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:82 · uses VariableIntensityIVSystem , POSystem , POVar
def dVar reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, the treatment-intensity potential-outcome variable is its ordered treatment, whose admissible levels run from zero through JJ.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
dVar S :
POVar P (Fin (J + 1))
⟨S.D, S.hDintensity⟩
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.dVar · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:85 · uses VariableIntensityIVSystem , POSystem , POVar
def yVar reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, the outcome potential-outcome variable is its real-valued outcome.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
yVar S :
POVar P ℝ
⟨S.Y, S.hYreal⟩
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.yVar · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:88 · uses VariableIntensityIVSystem , POSystem , POVar
def DofZ reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and an instrument value, the potential treatment intensity assigns every unit the ordered treatment level that would be observed if the instrument were fixed to that value.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z :
𝒵
DofZ S z :
P.Ω → Fin (J + 1)
S.dVar.cfUnder S.zVar z
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.DofZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:91 · uses VariableIntensityIVSystem , POSystem
def YofD reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and a treatment level, the treatment-indexed potential outcome assigns every unit the outcome that would be observed if treatment intensity were fixed to that level.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
d :
Fin (J + 1)
YofD S d :
P.Ω → ℝ
S.yVar.cfUnder S.dVar d
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.YofD · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:96 · uses VariableIntensityIVSystem , POSystem
def factualZ reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, the factual instrument assigns each unit its observed instrument value.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
factualZ S :
P.Ω → 𝒵
S.zVar.factual
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.factualZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:102 · uses VariableIntensityIVSystem , POSystem
def factualD reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, the factual treatment intensity assigns each unit its observed ordered treatment level.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
factualD S :
P.Ω → Fin (J + 1)
S.dVar.factual
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.factualD · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:105 · uses VariableIntensityIVSystem , POSystem
def factualY reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, the factual outcome assigns each unit its observed real-valued outcome.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
factualY S :
P.Ω → ℝ
S.yVar.factual
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.factualY · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:108 · uses VariableIntensityIVSystem , POSystem
def zEvent reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and an instrument value, the instrument cell is the set of units whose factual instrument equals that value.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z :
𝒵
zEvent S z :
Set P.Ω
S.zVar.event z
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.zEvent · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:111 · uses VariableIntensityIVSystem , POSystem
def dUnderZ reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and an instrument value, the regimed treatment variable is the treatment variable under the regime that fixes the instrument to that value.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z :
𝒵
dUnderZ S z :
RegimedVar P (Fin (J + 1))
⟨S.dVar, Regime.single S.Z (S.hZ𝒵.symm z)⟩
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.dUnderZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:147 · uses VariableIntensityIVSystem , POSystem , RegimedVar
def yUnderD reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and a treatment level, the regimed outcome variable is the outcome variable under the regime that fixes treatment to that level.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
d :
Fin (J + 1)
yUnderD S d :
⟨S.yVar, Regime.single S.D (S.hDintensity.symm d)⟩
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.yUnderD · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:151 · uses VariableIntensityIVSystem , POSystem , RegimedVar
def outcomeBundle reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, the outcome counterfactual bundle contains the potential outcomes at every one of the J+1J+1 ordered treatment levels.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
outcomeBundle S :
clause 1
n := J + 1
clause 2
type := fun _ => ℝ
clause 3
inst := fun _ => inferInstance
clause 4
vars := fun d => S.yUnderD d
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.outcomeBundle · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:155 · uses VariableIntensityIVSystem , POCFBundle , POSystem
def cfContrastBundle reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the contrast counterfactual bundle contains the potential treatments under those values and all treatment-indexed potential outcomes.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
cfContrastBundle S z0 z1 :
POCFBundle.cons (S.dUnderZ z0) (POCFBundle.cons (S.dUnderZ z1) S.outcomeBundle)
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.cfContrastBundle · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:162 · uses VariableIntensityIVSystem , POCFBundle , POSystem
def marginResponse reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and a treatment margin, the unit-level margin response assigns each unit the difference between its potential outcomes at the upper and lower levels of that margin.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
j :
Fin J
marginResponse S j :
P.Ω → ℝ
fun ω
=> S.YofD (OrderedTreatment.upperLevel j) ω - S.YofD (OrderedTreatment.lowerLevel j) ω
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.marginResponse · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:169 · uses VariableIntensityIVSystem , POSystem
def crossingEvent reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, two instrument values, and a treatment margin, the crossing event is the set of units whose potential treatment moves across that margin when the instrument changes from the first value to the second.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
j :
Fin J
crossingEvent S z0 z1 j :
Set P.Ω
{ω | OrderedTreatment.Crossing (S.DofZ z0 ω) (S.DofZ z1 ω) j}
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.crossingEvent · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:174 · uses VariableIntensityIVSystem , POSystem
def crossingProb reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, two instrument values, and a treatment margin, the crossing probability is the probability of the corresponding crossing event.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
j :
Fin J
crossingProb S z0 z1 j :
(P.μ (S.crossingEvent z0 z1 j)).toReal
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.crossingProb · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:178 · uses VariableIntensityIVSystem , POSystem
def totalCrossingProb reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the total crossing probability is the sum of the crossing probabilities over all treatment margins.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
totalCrossingProb S z0 z1 :
∑ j : Fin J, S.crossingProb z0 z1 j
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.totalCrossingProb · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:249 · uses VariableIntensityIVSystem , POSystem
def crossingWeight reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, two instrument values, and a treatment margin, the normalized margin-crossing weight is that margin's crossing probability divided by total crossing probability.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
j :
Fin J
crossingWeight S z0 z1 j :
OrderedTreatment.normalizedWeight (S.crossingProb z0 z1) j
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.crossingWeight · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:256 · uses VariableIntensityIVSystem , POSystem
def indicatorWeightedEffect reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, two instrument values, and a treatment margin, the indicator-weighted margin effect is the population mean of the unit-level margin response restricted to the corresponding crossing event.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
j :
Fin J
indicatorWeightedEffect S z0 z1 j :
∫ ω in S.crossingEvent z0 z1 j, S.marginResponse j ω ∂P.μ
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.indicatorWeightedEffect · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:260 · uses VariableIntensityIVSystem , POSystem
def unnormalizedACRContrast reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the unnormalized average-causal-response contrast is the sum of indicator-weighted margin effects over all treatment margins.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
unnormalizedACRContrast S z0 z1 :
∑ j : Fin J, S.indicatorWeightedEffect z0 z1 j
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.unnormalizedACRContrast · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:267 · uses VariableIntensityIVSystem , POSystem
def indicatorWeightedACR reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the indicator-weighted average causal response is the unnormalized contrast divided by total crossing probability.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
indicatorWeightedACR S z0 z1 :
S.unnormalizedACRContrast z0 z1 / S.totalCrossingProb z0 z1
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.indicatorWeightedACR · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:271 · uses VariableIntensityIVSystem , POSystem
def conditionalMarginResponse reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system, two instrument values, and a treatment margin, the conditional margin response is the average unit-level causal response among units whose potential treatment crosses that margin when the instrument changes from the first value to the second.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
j :
Fin J
conditionalMarginResponse S z0 z1 j :
PO.eventCondExp P.μ (S.crossingEvent z0 z1 j) (S.marginResponse j)
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.conditionalMarginResponse · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:278 · uses VariableIntensityIVSystem , POSystem
def averageCausalResponse reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the Angrist--Imbens average causal response is the crossing-probability-weighted sum of conditional margin responses.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
averageCausalResponse S z0 z1 :
∑ j : Fin J, S.crossingWeight z0 z1 j * S.conditionalMarginResponse z0 z1 j
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.averageCausalResponse · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:284 · uses VariableIntensityIVSystem , POSystem
def YofDofZ reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and an instrument value, the instrument-induced potential outcome assigns each unit the potential outcome at the treatment level induced by that instrument value.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z :
𝒵
YofDofZ S z :
P.Ω → ℝ
fun ω => S.YofD (S.DofZ z ω) ω
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.YofDofZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:288 · uses VariableIntensityIVSystem , POSystem
def firstStageContrast reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the potential first-stage contrast is the population mean of the difference between the real-valued potential treatment intensities under the second and first values.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
firstStageContrast S z0 z1 :
∫ ω, (OrderedTreatment.intensityValue (S.DofZ z1 ω) - OrderedTreatment.intensityValue (S.DofZ z0 ω)) ∂P.μ
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.firstStageContrast · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:326 · uses VariableIntensityIVSystem , POSystem
def reducedFormContrast reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the potential reduced-form contrast is the population mean of the difference between instrument-induced potential outcomes under the second and first values.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
reducedFormContrast S z0 z1 :
∫ ω, (S.YofDofZ z1 ω - S.YofDofZ z0 ω) ∂P.μ
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.reducedFormContrast · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:334 · uses VariableIntensityIVSystem , POSystem
def condExpDZ reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and an instrument value, the observed first-stage conditional mean is the conditional mean of factual treatment intensity in the instrument cell at that value.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z :
𝒵
condExpDZ S z :
PO.eventCondExp P.μ (S.zEvent z) (fun ω => OrderedTreatment.intensityValue (S.factualD ω))
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.condExpDZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:338 · uses VariableIntensityIVSystem , POSystem
def condExpYZ reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and an instrument value, the observed reduced-form conditional mean is the conditional mean of the factual outcome in the instrument cell at that value.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z :
𝒵
condExpYZ S z :
PO.eventCondExp P.μ (S.zEvent z) S.factualY
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.condExpYZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:345 · uses VariableIntensityIVSystem , POSystem
def wald reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Given a variable-intensity IV system and two instrument values, the directed Wald estimand is the difference in observed conditional outcome means divided by the corresponding difference in observed conditional treatment-intensity means.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
wald S z0 z1 :
(S.condExpYZ z1 - S.condExpYZ z0) / (S.condExpDZ z1 - S.condExpDZ z0)
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.wald · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:351 · uses VariableIntensityIVSystem , POSystem
structure ValidContrastAssumptions reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

IV-validity assumptions for a fixed directed contrast (z0,z1).

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
consistency :
P.Consistency

Consistency (SUTVA): observed D/Y equal the realized potential intensity/outcome, D = D(Z), Y = Y(D).

hIndependence :
P.IndepCF (RegimedVar.ofFactual S.zVar) (S.cfContrastBundle z0 z1) P.μ

H1: instrument independence from the contrast-relevant counterfactuals, Z ⟂ (D(z0), D(z1), Y(0),…,Y(J)).

hMonotone :
∀ᵐ ω ∂P.μ, S.DofZ z0 ω ≤ S.DofZ z1 ω

H5: directed monotonicity, D(z1) ≥ D(z0), a.s.

hRelevance :
0 < S.firstStageContrast z0 z1

H6: positive first stage.

hIntegrableY :
∀ d, Integrable (S.YofD d) P.μ

H7: treatment-indexed potential outcomes are integrable.

Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.ValidContrastAssumptions · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:356 · uses VariableIntensityIVSystem , POSystem
theorem reducedForm_eq_sum_crossingEffects reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Reduced-form decomposition across crossed margins. Fix a directed instrument contrast (z0, z1). Under the variable-intensity IV validity assumptions — SUTVA consistency of treatment and outcome, instrument independence from the potential treatments and treatment-indexed potential outcomes, almost-sure directed monotonicity of the potential treatment intensity in the instrument, a positive first stage, and integrability of every treatment-indexed potential outcome, the potential reduced-form contrast E[Y(D(z1)) − Y(D(z0))] equals the sum, over treatment-intensity margins, of the expected unit causal response on each margin restricted to the event that the instrument move from z0 to z1 crosses that margin.

Formal statement
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
hValid :
S.ValidContrastAssumptions z0 z1
S.reducedFormContrast z0 z1 = ∑ j : Fin J, S.indicatorWeightedEffect z0 z1 j
Proof (Lean source)
theorem reducedForm_eq_sum_crossingEffects {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) : S.reducedFormContrast z0 z1 = ∑ j : Fin J, S.indicatorWeightedEffect z0 z1 j := by unfold reducedFormContrast YofDofZ indicatorWeightedEffect have hpoint : (fun ω => S.YofD (S.DofZ z1 ω) ω - S.YofD (S.DofZ z0 ω) ω) =ᵐ[P.μ] fun ω => ∑ j : Fin J, S.marginResponse j ω * OrderedTreatment.crossingIndicator (S.DofZ z0 ω) (S.DofZ z1 ω) j := hValid.hMonotone.mono fun ω hmono => by simpa [OrderedTreatment.marginIncrement, marginResponse] using OrderedTreatment.ordered_telescope_indicator (J := J) (fun d : Fin (J + 1) => S.YofD d ω) hmono calc ∫ ω, (S.YofD (S.DofZ z1 ω) ω - S.YofD (S.DofZ z0 ω) ω) ∂P.μ = ∫ ω, ∑ j : Fin J, S.marginResponse j ω * OrderedTreatment.crossingIndicator (S.DofZ z0 ω) (S.DofZ z1 ω) j ∂P.μ := by exact MeasureTheory.integral_congr_ae hpoint _ = ∑ j : Fin J, ∫ ω, S.marginResponse j ω * OrderedTreatment.crossingIndicator (S.DofZ z0 ω) (S.DofZ z1 ω) j ∂P.μ := by rw [MeasureTheory.integral_finset_sum] intro i _hi rw [S.marginResponse_mul_crossingIndicator_eq_indicator z0 z1 i] exact (S.integrable_marginResponse hValid i).indicator (S.measurableSet_crossingEvent z0 z1 i) _ = ∑ j : Fin J, ∫ ω in S.crossingEvent z0 z1 j, S.marginResponse j ω ∂P.μ := by refine Finset.sum_congr rfl ?_ intro j _hj rw [S.marginResponse_mul_crossingIndicator_eq_indicator z0 z1 j] rw [MeasureTheory.integral_indicator (S.measurableSet_crossingEvent z0 z1 j)]
theorem indicatorWeightedACR_eq_averageCausalResponse reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Indicator-weighted and conditional-mean ACR forms agree. For any pair of instrument values z0 and z1, the indicator-weighted average causal response — the ratio of the summed crossing-indicator-weighted outcome contrasts to the summed crossing probabilities — equals the crossing-probability- weighted average of the conditional-mean margin responses.

Formal statement
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
S.indicatorWeightedACR z0 z1 = S.averageCausalResponse z0 z1
Proof (Lean source)
theorem indicatorWeightedACR_eq_averageCausalResponse {z0 z1 : 𝒵} : S.indicatorWeightedACR z0 z1 = S.averageCausalResponse z0 z1 := by simp only [indicatorWeightedACR, averageCausalResponse, crossingWeight, OrderedTreatment.normalizedWeight, normalizedWeight, totalCrossingProb, conditionalMarginResponse, unnormalizedACRContrast, indicatorWeightedEffect, crossingProb] rw [Finset.sum_div] apply Finset.sum_congr rfl intro j _hj rw [← PO.eventCondExp_mul_measure_toReal P.μ (S.crossingEvent z0 z1 j) (measure_ne_top _ _) (S.marginResponse j)] ring_nf
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.indicatorWeightedACR_eq_averageCausalResponse · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:763 · uses VariableIntensityIVSystem , averageCausalResponse , indicatorWeightedACR , POSystem
theorem wald_eq_averageCausalResponse reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Angrist-Imbens average-causal-response characterization. Under the variable-intensity IV validity assumptions, with the instrument cell Z = z0 having positive probability and the instrument cell Z = z1 having positive probability, the directed Wald estimand — the ratio of the reduced-form to first-stage conditional-mean contrasts across the two instrument cells — equals the Angrist-Imbens average causal response: the crossing-probability-weighted average, over treatment-intensity margins, of the conditional mean causal response given that the instrument move from z0 to z1 crosses that margin.

Formal statement
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
hValid :
S.ValidContrastAssumptions z0 z1
hCell0 :
0 < (P.μ (S.zEvent z0)).toReal
hCell1 :
0 < (P.μ (S.zEvent z1)).toReal
S.wald z0 z1 = S.averageCausalResponse z0 z1
Proof (Lean source)
theorem wald_eq_averageCausalResponse {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (hCell0 : 0 < (P.μ (S.zEvent z0)).toReal) (hCell1 : 0 < (P.μ (S.zEvent z1)).toReal) : S.wald z0 z1 = S.averageCausalResponse z0 z1 := by have hDZ0 := S.condExpDZ_left_eq_integral hValid hCell0 have hDZ1 := S.condExpDZ_right_eq_integral hValid hCell1 have hYZ0 := S.condExpYZ_left_eq_integral hValid hCell0 have hYZ1 := S.condExpYZ_right_eq_integral hValid hCell1 have hDint0 := S.integrable_intensityValue_DofZ z0 have hDint1 := S.integrable_intensityValue_DofZ z1 have hYint0 := S.integrable_YofDofZ hValid z0 have hYint1 := S.integrable_YofDofZ hValid z1 unfold wald rw [hYZ1, hYZ0, hDZ1, hDZ0] rw [← MeasureTheory.integral_sub hYint1 hYint0, ← MeasureTheory.integral_sub hDint1 hDint0] change S.reducedFormContrast z0 z1 / S.firstStageContrast z0 z1 = S.averageCausalResponse z0 z1 rw [← S.indicatorWeightedACR_eq_averageCausalResponse] simp [indicatorWeightedACR, unnormalizedACRContrast, totalCrossingProb, S.reducedForm_eq_sum_crossingEffects hValid, S.firstStage_eq_sum_crossingProb hValid]
def binaryMargin reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.SpecialCases

Given the condition that there is exactly one treatment margin, the unique binary-treatment margin is the sole margin of the ordered treatment scale.

Definition (Lean source)
J :
shared
hBinaryIntensity :
J = 1
binaryMargin hBinaryIntensity :
Fin J
hBinaryIntensity.symm ▸ (0 : Fin 1)
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.SpecialCases.binaryMargin · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:818
theorem wald_eq_late_of_binaryIntensity reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.SpecialCases

Binary-intensity specialization: Wald recovers LATE. Under the variable-intensity IV validity assumptions, with positive probability of the instrument cell Z = z0, positive probability of the instrument cell Z = z1, and a single treatment margin, J = 1, the directed Wald estimand equals the conditional mean unit causal response given the unique crossing event — the classical binary-treatment local average treatment effect.

Formal statement
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
hValid :
S.ValidContrastAssumptions z0 z1
hCell0 :
0 < (P.μ (S.zEvent z0)).toReal
hCell1 :
0 < (P.μ (S.zEvent z1)).toReal
hBinaryIntensity :
J = 1
S.wald z0 z1
= PO.eventCondExp P.μ (S.crossingEvent z0 z1 (binaryMargin hBinaryIntensity)) (S.marginResponse (binaryMargin hBinaryIntensity))
Proof (Lean source)
theorem wald_eq_late_of_binaryIntensity {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (hCell0 : 0 < (P.μ (S.zEvent z0)).toReal) (hCell1 : 0 < (P.μ (S.zEvent z1)).toReal) (hBinaryIntensity : J = 1) : S.wald z0 z1 = PO.eventCondExp P.μ (S.crossingEvent z0 z1 (binaryMargin hBinaryIntensity)) (S.marginResponse (binaryMargin hBinaryIntensity)) := by subst hBinaryIntensity rw [S.wald_eq_averageCausalResponse hValid hCell0 hCell1] have hweight : S.crossingWeight z0 z1 0 = 1 := by simpa using S.sum_crossingWeight_eq_one hValid simp [averageCausalResponse, binaryMargin, conditionalMarginResponse, hweight]
theorem wald_eq_marginResponseAverage reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.SpecialCases

Margin-specific response average specialization. Under the variable-intensity IV validity assumptions, with positive probability of the instrument cell Z = z0, positive probability of the instrument cell Z = z1, and a candidate margin-response function m that agrees, on each treatment-intensity margin, with the conditional mean causal response given that margin's crossing event, the directed Wald estimand equals the crossing-probability-weighted average of m across margins.

Formal statement
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
z0 z1 :
𝒵
m :
Fin J → ℝ
hValid :
S.ValidContrastAssumptions z0 z1
hCell0 :
0 < (P.μ (S.zEvent z0)).toReal
hCell1 :
0 < (P.μ (S.zEvent z1)).toReal
hMarginResponse :
∀ j : Fin J, m j = S.conditionalMarginResponse z0 z1 j
S.wald z0 z1 = ∑ j : Fin J, S.crossingWeight z0 z1 j * m j
Proof (Lean source)
theorem wald_eq_marginResponseAverage {z0 z1 : 𝒵} (m : Fin J → ℝ) (hValid : S.ValidContrastAssumptions z0 z1) (hCell0 : 0 < (P.μ (S.zEvent z0)).toReal) (hCell1 : 0 < (P.μ (S.zEvent z1)).toReal) (hMarginResponse : ∀ j : Fin J, m j = S.conditionalMarginResponse z0 z1 j) : S.wald z0 z1 = ∑ j : Fin J, S.crossingWeight z0 z1 j * m j := by rw [S.wald_eq_averageCausalResponse hValid hCell0 hCell1] simp [averageCausalResponse, hMarginResponse]
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.SpecialCases.wald_eq_marginResponseAverage · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:900 · uses VariableIntensityIVSystem , ValidContrastAssumptions , conditionalMarginResponse , crossingWeight , wald , zEvent , POSystem
structure PopulationTwoSLSScore reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Centered finite instrument score used to define an interface-only population 2SLS estimand for multivalued instruments.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
k :
Instrument score `S(z) ∈ ℝ^k`.
score :
𝒵 → Fin k → ℝ
Population first-stage projection coefficient.
gammaD :
Fin k → ℝ
Centering of each score coordinate.
centered :
∀ r : Fin k, ∫ ω, score (S.factualZ ω) r ∂P.μ = 0
Nonzero one-endogenous-regressor denominator.
denom_nonzero :
∫ ω, (∑ r : Fin k, gammaD r * score (S.factualZ ω) r) * OrderedTreatment.intensityValue (S.factualD ω) ∂P.μ
≠ 0
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.PopulationTwoSLSScore · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:918 · uses VariableIntensityIVSystem , POSystem
def fittedTreatment reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.PopulationTwoSLSScore

Given a population 2SLS score, the first-stage fitted treatment assigns each unit the linear projection of its factual treatment intensity onto that score.

Definition (Lean source)
k :
shared
P :
shared
𝒵 :
Type u_1
shared
J :
shared
T :
S.PopulationTwoSLSScore k
shared
fittedTreatment T :
P.Ω → ℝ
fun ω => ∑ r : Fin k, T.gammaD r * T.score (S.factualZ ω) r
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.PopulationTwoSLSScore.fittedTreatment · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:936 · uses VariableIntensityIVSystem , PopulationTwoSLSScore , POSystem
def beta2SLS reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.PopulationTwoSLSScore

Given a population 2SLS score, the population 2SLS estimand is the ratio of the population mean fitted-treatment--outcome product to the population mean fitted-treatment--treatment product.

Definition (Lean source)
k :
shared
P :
shared
𝒵 :
Type u_1
shared
J :
shared
T :
S.PopulationTwoSLSScore k
shared
beta2SLS T :
(∫ ω, T.fittedTreatment ω * S.factualY ω ∂P.μ) / (∫ ω, T.fittedTreatment ω * OrderedTreatment.intensityValue (S.factualD ω) ∂P.μ)
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.PopulationTwoSLSScore.beta2SLS · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:943 · uses VariableIntensityIVSystem , PopulationTwoSLSScore , POSystem
structure TwoSLSContrastDecomposition reviewed
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem

Deferred interface for expanding a multivalued-instrument 2SLS estimand into finite directed contrasts. A later theorem can add sign-alignment assumptions to turn this signed decomposition into a convex ACR average.

Definition (Lean source)
P :
shared
𝒵 :
Type u_1
shared
J :
shared
S :
shared
k :
T :
S.PopulationTwoSLSScore k
Signed weight on an ordered instrument-cell contrast.
contrastWeight :
𝒵 × 𝒵 → ℝ
First-stage contribution attached to each ordered contrast.
pairFirstStage :
𝒵 × 𝒵 → ℝ
Reduced-form contribution attached to each ordered contrast.
pairReducedForm :
𝒵 × 𝒵 → ℝ
Reduced-form expansion into finite ordered contrasts, carried as a field of the decomposition interface.
reducedForm_decomp :
∫ ω, T.fittedTreatment ω * S.factualY ω ∂P.μ
= ∑ p : 𝒵 × 𝒵, contrastWeight p * pairReducedForm p
First-stage expansion into finite ordered contrasts, carried as a field of the decomposition interface.
firstStage_decomp :
∫ ω, T.fittedTreatment ω * OrderedTreatment.intensityValue (S.factualD ω) ∂P.μ
= ∑ p : 𝒵 × 𝒵, contrastWeight p * pairFirstStage p
Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.TwoSLSContrastDecomposition · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:955 · uses VariableIntensityIVSystem , PopulationTwoSLSScore , POSystem
23 supporting declarations (lemmas, instances)
  • measurable_DofZ lemma — The potential treatment under a fixed instrument value is measurable.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z :
    𝒵
    Measurable (S.DofZ z)
    Proof (Lean source)
    @[fun_prop] lemma measurable_DofZ (z : 𝒵) : Measurable (S.DofZ z) := S.dVar.measurable_cfUnder S.zVar z
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_DofZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:114
  • measurable_YofD lemma — The potential outcome under a fixed treatment value is measurable.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    d :
    Fin (J + 1)
    Measurable (S.YofD d)
    Proof (Lean source)
    @[fun_prop] lemma measurable_YofD (d : Fin (J + 1)) : Measurable (S.YofD d) := S.yVar.measurable_cfUnder S.dVar d
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_YofD · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:119
  • measurable_factualZ lemma — The factual instrument is measurable.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    Measurable S.factualZ
    Proof (Lean source)
    @[fun_prop] lemma measurable_factualZ : Measurable S.factualZ := S.zVar.measurable_factual
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_factualZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:124
  • measurable_factualD lemma — The factual treatment is measurable.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    Measurable S.factualD
    Proof (Lean source)
    @[fun_prop] lemma measurable_factualD : Measurable S.factualD := S.dVar.measurable_factual
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_factualD · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:128
  • measurable_factualY lemma — The factual outcome is measurable.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    Measurable S.factualY
    Proof (Lean source)
    @[fun_prop] lemma measurable_factualY : Measurable S.factualY := S.yVar.measurable_factual
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_factualY · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:132
  • measurableSet_zEvent lemma — The factual instrument cell is measurable.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z :
    𝒵
    MeasurableSet (S.zEvent z)
    Proof (Lean source)
    lemma measurableSet_zEvent (z : 𝒵) : MeasurableSet (S.zEvent z) := S.zVar.measurableSet_event z (MeasurableSet.singleton z)
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurableSet_zEvent · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:136
  • measurable_intensityValue lemma — Reading an ordered treatment level as a real intensity is a measurable map on the finite level set.
    J :
    shared
    Measurable (fun d : Fin (J + 1) => OrderedTreatment.intensityValue d)
    Proof (Lean source)
    @[fun_prop] lemma measurable_intensityValue : Measurable (fun d : Fin (J + 1) => OrderedTreatment.intensityValue d) := by exact (by fun_prop : Measurable fun n : ℕ => (n : ℝ)).comp (by fun_prop : Measurable fun d : Fin (J + 1) => d.val)
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_intensityValue · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:182
  • measurable_intensityValue_DofZ lemma — The real intensity of the potential treatment at a fixed instrument value is a measurable function of the unit.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z :
    𝒵
    Measurable (fun ω => OrderedTreatment.intensityValue (S.DofZ z ω))
    Proof (Lean source)
    @[fun_prop] lemma measurable_intensityValue_DofZ (z : 𝒵) : Measurable (fun ω => OrderedTreatment.intensityValue (S.DofZ z ω)) := (measurable_intensityValue (J := J)).comp (S.measurable_DofZ z)
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_intensityValue_DofZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:190
  • integrable_intensityValue_DofZ lemma — The real intensity of the potential treatment at a fixed instrument value is integrable, being a bounded measurable function under a finite measure.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z :
    𝒵
    Integrable (fun ω => OrderedTreatment.intensityValue (S.DofZ z ω)) P.μ
    Proof (Lean source)
    @[fun_prop] lemma integrable_intensityValue_DofZ (z : 𝒵) : Integrable (fun ω => OrderedTreatment.intensityValue (S.DofZ z ω)) P.μ := by have hbdd : ∀ ω, ‖OrderedTreatment.intensityValue (S.DofZ z ω)‖ ≤ (J : ℝ) := by intro ω change |((S.DofZ z ω).val : ℝ)| ≤ (J : ℝ) rw [abs_of_nonneg (by exact_mod_cast zero_le (S.DofZ z ω).val)] exact_mod_cast Nat.le_of_lt_succ (S.DofZ z ω).isLt exact (MeasureTheory.integrable_const (J : ℝ)).mono' (S.measurable_intensityValue_DofZ z).aestronglyMeasurable (Filter.Eventually.of_forall hbdd)
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.integrable_intensityValue_DofZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:197
  • YofDofZ_def lemma — The potential outcome under the treatment intensity that an instrument value induces sends a unit to that unit's potential outcome at the induced intensity.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z :
    𝒵
    S.YofDofZ z = fun ω => S.YofD (S.DofZ z ω) ω
    Proof (Lean source)
    @[causal_defs_simps] lemma YofDofZ_def (z : 𝒵) : S.YofDofZ z = fun ω => S.YofD (S.DofZ z ω) ω := rfl
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.YofDofZ_def · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:296
  • measurable_YofDofZ lemma — The potential outcome under the instrument-induced treatment level is a measurable function of the unit.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z :
    𝒵
    Measurable (S.YofDofZ z)
    Proof (Lean source)
    @[fun_prop] lemma measurable_YofDofZ (z : 𝒵) : Measurable (S.YofDofZ z) := by classical unfold YofDofZ have hsum : (fun ω => S.YofD (S.DofZ z ω) ω) = fun ω => ∑ d : Fin (J + 1), ({d} : Set (Fin (J + 1))).indicator (fun _ => S.YofD d ω) (S.DofZ z ω) := by funext ω rw [Finset.sum_eq_single (S.DofZ z ω)] · simp · intro d _ hd simp [hd] · intro h simp at h rw [hsum] refine measurable_sum _ ?_ intro d _ exact (S.measurable_YofD d).indicator ((MeasurableSet.singleton d).preimage (S.measurable_DofZ z))
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.measurable_YofDofZ · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:303
  • integrable_marginResponse lemma — Integrability of a margin response, derived from H7.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    j :
    Fin J
    Integrable (S.marginResponse j) P.μ
    Proof (Lean source)
    lemma integrable_marginResponse {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (j : Fin J) : Integrable (S.marginResponse j) P.μ := by exact (hValid.hIntegrableY (OrderedTreatment.upperLevel j)).sub (hValid.hIntegrableY (OrderedTreatment.lowerLevel j))
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.integrable_marginResponse · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:380
  • DofZ_eq_factualD_on_zEvent lemma — On zEvent z, the counterfactual intensity D(z) equals the factual D.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    hC :
    P.Consistency
    z :
    𝒵
    ω :
    P.Ω
    :
    ω ∈ S.zEvent z
    S.DofZ z ω = S.factualD ω
    Proof (Lean source)
    lemma DofZ_eq_factualD_on_zEvent (hC : P.Consistency) (z : 𝒵) {ω : P.Ω} (hω : ω ∈ S.zEvent z) : S.DofZ z ω = S.factualD ω := POVar.cf_eq_factual_on_event hC S.dVar S.zVar z S.hZD.symm hω
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.DofZ_eq_factualD_on_zEvent · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:414
  • factualY_eq_YofD_factualD lemma — Factual Y equals the counterfactual Y(factualD ω).
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    hC :
    P.Consistency
    ω :
    P.Ω
    S.factualY ω = S.YofD (S.factualD ω) ω
    Proof (Lean source)
    lemma factualY_eq_YofD_factualD (hC : P.Consistency) (ω : P.Ω) : S.factualY ω = S.YofD (S.factualD ω) ω := POVar.factual_eq_cfUnder_self_selected hC S.yVar S.dVar S.hDY.symm ω
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.factualY_eq_YofD_factualD · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:420
  • condExpDZ_left_eq_integral lemma — First-stage bridge (left cell z0): the observed first-stage conditional mean equals the unconditional expectation of the potential intensity D(z0).
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    hCell0 :
    0 < (P.μ (S.zEvent z0)).toReal
    S.condExpDZ z0 = ∫ ω, OrderedTreatment.intensityValue (S.DofZ z0 ω) ∂P.μ
    Proof (Lean source)
    lemma condExpDZ_left_eq_integral {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (hCell0 : 0 < (P.μ (S.zEvent z0)).toReal) : S.condExpDZ z0 = ∫ ω, OrderedTreatment.intensityValue (S.DofZ z0 ω) ∂P.μ := by have hμne_zero : P.μ (S.zVar.event z0) ≠ 0 := fun h => absurd hCell0 (by simp [show S.zEvent z0 = S.zVar.event z0 from rfl, h]) have hμne_top : P.μ (S.zVar.event z0) ≠ ⊤ := measure_ne_top _ _ let idx0 : Fin (S.cfContrastBundle z0 z1).n := ⟨0, by simp [cfContrastBundle, outcomeBundle, POCFBundle.cons]⟩ let hproj : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) → ℝ := fun f => OrderedTreatment.intensityValue (f idx0) have hh_meas : Measurable hproj := by change Measurable fun f : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) => OrderedTreatment.intensityValue (f idx0) exact (measurable_intensityValue (J := J)).comp (measurable_pi_apply idx0) have h_cons : ∀ ω ∈ S.zVar.event z0, OrderedTreatment.intensityValue (S.factualD ω) = hproj ((S.cfContrastBundle z0 z1).jointValue ω) := by intro ω hω rw [← S.DofZ_eq_factualD_on_zEvent hValid.consistency z0 hω] change OrderedTreatment.intensityValue (S.DofZ z0 ω) = OrderedTreatment.intensityValue ((S.cfContrastBundle z0 z1).jointValue ω idx0) rfl have hbridge : S.condExpDZ z0 = eventCondExp P.μ (S.zVar.event z0) (fun ω => OrderedTreatment.intensityValue (S.factualD ω)) := rfl rw [hbridge, POSystem.eventCondExp_of_consistency_IndepCF hValid.hIndependence (a := S.zVar) hh_meas (MeasurableSet.singleton z0) (ae_restrict_of_forall_mem (S.measurableSet_zEvent z0) h_cons) hμne_zero hμne_top] refine MeasureTheory.integral_congr_ae (Filter.Eventually.of_forall ?_) intro ω change OrderedTreatment.intensityValue ((S.cfContrastBundle z0 z1).jointValue ω idx0) = OrderedTreatment.intensityValue (S.DofZ z0 ω) rfl
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.condExpDZ_left_eq_integral · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:425
  • condExpDZ_right_eq_integral lemma — First-stage bridge (right cell z1).
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    hCell1 :
    0 < (P.μ (S.zEvent z1)).toReal
    S.condExpDZ z1 = ∫ ω, OrderedTreatment.intensityValue (S.DofZ z1 ω) ∂P.μ
    Proof (Lean source)
    lemma condExpDZ_right_eq_integral {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (hCell1 : 0 < (P.μ (S.zEvent z1)).toReal) : S.condExpDZ z1 = ∫ ω, OrderedTreatment.intensityValue (S.DofZ z1 ω) ∂P.μ := by have hμne_zero : P.μ (S.zVar.event z1) ≠ 0 := fun h => absurd hCell1 (by simp [show S.zEvent z1 = S.zVar.event z1 from rfl, h]) have hμne_top : P.μ (S.zVar.event z1) ≠ ⊤ := measure_ne_top _ _ let idx1 : Fin (S.cfContrastBundle z0 z1).n := ⟨1, by simp [cfContrastBundle, outcomeBundle, POCFBundle.cons]⟩ let hproj : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) → ℝ := fun f => OrderedTreatment.intensityValue (f idx1) have hh_meas : Measurable hproj := by change Measurable fun f : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) => OrderedTreatment.intensityValue (f idx1) exact (measurable_intensityValue (J := J)).comp (measurable_pi_apply idx1) have h_cons : ∀ ω ∈ S.zVar.event z1, OrderedTreatment.intensityValue (S.factualD ω) = hproj ((S.cfContrastBundle z0 z1).jointValue ω) := by intro ω hω rw [← S.DofZ_eq_factualD_on_zEvent hValid.consistency z1 hω] change OrderedTreatment.intensityValue (S.DofZ z1 ω) = OrderedTreatment.intensityValue ((S.cfContrastBundle z0 z1).jointValue ω idx1) rfl have hbridge : S.condExpDZ z1 = eventCondExp P.μ (S.zVar.event z1) (fun ω => OrderedTreatment.intensityValue (S.factualD ω)) := rfl rw [hbridge, POSystem.eventCondExp_of_consistency_IndepCF hValid.hIndependence (a := S.zVar) hh_meas (MeasurableSet.singleton z1) (ae_restrict_of_forall_mem (S.measurableSet_zEvent z1) h_cons) hμne_zero hμne_top] refine MeasureTheory.integral_congr_ae (Filter.Eventually.of_forall ?_) intro ω change OrderedTreatment.intensityValue ((S.cfContrastBundle z0 z1).jointValue ω idx1) = OrderedTreatment.intensityValue (S.DofZ z1 ω) rfl
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.condExpDZ_right_eq_integral · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:468
  • condExpYZ_left_eq_integral lemma — Reduced-form bridge (left cell z0): the observed reduced-form conditional mean equals the unconditional expectation of Y(D(z0)).
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    hCell0 :
    0 < (P.μ (S.zEvent z0)).toReal
    S.condExpYZ z0 = ∫ ω, S.YofDofZ z0 ω ∂P.μ
    Proof (Lean source)
    lemma condExpYZ_left_eq_integral {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (hCell0 : 0 < (P.μ (S.zEvent z0)).toReal) : S.condExpYZ z0 = ∫ ω, S.YofDofZ z0 ω ∂P.μ := by classical have hμne_zero : P.μ (S.zVar.event z0) ≠ 0 := fun h => absurd hCell0 (by simp [show S.zEvent z0 = S.zVar.event z0 from rfl, h]) have hμne_top : P.μ (S.zVar.event z0) ≠ ⊤ := measure_ne_top _ _ let idx0 : Fin (S.cfContrastBundle z0 z1).n := ⟨0, by simp [cfContrastBundle, outcomeBundle, POCFBundle.cons]⟩ let idxY (i : Fin (J + 1)) : Fin (S.cfContrastBundle z0 z1).n := Fin.succ (Fin.succ i) let hproj : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) → ℝ := fun f => ∑ i : Fin (J + 1), if f idx0 = i then f (idxY i) else 0 have hh_meas : Measurable hproj := by change Measurable fun f : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) => ∑ i : Fin (J + 1), if f idx0 = i then f (idxY i) else 0 refine measurable_sum _ ?_ intro i _hi refine Measurable.ite ?_ (measurable_pi_apply (idxY i)) measurable_const exact (MeasurableSet.singleton i).preimage (measurable_pi_apply idx0) have h_cons : ∀ ω ∈ S.zVar.event z0, S.factualY ω = hproj ((S.cfContrastBundle z0 z1).jointValue ω) := by intro ω hω rw [S.factualY_eq_YofD_factualD hValid.consistency ω, ← S.DofZ_eq_factualD_on_zEvent hValid.consistency z0 hω] have hJV0 : (S.cfContrastBundle z0 z1).jointValue ω idx0 = S.DofZ z0 ω := rfl have hJVY : ∀ i : Fin (J + 1), (S.cfContrastBundle z0 z1).jointValue ω (idxY i) = S.YofD i ω := by intro i rfl change S.YofD (S.DofZ z0 ω) ω = ∑ i : Fin (J + 1), if (S.cfContrastBundle z0 z1).jointValue ω idx0 = i then (S.cfContrastBundle z0 z1).jointValue ω (idxY i) else 0 rw [hJV0] rw [Finset.sum_eq_single (S.DofZ z0 ω)] · exact (hJVY _).symm.trans (if_pos rfl).symm · intro i _hi hi by_cases hEq : S.DofZ z0 ω = i · exact elim (hi hEq.symm) · exact if_neg hEq · intro h simp at h have hbridge : S.condExpYZ z0 = eventCondExp P.μ (S.zVar.event z0) S.factualY := rfl rw [hbridge, POSystem.eventCondExp_of_consistency_IndepCF hValid.hIndependence (a := S.zVar) hh_meas (MeasurableSet.singleton z0) (ae_restrict_of_forall_mem (S.measurableSet_zEvent z0) h_cons) hμne_zero hμne_top] refine MeasureTheory.integral_congr_ae (Filter.Eventually.of_forall ?_) intro ω have hJV0 : (S.cfContrastBundle z0 z1).jointValue ω idx0 = S.DofZ z0 ω := rfl have hJVY : ∀ i : Fin (J + 1), (S.cfContrastBundle z0 z1).jointValue ω (idxY i) = S.YofD i ω := by intro i rfl change (∑ i : Fin (J + 1), if (S.cfContrastBundle z0 z1).jointValue ω idx0 = i then (S.cfContrastBundle z0 z1).jointValue ω (idxY i) else 0) = S.YofDofZ z0 ω unfold YofDofZ rw [hJV0] rw [Finset.sum_eq_single (S.DofZ z0 ω)] · exact (if_pos rfl).trans (hJVY _) · intro i _hi hi by_cases hEq : S.DofZ z0 ω = i · exact elim (hi hEq.symm) · exact if_neg hEq · intro h simp at h
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.condExpYZ_left_eq_integral · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:512
  • condExpYZ_right_eq_integral lemma — Reduced-form bridge (right cell z1).
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    hCell1 :
    0 < (P.μ (S.zEvent z1)).toReal
    S.condExpYZ z1 = ∫ ω, S.YofDofZ z1 ω ∂P.μ
    Proof (Lean source)
    lemma condExpYZ_right_eq_integral {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (hCell1 : 0 < (P.μ (S.zEvent z1)).toReal) : S.condExpYZ z1 = ∫ ω, S.YofDofZ z1 ω ∂P.μ := by classical have hμne_zero : P.μ (S.zVar.event z1) ≠ 0 := fun h => absurd hCell1 (by simp [show S.zEvent z1 = S.zVar.event z1 from rfl, h]) have hμne_top : P.μ (S.zVar.event z1) ≠ ⊤ := measure_ne_top _ _ let idx1 : Fin (S.cfContrastBundle z0 z1).n := ⟨1, by simp [cfContrastBundle, outcomeBundle, POCFBundle.cons]⟩ let idxY (i : Fin (J + 1)) : Fin (S.cfContrastBundle z0 z1).n := Fin.succ (Fin.succ i) let hproj : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) → ℝ := fun f => ∑ i : Fin (J + 1), if f idx1 = i then f (idxY i) else 0 have hh_meas : Measurable hproj := by change Measurable fun f : (∀ i : Fin (S.cfContrastBundle z0 z1).n, (S.cfContrastBundle z0 z1).type i) => ∑ i : Fin (J + 1), if f idx1 = i then f (idxY i) else 0 refine measurable_sum _ ?_ intro i _hi refine Measurable.ite ?_ (measurable_pi_apply (idxY i)) measurable_const exact (MeasurableSet.singleton i).preimage (measurable_pi_apply idx1) have h_cons : ∀ ω ∈ S.zVar.event z1, S.factualY ω = hproj ((S.cfContrastBundle z0 z1).jointValue ω) := by intro ω hω rw [S.factualY_eq_YofD_factualD hValid.consistency ω, ← S.DofZ_eq_factualD_on_zEvent hValid.consistency z1 hω] have hJV1 : (S.cfContrastBundle z0 z1).jointValue ω idx1 = S.DofZ z1 ω := rfl have hJVY : ∀ i : Fin (J + 1), (S.cfContrastBundle z0 z1).jointValue ω (idxY i) = S.YofD i ω := by intro i rfl change S.YofD (S.DofZ z1 ω) ω = ∑ i : Fin (J + 1), if (S.cfContrastBundle z0 z1).jointValue ω idx1 = i then (S.cfContrastBundle z0 z1).jointValue ω (idxY i) else 0 rw [hJV1] rw [Finset.sum_eq_single (S.DofZ z1 ω)] · exact (hJVY _).symm.trans (if_pos rfl).symm · intro i _hi hi by_cases hEq : S.DofZ z1 ω = i · exact elim (hi hEq.symm) · exact if_neg hEq · intro h simp at h have hbridge : S.condExpYZ z1 = eventCondExp P.μ (S.zVar.event z1) S.factualY := rfl rw [hbridge, POSystem.eventCondExp_of_consistency_IndepCF hValid.hIndependence (a := S.zVar) hh_meas (MeasurableSet.singleton z1) (ae_restrict_of_forall_mem (S.measurableSet_zEvent z1) h_cons) hμne_zero hμne_top] refine MeasureTheory.integral_congr_ae (Filter.Eventually.of_forall ?_) intro ω have hJV1 : (S.cfContrastBundle z0 z1).jointValue ω idx1 = S.DofZ z1 ω := rfl have hJVY : ∀ i : Fin (J + 1), (S.cfContrastBundle z0 z1).jointValue ω (idxY i) = S.YofD i ω := by intro i rfl change (∑ i : Fin (J + 1), if (S.cfContrastBundle z0 z1).jointValue ω idx1 = i then (S.cfContrastBundle z0 z1).jointValue ω (idxY i) else 0) = S.YofDofZ z1 ω unfold YofDofZ rw [hJV1] rw [Finset.sum_eq_single (S.DofZ z1 ω)] · exact (if_pos rfl).trans (hJVY _) · intro i _hi hi by_cases hEq : S.DofZ z1 ω = i · exact elim (hi hEq.symm) · exact if_neg hEq · intro h simp at h
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.condExpYZ_right_eq_integral · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:591
  • firstStage_eq_sum_crossingProb theorem — First-stage denominator equals the sum of crossing probabilities.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    S.firstStageContrast z0 z1 = ∑ j : Fin J, S.crossingProb z0 z1 j
    Proof (Lean source)
    theorem firstStage_eq_sum_crossingProb {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) : S.firstStageContrast z0 z1 = ∑ j : Fin J, S.crossingProb z0 z1 j := by unfold firstStageContrast crossingProb have hpoint : (fun ω => OrderedTreatment.intensityValue (S.DofZ z1 ω) - OrderedTreatment.intensityValue (S.DofZ z0 ω)) =ᵐ[P.μ] fun ω => ∑ j : Fin J, OrderedTreatment.crossingIndicator (S.DofZ z0 ω) (S.DofZ z1 ω) j := hValid.hMonotone.mono fun _ hmono => OrderedTreatment.ordered_telescope_identity hmono calc ∫ ω, (OrderedTreatment.intensityValue (S.DofZ z1 ω) - OrderedTreatment.intensityValue (S.DofZ z0 ω)) ∂P.μ = ∫ ω, ∑ j : Fin J, OrderedTreatment.crossingIndicator (S.DofZ z0 ω) (S.DofZ z1 ω) j ∂P.μ := by exact MeasureTheory.integral_congr_ae hpoint _ = ∑ j : Fin J, ∫ ω, OrderedTreatment.crossingIndicator (S.DofZ z0 ω) (S.DofZ z1 ω) j ∂P.μ := by rw [MeasureTheory.integral_finset_sum] intro i _hi rw [S.crossingIndicator_fun_eq_indicator z0 z1 i] exact (MeasureTheory.integrable_const (μ := P.μ) (1 : ℝ)).indicator (S.measurableSet_crossingEvent z0 z1 i) _ = ∑ j : Fin J, (P.μ (S.crossingEvent z0 z1 j)).toReal := by refine Finset.sum_congr rfl ?_ intro j _hj rw [S.crossingIndicator_fun_eq_indicator z0 z1 j] exact MeasureTheory.integral_indicator_one (S.measurableSet_crossingEvent z0 z1 j)
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.firstStage_eq_sum_crossingProb · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:669
  • crossingWeight_nonneg lemma — Crossing weights are nonnegative for a valid directed contrast.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    j :
    Fin J
    0 ≤ S.crossingWeight z0 z1 j
    Proof (Lean source)
    lemma crossingWeight_nonneg {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) (j : Fin J) : 0 ≤ S.crossingWeight z0 z1 j := by have hProb : ∀ i : Fin J, 0 ≤ S.crossingProb z0 z1 i := by intro i exact ENNReal.toReal_nonneg have hSum : 0 < ∑ i : Fin J, S.crossingProb z0 z1 i := by rw [← S.firstStage_eq_sum_crossingProb hValid] exact hValid.hRelevance exact OrderedTreatment.normalizedWeight_nonneg (S.crossingProb z0 z1) hProb hSum j
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.crossingWeight_nonneg · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:701
  • sum_crossingWeight_eq_one lemma — Crossing weights sum to one for a valid directed contrast.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hValid :
    S.ValidContrastAssumptions z0 z1
    ∑ j : Fin J, S.crossingWeight z0 z1 j = 1
    Proof (Lean source)
    lemma sum_crossingWeight_eq_one {z0 z1 : 𝒵} (hValid : S.ValidContrastAssumptions z0 z1) : ∑ j : Fin J, S.crossingWeight z0 z1 j = 1 := by have hSum : 0 < ∑ i : Fin J, S.crossingProb z0 z1 i := by rw [← S.firstStage_eq_sum_crossingProb hValid] exact hValid.hRelevance exact OrderedTreatment.sum_normalizedWeight_eq_one (S.crossingProb z0 z1) hSum
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.sum_crossingWeight_eq_one · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:713
  • crossingEvent_eq_complianceEvent lemma — Under J = 1, the unique crossing event coincides with the complier event {D(z1) = Fin.last J ∧ D(z0) = 0}, i.e. the unit jump from level 0 to the maximum level. When J = 1, Fin.last 1 = 1 : Fin 2, so this recovers exactly the binary-treatment LATE complier event {D(z1) = 1 ∧ D(z0) = 0} of Imbens-Angrist (1994): β_Wald(z0,z1) = E[Y(1) − Y(0) | D(z1) = Fin.last J ∧ D(z0) = 0].
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    hJ :
    J = 1
    S.crossingEvent z0 z1 (binaryMargin hJ)
    = {ω | S.DofZ z1 ω = last J ∧ S.DofZ z0 ω = (0 : Fin (J + 1))}
    Proof (Lean source)
    lemma crossingEvent_eq_complianceEvent (z0 z1 : 𝒵) (hJ : J = 1) : S.crossingEvent z0 z1 (binaryMargin hJ) = {ω | S.DofZ z1 ω = last J ∧ S.DofZ z0 ω = (0 : Fin (J + 1))} := by subst hJ ext ω simp only [binaryMargin, crossingEvent, OrderedTreatment.Crossing, OrderedTreatment.upperLevel, Set.mem_setOf_eq, last] have hone : (Fin.succ (0 : Fin 1)) = (⟨1, by omega⟩ : Fin 2) := by decide rw [hone] have hone_val : (⟨1, by omega⟩ : Fin 2).val = 1 := rfl constructor · rintro ⟨h1, h2⟩ refine ⟨le_antisymm (Fin.le_last _) h1, Fin.ext ?_⟩ have hv2 : (S.DofZ z0 ω).val < (⟨1, by omega⟩ : Fin 2).val := Fin.val_fin_lt.mpr h2 rw [hone_val] at hv2 have hge : 0 ≤ (S.DofZ z0 ω).val := zero_le _ simp only [Fin.val_zero] omega · rintro ⟨h1, h2⟩ refine ⟨h1 ▸ le_refl _, Fin.val_fin_lt.mp ?_⟩ rw [hone_val] have hv2 : (S.DofZ z0 ω).val = (0 : Fin 2).val := congr_arg val h2 simp only [Fin.val_zero] at hv2 omega
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.SpecialCases.crossingEvent_eq_complianceEvent · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:842
  • wald_eq_constantResponse theorem — Constant marginal response specialization.
    P :
    shared
    𝒵 :
    Type u_1
    shared
    J :
    shared
    S :
    shared
    z0 z1 :
    𝒵
    τ :
    hValid :
    S.ValidContrastAssumptions z0 z1
    hCell0 :
    0 < (P.μ (S.zEvent z0)).toReal
    hCell1 :
    0 < (P.μ (S.zEvent z1)).toReal
    hConstantResponse :
    ∀ j : Fin J, S.marginResponse j =ᵐ[P.μ] fun _ => τ
    S.wald z0 z1 = τ
    Proof (Lean source)
    theorem wald_eq_constantResponse {z0 z1 : 𝒵} {τ : ℝ} (hValid : S.ValidContrastAssumptions z0 z1) (hCell0 : 0 < (P.μ (S.zEvent z0)).toReal) (hCell1 : 0 < (P.μ (S.zEvent z1)).toReal) (hConstantResponse : ∀ j : Fin J, S.marginResponse j =ᵐ[P.μ] fun _ => τ) : S.wald z0 z1 = τ := by rw [S.wald_eq_averageCausalResponse hValid hCell0 hCell1] rw [← S.indicatorWeightedACR_eq_averageCausalResponse] unfold indicatorWeightedACR unnormalizedACRContrast totalCrossingProb indicatorWeightedEffect crossingProb have hterm : ∀ j : Fin J, (∫ ω in S.crossingEvent z0 z1 j, S.marginResponse j ω ∂P.μ) = τ * (P.μ (S.crossingEvent z0 z1 j)).toReal := by intro j rw [MeasureTheory.setIntegral_congr_ae (S.measurableSet_crossingEvent z0 z1 j) ((hConstantResponse j).mono fun _ hx _ => hx)] rw [MeasureTheory.setIntegral_const, MeasureTheory.Measure.real_def] exact smul_eq_mul _ _ |>.trans (mul_comm _ _) rw [Finset.sum_congr rfl (fun j _ => hterm j), ← Finset.mul_sum] have hpos : 0 < ∑ j : Fin J, (P.μ (S.crossingEvent z0 z1 j)).toReal := by simpa [crossingProb] using (by rw [← S.firstStage_eq_sum_crossingProb hValid] exact hValid.hRelevance : 0 < ∑ j : Fin J, S.crossingProb z0 z1 j) field_simp [ne_of_gt hpos]
    Causalean.PO.ID.Exact.VariableIntensityIV.VariableIntensityIVSystem.SpecialCases.wald_eq_constantResponse · Causalean/PO/ID/Exact/VariableIntensityIV/VariableIntensity.lean:874