Graph.Density.Finite­DAG.Positive

Positive finite-DAG distributions and their factorization properties.

Factor 6 core · 0 supporting This module contains the pointwise factor notions shared by uniformly positive continuous density factorizations and positive finite-state mechanisms. ★ eventually_nonzero

Common real-factor interface for positive finite-DAG models

This module contains the pointwise factor notions shared by uniformly positive continuous density factorizations and positive finite-state mechanisms. The interface depends only on a real-valued factor accessor, so the two probability theories do not duplicate their contrast and perturbation layers.

abbrev Accessor reviewed
Causalean.Graph.FiniteDensity.PositiveFactor

For a vertex family, coordinate spaces, the real factor-accessor type assigns to every vertex a real-valued function on full coordinate assignments.

Definition (Lean source)
V :
Type uV
X :
V → Type uX
Accessor V X :
Type (max uV uX)
V → (∀ k : V, X k) → ℝ
Causalean.Graph.FiniteDensity.PositiveFactor.Accessor · Causalean/Graph/Density/FiniteDAG/Positive/Factor.lean:29
def FactorIndependentOf reviewed
Causalean.Graph.FiniteDensity.PositiveFactor

Factor i does not depend on coordinate j for a real factor accessor: changing coordinate j never changes factor i, whatever the rest of the assignment.

Definition (Lean source)
V :
Type uV
V → Type uX
shared
factor :
i j :
V
x :
∀ k, X k
xj :
X j
FactorIndependentOf factor i j :
Prop
factor i (update x j xj) = factor i x
Causalean.Graph.FiniteDensity.PositiveFactor.FactorIndependentOf · Causalean/Graph/Density/FiniteDAG/Positive/Factor.lean:33 · uses Accessor
def localContrast reviewed
Causalean.Graph.FiniteDensity.PositiveFactor

The four-point local contrast of a real factor accessor at a child coordinate and parent coordinate, fixing a background assignment, compares the cross-products from two child values and two parent values. Factor independence makes it vanish, but for an arbitrary accessor the converse can fail. The converse results in later modules require normalization and positive-model hypotheses.

Definition (Lean source)
V :
Type uV
V → Type uX
shared
factor :
i j :
V
x :
∀ k, X k
xi xi' :
X i
xj xj' :
X j
localContrast factor i j x xi xi' xj xj' :
ℝ
factor i (update (update x i xi) j xj) * factor i (update (update x i xi') j xj')
- factor i (update (update x i xi) j xj') * factor i (update (update x i xi') j xj)
Causalean.Graph.FiniteDensity.PositiveFactor.localContrast · Causalean/Graph/Density/FiniteDAG/Positive/Factor.lean:39 · uses Accessor
structure EdgeWitness reviewed
Causalean.Graph.FiniteDensity.PositiveFactor

A local edge witness for a real factor accessor at a child and parent coordinate records a common background assignment, two child values, two parent values, and a nonzero cross-product contrast.

Definition (Lean source)
V :
Type uV
shared
X :
V → Type uX
shared
factor :
i j :
V
The common assignment fixing every coordinate not explicitly varied by the witness.
base :
∀ k, X k
The first child-coordinate value.
child₀ :
X i
The second child-coordinate value.
child₁ :
X i
The first parent-coordinate value.
parent₀ :
X j
The second parent-coordinate value.
parent₁ :
X j
The displayed factor contrast is nonzero.
nonzero :
localContrast factor i j base child₀ child₁ parent₀ parent₁ ≠ 0
Causalean.Graph.FiniteDensity.PositiveFactor.EdgeWitness · Causalean/Graph/Density/FiniteDAG/Positive/Factor.lean:52 · uses Accessor
def FactorSupClose reviewed
Causalean.Graph.FiniteDensity.PositiveFactor

Two real factor accessors are uniformly close at a radius when every pointwise factor difference has absolute value below that radius.

Definition (Lean source)
V :
Type uV
V → Type uX
shared
factorM factorN :
ε :
ℝ
i x :
FactorSupClose factorM factorN ε :
Prop
|factorN i x - factorM i x| < ε
Causalean.Graph.FiniteDensity.PositiveFactor.FactorSupClose · Causalean/Graph/Density/FiniteDAG/Positive/Factor.lean:73 · uses Accessor
theorem eventually_nonzero reviewed
Causalean.Graph.FiniteDensity.PositiveFactor.EdgeWitness

A nonzero local contrast witness for a factor accessor remains nonzero throughout some positive uniform neighborhood.

Formal statement
V :
Type uV
V → Type uX
shared
factorM :
i j :
V
w :
EdgeWitness factorM i j
∃ ε > 0,
∀ factorN : Accessor V X,
FactorSupClose factorM factorN ε → localContrast factorN i j w.base w.child₀ w.child₁ w.parent₀ w.parent₁
≠ 0
Proof (Lean source)
theorem EdgeWitness.eventually_nonzero [Fintype V] (factorM : Accessor V X) {i j : V} (w : EdgeWitness factorM i j) : ∃ ε > 0, ∀ factorN : Accessor V X, FactorSupClose factorM factorN ε → localContrast factorN i j w.base w.child₀ w.child₁ w.parent₀ w.parent₁ ≠ 0 := by let a : Fin 4 → ℝ := ![ factorM i (update (update w.base i w.child₀) j w.parent₀), factorM i (update (update w.base i w.child₁) j w.parent₁), factorM i (update (update w.base i w.child₀) j w.parent₁), factorM i (update (update w.base i w.child₁) j w.parent₀)] let q : (Fin 4 → ℝ) → ℝ := fun z ↦ z 0 * z 1 - z 2 * z 3 have hqa : q a ≠ 0 := by simpa [q, a, localContrast] using w.nonzero have hq : Continuous q := by unfold q exact ((continuous_apply 0).mul (continuous_apply 1)).sub ((continuous_apply 2).mul (continuous_apply 3)) have hne : {z | q z ≠ 0} ∈ nhds a := hq.continuousAt.eventually_ne hqa rcases Metric.mem_nhds_iff.mp hne with ⟨ε, hε, hball⟩ refine ⟨ε, hε, ?_⟩ intro factorN hclose let b : Fin 4 → ℝ := ![ factorN i (update (update w.base i w.child₀) j w.parent₀), factorN i (update (update w.base i w.child₁) j w.parent₁), factorN i (update (update w.base i w.child₀) j w.parent₁), factorN i (update (update w.base i w.child₁) j w.parent₀)] have hba : dist b a < ε := by rw [dist_pi_lt_iff hε] intro k fin_cases k · simpa [b, a, Real.dist_eq] using hclose i (update (update w.base i w.child₀) j w.parent₀) · simpa [b, a, Real.dist_eq] using hclose i (update (update w.base i w.child₁) j w.parent₁) · simpa [b, a, Real.dist_eq] using hclose i (update (update w.base i w.child₀) j w.parent₁) · simpa [b, a, Real.dist_eq] using hclose i (update (update w.base i w.child₁) j w.parent₀) have hqb : q b ≠ 0 := hball (Metric.mem_ball.mpr hba) change q b ≠ 0 exact hqb
Causalean.Graph.FiniteDensity.PositiveFactor.EdgeWitness.eventually_nonzero · Causalean/Graph/Density/FiniteDAG/Positive/Factor.lean:78 · uses Accessor , EdgeWitness , FactorSupClose , localContrast
Basic 7 core · 1 supporting This module defines uniformly positive continuous finite-DAG product-density mechanisms. ★ lintegral_node_given_parents

Uniformly positive continuous DAG product densities: foundations

This module defines uniformly positive continuous finite-DAG product-density mechanisms. With compact-coordinate hypotheses, it proves the conditional-law formula identifying a node's normalized local factor as its law conditional on its parents. The edge characterization and stable witnesses are in the companion modules.

theorem lintegral_node_given_parents reviewed
Causalean.Graph.FiniteDensity.Factorization

A normalized finite-DAG density factorization, node, parent-coordinate test, node-value test, and measurability of those two tests ensure that integrating their product under the observational law equals integrating the parent test against the node's local conditional density.

