Stat

Statistical foundations: convergence modes, limit theorems, concentration inequalities, and minimax lower-bound tools.

Sample 133 core · 130 supporting · 6 submodules This file provides the library's causal-agnostic model of an independent and identically distributed sample relative to arbitrary ambient and population measures; probability-measure instances are supplied separately whe Finite­Design 20 core · 53 supporting · 6 submodules Statistical tools for finite experimental and sampling designs. Finite­Positive­Table 43 core · 50 supporting · 5 submodules This roll-up module exports graph-independent finite positive tables, their marginals and conditionals, coordinate fixing, sequential expansions, and two-row cancellation identities. Order­Statistic 44 core · 101 supporting · 8 submodules Exact distribution theory for the order statistics of n i.i.d. Polynomial­Tail 18 core · 35 supporting · 6 submodules Probability and moment bounds under polynomial-tail assumptions. Random­Graph 48 core · 42 supporting · 4 submodules This topic supplies a reusable spanning-parent union bound for expected counts of finite connected components meeting a designated root set under finite product measures. Recurrent­Event 111 core · 105 supporting · 14 submodules This directory packages a finite-horizon Poisson recurrent-event experiment with independent death and censoring. Weighted 33 core · 54 supporting · 10 submodules Weighted least squares as linear algebra: the geometry that underlies estimators built from nonuniform observation weights. Limit 30 core · 58 supporting · 11 submodules Modes of convergence for random sequences, and the calculus for manipulating them. CLT 290 core · 175 supporting · 18 submodules Central limit theory, including martingale extensions. UStatistic 81 core · 109 supporting · 5 submodules Asymptotic theory of U-statistics of fixed order m built from an i.i.d. Sample­Split 23 core · 29 supporting · 8 submodules Probabilistic facts behind estimators that fit nuisance functions on one part of an i.i.d. MEstimation 34 core · 27 supporting · 16 submodules Asymptotic theory for estimators defined by an estimating equation Pₙ ψ(θ̂) ≈ 0 or by maximizing a sample criterion. Linear­Model 67 core · 50 supporting · 3 submodules Linear-model tools for the L² Frisch–Waugh–Lovell specialization, algebraic variance orderings for least-squares weights, and robust OLS asymptotics and inference. Minimax 1 to review 381 core · 577 supporting · 37 submodules Minimax risk: the best worst-case performance any procedure can achieve over a model class, and the standard devices for lower-bounding it. Concentration 373 core · 523 supporting · 17 submodules Concentration tools for scalar, vector, matrix, Poisson, and function-class deviations, including Hoeffding, Rademacher, VC, and entropy methods. Empirical­Process 76 core · 80 supporting · 6 submodules Empirical-process foundations for uniform stochastic deviations. GMM 37 core · 23 supporting · 11 submodules Large-sample theory for GMM estimators of a finite-dimensional parameter identified by moment conditions E g(θ₀, Z) = 0 with Jacobian G, weight W and moment covariance Cov. Inference 26 core · 19 supporting · 8 submodules General tools for statistical inference. Finite­Rao­Blackwell 151 core · 187 supporting · 7 submodules Rao–Blackwell results for finite sampling designs, including Poisson designs. Moment­Problems 78 core · 77 supporting · 10 submodules The classical moment problem: which sequences of raw moments come from a probability law, and what the moments pin down about the law. Nonparametric 134 core · 153 supporting · 8 submodules Finite-sample bias, variance and risk bounds for nonparametric estimators of a regression function under Hölder smoothness. Privacy 62 core · 72 supporting · 8 submodules Differential-privacy mechanisms and their statistical guarantees. Coupling 45 core · 49 supporting · 7 submodules This module collects coupling-based statistical primitives. Quantile 96 core · 125 supporting · 18 submodules Quantiles, empirical quantiles, and their statistical properties. Bootstrap 91 core · 55 supporting · 5 submodules Validity of Efron's nonparametric bootstrap for asymptotically linear estimators.
Attainable­Set 1 core · 0 supporting This file defines the identified set of a real-valued objective as the set of values attained over its feasible parameter set; it need not be an interval. ★ IdentifiedSet

Identified sets

This file defines the identified set of a real-valued objective as the set of values attained over its feasible parameter set; it need not be an interval. The definition is shared by potential-outcome and structural-causal-model partial identification results.

def IdentifiedSet reviewed
Causalean.Stat.AttainableSet

For a parameter space, an objective function, and a feasibility condition on its parameter values, the identified set is the set of all objective values attained by feasible parameters.

