Discovery.Invariant­Prediction.Linear­Gaussian.Helpers

Linear-Gaussian invariant-prediction helpers: intervention invariance, centered-noise moments, and residual algebra for soundness and completeness proofs.

Invariance 1 core · 0 supporting The structural backbone of the mean-shift argument (propos:sem): under a single do-intervention do(X_{k₀} = a), every coordinate that is not a descendant of k₀ and is not k₀ itself keeps its observational value a.e. ★ nonDescendant_invariance

Invariant Causal Prediction — non-descendant invariance

The structural backbone of the mean-shift argument (propos:sem): under a single do-intervention do(X_{k₀} = a), every coordinate that is not a descendant of k₀ and is not k₀ itself keeps its observational value a.e.

nonDescendant_invariance proves, for the single-intervention environment e with A = {k₀}, that e.X ω k = M.X ω k a.e. for every k ≠ k₀ with ¬ dag.isAncestor k₀ k (i.e. k is not a strict descendant of k₀). This includes nodes incomparable with k₀ and ancestors of k₀, exactly the "upstream + sideways" part of the graph the intervention cannot reach; the intervened node k₀ is excluded because it is pinned to the assigned constant.

The proof is a strong induction along the topological order: each such k satisfies the same structural equation in both worlds (hDoStruct k vs hε k, since k ≠ k₀ so k ∉ A), and all its parents are also non-descendants of k₀ with strictly smaller topological order, so they agree by induction.

theorem nonDescendant_invariance reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

Non-descendant invariance. Let e be an environment of the observational SEM M in which the single intervened coordinate is k₀. Then every coordinate k that is neither k₀ nor a descendant of k₀ in the observational DAG keeps its observational value almost surely: Xₖᵉ = Xₖ¹. (The node k₀ itself is pinned to the assigned constant, hence excluded.)

Formal statement
M :
e :
Env M
k₀ :
Fin (p + 1)
hA :
e.A = {k₀}
∀ᵐ ω ∂M.P, ∀ k, k ≠ k₀ → ¬ M.dag.isAncestor k₀ k → e.X ω k = M.X ω k
Proof (Lean source)
theorem nonDescendant_invariance (M : ObsSEM p) (e : Env M) (k₀ : Fin (p + 1)) (hA : e.A = {k₀}) : ∀ᵐ ω ∂M.P, ∀ k, k ≠ k₀ → ¬ M.dag.isAncestor k₀ k → e.X ω k = M.X ω k := by classical -- Combine all the a.e. structural equations (both worlds, all coordinates) -- into a single a.e. event. have hstruct : ∀ᵐ ω ∂M.P, (∀ k, k ∉ e.A → e.X ω k = M.ε ω k + ∑ j ∈ Finset.univ.erase k, M.β k j * e.X ω j) := by rw [ae_all_iff] intro k by_cases hk : k ∈ e.A · filter_upwards with ω; intro h; exact absurd hk h · filter_upwards [e.hDoStruct k hk] with ω hω _; exact hω filter_upwards [hstruct, M.hε] with ω hStruct hEps -- Strong induction on the topological order of `k`. -- We prove `∀ n k, topoOrder k = n → (k ≠ k₀ → ¬ isAncestor k₀ k → Xₖᵉ = Xₖ¹)`. suffices h : ∀ n, ∀ k, M.dag.topoOrder k = n → (k ≠ k₀ → ¬ M.dag.isAncestor k₀ k → e.X ω k = M.X ω k) by intro k; exact h (M.dag.topoOrder k) k rfl intro n induction n using Nat.strong_induction_on with | _ n IH => intro k hk hkk₀ hnonanc subst hk -- `k ∉ A = {k₀}` because `k ≠ k₀`. have hkA : k ∉ e.A := by rw [hA]; simpa using hkk₀ -- Both worlds' structural equations at `k`. have hE := hStruct k hkA have hM := hEps k -- The two structural sums over the parents agree (parents are non-descendant -- of `k₀`, smaller topo order, so equal by induction). have hsum : ∑ j ∈ Finset.univ.erase k, M.β k j * e.X ω j = ∑ j ∈ Finset.univ.erase k, M.β k j * M.X ω j := by apply Finset.sum_congr rfl intro j hj rw [Finset.mem_erase] at hj obtain ⟨hjk, _⟩ := hj -- If `β k j = 0` the terms agree trivially; else `j → k` is an edge. by_cases hβ : M.β k j = 0 · rw [hβ]; ring · -- `j` is a parent of `k`: `edge j k`. have hedge : M.dag.edge j k := (M.hEdge k j).mpr hβ -- `j ≠ k₀`: else `edge k₀ k` ⟹ `isAncestor k₀ k`, contradiction. have hjk₀ : j ≠ k₀ := by rintro rfl exact hnonanc (Causalean.DAG.isAncestor.edge hedge) -- `¬ isAncestor k₀ j`: else `isAncestor k₀ j` + `edge j k` ⟹ `isAncestor k₀ k`. have hnonanc_j : ¬ M.dag.isAncestor k₀ j := by intro hanc exact hnonanc (Causalean.DAG.isAncestor.trans hanc hedge) -- `topoOrder j < topoOrder k`, so IH applies. have hlt : M.dag.topoOrder j < M.dag.topoOrder k := M.dag.topoOrder_lt j k hedge rw [IH (M.dag.topoOrder j) hlt j rfl hjk₀ hnonanc_j] rw [hE, hM, hsum]; ring
Causalean.Discovery.InvariantPrediction.LinearGaussian.nonDescendant_invariance · Causalean/Discovery/InvariantPrediction/LinearGaussian/Helpers/Invariance.lean:36 · uses isAncestor , Env , ObsSEM
Moments 1 core · 2 supporting The structural noises εⱼ of the observational SEM are centered Gaussian (hGauss), hence integrable with mean 0. ★ eps_integral_zero

