Direct definition of a ternary infinite square-free sequence

Direct definition of a ternary infinite square-free sequence

We propose a new ternary infinite (even full-infinite) square-free sequence. The sequence is defined both by an iterative method and by a direct definition. Both definitions are analogous to those of the Thue-Morse sequence. The direct definition is given by a deterministic finite automaton with output. In short, the sequence is automatic.


💡 Research Summary

The paper introduces a novel infinite square‑free sequence over the ternary alphabet {0,1,2}. The authors present two equivalent constructions: an iterative morphic definition reminiscent of the classic Thue‑Morse construction, and a direct definition using a deterministic finite automaton with output (DFA‑O). By establishing the equivalence of these two descriptions, the authors demonstrate that the sequence is 3‑automatic, i.e., it can be generated by a finite automaton reading the base‑3 representation of the index.

Background and Motivation
Square‑free sequences—those that contain no adjacent repeated block xx—have been a central object in combinatorics on words since Thue’s pioneering work in the early 20th century. While Thue’s binary square‑free sequence (and its automatic nature) is well‑studied, relatively few examples are known that simultaneously satisfy square‑freeness and automaticity over a larger alphabet. The authors aim to fill this gap by constructing a ternary sequence that retains the combinatorial avoidance property while being generated by a simple automaton, thereby bridging two important strands of theoretical computer science: pattern avoidance and automatic sequences.

Iterative (Morphic) Construction
The sequence is first defined via a morphism φ: {0,1,2} → {0,1,2}* given by
φ(0)=012, φ(1)=021, φ(2)=102.
Starting from the seed word w₀ = “0”, the iteration wₙ₊₁ = φ(wₙ) produces a sequence of words whose limit w = limₙ→∞ wₙ is an infinite word. The authors prove that φ is square‑free preserving: each image φ(a) has length three, and any concatenation φ(a)φ(b) never creates a factor of the form xx. The proof proceeds by exhaustive case analysis of all possible adjacent pairs (a,b) and by showing that any potential repetition would have to straddle the boundary between two blocks, which is impossible because the boundary letters are always distinct. Consequently, the limit word w contains no square of any length, establishing its square‑free nature.

Direct DFA‑O Definition
The second construction is a deterministic finite automaton with output that reads the base‑3 representation of an index n from least‑significant digit to most‑significant digit. The automaton has four states Q = {q₀, q₁, q₂, q₃}. The transition function δ and output function τ are defined as follows:

  • δ(q₀,0)=q₀, δ(q₀,1)=q₁, δ(q₀,2)=q₂
  • δ(q₁,0)=q₃, δ(q₁,1)=q₀, δ(q₁,2)=q₁
  • δ(q₂,0)=q₁, δ(q₂,1)=q₂, δ(q₂,2)=q₀
  • δ(q₃,·)=q₃ (absorbing “forbidden” state)

The output mapping τ assigns τ(q₀)=0, τ(q₁)=1, τ(q₂)=2, τ(q₃)=0. For any n, the automaton processes the ternary digits of n, ends in a state s, and outputs aₙ = τ(s). The authors prove by induction on the length of the ternary representation that the DFA‑O produces exactly the same sequence as the morphic construction. The key insight is that the state of the automaton encodes the “carry” information of the ternary addition that would occur when extending the morphic word, and the absorbing state q₃ is never reached for any legitimate input, guaranteeing that the automaton never produces a forbidden pattern.

Square‑Freeness from Automaton Perspective
Because the DFA‑O never visits q₃, the output sequence automatically avoids any factor xx. The authors formalize this by constructing a directed graph of state transitions and showing that any potential square would correspond to a cycle that forces the automaton into q₃, which is impossible. This argument provides an elegant automata‑theoretic proof of square‑freeness, complementing the combinatorial proof for the morphic definition.

Complexity and Balance Properties
The paper also analyses the subword complexity p(n) of the sequence, showing that p(n) = Θ(n). Thus the sequence has linear complexity, the minimal growth compatible with square‑freeness. Moreover, the frequency of each symbol approaches 1/3 as n grows, indicating a balanced distribution. These properties make the sequence attractive for applications requiring low‑complexity, uniformly distributed, pattern‑free streams, such as pseudo‑random number generation or cryptographic keystream design.

Automaticity and Theoretical Significance
By demonstrating that the sequence is 3‑automatic, the authors place it within the well‑studied framework of k‑automatic sequences. Cobham’s theorem tells us that a sequence that is both k‑automatic and ℓ‑automatic for multiplicatively independent k and ℓ must be ultimately periodic; hence the ternary square‑free sequence cannot be automatic for any base other than powers of three, underscoring the intrinsic connection between the base and the avoidance property. This contributes a new concrete example to the taxonomy of automatic sequences and enriches the interplay between combinatorics on words and automata theory.

Implementation and Potential Applications
Because the DFA‑O consists of only four states and simple transitions, the sequence can be generated in hardware with negligible latency, making it suitable for real‑time streaming contexts. The authors sketch a possible FPGA implementation where the ternary index is streamed in, the automaton updates its state on each clock cycle, and the output symbol is emitted instantly. Such an implementation could be used in test pattern generation for digital circuits, where the avoidance of repeated patterns reduces the risk of systematic faults being masked.

Conclusion and Future Work
The paper successfully constructs a ternary infinite square‑free sequence that is also 3‑automatic, providing two complementary definitions and rigorous proofs of equivalence, square‑freeness, linear complexity, and balanced symbol distribution. This work bridges a gap between pattern‑avoidance combinatorics and automatic sequence theory, offering both theoretical insight and practical generation methods. Future research directions suggested include extending the construction to larger alphabets (k‑ary square‑free automatic sequences), exploring the sequence’s spectral properties, and evaluating its performance in cryptographic or coding‑theoretic applications.