Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Exact diagonal and off-diagonal expansion for orthogonal component residuals

Proved
NarrowDNF.ResidualGram.residual_square_sum

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

combinatoricsnarrow-dnf-authors-importprobabilitystoc-2027

Let Ω\OmegaΩ be finite, w:Ω→Rw:\Omega\to\mathbb Rw:Ω→R, and AAA finite. Put ⟨u,v⟩w=∑xw(x)u(x)v(x)\langle u,v\rangle_w=\sum_xw(x)u(x)v(x)⟨u,v⟩w​=∑x​w(x)u(x)v(x). Suppose real families fi,gif_i,g_ifi​,gi​ satisfy ⟨fi,fj⟩w=⟨fi,gj⟩w=0\langle f_i,f_j\rangle_w=\langle f_i,g_j\rangle_w=0⟨fi​,fj​⟩w​=⟨fi​,gj​⟩w​=0 whenever i,j∈Ai,j\in Ai,j∈A are distinct. Then

∑xw(x)(∑i∈A(fi(x)−gi(x)))2=∑i∈A∑xw(x)(fi(x)−gi(x))2+∑i∈A∑j∈A∖{i}⟨gi,gj⟩w.\sum_xw(x)\left(\sum_{i\in A}(f_i(x)-g_i(x))\right)^2 =\sum_{i\in A}\sum_xw(x)(f_i(x)-g_i(x))^2 +\sum_{i\in A}\sum_{j\in A\setminus\{i\}}\langle g_i,g_j\rangle_w.x∑​w(x)(i∈A∑​(fi​(x)−gi​(x)))2=i∈A∑​x∑​w(x)(fi​(x)−gi​(x))2+i∈A∑​j∈A∖{i}∑​⟨gi​,gj​⟩w​.

The off-diagonal sum uses ordered pairs. No sign condition on www is needed for this exact algebraic identity.

Preamble
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Real.Basic
import Mathlib.Tactic.Ring
import Definitions.Def_NarrowDNF_ResidualGram

namespace NarrowDNF.ResidualGram
end NarrowDNF.ResidualGram
open NarrowDNF
open NarrowDNF.ResidualGram
open scoped BigOperators
variable {Ω α : Type*} [Fintype Ω] [DecidableEq α]
Formal statement
theorem NarrowDNF.ResidualGram.residual_square_sum (w : Ω → ℝ) (A : Finset α) (f g : α → Ω → ℝ)
    (hff : ∀ i ∈ A, ∀ j ∈ A, i ≠ j → inner w (f i) (f j) = 0)
    (hfg : ∀ i ∈ A, ∀ j ∈ A, i ≠ j → inner w (f i) (g j) = 0) :
    (∑ x, w x * (∑ i ∈ A, (f i x-g i x))^2) =
      (∑ i ∈ A, ∑ x, w x * (f i x-g i x)^2) +
      ∑ i ∈ A, ∑ j ∈ A.erase i, inner w (g i) (g j) := by sorry
Source
https://github.com/liuchliuch/narrow-dnf-lean/blob/eecadd6a5ea0a331d6cf9fd5cb39fc6ec854b372/NarrowDNF/ResidualGram.lean#L38-L62

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