Stat.Finite­Positive­Table.DAG

This roll-up module exports positive finite DAG table factorizations, coordinate-fixing expansions, reverse-topological normalization, finite-atom conditional-independence bridges, and global Markov theorems for the resu

Basic 5 core · 4 supporting This module packages a strictly positive finite table together with normalized parent-local DAG factors. ★ parentFixingSteps_valid

Positive finite DAG tables and arrowhead removal

This module packages a strictly positive finite table together with normalized parent-local DAG factors. It also defines the graph and algebraic objects used by coordinate fixing: the product of the factors not yet fixed, parent-conditioned fixing steps, and the DAG obtained by removing every arrowhead into a fixed vertex.

The package deliberately reuses FinitePositiveTable for profiles, fibre sums, marginals, and fixing, and PositiveFiniteDAGMechanism for normalized local factors.

structure PositiveDAGTableFactorization reviewed
Causalean.Stat.FinitePositiveTable.DAG

A DAG and strictly positive finite table have a normalized parent-local factorization when every coordinate has at least one state, each vertex carries a strictly positive local factor that depends only on the vertex and its parents and sums to one over the vertex's own value, and the table mass of every complete profile is the product of all the local factors at that profile.

Definition (Lean source)
V :
Type u
shared
r :
V → ℕ
shared
G :
DAG V
Every coordinate alphabet contains at least one state.
cardinalitiesPositive :
The normalized, strictly positive, parent-local factors.
mechanism :
PositiveFiniteDAGMechanism G (fun v ↦ Fin (r v))
The table mass is the product of the local factors.
mass_eq_jointMass :
∀ x, p.mass x = mechanism.jointMass x
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization · Causalean/Stat/FinitePositiveTable/DAG/Basic.lean:37 · uses DAG , PositiveTable
def remainingFactorKernel reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

A factorized table and fixed vertex set determine the truncated product kernel by multiplying, at each complete profile, exactly the local factors of the vertices outside the fixed set.

Definition (Lean source)
V :
Type u
V → ℕ
DAG V
shared
p :
shared
fixed :
remainingFactorKernel fac fixed :
fun x ↦ ∏ v ∈ (univ \ fixed), fac.mechanism.factor v x
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.remainingFactorKernel · Causalean/Stat/FinitePositiveTable/DAG/Basic.lean:54 · uses DAG , PositiveDAGTableFactorization , Kernel , PositiveTable
def parentFixingSteps reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

A DAG and vertex list determine the parent-conditioned fixing steps by pairing each listed vertex, in order, with its DAG parent set as the conditioning set.

Definition (Lean source)
V :
Type u
shared
G :
DAG V
vertices :
parentFixingSteps G vertices :
vertices.map fun v ↦ ⟨v, G.parents v⟩
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.parentFixingSteps · Causalean/Stat/FinitePositiveTable/DAG/Basic.lean:61 · uses DAG , FixingStep
theorem parentFixingSteps_valid reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

A DAG, vertex list, and proof that the vertices are distinct give a valid parent-conditioned fixing sequence: the fixed coordinates are distinct and no step conditions on its own coordinate.

Formal statement
V :
Type u
shared
G :
DAG V
vertices :
hvertices :
vertices.Nodup
Proof (Lean source)
theorem parentFixingSteps_valid (G : DAG V) (vertices : List V) (hvertices : vertices.Nodup) : FixingSequenceValid (parentFixingSteps G vertices) := by /- Unfold both definitions. Mapping `FixingStep.coordinate` over the constructed list is definitionally `vertices`; the second conjunct is `v ∉ G.parents v`, which follows from `DAG.irrefl` through `DAG.mem_parents`. -/ constructor · simpa [parentFixingSteps, List.map_map, Function.comp_def] using hvertices · intro s hs simp only [parentFixingSteps, List.mem_map] at hs obtain ⟨v, hv, rfl⟩ := hs exact fun h ↦ G.irrefl v (G.mem_parents.mp h)
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.parentFixingSteps_valid · Causalean/Stat/FinitePositiveTable/DAG/Basic.lean:67 · uses DAG , parentFixingSteps , FixingSequenceValid
def arrowheadRemovedDAG reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

A DAG and fixed vertex set determine the DAG with incoming arrows to fixed vertices removed: an edge remains exactly when its target is unfixed, edge decidability is inherited, and acyclicity is preserved.

Definition (Lean source)
V :
Type u
shared
G :
DAG V
fixed :
arrowheadRemovedDAG G fixed :
DAG V
clause 1
edge u v := G.edge u v ∧ v ∉ fixed
clause 2
decEdge := inferInstance
clause 3
acyclic := by intro v hcycle exact G.acyclic v ((Relation.TransGen.mono (r := fun u v ↦ G.edge u v ∧ v ∉ fixed) (p := G.edge) (fun _ _ h ↦ h.1)) v v hcycle)
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.arrowheadRemovedDAG · Causalean/Stat/FinitePositiveTable/DAG/Basic.lean:85 · uses DAG
4 supporting declarations (lemmas, instances)
Kernel­CI 4 core · 1 supporting This module isolates the graph-independent part of the substrate. ★ condIndepFun_finiteAtom_crossProduct

Finite-kernel conditional independence bridges

This module isolates the graph-independent part of the substrate. It defines set-valued conditional independence for a finite kernel, converts Causalean's measure-theoretic CondIndepFun into the corresponding finite-atom cross-product equality, and relates the set-valued predicate to the existing two-coordinate KernelCondIndep API.

