Discovery.Invariant­Prediction

Entry point for the formalization of Peters, Bühlmann & Meinshausen, *Causal inference using invariant prediction: identification and confidence intervals* (JRSS-B 2016, arXiv:1501.01332).

Helpers 6 core · 15 supporting · 1 submodule Measure-theoretic and structural helper lemmas for invariant prediction, especially target-mechanism factorization and environment-invariance arguments. Linear­Gaussian 27 core · 7 supporting · 4 submodules 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).
Model 6 core · 3 supporting Formalization of the setup of Peters, Bühlmann & Meinshausen, *Causal inference using invariant prediction* (JRSS-B 2016, arXiv:1501.01332). ★ EnvFamily★ paFix_eq

Invariant Causal Prediction: environment-family model layer

Formalization of the setup of Peters, Bühlmann & Meinshausen, Causal inference using invariant prediction (JRSS-B 2016, arXiv:1501.01332).

An environment family is a finite collection of structural causal models {M i} over a common set of observed and latent variables, indexed by an environment label i. Each M i arises from interventions that may differ between environments, but never act on the target node Y: every environment shares the target's structural mechanism (hStruct), the target's parent set (hParents), and the latent-noise law (hLatent). Each environment also carries the values s i assigned to its intervened (fixed) coordinates, because an intervention do(X = x) fixes those coordinates to x.

The only observable content per environment is the conditional law of the target Y given a set of predictors X_S, read off from (M i).obsCondKernel {Y} S evaluated at s i. Invariant Causal Prediction asks which predictor sets S make this conditional law the same across all environments.

structure EnvFamily reviewed
Causalean.Discovery.InvariantPrediction

An environment family for Invariant Causal Prediction (Peters, Bühlmann & Meinshausen 2016) bundles a finite, Fintype-indexed collection of structural causal models sharing a common target variable that every environment observes, a common observed-variable set, and a common latent-variable set. The environments never intervene on the target: they share the target's parent set, the target's structural mechanism, and the latent-noise law, while each environment carries the values assigned to its own intervened coordinates. It further packages the regularity needed to disintegrate the joint law into the target's conditional law given any predictor set — a standard Borel and nonempty target value space, and countable generation of the relevant kernels, and states the exogeneity assumption that in every environment the target's exogenous (latent) parents are independent of its observed parents under the joint law.

Definition (Lean source)
N :
Ω :
N → Type*
∀ n, MeasurableSpace (Ω n)
ι :
Type*
The structural causal model in each environment.
M :
ι → SCM N Ω
The target variable; the target node is `SWIGNode.random Y`.
Y :
N
Every environment observes the target.
hYobs :
∀ i, SWIGNode.random Y ∈ (M i).observed
All environments share the observed-variable set.
hObs :
∀ i j, (M i).observed = (M j).observed
All environments share the latent-variable set.
hUnobs :
∀ i j, (M i).unobserved = (M j).unobserved
**(E4)** All environments share the target's parent set.
hParents :
∀ i j, (M i).dag.parents (SWIGNode.random Y) = (M j).dag.parents (SWIGNode.random Y)
**(E2)** All environments share the target's structural mechanism.
hStruct :
∀ i j,
HEq ((M i).structFun ⟨SWIGNode.random Y, hYobs i⟩) ((M j).structFun ⟨SWIGNode.random Y, hYobs j⟩)
**(E3)** All environments share the latent-noise law.
hLatent :
∀ i j, HEq (M i).latentDist (M j).latentDist
The values assigned to the intervened (fixed) coordinates in each environment (`do(X = x)` fixes `X` to `x`).
s :
∀ i, (M i).FixedValues
The target's value space is standard Borel (holds automatically when the coordinate spaces are standard Borel; bundled so the conditional-kernel disintegration machinery is always available).
borelTarget :
StandardBorelSpace (ValuesOn ({SWIGNode.random Y} : Finset (SWIGNode N)) (swigΩ Ω))
The target's value space is nonempty.
neTarget :
Nonempty (ValuesOn ({SWIGNode.random Y} : Finset (SWIGNode N)) (swigΩ Ω))
The disintegration obligation of `obsCondKernel` holds for every predictor set and environment (holds automatically for standard-Borel coordinates).
cg :
**Exogeneity** — the ICP invariance assumption `εᵉ ⊥ Xᵉ_{S*}` (Peters–Bühlmann– Meinshausen 2016, Assumption 1). In every environment, the target's exogenous (latent) parents are independent of its observed parents under the joint law. This rules out hidden confounding between `Y` and its parents, and is exactly what makes the conditional law of `Y` given its observed parents an environment-invariant structural factor (the engine of soundness).
hExo :
∀ i,
IndepFun (valuesProjection (Ω := swigΩ Ω) (show (M i).dag.parents (SWIGNode.random Y) ∩ (M i).unobserved ⊆ (M i).randomVars from (inter_subset_right).trans (by change (M i).unobserved ⊆ (M i).observed ∪ (M i).unobserved exact subset_union_right))) (valuesProjection (Ω := swigΩ Ω) (show (M i).dag.parents (SWIGNode.random Y) ∩ (M i).observed ⊆ (M i).randomVars from (inter_subset_right).trans (by change (M i).observed ⊆ (M i).observed ∪ (M i).unobserved exact subset_union_left))) ((M i).jointKernel (s i))
Causalean.Discovery.InvariantPrediction.EnvFamily · Causalean/Discovery/InvariantPrediction/Model.lean:40
abbrev yNode reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

