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 defines PanelPOSystem, the bundled finite-panel potential-outcomes system used by panel regression arguments. ★ DSigmaAlg_le
Cell-Level Potential Outcomes
This file defines PanelPOSystem, the bundled finite-panel
potential-outcomes system used by panel regression arguments. A system contains
observed weighted cells, a treatment-path random variable, cell-specific
exposure maps and baseline exposures, potential outcomes, and factual observed
outcomes.
The namespace also provides the realized exposure observedExposure, the
factual-outcome accessor observedY, the treatment-path sigma algebra
DSigmaAlg, the baseline conditional mean m0, the exposure response tau,
and the realized response realizedTau.
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)
The realized exposure at an observed cell r: E_r = e_r(D).
Definition (Lean source)
The factual observed outcome at an observed cell. It is stored independently from the potential-outcome schedule; the consistency assumption relates it to the potential outcome at the realized exposure.
Definition (Lean source)
The σ-algebra generated by the treatment path D. This is the "information of the assignment vector" — the σ-algebra in \bbE[· | D] of Definition 2.4.
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)
Baseline conditional mean m_r^0(D) := E[Y_r(e_r^0) | D].
Definition (Lean source)
Cell-level exposure response τ_r(e | D) := E[Y_r(e) − Y_r(e_r^0) | D].
Definition (Lean source)
The realized exposure response τ_r(E_r | D), obtained by evaluating tau at the exposure induced by the realized treatment path.
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.
Pointwise consistency at a given observed cell is the equality between the factual observed outcome and the potential outcome indexed by the realized exposure.
Definition (Lean source)
Panel consistency says that on every observed unit-period cell, the factual outcome equals the potential outcome evaluated at the realized exposure.
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.
An exposure mapping: a known function from realized treatment paths to a cell-dependent exposure set E r.
Definition (Lean source)
A baseline exposure: a distinguished element e_r^0 ∈ E r for every cell r. In the binary finite-memory case this is (0, …, 0).
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.
Indicator history 𝟙_A : ι → Fin 2, equal to 1 on A and 0 elsewhere.
The interaction effect at a subset S. The main lemma uses this only for non-empty S, but the definition is total.
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)
-
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.hypothesesA B :Finset ιhAB :A ⊆ Bconclusion(∑ 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)
Build a cell partition from a finite classifier g : Ω → ι: the cells are the level sets {ω | g ω = i}. Disjointness and covering are automatic; the caller supplies measurability and positive mass of each level set. This is the common way panel bridges obtain their partition (cohort map, treated/untreated classifier, cohort-period map, …).
Definition (Lean source)
Cell probability π_i = ℙ(cell i), as a real number.
Definition (Lean source)
Cell-conditional mean E[f ∣ cell i], i.e. the average of f over the cell computed as its integral over the cell divided by the cell's real 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ι :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.Proof (Lean source)
theorem mass_pos (P : CellPartition μ ι) (i : ι) : 0 < P.mass i := P.cell_pos i -
mass_ne_zerotheorem — Every cell has nonzero mass.Proof (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.Proof (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.Proof (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.hypothesesP :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.hypothesesP :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 2 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.
A treatment path: each unit i : I and time index t : T is assigned an action in A, representing the realized assignment D_{it}.
Definition (Lean source)
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.hypothesesconclusionHistoryDefault 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]