Invariant Causal Prediction — Gaussian-noise moments

The structural noises εⱼ of the observational SEM are centered Gaussian (hGauss), hence integrable with mean 0. These two facts feed the mean-shift integral computation in the completeness proof.

  • eps_integrable — each εⱼ is M.P-integrable.
  • eps_integral_zeroE[εⱼ] = 0.
theorem eps_integral_zero reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

For a linear-Gaussian observational SEM and coordinate index j, the structural noise εⱼ is centered: its expectation under M's probability measure is zero.

Formal statement
M :
j :
Fin (p + 1)
∫ ω, M.ε ω j ∂M.P = 0
Proof (Lean source)
theorem eps_integral_zero (M : ObsSEM p) (j : Fin (p + 1)) : ∫ ω, M.ε ω j ∂M.P = 0 := by have hmeas : AEMeasurable (fun ω => M.ε ω j) M.P := eps_aemeasurable M j have hg : AEStronglyMeasurable (fun x : ℝ => x) (M.P.map (fun ω => M.ε ω j)) := by rw [M.hGauss j]; exact (memLp_id_gaussianReal 1).aestronglyMeasurable rw [← integral_map hmeas hg, M.hGauss j] exact integral_id_gaussianReal
Causalean.Discovery.InvariantPrediction.LinearGaussian.eps_integral_zero · Causalean/Discovery/InvariantPrediction/LinearGaussian/Helpers/Moments.lean:53 · uses ObsSEM
2 supporting declarations (lemmas, instances)
Residual 3 core · 1 supporting Algebraic helper lemmas for the completeness proof: with the *causal* coefficient γ* = β₀,·, the regression residual Y − Σ_k γ*_k X_k equals the target noise ε₀ a.e. ★ obsResidual_eq_eps★ envResidual_eq_eps

Invariant Causal Prediction — residual equals the target noise

Algebraic helper lemmas for the completeness proof: with the causal coefficient γ* = β₀,·, the regression residual Y − Σ_k γ*_k X_k equals the target noise ε₀ a.e. in every environment.

* obsResidual_eq_eps — observational block: from at the target row. * envResidual_eq_eps — interventional block: from hDoStruct at the target (the target is never intervened on, so it keeps its structural equation).

Both use that the target's own coefficient is 0 (hNoSelf) to turn the Σ_{k≠0} of the structural equation into the full Σ_k of the residual.

def causalCoeff reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

The causal coefficient γ* = β₀,· (row 0 of β).

Definition (Lean source)
def causalCoeff (M : ObsSEM p) : Fin (p + 1) → ℝ := fun k => M.β (target p) k
Causalean.Discovery.InvariantPrediction.LinearGaussian.causalCoeff · Causalean/Discovery/InvariantPrediction/LinearGaussian/Helpers/Residual.lean:31 · uses ObsSEM
theorem obsResidual_eq_eps reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

Observational residual is the target noise. For an observational SEM, evaluated at the causal coefficient γ* = β₀,·, the observational residual Y − Σ_k β₀ₖ X_k equals the target's structural noise ε₀ almost everywhere.

Formal statement
M :
∀ᵐ ω ∂M.P, obsResidual M (causalCoeff M) ω = M.ε ω (target p)
Proof (Lean source)
theorem obsResidual_eq_eps (M : ObsSEM p) : ∀ᵐ ω ∂M.P, obsResidual M (causalCoeff M) ω = M.ε ω (target p) := by filter_upwards [M.hε] with ω hω simp only [obsResidual, causalCoeff, sum_causalCoeff_eq M (M.X ω), hω (target p)]
Causalean.Discovery.InvariantPrediction.LinearGaussian.obsResidual_eq_eps · Causalean/Discovery/InvariantPrediction/LinearGaussian/Helpers/Residual.lean:42 · uses ObsSEM , causalCoeff , obsResidual , target
theorem envResidual_eq_eps reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

Interventional residual is the target noise. For an observational SEM and a do-intervention environment built on it — where the target is never itself intervened on, so it keeps its structural equation — the environment residual Yᵉ − Σ_k β₀ₖ Xₖᵉ, evaluated at the causal coefficient, equals the target's structural noise ε₀ almost everywhere.

Formal statement
M :
e :
Env M
∀ᵐ ω ∂M.P, envResidual e (causalCoeff M) ω = M.ε ω (target p)
Proof (Lean source)
theorem envResidual_eq_eps (M : ObsSEM p) (e : Env M) : ∀ᵐ ω ∂M.P, envResidual e (causalCoeff M) ω = M.ε ω (target p) := by filter_upwards [e.hDoStruct (target p) e.hAtarget] with ω hω simp only [envResidual, causalCoeff, sum_causalCoeff_eq M (e.X ω), hω] ring
Causalean.Discovery.InvariantPrediction.LinearGaussian.envResidual_eq_eps · Causalean/Discovery/InvariantPrediction/LinearGaussian/Helpers/Residual.lean:50 · uses Env , ObsSEM , causalCoeff , envResidual , target
1 supporting declaration (lemmas, instances)