Modeling granular media using cellular automata (TIPE)

One-and-a-half-year project in the French preparatory track (MP), known as TIPE (travail d’initiative personnelle encadré), December 2020 – July 2022. The work linked cellular automata (CA) to toy models of granular surfaces: custom local rules on a 2D lattice whose long-time dynamics resemble erosion and craterization, implemented in Golly using hashing techniques and macro-cell ideas so large runs remain tractable. Special thanks to Andrew Trevorrow for his kind explanations at the time.

It was also a nice way to dive into the mathematical theory and look at some results such as universality properties, where many cellular automata can replicate a Turing machine while keeping very simple rules. Cellular automata are computationally interesting in their own right, with their already discretized structure and transitions.

1. Project objectives and overview

Objectives. Build intuition and experiments for how strictly local, deterministic updates can mimic aspects of landscape evolution (selective erosion, defect amplification, heterogeneous strength). Connect practice (rules, simulators, performance) to the classical mathematical characterization of global CA maps.

Mathematical definition (cellular automaton). Fix a countable set of cells L (here typically L = ℤd), a finite alphabet S, and a finite neighbourhood NL (often invariant under a group action of the translation group, e.g. the von Neumann or Moore neighbourhood in ℤ2). A local rule is a map f : SNS. A configuration is a map c : LS. The associated global map F : SLSL is

F(c)x := f ( (cx+n)nN )   for all xL.

Time evolution is the discrete dynamical system ct+1 = F(ct). The full configuration space SL carries the product topology. When S is finite, each factor is compact (discrete finite space), so Tychonoff’s theorem yields compactness of SL.

2. Inspiring examples

Patterns and “rugs”. Even very simple rules on ℤ2 can produce ordered, almost textile-like motifs (periodic or quasi-periodic colour bands sometimes called Persian rug patterns), coexisting with disordered invasion fronts—useful visual anchors when tuning rules toward textured landforms.

Elementary rules (1D). On ℤ with two states and nearest-neighbour neighbourhood, there are 256 Wolfram elementary rules; their space–time diagrams show how minimal neighbourhoods already generate complexity, chaos, or self-similarity—good sanity checks before designing 2D custom neighbourhoods.

Elementary CA gallery: space-time plots for rules 50–99 and a 3-bit neighbourhood encoding diagram
Gallery of 1D elementary rules (rules 50–99): each strip is a space–time diagram (time downward). Below: the eight 3-cell neighbourhoods and the binary outputs that define a rule number (here the classic Rule 30 coding pattern as illustration of the Wolfram scheme).

Classic rule families and notation. Many standard rules are specified in compact Birth / Survival form for outer-totalistic life-like automata on ℤ2: Bb1b2… / Ss1s2… lists total neighbour counts that cause a dead cell to become alive (birth) or a live cell to survive. Example: Conway’s Game of Life is B3/S23. The letter N in informal shorthand often refers to the neighbourhood shape (e.g. von Neumann vs Moore) that defines which cells enter the neighbour count. Beyond Life-like rules, well-known landmarks include Langton’s loops (self-reproducing cycles in a CA with many states), Brian’s Brain, and other seminal rule tables (Generations, Larger than Life, …).

3. Simple modeling

HashLife (Bill Gosper, early 1980s) memoises recurring macro-patterns of cells so the simulator can jump in time when the same subpattern reappears—especially effective for Conway’s Life and close variants. See also mafm/HashLife on GitHub for algorithm notes and code. Together with hierarchical macro-cells, this is what makes “absurdly large” universes explorable in practice.

Golly is an open-source CA laboratory: many built-in rules, HashLife-style acceleration where applicable, huge tori or bounded grids, and Python/Lua scripting—ideal for batching custom erosion experiments and checking visual plausibility.

4. Curtis–Hedlund–Lyndon theorem

We state the theorem on the full shift in dimension d (the same idea extends to any countable group acting by shifts). Write G = ℤd, let S be finite, and let

X = SG = { x : GS }

equipped with the product topology. For vG, the shift σv : XX is (σv(x))g = xg+v. A map F : XX commutes with the shift action if σvF = Fσv for all vG.

