Stat.Finite­Positive­Table

This roll-up module exports graph-independent finite positive tables, their marginals and conditionals, coordinate fixing, sequential expansions, and two-row cancellation identities.

DAG 13 core · 19 supporting · 6 submodules This roll-up module exports positive finite DAG table factorizations, coordinate-fixing expansions, reverse-topological normalization, finite-atom conditional-independence bridges, and global Markov theorems for the resu
Basic 7 core · 6 supporting This module provides graph-independent profile spaces and finite-fibre summation for real tables whose coordinates can have different finite cardinalities. ★ sum_fiberSum_insert_update

Finite dependent profile spaces and fibre sums

This module provides graph-independent profile spaces and finite-fibre summation for real tables whose coordinates can have different finite cardinalities.

abbrev ProfileSpace reviewed
Causalean.Stat.FinitePositiveTable

The coordinate cardinalities determine the finite dependent profile space by assigning one bounded state to each coordinate.

Definition (Lean source)
V :
Type u
shared
r :
V → ℕ
ProfileSpace r :
Type u
∀ v, Fin (r v)
Causalean.Stat.FinitePositiveTable.ProfileSpace · Causalean/Stat/FinitePositiveTable/Basic.lean:27
def CardinalitiesPositive reviewed
Causalean.Stat.FinitePositiveTable

The coordinate cardinalities satisfy strict positivity of every cardinality when every coordinate has at least one state.

Definition (Lean source)
V :
Type u
shared
r :
V → ℕ
v :
CardinalitiesPositive r :
Prop
0 < r v
Causalean.Stat.FinitePositiveTable.CardinalitiesPositive · Causalean/Stat/FinitePositiveTable/Basic.lean:31
abbrev Kernel reviewed
Causalean.Stat.FinitePositiveTable

The coordinate cardinalities determine a real-valued kernel on complete profiles as a real-valued function on profiles.

Definition (Lean source)
V :
Type u
shared
r :
V → ℕ
Kernel r :
Type u
ProfileSpace r → ℝ
Causalean.Stat.FinitePositiveTable.Kernel · Causalean/Stat/FinitePositiveTable/Basic.lean:35
structure PositiveTable reviewed
Causalean.Stat.FinitePositiveTable

The coordinate cardinalities determine a strictly positive normalized real table: a real mass for every complete profile, with every mass strictly positive and the masses summing to one.

Definition (Lean source)
V :
Type u
shared
r :
V → ℕ
The table assigns a real mass to each complete profile.
mass :
ProfileSpace r → ℝ
Every complete profile receives strictly positive mass.
mass_pos :
∀ x, 0 < mass x
The complete-profile masses sum to one.
sum_mass_eq_one :
∑ x, mass x = 1
Causalean.Stat.FinitePositiveTable.PositiveTable · Causalean/Stat/FinitePositiveTable/Basic.lean:39
def AgreeOn reviewed
Causalean.Stat.FinitePositiveTable

The coordinate set and two complete profiles determine their agreement on that set by equality at every coordinate in the set.

Definition (Lean source)
V :
Type u
V → ℕ
shared
S :
x y :
v ∈ S :
AgreeOn S x y :
Prop
x v = y v
Causalean.Stat.FinitePositiveTable.AgreeOn · Causalean/Stat/FinitePositiveTable/Basic.lean:50 · uses ProfileSpace
def fiberSum reviewed
Causalean.Stat.FinitePositiveTable

The profile function, fixed coordinate set, and reference profile determine the sum over compatible complete profiles by retaining exactly the profiles that agree with the reference on the fixed set.

Definition (Lean source)
V :
Type u
V → ℕ
shared
M :
Type uM
f :
ProfileSpace r → M
S :
x :
fiberSum f S x :
M
by classical exact ∑ y : ProfileSpace r, if AgreeOn S y x then f y else 0
Causalean.Stat.FinitePositiveTable.fiberSum · Causalean/Stat/FinitePositiveTable/Basic.lean:55 · uses ProfileSpace
theorem sum_fiberSum_insert_update reviewed
Causalean.Stat.FinitePositiveTable

For a profile function, a fixed coordinate set, a coordinate outside that set, and a reference profile, partitioning its fibre by the coordinate value recovers the original fibre sum: adding up, over every value of the outside coordinate, the fibre sum that additionally fixes that coordinate at that value gives the fibre sum that fixes only the original set.

