AFTD Auto-Formalizing Theoretical Domains

Kruskal.erase_append_perm

theoremverifiedimported Lean

Moving a member to the end is a permutation. Let $l$ be a finite list of weighted edges over $n$ vertices, and let $e$ be a weighted edge that occurs in $l$. Then $l$ is a permutation of the list obtained by deleting the first occurrence of $e$ from $l$ and appending $e$ at the end.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
lemma Kruskal.erase_append_perm {n : ℕ} {l : List (WEdge n)} {e : WEdge n} (he : e ∈ l) :
    l.Perm (l.erase e ++ [e])
Source
TCSlib, `Kruskal.erase_append_perm`
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
Classical.choiceQuot.soundpropext
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 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

set_option relaxedAutoImplicit false inset_option autoImplicit false inlemma Kruskal.erase_append_perm {n : ℕ} {l : List (WEdge n)} {e : WEdge n} (he : e ∈ l) :    l.Perm (l.erase e ++ [e]) := by grind
See it in the graphDiscuss this resultChallenge it