The target node SWIGNode.random Y.

Definition (Lean source)
abbrev yNode : SWIGNode N := SWIGNode.random F.Y
Causalean.Discovery.InvariantPrediction.EnvFamily.yNode · Causalean/Discovery/InvariantPrediction/Model.lean:116 · uses EnvFamily , SWIGNode
def paObs reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

The observed parents of the target in environment i — the conditioning candidates ICP ranges over. Index-independent by hParents and hObs (see paObs_eq).

Definition (Lean source)
def paObs (i : ι) : Finset (SWIGNode N) := (F.M i).dag.parents F.yNode ∩ (F.M i).observed
Causalean.Discovery.InvariantPrediction.EnvFamily.paObs · Causalean/Discovery/InvariantPrediction/Model.lean:119 · uses EnvFamily , SWIGNode
def paFix reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

The fixed parents of the target in environment i — the parents of Y that are intervened on (fixed) in that environment. These are the coordinates of Y's mechanism whose values live in s i and may legitimately differ across environments; the redesigned Invariant predicate conditions on them.

Definition (Lean source)
def paFix (i : ι) : Finset (SWIGNode N) := (F.M i).dag.parents F.yNode ∩ (F.M i).fixed
Causalean.Discovery.InvariantPrediction.EnvFamily.paFix · Causalean/Discovery/InvariantPrediction/Model.lean:130 · uses EnvFamily , SWIGNode
theorem paFix_eq reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

For any two environments i and j, the fixed parents of the target coincide between environment i and environment j.

Formal statement
i j :
ι
F.paFix i = F.paFix j
Proof (Lean source)
theorem paFix_eq (i j : ι) : F.paFix i = F.paFix j := by classical apply Finset.ext intro d simp only [paFix, mem_inter] constructor · rintro ⟨hdp, hdf⟩ refine ⟨?_, F.fixed_parent_mem_fixed_of_mem (Finset.mem_inter.mpr ⟨hdp, hdf⟩)⟩ rw [← F.hParents i j]; exact hdp · rintro ⟨hdp, hdf⟩ refine ⟨?_, F.fixed_parent_mem_fixed_of_mem (Finset.mem_inter.mpr ⟨hdp, hdf⟩)⟩ rw [F.hParents i j]; exact hdp
Causalean.Discovery.InvariantPrediction.EnvFamily.paFix_eq · Causalean/Discovery/InvariantPrediction/Model.lean:164 · uses EnvFamily , paFix , SWIGNode
def fixedParentVals reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

The fixed-parent values assigned by environment i's intervention, projected from s i.