Definition (Lean source)
α :
Type*
obj :
α → ℝ
feasible :
α → Prop
IdentifiedSet obj feasible :
Set ℝ
range (fun x : {x // feasible x} => obj x)
Causalean.Stat.AttainableSet.IdentifiedSet · Causalean/Stat/AttainableSet.lean:24
Conditional­Law 6 core · 14 supporting This module packages an explicitly supplied Markov kernel that disintegrates a full observation law given a real-valued dose. ★ integral_graph

Chosen conditional laws for real doses

This module packages an explicitly supplied Markov kernel that disintegrates a full observation law given a real-valued dose. It supplies pointwise conditional moments from that one chosen kernel, without asserting that such a kernel exists.

structure ContinuousDoseConditionalLaw reviewed
Causalean.Stat.ConditionalLaw

A measurable observation space, probability law, and measurable real-valued dose map determine a chosen continuous-dose conditional law. It consists of a proof that the dose map is measurable, a kernel assigning to each real dose value a measure on observations, a proof that every such measure is a probability measure, and the coherence identity: drawing a dose from its marginal law and then an observation from the kernel at that dose reproduces the joint law of the dose and the observation. The kernel is supplied, not constructed; nothing asserts that the kernel at a dose value is concentrated on observations with that dose beyond what the coherence identity implies.

Definition (Lean source)
Obs :
A :
Obs → ℝ
measurable_dose :
K :
Kernel ℝ Obs
markov :
coherence :
(letI : IsMarkovKernel K := markov (P.map A) ⊗ₘ K = P.map (fun ω ↦ (A ω, ω)))
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw · Causalean/Stat/ConditionalLaw.lean:25
theorem integral_graph reviewed
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw

A chosen conditional law, joint real-valued quantity, and integrability under the joint dose--observation law imply that joint integration equals first averaging within each dose and then averaging over the dose distribution.

Formal statement
Obs :
Type u_1
Obs → ℝ
shared
f :
ℝ × Obs → ℝ
hf :
Integrable f (P.map (fun ω ↦ (A ω, ω)))
∫ z, f z ∂(P.map (fun ω ↦ (A ω, ω))) = ∫ a, ∫ ω, f (a, ω) ∂L.K a ∂(P.map A)
Proof (Lean source)
theorem integral_graph (L : ContinuousDoseConditionalLaw Obs P A) (f : ℝ × Obs → ℝ) (hf : Integrable f (P.map (fun ω ↦ (A ω, ω)))) : ∫ z, f z ∂(P.map (fun ω ↦ (A ω, ω))) = ∫ a, ∫ ω, f (a, ω) ∂L.K a ∂(P.map A) := by haveI : IsMarkovKernel L.K := L.markov rw [← L.coherence] exact Measure.integral_compProd (L.coherence ▸ hf)
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw.integral_graph · Causalean/Stat/ConditionalLaw.lean:57 · uses ContinuousDoseConditionalLaw
def mean reviewed
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw

The chosen conditional law, real observation, and specified dose determine the pointwise conditional mean, given by integration against the selected kernel fiber.

Definition (Lean source)
Obs :
Type u_1
Obs → ℝ
shared
f :
Obs → ℝ
a :
ℝ
mean L f a :
ℝ
∫ ω, f ω ∂L.K a
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw.mean · Causalean/Stat/ConditionalLaw.lean:70 · uses ContinuousDoseConditionalLaw
def squaredRisk reviewed
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw

The chosen conditional law, real observation, dose-indexed prediction, and specified dose determine the pointwise squared prediction risk, given by the kernel-fiber average of squared prediction error.

Definition (Lean source)
Obs :
Type u_1
Obs → ℝ
shared
f :
Obs → ℝ
g :
ℝ → ℝ
a :
ℝ
squaredRisk L f g a :
ℝ
∫ ω, (f ω - g a) ^ 2 ∂L.K a
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw.squaredRisk · Causalean/Stat/ConditionalLaw.lean:76 · uses ContinuousDoseConditionalLaw
def secondMoment reviewed
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw

The chosen conditional law, real observation, and specified dose determine the conditional second moment, given by the kernel-fiber average of the squared observation.

Definition (Lean source)
Obs :
Type u_1
Obs → ℝ
shared
f :
Obs → ℝ
a :
ℝ
secondMoment L f a :
ℝ
∫ ω, (f ω) ^ 2 ∂L.K a
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw.secondMoment · Causalean/Stat/ConditionalLaw.lean:84 · uses ContinuousDoseConditionalLaw
def variance reviewed
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw

The chosen conditional law, real observation, and specified dose determine the conditional variance, given by the squared risk of the conditional mean under the same kernel fiber.

Definition (Lean source)
Obs :
Type u_1
Obs → ℝ
shared
f :
Obs → ℝ
a :
ℝ
variance L f a :
ℝ
L.squaredRisk f (L.mean f) a
Causalean.Stat.ConditionalLaw.ContinuousDoseConditionalLaw.variance · Causalean/Stat/ConditionalLaw.lean:90 · uses ContinuousDoseConditionalLaw
14 supporting declarations (lemmas, instances)
Contrast­Information 4 core · 17 supporting This module gives a finite-index interface for constrained quadratic information and generalized contrast variance of real positive-semidefinite matrices. ★ generalizedContrastVariance_eq_inv_constrainedInformation★ generalizedContrastVariance_antitone

Finite positive-semidefinite contrast information

This module gives a finite-index interface for constrained quadratic information and generalized contrast variance of real positive-semidefinite matrices. It includes the exact reciprocal identity in singular cases, range and positivity characterizations, and monotonicity under positive-semidefinite order.

def constrainedInformation reviewed
Causalean.Stat

A real finite matrix and contrast determine the constrained quadratic information, given by the infimum of the quadratic form of the matrix over all directions whose inner product with the contrast equals one.

Definition (Lean source)
ι :
Type u_1
shared
I :
Matrix ι ι ℝ
c :
ι → ℝ
constrainedInformation I c :
ℝ
sInf {r : ℝ | ∃ d : ι → ℝ, c ⬝ᵥ d = 1 ∧ r = d ⬝ᵥ I.mulVec d}
Causalean.Stat.constrainedInformation · Causalean/Stat/ContrastInformation.lean:23
def generalizedContrastVariance reviewed
Causalean.Stat

A real finite matrix and contrast determine the generalized contrast variance, given, when the linear system with this matrix and the contrast as right-hand side has a solution, by the infimum over solutions of the inner product of the contrast with the solution, truncated below at zero, and by infinity when no solution exists.

Definition (Lean source)
ι :
Type u_1
shared
I :
Matrix ι ι ℝ
c :
ι → ℝ
generalizedContrastVariance I c :
by classical exact if ∃ v : ι → ℝ, I.mulVec v
= c then ofReal (sInf {r : ℝ | ∃ v : ι → ℝ, I.mulVec v = c ∧ r = c ⬝ᵥ v}) else ⊤
Causalean.Stat.generalizedContrastVariance · Causalean/Stat/ContrastInformation.lean:33
theorem generalizedContrastVariance_eq_inv_constrainedInformation reviewed
Causalean.Stat

A positive-semidefinite matrix and nonzero contrast have generalized contrast variance equal to the extended reciprocal of constrained information.

Formal statement
ι :
Type u_1
Matrix ι ι ℝ
shared
hI :
I.PosSemidef
c :
ι → ℝ
hc :
c ≠ 0
Proof (Lean source)
theorem generalizedContrastVariance_eq_inv_constrainedInformation {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c : ι → ℝ} (hc : c ≠ 0) : generalizedContrastVariance I c = (ofReal (constrainedInformation I c))⁻¹ := by classical by_cases h : ∃ v : ι → ℝ, I.mulVec v = c · obtain ⟨v, hv⟩ := h rw [generalizedContrastVariance_eq_of_solution hI hv, constrainedInformation_eq_inv_of_solution hI hc hv, ENNReal.ofReal_inv_of_pos (solution_dot_pos hI hc hv), inv_inv] · simp [generalizedContrastVariance, h, constrainedInformation_eq_zero_of_no_solution hI hc h]
Causalean.Stat.generalizedContrastVariance_eq_inv_constrainedInformation · Causalean/Stat/ContrastInformation.lean:272 · uses constrainedInformation , generalizedContrastVariance
theorem generalizedContrastVariance_antitone reviewed
Causalean.Stat

For two positive-semidefinite matrices I and J such that J minus I is positive semidefinite, and a nonzero contrast, the generalized contrast variance under J is at most the generalized contrast variance under I.

Formal statement
ι :
Type u_1
Matrix ι ι ℝ
shared
hI :
I.PosSemidef
hJ :
J.PosSemidef
hIJ :
(J - I).PosSemidef
c :
ι → ℝ
hc :
c ≠ 0
Proof (Lean source)
theorem generalizedContrastVariance_antitone {I J : Matrix ι ι ℝ} (hI : I.PosSemidef) (hJ : J.PosSemidef) (hIJ : (J - I).PosSemidef) {c : ι → ℝ} (hc : c ≠ 0) : generalizedContrastVariance J c ≤ generalizedContrastVariance I c := by rw [generalizedContrastVariance_eq_inv_constrainedInformation hJ hc, generalizedContrastVariance_eq_inv_constrainedInformation hI hc] exact ENNReal.inv_le_inv' (ENNReal.ofReal_le_ofReal (constrainedInformation_mono hI hIJ hc))
Causalean.Stat.generalizedContrastVariance_antitone · Causalean/Stat/ContrastInformation.lean:322 · uses generalizedContrastVariance
17 supporting declarations (lemmas, instances)
  • exists_unitContrastDirection theorem — A finite contrast that is nonzero has a direction with unit contrast pairing.
    ι :
    Type u_1
    shared
    c :
    ι → ℝ
    hc :
    c ≠ 0
    ∃ d : ι → ℝ, c ⬝ᵥ d = 1
    Proof (Lean source)
    theorem exists_unitContrastDirection (c : ι → ℝ) (hc : c ≠ 0) : ∃ d : ι → ℝ, c ⬝ᵥ d = 1 := by classical have hi : ∃ i, c i ≠ 0 := by by_contra h push Not at h exact hc (funext h) obtain ⟨i, hi⟩ := hi refine ⟨Pi.single i (c i)⁻¹, ?_⟩ rw [dotProduct_single] exact mul_inv_cancel₀ hi
    Causalean.Stat.exists_unitContrastDirection · Causalean/Stat/ContrastInformation.lean:48
  • constrainedInformation_nonneg theorem — A positive-semidefinite matrix and a nonzero contrast have nonnegative constrained quadratic information.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c :
    ι → ℝ
    hc :
    c ≠ 0
    Proof (Lean source)
    theorem constrainedInformation_nonneg {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c : ι → ℝ} (hc : c ≠ 0) : 0 ≤ constrainedInformation I c := by unfold constrainedInformation apply le_csInf · obtain ⟨d, hd⟩ := exists_unitContrastDirection c hc exact ⟨d ⬝ᵥ I.mulVec d, d, hd, rfl⟩ · rintro r ⟨d, -, rfl⟩ simpa using hI.dotProduct_mulVec_nonneg d
    Causalean.Stat.constrainedInformation_nonneg · Causalean/Stat/ContrastInformation.lean:62
  • constrainedInformation_le_quad theorem — A positive-semidefinite matrix and a direction with unit pairing against the contrast have constrained information no larger than that direction's quadratic energy.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c d :
    ι → ℝ
    hd :
    c ⬝ᵥ d = 1
    constrainedInformation I c ≤ d ⬝ᵥ I.mulVec d
    Proof (Lean source)
    theorem constrainedInformation_le_quad {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c d : ι → ℝ} (hd : c ⬝ᵥ d = 1) : constrainedInformation I c ≤ d ⬝ᵥ I.mulVec d := by unfold constrainedInformation apply csInf_le · refine ⟨0, ?_⟩ rintro r ⟨e, -, rfl⟩ simpa using hI.dotProduct_mulVec_nonneg e · exact ⟨d, hd, rfl⟩
    Causalean.Stat.constrainedInformation_le_quad · Causalean/Stat/ContrastInformation.lean:73
  • constrainedInformation_mono theorem — A positive-semidefinite matrix and a second matrix whose difference in the stated order is positive semidefinite, at a nonzero contrast, have ordered constrained information.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    hIJ :
    (J - I).PosSemidef
    c :
    ι → ℝ
    hc :
    c ≠ 0
    Proof (Lean source)
    theorem constrainedInformation_mono {I J : Matrix ι ι ℝ} (hI : I.PosSemidef) (hIJ : (J - I).PosSemidef) {c : ι → ℝ} (hc : c ≠ 0) : constrainedInformation I c ≤ constrainedInformation J c := by unfold constrainedInformation apply le_csInf · obtain ⟨d, hd⟩ := exists_unitContrastDirection c hc exact ⟨d ⬝ᵥ J.mulVec d, d, hd, rfl⟩ · rintro r ⟨d, hd, rfl⟩ calc sInf {r : ℝ | ∃ e : ι → ℝ, c ⬝ᵥ e = 1 ∧ r = e ⬝ᵥ I.mulVec e} ≤ d ⬝ᵥ I.mulVec d := by apply csInf_le · refine ⟨0, ?_⟩ rintro x ⟨e, -, rfl⟩ simpa using hI.dotProduct_mulVec_nonneg e · exact ⟨d, hd, rfl⟩ _ ≤ d ⬝ᵥ J.mulVec d := by have h := hIJ.dotProduct_mulVec_nonneg d simpa [Matrix.sub_mulVec, dotProduct_sub] using h
    Causalean.Stat.constrainedInformation_mono · Causalean/Stat/ContrastInformation.lean:86
  • generalizedContrastVariance_nonneg theorem — A real finite matrix and contrast have nonnegative generalized contrast variance.
    ι :
    Type u_1
    shared
    I :
    Matrix ι ι ℝ
    c :
    ι → ℝ
    Proof (Lean source)
    theorem generalizedContrastVariance_nonneg (I : Matrix ι ι ℝ) (c : ι → ℝ) : 0 ≤ generalizedContrastVariance I c := bot_le
    Causalean.Stat.generalizedContrastVariance_nonneg · Causalean/Stat/ContrastInformation.lean:109
  • exists_kernel_nonorthogonal theorem — A positive-semidefinite matrix for which the contrast equation has no solution has a kernel direction with nonzero contrast pairing.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c :
    ι → ℝ
    hnone :
    ¬ ∃ v : ι → ℝ, I.mulVec v = c
    ∃ k : ι → ℝ,
    conclusion 1
    I.mulVec k = 0
    conclusion 2
    c ⬝ᵥ k ≠ 0
    Proof (Lean source)
    theorem exists_kernel_nonorthogonal {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c : ι → ℝ} (hnone : ¬ ∃ v : ι → ℝ, I.mulVec v = c) : ∃ k : ι → ℝ, I.mulVec k = 0 ∧ c ⬝ᵥ k ≠ 0 := by classical let T := I.toEuclideanLin have hT : T.IsSymmetric := Matrix.isSymmetric_toEuclideanLin_iff.mpr hI.isHermitian by_contra h push Not at h have hcorth : (toLp 2 c : EuclideanSpace ℝ ι) ∈ T.kerᗮ := by rw [Submodule.mem_orthogonal] intro x hx have hk : I.mulVec (ofLp x) = 0 := by have hx0 : T x = 0 := hx have := congrArg ofLp hx0 simpa [T, Matrix.toEuclideanLin_apply] using this have hck : c ⬝ᵥ ofLp x = 0 := h _ hk simpa [EuclideanSpace.inner_eq_star_dotProduct] using hck rw [T.orthogonal_ker, hT.adjoint_eq] at hcorth obtain ⟨v, hv⟩ := hcorth apply hnone refine ⟨WithLp.ofLp v, ?_⟩ have := congrArg ofLp hv simpa [T, Matrix.toEuclideanLin_apply] using this
    Causalean.Stat.exists_kernel_nonorthogonal · Causalean/Stat/ContrastInformation.lean:115
  • constrainedInformation_eq_zero_of_kernel theorem — A positive-semidefinite matrix, nonzero contrast, and kernel direction with nonzero contrast pairing have zero constrained information.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c k :
    ι → ℝ
    hc :
    c ≠ 0
    hk :
    I.mulVec k = 0
    hck :
    c ⬝ᵥ k ≠ 0
    Proof (Lean source)
    theorem constrainedInformation_eq_zero_of_kernel {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c k : ι → ℝ} (hc : c ≠ 0) (hk : I.mulVec k = 0) (hck : c ⬝ᵥ k ≠ 0) : constrainedInformation I c = 0 := by let d : ι → ℝ := (c ⬝ᵥ k)⁻¹ • k have hd : c ⬝ᵥ d = 1 := by simp [d, dotProduct_smul, inv_mul_cancel₀ hck] have hId : I.mulVec d = 0 := by simp [d, mulVec_smul, hk] apply le_antisymm · simpa [hId] using constrainedInformation_le_quad hI hd · exact constrainedInformation_nonneg hI hc
    Causalean.Stat.constrainedInformation_eq_zero_of_kernel · Causalean/Stat/ContrastInformation.lean:142
  • constrainedInformation_eq_zero_of_no_solution theorem — A positive-semidefinite matrix, nonzero contrast, and unsolvable contrast equation have zero constrained information.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c :
    ι → ℝ
    hc :
    c ≠ 0
    hnone :
    ¬ ∃ v : ι → ℝ, I.mulVec v = c
    Proof (Lean source)
    theorem constrainedInformation_eq_zero_of_no_solution {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c : ι → ℝ} (hc : c ≠ 0) (hnone : ¬ ∃ v : ι → ℝ, I.mulVec v = c) : constrainedInformation I c = 0 := by obtain ⟨k, hk, hck⟩ := exists_kernel_nonorthogonal hI hnone exact constrainedInformation_eq_zero_of_kernel hI hc hk hck
    Causalean.Stat.constrainedInformation_eq_zero_of_no_solution · Causalean/Stat/ContrastInformation.lean:157
  • solution_dot_eq theorem — A positive-semidefinite matrix and two solutions to its contrast equation have the same contrast pairing.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c v w :
    ι → ℝ
    hv :
    I.mulVec v = c
    hw :
    I.mulVec w = c
    c ⬝ᵥ v = c ⬝ᵥ w
    Proof (Lean source)
    theorem solution_dot_eq {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c v w : ι → ℝ} (hv : I.mulVec v = c) (hw : I.mulVec w = c) : c ⬝ᵥ v = c ⬝ᵥ w := by have hs : Iᵀ = I := by simpa using hI.isHermitian.eq calc c ⬝ᵥ v = (I.mulVec w) ⬝ᵥ v := by rw [hw] _ = w ⬝ᵥ I.mulVec v := by rw [dotProduct_comm] simpa [hs] using (Matrix.dotProduct_transpose_mulVec I w v).symm _ = c ⬝ᵥ w := by rw [hv, dotProduct_comm]
    Causalean.Stat.solution_dot_eq · Causalean/Stat/ContrastInformation.lean:165
  • solution_dot_pos theorem — A positive-semidefinite matrix, nonzero contrast, and solution to its contrast equation have a strictly positive contrast pairing.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c v :
    ι → ℝ
    hc :
    c ≠ 0
    hv :
    I.mulVec v = c
    0 < c ⬝ᵥ v
    Proof (Lean source)
    theorem solution_dot_pos {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c v : ι → ℝ} (hc : c ≠ 0) (hv : I.mulVec v = c) : 0 < c ⬝ᵥ v := by have hn : 0 ≤ c ⬝ᵥ v := by rw [← hv] simpa [dotProduct_comm] using hI.dotProduct_mulVec_nonneg v rcases hn.eq_or_lt with hz | hp · have hz' : v ⬝ᵥ I.mulVec v = 0 := by simpa [← hv, dotProduct_comm] using hz.symm exact False.elim (hc ((hI.dotProduct_mulVec_zero_iff v).mp hz' ▸ hv.symm)) · exact hp
    Causalean.Stat.solution_dot_pos · Causalean/Stat/ContrastInformation.lean:178
  • generalizedContrastVariance_eq_of_solution theorem — A positive-semidefinite matrix and a solution to its contrast equation have generalized contrast variance equal to that solution's contrast pairing.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c v :
    ι → ℝ
    hv :
    I.mulVec v = c
    Proof (Lean source)
    theorem generalizedContrastVariance_eq_of_solution {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c v : ι → ℝ} (hv : I.mulVec v = c) : generalizedContrastVariance I c = ofReal (c ⬝ᵥ v) := by unfold generalizedContrastVariance rw [if_pos ⟨v, hv⟩] congr 1 have hs : {r : ℝ | ∃ w : ι → ℝ, I.mulVec w = c ∧ r = c ⬝ᵥ w} = {c ⬝ᵥ v} := by ext r simp only [Set.mem_ofPred_eq, Set.mem_singleton_iff] constructor · rintro ⟨w, hw, rfl⟩ exact (solution_dot_eq hI hv hw).symm · rintro rfl exact ⟨v, hv, rfl⟩ rw [hs, csInf_singleton]
    Causalean.Stat.generalizedContrastVariance_eq_of_solution · Causalean/Stat/ContrastInformation.lean:191
  • inv_solution_dot_le_quad theorem — A positive-semidefinite matrix, nonzero contrast, solution to its contrast equation, and unit-contrast direction have the reciprocal solution pairing no greater than that direction's energy.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c v d :
    ι → ℝ
    hc :
    c ≠ 0
    hv :
    I.mulVec v = c
    hd :
    c ⬝ᵥ d = 1
    (c ⬝ᵥ v)⁻¹ ≤ d ⬝ᵥ I.mulVec d
    Proof (Lean source)
    theorem inv_solution_dot_le_quad {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c v d : ι → ℝ} (hc : c ≠ 0) (hv : I.mulVec v = c) (hd : c ⬝ᵥ d = 1) : (c ⬝ᵥ v)⁻¹ ≤ d ⬝ᵥ I.mulVec d := by let a := (c ⬝ᵥ v)⁻¹ have hp := solution_dot_pos hI hc hv have ha : a * (c ⬝ᵥ v) = 1 := inv_mul_cancel₀ (ne_of_gt hp) have hs : Iᵀ = I := by simpa using hI.isHermitian.eq have hcross : v ⬝ᵥ I.mulVec d = 1 := by calc v ⬝ᵥ I.mulVec d = d ⬝ᵥ I.mulVec v := by simpa [hs] using Matrix.dotProduct_transpose_mulVec I v d _ = 1 := by rw [hv, dotProduct_comm, hd] have hsq : 0 ≤ (d - a • v) ⬝ᵥ I.mulVec (d - a • v) := by simpa only [TrivialStar.star_trivial] using hI.dotProduct_mulVec_nonneg (d - a • v) simp only [Matrix.mulVec_sub, Matrix.mulVec_smul, dotProduct_sub, dotProduct_smul, smul_eq_mul] at hsq simp only [sub_dotProduct, smul_dotProduct, smul_eq_mul] at hsq have hdc : d ⬝ᵥ c = 1 := by simpa [dotProduct_comm] using hd rw [hv, hcross, hdc, dotProduct_comm v c] at hsq dsimp [a] at * nlinarith
    Causalean.Stat.inv_solution_dot_le_quad · Causalean/Stat/ContrastInformation.lean:211
  • exists_unitContrastDirection_energy_inv theorem — A positive-semidefinite matrix, nonzero contrast, and solution to its contrast equation have a unit-contrast direction attaining reciprocal solution energy.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c v :
    ι → ℝ
    hc :
    c ≠ 0
    hv :
    I.mulVec v = c
    ∃ d : ι → ℝ,
    conclusion 1
    c ⬝ᵥ d = 1
    conclusion 2
    d ⬝ᵥ I.mulVec d = (c ⬝ᵥ v)⁻¹
    Proof (Lean source)
    theorem exists_unitContrastDirection_energy_inv {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c v : ι → ℝ} (hc : c ≠ 0) (hv : I.mulVec v = c) : ∃ d : ι → ℝ, c ⬝ᵥ d = 1 ∧ d ⬝ᵥ I.mulVec d = (c ⬝ᵥ v)⁻¹ := by let a := (c ⬝ᵥ v)⁻¹ have hp := solution_dot_pos hI hc hv have ha : a * (c ⬝ᵥ v) = 1 := inv_mul_cancel₀ (ne_of_gt hp) refine ⟨a • v, ?_, ?_⟩ · rw [dotProduct_smul, smul_eq_mul] exact ha · rw [Matrix.mulVec_smul, dotProduct_smul, smul_dotProduct, smul_eq_mul, smul_eq_mul, hv, dotProduct_comm] change a * (a * (c ⬝ᵥ v)) = a rw [ha, mul_one]
    Causalean.Stat.exists_unitContrastDirection_energy_inv · Causalean/Stat/ContrastInformation.lean:237
  • constrainedInformation_eq_inv_of_solution theorem — A positive-semidefinite matrix, nonzero contrast, and solution to its contrast equation have constrained information equal to the reciprocal solution pairing.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c v :
    ι → ℝ
    hc :
    c ≠ 0
    hv :
    I.mulVec v = c
    constrainedInformation I c = (c ⬝ᵥ v)⁻¹
    Proof (Lean source)
    theorem constrainedInformation_eq_inv_of_solution {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c v : ι → ℝ} (hc : c ≠ 0) (hv : I.mulVec v = c) : constrainedInformation I c = (c ⬝ᵥ v)⁻¹ := by apply le_antisymm · obtain ⟨d, hd, he⟩ := exists_unitContrastDirection_energy_inv hI hc hv rw [← he] exact constrainedInformation_le_quad hI hd · unfold constrainedInformation apply le_csInf · obtain ⟨d, hd⟩ := exists_unitContrastDirection c hc exact ⟨d ⬝ᵥ I.mulVec d, d, hd, rfl⟩ · rintro r ⟨d, hd, rfl⟩ exact inv_solution_dot_le_quad hI hc hv hd
    Causalean.Stat.constrainedInformation_eq_inv_of_solution · Causalean/Stat/ContrastInformation.lean:255
  • constrainedInformation_pos_iff_solution theorem — A positive-semidefinite matrix and nonzero contrast have strictly positive constrained information exactly when their contrast equation is solvable.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c :
    ι → ℝ
    hc :
    c ≠ 0
    0 < constrainedInformation I c ↔ ∃ v : ι → ℝ, I.mulVec v = c
    Proof (Lean source)
    theorem constrainedInformation_pos_iff_solution {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c : ι → ℝ} (hc : c ≠ 0) : 0 < constrainedInformation I c ↔ ∃ v : ι → ℝ, I.mulVec v = c := by constructor · intro hq by_contra h exact (ne_of_gt hq) (constrainedInformation_eq_zero_of_no_solution hI hc h) · rintro ⟨v, hv⟩ rw [constrainedInformation_eq_inv_of_solution hI hc hv] exact inv_pos.mpr (solution_dot_pos hI hc hv)
    Causalean.Stat.constrainedInformation_pos_iff_solution · Causalean/Stat/ContrastInformation.lean:285
  • generalizedContrastVariance_eq_top_iff_no_solution theorem — A positive-semidefinite matrix and a contrast have infinite generalized contrast variance exactly when their contrast equation has no solution.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c :
    ι → ℝ
    generalizedContrastVariance I c = ⊤ ↔ ¬ ∃ v : ι → ℝ, I.mulVec v = c
    Proof (Lean source)
    theorem generalizedContrastVariance_eq_top_iff_no_solution {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c : ι → ℝ} : generalizedContrastVariance I c = ⊤ ↔ ¬ ∃ v : ι → ℝ, I.mulVec v = c := by classical constructor · intro htop h obtain ⟨v, hv⟩ := h rw [generalizedContrastVariance_eq_of_solution hI hv] at htop exact ENNReal.ofReal_ne_top htop · intro h simp [generalizedContrastVariance, h]
    Causalean.Stat.generalizedContrastVariance_eq_top_iff_no_solution · Causalean/Stat/ContrastInformation.lean:298
  • generalizedContrastVariance_eq_ofReal_inv_of_constrainedInformation_pos theorem — A positive-semidefinite matrix, nonzero contrast, and strictly positive constrained information have generalized contrast variance equal to the extended-real reciprocal.
    ι :
    Type u_1
    Matrix ι ι ℝ
    shared
    hI :
    I.PosSemidef
    c :
    ι → ℝ
    hc :
    c ≠ 0
    hq :
    Proof (Lean source)
    theorem generalizedContrastVariance_eq_ofReal_inv_of_constrainedInformation_pos {I : Matrix ι ι ℝ} (hI : I.PosSemidef) {c : ι → ℝ} (hc : c ≠ 0) (hq : 0 < constrainedInformation I c) : generalizedContrastVariance I c = ofReal (constrainedInformation I c)⁻¹ := by rw [generalizedContrastVariance_eq_inv_constrainedInformation hI hc, ENNReal.ofReal_inv_of_pos hq]
    Causalean.Stat.generalizedContrastVariance_eq_ofReal_inv_of_constrainedInformation_pos · Causalean/Stat/ContrastInformation.lean:312