Formal statement
V :
Type u
V → ℕ
shared
M :
Type uM
f :
ProfileSpace r → M
S :
v :
V
hv :
v ∉ S
x :
(∑ z : Fin (r v), fiberSum f (insert v S) (update x v z)) = fiberSum f S x
Proof (Lean source)
theorem sum_fiberSum_insert_update {M : Type uM} [AddCommMonoid M] (f : ProfileSpace r → M) {S : Finset V} {v : V} (hv : v ∉ S) (x : ProfileSpace r) : (∑ z : Fin (r v), fiberSum f (insert v S) (update x v z)) = fiberSum f S x := by classical have hAgree (z : Fin (r v)) (y : ProfileSpace r) : AgreeOn (insert v S) y (update x v z) ↔ AgreeOn S y x ∧ y v = z := by constructor · intro h constructor · intro w hw have hwy := h w (mem_insert_of_mem hw) simpa only [Function.update_of_ne (ne_of_mem_of_not_mem hw hv)] using hwy · simpa only [Function.update_self] using h v (mem_insert_self v S) · rintro ⟨hS, hyv⟩ w hw rcases mem_insert.mp hw with rfl | hw · simpa only [Function.update_self] using hyv · simpa only [Function.update_of_ne (ne_of_mem_of_not_mem hw hv)] using hS w hw unfold fiberSum calc (∑ z : Fin (r v), ∑ y : ProfileSpace r, if AgreeOn (insert v S) y (update x v z) then f y else 0) = ∑ z : Fin (r v), ∑ y ∈ univ with y v = z, if AgreeOn S y x then f y else 0 := by apply Finset.sum_congr rfl intro z hz rw [Finset.sum_filter] apply Finset.sum_congr rfl intro y hy rw [hAgree z y] by_cases hS : AgreeOn S y x <;> by_cases hyv : y v = z <;> simp [hS, hyv] _ = ∑ y : ProfileSpace r, if AgreeOn S y x then f y else 0 := by exact Finset.sum_fiberwise univ (fun y : ProfileSpace r => y v) (fun y => if AgreeOn S y x then f y else 0)
Causalean.Stat.FinitePositiveTable.sum_fiberSum_insert_update · Causalean/Stat/FinitePositiveTable/Basic.lean:118 · uses ProfileSpace , fiberSum
6 supporting declarations (lemmas, instances)
Marginals 6 core · 12 supporting This module defines marginals and conditional masses for finite real tables, proving positivity of conditioning denominators and normalization of each conditional row. ★ sum_conditionalMass

Marginals and finite conditional masses

This module defines marginals and conditional masses for finite real tables, proving positivity of conditioning denominators and normalization of each conditional row.

def kernelMarginalMass reviewed
Causalean.Stat.FinitePositiveTable

The kernel, fixed coordinate set, and reference profile determine the kernel's marginal mass by summing over compatible complete profiles.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
S :
x :
kernelMarginalMass q S x :
ℝ
fiberSum q S x
Causalean.Stat.FinitePositiveTable.kernelMarginalMass · Causalean/Stat/FinitePositiveTable/Marginals.lean:26 · uses Kernel , ProfileSpace
def marginalMass reviewed
Causalean.Stat.FinitePositiveTable

The positive table, fixed coordinate set, and reference profile determine the table's marginal mass as its kernel marginal.

Definition (Lean source)
V :
Type u
V → ℕ
shared
S :
x :
marginalMass p S x :
ℝ
Causalean.Stat.FinitePositiveTable.marginalMass · Causalean/Stat/FinitePositiveTable/Marginals.lean:31 · uses PositiveTable , ProfileSpace
def IsStrictlyPositive reviewed
Causalean.Stat.FinitePositiveTable.Kernel

The kernel has pointwise strict positivity when every complete profile has positive real mass.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
x :
IsStrictlyPositive q :
Prop
0 < q x
Causalean.Stat.FinitePositiveTable.Kernel.IsStrictlyPositive · Causalean/Stat/FinitePositiveTable/Marginals.lean:36 · uses Kernel
def kernelConditionalMass reviewed
Causalean.Stat.FinitePositiveTable

The kernel, coordinate and conditioning set, reference profile, and proposed coordinate value determine the kernel conditional mass as the joint marginal divided by the conditioning marginal.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
v :
V
C :
x :
z :
Fin (r v)
kernelConditionalMass q v C x z :
ℝ
Causalean.Stat.FinitePositiveTable.kernelConditionalMass · Causalean/Stat/FinitePositiveTable/Marginals.lean:79 · uses Kernel , ProfileSpace
def conditionalMass reviewed
Causalean.Stat.FinitePositiveTable

The positive table, coordinate and conditioning set, reference profile, and proposed coordinate value determine the table conditional mass as its kernel conditional mass.

