AFTD Auto-Formalizing Theoretical Domains

Kruskal.UF.find

defimported Lean

$\mathtt{find}\,\mathit{uf}\,i$ returns the representative of node $i$ in the union-find state $\mathit{uf}$, defined simply as $\mathit{uf}(i)$.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def Kruskal.UF.find {n : ℕ} (uf : UF n) (i : Fin n) : ℕ
Defined in
TCSlib, `Kruskal.UF.find`
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.
Verified
07 Oct 2026
Axioms
none listed
Built on 1
  • 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…
Used by 6
  • 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.processEdges_optimalOptimality of the greedy edge-selection sweep. Let $\mathit{edges}$ be a list of weighted edges on $n$ vertices, sorted in nondecreasing…
  • 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.processEdges_skipSkipping 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…
  • 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…
  • Kruskal.UF.init_findFind on the initial union-find. Consider the identity union-find on $n$ nodes, in which every node is its own representative. For every…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def Kruskal.UF.find {n : ℕ} (uf : UF n) (i : Fin n) : ℕ := uf i
See it in the graphDiscuss this resultChallenge it