Kruskal.processEdges_skip
Skipping an intra-component edge in the sweep. Fix a number of nodes $n$, a union-find state $\mathit{uf} : \mathrm{Fin}\,n \to \bbn$, a weighted edge $e$ over $n$ vertices with endpoints $u$ and $v$, and a list $\mathit{rest}$ of further weighted edges over $n$ vertices. Suppose the two endpoints of $e$ already have the same representative in $\mathit{uf}$, that is, $\mathit{uf}(u) = \mathit{uf}(v)$. Then the edge-selection sweep applied to the list $e :: \mathit{rest}$ starting from state $\mathit{uf}$ with empty accumulator returns exactly the same edge list as the sweep applied to $\mathit{rest}$ starting from the same state $\mathit{uf}$ with empty accumulator.
Statement
set_option relaxedAutoImplicit false in set_option autoImplicit false in lemma Kruskal.processEdges_skip {n : ℕ} {e : WEdge n} {rest : List (WEdge n)} {uf : UF n} (h : uf.find e.u = uf.find e.v) : processEdges (e :: rest) uf [] = processEdges rest uf []
- Source
- TCSlib, `Kruskal.processEdges_skip`
- Lean proof
- By Harsha Polavaram, from github.com/Shilun-Allan-Li/tcslib at
c8a02591b1e5(Copyright (c) 2026 Harsha Polavaram. 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.processEdges_skip← Kruskal.processEdges_skip (TCSlib/GraphTheory/Kruskal/Optimality.lean:73): verbatim
- Verified
- 07 Oct 2026
- Axioms
propext- Built on 5
- Kruskal.UFThe union-find state for $n$ nodes is defined as a function $\mathrm{Fin}\,n \to \mathbb{N}$ mapping each node to its current…
- Kruskal.UF.find$\mathtt{find}\,\mathit{uf}\,i$ returns the representative of node $i$ in the union-find state $\mathit{uf}$, defined simply as…
- Kruskal.processEdges$\mathtt{processEdges}\,\mathit{es}\,\mathit{uf}\,\mathit{acc}$ scans the edge list $\mathit{es}$ left-to-right: an edge $e$ is added to…
- Kruskal.UF.find_defFind equals direct lookup. Let $\mathit{uf} \colon \mathrm{Fin}\,n \to \bbn$ be a union-find state on $n$ nodes, and let $i$ be one of its…
- 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 1
- Kruskal.processEdges_optimalOptimality of the greedy edge-selection sweep. Let $\mathit{edges}$ be a list of weighted edges on $n$ vertices, sorted in nondecreasing…
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option relaxedAutoImplicit false inset_option autoImplicit false inlemma Kruskal.processEdges_skip {n : ℕ} {e : WEdge n} {rest : List (WEdge n)} {uf : UF n} (h : uf.find e.u = uf.find e.v) : processEdges (e :: rest) uf [] = processEdges rest uf [] := if_neg (by aesop)