Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 2.5 — each (V, E_i) output by FOREST is a maximal spanning forest in G − E_1 ∪ ⋯ ∪ E_{i−1}

Proved
NagamochiIbaraki.EdgeConn.lemma_2_5

by mikedeng1 · Sep 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

graph-algorithmsp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1spanning-forest

Let G=(V,E)G = (V, E)G=(V,E) be a finite multigraph without self-loops and with ∣V∣≥2|V| \ge 2∣V∣≥2, and let E1,E2,…,E∣E∣E_1, E_2, \dots, E_{|E|}E1​,E2​,…,E∣E∣​ be the classes obtained by Procedure FOREST upon completion (for any choices at lines 5 and 6). Then for every i=1,2,…,∣E∣i = 1, 2, \dots, |E|i=1,2,…,∣E∣,

(V,Ei) is a maximal spanning forest in G−(E1∪E2∪⋯∪Ei−1),(V, E_i) \text{ is a maximal spanning forest in } G - (E_1 \cup E_2 \cup \cdots \cup E_{i-1}),(V,Ei​) is a maximal spanning forest in G−(E1​∪E2​∪⋯∪Ei−1​),

that is, EiE_iEi​ is a forest contained in E∖(E1∪⋯∪Ei−1)E \setminus (E_1 \cup \dots \cup E_{i-1})E∖(E1​∪⋯∪Ei−1​), and adding to it any other edge of that set creates a cycle. For i=1i = 1i=1 the removed union is empty and E1E_1E1​ is a maximal spanning forest of GGG itself.

Lemma 2.5 says that the single scan of FOREST produces exactly the sequence of forests required by Lemma 2.1; combined with Lemma 2.1 it gives inequality (2.1) for the output of FOREST.

Formalization Note The classes are those of the final state σK\sigma_KσK​ of a completed run. The ground set G−E1∪⋯∪Ei−1G - E_1 \cup \dots \cup E_{i-1}G−E1​∪⋯∪Ei−1​ is written as the set of edges whose final index does not lie in {1,…,i−1}\{1, \dots, i-1\}{1,…,i−1}; at i=1i = 1i=1 this is all of EEE.

Preamble
import Mathlib
import Definitions.Def_NagamochiIbaraki_EdgeConn_Multigraph
import Definitions.Def_NagamochiIbaraki_EdgeConn_localEdgeConn
import Definitions.Def_NagamochiIbaraki_EdgeConn_Forest
Formal statement
namespace NagamochiIbaraki.EdgeConn

theorem lemma_2_5
    {V E : Type*} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E]
    (hV : 2 ≤ Fintype.card V)
    (ends : E → Sym2 V) (hloop : ∀ e, ¬ (ends e).IsDiag)
    (σ : ℕ → State V E) (K : ℕ) (hrun : IsCompletedRun ends σ K) :
    ∀ i : ℕ, 1 ≤ i → i ≤ Fintype.card E →
      IsMaxSpanningForest ends
        (Finset.univ.filter (fun e => ¬ (1 ≤ (σ K).idx e ∧ (σ K).idx e ≤ i - 1)))
        (cls (σ K) i) := by sorry

end NagamochiIbaraki.EdgeConn
Source
Nagamochi, Ibaraki, A Linear-Time Algorithm for Finding a Sparse k-Connected Spanning Subgraph of a k-Connected Graph, Algorithmica 7 (1992), p. 588, Lemma 2.5
Read-back

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

Setting. Let VVV be a finite node set with ∣V∣≥2|V|\ge2∣V∣≥2 and EEE a finite edge set, both with decidable equality. Let ends:E→Sym2(V)\mathrm{ends}:E\to\mathrm{Sym}^2(V)ends:E→Sym2(V) assign unordered end pairs, with no loops; parallel edges are allowed.

States and steps. A state sss has labels rs:V→Nr_s:V\to\mathbb Nrs​:V→N, edge classes ιs:E→N\iota_s:E\to\mathbb Nιs​:E→N, a scanned-node set DsD_sDs​, an optional current node and a list. The initial state has r≡0r\equiv0r≡0, ι≡0\iota\equiv0ι≡0, D=∅D=\emptysetD=∅, no current node and the empty list. A step is one of:

  • select: there is no current node, and x∉Dsx\notin D_sx∈/Ds​ has maximal rsr_srs​ among unscanned nodes. Then xxx becomes current and is appended to the list.
  • scan: the current node is xxx, and eee has ιs(e)=0\iota_s(e)=0ιs​(e)=0 and ends(e)={x,y}\mathrm{ends}(e)=\{x,y\}ends(e)={x,y}. Then ι(e):=rs(y)+1\iota(e):=r_s(y)+1ι(e):=rs​(y)+1, r(y):=rs(y)+1r(y):=r_s(y)+1r(y):=rs​(y)+1, and r(x)r(x)r(x) is incremented if rs(x)=rs(y)r_s(x)=r_s(y)rs​(x)=rs​(y).
  • finish: the current node is xxx, and all edges containing xxx have nonzero class. Then xxx joins DDD and there is no current node.

Completed run. σ0\sigma_0σ0​ is initial, there is a step from σk\sigma_kσk​ to σk+1\sigma_{k+1}σk+1​ for each k<Kk<Kk<K, and DσK=VD_{\sigma_K}=VDσK​​=V. Write ι=ισK\iota=\iota_{\sigma_K}ι=ισK​​ and Ei={e:ι(e)=i}E_i=\{e:\iota(e)=i\}Ei​={e:ι(e)=i}.

Claim. For every iii with 1≤i≤∣E∣1\le i\le|E|1≤i≤∣E∣, let

Hi={e∈E: not (1≤ι(e)≤i−1)},H_i=\{e\in E:\ \text{not } (1\le\iota(e)\le i-1)\},Hi​={e∈E: not (1≤ι(e)≤i−1)},

the edges whose final class is 000 or at least iii. Then EiE_iEi​ is a maximal spanning forest of HiH_iHi​, meaning all three of the following hold:

  • Ei⊆HiE_i\subseteq H_iEi​⊆Hi​;
  • EiE_iEi​ is a forest: for each e∈Eie\in E_ie∈Ei​ with ends(e)={u,v}\mathrm{ends}(e)=\{u,v\}ends(e)={u,v}, the nodes uuu and vvv are not connected by a path in the simple graph on VVV whose adjacencies come from the other edges of EiE_iEi​;
  • for each e∈Hi∖Eie\in H_i\setminus E_ie∈Hi​∖Ei​, the set Ei∪{e}E_i\cup\{e\}Ei​∪{e} is not a forest in this sense.

Degenerate cases:

  • For i=1i=1i=1, the condition 1≤ι(e)≤01\le\iota(e)\le01≤ι(e)≤0 is impossible, so H1=EH_1=EH1​=E.
  • If EEE is empty, the claim is vacuous.
  • K=0K=0K=0 cannot occur, because Dσ0=∅≠VD_{\sigma_0}=\emptyset\ne VDσ0​​=∅=V when ∣V∣≥2|V|\ge2∣V∣≥2.
  • Classes i>∣E∣i>|E|i>∣E∣ are not covered.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me