Kruskal.totalWeight
defimported Lean
The total weight of an edge list is the sum of the weights of all its edges: $\mathtt{totalWeight}\,\mathit{edges} = \sum_{e \in \mathit{edges}} e.\mathit{weight}$.
Statement
set_option relaxedAutoImplicit false in set_option autoImplicit false in def Kruskal.totalWeight {n : ℕ} (edges : List (WEdge n)) : ℕ
- Defined in
- TCSlib, `Kruskal.totalWeight`
- Lean proof
- By [Your Name], [Partner's Name (if applicable)], from github.com/Shilun-Allan-Li/tcslib at
c8a02591b1e5(Copyright (c) 2026 [Your Name] and [Partner's Name (if applicable)]. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.Kruskal.totalWeight← Kruskal.totalWeight (TCSlib/GraphTheory/Kruskal/Reach.lean:39): verbatim
- Verified
- 07 Oct 2026
- Axioms
- none listed
- Built on 1
- Kruskal.WEdgeA weighted edge over $n$ vertices is a structure with two endpoints $u, v : \mathrm{Fin}\,n$ and a natural-number weight…
- Used by 6
- Kruskal.totalWeight_eraseTotal weight after removing an edge. Let $\mathit{edges}$ be a list of weighted edges over $n$ vertices, and let $e$ be a weighted edge…
- Kruskal.totalWeight_nilTotal weight of the empty edge list. Over any number of vertices $n$, the total weight of the empty list of weighted edges is $0$; that…
- Kruskal.kruskal_optimalOptimality of Kruskal's algorithm. Let $E$ be a list of weighted edges on $n$ vertices, and let $S$ be another such list in which every…
- Kruskal.processEdges_optimalOptimality of the greedy edge-selection sweep. Let $\mathit{edges}$ be a list of weighted edges on $n$ vertices, sorted in nondecreasing…
- Kruskal.reduce_to_restDropping a redundant edge from a candidate set. Let $\mathit{uf}$ be a union-find state on $n$ nodes, let $e$ be a weighted edge with…
- Kruskal.processEdges_take_weightWeight contributed by an accepted edge. Fix a natural number $n$ and a union-find state $\mathit{uf}$ over $n$ nodes, and let $e$ be a…
Lean source view module on GitHub
set_option relaxedAutoImplicit false in set_option autoImplicit false in def Kruskal.totalWeight {n : ℕ} (edges : List (WEdge n)) : ℕ := (edges.map WEdge.weight).sum