Panel.PO
Potential-outcome semantics for panels: cell-level systems, exposure mappings, treatment-history responses, and panel consistency.
CellPO 8 core · 0 supporting This file provides the potential-outcomes foundation for a finite panel: weighted observed unit-period cells, a random treatment path, cell-specific exposures and baseline exposures, potential outcomes, and factual outco ★ DSigmaAlg_le
Cell-level panel potential outcomes
This file provides the potential-outcomes foundation for a finite panel: weighted observed unit-period cells, a random treatment path, cell-specific exposures and baseline exposures, potential outcomes, and factual outcomes. It also defines realized exposure and outcome, the σ-algebra generated by the treatment path, and the conditional baseline and exposure-response functions used by the panel-regression layer.
A panel potential-outcomes system pairs finite unit and time index sets with a finite collection of observed unit-period cells carrying positive normalized weights, a treatment-path-valued random variable D that is measurable in every unit-period coordinate, a cell-specific exposure mapping e together with a baseline exposure e0, a family of potential outcomes Y at each cell and exposure that is measurable and integrable, and a family of factual observed outcomes Yobs stored independently of the potential-outcome schedule that is likewise measurable and integrable.
Definition (Lean source)
For a panel potential-outcomes system, an observed unit-period cell, and a sample point, the realized exposure is the cell's exposure mapping applied to the treatment path realized at that sample point.
Definition (Lean source)
For a panel potential-outcomes system, an observed unit-period cell, and a sample point, the factual observed outcome is the outcome stored for that cell and sample point.
Definition (Lean source)
For a panel potential-outcomes system, the treatment-path σ-algebra is the smallest σ-algebra on the sample space that makes the treatment assigned to every unit in every period measurable.
Definition (Lean source)
The σ-algebra generated by the treatment path D, σ(D), is a sub-σ-algebra of the ambient σ-algebra on the outcome space Ω.
Formal statement
Proof (Lean source)
For a panel potential-outcomes system and an observed unit-period cell, the baseline conditional mean, evaluated at each sample point, is the conditional expectation of that cell's potential outcome under its baseline exposure given the treatment-path σ-algebra.
Definition (Lean source)
For a panel potential-outcomes system, an observed unit-period cell, and an exposure available at that cell, the cell-level exposure response, evaluated at each sample point, is the conditional expectation given the treatment-path σ-algebra of the potential outcome under that exposure minus the potential outcome under the cell's baseline exposure.
Definition (Lean source)
For a panel potential-outcomes system, an observed unit-period cell, and a sample point, the realized exposure response is that cell's exposure response at the exposure induced by the treatment path realized at the sample point.
Definition (Lean source)
Consistency 3 core · 0 supporting This file states the panel consistency property for a PanelPOSystem. ★ panelConsistency_holds
Panel Consistency
This file states the panel consistency property for a PanelPOSystem. The
predicate PanelPOSystem.observedY_eq_potentialOutcome is the pointwise
observed-cell equality, while PanelConsistency requires it for every observed
cell and sample point. The lemma panelConsistency_holds exposes the equality
directly from the assumption.
For a panel potential-outcomes system, an observed unit-period cell, and a sample point, pointwise consistency is the assertion that the factual observed outcome equals the potential outcome at that cell under the exposure realized at that sample point.
Definition (Lean source)
For a panel potential-outcomes system, the panel consistency condition requires that, for every observed unit-period cell and every sample point, the factual observed outcome equals the potential outcome at that cell under the exposure realized at that sample point.
Definition (Lean source)
If panel consistency holds for the panel potential-outcome system P, then the factual observed outcome equals the potential outcome evaluated at the realized exposure, for every observed unit-period cell and every sample point.
Formal statement
Proof (Lean source)
Exposure 2 core · 0 supporting This file defines Exposure, a cell-specific map from a realized TreatmentPath to a cell-dependent exposure type, and BaselineExposure, a distinguished baseline exposure for each cell.
Exposure Mappings
This file defines Exposure, a cell-specific map from a realized
TreatmentPath to a cell-dependent exposure type, and BaselineExposure, a
distinguished baseline exposure for each cell. These objects are the
potential-outcome interface between treatment histories and cell-level
responses.
For a set of units, a set of periods, a treatment-value set, and a cell-specific exposure set, an exposure mapping assigns to every unit-period cell and every realized treatment path an exposure in that cell's exposure set.
Definition (Lean source)
For a set of units, a set of periods, and a cell-specific exposure set, a baseline exposure assigns a distinguished exposure to every unit-period cell.
Definition (Lean source)
Mobius 3 core · 3 supporting This file proves the inclusion-exclusion expansion of a binary finite-memory treatment-history response. ★ mobius_expansion
Boolean-Cube Mobius Expansion
This file proves the inclusion-exclusion expansion of a binary finite-memory
treatment-history response. The definition indicator builds Boolean histories
from subsets of lags, delta gives the interaction coefficient for a subset,
and mobius_expansion recovers any response normalized to zero at the all-zero
history as a sum of nonempty lag interactions.
For a coordinate label space whose elements can be compared for equality and a finite subset of coordinate labels, the subset-indicator treatment history assigns treatment status one to labels in the subset and zero to all other labels.
For a coordinate label space whose elements can be compared for equality, a real-valued response defined for every binary treatment history, and a finite subset of coordinate labels, the subset interaction coefficient is the alternating sum of the response evaluated at every sub-subset's indicator history, with sign determined by the difference in subset sizes.
Any binary finite-memory response τ normalized to zero at the all-zero history can be recovered as the sum of its nonempty inclusion-exclusion interaction coefficients, with each interaction contributing only when every one of its lags is active in the history.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
indicator_emptylemma — The indicator history of the empty subset is the all-zero treatment history. -
prod_indicator_eqlemma — Indicator product: ∏ k ∈ S, ((h k).val : ℝ) equals 1 if S ⊆ B and 0 otherwise, where B = {k : h k = 1}.hypothesesconclusionprod S (fun k => ((h k).val : ℝ)) = if S ⊆ B then 1 else 0Proof (Lean source)
lemma prod_indicator_eq (h : ι → Fin 2) (B : Finset ι) (hB : ∀ k, k ∈ B ↔ h k = 1) (S : Finset ι) : prod S (fun k => ((h k).val : ℝ)) = if S ⊆ B then 1 else 0 := by classical by_cases hSB : S ⊆ B · rw [if_pos hSB] apply Finset.prod_eq_one intro k hk have hk1 : h k = 1 := (hB k).mp (hSB hk) rw [hk1]; simp · rw [if_neg hSB] rw [Finset.not_subset] at hSB obtain ⟨k, hkS, hkB⟩ := hSB apply Finset.prod_eq_zero hkS have h0 : h k ≠ 1 := fun hh => hkB ((hB k).mpr hh) have h2 : h k = 0 := by apply Fin.ext have hval_ne : (h k).val ≠ 1 := by intro hv apply h0 apply Fin.ext simpa using hv omega rw [h2]; simp -
coeff_sumlemma — Coefficient sum: for A ⊆ B, ∑ S, A ⊆ S ⊆ B, (-1)^(|S|-|A|) = if A = B then 1 else 0.hypothesesconclusion(∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card)) = if A = B then 1 else 0Proof (Lean source)
lemma coeff_sum (A B : Finset ι) (hAB : A ⊆ B) : (∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card)) = if A = B then 1 else 0 := by classical set C := B \ A with hCdef have hAdisj : Disjoint A C := Finset.disjoint_sdiff -- Reindex S = A ∪ T with T ⊆ C. have hreindex : (∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card)) = ∑ T ∈ C.powerset, (-1 : ℝ) ^ T.card := by refine Finset.sum_nbij' (fun S => S \ A) (fun T => A ∪ T) ?_ ?_ ?_ ?_ ?_ · intro S hS simp only [mem_filter, Finset.mem_powerset] at hS obtain ⟨hSB, _⟩ := hS exact (Finset.mem_powerset.mpr <| by intro x hx simp only [hCdef, mem_sdiff] at hx ⊢ exact ⟨hSB hx.1, hx.2⟩) · intro T hT simp only [Finset.mem_powerset] at hT simp only [mem_filter, Finset.mem_powerset] have hTC : T ⊆ C := hT have hTB : T ⊆ B := hTC.trans sdiff_subset exact ⟨Finset.union_subset hAB hTB, Finset.subset_union_left⟩ · intro S hS simp only [mem_filter, Finset.mem_powerset] at hS obtain ⟨_, hAS⟩ := hS ext x simp only [mem_union, mem_sdiff] constructor · rintro (hxA | ⟨hxS, _⟩) · exact hAS hxA · exact hxS · intro hxS by_cases hxA : x ∈ A · exact inl hxA · exact inr ⟨hxS, hxA⟩ · intro T hT simp only [Finset.mem_powerset] at hT have hTC : T ⊆ C := hT have hTA : Disjoint A T := Finset.disjoint_of_subset_right hTC hAdisj ext x simp only [mem_sdiff, mem_union] constructor · rintro ⟨hxA | hxT, hxnA⟩ · exact (hxnA hxA).elim · exact hxT · intro hxT refine ⟨Or.inr hxT, ?_⟩ intro hxA exact (Finset.disjoint_left.mp hTA hxA) hxT · intro S hS simp only [mem_filter, Finset.mem_powerset] at hS obtain ⟨_, hAS⟩ := hS rw [Finset.card_sdiff_of_subset hAS] rw [hreindex] by_cases hAB' : A = B · subst hAB' have hC0 : C = ∅ := by simp [hCdef] simp [hC0] · have hCne : C ≠ ∅ := by intro hC0 apply hAB' refine le_antisymm hAB ?_ intro x hxB by_contra hxA have hxC : x ∈ C := by simp [hCdef, hxB, hxA] rw [hC0] at hxC exact Finset.notMem_empty _ hxC have hCne' : C.Nonempty := Finset.nonempty_iff_ne_empty.mpr hCne have hint : (∑ T ∈ C.powerset, (-1 : ℤ) ^ T.card) = 0 := Finset.sum_powerset_neg_one_pow_card_of_nonempty (x := C) hCne' have hreal : (∑ T ∈ C.powerset, (-1 : ℝ) ^ T.card) = 0 := by exact_mod_cast hint simpa [hAB'] using hreal
PopulationCells 5 core · 10 supporting This file provides the shared finite-cell population substrate on which the panel estimand-characterization population bridges are built: a finite measurable partition of a probability space into positive-mass cells, tog ★ mean_consistency
Population cell partition
This file provides the shared finite-cell population substrate on which the panel estimand-characterization population bridges are built: a finite measurable partition of a probability space into positive-mass cells, together with cell masses, cell-conditional means, and their basic identities.
A finite measurable partition of a probability space (Ω, μ) into positive-mass cells indexed by a finite type ι: an assignment of a cell to each index such that every cell is measurable, distinct cells are pairwise disjoint, the cells cover the whole space, and every cell has strictly positive probability mass.
Definition (Lean source)
For a measurable sample space, a finite index set, a measure, a classifier assigning each sample point an index, measurable classifier level sets, and strictly positive real mass for every level set, the classifier-induced cell partition assigns each index its classifier level set.
Definition (Lean source)
For a measurable sample space, a measure, a finite index set, a cell partition, and one of its indices, the cell mass is the real-valued measure of that index's cell.
Definition (Lean source)
For a measurable sample space, a measure, a finite index set, a cell partition, a real-valued variable on the sample space, and one of the partition's indices, the cell-conditional mean is that variable's integral over the indexed cell divided by the cell's real-valued mass.
Definition (Lean source)
Cell-mean consistency descent. On a cell where the treatment value d is binary, d ∈ {0,1}, and pointwise potential-outcome consistency Y = Y0 + d·(Y1 − Y0) holds throughout the cell, the cell-conditional means satisfy the same identity: E[Y ∣ cell] = E[Y0 ∣ cell] + d·(E[Y1 ∣ cell] − E[Y0 ∣ cell]).
Formal statement
Proof (Lean source)
10 supporting declarations (lemmas, instances)
-
cellPartitionOfClassifier_celltheoremhypothesesΩ :sharedType u_1ι :Type*Fintype ιμ :Measure Ωg :Ω → ιhmeas :∀ i, MeasurableSet (g ⁻¹' {i})hpos :∀ i, 0 < (μ (g ⁻¹' {i})).toReali :ιconclusion(cellPartitionOfClassifier μ g hmeas hpos).cell i = g ⁻¹' {i}Proof (Lean source)
@[simp] theorem cellPartitionOfClassifier_cell {ι : Type*} [Fintype ι] (μ : Measure Ω) (g : Ω → ι) (hmeas : ∀ i, MeasurableSet (g ⁻¹' {i})) (hpos : ∀ i, 0 < (μ (g ⁻¹' {i})).toReal) (i : ι) : (cellPartitionOfClassifier μ g hmeas hpos).cell i = g ⁻¹' {i} := rfl -
mass_postheorem — Every cell has strictly positive mass.hypothesesconclusion0 < P.mass iProof (Lean source)
theorem mass_pos (P : CellPartition μ ι) (i : ι) : 0 < P.mass i := P.cell_pos i -
mass_ne_zerotheorem — Every cell has nonzero mass.hypothesesconclusionP.mass i ≠ 0Proof (Lean source)
theorem mass_ne_zero (P : CellPartition μ ι) (i : ι) : P.mass i ≠ 0 := (P.mass_pos i).ne' -
mass_sum_onetheorem — Masses sum to one. The cell probabilities of a partition of a probability space add to 1.hypothesesconclusion∑ i, P.mass i = 1Proof (Lean source)
theorem mass_sum_one (P : CellPartition μ ι) [IsProbabilityMeasure μ] : ∑ i, P.mass i = 1 := by have hsum : ∑ i, μ (P.cell i) = 1 := by have h := measure_iUnion (μ := μ) P.cell_disj P.cell_meas rw [P.cell_cov, measure_univ, tsum_fintype] at h exact h.symm calc ∑ i, P.mass i = (∑ i, μ (P.cell i)).toReal := (ENNReal.toReal_sum (fun i _ => measure_ne_top μ (P.cell i))).symm _ = (1 : ENNReal).toReal := by rw [hsum] _ = 1 := ENNReal.toReal_one -
integral_eq_sum_mass_mul_meantheorem — Finite-partition total law. The integral of f is the mass-weighted sum of its cell means: ∫ f = ∑ i, π_i · E[f ∣ cell i].hypothesesconclusion∫ ω, f ω ∂μ = ∑ i, P.mass i * P.mean f iProof (Lean source)
theorem integral_eq_sum_mass_mul_mean (P : CellPartition μ ι) [IsFiniteMeasure μ] (f : Ω → ℝ) (hf : Integrable f μ) : ∫ ω, f ω ∂μ = ∑ i, P.mass i * P.mean f i := integral_eq_sum_measure_mul_eventCondExp μ P.cell P.cell_meas P.cell_disj P.cell_cov f hf -
mean_congr_ontheorem — Cell means agree when the integrands agree pointwise on the cell. This is the workhorse "consistency descent" step: on a cell where an observed quantity equals a potential-outcome slice, their cell means coincide.hypothesesconclusionP.mean f i = P.mean g iProof (Lean source)
theorem mean_congr_on (P : CellPartition μ ι) {f g : Ω → ℝ} (i : ι) (h : ∀ ω ∈ P.cell i, f ω = g ω) : P.mean f i = P.mean g i := eventCondExp_congr_on μ (P.cell_meas i) h -
mean_congr_aetheorem — Cell means agree for a.e.-equal integrands.hypothesesconclusionP.mean f i = P.mean g iProof (Lean source)
theorem mean_congr_ae (P : CellPartition μ ι) {f g : Ω → ℝ} (i : ι) (h : f =ᵐ[μ] g) : P.mean f i = P.mean g i := eventCondExp_congr_ae μ (P.cell i) (ae_restrict_of_ae h) -
mean_subtheorem — Cell means are additive over subtraction of integrable integrands.hypothesesι :sharedType u_2P :CellPartition μ ιf g :Ω → ℝi :ιhf :IntegrableOn f (P.cell i) μhg :IntegrableOn g (P.cell i) μconclusionP.mean (f - g) i = P.mean f i - P.mean g iProof (Lean source)
theorem mean_sub (P : CellPartition μ ι) {f g : Ω → ℝ} (i : ι) (hf : IntegrableOn f (P.cell i) μ) (hg : IntegrableOn g (P.cell i) μ) : P.mean (f - g) i = P.mean f i - P.mean g i := eventCondExp_sub μ (P.cell i) hf hg -
mean_addtheorem — Cell means are additive over sums of integrable integrands.hypothesesι :sharedType u_2P :CellPartition μ ιf g :Ω → ℝi :ιhf :IntegrableOn f (P.cell i) μhg :IntegrableOn g (P.cell i) μconclusionP.mean (f + g) i = P.mean f i + P.mean g iProof (Lean source)
theorem mean_add (P : CellPartition μ ι) {f g : Ω → ℝ} (i : ι) (hf : IntegrableOn f (P.cell i) μ) (hg : IntegrableOn g (P.cell i) μ) : P.mean (f + g) i = P.mean f i + P.mean g i := eventCondExp_add μ (P.cell i) hf hg -
mean_smultheorem — Cell means are homogeneous under real scalar multiplication.hypothesesconclusionP.mean (fun ω => c * f ω) i = c * P.mean f iProof (Lean source)
theorem mean_smul (P : CellPartition μ ι) (c : ℝ) (f : Ω → ℝ) (i : ι) : P.mean (fun ω => c * f ω) i = c * P.mean f i := eventCondExp_smul μ (P.cell i) c f
TreatmentPath 5 core · 2 supporting This file defines TreatmentPath, the assignment of an action to each unit-time pair, and the finite-memory history constructors used by the panel potential-outcomes layer. ★ History_zero
Treatment Paths and Finite-Memory Histories
This file defines TreatmentPath, the assignment of an action to each
unit-time pair, and the finite-memory history constructors used by the panel
potential-outcomes layer. History uses an explicit boundary treatment for
lags before the observed panel starts, HistoryDefault uses the typeclass
default boundary value, and BinaryHistory specializes to binary treatment
with zero as the boundary value.
Given a set of units, a set of time periods, and a set of treatment actions, a treatment path assigns one treatment action to every unit-period pair.
Definition (Lean source)
Finite-memory history of length p+1 ending at time t, with the boundary convention "out-of-range = baseline" for an explicit baseline treatment value a0 : A. Lag k : Fin (p+1) returns D i ⟨t - k, _⟩ when k ≤ t.val, and a0 otherwise. Periods are indexed 0, …, T₀ - 1. In the binary case (A := Fin 2, baseline 0) this is H_{it}^{(p)} = (D_{it}, D_{i,t-1}, …, D_{i,t-p}) with the convention that treatment before the first period is 0; in one-based notation s = t.val + 1, this is D_{is} = 0 for s ∉ {1, …, T₀}.
Definition (Lean source)
Compatibility wrapper for code that deliberately wants the typeclass-provided default value as the finite-history boundary treatment.
Binary finite-memory history with the conventional zero baseline.
Lag 0 of the finite-memory treatment history equals the unit's contemporaneous treatment value.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
HistoryDefault_zerolemma — Lag 0 of the default-boundary history is the contemporaneous treatment.hypothesesI :sharedType u_1A :sharedType u_2T₀ :sharedℕp :ℕD :TreatmentPath I (Fin T₀) Ai :It :Fin T₀conclusionHistoryDefault p D i t 0 = D i tProof (Lean source)
@[simp] lemma HistoryDefault_zero [Inhabited A] (p : ℕ) (D : TreatmentPath I (Fin T₀) A) (i : I) (t : Fin T₀) : HistoryDefault p D i t 0 = D i t := by simp [HistoryDefault] -
BinaryHistory_zerolemma — Lag 0 of the binary zero-baseline history is the contemporaneous treatment.hypothesesconclusionBinaryHistory p D i t 0 = D i tProof (Lean source)
@[simp] lemma BinaryHistory_zero (p : ℕ) (D : TreatmentPath I (Fin T₀) (Fin 2)) (i : I) (t : Fin T₀) : BinaryHistory p D i t 0 = D i t := by simp [BinaryHistory]