Panel
Panel-data causal econometrics: adoption paths, cell-level potential outcomes, fixed effects, residualization and weighted-regression infrastructure, and estimand-characterization results for DiD, event-study, and TWFE designs.
Cells 2 core · 1 supporting This file provides the observed-cell substrate for panel regressions: a finite set of observed unit-period cells with strictly positive normalized weights. ★ balanced_weight
Observed Panel Cells
This file provides the observed-cell substrate for panel regressions: a finite set of observed unit-period cells with strictly positive normalized weights. It specializes the generic weighted-support infrastructure to panel cell indices and supplies the balanced-panel constructor. It mirrors Definition 2.1 of the projection note.
Relation to Causalean.Panel.CellBridge. Both files use the word cell,
but for different objects. Here a cell is a discrete index r = (i, t) ∈ I × T
carrying a positive normalized weight — a finite-weighted-support object with no
measure theory. In CellBridge a cell is a measurable level set
{ω | G ω = g} of an observable map on a probability space. The two share no
declarations and neither imports the other; the only common substrate is
Causalean.Panel.Weighted.IndicatorSpan.
Observed cells of a panel together with positive normalized weights.
Definition (Lean source)
For any unit-period cell r, the balanced panel design assigns it weight equal to one divided by the total number of unit-period cells.
Formal statement
Proof (Lean source)
WeightedTwoWayPanel 11 core · 9 supporting Paper-agnostic finite-sum infrastructure for two-way panels under a general unit weight p : Unit → ℝ (a pmf: ∑ p = 1, 0 < p i) with a uniform period measure. ★ ddot_orthogonal_unit_time★ ddot_eq_residualize
Weighted Finite Two-Way Panel Helpers
Paper-agnostic finite-sum infrastructure for two-way panels under a general
unit weight p : Unit → ℝ (a pmf: ∑ p = 1, 0 < p i) with a uniform period
measure. This is the share-weighted generalization of the uniform two-way panel
algebra used by the estimand-characterization modules:
- uniform balanced panels recover the old
UniformTwoWayPanelbyp ≡ 1/|Unit|; - Goodman-Bacon cohort-share panels take
p = cohort shares.
It provides the p-weighted unit/time/grand means, double demeaning (ddot), the
p-weighted inner product, the unit/time additive nuisance class, the
reconstruction identity, and the share-weighted orthogonality theorems
(ddot ⟂ unit / time / additive).
Bridge to the generic WeightedSupport FWL tower
The closed forms above are connected to the abstract Frisch–Waugh–Lovell
substrate in Causalean/Panel/Weighted/ by the Bridge section: the panel is the
cell support R = Unit × Time with weight ω_{(i,t)} = p_i / |Time|
(cellSupport), the p-weighted inner product is |Time| times
WeightedSupport.ip (inner_eq_card_smul_ip), and ddot is the generic residual
maker against the two-axis additive span (ddot_eq_residualize). The abstract
FWL coefficient lemma Weighted.WeightedSupport.scalar_fwl_of_normalEqs is thus
reusable through the bridge.
Unit weights. A weight function p assigning each unit a share that forms a probability vector: every unit's weight is strictly positive and the weights sum to one across units.
Definition (Lean source)
Unit mean \bar V_{i·} under the uniform period measure (weight-free in time).
p-weighted time mean \bar V_{·t} = ∑_i p_i V_{it}.
Definition (Lean source)
p-weighted grand mean \bar V = ∑_i p_i \bar V_{i·}.
Definition (Lean source)
Two-way residual / double-demeaned array under the p-weighted means.
Definition (Lean source)
p-weighted finite-panel inner product (uniform-time normalizer dropped as harmless).
Definition (Lean source)
Unit-time additive nuisance class h_it = a_i + b_t (shared predicate).
Definition (Lean source)
The unit/time component removed by double demeaning.
Definition (Lean source)
Double-demeaned arrays are orthogonal to every unit/time additive nuisance function. For a probability-weighted panel of units and periods, any array that decomposes as the sum of a unit-specific term and a time-specific term is orthogonal, under the p-weighted inner product, to the double-demeaned residual of any panel array V: their weighted inner product is zero.
Formal statement
Proof (Lean source)
The panel viewed as a cell-indexed weighted support on R = Unit × Time with the factorized weight ω_{(i,t)} = p_i / |Time| (every cell observed).
Definition (Lean source)
Concrete ↔ abstract bridge. For unit weights w and an outcome array V, the closed-form two-way double-demeaned residual ddot w V i t equals the generic weighted-support residual against the two-axis additive span, evaluated at cell (i, t). Every cell is observed, so the identity holds pointwise.
Formal statement
Proof (Lean source)
9 supporting declarations (lemmas, instances)
-
ddot_reconstructtheorem — Reconstruction identity V_it = ddot V_it + unitMean + timeMean - grandMean.hypothesesconclusionddot w V i t + unitMean V i + timeMean w V t - grandMean w V = V i tProof (Lean source)
theorem ddot_reconstruct (w : UnitWeights Unit) (V : Unit → Time → ℝ) (i : Unit) (t : Time) : ddot w V i t + unitMean V i + timeMean w V t - grandMean w V = V i t := by unfold ddot ring -
unitTimeProjection_additivetheorem — The removed component is itself unit/time additive.Proof (Lean source)
theorem unitTimeProjection_additive (w : UnitWeights Unit) (V : Unit → Time → ℝ) : IsUnitTimeAdditive (unitTimeProjection w V) := by refine ⟨unitMean V, fun t => timeMean w V t - grandMean w V, ?_⟩ intro i t unfold unitTimeProjection ring -
sub_ddot_eq_unitTimeProjectiontheorem — Pointwise residual decomposition V - ddot V into the unit/time projection.hypothesesconclusionV i t - ddot w V i t = unitTimeProjection w V i tProof (Lean source)
theorem sub_ddot_eq_unitTimeProjection (w : UnitWeights Unit) (V : Unit → Time → ℝ) (i : Unit) (t : Time) : V i t - ddot w V i t = unitTimeProjection w V i t := by unfold ddot unitTimeProjection ring -
ddot_orthogonal_unittheorem — Double-demeaned arrays are orthogonal (in the p-weighted inner product) to arbitrary unit-only functions.hypothesesconclusion∑ i, ∑ t, w.p i * (ddot w V i t * a i) = 0Proof (Lean source)
theorem ddot_orthogonal_unit (w : UnitWeights Unit) (V : Unit → Time → ℝ) (a : Unit → ℝ) : ∑ i, ∑ t, w.p i * (ddot w V i t * a i) = 0 := by classical cases isEmpty_or_nonempty Time with | inl h => letI : IsEmpty Time := h simp | inr h => letI : Nonempty Time := h exact ddot_orthogonal_unit_of_card_ne_zero w (by positivity) V a -
ddot_orthogonal_timetheorem — Double-demeaned arrays are orthogonal (in the p-weighted inner product) to arbitrary time-only functions: ∑_i ∑_t p_i · ddot V_{it} · b_t = 0. Per-period the p-weighted unit sum of ddot vanishes (∑ p = 1 cancels the time mean against the grand mean).hypothesesconclusion∑ i, ∑ t, w.p i * (ddot w V i t * b t) = 0Proof (Lean source)
theorem ddot_orthogonal_time (w : UnitWeights Unit) (V : Unit → Time → ℝ) (b : Time → ℝ) : ∑ i, ∑ t, w.p i * (ddot w V i t * b t) = 0 := by classical have hcol : ∀ t, ∑ i, w.p i * ddot w V i t = 0 := by intro t calc ∑ i, w.p i * ddot w V i t = ∑ i, (w.p i * V i t - w.p i * unitMean V i - w.p i * timeMean w V t + w.p i * grandMean w V) := by apply Finset.sum_congr rfl intro i _hi unfold ddot ring _ = ∑ i, w.p i * V i t - ∑ i, w.p i * unitMean V i - (∑ i, w.p i) * timeMean w V t + (∑ i, w.p i) * grandMean w V := by simp only [Finset.sum_sub_distrib, Finset.sum_add_distrib, Finset.sum_mul] _ = 0 := by rw [w.sum_one] unfold timeMean grandMean ring calc ∑ i, ∑ t, w.p i * (ddot w V i t * b t) = ∑ t, (∑ i, w.p i * ddot w V i t) * b t := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro t _ht calc ∑ i, w.p i * (ddot w V i t * b t) = ∑ i, (w.p i * ddot w V i t) * b t := by apply Finset.sum_congr rfl intro i _hi ring _ = (∑ i, w.p i * ddot w V i t) * b t := by rw [Finset.sum_mul] _ = 0 := by simp [hcol] -
cellSupport_weightlemma — The cell-support bridge assigns each unit-period cell its unit weight divided equally across periods.hypothesesw :r :Unit × Timeconclusion(cellSupport w).weight r = w.p r.1 / (Fintype.card Time : ℝ)Proof (Lean source)
@[simp] lemma cellSupport_weight (w : UnitWeights Unit) (r : Unit × Time) : (cellSupport w).weight r = w.p r.1 / (Fintype.card Time : ℝ) := rfl -
cellSupport_observedlemma — Every unit-period cell is observed in the cell-support bridge.hypothesesw :Proof (Lean source)
@[simp] lemma cellSupport_observed (w : UnitWeights Unit) : (cellSupport w).observed = (Finset.univ : Finset (Unit × Time)) := rfl -
mem_twoAxisAdditiveSpan_ifflemma — Membership in the two-axis additive span is exactly the panel's IsUnitTimeAdditive predicate after uncurrying.hypothesesh :Unit × Time → ℝconclusionh ∈ twoAxisAdditiveSpan Unit Time ↔ IsUnitTimeAdditive (fun i t => h (i, t))Proof (Lean source)
lemma mem_twoAxisAdditiveSpan_iff {h : Unit × Time → ℝ} : h ∈ twoAxisAdditiveSpan Unit Time ↔ IsUnitTimeAdditive (fun i t => h (i, t)) := by unfold twoAxisAdditiveSpan IsUnitTimeAdditive rw [AdditiveSpan.mem_iff] constructor · rintro ⟨a, b, hab⟩ exact ⟨a, b, fun i t => hab (i, t)⟩ · rintro ⟨a, b, hab⟩ refine ⟨a, b, ?_⟩ intro r simpa using hab r.1 r.2 -
inner_eq_card_smul_iptheorem — The p-weighted panel inner product is |Time| times the generic weighted-support inner product on the cell support.hypothesesw :V W :Unit → Time → ℝProof (Lean source)
theorem inner_eq_card_smul_ip (w : UnitWeights Unit) (V W : Unit → Time → ℝ) : inner w V W = (Fintype.card Time : ℝ) * (cellSupport w).ip (fun r => V r.1 r.2) (fun r => W r.1 r.2) := by have hT : (Fintype.card Time : ℝ) ≠ 0 := by have h := Fintype.card_pos (α := Time) exact_mod_cast h.ne' simp only [inner, WeightedSupport.ip_def, cellSupport_observed, cellSupport_weight] rw [Fintype.sum_prod_type, Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro i _ rw [Finset.mul_sum] refine Finset.sum_congr rfl ?_ intro t _ field_simp
AdoptionPath 9 core · 9 supporting This file provides finite-period adoption-path predicates for staggered-treatment designs, including eventual treatment, never treatment, and whether adoption has occurred by a period. ★ absorbingTreatment_eq
Adoption Path Helpers
This file provides finite-period adoption-path predicates for staggered-treatment designs, including eventual treatment, never treatment, and whether adoption has occurred by a period. The never-treated path is represented as an infinite adoption date, so absorbing treatment remains zero in every finite period for such units.
These paper-agnostic helpers are shared by staggered-adoption modules: Sun-Abraham path helpers wrap these declarations, and Goodman-Bacon uses the same raw infinite-date encoding for proof stability.
A finite adoption path, embedded in WithTop (Fin T).
Adoption-date predicate A ≤ t, i.e. adoption has occurred by period t.
Adoption-date predicate t < A, i.e. the path is untreated at period t.
The path is finite, i.e. eventually treated.
The path is infinite, i.e. never treated.
Definition (Lean source)
A path is never treated when its adoption date is infinite.
Definition (Lean source)
h < ∞, the path is eventually treated.
Absorbing treatment path 1{h < ∞ and h ≤ t}. Since ⊤ ≤ t is false, the never-treated path is untreated in every finite period.
For an adoption date h and period t within a horizon of T periods, the absorbing treatment indicator equals one exactly when adoption has occurred by that period, and zero otherwise.
Formal statement
9 supporting declarations (lemmas, instances)
-
finite_eqtheorem — Embedding a finite adoption period into the shared adoption-path type is definitionally the ordinary finite-period inclusion. -
le_eqtheorem — The treated-by-period predicate is exactly the order comparison with the finite period viewed as an adoption date. -
lt_eqtheorem — The untreated-before-adoption predicate is exactly the strict order comparison with the finite period viewed as an adoption date. -
isInfinite_eqtheorem — A path is never treated exactly when its adoption date is infinite.Proof (Lean source)
-
isNeverTreated_eqtheorem — The Sun-Abraham-compatible never-treated name is the infinite adoption-date predicate.Proof (Lean source)
-
isEventuallyTreated_eqtheorem — The Sun-Abraham-compatible eventually-treated name is the finite adoption-date predicate.Proof (Lean source)
@[simp] theorem isEventuallyTreated_eq {T : ℕ} (h : WithTop (Fin T)) : isEventuallyTreated h = (h ≠ ⊤) := rfl -
lt_of_isInfinitetheorem — Never-treated paths are untreated in every finite period.Proof (Lean source)
theorem lt_of_isInfinite {T : ℕ} {a : WithTop (Fin T)} {t : Fin T} (ha : isInfinite a) : lt a t := AdoptionDate.lt_of_isInf ha
CellBridge 10 core · 6 supporting Provides measure-theoretic finite-cell bridge infrastructure for panel estimand characterizations. ★ integral_mul_twoAxisIndicatorSpan_eq_zero_of_axes
Provides measure-theoretic finite-cell bridge infrastructure for panel estimand characterizations. It defines cell indicators, indicator spans, cell masses, and finite-partition integral lemmas for observable cell maps.
Finite-weighted-support cell indicator from Causalean.Panel.Weighted.IndicatorSpan.
Definition (Lean source)
Finite-weighted one-axis indicator span from Causalean.Panel.Weighted.IndicatorSpan.
Definition (Lean source)
Finite-weighted two-axis indicator span from Causalean.Panel.Weighted.IndicatorSpan.
Definition (Lean source)
Real-valued singleton indicator for the cell {X = i}.
Definition (Lean source)
One-axis finite indicator span generated by a measurable cell map G.
Definition (Lean source)
Two-axis finite indicator span generated by measurable maps G and T.
Definition (Lean source)
Cell mass (μ {G = g}).toReal.
Definition (Lean source)
Joint cell mass (μ {G = g ∧ T = t}).toReal.
Definition (Lean source)
Cell mean of a real-valued function on a finite cell. Zero-mass cells use Lean's totalized division convention.
Definition (Lean source)
If a square-integrable residual V is orthogonal in expectation to the indicator of every level g of one axis G and orthogonal in expectation to the indicator of every level t of the other axis T, then it is orthogonal in expectation to every finite linear combination of those axis indicators, with coefficients cG and cT.
Formal statement
Proof (Lean source)
6 supporting declarations (lemmas, instances)
-
indicator_cell_memLptheorem — Cell indicators are in L² under a finite measure.hypothesesΩ 𝒢 :μ :G :Ω → 𝒢G_meas :g :𝒢Proof (Lean source)
theorem indicator_cell_memLp {Ω 𝒢 : Type*} [MeasurableSpace Ω] [MeasurableSpace 𝒢] [MeasurableSingletonClass 𝒢] (μ : Measure Ω) [IsFiniteMeasure μ] (G : Ω → 𝒢) (G_meas : Measurable G) (g : 𝒢) : MemLp (fun ω => indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) 2 μ := by let s : Set Ω := G ⁻¹' ({g} : Set 𝒢) have hMeas : MeasurableSet s := G_meas (measurableSet_singleton g) change MemLp (fun ω => indicator s (fun _ => (1 : ℝ)) ω) 2 μ exact (memLp_const (μ := μ) (1 : ℝ)).indicator hMeas -
integral_cell_indicator_one_eq_cellMasstheorem — Cell indicators integrate to their real cell mass.hypothesesconclusion∫ ω, indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ = cellMass μ G gProof (Lean source)
theorem integral_cell_indicator_one_eq_cellMass {Ω 𝒢 : Type*} [MeasurableSpace Ω] [MeasurableSpace 𝒢] [MeasurableSingletonClass 𝒢] (μ : Measure Ω) (G : Ω → 𝒢) (G_meas : Measurable G) (g : 𝒢) : ∫ ω, indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ = cellMass μ G g := by let s : Set Ω := {ω | G ω = g} have hs_meas : MeasurableSet s := G_meas (measurableSet_singleton g) change (∫ ω, indicator s (1 : Ω → ℝ) ω ∂μ) = cellMass μ G g rw [MeasureTheory.integral_indicator_one hs_meas] simp [Measure.real, cellMass, s] -
cell_integral_div_mul_cellMasstheorem — Dividing an indicator-weighted cell integral by a nonzero cell mass and multiplying back recovers the numerator; on zero-mass cells the numerator is zero because the indicator is a.e. zero.hypothesesProof (Lean source)
theorem cell_integral_div_mul_cellMass {Ω 𝒢 : Type*} [MeasurableSpace Ω] (μ : Measure Ω) (F : Ω → ℝ) (G : Ω → 𝒢) (g : 𝒢) (hμ : μ {ω | G ω = g} ≠ ⊤) : ((∫ ω, F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ) / cellMass μ G g) * cellMass μ G g = ∫ ω, F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ := by let s : Set Ω := {ω | G ω = g} let A : ℝ := ∫ ω, F ω * indicator s (fun _ => (1 : ℝ)) ω ∂μ have hs_top : μ s ≠ ⊤ := by simpa [s] using hμ by_cases hmass : cellMass μ G g = 0 · have hs_zero : μ s = 0 := by have hzero : (μ s).toReal = 0 := by simpa [cellMass, s] using hmass rcases (ENNReal.toReal_eq_zero_iff (μ s)).1 hzero with h0 | htop · exact h0 · exact elim (hs_top htop) have h_not_mem : ∀ᵐ ω ∂μ, ω ∉ s := by rw [MeasureTheory.ae_iff] simpa using hs_zero have h_ae : (fun ω => F ω * indicator s (fun _ => (1 : ℝ)) ω) =ᵐ[μ] 0 := by filter_upwards [h_not_mem] with ω hω simp [indicator, hω] have hA : A = 0 := by simpa [A] using (integral_eq_zero_of_ae h_ae) simp [cellMass, s, A, hA] · have hAdef : A = ∫ ω, F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ := by simp [A, s] rw [hAdef.symm] field_simp [hmass] -
cellMean_mul_cellMasstheorem — Cell mean multiplied by cell mass recovers the indicator-weighted raw integral.hypothesesconclusioncellMean μ F G g * cellMass μ G g= ∫ ω, F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μProof (Lean source)
theorem cellMean_mul_cellMass {Ω 𝒢 : Type*} [MeasurableSpace Ω] (μ : Measure Ω) (F : Ω → ℝ) (G : Ω → 𝒢) (g : 𝒢) (hμ : μ {ω | G ω = g} ≠ ⊤) : cellMean μ F G g * cellMass μ G g = ∫ ω, F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ := by simpa [cellMean] using cell_integral_div_mul_cellMass μ F G g hμ -
integral_mul_indicatorSpan_eq_zero_of_celltheorem — If a square-integrable residual is orthogonal to every cell indicator, it is orthogonal to every finite indicator-span member.hypothesesΩ 𝒢 :μ :V :Ω → ℝG :Ω → 𝒢G_meas :V_memLp :MemLp V 2 μc :𝒢 → ℝhcell :∀ g, ∫ ω, V ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ = 0conclusion∫ ω, V ω * (∑ g, c g * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) ∂μ = 0Proof (Lean source)
theorem integral_mul_indicatorSpan_eq_zero_of_cell {Ω 𝒢 : Type*} [MeasurableSpace Ω] [Fintype 𝒢] [MeasurableSpace 𝒢] [MeasurableSingletonClass 𝒢] (μ : Measure Ω) [IsFiniteMeasure μ] (V : Ω → ℝ) (G : Ω → 𝒢) (G_meas : Measurable G) (V_memLp : MemLp V 2 μ) (c : 𝒢 → ℝ) (hcell : ∀ g, ∫ ω, V ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ = 0) : ∫ ω, V ω * (∑ g, c g * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) ∂μ = 0 := by classical let term : 𝒢 → Ω → ℝ := fun g ω => V ω * (c g * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) have hterm_int : ∀ g ∈ (Finset.univ : Finset 𝒢), Integrable (term g) μ := by intro g _ have hI : MemLp (fun ω => indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) 2 μ := indicator_cell_memLp μ G G_meas g have hcI : MemLp (fun ω => c g * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) 2 μ := by simpa [mul_comm] using hI.const_mul (c g) exact V_memLp.integrable_mul hcI have hpoint : (fun ω => V ω * (∑ g, c g * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω)) = (fun ω => ∑ g, term g ω) := by funext ω simp [term, Finset.mul_sum] calc ∫ ω, V ω * (∑ g, c g * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) ∂μ = ∫ ω, ∑ g, term g ω ∂μ := by rw [hpoint] _ = ∑ g, ∫ ω, term g ω ∂μ := by simpa using (MeasureTheory.integral_finset_sum (Finset.univ : Finset 𝒢) (f := term) hterm_int) _ = 0 := by refine Finset.sum_eq_zero (fun g _ => ?_) calc ∫ ω, term g ω ∂μ = ∫ ω, c g * (V ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) ∂μ := by refine integral_congr_ae ?_ filter_upwards [] with ω simp [term] ring _ = c g * ∫ ω, V ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ := integral_const_mul (c g) _ _ = 0 := by simp [hcell g] -
integral_eq_sum_celltheorem — Integrate an integrable function by summing over a finite measurable partition generated by G.hypothesesconclusion∫ ω, F ω ∂μ = ∑ g, ∫ ω, F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μProof (Lean source)
theorem integral_eq_sum_cell {Ω 𝒢 : Type*} [MeasurableSpace Ω] [Fintype 𝒢] [MeasurableSpace 𝒢] [MeasurableSingletonClass 𝒢] (μ : Measure Ω) (F : Ω → ℝ) (G : Ω → 𝒢) (G_meas : Measurable G) (F_int : Integrable F μ) : ∫ ω, F ω ∂μ = ∑ g, ∫ ω, F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω ∂μ := by classical let term : 𝒢 → Ω → ℝ := fun g ω => F ω * indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω have hterm_int : ∀ g ∈ (Finset.univ : Finset 𝒢), Integrable (term g) μ := by intro g _ have hG : MeasurableSet {ω : Ω | G ω = g} := G_meas (measurableSet_singleton g) have hEq : term g = fun ω => indicator {ω' | G ω' = g} F ω := by funext ω by_cases hω : G ω = g · simp [term, indicator, hω] · simp [term, indicator, hω] rw [hEq] exact F_int.indicator hG have hsum_ind : ∀ ω, (∑ g, indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) = 1 := by intro ω rw [Finset.sum_eq_single (G ω)] · simp · intro b _ hb have hne : ¬ G ω = b := fun h => hb h.symm simp [indicator, hne] · intro hnot exact elim (hnot (Finset.mem_univ _)) calc ∫ ω, F ω ∂μ = ∫ ω, F ω * (∑ g, indicator {ω' | G ω' = g} (fun _ => (1 : ℝ)) ω) ∂μ := by refine integral_congr_ae ?_ filter_upwards [] with ω simp [hsum_ind ω] _ = ∫ ω, ∑ g, term g ω ∂μ := by refine integral_congr_ae ?_ filter_upwards [] with ω simp [term, Finset.mul_sum] _ = ∑ g, ∫ ω, term g ω ∂μ := by simpa using (MeasureTheory.integral_finset_sum (Finset.univ : Finset 𝒢) (f := term) hterm_int)
UniformTwoWayPanel 12 core · 10 supporting This file provides finite-sum algebra for balanced unit-period panels under the uniform unit-period measure. ★ finite_residualized_coefficient_eq_of_normalEqs★ ddot_orthogonal_unit_time
Uniform Balanced Two-Way Panels
This file provides finite-sum algebra for balanced unit-period panels under the
uniform unit-period measure. It defines BalancedPanel, uniform unit weights,
unit means, time means, grand means, double demeaning ddot, the unnormalized
inner product, the finite residualized coefficient, and the unit/time additive
nuisance class. Its main results relate the uniform constructions to
WeightedTwoWayPanel, prove the finite residualized-coefficient handoff, and
show that double-demeaned arrays are orthogonal to unit-only, time-only, and
unit/time additive functions.
Balanced panel. The side conditions from the source definition that a panel counts as balanced: the unit index type has at least two elements and the time index type has at least two elements.
Uniform unit weights as a probability vector, used to view this module as the uniform specialization of WeightedTwoWayPanel.
Definition (Lean source)
Unit mean \bar V_{i·} under the uniform period measure.
Time mean \bar V_{·t} under the uniform unit measure.
Definition (Lean source)
Grand mean \bar V under the uniform unit-period measure.
Definition (Lean source)
Two-way residual / double-demeaned array.
Uniform finite-panel inner product, without the harmless normalizing constant.
Finite scalar residualized coefficient for a supplied residualized regressor Dtilde and residualized outcome Ytilde.
Definition (Lean source)
Finite scalar Frisch–Waugh–Lovell handoff. Suppose the outcome and regressor decompose as Y = Yproj + Ytilde and D = Dproj + Dtilde, where Dproj and the fitted nuisance term Hβ both satisfy the nuisance predicate H, Dtilde is orthogonal to every array satisfying H, Dtilde is orthogonal to Yproj, and Dtilde has strictly positive self-inner-product (a nondegenerate residualized regressor). If the coefficient β and nuisance fit Hβ satisfy the normal equation against the raw regressor D and the normal equation against its nuisance component Dproj, then β equals the finite residualized coefficient inner Dtilde Ytilde / inner Dtilde Dtilde.
Formal statement
Proof (Lean source)
Unit-time additive nuisance class h_it = a_i + b_t.
Definition (Lean source)
The unit/time component removed by double demeaning.
Assume at least one unit and at least one period. Then for any array h of unit/time additive form h_it = a_i + b_t, the double-demeaned array ddot V is orthogonal to h under the unnormalized uniform panel inner product.
Formal statement
Proof (Lean source)
10 supporting declarations (lemmas, instances)
-
timeMean_eq_weightedtheorem — In a finite balanced panel with uniformly weighted units, the usual time mean in any period equals the time mean computed under the uniform unit weights.hypothesesconclusiontimeMean V t = WeightedTwoWayPanel.timeMean (uniformWeights hU) V tProof (Lean source)
theorem timeMean_eq_weighted (hU : 0 < card Unit) (V : Unit → Time → ℝ) (t : Time) : timeMean V t = WeightedTwoWayPanel.timeMean (uniformWeights hU) V t := by unfold timeMean WeightedTwoWayPanel.timeMean uniformWeights rw [← Finset.mul_sum] -
grandMean_eq_weightedtheorem — In a finite balanced panel with uniform unit weights, the usual grand mean equals the grand mean computed under those weights.hypothesesconclusiongrandMean V = WeightedTwoWayPanel.grandMean (uniformWeights hU) VProof (Lean source)
theorem grandMean_eq_weighted (hU : 0 < Fintype.card Unit) (V : Unit → Time → ℝ) : grandMean V = WeightedTwoWayPanel.grandMean (uniformWeights hU) V := by unfold grandMean WeightedTwoWayPanel.grandMean uniformWeights change (((Fintype.card Unit : ℝ) * (Fintype.card Time : ℝ))⁻¹ * ∑ i, ∑ t, V i t) = ∑ i, (Fintype.card Unit : ℝ)⁻¹ * ((Fintype.card Time : ℝ)⁻¹ * ∑ t, V i t) calc (((Fintype.card Unit : ℝ) * (Fintype.card Time : ℝ))⁻¹ * ∑ i, ∑ t, V i t) = (Fintype.card Unit : ℝ)⁻¹ * ((Fintype.card Time : ℝ)⁻¹ * ∑ i, ∑ t, V i t) := by rw [mul_inv] ring _ = ∑ i, (Fintype.card Unit : ℝ)⁻¹ * ((Fintype.card Time : ℝ)⁻¹ * ∑ t, V i t) := by rw [Finset.mul_sum, Finset.mul_sum] -
ddot_eq_weightedtheorem — Uniform double-demeaning is weighted double-demeaning with uniform unit weights.hypothesesconclusionddot V i t= WeightedTwoWayPanel.ddot (uniformWeights (Fintype.card_pos_iff.mpr ⟨i⟩)) V i tProof (Lean source)
theorem ddot_eq_weighted (V : Unit → Time → ℝ) (i : Unit) (t : Time) : ddot V i t = WeightedTwoWayPanel.ddot (uniformWeights (Fintype.card_pos_iff.mpr ⟨i⟩)) V i t := by have hU : 0 < card Unit := Fintype.card_pos_iff.mpr ⟨i⟩ unfold ddot WeightedTwoWayPanel.ddot rw [timeMean_eq_weighted hU V t, grandMean_eq_weighted hU V] rfl -
sum_eq_card_mul_uniform_weightedtheorem — In a finite balanced panel, the unweighted sum across all unit-period cells equals the number of units times the corresponding sum under uniform unit weights.hypotheseshU :0 < Fintype.card UnitF :Unit → Time → ℝconclusion∑ i, ∑ t, F i t = (Fintype.card Unit : ℝ) * ∑ i, ∑ t, (uniformWeights hU).p i * F i tProof (Lean source)
theorem sum_eq_card_mul_uniform_weighted (hU : 0 < Fintype.card Unit) (F : Unit → Time → ℝ) : ∑ i, ∑ t, F i t = (Fintype.card Unit : ℝ) * ∑ i, ∑ t, (uniformWeights hU).p i * F i t := by have hU_ne : (Fintype.card Unit : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hU) unfold uniformWeights calc ∑ i, ∑ t, F i t = ((Fintype.card Unit : ℝ) * (Fintype.card Unit : ℝ)⁻¹) * ∑ i, ∑ t, F i t := by rw [mul_inv_cancel₀ hU_ne, one_mul] _ = (Fintype.card Unit : ℝ) * ((Fintype.card Unit : ℝ)⁻¹ * ∑ i, ∑ t, F i t) := by ring _ = (Fintype.card Unit : ℝ) * ∑ i, (Fintype.card Unit : ℝ)⁻¹ * ∑ t, F i t := by rw [Finset.mul_sum] _ = (Fintype.card Unit : ℝ) * ∑ i, ∑ t, (Fintype.card Unit : ℝ)⁻¹ * F i t := by congr 1 apply Finset.sum_congr rfl intro i _hi rw [Finset.mul_sum] -
inner_eq_card_smul_weightedtheorem — The unnormalized uniform inner product is the unit count times the weighted inner product under uniform unit weights.hypotheseshU :0 < Fintype.card UnitV W :Unit → Time → ℝconclusioninner V W = (Fintype.card Unit : ℝ) * WeightedTwoWayPanel.inner (uniformWeights hU) V WProof (Lean source)
theorem inner_eq_card_smul_weighted (hU : 0 < Fintype.card Unit) (V W : Unit → Time → ℝ) : inner V W = (Fintype.card Unit : ℝ) * WeightedTwoWayPanel.inner (uniformWeights hU) V W := by simpa [inner, WeightedTwoWayPanel.inner] using sum_eq_card_mul_uniform_weighted (Unit := Unit) (Time := Time) hU (fun i t => V i t * W i t) -
ddot_reconstructtheorem — Reconstruction identity V_it = ddot V_it + unitMean V_i + timeMean V_t - grandMean V.hypothesesconclusionddot V i t + unitMean V i + timeMean V t - grandMean V = V i t -
unitTimeProjection_additivetheorem — The removed component is itself unit/time additive.Proof (Lean source)
theorem unitTimeProjection_additive (V : Unit → Time → ℝ) : IsUnitTimeAdditive (unitTimeProjection V) := by refine ⟨unitMean V, fun t => timeMean V t - grandMean V, ?_⟩ intro i t unfold unitTimeProjection ring -
sub_ddot_eq_unitTimeProjectiontheorem — Pointwise residual decomposition V - ddot V into the unit/time projection.hypothesesconclusionV i t - ddot V i t = unitTimeProjection V i t -
ddot_orthogonal_unittheorem — Double-demeaned arrays are orthogonal to arbitrary unit-only functions.hypothesesconclusion∑ i, ∑ t, ddot V i t * a i = 0Proof (Lean source)
theorem ddot_orthogonal_unit (hU : 0 < Fintype.card Unit) (hT : 0 < Fintype.card Time) (V : Unit → Time → ℝ) (a : Unit → ℝ) : ∑ i, ∑ t, ddot V i t * a i = 0 := by classical let w := uniformWeights (Unit := Unit) hU have hweighted : ∑ i, ∑ t, w.p i * (WeightedTwoWayPanel.ddot w V i t * a i) = 0 := WeightedTwoWayPanel.ddot_orthogonal_unit w V a calc ∑ i, ∑ t, ddot V i t * a i = (Fintype.card Unit : ℝ) * ∑ i, ∑ t, w.p i * (ddot V i t * a i) := by simpa [w] using sum_eq_card_mul_uniform_weighted (Unit := Unit) (Time := Time) hU (fun i t => ddot V i t * a i) _ = (Fintype.card Unit : ℝ) * ∑ i, ∑ t, w.p i * (WeightedTwoWayPanel.ddot w V i t * a i) := by congr 1 apply Finset.sum_congr rfl intro i _hi apply Finset.sum_congr rfl intro t _ht rw [ddot_eq_weighted V i t] _ = 0 := by rw [hweighted, mul_zero] -
ddot_orthogonal_timetheorem — Double-demeaned arrays are orthogonal to arbitrary time-only functions.hypothesesconclusion∑ i, ∑ t, ddot V i t * b t = 0Proof (Lean source)
theorem ddot_orthogonal_time (hU : 0 < Fintype.card Unit) (V : Unit → Time → ℝ) (b : Time → ℝ) : ∑ i, ∑ t, ddot V i t * b t = 0 := by classical let w := uniformWeights (Unit := Unit) hU have hweighted : ∑ i, ∑ t, w.p i * (WeightedTwoWayPanel.ddot w V i t * b t) = 0 := WeightedTwoWayPanel.ddot_orthogonal_time w V b calc ∑ i, ∑ t, ddot V i t * b t = (Fintype.card Unit : ℝ) * ∑ i, ∑ t, w.p i * (ddot V i t * b t) := by simpa [w] using sum_eq_card_mul_uniform_weighted (Unit := Unit) (Time := Time) hU (fun i t => ddot V i t * b t) _ = (Fintype.card Unit : ℝ) * ∑ i, ∑ t, w.p i * (WeightedTwoWayPanel.ddot w V i t * b t) := by congr 1 apply Finset.sum_congr rfl intro i _hi apply Finset.sum_congr rfl intro t _ht rw [ddot_eq_weighted V i t] _ = 0 := by rw [hweighted, mul_zero]
FWLInstanceL2 1 core · 4 supporting This file instantiates the abstract Frisch-Waugh-Lovell development on square-integrable real functions under a probability measure. ★ fwlCoef_eq_of_original_minimizer
L2 Frisch-Waugh-Lovell Instance
This file instantiates the abstract Frisch-Waugh-Lovell development on
square-integrable real functions under a probability measure. It supplies
orthogonal projections for finite-dimensional nuisance subspaces, identifies
the Lp inner product with the corresponding population integral, and exposes
the residualized normal equations, least-squares optimality, and uniqueness
statements for the L²(μ) specialization.
FWL uniqueness on L²(μ). Fix square-integrable regressors X and outcome Y, and a finite-dimensional nuisance subspace H of L²(μ), and assume the residualized regressor Gram matrix is invertible. If the nuisance term h lies in H and the pair (β, h) minimizes the original least-squares objective jointly over all coefficient vectors and nuisance terms in H, then β equals the Frisch–Waugh–Lovell coefficient computed by residualizing against H. Specialization of Causalean.Mathlib.FWL.fwlCoef_eq_of_original_minimizer.
Formal statement
Proof (Lean source)
4 supporting declarations (lemmas, instances)
-
hasOrthogonalProjection_of_finiteDimensionalinstance — A finite-dimensional subspace of Lp ℝ 2 μ admits an orthogonal projection: it is complete (finite-dimensional over the complete field ℝ), so Mathlib's completeness instance applies.instance hasOrthogonalProjection_of_finiteDimensional (H : Submodule ℝ (Lp ℝ 2 μ)) [FiniteDimensional ℝ H] : H.HasOrthogonalProjection := inferInstance -
inner_eq_integraltheorem — L² inner product = integral pairing. For two square-integrable real random variables, the Hilbert-space inner product equals the integral of their product, independent of the chosen representatives. This is the bridge between abstract FWL inner products and the population second moments used in estimand papers.Proof (Lean source)
theorem inner_eq_integral (f g : Lp ℝ 2 μ) : inner ℝ f g = ∫ a, f a * g a ∂μ := by rw [L2.inner_def] refine integral_congr_ae (Filter.Eventually.of_forall (fun a => ?_)) change inner ℝ (f a) (g a) = f a * g a exact mul_comm _ _ -
gramResid_mulVec_fwlCoeftheorem — Residualized normal equations on L²(μ). The FWL coefficient solves gramResid H X *ᵥ fwlCoef H X Y = residInnerVec H X Y whenever the residualized Gram matrix is invertible. Specialization of Causalean.Mathlib.FWL.gramResid_mulVec_fwlCoef.hypothesesconclusion= residInnerVec H X YProof (Lean source)
theorem gramResid_mulVec_fwlCoef (hQ : IsUnit (gramResid H X).det) : (gramResid H X).mulVec (fwlCoef H X Y) = residInnerVec H X Y := gramResid_mulVec_fwlCoef H X Y hQ -
fwlCoef_original_minimizestheorem — FWL least-squares optimality on L²(μ). The FWL coefficient (paired with the nuisance projection of its raw residual) minimizes the original least-squares objective over coefficients and nuisance terms in H. Specialization of Causalean.Mathlib.FWL.fwlCoef_original_minimizes.hypothesesconclusionoriginalObjective X Y (fwlCoef H X Y) (H.orthogonalProjectionFn (Y - fittedValue X (fwlCoef H X Y)))≤ originalObjective X Y β hProof (Lean source)
theorem fwlCoef_original_minimizes (hQ : IsUnit (gramResid H X).det) (β : Fin K → ℝ) {h : Lp ℝ 2 μ} (hh : h ∈ H) : originalObjective X Y (fwlCoef H X Y) (H.orthogonalProjectionFn (Y - fittedValue X (fwlCoef H X Y))) ≤ originalObjective X Y β h := fwlCoef_original_minimizes H X Y hQ β hh
InnerProduct 1 core · 15 supporting This file provides the panel-facing import point for weighted inner products on observed cell arrays. ★ ip_self_eq_zero_iff
Panel Inner Products
This file provides the panel-facing import point for weighted inner products on
observed cell arrays. It restates the generic weighted-support inner-product
operations and algebraic lemmas under the panel cell namespace, including the
scalar aliases Cells.ip, Cells.ip_eq_weighted, the matrix-valued aliases
Cells.ipMat, Cells.ipMat_eq_weighted, and the symmetry, additivity,
homogeneity, nonnegativity, vanishing, and transpose lemmas used by panel
projection proofs.
For a panel cell structure and a panel array A, the self inner product c.ip A A is zero exactly when A vanishes on every observed cell of c.
Formal statement
Proof (Lean source)
15 supporting declarations (lemmas, instances)
-
ip_deflemma — The panel weighted inner product unfolds to the weighted sum over observed unit-period cells.hypothesesc :Cells I TA B :(I × T) → ℝconclusionc.ip A B = ∑ r ∈ c.observed, c.weight r * A r * B r -
ip_add_leftlemma — The panel weighted inner product is additive in its left array.Proof (Lean source)
lemma ip_add_left (c : Cells I T) (A A' B : (I × T) → ℝ) : c.ip (A + A') B = c.ip A B + c.ip A' B := ip_add_left c A A' B -
ip_add_rightlemma — The panel weighted inner product is additive in its right array.Proof (Lean source)
lemma ip_add_right (c : Cells I T) (A B B' : (I × T) → ℝ) : c.ip A (B + B') = c.ip A B + c.ip A B' := ip_add_right c A B B' -
ip_smul_leftlemma — The panel weighted inner product is homogeneous in its left array.Proof (Lean source)
lemma ip_smul_left (c : Cells I T) (s : ℝ) (A B : (I × T) → ℝ) : c.ip (s • A) B = s * c.ip A B := ip_smul_left c s A B -
ip_smul_rightlemma — The panel weighted inner product is homogeneous in its right array.Proof (Lean source)
lemma ip_smul_right (c : Cells I T) (s : ℝ) (A B : (I × T) → ℝ) : c.ip A (s • B) = s * c.ip A B := ip_smul_right c s A B -
ip_self_nonneglemma — The self inner product of any panel array is nonnegative.Proof (Lean source)
lemma ip_self_nonneg (c : Cells I T) (A : (I × T) → ℝ) : 0 ≤ c.ip A A := ip_self_nonneg c A -
ipMat_applylemma — The matrix-valued panel inner product has entries equal to scalar inner products of the corresponding array columns.hypothesesconclusionc.ipMat A B j k = c.ip (A j) (B k) -
ipMat_transposelemma — Swapping the two tuples of arrays transposes the matrix-valued panel inner product.Proof (Lean source)
lemma ipMat_transpose (c : Cells I T) (A B : Fin K → (I × T) → ℝ) : (c.ipMat A B).transpose = c.ipMat B A := ipMat_transpose c A B -
ipMat_add_leftlemma — The matrix-valued panel inner product is additive in its left tuple of arrays.hypothesesconclusionc.ipMat (A + A') B = c.ipMat A B + c.ipMat A' BProof (Lean source)
lemma ipMat_add_left (c : Cells I T) (A A' B : Fin K → (I × T) → ℝ) : c.ipMat (A + A') B = c.ipMat A B + c.ipMat A' B := ipMat_add_left c A A' B -
ipMat_add_rightlemma — The matrix-valued panel inner product is additive in its right tuple of arrays.hypothesesconclusionc.ipMat A (B + B') = c.ipMat A B + c.ipMat A B'Proof (Lean source)
lemma ipMat_add_right (c : Cells I T) (A B B' : Fin K → (I × T) → ℝ) : c.ipMat A (B + B') = c.ipMat A B + c.ipMat A B' := ipMat_add_right c A B B' -
ipMat_smul_leftlemma — The matrix-valued panel inner product is homogeneous in its left tuple of arrays.hypothesesconclusionc.ipMat (s • A) B = s • c.ipMat A BProof (Lean source)
lemma ipMat_smul_left (c : Cells I T) (s : ℝ) (A B : Fin K → (I × T) → ℝ) : c.ipMat (s • A) B = s • c.ipMat A B := ipMat_smul_left c s A B -
ipMat_smul_rightlemma — The matrix-valued panel inner product is homogeneous in its right tuple of arrays.hypothesesconclusionc.ipMat A (s • B) = s • c.ipMat A BProof (Lean source)
lemma ipMat_smul_right (c : Cells I T) (s : ℝ) (A B : Fin K → (I × T) → ℝ) : c.ipMat A (s • B) = s • c.ipMat A B := ipMat_smul_right c s A B
Subspace 1 core · 14 supporting This file exposes panel-level names for weighted orthogonal projection, residualization, and cell-array spaces. ★ residualize_in_orthogonal
Panel Subspace Aliases
This file exposes panel-level names for weighted orthogonal projection,
residualization, and cell-array spaces. It keeps the panel regression API
connected to the generic weighted subspace construction used throughout the
library while preserving convenient Cells.* names for projection,
residual-maker, residualized-regressor, orthogonality, and idempotence facts.
For an array h lying in the nuisance subspace H, the array X residualized against H is orthogonal to h under the panel weighted inner product c.ip.
Formal statement
Proof (Lean source)
14 supporting declarations (lemmas, instances)
-
proj_eq_weightedlemma — The panel projection alias is definitionally equal to the generic weighted support projection. -
residualize_eq_weightedlemma — The panel residual-maker alias is definitionally equal to the generic weighted support residual maker.Proof (Lean source)
lemma residualize_eq_weighted (c : Cells I T) (H : Submodule ℝ (V I T)) : residualize c H = residualize c H := rfl -
tildeX_eq_weightedlemma — The panel residualized-array alias is definitionally equal to the generic weighted support residualized array. -
tildeXVec_eq_weightedlemma — The panel column-wise residualization alias is definitionally equal to the generic weighted support column-wise residualization.hypotheses -
tildeX_eqlemma — Residualizing a panel array subtracts its nuisance-space projection. -
residualize_applylemma — Applying the panel residual maker subtracts the nuisance-space projection.hypothesesconclusionc.residualize H X = X - c.proj H XProof (Lean source)
@[simp] lemma residualize_apply (c : Cells I T) (H : Submodule ℝ (V I T)) (X : V I T) : c.residualize H X = X - c.proj H X := residualize_apply c H X -
tildeXVec_applylemma — Column-wise residualization residualizes each regressor column separately.hypothesesconclusionc.tildeXVec H X k = c.tildeX H (X k)Proof (Lean source)
@[simp] lemma tildeXVec_apply (c : Cells I T) (H : Submodule ℝ (V I T)) (X : Fin K → V I T) (k : Fin K) : c.tildeXVec H X k = c.tildeX H (X k) := tildeXVec_apply c H X k -
residualize_self_of_memlemma — A nuisance-space array residualizes to zero on observed cells.hypothesesconclusionc.tildeX H X r = 0Proof (Lean source)
lemma residualize_self_of_mem (c : Cells I T) (H : Submodule ℝ (V I T)) {X : V I T} (hX : X ∈ H) (r : I × T) (hr : r ∈ c.observed) : c.tildeX H X r = 0 := residualize_self_of_mem c H hX r hr -
residualize_idem_applylemma — Applying the panel residual maker twice agrees with applying it once on observed cells.hypothesesconclusionc.residualize H (c.residualize H X) r = c.residualize H X rProof (Lean source)
lemma residualize_idem_apply (c : Cells I T) (H : Submodule ℝ (V I T)) (X : V I T) (r : I × T) (hr : r ∈ c.observed) : c.residualize H (c.residualize H X) r = c.residualize H X r := residualize_idem_apply c H X r hr -
proj_orthogonallemma — The projection residual is orthogonal to every nuisance-space array under the panel weighted inner product.hypothesesconclusionc.ip (X - c.proj H X) h = 0Proof (Lean source)
lemma proj_orthogonal (c : Cells I T) (H : Submodule ℝ (V I T)) (X : V I T) {h : V I T} (hH : h ∈ H) : c.ip (X - c.proj H X) h = 0 := proj_orthogonal c H X hH -
proj_apply_of_memlemma — Projecting a nuisance-space array returns the same values on observed cells.hypothesesconclusionc.proj H Y r = Y rProof (Lean source)
lemma proj_apply_of_mem (c : Cells I T) (H : Submodule ℝ (V I T)) {Y : V I T} (hY : Y ∈ H) (r : I × T) (hr : r ∈ c.observed) : c.proj H Y r = Y r := proj_apply_of_mem c H hY r hr -
proj_apply_eq_of_mem_orthogonallemma — Any nuisance-space candidate with the projection orthogonality condition matches the chosen projection on observed cells.hypothesesc :Cells I TH :Submodule ℝ (V I T)X :V I TY :V I ThY :Y ∈ Hhorth :∀ h ∈ H, c.ip (X - Y) h = 0r :I × Thr :r ∈ c.observedconclusionc.proj H X r = Y rProof (Lean source)
lemma proj_apply_eq_of_mem_orthogonal (c : Cells I T) (H : Submodule ℝ (V I T)) (X : V I T) {Y : V I T} (hY : Y ∈ H) (horth : ∀ h ∈ H, c.ip (X - Y) h = 0) (r : I × T) (hr : r ∈ c.observed) : c.proj H X r = Y r := proj_apply_eq_of_mem_orthogonal c H X hY horth r hr -
proj_idem_applylemma — Applying the chosen panel projection twice agrees with applying it once on observed cells.hypothesesconclusionc.proj H (c.proj H X) r = c.proj H X rProof (Lean source)
lemma proj_idem_apply (c : Cells I T) (H : Submodule ℝ (V I T)) (X : V I T) (r : I × T) (hr : r ∈ c.observed) : c.proj H (c.proj H X) r = c.proj H X r := proj_idem_apply c H X r hr