# 4.4 Nested Patterns

Consider the 13 33 rule:

RulePlot[ResourceFunction[ "WolframModel"][{{1, 2, 3}} -> {{1, 4, 6}, {2, 5, 4}, {3, 6, 5}}]]

Starting from a single ternary relation with three distinct elements {{1,2,3}}, this gives a classic Sierpiński triangle structure:

ResourceFunction[ "WolframModel"][{{1, 2, 3}} -> {{1, 4, 6}, {2, 5, 4}, {3, 6, 5}}, {{1, 2, 3}}, 5, "StatesPlotsList"]

Starting instead from a ternary self-loop {{0,0,0}} one gets what amounts to a tetrahedron of Sierpiński triangles:

ResourceFunction[ "WolframModel"][{{1, 2, 3}} -> {{1, 4, 6}, {2, 5, 4}, {3, 6, 5}}, {{0, 0, 0}}, 6, "StatesPlotsList"]

This is exactly the same as one would get by starting with a tetrahedron graph, and repeatedly replacing every trivalent vertex with a triangle of vertices [1:p509]:

PlanarGraph[#, ImageSize -> Tiny, VertexSize -> Tiny, EdgeStyle -> ResourceFunction["WolframPhysicsProjectStyleData"]["GenericGraph", "EdgeStyle"]] & /@ Apply[UndirectedEdge, (ResourceFunction[ "WolframModel"][{{0, 1}, {2, 1}} -> {{0, 2}}, #, "FinalState"] &) /@ ResourceFunction[ "WolframModel"][{{0, 1}, {0, 2}, {0, 3}} -> {{4, 5}, {6, 5}, {4, 7}, {8, 7}, {6, 9}, {8, 9}, {4, 1}, {6, 2}, {8, 3}}, {{0, 1}, {2, 1}, {0, 3}, {4, 3}, {0, 5}, {6, 5}, {2, 7}, {4, 7}, {2, 8}, {6, 8}, {4, 9}, {6, 9}}, 4, "StatesList"], {2}]

In an ordinary Sierpiński triangle, the points on the edges have different neighborhoods from those in the interior. But in the structure shown here, all points have the same neighborhoods (so there is an isometry).

Many of the rules we have used have completely different behavior if the order of elements in their relations are changed. But in this case the limiting shape is always the same, regardless of ordering, as in these examples:

ResourceFunction["WolframModelPlot"][#, ImageSize -> 90] &@ ResourceFunction["WolframModel"][{{1, 2, 3}} -> #, {{1, 2, 3}}, 3, "FinalState"] & /@ {{{6, 4, 1}, {2, 5, 4}, {5, 6, 3}}, {{6, 1, 4}, {5, 2, 4}, {6, 3, 5}}, {{6, 4, 1}, {4, 5, 2}, {5, 3, 6}}, {{1, 6, 4}, {4, 2, 5}, {3, 6, 5}}, {{4, 1, 6}, {5, 2, 4}, {5, 3, 6}}, {{6, 1, 4}, {2, 4, 5}, {6, 3, 5}}}

The rule we have discussed so far in this section in a sense directly implements the recursive construction of nested patterns [1:5.4]. But the formation of nested patterns is also a common feature of the limiting behavior of many rules that do not exhibit any such obvious construction.

As an example, consider the 13 23 rule:

{{x, y, z}} -> {{z, w, w}, {y, w, x}}
RulePlot[ResourceFunction[ "WolframModel"][{{x, y, z}} -> {{z, w, w}, {y, w, x}}]]

This rule effectively constructs a nested sequence of self-similar “segments”:

ResourceFunction["WolframModelPlot"][#, "MaxImageSize" -> 100] & /@ ResourceFunction[ "WolframModel"][{{x, y, z}} -> {{z, w, w}, {y, w, x}}, {{0, 0, 0}}, 9, "StatesList"]

Similar behavior is seen in rules with binary relations, such as the 12 42 rule:

{{x, y}} -> {{z, w}, {z, x}, {w, x}, {y, w}}
RulePlot[ResourceFunction[ "WolframModel"][{{x, y}} -> {{z, w}, {z, x}, {w, x}, {y, w}}]]
ResourceFunction["WolframModelPlot"][#, "MaxImageSize" -> 100] & /@ ResourceFunction[ "WolframModel"][{{x, y}} -> {{z, w}, {z, x}, {w, x}, {y, w}}, {{0, 0}}, 5, "StatesList"]

A clear “naturally occurring” Sierpiński pattern appears in the limiting behavior of the 22 42 rule:

{{x, y}, {z, y}} -> {{y, w}, {y, w}, {w, x}, {z, w}}
RulePlot[ResourceFunction[ "WolframModel"][{{x, y}, {z, y}} -> {{y, w}, {y, w}, {w, x}, {z, w}}]]
ResourceFunction["WolframModelPlot"][#, ImageSize -> Tiny] & /@ ResourceFunction[ "WolframModel"][{{x, y}, {z, y}} -> {{y, w}, {y, w}, {w, x}, {z, w}}, {{0, 0}, {0, 0}, {0, 0}}, 11, "StatesList"]

After 15 steps, the rule yields:

ResourceFunction[ "WolframModel"][{{x, y}, {z, y}} -> {{y, w}, {y, w}, {w, x}, {z, w}}, {{0, 0}, {0, 0}, {0, 0}}, 15, "FinalStatePlot"]