P1 and P2 provide a shortest spanning subtree for any connected labelled graph with real edge lengths
ProvedShortestConnection.Principles.p1_p2_provide_sssLet be a connected simple graph on a finite set of terminals, and let assign an arbitrary real length to every edge (lengths may be zero, negative, or of mixed sign, and may tie). Then:
- a complete construction by P1 and P2 exists: a sequence of links, each an application of Principle 1 or Principle 2 with respect to the links made before it;
- the links of every complete construction form a shortest spanning subtree of :
This is the general statement of §IV of Prim's paper: "P1 and P2 will provide a SSS for any connected labelled graph with any set of real edge lengths." It contains the Basic Problem (complete graph, Euclidean distances) and the incomplete-graph case, and every choice of isolated terminal or fragment, of order, and of tie-breaking among nearest neighbors.
Formalization Note Missing edges of are never links (they have infinite length in Prim's distance table). The existence clause is part of "will provide" and rules out a vacuous reading.
import Mathlib import Definitions.Def_ShortestConnection_Principles_SpanningSubtree import Definitions.Def_ShortestConnection_Principles_Construction
namespace ShortestConnection.Principles
/-- Prim 1957, §IV, p. 1396: "P1 and P2 will provide a SSS for any connected labelled graph with
any set of real edge "lengths." The "lengths" need not even be positive, or of the same sign."
For every finite connected graph `G` and every real edge lengths `w`, a complete construction by
P1 and P2 (`N - 1` applications, `N = card V`) exists, and the links of every complete
construction form a shortest spanning subtree of `G`. -/
theorem p1_p2_provide_sss {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (hG : G.Connected) (w : Sym2 V → ℝ) :
(∃ l : List (Sym2 V), IsCompleteConstruction G w l) ∧
∀ l : List (Sym2 V), IsCompleteConstruction G w l → IsSSS G w l.toFinset := by sorry
end ShortestConnection.Principles
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
For every finite type of vertices with decidable equality, every simple graph on and every real-valued function on unordered pairs of vertices, the statement asserts two things, provided is connected.
Variables and hypotheses
- is a type of vertices. It is assumed to be finite, and equality of vertices is assumed to be decidable. has no other structure.
- is a simple graph on : an irreflexive, symmetric adjacency relation.
- assumes that is connected in Mathlib's sense. That means is nonempty and any two vertices are joined by a walk in .
- assigns a real number to every unordered pair of vertices. These pairs include the "diagonal" pairs and pairs that are not edges of . Nothing restricts the values of : they may be negative, zero or equal to each other.
Conclusion. Both of the following hold:
- Existence. There is a finite list of unordered vertex pairs such that
- Correctness. For every finite list of unordered vertex pairs, if holds, then
where is the finite set of pairs that occur in . Building this set ignores the order of the list and merges repeated entries.
The two predicates are not defined in the code shown. Both come from imported project files whose definitions were not provided:
- is a condition on the graph, the weight function and a list of pairs.
- is a condition on the graph, the weight function and a finite set of pairs.
This read-back cannot say what either condition requires. In particular, it cannot say whether:
- a "complete construction" must have a particular length (such as );
- its entries must be edges of ;
- it must be produced by a specific rule;
- "IsSSS" means that is a spanning tree of , or that its total -weight is minimal, or both.
Everything the theorem says beyond the two structural facts above depends on those definitions. The explanatory comment attached to the theorem is not part of what the code asserts, so this read-back does not use it.
Degenerate cases
- Empty . This is excluded, because Mathlib's connectedness requires to be nonempty.
- One vertex. has no edges and is connected. The theorem then asserts that some list satisfies , and that every such list's set of entries satisfies . Whether that list must be empty depends on the unseen definition.
- Values of . The statement places no condition on at all:
- Lengths may be negative, zero or tied, so a list with minimum total weight need not be unique.
- The values of on non-edges and on diagonal pairs are arbitrary. Whether they matter depends on the unseen definitions.
- Converting the list to a set. If a complete construction were allowed to repeat a pair, the repeats would disappear when the list is turned into a set. The statement's second part would then be about the smaller set.
- Existence is not vacuous. The first part asserts that a list satisfying exists. So, provided the theorem holds, the second part is not vacuously true for connected .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.