Well-quasi-orders, the cumulative hierarchy , -well-quasi-ordering, finite and planar graphs under minors
DefinitionTenChallenges_AlphaWQOThe definitions behind Challenge 6 of the Ten Challenges benchmark.
- Well-quasi-ordering. A relation on a type is a WQO if for every sequence in there are indices with .
- The cumulative hierarchy. For an ordinal , the type is defined by transfinite recursion: ; is the type of nonempty subsets of ; for a limit ordinal , is the disjoint union of the over . Three lemmas record these equations.
- The game relation . For and , is defined by recursion on the ordinals and : if it is in ; if and is a successor, it holds when some element of the set satisfies ; if is a successor and , when every element of the set satisfies ; if both are successors, when for every there is with ; and an element of a limit level is replaced by its underlying element of the lower level. This is the relation under which Player II has a winning strategy in Nash-Williams's game.
- -well-quasi-ordering. is -WQO if restricted to is a WQO. Level is ordinary WQO.
- Graphs. A finite graph is a pair with a simple graph on ; if is a minor of . A planar graph is a finite graph that is Wagner-planar (no or minor), with the same relation.
Formalization Note. The recursion uses Mathlib's Ordinal.limitRecOn, and the equations for the three kinds of levels are transported with cast. Ordinals and live in a common universe u; for graphs this is universe .
import Mathlib.SetTheory.Ordinal.Arithmetic
import Definitions.Def_TenChallenges_Minor
open SimpleGraph Ordinal
universe u
/-- A quasi-order is well-quasi-ordered when every infinite sequence
contains an increasing pair. -/
def IsWQO {Q : Type u} (le : Q → Q → Prop) : Prop :=
∀ f : ℕ → Q, ∃ i j : ℕ, i < j ∧ le (f i) (f j)
/-- Level `o` of the cumulative hierarchy over `Q`: `VStar Q 0 = Q`,
`VStar Q (succ o)` is the nonempty subsets of `VStar Q o`, and at a limit
`o` it is the disjoint union of all lower levels. -/
noncomputable def VStar (Q : Type u) (o : Ordinal.{u}) : Type u :=
Ordinal.limitRecOn o
Q
(fun _ ih => {S : Set ih // S.Nonempty})
(fun o _ ih => Σ i : o.ToType, ih (Ordinal.typein (α := o.ToType) (· < ·) i)
(Ordinal.typein_lt_self i))
/-- Level zero is the base quasi-order. -/
theorem VStar_zero (Q : Type u) : VStar Q 0 = Q :=
Ordinal.limitRecOn_zero ..
/-- Successor levels consist of nonempty subsets of the preceding level. -/
theorem VStar_succ (Q : Type u) (o : Ordinal.{u}) :
VStar Q (Order.succ o) = {S : Set (VStar Q o) // S.Nonempty} :=
Ordinal.limitRecOn_add_one ..
/-- Limit levels are disjoint unions of the preceding levels. -/
theorem VStar_limit (Q : Type u) {o : Ordinal.{u}} (h : Order.IsSuccLimit o) :
VStar Q o = Σ i : o.ToType, VStar Q (Ordinal.typein (α := o.ToType) (· < ·) i) :=
Ordinal.limitRecOn_limit _ _ _ _ h
/-- The Nash–Williams game relation `≤*`, as a *heterogeneous* relation
comparing an element of level `a` with an element of level `b`.
A limit-level element is identified with its underlying lower-level element
(the disjoint union is transparent), so `≤*` unwraps limit tags for free; at
successor levels it is the `∀`-Player-I / `∃`-Player-II lift, and at level
`0` it bottoms out in `le`. Well-founded because every unwrap/descent
strictly decreases the ordinal level on the side it acts on. -/
noncomputable def leStar {Q : Type u} (le : Q → Q → Prop) (a : Ordinal.{u}) :
VStar Q a → ∀ b : Ordinal.{u}, VStar Q b → Prop :=
Ordinal.limitRecOn (motive := fun a => VStar Q a → ∀ b : Ordinal.{u}, VStar Q b → Prop) a
-- a = 0 : X is in Q, Player I cannot move; recurse on b (Player II descends).
(fun X b => Ordinal.limitRecOn (motive := fun b => VStar Q b → Prop) b
(fun Y => le (cast (VStar_zero Q) X) (cast (VStar_zero Q) Y))
(fun β ibh Y => ∃ y ∈ (cast (VStar_succ Q β) Y).val, ibh y)
(fun β hb ibh Y =>
let Y' := cast (VStar_limit Q hb) Y
ibh (Ordinal.typein (α := β.ToType) (· < ·) Y'.1) (Ordinal.typein_lt_self _) Y'.2))
-- a = succ α : Player I picks x ∈ X, then Player II answers from b.
(fun α ih X b => Ordinal.limitRecOn (motive := fun b => VStar Q b → Prop) b
(fun Y => ∀ x ∈ (cast (VStar_succ Q α) X).val, ih x 0 Y)
(fun β _ Y => ∀ x ∈ (cast (VStar_succ Q α) X).val,
∃ y ∈ (cast (VStar_succ Q β) Y).val, ih x β y)
(fun β hb ibh Y =>
let Y' := cast (VStar_limit Q hb) Y
ibh (Ordinal.typein (α := β.ToType) (· < ·) Y'.1) (Ordinal.typein_lt_self _) Y'.2))
-- a limit : X is a disjoint-union
(fun a ha iha X =>
let X' := cast (VStar_limit Q ha) X
iha (Ordinal.typein (α := a.ToType) (· < ·) X'.1) (Ordinal.typein_lt_self _) X'.2)
/-- `(Q, le)` is `α`-well-quasi-ordered when level `α` of
the cumulative hierarchy over `Q` is well-quasi-ordered under `≤*`. -/
def IsAlphaWQO {Q : Type u} (le : Q → Q → Prop) (a : Ordinal.{u}) : Prop :=
IsWQO (fun X Y : VStar Q a => leStar le a X a Y)
/-- A finite simple graph, given as a graph on `Fin n` for some `n`. -/
def FiniteGraph : Type := Σ n : ℕ, SimpleGraph (Fin n)
/-- The minor order on finite graphs. -/
def FiniteGraph.MinorLE (G H : FiniteGraph) : Prop :=
Nonempty (Minor G.2 H.2)
/-- A finite planar simple graph. -/
def PlanarGraph : Type :=
{G : FiniteGraph // G.2.IsWagnerPlanar}
/-- The minor order on finite planar graphs. -/
def PlanarGraph.MinorLE (G H : PlanarGraph) : Prop :=
FiniteGraph.MinorLE G.val H.val
Read-back
What the Lean code literally says, in plain math · claude-fable-5-1
Setting. is a type in a universe and all ordinals are taken in the same universe . The file imports item TenChallenges_Minor; its notions are unfolded where used. .
IsWQO le. For an arbitrary binary relation on (written for le x y; no reflexivity, transitivity or antisymmetry is assumed anywhere in the file):
The inequality is strict. If is empty the condition holds vacuously (there is no sequence).
VStar Q o. A type (in universe ) for every ordinal , defined by transfinite recursion on (Ordinal.limitRecOn, whose zero / successor / limit clauses are exactly the three rules below):
- .
- , the type of nonempty subsets of level (every successor ordinal is of the form , so this covers every successor level).
- For a limit ordinal (meaning and is not a successor): , where (
o.ToType) is Mathlib's canonical well-ordered type of order type and is the ordinal position of in it (the order type of ); as ranges over , ranges bijectively over all ordinals . So an element of a limit level is a tagged pair with , : the disjoint union of all strictly lower levels.
The theorems VStar_zero, VStar_succ (stated with Order.succ o, which for ordinals is ) and VStar_limit (hypothesis: is a limit ordinal) assert precisely these three equalities of types. Edge cases: if is empty then every level is empty (no nonempty subset of an empty type exists, and a disjoint union of empty types is empty); if is nonempty then every level is nonempty.
leStar le a. For an ordinal , a function . Write for leStar le a X b Y, where and ; this is a heterogeneous relation between elements of possibly different levels and . It is defined by transfinite recursion on and, inside each case, by transfinite recursion on . The casts in the code only transport elements along the three type equalities above, so and are read through them below. The complete case list is:
Case ():
- (): (the base relation).
- ( a nonempty subset of ): .
- a limit, with , : .
Case ( a nonempty subset of ):
- (): .
- ( a nonempty subset of ): . (The recursive value for level on the right with the same is available but not used in this clause.)
- a limit, with , : .
Case a limit, with , : for every ordinal and every , .
Each clause refers to the relation only at a strictly smaller level on at least one side, so the recursion is well-founded. Features visible in the clauses: a limit-level tag is simply discarded on whichever side it occurs; on the left the quantifier is always over the elements of a successor-level set, on the right always ; when one side is at level the other side is unwrapped alone (so for nonempty and means , and for and nonempty means ); at the base relation is applied.
IsAlphaWQO le a. For a relation on and an ordinal : IsWQO of the relation on the type , i.e.
For this is IsWQO le itself. For it says: every sequence of nonempty subsets of has with . If is empty the condition holds vacuously for every .
FiniteGraph. The type : an element is a pair with (including , the graph with no vertices) and a simple graph on . Elements are pairs, not isomorphism classes: isomorphic graphs with different vertex counts, or different isomorphic graphs on the same , are distinct elements.
FiniteGraph.MinorLE G H. For and : the proposition that there exists a minor witness of in in the sense of item TenChallenges_Minor, i.e. a family of subsets of such that (i) whenever ; (ii) each is nonempty and any two of its vertices are joined by a walk of all of whose vertices lie in ; (iii) whenever there are and with . Nothing is required for non-edges of , and the need not cover . The relation reads " is a minor of " (first argument the minor, second the host). The element is a minor of everything, and with is never a minor of .
PlanarGraph. The subtype , i.e. those such that there is no minor witness of (the complete graph on ) in and no minor witness of (completeBipartiteGraph (Fin 3) (Fin 3): vertex type , exactly the left–right pairs adjacent) in . No embedding-based notion of planarity is involved; belongs to this type.
PlanarGraph.MinorLE G H. For in PlanarGraph: FiniteGraph.MinorLE applied to the underlying pairs, i.e. the underlying graph of is a minor of the underlying graph of (minor witness exactly as above).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.