Skip to main content

substitution_tiling_transducers/
lib.rs

1//! This crate implements a suite of algorithms for dealing with
2//! substitution tilings of the plane, including aperiodic tilings
3//! such as the Penrose tilings and the 2023 Hat and Spectre tilings.
4//!
5//! The core concept in this crate is the 'transducer' described in
6//! '[Finite-state transducers for substitution
7//! tilings](https://arxiv.org/pdf/2512.16595)'. (This Rust crate is
8//! the companion code to that paper, in fact.) A brief summary:
9//!
10//! In a substitution tiling system, each tile can be assigned an
11//! 'address' which states its position in the substitution hierarchy
12//! in purely symbolic terms, by giving the type of the tile and all
13//! its higher-order supertiles, and at each step, indicating which
14//! subtile of the supertile was selected. An address of one tile in a
15//! tiling can be converted into the address of its neighbour, using a
16//! finite state machine which consumes the address one symbol at a
17//! time and outputs the address of the neighbouring tile. This
18//! provides a practical way to plot patches of aperiodic tilings, as
19//! well as permitting various analyses of the substitution system.
20//!
21//! This crate implements the workflow for building a transducer:
22//!
23//! * start from a combinatorial description of the substitution
24//!   system ([`CombSystem`]), which specifies how tiles connect and
25//!   relate to each other without saying anything about their shapes
26//!   and sizes
27//!
28//! * from that, build a preliminary 'adjacency recogniser' state
29//!   machine ([`Recogniser`]), which takes two tile
30//!   addresses and determine whether they are neighbours along
31//!   specified edges
32//!
33//! * from that in turn, build a transducer
34//!   ([`Transducer`]) which takes one tile address and
35//!   outputs its neighbour along a specified edge
36//!
37//! * if the transducer cannot be built due to an ambiguity in the
38//!   original system, automatically refine the system by cloning tile
39//!   types into subtypes, producing a specification of the refinement
40//!   ([`Refinement`]) which can be combined with the
41//!   original `CombSystem` to produce a new one.
42//!
43//! Optionally, a `CombSystem` can be constructed from a _geometric_
44//! description of the tiling ([`GeomSystem`]). If you have a
45//! geometric description of the tiling, you can also use the
46//! transducer to plot patches of tiles, via three different
47//! algorithms ([`PushGenerator`], [`RasterGenerator`],
48//! [`SearchGenerator`]), all with different strengths and weaknesses.
49//! Patches can be generated based on user-specified tile addresses,
50//! or based on a random tile address.
51//!
52//! This crate supports loading and saving many of its data types as
53//! TOML-based file formats. In the `toml` data directory of its
54//! source, sample files are provided which define well-known
55//! aperiodic tilings.
56
57#![warn(missing_docs)]
58
59#[cfg(doc)]
60use crate::{
61    combinatorial::{CombSystem, Recogniser, Refinement, Transducer},
62    generators::{PushGenerator, RasterGenerator, SearchGenerator},
63    geometric::GeomSystem,
64};
65
66pub mod address;
67mod algebraic;
68pub mod automata;
69pub mod builtin;
70pub mod combinatorial;
71pub mod common;
72pub mod cosmetics;
73mod distribution;
74mod dsf;
75pub mod filetype;
76pub mod generators;
77pub mod geometric;
78pub mod polyring;
79pub mod randomaddr;
80
81#[cfg(test)]
82mod test;