Definition (Lean source)
V :
Type u
V → ℕ
shared
v :
V
C :
x :
z :
Fin (r v)
conditionalMass p v C x z :
ℝ
kernelConditionalMass p.mass v C x z
Causalean.Stat.FinitePositiveTable.conditionalMass · Causalean/Stat/FinitePositiveTable/Marginals.lean:87 · uses PositiveTable , ProfileSpace
theorem sum_conditionalMass reviewed
Causalean.Stat.FinitePositiveTable

For a positive table, a coordinate outside the conditioning set, and a reference profile, the conditional row sums to one.

Formal statement
V :
Type u
V → ℕ
shared
v :
V
C :
hv :
v ∉ C
x :
∑ z : Fin (r v), conditionalMass p v C x z = 1
Proof (Lean source)
theorem sum_conditionalMass (p : PositiveTable r) (v : V) (C : Finset V) (hv : v ∉ C) (x : ProfileSpace r) : ∑ z : Fin (r v), conditionalMass p v C x z = 1 := by exact sum_kernelConditionalMass p.mass_pos v C hv x
12 supporting declarations (lemmas, instances)
Fixing 8 core · 9 supporting This module defines graph-independent coordinate fixing for positive finite tables and records its one-step and sequential conditional-factor expansions. ★ fixSequence_eq_div_conditionalProduct

Coordinate fixing and sequential expansions

This module defines graph-independent coordinate fixing for positive finite tables and records its one-step and sequential conditional-factor expansions.

def fixKernelCoordinate reviewed
Causalean.Stat.FinitePositiveTable

The kernel, coordinate, and conditioning set determine the kernel after fixing that coordinate by dividing each profile's mass by the kernel's conditional mass of that profile's value at the coordinate given its values on the conditioning set. The division follows the real-number convention that division by zero gives zero, so the result is the intended quotient only when the conditional mass is nonzero, as it is for a strictly positive kernel.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
v :
V
C :
fixKernelCoordinate q v C :
fun x ↦ q x / kernelConditionalMass q v C x (x v)
Causalean.Stat.FinitePositiveTable.fixKernelCoordinate · Causalean/Stat/FinitePositiveTable/Fixing.lean:25 · uses Kernel
def fixCoordinate reviewed
Causalean.Stat.FinitePositiveTable

The positive table, coordinate, and conditioning set determine the fixed kernel as the fixed mass kernel.

Definition (Lean source)
V :
Type u
V → ℕ
shared
v :
V
C :
fixCoordinate p v C :
Causalean.Stat.FinitePositiveTable.fixCoordinate · Causalean/Stat/FinitePositiveTable/Fixing.lean:34 · uses Kernel , PositiveTable
structure FixingStep reviewed
Causalean.Stat.FinitePositiveTable

The coordinate type determines one algebraic fixing step, consisting of the coordinate to remove and the coordinates used for conditioning.

Definition (Lean source)
V :
Type u
The coordinate removed from the random kernel.
coordinate :
V
The coordinates conditioned on when the coordinate is fixed.
conditioning :
Causalean.Stat.FinitePositiveTable.FixingStep · Causalean/Stat/FinitePositiveTable/Fixing.lean:39
def FixingSequenceValid reviewed
Causalean.Stat.FinitePositiveTable

The list of fixing steps satisfies algebraic validity when its fixed coordinates are distinct and no step conditions on its own coordinate.

Definition (Lean source)
V :
Type u
shared
steps :
FixingSequenceValid steps :
Prop
clause 1
(steps.map (fun s ↦ s.coordinate)).Nodup
clause 2
s ∈ steps :
s.coordinate ∉ s.conditioning
Causalean.Stat.FinitePositiveTable.FixingSequenceValid · Causalean/Stat/FinitePositiveTable/Fixing.lean:47 · uses FixingStep
def fixKernelSequence reviewed
Causalean.Stat.FinitePositiveTable

The kernel and a list of fixing steps determine the sequentially fixed kernel: an empty list leaves the kernel unchanged, and a nonempty list fixes its head before continuing with its tail.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
fixKernelSequence q :
clause 1
| [] => q
clause 2
| s :: ss => fixKernelSequence (fixKernelCoordinate q s.coordinate s.conditioning) ss
Causalean.Stat.FinitePositiveTable.fixKernelSequence · Causalean/Stat/FinitePositiveTable/Fixing.lean:53 · uses FixingStep , Kernel
def fixSequence reviewed
Causalean.Stat.FinitePositiveTable

The positive table and list of fixing steps determine the sequentially fixed kernel as the sequentially fixed mass kernel.

