Discovery.Invariant­Prediction.Linear­Gaussian

Self-contained linear-Gaussian formalization of the completeness half of Invariant Causal Prediction (Peters, Bühlmann & Meinshausen, JRSS-B 2016, arXiv:1501.01332, Theorem prop:1(i), the do-intervention version).

Helpers 5 core · 3 supporting · 3 submodules Linear-Gaussian invariant-prediction helpers: intervention invariance, centered-noise moments, and residual algebra for soundness and completeness proofs.
Model 8 core · 2 supporting Setup of the linear-Gaussian identifiability theorem of Peters, Bühlmann & Meinshausen, *Causal inference using invariant prediction* (JRSS-B 2016, arXiv:1501.01332), Theorem prop:1(i) (the do-intervention version). ★ ObsSEM★ mem_paY★ EnvFamily

Invariant Causal Prediction — linear-Gaussian model layer

Setup of the linear-Gaussian identifiability theorem of Peters, Bühlmann & Meinshausen, Causal inference using invariant prediction (JRSS-B 2016, arXiv:1501.01332), Theorem prop:1(i) (the do-intervention version).

This is a self-contained linear-Gaussian framework, deliberately separate from the nonparametric SWIG/kernel EnvFamily development in the sibling files. It uses the random-variable encoding of Discovery/LiNGAM/Kurtosis.lean: variables are real functions on a probability space, with /E[·] for moments and IdentDistrib for equality in distribution.

Encoding choices

* Index convention. The paper uses variables X₁,…,X_{p+1} with target Y = X₁ and predictors X₂,…,X_{p+1}. We index nodes by Fin (p+1) and put the target at index 0, predictors at 1,…,p. So target = 0 and the predictor index set is {1,…,p} = {k : k ≠ 0} (Finset.univ.erase 0). This is a pure 0-based relabelling of the paper's 1,…,p+1; PA(Y) is then a subset of {k : k ≠ 0}.

* One coefficient matrix, one DAG. The observational SEM e = 1 (eq:semmmmm) carries the coefficients β : Matrix (Fin (p+1)) (Fin (p+1)) ℝ with Xⱼ = Σ_{k≠j} βⱼₖ Xₖ + εⱼ. Acyclicity is witnessed by a DAG whose edge k → j holds exactly when βⱼₖ ≠ 0 (hEdge); reusing Causalean.DAG gives parents / descendants / topological order / the "youngest node" notion for free. PA(Y) = {k : β 0 k ≠ 0} is then literally dag.parents 0.

* Gaussian noise, random-variable form. The observational SEM has its own probability space with observed coordinates, and do-intervention environments live on that same probability space with the same structural noises. Independence of the noises and their Gaussian marginals are stated on the observational environment only (that is where the graph/β/Gaussianity live).

* Do-interventions (sec:idfirst). In environment e an intervention set A e ⊆ {1,…,p} and values a e : Fin (p+1) → ℝ replace the structural equation of each j ∈ A e by the constant a e j (zeroing its row of β and replacing εⱼ by a e j). Per the paper, 0 ∉ A e (never intervene on the target) and A 1 = ∅ (observational).

The do-version's proof (later) is a mean-shift argument (R^{e₀} = α_{k₀} a_{k₀} + … vs. R^1 = α_{k₀} X_{k₀}^1 + …, eq:help1/help2), so the model exposes residual means / laws cleanly via IdentDistrib and .

abbrev target reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

The target node Y = X₁, encoded at index 0 of Fin (p+1).

Definition (Lean source)
abbrev target (p : ℕ) : Fin (p + 1) := 0
Causalean.Discovery.InvariantPrediction.LinearGaussian.target · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:65
def predictors reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

The predictor index set {X₂,…,X_{p+1}}, encoded as {k : k ≠ 0}.

Definition (Lean source)
def predictors (p : ℕ) : Finset (Fin (p + 1)) := Finset.univ.erase 0
Causalean.Discovery.InvariantPrediction.LinearGaussian.predictors · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:68
structure ObsSEM reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

The observational linear-Gaussian structural equation model (eq:semmmmm, the e = 1 block): it bundles a sample space with its σ-algebra carrying a probability measure that is a genuine probability measure, together with structural coefficients β obeying Xⱼ = Σ_{k≠j} βⱼₖ Xₖ + εⱼ for measurable observed coordinates X, an acyclic graph whose edge k → j holds exactly when βⱼₖ ≠ 0, and the absence of self-loops in β. The noises ε are declared to be the structural residuals εⱼ = Xⱼ − Σ_{k≠j} βⱼₖ Xₖ, jointly independent, and each centered Gaussian with a positive variance σⱼ², and the target's noise is independent of every parent coordinate of the target.

