Graphs are the most basic combinatorial model of pairwise relations: road networks, frequency interference between radio stations, schedules, circuit layouts. Chapter 5 of Keller and Trotter's Applied Combinatorics (appliedcombinatorics.org, CC BY-SA 4.0) introduces the vocabulary of graph theory and proves its first structural theorems: when a graph can be traversed edge by edge (Euler, 1736), when it can be toured vertex by vertex (Dirac, 1952), when it can be colored with two colors, and how far the chromatic number can drift from the size of the largest clique.
Hamiltonicity is the vertex analogue of Euler's edge-traversal problem and behaves very differently: Euler's problem has a simple parity characterization, while deciding whether a graph has a hamiltonian cycle is NP-complete (Karp, 1972). Sufficient conditions are therefore the main tool, and the minimum-degree condition of Dirac (1952) is the first and most cited of them; Ore's condition (1960) and the Bondy–Chvátal closure (1976) refine it.
A graph consists of a finite vertex set and a set of 2-element subsets of , the edges; means and are adjacent. The degree is the number of neighbours of . The mission uses Mathlib's SimpleGraph V with [Fintype V]; "a graph on vertices" means Fintype.card V = n.
AppliedComb.Graphs.IsHamiltonian).IsEulerian).IsIntervalGraph).In the book's order:
The book's proof of Theorem 5.18 uses only the pigeonhole principle, so none of these results lies on its path. The milestones are the chapter's other theorems about the same objects (cycles, degrees, colorings), and they share the goal's definitions. Cayley's formula (Theorem 5.39, labelled trees on vertices) is already on the platform as GYGraphTheory.cayley_tree_formula and is included as a reference item.
Dirac's theorem is sharp: the complete bipartite graph has minimum degree and no hamiltonian cycle. It is the starting point for the theory of degree conditions for hamiltonicity (Ore, Pósa, Chvátal) and for its extremal and random-graph analogues. Euler's theorem gives linear-time recognition of eulerian graphs; Theorem 5.21 characterizes bipartite graphs; Proposition 5.25 shows that local sparsity (no triangles) does not bound the chromatic number; Theorem 5.28 is the first step towards perfect graphs.
All of these results have been proved for a long time. What is missing is their formalization. Mathlib provides SimpleGraph, chromaticNumber, cliqueNum, degree-sum identities, and definitions of eulerian and hamiltonian walks. It contains no Dirac theorem, no converse of the eulerian degree condition, and no interval-graph theory. On the platform, FamousTheorems.two_colorable_iff_no_odd_cycle_6b is stated with odd closed walks rather than odd cycles, and triangle_free_chromatic_number asserts only rather than with exactly.
For Dirac's theorem the obvious approach, induction on (deleting a vertex), fails: deleting a vertex lowers degrees, and the hypothesis is not inherited by the smaller graph. The degree condition is global, and so is the argument that uses it. In Lean the argument also has to reverse and splice vertex sequences while keeping distinctness and every adjacency along the way. The sufficiency half of Euler's theorem has to construct a circuit that uses every edge exactly once, not just show that one exists up to parity. In Theorem 5.21 the obstruction is a cycle with distinct vertices; producing one from a failed 2-coloring takes more work than producing an odd closed walk. Proposition 5.25 needs a concrete infinite family of graphs and exact computation of both invariants. The upper bound is easy, but the lower bound is not.
SimpleGraph V on a Fintype V. The number of vertices is always Fintype.card V, never a free parameter; in Theorem 5.18 the ceiling is (n + 1) / 2 in , with Fintype.card V = n.Walk.IsHamiltonianCycle, which needs at least three vertices: under that notion Theorem 5.18 would be false for . The goal assumes nonempty, as the book's proof does ( positive). Degenerate readings are ruled out: a predicate satisfied by a cycle through only some vertices, or a statement in which is not the number of vertices, would make the goal vacuous or false, and neither is used here.chromaticNumber (-valued) and is cliqueNum; on finite graphs both agree with the book's definitions (pp. 81, 84).namespace AppliedComb.Graphs
/-- Keller–Trotter, p. 80, Theorem 5.18 (Dirac). If `G` is a graph on `n` vertices and each
vertex of `G` has at least `⌈n/2⌉` neighbors, then `G` is hamiltonian (book's definition,
p. 79). `⌈n/2⌉` is written `(n + 1) / 2` in `ℕ`. The vertex set is nonempty (the book's proof
takes `n` to be a positive integer). -/
theorem dirac {V : Type*} [Fintype V] [Nonempty V] (G : SimpleGraph V) [DecidableRel G.Adj]
(n : ℕ) (hn : Fintype.card V = n) (hdeg : ∀ v : V, (n + 1) / 2 ≤ G.degree v) :
IsHamiltonian G := by sorry
end AppliedComb.Graphs
Let be a graph on vertices in which every vertex has at least neighbours:
Then is hamiltonian: there is a sequence listing every vertex exactly once with for and .
Dirac's condition (1952) is the classical sufficient condition for hamiltonicity; deciding hamiltonicity in general has no known efficient method.
Formalization Note. is written (n + 1) / 2 in , and is tied to the graph by Fintype.card V = n. "Hamiltonian" is the book's notion (AppliedComb.Graphs.IsHamiltonian), under which is hamiltonian; with Mathlib's IsHamiltonianCycle the statement would be false at . The vertex type is assumed nonempty, since the book's proof takes to be a positive integer and the empty graph has no hamiltonian cycle. At the degree hypothesis cannot hold, exactly as on the page.
No open leaves. Every sub-goal is proved or awaiting decomposition.