Proposition 3.7.1 (degree via Prüfer occurrence count)
ProvedGYGraphTheory.prop_3_7_1Proposition 3.7.1 (Gross–Yellen, p. 159). For every : let be a labeled tree on vertices and let denote the number of occurrences of the label in the Prüfer sequence of (pruferEncode T, Algorithm 3.7.1). Then the degree of the vertex labeled in equals .
The source proves this by induction on : the claim holds trivially for the 2-vertex tree (empty Prüfer sequence, every vertex has degree 1), and for the inductive step, removing the smallest-labeled leaf (whose neighbor becomes the first entry of the sequence) decreases by exactly one while leaving every other vertex's degree, and every other label's occurrence count in the remaining sequence, unchanged. (The hypothesis is needed: a 1-vertex tree has a degree-0 vertex, for which this formula would be false.)
import Definitions.Def_GYGraphTheory import Mathlib open scoped Classical
namespace GYGraphTheory
theorem prop_3_7_1 {n : ℕ} (hn : 2 ≤ n) (T : SimpleGraph (Fin n)) (hT : T.IsTree) (k : Fin n) :
haveI : NeZero n := ⟨by omega⟩
T.degree k = (List.ofFn (pruferEncode T)).count k + 1 := by sorry
end GYGraphTheoryRead-back
What the Lean code literally says, in plain math · claude-sonnet-5
Read-back. For every natural number with , every simple graph on the vertex set that is a tree (i.e. is connected and acyclic, per Mathlib's SimpleGraph.IsTree), and every vertex , the statement asserts , where "Prüfer sequence of " is the explicit length- list produced as follows. Build a sequence of pairs (active vertex set, accumulated list) starting from (all vertices), ; at each step , among let (its "active neighbors"), call an active leaf of if and , let be the least active leaf of in the standard order on (or the junk value if no active leaf of exists), let be the least element of (again by convention if that set is empty), and set , ; the Prüfer sequence is then (the entry at position is literally the last, and only newly-appended, element of , so the getD 0 fallback used in pruferEncode is never actually triggered on this indexing). The right-hand side counts how many times the fixed vertex occurs among , and the left-hand side is the ordinary graph degree of in (the cardinality of its neighbor set). No claim is made about existence/uniqueness of active leaves at each stage beyond what the hypothesis and the definitions force; in the boundary case , is empty, so the Prüfer sequence is the empty list, every count is , and the statement reduces to asserting for each of the two vertices .
Confirmed by the mission captain (proposal self-audit).