AFTD Auto-Formalizing Theoretical Domains

Kruskal.reach_mem_iff

theoremverifiedimported Lean

Reachability depends only on the edge set. Fix $n \in \bbn$, and let $l_1$ and $l_2$ be two lists of weighted edges on the vertex set $\mathrm{Fin}\,n$ that have the same members, i.e.\ $x \in l_1 \Leftrightarrow x \in l_2$ for every weighted edge $x$. Then for any vertices $a, b \in \mathrm{Fin}\,n$, the vertex $b$ is reachable from $a$ through the edges of $l_1$ if and only if it is reachable from $a$ through the edges of $l_2$.

Statement

set_option relaxedAutoImplicit false in
set_option autoImplicit false in
lemma Kruskal.reach_mem_iff {n : ℕ} {l1 l2 : List (WEdge n)}
    (hmem : ∀ x, x ∈ l1 ↔ x ∈ l2) {a b : Fin n} :
    Reach l1 a b ↔ Reach l2 a b
Source
TCSlib, `Kruskal.reach_mem_iff`
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 — Lean reports it depends on no axioms
Built on 3
  • Kruskal.reach_monoMonotonicity of reachability under edge addition. Fix $n$, let $e_1$ and $e_2$ be lists of weighted edges on the vertex set…
  • Kruskal.WEdgeA weighted edge over $n$ vertices is a structure with two endpoints $u, v : \mathrm{Fin}\,n$ and a natural-number weight…
  • Kruskal.Reach$\mathtt{Reach}\,\mathit{edges}$ is the reflexive--transitive closure of $\mathtt{SymAdj}\,\mathit{edges}$; that is,…
Used by 2
  • 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…

Lean source view module on GitHub

set_option relaxedAutoImplicit false inset_option autoImplicit false inlemma Kruskal.reach_mem_iff {n : ℕ} {l1 l2 : List (WEdge n)}    (hmem : ∀ x, x ∈ l1 ↔ x ∈ l2) {a b : Fin n} :    Reach l1 a b ↔ Reach l2 a b := by  exact ⟨fun h => reach_mono h (fun e he => (hmem e).mp he),         fun h => reach_mono h (fun e he => (hmem e).mpr he)⟩
See it in the graphDiscuss this resultChallenge it