PO.ID.Exact.VariableIntensityIV
Variable-intensity instrumental variables: Angrist-Imbens average causal response over ordered treatment margins.
OrderedTreatment 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.
Treatment intensity level j, the lower endpoint of margin j → j+1.
Definition (Lean source)
Treatment intensity level j+1, the upper endpoint of margin j → j+1.
Definition (Lean source)
Numeric value of an ordered treatment level.
Definition (Lean source)
The margin increment f(j+1) - f(j) for j : Fin J.
Definition (Lean source)
A movement from a to b crosses margin j → j+1.
Definition (Lean source)
Real-valued indicator of Crossing a b j.
Definition (Lean source)
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
Proof (Lean source)
Generic normalized finite weight a_i / Σ_k a_k.
Definition (Lean source)
3 supporting declarations (lemmas, instances)
-
ordered_telescope_indicatorlemma — Ordered telescoping across crossed margins for an arbitrary real-valued function on finite ordered levels.hypothesesconclusionProof (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] -
normalizedWeight_nonneglemma — Nonnegativity of normalized weights from nonnegative raw weights and a positive normalizing sum.hypothesesconclusion0 ≤ normalizedWeight a iProof (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 -
sum_normalizedWeight_eq_onelemma — Normalized finite weights sum to one when the normalizing sum is positive.hypothesesconclusion∑ i, normalizedWeight a i = 1Proof (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'
VariableIntensity 41 core · 18 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.
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)
Instrument packaged as a POVar valued in 𝒵.
Definition (Lean source)
Treatment intensity packaged as a POVar valued in Fin (J+1).
Outcome packaged as a POVar valued in ℝ.
Definition (Lean source)
Potential treatment intensity D(z): the intensity that would be observed if the instrument were fixed to z. A genuine single-intervention counterfactual.
Definition (Lean source)
Treatment-indexed potential outcome Y(d): the outcome that would be observed if the treatment intensity were fixed to d. No instrument argument enters, so exclusion is structural.
Definition (Lean source)
Factual instrument Z.
Definition (Lean source)
Factual treatment intensity D.
Definition (Lean source)
Factual outcome Y.
Definition (Lean source)
Factual instrument cell {Z = z}.
Definition (Lean source)
Regimed variable for D(z) (treatment intensity under instrument set to z).
Definition (Lean source)
Regimed variable for Y(d) (outcome under treatment intensity set to d).
Definition (Lean source)
Homogeneous bundle of the J+1 treatment-indexed potential outcomes Y(0),…,Y(J).
Definition (Lean source)
Counterfactual bundle (D(z0), D(z1), Y(0),…,Y(J)) for the contrast (z0, z1). Index 0 is D(z0), index 1 is D(z1), index d+2 is Y(d).
Definition (Lean source)
Unit causal response on margin j → j+1: Δ_jY = Y(j+1) - Y(j).
Definition (Lean source)
Crossing event C_j(z0,z1) = {D(z1) ≥ j+1 > D(z0)}.
Definition (Lean source)
Crossing probability for a directed instrument contrast and margin.
Definition (Lean source)
Total crossing probability, equivalently the first-stage denominator under directed monotonicity.
Definition (Lean source)
Normalized Angrist-Imbens margin-crossing weight.
Definition (Lean source)
Indicator-weighted margin effect E[Δ_jY · 1_{C_j}], represented as a set integral over the crossing event.
Definition (Lean source)
Unnormalized sum of indicator-weighted crossing effects.
Definition (Lean source)
Indicator-weighted ACR ratio, avoiding partial conditional means in the core algebra.
Definition (Lean source)
The conditional margin response is the average unit-level causal response among units whose potential treatment crosses a selected treatment margin when the instrument changes along a selected ordered contrast.
Definition (Lean source)
Angrist-Imbens average causal response: Σ_j ω_j E[Δ_jY | C_j].
Definition (Lean source)
Potential outcome Y(D(z)): the outcome if the instrument were set to z. Equals Y(d) at d = D(z)(ω). No direct instrument effect enters because YofD fixes only the treatment intensity d, not z (structural exclusion).
Definition (Lean source)
Potential first-stage contrast E[D(z1) − D(z0)] using potential treatment intensities.
Definition (Lean source)
Potential reduced-form contrast E[Y(D(z1)) − Y(D(z0))].
Definition (Lean source)
E[D | Z = z] — observed first-stage conditional mean at instrument value z, defined via eventCondExp over the cell {Z = z}.
Definition (Lean source)
E[Y | Z = z] — observed reduced-form conditional mean at instrument value z, defined via eventCondExp over the cell {Z = z}.
Definition (Lean source)
Directed Wald estimand for two instrument cells.
Definition (Lean source)
IV-validity assumptions for a fixed directed contrast (z0,z1).
Definition (Lean source)
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
Proof (Lean source)
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
Proof (Lean source)
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
Proof (Lean source)
Canonical single treatment margin transported from Fin 1 under J = 1.
Definition (Lean source)
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
Proof (Lean source)
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
Proof (Lean source)
Centered finite instrument score used to define an interface-only population 2SLS estimand for multivalued instruments.
Definition (Lean source)
First-stage fitted treatment D_S(ω) = γ_D^T S(Z(ω)); the linear projection of D onto the instrument score.
Definition (Lean source)
Population 2SLS estimand β_2SLS(S) = E[D_S Y] / E[D_S D]. This declaration is only the population ratio interface: the file does not derive the binary-instrument bridge beta2SLS T = wald z0 z1. Such a bridge would require centering algebra and the scalar FWL identity for a score of the form S(Z) = Z - E[Z].
Definition (Lean source)
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)
18 supporting declarations (lemmas, instances)
-
measurable_DofZlemma — The potential treatment under a fixed instrument value is measurable.Proof (Lean source)
lemma measurable_DofZ (z : 𝒵) : Measurable (S.DofZ z) := S.dVar.measurable_cfUnder S.zVar z -
measurable_YofDlemma — The potential outcome under a fixed treatment value is measurable.Proof (Lean source)
lemma measurable_YofD (d : Fin (J + 1)) : Measurable (S.YofD d) := S.yVar.measurable_cfUnder S.dVar d -
measurable_factualZlemma — The factual instrument is measurable.conclusionMeasurable S.factualZProof (Lean source)
lemma measurable_factualZ : Measurable S.factualZ := S.zVar.measurable_factual -
measurable_factualDlemma — The factual treatment is measurable.conclusionMeasurable S.factualDProof (Lean source)
lemma measurable_factualD : Measurable S.factualD := S.dVar.measurable_factual -
measurable_factualYlemma — The factual outcome is measurable.conclusionMeasurable S.factualYProof (Lean source)
lemma measurable_factualY : Measurable S.factualY := S.yVar.measurable_factual -
measurableSet_zEventlemma — The factual instrument cell is measurable.Proof (Lean source)
lemma measurableSet_zEvent (z : 𝒵) : MeasurableSet (S.zEvent z) := S.zVar.measurableSet_event z (MeasurableSet.singleton z) -
integrable_marginResponselemma — Integrability of a margin response, derived from H7.hypothesesconclusionIntegrable (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)) -
DofZ_eq_factualD_on_zEventlemma — On zEvent z, the counterfactual intensity D(z) equals the factual D.hypotheseshC :P.Consistencyz :𝒵ω :P.Ωhω :ω ∈ S.zEvent zconclusionS.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ω -
factualY_eq_YofD_factualDlemma — Factual Y equals the counterfactual Y(factualD ω).hypotheseshC :P.Consistencyω :P.ΩconclusionS.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 ω -
condExpDZ_left_eq_integrallemma — First-stage bridge (left cell z0): the observed first-stage conditional mean equals the unconditional expectation of the potential intensity D(z0).hypothesesz0 z1 :𝒵hValid :S.ValidContrastAssumptions z0 z1hCell0 :0 < (P.μ (S.zEvent z0)).toRealconclusionS.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 -
condExpDZ_right_eq_integrallemma — First-stage bridge (right cell z1).hypothesesz0 z1 :𝒵hValid :S.ValidContrastAssumptions z0 z1hCell1 :0 < (P.μ (S.zEvent z1)).toRealconclusionS.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 -
condExpYZ_left_eq_integrallemma — Reduced-form bridge (left cell z0): the observed reduced-form conditional mean equals the unconditional expectation of Y(D(z0)).hypothesesz0 z1 :𝒵hValid :S.ValidContrastAssumptions z0 z1hCell0 :0 < (P.μ (S.zEvent z0)).toRealconclusionS.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 -
condExpYZ_right_eq_integrallemma — Reduced-form bridge (right cell z1).hypothesesz0 z1 :𝒵hValid :S.ValidContrastAssumptions z0 z1hCell1 :0 < (P.μ (S.zEvent z1)).toRealconclusionS.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 -
firstStage_eq_sum_crossingProbtheorem — First-stage denominator equals the sum of crossing probabilities.hypothesesz0 z1 :𝒵hValid :S.ValidContrastAssumptions z0 z1conclusionS.firstStageContrast z0 z1 = ∑ j : Fin J, S.crossingProb z0 z1 jProof (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) -
crossingWeight_nonneglemma — Crossing weights are nonnegative for a valid directed contrast.hypothesesconclusion0 ≤ S.crossingWeight z0 z1 jProof (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 -
sum_crossingWeight_eq_onelemma — Crossing weights sum to one for a valid directed contrast.hypothesesz0 z1 :𝒵hValid :S.ValidContrastAssumptions z0 z1conclusion∑ j : Fin J, S.crossingWeight z0 z1 j = 1Proof (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 -
crossingEvent_eq_complianceEventlemma — 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].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 -
wald_eq_constantResponsetheorem — Constant marginal response specialization.hypothesesz0 z1 :𝒵τ :ℝhValid :S.ValidContrastAssumptions z0 z1hCell0 :0 < (P.μ (S.zEvent z0)).toRealhCell1 :0 < (P.μ (S.zEvent z1)).toRealhConstantResponse :∀ j : Fin J, S.marginResponse j =ᵐ[P.μ] fun _ => τconclusionS.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]