Partial partitions, unfriendliness at a vertex, and the partitioning game with an ordinal clock
DefinitionTenChallenges_UnfriendlyPartitionThe definitions behind Challenge 10 of the Ten Challenges benchmark, for a simple graph on a vertex type .
- Partial partitions. A partial partition is a function from to . The empty partition is undefined everywhere; has finite domain if only finitely many vertices are assigned a class; extends if every assignment made by is kept by .
- Unfriendly at . is unfriendly at if is defined and the cardinality of the set of neighbours of assigned is at most the cardinality of the set of neighbours assigned the opposite class . Unassigned neighbours are not counted.
- Legal response. Given and a challenged vertex , a partial partition is a legal response if it extends , has finite domain, and is unfriendly at .
- Partitioner wins. For an ordinal clock , holds if for every vertex and every ordinal there is a legal response to with . For this holds vacuously.
These definitions encode the -partitioning game: Challenger names and , Partitioner answers with a legal response, and play continues with clock .
Formalization Note. Classes are Option Bool; cardinalities are Mathlib's Cardinal.mk of subtypes of V; the recursion on the ordinal is well-founded recursion (termination_by α). The vertex type and the ordinal have independent universe parameters u and v.
import Mathlib.SetTheory.Ordinal.Basic
import Mathlib.Combinatorics.SimpleGraph.Basic
universe u v
open scoped Cardinal
variable {V : Type u} (G : SimpleGraph V)
/-- Neighbours of `v` mapped to value `b` by `f`. -/
def NeighColored {β : Type*} (f : V → β)
(v : V) (b : β) : Type u := ↥(G.neighborSet v ∩ f ⁻¹' {b})
/-- `v` is coloured, with at least as many neighbours of the opposite colour as of its own. -/
def UnfriendlyAt (f : V → Option Bool)
(v : V) : Prop :=
∃ b : Bool, f v = some b ∧
#(NeighColored G f v (some b)) ≤ #(NeighColored G f v (some (!b)))
/-- The empty partial partition. -/
def emptyPartition (V : Type u) : V → Option Bool :=
fun _ => none
/-- Only finitely many vertices are assigned a colour. -/
def HasFiniteDomain {V : Type u} (f : V → Option Bool) : Prop :=
{v : V | f v ≠ none}.Finite
/-- `g` extends `f` when all assignments already made by `f` are preserved. -/
def Extends {V : Type u} (f g : V → Option Bool) : Prop :=
∀ v b, f v = some b → g v = some b
/-- A finite extension of `f` that is unfriendly at the challenged vertex `v`. -/
def IsLegalResponse {V : Type u} (G : SimpleGraph V)
(f g : V → Option Bool) (v : V) : Prop :=
Extends f g ∧ HasFiniteDomain g ∧ UnfriendlyAt G g v
/-- Partitioner wins from `(f, α)`, by recursion on the ordinal clock `α`. -/
def PartitionerWins {V : Type u} (G : SimpleGraph V)
(f : V → Option Bool) (α : Ordinal.{v}) : Prop :=
∀ v : V, ∀ β : Ordinal.{v}, β < α →
∃ g : V → Option Bool,
IsLegalResponse G f g v ∧ PartitionerWins G g β
termination_by α
Read-back
What the Lean code literally says, in plain math · claude-fable-5-1
Setting and notation. Throughout, is an arbitrary type (the vertex set) living in a universe ; may be empty, finite or infinite. is a simple graph on , i.e. a binary adjacency relation on that is symmetric and irreflexive (no loops, no multiple edges, and no further restriction: a vertex may have infinitely many neighbours). is the set of neighbours of . A partial 2-colouring is any function , where means "no colour assigned" and are the two Boolean colours; for a Boolean , denotes its negation (, ). denotes the cardinality of as a cardinal number (in universe ), so it may be infinite, and between cardinalities means existence of an injection. Ordinals range over the ordinals of a second universe , independent of ; is the usual strict well-ordering of ordinals.
Definition NeighColored (written ). For any type , any function , any vertex and any value , is the type (in universe ) whose elements are the members of the set
i.e. the neighbours of whose -value is exactly . (Below it is only ever used with and .)
Definition UnfriendlyAt (written ). For a partial 2-colouring and a vertex :
In words: is actually coloured (so ; the witness is forced to be the colour of ), and the number of neighbours of carrying the same colour as is at most, as cardinals, the number of neighbours carrying the opposite colour. Neighbours with are counted on neither side. Edge cases that the definition literally includes: a coloured vertex with no neighbours satisfies it (); if both sides are infinite of the same cardinality the inequality holds; if the same-colour side is infinite and the opposite side finite it fails; an uncoloured vertex () is never unfriendly.
Definition emptyPartition (written ). For a type (universe ), is the constant function for all (no vertex coloured).
Definition HasFiniteDomain (written ). For ,
i.e. there are and a bijection between this set and ; is allowed, so has finite domain.
Definition Extends (written ). For ,
Every colour already assigned by is kept unchanged by . Nothing is required at vertices with : may colour them or leave them uncoloured. In particular , and for every .
Definition IsLegalResponse (written ). For and ,
No hypothesis is placed on itself (although together with forces the coloured set of to be finite as well). is not required to differ from ; is required to be unfriendly only at the single vertex and nothing is asserted about other vertices; may colour any finite number of further vertices anywhere in .
Definition PartitionerWins (written ). For a partial 2-colouring and an ordinal (universe ), is defined by well-founded recursion on (the recursive call is at an ordinal ):
In words: for every vertex (any vertex at all, coloured or not under ; the same vertex may be chosen again at later stages) and for every ordinal strictly smaller than (all such , not only an immediate predecessor; at a limit this is every ), there exists a that extends , colours only finitely many vertices, and is unfriendly at (the choice of may depend on both and ), and the same property holds again from the pair . Unfolding the recursion, this is a sequence of alternations: an opponent picks with , the Partitioner answers with ; the opponent picks with , the Partitioner answers with ; and so on; since the ordinals strictly decrease, every such run is finite. Consequences of the literal definition: holds for every and every (there is no ), including with infinitely many coloured vertices; if is empty then holds for every ; if , is nonempty and has infinitely many coloured vertices, then fails (no finite-domain extends ).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.