SCM.ID.Density.Mech­CFactor

Tian's c-factor Q[S] of a set S of observed variables, defined through the causal mechanisms: the density on S of the law obtained by intervening on every observed variable outside S.

Basic 5 core · 5 supporting This file defines the do-complement intervention and its marginal measure QmechMeasure, relates singleton values of that measure to qLocalMass, and proves the fixed-edge facts needed for valid interventions. ★ QmechMeasure_singleton_eq_qLocalMass

The mechanism c-factor and do-complement measure

This file defines the do-complement intervention and its marginal measure QmechMeasure, relates singleton values of that measure to qLocalMass, and proves the fixed-edge facts needed for valid interventions. The density-level invariance and observational comparison are developed in sibling files.

def mechComplementNames reviewed
Causalean.SCM

For a finite node set with measurable node-value spaces, a structural causal model and a set of SWIG nodes, the mechanism-complement node set consists exactly of the base nodes whose random copy is observed but absent from the given set and whose fixed copy is not already fixed in the model.

Definition (Lean source)
N :
Type u_1
N → Type u_2
shared
M :
SCM N Ω
S :
mechComplementNames M S :
Finset.univ.filter fun n => SWIGNode.random n ∈ M.observed \ S ∧
SWIGNode.fixed n ∉ M.fixed
Causalean.SCM.mechComplementNames · Causalean/SCM/ID/Density/MechCFactor/Basic.lean:41 · uses SWIGNode , SCM
def mechDoValues reviewed
Causalean.SCM

For a finite node set with measurable node-value spaces, a structural causal model, a set of SWIG nodes, an assignment to the model's already fixed nodes, and a full assignment to its observed nodes, the do-complement fixed-node assignment extends the original fixed-node assignment by assigning each mechanism-complement node the value of its random copy in the observed assignment.

Definition (Lean source)
N :
Type u_1
N → Type u_2
shared
M :
SCM N Ω
S :
s :
M.FixedValues
x :
ValuesOn M.observed (swigΩ Ω)
mechDoValues M S s x :
(M.fixSet (M.mechComplementNames S) (M.mechComplementNames_random_mem_observed S) (M.mechComplementNames_fixed_not_mem S)).FixedValues
M.fixSetExtend (M.mechComplementNames S) (M.mechComplementNames_random_mem_observed S) (M.mechComplementNames_fixed_not_mem S) s (valuesProjection (M.mechComplementNames_image_random_subset_observed S) x)
def QmechMeasure reviewed
Causalean.SCM

For a finite node set with measurable node-value spaces, a structural causal model, a set of SWIG nodes contained in its observed-node set, and an assignment to the fixed nodes of the model obtained by intervening on its mechanism complement, the mechanism Q[S]Q[S] measure is the intervened model's observational law projected onto the given SWIG-node set.

Definition (Lean source)
N :
Type u_1
N → Type u_2
shared
M :
SCM N Ω
S :
hS :
S ⊆ M.observed
sWn :
(M.fixSet (M.mechComplementNames S) (M.mechComplementNames_random_mem_observed S) (M.mechComplementNames_fixed_not_mem S)).FixedValues
QmechMeasure M S hS sWn :
((M.fixSet (M.mechComplementNames S) (M.mechComplementNames_random_mem_observed S) (M.mechComplementNames_fixed_not_mem S)).obsKernel sWn).map (valuesProjection (show S ⊆ (M.fixSet (M.mechComplementNames S) (M.mechComplementNames_random_mem_observed S) (M.mechComplementNames_fixed_not_mem S)).observed by simpa [fixSet_observed] using hS))
def mechCFactor reviewed
Causalean.SCM

For a finite node set with measurable node-value spaces, a structural causal model, a family of reference measures, a set of SWIG nodes contained in the model's observed-node set, and an assignment to the model's fixed nodes, the mechanism c-factor density maps every full observed-node assignment to the Radon--Nikodym derivative of the corresponding mechanism Q[S]Q[S] measure with respect to the product reference measure on the given node set, evaluated at that assignment's restriction to the set.

Definition (Lean source)
N :
Type u_1
N → Type u_2
shared
M :
SCM N Ω
S :
hS :
S ⊆ M.observed
s :
M.FixedValues
mechCFactor M ref S hS s :
ValuesOn M.observed (swigΩ Ω) → ENNReal
fun x
=> (QmechMeasure M S hS (M.mechDoValues S s x)).rnDeriv (jointRef ref S) (valuesProjection hS x)
theorem QmechMeasure_singleton_eq_qLocalMass reviewed
Causalean.SCM

For a finite structural causal model with finite measurable node-value spaces, an observed node set, evidence that the set is observed, the condition that fixed nodes have no outgoing random-copy edges, a fixed-node assignment, and an observed realization, the singleton mass under the complementary intervention equals the local q-mass of that node set.

