Stat.Finite­Rao­Blackwell

Guarded finite conditional laws and Rao–Blackwell reductions for arbitrary finite-design pushforwards and uniform allocation experiments, with exact disintegration, finite-prior posteriors, factorization sufficiency, and real-valued minimax bridges.

Paired­Poisson­Histogram 12 core · 11 supporting · 4 submodules This roll-up module exports a parameter-independent count estimator obtained from any estimator of paired fixed samples, the law identity for pairing two independent iid arrays, and the general and twice-sample-size risk
Core 11 core · 11 supporting This module gives the finite-sum probability substrate for an experiment that first chooses uniformly from a nonempty finite set of admissible allocations and then draws a finite observation. ★ disintegrate_sum

Finite uniform experiments and guarded conditional designs

This module gives the finite-sum probability substrate for an experiment that first chooses uniformly from a nonempty finite set of admissible allocations and then draws a finite observation. It defines the joint mass, the mass of a coarsening statistic, and a conditional design on every statistic fiber. Positive fibers use Bayes' formula; zero-mass fibers use a fixed point mass, so the result is a genuine probability design everywhere without changing any disintegration identity.

structure FiniteUniformExperiment reviewed
Causalean.Stat.FiniteRaoBlackwell

A finite uniform-allocation experiment consists of a nonempty admissible allocation set, a normalized nonnegative observation mass for every state and allocation, a finite statistic, and a fallback observation used only to totalize conditioning on null fibers.

Definition (Lean source)
Latent Allocation Observation Statistic :
Type*
Fintype Latent
Fintype Allocation
Fintype Observation
Fintype Statistic
The finite set of admissible fixed-size allocations.
allocations :
Finset Allocation
At least one admissible allocation is available.
allocations_nonempty :
allocations.Nonempty
Conditional observation mass at a latent state and allocation.
observationMass :
Latent → Allocation → Observation → ℝ
Every conditional observation mass is nonnegative.
observationMass_nonneg :
∀ θ a x, 0 ≤ observationMass θ a x
Conditional observation masses sum to one.
observationMass_sum :
∀ θ a, ∑ x, observationMass θ a x = 1
The coarsened statistic computed from allocation and observation.
statistic :
Allocation → Observation → Statistic
A fallback observation used to define null-fiber conditional laws.
fallbackObservation :
Observation
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment · Causalean/Stat/FiniteRaoBlackwell/Core.lean:24
def fallbackAllocation reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, the fallback allocation is a chosen member of its nonempty set of admissible allocations.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
fallbackAllocation E :
Allocation
E.allocations_nonempty.choose
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.fallbackAllocation · Causalean/Stat/FiniteRaoBlackwell/Core.lean:49 · uses FiniteUniformExperiment
def fallbackSample reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, the fallback full-data point pairs its fallback allocation with its fallback observation.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
fallbackSample E :
Allocation × Observation
(E.fallbackAllocation, E.fallbackObservation)
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.fallbackSample · Causalean/Stat/FiniteRaoBlackwell/Core.lean:53 · uses FiniteUniformExperiment
def sampleStatistic reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment and a full-data point, the sample statistic is the statistic computed from that point's allocation and observation.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
z :
Allocation × Observation
sampleStatistic E z :
Statistic
E.statistic z.1 z.2
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.sampleStatistic · Causalean/Stat/FiniteRaoBlackwell/Core.lean:57 · uses FiniteUniformExperiment
def uniformAllocationMass reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment and an allocation, the uniform allocation mass is the reciprocal of the number of admissible allocations when that allocation is admissible, and zero otherwise.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
a :
Allocation
uniformAllocationMass E a :
by classical exact if a ∈ E.allocations then (E.allocations.card : ℝ)⁻¹ else 0
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.uniformAllocationMass · Causalean/Stat/FiniteRaoBlackwell/Core.lean:61 · uses FiniteUniformExperiment
def jointMass reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a latent state, and a full-data point, the joint mass is the uniform allocation mass of its allocation multiplied by the conditional observation mass of its observation at that state and allocation.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
θ :
Latent
z :
Allocation × Observation
jointMass E θ z :
E.uniformAllocationMass z.1 * E.observationMass θ z.1 z.2
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.jointMass · Causalean/Stat/FiniteRaoBlackwell/Core.lean:67 · uses FiniteUniformExperiment
def statisticMass reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a latent state, and a statistic value, the statistic mass is the sum of joint masses of all full-data points whose statistic equals that value.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
θ :
Latent
s :
Statistic
statisticMass E θ s :
by classical exact ∑ z : Allocation × Observation, if E.sampleStatistic z
= s then E.jointMass θ z else 0
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticMass · Causalean/Stat/FiniteRaoBlackwell/Core.lean:96 · uses FiniteUniformExperiment
def conditionalWeight reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a latent state, a statistic value, and a full-data point, the guarded conditional weight is the joint mass divided by the statistic mass when that mass is positive and the point has the requested statistic, is zero for other points, and is instead a point mass at the fallback sample when the statistic mass is zero.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
θ :
Latent
s :
Statistic
z :
Allocation × Observation
conditionalWeight E θ s z :
by classical exact if 0 < E.statisticMass θ s then if E.sampleStatistic z
= s then E.jointMass θ z / E.statisticMass θ s else 0 else if z = E.fallbackSample then 1 else 0
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalWeight · Causalean/Stat/FiniteRaoBlackwell/Core.lean:122 · uses FiniteUniformExperiment
def conditionalDesign reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a latent state, and a statistic value, the guarded conditional full-data design is the finite probability design whose probabilities are the guarded conditional weights.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
θ :
Latent
s :
Statistic
conditionalDesign E θ s :
FiniteDesign (Allocation × Observation)
clause 1
p := E.conditionalWeight θ s
clause 2
p_nonneg := E.conditionalWeight_nonneg θ s
clause 3
p_sum := E.conditionalWeight_sum θ s
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalDesign · Causalean/Stat/FiniteRaoBlackwell/Core.lean:187 · uses FiniteDesign , FiniteUniformExperiment
def statisticDesign reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment and a latent state, the statistic design is the finite probability design whose probabilities are the statistic masses.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
θ :
Latent
statisticDesign E θ :
FiniteDesign Statistic
clause 1
p := E.statisticMass θ
clause 2
p_nonneg := E.statisticMass_nonneg θ
clause 3
p_sum := E.statisticMass_sum θ
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticDesign · Causalean/Stat/FiniteRaoBlackwell/Core.lean:194 · uses FiniteDesign , FiniteUniformExperiment
theorem disintegrate_sum reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

Every real test function has the same joint expectation as its statistic-marginal expectation of the guarded conditional expectation; null fibers contribute exactly zero.

