Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Union-closed families, occurrences, density, nondegeneracy

Definition
TenChallenges_UnionClosed

by utkuokur · Nov 4, 2026 · Mathlib 0df444a (Lean v4.33.1)

extremal-set-theoryfranklunion-closed

The definitions behind Challenge 9 of the Ten Challenges benchmark, for a finite family F\mathcal FF of finite subsets of a type UUU.

  1. Union-closed. A∪B∈FA\cup B\in\mathcal FA∪B∈F whenever A,B∈FA,B\in\mathcal FA,B∈F.
  2. Occurrences. occF(x)\mathrm{occ}_{\mathcal F}(x)occF​(x) is the number of members of F\mathcal FF containing xxx.
  3. Density. δF(x)=occF(x)/max⁡(1,∣F∣)\delta_{\mathcal F}(x)=\mathrm{occ}_{\mathcal F}(x)/\max(1,|\mathcal F|)δF​(x)=occF​(x)/max(1,∣F∣), a rational number; for nonempty F\mathcal FF this is the fraction of members containing xxx.
  4. Nondegenerate. F≠∅\mathcal F\ne\emptysetF=∅ and F≠{∅}\mathcal F\ne\{\emptyset\}F={∅}, the two union-closed families excluded from the conjecture.

Formalization Note. Families are Finset (Finset U) with [DecidableEq U]; the density is a quotient in ℚ, with the denominator max⁡(1,∣F∣)\max(1,|\mathcal F|)max(1,∣F∣) avoiding division by zero.

Definition code
import Mathlib.Data.Finset.Card
import Mathlib.Algebra.Order.Ring.Unbundled.Rat

variable {U : Type*} [DecidableEq U] (F : Finset (Finset U))

/-- A finite family of finite sets is union-closed. -/
def IsUnionClosed : Prop :=
  ∀ ⦃A B : Finset U⦄, A ∈ F → B ∈ F → A ∪ B ∈ F

/-- The number of members of the family containing `x`. -/
def occurrences (x : U) : ℕ :=
  (F.filter fun A => x ∈ A).card

/-- The density of an element with respect to a finite family. -/
def density (x : U) : ℚ :=
  (occurrences F x : ℚ) / max 1 F.card

/-- The two degenerate families excluded from the union-closed sets conjecture. -/
def Nondegenerate : Prop :=
  F ≠ ∅ ∧ F ≠ {∅}
Source
Ten Challenges repository, file Defs_and_Lems/UnionClosed.lean (commit ff14a56), https://github.com/TenChallenges/ten-challenges/blob/main/Defs_and_Lems/UnionClosed.lean; conjecture as in H. Bruhn, O. Schaudt, The journey of the union-closed sets conjecture, Graphs Combin. 31 (2015), Section 1.
Read-back

What the Lean code literally says, in plain math · claude-fable-5-1

Setting shared by all four definitions. Throughout, UUU is an arbitrary type (any collection of "elements": finite or infinite, possibly empty; it lives in an arbitrary but fixed universe), and FFF is a finite set whose members are finite subsets of UUU, i.e. a finite family of finite sets with no repeated members. The first three definitions additionally assume that UUU carries a decidable equality (a procedure deciding whether two given elements of UUU are equal); this is an extra parameter of those definitions. Write ∣F∣|F|∣F∣ for the number of members of FFF.

Definition IsUnionClosed ("FFF is union-closed") is the proposition

∀ A,B finite subsets of U:A∈F  ∧  B∈F  ⟹  A∪B∈F.\forall\, A, B \text{ finite subsets of } U:\qquad A \in F \;\wedge\; B \in F \;\Longrightarrow\; A \cup B \in F .∀A,B finite subsets of U:A∈F∧B∈F⟹A∪B∈F.

Here AAA and BBB range over all finite subsets of UUU (the hypotheses A∈FA \in FA∈F, B∈FB \in FB∈F then restrict them), and A=BA = BA=B is allowed. Nothing requires FFF to be nonempty, to contain ∅\emptyset∅, to contain the whole union of its members, or to be closed under intersection. Edge cases: the empty family F=∅F = \emptysetF=∅ satisfies this vacuously; the family {∅}\{\emptyset\}{∅} satisfies it; every one-member family {A}\{A\}{A} satisfies it.

Definition occurrences assigns to x∈Ux \in Ux∈U the natural number

occ⁡F(x)  =  ∣{ A∈F  :  x∈A }∣,\operatorname{occ}_F(x) \;=\; \bigl|\{\, A \in F \;:\; x \in A \,\}\bigr| ,occF​(x)=​{A∈F:x∈A}​,

the number of members of FFF that contain xxx. It is 000 when no member of FFF contains xxx (in particular for every xxx when F=∅F = \emptysetF=∅), and it is at most ∣F∣|F|∣F∣.

Definition density assigns to x∈Ux \in Ux∈U the rational number

dens⁡F(x)  =  occ⁡F(x)max⁡(1, ∣F∣)  ∈  Q,\operatorname{dens}_F(x) \;=\; \frac{\operatorname{occ}_F(x)}{\max(1,\,|F|)} \;\in\; \mathbb{Q},densF​(x)=max(1,∣F∣)occF​(x)​∈Q,

where the numerator occ⁡F(x)\operatorname{occ}_F(x)occF​(x) and the denominator max⁡(1,∣F∣)\max(1,|F|)max(1,∣F∣) are natural numbers (the maximum is taken among natural numbers) viewed as rationals. The denominator is always ≥1\ge 1≥1, so this is an ordinary quotient and the "division by zero gives zero" convention of the rationals is never invoked. If F≠∅F \neq \emptysetF=∅ this equals occ⁡F(x)/∣F∣\operatorname{occ}_F(x) / |F|occF​(x)/∣F∣, a rational in [0,1][0,1][0,1] (the fraction of members of FFF containing xxx); if F=∅F = \emptysetF=∅ it equals 0/1=00/1 = 00/1=0 for every xxx.

Definition Nondegenerate ("FFF is nondegenerate") is the proposition

F≠∅∧F≠{∅},F \neq \emptyset \quad\wedge\quad F \neq \{\emptyset\},F=∅∧F={∅},

i.e. FFF is neither the empty family nor the family whose only member is the empty set. (This definition takes no decidable-equality assumption.) It does not say that ∅∉F\emptyset \notin F∅∈/F, and it does not require FFF to have two or more members: for example {A}\{A\}{A} with A≠∅A \neq \emptysetA=∅, and {∅,A}\{\emptyset, A\}{∅,A} with A≠∅A \neq \emptysetA=∅, are both nondegenerate. Literally, the condition is equivalent to "FFF has at least one member that is a nonempty set"; in particular a nondegenerate FFF can only exist when UUU has at least one element (if UUU is empty, every FFF is ∅\emptyset∅ or {∅}\{\emptyset\}{∅}).

Human review
  • Endorsed by Shuze Chen · Nov 4, 2026

    Confirmed by the moderator at approval.

  • Endorsed by utkuokur · Nov 4, 2026

    Confirmed by the mission captain (proposal self-audit).

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me