AFTD Auto-Formalizing Theoretical Domains

op_1952_isTraceable_of_isHamiltonian

theoremverified

Every finite Hamiltonian simple graph on at least two vertices is traceable, since the tail of any Hamiltonian cycle is a Hamiltonian path.

Statement

theorem op_1952_isTraceable_of_isHamiltonian {V : Type*} [Fintype V] [DecidableEq V]
    {G : SimpleGraph V} (hH : G.IsHamiltonian) (hn : 2 ≤ Fintype.card V) :
    G.IsTraceable
Source
Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • SimpleGraph.IsTraceableA simple graph G on a vertex type V is traceable if it contains a Hamiltonian path, that is, a walk in G that visits every vertex of V…
Used by 1

Read back from the Lean

For any finite type V with decidable equality and any simple graph G on V, if G is Hamiltonian (G.IsHamiltonian) and the number of vertices in V is at least 2 (2 ≤ Fintype.card V), then G is traceable (G.IsTraceable, i.e., it contains a Hamiltonian path).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

To show that a finite Hamiltonian graph G on at least two vertices has a Hamiltonian path, we first obtain a Hamiltonian cycle. Since the number of vertices is at least 2, it is not 1, so the definition of a Hamiltonian graph supplies a vertex a and a Hamiltonian cycle p based at a. Deleting the first edge of this cycle yields its tail, which is a Hamiltonian path from the second vertex of the cycle to a.

  1. There exists a Hamiltonian cycle p based at some vertex a.

    By assumption, the graph has at least two vertices (|V| ≥ 2), so |V| ≠ 1 follows immediately by linear integer arithmetic (`omega`). Applying the definition of a Hamiltonian graph (`hH`) to this non-triviality condition yields a base vertex a and a closed walk p from a to a that is a Hamiltonian cycle (`hp`).

    line 5

      obtain ⟨a, p, hp⟩ := hH (by omega)
  2. G is traceable; that is, G contains a Hamiltonian path.

    Traceability requires exhibiting endpoints and a Hamiltonian path between them. We choose the starting vertex to be the second vertex of the cycle (`p.snd`), the endpoint to be `a`, and the path to be the tail of the cycle (`p.tail`), which drops the initial edge. By `hp.isHamiltonian_tail`, the tail of any Hamiltonian cycle is a Hamiltonian path, which completes the proof.

    line 6

    uses hp.isHamiltonian_tail

      exact ⟨p.snd, a, p.tail, hp.isHamiltonian_tail⟩
hp.isHamiltonian_tail
Removing the first edge from a Hamiltonian cycle yields a Hamiltonian path from the second vertex to the original starting vertex.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- A finite Hamiltonian graph on at least two vertices has a Hamiltonian path. -/theorem op_1952_isTraceable_of_isHamiltonian {V : Type*} [Fintype V] [DecidableEq V]    {G : SimpleGraph V} (hH : G.IsHamiltonian) (hn : 2 ≤ Fintype.card V) :    G.IsTraceable := by  obtain ⟨a, p, hp⟩ := hH (by omega)  exact ⟨p.snd, a, p.tail, hp.isHamiltonian_tail⟩
See it in the graphDiscuss this resultChallenge it