Formal statement
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
B :
i :
V
h :
(∀ k : G.parents i, X k) → ℝ≥0∞
g :
X i → ℝ≥0∞
hh :
hg :
(∫⁻ x, h (coordinateProjection (X := X) (G.parents i) x) * g (x i) ∂B.observationalMeasure)
= ∫⁻ x, h (coordinateProjection (X := X) (G.parents i) x) * (∫⁻ z, g z * B.factor i (update x i z) ∂μ i) ∂B.observationalMeasure
Proof (Lean source)
theorem Factorization.lintegral_node_given_parents (B : Factorization G X μ) (i : V) (h : (∀ k : G.parents i, X k) → ℝ≥0∞) (g : X i → ℝ≥0∞) (hh : Measurable h) (hg : Measurable g) : (∫⁻ x, h (coordinateProjection (X := X) (G.parents i) x) * g (x i) ∂B.observationalMeasure) = ∫⁻ x, h (coordinateProjection (X := X) (G.parents i) x) * (∫⁻ z, g z * B.factor i (update x i z) ∂μ i) ∂B.observationalMeasure := by /- Use the existing reverse-topological elimination identities to compute the joint marginal of `i ∪ parents i`, then apply Tonelli twice and `B.normalized_factor`. -/ classical let τ := canonicalTopologicalRanking G let P := predecessors τ i let A := insert i P let T := univ \ A let q₁ : (∀ k, X k) → ℝ≥0∞ := fun x ↦ h (coordinateProjection (X := X) (G.parents i) x) * g (x i) let r : (∀ k, X k) → ℝ≥0∞ := fun x ↦ ∫⁻ z, g z * B.factor i (update x i z) ∂μ i let q₂ : (∀ k, X k) → ℝ≥0∞ := fun x ↦ h (coordinateProjection (X := X) (G.parents i) x) * r x have hparentsP : G.parents i ⊆ P := parents_subset_predecessors τ i have hiParents : i ∉ G.parents i := by simpa [mem_parents] using G.irrefl i have hAclosed : ParentClosed G A := by intro j hj k hk rcases Finset.mem_insert.mp hj with rfl | hjP · exact Finset.mem_insert_of_mem (hparentsP hk) · exact Finset.mem_insert_of_mem (parentClosed_predecessors τ i hjP hk) have hiP : i ∉ P := not_mem_predecessors τ i have hleaf : IsLeafIn G i A := by refine ⟨Finset.mem_insert_self i P, ?_⟩ intro j hj hji hij have hjP : j ∈ P := (Finset.mem_insert.mp hj).resolve_left hji have hjlt : τ.rank j < τ.rank i := by simpa [P, predecessors] using hjP exact (not_lt_of_ge (le_of_lt hjlt)) (τ.edge_lt hij) have hq₁ : Measurable q₁ := by unfold q₁ fun_prop have hr : Measurable r := by unfold r apply Measurable.lintegral_prod_right exact (hg.comp measurable_snd).mul ((B.measurable_factor i).comp measurable_update') have hq₂ : Measurable q₂ := by unfold q₂ fun_prop have hq₁_dep : DependsOn A q₁ := by intro x y hxy unfold q₁ congr 1 · congr 1 funext k exact hxy k (Finset.mem_insert_of_mem (hparentsP k.property)) · exact congrArg g (hxy i (Finset.mem_insert_self i P)) have hr_dep : DependsOn A r := by intro x y hxy unfold r apply lintegral_congr intro z congr 1 apply B.local_factor i intro k hk rcases Finset.mem_insert.mp hk with rfl | hk · simp · have hki : k ≠ i := fun hki ↦ hiParents (by simpa [hki] using hk) rw [Function.update_of_ne hki, Function.update_of_ne hki] exact hxy k (Finset.mem_insert_of_mem (hparentsP hk)) have hq₂_dep : DependsOn A q₂ := by intro x y hxy unfold q₂ congr 1 · congr 1 funext k exact hxy k (Finset.mem_insert_of_mem (hparentsP k.property)) · exact hr_dep hxy have hmarginal_mul (q : (∀ k, X k) → ℝ≥0∞) (hq : Measurable q) (hq_dep : DependsOn A q) : (∫⋯∫⁻_T, fun x ↦ B.observationalDensity x * q x ∂μ) = fun x ↦ B.partialDensity A x * q x := by funext x simp only [lmarginal] calc (∫⁻ y, B.observationalDensity (Function.updateFinset x T y) * q (Function.updateFinset x T y) ∂Measure.pi fun j : T ↦ μ j) = ∫⁻ y, B.observationalDensity (Function.updateFinset x T y) * q x ∂Measure.pi fun j : T ↦ μ j := by apply lintegral_congr intro y rw [hq_dep (fun k hk ↦ by simp only [Function.updateFinset] rw [dif_neg] simpa [T] using hk)] _ = (∫⁻ y, B.observationalDensity (Function.updateFinset x T y) ∂Measure.pi fun j : T ↦ μ j) * q x := by rw [lintegral_mul_const] exact B.measurable_observationalDensity.comp measurable_updateFinset _ = B.partialDensity A x * q x := by rw [show (∫⁻ y, B.observationalDensity (Function.updateFinset x T y) ∂Measure.pi fun j : T ↦ μ j) = (∫⋯∫⁻_T, B.observationalDensity ∂μ) x by rfl] exact congrArg (· * q x) (congrFun (B.lmarginal_compl_observationalDensity_eq hAclosed) x) have hsingle : (∫⋯∫⁻_{i}, fun x ↦ B.partialDensity A x * q₁ x ∂μ) = (∫⋯∫⁻_{i}, fun x ↦ B.partialDensity A x * q₂ x ∂μ) := by rw [MeasureTheory.lmarginal_singleton, MeasureTheory.lmarginal_singleton] funext x unfold q₁ q₂ r simp only [Function.update_self] calc (∫⁻ z, B.partialDensity A (update x i z) * (h (fun k ↦ update x i z k) * g z) ∂μ i) = B.partialDensity (A.erase i) x * h (coordinateProjection (X := X) (G.parents i) x) * (∫⁻ z, g z * B.factor i (update x i z) ∂μ i) := by simp_rw [show ∀ z, B.partialDensity A (update x i z) = B.factor i (update x i z) * B.partialDensity (A.erase i) x by intro z calc B.partialDensity A (update x i z) = B.factor i (update x i z) * B.partialDensity (A.erase i) (update x i z) := by unfold Factorization.partialDensity exact (Finset.mul_prod_erase A (fun j ↦ B.factor j (update x i z)) hleaf.1).symm _ = _ := by rw [B.partialDensity_erase_update_leaf hleaf]] simp_rw [show ∀ (z : X i), h (fun k : G.parents i ↦ update x i z k) = h (coordinateProjection (X := X) (G.parents i) x) by intro z congr 1 funext k exact Function.update_of_ne (fun hki ↦ hiParents (by simpa [hki] using k.property)) _ _] rw [← lintegral_const_mul] · congr 1 funext z simp only [mul_assoc, mul_left_comm, mul_comm] · exact hg.mul ((B.measurable_factor i).comp (measurable_update x)) _ = ∫⁻ z, B.partialDensity A (update x i z) * (h (fun k ↦ update x i z k) * ∫⁻ w, g w * B.factor i (update (update x i z) i w) ∂μ i) ∂μ i := by simp_rw [Function.update_idem] simp_rw [show ∀ (z : X i), h (fun k : G.parents i ↦ update x i z k) = h (coordinateProjection (X := X) (G.parents i) x) by intro z congr 1 funext k exact Function.update_of_ne (fun hki ↦ hiParents (by simpa [hki] using k.property)) _ _] rw [lintegral_mul_const] · rw [B.lintegral_partialDensity_leaf hleaf x] simp only [mul_assoc, mul_left_comm, mul_comm] · exact (B.measurable_partialDensity A).comp (measurable_update x) have hweighted : ∫⁻ x, B.observationalDensity x * q₁ x ∂Measure.pi μ = ∫⁻ x, B.observationalDensity x * q₂ x ∂Measure.pi μ := by apply MeasureTheory.lintegral_eq_of_lmarginal_eq (T ∪ {i}) (B.measurable_observationalDensity.mul hq₁) (B.measurable_observationalDensity.mul hq₂) rw [MeasureTheory.lmarginal_union' μ _ (B.measurable_observationalDensity.mul hq₁) (Finset.disjoint_singleton_right.mpr (by simp [T, A])), MeasureTheory.lmarginal_union' μ _ (B.measurable_observationalDensity.mul hq₂) (Finset.disjoint_singleton_right.mpr (by simp [T, A]))] change (∫⋯∫⁻_{i}, ∫⋯∫⁻_T, (fun x ↦ B.observationalDensity x * q₁ x) ∂μ ∂μ) = (∫⋯∫⁻_{i}, ∫⋯∫⁻_T, (fun x ↦ B.observationalDensity x * q₂ x) ∂μ ∂μ) rw [hmarginal_mul q₁ hq₁ hq₁_dep, hmarginal_mul q₂ hq₂ hq₂_dep] exact hsingle change (∫⁻ x, q₁ x ∂B.observationalMeasure) = ∫⁻ x, q₂ x ∂B.observationalMeasure rw [Factorization.observationalMeasure, lintegral_withDensity_eq_lintegral_mul _ B.measurable_observationalDensity hq₁, lintegral_withDensity_eq_lintegral_mul _ B.measurable_observationalDensity hq₂] exact hweighted
structure UniformlyPositiveContinuousFactorization reviewed
Causalean.Graph.FiniteDensity

Over a finite DAG with coordinate spaces and reference measures, a uniformly positive continuous factorization consists of a normalized parent-local factorization, a common lower bound, proof that the bound is strictly positive, pointwise finiteness of every local density, continuity of their real values, and a guarantee that every density is at least the common bound.

Definition (Lean source)
G :
DAG V
X :
V → Type uX
∀ i, MeasurableSpace (X i)
∀ i, TopologicalSpace (X i)
μ :
∀ i, Measure (X i)
∀ i, SigmaFinite (μ i)
The underlying normalized measurable parent-local DAG factorization.
toFactorization :
The common pointwise lower bound for every local density.
lower :
ℝ
The common lower bound is strictly positive.
lower_pos :
0 < lower
Every extended-nonnegative local density is finite at every point.
factor_ne_top :
∀ i x, toFactorization.factor i x ≠ ∞
The real value of each local density is continuous on the full product domain.
factor_continuous :
∀ i, Continuous (fun x : ∀ k, X k ↦ (toFactorization.factor i x).toReal)
Every local density is bounded below by the displayed common positive margin.
lower_le_factor :
∀ i x, lower ≤ (toFactorization.factor i x).toReal
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization · Causalean/Graph/Density/FiniteDAG/Positive/Basic.lean:230 · uses DAG
abbrev factorAccessor reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

A uniformly positive continuous factorization has a real-valued common factor accessor obtained by taking the finite value of each extended-nonnegative local density.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
factorAccessor M :
PositiveFactor.Accessor V X
fun i x ↦ (M.toFactorization.factor i x).toReal
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.factorAccessor · Causalean/Graph/Density/FiniteDAG/Positive/Basic.lean:261 · uses DAG , Accessor , UniformlyPositiveContinuousFactorization
abbrev observationalMeasure reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

A uniformly positive continuous factorization has an observational law given by the product reference measure weighted by the product of its local densities.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
observationalMeasure M :
Measure (∀ i, X i)
M.toFactorization.observationalMeasure
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.observationalMeasure · Causalean/Graph/Density/FiniteDAG/Positive/Basic.lean:267 · uses DAG , UniformlyPositiveContinuousFactorization
def CondIndepCoordinates reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

Coordinate i is conditionally independent of coordinate j given C under the observational product-density law.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
i j :
V
C :
CondIndepCoordinates M i j C :
Prop
CondIndepFun (comap (coordinateProjection (X := X) C) inferInstance) (coordinateConditioning_comap_le (X := X) C) (fun x : ∀ k, X k ↦ x i) (fun x : ∀ k, X k ↦ x j) M.observationalMeasure
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.CondIndepCoordinates · Causalean/Graph/Density/FiniteDAG/Positive/Basic.lean:271 · uses DAG , UniformlyPositiveContinuousFactorization
def FactorIndependentOf reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

For a uniformly positive continuous factorization, the local factor at a node is pointwise independent of a coordinate when updating only that coordinate leaves the factor unchanged throughout the product domain.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
i j :
V
FactorIndependentOf M i j :
Prop
PositiveFactor.FactorIndependentOf M.factorAccessor i j
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.FactorIndependentOf · Causalean/Graph/Density/FiniteDAG/Positive/Basic.lean:280 · uses DAG , UniformlyPositiveContinuousFactorization
def AEFactorIndependentOf reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

A child's local factor is almost-everywhere independent of coordinate j when the update identity holds for product-reference-almost every assignment and parent value.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
i j :
V
AEFactorIndependentOf M i j :
Prop
∀ᵐ x ∂Measure.pi μ, ∀ᵐ xj ∂μ j, M.toFactorization.factor i (update x j xj)
= M.toFactorization.factor i x
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.AEFactorIndependentOf · Causalean/Graph/Density/FiniteDAG/Positive/Basic.lean:286 · uses DAG , UniformlyPositiveContinuousFactorization
1 supporting declaration (lemmas, instances)
  • condDistrib_child_given_parents theorem — A uniformly positive continuous factorization and node satisfy the displayed regular-conditional-law identity: conditioning that node on its parents gives the reference measure weighted by the node's normalized local factor.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i :
    V
    P :
    G.parents i
    x₀ :
    choice inferInstance (: ∀ k, X k)
    d :
    fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P x₀ p) i z) (: (∀ k : P, X k) → X i → ℝ≥0∞)
    condDistrib (fun x : ∀ k, X k ↦ x i) (coordinateProjection (X := X) P) M.observationalMeasure
    =ᵐ[Measure.map (coordinateProjection (X := X) P) M.observationalMeasure] Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) d
    Proof (Lean source)
    theorem condDistrib_child_given_parents (i : V) : let P := G.parents i let x₀ : ∀ k, X k := Classical.choice inferInstance let d : (∀ k : P, X k) → X i → ℝ≥0∞ := fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P x₀ p) i z) condDistrib (fun x : ∀ k, X k ↦ x i) (coordinateProjection (X := X) P) M.observationalMeasure =ᵐ[Measure.map (coordinateProjection (X := X) P) M.observationalMeasure] Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) d := by classical dsimp only let P := G.parents i let x₀ : ∀ k, X k := Classical.choice inferInstance let d : (∀ k : P, X k) → X i → ℝ≥0∞ := fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P x₀ p) i z) have hd : Measurable (uncurry d) := by unfold d exact (M.toFactorization.measurable_factor i).comp (measurable_update'.comp (((measurable_coordinateExtension P x₀).comp measurable_fst).prodMk measurable_snd)) let κ : Kernel (∀ k : P, X k) (X i) := Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) d have hκ_apply (p : ∀ k : P, X k) : κ p = (μ i).withDensity (d p) := by dsimp [κ] rw [Kernel.withDensity_apply _ hd, Kernel.const_apply] have hd_eq (x : ∀ k, X k) (z : X i) : d (coordinateProjection (X := X) P x) z = M.toFactorization.factor i (update x i z) := by unfold d apply M.toFactorization.local_factor i intro k hk rcases Finset.mem_insert.mp hk with rfl | hk · simp · have hki : k ≠ i := by intro hki subst k exact G.irrefl i (G.mem_parents.mp hk) have hkP : k ∈ P := by simpa [P] using hk simp [coordinateExtension, coordinateProjection, hkP, hki] letI : IsFiniteKernel κ := ⟨1, ENNReal.one_lt_top, fun p ↦ by rw [hκ_apply, withDensity_apply _ MeasurableSet.univ] simp only [Measure.restrict_univ] change ∫⁻ z, M.toFactorization.factor i (update (coordinateExtension P x₀ p) i z) ∂μ i ≤ 1 rw [M.toFactorization.normalized_factor]⟩ apply condDistrib_ae_eq_of_measure_eq_compProd_of_measurable (measurable_coordinateProjection P) (measurable_pi_apply i) apply Measure.ext_prod intro s t hs ht rw [Measure.map_apply (by fun_prop) (hs.prod ht), Measure.compProd_apply_prod hs ht] rw [← lintegral_indicator_one ((hs.prod ht).preimage ((measurable_coordinateProjection P).prodMk (measurable_pi_apply i)))] rw [← lintegral_indicator hs] rw [lintegral_map ((Kernel.measurable_coe κ ht).indicator hs) (measurable_coordinateProjection P)] simp_rw [hκ_apply, withDensity_apply _ ht] calc (∫⁻ a, ((fun x : ∀ k, X k ↦ (coordinateProjection (X := X) P x, x i)) ⁻¹' (s ×ˢ t)).indicator 1 a ∂M.observationalMeasure) = ∫⁻ x, s.indicator 1 (coordinateProjection (X := X) P x) * t.indicator 1 (x i) ∂M.observationalMeasure := by apply lintegral_congr intro x by_cases hp : coordinateProjection (X := X) P x ∈ s <;> by_cases hi : x i ∈ t <;> simp [indicator, hp, hi] _ = ∫⁻ x, s.indicator 1 (coordinateProjection (X := X) P x) * (∫⁻ z, t.indicator 1 z * M.toFactorization.factor i (update x i z) ∂μ i) ∂M.observationalMeasure := _root_.Causalean.Graph.FiniteDensity.Factorization.lintegral_node_given_parents M.toFactorization i (s.indicator 1) (t.indicator 1) (measurable_const.indicator hs) (measurable_const.indicator ht) _ = ∫⁻ a, s.indicator (fun p ↦ ∫⁻ z in t, d p z ∂μ i) (coordinateProjection (X := X) P a) ∂M.observationalMeasure := by apply lintegral_congr intro x by_cases hp : coordinateProjection (X := X) P x ∈ s · simp only [Set.indicator_of_mem hp, Pi.one_apply, one_mul] rw [← lintegral_indicator ht] apply lintegral_congr intro z by_cases hz : z ∈ t <;> simp [indicator, hz, hd_eq] · simp [indicator, hp]
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.condDistrib_child_given_parents · Causalean/Graph/Density/FiniteDAG/Positive/Basic.lean:292
Finite 12 core · 9 supporting This module gives a pointwise finite-state interface for strictly positive Bayesian-network mechanisms. ★ edge_condIndep_iff_localContrast_zero

