Panel.PO

Potential-outcome semantics for panels: cell-level systems, exposure mappings, treatment-history responses, and panel consistency.

Cell­PO 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.

structure PanelPOSystem reviewed
Causalean.Panel

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)
Unit index type.
I :
Type*
Time index type.
T :
Type*
fintypeI :
fintypeT :
decI :
decT :
Observed unit-period cells with positive normalized weights.
cells :
Cells I T
Action type for treatment assignments.
A :
Type*
Observed-cell-indexed exposure set `E_r`.
E :
(r : I × T) → r ∈ cells.observed → Type*
Each observed-cell exposure set carries a measurable structure.
measE :
∀ r hr, MeasurableSpace (E r hr)
Exposure mapping `e_r : (I → T → A) → E_r` for observed cells.
e :
∀ r hr
then
E r hr
Baseline exposure `e_r^0 ∈ E_r` for observed cells.
e0 :
∀ r hr, E r hr
Sample space.
Ω :
measA :
Probability measure.
Treatment path random variable `D : Ω → I → T → A`.
D :
Ω → TreatmentPath I T A
`D` is measurable as a map into the function space. Encoded cellwise: each `(D ·) i t : Ω → A` is measurable.
D_meas :
∀ i t, Measurable (fun ω => D ω i t)
Cell-level potential outcome family `Y r e : Ω → ℝ` on observed cells.
Y :
(r : I × T) → (hr : r ∈ cells.observed) → E r hr → Ω → ℝ
Each potential outcome is measurable.
Y_meas :
∀ r hr e, Measurable (Y r hr e)
Each potential outcome is integrable.
Y_integrable :
∀ r hr e, Integrable (Y r hr e) μ
Factual observed outcome family on observed cells.
Yobs :
(r : I × T) → r ∈ cells.observed → Ω → ℝ
Each factual observed outcome is measurable.
Yobs_meas :
∀ r hr, Measurable (Yobs r hr)
Each factual observed outcome is integrable.
Yobs_integrable :
∀ r hr, Integrable (Yobs r hr) μ
Causalean.Panel.PanelPOSystem · Causalean/Panel/PO/CellPO.lean:43
def observedExposure reviewed
Causalean.Panel.PanelPOSystem

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)
P :
shared
r :
P.I × P.T
hr :
r ∈ P.cells.observed
ω :
P.Ω
observedExposure P r hr ω :
P.E r hr
P.e r hr (P.D ω)
Causalean.Panel.PanelPOSystem.observedExposure · Causalean/Panel/PO/CellPO.lean:112 · uses PanelPOSystem
def observedY reviewed
Causalean.Panel.PanelPOSystem

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)
P :
shared
r :
P.I × P.T
hr :
r ∈ P.cells.observed
ω :
P.Ω
observedY P r hr ω :
P.Yobs r hr ω
Causalean.Panel.PanelPOSystem.observedY · Causalean/Panel/PO/CellPO.lean:119 · uses PanelPOSystem
def DSigmaAlg reviewed
Causalean.Panel.PanelPOSystem

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)
P :
shared
DSigmaAlg P :
⨆ (i : P.I) (t : P.T), comap (fun ω => P.D ω i t) inferInstance
Causalean.Panel.PanelPOSystem.DSigmaAlg · Causalean/Panel/PO/CellPO.lean:128 · uses PanelPOSystem
lemma DSigmaAlg_le reviewed
Causalean.Panel.PanelPOSystem

The σ-algebra generated by the treatment path D, σ(D), is a sub-σ-algebra of the ambient σ-algebra on the outcome space Ω.

