Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Conditional-expectation residuals are orthogonal to every atom-constant function

Proved
NarrowDNF.ConditionalExpectation.residual_orthogonal

by chenghua.liu · Nov 13, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatoricsnarrow-dnf-authors-importprobabilitystoc-2027

Let A,BA,BA,B be finite sets, ϕ:A→B\phi:A\to Bϕ:A→B, w:A→(0,∞)w:A\to(0,\infty)w:A→(0,∞), and F:A→RF:A\to\mathbb RF:A→R. For a realized atom, define its weighted mean and its pullback by

m(b)=∑a:ϕ(a)=bw(a)F(a)∑a:ϕ(a)=bw(a),M(a)=m(ϕ(a)).m(b)=\frac{\sum_{a:\phi(a)=b}w(a)F(a)}{\sum_{a:\phi(a)=b}w(a)},\qquad M(a)=m(\phi(a)).m(b)=∑a:ϕ(a)=b​w(a)∑a:ϕ(a)=b​w(a)F(a)​,M(a)=m(ϕ(a)).

Empty atoms have mean zero by convention. For every G:B→RG:B\to\mathbb RG:B→R,

∑a∈Aw(a)(F(a)−M(a))G(ϕ(a))=0.\sum_{a\in A}w(a)(F(a)-M(a))G(\phi(a))=0.a∈A∑​w(a)(F(a)−M(a))G(ϕ(a))=0.

Weights need not sum to one. This is the finite weighted orthogonality property that characterizes conditional averaging relative to the partition into fibers of ϕ\phiϕ.

Preamble
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Data.Bool.Basic
import Mathlib.Data.Finset.Lattice.Fold
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Pi
import Mathlib.Data.Real.Basic
import Mathlib.Logic.Equiv.Prod
import Mathlib.Order.Monotone.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
import Definitions.Def_NarrowDNF_ConditionalExpectation
import Definitions.Def_NarrowDNF_ProductMeasure

namespace NarrowDNF.ConditionalExpectation
end NarrowDNF.ConditionalExpectation

namespace NarrowDNF.ProductMeasure
end NarrowDNF.ProductMeasure
noncomputable section
open scoped BigOperators
open NarrowDNF
open NarrowDNF.ConditionalExpectation
variable {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β]
Formal statement
theorem NarrowDNF.ConditionalExpectation.residual_orthogonal (φ : α → β) (w F : α → ℝ) (hw : ∀ a, 0 < w a)
    (G : β → ℝ) :
    (∑ a, w a * (F a - conditional φ w F a) * G (φ a)) = 0 := by sorry
Source
https://github.com/liuchliuch/narrow-dnf-lean/blob/eecadd6a5ea0a331d6cf9fd5cb39fc6ec854b372/NarrowDNF/ConditionalExpectation.lean#L95-L116

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me