Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Graph minors, the Hadwiger number and Wagner planarity

Definition
TenChallenges_Minor

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

graph-theoryminorsplanarity

The minor relation for Mathlib's simple graphs, shared by Challenges 1 and 6 of the Ten Challenges benchmark.

  1. Minor. For graphs HHH on WWW and GGG on VVV, a minor structure of HHH in GGG consists of branch sets Bw⊆VB_w\subseteq VBw​⊆V for w∈Ww\in Ww∈W which are pairwise disjoint, each inducing a connected (hence nonempty) subgraph of GGG, such that for every edge w1w2w_1w_2w1​w2​ of HHH some vertex of Bw1B_{w_1}Bw1​​ is adjacent in GGG to some vertex of Bw2B_{w_2}Bw2​​. HHH is a minor of GGG when such a structure exists.
  2. Hadwiger number. For a finite graph GGG, h(G)h(G)h(G) is the largest r≤∣V∣r\le |V|r≤∣V∣ such that the complete graph KrK_rKr​ is a minor of GGG.
  3. Planarity. K5K_5K5​ and K3,3K_{3,3}K3,3​ denote the complete graph on five vertices and the complete bipartite graph with sides of size three; GGG is Wagner-planar if neither K5K_5K5​ nor K3,3K_{3,3}K3,3​ is a minor of GGG. By Wagner's theorem this is planarity for finite graphs.

Formalization Note. Minor H G is a structure (data, not a proposition); "HHH is a minor of GGG" is Nonempty (Minor H G). The Hadwiger number is Nat.findGreatest over r≤∣V∣r\le|V|r≤∣V∣, so it is 000 for the graph with no vertices.

Definition code
import Mathlib.Combinatorics.SimpleGraph.Coloring.Vertex

namespace SimpleGraph

variable {V W : Type*}

/-- The data witnessing that `H` is a minor of `G`, as simple graphs. -/
structure Minor (H : SimpleGraph W) (G : SimpleGraph V) where
  /-- The branch sets of the minor.

  Seeing the minor as a quotient graph, `branchSet w` is exactly the fiber of `w` under the quotient
  map. -/
  branchSet : W → Set V
  /-- The branch sets are pairwise disjoint. -/
  pairwise_disjoint_branchSet : Pairwise fun w₁ w₂ ↦ Disjoint (branchSet w₁) (branchSet w₂)
  /-- Each branch set is connected (in particular nonempty). -/
  connectedOn_branchSet (w : W) : (G.induce (branchSet w)).Connected
  /-- Adjacency in the minor induce adjacency between some points of the corresponding branch set.
  -/
  exists_mem_branchSet_of_adj ⦃w₁ w₂ : W⦄ :
    H.Adj w₁ w₂ → ∃ v₁ ∈ branchSet w₁, ∃ v₂ ∈ branchSet w₂, G.Adj v₁ v₂

/-- The Hadwiger number: the largest `r` such that `K_r` is a minor of `G`. -/
noncomputable def hadwigerNumber [Fintype V] (G : SimpleGraph V) : ℕ := by
  classical
  exact Nat.findGreatest (fun r =>
    Nonempty (Minor (completeGraph (Fin r)) G)) (Fintype.card V)

/-- K₅ -/
abbrev K5 := completeGraph (Fin 5)

/-- K₃,₃ -/
abbrev K33 := completeBipartiteGraph (Fin 3) (Fin 3)

/-- Planarity via Wagner's criterion: no `K₅` or `K₃,₃` minor. -/
def IsWagnerPlanar (G : SimpleGraph V) : Prop :=
  ¬ Nonempty (Minor K5 G) ∧ ¬ Nonempty (Minor K33 G)

end SimpleGraph
Source
Ten Challenges repository, file Defs_and_Lems/Minor.lean (commit ff14a56), https://github.com/TenChallenges/ten-challenges/blob/main/Defs_and_Lems/Minor.lean; definitions following R. Diestel, Graph Theory, 5th ed., Sections 1.7 and 4.4.
Read-back

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

Setting. Every declaration in this file lives in the SimpleGraph namespace. VVV and WWW are arbitrary types (possibly infinite, in arbitrary universes); no finiteness or decidability is assumed unless stated. A simple graph on a type is, as in Mathlib, an irreflexive symmetric adjacency relation; u∼Gvu \sim_G vu∼G​v denotes adjacency in GGG.

