Documentation

CslibFrontier.Computability.WangTile.Basic

Wang tiles and finite patches #

A Wang tile is an oriented unit square with natural-number edge colours. A finite palette is a list; repetitions do not affect tiling. We distinguish tilings of the integer plane, tilings of the natural-number quadrant with a prescribed southwest tile, and plane tilings with a prescribed tile at the origin. These definitions alone do not establish undecidability; the unseeded plane theorem is proved in the separate WangTile.Undecidable module.

Main definitions #

References #

The prior formalization is lean-wang, revision 64268a3, Basic.

structure Cslib.WangTile :

A Wang tile: a unit square in fixed orientation with a colour on each edge.

  • top : ℕ

    The colour on the top edge.

  • bottom : ℕ

    The colour on the bottom edge.

  • left : ℕ

    The colour on the left edge.

  • right : ℕ

    The colour on the right edge.

Instances For

    A tile is coded as the tuple (top, bottom, left, right).

    The tiles of τ tile the plane: some map ℤ × ℤ → τ matches colours on every pair of horizontally and vertically adjacent cells.

    A finite palette with a prescribed tile. The seed need not belong to the palette.

    • tiles : List WangTile

      The tiles allowed in the tiling.

    • seed : WangTile

      The tile prescribed at the origin.

    Instances For

      A matching tiling of the quadrant ℕ × ℕ whose southwest tile is the seed.

      A matching tiling of the integer plane with the seed at the origin.

      structure Cslib.WangTile.Rectangle (τ : List WangTile) (w h : ℕ) :

      A matching rectangular patch of width w and height h, with no boundary conditions.

      • tile : Fin w → Fin h → WangTile

        The tile at each position, indexed from the southwest corner.

      • mem (i : Fin w) (j : Fin h) : self.tile i j ∈ τ

        Every tile belongs to the palette.

      • horizontal (i : Fin w) (j : Fin h) (hi : ↑i + 1 < w) : (self.tile i j).right = (self.tile ⟨↑i + 1, hi⟩ j).left

        Horizontally adjacent edges match.

      • vertical (i : Fin w) (j : Fin h) (hj : ↑j + 1 < h) : (self.tile i j).top = (self.tile i ⟨↑j + 1, hj⟩).bottom

        Vertically adjacent edges match.

      A square of side n + 1 with prescribed southwest tile. The side is always positive.

      theorem Cslib.WangTile.primrec_mk {α : Type u_1} [Primcodable α] {top bottom left right : α → ℕ} (ht : Primrec top) (hb : Primrec bottom) (hl : Primrec left) (hr : Primrec right) :
      Primrec fun (a : α) => { top := top a, bottom := bottom a, left := left a, right := right a }

      A tile assembled from four primitive-recursive colour functions is primitive recursive.

      Reading a tile's top colour is primitive recursive.

      Reading a tile's bottom colour is primitive recursive.

      Reading a tile's left colour is primitive recursive.

      Reading a tile's right colour is primitive recursive.

      Reading the palette of a seeded instance is primitive recursive.

      Reading the seed of a seeded instance is primitive recursive.

      Building a seeded instance from a palette and a seed is primitive recursive.