Formal statement
P :
shared
P.DSigmaAlg ≤ (inferInstance : MeasurableSpace P.Ω)
Proof (Lean source)
lemma DSigmaAlg_le : P.DSigmaAlg ≤ (inferInstance : MeasurableSpace P.Ω) := by rw [DSigmaAlg] exact iSup_le (fun i => iSup_le (fun t => measurable_iff_comap_le.mp (P.D_meas i t)))
Causalean.Panel.PanelPOSystem.DSigmaAlg_le · Causalean/Panel/PO/CellPO.lean:137 · uses PanelPOSystem , DSigmaAlg
def m0 reviewed
Causalean.Panel.PanelPOSystem

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)
P :
shared
r :
P.I × P.T
hr :
r ∈ P.cells.observed
m0 P r hr :
P.Ω → ℝ
condExp P.DSigmaAlg P.μ (P.Y r hr (P.e0 r hr))
Causalean.Panel.PanelPOSystem.m0 · Causalean/Panel/PO/CellPO.lean:144 · uses PanelPOSystem
def tau reviewed
Causalean.Panel.PanelPOSystem

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)
P :
shared
r :
P.I × P.T
hr :
r ∈ P.cells.observed
e :
P.E r hr
tau P r hr e :
P.Ω → ℝ
condExp P.DSigmaAlg P.μ (fun ω => P.Y r hr e ω - P.Y r hr (P.e0 r hr) ω)
Causalean.Panel.PanelPOSystem.tau · Causalean/Panel/PO/CellPO.lean:151 · uses PanelPOSystem
def realizedTau reviewed
Causalean.Panel.PanelPOSystem

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)
P :
shared
r :
P.I × P.T
hr :
r ∈ P.cells.observed
ω :
P.Ω
realizedTau P r hr ω :
P.tau r hr (P.observedExposure r hr ω) ω
Causalean.Panel.PanelPOSystem.realizedTau · Causalean/Panel/PO/CellPO.lean:161 · uses PanelPOSystem
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.

def observedY_eq_potentialOutcome reviewed
Causalean.Panel.PanelPOSystem

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)
P :
shared
r :
P.I × P.T
hr :
r ∈ P.cells.observed
ω :
P.Ω
observedY_eq_potentialOutcome P r hr ω :
Prop
P.observedY r hr ω = P.Y r hr (P.observedExposure r hr ω) ω
Causalean.Panel.PanelPOSystem.observedY_eq_potentialOutcome · Causalean/Panel/PO/Consistency.lean:31 · uses PanelPOSystem
def PanelConsistency reviewed
Causalean.Panel

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)
r :
P.I × P.T
hr :
r ∈ P.cells.observed
ω :
P.Ω
PanelConsistency P :
Prop
P.observedY_eq_potentialOutcome r hr ω
Causalean.Panel.PanelConsistency · Causalean/Panel/PO/Consistency.lean:41 · uses PanelPOSystem
lemma panelConsistency_holds reviewed
Causalean.Panel

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
r :
P.I × P.T
hr :
r ∈ P.cells.observed
ω :
P.Ω
P.observedY r hr ω = P.Y r hr (P.observedExposure r hr ω) ω
Proof (Lean source)
lemma panelConsistency_holds (P : PanelPOSystem) (hP : PanelConsistency P) : ∀ (r : P.I × P.T) (hr : r ∈ P.cells.observed) (ω : P.Ω), P.observedY r hr ω = P.Y r hr (P.observedExposure r hr ω) ω := hP
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.

def Exposure reviewed
Causalean.Panel

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)
I T A :
Type*
E :
I × T → Type*
Exposure I T A E :
Type _
(r : I × T) → TreatmentPath I T A → E r
Causalean.Panel.Exposure · Causalean/Panel/PO/Exposure.lean:31
def BaselineExposure reviewed
Causalean.Panel

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)
I T :
Type*
E :
I × T → Type*
BaselineExposure E :
Type _
(r : I × T) → E r
Causalean.Panel.BaselineExposure · Causalean/Panel/PO/Exposure.lean:37
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.

def indicator reviewed
Causalean.Panel.PO.Mobius

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.