Structure Minor H G. For a simple graph HHH on WWW and a simple graph GGG on VVV, a minor witness of HHH in GGG consists of exactly the following data and conditions:

  1. Branch sets. A function B:W→P(V)B : W \to \mathcal P(V)B:W→P(V), w↦Bw⊆Vw \mapsto B_w \subseteq Vw↦Bw​⊆V.
  2. Pairwise disjointness. For all w1,w2∈Ww_1, w_2 \in Ww1​,w2​∈W with w1≠w2w_1 \neq w_2w1​=w2​: Bw1∩Bw2=∅B_{w_1} \cap B_{w_2} = \emptysetBw1​​∩Bw2​​=∅.
  3. Connectedness. For every w∈Ww \in Ww∈W, the induced subgraph G[Bw]G[B_w]G[Bw​] (vertex set BwB_wBw​; two vertices of BwB_wBw​ are adjacent iff they are adjacent in GGG) is connected in Mathlib's sense, which means both that Bw≠∅B_w \neq \emptysetBw​=∅ and that any two vertices u,v∈Bwu, v \in B_wu,v∈Bw​ are joined by a walk u=v0∼Gv1∼G⋯∼Gvk=vu = v_0 \sim_G v_1 \sim_G \dots \sim_G v_k = vu=v0​∼G​v1​∼G​⋯∼G​vk​=v (k≥0k \ge 0k≥0 allowed) all of whose vertices lie in BwB_wBw​.
  4. Edge lifting. For all w1,w2∈Ww_1, w_2 \in Ww1​,w2​∈W: if w1∼Hw2w_1 \sim_H w_2w1​∼H​w2​, then there exist v1∈Bw1v_1 \in B_{w_1}v1​∈Bw1​​ and v2∈Bw2v_2 \in B_{w_2}v2​∈Bw2​​ with v1∼Gv2v_1 \sim_G v_2v1​∼G​v2​.

Nothing else is required: the branch sets need not cover VVV; no condition is imposed when w1̸∼Hw2w_1 \not\sim_H w_2w1​∼H​w2​ (edges of GGG between Bw1B_{w_1}Bw1​​ and Bw2B_{w_2}Bw2​​ are allowed); if WWW is empty, BBB is the empty function and conditions 2–4 hold vacuously, so every graph GGG admits a minor witness of the graph with no vertices. In the rest of the file "Nonempty (Minor H G)" means that at least one such witness exists; below I abbreviate this as "HHH is a minor of GGG", always in exactly this sense.

hadwigerNumber G. Defined only when VVV is a finite type (Fintype V), using classical decidability. It is the natural number

findGreatest⁡(r↦“Kr is a minor of G”, ∣V∣),\operatorname{findGreatest}\big(r \mapsto \text{“}K_r \text{ is a minor of } G\text{”},\ |V|\big),findGreatest(r↦“Kr​ is a minor of G”, ∣V∣),

i.e. the largest rrr with 0≤r≤∣V∣0 \le r \le |V|0≤r≤∣V∣ such that KrK_rKr​ — the complete graph on Fin r={0,…,r−1}\mathrm{Fin}\,r = \{0,\dots,r-1\}Finr={0,…,r−1}, in which i∼j  ⟺  i≠ji \sim j \iff i \neq ji∼j⟺i=j — is a minor of GGG in the above sense, with the convention that the result is 000 when no r∈{1,…,∣V∣}r \in \{1,\dots,|V|\}r∈{1,…,∣V∣} qualifies. Since r=0r = 0r=0 always qualifies (empty vertex type, vacuous conditions), the value is exactly max⁡{ r≤∣V∣:Kr is a minor of G }\max\{\, r \le |V| : K_r \text{ is a minor of } G \,\}max{r≤∣V∣:Kr​ is a minor of G}; values r>∣V∣r > |V|r>∣V∣ are never examined.

K5. The complete graph on Fin 5\mathrm{Fin}\,5Fin5: five vertices, all ten pairs of distinct vertices adjacent.

K33. Mathlib's completeBipartiteGraph (Fin 3) (Fin 3): the vertex type is the disjoint union Fin 3⊔Fin 3\mathrm{Fin}\,3 \sqcup \mathrm{Fin}\,3Fin3⊔Fin3 (six vertices, each tagged "left" or "right"), and v∼wv \sim wv∼w iff (vvv is left and www is right) or (vvv is right and www is left). There are no edges inside a side; all nine left–right pairs are adjacent.

IsWagnerPlanar G. For a simple graph GGG on an arbitrary type VVV (no finiteness assumed), the proposition

¬(∃ minor witness of K5 in G) ∧ ¬(∃ minor witness of K3,3 in G).\neg\big(\exists\ \text{minor witness of } K_5 \text{ in } G\big)\ \wedge\ \neg\big(\exists\ \text{minor witness of } K_{3,3} \text{ in } G\big).¬(∃ minor witness of K5​ in G) ∧ ¬(∃ minor witness of K3,3​ in G).

Unfolded: there is no family (Bw)w∈Fin 5(B_w)_{w \in \mathrm{Fin}\,5}(Bw​)w∈Fin5​ of pairwise disjoint subsets of VVV, each nonempty and connected inside GGG, such that for every two distinct indices w1≠w2w_1 \ne w_2w1​=w2​ some vertex of Bw1B_{w_1}Bw1​​ is GGG-adjacent to some vertex of Bw2B_{w_2}Bw2​​; and there is no family (Bw)w∈Fin 3⊔Fin 3(B_w)_{w \in \mathrm{Fin}\,3 \sqcup \mathrm{Fin}\,3}(Bw​)w∈Fin3⊔Fin3​ of pairwise disjoint subsets of VVV, each nonempty and connected inside GGG, such that for every left index w1w_1w1​ and every right index w2w_2w2​ some vertex of Bw1B_{w_1}Bw1​​ is GGG-adjacent to some vertex of Bw2B_{w_2}Bw2​​. No other notion of planarity (embeddings in the plane, Euler's formula, etc.) appears in the definition.

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).

  • Endorsed by mikedeng1 · Nov 12, 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