Definition (Lean source)
noncomputable def fixedParentVals (i : ι) : ValuesOn (F.paFix i) (swigΩ Ω) := valuesProjection (F.paFix_subset_fixed i) (F.s i)
Causalean.Discovery.InvariantPrediction.EnvFamily.fixedParentVals · Causalean/Discovery/InvariantPrediction/Model.lean:188 · uses EnvFamily , paFix , SWIGNode , ValuesOn , swigΩ
3 supporting declarations (lemmas, instances)
  • paObs_eq theorem — paObs does not depend on the chosen environment.
    i j :
    ι
    F.paObs i = F.paObs j
    Proof (Lean source)
    theorem paObs_eq (i j : ι) : F.paObs i = F.paObs j := by unfold paObs rw [F.hParents i j, F.hObs i j]
    Causalean.Discovery.InvariantPrediction.EnvFamily.paObs_eq · Causalean/Discovery/InvariantPrediction/Model.lean:125
  • fixed_parent_mem_fixed_of_mem theorem — A target parent that is fixed in one environment is fixed in every environment. The point is not that EnvFamily shares the whole fixed set, but that it shares the target parent set (E4), and a fixed-form SWIG node cannot be an observed or unobserved random-form node in the other environment, while a parent of Y is always classified as fixed/observed/unobserved (dag_edges_classified).
    i j :
    ι
    d :
    hd :
    d ∈ (F.M i).dag.parents F.yNode ∩ (F.M i).fixed
    d ∈ (F.M j).fixed
    Proof (Lean source)
    theorem fixed_parent_mem_fixed_of_mem {i j : ι} {d : SWIGNode N} (hd : d ∈ (F.M i).dag.parents F.yNode ∩ (F.M i).fixed) : d ∈ (F.M j).fixed := by classical have hd_parent_i : d ∈ (F.M i).dag.parents F.yNode := (Finset.mem_inter.mp hd).1 have hd_fixed_i : d ∈ (F.M i).fixed := (Finset.mem_inter.mp hd).2 have hd_parent_j : d ∈ (F.M j).dag.parents F.yNode := by rw [← F.hParents i j] exact hd_parent_i have hedge_j : (F.M j).dag.edge d F.yNode := (F.M j).dag.mem_parents.mp hd_parent_j have hclass_j : d ∈ (F.M j).fixed ∪ (F.M j).observed ∪ (F.M j).unobserved := ((F.M j).dag_edges_classified d F.yNode hedge_j).1 rcases (F.M i).fixed_is_fixed d hd_fixed_i with ⟨n, rfl⟩ rcases Finset.mem_union.mp hclass_j with hfo | hunobs · rcases Finset.mem_union.mp hfo with hfixed | hobs · exact hfixed · rcases (F.M j).observed_is_random (SWIGNode.fixed n) hobs with ⟨m, hm⟩ cases hm · rcases (F.M j).unobserved_is_random (SWIGNode.fixed n) hunobs with ⟨m, hm⟩ cases hm
    Causalean.Discovery.InvariantPrediction.EnvFamily.fixed_parent_mem_fixed_of_mem · Causalean/Discovery/InvariantPrediction/Model.lean:137
  • paFix_subset_fixed theorem — The fixed parents are a subset of the fixed coordinates, so they can be read off the environment's intervention assignment s i.
    i :
    ι
    F.paFix i ⊆ (F.M i).fixed
    Proof (Lean source)
    theorem paFix_subset_fixed (i : ι) : F.paFix i ⊆ (F.M i).fixed := inter_subset_right
    Causalean.Discovery.InvariantPrediction.EnvFamily.paFix_subset_fixed · Causalean/Discovery/InvariantPrediction/Model.lean:183
Identified­Set 3 core · 1 supporting The identified set S(E) is the intersection of all invariant predictor sets. ★ idSet★ paObs_mem_invariantSets

Invariant Causal Prediction: the identified set S(E)

The identified set S(E) is the intersection of all invariant predictor sets. By mechanism_invariant the target's observed parents are invariant, so the collection is nonempty and S(E) is contained in the parents — the soundness direction (proved in Soundness.lean).

def invariantSets reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

The collection of invariant predictor sets, viewed as sets of nodes.

Definition (Lean source)
def invariantSets (F : EnvFamily N Ω ι) : Set (Set (SWIGNode N)) := { T | ∃ (S : Finset (SWIGNode N)) (hS : ∀ i, S ⊆ (F.M i).observed), (↑S : Set (SWIGNode N)) = T ∧ F.Invariant S hS }
Causalean.Discovery.InvariantPrediction.EnvFamily.invariantSets · Causalean/Discovery/InvariantPrediction/IdentifiedSet.lean:29 · uses EnvFamily , SWIGNode
def idSet reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

The identified set S(E): the intersection of all invariant predictor sets across the environment family.