Formal statement
N :
Type u_1
N → Type u_2
shared
∀ n, Fintype (Ω n)
M :
SCM N Ω
S :
hS :
S ⊆ M.observed
hfe :
∀ n : N
if
SWIGNode.fixed n ∈ M.fixed
then
∀ v : SWIGNode N, ¬ M.dag.edge (SWIGNode.random n) v
s :
M.FixedValues
x :
ValuesOn M.observed (swigΩ Ω)
QmechMeasure M S hS (M.mechDoValues S s x) {valuesProjection hS x} = M.qLocalMass s S hS x
Proof (Lean source)
theorem QmechMeasure_singleton_eq_qLocalMass [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (S : Finset (SWIGNode N)) (hS : S ⊆ M.observed) (hfe : ∀ n : N, SWIGNode.fixed n ∈ M.fixed → ∀ v : SWIGNode N, ¬ M.dag.edge (SWIGNode.random n) v) (s : M.FixedValues) (x : ValuesOn M.observed (swigΩ Ω)) : QmechMeasure M S hS (M.mechDoValues S s x) {valuesProjection hS x} = M.qLocalMass s S hS x := by classical let W := M.mechComplementNames S let hWobs := M.mechComplementNames_random_mem_observed S let hWfix := M.mechComplementNames_fixed_not_mem S let M' := M.fixSet W hWobs hWfix let s' : M'.FixedValues := M.mechDoValues S s x have hclosed : M'.ObsParentClosed S := by simpa [M', W, hWobs, hWfix] using mechComplement_fixSet_obsParentClosed M S hS hfe let hS' : S ⊆ M'.observed := hclosed.1 have hbridge := obsKernel_marginal_singleton_eq_latentProduct_agree M' s' hS' x have heval_local : {ℓ | ∀ v : {v // v ∈ S}, M'.evalMap s' ℓ ⟨v.val, mem_union_left M'.unobserved (hS' v.property)⟩ = x ⟨v.val, hS' v.property⟩} = {ℓ | ∀ v (hv : v ∈ S), M'.localConsistent s' x v (hS' hv) ℓ} := by ext ℓ constructor · intro hEval exact (M'.evalMap_agree_iff_localConsistent s' S hclosed x ℓ).mp (fun v hv => hEval ⟨v, hv⟩) · intro hLocal v exact (M'.evalMap_agree_iff_localConsistent s' S hclosed x ℓ).mpr hLocal v.val v.property have hobsAgree : ∀ w (hw : w ∈ M.observed), x ⟨w, by simpa [M', W, hWobs, hWfix, fixSet_observed] using hw⟩ = x ⟨w, hw⟩ := by intro w hw rfl have hpin : ∀ D (hD : D ∈ W), x ⟨SWIGNode.random D, hWobs D hD⟩ = s' ⟨SWIGNode.fixed D, mem_union_right _ (Finset.mem_image.mpr ⟨D, hD, rfl⟩)⟩ := by intro D hD have hnew := M.fixSetExtend_apply_new_fixed W hWobs hWfix s (valuesProjection (M.mechComplementNames_image_random_subset_observed S) x) hD simp only [s', mechDoValues] exact hnew.symm have hproj : M.fixSetProj W hWobs hWfix s' = s := by simpa [s', W, hWobs, hWfix, mechDoValues] using (M.fixSetProj_fixSetExtend W hWobs hWfix s (valuesProjection (M.mechComplementNames_image_random_subset_observed S) x)) have hset_do : {ℓ | ∀ v (hv : v ∈ S), M'.localConsistent s' x v (hS' hv) ℓ} = {ℓ | ∀ v (hv : v ∈ S), M.localConsistent s x v (hS hv) ℓ} := by ext ℓ constructor · intro hLocal v hv have hnot : v ∉ W.image SWIGNode.random := by intro hvW rcases Finset.mem_image.mp hvW with ⟨D, hD, rfl⟩ exact (Finset.mem_sdiff.mp (Finset.mem_filter.mp hD).2.1).2 hv exact (localConsistent_fixSet_iff M W hWobs hWfix s' s x x v (hS' hv) (hS hv) hnot hobsAgree hpin hproj ℓ).mp (hLocal v hv) · intro hLocal v hv have hnot : v ∉ W.image SWIGNode.random := by intro hvW rcases Finset.mem_image.mp hvW with ⟨D, hD, rfl⟩ exact (Finset.mem_sdiff.mp (Finset.mem_filter.mp hD).2.1).2 hv exact (localConsistent_fixSet_iff M W hWobs hWfix s' s x x v (hS' hv) (hS hv) hnot hobsAgree hpin hproj ℓ).mpr (hLocal v hv) calc QmechMeasure M S hS (M.mechDoValues S s x) {valuesProjection hS x} = ((M'.obsKernel s').map (valuesProjection hS')) {valuesProjection hS' x} := by rfl _ = M'.latentProduct {ℓ | ∀ v : {v // v ∈ S}, M'.evalMap s' ℓ ⟨v.val, mem_union_left M'.unobserved (hS' v.property)⟩ = x ⟨v.val, hS' v.property⟩} := hbridge _ = M'.latentProduct {ℓ | ∀ v (hv : v ∈ S), M'.localConsistent s' x v (hS' hv) ℓ} := by rw [heval_local] _ = M.latentProduct {ℓ | ∀ v (hv : v ∈ S), M.localConsistent s x v (hS hv) ℓ} := by rw [hset_do] rfl _ = M.qLocalMass s S hS x := by rfl
5 supporting declarations (lemmas, instances)
  • mechComplementNames_random_mem_observed lemma — Every mechanism-complement variable has its random copy among the observed nodes.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    S :
    n ∈ M.mechComplementNames S :
    SWIGNode.random n ∈ M.observed
    Proof (Lean source)
    lemma mechComplementNames_random_mem_observed (M : SCM N Ω) (S : Finset (SWIGNode N)) : ∀ n ∈ M.mechComplementNames S, SWIGNode.random n ∈ M.observed := by intro n hn exact (Finset.mem_sdiff.mp (Finset.mem_filter.mp hn).2.1).1
    Causalean.SCM.mechComplementNames_random_mem_observed · Causalean/SCM/ID/Density/MechCFactor/Basic.lean:55
  • mechComplementNames_fixed_not_mem lemma — Every mechanism-complement variable has a fixed copy that is not already fixed.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    S :
    n ∈ M.mechComplementNames S :
    SWIGNode.fixed n ∉ M.fixed
    Proof (Lean source)
    lemma mechComplementNames_fixed_not_mem (M : SCM N Ω) (S : Finset (SWIGNode N)) : ∀ n ∈ M.mechComplementNames S, SWIGNode.fixed n ∉ M.fixed := by intro n hn exact (Finset.mem_filter.mp hn).2.2
    Causalean.SCM.mechComplementNames_fixed_not_mem · Causalean/SCM/ID/Density/MechCFactor/Basic.lean:62
  • mechComplementNames_image_random_subset_observed lemma — The random copies of the mechanism-complement variables form a subset of the observed nodes.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    S :
    (M.mechComplementNames S).image SWIGNode.random ⊆ M.observed
    Proof (Lean source)
    lemma mechComplementNames_image_random_subset_observed (M : SCM N Ω) (S : Finset (SWIGNode N)) : (M.mechComplementNames S).image SWIGNode.random ⊆ M.observed := by intro v hv rcases Finset.mem_image.mp hv with ⟨n, hn, rfl⟩ exact M.mechComplementNames_random_mem_observed S n hn
    Causalean.SCM.mechComplementNames_image_random_subset_observed · Causalean/SCM/ID/Density/MechCFactor/Basic.lean:69
  • standard_fixed_random_edgeless lemma — A standard structural causal model has no fixed nodes, so the implication from fixed-copy membership to absence of outgoing random-copy edges holds vacuously.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    hStd :
    M.isStandard
    n :
    N
    SWIGNode.fixed n ∈ M.fixed
    v :
    ¬ M.dag.edge (SWIGNode.random n) v
    Proof (Lean source)
    lemma standard_fixed_random_edgeless (M : SCM N Ω) (hStd : M.isStandard) : ∀ n : N, SWIGNode.fixed n ∈ M.fixed → ∀ v : SWIGNode N, ¬ M.dag.edge (SWIGNode.random n) v := by intro n hn rw [SCM.isStandard] at hStd rw [hStd] at hn simp at hn
    Causalean.SCM.standard_fixed_random_edgeless · Causalean/SCM/ID/Density/MechCFactor/Basic.lean:277
  • fixSet_fixed_random_edgeless lemma — Given a finite structural causal model and an intervention set, if every intervened random copy is observed, no corresponding fixed copy is already fixed, and the model is standard, then for a node whose fixed copy is fixed after the intervention and any target node, the intervened random copy has no outgoing edge to that target.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    X :
    hObs :
    ∀ D ∈ X, SWIGNode.random D ∈ M.observed
    hFix :
    ∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed
    hStd :
    M.isStandard
    n :
    N
    SWIGNode.fixed n ∈ (M.fixSet X hObs hFix).fixed
    v :
    ¬ (M.fixSet X hObs hFix).dag.edge (SWIGNode.random n) v
    Proof (Lean source)
    lemma fixSet_fixed_random_edgeless (M : SCM N Ω) (X : Finset N) (hObs : ∀ D ∈ X, SWIGNode.random D ∈ M.observed) (hFix : ∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed) (hStd : M.isStandard) : ∀ n : N, SWIGNode.fixed n ∈ (M.fixSet X hObs hFix).fixed → ∀ v : SWIGNode N, ¬ (M.fixSet X hObs hFix).dag.edge (SWIGNode.random n) v := by classical intro n hn v have hnX : n ∈ X := by rw [SCM.fixSet_fixed] at hn rcases Finset.mem_union.mp hn with hnM | hnX · exfalso rw [SCM.isStandard] at hStd rw [hStd] at hnM simp at hnM · rcases Finset.mem_image.mp hnX with ⟨D, hD, hDfix⟩ cases hDfix exact hD intro hEdge have hEdgeRel : SWIGGraph.splitMonoEdgeRel M.toSWIGGraph.dag.edge X (SWIGNode.random n) v := by simpa [SCM.fixSet, SCM.fixMono, SWIGGraph.splitMono, SWIGGraph.splitMonoDAG] using hEdge simp [SWIGGraph.splitMonoEdgeRel, hnX] at hEdgeRel
    Causalean.SCM.fixSet_fixed_random_edgeless · Causalean/SCM/ID/Density/MechCFactor/Basic.lean:289
Invariance 2 core · 4 supporting This file identifies the observational c-component density with the mechanism c-factor and proves that the latter is unchanged by interventions outside the component. ★ cComponentDensityFactor_eq_mechCFactor★ mechCFactor_fixSet_invariant

Observational equality and intervention invariance of mechanism c-factors

This file identifies the observational c-component density with the mechanism c-factor and proves that the latter is unchanged by interventions outside the component. These are the two mechanism-level equalities used by Tian district recovery.

lemma cComponentDensityFactor_eq_mechCFactor reviewed
Causalean.SCM.ID

(A) Tian Lemma 1 (Eq. 37 = Eq. 36). For a standard causal model M, i.e. one with no fixed nodes, a reference family that is faithful — every coordinate value has nonzero reference mass, and an observational kernel at a fixed-value slice s with full point-mass support (every observed assignment has nonzero probability), fix a node set S contained in the observed coordinates that is a full c-component of the model's SWIG graph. Then the observational full-prefix c-component density cComponentDensityFactor on S equals the mechanism c-factor Q[S] (mechCFactor) — the do-complement marginal density of S.

Formal statement
N :
Type u_1
N → Type u_2
shared
∀ n, Fintype (Ω n)
M :
SCM N Ω
s :
M.FixedValues
hStd :
M.isStandard
S :
hS :
S ⊆ M.observed
hScomp :
S ∈ M.toSWIGGraph.cComponentSet
href :
hpos :
DiscreteID.PositiveMass (M.obsKernel s)
∀ s' : M.FixedValues, IsFiniteMeasure (M.obsKernel s')
∀ (k : ℕ) (hk : k < M.observed.card),
StandardBorelSpace (ValuesOn ({(M.observedAt ⟨k, hk⟩).val} : Finset (SWIGNode N)) (swigΩ Ω))
∀ (k : ℕ) (hk : k < M.observed.card),
Nonempty (ValuesOn ({(M.observedAt ⟨k, hk⟩).val} : Finset (SWIGNode N)) (swigΩ Ω))
∀ k : ℕ,
CountableOrCountablyGenerated M.FixedValues (ValuesOn (M.prefixNodes k) (swigΩ Ω))
x :
ValuesOn M.observed (swigΩ Ω)
M.cComponentDensityFactor ref s S x = M.mechCFactor ref S hS s x
Proof (Lean source)
lemma cComponentDensityFactor_eq_mechCFactor [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (ref : ReferenceMeasures Ω) (s : M.FixedValues) (hStd : M.isStandard) (S : Finset (SWIGNode N)) (hS : S ⊆ M.observed) (hScomp : S ∈ M.toSWIGGraph.cComponentSet) (href : ReferenceFaithful ref) (hpos : DiscreteID.PositiveMass (M.obsKernel s)) [∀ s' : M.FixedValues, IsFiniteMeasure (M.obsKernel s')] [∀ (k : ℕ) (hk : k < M.observed.card), StandardBorelSpace (ValuesOn ({(M.observedAt ⟨k, hk⟩).val} : Finset (SWIGNode N)) (swigΩ Ω))] [∀ (k : ℕ) (hk : k < M.observed.card), Nonempty (ValuesOn ({(M.observedAt ⟨k, hk⟩).val} : Finset (SWIGNode N)) (swigΩ Ω))] [∀ k : ℕ, CountableOrCountablyGenerated M.FixedValues (ValuesOn (M.prefixNodes k) (swigΩ Ω))] (x : ValuesOn M.observed (swigΩ Ω)) : M.cComponentDensityFactor ref s S x = M.mechCFactor ref S hS s x := by classical let I : Finset (Fin M.observed.card) := Finset.univ.filter (fun i : Fin M.observed.card => M.toSWIGGraph.cComponentOf (M.observedAt i).val = S) let num : Fin M.observed.card → ENNReal := fun i => M.qLocalMass s (S ∩ M.prefixNodes (i.val + 1)) (fun _ hv => M.prefixNodes_subset_observed (i.val + 1) (mem_of_mem_inter_right hv)) x let den : Fin M.observed.card → ENNReal := fun i => M.qLocalMass s (S ∩ M.prefixNodes i.val) (fun _ hv => M.prefixNodes_subset_observed i.val (mem_of_mem_inter_right hv)) x let atom : Fin M.observed.card → ENNReal := fun i => ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val)) have hsteps : M.cComponentDensityFactor ref s S x = ∏ i ∈ I, (num i / den i) / atom i := by unfold cComponentDensityFactor refine Finset.prod_congr rfl ?_ intro i hi have hiS : M.toSWIGGraph.cComponentOf (M.observedAt i).val = S := (Finset.mem_filter.mp hi).2 exact obsStepCondDensity_eq_component_ratio_div_ref M ref s S hScomp i hiS href hpos x have hatom0 : ∀ i ∈ I, atom i ≠ 0 := by intro i _hi exact href (M.observedAt i).val (x (M.observedAt i)) have hatomtop : ∀ i ∈ I, atom i ≠ ∞ := by intro i _hi exact ne_of_lt (MeasureTheory.measure_lt_top (ref.μ (M.observedAt i).val) ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val))) have hsplit : (∏ i ∈ I, (num i / den i) / atom i) = (∏ i ∈ I, num i / den i) / (∏ i ∈ I, atom i) := ENNReal.prod_div_prod₂ I num den atom hatom0 hatomtop have hnum : (∏ i ∈ I, num i / den i) = M.qLocalMass s S hS x := by simpa [I, num, den] using component_qLocalMass_ratio_product M s S hS hScomp hpos x have hrefprod : (∏ i ∈ I, atom i) = jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) := by simpa [I, atom] using component_ref_atom_product_eq_jointRef M ref S hS hScomp x have hanchor : M.mechCFactor ref S hS s x = M.qLocalMass s S hS x / jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) := mechCFactor_eq_qLocalMass_div_jointRef M ref s S hS href (standard_fixed_random_edgeless M hStd) x calc M.cComponentDensityFactor ref s S x = ∏ i ∈ I, (num i / den i) / atom i := hsteps _ = (∏ i ∈ I, num i / den i) / (∏ i ∈ I, atom i) := hsplit _ = M.qLocalMass s S hS x / jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) := by rw [hnum, hrefprod] _ = M.mechCFactor ref S hS s x := hanchor.symm
lemma mechCFactor_fixSet_invariant reviewed
Causalean.SCM.ID

