Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Necessary Condition 1 — every terminal of a SSS is directly connected to a nearest neighbor

Proved
ShortestConnection.Principles.necessary_condition_1

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 connected simple graph on a finite set VVV with at least two terminals, with arbitrary real edge lengths www, and let FFF be a shortest spanning subtree of GGG. Then every terminal ttt is directly connected in FFF to at least one nearest neighbor: there is a GGG-neighbor nnn of ttt with

{t,n}∈Fandw({t,n})≤w({t,m}) for every G-neighbor m of t.\{t,n\} \in F \quad\text{and}\quad w(\{t,n\}) \le w(\{t,m\}) \text{ for every } G\text{-neighbor } m \text{ of } t.{t,n}∈Fandw({t,n})≤w({t,m}) for every G-neighbor m of t.

This is Prim's NC1, from which Principle 1 follows: the link P1 adds is one that some shortest network must contain. Ties between lengths are allowed, which is why the conclusion is "at least one" nearest neighbor.

Formalization Note The connectivity of GGG and the existence of at least two terminals are implicit hypotheses of the paper, stated explicitly here; the second guarantees that a nearest neighbor exists. Nearest neighbors range over GGG-neighbors only (a missing edge has infinite length).

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

/-- Necessary Condition 1 (Prim 1957, p. 1392): every terminal in a shortest spanning subtree
`F` of the connected labelled graph `G` is directly connected to at least one nearest neighbor:
for every terminal `t` there is a `G`-neighbor `n` of `t` with `s(t, n) ∈ F` and
`w s(t, n) ≤ w s(t, m)` for every `G`-neighbor `m` of `t`. Lengths are arbitrary reals, ties are
allowed.
Implicit hypotheses made explicit: `G` is connected, and `V` has at least two terminals
(`Nontrivial V`), so that a nearest neighbor exists. -/
theorem necessary_condition_1 {V : Type*} [Fintype V] [DecidableEq V] [Nontrivial V]
    (G : SimpleGraph V) (hG : G.Connected) (w : Sym2 V → ℝ) (F : Finset (Sym2 V))
    (hF : IsSSS G w F) (t : V) :
    ∃ n : V, G.Adj t n ∧ s(t, n) ∈ F ∧ ∀ m : V, G.Adj t m → w s(t, n) ≤ w s(t, m) := by sorry

end ShortestConnection.Principles
Source
Prim, Shortest Connection Networks And Some Generalizations, Bell System Tech. J. 36 (1957), p. 1392, Necessary Condition 1
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 at least two elements. Let GGG be a connected simple graph on VVV, and let www be any real-valued length on unordered pairs, with ties and negative values allowed. Let FFF be a shortest spanning subtree of GGG for www:

  • every pair in FFF is an edge of GGG;
  • the graph on VVV with edge set FFF is a tree (connected and acyclic);
  • ∑e∈Fw(e)≤∑e∈F′w(e)\sum_{e\in F} w(e) \le \sum_{e\in F'} w(e)∑e∈F​w(e)≤∑e∈F′​w(e) for every finite set F′F'F′ with those same two properties.

Let ttt be any terminal. The theorem asserts that there is a terminal nnn with the following three properties:

  • t∼Gnt \sim_G nt∼G​n;
  • {t,n}∈F\{t,n\} \in F{t,n}∈F;
  • w({t,n})≤w({t,m})w(\{t,n\}) \le w(\{t,m\})w({t,n})≤w({t,m}) for every GGG-neighbour mmm of ttt.

So some link of FFF at ttt is a GGG-edge of minimal length among all GGG-edges at ttt.

Degenerate cases. Empty and one-element VVV are excluded by the hypotheses. If GGG has no spanning subtree, no SSS exists and the statement is vacuous. For connected GGG on finite VVV, spanning subtrees do exist. When several GGG-edges at ttt tie for the minimum, only one of them needs to lie in FFF.

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