Definition (Lean source)
def idSet (F : EnvFamily N Ω ι) : Set (SWIGNode N) := ⋂₀ F.invariantSets
Causalean.Discovery.InvariantPrediction.EnvFamily.idSet · Causalean/Discovery/InvariantPrediction/IdentifiedSet.lean:34 · uses EnvFamily , SWIGNode
theorem paObs_mem_invariantSets reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

For an invariant-prediction environment family and an index i₀ selecting the target's observed-parent set, the target's observed parents form an invariant predictor set — the membership form of mechanism_invariant.

Formal statement
F :
EnvFamily N Ω ι
i₀ :
ι
(↑(F.paObs i₀) : Set (SWIGNode N)) ∈ F.invariantSets
Proof (Lean source)
theorem paObs_mem_invariantSets (F : EnvFamily N Ω ι) (i₀ : ι) : (↑(F.paObs i₀) : Set (SWIGNode N)) ∈ F.invariantSets := ⟨F.paObs i₀, (fun j => F.paObs_subset_observed i₀ j), rfl, F.mechanism_invariant i₀⟩
Causalean.Discovery.InvariantPrediction.EnvFamily.paObs_mem_invariantSets · Causalean/Discovery/InvariantPrediction/IdentifiedSet.lean:43 · uses EnvFamily , invariantSets , paObs , SWIGNode
1 supporting declaration (lemmas, instances)
Invariance 3 core · 1 supporting A predictor set S is invariant across an environment family when the conditional law of the target Y given X_S — read off from obsCondKernel {Y} S evaluated at each environment's intervention values s i — is the *same* i ★ Invariant★ mechanism_invariant

Invariant Causal Prediction: the invariance predicate and mechanism invariance

A predictor set S is invariant across an environment family when the conditional law of the target Y given X_S — read off from obsCondKernel {Y} S evaluated at each environment's intervention values s i — is the same in every environment.

The central structural fact is mechanism_invariant: the target's own observed parents paObs always form an invariant set, because conditioning on the parents exposes the target's structural mechanism, which every environment shares (hStruct/hLatent/hParents). This is the engine behind soundness (S(E) ⊆ PA(Y)).

Throughout we assume the per-coordinate value spaces are standard Borel and nonempty; the finite-measure and countably-generated obligations of obsCondKernel are threaded as instance hypotheses.

abbrev targetSet reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

The singleton node set {Y} used as the conditioned target.

Definition (Lean source)
abbrev targetSet (F : EnvFamily N Ω ι) : Finset (SWIGNode N) := {SWIGNode.random F.Y}
Causalean.Discovery.InvariantPrediction.EnvFamily.targetSet · Causalean/Discovery/InvariantPrediction/Invariance.lean:39 · uses EnvFamily , SWIGNode
def Invariant reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

S is invariant across the environment family F.

Definition (Lean source)
def Invariant (F : EnvFamily N Ω ι) (S : Finset (SWIGNode N)) (hS : ∀ i, S ⊆ (F.M i).observed) : Prop := haveI := F.borelTarget haveI := F.neTarget haveI : ∀ i, CountableOrCountablyGenerated ((F.M i).FixedValues) (ValuesOn S (swigΩ Ω)) := fun i => F.cg S i ∃ κ : (i : ι) → ValuesOn (F.paFix i) (swigΩ Ω) → ValuesOn S (swigΩ Ω) → Measure (ValuesOn F.targetSet (swigΩ Ω)), (∀ (i j : ι) (cf : ValuesOn (F.paFix i) (swigΩ Ω)), κ i cf = κ j (valuesProjection (le_of_eq (F.paFix_eq j i)) cf)) ∧ ∀ i : ι, (fun c => (F.M i).obsCondKernel F.targetSet S (Finset.singleton_subset_iff.mpr (F.hYobs i)) (hS i) (F.s i, c)) =ᵐ[((F.M i).obsKernel (F.s i)).map (valuesProjection (hS i))] (fun c => κ i (F.fixedParentVals i) c)
Causalean.Discovery.InvariantPrediction.EnvFamily.Invariant · Causalean/Discovery/InvariantPrediction/Invariance.lean:42 · uses EnvFamily , SWIGNode
theorem mechanism_invariant reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

Mechanism invariance (the heart of soundness). For an environment family and a target index i₀, the target's observed parents paObs form an invariant set: in every environment the conditional law of the target given its observed parents equals one fixed structural factor, so ICP never rejects the parents.