Definition (Lean source)
V :
Type u
V → ℕ
shared
steps :
fixSequence p steps :
fixKernelSequence p.mass steps
Causalean.Stat.FinitePositiveTable.fixSequence · Causalean/Stat/FinitePositiveTable/Fixing.lean:60 · uses FixingStep , Kernel , PositiveTable
def fixingConditionalProduct reviewed
Causalean.Stat.FinitePositiveTable

The kernel and a list of fixing steps determine the product of the successive conditional factors, evaluated at a profile: an empty list has product one, and a nonempty list multiplies the kernel's conditional mass for its first step by the product for the remaining steps computed from the kernel after that first step has been fixed.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
fixingConditionalProduct q :
List (FixingStep V) → ProfileSpace r → ℝ
clause 1
| [], _ => 1
clause 2
| s :: ss, x
=> kernelConditionalMass q s.coordinate s.conditioning x (x s.coordinate) * fixingConditionalProduct (fixKernelCoordinate q s.coordinate s.conditioning) ss x
Causalean.Stat.FinitePositiveTable.fixingConditionalProduct · Causalean/Stat/FinitePositiveTable/Fixing.lean:65 · uses FixingStep , Kernel , ProfileSpace
theorem fixSequence_eq_div_conditionalProduct reviewed
Causalean.Stat.FinitePositiveTable

For a positive table, an algebraically valid list of fixing steps, and a profile, the sequentially fixed kernel at that profile equals the table's mass there divided by the product of the successive conditional factors, each computed from the kernel obtained after the earlier fixing steps.

Formal statement
V :
Type u
V → ℕ
shared
steps :
hvalid :
x :
fixSequence p steps x = p.mass x / fixingConditionalProduct p.mass steps x
Proof (Lean source)
theorem fixSequence_eq_div_conditionalProduct (p : PositiveTable r) (steps : List (FixingStep V)) (hvalid : FixingSequenceValid steps) (x : ProfileSpace r) : fixSequence p steps x = p.mass x / fixingConditionalProduct p.mass steps x := by exact fixKernelSequence_eq_div_conditionalProduct p.mass_pos steps hvalid x
9 supporting declarations (lemmas, instances)
Two­Row 9 core · 4 supporting This module proves the graph-independent row normalization, total normalization, and positive marginal cancellation identities used to read conditional independence from fixed kernels. ★ kernelRows_eq_of_condIndep

Row, total, and cancellation identities for fixed kernels

This module proves the graph-independent row normalization, total normalization, and positive marginal cancellation identities used to read conditional independence from fixed kernels.

def coordinateRowMass reviewed
Causalean.Stat.FinitePositiveTable

The kernel, row coordinate, and reference profile determine the kernel's coordinate-row mass by summing over that coordinate.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
d :
V
x :
coordinateRowMass q d x :
ℝ
∑ zd : Fin (r d), q (update x d zd)
Causalean.Stat.FinitePositiveTable.coordinateRowMass · Causalean/Stat/FinitePositiveTable/TwoRow.lean:25 · uses Kernel , ProfileSpace
def coordinateRectangleMass reviewed
Causalean.Stat.FinitePositiveTable

The kernel, two varying coordinates, and reference profile determine the kernel's coordinate-rectangle mass by summing over both coordinates.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
a d :
V
x :
coordinateRectangleMass q a d x :
ℝ
∑ za : Fin (r a), ∑ zd : Fin (r d), q (update (update x a za) d zd)
Causalean.Stat.FinitePositiveTable.coordinateRectangleMass · Causalean/Stat/FinitePositiveTable/TwoRow.lean:30 · uses Kernel , ProfileSpace
def coordinateColumnMass reviewed
Causalean.Stat.FinitePositiveTable

The kernel, column coordinate, and reference profile determine the kernel's coordinate-column mass by summing over that coordinate.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
a :
V
x :
coordinateColumnMass q a x :
ℝ
∑ za : Fin (r a), q (update x a za)
Causalean.Stat.FinitePositiveTable.coordinateColumnMass · Causalean/Stat/FinitePositiveTable/TwoRow.lean:36 · uses Kernel , ProfileSpace
def HasMarginalKernelForm reviewed
Causalean.Stat.FinitePositiveTable

The positive table, kernel, three distinct-role coordinates, and residual kernel determine the marginal-times-kernel representation when the kernel factors into the positive a marginal and the residual three-coordinate kernel.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
a c d :
V
K :
Fin (r a) → Fin (r c) → Fin (r d) → ℝ
x :
HasMarginalKernelForm p q a c d K :
Prop
q x = marginalMass p {a} x * K (x a) (x c) (x d)
Causalean.Stat.FinitePositiveTable.HasMarginalKernelForm · Causalean/Stat/FinitePositiveTable/TwoRow.lean:41 · uses Kernel , PositiveTable
def KernelRowsNormalized reviewed
Causalean.Stat.FinitePositiveTable

