A tiling covers the plane with copies of a finite number of shapes, with no gaps or overlaps. Most familiar tilings, such as a floor of square or hexagonal tiles, are periodic: shifting the whole tiling by the right amount is a symmetry operation: the tiling looks identical because repeats itself in space. Since the 1960s, mathematicians have known sets of tiles that can cover the plane only non-periodically; in the 1970s Roger Penrose brought such a set down to just two shapes: see this earlier post on Penrose tilings. Whether a single shape could do the same, an einstein (a pun from the German ein Stein, "one stone"), remained an open question until 2023, when David Smith, Joseph Samuel Myers, Craig S. Kaplan and Chaim Goodman-Strauss described one the "hat".
Their paper, An aperiodic monotile, Combinatorial Theory 4(1) (2024), proves that the hat tiles the plane, but never periodically. The small Python package, einstein-tiling builds these tilings and draws them as SVG images. This post describes this implentation, following the paper (the figure numbers are the paper's), and then how to use it.
The hat is a polykite: it is made of eight kites of the [3.4.6.4] Laves tiling, the tiling of the plane by kites that each make up one sixth of a hexagon. Its outline has 13 edges, of lengths 1 and \(\sqrt{3}\), apart from one edge of length 2. Every tiling by hats uses some reflected hats as well as unreflected ones. (Whether a shape and its mirror image count as the same shape is a matter of convention: the tiling literature, following Euclid, says that they do. The same authors later found the Spectre, a closely related shape that tiles the plane non-periodically without any reflected copies.)
The paper groups the hats of any hat tiling into four kinds of cluster (Figure 4.1, redrawn below):
- H: four hats, one of them reflected (\(H_1\), in the middle).
- T: a single hat.
- P and F: two hats each.
Each cluster is simplified to a metatile, outlined in green: a hexagon, a triangle, a parallelogram and a pentagon. Marked points divide each metatile's boundary into segments, and the labels on the segments are the matching rules: where two metatiles meet, \(A^+\) must meet \(A^-\), and likewise for \(B\), \(X\) and \(F\), while \(L\) meets \(L\). The metatiles are only ever rotated, never reflected. Following the rules, the hats of neighbouring clusters fit together exactly, so any tiling by the metatiles gives a tiling by hats.
The matching rules are local, but they are not enough to build a tiling one tile at a time: a patch can obey every rule and still be impossible to extend, so a tile placed early can turn out to be wrong much later. The einstein-tiling package builds tilings by substitution (Figure 2.6), and uses the matching rules only to check the result. At each level:
- 29 copies of the four tiles are fitted together edge to edge, using the table of placements in Craig Kaplan's hatviz.
- 22 of them become the children of the next level's four supertiles: ten in H, one in T, five in P and six in F. The rest only position the others.
- The supertiles' outlines are worked out from a few key points of the patch, and the rule that their interior angles are 120°. They are not scaled copies of the metatiles.
The supertiles obey the same matching rules as the metatiles, so the same steps build the next level, and so on. Here are levels 0, 1 and 2 of the H supertile:
The numbers of hats in the H supertile, 4, 25, 169, 1156, 7921, …, are the squares of every other Fibonacci number, and the area of the tiles grows by the factor \(\phi^4 \approx 6.854\) at each level, where \(\phi\) is the golden ratio.
Every corner of every hat lies on a triangular lattice, so einstein-tiling stores a point as two integers \((a, b)\), standing for \(a + b\omega\), where \(\omega = e^{i\pi/3}\), in units of the hat's short edge. Rotating by 60° is then \((a, b) \to (-b, a + b)\). The corners of the supertiles' outlines can be fractions, so they are kept as exact fractions.Fraction values, but the metatiles' placements always come out as integers: floating-point numbers appear only when the tiles are drawn.
Using einstein-tiling
einstein-tiling is on PyPI, and has no dependencies:
pip install einstein-tiling
With uv, uvx einstein-tiling runs it without installing anything. To draw a tiling:
einstein-tiling tiling --level 4 -o tiling.svg
This builds a supertile of the given level, and writes an SVG image of it to tiling.svg. A supertile has a ragged edge, so the picture is cropped to the largest rectangle, centred on the patch, that has no gaps around its edges; --width sets the picture's width in pixels and --aspect its shape, and --no-crop draws the whole patch instead. By default, the hats are coloured by cluster. At level 2:
einstein-tiling tiling --level 2 -o tiling.svg
--colour NAME=COLOUR (or --color) changes a colour, and can be repeated. The names are H, T, P and F for the unreflected hats of each cluster, and reflected, outline, metatile and background. Any SVG colour will do, but put one such as #f4d8cd in quotes, since some shells treat # specially. At level 3:
einstein-tiling tiling --level 3 --width 900 --colour 'H=#f4d8cd' \
--colour 'T=#ffffff' --colour 'P=#ede4d3' --colour 'F=#d9c6b0' \
--colour 'reflected=#8c2f39' --colour 'outline=#3b2f2f' -o tiling.svg
The package can also be used from Python: it returns the tiles' exact positions, and the corners of every hat as coordinates for use with e.g. Matplotlib. More details are available in the documentation.