Positive finite-state DAG mechanisms

This module gives a pointwise finite-state interface for strictly positive Bayesian-network mechanisms. It defines cylinder marginals and conditional masses directly from the product density, and characterizes a redundant directed edge by independence of the child's local factor. Stable witnesses are in Positive.FiniteWitness.

structure PositiveFiniteDAGMechanism reviewed
Causalean.Graph.FiniteDensity

A positive finite-state DAG mechanism consists of normalized, strictly positive local factors, each depending only on its own coordinate and its graph parents.

Definition (Lean source)
V :
Type uV
shared
G :
DAG V
X :
V → Type uX
∀ i, Fintype (X i)
The local conditional mass factor at each vertex.
factor :
∀ i
if
(∀ k, X k)
then
ℝ
Every local factor is strictly positive.
factor_pos :
∀ i x, 0 < factor i x
Each local factor sums to one in its own coordinate for every fixed context.
factor_normalized :
∀ i x, ∑ z : X i, factor i (update x i z) = 1
A local factor depends only on its vertex and its parents.
factor_local :
∀ i, DependsOn (X := X) (insert i (G.parents i)) (factor i)
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:35 · uses DAG
abbrev factorAccessor reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

A positive finite-state mechanism exposes its real local factors through the common positive-factor accessor.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
factorAccessor M :
PositiveFactor.Accessor V X
M.factor
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.factorAccessor · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:52 · uses DAG , Accessor , PositiveFiniteDAGMechanism
def factorLower reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

For a positive finite-state mechanism, a common strictly positive lower bound for its local factors is their minimum when the vertex set is nonempty, and is one when it is empty.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
factorLower M :
ℝ
by classical exact if hV : Nonempty V then Finset.univ.inf' (by letI := hV exact univ_nonempty) (fun p : V × (∀ k, X k) ↦ M.factor p.1 p.2) else 1
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.factorLower · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:56 · uses DAG , PositiveFiniteDAGMechanism
def toCountingFactorization reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

The positive finite-state mechanism determines a normalized DAG factorization over counting reference measure, using the discrete measurable structure on every coordinate.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
toCountingFactorization M :
letI : ∀ i, MeasurableSpace (X i)
fun _ ↦ ⊤ let μ : ∀ i, Measure (X i) := fun _ ↦ Measure.count Factorization G X μ := by letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ let μ : ∀ i, Measure (X i) := fun _ ↦ Measure.count haveI : ∀ i, SigmaFinite (μ i) := fun _ ↦ inferInstance exact { factor := fun i x ↦ ofReal (M.factor i x) measurable_factor := fun _ ↦ measurable_of_countable _ local_factor := fun i x y hxy ↦ congrArg ofReal (M.factor_local i hxy) normalized_factor := by intro i x rw [lintegral_count, tsum_fintype, ← ENNReal.ofReal_sum_of_nonneg] · rw [M.factor_normalized] simp · intro z _ exact (M.factor_pos i _).le }
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.toCountingFactorization · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:67 · uses DAG , Factorization , PositiveFiniteDAGMechanism
def toCompactPositiveFactorization reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

