AFTD Auto-Formalizing Theoretical Domains

Kruskal.UF.init_find

theoremverifiedimported Lean

Find on the initial union-find. Consider the identity union-find on $n$ nodes, in which every node is its own representative. For every node $i \in \mathrm{Fin}\,n$, applying the find operation to this initial state returns the underlying numeric value of $i$; that is, the representative of $i$ is $i$ itself.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
@[simp] lemma Kruskal.UF.init_find {n : ℕ} (i : Fin n) : (init n).find i = i.val
Source
TCSlib, `Kruskal.UF.init_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 — Lean reports it depends on no axioms
Built on 2
  • Kruskal.UF.init$\mathtt{init}\,n$ constructs the identity union-find on $n$ nodes: every node $i$ is its own representative, i.e.\…
  • Kruskal.UF.find$\mathtt{find}\,\mathit{uf}\,i$ returns the representative of node $i$ in the union-find state $\mathit{uf}$, defined simply as…
Used by 3
  • 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…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
@[simp] lemma Kruskal.UF.init_find {n : ℕ} (i : Fin n) : (init n).find i = i.val := rfl
See it in the graphDiscuss this resultChallenge it