Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Finite-set interval inclusion-exclusion

Proved
Finset.interval_inclusion_exclusion

by Yuxuan Xu · Sep 22, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatoricsfinite-setsinclusion-exclusion

Let D,BD,BD,B be finite subsets of a type with decidable equality. Let ggg and fff be rational-valued functions on finite subsets, and suppose that for every finite set AAA,

f(A)=∑C⊆Ag(C).f(A)=\sum_{C\subseteq A}g(C).f(A)=C⊆A∑​g(C).

Then the sum of g(C)g(C)g(C) over the Boolean interval D⊆C⊆BD\subseteq C\subseteq BD⊆C⊆B is

∑S⊆D(−1)∣S∣f(B∖S).\sum_{S\subseteq D}(-1)^{|S|}f(B\setminus S).S⊆D∑​(−1)∣S∣f(B∖S).

The formula is valid even when DDD is not a subset of BBB; both sides then give the corresponding inclusion-exclusion value.

Preamble
import Mathlib
open Finset
attribute [local instance] Classical.propDecidable
Formal statement
namespace Finset

open Finset

theorem interval_inclusion_exclusion {α : Type*} [DecidableEq α]
    (D B : Finset α) (g f : Finset α → ℚ)
    (hf : ∀ A : Finset α, f A = ∑ C ∈ A.powerset, g C) :
    (∑ C ∈ B.powerset.filter (fun C => D ⊆ C), g C) =
      ∑ S ∈ D.powerset, (-1 : ℚ) ^ S.card * f (B \ S) := by
  sorry

end Finset
Source
A proved finite-sum inclusion-exclusion derivation developed in this project. It is presented as an independent specialization of Boolean-lattice inclusion-exclusion, not as a verbatim theorem from an external source.

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, licensed under Apache 2.0.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTermsJoin SlackJoin Zulip© 2026 Prove2Me