def fixedKernelMarginal reviewed
Causalean.Stat.FinitePositiveTable.DAG

A kernel, fixed and requested random coordinate sets, and profile determine the corresponding fixed-row kernel marginal as the sum of the kernel over all complete profiles that agree with the given profile on every fixed and every requested coordinate.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
fixed S :
x :
fixedKernelMarginal q fixed S x :
ℝ
kernelMarginalMass q (fixed ∪ S) x
Causalean.Stat.FinitePositiveTable.DAG.fixedKernelMarginal · Causalean/Stat/FinitePositiveTable/DAG/KernelCI.lean:30 · uses Kernel , ProfileSpace
def FixedKernelCondIndepAt reviewed
Causalean.Stat.FinitePositiveTable.DAG

A kernel, fixed, two random, and conditioning coordinate sets, and profile determine the fixed-row atomwise conditional-independence identity: the fixed-row marginal over the two random sets and the conditioning set, times the fixed-row marginal over the conditioning set, equals the product of the fixed-row marginals over each random set joined with the conditioning set.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
fixed X Y Z :
x :
FixedKernelCondIndepAt q fixed X Y Z x :
Prop
fixedKernelMarginal q fixed (X ∪ Y ∪ Z) x * fixedKernelMarginal q fixed Z x
= fixedKernelMarginal q fixed (X ∪ Z) x * fixedKernelMarginal q fixed (Y ∪ Z) x
Causalean.Stat.FinitePositiveTable.DAG.FixedKernelCondIndepAt · Causalean/Stat/FinitePositiveTable/DAG/KernelCI.lean:38 · uses Kernel , ProfileSpace
def FixedKernelCondIndep reviewed
Causalean.Stat.FinitePositiveTable.DAG

A kernel and fixed, two random, and conditioning coordinate sets determine fixed-row conditional independence by requiring the atomwise identity at every profile.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
fixed X Y Z :
x :
FixedKernelCondIndep q fixed X Y Z :
Prop
FixedKernelCondIndepAt q fixed X Y Z x
Causalean.Stat.FinitePositiveTable.DAG.FixedKernelCondIndep · Causalean/Stat/FinitePositiveTable/DAG/KernelCI.lean:50 · uses Kernel
theorem condIndepFun_finiteAtom_crossProduct reviewed
Causalean.Stat.FinitePositiveTable.DAG

On a standard Borel space with a finite measure, let three random elements with finite value sets be measurable, with the first two conditionally independent given the third. Then for any three values, the measure of the event that all three elements take these values, times the measure of the event that the third takes its value, equals the measure of the event that the first and third take their values times the measure of the event that the second and third take theirs.

