Proposition 3.7.3 (decoding always yields a tree)
ProvedGYGraphTheory.prop_3_7_3Proposition 3.7.3 (Gross–Yellen, p. 161). For every and every sequence of labels (a Prüfer sequence), the graph produced by Prüfer decoding (pruferDecode s, Algorithm 3.7.3) is a genuine tree on the labeled vertices — i.e. it is connected and acyclic. The source proves this by induction on : the base case () is a single edge, and the inductive step observes that adding a new vertex , absent from the smaller-vertex-set subtree already built by recursion, joined by one edge to an existing vertex of that subtree, cannot create a cycle and keeps the graph connected.
import Definitions.Def_GYGraphTheory import Mathlib
namespace GYGraphTheory
theorem prop_3_7_3 {n : ℕ} (hn : 2 ≤ n) (s : Fin (n - 2) → Fin n) :
haveI : NeZero n := ⟨by omega⟩
(pruferDecode s).IsTree := by sorry
end GYGraphTheoryRead-back
What the Lean code literally says, in plain math · claude-sonnet-5
Read‑back of GYGraphTheory.prop_3_7_3.
Fix a natural number with and an arbitrary function — no injectivity, surjectivity, or any other condition is imposed on ; it may repeat values or even be constant (e.g. ). Write for the list List.ofFn s (empty when , since has no elements). Define a graph pruferDecodeAux P L on vertex set by recursion on the list argument, starting from (all of ): given a nonempty remaining list with head and tail and current set , let be the least element of — i.e. the smallest label still "available" that does not occur anywhere in the as‑yet‑unprocessed part of the sequence — defaulting to if that set happens to be empty; add the edge (silently dropped if , since fromEdgeSet discards self‑loops) and recurse on with removed from , taking the union (of edge sets, via ) with this edge. When the list is exhausted, take and (each defaulting to if the relevant set is empty) and output the single edge (again dropped if ). This produces up to edges from the recursive steps plus one final edge from the base case — the standard Prüfer‑sequence decoding procedure. pruferDecode s is this graph run on the full input starting from (as a Finset). (The hypothesis hn : 2 ≤ n is used only to derive the typeclass instance NeZero n via omega, so that Fin n and the decoding are well‑formed; it contributes no separate mathematical content beyond enabling the statement to typecheck.)
The theorem asserts: for every and for every function whatsoever (with no further hypotheses), the graph pruferDecode s on the ‑element vertex set is a tree in Mathlib's sense — that is, it is connected (any two vertices are joined by a path) and acyclic (it contains no cycle), which in particular forces it to have exactly edges and forces the vertex type to be nonempty (automatic here since ). No claim is made about the relationship between and the tree beyond this: the statement covers every conceivable input sequence uniformly, including degenerate ones such as (where is empty, so the "decoding" is forced to be the single base‑case edge regardless of ) and constant or repeated‑value sequences, and it says nothing about uniqueness of for a given tree or about any inverse (encoding) map.
Confirmed by the mission captain (proposal self-audit).