Definition (Lean source)
ι :
Type u_1
shared
A :
indicator A :
ι → Fin 2
fun k => if k ∈ A then 1 else 0
Causalean.Panel.PO.Mobius.indicator · Causalean/Panel/PO/Mobius.lean:48
def delta reviewed
Causalean.Panel.PO.Mobius

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.

Definition (Lean source)
ι :
Type u_1
shared
τ :
(ι → Fin 2) → ℝ
S :
delta τ S :
∑ A ∈ S.powerset, (-1 : ℝ) ^ (S.card - A.card) * τ (indicator A)
Causalean.Panel.PO.Mobius.delta · Causalean/Panel/PO/Mobius.lean:61
theorem mobius_expansion reviewed
Causalean.Panel.PO.Mobius

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
ι :
Type u_1
shared
τ :
(ι → Fin 2) → ℝ
hτ0 :
τ (fun _ => 0) = 0
h :
ι → Fin 2
τ h
= ∑ S ∈ (((Finset.univ : Finset ι).powerset.filter (·.Nonempty)) : Finset (Finset ι)), delta τ S * prod S (fun k => ((h k).val : ℝ))
Proof (Lean source)
theorem mobius_expansion [Fintype ι] (τ : (ι → Fin 2) → ℝ) (hτ0 : τ (fun _ => 0) = 0) (h : ι → Fin 2) : τ h = ∑ S ∈ (((Finset.univ : Finset ι).powerset.filter (·.Nonempty)) : Finset (Finset ι)), delta τ S * prod S (fun k => ((h k).val : ℝ)) := by classical let B : Finset ι := Finset.univ.filter (fun k => h k = 1) have hBmem : ∀ k, k ∈ B ↔ h k = 1 := by intro k simp [B, mem_filter] have hh_indB : h = indicator B := by funext k by_cases hk : k ∈ B · have hk' := (hBmem k).1 hk simp [indicator, hk, hk'] · have h0 : h k ≠ 1 := by intro hh exact hk ((hBmem k).2 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 simp [indicator, hk, h2] let u : Finset (Finset ι) := (Finset.univ : Finset ι).powerset.filter (·.Nonempty) let s : Finset (Finset ι) := B.powerset.filter (·.Nonempty) change τ h = ∑ S ∈ u, delta τ S * prod S (fun k => ((h k).val : ℝ)) have hstep1 : (∑ S ∈ u, delta τ S * prod S (fun k => ((h k).val : ℝ))) = ∑ S ∈ s, delta τ S := by have hmul : ∀ S ∈ u, delta τ S * prod S (fun k => ((h k).val : ℝ)) = if S ⊆ B then delta τ S else 0 := by intro S hS rw [prod_indicator_eq h B hBmem S] by_cases hSB : S ⊆ B <;> simp [hSB] rw [Finset.sum_congr rfl hmul] have hfilter : u.filter (fun S => S ⊆ B) = s := by ext S simp [u, s, and_comm] rw [← Finset.sum_filter] rw [hfilter] have hstep2 : (∑ S ∈ s, delta τ S) = ∑ A ∈ B.powerset, (∑ S ∈ s, if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) * τ (indicator A) := by rw [show s = B.powerset.filter (·.Nonempty) by rfl] calc (∑ S ∈ B.powerset.filter (·.Nonempty), delta τ S) = ∑ S ∈ B.powerset.filter (·.Nonempty), ∑ A ∈ B.powerset, if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) * τ (indicator A) else 0 := by refine Finset.sum_congr rfl ?_ intro S hS rw [delta] have hSsub : S ⊆ B := Finset.mem_powerset.mp (Finset.mem_filter.mp hS).1 have hcard : (∑ A ∈ S.powerset, (-1 : ℝ) ^ (S.card - A.card) * τ (indicator A)) = ∑ A ∈ B.powerset, if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) * τ (indicator A) else 0 := by rw [← Finset.sum_filter] have hPowEq : S.powerset = B.powerset.filter (fun A => A ⊆ S) := by ext A constructor · intro hAS exact Finset.mem_filter.mpr ⟨Finset.mem_powerset.mpr ((Finset.mem_powerset.mp hAS).trans hSsub), Finset.mem_powerset.mp hAS⟩ · intro hAS exact Finset.mem_powerset.mpr (Finset.mem_filter.mp hAS).2 simp [hPowEq] simp [hcard] _ = ∑ S ∈ B.powerset.filter (·.Nonempty), ∑ A ∈ B.powerset, (if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) * τ (indicator A) := by simp [ite_mul] _ = ∑ A ∈ B.powerset, ∑ S ∈ B.powerset.filter (·.Nonempty), (if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) * τ (indicator A) := by rw [Finset.sum_comm] _ = ∑ A ∈ B.powerset, (∑ S ∈ B.powerset.filter (·.Nonempty), if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) * τ (indicator A) := by simp [Finset.sum_mul] have hstep3 : (∑ A ∈ B.powerset, (∑ S ∈ s, if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) * τ (indicator A)) = τ (indicator B) := by have hterms : ∀ A ∈ B.powerset, (∑ S ∈ s, if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) * τ (indicator A) = if A = B then τ (indicator B) else 0 := by intro A hA by_cases hA0 : A = ∅ · subst hA0 by_cases hB0 : B = ∅ · rw [hB0] simp [hτ0] · have hne : (∅ : Finset ι) ≠ B := by intro h exact hB0 h.symm simp [hτ0, hne] · have hAne : A.Nonempty := Finset.nonempty_iff_ne_empty.mpr hA0 have hAS : A ⊆ B := Finset.mem_powerset.mp hA have hfilter : s.filter (fun S => A ⊆ S) = B.powerset.filter (A ⊆ ·) := by ext S constructor · intro hS rcases Finset.mem_filter.mp hS with ⟨hSs, hSA⟩ exact Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp hSs).1, hSA⟩ · intro hS rcases Finset.mem_filter.mp hS with ⟨hSsub, hSA⟩ exact Finset.mem_filter.mpr ⟨Finset.mem_filter.mpr ⟨hSsub, hAne.mono hSA⟩, hSA⟩ have hinner : (∑ S ∈ s, if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) = ∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card) := by rw [← Finset.sum_filter] have hEq : s.filter (fun S => A ⊆ S) = B.powerset.filter (A ⊆ ·) := hfilter simp [hEq] rw [hinner] have hcoeff := coeff_sum A B hAS by_cases hABeq : A = B · subst hABeq simp [hcoeff] · simp [hcoeff, hABeq] calc (∑ A ∈ B.powerset, (∑ S ∈ s, if A ⊆ S then (-1 : ℝ) ^ (S.card - A.card) else 0) * τ (indicator A)) = ∑ A ∈ B.powerset, if A = B then τ (indicator B) else 0 := by exact Finset.sum_congr rfl hterms _ = τ (indicator B) := by rw [Finset.sum_eq_single B] · simp · intro A hA hAB simp [hAB] · intro hB simp at hB rw [hstep1, hstep2, hstep3] simp [hh_indB]
Causalean.Panel.PO.Mobius.mobius_expansion · Causalean/Panel/PO/Mobius.lean:177 · uses delta
3 supporting declarations (lemmas, instances)
  • indicator_empty lemma — The indicator history of the empty subset is the all-zero treatment history.
    ι :
    Type u_1
    shared
    indicator (∅ : Finset ι) = fun _ => 0
    Proof (Lean source)
    @[simp] lemma indicator_empty : indicator (∅ : Finset ι) = fun _ => 0 := by funext k; simp [indicator]
    Causalean.Panel.PO.Mobius.indicator_empty · Causalean/Panel/PO/Mobius.lean:55
  • prod_indicator_eq lemma — Indicator product: ∏ k ∈ S, ((h k).val : ℝ) equals 1 if S ⊆ B and 0 otherwise, where B = {k : h k = 1}.
    ι :
    Type u_1
    shared
    h :
    ι → Fin 2
    B :
    hB :
    ∀ k, k ∈ B ↔ h k = 1
    S :
    prod S (fun k => ((h k).val : ℝ)) = if S ⊆ B then 1 else 0
    Proof (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
    Causalean.Panel.PO.Mobius.prod_indicator_eq · Causalean/Panel/PO/Mobius.lean:69
  • coeff_sum lemma — Coefficient sum: for A ⊆ B, ∑ S, A ⊆ S ⊆ B, (-1)^(|S|-|A|) = if A = B then 1 else 0.
    ι :
    Type u_1
    shared
    A B :
    hAB :
    A ⊆ B
    (∑ S ∈ B.powerset.filter (A ⊆ ·), (-1 : ℝ) ^ (S.card - A.card)) = if A = B then 1 else 0
    Proof (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
    Causalean.Panel.PO.Mobius.coeff_sum · Causalean/Panel/PO/Mobius.lean:97
Population­Cells 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.

structure CellPartition reviewed
Causalean.Panel.PO

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)
Ω :
Type u_1
shared
μ :
ι :
Type*
The cell assigned to index `i` (e.g. `{ω | G ω = i}`).
cell :
ι → Set Ω
Each cell is measurable.
cell_meas :
∀ i, MeasurableSet (cell i)
Distinct cells are disjoint.
cell_disj :
Pairwise (onFun Disjoint cell)
The cells cover the whole space.
cell_cov :
(⋃ i, cell i) = univ
Every cell has positive real mass.
cell_pos :
∀ i, 0 < (μ (cell i)).toReal
Causalean.Panel.PO.CellPartition · Causalean/Panel/PO/PopulationCells.lean:46
def cellPartitionOfClassifier reviewed
Causalean.Panel.PO

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)
Ω :
Type u_1
shared
ι :
Type*
μ :
g :
Ω → ι
hmeas :
∀ i, MeasurableSet (g ⁻¹' {i})
hpos :
∀ i, 0 < (μ (g ⁻¹' {i})).toReal
cellPartitionOfClassifier μ g hmeas hpos :
clause 1
cell i := g ⁻¹' {i}
clause 2
cell_meas := hmeas
clause 3
cell_disj := fun _a _b hab => Disjoint.preimage g (Set.disjoint_singleton.mpr hab)
clause 4
cell_cov := by ext ω; simp
clause 5
cell_pos := hpos
Causalean.Panel.PO.cellPartitionOfClassifier · Causalean/Panel/PO/PopulationCells.lean:63 · uses CellPartition
def mass reviewed
Causalean.Panel.PO.CellPartition

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)
Ω :
Type u_1
shared
ι :
Type u_2
shared
P :
i :
ι
mass P i :
(μ (P.cell i)).toReal
Causalean.Panel.PO.CellPartition.mass · Causalean/Panel/PO/PopulationCells.lean:91 · uses CellPartition
def mean reviewed
Causalean.Panel.PO.CellPartition

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)
Ω :
Type u_1
shared
ι :
Type u_2
shared
P :
f :
Ω → ℝ
i :
ι
mean P f i :
eventCondExp μ (P.cell i) f
Causalean.Panel.PO.CellPartition.mean · Causalean/Panel/PO/PopulationCells.lean:96 · uses CellPartition
theorem mean_consistency reviewed
Causalean.Panel.PO.CellPartition

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
Ω :
Type u_1
shared
ι :
Type u_2
shared
P :
i :
ι
Y Y0 Y1 :
Ω → ℝ
d :
hd :
d = 0 ∨ d = 1
hcons :
∀ ω ∈ P.cell i, Y ω = Y0 ω + d * (Y1 ω - Y0 ω)
P.mean Y i = P.mean Y0 i + d * (P.mean Y1 i - P.mean Y0 i)
Proof (Lean source)
theorem mean_consistency (P : CellPartition μ ι) (i : ι) (Y Y0 Y1 : Ω → ℝ) {d : ℝ} (hd : d = 0 ∨ d = 1) (hcons : ∀ ω ∈ P.cell i, Y ω = Y0 ω + d * (Y1 ω - Y0 ω)) : P.mean Y i = P.mean Y0 i + d * (P.mean Y1 i - P.mean Y0 i) := by rcases hd with h0 | h1 · subst h0 have hY : P.mean Y i = P.mean Y0 i := P.mean_congr_on i (fun ω hω => by rw [hcons ω hω]; ring) rw [hY]; ring · subst h1 have hY : P.mean Y i = P.mean Y1 i := P.mean_congr_on i (fun ω hω => by rw [hcons ω hω]; ring) rw [hY]; ring
Causalean.Panel.PO.CellPartition.mean_consistency · Causalean/Panel/PO/PopulationCells.lean:163 · uses CellPartition , mean
10 supporting declarations (lemmas, instances)
Treatment­Path 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.

def TreatmentPath reviewed
Causalean.Panel

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)
I T A :
Type*
TreatmentPath I T A :
Type _
I → T → A
Causalean.Panel.TreatmentPath · Causalean/Panel/PO/TreatmentPath.lean:22
def History reviewed
Causalean.Panel.TreatmentPath

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)
I :
Type u_1
shared
A :
Type u_2
shared
T₀ :
shared
a0 :
A
p :
D :
TreatmentPath I (Fin T₀) A
i :
I
t :
Fin T₀
History a0 p D i t :
Fin (p + 1) → A
fun k
=> if h : k.val ≤ t.val then D i ⟨t.val
- k.val, by have : t.val
- k.val ≤ t.val := Nat.sub_le _ _ exact lt_of_le_of_lt this t.isLt⟩ else a0
Causalean.Panel.TreatmentPath.History · Causalean/Panel/PO/TreatmentPath.lean:31 · uses TreatmentPath
def HistoryDefault reviewed
Causalean.Panel.TreatmentPath