Formal statement
Ω :
Type uΩ
A :
Type uA
B :
Type uB
C :
Type uC
f :
Ω → A
g :
Ω → B
c :
Ω → C
hf :
hg :
hc :
hci :
CondIndepFun (comap c inferInstance) hc.comap_le f g mu
a :
A
b :
B
c₀ :
C
mu.real (((f ⁻¹' {a}) ∩ (g ⁻¹' {b})) ∩ (c ⁻¹' {c₀})) * mu.real (c ⁻¹' {c₀})
= mu.real ((f ⁻¹' {a}) ∩ (c ⁻¹' {c₀})) * mu.real ((g ⁻¹' {b}) ∩ (c ⁻¹' {c₀}))
Proof (Lean source)
theorem condIndepFun_finiteAtom_crossProduct {Ω : Type uΩ} {A : Type uA} {B : Type uB} {C : Type uC} [MeasurableSpace Ω] [StandardBorelSpace Ω] [Fintype A] [MeasurableSpace A] [MeasurableSingletonClass A] [Fintype B] [MeasurableSpace B] [MeasurableSingletonClass B] [Fintype C] [MeasurableSpace C] [MeasurableSingletonClass C] (mu : Measure Ω) [IsFiniteMeasure mu] (f : Ω → A) (g : Ω → B) (c : Ω → C) (hf : Measurable f) (hg : Measurable g) (hc : Measurable c) (hci : CondIndepFun (comap c inferInstance) hc.comap_le f g mu) (a : A) (b : B) (c₀ : C) : mu.real (((f ⁻¹' {a}) ∩ (g ⁻¹' {b})) ∩ (c ⁻¹' {c₀})) * mu.real (c ⁻¹' {c₀}) = mu.real ((f ⁻¹' {a}) ∩ (c ⁻¹' {c₀})) * mu.real ((g ⁻¹' {b}) ∩ (c ⁻¹' {c₀})) := by classical let F := c ⁻¹' {c₀} by_cases hzero : mu.real F = 0 · have hjoint : mu.real (((f ⁻¹' {a}) ∩ (g ⁻¹' {b})) ∩ F) = 0 := le_antisymm (hzero ▸ measureReal_mono Set.inter_subset_right) measureReal_nonneg have hfiber : mu.real ((f ⁻¹' {a}) ∩ F) = 0 := le_antisymm (hzero ▸ measureReal_mono Set.inter_subset_right) measureReal_nonneg have hgiber : mu.real ((g ⁻¹' {b}) ∩ F) = 0 := le_antisymm (hzero ▸ measureReal_mono Set.inter_subset_right) measureReal_nonneg simpa [F, hzero, hjoint, hfiber, hgiber] · have hci_atoms := (condIndepFun_iff_condExp_inter_preimage_eq_mul hf hg).mp hci {a} {b} (measurableSet_singleton a) (measurableSet_singleton b) have hjoint := condExp_indicator_finite_comap_local mu c hc ((f ⁻¹' {a}) ∩ (g ⁻¹' {b})) ((hf (measurableSet_singleton a)).inter (hg (measurableSet_singleton b))) have hfiber := condExp_indicator_finite_comap_local mu c hc (f ⁻¹' {a}) (hf (measurableSet_singleton a)) have hgiber := condExp_indicator_finite_comap_local mu c hc (g ⁻¹' {b}) (hg (measurableSet_singleton b)) have hratio : ∀ᵐ omega ∂mu, finiteComapCondProb mu c ((f ⁻¹' {a}) ∩ (g ⁻¹' {b})) (c omega) = finiteComapCondProb mu c (f ⁻¹' {a}) (c omega) * finiteComapCondProb mu c (g ⁻¹' {b}) (c omega) := by filter_upwards [hci_atoms, hjoint, hfiber, hgiber] with omega hciω hjω hfω hgω exact hjω.symm.trans (hciω.trans (congrArg₂ (· * ·) hfω hgω)) have hmuF : mu F ≠ 0 := by intro hF apply hzero simp only [Measure.real, hF, ENNReal.toReal_zero] have hnebot : (ae (mu.restrict F)).NeBot := ae_restrict_neBot.mpr hmuF have hratioF : ∀ᵐ omega ∂mu.restrict F, finiteComapCondProb mu c ((f ⁻¹' {a}) ∩ (g ⁻¹' {b})) (c omega) = finiteComapCondProb mu c (f ⁻¹' {a}) (c omega) * finiteComapCondProb mu c (g ⁻¹' {b}) (c omega) := hratio.filter_mono (@ae_restrict_le Ω _ mu F) have hmemF : ∀ᵐ omega ∂mu.restrict F, omega ∈ F := ae_restrict_mem (hc (measurableSet_singleton c₀)) letI : (ae (mu.restrict F)).NeBot := hnebot obtain ⟨omega, hωratio, hωF⟩ := (hratioF.and hmemF).exists have hcω : c omega = c₀ := by simpa [F] using hωF unfold finiteComapCondProb at hωratio simp only [hcω] at hωratio change (mu.real F)⁻¹ * mu.real (F ∩ ((f ⁻¹' {a}) ∩ (g ⁻¹' {b}))) = ((mu.real F)⁻¹ * mu.real (F ∩ (f ⁻¹' {a}))) * ((mu.real F)⁻¹ * mu.real (F ∩ (g ⁻¹' {b}))) at hωratio field_simp at hωratio simpa [F, Set.inter_comm, Set.inter_left_comm, Set.inter_assoc, mul_comm] using hωratio
Causalean.Stat.FinitePositiveTable.DAG.condIndepFun_finiteAtom_crossProduct · Causalean/Stat/FinitePositiveTable/DAG/KernelCI.lean:162
1 supporting declaration (lemmas, instances)
Elimination 1 core · 7 supporting This module isolates the finite-sum algebra behind DAG fixing. ★ remainingFactorKernel_row_normalized

Reverse-topological elimination for truncated finite DAG products

This module isolates the finite-sum algebra behind DAG fixing. A maximal remaining vertex can be summed out because no other remaining local factor depends on it and its own local row is normalized. Iterating this reverse-topological step normalizes every row of a truncated product and identifies the conditional mass used by graph-independent fixing with the vertex's local factor.

theorem remainingFactorKernel_row_normalized reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

A factorized table, fixed vertex set, and profile give unit total mass for the truncated product in that fixed-coordinate row: the product of the local factors of the unfixed vertices, summed over all complete profiles that agree with the given profile on the fixed set, equals one.

Formal statement
V :
Type u
V → ℕ
DAG V
shared
p :
shared
fixed :
x :
kernelMarginalMass (fac.remainingFactorKernel fixed) fixed x = 1
Proof (Lean source)
theorem remainingFactorKernel_row_normalized (fac : PositiveDAGTableFactorization G p) (fixed : Finset V) (x : ProfileSpace r) : kernelMarginalMass (fac.remainingFactorKernel fixed) fixed x = 1 := by /- Induct on `card (univ \ fixed)`. The empty case reduces the fibre to `x` and the empty product to one. Otherwise select `exists_remaining_sink`, partition the fibre with `kernelMarginalMass_decompose`, rewrite each summand by `sum_remainingFactorKernel_sink`, and apply the induction hypothesis to `insert v fixed`. -/ classical induction hcard : (univ \ fixed).card using Nat.strong_induction_on generalizing fixed x with | h n ih => by_cases hne : (univ \ fixed).Nonempty · obtain ⟨v, hv, hsink⟩ := exists_remaining_sink G fixed hne have hlt : (univ \ insert v fixed).card < n := by rw [← hcard] simpa [Finset.sdiff_insert] using Finset.card_erase_lt_of_mem (Finset.mem_sdiff.mpr ⟨Finset.mem_univ v, hv⟩) rw [kernelMarginalMass_eliminate_coordinate (fac.remainingFactorKernel fixed) (fac.remainingFactorKernel (insert v fixed)) (S := fixed) (v := v) hv (fac.sum_remainingFactorKernel_sink fixed hv hsink) x] exact ih _ hlt (insert v fixed) x rfl · have hempty : univ \ fixed = ∅ := Finset.not_nonempty_iff_eq_empty.mp hne have hfixed : fixed = univ := by ext w simpa using congrArg (w ∈ ·) hempty subst fixed rw [kernelMarginalMass, fiberSum_univ, remainingFactorKernel] simp
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.remainingFactorKernel_row_normalized · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:220 · uses DAG , PositiveDAGTableFactorization , remainingFactorKernel , PositiveTable , ProfileSpace , kernelMarginalMass
7 supporting declarations (lemmas, instances)
  • remainingFactorKernel_pos theorem — A factorized table and fixed vertex set give strictly positive mass at every profile for the truncated product kernel.
    V :
    Type u
    V → ℕ
    DAG V
    shared
    p :
    shared
    fixed :
    (fac.remainingFactorKernel fixed).IsStrictlyPositive
    Proof (Lean source)
    theorem remainingFactorKernel_pos (fac : PositiveDAGTableFactorization G p) (fixed : Finset V) : (fac.remainingFactorKernel fixed).IsStrictlyPositive := by intro x exact Finset.prod_pos fun v _ ↦ fac.mechanism.factor_pos v x
    Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.remainingFactorKernel_pos · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:36
  • kernelMarginalMass_decompose theorem — A kernel, coordinate outside the marginal set, and reference profile give the finite decomposition of its marginal across that coordinate's states.
    V :
    Type u
    V → ℕ
    shared
    q :
    S :
    v :
    V
    hv :
    v ∉ S
    x :
    (∑ z : Fin (r v), kernelMarginalMass q (insert v S) (update x v z))
    Proof (Lean source)
    theorem kernelMarginalMass_decompose (q : Kernel r) {S : Finset V} {v : V} (hv : v ∉ S) (x : ProfileSpace r) : (∑ z : Fin (r v), kernelMarginalMass q (insert v S) (update x v z)) = kernelMarginalMass q S x := by simpa [kernelMarginalMass] using sum_fiberSum_insert_update q hv x
    Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.kernelMarginalMass_decompose · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:44
  • kernelMarginalMass_eliminate_coordinate theorem — Two kernels, a coordinate outside the marginal set, a pointwise coordinate-summation identity, and reference profile give the corresponding elimination identity for kernel marginals.
    V :
    Type u
    V → ℕ
    shared
    q qNext :
    S :
    v :
    V
    hv :
    v ∉ S
    hsum :
    ∀ y, (∑ z : Fin (r v), q (update y v z)) = qNext y
    x :
    Proof (Lean source)
    theorem kernelMarginalMass_eliminate_coordinate (q qNext : Kernel r) {S : Finset V} {v : V} (hv : v ∉ S) (hsum : ∀ y, (∑ z : Fin (r v), q (update y v z)) = qNext y) (x : ProfileSpace r) : kernelMarginalMass q S x = kernelMarginalMass qNext (insert v S) x := by classical let e := Equiv.piSplitAt v (fun i ↦ Fin (r i)) let base (t : ∀ j : {j // j ≠ v}, Fin (r j)) : ProfileSpace r := e.symm (x v, t) have hbase_v (t : ∀ j : {j // j ≠ v}, Fin (r j)) : base t v = x v := by simp [base, e, Equiv.piSplitAt] have hupdate (t : ∀ j : {j // j ≠ v}, Fin (r j)) (z : Fin (r v)) : update (base t) v z = e.symm (z, t) := by funext i by_cases hiv : i = v · subst i simp [base, e, Equiv.piSplitAt] · simp [base, e, Equiv.piSplitAt, hiv] have hagree (t : ∀ j : {j // j ≠ v}, Fin (r j)) (z : Fin (r v)) : AgreeOn S (e.symm (z, t)) x ↔ AgreeOn S (base t) x := by constructor <;> intro h w hw · simpa only [← hupdate t z, Function.update_of_ne (ne_of_mem_of_not_mem hw hv)] using h w hw · have hwv : w ≠ v := ne_of_mem_of_not_mem hw hv simpa only [← hupdate t z, Function.update_of_ne hwv] using h w hw have hagree_insert (t : ∀ j : {j // j ≠ v}, Fin (r j)) (z : Fin (r v)) : AgreeOn (insert v S) (e.symm (z, t)) x ↔ z = x v ∧ AgreeOn S (base t) x := by rw [← hupdate t z] constructor · intro h constructor · simpa using h v (mem_insert_self v S) · intro w hw have hwv : w ≠ v := ne_of_mem_of_not_mem hw hv simpa only [Function.update_of_ne hwv] using h w (mem_insert_of_mem hw) · rintro ⟨rfl, h⟩ w hw rcases mem_insert.mp hw with rfl | hw · simp · have hwv : w ≠ v := ne_of_mem_of_not_mem hw hv simpa only [Function.update_of_ne hwv] using h w hw unfold kernelMarginalMass fiberSum calc (∑ y : ProfileSpace r, if AgreeOn S y x then q y else 0) = ∑ a : Fin (r v) × (∀ j : {j // j ≠ v}, Fin (r j)), if AgreeOn S (e.symm a) x then q (e.symm a) else 0 := by exact Fintype.sum_equiv e _ _ (fun y ↦ by simp) _ = ∑ t : (∀ j : {j // j ≠ v}, Fin (r j)), ∑ z : Fin (r v), if AgreeOn S (e.symm (z, t)) x then q (e.symm (z, t)) else 0 := by rw [Fintype.sum_prod_type, Finset.sum_comm] _ = ∑ t : (∀ j : {j // j ≠ v}, Fin (r j)), if AgreeOn S (base t) x then qNext (base t) else 0 := by apply Finset.sum_congr rfl intro t ht simp_rw [hagree t] split_ifs with h · simp_rw [← hupdate t] exact hsum (base t) · simp _ = ∑ a : Fin (r v) × (∀ j : {j // j ≠ v}, Fin (r j)), if AgreeOn (insert v S) (e.symm a) x then qNext (e.symm a) else 0 := by rw [Fintype.sum_prod_type, Finset.sum_comm] apply Finset.sum_congr rfl intro t ht simp_rw [hagree_insert t] rw [Finset.sum_eq_single (x v)] · simp [base] · intro z hz hne simp [hne] · intro hnot exact (hnot (Finset.mem_univ _)).elim _ = ∑ y : ProfileSpace r, if AgreeOn (insert v S) y x then qNext y else 0 := by symm exact Fintype.sum_equiv e _ _ (fun y ↦ by simp)
    Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.kernelMarginalMass_eliminate_coordinate · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:53
  • exists_remaining_sink theorem — A DAG, fixed vertex set, and nonempty set of remaining vertices give a remaining vertex with no remaining child.
    V :
    Type u
    shared
    G :
    DAG V
    fixed :
    hne :
    (univ \ fixed).Nonempty
    ∃ v,
    v ∉ fixed
    conclusion 1
    w :
    w ∉ fixed
    ¬ G.edge v w
    Proof (Lean source)
    theorem exists_remaining_sink (G : DAG V) (fixed : Finset V) (hne : (univ \ fixed).Nonempty) : ∃ v, v ∉ fixed ∧ ∀ w, w ∉ fixed → ¬ G.edge v w := by /- Choose a vertex maximizing `G.topoOrder` on `univ \ fixed`. An edge to another remaining vertex would strictly increase `topoOrder`, contradicting maximality. `Finset.exists_max_image` is the same selection lemma used by the ordered-local d-separation closure. -/ obtain ⟨v, hv, hmax⟩ := Finset.exists_max_image (univ \ fixed) G.topoOrder hne refine ⟨v, (Finset.mem_sdiff.mp hv).2, ?_⟩ intro w hw hEdge have hwRemaining : w ∈ univ \ fixed := Finset.mem_sdiff.mpr ⟨Finset.mem_univ w, hw⟩ exact (not_lt_of_ge (hmax w hwRemaining)) (G.topoOrder_lt v w hEdge)
    Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.exists_remaining_sink · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:133
  • sum_remainingFactorKernel_sink theorem — A factorized table, fixed vertex set, remaining vertex, proof that it has no remaining child, and profile give the identity obtained by summing out that sink's local factor.
    V :
    Type u
    V → ℕ
    DAG V
    shared
    p :
    shared
    fixed :
    v :
    V
    hv :
    v ∉ fixed
    hsink :
    ∀ w
    if
    w ∉ fixed
    then
    ¬ G.edge v w
    x :
    (∑ z : Fin (r v), fac.remainingFactorKernel fixed (update x v z))
    = fac.remainingFactorKernel (insert v fixed) x
    Proof (Lean source)
    theorem sum_remainingFactorKernel_sink (fac : PositiveDAGTableFactorization G p) (fixed : Finset V) {v : V} (hv : v ∉ fixed) (hsink : ∀ w, w ∉ fixed → ¬ G.edge v w) (x : ProfileSpace r) : (∑ z : Fin (r v), fac.remainingFactorKernel fixed (update x v z)) = fac.remainingFactorKernel (insert v fixed) x := by /- Split the product into the factor at `v` and the remaining factors. For any remaining `w ≠ v`, locality of factor `w` and `hsink w` show that updating `v` does not change it. Pull this common product outside the sum and apply `factor_normalized v x`. -/ let S : Finset V := univ \ fixed have hvS : v ∈ S := Finset.mem_sdiff.mpr ⟨Finset.mem_univ v, hv⟩ have hrest (z : Fin (r v)) : (∏ w ∈ S.erase v, fac.mechanism.factor w (update x v z)) = ∏ w ∈ S.erase v, fac.mechanism.factor w x := by apply Finset.prod_congr rfl intro w hw apply fac.mechanism.factor_local w intro i hi have hwS : w ∈ S := Finset.mem_of_mem_erase hw have hwFixed : w ∉ fixed := (Finset.mem_sdiff.mp hwS).2 have hwne : w ≠ v := (Finset.mem_erase.mp hw).1 have hvNotLocal : v ∉ insert w (G.parents w) := by simp only [Finset.mem_insert, not_or] exact ⟨Ne.symm hwne, fun hvParent ↦ hsink w hwFixed (G.mem_parents.mp hvParent)⟩ have hine : i ≠ v := fun hiv ↦ hvNotLocal (hiv ▸ hi) exact Function.update_of_ne hine z x rw [remainingFactorKernel] simp only [S] at hvS hrest ⊢ calc (∑ z : Fin (r v), ∏ w ∈ (univ \ fixed), fac.mechanism.factor w (update x v z)) = ∑ z : Fin (r v), fac.mechanism.factor v (update x v z) * ∏ w ∈ (univ \ fixed).erase v, fac.mechanism.factor w (update x v z) := by apply Finset.sum_congr rfl intro z hz exact (Finset.mul_prod_erase (univ \ fixed) (fun w ↦ fac.mechanism.factor w (update x v z)) hvS).symm _ = ∑ z : Fin (r v), fac.mechanism.factor v (update x v z) * ∏ w ∈ (univ \ fixed).erase v, fac.mechanism.factor w x := by apply Finset.sum_congr rfl intro z hz rw [hrest z] _ = (∑ z : Fin (r v), fac.mechanism.factor v (update x v z)) * ∏ w ∈ (univ \ fixed).erase v, fac.mechanism.factor w x := by rw [Finset.sum_mul] _ = ∏ w ∈ (univ \ fixed).erase v, fac.mechanism.factor w x := by rw [fac.mechanism.factor_normalized, one_mul] _ = ∏ w ∈ (univ \ insert v fixed), fac.mechanism.factor w x := by congr 1 ext w simp
    Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.sum_remainingFactorKernel_sink · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:151
  • remainingFactorKernel_conditionalMass_eq_factor theorem — A factorized table, fixed vertex set, proof that the vertex remains random, profile, and proposed vertex state give the equality between the truncated kernel's parent-conditional mass and its normalized local factor.
    V :
    Type u
    V → ℕ
    DAG V
    shared
    p :
    shared
    fixed :
    v :
    V
    hv :
    v ∉ fixed
    x :
    z :
    Fin (r v)
    kernelConditionalMass (fac.remainingFactorKernel fixed) v (G.parents v) x z
    = fac.mechanism.factor v (update x v z)
    Proof (Lean source)
    theorem remainingFactorKernel_conditionalMass_eq_factor (fac : PositiveDAGTableFactorization G p) (fixed : Finset V) {v : V} (hv : v ∉ fixed) (x : ProfileSpace r) (z : Fin (r v)) : kernelConditionalMass (fac.remainingFactorKernel fixed) v (G.parents v) x z = fac.mechanism.factor v (update x v z) := by /- Expand numerator and denominator as truncated-product fibre sums. Reverse-topologically eliminate every remaining vertex except `v` and its parents; locality makes the surviving numerator equal the factor at `v` times the denominator. Strict positivity from `remainingFactorKernel_pos` cancels the denominator. This is the finite-table form of the ordered local Markov calculation and should reuse `remainingFactorKernel_row_normalized`. -/ classical let (i : V) : Nonempty (Fin (r i)) := ⟨⟨0, fac.cardinalitiesPositive i⟩⟩ let M : PositiveFiniteDAGMechanism G (fun i ↦ Fin (r i)) := { factor := fun i y ↦ if i ∈ fixed then (r i : ℝ)⁻¹ else fac.mechanism.factor i y factor_pos := by intro i y split_ifs with hi · exact inv_pos.mpr (Nat.cast_pos.mpr (fac.cardinalitiesPositive i)) · exact fac.mechanism.factor_pos i y factor_normalized := by intro i y by_cases hi : i ∈ fixed · simp only [hi, if_pos] rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] exact mul_inv_cancel₀ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt (fac.cardinalitiesPositive i))) · simp only [hi] exact fac.mechanism.factor_normalized i y factor_local := by intro i y y' hyy' by_cases hi : i ∈ fixed · simp [hi] · simp only [hi] exact fac.mechanism.factor_local i hyy' } let c : ℝ := ∏ i ∈ fixed, (r i : ℝ)⁻¹ have hcpos : 0 < c := by exact Finset.prod_pos fun i hi ↦ inv_pos.mpr (Nat.cast_pos.mpr (fac.cardinalitiesPositive i)) have hjoint (y : ProfileSpace r) : M.jointMass y = c * fac.remainingFactorKernel fixed y := by unfold PositiveFiniteDAGMechanism.jointMass remainingFactorKernel c M rw [Finset.prod_ite] congr 1 · congr 1 ext i simp · congr 1 ext i simp have hagree_iff_projection (S : Finset V) (a y : ProfileSpace r) : AgreeOn S y a ↔ coordinateProjection (X := fun i ↦ Fin (r i)) S y = coordinateProjection (X := fun i ↦ Fin (r i)) S a := by constructor · intro h funext w exact h w w.property · intro h w hw exact congrFun h ⟨w, hw⟩ have hmarginal (S : Finset V) (a : ProfileSpace r) : M.marginalMass S a = c * kernelMarginalMass (fac.remainingFactorKernel fixed) S a := by unfold PositiveFiniteDAGMechanism.marginalMass kernelMarginalMass fiberSum rw [Finset.mul_sum] apply Finset.sum_congr rfl intro y hy rw [hjoint] by_cases hya : AgreeOn S y a · have hp := (hagree_iff_projection S a y).mp hya simp [hya, hp] · have hp : coordinateProjection (X := fun i ↦ Fin (r i)) S y ≠ coordinateProjection (X := fun i ↦ Fin (r i)) S a := fun hp ↦ hya ((hagree_iff_projection S a y).mpr hp) simp [hya, hp] have hcond := M.conditionalMass_given_parents v x z unfold PositiveFiniteDAGMechanism.conditionalMass at hcond rw [hmarginal, hmarginal] at hcond rw [mul_div_mul_left _ _ hcpos.ne'] at hcond unfold kernelConditionalMass simpa [M, hv] using hcond
    Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.remainingFactorKernel_conditionalMass_eq_factor · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:256
  • fixKernelCoordinate_remainingFactorKernel theorem — A factorized table, fixed vertex set, and proof that the vertex is not fixed already give the parent-conditioned fixing identity that removes its local factor.
    V :
    Type u
    V → ℕ
    DAG V
    shared
    p :
    shared
    fixed :
    v :
    V
    hv :
    v ∉ fixed
    fixKernelCoordinate (fac.remainingFactorKernel fixed) v (G.parents v)
    = fac.remainingFactorKernel (insert v fixed)
    Proof (Lean source)
    theorem fixKernelCoordinate_remainingFactorKernel (fac : PositiveDAGTableFactorization G p) (fixed : Finset V) {v : V} (hv : v ∉ fixed) : fixKernelCoordinate (fac.remainingFactorKernel fixed) v (G.parents v) = fac.remainingFactorKernel (insert v fixed) := by /- Extensionality, `fixKernelCoordinate_apply`, and `remainingFactorKernel_conditionalMass_eq_factor` reduce the claim to cancelling the positive factor at `v` from the finite product. Use `Finset.prod_erase` (or the corresponding insert/sdiff product lemma) and `factor_pos.ne'`. -/ funext x rw [fixKernelCoordinate_apply, fac.remainingFactorKernel_conditionalMass_eq_factor fixed hv x (x v)] simp only [Function.update_eq_self] unfold remainingFactorKernel have hvRemaining : v ∈ univ \ fixed := Finset.mem_sdiff.mpr ⟨Finset.mem_univ v, hv⟩ have hsets : univ \ insert v fixed = (univ \ fixed).erase v := by ext w simp rw [hsets, ← Finset.mul_prod_erase (univ \ fixed) (fun w ↦ fac.mechanism.factor w x) hvRemaining] exact mul_div_cancel_left₀ _ (fac.mechanism.factor_pos v x).ne'
    Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.fixKernelCoordinate_remainingFactorKernel · Causalean/Stat/FinitePositiveTable/DAG/Elimination.lean:345
Fixing 1 core · 2 supporting This module proves the graph-independent fixing expansion requested by downstream consumers: for any list of distinct vertices, sequential FinitePositiveTable fixing conditional on the original DAG parent sets equals the ★ fixSequence_eq_remainingFactorKernel

Sequential fixing removes local DAG factors

This module proves the graph-independent fixing expansion requested by downstream consumers: for any list of distinct vertices, sequential FinitePositiveTable fixing conditional on the original DAG parent sets equals the product of precisely the local factors whose vertices have not been fixed. Hence the result is a normalized kernel over the remaining coordinates with the fixed coordinates acting as arguments.

theorem fixSequence_eq_remainingFactorKernel reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

A factorized table, vertex list, and proof that its vertices are distinct give the sequential-fixing expansion as the truncated local-factor product: fixing the listed vertices one after another, each time dividing the current kernel by its conditional mass of the vertex given the vertex's DAG parents, yields at every complete profile the product of the local factors of the vertices not in the list.

Formal statement
V :
Type u
V → ℕ
DAG V
shared
p :
shared
vertices :
hvertices :
vertices.Nodup
fixSequence p (parentFixingSteps G vertices) = fac.remainingFactorKernel vertices.toFinset
Proof (Lean source)
theorem fixSequence_eq_remainingFactorKernel (fac : PositiveDAGTableFactorization G p) (vertices : List V) (hvertices : vertices.Nodup) : fixSequence p (parentFixingSteps G vertices) = fac.remainingFactorKernel vertices.toFinset := by /- Induct on `vertices`. At the empty list, use `fac.mass_eq_jointMass` and identify the `univ \ ∅` product with `jointMass`. At `v :: vs`, rewrite the first kernel by the induction invariant for the already fixed set and apply `fixKernelCoordinate_remainingFactorKernel`; `Nodup` supplies `v ∉ vs.toFinset`. The recursion direction of `fixKernelSequence` may make it cleaner to strengthen the induction statement to start from an arbitrary already-fixed set. -/ have hstart : p.mass = fac.remainingFactorKernel ∅ := by funext x rw [fac.mass_eq_jointMass] unfold Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.jointMass remainingFactorKernel simp have haux : ∀ (done : Finset V) (vs : List V), vs.Nodup → Disjoint done vs.toFinset → fixKernelSequence (fac.remainingFactorKernel done) (parentFixingSteps G vs) = fac.remainingFactorKernel (done ∪ vs.toFinset) := by intro done vs hnodup hdisj induction vs generalizing done with | nil => simp [parentFixingSteps, fixKernelSequence] | cons v vs ih => simp only [List.nodup_cons] at hnodup simp only [List.toFinset_cons, Finset.disjoint_insert_right] at hdisj rw [show parentFixingSteps G (v :: vs) = { coordinate := v, conditioning := G.parents v } :: parentFixingSteps G vs by rfl] rw [fixKernelSequence] rw [fac.fixKernelCoordinate_remainingFactorKernel done hdisj.1] rw [ih (insert v done) hnodup.2] · congr 1 ext w simp · rw [Finset.disjoint_insert_left] exact ⟨by simpa using hnodup.1, hdisj.2⟩ unfold fixSequence rw [hstart] simpa using haux ∅ vertices hvertices (by simp)
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization.fixSequence_eq_remainingFactorKernel · Causalean/Stat/FinitePositiveTable/DAG/Fixing.lean:33 · uses DAG , PositiveDAGTableFactorization , parentFixingSteps , remainingFactorKernel , Kernel , PositiveTable , fixSequence
2 supporting declarations (lemmas, instances)
Global­Markov 1 core · 2 supporting This module exposes the headline API. ★ fixSequence_globalMarkov

Global Markov theorems for sequentially fixed finite DAG tables

This module exposes the headline API. Sequential graph-independent fixing of distinct DAG vertices is first identified with the truncated local-factor product; d-separation in the DAG with incoming arrows to those fixed vertices removed then yields multiplicative finite-kernel conditional independence. Both a set-valued core and singleton consumer forms are provided.

theorem fixSequence_globalMarkov reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

A factorized table, distinct fixed-vertex list, three remaining coordinate sets, proofs that each is remaining, and d-separation of the first two sets given the third set together with all fixed vertices, in the DAG with incoming arrows to fixed vertices removed, give the atomwise multiplicative conditional-independence identity for the kernel obtained by sequentially fixing the listed vertices given their DAG parents.

Formal statement
V :
Type u
V → ℕ
DAG V
shared
p :
shared
vertices :
hvertices :
vertices.Nodup
X Y Z :
hX :
X ⊆ univ \ vertices.toFinset
hY :
Y ⊆ univ \ vertices.toFinset
hZ :
Z ⊆ univ \ vertices.toFinset
hdSep :
(arrowheadRemovedDAG G vertices.toFinset).dSep X Y (Z ∪ vertices.toFinset)
FixedKernelCondIndep (fixSequence p (parentFixingSteps G vertices)) vertices.toFinset X Y Z
Proof (Lean source)
theorem fixSequence_globalMarkov (fac : PositiveDAGTableFactorization G p) (vertices : List V) (hvertices : vertices.Nodup) (X Y Z : Finset V) (hX : X ⊆ univ \ vertices.toFinset) (hY : Y ⊆ univ \ vertices.toFinset) (hZ : Z ⊆ univ \ vertices.toFinset) (hdSep : (arrowheadRemovedDAG G vertices.toFinset).dSep X Y (Z ∪ vertices.toFinset)) : FixedKernelCondIndep (fixSequence p (parentFixingSteps G vertices)) vertices.toFinset X Y Z := by rw [fixSequence_eq_remainingFactorKernel fac vertices hvertices] exact fac.remainingFactorKernel_globalMarkov vertices.toFinset X Y Z hX hY hZ hdSep
2 supporting declarations (lemmas, instances)
Kernel­Markov 1 core · 3 supporting This module interprets the DAG ordered-local closure for truncated products and combines that interpretation with d-separation after arrowhead removal. ★ remainingFactorKernel_globalMarkov

Multiplicative conditional independence and DAG global Markov kernels

This module interprets the DAG ordered-local closure for truncated products and combines that interpretation with d-separation after arrowhead removal. The graph-independent finite-kernel conditional-independence definitions and bridges live in KernelCI.

theorem remainingFactorKernel_globalMarkov reviewed
Causalean.Stat.FinitePositiveTable.DAG.PositiveDAGTableFactorization

Take a strictly positive finite table that factorizes into normalized parent-local factors along a DAG, and a set of fixed vertices with three further vertex sets, two random sets and a conditioning set, each consisting of unfixed vertices. If the two random sets are d-separated given the conditioning set together with the fixed vertices, in the DAG obtained by deleting every arrow pointing into a fixed vertex, then the truncated product of the unfixed local factors satisfies the multiplicative conditional-independence identity at every profile: with the fixed coordinates held at the profile's values, its marginal over both random sets and the conditioning set, times its marginal over the conditioning set, equals the product of its marginals over each random set joined with the conditioning set.

Formal statement
V :
Type u
V → ℕ
DAG V
shared
p :
shared
fixed X Y Z :
hX :
X ⊆ univ \ fixed
hY :
Y ⊆ univ \ fixed
hZ :
Z ⊆ univ \ fixed
hdSep :
(arrowheadRemovedDAG G fixed).dSep X Y (Z ∪ fixed)
FixedKernelCondIndep (fac.remainingFactorKernel fixed) fixed X Y Z
Proof (Lean source)
theorem remainingFactorKernel_globalMarkov (fac : PositiveDAGTableFactorization G p) (fixed X Y Z : Finset V) (hX : X ⊆ univ \ fixed) (hY : Y ⊆ univ \ fixed) (hZ : Z ⊆ univ \ fixed) (hdSep : (arrowheadRemovedDAG G fixed).dSep X Y (Z ∪ fixed)) : FixedKernelCondIndep (fac.remainingFactorKernel fixed) fixed X Y Z := by apply fac.remainingFactorKernel_orderedLocalMarkov fixed X Y Z apply (arrowheadRemovedDAG G fixed).orderedLocalSG_of_dSep_with_fixed (univ \ fixed) X Y Z fixed · intro f hf exact arrowheadRemovedDAG_fixed_parents_empty G fixed hf · exact fixed_disjoint_remaining fixed · exact hX · exact hY · exact hZ · exact hdSep
3 supporting declarations (lemmas, instances)