Formal statement
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
θ :
Latent
f :
Allocation × Observation → ℝ
∑ z, E.jointMass θ z * f z
= ∑ s, E.statisticMass θ s * (∑ z, E.conditionalWeight θ s z * f z)
Proof (Lean source)
theorem disintegrate_sum (θ : Latent) (f : Allocation × Observation → ℝ) : ∑ z, E.jointMass θ z * f z = ∑ s, E.statisticMass θ s * (∑ z, E.conditionalWeight θ s z * f z) := by /- Distribute products over the inner sums, use statisticMass_mul_conditionalWeight, swap the finite sums, and collapse the unique statistic value of each sample point. -/ classical simp_rw [Finset.mul_sum, ← mul_assoc, E.statisticMass_mul_conditionalWeight θ] rw [Finset.sum_comm] simp
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.disintegrate_sum · Causalean/Stat/FiniteRaoBlackwell/Core.lean:237 · uses FiniteUniformExperiment , conditionalWeight , jointMass , statisticMass
11 supporting declarations (lemmas, instances)
  • uniformAllocationMass_nonneg theorem — The uniform allocation mass is nonnegative at every allocation.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    a :
    Allocation
    0 ≤ E.uniformAllocationMass a
    Proof (Lean source)
    theorem uniformAllocationMass_nonneg (a : Allocation) : 0 ≤ E.uniformAllocationMass a := by classical simp only [uniformAllocationMass] split_ifs · exact inv_nonneg.mpr (Nat.cast_nonneg _) · exact le_rfl
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.uniformAllocationMass_nonneg · Causalean/Stat/FiniteRaoBlackwell/Core.lean:71
  • jointMass_nonneg theorem — The full-data joint mass is nonnegative at every state and sample point.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    z :
    Allocation × Observation
    0 ≤ E.jointMass θ z
    Proof (Lean source)
    theorem jointMass_nonneg (θ : Latent) (z : Allocation × Observation) : 0 ≤ E.jointMass θ z := by exact mul_nonneg (E.uniformAllocationMass_nonneg z.1) (E.observationMass_nonneg θ z.1 z.2)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.jointMass_nonneg · Causalean/Stat/FiniteRaoBlackwell/Core.lean:80
  • jointMass_sum theorem — At every latent state, the full-data joint mass sums to one.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    ∑ z : Allocation × Observation, E.jointMass θ z = 1
    Proof (Lean source)
    theorem jointMass_sum (θ : Latent) : ∑ z : Allocation × Observation, E.jointMass θ z = 1 := by /- Expand the product sum, discard allocations off the support, use observationMass_sum, and cancel the nonzero finite support cardinality. -/ classical rw [Fintype.sum_prod_type] simp_rw [jointMass, ← Finset.mul_sum, E.observationMass_sum, mul_one] simp [uniformAllocationMass, E.allocations_nonempty.card_ne_zero]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.jointMass_sum · Causalean/Stat/FiniteRaoBlackwell/Core.lean:86
  • statisticMass_nonneg theorem — Every statistic mass is nonnegative.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    0 ≤ E.statisticMass θ s
    Proof (Lean source)
    theorem statisticMass_nonneg (θ : Latent) (s : Statistic) : 0 ≤ E.statisticMass θ s := by classical exact sum_nonneg fun z _ => by split_ifs · exact E.jointMass_nonneg θ z · exact le_rfl
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticMass_nonneg · Causalean/Stat/FiniteRaoBlackwell/Core.lean:103
  • statisticMass_sum theorem — At every latent state, the statistic masses sum to one.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    ∑ s : Statistic, E.statisticMass θ s = 1
    Proof (Lean source)
    theorem statisticMass_sum (θ : Latent) : ∑ s : Statistic, E.statisticMass θ s = 1 := by /- Swap the two finite sums; for each full-data point exactly one statistic value survives. -/ classical rw [← E.jointMass_sum θ] simp_rw [statisticMass] rw [Finset.sum_comm] simp
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticMass_sum · Causalean/Stat/FiniteRaoBlackwell/Core.lean:112
  • conditionalWeight_of_pos theorem — On a positive fiber, the guarded conditional weight is the usual fiber-restricted Bayes ratio.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    h :
    0 < E.statisticMass θ s
    z :
    Allocation × Observation
    E.conditionalWeight θ s z
    = if E.sampleStatistic z = s then E.jointMass θ z / E.statisticMass θ s else 0
    Proof (Lean source)
    theorem conditionalWeight_of_pos {θ : Latent} {s : Statistic} (h : 0 < E.statisticMass θ s) (z : Allocation × Observation) : E.conditionalWeight θ s z = if E.sampleStatistic z = s then E.jointMass θ z / E.statisticMass θ s else 0 := by classical simp [conditionalWeight, h]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalWeight_of_pos · Causalean/Stat/FiniteRaoBlackwell/Core.lean:131
  • conditionalWeight_of_eq_zero theorem — On a zero-mass fiber, the guarded conditional weight is the fallback point mass.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    h :
    E.statisticMass θ s = 0
    z :
    Allocation × Observation
    E.conditionalWeight θ s z = if z = E.fallbackSample then 1 else 0
    Proof (Lean source)
    theorem conditionalWeight_of_eq_zero {θ : Latent} {s : Statistic} (h : E.statisticMass θ s = 0) (z : Allocation × Observation) : E.conditionalWeight θ s z = if z = E.fallbackSample then 1 else 0 := by classical simp [conditionalWeight, h]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalWeight_of_eq_zero · Causalean/Stat/FiniteRaoBlackwell/Core.lean:139
  • conditionalWeight_nonneg theorem — Every guarded conditional weight is nonnegative, including on null fibers.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    z :
    Allocation × Observation
    0 ≤ E.conditionalWeight θ s z
    Proof (Lean source)
    theorem conditionalWeight_nonneg (θ : Latent) (s : Statistic) (z : Allocation × Observation) : 0 ≤ E.conditionalWeight θ s z := by classical by_cases h : 0 < E.statisticMass θ s · simp only [E.conditionalWeight_of_pos h] split_ifs · exact div_nonneg (E.jointMass_nonneg θ z) (le_of_lt h) · exact le_rfl · have hs : E.statisticMass θ s = 0 := le_antisymm (le_of_not_gt h) (E.statisticMass_nonneg θ s) rw [E.conditionalWeight_of_eq_zero hs] split_ifs <;> norm_num
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalWeight_nonneg · Causalean/Stat/FiniteRaoBlackwell/Core.lean:146
  • conditionalWeight_sum theorem — The guarded conditional weights sum to one on every fiber, with positive fibers normalized by Bayes' formula and null fibers normalized by the fallback point mass.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    ∑ z : Allocation × Observation, E.conditionalWeight θ s z = 1
    Proof (Lean source)
    theorem conditionalWeight_sum (θ : Latent) (s : Statistic) : ∑ z : Allocation × Observation, E.conditionalWeight θ s z = 1 := by /- Split on positivity of statisticMass. In the positive branch divide the defining fiber sum by its mass; in the null branch sum the fallback Kronecker mass. -/ classical by_cases h : 0 < E.statisticMass θ s · simp_rw [E.conditionalWeight_of_pos h] simp_rw [div_eq_mul_inv] have hfactor (z : Allocation × Observation) : (if E.sampleStatistic z = s then E.jointMass θ z * (E.statisticMass θ s)⁻¹ else 0) = (if E.sampleStatistic z = s then E.jointMass θ z else 0) * (E.statisticMass θ s)⁻¹ := by split_ifs <;> simp simp_rw [hfactor] rw [← Finset.sum_mul, show (∑ z : Allocation × Observation, if E.sampleStatistic z = s then E.jointMass θ z else 0) = E.statisticMass θ s from rfl] exact mul_inv_cancel₀ (ne_of_gt h) · have hs : E.statisticMass θ s = 0 := le_antisymm (le_of_not_gt h) (E.statisticMass_nonneg θ s) simp [E.conditionalWeight_of_eq_zero hs]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalWeight_sum · Causalean/Stat/FiniteRaoBlackwell/Core.lean:161
  • statisticMass_mul_conditionalWeight theorem — Multiplying a statistic marginal by its guarded conditional weight recovers the joint mass on that fiber and zero away from it, including when the marginal is zero.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    z :
    Allocation × Observation
    E.statisticMass θ s * E.conditionalWeight θ s z
    = if E.sampleStatistic z = s then E.jointMass θ z else 0
    Proof (Lean source)
    theorem statisticMass_mul_conditionalWeight (θ : Latent) (s : Statistic) (z : Allocation × Observation) : E.statisticMass θ s * E.conditionalWeight θ s z = if E.sampleStatistic z = s then E.jointMass θ z else 0 := by /- Positive mass is field cancellation. If the mass is zero, nonnegativity and the fact that jointMass is one summand in statisticMass force every mass on the fiber to vanish. -/ classical by_cases h : 0 < E.statisticMass θ s · rw [E.conditionalWeight_of_pos h] split_ifs · exact mul_div_cancel₀ _ (ne_of_gt h) · exact mul_zero _ · have hs : E.statisticMass θ s = 0 := le_antisymm (le_of_not_gt h) (E.statisticMass_nonneg θ s) rw [hs, zero_mul] split_ifs with hz · have hsum : (∑ z' : Allocation × Observation, if E.sampleStatistic z' = s then E.jointMass θ z' else 0) = 0 := by simpa [statisticMass] using hs have hterm := (Finset.sum_eq_zero_iff_of_nonneg (fun z' _ => by split_ifs · exact E.jointMass_nonneg θ z' · exact le_rfl)).mp hsum z (Finset.mem_univ z) simpa [hz] using hterm.symm · rfl
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticMass_mul_conditionalWeight · Causalean/Stat/FiniteRaoBlackwell/Core.lean:200
  • jointMass_eq_statisticMass_mul_conditionalWeight theorem — Every full-data atom factors into its statistic marginal and guarded conditional weight.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    z :
    Allocation × Observation
    E.jointMass θ z
    = E.statisticMass θ (E.sampleStatistic z) * E.conditionalWeight θ (E.sampleStatistic z) z
    Proof (Lean source)
    theorem jointMass_eq_statisticMass_mul_conditionalWeight (θ : Latent) (z : Allocation × Observation) : E.jointMass θ z = E.statisticMass θ (E.sampleStatistic z) * E.conditionalWeight θ (E.sampleStatistic z) z := by simpa using (E.statisticMass_mul_conditionalWeight θ (E.sampleStatistic z) z).symm
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.jointMass_eq_statisticMass_mul_conditionalWeight · Causalean/Stat/FiniteRaoBlackwell/Core.lean:229
Sufficiency 6 core · 5 supporting This module gives a finite Fisher--Neyman factorization criterion for the statistic of a FiniteUniformExperiment. ★ commonConditionalWeight_eq_conditionalWeight

Finite factorization sufficiency

This module gives a finite Fisher--Neyman factorization criterion for the statistic of a FiniteUniformExperiment. A state-dependent factor through the statistic and a nonnegative state-independent carrier weight determine a common conditional distribution of the full data given the statistic. Null carrier fibers are totalized by the experiment's fallback point.

structure CommonConditionalKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

A common finite conditional law assigns normalized nonnegative full-data weights to every statistic value and agrees with each statewise Bayes conditional on every positive-mass fiber.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
The state-independent conditional full-data weights.
weight :
Statistic → Allocation × Observation → ℝ
Common conditional weights are nonnegative.
weight_nonneg :
∀ s z, 0 ≤ weight s z
Common conditional weights are normalized at every statistic value.
weight_sum :
∀ s, ∑ z, weight s z = 1
Positive statewise fibers have the common conditional weights.
eq_conditionalWeight :
∀ θ s
if
0 < E.statisticMass θ s
then
∀ z, weight s z = E.conditionalWeight θ s z
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.CommonConditionalKernel · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:24 · uses FiniteUniformExperiment
structure SufficientFactorization reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

A sufficient factorization writes every full-data mass as a nonnegative factor depending on the state and data only through the statistic, times a nonnegative state-independent carrier weight on the full data.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
The state-independent carrier weight on full-data points.
carrierWeight :
Allocation × Observation → ℝ
Carrier weights are nonnegative.
carrierWeight_nonneg :
∀ z, 0 ≤ carrierWeight z
The state-and-statistic likelihood factor.
statisticFactor :
Latent → Statistic → ℝ
State-and-statistic factors are nonnegative.
statisticFactor_nonneg :
∀ θ s, 0 ≤ statisticFactor θ s
The full-data mass factors through the statistic.
jointMass_factor :
∀ θ z, E.jointMass θ z = statisticFactor θ (E.sampleStatistic z) * carrierWeight z
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:37 · uses FiniteUniformExperiment
def fiberCarrierMass reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization

For a finite uniform experiment, a sufficient factorization of that experiment's full-data masses, and a statistic value, the carrier mass of that statistic fiber is the sum of the factorization's state-independent carrier weights over all allocation--observation pairs having that statistic value.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
F :
E.SufficientFactorization
shared
s :
Statistic
fiberCarrierMass F s :
∑ z : Allocation × Observation, if E.sampleStatistic z = s then F.carrierWeight z else 0
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.fiberCarrierMass · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:58 · uses FiniteUniformExperiment , SufficientFactorization
def commonConditionalWeight reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization

For a finite uniform experiment, a sufficient factorization of its full-data masses, a statistic value, and an allocation--observation pair, the common conditional weight equals the carrier weight divided by the carrier mass when that mass is positive and the pair has the stated statistic, equals zero when the mass is positive but the pair has another statistic, and otherwise is a unit mass at the experiment's designated fallback pair.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
F :
E.SufficientFactorization
shared
s :
Statistic
z :
Allocation × Observation
commonConditionalWeight F s z :
if 0 < F.fiberCarrierMass s then if E.sampleStatistic z
= s then F.carrierWeight z / F.fiberCarrierMass s else 0 else if z = E.fallbackSample then 1 else 0
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.commonConditionalWeight · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:98 · uses FiniteUniformExperiment , SufficientFactorization
theorem commonConditionalWeight_eq_conditionalWeight reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization

On every positive statewise statistic fiber, factorization identifies the common conditional weight with the guarded Bayes conditional weight.

Formal statement
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
F :
E.SufficientFactorization
shared
θ :
Latent
s :
Statistic
h :
0 < E.statisticMass θ s
z :
Allocation × Observation
F.commonConditionalWeight s z = E.conditionalWeight θ s z
Proof (Lean source)
theorem commonConditionalWeight_eq_conditionalWeight (θ : Latent) (s : Statistic) (h : 0 < E.statisticMass θ s) (z : Allocation × Observation) : F.commonConditionalWeight s z = E.conditionalWeight θ s z := by /- Positive statistic mass makes both factor terms positive. Expand both guarded weights, rewrite statisticMass and jointMass by factorization, then cancel the statistic factor. -/ classical have hcarrier : 0 < F.fiberCarrierMass s := F.fiberCarrierMass_pos_of_statisticMass_pos h have hprod : 0 < F.statisticFactor θ s * F.fiberCarrierMass s := by rwa [← F.statisticMass_eq_factor_mul_fiberCarrierMass θ s] have hfactor : 0 < F.statisticFactor θ s := pos_of_mul_pos_left hprod (F.fiberCarrierMass_nonneg s) rw [E.conditionalWeight_of_pos h] simp only [commonConditionalWeight, hcarrier, if_pos] by_cases hz : E.sampleStatistic z = s · simp only [hz, if_pos] rw [F.jointMass_factor, F.statisticMass_eq_factor_mul_fiberCarrierMass, hz] exact (mul_div_mul_left (F.carrierWeight z) (F.fiberCarrierMass s) (ne_of_gt hfactor)).symm · simp [hz]
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.commonConditionalWeight_eq_conditionalWeight · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:146 · uses FiniteUniformExperiment , SufficientFactorization , commonConditionalWeight , conditionalWeight , statisticMass
def toCommonConditionalKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization

For a finite uniform experiment and a sufficient factorization of its full-data masses, the common conditional kernel induced by that factorization assigns the factorization-induced common conditional weights to every statistic value and allocation--observation pair.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
F :
E.SufficientFactorization
shared
toCommonConditionalKernel F :
E.CommonConditionalKernel
clause 1
weight := F.commonConditionalWeight
clause 2
weight_nonneg := F.commonConditionalWeight_nonneg
clause 3
weight_sum := F.commonConditionalWeight_sum
clause 4
eq_conditionalWeight := F.commonConditionalWeight_eq_conditionalWeight
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.toCommonConditionalKernel · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:170 · uses FiniteUniformExperiment , CommonConditionalKernel , SufficientFactorization
5 supporting declarations (lemmas, instances)
  • fiberCarrierMass_nonneg theorem — Every carrier fiber mass is nonnegative.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    shared
    s :
    Statistic
    0 ≤ F.fiberCarrierMass s
    Proof (Lean source)
    theorem fiberCarrierMass_nonneg (s : Statistic) : 0 ≤ F.fiberCarrierMass s := by /- Expand the fiber sum and use carrierWeight_nonneg in the matching branch. -/ classical exact sum_nonneg fun z _ => by split_ifs · exact F.carrierWeight_nonneg z · exact le_rfl
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.fiberCarrierMass_nonneg · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:66
  • statisticMass_eq_factor_mul_fiberCarrierMass theorem — The statistic mass factors as the state-and-statistic factor times the carrier fiber mass.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    shared
    θ :
    Latent
    s :
    Statistic
    E.statisticMass θ s = F.statisticFactor θ s * F.fiberCarrierMass s
    Proof (Lean source)
    theorem statisticMass_eq_factor_mul_fiberCarrierMass (θ : Latent) (s : Statistic) : E.statisticMass θ s = F.statisticFactor θ s * F.fiberCarrierMass s := by /- Rewrite every joint atom by jointMass_factor; on the selected fiber the statistic factor is constant, so Finset.mul_sum factors it out. -/ classical simp only [FiniteUniformExperiment.statisticMass, fiberCarrierMass, Finset.mul_sum] apply Finset.sum_congr rfl intro z _ by_cases hz : E.sampleStatistic z = s · simp [hz, F.jointMass_factor] · simp [hz]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.statisticMass_eq_factor_mul_fiberCarrierMass · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:75
  • fiberCarrierMass_pos_of_statisticMass_pos theorem — Positive statistic mass forces the state-independent carrier fiber to have positive mass.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    shared
    θ :
    Latent
    s :
    Statistic
    h :
    0 < E.statisticMass θ s
    0 < F.fiberCarrierMass s
    Proof (Lean source)
    theorem fiberCarrierMass_pos_of_statisticMass_pos {θ : Latent} {s : Statistic} (h : 0 < E.statisticMass θ s) : 0 < F.fiberCarrierMass s := by /- Rewrite statisticMass using the product formula. Both factors are nonnegative, so a positive product forces the carrier factor to be positive. -/ have hprod : 0 < F.statisticFactor θ s * F.fiberCarrierMass s := by rwa [← F.statisticMass_eq_factor_mul_fiberCarrierMass θ s] exact pos_of_mul_pos_right hprod (F.statisticFactor_nonneg θ s)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.fiberCarrierMass_pos_of_statisticMass_pos · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:88
  • commonConditionalWeight_nonneg theorem — Factorization-induced common conditional weights are nonnegative on every fiber.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    shared
    s :
    Statistic
    z :
    Allocation × Observation
    0 ≤ F.commonConditionalWeight s z
    Proof (Lean source)
    theorem commonConditionalWeight_nonneg (s : Statistic) (z : Allocation × Observation) : 0 ≤ F.commonConditionalWeight s z := by /- Split on positive carrier fiber mass and on fiber membership; use div_nonneg in the positive branch and the fallback Kronecker mass in the null branch. -/ classical by_cases hs : 0 < F.fiberCarrierMass s · simp only [commonConditionalWeight, hs, if_pos] split_ifs · exact div_nonneg (F.carrierWeight_nonneg z) (le_of_lt hs) · exact le_rfl · simp only [commonConditionalWeight, hs, if_false] split_ifs <;> norm_num
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.commonConditionalWeight_nonneg · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:108
  • commonConditionalWeight_sum theorem — Factorization-induced common conditional weights sum to one on every fiber.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    shared
    s :
    Statistic
    ∑ z, F.commonConditionalWeight s z = 1
    Proof (Lean source)
    theorem commonConditionalWeight_sum (s : Statistic) : ∑ z, F.commonConditionalWeight s z = 1 := by /- On a positive carrier fiber, the numerator sum is fiberCarrierMass and division cancels. On a null fiber, sum the fallback point mass. -/ classical by_cases hs : 0 < F.fiberCarrierMass s · simp only [commonConditionalWeight, hs, if_pos] simp_rw [div_eq_mul_inv] have hfactor (z : Allocation × Observation) : (if E.sampleStatistic z = s then F.carrierWeight z * (F.fiberCarrierMass s)⁻¹ else 0) = (if E.sampleStatistic z = s then F.carrierWeight z else 0) * (F.fiberCarrierMass s)⁻¹ := by split_ifs <;> simp simp_rw [hfactor] rw [← Finset.sum_mul, show (∑ z : Allocation × Observation, if E.sampleStatistic z = s then F.carrierWeight z else 0) = F.fiberCarrierMass s from rfl] exact mul_inv_cancel₀ (ne_of_gt hs) · simp [commonConditionalWeight, hs]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.SufficientFactorization.commonConditionalWeight_sum · Causalean/Stat/FiniteRaoBlackwell/Sufficiency.lean:123
Posterior 6 core · 9 supporting This module mixes a finite latent-state prior with the statistic law of a FiniteUniformExperiment. ★ posterior_disintegrate_sum

Finite prior joint laws and guarded posterior kernels

This module mixes a finite latent-state prior with the statistic law of a FiniteUniformExperiment. It defines the resulting state--statistic joint mass, statistic marginal, and guarded posterior law of the latent state given the statistic. On a null statistic fiber the posterior is totalized by the original prior, which preserves normalization and does not affect disintegration.

def priorJointStatisticMass reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a finite prior design on latent states, a latent state, and a statistic value, the prior joint state--statistic mass is the prior probability of the state multiplied by that state's statistic mass at the specified value.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
prior :
θ :
Latent
s :
Statistic
priorJointStatisticMass E prior θ s :
prior.p θ * E.statisticMass θ s
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorJointStatisticMass · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:27 · uses FiniteDesign , FiniteUniformExperiment
def priorStatisticMass reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a finite prior design on latent states, and a statistic value, the prior-predictive statistic mass is the sum of the prior joint state--statistic masses over all latent states.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
prior :
s :
Statistic
priorStatisticMass E prior s :
∑ θ, E.priorJointStatisticMass prior θ s
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorStatisticMass · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:48 · uses FiniteDesign , FiniteUniformExperiment
def posteriorWeight reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a finite prior design on latent states, a statistic value, and a latent state, the guarded posterior weight is the prior joint state--statistic mass divided by the prior-predictive statistic mass when the latter is positive, and is the original prior probability of the state when it is zero.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
prior :
s :
Statistic
θ :
Latent
posteriorWeight E prior s θ :
if 0 < E.priorStatisticMass prior s then E.priorJointStatisticMass prior θ s / E.priorStatisticMass prior s else prior.p θ
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorWeight · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:68 · uses FiniteDesign , FiniteUniformExperiment
def posteriorDesign reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a finite prior design on latent states, and a statistic value, the guarded posterior design is the finite probability design on latent states whose probabilities are the guarded posterior weights.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
prior :
s :
Statistic
posteriorDesign E prior s :
clause 1
p := E.posteriorWeight prior s
clause 2
p_nonneg := E.posteriorWeight_nonneg prior s
clause 3
p_sum := E.posteriorWeight_sum prior s
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorDesign · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:141 · uses FiniteDesign , FiniteUniformExperiment
def priorStatisticDesign reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment and a finite prior design on latent states, the prior-predictive statistic design is the finite probability design whose probabilities are the prior-predictive statistic masses.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
prior :
priorStatisticDesign E prior :
FiniteDesign Statistic
clause 1
p := E.priorStatisticMass prior
clause 2
p_nonneg := E.priorStatisticMass_nonneg prior
clause 3
p_sum := E.priorStatisticMass_sum prior
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorStatisticDesign · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:148 · uses FiniteDesign , FiniteUniformExperiment
theorem posterior_disintegrate_sum reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

Every real test function of latent state and statistic has the same prior-joint expectation as prior-predictive statistic expectation of posterior conditional expectation; null fibers contribute exactly zero.

Formal statement
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
prior :
f :
Latent → Statistic → ℝ
∑ θ, ∑ s, E.priorJointStatisticMass prior θ s * f θ s
= ∑ s, E.priorStatisticMass prior s * (∑ θ, E.posteriorWeight prior s θ * f θ s)
Proof (Lean source)
theorem posterior_disintegrate_sum (prior : FiniteDesign Latent) (f : Latent → Statistic → ℝ) : ∑ θ, ∑ s, E.priorJointStatisticMass prior θ s * f θ s = ∑ s, E.priorStatisticMass prior s * (∑ θ, E.posteriorWeight prior s θ * f θ s) := by /- Distribute the outer marginal through each inner sum, apply the atomwise posterior factorization, and swap the two finite sums. -/ classical simp_rw [Finset.mul_sum, ← mul_assoc, E.priorStatisticMass_mul_posteriorWeight prior] rw [Finset.sum_comm]
9 supporting declarations (lemmas, instances)
  • priorJointStatisticMass_nonneg theorem — Every prior state--statistic joint mass is nonnegative.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    θ :
    Latent
    s :
    Statistic
    0 ≤ E.priorJointStatisticMass prior θ s
    Proof (Lean source)
    theorem priorJointStatisticMass_nonneg (prior : FiniteDesign Latent) (θ : Latent) (s : Statistic) : 0 ≤ E.priorJointStatisticMass prior θ s := by /- Multiply prior and statewise-statistic nonnegativity. -/ exact mul_nonneg (prior.p_nonneg θ) (E.statisticMass_nonneg θ s)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorJointStatisticMass_nonneg · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:32
  • priorJointStatisticMass_sum theorem — The prior state--statistic joint masses sum to one.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    ∑ p : Latent × Statistic, E.priorJointStatisticMass prior p.1 p.2 = 1
    Proof (Lean source)
    theorem priorJointStatisticMass_sum (prior : FiniteDesign Latent) : ∑ p : Latent × Statistic, E.priorJointStatisticMass prior p.1 p.2 = 1 := by /- Expand the product sum, use statisticMass_sum at each state, then prior.p_sum. -/ classical rw [Fintype.sum_prod_type] simp_rw [priorJointStatisticMass, ← Finset.mul_sum, E.statisticMass_sum, mul_one] exact prior.p_sum
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorJointStatisticMass_sum · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:39
  • priorStatisticMass_nonneg theorem — Every prior-predictive statistic mass is nonnegative.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    s :
    Statistic
    0 ≤ E.priorStatisticMass prior s
    Proof (Lean source)
    theorem priorStatisticMass_nonneg (prior : FiniteDesign Latent) (s : Statistic) : 0 ≤ E.priorStatisticMass prior s := by /- Sum the nonnegative prior joint atoms over latent states. -/ classical exact sum_nonneg fun θ _ => E.priorJointStatisticMass_nonneg prior θ s
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorStatisticMass_nonneg · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:52
  • priorStatisticMass_sum theorem — The prior-predictive statistic masses sum to one.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    ∑ s, E.priorStatisticMass prior s = 1
    Proof (Lean source)
    theorem priorStatisticMass_sum (prior : FiniteDesign Latent) : ∑ s, E.priorStatisticMass prior s = 1 := by /- Swap the statistic/state sums and reuse the joint normalization calculation. -/ classical simp_rw [priorStatisticMass] rw [Finset.sum_comm] simpa only [Fintype.sum_prod_type] using E.priorJointStatisticMass_sum prior
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorStatisticMass_sum · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:59
  • posteriorWeight_of_pos theorem — On a positive prior-predictive fiber, the guarded posterior is the usual Bayes ratio.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    s :
    Statistic
    h :
    0 < E.priorStatisticMass prior s
    θ :
    Latent
    E.posteriorWeight prior s θ
    = E.priorJointStatisticMass prior θ s / E.priorStatisticMass prior s
    Proof (Lean source)
    theorem posteriorWeight_of_pos (prior : FiniteDesign Latent) {s : Statistic} (h : 0 < E.priorStatisticMass prior s) (θ : Latent) : E.posteriorWeight prior s θ = E.priorJointStatisticMass prior θ s / E.priorStatisticMass prior s := by /- Unfold posteriorWeight and simplify the positive guard. -/ simp [posteriorWeight, h]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorWeight_of_pos · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:75
  • posteriorWeight_of_eq_zero theorem — On a null prior-predictive fiber, the guarded posterior is the original prior.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    s :
    Statistic
    h :
    E.priorStatisticMass prior s = 0
    θ :
    Latent
    E.posteriorWeight prior s θ = prior.p θ
    Proof (Lean source)
    theorem posteriorWeight_of_eq_zero (prior : FiniteDesign Latent) {s : Statistic} (h : E.priorStatisticMass prior s = 0) (θ : Latent) : E.posteriorWeight prior s θ = prior.p θ := by /- Unfold posteriorWeight; nonnegativity plus zero mass rules out the positive guard. -/ simp [posteriorWeight, h]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorWeight_of_eq_zero · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:83
  • posteriorWeight_nonneg theorem — Every guarded posterior weight is nonnegative.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    s :
    Statistic
    θ :
    Latent
    0 ≤ E.posteriorWeight prior s θ
    Proof (Lean source)
    theorem posteriorWeight_nonneg (prior : FiniteDesign Latent) (s : Statistic) (θ : Latent) : 0 ≤ E.posteriorWeight prior s θ := by /- Split on positive priorStatisticMass; use div_nonneg or prior.p_nonneg. -/ classical by_cases h : 0 < E.priorStatisticMass prior s · rw [E.posteriorWeight_of_pos prior h] exact div_nonneg (E.priorJointStatisticMass_nonneg prior θ s) (le_of_lt h) · have hs : E.priorStatisticMass prior s = 0 := le_antisymm (le_of_not_gt h) (E.priorStatisticMass_nonneg prior s) rw [E.posteriorWeight_of_eq_zero prior hs] exact prior.p_nonneg θ
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorWeight_nonneg · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:90
  • posteriorWeight_sum theorem — Guarded posterior weights sum to one on positive and null prior-predictive fibers.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    s :
    Statistic
    ∑ θ, E.posteriorWeight prior s θ = 1
    Proof (Lean source)
    theorem posteriorWeight_sum (prior : FiniteDesign Latent) (s : Statistic) : ∑ θ, E.posteriorWeight prior s θ = 1 := by /- Positive fibers divide the defining marginal sum by itself; null fibers use prior.p_sum. -/ classical by_cases h : 0 < E.priorStatisticMass prior s · simp_rw [E.posteriorWeight_of_pos prior h, div_eq_mul_inv] rw [← Finset.sum_mul, show (∑ θ, E.priorJointStatisticMass prior θ s) = E.priorStatisticMass prior s from rfl] exact mul_inv_cancel₀ (ne_of_gt h) · have hs : E.priorStatisticMass prior s = 0 := le_antisymm (le_of_not_gt h) (E.priorStatisticMass_nonneg prior s) simp [E.posteriorWeight_of_eq_zero prior hs, prior.p_sum]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorWeight_sum · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:104
  • priorStatisticMass_mul_posteriorWeight theorem — Multiplying the statistic marginal by its guarded posterior weight recovers each state--statistic joint atom, including on null fibers.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    s :
    Statistic
    θ :
    Latent
    E.priorStatisticMass prior s * E.posteriorWeight prior s θ
    = E.priorJointStatisticMass prior θ s
    Proof (Lean source)
    theorem priorStatisticMass_mul_posteriorWeight (prior : FiniteDesign Latent) (s : Statistic) (θ : Latent) : E.priorStatisticMass prior s * E.posteriorWeight prior s θ = E.priorJointStatisticMass prior θ s := by /- Positive mass is cancellation. If the marginal is zero, nonnegativity of every joint summand forces the selected joint atom to vanish. -/ classical by_cases h : 0 < E.priorStatisticMass prior s · rw [E.posteriorWeight_of_pos prior h] exact mul_div_cancel₀ _ (ne_of_gt h) · have hs : E.priorStatisticMass prior s = 0 := le_antisymm (le_of_not_gt h) (E.priorStatisticMass_nonneg prior s) rw [hs, zero_mul] have hsum : (∑ θ', E.priorJointStatisticMass prior θ' s) = 0 := by simpa [priorStatisticMass] using hs have hterm := (Finset.sum_eq_zero_iff_of_nonneg (fun θ' _ => E.priorJointStatisticMass_nonneg prior θ' s)).mp hsum θ (Finset.mem_univ θ) exact hterm.symm
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorStatisticMass_mul_posteriorWeight · Causalean/Stat/FiniteRaoBlackwell/Posterior.lean:119
Rao­Blackwell 6 core · 15 supporting This module averages a real estimator over the guarded conditional design from Core and proves finite Jensen and squared-risk contraction. ★ statisticRisk_raoBlackwellEstimator_le_fullRisk

Finite Rao--Blackwell reduction for squared loss

This module averages a real estimator over the guarded conditional design from Core and proves finite Jensen and squared-risk contraction. The state-indexed conditional mean is retained as an analytic fiberwise device. The usable Rao--Blackwell estimator is a single statistic-only function constructed from a sufficient factorization, and it yields statewise, finite-prior, worst-case, and minimax-compatible corollaries.

def conditionalMean reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a real-valued full-data estimator, a latent state, and a statistic value, the conditional mean is the estimator's finite expectation under the guarded conditional design given that state and statistic value.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
est :
Allocation × Observation → ℝ
θ :
Latent
s :
Statistic
conditionalMean E est θ s :
∑ z, E.conditionalWeight θ s z * est z
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalMean · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:31 · uses FiniteUniformExperiment
def fullRisk reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a real-valued target indexed by latent state, a real-valued full-data estimator, and a latent state, the full-data squared-error risk is the joint expected value of the estimator's squared error relative to the target at that state.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
target :
Latent → ℝ
est :
Allocation × Observation → ℝ
θ :
Latent
fullRisk E target est θ :
∑ z, E.jointMass θ z * (est z - target θ) ^ 2
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.fullRisk · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:44 · uses FiniteUniformExperiment
def statisticRisk reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a real-valued target indexed by latent state, a real-valued statistic-only estimator, and a latent state, the statistic-only squared-error risk is the joint expected squared error after applying the estimator to the sample statistic.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
target :
Latent → ℝ
est :
Statistic → ℝ
θ :
Latent
statisticRisk E target est θ :
∑ z, E.jointMass θ z * (est (E.sampleStatistic z) - target θ) ^ 2
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticRisk · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:49 · uses FiniteUniformExperiment
def commonRaoBlackwellEstimator reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a common conditional kernel, and a real-valued full-data estimator, the common Rao--Blackwell estimator assigns to each statistic value the finite weighted average of the full-data estimator under that kernel.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
K :
E.CommonConditionalKernel
est :
Allocation × Observation → ℝ
commonRaoBlackwellEstimator E K est :
Statistic → ℝ
fun s ↦ ∑ z, K.weight s z * est z
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.commonRaoBlackwellEstimator · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:114 · uses FiniteUniformExperiment , CommonConditionalKernel
def raoBlackwellEstimator reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

For a finite uniform-allocation experiment, a sufficient factorization, and a real-valued full-data estimator, the Rao--Blackwell estimator is the statistic-only estimator obtained by averaging the full-data estimator with the factorization's derived common conditional law.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
F :
E.SufficientFactorization
est :
Allocation × Observation → ℝ
raoBlackwellEstimator E F est :
Statistic → ℝ
E.commonRaoBlackwellEstimator F.toCommonConditionalKernel est
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.raoBlackwellEstimator · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:228 · uses FiniteUniformExperiment , SufficientFactorization
theorem statisticRisk_raoBlackwellEstimator_le_fullRisk reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

A sufficient factorization produces one statistic-only Rao--Blackwell estimator whose squared-error risk is no larger than the full-data estimator at every latent state.

Formal statement
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
F :
E.SufficientFactorization
target :
Latent → ℝ
est :
Allocation × Observation → ℝ
θ :
Latent
E.statisticRisk target (E.raoBlackwellEstimator F est) θ ≤ E.fullRisk target est θ
Proof (Lean source)
theorem statisticRisk_raoBlackwellEstimator_le_fullRisk (F : E.SufficientFactorization) (target : Latent → ℝ) (est : Allocation × Observation → ℝ) (θ : Latent) : E.statisticRisk target (E.raoBlackwellEstimator F est) θ ≤ E.fullRisk target est θ := by exact E.statisticRisk_commonRaoBlackwellEstimator_le_fullRisk F.toCommonConditionalKernel target est θ
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticRisk_raoBlackwellEstimator_le_fullRisk · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:242 · uses FiniteUniformExperiment , SufficientFactorization , fullRisk , raoBlackwellEstimator , statisticRisk
15 supporting declarations (lemmas, instances)
  • measurable_conditionalMean theorem — On a finite statistic space, the state-indexed conditional mean is measurable for the discrete sigma algebra.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    MeasurableSpace Statistic
    est :
    Allocation × Observation → ℝ
    θ :
    Latent
    Measurable (E.conditionalMean est θ)
    Proof (Lean source)
    theorem measurable_conditionalMean [MeasurableSpace Statistic] [MeasurableSingletonClass Statistic] (est : Allocation × Observation → ℝ) (θ : Latent) : Measurable (E.conditionalMean est θ) := by exact measurable_of_finite _
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.measurable_conditionalMean · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:36
  • fullRisk_nonneg theorem — Full-data squared-error risk is nonnegative at every latent state.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    target :
    Latent → ℝ
    est :
    Allocation × Observation → ℝ
    θ :
    Latent
    0 ≤ E.fullRisk target est θ
    Proof (Lean source)
    theorem fullRisk_nonneg (target : Latent → ℝ) (est : Allocation × Observation → ℝ) (θ : Latent) : 0 ≤ E.fullRisk target est θ := by exact sum_nonneg fun z _ ↦ mul_nonneg (E.jointMass_nonneg θ z) (sq_nonneg _)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.fullRisk_nonneg · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:54
  • statisticRisk_nonneg theorem — Statistic-only squared-error risk is nonnegative at every latent state.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    target :
    Latent → ℝ
    est :
    Statistic → ℝ
    θ :
    Latent
    0 ≤ E.statisticRisk target est θ
    Proof (Lean source)
    theorem statisticRisk_nonneg (target : Latent → ℝ) (est : Statistic → ℝ) (θ : Latent) : 0 ≤ E.statisticRisk target est θ := by exact sum_nonneg fun z _ ↦ mul_nonneg (E.jointMass_nonneg θ z) (sq_nonneg _)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticRisk_nonneg · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:61
  • conditionalMean_sq_le theorem — Conditional Jensen for squared loss: the squared error of the conditional mean is at most the conditional mean squared error on every guarded fiber.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    target :
    est :
    Allocation × Observation → ℝ
    θ :
    Latent
    s :
    Statistic
    (E.conditionalMean est θ s - target) ^ 2
    ≤ ∑ z, E.conditionalWeight θ s z * (est z - target) ^ 2
    Proof (Lean source)
    theorem conditionalMean_sq_le (target : ℝ) (est : Allocation × Observation → ℝ) (θ : Latent) (s : Statistic) : (E.conditionalMean est θ s - target) ^ 2 ≤ ∑ z, E.conditionalWeight θ s z * (est z - target) ^ 2 := by /- Apply ConvexOn.map_sum_le to x ↦ x^2 with the conditional weights. Linearity and conditionalWeight_sum identify the weighted centered mean with conditionalMean - target. -/ classical have hJ := (Even.convexOn_pow (by norm_num : Even (2 : ℕ)) : ConvexOnuniv (fun x : ℝ ↦ x ^ 2)).map_sum_le (t := univ) (w := fun z ↦ E.conditionalWeight θ s z) (p := fun z ↦ est z - target) (fun z _ ↦ E.conditionalWeight_nonneg θ s z) (by simpa using E.conditionalWeight_sum θ s) (fun _ _ ↦ Set.mem_univ _) have hcenter : (∑ z, E.conditionalWeight θ s z • (est z - target)) = E.conditionalMean est θ s - target := by simp only [smul_eq_mul, mul_sub, Finset.sum_sub_distrib, conditionalMean, ← Finset.sum_mul, E.conditionalWeight_sum, one_mul] rw [hcenter] at hJ simpa only [smul_eq_mul] using hJ
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalMean_sq_le · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:68
  • statisticRisk_conditionalMean_le_fullRisk theorem — At any fixed state, composing that state's conditional mean with the statistic has no larger squared-error risk than the original estimator. This is a fiberwise analytic inequality; the conditional mean in this statement is not asserted to be one estimator shared across states.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    target :
    Latent → ℝ
    est :
    Allocation × Observation → ℝ
    θ :
    Latent
    E.statisticRisk target (E.conditionalMean est θ) θ ≤ E.fullRisk target est θ
    Proof (Lean source)
    theorem statisticRisk_conditionalMean_le_fullRisk (target : Latent → ℝ) (est : Allocation × Observation → ℝ) (θ : Latent) : E.statisticRisk target (E.conditionalMean est θ) θ ≤ E.fullRisk target est θ := by /- Rewrite both risks through disintegrate_sum and sum conditionalMean_sq_le with the nonnegative statistic masses. -/ classical have hstat : E.statisticRisk target (E.conditionalMean est θ) θ = ∑ s, E.statisticMass θ s * (E.conditionalMean est θ s - target θ) ^ 2 := by simp only [statisticRisk, statisticMass, Finset.sum_mul] rw [Finset.sum_comm] simp rw [hstat, fullRisk, E.disintegrate_sum] exact Finset.sum_le_sum fun s _ ↦ mul_le_mul_of_nonneg_left (E.conditionalMean_sq_le (target θ) est θ s) (E.statisticMass_nonneg θ s)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticRisk_conditionalMean_le_fullRisk · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:92
  • conditionalMean_eq_commonRaoBlackwellEstimator theorem — On every positive statewise fiber, the state-indexed conditional mean equals the common Rao--Blackwell estimator supplied by the sufficient conditional kernel.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    K :
    E.CommonConditionalKernel
    est :
    Allocation × Observation → ℝ
    θ :
    Latent
    s :
    Statistic
    hpos :
    0 < E.statisticMass θ s
    E.conditionalMean est θ s = E.commonRaoBlackwellEstimator K est s
    Proof (Lean source)
    theorem conditionalMean_eq_commonRaoBlackwellEstimator (K : E.CommonConditionalKernel) (est : Allocation × Observation → ℝ) (θ : Latent) (s : Statistic) (hpos : 0 < E.statisticMass θ s) : E.conditionalMean est θ s = E.commonRaoBlackwellEstimator K est s := by apply Finset.sum_congr rfl intro z _ rw [K.eq_conditionalWeight θ s hpos z]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalMean_eq_commonRaoBlackwellEstimator · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:120
  • measurable_commonRaoBlackwellEstimator theorem — On finite statistic spaces, the common Rao--Blackwell estimator is measurable for the discrete sigma algebra.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    MeasurableSpace Statistic
    K :
    E.CommonConditionalKernel
    est :
    Allocation × Observation → ℝ
    Measurable (E.commonRaoBlackwellEstimator K est)
    Proof (Lean source)
    theorem measurable_commonRaoBlackwellEstimator [MeasurableSpace Statistic] [MeasurableSingletonClass Statistic] (K : E.CommonConditionalKernel) (est : Allocation × Observation → ℝ) : Measurable (E.commonRaoBlackwellEstimator K est) := by exact measurable_of_finite _
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.measurable_commonRaoBlackwellEstimator · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:131
  • statisticRisk_commonRaoBlackwellEstimator_le_fullRisk theorem — A common sufficient conditional kernel produces one statistic-only Rao--Blackwell estimator whose squared-error risk is no larger at every latent state.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    K :
    E.CommonConditionalKernel
    target :
    Latent → ℝ
    est :
    Allocation × Observation → ℝ
    θ :
    Latent
    E.statisticRisk target (E.commonRaoBlackwellEstimator K est) θ ≤ E.fullRisk target est θ
    Proof (Lean source)
    theorem statisticRisk_commonRaoBlackwellEstimator_le_fullRisk (K : E.CommonConditionalKernel) (target : Latent → ℝ) (est : Allocation × Observation → ℝ) (θ : Latent) : E.statisticRisk target (E.commonRaoBlackwellEstimator K est) θ ≤ E.fullRisk target est θ := by /- Apply the state-indexed contraction on positive statistic fibers. Null fibers vanish after multiplication by statisticMass, so no cross-state support assumption is needed. -/ classical have hrb : E.statisticRisk target (E.commonRaoBlackwellEstimator K est) θ = ∑ s, E.statisticMass θ s * (E.commonRaoBlackwellEstimator K est s - target θ) ^ 2 := by simp only [statisticRisk, statisticMass, Finset.sum_mul] rw [Finset.sum_comm] simp have hcm : E.statisticRisk target (E.conditionalMean est θ) θ = ∑ s, E.statisticMass θ s * (E.conditionalMean est θ s - target θ) ^ 2 := by simp only [statisticRisk, statisticMass, Finset.sum_mul] rw [Finset.sum_comm] simp have heq : E.statisticRisk target (E.commonRaoBlackwellEstimator K est) θ = E.statisticRisk target (E.conditionalMean est θ) θ := by rw [hrb, hcm] apply Finset.sum_congr rfl intro s _ by_cases hpos : 0 < E.statisticMass θ s · rw [E.conditionalMean_eq_commonRaoBlackwellEstimator K est θ s hpos] · have hzero : E.statisticMass θ s = 0 := le_antisymm (le_of_not_gt hpos) (E.statisticMass_nonneg θ s) simp [hzero] rw [heq] exact E.statisticRisk_conditionalMean_le_fullRisk target est θ
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticRisk_commonRaoBlackwellEstimator_le_fullRisk · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:139
  • priorRisk_commonRaoBlackwellEstimator_le theorem — Under any finite prior on latent states, the common Rao--Blackwell estimator has no larger prior-averaged squared-error risk than the original estimator.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    K :
    E.CommonConditionalKernel
    prior :
    target :
    Latent → ℝ
    est :
    Allocation × Observation → ℝ
    prior.E (E.statisticRisk target (E.commonRaoBlackwellEstimator K est))
    ≤ prior.E (E.fullRisk target est)
    Proof (Lean source)
    theorem priorRisk_commonRaoBlackwellEstimator_le (K : E.CommonConditionalKernel) (prior : FiniteDesign Latent) (target : Latent → ℝ) (est : Allocation × Observation → ℝ) : prior.E (E.statisticRisk target (E.commonRaoBlackwellEstimator K est)) ≤ prior.E (E.fullRisk target est) := by /- Sum the statewise contraction against the nonnegative prior weights. -/ exact Finset.sum_le_sum fun θ _ ↦ mul_le_mul_of_nonneg_left (E.statisticRisk_commonRaoBlackwellEstimator_le_fullRisk K target est θ) (prior.p_nonneg θ)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorRisk_commonRaoBlackwellEstimator_le · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:177
  • worstCaseRisk_commonRaoBlackwellEstimator_le theorem — Under state-independent conditional laws, Rao--Blackwellization weakly decreases the finite worst-case squared risk, in the real-valued worstCaseRisk API.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    K :
    E.CommonConditionalKernel
    target :
    Latent → ℝ
    est :
    Allocation × Observation → ℝ
    worstCaseRisk (E.statisticRisk target) (E.commonRaoBlackwellEstimator K est)
    worstCaseRisk (E.fullRisk target) est
    Proof (Lean source)
    theorem worstCaseRisk_commonRaoBlackwellEstimator_le (K : E.CommonConditionalKernel) (target : Latent → ℝ) (est : Allocation × Observation → ℝ) : worstCaseRisk (E.statisticRisk target) (E.commonRaoBlackwellEstimator K est) ≤ worstCaseRisk (E.fullRisk target) est := by /- Finite state spaces bound both risk ranges. Apply worstCaseRisk_le to the statewise contraction followed by le_worstCaseRisk for the full estimator. -/ cases isEmpty_or_nonempty Latent with | inl _ => simp only [worstCaseRisk_of_isEmpty_class] exact le_rfl | inr _ => apply worstCaseRisk_le intro θ exact (E.statisticRisk_commonRaoBlackwellEstimator_le_fullRisk K target est θ).trans (le_worstCaseRisk (Set.finite_range _ |>.bddAbove) θ)
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.worstCaseRisk_commonRaoBlackwellEstimator_le · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:191
  • minimaxValue_statistic_le_full_of_commonConditionalKernel theorem — If every full-data estimator is Rao--Blackwellized through state-independent conditionals, the minimax value over statistic-only estimators is no larger than the full-data minimax value.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    K :
    E.CommonConditionalKernel
    target :
    Latent → ℝ
    minimaxValue (E.statisticRisk target)
    minimaxValue (E.fullRisk target)
    Proof (Lean source)
    theorem minimaxValue_statistic_le_full_of_commonConditionalKernel (K : E.CommonConditionalKernel) (target : Latent → ℝ) : minimaxValue (E.statisticRisk target) ≤ minimaxValue (E.fullRisk target) := by /- Use minimaxValue_le_minimaxValue, pairing each full estimator with its common raoBlackwellEstimator. Nonnegativity supplies the lower bound for statistic risks. -/ apply minimaxValue_le_minimaxValue (bddBelow_range_worstCaseRisk fun est θ ↦ E.statisticRisk_nonneg target est θ) intro est exact ⟨E.commonRaoBlackwellEstimator K est, E.worstCaseRisk_commonRaoBlackwellEstimator_le K target est⟩
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.minimaxValue_statistic_le_full_of_commonConditionalKernel · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:211
  • measurable_raoBlackwellEstimator theorem — The factorization-based Rao--Blackwell estimator is measurable on a finite discrete statistic space.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    MeasurableSpace Statistic
    F :
    E.SufficientFactorization
    est :
    Allocation × Observation → ℝ
    Measurable (E.raoBlackwellEstimator F est)
    Proof (Lean source)
    theorem measurable_raoBlackwellEstimator [MeasurableSpace Statistic] [MeasurableSingletonClass Statistic] (F : E.SufficientFactorization) (est : Allocation × Observation → ℝ) : Measurable (E.raoBlackwellEstimator F est) := by exact E.measurable_commonRaoBlackwellEstimator F.toCommonConditionalKernel est
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.measurable_raoBlackwellEstimator · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:234
  • priorRisk_raoBlackwellEstimator_le theorem — Under any finite prior, the one statistic-only estimator derived from a sufficient factorization has no larger prior-averaged squared-error risk than the full-data estimator.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    prior :
    target :
    Latent → ℝ
    est :
    Allocation × Observation → ℝ
    prior.E (E.statisticRisk target (E.raoBlackwellEstimator F est))
    ≤ prior.E (E.fullRisk target est)
    Proof (Lean source)
    theorem priorRisk_raoBlackwellEstimator_le (F : E.SufficientFactorization) (prior : FiniteDesign Latent) (target : Latent → ℝ) (est : Allocation × Observation → ℝ) : prior.E (E.statisticRisk target (E.raoBlackwellEstimator F est)) ≤ prior.E (E.fullRisk target est) := by exact E.priorRisk_commonRaoBlackwellEstimator_le F.toCommonConditionalKernel prior target est
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.priorRisk_raoBlackwellEstimator_le · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:252
  • worstCaseRisk_raoBlackwellEstimator_le theorem — Under a sufficient factorization, the one statistic-only Rao--Blackwell estimator has no larger finite worst-case squared risk than the full-data estimator.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    target :
    Latent → ℝ
    est :
    Allocation × Observation → ℝ
    worstCaseRisk (E.statisticRisk target) (E.raoBlackwellEstimator F est)
    worstCaseRisk (E.fullRisk target) est
    Proof (Lean source)
    theorem worstCaseRisk_raoBlackwellEstimator_le (F : E.SufficientFactorization) (target : Latent → ℝ) (est : Allocation × Observation → ℝ) : worstCaseRisk (E.statisticRisk target) (E.raoBlackwellEstimator F est) ≤ worstCaseRisk (E.fullRisk target) est := by exact E.worstCaseRisk_commonRaoBlackwellEstimator_le F.toCommonConditionalKernel target est
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.worstCaseRisk_raoBlackwellEstimator_le · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:263
  • minimaxValue_statistic_le_full theorem — If the statistic satisfies the finite factorization criterion, its estimator class has minimax squared-risk value no larger than the full-data estimator class.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    target :
    Latent → ℝ
    minimaxValue (E.statisticRisk target)
    minimaxValue (E.fullRisk target)
    Proof (Lean source)
    theorem minimaxValue_statistic_le_full (F : E.SufficientFactorization) (target : Latent → ℝ) : minimaxValue (E.statisticRisk target) ≤ minimaxValue (E.fullRisk target) := by exact E.minimaxValue_statistic_le_full_of_commonConditionalKernel F.toCommonConditionalKernel target
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.minimaxValue_statistic_le_full · Causalean/Stat/FiniteRaoBlackwell/RaoBlackwell.lean:273
Design­Pushforward 5 core · 14 supporting This module develops finite conditional expectation along an arbitrary deterministic coarsening of a finite randomization design. ★ E_map_conditionalMeanAlongMap_sq_le

Conditional means along finite-design pushforwards

This module develops finite conditional expectation along an arbitrary deterministic coarsening of a finite randomization design. Fibers of zero design mass are totalized by a caller-supplied default, while exact disintegration, interval preservation, and squared-loss Rao--Blackwell contraction remain valid without uniformity, independence, surjectivity, or full support.

def fiberMass reviewed
Causalean.Stat.FiniteRaoBlackwell

For a finite probability design on source points, a deterministic coarsening map, and a coarsened value, the fiber mass is the total design probability of source points mapped to that value.

Definition (Lean source)
Ω :
Type u_1
shared
B :
Type u_2
shared
D :
φ :
Ω → B
b :
B
fiberMass D φ b :
by classical exact ∑ ω, if φ ω = b then D.p ω else 0
Causalean.Stat.FiniteRaoBlackwell.fiberMass · Causalean/Stat/FiniteRaoBlackwell/DesignPushforward.lean:23 · uses FiniteDesign
def fiberNumerator reviewed
Causalean.Stat.FiniteRaoBlackwell

For a finite probability design on source points, a deterministic coarsening map, a real-valued source function indexed by values, a coarsened value, and an index value, the fiber numerator is the sum of the design probability times the source-function value over source points mapped to that coarsened value.

Definition (Lean source)
Ω :
Type u_1
shared
B :
Type u_2
shared
V :
Type u_3
shared
D :
φ :
Ω → B
h :
Ω → V → ℝ
b :
B
v :
V
fiberNumerator D φ h b v :
by classical exact ∑ ω, if φ ω = b then D.p ω * h ω v else 0
Causalean.Stat.FiniteRaoBlackwell.fiberNumerator · Causalean/Stat/FiniteRaoBlackwell/DesignPushforward.lean:48 · uses FiniteDesign
def conditionalFiberWeight reviewed
Causalean.Stat.FiniteRaoBlackwell

For a finite probability design on source points, a deterministic coarsening map, a coarsened value, and a source point, the conditional fiber weight is its design probability divided by the fiber mass when that mass is nonzero and the point maps to the value, and zero otherwise.

Definition (Lean source)
Ω :
Type u_1
shared
B :
Type u_2
shared
D :
φ :
Ω → B
b :
B
ω :
Ω
conditionalFiberWeight D φ b ω :
by classical exact if fiberMass D φ b
= 0 then 0 else if φ ω = b then D.p ω / fiberMass D φ b else 0
Causalean.Stat.FiniteRaoBlackwell.conditionalFiberWeight · Causalean/Stat/FiniteRaoBlackwell/DesignPushforward.lean:55 · uses FiniteDesign
def conditionalMeanAlongMap reviewed
Causalean.Stat.FiniteRaoBlackwell

For a finite probability design on source points, a deterministic coarsening map, a real-valued default, a real-valued source function indexed by values, a coarsened value, and an index value, the conditional mean along the map is the design-weighted fiber mean when the fiber has nonzero mass and the supplied default when it has zero mass.

Definition (Lean source)
Ω :
Type u_1
shared
B :
Type u_2
shared
V :
Type u_3
shared
D :
φ :
Ω → B
d :
h :
Ω → V → ℝ
b :
B
v :
V
conditionalMeanAlongMap D φ d h b v :
if fiberMass D φ b = 0 then d else fiberNumerator D φ h b v / fiberMass D φ b
Causalean.Stat.FiniteRaoBlackwell.conditionalMeanAlongMap · Causalean/Stat/FiniteRaoBlackwell/DesignPushforward.lean:122 · uses FiniteDesign
theorem E_map_conditionalMeanAlongMap_sq_le reviewed
Causalean.Stat.FiniteRaoBlackwell

Conditioning over the fibers of any deterministic pushforward weakly contracts covariate-parametric squared loss under an arbitrary finite design.

Formal statement
Ω :
Type u_1
shared
B :
Type u_2
shared
V :
Type u_3
shared
D :
φ :
Ω → B
d :
h :
Ω → V → ℝ
v :
B → V
t :
(D.map φ).E (fun b => (conditionalMeanAlongMap D φ d h b (v b) - t) ^ 2)
≤ D.E (fun ω => (h ω (v (φ ω)) - t) ^ 2)
Proof (Lean source)
theorem E_map_conditionalMeanAlongMap_sq_le (D : FiniteDesign Ω) (φ : Ω → B) (d : ℝ) (h : Ω → V → ℝ) (v : B → V) (t : ℝ) : (D.map φ).E (fun b => (conditionalMeanAlongMap D φ d h b (v b) - t) ^ 2) ≤ D.E (fun ω => (h ω (v (φ ω)) - t) ^ 2) := by classical simp only [FiniteDesign.E, ← fiberMass_eq_map_p] rw [← sum_fiberMass_mul_conditionalMeanAlongMap D φ 0 (fun ω v => (h ω v - t) ^ 2) v] apply Finset.sum_le_sum intro b _ by_cases hb : fiberMass D φ b = 0 · simp [hb] · apply mul_le_mul_of_nonneg_left _ (fiberMass_nonneg D φ b) rw [conditionalMeanAlongMap_eq_sum_conditionalFiberWeight D φ 0 (fun ω v => (h ω v - t) ^ 2) b (v b) hb] exact conditionalMeanAlongMap_sq_le D φ d h b (v b) t hb
Causalean.Stat.FiniteRaoBlackwell.E_map_conditionalMeanAlongMap_sq_le · Causalean/Stat/FiniteRaoBlackwell/DesignPushforward.lean:261 · uses FiniteDesign , E , map , conditionalMeanAlongMap
14 supporting declarations (lemmas, instances)
Kernel­Bridge 6 core · 12 supporting This module realizes the algebraic finite designs from Core as genuine Markov kernels on finite labeled measurable spaces. ★ kernelMean_conditionalKernel_eq_conditionalMean

Markov-kernel and finite-Bayes bridges

This module realizes the algebraic finite designs from Core as genuine Markov kernels on finite labeled measurable spaces. It exposes the full-data law, statistic law, and guarded conditional laws in the kernel API, including the factorization-derived common conditional law and a finite-prior posterior law of the latent state given the statistic. Singleton probabilities are identified with real finite masses, so the kernels can be passed directly to Causalean.Stat.Minimax.FiniteKernelBayes without an ENNReal loss conversion.

def fullKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

Given a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with σ-algebras on the latent, allocation, and observation spaces and measurable singleton latent states, the full-data Markov kernel assigns to each latent state the experiment's finite joint probability law of the allocation and observation at that state.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
fullKernel E :
Kernel Latent (Allocation × Observation)
Kernel.ofFunOfCountable fun θ ↦ ({ p := E.jointMass θ p_nonneg := E.jointMass_nonneg θ p_sum := E.jointMass_sum θ } : FiniteDesign (Allocation × Observation)).toMeasure
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.fullKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:37 · uses FiniteUniformExperiment
def statisticKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

Given a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with σ-algebras on the latent and statistic spaces and measurable singleton latent states, the statistic Markov kernel assigns to each latent state the experiment's finite marginal probability law of the statistic.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
statisticKernel E :
Kernel Latent Statistic
Kernel.ofFunOfCountable fun θ ↦ (E.statisticDesign θ).toMeasure
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:64 · uses FiniteUniformExperiment
def conditionalKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

Given a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with σ-algebras on the allocation, observation, and statistic spaces and measurable singleton statistic values, and a latent state, the guarded conditional Markov kernel assigns to each statistic value the experiment's conditional probability law of the allocation--observation pair at that state, using the fallback law when the statistic fiber has zero probability.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
θ :
Latent
conditionalKernel E θ :
Kernel Statistic (Allocation × Observation)
Kernel.ofFunOfCountable fun s ↦ (E.conditionalDesign θ s).toMeasure
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:79 · uses FiniteUniformExperiment
def commonConditionalMarkovKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

Given a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with σ-algebras on the allocation, observation, and statistic spaces and measurable singleton statistic values, and a sufficient factorization of its full-data masses, the common conditional Markov kernel assigns to each statistic value the factorization-induced state-independent conditional probability law of the allocation--observation pair.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
F :
E.SufficientFactorization
commonConditionalMarkovKernel E F :
Kernel Statistic (Allocation × Observation)
Kernel.ofFunOfCountable fun s ↦ ({ p := F.toCommonConditionalKernel.weight s p_nonneg := F.toCommonConditionalKernel.weight_nonneg s p_sum := F.toCommonConditionalKernel.weight_sum s } : FiniteDesign (Allocation × Observation)).toMeasure
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.commonConditionalMarkovKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:98 · uses FiniteUniformExperiment , SufficientFactorization
def posteriorKernel reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

Given a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with σ-algebras on the latent and statistic spaces and measurable singleton statistic values, and a finite prior probability distribution on latent states, the posterior Markov kernel assigns to each statistic value the guarded posterior probability law of the latent state, using the designated fallback law on prior-predictive statistic fibers of zero probability.

Definition (Lean source)
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
prior :
posteriorKernel E prior :
Kernel Statistic Latent
Kernel.ofFunOfCountable fun s ↦ (E.posteriorDesign prior s).toMeasure
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:128 · uses FiniteDesign , FiniteUniformExperiment
theorem kernelMean_conditionalKernel_eq_conditionalMean reviewed
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment

The measure-theoretic conditional-kernel mean of a full-data estimator equals the finite conditional mean, so no ENNReal conversion appears in Rao--Blackwell calculations.

Formal statement
Latent :
Type u_1
shared
Allocation :
Type u_2
shared
Observation :
Type u_3
shared
Statistic :
Type u_4
shared
E :
FiniteUniformExperiment Latent Allocation Observation Statistic
shared
est :
Allocation × Observation → ℝ
θ :
Latent
s :
Statistic
(∫ z, est z ∂(E.conditionalKernel θ) s) = E.conditionalMean est θ s
Proof (Lean source)
theorem kernelMean_conditionalKernel_eq_conditionalMean (est : Allocation × Observation → ℝ) (θ : Latent) (s : Statistic) : (∫ z, est z ∂(E.conditionalKernel θ) s) = E.conditionalMean est θ s := by /- Evaluate the finite-design integral and unfold the two finite expectations. -/ change (∫ z, est z ∂(E.conditionalDesign θ s).toMeasure) = E.conditionalMean est θ s rw [FiniteDesign.integral_toMeasure] rfl
Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.kernelMean_conditionalKernel_eq_conditionalMean · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:238 · uses FiniteUniformExperiment , conditionalKernel , conditionalMean
12 supporting declarations (lemmas, instances)
  • fullKernel_isMarkovKernel instance — For a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with distinguishable allocation, observation, and statistic values, σ-algebras on the latent, allocation, and observation spaces, and measurable singleton latent states, the full-data kernel is a Markov kernel: at every latent state, its output law is a probability measure.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    fullKernel_isMarkovKernel E :
    IsMarkovKernel E.fullKernel
    isProbabilityMeasure θ := by change IsProbabilityMeasure (({ p := E.jointMass θ p_nonneg := E.jointMass_nonneg θ p_sum := E.jointMass_sum θ } : FiniteDesign (Allocation × Observation)).toMeasure) infer_instance
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.fullKernel_isMarkovKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:49
  • statisticKernel_isMarkovKernel instance — For a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with distinguishable allocation, observation, and statistic values, σ-algebras on the latent and statistic spaces, and measurable singleton latent states, the statistic kernel is a Markov kernel: at every latent state, its output law is a probability measure.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    statisticKernel_isMarkovKernel E :
    IsMarkovKernel E.statisticKernel
    isProbabilityMeasure θ := by change IsProbabilityMeasure (E.statisticDesign θ).toMeasure infer_instance
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticKernel_isMarkovKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:70
  • conditionalKernel_isMarkovKernel instance — For a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with distinguishable allocation, observation, and statistic values, σ-algebras on the allocation, observation, and statistic spaces, and measurable singleton statistic values and a latent state, the guarded conditional kernel is a Markov kernel: at every statistic value, including a zero-probability fibre, its output law is a probability measure.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    conditionalKernel_isMarkovKernel E θ :
    IsMarkovKernel (E.conditionalKernel θ)
    isProbabilityMeasure s := by change IsProbabilityMeasure (E.conditionalDesign θ s).toMeasure infer_instance
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalKernel_isMarkovKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:87
  • commonConditionalMarkovKernel_isMarkovKernel instance — For a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with distinguishable allocation, observation, and statistic values, σ-algebras on the allocation, observation, and statistic spaces, and measurable singleton statistic values and a sufficient factorization of its full-data probability masses, the factorization-derived common conditional kernel is a Markov kernel: at every statistic value, including a zero-probability fibre, its output law is a probability measure.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    commonConditionalMarkovKernel_isMarkovKernel E F :
    IsMarkovKernel (E.commonConditionalMarkovKernel F)
    isProbabilityMeasure s := by change IsProbabilityMeasure (({ p := F.toCommonConditionalKernel.weight s p_nonneg := F.toCommonConditionalKernel.weight_nonneg s p_sum := F.toCommonConditionalKernel.weight_sum s } : FiniteDesign (Allocation × Observation)).toMeasure) infer_instance
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.commonConditionalMarkovKernel_isMarkovKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:111
  • posteriorKernel_isMarkovKernel instance — For a finite uniform experiment on finite latent, allocation, observation, and statistic spaces, with distinguishable allocation, observation, and statistic values, σ-algebras on the latent and statistic spaces, and measurable singleton statistic values and a finite prior probability distribution on latent states, the guarded posterior kernel is a Markov kernel: at every statistic value, including a prior-predictive zero-probability fibre, its output law is a probability measure.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    posteriorKernel_isMarkovKernel E prior :
    IsMarkovKernel (E.posteriorKernel prior)
    isProbabilityMeasure s := by change IsProbabilityMeasure (E.posteriorDesign prior s).toMeasure infer_instance
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorKernel_isMarkovKernel · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:135
  • fullKernel_singletonReal theorem — The real singleton probability of the full-data kernel equals the finite joint mass.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    z :
    Allocation × Observation
    (E.fullKernel θ).real {z} = E.jointMass θ z
    Proof (Lean source)
    theorem fullKernel_singletonReal (θ : Latent) (z : Allocation × Observation) : (E.fullKernel θ).real {z} = E.jointMass θ z := by change (({ p := E.jointMass θ p_nonneg := E.jointMass_nonneg θ p_sum := E.jointMass_sum θ } : FiniteDesign (Allocation × Observation)).toMeasure).real {z} = E.jointMass θ z rw [show ({z} : Set (Allocation × Observation)) = {x | x = z} by ext; simp] rw [FiniteDesign.toMeasure_real_setOf] change (∑ x, E.jointMass θ x * if x = z then 1 else 0) = E.jointMass θ z simp
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.fullKernel_singletonReal · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:147
  • statisticKernel_singletonReal theorem — The real singleton probability of the statistic kernel equals the finite statistic mass.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    (E.statisticKernel θ).real {s} = E.statisticMass θ s
    Proof (Lean source)
    theorem statisticKernel_singletonReal (θ : Latent) (s : Statistic) : (E.statisticKernel θ).real {s} = E.statisticMass θ s := by change (E.statisticDesign θ).toMeasure.real {s} = E.statisticMass θ s rw [show ({s} : Set Statistic) = {x | x = s} by ext; simp] rw [FiniteDesign.toMeasure_real_setOf] change (∑ x, E.statisticMass θ x * if x = s then 1 else 0) = E.statisticMass θ s simp
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.statisticKernel_singletonReal · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:161
  • conditionalKernel_singletonReal theorem — The real singleton probability of the guarded conditional kernel equals its finite conditional weight.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    θ :
    Latent
    s :
    Statistic
    z :
    Allocation × Observation
    (E.conditionalKernel θ s).real {z} = E.conditionalWeight θ s z
    Proof (Lean source)
    theorem conditionalKernel_singletonReal (θ : Latent) (s : Statistic) (z : Allocation × Observation) : (E.conditionalKernel θ s).real {z} = E.conditionalWeight θ s z := by change (E.conditionalDesign θ s).toMeasure.real {z} = E.conditionalWeight θ s z rw [show ({z} : Set (Allocation × Observation)) = {x | x = z} by ext; simp] rw [FiniteDesign.toMeasure_real_setOf] change (∑ x, E.conditionalWeight θ s x * if x = z then 1 else 0) = E.conditionalWeight θ s z simp
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.conditionalKernel_singletonReal · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:170
  • commonConditionalMarkovKernel_singletonReal theorem — The real singleton probability of the factorization-derived common conditional Markov kernel equals its finite common conditional weight.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    F :
    E.SufficientFactorization
    s :
    Statistic
    z :
    Allocation × Observation
    (E.commonConditionalMarkovKernel F s).real {z} = F.toCommonConditionalKernel.weight s z
    Proof (Lean source)
    theorem commonConditionalMarkovKernel_singletonReal (F : E.SufficientFactorization) (s : Statistic) (z : Allocation × Observation) : (E.commonConditionalMarkovKernel F s).real {z} = F.toCommonConditionalKernel.weight s z := by change (({ p := F.toCommonConditionalKernel.weight s p_nonneg := F.toCommonConditionalKernel.weight_nonneg s p_sum := F.toCommonConditionalKernel.weight_sum s } : FiniteDesign (Allocation × Observation)).toMeasure).real {z} = F.toCommonConditionalKernel.weight s z rw [show ({z} : Set (Allocation × Observation)) = {x | x = z} by ext; simp] rw [FiniteDesign.toMeasure_real_setOf] change (∑ x, F.toCommonConditionalKernel.weight s x * if x = z then 1 else 0) = F.toCommonConditionalKernel.weight s z simp
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.commonConditionalMarkovKernel_singletonReal · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:182
  • posteriorKernel_singletonReal theorem — The real singleton probability of the finite-prior posterior kernel equals the guarded posterior weight of that latent state.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    prior :
    s :
    Statistic
    θ :
    Latent
    (E.posteriorKernel prior s).real {θ} = E.posteriorWeight prior s θ
    Proof (Lean source)
    theorem posteriorKernel_singletonReal (prior : FiniteDesign Latent) (s : Statistic) (θ : Latent) : (E.posteriorKernel prior s).real {θ} = E.posteriorWeight prior s θ := by classical change (E.posteriorDesign prior s).toMeasure.real {θ} = E.posteriorWeight prior s θ rw [show ({θ} : Set Latent) = {x | x = θ} by ext; simp] rw [FiniteDesign.toMeasure_real_setOf] change (∑ x, E.posteriorWeight prior s x * if x = θ then 1 else 0) = E.posteriorWeight prior s θ simp
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.posteriorKernel_singletonReal · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:202
  • kernelAverageLoss_statisticKernel_eq_sum theorem — Kernel averaging through the statistic kernel is exactly the real finite sum of statistic losses weighted by their statistic masses, matching FiniteKernelBayes.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    Action :
    Type*
    loss :
    Action → Statistic → ℝ
    a :
    Action
    θ :
    Latent
    kernelAverageLoss E.statisticKernel loss a θ
    = ∑ s, E.statisticMass θ s * loss a s
    Proof (Lean source)
    theorem kernelAverageLoss_statisticKernel_eq_sum {Action : Type*} (loss : Action → Statistic → ℝ) (a : Action) (θ : Latent) : kernelAverageLoss E.statisticKernel loss a θ = ∑ s, E.statisticMass θ s * loss a s := by /- Rewrite with kernelAverageLoss_eq_sum and the singleton bridge. -/ letI : Nonempty Statistic := ⟨E.sampleStatistic E.fallbackSample⟩ rw [kernelAverageLoss_eq_sum] simp_rw [E.statisticKernel_singletonReal]
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.kernelAverageLoss_statisticKernel_eq_sum · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:215
  • kernelAverageLoss_posteriorKernel_eq_sum theorem — Kernel averaging a real latent-state loss through the finite-prior posterior kernel is exactly the finite posterior-weighted sum, matching the real FiniteKernelBayes interface.
    Latent :
    Type u_1
    shared
    Allocation :
    Type u_2
    shared
    Observation :
    Type u_3
    shared
    Statistic :
    Type u_4
    shared
    E :
    FiniteUniformExperiment Latent Allocation Observation Statistic
    shared
    Action :
    Type*
    prior :
    loss :
    Action → Latent → ℝ
    a :
    Action
    s :
    Statistic
    kernelAverageLoss (E.posteriorKernel prior) loss a s
    = ∑ θ, E.posteriorWeight prior s θ * loss a θ
    Proof (Lean source)
    theorem kernelAverageLoss_posteriorKernel_eq_sum {Action : Type*} (prior : FiniteDesign Latent) (loss : Action → Latent → ℝ) (a : Action) (s : Statistic) : kernelAverageLoss (E.posteriorKernel prior) loss a s = ∑ θ, E.posteriorWeight prior s θ * loss a θ := by change (∫ θ, loss a θ ∂(E.posteriorDesign prior s).toMeasure) = ∑ θ, E.posteriorWeight prior s θ * loss a θ rw [FiniteDesign.integral_toMeasure] rfl
    Causalean.Stat.FiniteRaoBlackwell.FiniteUniformExperiment.kernelAverageLoss_posteriorKernel_eq_sum · Causalean/Stat/FiniteRaoBlackwell/KernelBridge.lean:226