Finite­Fiber­Conditioning 1 core · 0 supporting This file turns elementary probability-mass factorization within every fiber of a finite-valued conditioning map into conditional independence given that map. ★ condIndepFun_finite_of_measureReal_fibers

Conditional Independence from Finite Fibers

This file turns elementary probability-mass factorization within every fiber of a finite-valued conditioning map into conditional independence given that map. The proof computes conditional expectations of event indicators by finite-fiber probability ratios.

theorem condIndepFun_finite_of_measureReal_fibers reviewed
Causalean.Stat

For a finite measure, a finite-valued conditioning map, two random elements, measurability of all three maps, and factorization of their ordinary real masses on every measurable pair of events inside every conditioning fiber, the two random elements are conditionally independent given the sigma-algebra generated by the conditioning map.

Formal statement
mu :
X :
Omega → T
hX :
f :
Omega → A
hf :
g :
Omega → B
hg :
hfactor :
∀ (x : T) (s : Set A) (t : Set B)
then
mu.real (((f ⁻¹' s) ∩ (g ⁻¹' t)) ∩ X ⁻¹' {x}) * mu.real (X ⁻¹' {x})
= mu.real ((f ⁻¹' s) ∩ X ⁻¹' {x}) * mu.real ((g ⁻¹' t) ∩ X ⁻¹' {x})
CondIndepFun (comap X inferInstance) hX.comap_le f g mu
Proof (Lean source)
theorem condIndepFun_finite_of_measureReal_fibers {Omega T A B : Type*} [MeasurableSpace Omega] [StandardBorelSpace Omega] [Finite T] [MeasurableSpace T] [MeasurableSingletonClass T] [MeasurableSpace A] [MeasurableSpace B] (mu : Measure Omega) [IsFiniteMeasure mu] (X : Omega → T) (hX : Measurable X) (f : Omega → A) (hf : Measurable f) (g : Omega → B) (hg : Measurable g) (hfactor : ∀ (x : T) (s : Set A) (t : Set B), MeasurableSet s → MeasurableSet t → mu.real (((f ⁻¹' s) ∩ (g ⁻¹' t)) ∩ X ⁻¹' {x}) * mu.real (X ⁻¹' {x}) = mu.real ((f ⁻¹' s) ∩ X ⁻¹' {x}) * mu.real ((g ⁻¹' t) ∩ X ⁻¹' {x})) : CondIndepFun (comap X inferInstance) hX.comap_le f g mu := by rw [condIndepFun_iff_condExp_inter_preimage_eq_mul hf hg] intro s t hs ht have hfg : MeasurableSet (f ⁻¹' s ∩ g ⁻¹' t) := (hf hs).inter (hg ht) have hleft := condExp_indicator_finite_comap mu X hX _ hfg have hfiber := condExp_indicator_finite_comap mu X hX _ (hf hs) have hgiber := condExp_indicator_finite_comap mu X hX _ (hg ht) filter_upwards [hleft, hfiber, hgiber] with omega hleftomega hfomega hgomega rw [hleftomega, hfomega, hgomega] unfold finiteCondProb let m := mu.real (X ⁻¹' {X omega}) by_cases hm : m = 0 · simp only [m] at hm simp [hm] · have hfac := hfactor (X omega) s t hs ht simp only [Set.inter_assoc] at hfac change m⁻¹ * mu.real (X ⁻¹' {X omega} ∩ (f ⁻¹' s ∩ g ⁻¹' t)) = (m⁻¹ * mu.real (X ⁻¹' {X omega} ∩ f ⁻¹' s)) * (m⁻¹ * mu.real (X ⁻¹' {X omega} ∩ g ⁻¹' t)) have hfac' : mu.real (X ⁻¹' {X omega} ∩ (f ⁻¹' s ∩ g ⁻¹' t)) * m = mu.real (X ⁻¹' {X omega} ∩ f ⁻¹' s) * mu.real (X ⁻¹' {X omega} ∩ g ⁻¹' t) := by simpa [m, Set.inter_comm, Set.inter_left_comm, Set.inter_assoc] using hfac field_simp simpa [mul_comm] using hfac'
Causalean.Stat.condIndepFun_finite_of_measureReal_fibers · Causalean/Stat/FiniteFiberConditioning.lean:140
Score­Projection 3 core · 6 supporting This module develops guarded likelihood scores for dominated laws and proves that pushing a law through any measurable statistic projects its score onto the statistic's σ-algebra, provided the derivative density on the s ★ condExp_guardedScore_eq_statistic_score★ statistic_score_memLp_and_secondMoment_le

Likelihood-score projection through measurable statistics

This module develops guarded likelihood scores for dominated laws and proves that pushing a law through any measurable statistic projects its score onto the statistic's σ-algebra, provided the derivative density on the statistic's space is assumed to be the pushforward of the source derivative density. It also gives the corresponding L² contraction, without conditional distributions or regularity assumptions on the sample spaces.

def guardedScore reviewed
Causalean.Stat.ScoreProjection

A density, signed derivative density, and observation determine the guarded likelihood score, given by their quotient away from a zero density and by zero at a zero density.

Definition (Lean source)
α :
Type u_1
shared
q qdot :
α → ℝ
x :
α
guardedScore q qdot x :
ℝ
if q x = 0 then 0 else qdot x / q x
Causalean.Stat.ScoreProjection.guardedScore · Causalean/Stat/ScoreProjection.lean:25
theorem condExp_guardedScore_eq_statistic_score reviewed
Causalean.Stat.ScoreProjection

Take finite reference measures on the source space and on the statistic's space, a source probability law and a statistic law, a measurable statistic, and real densities and derivative densities on both spaces, all measurable except possibly the source derivative density. Suppose the densities are nonnegative almost everywhere under their reference measures, each derivative density vanishes almost everywhere where its density vanishes, the source law has the source density with respect to its reference measure, the statistic law is the law of the statistic under the source law, and it has the statistic density with respect to its reference measure, both guarded scores are integrable under their laws, and the derivative densities are linked by the same pushforward: for every measurable set of statistic values, the source derivative density integrated over the set's preimage equals the statistic derivative density integrated over the set. Then the conditional expectation, under the source law, of the source guarded score given the statistic equals the statistic's guarded score evaluated at the statistic, almost everywhere.

Formal statement
Ω :
Type u_2
shared
Y :
Type u_3
shared
νΩ :
shared
νY :
shared
μΩ :
shared
μY :
shared
T :
Ω → Y
shared
qΩ :
Ω → ℝ
shared
qdotΩ :
Ω → ℝ
shared
qY :
Y → ℝ
shared
qdotY :
Y → ℝ
shared
hT :
hqΩ :
hqY :
hqdotY :
hqΩnonneg :
∀ᵐ ω ∂νΩ, 0 ≤ qΩ ω
hqYnonneg :
∀ᵐ y ∂νY, 0 ≤ qY y
hzeroΩ :
∀ᵐ ω ∂νΩ, qΩ ω = 0 → qdotΩ ω = 0
hzeroY :
∀ᵐ y ∂νY, qY y = 0 → qdotY y = 0
hμΩ :
μΩ = νΩ.withDensity (fun ω => ofReal (qΩ ω))
hμYmap :
μY = μΩ.map T
hμYdensity :
μY = νY.withDensity (fun y => ofReal (qY y))
hscoreΩInt :
Integrable (guardedScore qΩ qdotΩ) μΩ
hscoreYInt :
Integrable (guardedScore qY qdotY) μY
hderivMap :
∀ A : Set Y
then
∫ ω in T ⁻¹' A, qdotΩ ω ∂νΩ = ∫ y in A, qdotY y ∂νY
μΩ[guardedScore qΩ qdotΩ | comap T inferInstance]
=ᵐ[μΩ] fun ω => guardedScore qY qdotY (T ω)
Proof (Lean source)
theorem condExp_guardedScore_eq_statistic_score (hT : Measurable T) (hqΩ : Measurable qΩ) (hqY : Measurable qY) (hqdotY : Measurable qdotY) (hqΩnonneg : ∀ᵐ ω ∂νΩ, 0 ≤ qΩ ω) (hqYnonneg : ∀ᵐ y ∂νY, 0 ≤ qY y) (hzeroΩ : ∀ᵐ ω ∂νΩ, qΩ ω = 0 → qdotΩ ω = 0) (hzeroY : ∀ᵐ y ∂νY, qY y = 0 → qdotY y = 0) (hμΩ : μΩ = νΩ.withDensity (fun ω => ofReal (qΩ ω))) (hμYmap : μY = μΩ.map T) (hμYdensity : μY = νY.withDensity (fun y => ofReal (qY y))) (hscoreΩInt : Integrable (guardedScore qΩ qdotΩ) μΩ) (hscoreYInt : Integrable (guardedScore qY qdotY) μY) (hderivMap : ∀ A : Set Y, MeasurableSet A → ∫ ω in T ⁻¹' A, qdotΩ ω ∂νΩ = ∫ y in A, qdotY y ∂νY) : μΩ[guardedScore qΩ qdotΩ | comap T inferInstance] =ᵐ[μΩ] fun ω => guardedScore qY qdotY (T ω) := by apply (condExp_eq_statistic_iff_integral_preimage_eq μΩ μY T hT hμYmap (guardedScore qΩ qdotΩ) (guardedScore qY qdotY) hscoreΩInt hscoreYInt (measurable_guardedScore hqY hqdotY)).2 intro A hA calc ∫ ω in T ⁻¹' A, guardedScore qΩ qdotΩ ω ∂μΩ = ∫ ω in T ⁻¹' A, guardedScore qY qdotY (T ω) ∂μΩ := score_integral_preimage_eq νΩ νY μΩ μY T qΩ qdotΩ qY qdotY hT hqΩ hqY hqdotY hqΩnonneg hqYnonneg hzeroΩ hzeroY hμΩ hμYmap hμYdensity hderivMap A hA _ = ∫ y in A, guardedScore qY qdotY y ∂μY := by rw [hμYmap] exact (setIntegral_map hA (measurable_guardedScore hqY hqdotY).aestronglyMeasurable hT.aemeasurable).symm
Causalean.Stat.ScoreProjection.condExp_guardedScore_eq_statistic_score · Causalean/Stat/ScoreProjection.lean:173 · uses guardedScore
theorem statistic_score_memLp_and_secondMoment_le reviewed
Causalean.Stat.ScoreProjection

Take finite reference measures on the source space and on the statistic's space, a source probability law and a statistic law, a measurable statistic, and real densities and derivative densities on both spaces, all measurable except possibly the source derivative density. Suppose the densities are nonnegative almost everywhere under their reference measures, each derivative density vanishes almost everywhere where its density vanishes, the source law has the source density with respect to its reference measure, the statistic law is the law of the statistic under the source law, and it has the statistic density with respect to its reference measure, the statistic derivative density is integrable under its reference measure, for every measurable set of statistic values, the source derivative density integrated over the set's preimage equals the statistic derivative density integrated over the set, and the source guarded score is square-integrable under the source law. Then the statistic's guarded score is square-integrable under the statistic law, and its second moment is at most the second moment of the source guarded score under the source law.

Formal statement
Ω :
Type u_2
shared
Y :
Type u_3
shared
νΩ :
shared
νY :
shared
μΩ :
shared
μY :
shared
T :
Ω → Y
shared
qΩ :
Ω → ℝ
shared
qdotΩ :
Ω → ℝ
shared
qY :
Y → ℝ
shared
qdotY :
Y → ℝ
shared
hT :
hqΩ :
hqY :
hqdotY :
hqΩnonneg :
∀ᵐ ω ∂νΩ, 0 ≤ qΩ ω
hqYnonneg :
∀ᵐ y ∂νY, 0 ≤ qY y
hzeroΩ :
∀ᵐ ω ∂νΩ, qΩ ω = 0 → qdotΩ ω = 0
hzeroY :
∀ᵐ y ∂νY, qY y = 0 → qdotY y = 0
hμΩ :
μΩ = νΩ.withDensity (fun ω => ofReal (qΩ ω))
hμYmap :
μY = μΩ.map T
hμYdensity :
μY = νY.withDensity (fun y => ofReal (qY y))
hderivYInt :
Integrable qdotY νY
hderivMap :
∀ A : Set Y
then
∫ ω in T ⁻¹' A, qdotΩ ω ∂νΩ = ∫ y in A, qdotY y ∂νY
hscoreΩL2 :
MemLp (guardedScore qΩ qdotΩ) 2 μΩ
conclusion 1
MemLp (guardedScore qY qdotY) 2 μY
conclusion 2
(∫ y, guardedScore qY qdotY y ^ 2 ∂μY) ≤ ∫ ω, guardedScore qΩ qdotΩ ω ^ 2 ∂μΩ
Proof (Lean source)
theorem statistic_score_memLp_and_secondMoment_le (hT : Measurable T) (hqΩ : Measurable qΩ) (hqY : Measurable qY) (hqdotY : Measurable qdotY) (hqΩnonneg : ∀ᵐ ω ∂νΩ, 0 ≤ qΩ ω) (hqYnonneg : ∀ᵐ y ∂νY, 0 ≤ qY y) (hzeroΩ : ∀ᵐ ω ∂νΩ, qΩ ω = 0 → qdotΩ ω = 0) (hzeroY : ∀ᵐ y ∂νY, qY y = 0 → qdotY y = 0) (hμΩ : μΩ = νΩ.withDensity (fun ω => ofReal (qΩ ω))) (hμYmap : μY = μΩ.map T) (hμYdensity : μY = νY.withDensity (fun y => ofReal (qY y))) (hderivYInt : Integrable qdotY νY) (hderivMap : ∀ A : Set Y, MeasurableSet A → ∫ ω in T ⁻¹' A, qdotΩ ω ∂νΩ = ∫ y in A, qdotY y ∂νY) (hscoreΩL2 : MemLp (guardedScore qΩ qdotΩ) 2 μΩ) : MemLp (guardedScore qY qdotY) 2 μY ∧ (∫ y, guardedScore qY qdotY y ^ 2 ∂μY) ≤ ∫ ω, guardedScore qΩ qdotΩ ω ^ 2 ∂μΩ := by have hscoreΩInt : Integrable (guardedScore qΩ qdotΩ) μΩ := hscoreΩL2.integrable (by norm_num) have hscoreYInt : Integrable (guardedScore qY qdotY) μY := integrable_guardedScore_of_derivative_integrable νY μY qY qdotY hqY hqYnonneg hzeroY hμYdensity hderivYInt have hprojection := condExp_guardedScore_eq_statistic_score νΩ νY μΩ μY T qΩ qdotΩ qY qdotY hT hqΩ hqY hqdotY hqΩnonneg hqYnonneg hzeroΩ hzeroY hμΩ hμYmap hμYdensity hscoreΩInt hscoreYInt hderivMap have hpull : MemLp (fun ω => guardedScore qY qdotY (T ω)) 2 μΩ := (memLp_congr_ae hprojection).mp (MemLp.condExp (m := comap T inferInstance) (by norm_num) hscoreΩL2) have hscoreY : MemLp (guardedScore qY qdotY) 2 μY := by rw [hμYmap] exact (memLp_map_measure_iff (measurable_guardedScore hqY hqdotY).aestronglyMeasurable hT.aemeasurable).2 hpull refine ⟨hscoreY, ?_⟩ have hbound := integral_norm_condExp_rpow_le (m := comap T inferInstance) (μ := μΩ) (f := guardedScore qΩ qdotΩ) (p := (2 : ℝ)) (by norm_num) (by convert hscoreΩL2.integrable_norm_pow (p := 2) (by norm_num) using 1 ext x rw [← @Nat.cast_two ℝ, Real.rpow_natCast]) have hmap : (∫ y, guardedScore qY qdotY y ^ 2 ∂μY) = ∫ ω, guardedScore qY qdotY (T ω) ^ 2 ∂μΩ := by rw [hμYmap] exact integral_map hT.aemeasurable ((measurable_guardedScore hqY hqdotY).pow_const 2).aestronglyMeasurable rw [hmap] have hprojSq : (∫ ω, guardedScore qY qdotY (T ω) ^ 2 ∂μΩ) = ∫ ω, (μΩ[guardedScore qΩ qdotΩ | comap T inferInstance]) ω ^ 2 ∂μΩ := by apply integral_congr_ae filter_upwards [hprojection] with ω hω rw [hω] rw [hprojSq] have hsq (x : ℝ) : ‖x‖ ^ (2 : ℝ) = x ^ 2 := by rw [← @Nat.cast_two ℝ, Real.rpow_natCast, Real.norm_eq_abs, sq_abs] simpa only [hsq] using hbound
Causalean.Stat.ScoreProjection.statistic_score_memLp_and_secondMoment_le · Causalean/Stat/ScoreProjection.lean:224 · uses guardedScore
6 supporting declarations (lemmas, instances)
  • measurable_guardedScore theorem — Measurable density and derivative functions give a measurable guarded likelihood score.
    α :
    Type u_1
    α → ℝ
    shared
    hq :
    hqdot :
    Proof (Lean source)
    @[fun_prop] theorem measurable_guardedScore {q qdot : α → ℝ} (hq : Measurable q) (hqdot : Measurable qdot) : Measurable (guardedScore q qdot) := by unfold guardedScore exact Measurable.ite (hq (measurableSet_singleton 0)) measurable_const (hqdot.div hq)
    Causalean.Stat.ScoreProjection.measurable_guardedScore · Causalean/Stat/ScoreProjection.lean:31
  • derivative_eq_density_mul_guardedScore theorem — A reference measure, density, and derivative density whose derivative vanishes wherever the density vanishes satisfy the almost-everywhere identity between the derivative density and density times its guarded score.
    α :
    Type u_1
    α → ℝ
    shared
    hzero :
    ∀ᵐ x ∂ν, q x = 0 → qdot x = 0
    ∀ᵐ x ∂ν, qdot x = q x * guardedScore q qdot x
    Proof (Lean source)
    theorem derivative_eq_density_mul_guardedScore {ν : Measure α} {q qdot : α → ℝ} (hzero : ∀ᵐ x ∂ν, q x = 0 → qdot x = 0) : ∀ᵐ x ∂ν, qdot x = q x * guardedScore q qdot x := by filter_upwards [hzero] with x hx by_cases hq : q x = 0 · simp [guardedScore, hq, hx hq] · simp [guardedScore, hq, mul_div_cancel₀ _ hq]
    Causalean.Stat.ScoreProjection.derivative_eq_density_mul_guardedScore · Causalean/Stat/ScoreProjection.lean:39
  • integrable_guardedScore_of_derivative_integrable theorem — A reference measure and law, measurable density and derivative density, nonnegative density, zero-set derivative control, density representation of the law, and integrable derivative density give an integrable guarded likelihood score under the law.
    α :
    Type u_1
    shared
    ν μ :
    q qdot :
    α → ℝ
    hq :
    hqnonneg :
    ∀ᵐ x ∂ν, 0 ≤ q x
    hzero :
    ∀ᵐ x ∂ν, q x = 0 → qdot x = 0
    hμ :
    μ = ν.withDensity (fun x => ofReal (q x))
    hderivInt :
    Integrable qdot ν
    Proof (Lean source)
    theorem integrable_guardedScore_of_derivative_integrable (ν μ : Measure α) (q qdot : α → ℝ) (hq : Measurable q) (hqnonneg : ∀ᵐ x ∂ν, 0 ≤ q x) (hzero : ∀ᵐ x ∂ν, q x = 0 → qdot x = 0) (hμ : μ = ν.withDensity (fun x => ofReal (q x))) (hderivInt : Integrable qdot ν) : Integrable (guardedScore q qdot) μ := by rw [hμ, integrable_withDensity_iff_integrable_smul' hq.ennreal_ofReal (by simp)] apply hderivInt.congr filter_upwards [hqnonneg, derivative_eq_density_mul_guardedScore hzero] with x hx hxeq rw [ENNReal.toReal_ofReal hx, smul_eq_mul] exact hxeq
    Causalean.Stat.ScoreProjection.integrable_guardedScore_of_derivative_integrable · Causalean/Stat/ScoreProjection.lean:51
  • setIntegral_guardedScore_eq_derivative theorem — A finite reference measure and law, measurable density and derivative density, nonnegative density, zero-set derivative control, density representation, and measurable event make the guarded-score integral on that event equal the derivative-density integral.
    α :
    Type u_1
    shared
    ν μ :
    q qdot :
    α → ℝ
    hq :
    hqnonneg :
    ∀ᵐ x ∂ν, 0 ≤ q x
    hzero :
    ∀ᵐ x ∂ν, q x = 0 → qdot x = 0
    hμ :
    μ = ν.withDensity (fun x => ofReal (q x))
    A :
    Set α
    hA :
    ∫ x in A, guardedScore q qdot x ∂μ = ∫ x in A, qdot x ∂ν
    Proof (Lean source)
    theorem setIntegral_guardedScore_eq_derivative (ν μ : Measure α) [IsFiniteMeasure ν] (q qdot : α → ℝ) (hq : Measurable q) (hqnonneg : ∀ᵐ x ∂ν, 0 ≤ q x) (hzero : ∀ᵐ x ∂ν, q x = 0 → qdot x = 0) (hμ : μ = ν.withDensity (fun x => ofReal (q x))) {A : Set α} (hA : MeasurableSet A) : ∫ x in A, guardedScore q qdot x ∂μ = ∫ x in A, qdot x ∂ν := by rw [hμ, restrict_withDensity hA, integral_withDensity_eq_integral_toReal_smul hq.ennreal_ofReal (by simp)] apply integral_congr_ae filter_upwards [ae_restrict_of_ae hqnonneg, ae_restrict_of_ae (derivative_eq_density_mul_guardedScore hzero)] with x hxq hxeq rw [ENNReal.toReal_ofReal hxq, smul_eq_mul, ← hxeq]
    Causalean.Stat.ScoreProjection.setIntegral_guardedScore_eq_derivative · Causalean/Stat/ScoreProjection.lean:69
  • condExp_eq_statistic_iff_integral_preimage_eq theorem — A measurable statistic with its pushed-forward law, integrable source and statistic functions, and a measurable statistic function has its conditional expectation equal to the pulled-back statistic function exactly when their integrals agree on every measurable statistic event.
    Ω :
    Type u_2
    shared
    Y :
    Type u_3
    shared
    μΩ :
    shared
    μY :
    shared
    T :
    Ω → Y
    shared
    hT :
    hμYmap :
    μY = μΩ.map T
    f :
    Ω → ℝ
    g :
    Y → ℝ
    hf :
    Integrable f μΩ
    hg :
    hgmeas :
    (μΩ[f | comap T inferInstance] =ᵐ[μΩ] fun ω => g (T ω))
    ↔ ∀ A : Set Y, MeasurableSet A → ∫ ω in T ⁻¹' A, f ω ∂μΩ = ∫ y in A, g y ∂μY
    Proof (Lean source)
    theorem condExp_eq_statistic_iff_integral_preimage_eq (hT : Measurable T) (hμYmap : μY = μΩ.map T) (f : Ω → ℝ) (g : Y → ℝ) (hf : Integrable f μΩ) (hg : Integrable g μY) (hgmeas : Measurable g) : (μΩ[f | comap T inferInstance] =ᵐ[μΩ] fun ω => g (T ω)) ↔ ∀ A : Set Y, MeasurableSet A → ∫ ω in T ⁻¹' A, f ω ∂μΩ = ∫ y in A, g y ∂μY := by have hmap (A : Set Y) (hA : MeasurableSet A) : ∫ ω in T ⁻¹' A, g (T ω) ∂μΩ = ∫ y in A, g y ∂μY := by rw [hμYmap] exact (setIntegral_map hA hgmeas.aestronglyMeasurable hT.aemeasurable).symm constructor · intro hcond A hA calc ∫ ω in T ⁻¹' A, f ω ∂μΩ = ∫ ω in T ⁻¹' A, (μΩ[f | comap T inferInstance]) ω ∂μΩ := (setIntegral_condExp hT.comap_le hf ⟨A, hA, rfl⟩).symm _ = ∫ ω in T ⁻¹' A, g (T ω) ∂μΩ := setIntegral_congr_ae (hT hA) (hcond.mono fun ω hω _ => hω) _ = ∫ y in A, g y ∂μY := hmap A hA · intro hintegral have hgmap : Integrable g (μΩ.map T) := by simpa only [hμYmap] using hg have hgcomp : Integrable (fun ω => g (T ω)) μΩ := by simpa only [Function.comp_def] using hgmap.comp_measurable hT have hTcomap : Measurable[comap T inferInstance] T := comap_measurable T have hgstrong : StronglyMeasurable[comap T inferInstance] (fun ω => g (T ω)) := hgmeas.stronglyMeasurable.comp_measurable hTcomap exact condExp_eq_of_integral_preimage_eq μΩ T hT f (fun ω => g (T ω)) hf hgcomp hgstrong.aestronglyMeasurable (by intro A hA exact (hintegral A hA).trans (hmap A hA).symm)
    Causalean.Stat.ScoreProjection.condExp_eq_statistic_iff_integral_preimage_eq · Causalean/Stat/ScoreProjection.lean:94
  • score_integral_preimage_eq theorem — Finite source and statistic reference measures, source and statistic laws, a measurable statistic, densities and derivative densities, all measurable except possibly the source derivative density, nonnegative densities, zero-set derivative controls, the source and statistic density laws, an exact derivative pushforward identity, and a measurable statistic event give equal source-score and pulled-back statistic-score integrals on that event.
    Ω :
    Type u_2
    shared
    Y :
    Type u_3
    shared
    νΩ :
    shared
    νY :
    shared
    μΩ :
    shared
    μY :
    shared
    T :
    Ω → Y
    shared
    qΩ :
    Ω → ℝ
    shared
    qdotΩ :
    Ω → ℝ
    shared
    qY :
    Y → ℝ
    shared
    qdotY :
    Y → ℝ
    shared
    hT :
    hqΩ :
    hqY :
    hqdotY :
    hqΩnonneg :
    ∀ᵐ ω ∂νΩ, 0 ≤ qΩ ω
    hqYnonneg :
    ∀ᵐ y ∂νY, 0 ≤ qY y
    hzeroΩ :
    ∀ᵐ ω ∂νΩ, qΩ ω = 0 → qdotΩ ω = 0
    hzeroY :
    ∀ᵐ y ∂νY, qY y = 0 → qdotY y = 0
    hμΩ :
    μΩ = νΩ.withDensity (fun ω => ofReal (qΩ ω))
    hμYmap :
    μY = μΩ.map T
    hμYdensity :
    μY = νY.withDensity (fun y => ofReal (qY y))
    hderivMap :
    ∀ A : Set Y
    then
    ∫ ω in T ⁻¹' A, qdotΩ ω ∂νΩ = ∫ y in A, qdotY y ∂νY
    A :
    Set Y
    hA :
    ∫ ω in T ⁻¹' A, guardedScore qΩ qdotΩ ω ∂μΩ
    = ∫ ω in T ⁻¹' A, guardedScore qY qdotY (T ω) ∂μΩ
    Proof (Lean source)
    theorem score_integral_preimage_eq (hT : Measurable T) (hqΩ : Measurable qΩ) (hqY : Measurable qY) (hqdotY : Measurable qdotY) (hqΩnonneg : ∀ᵐ ω ∂νΩ, 0 ≤ qΩ ω) (hqYnonneg : ∀ᵐ y ∂νY, 0 ≤ qY y) (hzeroΩ : ∀ᵐ ω ∂νΩ, qΩ ω = 0 → qdotΩ ω = 0) (hzeroY : ∀ᵐ y ∂νY, qY y = 0 → qdotY y = 0) (hμΩ : μΩ = νΩ.withDensity (fun ω => ofReal (qΩ ω))) (hμYmap : μY = μΩ.map T) (hμYdensity : μY = νY.withDensity (fun y => ofReal (qY y))) (hderivMap : ∀ A : Set Y, MeasurableSet A → ∫ ω in T ⁻¹' A, qdotΩ ω ∂νΩ = ∫ y in A, qdotY y ∂νY) (A : Set Y) (hA : MeasurableSet A) : ∫ ω in T ⁻¹' A, guardedScore qΩ qdotΩ ω ∂μΩ = ∫ ω in T ⁻¹' A, guardedScore qY qdotY (T ω) ∂μΩ := by have hmap : ∫ ω in T ⁻¹' A, guardedScore qY qdotY (T ω) ∂μΩ = ∫ y in A, guardedScore qY qdotY y ∂μY := by rw [hμYmap] exact (setIntegral_map hA (measurable_guardedScore hqY hqdotY).aestronglyMeasurable hT.aemeasurable).symm calc ∫ ω in T ⁻¹' A, guardedScore qΩ qdotΩ ω ∂μΩ = ∫ ω in T ⁻¹' A, qdotΩ ω ∂νΩ := setIntegral_guardedScore_eq_derivative νΩ μΩ qΩ qdotΩ hqΩ hqΩnonneg hzeroΩ hμΩ (hT hA) _ = ∫ y in A, qdotY y ∂νY := hderivMap A hA _ = ∫ y in A, guardedScore qY qdotY y ∂μY := (setIntegral_guardedScore_eq_derivative νY μY qY qdotY hqY hqYnonneg hzeroY hμYdensity hA).symm _ = ∫ ω in T ⁻¹' A, guardedScore qY qdotY (T ω) ∂μΩ := hmap.symm
    Causalean.Stat.ScoreProjection.score_integral_preimage_eq · Causalean/Stat/ScoreProjection.lean:133
Support­Transfer 2 core · 0 supporting This file defines a real-valued event indicator and proves a measure-theoretic support-transfer theorem under a normalized restriction to a positive-mass cell. ★ ae_abs_target_le_of_indep_positive_event

Support Transfer Across an Independent Event

This file defines a real-valued event indicator and proves a measure-theoretic support-transfer theorem under a normalized restriction to a positive-mass cell. Independence from a positive-probability event and almost-everywhere agreement on that event transfer an absolute bound from a reference quantity to the target quantity throughout the cell.

def eventIndicator reviewed
Causalean.Stat

Given a sample space and an event in it, the real-valued event indicator equals one for sample points in the event and zero for all other sample points.

Definition (Lean source)
Omega :
Type*
A :
Set Omega
eventIndicator A :
Omega → ℝ
A.indicator (fun _ => 1)
Causalean.Stat.eventIndicator · Causalean/Stat/SupportTransfer.lean:26
theorem ae_abs_target_le_of_indep_positive_event reviewed
Causalean.Stat

Within a measurable positive-mass cell, for a measurable event, if a target quantity is measurable, the event has positive normalized cell probability, the target is independent of the event indicator under the normalized cell law, a reference quantity agrees almost surely with the target on that event, and the reference obeys an absolute bound there, then the target obeys the same absolute bound almost surely throughout the cell.

Formal statement
Omega :
Type*
Measure Omega
C A :
Set Omega
_hC :
hCpos :
0 < P C
_hA :
target reference :
Omega → ℝ
hTarget :
Measurable target
hEventPos :
hInd :
IndepFun target (eventIndicator A) (normalizedRestrict P C)
hAgreement :
reference =ᵐ[(normalizedRestrict P C).restrict A] target
R :
ℝ
hReferenceBound :
∀ᵐ omega ∂(normalizedRestrict P C).restrict A, |reference omega| ≤ R
∀ᵐ omega ∂P.restrict C, |target omega| ≤ R
Proof (Lean source)
theorem ae_abs_target_le_of_indep_positive_event {Omega : Type*} [MeasurableSpace Omega] {P : Measure Omega} [IsProbabilityMeasure P] {C A : Set Omega} (_hC : MeasurableSet C) (hCpos : 0 < P C) (_hA : MeasurableSet A) {target reference : Omega → ℝ} (hTarget : Measurable target) (hEventPos : 0 < normalizedRestrict P C A) (hInd : IndepFun target (eventIndicator A) (normalizedRestrict P C)) (hAgreement : reference =ᵐ[(normalizedRestrict P C).restrict A] target) {R : ℝ} (hReferenceBound : ∀ᵐ omega ∂(normalizedRestrict P C).restrict A, |reference omega| ≤ R) : ∀ᵐ omega ∂P.restrict C, |target omega| ≤ R := by let B : Set Omega := {omega | R < |target omega|} have hBadRange : MeasurableSet {y : ℝ | R < |y|} := by rw [show {y : ℝ | R < |y|} = {y : ℝ | R < ‖y‖} by ext y simp only [Real.norm_eq_abs]] exact measurableSet_lt measurable_const (by fun_prop) have hB : MeasurableSet B := hTarget hBadRange have hTargetBoundEvent : ∀ᵐ omega ∂(normalizedRestrict P C).restrict A, |target omega| ≤ R := by filter_upwards [hAgreement, hReferenceBound] with omega hEq hBound rw [← hEq] exact hBound have hBAzero : normalizedRestrict P C (B ∩ A) = 0 := by rw [measure_eq_zero_iff_ae_notMem] filter_upwards [ae_imp_of_ae_restrict hTargetBoundEvent] with omega homega intro hmem exact (not_lt_of_ge (homega hmem.2)) hmem.1 have hEventPreimage : eventIndicator A ⁻¹' ({1} : Set ℝ) = A := by ext omega simp [eventIndicator] have hFactor : normalizedRestrict P C (B ∩ A) = normalizedRestrict P C B * normalizedRestrict P C A := by simpa [B, hEventPreimage] using hInd.measure_inter_preimage_eq_mul {y : ℝ | R < |y|} ({1} : Set ℝ) hBadRange (measurableSet_singleton (1 : ℝ)) have hBzero : normalizedRestrict P C B = 0 := by have hprod : normalizedRestrict P C B * normalizedRestrict P C A = 0 := by rw [← hFactor, hBAzero] exact (mul_eq_zero.mp hprod).resolve_right hEventPos.ne' apply (ae_normalizedRestrict_iff hCpos).mp filter_upwards [(measure_eq_zero_iff_ae_notMem.mp hBzero)] with omega homega exact le_of_not_gt (by simpa [B] using homega)
Causalean.Stat.ae_abs_target_le_of_indep_positive_event · Causalean/Stat/SupportTransfer.lean:32 · uses normalizedRestrict , eventIndicator
Doob­Information 4 core · 8 supporting For a square-integrable score under one probability law, this module develops the finite-horizon decomposition into conditional-expectation increments along an arbitrary filtration. ★ fisher_eq_sum★ guarded_density_fisher_eq_doob_sum

Finite-horizon Doob information decomposition

For a square-integrable score under one probability law, this module develops the finite-horizon decomposition into conditional-expectation increments along an arbitrary filtration. It supplies centering, orthogonality, information additivity, a uniform increment-budget bound, and a density-facing Fisher-information corollary without disintegration or stagewise Radon–Nikodym derivatives.

def increment reviewed
Causalean.Stat.DoobInformation

A probability law, filtration, terminal score, and stage determine the Doob score increment, given by the change in the score's conditional expectation between the two adjacent prefix σ-algebras.

Definition (Lean source)
Ω :
Type u_1
shared
μ :
F :
Filtration ℕ mΩ
S :
Ω → ℝ
k :
ℕ
increment μ F S k :
Ω → ℝ
fun ω => μ[S | F (k + 1)] ω - μ[S | F k] ω
Causalean.Stat.DoobInformation.increment · Causalean/Stat/DoobInformation.lean:26
def doobArray reviewed
Causalean.Stat.DoobInformation

A probability law, filtration, terminal score, square-integrability certificate, and horizon determine the constant-row Doob martingale-difference array, given by the Doob construction in which every row uses this same law, filtration, and score, has length equal to the horizon, and has as its entry at each stage the change in the score's conditional expectation between the two adjacent prefix σ-algebras.

Definition (Lean source)
Ω :
Type u_1
shared
F :
Filtration ℕ mΩ
S :
Ω → ℝ
hS :
MemLp S 2 μ
n :
ℕ
doobArray μ F S hS n :
MartingaleDifferenceArray (fun _ : ℕ => Ω) (fun _ => μ)
doobMartingaleDifferenceArray (μ := fun _ => μ) (fun _ => n) (fun _ => F) (fun _ => S) (fun _ => hS)
Causalean.Stat.DoobInformation.doobArray · Causalean/Stat/DoobInformation.lean:32 · uses MartingaleDifferenceArray
theorem fisher_eq_sum reviewed
Causalean.Stat.DoobInformation

Under a probability law and filtration, if a square-integrable terminal score is its terminal conditional expectation and has zero initial conditional expectation, then its Fisher-information second moment, the expectation of the squared score, equals the sum over the stages before the horizon of the increment second moments at the given horizon.

Formal statement
Ω :
shared
F :
Filtration ℕ mΩ
shared
S :
Ω → ℝ
shared
hS :
MemLp S 2 μ
n :
ℕ
hterminal :
μ[S | F n] =ᵐ[μ] S
hinitial :
μ[S | F 0] =ᵐ[μ] (0 : Ω → ℝ)
∫ ω, S ω ^ 2 ∂μ = ∑ k ∈ range n, ∫ ω, increment μ F S k ω ^ 2 ∂μ
Proof (Lean source)
theorem fisher_eq_sum (hS : MemLp S 2 μ) (n : ℕ) (hterminal : μ[S | F n] =ᵐ[μ] S) (hinitial : μ[S | F 0] =ᵐ[μ] (0 : Ω → ℝ)) : ∫ ω, S ω ^ 2 ∂μ = ∑ k ∈ range n, ∫ ω, increment μ F S k ω ^ 2 ∂μ := by let d : ℕ → Ω → ℝ := increment μ F S let t : ℕ → Ω → ℝ := fun r ω => ∑ k ∈ range r, d k ω have hd (k : ℕ) : MemLp (d k) 2 μ := increment_memLp (μ := μ) F S hS k have ht (r : ℕ) : MemLp (t r) 2 μ := by induction r with | zero => simp [t] | succ r ihr => convert ihr.add (hd r) using 1 funext ω simp [t, Finset.sum_range_succ] have hsq (r : ℕ) : ∫ ω, t r ω ^ 2 ∂μ = ∑ k ∈ range r, ∫ ω, d k ω ^ 2 ∂μ := by induction r with | zero => simp [t] | succ r ihr => have hcross : ∫ ω, t r ω * d r ω ∂μ = 0 := by calc _ = ∫ ω, ∑ k ∈ range r, d k ω * d r ω ∂μ := by congr 1 funext ω simp [t, Finset.sum_mul] _ = ∑ k ∈ range r, ∫ ω, d k ω * d r ω ∂μ := by exact integral_finsetSum _ (by intro k hk exact (hd k).integrable_mul (hd r)) _ = 0 := by apply Finset.sum_eq_zero intro k hk exact increment_orthogonal (μ := μ) F S hS (Nat.ne_of_lt (Finset.mem_range.mp hk)) have hrr : Integrable (fun ω => t r ω * t r ω) μ := (ht r).integrable_mul (ht r) have hrd : Integrable (fun ω => t r ω * d r ω) μ := (ht r).integrable_mul (hd r) have hdr : Integrable (fun ω => d r ω * t r ω) μ := (hd r).integrable_mul (ht r) have hdd : Integrable (fun ω => d r ω * d r ω) μ := (hd r).integrable_mul (hd r) calc ∫ ω, t (r + 1) ω ^ 2 ∂μ = ∫ ω, (t r ω * t r ω + t r ω * d r ω) + (d r ω * t r ω + d r ω * d r ω) ∂μ := by congr 1 funext ω simp only [t, Finset.sum_range_succ] ring _ = (∫ ω, t r ω * t r ω ∂μ) + (∫ ω, t r ω * d r ω ∂μ) + (∫ ω, d r ω * t r ω ∂μ) + (∫ ω, d r ω * d r ω ∂μ) := by have houter := integral_add (hrr.add hrd) (hdr.add hdd) have hleft := integral_add hrr hrd have hright := integral_add hdr hdd simpa only [Pi.add_apply, hleft, hright, add_assoc] using houter _ = ∑ k ∈ range (r + 1), ∫ ω, d k ω ^ 2 ∂μ := by rw [hcross] have hcross' : ∫ ω, d r ω * t r ω ∂μ = 0 := by convert hcross using 1 congr 1 funext ω ring rw [hcross'] simp only [← pow_two, add_zero, Finset.sum_range_succ] exact congrArg (· + ∫ ω, d r ω ^ 2 ∂μ) ihr have hae : t n =ᵐ[μ] S := by filter_upwards [increment_sum (μ := μ) F S hS n, hterminal, hinitial] with ω hsum hterm hinit dsimp [t, d] at hsum ⊢ rw [hsum, hterm, hinit] simp calc ∫ ω, S ω ^ 2 ∂μ = ∫ ω, t n ω ^ 2 ∂μ := integral_congr_ae (by filter_upwards [hae] with ω hw rw [hw]) _ = ∑ k ∈ range n, ∫ ω, increment μ F S k ω ^ 2 ∂μ := hsq n
Causalean.Stat.DoobInformation.fisher_eq_sum · Causalean/Stat/DoobInformation.lean:137 · uses increment
theorem guarded_density_fisher_eq_doob_sum reviewed
Causalean.Stat.DoobInformation

A finite reference measure, probability law, filtration, horizon, density, density derivative, and score with a measurable density, the law having density q with respect to the reference measure, almost-everywhere nonnegative density, the score identity that the density derivative equals the density times the score almost everywhere under the reference measure, square-integrable score under the law, and the score agreeing almost surely with its conditional expectation at the horizon while its conditional expectation at stage zero vanishes almost surely have a guarded density Fisher integral, the reference-measure integral of the squared density derivative divided by the density with the integrand set to zero where the density vanishes, equal to the sum over the stages before the horizon of the second moments of the Doob score increments.

Formal statement
Ω :
shared
F :
Filtration ℕ mΩ
n :
ℕ
q qdot S :
Ω → ℝ
hq :
hμ :
μ = ν.withDensity (fun ω => ofReal (q ω))
hqnonneg :
∀ᵐ ω ∂ν, 0 ≤ q ω
hscore :
∀ᵐ ω ∂ν, qdot ω = q ω * S ω
hS :
MemLp S 2 μ
hterminal :
μ[S | F n] =ᵐ[μ] S
hinitial :
μ[S | F 0] =ᵐ[μ] (0 : Ω → ℝ)
(∫ ω, (if q ω = 0 then 0 else qdot ω ^ 2 / q ω) ∂ν)
= ∑ k ∈ range n, ∫ ω, increment μ F S k ω ^ 2 ∂μ
Proof (Lean source)
theorem guarded_density_fisher_eq_doob_sum (F : Filtration ℕ mΩ) (n : ℕ) (q qdot S : Ω → ℝ) (hq : Measurable q) (hμ : μ = ν.withDensity (fun ω => ofReal (q ω))) (hqnonneg : ∀ᵐ ω ∂ν, 0 ≤ q ω) (hscore : ∀ᵐ ω ∂ν, qdot ω = q ω * S ω) (hS : MemLp S 2 μ) (hterminal : μ[S | F n] =ᵐ[μ] S) (hinitial : μ[S | F 0] =ᵐ[μ] (0 : Ω → ℝ)) : (∫ ω, (if q ω = 0 then 0 else qdot ω ^ 2 / q ω) ∂ν) = ∑ k ∈ range n, ∫ ω, increment μ F S k ω ^ 2 ∂μ := by rw [guarded_density_fisher_eq q qdot S hq hμ hqnonneg hscore] exact fisher_eq_sum F S hS n hterminal hinitial
Causalean.Stat.DoobInformation.guarded_density_fisher_eq_doob_sum · Causalean/Stat/DoobInformation.lean:285 · uses increment
8 supporting declarations (lemmas, instances)
  • increment_eq_doobArray theorem — Given a probability law, filtration, square-integrable terminal score, horizon, and stage, the score increment agrees with the matching entry of its constant-row Doob array.
    Ω :
    shared
    F :
    Filtration ℕ mΩ
    shared
    S :
    Ω → ℝ
    shared
    hS :
    MemLp S 2 μ
    n k :
    ℕ
    increment μ F S k = (doobArray μ F S hS n).increment 0 k
    Proof (Lean source)
    theorem increment_eq_doobArray (hS : MemLp S 2 μ) (n k : ℕ) : increment μ F S k = (doobArray μ F S hS n).increment 0 k := by rfl
    Causalean.Stat.DoobInformation.increment_eq_doobArray · Causalean/Stat/DoobInformation.lean:44
  • increment_memLp theorem — Under a probability law and filtration, a square-integrable terminal score has a square-integrable score increment at every stage, including the specified stage.
    Ω :
    shared
    F :
    Filtration ℕ mΩ
    shared
    S :
    Ω → ℝ
    shared
    hS :
    MemLp S 2 μ
    k :
    ℕ
    MemLp (increment μ F S k) 2 μ
    Proof (Lean source)
    theorem increment_memLp (hS : MemLp S 2 μ) (k : ℕ) : MemLp (increment μ F S k) 2 μ := by rw [increment_eq_doobArray (μ := μ) F S hS (k + 1) k] exact (doobArray μ F S hS (k + 1)).squareIntegrable 0 k (by simpa [doobArray, doobMartingaleDifferenceArray] using lt_succ_self k)
    Causalean.Stat.DoobInformation.increment_memLp · Causalean/Stat/DoobInformation.lean:51
  • increment_stronglyMeasurable theorem — Under a probability law and filtration, a square-integrable terminal score has an increment measurable at the next prefix σ-algebra for the given stage.
    Ω :
    shared
    F :
    Filtration ℕ mΩ
    shared
    S :
    Ω → ℝ
    shared
    hS :
    MemLp S 2 μ
    k :
    ℕ
    StronglyMeasurable[F (k + 1)] (increment μ F S k)
    Proof (Lean source)
    theorem increment_stronglyMeasurable (hS : MemLp S 2 μ) (k : ℕ) : StronglyMeasurable[F (k + 1)] (increment μ F S k) := by rw [increment_eq_doobArray (μ := μ) F S hS (k + 1) k] exact (doobArray μ F S hS (k + 1)).adapted 0 k (by simpa [doobArray, doobMartingaleDifferenceArray] using lt_succ_self k)
    Causalean.Stat.DoobInformation.increment_stronglyMeasurable · Causalean/Stat/DoobInformation.lean:60
  • increment_condExp_zero theorem — Under a probability law and filtration, the increment of a square-integrable terminal score has conditional mean zero at the preceding prefix σ-algebra for the given stage.
    Ω :
    shared
    F :
    Filtration ℕ mΩ
    shared
    S :
    Ω → ℝ
    shared
    hS :
    MemLp S 2 μ
    k :
    ℕ
    μ[increment μ F S k | F k] =ᵐ[μ] (0 : Ω → ℝ)
    Proof (Lean source)
    theorem increment_condExp_zero (hS : MemLp S 2 μ) (k : ℕ) : μ[increment μ F S k | F k] =ᵐ[μ] (0 : Ω → ℝ) := by rw [increment_eq_doobArray (μ := μ) F S hS (k + 1) k] exact (doobArray μ F S hS (k + 1)).condExp_zero 0 k (by simpa [doobArray, doobMartingaleDifferenceArray] using lt_succ_self k)
    Causalean.Stat.DoobInformation.increment_condExp_zero · Causalean/Stat/DoobInformation.lean:69
  • increment_sum theorem — Under a probability law and filtration, the increments of a square-integrable terminal score have a finite sum equal almost everywhere to the difference between terminal and initial conditional expectations at the given horizon.
    Ω :
    shared
    F :
    Filtration ℕ mΩ
    shared
    S :
    Ω → ℝ
    shared
    hS :
    MemLp S 2 μ
    n :
    ℕ
    (fun ω => ∑ k ∈ range n, increment μ F S k ω)
    =ᵐ[μ] (fun ω => μ[S | F n] ω - μ[S | F 0] ω)
    Proof (Lean source)
    theorem increment_sum (hS : MemLp S 2 μ) (n : ℕ) : (fun ω => ∑ k ∈ range n, increment μ F S k ω) =ᵐ[μ] (fun ω => μ[S | F n] ω - μ[S | F 0] ω) := by have hsum : (fun ω => ∑ k ∈ range n, increment μ F S k ω) = (doobArray μ F S hS n).rowSum 0 := by funext ω simp only [MartingaleDifferenceArray.rowSum, Finset.sum_apply] change (∑ k ∈ range n, increment μ F S k ω) = ∑ k ∈ range n, (doobArray μ F S hS n).increment 0 k ω apply Finset.sum_congr rfl intro k _ exact congrFun (increment_eq_doobArray (μ := μ) F S hS n k) ω have hrow := doobMartingaleDifferenceArray_rowSum (μ := fun _ => μ) (fun _ => n) (fun _ => F) (fun _ => S) (fun _ => hS) 0 change (doobArray μ F S hS n).rowSum 0 = (fun ω => μ[S | F n] ω - μ[S | F 0] ω) at hrow exact Filter.Eventually.of_forall (fun ω => congrFun (hsum.trans hrow) ω)
    Causalean.Stat.DoobInformation.increment_sum · Causalean/Stat/DoobInformation.lean:78
  • increment_orthogonal theorem — Under a probability law and filtration, distinct stages of the Doob increments for a square-integrable terminal score are orthogonal in the squared-integrable sense, whenever the two stages differ.
    Ω :
    shared
    F :
    Filtration ℕ mΩ
    shared
    S :
    Ω → ℝ
    shared
    hS :
    MemLp S 2 μ
    i j :
    ℕ
    hij :
    i ≠ j
    ∫ ω, increment μ F S i ω * increment μ F S j ω ∂μ = 0
    Proof (Lean source)
    theorem increment_orthogonal (hS : MemLp S 2 μ) {i j : ℕ} (hij : i ≠ j) : ∫ ω, increment μ F S i ω * increment μ F S j ω ∂μ = 0 := by have hforward {a b : ℕ} (hab : a < b) : ∫ ω, increment μ F S a ω * increment μ F S b ω ∂μ = 0 := by have hm : F (a + 1) ≤ F b := F.mono (succ_le_of_lt hab) have hmeas : StronglyMeasurable[F b] (increment μ F S a) := (increment_stronglyMeasurable (μ := μ) F S hS a).mono hm have ha := increment_memLp (μ := μ) F S hS a have hb := increment_memLp (μ := μ) F S hS b have hprod : Integrable (increment μ F S a * increment μ F S b) μ := ha.integrable_mul hb have hpull := condExp_mul_of_stronglyMeasurable_left hmeas hprod (hb.integrable (by norm_num)) calc ∫ ω, increment μ F S a ω * increment μ F S b ω ∂μ = ∫ ω, μ[increment μ F S a * increment μ F S b | F b] ω ∂μ := by exact (integral_condExp (F.le b)).symm _ = ∫ ω, increment μ F S a ω * μ[increment μ F S b | F b] ω ∂μ := integral_congr_ae hpull _ = 0 := by have hz : (fun ω => increment μ F S a ω * μ[increment μ F S b | F b] ω) =ᵐ[μ] (0 : Ω → ℝ) := by filter_upwards [increment_condExp_zero (μ := μ) F S hS b] with ω hω simp only [Pi.zero_apply] at hω simp [hω] rw [integral_congr_ae hz] simp rcases lt_or_gt_of_ne hij with h | h · exact hforward h · rw [show (fun ω => increment μ F S i ω * increment μ F S j ω) = (fun ω => increment μ F S j ω * increment μ F S i ω) from funext (fun ω => mul_comm _ _)] exact hforward h
    Causalean.Stat.DoobInformation.increment_orthogonal · Causalean/Stat/DoobInformation.lean:100
  • fisher_le_mul theorem — Under a probability law and filtration, if a square-integrable terminal score has the terminal and initial conditional-expectation identities and each active increment's second moment is bounded, then the score's Fisher information is at most the horizon times the common bound for the given horizon and bound.
    Ω :
    shared
    F :
    Filtration ℕ mΩ
    shared
    S :
    Ω → ℝ
    shared
    hS :
    MemLp S 2 μ
    n :
    ℕ
    B :
    ℝ
    hterminal :
    μ[S | F n] =ᵐ[μ] S
    hinitial :
    μ[S | F 0] =ᵐ[μ] (0 : Ω → ℝ)
    hbound :
    ∀ k < n, ∫ ω, increment μ F S k ω ^ 2 ∂μ ≤ B
    ∫ ω, S ω ^ 2 ∂μ ≤ (n : ℝ) * B
    Proof (Lean source)
    theorem fisher_le_mul (hS : MemLp S 2 μ) (n : ℕ) (B : ℝ) (hterminal : μ[S | F n] =ᵐ[μ] S) (hinitial : μ[S | F 0] =ᵐ[μ] (0 : Ω → ℝ)) (hbound : ∀ k < n, ∫ ω, increment μ F S k ω ^ 2 ∂μ ≤ B) : ∫ ω, S ω ^ 2 ∂μ ≤ (n : ℝ) * B := by rw [fisher_eq_sum (μ := μ) F S hS n hterminal hinitial] calc ∑ k ∈ range n, ∫ ω, increment μ F S k ω ^ 2 ∂μ ≤ ∑ _k ∈ range n, B := by apply Finset.sum_le_sum intro k hk exact hbound k (Finset.mem_range.mp hk) _ = (n : ℝ) * B := by simp
    Causalean.Stat.DoobInformation.fisher_le_mul · Causalean/Stat/DoobInformation.lean:228
  • guarded_density_fisher_eq theorem — A finite reference measure, probability law, density, density derivative, and score with a measurable density, the stated density representation, almost-everywhere nonnegative density, and almost-everywhere score identity have a guarded density Fisher integral equal to the score second moment.
    Ω :
    shared
    q qdot S :
    Ω → ℝ
    hq :
    hμ :
    μ = ν.withDensity (fun ω => ofReal (q ω))
    hqnonneg :
    ∀ᵐ ω ∂ν, 0 ≤ q ω
    hscore :
    ∀ᵐ ω ∂ν, qdot ω = q ω * S ω
    (∫ ω, (if q ω = 0 then 0 else qdot ω ^ 2 / q ω) ∂ν) = ∫ ω, S ω ^ 2 ∂μ
    Proof (Lean source)
    theorem guarded_density_fisher_eq (q qdot S : Ω → ℝ) (hq : Measurable q) (hμ : μ = ν.withDensity (fun ω => ofReal (q ω))) (hqnonneg : ∀ᵐ ω ∂ν, 0 ≤ q ω) (hscore : ∀ᵐ ω ∂ν, qdot ω = q ω * S ω) : (∫ ω, (if q ω = 0 then 0 else qdot ω ^ 2 / q ω) ∂ν) = ∫ ω, S ω ^ 2 ∂μ := by have hquot : (fun ω => if q ω = 0 then 0 else qdot ω ^ 2 / q ω) =ᵐ[ν] (fun ω => q ω * S ω ^ 2) := by filter_upwards [hscore] with ω hs by_cases hq0 : q ω = 0 · simp [hq0] · rw [hs] simp only [hq0, ↓reduceIte] field_simp calc (∫ ω, (if q ω = 0 then 0 else qdot ω ^ 2 / q ω) ∂ν) = ∫ ω, q ω * S ω ^ 2 ∂ν := integral_congr_ae hquot _ = ∫ ω, S ω ^ 2 ∂μ := by rw [hμ, integral_withDensity_eq_integral_toReal_smul hq.ennreal_ofReal (by simp)] apply integral_congr_ae filter_upwards [hqnonneg] with ω hn simp [ENNReal.toReal_ofReal hn, smul_eq_mul]
    Causalean.Stat.DoobInformation.guarded_density_fisher_eq · Causalean/Stat/DoobInformation.lean:249
Gaussian­Covariance 7 core · 13 supporting This module defines the Gaussian covariance discrepancy on finite positive-definite matrices and derives its compact-model attainment, strict separation, perturbation stability, and finite-model-selection interfaces. ★ finiteCovarianceModel_populationGap

Gaussian covariance discrepancy and finite model selection

This module defines the Gaussian covariance discrepancy on finite positive-definite matrices and derives its compact-model attainment, strict separation, perturbation stability, and finite-model-selection interfaces. The model assumptions are stated separately from the matrix inequality, so the results can be reused for any finite family of covariance models.

abbrev PositiveCovariance reviewed
Causalean.Stat

For a finite coordinate type, the positive covariance matrices are real square matrices equipped with a proof of positive definiteness.

Definition (Lean source)
V :
Type*
PositiveCovariance V :
Type (max 0 u_2)
{K : Matrix V V ℝ // PosDef K}
Causalean.Stat.PositiveCovariance · Causalean/Stat/GaussianCovariance.lean:26
def gaussianCovarianceDiscrepancy reviewed
Causalean.Stat

For a candidate covariance matrix and target second-moment matrix, the Gaussian covariance discrepancy is log determinant plus inverse-weighted trace.

Definition (Lean source)
V :
Type u_1
shared
K T :
Matrix V V ℝ
gaussianCovarianceDiscrepancy K T :
ℝ
log K.det + trace (K⁻¹ * T)
Causalean.Stat.gaussianCovarianceDiscrepancy · Causalean/Stat/GaussianCovariance.lean:31
def normalizedCovarianceDiscrepancy reviewed
Causalean.Stat

For positive-definite candidate and target covariances, the normalized Gaussian covariance discrepancy subtracts the criterion's value at the target.

Definition (Lean source)
V :
Type u_1
shared
normalizedCovarianceDiscrepancy K T :
ℝ
Causalean.Stat.normalizedCovarianceDiscrepancy · Causalean/Stat/GaussianCovariance.lean:37 · uses PositiveCovariance
def IsDiscrepancyAttainedOn reviewed
Causalean.Stat

For a covariance model and target matrix, discrepancy attainment means that one model member has no larger Gaussian discrepancy than every other member.

Definition (Lean source)
V :
Type u_2
shared
T :
Matrix V V ℝ
IsDiscrepancyAttainedOn M T :
Prop
∃ K ∈ M,
∀ L ∈ M,
Causalean.Stat.IsDiscrepancyAttainedOn · Causalean/Stat/GaussianCovariance.lean:260 · uses PositiveCovariance
def HasCompactDiscrepancySublevel reviewed
Causalean.Stat

For a covariance model and target matrix, a compact discrepancy sublevel is a nonempty compact cut of the model below some criterion value.

Definition (Lean source)
V :
Type u_2
shared
T :
Matrix V V ℝ
HasCompactDiscrepancySublevel M T :
Prop
∃ c : ℝ,
clause 1
(M ∩ {K | gaussianCovarianceDiscrepancy (K : Matrix V V ℝ) T ≤ c}).Nonempty
clause 2
IsCompact (M ∩ {K | gaussianCovarianceDiscrepancy (K : Matrix V V ℝ) T ≤ c})
Causalean.Stat.HasCompactDiscrepancySublevel · Causalean/Stat/GaussianCovariance.lean:268 · uses PositiveCovariance
def covarianceModelLoss reviewed
Causalean.Stat

For a covariance model and target matrix, the population loss is the infimum Gaussian discrepancy over positive-definite model covariances.

Definition (Lean source)
V :
Type u_2
shared
T :
Matrix V V ℝ
covarianceModelLoss M T :
ℝ
sInf ((fun K : PositiveCovariance V => gaussianCovarianceDiscrepancy (K : Matrix V V ℝ) T) '' M)
Causalean.Stat.covarianceModelLoss · Causalean/Stat/GaussianCovariance.lean:372 · uses PositiveCovariance
theorem finiteCovarianceModel_populationGap reviewed
Causalean.Stat

Given a finite family of covariance models whose members are compact and nonempty, and a positive-definite true covariance contained in at least one model, the population losses have the positive gap required by finite penalized model selection.

Formal statement
V :
Type u_2
shared
I :
Type u_3
shared
Nonempty I
models :
hcompact :
∀ i, IsCompact (models i)
hne :
∀ i, (models i).Nonempty
hcontains :
∃ i, T ∈ models i
∃ gap : ℝ,
0 < gap
conclusion 1
i ∈ Causalean.Stat.populationMinimizers (fun j => covarianceModelLoss (models j) T) :
j ∉ Causalean.Stat.populationMinimizers (fun k => covarianceModelLoss (models k) T) :
covarianceModelLoss (models i) T + gap ≤ covarianceModelLoss (models j) T
Proof (Lean source)
theorem finiteCovarianceModel_populationGap [Fintype V] [DecidableEq V] [Fintype I] [Nonempty I] (models : I → Set (PositiveCovariance V)) (hcompact : ∀ i, IsCompact (models i)) (hne : ∀ i, (models i).Nonempty) (T : PositiveCovariance V) (hcontains : ∃ i, T ∈ models i) : ∃ gap : ℝ, 0 < gap ∧ ∀ i ∈ populationMinimizers (fun j => covarianceModelLoss (models j) T), ∀ j ∉ populationMinimizers (fun k => covarianceModelLoss (models k) T), covarianceModelLoss (models i) T + gap ≤ covarianceModelLoss (models j) T := by classical let minimizers := populationMinimizers (fun j => covarianceModelLoss (models j) T) let bad : Finset I := Finset.univ.filter fun j => j ∉ minimizers by_cases hbad : bad.Nonempty · obtain ⟨j0, hj0bad, hj0min⟩ := Finset.exists_min_image bad (fun j => covarianceModelLoss (models j) T) hbad have hj0not : j0 ∉ minimizers := (Finset.mem_filter.mp hj0bad).2 have hj0T : T ∉ models j0 := by simpa [minimizers, populationMinimizers_covarianceModelLoss_iff models hcompact hne T hcontains j0] using hj0not have hbase_lt : gaussianCovarianceDiscrepancy (T : Matrix V V ℝ) T < covarianceModelLoss (models j0) T := lt_of_le_of_ne (covarianceModelLoss_ge_truth (hcompact j0) (hne j0) T) (fun h => hj0T ((covarianceModelLoss_eq_truth_iff (hcompact j0) (hne j0) T).mp h.symm)) refine ⟨covarianceModelLoss (models j0) T - gaussianCovarianceDiscrepancy (T : Matrix V V ℝ) T, sub_pos.mpr hbase_lt, ?_⟩ intro i hi j hj have hiT : T ∈ models i := by exact (populationMinimizers_covarianceModelLoss_iff models hcompact hne T hcontains i).mp hi have hjbad : j ∈ bad := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ rw [(covarianceModelLoss_eq_truth_iff (hcompact i) (hne i) T).2 hiT] linarith [hj0min j hjbad] · refine ⟨1, zero_lt_one, ?_⟩ intro i hi j hj exfalso exact hbad ⟨j, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩⟩
13 supporting declarations (lemmas, instances)