Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§II — each application of P1 or P2 joins two components: no loops, N − k components

Proved
ShortestConnection.Principles.construction_acyclic_card_components

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

graph-theoryp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1spanning-trees

Let GGG be a simple graph on a finite set VVV of NNN terminals with real edge lengths www, and let e0,…,ek−1e_0,\dots,e_{k-1}e0​,…,ek−1​ be a construction by P1 and P2. Then the links F={e0,…,ek−1}F = \{e_0,\dots,e_{k-1}\}F={e0​,…,ek−1​} contain no closed loop, and the number of connected components of the link graph H(F)H(F)H(F) (isolated terminals and isolated fragments together) is

# components(H(F))=N−k.\#\,\mathrm{components}\bigl(H(F)\bigr) = N - k.#components(H(F))=N−k.

This is Prim's observation that each application of either principle reduces the number of isolated terminals and fragments by one; it is the counting step behind "an NNN-terminal network is connected by N−1N-1N−1 applications".

Formalization Note The component count is Nat.card of the connected components of the link graph; N−kN - kN−k is natural-number subtraction. No connectivity of GGG is needed.

Preamble
import Mathlib
import Definitions.Def_ShortestConnection_Principles_SpanningSubtree
import Definitions.Def_ShortestConnection_Principles_Construction
Formal statement
namespace ShortestConnection.Principles

/-- Prim 1957, §II, p. 1392 ("each application of either P1 or P2 reduces the total number of
isolated terminals and fragments by one"): after the links of any construction by P1 and P2 have
been made, the links form no closed loop, and the number of connected components (isolated
terminals and isolated fragments) is the number of terminals minus the number of links made.
No hypothesis on `G` or on the lengths is needed. -/
theorem construction_acyclic_card_components {V : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) (w : Sym2 V → ℝ) (l : List (Sym2 V)) (hl : IsConstruction G w l) :
    (linkGraph l.toFinset).IsAcyclic ∧
      Nat.card (linkGraph l.toFinset).ConnectedComponent = Fintype.card V - l.length := by sorry

end ShortestConnection.Principles
Source
Prim, Shortest Connection Networks And Some Generalizations, Bell System Tech. J. 36 (1957), p. 1392, §II
Read-back

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

Let VVV be a finite type with decidable equality and N=∣V∣N = |V|N=∣V∣ elements. Let GGG be any simple graph on VVV, and let www be any real-valued length on unordered pairs. Let lll be a list of unordered pairs that is a construction for GGG and www.

A construction is a list in which each entry lil_ili​ is either:

  • a P1 step relative to {l0,…,li−1}\{l_0,\dots,l_{i-1}\}{l0​,…,li−1​}: a pair {t,n}\{t,n\}{t,n} with ttt touched by no earlier non-degenerate link, t∼Gnt \sim_G nt∼G​n, and w({t,n})w(\{t,n\})w({t,n}) minimal among the GGG-edges at ttt; or
  • a P2 step: a pair {u,n}\{u,n\}{u,n} with uuu having an earlier link, nnn not reachable from uuu by earlier links, u∼Gnu\sim_G nu∼G​n, and w({u,n})w(\{u,n\})w({u,n}) at most the length of every GGG-edge from the earlier-link component of uuu to its complement.

Let L\mathcal LL be the graph on VVV whose edges are the non-degenerate entries of lll. The theorem asserts two things:

  1. L\mathcal LL has no cycles;
  2. the number of connected components of L\mathcal LL equals N−∣l∣N - |l|N−∣l∣, where ∣l∣|l|∣l∣ is the number of list entries (repeats counted) and the subtraction is natural-number subtraction:
#components(L)=N−˙∣l∣.\#\text{components}(\mathcal L) = N \mathbin{\dot-} |l|.#components(L)=N−˙​∣l∣.

There are no hypotheses on GGG (it may be disconnected) or on www (ties and negative values are allowed).

Degenerate cases. If VVV is empty, only the empty list is a construction, since a step needs a terminal. The claim is then that the empty graph is acyclic and has 0=0−00 = 0 - 00=0−0 components. If lll is empty, the claim is that the edgeless graph has NNN components. Because the subtraction is truncated, the equation read literally allows ∣l∣>N|l| > N∣l∣>N with 000 components. The theorem asserts the stated equality for every construction.

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