SCM.ID.Density.QFactor
The density-level form of Tian's c-component (district) factorization.
Defs 6 core · 1 supporting This file introduces the conditional-independence and global-Markov predicates used by the density proof, together with the finite-product regrouping of the full prefix density into one tianDistrictDensity factor per c-c ★ prod_tianDistrictDensity_eq_tianDensityProduct
Definitions for Tian district-density factorization
This file introduces the conditional-independence and global-Markov predicates
used by the density proof, together with the finite-product regrouping of the
full prefix density into one tianDistrictDensity factor per c-component.
For a finite node-label set, measurable node-value spaces, a finite coordinate set, two coordinate blocks, a conditioning coordinate block, proofs that all three blocks are contained in the coordinate set, and a finite measure on the values of that coordinate set, kernel observational conditional independence means that the first two blocks are conditionally independent given the third under that measure, provided the coordinate-value space is standard Borel.
Definition (Lean source)
For a finite node-label set, measurable node-value spaces, a SWIG graph, a finite coordinate set, and a finite measure on its coordinate-value space, the kernel global Markov property means that every three pairwise disjoint coordinate blocks contained in that set which are d-separated in the graph are conditionally independent under the measure, provided the coordinate-value space is standard Borel.
Definition (Lean source)
For a finite node-label set, measurable node-value spaces, a SWIG graph, a finite node set, a finite measure on its value assignments, a family of reference measures, and a position in the graph's ordering of that set, Tian's prefix-step density maps each assignment of the selected nodes to the Radon–Nikodym density of the selected node's conditional distribution given its preceding nodes, relative to its reference measure; the selected node's value space is required to be nonempty and standard Borel.
Definition (Lean source)
For a finite node-label set, measurable node-value spaces, a SWIG graph, a finite node set, a finite measure on its value assignments, a family of reference measures, and a selected node set, Tian's district density maps each node assignment to the product of the prefix-step densities for exactly those ordered nodes that lie in the selected set; every singleton node-value space in the ordering is required to be nonempty and standard Borel.
Definition (Lean source)
For a finite node-label set, measurable node-value spaces, a SWIG graph, a finite node set, a finite measure on its value assignments, and a family of reference measures, Tian's full prefix-chain density maps each node assignment to the product of the prefix-step densities for every node in the graph's ordering; every singleton node-value space in that ordering is required to be nonempty and standard Borel.
Definition (Lean source)
For a finite acyclic graph with measurable node-value spaces, a finite node set, evidence that it is exactly the observed set, a finite law on that set, and coordinate reference measures, the full prefix-chain density equals the product of Tian's district densities over all c-components.
Formal statement
Proof (Lean source)
1 supporting declaration (lemmas, instances)
-
prefixIn_obsParentClosedlemma — Topological prefixes of an observed-parent-closed set remain observed-parent-closed.hypothesesN :sharedType u_1N → Type u_2M :SCM N ΩX :Finset NhObs :∀ D ∈ X, SWIGNode.random D ∈ M.observedhFix :∀ D ∈ X, SWIGNode.fixed D ∉ M.fixedk :ℕconclusion(M.fixSet X hObs hFix).ObsParentClosed (((M.fixSet X hObs hFix).toSWIGGraph.induce (SCM.ID.fixAncestralSet M X hObs hFix Y)).prefixIn (SCM.ID.fixObservedAncestralSet M X hObs hFix Y) k)Proof (Lean source)
lemma prefixIn_obsParentClosed (M : SCM N Ω) (X : Finset N) (hObs : ∀ D ∈ X, SWIGNode.random D ∈ M.observed) (hFix : ∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed) (Y : Finset (SWIGNode N)) (k : ℕ) : (M.fixSet X hObs hFix).ObsParentClosed (((M.fixSet X hObs hFix).toSWIGGraph.induce (SCM.ID.fixAncestralSet M X hObs hFix Y)).prefixIn (SCM.ID.fixObservedAncestralSet M X hObs hFix Y) k) := by classical let M' := M.fixSet X hObs hFix let A := SCM.ID.fixAncestralSet M X hObs hFix Y let D := SCM.ID.fixObservedAncestralSet M X hObs hFix Y let H := M'.toSWIGGraph.induce A have hDclosed : M'.ObsParentClosed D := by simpa [M', D] using (SCM.ID.fixObservedAncestralSet_obsParent_closed M X hObs hFix Y) refine ⟨?_, ?_⟩ · intro v hv exact hDclosed.1 (H.prefixIn_subset D k hv) · intro v hv w hwObs hEdge have hvD : v ∈ D := H.prefixIn_subset D k hv have hwD : w ∈ D := hDclosed.2 v hvD w hwObs hEdge rcases Finset.mem_filter.mp hv with ⟨hvD₀, hvIdxLt₀⟩ have hvIdxLt : (H.nodeIndex D ⟨v, hvD⟩).val < k := by have hsub : (⟨v, hvD⟩ : {v // v ∈ D}) = ⟨v, hvD₀⟩ := Subtype.ext rfl simpa [SWIGGraph.prefixIn, hsub, hvD₀] using hvIdxLt₀ have hEdgeH : H.dag.edge w v := by have hwA : w ∈ A := (Finset.mem_inter.mp hwD).1 have hvA : v ∈ A := (Finset.mem_inter.mp hvD).1 have hvObs : v ∈ M'.observed := hDclosed.1 hvD dsimp [H, M', A, SWIGGraph.induce, SWIGGraph.inducedDag, SWIGGraph.inducedEdge] refine ⟨hEdge, ?_, ?_⟩ · exact mem_union_left _ (mem_union_right _ (Finset.mem_inter.mpr ⟨hwA, hwObs⟩)) · exact mem_union_left _ (mem_union_right _ (Finset.mem_inter.mpr ⟨hvA, hvObs⟩)) have hTopo : H.dag.topoOrder w < H.dag.topoOrder v := H.dag.topoOrder_lt w v hEdgeH letI := H.topoLinearOrder have hSubtypeLt : (⟨w, hwD⟩ : {v // v ∈ D}) < ⟨v, hvD⟩ := by change H.dag.topoOrder w < H.dag.topoOrder v exact hTopo have hIndexLt : (H.nodeIndex D ⟨w, hwD⟩).val < (H.nodeIndex D ⟨v, hvD⟩).val := by have hIndexLtFin : H.nodeIndex D ⟨w, hwD⟩ < H.nodeIndex D ⟨v, hvD⟩ := by simpa [SWIGGraph.nodeIndex] using ((D.orderIsoOfFin rfl).symm.strictMono hSubtypeLt) simpa [SWIGGraph.nodeIndex] using hIndexLtFin change w ∈ D.filter (fun v => if h : v ∈ D then (H.nodeIndex D ⟨v, h⟩).val < k else False) exact Finset.mem_filter.mpr ⟨hwD, by simpa [hwD] using lt_trans hIndexLt hvIdxLt⟩
PrefixLemmas 1 core · 12 supporting This file proves the topological-prefix closure and component-intersection facts needed to factor qLocalMass along successive prefixes. ★ qLocalMass_prefixIn_eq_prod_induce_components
Prefix and component lemmas for q-factor recovery
This file proves the topological-prefix closure and component-intersection facts
needed to factor qLocalMass along successive prefixes. It also provides the
fixed-edge fact used when the ambient model is replaced by a do-model.
For a finite structural causal model with finite measurable node-value spaces, a fixed-node assignment, an observed node set, evidence that it is observed, a prefix length, and an observed realization, the local q-mass of the induced graph's prefix factors into the local q-masses of its intersections with the induced c-components.
Formal statement
Proof (Lean source)
12 supporting declarations (lemmas, instances)
-
mem_prefixIn_ifflemma — Membership in a graph-ordered prefix of D is exactly index membership below the prefix length.hypothesesconclusionv ∈ H.prefixIn D n ↔ ∃ h : v ∈ D, (H.nodeIndex D ⟨v, h⟩).val < nProof (Lean source)
lemma mem_prefixIn_iff (H : SWIGGraph N) (D : Finset (SWIGNode N)) (n : ℕ) (v : SWIGNode N) : v ∈ H.prefixIn D n ↔ ∃ h : v ∈ D, (H.nodeIndex D ⟨v, h⟩).val < n := by unfold SWIGGraph.prefixIn constructor · intro hv rcases Finset.mem_filter.mp hv with ⟨hD, hltif⟩ exact ⟨hD, by simpa [hD] using hltif⟩ · rintro ⟨hD, hlt⟩ exact Finset.mem_filter.mpr ⟨hD, by simpa [hD] using hlt⟩ -
prefixIn_zerolemma — The D-prefix of length zero is empty.hypothesesconclusionH.prefixIn D 0 = ∅Proof (Lean source)
lemma prefixIn_zero (H : SWIGGraph N) (D : Finset (SWIGNode N)) : H.prefixIn D 0 = ∅ := by ext v constructor · intro hv rcases (mem_prefixIn_iff H D 0 v).mp hv with ⟨_, hlt⟩ omega · simp -
nodesAt_mem_prefixIn_ifflemma — The node at index i belongs to the first n D-nodes iff i < n.hypothesesconclusion(H.nodesAt D i).val ∈ H.prefixIn D n ↔ i.val < nProof (Lean source)
lemma nodesAt_mem_prefixIn_iff (H : SWIGGraph N) (D : Finset (SWIGNode N)) (n : ℕ) (i : Fin D.card) : (H.nodesAt D i).val ∈ H.prefixIn D n ↔ i.val < n := by rw [mem_prefixIn_iff] constructor · rintro ⟨hD, hlt⟩ have hidx : H.nodeIndex D ⟨(H.nodesAt D i).val, hD⟩ = i := by have hsub : (⟨(H.nodesAt D i).val, hD⟩ : {v // v ∈ D}) = H.nodesAt D i := Subtype.ext rfl rw [hsub] simp [SWIGGraph.nodeIndex, SWIGGraph.nodesAt] rwa [hidx] at hlt · intro hlt exact ⟨(H.nodesAt D i).property, by have hidx : H.nodeIndex D (H.nodesAt D i) = i := by simp [SWIGGraph.nodeIndex, SWIGGraph.nodesAt] simpa [hidx] using hlt⟩ -
prefixIn_cardlemma — The full D-prefix is D.hypothesesconclusionH.prefixIn D D.card = DProof (Lean source)
lemma prefixIn_card (H : SWIGGraph N) (D : Finset (SWIGNode N)) : H.prefixIn D D.card = D := by ext v constructor · exact fun hv => H.prefixIn_subset D D.card hv · intro hv exact (mem_prefixIn_iff H D D.card v).mpr ⟨hv, (H.nodeIndex D ⟨v, hv⟩).isLt⟩ -
prefixIn_monolemma — Prefix sets are monotone in the prefix length.hypothesesconclusionH.prefixIn D m ⊆ H.prefixIn D kProof (Lean source)
lemma prefixIn_mono (H : SWIGGraph N) (D : Finset (SWIGNode N)) {m k : ℕ} (h : m ≤ k) : H.prefixIn D m ⊆ H.prefixIn D k := by intro v hv rcases (mem_prefixIn_iff H D m v).mp hv with ⟨hD, hlt⟩ exact (mem_prefixIn_iff H D k v).mpr ⟨hD, lt_of_lt_of_le hlt h⟩ -
nodesAt_not_mem_prefixInlemma — The next D-node is not in the previous D-prefix.hypothesesconclusion(H.nodesAt D ⟨n, hn⟩).val ∉ H.prefixIn D nProof (Lean source)
lemma nodesAt_not_mem_prefixIn (H : SWIGGraph N) (D : Finset (SWIGNode N)) {n : ℕ} (hn : n < D.card) : (H.nodesAt D ⟨n, hn⟩).val ∉ H.prefixIn D n := by rw [nodesAt_mem_prefixIn_iff H D n ⟨n, hn⟩] exact Nat.lt_irrefl n -
prefixIn_succlemma — The successor D-prefix is obtained by adjoining the next D-node.hypothesesconclusionH.prefixIn D (n + 1) = H.prefixIn D n ∪ {(H.nodesAt D ⟨n, hn⟩).val}Proof (Lean source)
lemma prefixIn_succ (H : SWIGGraph N) (D : Finset (SWIGNode N)) {n : ℕ} (hn : n < D.card) : H.prefixIn D (n + 1) = H.prefixIn D n ∪ {(H.nodesAt D ⟨n, hn⟩).val} := by ext v constructor · intro hv rcases (mem_prefixIn_iff H D (n + 1) v).mp hv with ⟨hD, hlt⟩ by_cases hlt_n : (H.nodeIndex D ⟨v, hD⟩).val < n · exact mem_union_left _ ((mem_prefixIn_iff H D n v).mpr ⟨hD, hlt_n⟩) · have hidx_val : (H.nodeIndex D ⟨v, hD⟩).val = n := by omega have hidx : H.nodeIndex D ⟨v, hD⟩ = ⟨n, hn⟩ := Fin.ext hidx_val have hv_eq : v = (H.nodesAt D ⟨n, hn⟩).val := by have hround : H.nodesAt D (H.nodeIndex D ⟨v, hD⟩) = ⟨v, hD⟩ := by simp [SWIGGraph.nodeIndex, SWIGGraph.nodesAt] rw [hidx] at hround exact congrArg val hround.symm exact mem_union_right _ (by simp [hv_eq]) · intro hv rcases Finset.mem_union.mp hv with hvpre | hvlast · rcases (mem_prefixIn_iff H D n v).mp hvpre with ⟨hD, hlt⟩ exact (mem_prefixIn_iff H D (n + 1) v).mpr ⟨hD, by omega⟩ · have hv_eq : v = (H.nodesAt D ⟨n, hn⟩).val := by simpa using hvlast subst hv_eq rw [nodesAt_mem_prefixIn_iff H D (n + 1) ⟨n, hn⟩] exact lt_succ_self n -
prefixIn_disjoint_singleton_nextlemma — The previous D-prefix is disjoint from the singleton next node.hypothesesProof (Lean source)
lemma prefixIn_disjoint_singleton_next (H : SWIGGraph N) (D : Finset (SWIGNode N)) {n : ℕ} (hn : n < D.card) : Disjoint (H.prefixIn D n) ({(H.nodesAt D ⟨n, hn⟩).val} : Finset (SWIGNode N)) := by rw [Finset.disjoint_singleton_right] exact nodesAt_not_mem_prefixIn H D hn -
prefixIn_parent_closed_induce_observedlemma — In an induced set of observed variables, every topological prefix contains all parents within that set of each variable it contains.hypothesesN :sharedType u_1N → Type u_2M :SCM N ΩhA :A ⊆ M.observedk :ℕv ∈ A :w ∈ (M.toSWIGGraph.induce A).prefixIn A k :M.dag.edge v wconclusionv ∈ (M.toSWIGGraph.induce A).prefixIn A kProof (Lean source)
lemma prefixIn_parent_closed_induce_observed (M : SCM N Ω) (A : Finset (SWIGNode N)) (hA : A ⊆ M.observed) (k : ℕ) : ∀ v ∈ A, ∀ w ∈ (M.toSWIGGraph.induce A).prefixIn A k, M.dag.edge v w → v ∈ (M.toSWIGGraph.induce A).prefixIn A k := by classical intro v hvA w hwPre hEdge let H := M.toSWIGGraph.induce A have hwA : w ∈ A := H.prefixIn_subset A k hwPre have hEdgeH : H.dag.edge v w := by dsimp [H, SWIGGraph.induce] rw [SWIGGraph.inducedDag_edge_iff] refine ⟨hEdge, ?_, ?_⟩ · simp [hvA, hA hvA] · simp [hwA, hA hwA] have hTopo : H.dag.topoOrder v < H.dag.topoOrder w := H.dag.topoOrder_lt v w hEdgeH rcases (mem_prefixIn_iff H A k w).mp hwPre with ⟨hwA', hwIdxLt⟩ letI := H.topoLinearOrder have hSubtypeLt : (⟨v, hvA⟩ : {v // v ∈ A}) < ⟨w, hwA'⟩ := by change H.dag.topoOrder v < H.dag.topoOrder w exact hTopo have hIndexLt : (H.nodeIndex A ⟨v, hvA⟩).val < (H.nodeIndex A ⟨w, hwA'⟩).val := by have hIndexLtFin : H.nodeIndex A ⟨v, hvA⟩ < H.nodeIndex A ⟨w, hwA'⟩ := by simpa [SWIGGraph.nodeIndex] using ((A.orderIsoOfFin rfl).symm.strictMono hSubtypeLt) simpa [SWIGGraph.nodeIndex] using hIndexLtFin exact (mem_prefixIn_iff H A k v).mpr ⟨hvA, lt_trans hIndexLt hwIdxLt⟩ -
cComponent_inter_prefixIn_succ_eq_of_nelemma — Given a finite structural causal model, a graph, a node set, and two districts, if the first and second sets are districts, the node set is observed, the next prefix node lies in the first district, and the districts differ, then intersecting the second district with the prefix is unchanged at that step.hypothesesN :sharedType u_1N → Type u_2M :SCM N ΩH :hScomp :S ∈ M.toSWIGGraph.cComponentSethCcomp :C ∈ M.toSWIGGraph.cComponentSeti :Fin D.cardhDobs :D ⊆ M.observedhiS :(H.nodesAt D i).val ∈ ShCS :C ≠ SconclusionC ∩ H.prefixIn D (i.val + 1) = C ∩ H.prefixIn D i.valProof (Lean source)
lemma cComponent_inter_prefixIn_succ_eq_of_ne (M : SCM N Ω) (H : SWIGGraph N) (D : Finset (SWIGNode N)) {S C : Finset (SWIGNode N)} (hScomp : S ∈ M.toSWIGGraph.cComponentSet) (hCcomp : C ∈ M.toSWIGGraph.cComponentSet) {i : Fin D.card} (hDobs : D ⊆ M.observed) (hiS : (H.nodesAt D i).val ∈ S) (hCS : C ≠ S) : C ∩ H.prefixIn D (i.val + 1) = C ∩ H.prefixIn D i.val := by classical ext v constructor · intro hv rcases Finset.mem_inter.mp hv with ⟨hvC, hvpre⟩ rw [prefixIn_succ H D i.isLt] at hvpre rcases Finset.mem_union.mp hvpre with hvold | hvnew · exact Finset.mem_inter.mpr ⟨hvC, hvold⟩ · have hvnode : v = (H.nodesAt D i).val := by simpa using hvnew subst hvnode have hnodeObs : (H.nodesAt D i).val ∈ M.observed := hDobs (H.nodesAt D i).property have hSC : S = C := by exact (mem_cComponent_iff_cComponentOf_eq M.toSWIGGraph hnodeObs hCcomp).mp hvC ▸ ((mem_cComponent_iff_cComponentOf_eq M.toSWIGGraph hnodeObs hScomp).mp hiS).symm exact False.elim (hCS hSC.symm) · intro hv rcases Finset.mem_inter.mp hv with ⟨hvC, hvpre⟩ exact Finset.mem_inter.mpr ⟨hvC, prefixIn_mono H D (le_succ i.val) hvpre⟩ -
family_inter_prefixIn_succ_eq_of_nelemma — Given a finite graph, node set, two families, and a prefix index, if the next prefix node lies in the first family and the families are disjoint, then intersecting the second family with the prefix is unchanged at that step.hypothesesconclusionC ∩ H.prefixIn D (i.val + 1) = C ∩ H.prefixIn D i.valProof (Lean source)
lemma family_inter_prefixIn_succ_eq_of_ne (H : SWIGGraph N) (D : Finset (SWIGNode N)) {S C : Finset (SWIGNode N)} {i : Fin D.card} (hiS : (H.nodesAt D i).val ∈ S) (hdisj : Disjoint C S) : C ∩ H.prefixIn D (i.val + 1) = C ∩ H.prefixIn D i.val := by classical ext v constructor · intro hv rcases Finset.mem_inter.mp hv with ⟨hvC, hvpre⟩ rw [prefixIn_succ H D i.isLt] at hvpre rcases Finset.mem_union.mp hvpre with hvold | hvnew · exact Finset.mem_inter.mpr ⟨hvC, hvold⟩ · have hvnode : v = (H.nodesAt D i).val := by simpa using hvnew subst hvnode exact False.elim (Finset.disjoint_left.mp hdisj hvC hiS) · intro hv rcases Finset.mem_inter.mp hv with ⟨hvC, hvpre⟩ exact Finset.mem_inter.mpr ⟨hvC, prefixIn_mono H D (le_succ i.val) hvpre⟩ -
cComponent_inter_prefixIn_succ_eq_of_node_not_memlemma — Given a finite graph, node set, component, and prefix index, if the next prefix node is outside the component, then the component's intersection with the prefix is unchanged at that step.hypothesesconclusionS ∩ H.prefixIn D (i.val + 1) = S ∩ H.prefixIn D i.valProof (Lean source)
lemma cComponent_inter_prefixIn_succ_eq_of_node_not_mem (H : SWIGGraph N) (D : Finset (SWIGNode N)) {S : Finset (SWIGNode N)} {i : Fin D.card} (hiS : (H.nodesAt D i).val ∉ S) : S ∩ H.prefixIn D (i.val + 1) = S ∩ H.prefixIn D i.val := by classical ext v constructor · intro hv rcases Finset.mem_inter.mp hv with ⟨hvS, hvpre⟩ rw [prefixIn_succ H D i.isLt] at hvpre rcases Finset.mem_union.mp hvpre with hvold | hvnew · exact Finset.mem_inter.mpr ⟨hvS, hvold⟩ · have hvnode : v = (H.nodesAt D i).val := by simpa using hvnew subst hvnode exact False.elim (hiS hvS) · intro hv rcases Finset.mem_inter.mp hv with ⟨hvS, hvpre⟩ exact Finset.mem_inter.mpr ⟨hvS, prefixIn_mono H D (le_succ i.val) hvpre⟩
RatioProduct 1 core · 7 supporting This file shows how ratios of prefix q-mass products isolate a selected component. ★ identifyMassRec_qLocalMass
Prefix-ratio products for recursive q-factor recovery
This file shows how ratios of prefix q-mass products isolate a selected
component. It culminates in district extraction and the correspondence between
identifyMassRec and the local q-mass recovered along an IDENTIFY certificate.
For a finite structural causal model with finite measurable node-value spaces, a fixed-node assignment, positive observational atom masses, source and target districts, evidence that the source is observed, a recursive c-factor reachability certificate from source to target, and an observed realization, the observational IDENTIFY recursion recovers the target district's local q-mass from the source district's local q-mass.
Formal statement
Proof (Lean source)
7 supporting declarations (lemmas, instances)
-
prefixIn_qProduct_ratio_eq_component_ratio_of_familylemma — In a product over an abstract pairwise-disjoint family, the prefix-ratio step at a node of S cancels every factor except the S factor.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)M :SCM N ΩH :s :M.FixedValueshS𝒞 :S ∈ 𝒞hdisj :∀ C ∈ 𝒞ifC ≠ SthenDisjoint C Si :Fin D.cardhDobs :D ⊆ M.observedhiS :(H.nodesAt D i).val ∈ Shpos :DiscreteID.PositiveMass (M.obsKernel s)conclusion(∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x) / (∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x)= M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) xProof (Lean source)
lemma prefixIn_qProduct_ratio_eq_component_ratio_of_family [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (H : SWIGGraph N) (D : Finset (SWIGNode N)) (s : M.FixedValues) (𝒞 : Finset (Finset (SWIGNode N))) (S : Finset (SWIGNode N)) (hS𝒞 : S ∈ 𝒞) (hdisj : ∀ C ∈ 𝒞, C ≠ S → Disjoint C S) (i : Fin D.card) (hDobs : D ⊆ M.observed) (hiS : (H.nodesAt D i).val ∈ S) (hpos : DiscreteID.PositiveMass (M.obsKernel s)) (x : ValuesOn M.observed (swigΩ Ω)) : (∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x) / (∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) = M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x := by classical let f₁ : Finset (SWIGNode N) → ENNReal := fun C => M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x let f₀ : Finset (SWIGNode N) → ENNReal := fun C => M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x have hrest : ∏ C ∈ 𝒞 \ {S}, f₁ C = ∏ C ∈ 𝒞 \ {S}, f₀ C := by refine Finset.prod_congr rfl ?_ intro C hC have hC𝒞 : C ∈ 𝒞 := (Finset.mem_sdiff.mp hC).1 have hCne : C ≠ S := by intro h exact (Finset.mem_sdiff.mp hC).2 (by simp [h]) simp [f₁, f₀, family_inter_prefixIn_succ_eq_of_ne H D hiS (hdisj C hC𝒞 hCne)] have hsplit₁ : (∏ C ∈ 𝒞, f₁ C) = f₁ S * ∏ C ∈ 𝒞 \ {S}, f₁ C := by exact Finset.prod_eq_mul_prod_diff_singleton S f₁ (by intro h; exact False.elim (h hS𝒞)) have hsplit₀ : (∏ C ∈ 𝒞, f₀ C) = f₀ S * ∏ C ∈ 𝒞 \ {S}, f₀ C := by exact Finset.prod_eq_mul_prod_diff_singleton S f₀ (by intro h; exact False.elim (h hS𝒞)) have hr0 : (∏ C ∈ 𝒞 \ {S}, f₀ C) ≠ 0 := by exact Finset.prod_ne_zero_iff.mpr (by intro C _hC exact M.qLocalMass_pos_of_positiveObs s hpos (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) have hrtop : (∏ C ∈ 𝒞 \ {S}, f₀ C) ≠ ∞ := by exact Finset.prod_ne_top_of_ne_top _ f₀ (by intro C _hC exact qLocalMass_ne_top M s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) change (∏ C ∈ 𝒞, f₁ C) / (∏ C ∈ 𝒞, f₀ C) = f₁ S / f₀ S rw [hsplit₁, hsplit₀, hrest] exact ENNReal.div_mul_common hr0 hrtop -
prefixIn_qProduct_ratio_eq_component_ratio_of_ne_zerolemma — Given a finite structural causal model, graph, observed node set, fixed assignment, district, prefix index, and observed assignment, if the set is a district, the node set is observed, the next prefix node lies in that district, and the product of all other district factors is nonzero, then the ratio of successive full prefix products equals the corresponding ratio for that district.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)M :SCM N ΩH :s :M.FixedValueshScomp :S ∈ M.toSWIGGraph.cComponentSeti :Fin D.cardhDobs :D ⊆ M.observedhiS :(H.nodesAt D i).val ∈ Shrest0 :(∏ C ∈ M.toSWIGGraph.cComponentSet \ {S}, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x)≠ 0conclusion(∏ C ∈ M.toSWIGGraph.cComponentSet, M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x) / (∏ C ∈ M.toSWIGGraph.cComponentSet, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x)= M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) xProof (Lean source)
lemma prefixIn_qProduct_ratio_eq_component_ratio_of_ne_zero [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (H : SWIGGraph N) (D : Finset (SWIGNode N)) (s : M.FixedValues) (S : Finset (SWIGNode N)) (hScomp : S ∈ M.toSWIGGraph.cComponentSet) (i : Fin D.card) (hDobs : D ⊆ M.observed) (hiS : (H.nodesAt D i).val ∈ S) (x : ValuesOn M.observed (swigΩ Ω)) (hrest0 : (∏ C ∈ M.toSWIGGraph.cComponentSet \ {S}, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) ≠ 0) : (∏ C ∈ M.toSWIGGraph.cComponentSet, M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x) / (∏ C ∈ M.toSWIGGraph.cComponentSet, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) = M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x := by classical let f₁ : Finset (SWIGNode N) → ENNReal := fun C => M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x let f₀ : Finset (SWIGNode N) → ENNReal := fun C => M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x have hrest : ∏ C ∈ M.toSWIGGraph.cComponentSet \ {S}, f₁ C = ∏ C ∈ M.toSWIGGraph.cComponentSet \ {S}, f₀ C := by refine Finset.prod_congr rfl ?_ intro C hC have hCcomp : C ∈ M.toSWIGGraph.cComponentSet := (Finset.mem_sdiff.mp hC).1 have hCne : C ≠ S := by intro h exact (Finset.mem_sdiff.mp hC).2 (by simp [h]) simp [f₁, f₀, cComponent_inter_prefixIn_succ_eq_of_ne M H D hScomp hCcomp hDobs hiS hCne] have hsplit₁ : (∏ C ∈ M.toSWIGGraph.cComponentSet, f₁ C) = f₁ S * ∏ C ∈ M.toSWIGGraph.cComponentSet \ {S}, f₁ C := by exact Finset.prod_eq_mul_prod_diff_singleton S f₁ (by intro h; exact False.elim (h hScomp)) have hsplit₀ : (∏ C ∈ M.toSWIGGraph.cComponentSet, f₀ C) = f₀ S * ∏ C ∈ M.toSWIGGraph.cComponentSet \ {S}, f₀ C := by exact Finset.prod_eq_mul_prod_diff_singleton S f₀ (by intro h; exact False.elim (h hScomp)) have hrtop : (∏ C ∈ M.toSWIGGraph.cComponentSet \ {S}, f₀ C) ≠ ∞ := by exact Finset.prod_ne_top_of_ne_top _ f₀ (by intro C _hC exact qLocalMass_ne_top M s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) change (∏ C ∈ M.toSWIGGraph.cComponentSet, f₁ C) / (∏ C ∈ M.toSWIGGraph.cComponentSet, f₀ C) = f₁ S / f₀ S rw [hsplit₁, hsplit₀, hrest] exact ENNReal.div_mul_common hrest0 hrtop -
prefixIn_qProduct_ratio_eq_component_ratio_of_family_of_ne_zerolemma — Nonzero-denominator variant of prefixIn_qProduct_ratio_eq_component_ratio_of_family.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)M :SCM N ΩH :s :M.FixedValueshS𝒞 :S ∈ 𝒞hdisj :∀ C ∈ 𝒞ifC ≠ SthenDisjoint C Si :Fin D.cardhDobs :D ⊆ M.observedhiS :(H.nodesAt D i).val ∈ Shrest0 :(∏ C ∈ 𝒞 \ {S}, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x)≠ 0conclusion(∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x) / (∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x)= M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) xProof (Lean source)
lemma prefixIn_qProduct_ratio_eq_component_ratio_of_family_of_ne_zero [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (H : SWIGGraph N) (D : Finset (SWIGNode N)) (s : M.FixedValues) (𝒞 : Finset (Finset (SWIGNode N))) (S : Finset (SWIGNode N)) (hS𝒞 : S ∈ 𝒞) (hdisj : ∀ C ∈ 𝒞, C ≠ S → Disjoint C S) (i : Fin D.card) (hDobs : D ⊆ M.observed) (hiS : (H.nodesAt D i).val ∈ S) (x : ValuesOn M.observed (swigΩ Ω)) (hrest0 : (∏ C ∈ 𝒞 \ {S}, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) ≠ 0) : (∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x) / (∏ C ∈ 𝒞, M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) = M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x := by classical let f₁ : Finset (SWIGNode N) → ENNReal := fun C => M.qLocalMass s (C ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hDobs (H.prefixIn_subset D (i.val + 1) (mem_of_mem_inter_right hv))) x let f₀ : Finset (SWIGNode N) → ENNReal := fun C => M.qLocalMass s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x have hrest : ∏ C ∈ 𝒞 \ {S}, f₁ C = ∏ C ∈ 𝒞 \ {S}, f₀ C := by refine Finset.prod_congr rfl ?_ intro C hC have hC𝒞 : C ∈ 𝒞 := (Finset.mem_sdiff.mp hC).1 have hCne : C ≠ S := by intro h exact (Finset.mem_sdiff.mp hC).2 (by simp [h]) simp [f₁, f₀, family_inter_prefixIn_succ_eq_of_ne H D hiS (hdisj C hC𝒞 hCne)] have hsplit₁ : (∏ C ∈ 𝒞, f₁ C) = f₁ S * ∏ C ∈ 𝒞 \ {S}, f₁ C := by exact Finset.prod_eq_mul_prod_diff_singleton S f₁ (by intro h; exact False.elim (h hS𝒞)) have hsplit₀ : (∏ C ∈ 𝒞, f₀ C) = f₀ S * ∏ C ∈ 𝒞 \ {S}, f₀ C := by exact Finset.prod_eq_mul_prod_diff_singleton S f₀ (by intro h; exact False.elim (h hS𝒞)) have hrtop : (∏ C ∈ 𝒞 \ {S}, f₀ C) ≠ ∞ := by exact Finset.prod_ne_top_of_ne_top _ f₀ (by intro C _hC exact qLocalMass_ne_top M s (C ∩ H.prefixIn D i.val) (fun _ hv => hDobs (H.prefixIn_subset D i.val (mem_of_mem_inter_right hv))) x) change (∏ C ∈ 𝒞, f₁ C) / (∏ C ∈ 𝒞, f₀ C) = f₁ S / f₀ S rw [hsplit₁, hsplit₀, hrest] exact ENNReal.div_mul_common hrest0 hrtop -
component_qLocalMass_ratio_product_prefixIn_of_ne_zerolemma — Given a finite structural causal model, graph, node set, fixed assignment, district, and observed assignment, if the district is observed, it lies in the node set, and all of its prefix local masses are nonzero, then the product of its successive prefix-mass ratios equals its full local mass.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)M :SCM N ΩH :s :M.FixedValueshS :S ⊆ M.observedhSD :S ⊆ Dhne :conclusion(∏ i ∈ Finset.univ.filter (fun i : Fin D.card => (H.nodesAt D i).val ∈ S), M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hS (mem_of_mem_inter_left hv)) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hS (mem_of_mem_inter_left hv)) x)= M.qLocalMass s S hS xProof (Lean source)
lemma component_qLocalMass_ratio_product_prefixIn_of_ne_zero [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (H : SWIGGraph N) (D : Finset (SWIGNode N)) (s : M.FixedValues) (S : Finset (SWIGNode N)) (hS : S ⊆ M.observed) (hSD : S ⊆ D) (x : ValuesOn M.observed (swigΩ Ω)) (hne : ∀ k ≤ D.card, M.qLocalMass s (S ∩ H.prefixIn D k) (fun _ hv => hS (mem_of_mem_inter_left hv)) x ≠ 0) : (∏ i ∈ Finset.univ.filter (fun i : Fin D.card => (H.nodesAt D i).val ∈ S), M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hS (mem_of_mem_inter_left hv)) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hS (mem_of_mem_inter_left hv)) x) = M.qLocalMass s S hS x := by classical let hPrefObs : ∀ k, S ∩ H.prefixIn D k ⊆ M.observed := fun k _ hv => hS (mem_of_mem_inter_left hv) let a : ℕ → ENNReal := fun k => M.qLocalMass s (S ∩ H.prefixIn D k) (hPrefObs k) x let T : Finset ℕ := (range D.card).filter fun k => if hk : k < D.card then (H.nodesAt D ⟨k, hk⟩).val ∈ S else False have hreindex : (∏ i ∈ Finset.univ.filter (fun i : Fin D.card => (H.nodesAt D i).val ∈ S), a (i.val + 1) / a i.val) = ∏ k ∈ T, a (k + 1) / a k := by refine Finset.prod_bij (fun i _hi => i.val) ?_ ?_ ?_ ?_ · intro i hi simp [T, i.isLt, Finset.mem_filter.mp hi] · intro i _hi j _hj hij exact Fin.ext hij · intro k hk simp [T] at hk have hklt : k < D.card := hk.1 refine ⟨⟨k, hklt⟩, ?_, rfl⟩ rw [mem_filter] exact ⟨Finset.mem_univ _, by simpa [hklt] using hk.2⟩ · intro i _hi rfl have hTsubset : T ⊆ range D.card := by intro k hk exact (Finset.mem_filter.mp hk).1 have hne' : ∀ k ≤ D.card, a k ≠ 0 := by intro k hk exact hne k hk have hfin : ∀ k ≤ D.card, a k ≠ ∞ := by intro k hk exact qLocalMass_ne_top M s (S ∩ H.prefixIn D k) (hPrefObs k) x have hconst : ∀ k < D.card, k ∉ T → a (k + 1) = a k := by intro k hk hnot have hnode_not : (H.nodesAt D ⟨k, hk⟩).val ∉ S := by intro hnode exact hnot (by simp [T, hk, hnode]) dsimp [a] have hset : S ∩ H.prefixIn D (k + 1) = S ∩ H.prefixIn D k := cComponent_inter_prefixIn_succ_eq_of_node_not_mem H D hnode_not unfold qLocalMass congr 1 ext ℓ constructor · intro hℓ v hv have hv' : v ∈ S ∩ H.prefixIn D (k + 1) := by simpa [hset] using hv simpa using hℓ v hv' · intro hℓ v hv have hv' : v ∈ S ∩ H.prefixIn D k := by simpa [hset] using hv simpa using hℓ v hv' have htelescope : ∏ k ∈ T, a (k + 1) / a k = a D.card / a 0 := prod_filter_div_telescope a D.card T hTsubset hne' hfin hconst have htop : S ∩ H.prefixIn D D.card = S := by rw [prefixIn_card H D] exact Finset.inter_eq_left.mpr hSD have hzero : S ∩ H.prefixIn D 0 = ∅ := by rw [prefixIn_zero H D, Finset.inter_empty] calc (∏ i ∈ Finset.univ.filter (fun i : Fin D.card => (H.nodesAt D i).val ∈ S), M.qLocalMass s (S ∩ H.prefixIn D (i.val + 1)) (fun _ hv => hS (mem_of_mem_inter_left hv)) x / M.qLocalMass s (S ∩ H.prefixIn D i.val) (fun _ hv => hS (mem_of_mem_inter_left hv)) x) = ∏ i ∈ Finset.univ.filter (fun i : Fin D.card => (H.nodesAt D i).val ∈ S), a (i.val + 1) / a i.val := by rfl _ = ∏ k ∈ T, a (k + 1) / a k := hreindex _ = a D.card / a 0 := htelescope _ = M.qLocalMass s S hS x / 1 := by simp [a, htop, hzero] _ = M.qLocalMass s S hS x := by simp -
extractDistrict_qLocalMasslemma — Given a finite structural causal model, fixed assignment, ancestral set, and induced district, if the ancestral set is observed, the set is a district of the induced graph, and the observational kernel has positive mass, then for an observed assignment, extracting the district from the ancestral local mass recovers that district's local mass.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)M :SCM N Ωs :M.FixedValueshA :A ⊆ M.observedhC' :C' ∈ (M.toSWIGGraph.induce A).cComponentSethpos :DiscreteID.PositiveMass (M.obsKernel s)conclusionextractDistrict M.observed (M.toSWIGGraph.induce A) A C' hA (M.qLocalMass s A hA) x= M.qLocalMass s C' (fun _ hv => hA (by have hHobs : (M.toSWIGGraph.induce A).observed = A := by simp [SWIGGraph.induce, Finset.inter_eq_left.mpr hA] exact hHobs ▸ (M.toSWIGGraph.induce A).cComponentSet_subset_observed C' hC' hv)) xProof (Lean source)
lemma extractDistrict_qLocalMass [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (s : M.FixedValues) (A C' : Finset (SWIGNode N)) (hA : A ⊆ M.observed) (hC' : C' ∈ (M.toSWIGGraph.induce A).cComponentSet) (hpos : DiscreteID.PositiveMass (M.obsKernel s)) (x : ValuesOn M.observed (swigΩ Ω)) : extractDistrict M.observed (M.toSWIGGraph.induce A) A C' hA (M.qLocalMass s A hA) x = M.qLocalMass s C' (fun _ hv => hA (by have hHobs : (M.toSWIGGraph.induce A).observed = A := by simp [SWIGGraph.induce, Finset.inter_eq_left.mpr hA] exact hHobs ▸ (M.toSWIGGraph.induce A).cComponentSet_subset_observed C' hC' hv)) x := by classical let H := M.toSWIGGraph.induce A have hHobs : H.observed = A := by simp [H, SWIGGraph.induce, Finset.inter_eq_left.mpr hA] have hCobs : C' ⊆ M.observed := by intro v hv exact hA (hHobs ▸ H.cComponentSet_subset_observed C' hC' hv) have hCA : C' ⊆ A := by intro v hv exact hHobs ▸ H.cComponentSet_subset_observed C' hC' hv have hdisj : (↑H.cComponentSet : Set (Finset (SWIGNode N))).Pairwise (fun U U' => Disjoint U U') := by intro U hU V hV hne exact H.cComponentSet_pairwise_disjoint hU hV hne have hmarg : ∀ k, marginalizeOn M.observed (A \ H.prefixIn A k) (fun _ hv => hA ((Finset.mem_sdiff.mp hv).1)) (M.qLocalMass s A hA) x = M.qLocalMass s (H.prefixIn A k) (fun _ hv => hA (H.prefixIn_subset A k hv)) x := by intro k simpa [H] using M.qLocalMass_marginalize_ancestralClosed s A (H.prefixIn A k) hA (H.prefixIn_subset A k) (prefixIn_parent_closed_induce_observed M A hA k) x have hprod : ∀ k, M.qLocalMass s (H.prefixIn A k) (fun _ hv => hA (H.prefixIn_subset A k hv)) x = ∏ C ∈ H.cComponentSet, M.qLocalMass s (C ∩ H.prefixIn A k) (fun _ hv => hA (H.prefixIn_subset A k (mem_of_mem_inter_right hv))) x := by intro k simpa [H] using qLocalMass_prefixIn_eq_prod_induce_components M s A hA k x unfold SCM.extractDistrict calc (∏ i ∈ Finset.univ.filter (fun i : Fin A.card => (H.nodesAt A i).val ∈ C'), marginalizeOn M.observed (A \ H.prefixIn A (i.val + 1)) (fun _ hv => hA ((Finset.mem_sdiff.mp hv).1)) (M.qLocalMass s A hA) x / marginalizeOn M.observed (A \ H.prefixIn A i.val) (fun _ hv => hA ((Finset.mem_sdiff.mp hv).1)) (M.qLocalMass s A hA) x) = ∏ i ∈ Finset.univ.filter (fun i : Fin A.card => (H.nodesAt A i).val ∈ C'), (∏ C ∈ H.cComponentSet, M.qLocalMass s (C ∩ H.prefixIn A (i.val + 1)) (fun _ hv => hA (H.prefixIn_subset A (i.val + 1) (mem_of_mem_inter_right hv))) x) / (∏ C ∈ H.cComponentSet, M.qLocalMass s (C ∩ H.prefixIn A i.val) (fun _ hv => hA (H.prefixIn_subset A i.val (mem_of_mem_inter_right hv))) x) := by refine Finset.prod_congr rfl ?_ intro i _hi rw [hmarg (i.val + 1), hmarg i.val, hprod (i.val + 1), hprod i.val] _ = ∏ i ∈ Finset.univ.filter (fun i : Fin A.card => (H.nodesAt A i).val ∈ C'), M.qLocalMass s (C' ∩ H.prefixIn A (i.val + 1)) (fun _ hv => hA (H.prefixIn_subset A (i.val + 1) (mem_of_mem_inter_right hv))) x / M.qLocalMass s (C' ∩ H.prefixIn A i.val) (fun _ hv => hA (H.prefixIn_subset A i.val (mem_of_mem_inter_right hv))) x := by refine Finset.prod_congr rfl ?_ intro i hi have hiC : (H.nodesAt A i).val ∈ C' := (Finset.mem_filter.mp hi).2 exact prefixIn_qProduct_ratio_eq_component_ratio_of_family M H A s H.cComponentSet C' hC' (fun C hC hne => hdisj hC hC' hne) i hA hiC hpos x _ = M.qLocalMass s C' hCobs x := by simpa using component_qLocalMass_ratio_product_prefixIn M H A s C' hCobs hCA hpos x _ = M.qLocalMass s C' (fun _ hv => hA (by have hHobs' : (M.toSWIGGraph.induce A).observed = A := by simp [SWIGGraph.induce, Finset.inter_eq_left.mpr hA] exact hHobs' ▸ (M.toSWIGGraph.induce A).cComponentSet_subset_observed C' hC' hv)) x := by rfl -
target_subsettheorem — The target set of a recursive c-factor reachability certificate is contained in the source set.Proof (Lean source)
theorem CFactorReachableRec.target_subset {G : SWIGGraph N} {T C : Finset (SWIGNode N)} (h : CFactorReachableRec G T C) : C ⊆ T := by cases h with | base _ hCT _ => exact hCT | step _ hCT _ _ _ => exact hCT -
qLocalMass_obsProof_irrellemma — The local q-mass of an observed variable set does not depend on which proof establishes that the set is observed.hypothesesconclusionM.qLocalMass s T hT x = M.qLocalMass s T hT' x
TianRecovery 3 core · 0 supporting This file identifies a district density of the post-intervention ancestral law with a mechanism c-factor and, for a full c-component, with the corresponding observational c-component density. ★ tianDistrictDensity_eq_mechCFactor_doModel★ tianDistrictDensity_eq_qLocalMass_div_jointRef_district★ tian_full_cComponent_density_recovery
Tian district-density recovery
This file identifies a district density of the post-intervention ancestral law with a mechanism c-factor and, for a full c-component, with the corresponding observational c-component density. It contains the terminal recovery results assembled from the prefix-mass lemmas and mechanism invariance.
(B) Tian Lemma 1 for the do-model ancestral marginal. Consider a structural causal model M with an intervention set X whose random copies are observed and whose fixed copies are not already frozen, an outcome set Y disjoint from the random copies of X, under a faithful reference-measure family, a positive observational kernel at every fixed-value assignment, and the standing assumption that M is a standard model. For a set S that is simultaneously a district of the post-intervention ancestral graph and a full c-component of M, and an extension map that inverts the projection onto the ancestral observed coordinates, the Tian district density read off the do(X)-law ancestral marginal at S agrees with the mechanism c-factor of the post-intervention model at the extended point.
Formal statement
Proof (Lean source)
Consider an intervention set X whose random copies are observed and whose fixed copies are not already frozen together with an outcome set Y disjoint from the random copies of X, under a faithful reference-measure family and a positive observational kernel at every fixed-value assignment. For any district S of the post-intervention ancestral graph and an extension map inverting the projection onto the ancestral observed coordinates, the Tian district density read off the do(X)-law ancestral marginal at S equals the do-model local q-mass on S divided by the reference atom mass of S.
Formal statement
Proof (Lean source)
District recovery by c-factor projection consistency. Consider a standard structural causal model M with an intervention set X whose random copies are observed and whose fixed copies are not already frozen, under a faithful reference-measure family and a positive observational kernel at every fixed-value assignment, for an outcome set Y disjoint from the random copies of X. For a set S that is simultaneously a district of the post-intervention ancestral graph and a full c-component of M, and an extension map that inverts the projection onto the ancestral observed coordinates and reproduces the intervention values sDo on the intervened coordinates, the Tian district density read off the do(X)-law ancestral marginal at S agrees, almost everywhere with respect to the product reference measure on the ancestral observed coordinates, with the observational c-component density factor at S pulled back through the extension.
Formal statement
Proof (Lean source)
TianRecoveryLemmas 1 core · 6 supporting This file relates prefix singleton masses, reference atoms, local q-masses, and Tian prefix-step densities. ★ doObsKernelAncestralMarginal_prefix_singleton_eq_prod_H_qLocalMass
Point-mass lemmas for Tian density recovery
This file relates prefix singleton masses, reference atoms, local q-masses, and
Tian prefix-step densities. These lemmas supply the pointwise calculations
used by the district-recovery theorems in TianRecovery.
For a finite structural causal model with finite measurable node-value spaces, an intervention set, evidence that its random copies are observed, evidence that its fixed copies are not already fixed, an outcome set, a fixed-node assignment after intervention, an extension from the ancestral observed margin to the original observed space, proof that extension preserves that margin, a prefix length, and a realization on the ancestral margin, the intervened observational law's singleton mass on that prefix equals the product of the induced graph's local q-masses over its c-components.
Formal statement
Proof (Lean source)
6 supporting declarations (lemmas, instances)
-
component_ref_atom_product_eq_jointRef_prefixInlemma — For a subset of an ordered finite graph set, the product of coordinate reference-measure masses at selected values equals the reference measure's mass at their joint singleton outcome.hypothesesProof (Lean source)
lemma component_ref_atom_product_eq_jointRef_prefixIn [∀ n, MeasurableSingletonClass (Ω n)] (H : SWIGGraph N) (D : Finset (SWIGNode N)) (ref : ReferenceMeasures Ω) (S : Finset (SWIGNode N)) (hSD : S ⊆ D) (xD : ValuesOn D (swigΩ Ω)) : (∏ i ∈ Finset.univ.filter (fun i : Fin D.card => (H.nodesAt D i).val ∈ S), ref.μ (H.nodesAt D i).val ({xD (H.nodesAt D i)} : Set (swigΩ Ω (H.nodesAt D i).val))) = jointRef ref S ({valuesProjection hSD xD} : Set (ValuesOn S (swigΩ Ω))) := by classical have hprod : (∏ i ∈ Finset.univ.filter (fun i : Fin D.card => (H.nodesAt D i).val ∈ S), ref.μ (H.nodesAt D i).val ({xD (H.nodesAt D i)} : Set (swigΩ Ω (H.nodesAt D i).val))) = ∏ v : {v // v ∈ S}, ref.μ v.val ({(valuesProjection hSD xD) v} : Set (swigΩ Ω v.val)) := by refine Finset.prod_bij (fun i hi => ⟨(H.nodesAt D i).val, (Finset.mem_filter.mp hi).2⟩) ?_ ?_ ?_ ?_ · intro i hi exact Finset.mem_univ _ · intro i _hi j _hj hij have hval : (H.nodesAt D i).val = (H.nodesAt D j).val := congrArg (fun v : {v // v ∈ S} => v.val) hij have hsub : H.nodesAt D i = H.nodesAt D j := Subtype.ext hval calc i = H.nodeIndex D (H.nodesAt D i) := by simp [SWIGGraph.nodeIndex, SWIGGraph.nodesAt] _ = H.nodeIndex D (H.nodesAt D j) := by rw [hsub] _ = j := by simp [SWIGGraph.nodeIndex, SWIGGraph.nodesAt] · intro v _hv let i : Fin D.card := H.nodeIndex D ⟨v.val, hSD v.property⟩ have hnode : (H.nodesAt D i).val = v.val := by have hround : H.nodesAt D (H.nodeIndex D ⟨v.val, hSD v.property⟩) = ⟨v.val, hSD v.property⟩ := by simp [SWIGGraph.nodeIndex, SWIGGraph.nodesAt] exact congrArg val hround refine ⟨i, ?_, ?_⟩ · rw [mem_filter] exact ⟨Finset.mem_univ _, by simp [hnode, v.property]⟩ · exact Subtype.ext hnode · intro i hi simp [valuesProjection] rw [jointRef_singleton_eq_prod] exact hprod -
prefix_pair_singleton_mass_eq_succ_prefix_masslemma — The mass of a realized prefix together with its next coordinate equals the mass of the same realization of the successor prefix under any measure on the ordered graph values.hypothesesconclusion(μ.map (fun ω : ValuesOn D (swigΩ Ω) => (valuesProjection (H.prefixIn_subset D i.val) ω, valuesProjection (show ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D from by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property) ω))) ({(valuesProjection (H.prefixIn_subset D i.val) x, valuesProjection (show ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D from by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property) x)} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω) × ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω)))= (μ.map (valuesProjection (H.prefixIn_subset D (i.val + 1)))) ({valuesProjection (H.prefixIn_subset D (i.val + 1)) x} : Set (ValuesOn (H.prefixIn D (i.val + 1)) (swigΩ Ω)))Proof (Lean source)
lemma prefix_pair_singleton_mass_eq_succ_prefix_mass [∀ n, MeasurableSingletonClass (Ω n)] (H : SWIGGraph N) (D : Finset (SWIGNode N)) (μ : Measure (ValuesOn D (swigΩ Ω))) (i : Fin D.card) (x : ValuesOn D (swigΩ Ω)) : (μ.map (fun ω : ValuesOn D (swigΩ Ω) => (valuesProjection (H.prefixIn_subset D i.val) ω, valuesProjection (show ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D from by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property) ω))) ({(valuesProjection (H.prefixIn_subset D i.val) x, valuesProjection (show ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D from by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property) x)} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω) × ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω))) = (μ.map (valuesProjection (H.prefixIn_subset D (i.val + 1)))) ({valuesProjection (H.prefixIn_subset D (i.val + 1)) x} : Set (ValuesOn (H.prefixIn D (i.val + 1)) (swigΩ Ω))) := by classical let hNodeD : ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D := by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property let pairMap : ValuesOn D (swigΩ Ω) → ValuesOn (H.prefixIn D i.val) (swigΩ Ω) × ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω) := fun ω => (valuesProjection (H.prefixIn_subset D i.val) ω, valuesProjection hNodeD ω) let succMap : ValuesOn D (swigΩ Ω) → ValuesOn (H.prefixIn D (i.val + 1)) (swigΩ Ω) := valuesProjection (H.prefixIn_subset D (i.val + 1)) have hsets : pairMap ⁻¹' ({(valuesProjection (H.prefixIn_subset D i.val) x, valuesProjection hNodeD x)} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω) × ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω))) = succMap ⁻¹' ({valuesProjection (H.prefixIn_subset D (i.val + 1)) x} : Set (ValuesOn (H.prefixIn D (i.val + 1)) (swigΩ Ω))) := by ext ω constructor · intro hω have hpre : valuesProjection (H.prefixIn_subset D i.val) ω = valuesProjection (H.prefixIn_subset D i.val) x := congrArg Prod.fst hω have hnode : valuesProjection hNodeD ω = valuesProjection hNodeD x := congrArg Prod.snd hω ext v by_cases hvpre : v.val ∈ H.prefixIn D i.val · have h := congrFun hpre ⟨v.val, hvpre⟩ simpa [succMap, valuesProjection] using h · have hvnode : v.val = (H.nodesAt D i).val := by have hvsucc : v.val ∈ H.prefixIn D (i.val + 1) := v.property have hvsucc' : v.val ∈ H.prefixIn D i.val ∪ {(H.nodesAt D i).val} := by simpa [prefixIn_succ H D i.isLt] using hvsucc rcases Finset.mem_union.mp hvsucc' with hvold | hvnew · exact False.elim (hvpre hvold) · simpa using hvnew have h := congrFun hnode ⟨v.val, by simpa [hvnode] using mem_singleton_self (H.nodesAt D i).val⟩ simpa [succMap, valuesProjection, hvnode] using h · intro hω have hsucc : valuesProjection (H.prefixIn_subset D (i.val + 1)) ω = valuesProjection (H.prefixIn_subset D (i.val + 1)) x := hω apply Prod.ext · ext v have hvsucc : v.val ∈ H.prefixIn D (i.val + 1) := prefixIn_mono H D (le_succ i.val) v.property have h := congrFun hsucc ⟨v.val, hvsucc⟩ simpa [pairMap, valuesProjection] using h · ext v have hvnode : v.val = (H.nodesAt D i).val := by exact Finset.mem_singleton.mp v.property have hvsucc : v.val ∈ H.prefixIn D (i.val + 1) := by rw [hvnode, nodesAt_mem_prefixIn_iff H D (i.val + 1) i] exact lt_succ_self i.val have h := congrFun hsucc ⟨v.val, hvsucc⟩ simpa [pairMap, valuesProjection] using h rw [MeasureTheory.Measure.map_apply ((measurable_valuesProjection (H.prefixIn_subset D i.val)).prod (measurable_valuesProjection hNodeD)) (MeasurableSet.singleton _), MeasureTheory.Measure.map_apply (measurable_valuesProjection (H.prefixIn_subset D (i.val + 1))) (MeasurableSet.singleton _), hsets] -
tianPrefixStepDensity_eq_prefix_mass_ratiolemma — When the preceding prefix has nonzero singleton mass, the one-step Tian density is the ratio of the successive prefix singleton masses, divided by the singleton reference mass of the added variable.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)H :ref :href :∀ (k : ℕ) (hk : k < D.card),i :Fin D.cardhprefix0 :(μ.map (valuesProjection (H.prefixIn_subset D i.val))) ({valuesProjection (H.prefixIn_subset D i.val) x} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω)))≠ 0conclusiontianPrefixStepDensity H D μ ref i x= ((μ.map (valuesProjection (H.prefixIn_subset D (i.val + 1)))) ({valuesProjection (H.prefixIn_subset D (i.val + 1)) x} : Set (ValuesOn (H.prefixIn D (i.val + 1)) (swigΩ Ω))) / (μ.map (valuesProjection (H.prefixIn_subset D i.val))) ({valuesProjection (H.prefixIn_subset D i.val) x} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω)))) / jointRef ref ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ({valuesProjection (show ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D from by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property) x} : Set (ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω)))Proof (Lean source)
lemma tianPrefixStepDensity_eq_prefix_mass_ratio [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (H : SWIGGraph N) (D : Finset (SWIGNode N)) (μ : Measure (ValuesOn D (swigΩ Ω))) (ref : ReferenceMeasures Ω) (href : ReferenceFaithful ref) [IsFiniteMeasure μ] [∀ (k : ℕ) (hk : k < D.card), StandardBorelSpace (ValuesOn ({(H.nodesAt D ⟨k, hk⟩).val} : Finset (SWIGNode N)) (swigΩ Ω))] [∀ (k : ℕ) (hk : k < D.card), Nonempty (ValuesOn ({(H.nodesAt D ⟨k, hk⟩).val} : Finset (SWIGNode N)) (swigΩ Ω))] (i : Fin D.card) (x : ValuesOn D (swigΩ Ω)) (hprefix0 : (μ.map (valuesProjection (H.prefixIn_subset D i.val))) ({valuesProjection (H.prefixIn_subset D i.val) x} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω))) ≠ 0) : tianPrefixStepDensity H D μ ref i x = ((μ.map (valuesProjection (H.prefixIn_subset D (i.val + 1)))) ({valuesProjection (H.prefixIn_subset D (i.val + 1)) x} : Set (ValuesOn (H.prefixIn D (i.val + 1)) (swigΩ Ω))) / (μ.map (valuesProjection (H.prefixIn_subset D i.val))) ({valuesProjection (H.prefixIn_subset D i.val) x} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω)))) / jointRef ref ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ({valuesProjection (show ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D from by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property) x} : Set (ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω))) := by classical let hNodeD : ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ⊆ D := by intro v hv rw [Finset.mem_singleton] at hv exact hv ▸ (H.nodesAt D i).property let nodeMap : ValuesOn D (swigΩ Ω) → ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω) := valuesProjection hNodeD let prefixMap : ValuesOn D (swigΩ Ω) → ValuesOn (H.prefixIn D i.val) (swigΩ Ω) := valuesProjection (H.prefixIn_subset D i.val) have hden0 : jointRef ref ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ({nodeMap x} : Set (ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω))) ≠ 0 := jointRef_singleton_ne_zero ref href _ (nodeMap x) have hdentop : jointRef ref ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ({nodeMap x} : Set (ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω))) ≠ ∞ := by exact ne_of_lt (MeasureTheory.measure_lt_top (jointRef ref ({(H.nodesAt D i).val} : Finset (SWIGNode N))) _) have hcond : (condDistrib nodeMap prefixMap μ (prefixMap x)) ({nodeMap x} : Set (ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω))) = (μ.map (valuesProjection (H.prefixIn_subset D (i.val + 1)))) ({valuesProjection (H.prefixIn_subset D (i.val + 1)) x} : Set (ValuesOn (H.prefixIn D (i.val + 1)) (swigΩ Ω))) / (μ.map prefixMap) ({prefixMap x} : Set (ValuesOn (H.prefixIn D i.val) (swigΩ Ω))) := by rw [condDistrib_singleton_mass_of_ne_zero (μ := μ) (Y := nodeMap) (Z := prefixMap) (measurable_valuesProjection hNodeD) (prefixMap x) (nodeMap x) hprefix0] rw [prefix_pair_singleton_mass_eq_succ_prefix_mass H D μ i x] unfold tianPrefixStepDensity rw [rnDeriv_singleton_eq_div _ _ (absolutelyContinuous_jointRef_of_faithful ref href ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (condDistrib nodeMap prefixMap μ (prefixMap x))) (nodeMap x) hden0 hdentop] simpa [nodeMap, prefixMap, hNodeD] using congrArg (fun a => a / jointRef ref ({(H.nodesAt D i).val} : Finset (SWIGNode N)) ({nodeMap x} : Set (ValuesOn ({(H.nodesAt D i).val} : Finset (SWIGNode N)) (swigΩ Ω)))) hcond -
doModel_mechCFactor_eq_qLocalMass_div_jointReflemma — Given a finite structural causal model and intervention set, if the intervened random copies are observed, their fixed copies are not already fixed, the model is standard, and the reference measures are faithful, then for an intervention assignment, observed set, and observed value, the intervened mechanism factor is the local mass divided by the joint reference mass.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)M :SCM N ΩX :Finset NhObs :∀ D ∈ X, SWIGNode.random D ∈ M.observedhFix :∀ D ∈ X, SWIGNode.fixed D ∉ M.fixedhStd :M.isStandardref :href :sDo :(M.fixSet X hObs hFix).FixedValueshSobs :S ⊆ (M.fixSet X hObs hFix).observedconclusion(M.fixSet X hObs hFix).mechCFactor ref S hSobs sDo x= (M.fixSet X hObs hFix).qLocalMass sDo S hSobs x / jointRef ref S ({valuesProjection hSobs x} : Set (ValuesOn S (swigΩ Ω)))Proof (Lean source)
lemma doModel_mechCFactor_eq_qLocalMass_div_jointRef [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (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) (ref : ReferenceMeasures Ω) (href : ReferenceFaithful ref) (sDo : (M.fixSet X hObs hFix).FixedValues) (S : Finset (SWIGNode N)) (hSobs : S ⊆ (M.fixSet X hObs hFix).observed) (x : ValuesOn (M.fixSet X hObs hFix).observed (swigΩ Ω)) : (M.fixSet X hObs hFix).mechCFactor ref S hSobs sDo x = (M.fixSet X hObs hFix).qLocalMass sDo S hSobs x / jointRef ref S ({valuesProjection hSobs x} : Set (ValuesOn S (swigΩ Ω))) := by exact mechCFactor_eq_qLocalMass_div_jointRef (M.fixSet X hObs hFix) ref sDo S hSobs href (fixSet_fixed_random_edgeless M X hObs hFix hStd) x -
valuesProjection_extend_eq_of_subsetlemma — If an extension preserves all values on a larger observed set, then restricting the extension to any subset gives the same values as restricting the original assignment directly.hypothesesN :sharedType u_1N → Type u_2M :SCM N ΩhDobs :D ⊆ M.observedhSD :S ⊆ DhSobs :S ⊆ M.observedhExtend :∀ xD, valuesProjection hDobs (extend xD) = xDconclusionvaluesProjection hSobs (extend xD) = valuesProjection hSD xDProof (Lean source)
lemma valuesProjection_extend_eq_of_subset (M : SCM N Ω) {D S : Finset (SWIGNode N)} (hDobs : D ⊆ M.observed) (hSD : S ⊆ D) (hSobs : S ⊆ M.observed) (extend : ValuesOn D (swigΩ Ω) → ValuesOn M.observed (swigΩ Ω)) (hExtend : ∀ xD, valuesProjection hDobs (extend xD) = xD) (xD : ValuesOn D (swigΩ Ω)) : valuesProjection hSobs (extend xD) = valuesProjection hSD xD := by ext v have h := congrFun (hExtend xD) ⟨v.val, hSD v.property⟩ simpa [valuesProjection] using h -
doObsKernelAncestralMarginal_prefix_singleton_eq_prod_qLocalMasslemma — Given a finite structural causal model, intervention set, target set, intervention assignment, and extension map, if the intervened random copies are observed, their fixed copies are not already fixed, and the extension map preserves ancestral coordinates, then for a prefix length and ancestral assignment, the singleton mass of the corresponding interventional marginal equals the product of district-local masses over that prefix.hypothesesN :sharedType u_1N → Type u_2∀ n, Fintype (Ω n)∀ n, MeasurableSingletonClass (Ω n)M :SCM N ΩX :Finset NhObs :∀ D ∈ X, SWIGNode.random D ∈ M.observedhFix :∀ D ∈ X, SWIGNode.fixed D ∉ M.fixedsDo :(M.fixSet X hObs hFix).FixedValuesextend :hExtend :∀ xD,valuesProjection (show fixObservedAncestralSet M X hObs hFix Y ⊆ M.observed from inter_subset_right) (extend xD)= xDk :ℕxD :conclusionMX :M.fixSet X hObs hFixD :fixObservedAncestralSet M X hObs hFix YH :MX.toSWIGGraph.induce (fixAncestralSet M X hObs hFix Y)((doObsKernelAncestralMarginal M X hObs hFix Y sDo).map (valuesProjection (H.prefixIn_subset D k))) ({valuesProjection (H.prefixIn_subset D k) xD} : Set (ValuesOn (H.prefixIn D k) (swigΩ Ω)))= ∏ C ∈ MX.toSWIGGraph.cComponentSet, MX.qLocalMass sDo (C ∩ H.prefixIn D k) (fun _ hv => (SWIGGraph.prefixIn_obsParentClosed M X hObs hFix Y k).1 (mem_of_mem_inter_right hv)) (extend xD)Proof (Lean source)
lemma doObsKernelAncestralMarginal_prefix_singleton_eq_prod_qLocalMass [∀ n, Fintype (Ω n)] [∀ n, MeasurableSingletonClass (Ω n)] (M : SCM N Ω) (X : Finset N) (hObs : ∀ D ∈ X, SWIGNode.random D ∈ M.observed) (hFix : ∀ D ∈ X, SWIGNode.fixed D ∉ M.fixed) (Y : Finset (SWIGNode N)) (sDo : (M.fixSet X hObs hFix).FixedValues) (extend : ValuesOn (fixObservedAncestralSet M X hObs hFix Y) (swigΩ Ω) → ValuesOn M.observed (swigΩ Ω)) (hExtend : ∀ xD, valuesProjection (show fixObservedAncestralSet M X hObs hFix Y ⊆ M.observed from inter_subset_right) (extend xD) = xD) (k : ℕ) (xD : ValuesOn (fixObservedAncestralSet M X hObs hFix Y) (swigΩ Ω)) : let MX := M.fixSet X hObs hFix let D := fixObservedAncestralSet M X hObs hFix Y let H := MX.toSWIGGraph.induce (fixAncestralSet M X hObs hFix Y) ((doObsKernelAncestralMarginal M X hObs hFix Y sDo).map (valuesProjection (H.prefixIn_subset D k))) ({valuesProjection (H.prefixIn_subset D k) xD} : Set (ValuesOn (H.prefixIn D k) (swigΩ Ω))) = ∏ C ∈ MX.toSWIGGraph.cComponentSet, MX.qLocalMass sDo (C ∩ H.prefixIn D k) (fun _ hv => (SWIGGraph.prefixIn_obsParentClosed M X hObs hFix Y k).1 (mem_of_mem_inter_right hv)) (extend xD) := by classical let MX := M.fixSet X hObs hFix let D := fixObservedAncestralSet M X hObs hFix Y let H := MX.toSWIGGraph.induce (fixAncestralSet M X hObs hFix Y) let P := H.prefixIn D k let hPD : P ⊆ D := H.prefixIn_subset D k let hPclosed : MX.ObsParentClosed P := by simpa [MX, D, H, P] using SWIGGraph.prefixIn_obsParentClosed M X hObs hFix Y k let hPobsMX : P ⊆ MX.observed := hPclosed.1 let hPobsM : P ⊆ M.observed := fun _ hv => inter_subset_right (hPD hv) have hpointM : valuesProjection hPobsM (extend xD) = valuesProjection hPD xD := valuesProjection_extend_eq_of_subset M (show D ⊆ M.observed from inter_subset_right) hPD hPobsM extend hExtend xD have hpointMX : valuesProjection hPobsMX (extend xD) = valuesProjection hPD xD := by simpa [MX, SCM.fixSet_observed, hPobsMX, hPobsM] using hpointM have hmap := doObsKernelAncestralMarginal_map_prefix_eq_doObsKernel_map_prefix M X hObs hFix Y sDo hPD have hengine := MX.obsKernel_marginal_singleton_eq_prod_qLocalMass sDo P hPclosed (extend xD) calc ((doObsKernelAncestralMarginal M X hObs hFix Y sDo).map (valuesProjection hPD)) ({valuesProjection hPD xD} : Set (ValuesOn P (swigΩ Ω))) = ((MX.obsKernel sDo).map (valuesProjection hPobsMX)) ({valuesProjection hPD xD} : Set (ValuesOn P (swigΩ Ω))) := by simpa [MX, D, H, P, hPobsMX] using congrArg (fun μ : Measure (ValuesOn P (swigΩ Ω)) => μ ({valuesProjection hPD xD} : Set (ValuesOn P (swigΩ Ω)))) hmap _ = ((MX.obsKernel sDo).map (valuesProjection hPobsMX)) ({valuesProjection hPobsMX (extend xD)} : Set (ValuesOn P (swigΩ Ω))) := by rw [hpointMX] _ = ∏ C ∈ MX.toSWIGGraph.cComponentSet, MX.qLocalMass sDo (C ∩ P) (fun _ hv => hPclosed.1 (mem_of_mem_inter_right hv)) (extend xD) := by exact hengine