AFTD Auto-Formalizing Theoretical Domains

Kruskal.UF.init

defimported Lean

$\mathtt{init}\,n$ constructs the identity union-find on $n$ nodes: every node $i$ is its own representative, i.e.\ $\mathtt{init}\,n\,(i) = i$.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def Kruskal.UF.init (n : ℕ) : UF n
Defined in
TCSlib, `Kruskal.UF.init`
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 4
  • Kruskal.kruskal$\mathtt{kruskal}\,n\,\mathit{edges}$ sorts the edge list by weight and then runs processEdges on the sorted list starting from…
  • 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.mergeAll_init_iffCorrectness of union-find merging from the initial state. Fix a natural number $n$, and let $\mathit{edges}$ be a list of weighted edges…
  • 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.init (n : ℕ) : UF n := fun i => i.val
See it in the graphDiscuss this resultChallenge it