Framework. S finite, X compact metrizable, shifts σv homeomorphisms. “Cellular automaton” means: there exist a finite set NG and a map f : SNS such that for every xX and every gG,

(F(x))g = f ( (xg+n)nN ).

Theorem (Curtis–Hedlund–Lyndon). A map F : XX is the global map of a cellular automaton (i.e. admits some finite N and local rule f as above) if and only if F is continuous (for the product topology) and shift-equivariant (σvF = Fσv for all vG).

Definitions used in the proof. A subset UX is open if every xU has a neighbourhood contained in U; it is closed if X \ U is open; it is clopen if it is both open and closed. For a finite window WG and a pattern p : WS, the cylinder set is C(W, p) := { xX : x|W = p }, where x|W denotes the restriction of the configuration x to coordinates in W.

In the product topology on X = SG (with finite discrete alphabet S), cylinders are basic clopen sets.

Proof

We prove both implications; the easy direction is “local rule ⇒ topology and symmetry”; the converse is the conceptual core of the theorem.

(⇒) If F is a CA global map, then F is continuous and shift-equivariant.

Shift-equivariance. For all x, g, v:

(σv(F(x)))g = (F(x))g+v = f((xg+v+n)nN) = f((σv(x))g+n)nN) = (F(σv(x)))g.

Continuity. Fix a coordinate gG. The map πgF : XS depends only on coordinates in the finite set g + N. Hence (πgF)−1({s}) is a cylinder set (clopen) for each sS. Finite intersections and unions of cylinders are clopen; since the alphabet is finite, F is continuous when S is given the discrete topology (inverse image of every cylinder in the subbasis of the codomain product topology is clopen). Thus F is continuous on X.

(⇐) If F is continuous and shift-equivariant, then F is a CA global map.

Step 1 — fibre at the origin. Let π0 : XS be projection to the cell at 0 ∈ G, and consider h := π0F : XS. For each symbol aS, the singleton {a} is clopen in S, so

Ua := h−1({a}) = { xX : (F(x))0 = a }

is clopen in X. The family {Ua}aS is a finite partition of X into disjoint clopens.

Step 2 — clopens are finite unions of cylinders. In the full shift X = SG with S finite, every clopen subset is a finite disjoint union of cylinder sets

C(W, p) := { xX : x|W = p },

where WG is finite and p : WS. (Idea: clopens are compact-open; cylinder sets form a basis; refine any clopen to a finite disjoint union of basic cylinders.) For each a, write Ua as such a union. Let W0 be the union of all finite windows W that appear in these unions, over all aS. Then W0 is finite.

Step 3 — (F(x))0 depends only on coordinates in W0. Say that x and y agree on W0 if xw = yw for every wW0. This is an equivalence relation; each class is a cylinder C(W0, p) for some pattern p. Because each Ua is a disjoint union of cylinders whose coordinate windows lie in W0, every such cylinder C(W0, p) is contained in a unique fibre Ua (the sets Ua partition X). Hence if x and y agree on W0, they lie in the same Ua, so h(x) = h(y), i.e. (F(x))0 = (F(y))0.

Step 4 — propagate to every cell by shift-equivariance. Fix gG. Using σgF = Fσg,

(F(x))g = (σg(F(x)))0 = (F(σg(x)))0.

Step 3 applied to σg(x) shows (F(σg(x)))0 depends only on values of σg(x) on W0, i.e. on values of x on g + W0. Therefore (F(x))g depends only on coordinates xg+n with nW0. Set N := W0 as the neighbourhood of the identity. Then (F(x))g is determined by (xg+n)nN.

Step 5 — define the local rule. For a pattern p : NS, choose any configuration x whose restriction to N equals p (arbitrary values elsewhere). Define f(p) := (F(x))0. Step 3 implies (F(x))0 depends only on x on N = W0, so f is well-defined. For any g, Step 4 gives (F(x))g = f((xg+n)nN). Thus F is a cellular automaton global map. ∎

Remark (where compactness hides). The “hard” direction uses that SG is compact and totally disconnected, so clopen sets are finite unions of cylinders; on non-compact subshifts one must restrict to maps between subshifts satisfying additional closedness hypotheses.