Definition (Lean source)
p :
Sample space of the observational environment.
Ω :
Type*
Measurable structure on `Ω`.
:
The observational probability measure `P¹`.
P :
`P¹` is a probability measure.
The structural coefficients `βⱼₖ` (row `j`, column `k`).
β :
Matrix (Fin (p + 1)) (Fin (p + 1)) ℝ
The noise standard deviations `σⱼ` (`εⱼ ~ N(0, σⱼ²)`).
σ :
Fin (p + 1) → ℝ
The noises are nondegenerate (`σⱼ > 0`), as in a genuine Gaussian SEM.
hσpos :
∀ j, 0 < σ j
The acyclic graph of the SEM; its edges are the nonzero coefficients.
dag :
DAG (Fin (p + 1))
The graph edge `k → j` holds exactly when the coefficient `βⱼₖ` is nonzero.
hEdge :
∀ j k, dag.edge k j ↔ β j k ≠ 0
No self-loops: a variable does not enter its own structural equation.
hNoSelf :
∀ j, β j j = 0
The observed coordinates `X : Ω → (Fin (p+1) → ℝ)`.
X :
Ω → Fin (p + 1) → ℝ
Each coordinate is measurable.
hXmeas :
∀ j, Measurable fun ω => X ω j
The structural noises `εⱼ = Xⱼ − Σ_{k≠j} βⱼₖ Xₖ`.
ε :
Ω → Fin (p + 1) → ℝ
The noises are the structural residuals (definitional, stated a.e.).
:
∀ᵐ ω ∂P, ∀ j, ε ω j = X ω j - ∑ k ∈ Finset.univ.erase j, β j k * X ω k
The noises are jointly independent.
hindep :
iIndepFun (fun j ω => ε ω j) P
Each noise is centered Gaussian with variance `σⱼ²`: the law of `εⱼ` under `P` is `N(0, σⱼ²)`.
hGauss :
∀ j, P.map (fun ω => ε ω j) = gaussianReal 0 ⟨(σ j) ^ 2, by positivity⟩
**Target exogeneity (the paper's Assumption 1, `ε ⊥ X_{S*}`).** The target noise `ε₀` is independent of each *parent* coordinate `Xₖ` (`k ∈ PA(Y)`, i.e. `dag.edge k 0`). In a recursive SEM this is a *consequence* of the joint noise independence (`hindep`) plus acyclicity — the parents of `Y` are non-descendants of `Y`, so they are functions of noises other than `ε₀` — but the random-variable encoding here does not expose the `ε → X` solve `X = (I−B)⁻¹ε`, so we carry it as a field. It is stated **only for parents** of the target: it is *false* for descendants of `Y`.
hYexo :
∀ k
if
dag.edge k (target p)
then
IndepFun (fun ω => ε ω (target p)) (fun ω => X ω k) P
Causalean.Discovery.InvariantPrediction.LinearGaussian.ObsSEM · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:75
def paY reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.ObsSEM

The parents of the target Y in the observational graph: PA(Y) = {k : β 0 k ≠ 0}. This is the set the completeness theorem recovers.

Definition (Lean source)
def paY : Finset (Fin (p + 1)) := M.dag.parents (target p)
Causalean.Discovery.InvariantPrediction.LinearGaussian.ObsSEM.paY · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:142 · uses ObsSEM
theorem mem_paY reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.ObsSEM

For a predictor index k, k belongs to the target's parent set PA(Y) exactly when the target's structural coefficient on k is nonzero.

Formal statement
k :
Fin (p + 1)
k ∈ M.paY ↔ M.β (target p) k ≠ 0
Proof (Lean source)
theorem mem_paY {k : Fin (p + 1)} : k ∈ M.paY ↔ M.β (target p) k ≠ 0 := by rw [paY, M.dag.mem_parents, M.hEdge]
Causalean.Discovery.InvariantPrediction.LinearGaussian.ObsSEM.mem_paY · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:154 · uses ObsSEM , paY , target
structure Env reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

A single do-intervention environment for the observational SEM M (sec:idfirst) bundles an intervention set that never includes the target node, the constant values assigned to each intervened coordinate, and measurable post-intervention coordinates that equal their assigned constant, almost surely, on the intervened set, satisfy the same structural equation as M — with M's coefficients and noises — on every coordinate left un-intervened, and for which the target's noise remains independent of each parent coordinate of the target.

Definition (Lean source)
M :
The do-intervention target set `Aᵉ` (never the target `0`).
A :
Finset (Fin (p + 1))
The intervention never acts on the target.
hAtarget :
target p ∉ A
The assigned values `aᵉⱼ` for `j ∈ Aᵉ`.
a :
Fin (p + 1) → ℝ
The post-intervention coordinates, on `M`'s probability space.
X :
M.Ω → Fin (p + 1) → ℝ
Each coordinate is measurable.
hXmeas :
∀ j, Measurable fun ω => X ω j
do-pin: each intervened coordinate equals its assigned constant a.e.
hDoPin :
∀ j ∈ A, ∀ᵐ ω ∂M.P, X ω j = a j
Modularity: each un-intervened coordinate keeps the observational structural equation, with the **same** coefficients `β` and noises `ε` as `M`.
hDoStruct :
∀ j
if
j ∉ A
then
∀ᵐ ω ∂M.P, X ω j = M.ε ω j + ∑ k ∈ Finset.univ.erase j, M.β j k * X ω k
**Target exogeneity in this environment (the paper's Assumption 1).** The target keeps its structural equation (`0 ∉ A`), so its noise `M.ε₀` is still independent of each *parent* coordinate `Xₖ` (`k ∈ PA(Y)`) — now of the post-intervention `X`. As with `ObsSEM.hYexo` this is a consequence of recursive noise-independence + acyclicity that the random-variable encoding does not expose, so it is carried as a field; stated **only for parents** of the target.
hExo :
∀ k
if
M.dag.edge k (target p)
then
IndepFun (fun ω => M.ε ω (target p)) (fun ω => X ω k) M.P
Causalean.Discovery.InvariantPrediction.LinearGaussian.Env · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:161 · uses ObsSEM
structure EnvFamily reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

An environment family for the linear-Gaussian ICP problem bundles an observational linear-Gaussian structural equation model together with a finite index set of interventional environments over that model.

Definition (Lean source)
p :
The observational linear-Gaussian SEM (`e = 1`).
obs :
Index type of the interventional environments.
ι :
Type*
Finitely many environments.
:
The interventional environments.
env :
ι → Env obs
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:208
abbrev paY reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

The observational parent set PA(Y) of the family.

Definition (Lean source)
abbrev paY : Finset (Fin (p + 1)) := F.obs.paY
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.paY · Causalean/Discovery/InvariantPrediction/LinearGaussian/Model.lean:232 · uses EnvFamily
2 supporting declarations (lemmas, instances)
Regression 7 core · 2 supporting The observable layer of the linear-Gaussian ICP problem: the regression predictor in each environment, the regression-invariance null H_{0,S}, and the identified set S(E) (Peters–Bühlmann–Meinshausen 2016, eq:betapred, e ★ InvarianceNull★ identifiedSet★ mem_identifiedSet

Invariant Causal Prediction — regression-invariance null and identified set

The observable layer of the linear-Gaussian ICP problem: the regression predictor in each environment, the regression-invariance null H_{0,S}, and the identified set S(E) (Peters–Bühlmann–Meinshausen 2016, eq:betapred, eq:H0Sregr, eq:ident).

Encoding choices (fidelity notes)

* Residual. residual γ env ω := Yᵉ(ω) − Σ_k γ k · Xₖᵉ(ω) with the sum over all coordinates (γ is supported on S, so k ∉ S contributes nothing). This is R^e(S) of the paper (R^e = Y^e − X^e β).

* Support on S. "γ supported on S" is ∀ k, γ k ≠ 0 → k ∈ S (SupportedOn). This is the paper's constraint β_k = 0 if k ∉ S.

* Regression-invariance null H_{0,S}. This file uses a pairwise-coordinate version of the regression null: there exist a coefficient vector γ supported on S and a fixed residual law such that for every environment e, the residual R^e = Y^e − Σ γ_k X_k^e is (i) independent of each predictor coordinate in S and (ii) has law (the same law across environments). In this jointly Gaussian linear-Gaussian setting, coordinatewise independence of the residual from each X_k, k ∈ S, is equivalent to joint independence from the vector X_S, so this matches the Peters-Buhlmann-Meinshausen regression null despite the weaker-looking form. The paper also requires γ = β^{pred,e}(S) (the population-OLS coefficient); under independence of R^e from X_S^e that is automatic (the residual is orthogonal to X_S, i.e. the normal equations hold), so we fold it into the independence clause and do not carry β^{pred} as a separate object. The observational environment obs is included as one of the environments (it is e = 1), so invariance is genuinely across the whole family.

* Residual law as a measure on . Fε : Measure ℝ; "R^e ∼ Fε" is Pᵉ.map (residual γ (env e)) = Fε. Equivalently IdentDistrib across environments; we phrase it via a single shared measure so the "same law" is one object. The mean-shift proof only needs that the two laws differ, which a shared-measure formulation exposes directly (hLawObs, hLawEnv).

* Identified set S(E) (eq:ident). S(E) := ⋂ {S : H_{0,S} holds}. We encode the intersection over the (finite) powerset of predictors that satisfy the null.

def SupportedOn reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

γ is supported on S: every nonzero coordinate of γ lies in S (the paper's β_k = 0 if k ∉ S).

Definition (Lean source)
def SupportedOn (γ : Fin (p + 1) → ℝ) (S : Finset (Fin (p + 1))) : Prop := ∀ k, γ k ≠ 0 → k ∈ S
Causalean.Discovery.InvariantPrediction.LinearGaussian.SupportedOn · Causalean/Discovery/InvariantPrediction/LinearGaussian/Regression.lean:61
def obsResidual reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

The regression residual in the observational SEM: R = Y − Σ_k γ k · X_k (with γ supported on S, so only k ∈ S matter).

Definition (Lean source)
def obsResidual (M : ObsSEM p) (γ : Fin (p + 1) → ℝ) (ω : M.Ω) : ℝ := M.X ω (target p) - ∑ k, γ k * M.X ω k
Causalean.Discovery.InvariantPrediction.LinearGaussian.obsResidual · Causalean/Discovery/InvariantPrediction/LinearGaussian/Regression.lean:66 · uses ObsSEM
def envResidual reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian

The regression residual in an interventional environment, on M's space: R^e = Y^e − Σ_k γ k · X_k^e.

Definition (Lean source)
def envResidual {M : ObsSEM p} (e : Env M) (γ : Fin (p + 1) → ℝ) (ω : M.Ω) : ℝ := e.X ω (target p) - ∑ k, γ k * e.X ω k
Causalean.Discovery.InvariantPrediction.LinearGaussian.envResidual · Causalean/Discovery/InvariantPrediction/LinearGaussian/Regression.lean:71 · uses Env , ObsSEM
def InvarianceNull reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

Pairwise regression-invariance null.

Definition (Lean source)
def InvarianceNull (S : Finset (Fin (p + 1))) : Prop := ∃ (γ : Fin (p + 1) → ℝ) (Fε : Measure ℝ), SupportedOn γ S ∧ -- observational block `e = 1` (∀ k ∈ S, IndepFun (obsResidual F.obs γ) (fun ω => F.obs.X ω k) F.obs.P) ∧ F.obs.P.map (obsResidual F.obs γ) = Fε ∧ -- every interventional block shares the same `γ` and the same residual law -- (each do-environment lives on `M.Ω = F.obs.Ω` with measure `F.obs.P`) (∀ i, ∀ k ∈ S, IndepFun (envResidual (F.env i) γ) (fun ω => (F.env i).X ω k) F.obs.P) ∧ (∀ i, F.obs.P.map (envResidual (F.env i) γ) = Fε)
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.InvarianceNull · Causalean/Discovery/InvariantPrediction/LinearGaussian/Regression.lean:80 · uses EnvFamily
def invariantSets reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

The collection of predictor subsets S ⊆ {1,…,p} whose invariance null holds — the index set of the S(E) intersection (eq:ident).

Definition (Lean source)
noncomputable def invariantSets : Finset (Finset (Fin (p + 1))) := (predictors p).powerset.filter (fun S => F.InvarianceNull S)
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.invariantSets · Causalean/Discovery/InvariantPrediction/LinearGaussian/Regression.lean:111 · uses EnvFamily
def identifiedSet reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

The identified set S(E) := ⋂ {S : H_{0,S} holds} (eq:ident).

Definition (Lean source)
noncomputable def identifiedSet : Finset (Fin (p + 1)) := (F.invariantSets).inf id
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.identifiedSet · Causalean/Discovery/InvariantPrediction/LinearGaussian/Regression.lean:116 · uses EnvFamily
theorem mem_identifiedSet reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

For a predictor index k, k lies in the identified set S(E) exactly when k belongs to every predictor subset whose invariance null holds.

Formal statement
k :
Fin (p + 1)
k ∈ F.identifiedSet ↔ ∀ S ∈ F.invariantSets, k ∈ S
Proof (Lean source)
theorem mem_identifiedSet {k : Fin (p + 1)} : k ∈ F.identifiedSet ↔ ∀ S ∈ F.invariantSets, k ∈ S := by classical simp only [identifiedSet, Finset.mem_inf, id_eq]
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.mem_identifiedSet · Causalean/Discovery/InvariantPrediction/LinearGaussian/Regression.lean:125 · uses EnvFamily , identifiedSet , invariantSets
2 supporting declarations (lemmas, instances)
Completeness 7 core · 0 supporting The statement of Peters–Bühlmann–Meinshausen 2016, Theorem prop:1(i): for a linear-Gaussian SEM whose interventions are *do-interventions* with shifted values (a^e_j ≠ E[X¹_j]) and at least one single-node intervention o ★ HasShiftedSingleInterventions★ icp_sound_linearGaussian★ exists_youngest_nonzero★ residual_mean_shift_of_doIntervention★ icp_complete_linearGaussian

Invariant Causal Prediction — completeness for do-interventions (prop:1(i))

The statement of Peters–Bühlmann–Meinshausen 2016, Theorem prop:1(i): for a linear-Gaussian SEM whose interventions are do-interventions with shifted values (a^e_j ≠ E[X¹_j]) and at least one single-node intervention on every predictor, the identified set equals the parents of the target: S(E) = PA(Y).

The intermediate lemmas mirror the paper's appendix proof (app:proofs, "Proof of Theorem prop:1 (i)"):

1. Soundness icp_sound_linearGaussian (S(E) ⊆ PA(Y)) — H_{0,PA(Y)} holds with γ = γ* = β₀,· and residual ε₁, so PA(Y) is one of the intersected sets (propos:sem). 2. Youngest-node selection exists_youngest_nonzero — among the indices k with α_k ≠ 0 (α = γ* − β^{pred}(S)) there is one, k₀, with no directed path to any other such index (a sink in the induced subgraph). 3. Mean-shift residual_mean_shift_of_doIntervention — under the single do(X_{k₀} = a) intervention with a ≠ E[X¹_{k₀}] and α_{k₀} ≠ 0, the residual law in that environment differs from the observational one (their means differ by α_{k₀}·(a − E[X¹_{k₀}]) ≠ 0), contradicting invariance. 4. Completeness icp_complete_linearGaussian — combines 1–3: any null-satisfying S must contain PA(Y), so S(E) ⊇ PA(Y), and with soundness S(E) = PA(Y).

Encoding choices (fidelity notes)

* Single-intervention hypothesis (prop:1(i)). HasShiftedSingleInterventions: for each predictor j, some environment i has A i = {j} (single intervention on j) and a i j ≠ E[X¹_j] (the shift condition, with the mean taken under the observational law). This is exactly the paper's "`a^e_j ≠ E(X¹_j) and for each j ∈ {2,…,p+1} there is e with A^e = {j}`".

* E[X¹_j] is the observational mean ∫ ω, M.X ω j ∂P. Finiteness / integrability of the observational coordinates is bundled as hIntegrable (the Gaussian SEM has all moments; the theorem keeps this fact as an explicit integrability hypothesis rather than rebuilding Gaussian moment theory here).

* α and β^{pred}. The proof works with α k = γ*_k − γ_k for the null's coefficient γ (which, being orthogonal to X_S, is β^{pred}(S)). We do not introduce a separate β^{pred} object; α is defined inline in the lemmas.

* Exogeneity (the paper's Assumption 1). Soundness needs ε₀ ⊥ X_k for each parent k ∈ PA(Y). In a recursive Gaussian SEM this follows from joint noise independence + acyclicity, but the random-variable encoding here does not expose the ε → X solve, so it is carried as the structure fields ObsSEM.hYexo and Env.hExo (stated only for parents — it is false for descendants of Y).

* hyoung at the call site. residual_mean_shift_of_doIntervention takes a hyoung hypothesis — every other support index k ≠ k₀ with α_k ≠ 0 is not a descendant of k₀. In the completeness proof this is supplied exactly by the youngest-node selection (exists_youngest_nonzero over the support of α).

def obsMean reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

The observational mean of coordinate j: E[X¹_j] = ∫ X_j dP¹.

Definition (Lean source)
noncomputable def obsMean (j : Fin (p + 1)) : ℝ := ∫ ω, F.obs.X ω j ∂F.obs.P
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.obsMean · Causalean/Discovery/InvariantPrediction/LinearGaussian/Completeness.lean:79 · uses EnvFamily
def HasShiftedSingleInterventions reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

Do-intervention single-intervention hypothesis of prop:1(i): for every predictor j, some environment performs a single shifted do-intervention on j, i.e. A i = {j} and the assigned value differs from the observational mean a i j ≠ E[X¹_j].

Definition (Lean source)
def HasShiftedSingleInterventions : Prop := ∀ j ∈ predictors p, ∃ i : F.ι, (F.env i).A = {j} ∧ (F.env i).a j ≠ F.obsMean j
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.HasShiftedSingleInterventions · Causalean/Discovery/InvariantPrediction/LinearGaussian/Completeness.lean:82 · uses EnvFamily
def ObsIntegrable reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

Integrability of the observational coordinates (all Gaussian moments exist); carried as an explicit hypothesis so the observational means E[X¹_j] used by the shifted-intervention condition are available.

Definition (Lean source)
def ObsIntegrable : Prop := ∀ j, Integrable (fun ω => F.obs.X ω j) F.obs.P
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.ObsIntegrable · Causalean/Discovery/InvariantPrediction/LinearGaussian/Completeness.lean:90 · uses EnvFamily
theorem icp_sound_linearGaussian reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

Soundness (propos:sem). Assuming the observational predictor coordinates are integrable, so their means E[X¹_j] are well defined, the identified set is contained in the target's parents, S(E) ⊆ PA(Y).

Formal statement
_hInt :
F.ObsIntegrable
F.identifiedSet ⊆ F.paY
Proof (Lean source)
theorem icp_sound_linearGaussian (_hInt : F.ObsIntegrable) : F.identifiedSet ⊆ F.paY := by -- It suffices that `PA(Y)` itself satisfies the invariance null, since the -- identified set is contained in every invariant set. intro k hk rw [mem_identifiedSet] at hk refine hk F.paY ?_ rw [mem_invariantSets] refine ⟨F.obs.paY_subset_predictors, ?_⟩ -- Witness: causal coefficient `γ* = β₀,·` and residual law `N(0, σ₀²)`. refine ⟨causalCoeff F.obs, gaussianReal 0 ⟨(F.obs.σ (target p)) ^ 2, by positivity⟩, ?_, ?_, ?_, ?_, ?_⟩ · -- `SupportedOn γ* PA(Y)`: `β₀ₖ ≠ 0 ↔ k ∈ PA(Y)`. intro k hk0 exact F.obs.mem_paY.mpr hk0 · -- Observational independence clause: residual `=ᵐ ε₀`, then `hYexo`. intro k hkPaY have hedge : F.obs.dag.edge k (target p) := F.obs.dag.mem_parents.mp hkPaY exact (F.obs.hYexo k hedge).congr (Filter.EventuallyEq.symm (obsResidual_eq_eps F.obs)) (Filter.EventuallyEq.refl _ _) · -- Observational law clause: `P.map residual = P.map ε₀ = N(0, σ₀²)`. rw [Measure.map_congr (obsResidual_eq_eps F.obs), F.obs.hGauss (target p)] · -- Interventional independence clause: residual `=ᵐ ε₀`, then `(env i).hExo`. intro i k hkPaY have hedge : F.obs.dag.edge k (target p) := F.obs.dag.mem_parents.mp hkPaY exact ((F.env i).hExo k hedge).congr (Filter.EventuallyEq.symm (envResidual_eq_eps F.obs (F.env i))) (Filter.EventuallyEq.refl _ _) · -- Interventional law clause: same as observational via `=ᵐ ε₀`. intro i rw [Measure.map_congr (envResidual_eq_eps F.obs (F.env i)), F.obs.hGauss (target p)]
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.icp_sound_linearGaussian · Causalean/Discovery/InvariantPrediction/LinearGaussian/Completeness.lean:95 · uses EnvFamily , ObsIntegrable , identifiedSet , paY
theorem exists_youngest_nonzero reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

Youngest-node selection (the "youngest node X_{k₀}" step). Given a nonempty set of coordinate indices TT, there is an index k0Tk_0 \in T such that no other element of TT is a descendant of k0k_0 along the observational DAG's directed edges — i.e. k0k_0 is a sink of the subgraph induced by TT. This is the "youngest" node with non-zero α of the paper's proof.

Formal statement
T :
Finset (Fin (p + 1))
hT :
T.Nonempty
∃ k₀ ∈ T, ∀ k ∈ T, k ≠ k₀ → ¬ F.obs.dag.isAncestor k₀ k
Proof (Lean source)
theorem exists_youngest_nonzero (T : Finset (Fin (p + 1))) (hT : T.Nonempty) : ∃ k₀ ∈ T, ∀ k ∈ T, k ≠ k₀ → ¬ F.obs.dag.isAncestor k₀ k := by -- Pick the index of `T` with the largest topological order: it cannot be a -- proper ancestor of any other element, since ancestors strictly increase the -- topological order. obtain ⟨k₀, hk₀T, hmax⟩ := Finset.exists_max_image T (fun k => F.obs.dag.topoOrder k) hT refine ⟨k₀, hk₀T, ?_⟩ intro k hkT _ hanc have hlt : F.obs.dag.topoOrder k₀ < F.obs.dag.topoOrder k := F.obs.dag.isAncestor_topoOrder_lt hanc exact absurd (hmax k hkT) (Nat.not_le.mpr hlt)
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.exists_youngest_nonzero · Causalean/Discovery/InvariantPrediction/LinearGaussian/Completeness.lean:133 · uses isAncestor , EnvFamily
theorem residual_mean_shift_of_doIntervention reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

Residual mean-shift (eq:help1/eq:help2). Fix an observational SEM with integrable regressors, a candidate coefficient vector γ, and an index k₀ such that the gap α_{k₀} = β₀,k₀ − γ_{k₀} between the causal coefficient and γ at k₀ is nonzero. Suppose k₀ is a youngest such index: every other index with a nonzero coefficient gap is not a descendant of k₀ in the observational DAG, and let i be an environment consisting of a single do-intervention pinning coordinate k₀ to a value different from its observational mean. Then the residual R^i = Y^i − Σ γ_k X_k^i computed in environment i and the observational residual computed the same way do not have the same distribution, since they have different means.

Formal statement
hInt :
F.ObsIntegrable
γ :
Fin (p + 1) → ℝ
k₀ :
Fin (p + 1)
hk₀ :
(F.obs.β (target p) k₀ - γ k₀) ≠ 0
hyoung :
∀ k
if
k ≠ k₀
and
(F.obs.β (target p) k - γ k) ≠ 0
then
¬ F.obs.dag.isAncestor k₀ k
i :
F.ι
hAi :
(F.env i).A = {k₀}
hai :
(F.env i).a k₀ ≠ F.obsMean k₀
¬ IdentDistrib (envResidual (F.env i) γ) (obsResidual F.obs γ) F.obs.P F.obs.P
Proof (Lean source)
theorem residual_mean_shift_of_doIntervention (hInt : F.ObsIntegrable) (γ : Fin (p + 1) → ℝ) (k₀ : Fin (p + 1)) (hk₀ : (F.obs.β (target p) k₀ - γ k₀) ≠ 0) (hyoung : ∀ k, k ≠ k₀ → (F.obs.β (target p) k - γ k) ≠ 0 → ¬ F.obs.dag.isAncestor k₀ k) (i : F.ι) (hAi : (F.env i).A = {k₀}) (hai : (F.env i).a k₀ ≠ F.obsMean k₀) : ¬ IdentDistrib (envResidual (F.env i) γ) (obsResidual F.obs γ) F.obs.P F.obs.P := by classical set M := F.obs with hM set e := F.env i with he -- `α k = β₀ₖ − γ k`. set α : Fin (p + 1) → ℝ := fun k => M.β (target p) k - γ k with hα -- `k₀ ≠ 0`: the intervention never targets `Y`, and `A = {k₀}`. have hk₀ne : k₀ ≠ target p := by intro h; subst h; exact e.hAtarget (by rw [hAi]; exact mem_singleton_self _) -- ---- Residual rewrites: `R = ε₀ + Σ_k α_k X_k` (both worlds). ---- -- `Σ α_k x_k = Σ β₀ₖ x_k − Σ γ_k x_k`. have hαsum : ∀ x : Fin (p + 1) → ℝ, ∑ k, α k * x k = (∑ k, M.β (target p) k * x k) - ∑ k, γ k * x k := by intro x rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl; intro k _; simp only [hα]; ring have hobsR : ∀ᵐ ω ∂M.P, obsResidual M γ ω = M.ε ω (target p) + ∑ k, α k * M.X ω k := by filter_upwards [M.hε] with ω hω have hX0 : M.X ω (target p) = M.ε ω (target p) + ∑ k, M.β (target p) k * M.X ω k := by rw [sum_causalCoeff_eq M (M.X ω)]; rw [hω (target p)]; ring simp only [obsResidual, hX0, hαsum (M.X ω)]; ring have henvR : ∀ᵐ ω ∂M.P, envResidual e γ ω = M.ε ω (target p) + ∑ k, α k * e.X ω k := by filter_upwards [e.hDoStruct (target p) e.hAtarget] with ω hω have hX0 : e.X ω (target p) = M.ε ω (target p) + ∑ k, M.β (target p) k * e.X ω k := by rw [sum_causalCoeff_eq M (e.X ω), hω] simp only [envResidual, hX0, hαsum (e.X ω)]; ring -- ---- Integrability of each summand. ---- -- obs: `α k * X_k` is integrable. have hobsTermInt : ∀ k, Integrable (fun ω => α k * M.X ω k) M.P := fun k => (hInt k).const_mul _ -- env: `α k * X_kᵉ` is integrable: either `α k = 0` (zero function) or `X_kᵉ` -- agrees a.e. with an integrable function (`a` const if `k = k₀`, `X_k` else). have hAk₀ : ∀ᵐ ω ∂M.P, e.X ω k₀ = e.a k₀ := e.hDoPin k₀ (by rw [hAi]; exact mem_singleton_self _) have henvEqObs : ∀ k, k ≠ k₀ → ¬ M.dag.isAncestor k₀ k → ∀ᵐ ω ∂M.P, e.X ω k = M.X ω k := by intro k hk hanc filter_upwards [nonDescendant_invariance M e k₀ hAi] with ω hω using hω k hk hanc have henvTermInt : ∀ k, Integrable (fun ω => α k * e.X ω k) M.P := by intro k by_cases hαk : α k = 0 · simp [hαk] · by_cases hkk₀ : k = k₀ · -- `k = k₀`: `e.X · k =ᵐ e.a k₀` (do-pin), so `α k * e.X · k =ᵐ α k * e.a k₀`. subst hkk₀ refine (integrable_const (α k * e.a k)).congr ?_ filter_upwards [hAk₀] with ω hω using by rw [hω] · -- `k ≠ k₀` and `α k ≠ 0`, so `k` is a non-descendant of `k₀`. have hanc : ¬ M.dag.isAncestor k₀ k := hyoung k hkk₀ hαk refine ((hInt k).const_mul (α k)).congr ?_ filter_upwards [henvEqObs k hkk₀ hanc] with ω hω using by rw [hω] -- ---- Compute the two means. ---- have hεInt : Integrable (fun ω => M.ε ω (target p)) M.P := eps_integrable M (target p) have hobsMean : ∫ ω, obsResidual M γ ω ∂M.P = ∑ k, α k * (∫ ω, M.X ω k ∂M.P) := by rw [integral_congr_ae hobsR] rw [integral_add hεInt (integrable_finset_sum _ (fun k _ => hobsTermInt k))] rw [eps_integral_zero M (target p), zero_add, integral_finset_sum _ (fun k _ => hobsTermInt k)] apply Finset.sum_congr rfl; intro k _; rw [integral_const_mul] have henvMean : ∫ ω, envResidual e γ ω ∂M.P = ∑ k, α k * (∫ ω, e.X ω k ∂M.P) := by rw [integral_congr_ae henvR] rw [integral_add hεInt (integrable_finset_sum _ (fun k _ => henvTermInt k))] rw [eps_integral_zero M (target p), zero_add, integral_finset_sum _ (fun k _ => henvTermInt k)] apply Finset.sum_congr rfl; intro k _; rw [integral_const_mul] -- ---- The mean gap is the single `k₀` term. ---- have hgap : ∫ ω, envResidual e γ ω ∂M.P - ∫ ω, obsResidual M γ ω ∂M.P = α k₀ * (e.a k₀ - F.obsMean k₀) := by rw [henvMean, hobsMean, ← Finset.sum_sub_distrib] -- Each term: `α k * (E[X_kᵉ] − E[X_k])`. Only `k = k₀` survives. have hterm : ∀ k ∈ univ, k ≠ k₀ → α k * (∫ ω, e.X ω k ∂M.P) - α k * (∫ ω, M.X ω k ∂M.P) = 0 := by intro k _ hkk₀ by_cases hαk : α k = 0 · simp [hαk] · have hanc : ¬ M.dag.isAncestor k₀ k := hyoung k hkk₀ hαk have : (∫ ω, e.X ω k ∂M.P) = (∫ ω, M.X ω k ∂M.P) := integral_congr_ae (henvEqObs k hkk₀ hanc) rw [this]; ring rw [Finset.sum_eq_single k₀ hterm (by simp)] -- `E[X_{k₀}ᵉ] = a k₀` (do-pin); `E[X_{k₀}] = obsMean k₀`. have hEnvk₀ : (∫ ω, e.X ω k₀ ∂M.P) = e.a k₀ := by rw [integral_congr_ae hAk₀, integral_const]; simp rw [hEnvk₀] simp only [EnvFamily.obsMean]; ring -- ---- Different means ⟹ not IdentDistrib. ---- intro hid have heq : ∫ ω, envResidual e γ ω ∂M.P = ∫ ω, obsResidual M γ ω ∂M.P := hid.integral_eq rw [heq, sub_self] at hgap exact (mul_ne_zero hk₀ (sub_ne_zero.mpr hai)) hgap.symm
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.residual_mean_shift_of_doIntervention · Causalean/Discovery/InvariantPrediction/LinearGaussian/Completeness.lean:151 · uses isAncestor , EnvFamily , ObsIntegrable , obsMean , envResidual , obsResidual , target
theorem icp_complete_linearGaussian reviewed
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily

Completeness for do-interventions — Theorem prop:1(i). For an observational linear-Gaussian SEM with integrable regressors such that every predictor jj receives at least one environment with a single do-intervention Ae={j}A^e = \{j\} whose shifted value ajea^e_j differs from its observational mean E[Xj1]E[X^1_j], the ICP identified set — the intersection of all invariant predictor sets — equals exactly the parent set of the target node, S(E)=PA(Y)S(E) = PA(Y).

Formal statement
hInt :
F.ObsIntegrable
hInterv :
F.HasShiftedSingleInterventions
F.identifiedSet = F.paY
Proof (Lean source)
theorem icp_complete_linearGaussian (hInt : F.ObsIntegrable) (hInterv : F.HasShiftedSingleInterventions) : F.identifiedSet = F.paY := by classical apply le_antisymm (icp_sound_linearGaussian F hInt) -- `PA(Y) ⊆ S(E)`: every parent lies in every invariant set. intro pp hpp rw [mem_identifiedSet] intro S hS rw [mem_invariantSets] at hS obtain ⟨hSpred, γ, Fε, hSupp, _, hObsLaw, _, hEnvLaw⟩ := hS -- It suffices to show `PA(Y) ⊆ S`. by_contra hppS -- `α k = β₀ₖ − γ k`. Its support `T` is nonempty (contains `pp`). set α : Fin (p + 1) → ℝ := fun k => F.obs.β (target p) k - γ k with hα -- `α pp ≠ 0`: `pp ∈ paY` gives `β₀,pp ≠ 0`, and `pp ∉ S` gives `γ pp = 0`. have hγpp : γ pp = 0 := by by_contra h; exact hppS (hSupp pp h) have hαpp : α pp ≠ 0 := by simp only [hα, hγpp, sub_zero] exact F.obs.mem_paY.mp hpp set T : Finset (Fin (p + 1)) := Finset.univ.filter (fun k => α k ≠ 0) with hT have hppT : pp ∈ T := by rw [hT]; simp [hαpp] have hTne : T.Nonempty := ⟨pp, hppT⟩ -- Youngest index of the support. obtain ⟨k₀, hk₀T, hk₀young⟩ := F.exists_youngest_nonzero T hTne have hαk₀ : α k₀ ≠ 0 := by rw [hT] at hk₀T; simpa using hk₀T -- `hyoung` for the mean-shift lemma: every other support index is a non-ancestor. have hyoung : ∀ k, k ≠ k₀ → (F.obs.β (target p) k - γ k) ≠ 0 → ¬ F.obs.dag.isAncestor k₀ k := by intro k hk hαk exact hk₀young k (by rw [hT]; simp [α, hαk]) hk -- `k₀` is a predictor (`k₀ ≠ 0`): either `γ k₀ ≠ 0` (so `k₀ ∈ S ⊆ predictors`) or -- `β₀,k₀ ≠ 0` (so `k₀ ∈ paY ⊆ predictors`). have hk₀pred : k₀ ∈ predictors p := by by_cases hγk₀ : γ k₀ = 0 · -- `β₀,k₀ = α k₀ ≠ 0`, so `k₀ ∈ paY`. have : F.obs.β (target p) k₀ ≠ 0 := by have : α k₀ = F.obs.β (target p) k₀ := by simp [hα, hγk₀] rwa [this] at hαk₀ exact F.obs.paY_subset_predictors (F.obs.mem_paY.mpr this) · exact hSpred (hSupp k₀ hγk₀) -- A single shifted do-intervention on `k₀`. obtain ⟨i, hAi, hai⟩ := hInterv k₀ hk₀pred -- The mean-shift lemma: residuals are NOT identically distributed. have hni := F.residual_mean_shift_of_doIntervention hInt γ k₀ hαk₀ hyoung i hAi hai -- But the invariance null says they share the law `Fε`, hence ARE identically -- distributed — contradiction. apply hni have hmeasObs : Measurable (obsResidual F.obs γ) := (F.obs.hXmeas (target p)).sub (measurable_sum _ (fun k _ => (F.obs.hXmeas k).const_mul _)) have hmeasEnv : Measurable (envResidual (F.env i) γ) := ((F.env i).hXmeas (target p)).sub (measurable_sum _ (fun k _ => ((F.env i).hXmeas k).const_mul _)) refine ⟨hmeasEnv.aemeasurable, hmeasObs.aemeasurable, ?_⟩ rw [hEnvLaw i, hObsLaw]
Causalean.Discovery.InvariantPrediction.LinearGaussian.EnvFamily.icp_complete_linearGaussian · Causalean/Discovery/InvariantPrediction/LinearGaussian/Completeness.lean:276 · uses EnvFamily , HasShiftedSingleInterventions , ObsIntegrable , identifiedSet , paY