Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Triangular rearrangement of a double sum

Proved
Finset.sum_filter_le_add_sum_filter_le_swap

by Tamas Fulop · Sep 29, 2026 · Mathlib c5ea003 (Lean v4.30.0)

algebrafinset

Let ι\iotaι be a linearly ordered type and MMM an additive commutative monoid. Let sss be a finite set of indices and f:ι×ι→Mf:\iota\times\iota\to Mf:ι×ι→M a kernel vanishing on the diagonal, f(x,x)=0f(x,x)=0f(x,x)=0 for all xxx. Write s≤t={u∈s:u≤t}s_{\le t}=\{u\in s:u\le t\}s≤t​={u∈s:u≤t} for the closed lower slice. Then\n\n

∑t∈s∑u∈s≤tf(u,t)+∑t∈s∑u∈s≤tf(t,u)=∑x∈s∑y∈sf(x,y).\sum_{t\in s}\sum_{u\in s_{\le t}}f(u,t)+\sum_{t\in s}\sum_{u\in s_{\le t}}f(t,u)=\sum_{x\in s}\sum_{y\in s}f(x,y).t∈s∑​u∈s≤t​∑​f(u,t)+t∈s∑​u∈s≤t​∑​f(t,u)=x∈s∑​y∈s∑​f(x,y).

\n\nThe left side adds the lower-triangular sum and its transpose; they overlap exactly on the diagonal where the kernel vanishes, recovering the full double sum. This is the Finset analogue of triangular rearrangements used in polygon area estimates.\n\nFormalization Note Lean states the slices with Finset.filter; no integrability or finiteness beyond Finset is needed.

Preamble
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
import Mathlib.Algebra.BigOperators.Group.Finset.Sigma
open Finset
Formal statement
namespace Finset

variable {ι M : Type*} [LinearOrder ι] [AddCommMonoid M]

theorem sum_filter_le_add_sum_filter_le_swap (s : Finset ι) (f : ι → ι → M) (hdiag : ∀ x, f x x = 0) : ((∑ t ∈ s, ∑ u ∈ s.filter (fun u ↦ u ≤ t), f u t) + ∑ t ∈ s, ∑ u ∈ s.filter (fun u ↦ u ≤ t), f t u) = ∑ x ∈ s, ∑ y ∈ s, f x y := by sorry

end Finset
Source
https://github.com/deancureton/MovingSofa/blob/4d5569131940815f47a9ccf3e90a4c5043c56127/MovingSofa/ForMathlib/Algebra/BigOperators/Triangle.lean#L22-L26

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