Formal statement
F :
EnvFamily N Ω ι
i₀ :
ι
F.Invariant (F.paObs i₀) (fun j => F.paObs_subset_observed i₀ j)
Proof (Lean source)
theorem mechanism_invariant (F : EnvFamily N Ω ι) (i₀ : ι) : F.Invariant (F.paObs i₀) (fun j => F.paObs_subset_observed i₀ j) := by classical haveI := F.borelTarget haveI := F.neTarget -- The latent-parent set is a random-variable subset in every environment. have hLrvOf : ∀ i : ι, F.paLat i ⊆ (F.M i).randomVars := fun i => (inter_subset_right).trans (by change (F.M i).unobserved ⊆ (F.M i).observed ∪ (F.M i).unobserved exact subset_union_right) -- The witness conditional law `κ`: the mechanism factor for environment `i`, -- parameterized by the explicit fixed-parent values `cf`. refine ⟨fun i cf _c => mechanismKernel (((F.M i).jointKernel (F.s i)).map (valuesProjection (hLrvOf i))) (F.mechanismFunCf i₀ i cf) _c, ?_, ?_⟩ · -- Coherence across environments: `κ i cf = κ j (transport cf)`. intro i j cf funext c exact congrFun (congrArg coe (F.mechanismKernel_cf_env_eq i₀ i j cf (hLrvOf i) (hLrvOf j))) c · -- Per-environment a.e. equality at environment `i`'s own fixed-parent values. intro i have hPrv : F.paObs i₀ ⊆ (F.M i).randomVars := by rw [F.paObs_eq i₀ i] exact (inter_subset_right).trans (by change (F.M i).observed ⊆ (F.M i).observed ∪ (F.M i).unobserved exact subset_union_left) -- Rewrite the ambient a.e. measure from `obsKernel` to `jointKernel`. rw [obsKernel_map_valuesProjection_eq_jointKernel_map (F.M i) (F.s i) (F.paObs i₀) (F.paObs_subset_observed i₀ i) hPrv] -- `obsCondKernel =ᵐ condDistrib =ᵐ mechanismKernel(..., mechanismFun i₀ i)`, -- and `mechanismFunCf i₀ i (fixedParentVals i) = mechanismFun i₀ i`. have hStep1 := F.obsCondKernel_ae_eq_joint_condDistrib i₀ i have hStep2 := F.condDistrib_target_eq_mechanismKernel i₀ i simp only [F.mechanismFunCf_fixedParentVals i₀ i] exact hStep1.trans hStep2
Causalean.Discovery.InvariantPrediction.EnvFamily.mechanism_invariant · Causalean/Discovery/InvariantPrediction/Invariance.lean:178 · uses EnvFamily , Invariant , paObs , paObs_subset_observed
1 supporting declaration (lemmas, instances)
Soundness 1 core · 0 supporting This file proves the soundness theorem for invariant causal prediction: icp_sound states that the identified set S(E) is contained in the target's observed parents PA(Y). ★ icp_sound

Invariant Causal Prediction: soundness

This file proves the soundness theorem for invariant causal prediction: icp_sound states that the identified set S(E) is contained in the target's observed parents PA(Y). Thus every variable selected by ICP is a genuine direct cause in the observed parent set.

The proof is the formal version of the standard Theorem 1 argument. The parent set is itself invariant (paObs_mem_invariantSets), and the ICP identified set is the intersection of all invariant sets (idSet_subset_of_mem), so it must be contained in the parents.

theorem icp_sound reviewed
Causalean.Discovery.InvariantPrediction.EnvFamily

Theorem 1 (soundness). For an environment family and an index i₀ selecting the target's observed-parent set, the identified set is contained in the target's observed parents: every node selected by ICP is a genuine direct cause.

Formal statement
F :
EnvFamily N Ω ι
i₀ :
ι
F.idSet ⊆ (↑(F.paObs i₀) : Set (SWIGNode N))
Proof (Lean source)
theorem icp_sound (F : EnvFamily N Ω ι) (i₀ : ι) : F.idSet ⊆ (↑(F.paObs i₀) : Set (SWIGNode N)) := F.idSet_subset_of_mem (F.paObs_mem_invariantSets i₀)
Causalean.Discovery.InvariantPrediction.EnvFamily.icp_sound · Causalean/Discovery/InvariantPrediction/Soundness.lean:34 · uses EnvFamily , idSet , paObs , SWIGNode