Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

p. 3:26 — a Lex-DFS can be performed from any vertex of a connected graph

Proved
TwinWidthI.MinorFree.lexDFS_exists

by mikedeng1 · Oct 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

depth-first-searchgraph-searchlex-dfsp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let GGG be a finite connected graph and v1v_1v1​ any vertex of GGG. Then there is a Lex-DFS discovery order of GGG starting at v1v_1v1​: an ordering v1,…,vnv_1,\dots,v_nv1​,…,vn​ of all vertices with a DFS tree T\mathcal TT such that each new vertex is a neighbour of the current active vertex, chosen in a component of the undiscovered vertices with lexicographically maximal word,

∃ (σ,T) Lex-DFS of G with σ−1(0)=v1.\exists\,(\sigma,\mathcal T)\ \text{Lex-DFS of }G\ \text{with}\ \sigma^{-1}(0)=v_1 .∃(σ,T) Lex-DFS of G with σ−1(0)=v1​.

The proof of Theorem 6.3 orders the adjacency matrix by this discovery order; the statement says that the search is well defined ("since GGG is connected, the active vertex is always well-defined").

Formalization Note The discovery order is an equivalence V≃Fin ∣V∣V\simeq\mathrm{Fin}\,|V|V≃Fin∣V∣, with v1v_1v1​ at position 000.

Preamble
import Mathlib
import Definitions.Def_TwinWidthI_MinorFree_LexDFS
Formal statement
namespace TwinWidthI.MinorFree

/-- p. 3:26: from an arbitrary vertex `v₁` of a connected finite graph the Lex-DFS can be
performed: there is a Lex-DFS discovery order `σ` with DFS tree `par` that starts at `v₁`. -/
theorem lexDFS_exists {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
    (hconn : G.Connected) (v₁ : V) :
    ∃ (σ : V ≃ Fin (Fintype.card V)) (par : V → V),
      IsLexDFSOrder G σ par ∧ (σ v₁ : ℕ) = 0 := by sorry

end TwinWidthI.MinorFree
Source
Bonnet, Kim, Thomassé and Watrigant, Twin-width I: Tractable FO Model Checking, J. ACM 69(1), Article 3 (2021), p. 3:26, proof of Theorem 6.3, "Definition of the appropriate Lex-DFS"
Human review
  • Endorsed by Shuze Chen · Oct 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me