Compatibility wrapper for code that deliberately wants the typeclass-provided default value as the finite-history boundary treatment.

Definition (Lean source)
I :
Type u_1
shared
A :
Type u_2
shared
T₀ :
shared
p :
D :
TreatmentPath I (Fin T₀) A
i :
I
t :
Fin T₀
HistoryDefault p D i t :
Fin (p + 1) → A
History (default : A) p D i t
Causalean.Panel.TreatmentPath.HistoryDefault · Causalean/Panel/PO/TreatmentPath.lean:49 · uses TreatmentPath
def BinaryHistory reviewed
Causalean.Panel.TreatmentPath

Binary finite-memory history with the conventional zero baseline.

Definition (Lean source)
I :
Type u_1
shared
T₀ :
shared
p :
D :
TreatmentPath I (Fin T₀) (Fin 2)
i :
I
t :
Fin T₀
BinaryHistory p D i t :
Fin (p + 1) → Fin 2
History 0 p D i t
Causalean.Panel.TreatmentPath.BinaryHistory · Causalean/Panel/PO/TreatmentPath.lean:56 · uses TreatmentPath
lemma History_zero reviewed
Causalean.Panel.TreatmentPath

Lag 0 of the finite-memory treatment history equals the unit's contemporaneous treatment value.

Formal statement
I :
Type u_1
shared
A :
Type u_2
shared
T₀ :
shared
a0 :
A
p :
D :
TreatmentPath I (Fin T₀) A
i :
I
t :
Fin T₀
History a0 p D i t 0 = D i t
Proof (Lean source)
@[simp] lemma History_zero (a0 : A) (p : ℕ) (D : TreatmentPath I (Fin T₀) A) (i : I) (t : Fin T₀) : History a0 p D i t 0 = D i t := by unfold History simp
Causalean.Panel.TreatmentPath.History_zero · Causalean/Panel/PO/TreatmentPath.lean:62 · uses TreatmentPath , History
2 supporting declarations (lemmas, instances)