AFTD Auto-Formalizing Theoretical Domains

Kruskal.SymAdj

defimported Lean

Given a list of weighted edges $\mathit{edges}$ on $n$ vertices, $\mathtt{SymAdj}\,\mathit{edges}\,u\,v$ holds when there exists an edge $e \in \mathit{edges}$ whose endpoints are $\{u, v\}$ (in either order), i.e.\ $(e.u = u \wedge e.v = v) \vee (e.u = v \wedge e.v = u)$.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def Kruskal.SymAdj {n : ℕ} (edges : List (WEdge n)) (u v : Fin n) : Prop
Defined in
TCSlib, `Kruskal.SymAdj`
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.
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 13
  • Kruskal.exchange_take_headHead-edge exchange preserves reachability. Let $\mathit{base}$ and $\mathit{rest}$ be lists of weighted edges on $n$ vertices, and let $g$…
  • Kruskal.symAdj_monoMonotonicity of symmetric adjacency. Fix $n \in \bbn$ and two vertices $u, v \in \mathrm{Fin}\,n$, and let $e_1$ and $e_2$ be lists of…
  • Kruskal.exchange_with_baseBase-relative exchange of an edge in Kruskal's algorithm. Let $\mathit{base}$ and $S$ be lists of weighted edges on $n$ vertices, and let…
  • Kruskal.uf_exchangeUnion-find form of the exchange argument. Let $\mathit{uf}\colon \mathrm{Fin}\,n \to \bbn$ be a union-find state whose classes coincide…
  • 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.symAdj_symmSymmetry of symmetric adjacency. Fix a list of weighted edges on $n$ vertices, and let $u$ and $v$ be two vertices. Recall that $u$ and…
  • Kruskal.reach_cons_iffHead–tail decomposition of reachability. Let $g$ be a weighted edge on $n$ vertices with endpoints $p$ and $q$, let $\mathit{rest}$ be a…
  • 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.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.mergeAll_iff_reachMerging preserves the reachability invariant. Fix $n$ and let $uf : \mathrm{Fin}\,n \to \bbn$ be a union-find state assigning each of the…
  • Kruskal.exchange_take_head'Edge exchange preserving reachability, reversed orientation. Fix $n$ and consider weighted edges on a vertex set of size $n$, each edge…
  • Kruskal.reach_liftLifting reachability along an edge set. Let $\mathit{edges}$ and $\mathit{edges}'$ be two lists of weighted edges on $n$ vertices, and…
  • Kruskal.Reach$\mathtt{Reach}\,\mathit{edges}$ is the reflexive--transitive closure of $\mathtt{SymAdj}\,\mathit{edges}$; that is,…

Lean source view module on GitHub

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
def Kruskal.SymAdj {n : ℕ} (edges : List (WEdge n)) (u v : Fin n) : Prop :=
  ∃ e ∈ edges, (e.u = u ∧ e.v = v) ∨ (e.u = v ∧ e.v = u)
See it in the graphDiscuss this resultChallenge it