Sperner's lemma on the triangulated square grid #
Cutting each unit cell of the W × H integer grid along its main diagonal triangulates it by the
GridTriangles of triangles W H. A colouring c : ℕ × ℕ → Fin 3 of the grid points of the
N × N grid is a Sperner colouring (IsSpernerColoring) when it agrees on the boundary with the
boundary colouring boundaryColor of Chen, Deng and Teng [CDT09] (Section 4.1, the
valid colourings of Theorem 4.1 and Definition 4.4 with d = 2, colour 3 written 0): colour
2 on the bottom edge, colour 1 on the rest of the left edge and colour 0 on the rest of the
boundary. Sperner's lemma says that such a colouring has a trichromatic triangle; here it is proved
in its parity form, by the path-following argument that underlies PPAD [Pap94b].
(Mathlib's IsAntichain.sperner is Sperner's theorem on antichains, an unrelated result.)
An edge of a triangle whose endpoints are coloured 1 and 2 is a door; traversing the corners
counterclockwise, it is an exit (2 then 1, IsExit) or an entry (1 then 2, IsEntry).
A triangle has at most one exit and at most one entry, it is trichromatic exactly when it has
exactly one door (trichromatic_iff_isSink_or_isSource), and crossing an interior door turns an
exit into an entry (gluing, isEntry_across). Crossing interior exits (next) and interior
entries (prev) therefore defines a directed graph of in- and out-degree at most one, and counting
doors gives, for every colouring of every W × H grid, the index theorem
#sinks + #boundary exits = #sources + #boundary entries
(card_isSink_add_card_hasBoundaryExit). A Sperner colouring has no boundary exit and exactly one
boundary entry, the left edge of start, so it has one more sink than sources and an odd number of
trichromatic triangles.
The last section identifies the door graph of a Sperner colouring as an end-of-line graph whose
distinguished source is start and whose other unbalanced vertices are exactly the trichromatic
triangles (IsSpernerColoring.door_out_iff, IsSpernerColoring.door_in_iff,
IsSpernerColoring.trichromatic_iff). The circuit-presented search problem built on it is
Cslib.Complexity.Sperner2D.
Main definitions #
Cslib.Sperner.GridTriangle,Cslib.Sperner.triangles: the triangles of the triangulated grid, with cornersGridTriangle.cornerand neighboursGridTriangle.across.Cslib.Sperner.IsExit,Cslib.Sperner.IsEntry,Cslib.Sperner.Trichromatic: doors and trichromatic triangles of a colouring.Cslib.Sperner.next,Cslib.Sperner.prev: the door graph.Cslib.Sperner.IsSink,Cslib.Sperner.IsSource: its unbalanced vertices.Cslib.Sperner.boundaryColor,Cslib.Sperner.IsSpernerColoring,Cslib.Sperner.start.
Main results #
Cslib.Sperner.card_isSink_add_card_hasBoundaryExit: the index theorem for an arbitrary colouring of an arbitrary grid.Cslib.Sperner.IsSpernerColoring.card_isSink: a Sperner colouring has one more sink than sources.Cslib.Sperner.IsSpernerColoring.odd_card_trichromatic: Sperner's lemma, parity form.Cslib.Sperner.IsSpernerColoring.exists_trichromatic: Sperner's lemma.Cslib.Sperner.IsSpernerColoring.trichromatic_iff: the trichromatic triangles are the unbalanced vertices of the door graph other thanstart, together withstartwhen it is a sink.
References #
A triangle of the standard triangulation of the integer grid.
The corners of a grid triangle, in counterclockwise order.
Edge k of t is an interior edge of the W × H grid.
The index of the shared edge in the neighbouring triangle.
t lies in the W × H grid.
Instances For
Crossing an interior edge k of a triangle t of the grid leads to a triangle of the grid that
shares the edge, traversed in the opposite direction, as its edge mate t k; crossing back returns
to t.
Grid triangles are triples (lower, x, y).
Edge k of t is an exit door: its endpoints are coloured 2 then 1.
Instances For
Edge k of t is an entry door: its endpoints are coloured 1 then 2.
Instances For
The corners of t carry three distinct colours.
Instances For
An exit door of t is an entry door of the neighbouring triangle.
An entry door of t is an exit door of the neighbouring triangle.
Follow the interior exit door of t, if any; otherwise stay at t.
Follow the interior entry door of t backwards, if any; otherwise stay at t.
Doors and the index theorem #
t has an exit door.
Instances For
t has an entry door.
Instances For
t has an exit door that is an interior edge of the W × H grid.
Instances For
t has an exit door on the boundary of the W × H grid.
Instances For
t has an entry door that is an interior edge of the W × H grid.
Instances For
t has an entry door on the boundary of the W × H grid.
Instances For
A sink of the door graph: an entry door but no exit door.
Instances For
A source of the door graph: an exit door but no entry door.
Instances For
A triangle is trichromatic exactly when it is a sink or a source of the door graph.
Interior exit doors and interior entry doors are matched by crossing the door.
Index theorem for the door graph. In every colouring of the W × H grid, the number of
sinks plus the number of boundary exit doors equals the number of sources plus the number of
boundary entry doors.
Sperner colourings of the square grid #
A colouring of the N × N grid is a Sperner colouring if it agrees with boundaryColor on
the boundary.
The triangle whose left edge is the unique boundary door of a Sperner colouring.
In a Sperner colouring of the N × N grid (0 < N), the door graph has exactly one more
sink than it has sources.
Sperner's lemma, parity form. A Sperner colouring of the N × N grid (0 < N) has an odd
number of trichromatic triangles.
Sperner's lemma. A Sperner colouring of the N × N grid (0 < N) has a trichromatic
triangle.
The door graph as an end-of-line graph #
Following an interior exit door never leads back to start: the entry door of start lies
on the boundary.
The door graph of a Sperner colouring has an outgoing edge at t exactly when t has an exit
door.
The door graph of a Sperner colouring has an incoming edge at t exactly when t has an entry
door and is not start.
Trichromatic triangles are the unbalanced vertices of the door graph. For a Sperner
colouring, a triangle t ≠ start is trichromatic exactly when it has exactly one of an entry and an
exit door, and start (which always has an entry door) is trichromatic exactly when it has no exit
door.