The positive finite-state mechanism determines a compact positive factorization over discrete coordinates and counting measure.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
toCompactPositiveFactorization M :
letI : ∀ i, MeasurableSpace (X i)
fun _ ↦ ⊤ letI : ∀ i, TopologicalSpace (X i) := fun _ ↦ ⊥ let μ : ∀ i, Measure (X i) := fun _ ↦ Measure.count UniformlyPositiveContinuousFactorization G X μ := by letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ letI : ∀ i, TopologicalSpace (X i) := fun _ ↦ ⊥ letI : ∀ i, DiscreteTopology (X i) := fun i ↦ discreteTopology_bot (X i) let μ : ∀ i, Measure (X i) := fun _ ↦ Measure.count haveI : ∀ i, SigmaFinite (μ i) := fun _ ↦ inferInstance refine { toFactorization := M.toCountingFactorization lower := factorLower M lower_pos := ?_ factor_ne_top := fun _ _ ↦ ENNReal.ofReal_ne_top factor_continuous := ?_ lower_le_factor := ?_ } · classical by_cases hV : Nonempty V · simp only [factorLower, hV, dif_pos] letI := hV exact (Finset.lt_inf'_iff univ_nonempty).2 fun p _ ↦ M.factor_pos p.1 p.2 · simp [factorLower, hV] · intro i exact continuous_of_discreteTopology · intro i x classical haveI : Nonempty V := ⟨i⟩ change factorLower M
≤ (ofReal (M.factor i x)).toReal rw [ENNReal.toReal_ofReal (M.factor_pos i x).le] simp only [factorLower, dif_pos (inferInstance : Nonempty V)] exact Finset.inf'_le _ (Finset.mem_univ (i, x))
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.toCompactPositiveFactorization · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:88 · uses DAG , PositiveFiniteDAGMechanism , UniformlyPositiveContinuousFactorization
def jointMass reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

The joint mass of an assignment is the product of all local factors.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
x :
∀ i, X i
jointMass M x :
ℝ
∏ i, M.factor i x
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.jointMass · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:130 · uses DAG , PositiveFiniteDAGMechanism
def marginalMass reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

The mass of the cylinder fixing the coordinates in S to their values in x is obtained by summing the joint product mass over all compatible full assignments.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
S :
x :
∀ i, X i
marginalMass M S x :
ℝ
∑ y : ∀ i, X i, if coordinateProjection (X := X) S y
= coordinateProjection (X := X) S x then M.jointMass y else 0
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.marginalMass · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:133 · uses DAG , PositiveFiniteDAGMechanism
def conditionalMass reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

The pointwise conditional mass of coordinate i taking a given value, given the coordinates in C, is the mass of the cylinder fixing i and C divided by the mass of the cylinder fixing C (zero if that mass is zero). It is the elementary conditional probability when i is not in C, which is how it is used; if i belongs to C, the numerator overrides that conditioning value.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
i :
V
C :
x :
∀ i, X i
z :
X i
conditionalMass M i C x z :
ℝ
M.marginalMass (insert i C) (update x i z) / M.marginalMass C x
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.conditionalMass · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:140 · uses DAG , PositiveFiniteDAGMechanism
def CondIndepCoordinates reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

Under the finite mechanism's counting-factorization observational law, coordinates i and j satisfy conditional independence given the coordinates in C for any conditioning set C.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
i j :
V
C :
CondIndepCoordinates M i j C :
Prop
letI : ∀ k, MeasurableSpace (X k) := fun _ ↦ ⊤ letI : ∀ k, TopologicalSpace (X k) := fun _ ↦ ⊥ letI : ∀ k, DiscreteTopology (X k) := fun k ↦ discreteTopology_bot (X k) (M.toCompactPositiveFactorization).CondIndepCoordinates i j C
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.CondIndepCoordinates · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:418 · uses DAG , PositiveFiniteDAGMechanism
def FactorIndependentOf reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

A local factor is independent of coordinate j when changing only that coordinate never changes the factor.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
i j :
V
FactorIndependentOf M i j :
Prop
PositiveFactor.FactorIndependentOf M.factorAccessor i j
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.FactorIndependentOf · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:427 · uses DAG , PositiveFiniteDAGMechanism
def localContrast reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

The four-point local contrast compares the two-by-two cross products of a child's factor as its own value and one candidate parent value vary, with all other coordinates held fixed.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
i j :
V
x :
∀ k, X k
xi xi' :
X i
xj xj' :
X j
localContrast M i j x xi xi' xj xj' :
ℝ
PositiveFactor.localContrast M.factorAccessor i j x xi xi' xj xj'
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.localContrast · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:432 · uses DAG , PositiveFiniteDAGMechanism
theorem edge_condIndep_iff_localContrast_zero reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

A positive finite-state DAG mechanism and directed edge have conditional independence of the endpoints given the other parents exactly when every local four-point factor contrast vanishes.

Formal statement
V :
Type uV
V → Type uX
DAG V
shared
i j :
V
hji :
G.edge j i
M.CondIndepCoordinates i j ((G.parents i).erase j)
↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0
Proof (Lean source)
theorem edge_condIndep_iff_localContrast_zero {i j : V} (hji : G.edge j i) : M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0 := by exact (M.edge_condIndep_iff_factorIndependent hji).trans (M.factorIndependent_iff_localContrast_zero hji)
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.edge_condIndep_iff_localContrast_zero · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:639 · uses DAG , parents , PositiveFiniteDAGMechanism , CondIndepCoordinates , localContrast
9 supporting declarations (lemmas, instances)
  • toCountingFactorization_factor theorem — For a finite mechanism, the local counting density at a node and assignment is the extended-nonnegative embedding of its mass factor.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    i :
    V
    x :
    ∀ k, X k
    letI : ∀ k, MeasurableSpace (X k)
    Proof (Lean source)
    theorem toCountingFactorization_factor (i : V) (x : ∀ k, X k) : letI : ∀ k, MeasurableSpace (X k) := fun _ ↦ ⊤ M.toCountingFactorization.factor i x = ofReal (M.factor i x) := by rfl
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.toCountingFactorization_factor · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:123
  • sum_jointMass theorem — The product density of a normalized positive finite DAG mechanism has total mass one.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    ∑ x : ∀ i, X i, M.jointMass x = 1
    Proof (Lean source)
    theorem sum_jointMass : ∑ x : ∀ i, X i, M.jointMass x = 1 := by letI : ∀ i, MeasurableSpace (X i) := fun _ => ⊤ let μ : ∀ i, Measure (X i) := fun _ => Measure.count haveI : ∀ i, SigmaFinite (μ i) := fun _ => inferInstance let B : Factorization G X μ := M.toCountingFactorization have hpi : Measure.pi μ = (Measure.count : Measure (∀ i, X i)) := by apply Measure.ext_of_singleton intro x rw [Measure.pi_singleton, Measure.count_singleton] dsimp [μ] simp have hobs (x : ∀ i, X i) : B.observationalDensity x = ofReal (M.jointMass x) := by change (∏ i ∈ univ, ofReal (M.factor i x)) = ofReal (∏ i ∈ univ, M.factor i x) rw [ENNReal.ofReal_prod_of_nonneg] intro i _ exact (M.factor_pos i x).le let x₀ : ∀ i, X i := fun i => choice (inferInstance : Nonempty (X i)) have hmarg := B.lmarginal_compl_observationalDensity_eq (A := ∅) (by intro i hi simp at hi) have hint : ∫⁻ x, B.observationalDensity x ∂Measure.pi μ = 1 := by rw [MeasureTheory.lintegral_eq_lmarginal_univ x₀] simpa [Factorization.partialDensity] using congrFun hmarg x₀ rw [hpi, MeasureTheory.lintegral_count, tsum_fintype] at hint simp_rw [hobs] at hint rw [← ENNReal.ofReal_sum_of_nonneg] at hint · exact ENNReal.ofReal_eq_one.mp hint · intro x _ exact (Finset.prod_pos fun i _ => M.factor_pos i x).le
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.sum_jointMass · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:147
  • marginalMass_pos theorem — Every cylinder marginal of a positive finite DAG mechanism is strictly positive.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    S :
    x :
    ∀ i, X i
    0 < M.marginalMass S x
    Proof (Lean source)
    theorem marginalMass_pos (S : Finset V) (x : ∀ i, X i) : 0 < M.marginalMass S x := by unfold marginalMass apply Finset.sum_pos' · intro y _ split_ifs · exact (Finset.prod_pos fun i _ => M.factor_pos i y).le · exact le_rfl · refine ⟨x, Finset.mem_univ x, ?_⟩ simp only [ite_true] exact Finset.prod_pos fun i _ => M.factor_pos i x
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.marginalMass_pos · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:181
  • pi_count_eq_count theorem — For discrete coordinate spaces, the product of coordinate counting measures equals counting measure on the full assignment space.
    V :
    Type uV
    V → Type uX
    shared
    letI : ∀ i, MeasurableSpace (X i)
    Proof (Lean source)
    theorem pi_count_eq_count : letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ Measure.pi (fun i : V ↦ (Measure.count : Measure (X i))) = (Measure.count : Measure (∀ i, X i)) := by letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ apply Measure.ext_of_singleton intro x rw [Measure.pi_singleton, Measure.count_singleton] simp
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.pi_count_eq_count · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:194
  • toCountingFactorization_observationalDensity theorem — At every full assignment, the counting-factorization product density is the extended-nonnegative embedding of the mechanism's joint mass.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    x :
    ∀ i, X i
    letI : ∀ i, MeasurableSpace (X i)
    Proof (Lean source)
    theorem toCountingFactorization_observationalDensity (x : ∀ i, X i) : letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ M.toCountingFactorization.observationalDensity x = ofReal (M.jointMass x) := by letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ change (∏ i ∈ univ, ofReal (M.factor i x)) = ofReal (∏ i ∈ univ, M.factor i x) rw [ENNReal.ofReal_prod_of_nonneg] intro i _ exact (M.factor_pos i x).le
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.toCountingFactorization_observationalDensity · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:206
  • ofReal_marginalMass_eq_lintegral_indicator theorem — For a coordinate cylinder, its mass under the counting-factorization observational measure is the extended-nonnegative embedding of the mechanism's cylinder mass.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    S :
    x :
    ∀ i, X i
    letI : ∀ i, MeasurableSpace (X i)
    Proof (Lean source)
    theorem ofReal_marginalMass_eq_lintegral_indicator (S : Finset V) (x : ∀ i, X i) : letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ ofReal (M.marginalMass S x) = ∫⁻ y, (if coordinateProjection (X := X) S y = coordinateProjection (X := X) S x then 1 else 0) ∂M.toCountingFactorization.observationalMeasure := by letI : ∀ i, MeasurableSpace (X i) := fun _ ↦ ⊤ let μ : ∀ i, Measure (X i) := fun _ ↦ Measure.count rw [Factorization.observationalMeasure, lintegral_withDensity_eq_lintegral_mul _ M.toCountingFactorization.measurable_observationalDensity (measurable_of_countable _)] rw [show Measure.pi μ = (Measure.count : Measure (∀ i, X i)) by simpa [μ] using (pi_count_eq_count (V := V) (X := X))] rw [lintegral_count, tsum_fintype] unfold marginalMass rw [ENNReal.ofReal_sum_of_nonneg] · apply Finset.sum_congr rfl intro y _ change ofReal (if coordinateProjection (X := X) S y = coordinateProjection (X := X) S x then M.jointMass y else 0) = M.toCountingFactorization.observationalDensity y * (if coordinateProjection (X := X) S y = coordinateProjection (X := X) S x then 1 else 0) rw [M.toCountingFactorization_observationalDensity] by_cases hy : coordinateProjection (X := X) S y = coordinateProjection (X := X) S x · simp [hy] · simp [hy] · intro y _ by_cases hy : coordinateProjection (X := X) S y = coordinateProjection (X := X) S x · simp [hy] exact (Finset.prod_pos fun j _ ↦ M.factor_pos j y).le · simp [hy]
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.ofReal_marginalMass_eq_lintegral_indicator · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:218
  • conditionalMass_given_parents theorem — Conditioning a node on all of its parents recovers exactly its normalized local factor.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    i :
    V
    x :
    ∀ i, X i
    z :
    X i
    M.conditionalMass i (G.parents i) x z = M.factor i (update x i z)
    Proof (Lean source)
    theorem conditionalMass_given_parents (i : V) (x : ∀ i, X i) (z : X i) : M.conditionalMass i (G.parents i) x z = M.factor i (update x i z) := by letI : ∀ i, MeasurableSpace (X i) := fun _ => ⊤ let μ : ∀ i, Measure (X i) := fun _ => Measure.count haveI : ∀ i, SigmaFinite (μ i) := fun _ => inferInstance let B : Factorization G X μ := M.toCountingFactorization have hpi : Measure.pi μ = (Measure.count : Measure (∀ i, X i)) := by apply Measure.ext_of_singleton intro y rw [Measure.pi_singleton, Measure.count_singleton] dsimp [μ] simp have hobs (y : ∀ i, X i) : B.observationalDensity y = ofReal (M.jointMass y) := by change (∏ i ∈ univ, ofReal (M.factor i y)) = ofReal (∏ i ∈ univ, M.factor i y) rw [ENNReal.ofReal_prod_of_nonneg] intro j _ exact (M.factor_pos j y).le have hcyl (S : Finset V) (a : ∀ i, X i) : ofReal (M.marginalMass S a) = ∫⁻ y, (if coordinateProjection (X := X) S y = coordinateProjection (X := X) S a then 1 else 0) ∂B.observationalMeasure := by rw [Factorization.observationalMeasure, lintegral_withDensity_eq_lintegral_mul _ B.measurable_observationalDensity (measurable_of_countable _)] rw [hpi, lintegral_count, tsum_fintype] unfold marginalMass rw [ENNReal.ofReal_sum_of_nonneg] · apply Finset.sum_congr rfl intro y _ change ofReal (if coordinateProjection (X := X) S y = coordinateProjection (X := X) S a then M.jointMass y else 0) = B.observationalDensity y * (if coordinateProjection (X := X) S y = coordinateProjection (X := X) S a then 1 else 0) rw [hobs] by_cases hy : coordinateProjection (X := X) S y = coordinateProjection (X := X) S a · simp [hy] · simp [hy] · intro y _ by_cases hy : coordinateProjection (X := X) S y = coordinateProjection (X := X) S a · simp [hy] exact (Finset.prod_pos fun j _ => M.factor_pos j y).le · simp [hy] let h : (∀ k : G.parents i, X k) → ℝ≥0∞ := fun p => if p = coordinateProjection (X := X) (G.parents i) x then 1 else 0 let g : X i → ℝ≥0∞ := fun w => if w = z then 1 else 0 have hnode := _root_.Causalean.Graph.FiniteDensity.Factorization.lintegral_node_given_parents B i h g (measurable_of_countable _) (measurable_of_countable _) have hinner (y : ∀ i, X i) : (∫⁻ w, g w * B.factor i (update y i w) ∂μ i) = B.factor i (update y i z) := by rw [lintegral_count, tsum_fintype] simp [g] have hmeasure : ofReal (M.marginalMass (insert i (G.parents i)) (update x i z)) = ofReal (M.factor i (update x i z)) * ofReal (M.marginalMass (G.parents i) x) := by rw [hcyl, hcyl] calc (∫⁻ y, (if coordinateProjection (X := X) (insert i (G.parents i)) y = coordinateProjection (X := X) (insert i (G.parents i)) (update x i z) then 1 else 0) ∂B.observationalMeasure) = ∫⁻ y, h (coordinateProjection (X := X) (G.parents i) y) * g (y i) ∂B.observationalMeasure := by apply lintegral_congr intro y by_cases hyi : y i = z <;> by_cases hyp : coordinateProjection (X := X) (G.parents i) y = coordinateProjection (X := X) (G.parents i) x <;> simp [h, g, projection_insert_update_iff, hyi, hyp] _ = ∫⁻ y, h (coordinateProjection (X := X) (G.parents i) y) * (∫⁻ w, g w * B.factor i (update y i w) ∂μ i) ∂B.observationalMeasure := hnode _ = ∫⁻ y, ofReal (M.factor i (update x i z)) * h (coordinateProjection (X := X) (G.parents i) y) ∂B.observationalMeasure := by apply lintegral_congr intro y rw [hinner] by_cases hy : coordinateProjection (X := X) (G.parents i) y = coordinateProjection (X := X) (G.parents i) x · change h _ * ofReal (M.factor i (update y i z)) = _ rw [factor_update_eq_of_projection_eq M i x y z hy] simp [h, hy] · simp [h, hy] _ = ofReal (M.factor i (update x i z)) * ∫⁻ y, h (coordinateProjection (X := X) (G.parents i) y) ∂B.observationalMeasure := by rw [lintegral_const_mul] exact measurable_of_countable _ _ = ofReal (M.factor i (update x i z)) * ∫⁻ y, (if coordinateProjection (X := X) (G.parents i) y = coordinateProjection (X := X) (G.parents i) x then 1 else 0) ∂B.observationalMeasure := by rfl have hreal : M.marginalMass (insert i (G.parents i)) (update x i z) = M.factor i (update x i z) * M.marginalMass (G.parents i) x := by rw [← ENNReal.ofReal_eq_ofReal_iff] · rw [ENNReal.ofReal_mul (M.factor_pos i _).le] exact hmeasure · exact (M.marginalMass_pos _ _).le · exact mul_nonneg (M.factor_pos i _).le (M.marginalMass_pos _ _).le unfold conditionalMass rw [hreal] exact mul_div_cancel_right₀ _ (ne_of_gt (M.marginalMass_pos (G.parents i) x))
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.conditionalMass_given_parents · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:305
  • edge_condIndep_iff_factorIndependent theorem — For a directed edge j → i, conditional independence of its endpoints given the other parents is equivalent to pointwise independence of the child's local factor from j.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ M.FactorIndependentOf i j
    Proof (Lean source)
    theorem edge_condIndep_iff_factorIndependent {i j : V} (hji : G.edge j i) : M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ M.FactorIndependentOf i j := by classical letI : ∀ k, MeasurableSpace (X k) := fun _ ↦ ⊤ letI : ∀ k, TopologicalSpace (X k) := fun _ ↦ ⊥ letI : ∀ k, DiscreteTopology (X k) := fun k ↦ discreteTopology_bot (X k) let μ : ∀ k, Measure (X k) := fun _ ↦ Measure.count haveI : ∀ k, SigmaFinite (μ k) := fun _ ↦ inferInstance haveI : ∀ k, BorelSpace (X k) := fun _ ↦ inferInstance haveI : ∀ k, CompactSpace (X k) := fun _ ↦ inferInstance haveI : ∀ k, StandardBorelSpace (X k) := fun _ ↦ inferInstance haveI : ∀ k, (μ k).IsOpenPosMeasure := fun k ↦ { open_pos := fun U _ hU ↦ by rcases hU with ⟨x, hx⟩ intro hzero have hsingleton := measure_mono_null (Set.singleton_subset_iff.mpr hx) hzero simpa [μ, Measure.count_singleton] using hsingleton } let CM : UniformlyPositiveContinuousFactorization G X μ := M.toCompactPositiveFactorization have hcompact := CM.edge_condIndep_iff_factorIndependent hji constructor · intro hCI x xj have hCI' : CM.CondIndepCoordinates i j ((G.parents i).erase j) := by exact hCI have hind := hcompact.mp hCI' x xj simpa [CM, UniformlyPositiveContinuousFactorization.factorAccessor, toCompactPositiveFactorization, toCountingFactorization, (M.factor_pos i (update x j xj)).le, (M.factor_pos i x).le] using hind · intro hind have hind' : CM.FactorIndependentOf i j := by intro x xj simpa [CM, UniformlyPositiveContinuousFactorization.factorAccessor, toCompactPositiveFactorization, toCountingFactorization, (M.factor_pos i (update x j xj)).le, (M.factor_pos i x).le] using hind x xj exact hcompact.mpr hind'
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.edge_condIndep_iff_factorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:536
  • factorIndependent_iff_localContrast_zero theorem — For a directed edge j → i, independence of the child's factor from j is equivalent to vanishing of every local four-point cross-product contrast.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.FactorIndependentOf i j
    ↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0
    Proof (Lean source)
    theorem factorIndependent_iff_localContrast_zero {i j : V} (hji : G.edge j i) : M.FactorIndependentOf i j ↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0 := by constructor · intro hind x xi xi' xj xj' change ∀ (x : ∀ k, X k) (xj : X j), M.factor i (update x j xj) = M.factor i x at hind have hij : i ≠ j := by intro hij subst j exact G.irrefl i hji unfold localContrast PositiveFactor.localContrast factorAccessor rw [hind (update x i xi) xj, hind (update x i xi') xj', hind (update x i xi) xj', hind (update x i xi') xj] ring · intro hzero x xj have hij : i ≠ j := by intro hij subst j exact G.irrefl i hji have hcross (z w : X i) : M.factor i (update (update x j xj) i z) * M.factor i (update x i w) = M.factor i (update x i z) * M.factor i (update (update x j xj) i w) := by apply sub_eq_zero.mp simpa [localContrast, PositiveFactor.localContrast, factorAccessor, Function.update_comm hij] using hzero x z w xj (x j) have hsum (z : X i) : M.factor i (update (update x j xj) i z) = M.factor i (update x i z) := by have hs := Finset.sum_congr rfl (fun w (_ : w ∈ univ) ↦ hcross z w) calc M.factor i (update (update x j xj) i z) = M.factor i (update (update x j xj) i z) * 1 := by ring _ = M.factor i (update (update x j xj) i z) * ∑ w : X i, M.factor i (update x i w) := by rw [M.factor_normalized] _ = ∑ w : X i, M.factor i (update (update x j xj) i z) * M.factor i (update x i w) := Finset.mul_sum _ _ _ _ = ∑ w : X i, M.factor i (update x i z) * M.factor i (update (update x j xj) i w) := hs _ = M.factor i (update x i z) * ∑ w : X i, M.factor i (update (update x j xj) i w) := (Finset.mul_sum _ _ _).symm _ = M.factor i (update x i z) := by rw [M.factor_normalized] ring have hz := hsum (x i) have hcoord : update x j xj i = x i := Function.update_of_ne hij xj x have hidem : update (update x j xj) i (x i) = update x j xj := by rw [← hcoord, Function.update_eq_self] simpa [hidem] using hz
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.factorIndependent_iff_localContrast_zero · Causalean/Graph/Density/FiniteDAG/Positive/Finite.lean:575
Edge 2 core · 11 supporting For uniformly positive continuous finite-DAG densities on compact coordinates, this module characterizes a redundant edge: conditional independence given the other parents is exactly pointwise independence of the child's ★ edge_condIndep_iff_factorIndependent

Edge minimality on compact coordinates

For uniformly positive continuous finite-DAG densities on compact coordinates, this module characterizes a redundant edge: conditional independence given the other parents is exactly pointwise independence of the child's local factor, equivalently vanishing of its four-point contrast.

def localContrast reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

The real four-point cross-product contrast of a child's local density varies its own coordinate and one other coordinate while holding all remaining coordinates fixed. The other coordinate is arbitrary here; the edge characterization applies it to a parent of the child, and if it equals the child's own coordinate the contrast is identically zero.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
i j :
V
x :
∀ k, X k
xi xi' :
X i
xj xj' :
X j
localContrast M i j x xi xi' xj xj' :
ℝ
PositiveFactor.localContrast M.factorAccessor i j x xi xi' xj xj'
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.localContrast · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:107 · uses DAG , UniformlyPositiveContinuousFactorization
theorem edge_condIndep_iff_factorIndependent reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

A uniformly positive continuous factorization on compact coordinates and directed edge satisfy the edge conditional-independence characterization: the endpoints are conditionally independent given the child's other parents exactly when changing the parent coordinate leaves the child's local factor unchanged.

Formal statement
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
i j :
V
hji :
G.edge j i
M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ M.FactorIndependentOf i j
Proof (Lean source)
theorem edge_condIndep_iff_factorIndependent {i j : V} (hji : G.edge j i) : M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ M.FactorIndependentOf i j := by exact (M.edge_condIndep_iff_aeFactorIndependent hji).trans M.aeFactorIndependent_iff_factorIndependent
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.edge_condIndep_iff_factorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:570 · uses DAG , parents , UniformlyPositiveContinuousFactorization , CondIndepCoordinates , FactorIndependentOf
11 supporting declarations (lemmas, instances)
  • aeFactorIndependent_of_edge_condIndep theorem — For an edge j → i, conditional independence of the endpoints given the other parents forces reference-almost-everywhere independence of the child's local factor from j.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.CondIndepCoordinates i j ((G.parents i).erase j)
    M.AEFactorIndependentOf i j
    Proof (Lean source)
    theorem aeFactorIndependent_of_edge_condIndep {i j : V} (hji : G.edge j i) : M.CondIndepCoordinates i j ((G.parents i).erase j) → M.AEFactorIndependentOf i j := by /- Use `lintegral_node_given_parents` with bounded indicator tests to identify the conditional law of `i` given all parents. Conditional independence drops `j` from that law. Strict positivity makes the observational law equivalent to the product reference law, after which uniqueness of Radon–Nikodym densities gives the iterated-a.e. update identity. Useful library bridges are `condIndepFun_iff_condDistrib_prod_ae_eq_prodMkRight` (after `CondIndepFun.symm`) for dropping `j` from the conditional kernel, and `MeasureTheory.withDensity_ae_eq` (or `withDensity_absolutelyContinuous'`) for transferring the resulting observational-a.e. statement to `Measure.pi μ`. -/ intro hCI classical let C := (G.parents i).erase j let P := G.parents i let Y : (∀ k, X k) → X i := fun x ↦ x i let J : (∀ k, X k) → X j := fun x ↦ x j let K := coordinateProjection (X := X) C let R := coordinateProjection (X := X) P let e := parentSplitEquiv (X := X) hji have he : e ∘ R = fun x ↦ (K x, J x) := by funext x change e (R x) = (K x, J x) rw [show e (R x) = (fun k : (G.parents i).erase j ↦ R x ⟨k, mem_of_mem_erase k.property⟩, R x ⟨j, G.mem_parents.mpr hji⟩) by exact parentSplitEquiv_apply (X := X) hji (R x)] rfl have hdrop : condDistrib Y (fun x ↦ (K x, J x)) M.observationalMeasure =ᵐ[Measure.map (fun x ↦ (K x, J x)) M.observationalMeasure] (condDistrib Y K M.observationalMeasure).prodMkRight _ := by apply (condIndepFun_iff_condDistrib_prod_ae_eq_prodMkRight (f := Y) (g := J) (k := K) (by fun_prop) (by fun_prop) (by fun_prop)).mp simpa [CondIndepCoordinates, Y, J, K, C] using hCI.symm have hreparam := condDistrib_comp_right_measurableEquiv M.observationalMeasure e (Y := Y) (X := R) (by fun_prop) (by fun_prop) have hparent := M.condDistrib_child_given_parents i change condDistrib Y R M.observationalMeasure =ᵐ[Measure.map R M.observationalMeasure] _ at hparent have hmap : Measure.map e (Measure.map R M.observationalMeasure) = Measure.map (fun x ↦ (K x, J x)) M.observationalMeasure := by rw [Measure.map_map e.measurable (by fun_prop), he] have hdrop' : (fun p ↦ condDistrib Y (fun x ↦ (K x, J x)) M.observationalMeasure (e p)) =ᵐ[Measure.map R M.observationalMeasure] fun p ↦ condDistrib Y K M.observationalMeasure (e p).1 := by have h := ae_of_ae_map (μ := Measure.map R M.observationalMeasure) e.measurable.aemeasurable (by rw [hmap]; exact hdrop) filter_upwards [h] with p hp simpa using hp have hparent_drop : (fun p ↦ (Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) (fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P (Classical.choice inferInstance) p) i z))) p) =ᵐ[Measure.map R M.observationalMeasure] fun p ↦ condDistrib Y K M.observationalMeasure (e p).1 := by filter_upwards [hparent, hreparam, hdrop'] with p hp hr hd exact hp.symm.trans (hr.symm.trans hd) have hobs := ae_of_ae_map (μ := M.observationalMeasure) (show AEMeasurable R M.observationalMeasure by fun_prop) hparent_drop have hfactor_ne_zero (k : V) (x : ∀ l, X l) : M.toFactorization.factor k x ≠ 0 := by intro hk have hle := M.lower_le_factor k x rw [hk] at hle simp only [ENNReal.toReal_zero] at hle exact (not_lt_of_ge hle) M.lower_pos have hdensity_ne_zero : ∀ᵐ x ∂Measure.pi μ, M.toFactorization.observationalDensity x ≠ 0 := Filter.Eventually.of_forall fun x ↦ Finset.prod_ne_zero_iff.mpr fun k _ ↦ hfactor_ne_zero k x have hpi : (fun x ↦ (Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) (fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P (Classical.choice inferInstance) p) i z))) (R x)) =ᵐ[Measure.pi μ] fun x ↦ condDistrib Y K M.observationalMeasure (e (R x)).1 := (withDensity_ae_eq M.toFactorization.measurable_observationalDensity.aemeasurable hdensity_ne_zero).mp (by change (fun x ↦ (Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) (fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P (Classical.choice inferInstance) p) i z))) (R x)) =ᵐ[M.observationalMeasure] fun x ↦ condDistrib Y K M.observationalMeasure (e (R x)).1 exact hobs) let split := MeasurableEquiv.piEquivPiSubtypeProd X (fun k ↦ k ∈ C) let μC : Measure (∀ k : {k // k ∈ C}, X k) := @Measure.pi {k : V // k ∈ C} (fun k ↦ X k) (fintype fun k ↦ k ∈ C) (fun k ↦ inferInstance) (fun k ↦ μ k) let μD : Measure (∀ k : {k // k ∉ C}, X k) := @Measure.pi {k : V // k ∉ C} (fun k ↦ X k) (fintype fun k ↦ k ∉ C) (fun k ↦ inferInstance) (fun k ↦ μ k) have hsplit_pres : MeasurePreserving split (Measure.pi μ) (μC.prod μD) := by simpa [split, μC, μD] using measurePreserving_piEquivPiSubtypeProd μ (fun k ↦ k ∈ C) have hsplit : ∀ᵐ q ∂μC.prod μD, (Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) (fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P (Classical.choice inferInstance) p) i z))) (R (split.symm q)) = condDistrib Y K M.observationalMeasure q.1 := by have hs := ae_of_ae_map (μ := μC.prod μD) split.symm.measurable.aemeasurable (by rw [(MeasurePreserving.symm split hsplit_pres).map_eq] exact hpi) filter_upwards [hs] with q hq rw [hq] congr 1 change ((e ∘ R) (split.symm q)).1 = q.1 rw [he] change K (split.symm q) = q.1 funext k simp [K, coordinateProjection, split] have hsplit_nested := Measure.ae_ae_of_ae_prod hsplit let x₀ : ∀ k, X k := Classical.choice inferInstance let d : (∀ k : P, X k) → X i → ℝ≥0∞ := fun p z ↦ M.toFactorization.factor i (update (coordinateExtension P x₀ p) i z) have hd : Measurable (uncurry d) := by unfold d exact (M.toFactorization.measurable_factor i).comp (measurable_update'.comp (((measurable_coordinateExtension P x₀).comp measurable_fst).prodMk measurable_snd)) let κ : Kernel (∀ k : P, X k) (X i) := Kernel.withDensity (Kernel.const (∀ k : P, X k) (μ i)) d have hκ_apply (p : ∀ k : P, X k) : κ p = (μ i).withDensity (d p) := by dsimp [κ] rw [Kernel.withDensity_apply _ hd, Kernel.const_apply] have hd_eq (x : ∀ k, X k) (z : X i) : d (R x) z = M.toFactorization.factor i (update x i z) := by unfold d apply M.toFactorization.local_factor i intro k hk rcases Finset.mem_insert.mp hk with rfl | hk · simp · have hki : k ≠ i := by intro hki subst k exact G.irrefl i (G.mem_parents.mp hk) have hkP : k ∈ P := by simpa [P] using hk simp [R, coordinateProjection, coordinateExtension, hkP, hki] have hsection_ae : ∀ᵐ c ∂μC, ∀ᵐ r₁ ∂μD, ∀ᵐ r₂ ∂μD, ∀ᵐ z ∂μ i, M.toFactorization.factor i (update (split.symm (c, r₁)) i z) = M.toFactorization.factor i (update (split.symm (c, r₂)) i z) := by filter_upwards [hsplit_nested] with c hc filter_upwards [hc] with r₁ hr₁ filter_upwards [hc] with r₂ hr₂ have hκ : κ (R (split.symm (c, r₁))) = κ (R (split.symm (c, r₂))) := by exact hr₁.trans hr₂.symm have hden : d (R (split.symm (c, r₁))) =ᵐ[μ i] d (R (split.symm (c, r₂))) := (withDensity_eq_iff_of_sigmaFinite (Measurable.of_uncurry_left hd (x := R (split.symm (c, r₁)))).aemeasurable (Measurable.of_uncurry_left hd (x := R (split.symm (c, r₂)))).aemeasurable).mp (by rw [← hκ_apply, ← hκ_apply] exact hκ) filter_upwards [hden] with z hz simpa only [hd_eq] using hz let f : ((∀ k : {k // k ∈ C}, X k) × ((∀ k : {k // k ∉ C}, X k) × ((∀ k : {k // k ∉ C}, X k) × X i))) → ℝ := fun q ↦ (M.toFactorization.factor i (update (split.symm (q.1, q.2.1)) i q.2.2.2)).toReal let g : ((∀ k : {k // k ∈ C}, X k) × ((∀ k : {k // k ∉ C}, X k) × ((∀ k : {k // k ∉ C}, X k) × X i))) → ℝ := fun q ↦ (M.toFactorization.factor i (update (split.symm (q.1, q.2.2.1)) i q.2.2.2)).toReal have hsplit_cont : Continuous split.symm := by change Continuous (Homeomorph.piEquivPiSubtypeProd (fun k ↦ k ∈ C) X).symm exact (Homeomorph.piEquivPiSubtypeProd (fun k ↦ k ∈ C) X).symm.continuous have hf : Continuous f := by unfold f exact (M.factor_continuous i).comp ((hsplit_cont.comp (continuous_fst.prodMk continuous_snd.fst)).update i continuous_snd.snd.snd) have hg : Continuous g := by unfold g exact (M.factor_continuous i).comp ((hsplit_cont.comp (continuous_fst.prodMk continuous_snd.snd.fst)).update i continuous_snd.snd.snd) have hfm : Measurable f := by unfold f exact ((M.toFactorization.measurable_factor i).comp (measurable_update'.comp ((split.symm.measurable.comp (measurable_fst.prodMk measurable_snd.fst)).prodMk measurable_snd.snd.snd))).ennreal_toReal have hgm : Measurable g := by unfold g exact ((M.toFactorization.measurable_factor i).comp (measurable_update'.comp ((split.symm.measurable.comp (measurable_fst.prodMk measurable_snd.snd.fst)).prodMk measurable_snd.snd.snd))).ennreal_toReal have hfg_ae : f =ᵐ[μC.prod (μD.prod (μD.prod (μ i)))] g := by apply (Measure.ae_prod_iff_ae_ae (measurableSet_eq_fun hfm hgm)).2 filter_upwards [hsection_ae] with c hc have hfm_c : Measurable (fun y ↦ f (c, y)) := hfm.comp (measurable_const.prodMk measurable_id) have hgm_c : Measurable (fun y ↦ g (c, y)) := hgm.comp (measurable_const.prodMk measurable_id) apply (Measure.ae_prod_iff_ae_ae (measurableSet_eq_fun hfm_c hgm_c)).2 filter_upwards [hc] with r₁ hr₁ have hfm_cr₁ : Measurable (fun y ↦ f (c, r₁, y)) := hfm.comp (measurable_const.prodMk (measurable_const.prodMk measurable_id)) have hgm_cr₁ : Measurable (fun y ↦ g (c, r₁, y)) := hgm.comp (measurable_const.prodMk (measurable_const.prodMk measurable_id)) apply (Measure.ae_prod_iff_ae_ae (measurableSet_eq_fun hfm_cr₁ hgm_cr₁)).2 filter_upwards [hr₁] with r₂ hr₂ filter_upwards [hr₂] with z hz exact congrArg ENNReal.toReal hz have hfg : f = g := (hf.ae_eq_iff_eq (μC.prod (μD.prod (μD.prod (μ i)))) hg).mp hfg_ae have hsections (c : ∀ k : {k // k ∈ C}, X k) (r₁ r₂ : ∀ k : {k // k ∉ C}, X k) (z : X i) : M.toFactorization.factor i (update (split.symm (c, r₁)) i z) = M.toFactorization.factor i (update (split.symm (c, r₂)) i z) := by apply (ENNReal.toReal_eq_toReal_iff' (M.factor_ne_top i (update (split.symm (c, r₁)) i z)) (M.factor_ne_top i (update (split.symm (c, r₂)) i z))).mp exact congrFun hfg (c, r₁, r₂, z) -- … truncated; follow the source link for the rest …
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.aeFactorIndependent_of_edge_condIndep · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:116
  • aeFactorIndependent_of_factorIndependent theorem — Pointwise independence of a local factor from one coordinate implies the corresponding iterated product-reference almost-everywhere update identity.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    M.FactorIndependentOf i j
    M.AEFactorIndependentOf i j
    Proof (Lean source)
    theorem aeFactorIndependent_of_factorIndependent {i j : V} : M.FactorIndependentOf i j → M.AEFactorIndependentOf i j := by intro h exact Filter.Eventually.of_forall fun x ↦ Filter.Eventually.of_forall fun xj ↦ by apply (ENNReal.toReal_eq_toReal_iff' (M.factor_ne_top i (update x j xj)) (M.factor_ne_top i x)).mp exact h x xj
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.aeFactorIndependent_of_factorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:394
  • factorIndependent_of_aeFactorIndependent theorem — Continuity and full support upgrade the iterated product-reference almost-everywhere update identity for a local factor to pointwise independence on the whole compact product domain.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    M.AEFactorIndependentOf i j
    M.FactorIndependentOf i j
    Proof (Lean source)
    theorem factorIndependent_of_aeFactorIndependent {i j : V} : M.AEFactorIndependentOf i j → M.FactorIndependentOf i j := by /- Regard the two sides as continuous real functions on `(∀ k, X k) × X j`. Convert the iterated a.e. hypothesis to product-measure a.e. equality, apply full-support extensionality, and use `factor_ne_top` to reflect equality through `ENNReal.toReal`. -/ intro h let f : ((∀ k, X k) × X j) → ℝ := fun z ↦ (M.toFactorization.factor i (update z.1 j z.2)).toReal let g : ((∀ k, X k) × X j) → ℝ := fun z ↦ (M.toFactorization.factor i z.1).toReal have hf : Continuous f := (M.factor_continuous i).comp (continuous_fst.update j continuous_snd) have hg : Continuous g := (M.factor_continuous i).comp continuous_fst have hae : f =ᵐ[(Measure.pi μ).prod (μ j)] g := by have hfm : Measurable f := ((M.toFactorization.measurable_factor i).comp measurable_update').ennreal_toReal have hgm : Measurable g := ((M.toFactorization.measurable_factor i).comp measurable_fst).ennreal_toReal apply (Measure.ae_prod_iff_ae_ae (measurableSet_eq_fun hfm hgm)).2 filter_upwards [h] with x hx filter_upwards [hx] with xj hxj exact congrArg ENNReal.toReal hxj have hfg : f = g := (hf.ae_eq_iff_eq ((Measure.pi μ).prod (μ j)) hg).mp hae intro x xj exact congrFun hfg (x, xj)
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.factorIndependent_of_aeFactorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:405
  • aeFactorIndependent_iff_factorIndependent theorem — Continuity and full support upgrade almost-everywhere independence of a local density factor from one coordinate to pointwise independence on the entire compact product domain.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    M.AEFactorIndependentOf i j ↔ M.FactorIndependentOf i j
    Proof (Lean source)
    theorem aeFactorIndependent_iff_factorIndependent {i j : V} : M.AEFactorIndependentOf i j ↔ M.FactorIndependentOf i j := by exact ⟨M.factorIndependent_of_aeFactorIndependent, M.aeFactorIndependent_of_factorIndependent⟩
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.aeFactorIndependent_iff_factorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:434
  • edge_condIndep_of_factorIndependent theorem — For an edge j → i, pointwise independence of the child's local factor from j implies conditional independence of the endpoints given the other parents.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.FactorIndependentOf i j
    M.CondIndepCoordinates i j ((G.parents i).erase j)
    Proof (Lean source)
    theorem edge_condIndep_of_factorIndependent {i j : V} (hji : G.edge j i) : M.FactorIndependentOf i j → M.CondIndepCoordinates i j ((G.parents i).erase j) := by /- Delete the single edge `j → i`, reuse the same normalized factors as a factorization of the resulting sub-DAG (the new locality obligation is exactly factor independence), and apply the ordered local-Markov theorem in that sub-DAG. Its parent set at `i` is `(G.parents i).erase j`; contract the predecessor residual to coordinate `j`. -/ intro hind classical let H : DAG V := { edge := fun u v ↦ G.edge u v ∧ ¬ (u = j ∧ v = i) decEdge := inferInstance acyclic := by intro v hv exact G.acyclic v ((Relation.TransGen.mono (r := fun u v ↦ G.edge u v ∧ ¬ (u = j ∧ v = i)) (p := G.edge) (fun _ _ h ↦ h.1)) v v hv) } let B : Factorization H X μ := { factor := M.toFactorization.factor measurable_factor := M.toFactorization.measurable_factor normalized_factor := M.toFactorization.normalized_factor local_factor := by intro k x y hxy by_cases hki : k = i · have hxyi : ∀ l, l ∈ insert i (H.parents i) → x l = y l := by intro l hl apply hxy l have hl' : l ∈ (↑(insert i (H.parents i)) : Set V) := hl simpa only [hki] using hl' have hi : M.toFactorization.factor i x = M.toFactorization.factor i y := by calc M.toFactorization.factor i x = M.toFactorization.factor i (update x j (y j)) := (ENNReal.toReal_eq_toReal_iff' (M.factor_ne_top i x) (M.factor_ne_top i (update x j (y j)))).mp (hind x (y j)).symm _ = M.toFactorization.factor i y := by apply M.toFactorization.local_factor i intro l hl rcases Finset.mem_insert.mp hl with hli | hl · have hlj : l ≠ j := by intro h have hij : i ≠ j := fun hij ↦ G.irrefl i (hij ▸ hji) exact hij (hli.symm.trans h) rw [Function.update_of_ne hlj] exact hxyi l (Finset.mem_insert.mpr (inl hli)) · by_cases hlj : l = j · subst l simp · rw [Function.update_of_ne hlj] apply hxyi l apply Finset.mem_insert_of_mem rw [H.mem_parents] exact ⟨G.mem_parents.mp hl, fun h ↦ hlj h.1⟩ simpa only [hki] using hi · apply M.toFactorization.local_factor k intro l hl apply hxy l rcases Finset.mem_insert.mp hl with hl | hl · exact Finset.mem_insert.mpr (inl hl) · apply Finset.mem_insert_of_mem rw [H.mem_parents] refine ⟨G.mem_parents.mp hl, ?_⟩ rintro ⟨rfl, rfl⟩ exact hki rfl } let τG := canonicalTopologicalRanking G let τ : TopologicalRanking H := { rank := τG.rank injective_rank := τG.injective_rank edge_lt := fun h ↦ τG.edge_lt h.1 } let C := (G.parents i).erase j have hparents : H.parents i = C := by ext k simp only [H.mem_parents, C, G.mem_parents, Finset.mem_erase] constructor · rintro ⟨hk, hdel⟩ exact ⟨fun hkj ↦ hdel ⟨hkj, rfl⟩, hk⟩ · rintro ⟨hkj, hk⟩ exact ⟨hk, fun h ↦ hkj h.1⟩ have hCpred : C ⊆ predecessors τ i := by intro k hk rw [predecessors, mem_filter] exact ⟨Finset.mem_univ k, τG.edge_lt (G.mem_parents.mp (mem_of_mem_erase hk))⟩ have hmarkov := B.orderedLocalMarkov τ i C hCpred (by simpa [hparents]) have hjpred : j ∈ predecessors τ i := by rw [predecessors, mem_filter] exact ⟨Finset.mem_univ j, τG.edge_lt hji⟩ have hjC : j ∉ C := by simp [C] let e : (∀ k : ↑(predecessors τ i \ C), X k) → X j := fun z ↦ z ⟨j, Finset.mem_sdiff.mpr ⟨hjpred, hjC⟩⟩ have hcomp := hmarkov.comp measurable_id (measurable_pi_apply (⟨j, Finset.mem_sdiff.mpr ⟨hjpred, hjC⟩⟩ : ↑(predecessors τ i \ C))) have heval : e ∘ coordinateProjection (X := X) (predecessors τ i \ C) = fun x : ∀ k, X k ↦ x j := by funext x rfl rw [heval] at hcomp change CondIndepFun (comap (coordinateProjection (X := X) C) inferInstance) (coordinateConditioning_comap_le (X := X) C) (fun x : ∀ k, X k ↦ x i) (fun x : ∀ k, X k ↦ x j) M.observationalMeasure simp only [Function.id_comp] at hcomp have hmeasure : B.observationalMeasure = M.observationalMeasure := by rfl cases hmeasure exact hcomp
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.edge_condIndep_of_factorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:441
  • edge_condIndep_of_aeFactorIndependent theorem — For an edge j → i, reference-almost-everywhere independence of the child's local factor from j implies conditional independence of the endpoints given the other parents.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.AEFactorIndependentOf i j
    M.CondIndepCoordinates i j ((G.parents i).erase j)
    Proof (Lean source)
    theorem edge_condIndep_of_aeFactorIndependent {i j : V} (hji : G.edge j i) : M.AEFactorIndependentOf i j → M.CondIndepCoordinates i j ((G.parents i).erase j) := by intro h exact M.edge_condIndep_of_factorIndependent hji (M.factorIndependent_of_aeFactorIndependent h)
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.edge_condIndep_of_aeFactorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:552
  • edge_condIndep_iff_aeFactorIndependent theorem — For an edge j → i in a uniformly positive continuous DAG density on compact coordinates, conditional independence of i and j given the other parents is equivalent to reference-almost-everywhere independence of the child's local factor from j.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ M.AEFactorIndependentOf i j
    Proof (Lean source)
    theorem edge_condIndep_iff_aeFactorIndependent {i j : V} (hji : G.edge j i) : M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ M.AEFactorIndependentOf i j := by exact ⟨M.aeFactorIndependent_of_edge_condIndep hji, M.edge_condIndep_of_aeFactorIndependent hji⟩
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.edge_condIndep_iff_aeFactorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:561
  • localContrast_zero_of_factorIndependent theorem — Pointwise independence of a child's factor from a parent coordinate forces every associated four-point local cross-product contrast to vanish.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.FactorIndependentOf i j
    x :
    ∀ k, X k
    xi xi' :
    X i
    xj xj' :
    X j
    M.localContrast i j x xi xi' xj xj' = 0
    Proof (Lean source)
    theorem localContrast_zero_of_factorIndependent {i j : V} (hji : G.edge j i) : M.FactorIndependentOf i j → ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0 := by /- Rewrite all four factor values to a fixed value of coordinate `j`; `hji` supplies `i ≠ j` so the own-coordinate update is not disturbed. -/ intro h x xi xi' xj xj' have hij : i ≠ j := by intro hij subst j exact G.irrefl i hji have hsection (z : X i) (w : X j) : (M.toFactorization.factor i (update (update x j w) i z)).toReal = (M.toFactorization.factor i (update x i z)).toReal := by rw [← Function.update_comm hij] exact h (update x i z) w unfold localContrast PositiveFactor.localContrast factorAccessor simp_rw [Function.update_comm hij] rw [hsection xi xj, hsection xi' xj', hsection xi xj', hsection xi' xj] ring
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.localContrast_zero_of_factorIndependent · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:579
  • factorIndependent_of_localContrast_zero theorem — If every four-point local cross-product contrast for an edge vanishes, normalization and strict positivity force the child's factor to be independent of that parent coordinate.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    (∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0)
    M.FactorIndependentOf i j
    Proof (Lean source)
    theorem factorIndependent_of_localContrast_zero {i j : V} (hji : G.edge j i) : (∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0) → M.FactorIndependentOf i j := by /- Fix the base assignment and the new `j` value. The contrast equations say the two positive own-coordinate density sections are proportional. Integrate the equations in the second own-coordinate variable and use `normalized_factor` twice; the proportionality constant is one. Finiteness reflects the real calculation back to `ENNReal`. -/ intro h x xj have hij : i ≠ j := by intro hij subst j exact G.irrefl i hji let a : X i → ℝ≥0∞ := fun z ↦ M.toFactorization.factor i (update (update x j xj) i z) let b : X i → ℝ≥0∞ := fun z ↦ M.toFactorization.factor i (update x i z) have ha_meas : Measurable a := (M.toFactorization.measurable_factor i).comp (measurable_update (update x j xj)) have hb_meas : Measurable b := (M.toFactorization.measurable_factor i).comp (measurable_update x) have hab (z w : X i) : a z * b w = b z * a w := by apply (ENNReal.toReal_eq_toReal_iff' (ENNReal.mul_ne_top (M.factor_ne_top i (update (update x j xj) i z)) (M.factor_ne_top i (update x i w))) (ENNReal.mul_ne_top (M.factor_ne_top i (update x i z)) (M.factor_ne_top i (update (update x j xj) i w)))).mp rw [ENNReal.toReal_mul, ENNReal.toReal_mul] apply sub_eq_zero.mp simpa [localContrast, PositiveFactor.localContrast, factorAccessor, a, b, Function.update_comm hij] using h x z w xj (x j) have ha_norm : ∫⁻ z, a z ∂μ i = 1 := by exact M.toFactorization.normalized_factor i (update x j xj) have hb_norm : ∫⁻ z, b z ∂μ i = 1 := by exact M.toFactorization.normalized_factor i x have hab_eq (z : X i) : a z = b z := by have hint : a z * (∫⁻ w, b w ∂μ i) = b z * (∫⁻ w, a w ∂μ i) := by calc a z * (∫⁻ w, b w ∂μ i) = ∫⁻ w, a z * b w ∂μ i := by exact (lintegral_const_mul (a z) hb_meas).symm _ = ∫⁻ w, b z * a w ∂μ i := lintegral_congr (hab z) _ = b z * (∫⁻ w, a w ∂μ i) := by exact lintegral_const_mul (b z) ha_meas simpa [ha_norm, hb_norm] using hint have hz := hab_eq (x i) change M.toFactorization.factor i (update (update x j xj) i (x i)) = M.toFactorization.factor i (update x i (x i)) at hz rw [Function.update_eq_self] at hz have hcoord : update x j xj i = x i := Function.update_of_ne hij _ _ rw [← hcoord, Function.update_eq_self] at hz exact congrArg toReal hz
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.factorIndependent_of_localContrast_zero · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:603
  • factorIndependent_iff_localContrast_zero theorem — For an edge j → i, pointwise independence of the child's factor from j is equivalent to vanishing of all its local four-point cross-product contrasts.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.FactorIndependentOf i j
    ↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0
    Proof (Lean source)
    theorem factorIndependent_iff_localContrast_zero {i j : V} (hji : G.edge j i) : M.FactorIndependentOf i j ↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0 := by exact ⟨M.localContrast_zero_of_factorIndependent hji, M.factorIndependent_of_localContrast_zero hji⟩
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.factorIndependent_iff_localContrast_zero · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:663
  • edge_condIndep_iff_localContrast_zero theorem — For an edge j → i, conditional independence given the other parents is equivalent to vanishing of every local factor cross-product contrast.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    M.CondIndepCoordinates i j ((G.parents i).erase j)
    ↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0
    Proof (Lean source)
    theorem edge_condIndep_iff_localContrast_zero {i j : V} (hji : G.edge j i) : M.CondIndepCoordinates i j ((G.parents i).erase j) ↔ ∀ (x : ∀ k, X k) (xi xi' : X i) (xj xj' : X j), M.localContrast i j x xi xi' xj xj' = 0 := by exact (M.edge_condIndep_iff_factorIndependent hji).trans (M.factorIndependent_iff_localContrast_zero hji)
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.edge_condIndep_iff_localContrast_zero · Causalean/Graph/Density/FiniteDAG/Positive/Edge.lean:672
Examples 2 core · 0 supporting This module exercises the two reusable APIs on a binary two-node DAG and on the scalar pair q(x) = exp(x), p(x) = 1 over the unit interval.

Examples for positive-mechanism stratum openness

This module exercises the two reusable APIs on a binary two-node DAG and on the scalar pair q(x) = exp(x), p(x) = 1 over the unit interval.

def binaryEdgeDAG reviewed
Causalean.Graph.FiniteDensity

The two-node DAG has the single directed edge 0 → 1.

Definition (Lean source)
binaryEdgeDAG :
DAG (Fin 2)
clause 1
edge i j := i = 0 ∧ j = 1
clause 2
decEdge := inferInstance
clause 3
acyclic := by apply DAG.acyclic_of_topoOrder (r := (· < ·)) (τ := fun i : Fin 2 ↦ i.val) rintro u v ⟨rfl, rfl⟩ norm_num
Causalean.Graph.FiniteDensity.binaryEdgeDAG · Causalean/Graph/Density/FiniteDAG/Positive/Examples.lean:23 · uses DAG
def binaryMechanism reviewed
Causalean.Graph.FiniteDensity

The binary example has a fair root and a child which matches its parent with probability three quarters.

Definition (Lean source)
binaryMechanism :
clause 1
factor i x := if i
= 0 then (1 / 2 : ℝ) else if x 1 = x 0 then (3 / 4 : ℝ) else (1 / 4 : ℝ)
clause 2
factor_pos := by intro i x split_ifs <;> norm_num
clause 3
factor_normalized := by intro i x fin_cases i · simp · cases h : x 0 <;> simp [h] <;> norm_num
clause 4
factor_local := by intro i x y hxy fin_cases i · simp · have h0 : x 0
= y 0 := hxy 0 (by simp [binaryEdgeDAG, DAG.mem_parents]) have h1 : x 1 = y 1 := hxy 1 (by simp) simp [h0, h1]
Finite­Witness 3 core · 2 supporting This module packages nonzero finite-state local contrasts and proves that their nonvanishing, and therefore edgewise conditional dependence, persists throughout one uniform factor neighborhood. ★ all_edge_witnesses_open

Stable finite-state DAG edge witnesses

This module packages nonzero finite-state local contrasts and proves that their nonvanishing, and therefore edgewise conditional dependence, persists throughout one uniform factor neighborhood.

abbrev EdgeWitness reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

A local edge witness records four coordinate values at which the child's cross-product contrast is nonzero.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
i j :
V
EdgeWitness M i j :
Type (max uV uX)
PositiveFactor.EdgeWitness M.factorAccessor i j
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.EdgeWitness · Causalean/Graph/Density/FiniteDAG/Positive/FiniteWitness.lean:33 · uses DAG , PositiveFiniteDAGMechanism
def FactorSupClose reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

Two finite DAG mechanisms are uniformly factor-close when every local factor differs by less than the prescribed radius at every full assignment.

Definition (Lean source)
V :
Type uV
V → Type uX
DAG V
shared
ε :
ℝ
FactorSupClose M N ε :
Prop
PositiveFactor.FactorSupClose M.factorAccessor N.factorAccessor ε
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.FactorSupClose · Causalean/Graph/Density/FiniteDAG/Positive/FiniteWitness.lean:46 · uses DAG , PositiveFiniteDAGMechanism
theorem all_edge_witnesses_open reviewed
Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism

A positive finite-state DAG mechanism with a nonzero local-contrast witness for each directed edge has one positive uniform factor neighborhood in which every parent and child remain conditionally dependent given the child's other parents.

Formal statement
V :
Type uV
V → Type uX
DAG V
shared
w :
∀ i j
if
G.edge j i
then
M.EdgeWitness i j
∃ ε > 0,
M.FactorSupClose N ε → ∀ i j (hji : G.edge j i), ¬ N.CondIndepCoordinates i j ((G.parents i).erase j)
Proof (Lean source)
theorem all_edge_witnesses_open (w : ∀ i j, G.edge j i → M.EdgeWitness i j) : ∃ ε > 0, ∀ N : PositiveFiniteDAGMechanism G X, M.FactorSupClose N ε → ∀ i j (hji : G.edge j i), ¬ N.CondIndepCoordinates i j ((G.parents i).erase j) := by classical cases isEmpty_or_nonempty V with | inl hV => letI := hV refine ⟨1, zero_lt_one, ?_⟩ intro N hclose i exact isEmptyElim i | inr hV => letI := hV let radius : V × V → ℝ := fun p ↦ if hp : G.edge p.2 p.1 then choose (EdgeWitness.eventually_nonzero M (w p.1 p.2 hp)) else 1 have hradius_pos (p : V × V) : 0 < radius p := by by_cases hp : G.edge p.2 p.1 · simp only [radius, dif_pos hp] exact (Classical.choose_spec (EdgeWitness.eventually_nonzero M (w p.1 p.2 hp))).1 · simp [radius, hp] have hradius_spec (i j : V) (hji : G.edge j i) : ∀ N : PositiveFiniteDAGMechanism G X, M.FactorSupClose N (radius (i, j)) → N.localContrast i j (w i j hji).base (w i j hji).child₀ (w i j hji).child₁ (w i j hji).parent₀ (w i j hji).parent₁ ≠ 0 := by simp only [radius, dif_pos hji] exact (Classical.choose_spec (EdgeWitness.eventually_nonzero M (w i j hji))).2 let ε := Finset.univ.inf' Finset.univ_nonempty radius have hε : 0 < ε := by exact (Finset.lt_inf'_iff Finset.univ_nonempty).2 fun p _ ↦ hradius_pos p refine ⟨ε, hε, ?_⟩ intro N hclose i j hji let wN : N.EdgeWitness i j := { base := (w i j hji).base child₀ := (w i j hji).child₀ child₁ := (w i j hji).child₁ parent₀ := (w i j hji).parent₀ parent₁ := (w i j hji).parent₁ nonzero := hradius_spec i j hji N (fun k x ↦ (hclose k x).trans_le (Finset.inf'_le radius (Finset.mem_univ (i, j)))) } exact EdgeWitness.not_condIndep N hji wN
2 supporting declarations (lemmas, instances)
  • not_condIndep theorem — A nonzero local factor contrast on an edge proves failure of conditional independence of the edge endpoints given the child's other parents.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    w :
    M.EdgeWitness i j
    ¬ M.CondIndepCoordinates i j ((G.parents i).erase j)
    Proof (Lean source)
    theorem EdgeWitness.not_condIndep {i j : V} (hji : G.edge j i) (w : M.EdgeWitness i j) : ¬ M.CondIndepCoordinates i j ((G.parents i).erase j) := by intro hCI exact w.nonzero ((M.edge_condIndep_iff_localContrast_zero hji).mp hCI w.base w.child₀ w.child₁ w.parent₀ w.parent₁)
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.EdgeWitness.not_condIndep · Causalean/Graph/Density/FiniteDAG/Positive/FiniteWitness.lean:37
  • eventually_nonzero theorem — A fixed nonzero local contrast remains nonzero for every sufficiently small uniform perturbation of all local factors.
    V :
    Type uV
    V → Type uX
    DAG V
    shared
    i j :
    V
    w :
    M.EdgeWitness i j
    ∃ ε > 0,
    M.FactorSupClose N ε → N.localContrast i j w.base w.child₀ w.child₁ w.parent₀ w.parent₁
    ≠ 0
    Proof (Lean source)
    theorem EdgeWitness.eventually_nonzero {i j : V} (w : M.EdgeWitness i j) : ∃ ε > 0, ∀ N : PositiveFiniteDAGMechanism G X, M.FactorSupClose N ε → N.localContrast i j w.base w.child₀ w.child₁ w.parent₀ w.parent₁ ≠ 0 := by rcases PositiveFactor.EdgeWitness.eventually_nonzero M.factorAccessor w with ⟨ε, hε, hopen⟩ refine ⟨ε, hε, ?_⟩ intro N hclose exact hopen N.factorAccessor hclose
    Causalean.Graph.FiniteDensity.PositiveFiniteDAGMechanism.EdgeWitness.eventually_nonzero · Causalean/Graph/Density/FiniteDAG/Positive/FiniteWitness.lean:51
Witness 3 core · 2 supporting For uniformly positive continuous DAG densities on compact coordinates, this module packages nonzero four-point local-factor contrasts as witnesses that an edge is not conditionally independent given the other parents. ★ all_edge_witnesses_open

Stable contrast witnesses on compact coordinates

For uniformly positive continuous DAG densities on compact coordinates, this module packages nonzero four-point local-factor contrasts as witnesses that an edge is not conditionally independent given the other parents. It also proves that finitely many such witnesses persist under one uniform factor neighborhood.

abbrev EdgeWitness reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

A compact-density edge witness records four domain points at which the child's local cross-product contrast is nonzero.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
i j :
V
EdgeWitness M i j :
Type (max uV uX)
PositiveFactor.EdgeWitness M.factorAccessor i j
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.EdgeWitness · Causalean/Graph/Density/FiniteDAG/Positive/Witness.lean:38 · uses DAG , UniformlyPositiveContinuousFactorization
def FactorSupClose reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

Two compact positive mechanisms are uniformly close when the real values of all local density factors differ by less than one common radius over every node and domain point.

Definition (Lean source)
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
ε :
ℝ
FactorSupClose M N ε :
Prop
PositiveFactor.FactorSupClose M.factorAccessor N.factorAccessor ε
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.FactorSupClose · Causalean/Graph/Density/FiniteDAG/Positive/Witness.lean:51 · uses DAG , UniformlyPositiveContinuousFactorization
theorem all_edge_witnesses_open reviewed
Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization

A uniformly positive continuous factorization on compact coordinates with a nonzero local-contrast witness for each directed edge has a common stability neighborhood in which every edge remains conditionally dependent given its other parents.

Formal statement
V :
Type uV
V → Type uX
(i : V) → Measure (X i)
DAG V
shared
w :
∀ i j
if
G.edge j i
then
M.EdgeWitness i j
∃ ε > 0,
M.FactorSupClose N ε → ∀ i j (hji : G.edge j i), ¬ N.CondIndepCoordinates i j ((G.parents i).erase j)
Proof (Lean source)
theorem all_edge_witnesses_open (w : ∀ i j, G.edge j i → M.EdgeWitness i j) : ∃ ε > 0, ∀ N : UniformlyPositiveContinuousFactorization G X μ, M.FactorSupClose N ε → ∀ i j (hji : G.edge j i), ¬ N.CondIndepCoordinates i j ((G.parents i).erase j) := by classical cases isEmpty_or_nonempty V with | inl hV => letI := hV refine ⟨1, zero_lt_one, ?_⟩ intro N hclose i exact isEmptyElim i | inr hV => letI := hV let radius : V × V → ℝ := fun p ↦ if hp : G.edge p.2 p.1 then choose (EdgeWitness.eventually_not_condIndep M hp (w p.1 p.2 hp)) else 1 have hradius_pos (p : V × V) : 0 < radius p := by by_cases hp : G.edge p.2 p.1 · simp only [radius, dif_pos hp] exact (Classical.choose_spec (EdgeWitness.eventually_not_condIndep M hp (w p.1 p.2 hp))).1 · simp [radius, hp] have hradius_spec (i j : V) (hji : G.edge j i) : ∀ N : UniformlyPositiveContinuousFactorization G X μ, M.FactorSupClose N (radius (i, j)) → ¬ N.CondIndepCoordinates i j ((G.parents i).erase j) := by simp only [radius, dif_pos hji] exact (Classical.choose_spec (EdgeWitness.eventually_not_condIndep M hji (w i j hji))).2 let ε := Finset.univ.inf' Finset.univ_nonempty radius have hε : 0 < ε := by exact (Finset.lt_inf'_iff Finset.univ_nonempty).2 fun p _ ↦ hradius_pos p refine ⟨ε, hε, ?_⟩ intro N hclose i j hji apply hradius_spec i j hji N intro k x exact (hclose k x).trans_le (Finset.inf'_le radius (Finset.mem_univ (i, j)))
2 supporting declarations (lemmas, instances)
  • not_condIndep theorem — A nonzero local factor contrast on an edge rules out conditional independence of the edge endpoints given the other parents.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    w :
    M.EdgeWitness i j
    ¬ M.CondIndepCoordinates i j ((G.parents i).erase j)
    Proof (Lean source)
    theorem EdgeWitness.not_condIndep {i j : V} (hji : G.edge j i) (w : M.EdgeWitness i j) : ¬ M.CondIndepCoordinates i j ((G.parents i).erase j) := by intro hCI exact w.nonzero ((M.edge_condIndep_iff_localContrast_zero hji).mp hCI w.base w.child₀ w.child₁ w.parent₀ w.parent₁)
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.EdgeWitness.not_condIndep · Causalean/Graph/Density/FiniteDAG/Positive/Witness.lean:42
  • eventually_not_condIndep theorem — A fixed nonzero compact-domain contrast remains a nonzero witness, and hence continues to rule out edge conditional independence, throughout a sufficiently small uniform neighborhood.
    V :
    Type uV
    V → Type uX
    (i : V) → Measure (X i)
    DAG V
    shared
    i j :
    V
    hji :
    G.edge j i
    w :
    M.EdgeWitness i j
    ∃ ε > 0,
    M.FactorSupClose N ε → ¬ N.CondIndepCoordinates i j ((G.parents i).erase j)
    Proof (Lean source)
    theorem EdgeWitness.eventually_not_condIndep {i j : V} (hji : G.edge j i) (w : M.EdgeWitness i j) : ∃ ε > 0, ∀ N : UniformlyPositiveContinuousFactorization G X μ, M.FactorSupClose N ε → ¬ N.CondIndepCoordinates i j ((G.parents i).erase j) := by rcases PositiveFactor.EdgeWitness.eventually_nonzero M.factorAccessor w with ⟨ε, hε, hopen⟩ refine ⟨ε, hε, ?_⟩ intro N hclose let wN : N.EdgeWitness i j := { base := w.base child₀ := w.child₀ child₁ := w.child₁ parent₀ := w.parent₀ parent₁ := w.parent₁ nonzero := hopen N.factorAccessor hclose } exact EdgeWitness.not_condIndep N hji wN
    Causalean.Graph.FiniteDensity.UniformlyPositiveContinuousFactorization.EdgeWitness.eventually_not_condIndep · Causalean/Graph/Density/FiniteDAG/Positive/Witness.lean:56