Do(X)-invariance of the c-factor Q[S]. Let an intervention set X have random copies that are all observed and fixed copies that are not already fixed in the base model, giving the intervened model M.fixSet X. For a standard base model M, a reference family that is faithful, and a node set S contained in the observed coordinates whose random copies avoid every intervened node in X, if the base assignment x records, at each intervened node, the same value that the intervened model's fixed values sDo assign to the corresponding fixed coordinate, then the S-c-factor Q[S] of the intervened model M.fixSet X at sDo, x equals the S-c-factor of the base model M at the projected fixed values M.fixSetProj X sDo, x.

Formal statement
N :
Type u_1
N → Type u_2
shared
∀ n, Fintype (Ω n)
M :
SCM N Ω
X :
href :
hStd :
M.isStandard
hObs :
∀ D ∈ X, SWIGNode.random D ∈ M.observed
hFix :
∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed
S :
hS :
S ⊆ M.observed
hSX :
∀ n ∈ X, SWIGNode.random n ∉ S
sDo :
(M.fixSet X hObs hFix).FixedValues
x :
ValuesOn M.observed (swigΩ Ω)
hpin :
∀ D (hD : D ∈ X),
x ⟨SWIGNode.random D, hObs D hD⟩
= sDo ⟨SWIGNode.fixed D, mem_union_right _ (Finset.mem_image.mpr ⟨D, hD, rfl⟩)⟩
(M.fixSet X hObs hFix).mechCFactor ref S (by simpa [fixSet_observed] using hS) sDo x
= M.mechCFactor ref S hS (M.fixSetProj X hObs hFix sDo) x
Proof (Lean source)
lemma mechCFactor_fixSet_invariant [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (ref : ReferenceMeasures Ω) (X : Finset N) (href : ReferenceFaithful ref) (hStd : M.isStandard) (hObs : ∀ D ∈ X, SWIGNode.random D ∈ M.observed) (hFix : ∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed) (S : Finset (SWIGNode N)) (hS : S ⊆ M.observed) (hSX : ∀ n ∈ X, SWIGNode.random n ∉ S) (sDo : (M.fixSet X hObs hFix).FixedValues) (x : ValuesOn M.observed (swigΩ Ω)) (hpin : ∀ D (hD : D ∈ X), x ⟨SWIGNode.random D, hObs D hD⟩ = sDo ⟨SWIGNode.fixed D, mem_union_right _ (Finset.mem_image.mpr ⟨D, hD, rfl⟩)⟩) : (M.fixSet X hObs hFix).mechCFactor ref S (by simpa [fixSet_observed] using hS) sDo x = M.mechCFactor ref S hS (M.fixSetProj X hObs hFix sDo) x := by classical let MX := M.fixSet X hObs hFix let hSXobs : S ⊆ MX.observed := by simpa [MX, fixSet_observed] using hS have hfeX : ∀ n : N, SWIGNode.fixed n ∈ MX.fixed → ∀ v : SWIGNode N, ¬ MX.dag.edge (SWIGNode.random n) v := by simpa [MX] using fixSet_fixed_random_edgeless M X hObs hFix hStd have hfeM : ∀ n : N, SWIGNode.fixed n ∈ M.fixed → ∀ v : SWIGNode N, ¬ M.dag.edge (SWIGNode.random n) v := standard_fixed_random_edgeless M hStd have hq : MX.qLocalMass sDo S hSXobs x = M.qLocalMass (M.fixSetProj X hObs hFix sDo) S hS x := qLocalMass_fixSet_invariant M X hObs hFix sDo S hS hSX x hpin have hnumX : QmechMeasure MX S hSXobs (MX.mechDoValues S sDo x) {valuesProjection hSXobs x} = MX.qLocalMass sDo S hSXobs x := QmechMeasure_singleton_eq_qLocalMass MX S hSXobs hfeX sDo x have hnumM : QmechMeasure M S hS (M.mechDoValues S (M.fixSetProj X hObs hFix sDo) x) {valuesProjection hS x} = M.qLocalMass (M.fixSetProj X hObs hFix sDo) S hS x := QmechMeasure_singleton_eq_qLocalMass M S hS hfeM (M.fixSetProj X hObs hFix sDo) x have hprojPoint : valuesProjection hSXobs x = valuesProjection hS x := by ext v rfl have hden0X : jointRef ref S ({valuesProjection hSXobs x} : Set (ValuesOn S (swigΩ Ω))) ≠ 0 := jointRef_singleton_ne_zero ref href S (valuesProjection hSXobs x) have hdenTopX : jointRef ref S ({valuesProjection hSXobs x} : Set (ValuesOn S (swigΩ Ω))) ≠ ∞ := by exact ne_of_lt (MeasureTheory.measure_lt_top (jointRef ref S) ({valuesProjection hSXobs x} : Set (ValuesOn S (swigΩ Ω)))) have hden0M : jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) ≠ 0 := jointRef_singleton_ne_zero ref href S (valuesProjection hS x) have hdenTopM : jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) ≠ ∞ := by exact ne_of_lt (MeasureTheory.measure_lt_top (jointRef ref S) ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω)))) unfold mechCFactor rw [rnDeriv_singleton_eq_div _ _ (absolutelyContinuous_jointRef_of_faithful ref href S (QmechMeasure MX S hSXobs (MX.mechDoValues S sDo x))) (valuesProjection hSXobs x) hden0X hdenTopX] rw [rnDeriv_singleton_eq_div _ _ (absolutelyContinuous_jointRef_of_faithful ref href S (QmechMeasure M S hS (M.mechDoValues S (M.fixSetProj X hObs hFix sDo) x))) (valuesProjection hS x) hden0M hdenTopM] rw [hnumX, hnumM, hq, hprojPoint]
4 supporting declarations (lemmas, instances)
  • prod_div_prod lemma — A finite product of quotients is the quotient of the finite products when denominators are nonzero and finite.
    ι :
    Type*
    t :
    f g :
    ι → ENNReal
    hg0 :
    ∀ i ∈ t, g i ≠ 0
    hgtop :
    ∀ i ∈ t, g i ≠ ∞
    (∏ i ∈ t, f i / g i) = (∏ i ∈ t, f i) / (∏ i ∈ t, g i)
    Proof (Lean source)
    lemma ENNReal.prod_div_prod {ι : Type*} [DecidableEq ι] (t : Finset ι) (f g : ι → ENNReal) (hg0 : ∀ i ∈ t, g i ≠ 0) (hgtop : ∀ i ∈ t, g i ≠ ∞) : (∏ i ∈ t, f i / g i) = (∏ i ∈ t, f i) / (∏ i ∈ t, g i) := by classical induction t using Finset.induction_on with | empty => simp | insert a t ha ih => have ih' : (∏ i ∈ t, f i / g i) = (∏ i ∈ t, f i) / (∏ i ∈ t, g i) := ih (by intro i hi; exact hg0 i (Finset.mem_insert_of_mem hi)) (by intro i hi; exact hgtop i (Finset.mem_insert_of_mem hi)) have hprod0 : (∏ i ∈ t, g i) ≠ 0 := by exact Finset.prod_ne_zero_iff.mpr (by intro i hi exact hg0 i (Finset.mem_insert_of_mem hi)) have hprodtop : (∏ i ∈ t, g i) ≠ ∞ := by exact Finset.prod_ne_top_of_ne_top _ g (by intro i hi exact hgtop i (Finset.mem_insert_of_mem hi)) rw [Finset.prod_insert ha, Finset.prod_insert ha, Finset.prod_insert ha, ih'] rw [div_eq_mul_inv, div_eq_mul_inv, div_eq_mul_inv] rw [ENNReal.mul_inv] · ac_rfl · exact inr hprodtop · exact inr hprod0
    Causalean.SCM.ID.ENNReal.prod_div_prod · Causalean/SCM/ID/Density/MechCFactor/Invariance.lean:42
  • mechCFactor_eq_qLocalMass_div_jointRef lemma — For a structural causal model and fixed assignment, an observed node block, faithful reference measures, and an observed assignment, if each fixed variable's random copy has no outgoing edge, then the mechanism c-factor equals the local q-mass divided by the block's reference singleton mass.
    N :
    Type u_1
    N → Type u_2
    shared
    ∀ n, Fintype (Ω n)
    M :
    SCM N Ω
    s :
    M.FixedValues
    S :
    hS :
    S ⊆ M.observed
    href :
    hfe :
    ∀ n : N
    if
    SWIGNode.fixed n ∈ M.fixed
    then
    ∀ v : SWIGNode N, ¬ M.dag.edge (SWIGNode.random n) v
    x :
    ValuesOn M.observed (swigΩ Ω)
    M.mechCFactor ref S hS s x
    = M.qLocalMass s S hS x / jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω)))
    Proof (Lean source)
    lemma mechCFactor_eq_qLocalMass_div_jointRef [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (ref : ReferenceMeasures Ω) (s : M.FixedValues) (S : Finset (SWIGNode N)) (hS : S ⊆ M.observed) (href : ReferenceFaithful ref) (hfe : ∀ n : N, SWIGNode.fixed n ∈ M.fixed → ∀ v : SWIGNode N, ¬ M.dag.edge (SWIGNode.random n) v) (x : ValuesOn M.observed (swigΩ Ω)) : M.mechCFactor ref S hS s x = M.qLocalMass s S hS x / jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) := by have hnum : QmechMeasure M S hS (M.mechDoValues S s x) {valuesProjection hS x} = M.qLocalMass s S hS x := QmechMeasure_singleton_eq_qLocalMass M S hS hfe s x have hden0 : jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) ≠ 0 := jointRef_singleton_ne_zero ref href S (valuesProjection hS x) have hdenTop : jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) ≠ ∞ := by exact ne_of_lt (MeasureTheory.measure_lt_top (jointRef ref S) ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω)))) unfold mechCFactor rw [rnDeriv_singleton_eq_div _ _ (absolutelyContinuous_jointRef_of_faithful ref href S (QmechMeasure M S hS (M.mechDoValues S s x))) (valuesProjection hS x) hden0 hdenTop] rw [hnum]
    Causalean.SCM.ID.mechCFactor_eq_qLocalMass_div_jointRef · Causalean/SCM/ID/Density/MechCFactor/Invariance.lean:77
  • component_ref_atom_product_eq_jointRef lemma — Multiplying the singleton reference masses for all observed variables in one c-component equals the singleton mass of their joint reference measure.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    S :
    hS :
    S ⊆ M.observed
    hScomp :
    S ∈ M.toSWIGGraph.cComponentSet
    x :
    ValuesOn M.observed (swigΩ Ω)
    (∏ i ∈ Finset.univ.filter (fun i : Fin M.observed.card => M.toSWIGGraph.cComponentOf (M.observedAt i).val = S), ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val)))
    = jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω)))
    Proof (Lean source)
    lemma component_ref_atom_product_eq_jointRef [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (ref : ReferenceMeasures Ω) (S : Finset (SWIGNode N)) (hS : S ⊆ M.observed) (hScomp : S ∈ M.toSWIGGraph.cComponentSet) (x : ValuesOn M.observed (swigΩ Ω)) : (∏ i ∈ Finset.univ.filter (fun i : Fin M.observed.card => M.toSWIGGraph.cComponentOf (M.observedAt i).val = S), ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val))) = jointRef ref S ({valuesProjection hS x} : Set (ValuesOn S (swigΩ Ω))) := by classical have hprod : (∏ i ∈ Finset.univ.filter (fun i : Fin M.observed.card => M.toSWIGGraph.cComponentOf (M.observedAt i).val = S), ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val))) = ∏ v : {v // v ∈ S}, ref.μ v.val ({(valuesProjection hS x) v} : Set (swigΩ Ω v.val)) := by refine Finset.prod_bij (fun i hi => ⟨(M.observedAt i).val, (mem_cComponent_iff_cComponentOf_eq M.toSWIGGraph (M.observedAt i).property hScomp).mpr (Finset.mem_filter.mp hi).2⟩) ?_ ?_ ?_ ?_ · intro i hi exact Finset.mem_univ _ · intro i _hi j _hj hij have hval : (M.observedAt i).val = (M.observedAt j).val := congrArg (fun v : {v // v ∈ S} => v.val) hij have hsub : M.observedAt i = M.observedAt j := Subtype.ext hval calc i = M.observedIndex (M.observedAt i) := (M.observedIndex_observedAt i).symm _ = M.observedIndex (M.observedAt j) := by rw [hsub] _ = j := M.observedIndex_observedAt j · intro v _hv let i : Fin M.observed.card := M.observedIndex ⟨v.val, hS v.property⟩ have hnode : (M.observedAt i).val = v.val := M.observedAt_observedIndex ⟨v.val, hS v.property⟩ refine ⟨i, ?_, ?_⟩ · rw [mem_filter] refine ⟨Finset.mem_univ _, ?_⟩ have hvcomp : M.toSWIGGraph.cComponentOf v.val = S := (mem_cComponent_iff_cComponentOf_eq M.toSWIGGraph (hS v.property) hScomp).mp v.property simpa [hnode] using hvcomp · exact Subtype.ext hnode · intro i hi simp [valuesProjection] rw [jointRef_singleton_eq_prod] exact hprod
    Causalean.SCM.ID.component_ref_atom_product_eq_jointRef · Causalean/SCM/ID/Density/MechCFactor/Invariance.lean:228
  • qLocalMass_fixSet_invariant lemma — Local q-mass is invariant under a fixSet intervention when no coordinate in S is one of the intervened random nodes and the full assignment pins each intervened random node to the corresponding fixed value.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    X :
    hObs :
    ∀ D ∈ X, SWIGNode.random D ∈ M.observed
    hFix :
    ∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed
    sDo :
    (M.fixSet X hObs hFix).FixedValues
    S :
    hS :
    S ⊆ M.observed
    hSX :
    ∀ n ∈ X, SWIGNode.random n ∉ S
    x :
    ValuesOn M.observed (swigΩ Ω)
    hpin :
    ∀ D (hD : D ∈ X),
    x ⟨SWIGNode.random D, hObs D hD⟩
    = sDo ⟨SWIGNode.fixed D, mem_union_right _ (Finset.mem_image.mpr ⟨D, hD, rfl⟩)⟩
    (M.fixSet X hObs hFix).qLocalMass sDo S (by simpa [fixSet_observed] using hS) x
    = M.qLocalMass (M.fixSetProj X hObs hFix sDo) S hS x
    Proof (Lean source)
    lemma qLocalMass_fixSet_invariant (M : SCM N Ω) (X : Finset N) (hObs : ∀ D ∈ X, SWIGNode.random D ∈ M.observed) (hFix : ∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed) (sDo : (M.fixSet X hObs hFix).FixedValues) (S : Finset (SWIGNode N)) (hS : S ⊆ M.observed) (hSX : ∀ n ∈ X, SWIGNode.random n ∉ S) (x : ValuesOn M.observed (swigΩ Ω)) (hpin : ∀ D (hD : D ∈ X), x ⟨SWIGNode.random D, hObs D hD⟩ = sDo ⟨SWIGNode.fixed D, mem_union_right _ (Finset.mem_image.mpr ⟨D, hD, rfl⟩)⟩) : (M.fixSet X hObs hFix).qLocalMass sDo S (by simpa [fixSet_observed] using hS) x = M.qLocalMass (M.fixSetProj X hObs hFix sDo) S hS x := by classical let MX := M.fixSet X hObs hFix let hSXobs : S ⊆ MX.observed := by simpa [MX, fixSet_observed] using hS have hobsAgree : ∀ w (hw : w ∈ M.observed), x ⟨w, by simpa [MX, fixSet_observed] using hw⟩ = x ⟨w, hw⟩ := by intro w hw rfl have hproj : M.fixSetProj X hObs hFix sDo = M.fixSetProj X hObs hFix sDo := rfl unfold qLocalMass congr 1 ext ℓ constructor · intro hLocal v hv have hnot : v ∉ X.image SWIGNode.random := by intro hvX rcases Finset.mem_image.mp hvX with ⟨D, hD, rfl⟩ exact hSX D hD hv exact (localConsistent_fixSet_iff M X hObs hFix sDo (M.fixSetProj X hObs hFix sDo) x x v (hSXobs hv) (hS hv) hnot hobsAgree hpin hproj ℓ).mp (hLocal v hv) · intro hLocal v hv have hnot : v ∉ X.image SWIGNode.random := by intro hvX rcases Finset.mem_image.mp hvX with ⟨D, hD, rfl⟩ exact hSX D hD hv exact (localConsistent_fixSet_iff M X hObs hFix sDo (M.fixSetProj X hObs hFix sDo) x x v (hSXobs hv) (hS hv) hnot hobsAgree hpin hproj ℓ).mpr (hLocal v hv)
    Causalean.SCM.ID.qLocalMass_fixSet_invariant · Causalean/SCM/ID/Density/MechCFactor/Invariance.lean:392
Ratios 1 core · 6 supporting This file computes each observational step density as a ratio of component q-masses and reference atoms. ★ obsStepCondDensity_eq_component_ratio_div_ref

Prefix ratios for mechanism c-factors

This file computes each observational step density as a ratio of component q-masses and reference atoms. Its component-intersection and cancellation lemmas provide the algebraic bridge from the observational prefix product to a single mechanism c-factor.

lemma obsStepCondDensity_eq_component_ratio_div_ref reviewed
Causalean.SCM.ID

For a finite structural causal model with finite measurable node-value spaces, coordinate reference measures and a fixed-node assignment, an observed c-component, evidence that it is a listed component, a position in the observed topological order, evidence that the node at that position belongs to the component, faithfulness of the reference measures, positive observational atom masses, and an observed realization, the one-step observational conditional density equals the component's successive local-mass ratio divided by the next coordinate's reference mass.

Formal statement
N :
Type u_1
N → Type u_2
shared
∀ n, Fintype (Ω n)
M :
SCM N Ω
s :
M.FixedValues
S :
hScomp :
S ∈ M.toSWIGGraph.cComponentSet
i :
Fin M.observed.card
hiS :
M.toSWIGGraph.cComponentOf (M.observedAt i).val = S
href :
hpos :
DiscreteID.PositiveMass (M.obsKernel s)
∀ s' : M.FixedValues, IsFiniteMeasure (M.obsKernel s')
StandardBorelSpace (ValuesOn ({(M.observedAt i).val} : Finset (SWIGNode N)) (swigΩ Ω))
Nonempty (ValuesOn ({(M.observedAt i).val} : Finset (SWIGNode N)) (swigΩ Ω))
CountableOrCountablyGenerated M.FixedValues (ValuesOn (M.prefixNodes i.val) (swigΩ Ω))
x :
ValuesOn M.observed (swigΩ Ω)
M.obsStepCondDensity ref s i x
= (M.qLocalMass s (S ∩ M.prefixNodes (i.val + 1)) (fun _ hv => M.prefixNodes_subset_observed (i.val + 1) (mem_of_mem_inter_right hv)) x / M.qLocalMass s (S ∩ M.prefixNodes i.val) (fun _ hv => M.prefixNodes_subset_observed i.val (mem_of_mem_inter_right hv)) x) / ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val))
Proof (Lean source)
lemma obsStepCondDensity_eq_component_ratio_div_ref [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (ref : ReferenceMeasures Ω) (s : M.FixedValues) (S : Finset (SWIGNode N)) (hScomp : S ∈ M.toSWIGGraph.cComponentSet) (i : Fin M.observed.card) (hiS : M.toSWIGGraph.cComponentOf (M.observedAt i).val = S) (href : ReferenceFaithful ref) (hpos : DiscreteID.PositiveMass (M.obsKernel s)) [∀ s' : M.FixedValues, IsFiniteMeasure (M.obsKernel s')] [StandardBorelSpace (ValuesOn ({(M.observedAt i).val} : Finset (SWIGNode N)) (swigΩ Ω))] [Nonempty (ValuesOn ({(M.observedAt i).val} : Finset (SWIGNode N)) (swigΩ Ω))] [CountableOrCountablyGenerated M.FixedValues (ValuesOn (M.prefixNodes i.val) (swigΩ Ω))] (x : ValuesOn M.observed (swigΩ Ω)) : M.obsStepCondDensity ref s i x = (M.qLocalMass s (S ∩ M.prefixNodes (i.val + 1)) (fun _ hv => M.prefixNodes_subset_observed (i.val + 1) (mem_of_mem_inter_right hv)) x / M.qLocalMass s (S ∩ M.prefixNodes i.val) (fun _ hv => M.prefixNodes_subset_observed i.val (mem_of_mem_inter_right hv)) x) / ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val)) := by have hac : (M.obsStepCondKernel i.isLt) (s, valuesProjection (M.prefixNodes_subset_observed i.val) x) ≪ ref.μ (M.observedAt i).val := by exact absolutelyContinuous_of_singleton_ne_zero _ _ (href (M.observedAt i).val) have href0 : ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val)) ≠ 0 := href (M.observedAt i).val (x (M.observedAt i)) have hreftop : ref.μ (M.observedAt i).val ({x (M.observedAt i)} : Set (swigΩ Ω (M.observedAt i).val)) ≠ ∞ := by exact ne_of_lt (MeasureTheory.measure_lt_top (ref.μ (M.observedAt i).val) _) rw [obsStepCondDensity_eq_mass_ratio M ref s i x hac href0 hreftop] rw [obsStepCondKernel_singleton_eq_prefix_ratio M s i hpos x] rw [obsKernel_prefix_singleton_eq_prod_qLocalMass] rw [obsKernel_prefix_singleton_eq_prod_qLocalMass] rw [prefix_qProduct_ratio_eq_component_ratio M s S hScomp i hiS hpos x]
6 supporting declarations (lemmas, instances)
  • prefixNodes_obsParentClosed lemma — The first k observed nodes in a structural causal model's topological order form a set closed under observed parents.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    k :
    ℕ
    M.ObsParentClosed (M.prefixNodes k)
    Proof (Lean source)
    lemma prefixNodes_obsParentClosed (M : SCM N Ω) (k : ℕ) : M.ObsParentClosed (M.prefixNodes k) := by classical refine ⟨M.prefixNodes_subset_observed k, ?_⟩ intro v hv w hwObs hEdge rcases (M.mem_prefixNodes_iff k v).mp hv with ⟨hvObs, hvlt⟩ let i : Fin M.observed.card := M.observedIndex ⟨v, hvObs⟩ have hi_eq : (M.observedAt i).val = v := by exact M.observedAt_observedIndex ⟨v, hvObs⟩ have hwPred : w ∈ M.toSWIGGraph.observedPredecessors (M.observedAt i).val := by rw [hi_eq] exact Finset.mem_filter.mpr ⟨hwObs, M.dag.topoOrder_lt w v hEdge⟩ have hwPrefixI : w ∈ M.prefixNodes i.val := by simpa using ((M.observedPredecessors_observedAt i.isLt).symm ▸ hwPred) exact M.prefixNodes_mono (show i.val ≤ k from le_of_lt hvlt) hwPrefixI
    Causalean.SCM.ID.prefixNodes_obsParentClosed · Causalean/SCM/ID/Density/MechCFactor/Ratios.lean:44
  • mem_cComponent_iff_cComponentOf_eq lemma — For an observed node and a listed c-component, membership in that component is equivalent to the computed c-component being the listed set.
    N :
    Type u_1
    shared
    G :
    v :
    S :
    hv :
    v ∈ G.observed
    hS :
    S ∈ G.cComponentSet
    v ∈ S ↔ G.cComponentOf v = S
    Proof (Lean source)
    lemma mem_cComponent_iff_cComponentOf_eq (G : SWIGGraph N) {v : SWIGNode N} {S : Finset (SWIGNode N)} (hv : v ∈ G.observed) (hS : S ∈ G.cComponentSet) : v ∈ S ↔ G.cComponentOf v = S := by constructor · intro hvS rw [SWIGGraph.cComponentSet, mem_image] at hS obtain ⟨w, hw, rfl⟩ := hS have hwv : G.bidirectedReachable w v := (G.mem_cComponentOf_iff_reachable hw).mp hvS exact (G.cComponentOf_eq_of_reachable hwv).symm · intro hcomp exact hcomp ▸ G.mem_cComponentOf_self hv
    Causalean.SCM.ID.mem_cComponent_iff_cComponentOf_eq · Causalean/SCM/ID/Density/MechCFactor/Ratios.lean:66
  • qLocalMass_ne_top lemma — Every local q-mass associated with fixed values, an observed node set, and an observed assignment is finite.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    s :
    M.FixedValues
    T :
    hT :
    T ⊆ M.observed
    x :
    ValuesOn M.observed (swigΩ Ω)
    M.qLocalMass s T hT x ≠ ∞
    Proof (Lean source)
    lemma qLocalMass_ne_top (M : SCM N Ω) (s : M.FixedValues) (T : Finset (SWIGNode N)) (hT : T ⊆ M.observed) (x : ValuesOn M.observed (swigΩ Ω)) : M.qLocalMass s T hT x ≠ ∞ := by exact ne_of_lt (MeasureTheory.measure_lt_top M.latentProduct _)
    Causalean.SCM.ID.qLocalMass_ne_top · Causalean/SCM/ID/Density/MechCFactor/Ratios.lean:98
  • div_mul_common lemma — Cancelling a common nonzero finite factor preserves a quotient of extended nonnegative reals.
    a b r :
    hr0 :
    r ≠ 0
    hrtop :
    r ≠ ∞
    (a * r) / (b * r) = a / b
    Proof (Lean source)
    lemma ENNReal.div_mul_common {a b r : ENNReal} (hr0 : r ≠ 0) (hrtop : r ≠ ∞) : (a * r) / (b * r) = a / b := by rw [ENNReal.div_eq_inv_mul, ENNReal.div_eq_inv_mul] rw [ENNReal.mul_inv] · rw [show b⁻¹ * r⁻¹ * (a * r) = (r⁻¹ * r) * (b⁻¹ * a) by ac_rfl] rw [ENNReal.inv_mul_cancel hr0 hrtop] simp [mul_comm] · exact inr hrtop · exact inr hr0
    Causalean.SCM.ID.ENNReal.div_mul_common · Causalean/SCM/ID/Density/MechCFactor/Ratios.lean:107
  • prod_ne_top_of_ne_top lemma — A finite product of finite extended nonnegative reals is finite.
    ι :
    Type*
    s :
    f :
    ι → ENNReal
    hf :
    ∀ i ∈ s, f i ≠ ∞
    (∏ i ∈ s, f i) ≠ ∞
    Proof (Lean source)
    lemma Finset.prod_ne_top_of_ne_top {ι : Type*} [DecidableEq ι] (s : Finset ι) (f : ι → ENNReal) (hf : ∀ i ∈ s, f i ≠ ∞) : (∏ i ∈ s, f i) ≠ ∞ := by classical induction s using Finset.induction_on with | empty => simp | insert a s ha ih => rw [Finset.prod_insert ha] exact ENNReal.mul_ne_top (hf a (Finset.mem_insert_self a s)) (ih (by intro i hi; exact hf i (Finset.mem_insert_of_mem hi)))
    Causalean.SCM.ID.Finset.prod_ne_top_of_ne_top · Causalean/SCM/ID/Density/MechCFactor/Ratios.lean:119
  • cComponent_inter_prefix_succ_eq_of_node_ne lemma — Given a finite structural causal model, a district, and a valid observed-node index, if the set is a district and the indexed node's district differs from it, then the district's intersection with the observed prefix is unchanged at that step.
    N :
    Type u_1
    N → Type u_2
    shared
    M :
    SCM N Ω
    S :
    hScomp :
    S ∈ M.toSWIGGraph.cComponentSet
    i :
    Fin M.observed.card
    hiS :
    M.toSWIGGraph.cComponentOf (M.observedAt i).val ≠ S
    S ∩ M.prefixNodes (i.val + 1) = S ∩ M.prefixNodes i.val
    Proof (Lean source)
    lemma cComponent_inter_prefix_succ_eq_of_node_ne (M : SCM N Ω) {S : Finset (SWIGNode N)} (hScomp : S ∈ M.toSWIGGraph.cComponentSet) {i : Fin M.observed.card} (hiS : M.toSWIGGraph.cComponentOf (M.observedAt i).val ≠ S) : S ∩ M.prefixNodes (i.val + 1) = S ∩ M.prefixNodes i.val := by classical ext v constructor · intro hv rcases Finset.mem_inter.mp hv with ⟨hvS, hvpre⟩ rw [M.prefixNodes_succ i.isLt] at hvpre rcases Finset.mem_union.mp hvpre with hvold | hvnew · exact Finset.mem_inter.mpr ⟨hvS, hvold⟩ · have hvnode : v = (M.observedAt i).val := by simpa using hvnew subst hvnode exact False.elim (hiS ((mem_cComponent_iff_cComponentOf_eq M.toSWIGGraph (M.observedAt i).property hScomp).mp hvS)) · intro hv rcases Finset.mem_inter.mp hv with ⟨hvS, hvpre⟩ exact Finset.mem_inter.mpr ⟨hvS, M.prefixNodes_mono (le_succ i.val) hvpre⟩
    Causalean.SCM.ID.cComponent_inter_prefix_succ_eq_of_node_ne · Causalean/SCM/ID/Density/MechCFactor/Ratios.lean:162