The residual kernel has normalized rows in its final coordinate when each such row sums to one.

Definition (Lean source)
V :
Type u
V → ℕ
V
shared
K :
Fin (r a) → Fin (r c) → Fin (r d) → ℝ
xa xc :
KernelRowsNormalized K :
Prop
∑ xd, K xa xc xd = 1
Causalean.Stat.FinitePositiveTable.KernelRowsNormalized · Causalean/Stat/FinitePositiveTable/TwoRow.lean:48
def KernelNonnegative reviewed
Causalean.Stat.FinitePositiveTable

The residual kernel has pointwise nonnegativity when every entry is nonnegative.

Definition (Lean source)
V :
Type u
V → ℕ
V
shared
K :
Fin (r a) → Fin (r c) → Fin (r d) → ℝ
xa xc xd :
KernelNonnegative K :
Prop
0 ≤ K xa xc xd
Causalean.Stat.FinitePositiveTable.KernelNonnegative · Causalean/Stat/FinitePositiveTable/TwoRow.lean:54
def KernelCondIndepAt reviewed
Causalean.Stat.FinitePositiveTable

The kernel, two coordinates, and profile determine the multiplicative conditional-independence identity at that profile by equating the profile-and-rectangle product with the row-and-column product.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
a d :
V
x :
KernelCondIndepAt q a d x :
Prop
Causalean.Stat.FinitePositiveTable.KernelCondIndepAt · Causalean/Stat/FinitePositiveTable/TwoRow.lean:60 · uses Kernel , ProfileSpace
def KernelCondIndep reviewed
Causalean.Stat.FinitePositiveTable

The kernel and two coordinates determine their multiplicative conditional-independence identity at every profile by requiring the pointwise identity at each profile.

Definition (Lean source)
V :
Type u
V → ℕ
shared
q :
a d :
V
x :
KernelCondIndep q a d :
Prop
Causalean.Stat.FinitePositiveTable.KernelCondIndep · Causalean/Stat/FinitePositiveTable/TwoRow.lean:67 · uses Kernel
theorem kernelRows_eq_of_condIndep reviewed
Causalean.Stat.FinitePositiveTable

For a positive table, a kernel, three pairwise distinct coordinates, a residual kernel, its marginal-times-kernel form, normalized residual rows, and the kernel's multiplicative conditional-independence identity, the residual row is unchanged when the positive-marginal coordinate is replaced.

Formal statement
V :
Type u
V → ℕ
shared
q :
a c d :
V
hac :
a ≠ c
had :
a ≠ d
hcd :
c ≠ d
K :
Fin (r a) → Fin (r c) → Fin (r d) → ℝ
hform :
hci :
x :
za :
Fin (r a)
K (x a) (x c) (x d) = K za (x c) (x d)
Proof (Lean source)
theorem kernelRows_eq_of_condIndep (p : PositiveTable r) (q : Kernel r) {a c d : V} (hac : a ≠ c) (had : a ≠ d) (hcd : c ≠ d) (K : Fin (r a) → Fin (r c) → Fin (r d) → ℝ) (hform : HasMarginalKernelForm p q a c d K) (hrows : KernelRowsNormalized K) (hci : KernelCondIndep q a d) : ∀ (x : ProfileSpace r) (za : Fin (r a)), K (x a) (x c) (x d) = K za (x c) (x d) := by intro x za have hKcol (y : ProfileSpace r) : K (y a) (y c) (y d) = coordinateColumnMass q a y := by have h := hci y unfold KernelCondIndepAt at h rw [coordinateRectangleMass_eq_one p q had hcd K hform hrows y, coordinateRowMass_eq_marginalMass p q had hcd K hform hrows y, hform y] at h simp only [mul_one] at h exact eq_of_pos_mul_eq_mul (marginalMass_pos p {a} y) h have hcol : coordinateColumnMass q a (update x a za) = coordinateColumnMass q a x := by unfold coordinateColumnMass apply Finset.sum_congr rfl intro z hz rw [Function.update_idem] calc K (x a) (x c) (x d) = coordinateColumnMass q a x := hKcol x _ = coordinateColumnMass q a (update x a za) := hcol.symm _ = K ((update x a za) a) ((update x a za) c) ((update x a za) d) := (hKcol (update x a za)).symm _ = K za (x c) (x d) := by simp only [Function.update_self, Function.update_of_ne hac.symm, Function.update_of_ne had.symm]
4 supporting declarations (lemmas, instances)