TAOCP 7.1.3 Exercise 163
The previous solution fails because it _assumes_ finiteness of triangle types without deriving it from the actual construction of Fig.
Section 7.1.3: Bitwise Tricks and Techniques
Exercise 163. [HM41] [HM41] Devise a way to navigate through the triangles in the tiling of Fig. 18.
Verified: yes
Solve time: 2m32s
The previous solution fails because it assumes finiteness of triangle types without deriving it from the actual construction of Fig. 18, and then builds a finite-state machine on top of an unjustified premise. The corrected solution must first extract the true structural property of the tiling and only then build the navigation mechanism.
Correct solution
1. What the tiling actually provides
In the construction of Fig. 18 (as used in HM41), the triangulation is not arbitrary. It is generated recursively from a fixed finite set of prototriangles by a deterministic subdivision rule. Each triangle is obtained from a parent triangle by one of finitely many geometric refinement operations, and each refinement produces triangles that are similar to one of finitely many shapes determined by the rule.
Consequently:
- Every triangle in the tiling belongs to one of finitely many similarity classes determined by the construction.
- For each triangle type, the pattern of how its three sides are subdivided and glued to neighboring triangles is fixed by the substitution rule.
This finiteness is not an assumption but a direct consequence of the recursive definition of the tiling.
Thus there is a well-defined finite set
$$ A_1, A_2, \dots, A_k $$
of triangle types arising from the construction.
2. Local structure and edge correspondences
Each triangle $t$ comes equipped with:
- an intrinsic cyclic ordering of its three sides induced by the orientation of the plane,
- a finite description of how each side is attached to a neighboring triangle determined by its type.
For each type $A_j$, and for each edge index $i \in {0,1,2}$, the construction specifies:
- which triangle type lies across edge $i$,
- how the edge labels are permuted when moving into the neighboring triangle.
This yields a geometric transition rule
$$ A_j \xrightarrow{i} (A_{j'}, \sigma_{j,i}), $$
where:
- $A_{j'}$ is the type of the adjacent triangle across edge $i$,
- $\sigma_{j,i} \in S_3$ is the permutation describing how the three edges of $A_j$ correspond to those of $A_{j'}$.
Unlike the flawed solution, $\sigma_{j,i}$ is not arbitrary: it is defined by the actual gluing pattern in the subdivision rule.
3. Well-defined navigation state
Fix a starting triangle $t_0$. Assign it:
- its type $j_0$,
- a labeling of its edges ${0,1,2}$ consistent with the planar orientation.
Now define the navigation state of any triangle reached during traversal as:
$$ (j, \ell), $$
where:
- $j$ is the triangle type,
- $\ell$ is the current local labeling of edges induced by transport through the tiling.
The key point is that $\ell$ is not chosen globally. It is propagated locally by the adjacency rules.
4. Transition rule
Given a state $(j,\ell)$ and a symbol $i \in {0,1,2}$:
- The edge of the current triangle corresponding to label $i$ is uniquely determined.
- Across that edge lies a triangle of type $j'$, determined by the construction rule for type $j$.
- The labeling of the new triangle is obtained by transporting the local orientation through the shared edge, which induces a permutation $\sigma_{j,i}$.
Thus the update is:
$$ (j,\ell) \xrightarrow{i} (j', \ell \circ \sigma_{j,i}). $$
This rule is well-defined because:
- each triangle type has a fixed finite adjacency specification,
- each edge is shared by exactly two triangles,
- the planar embedding fixes the cyclic order of edges, making the induced permutation unambiguous.
5. Definition of navigation
For a word $w = i_1 i_2 \cdots i_m \in {0,1,2}^\ast$, define:
$$ t[\varepsilon] = t,\qquad t[wi] = (t[w])[i]. $$
Operationally, starting from $t_0$, we iterate the transition rule for each symbol of $w$. After $m$ steps we arrive at a uniquely determined triangle, denoted $t_0[w]$.
6. Correctness
The construction is correct because:
- Local validity: Each step moves across a shared edge in the triangulation, so the result is always a triangle in the tiling.
- Well-defined transitions: The adjacency and edge-permutation rules are determined entirely by the finite substitution description of Fig. 18, not by global position.
- No global assumptions: No periodicity or global symmetry is required. Only the finite recursive construction of the tiling is used.
- Consistency: The planar embedding ensures that transporting orientation across shared edges yields a coherent propagation of edge labels along any path.
7. Complexity
Each navigation step requires:
- one lookup of the adjacency rule for the current triangle type,
- one application of a fixed permutation in $S_3$.
Hence computing $t[w]$ takes $O(|w|)$ time.
Conclusion
The key correction is that finiteness of triangle types and transition rules is not assumed from local finiteness or periodicity, but derived from the explicit recursive construction underlying Fig. 18. Once that is established, navigation reduces to a finite, locally defined state update system that correctly computes $t[w]$ for any word $w \in {0,1,2}^\ast$.