Manuscript Offprint
arXiv:2610.13274Prime Accessible Deterministic Automata
Abstract
We classify prime accessible deterministic automata over finite alphabets, both among finite automata and among automata with arbitrary state sets. Every one-state automaton is prime. Over a one-letter alphabet, a finite nontrivial automaton is prime exactly when it is a cycle of prime-power length or a finite chain ending in a fixed state. The unique infinite accessible unary automaton, up to isomorphism, is also prime. Every nontrivial automaton over an alphabet with at least two letters is not prime. Shen proved the finite case; we give a shorter proof.
We also characterize a decomposition of the automaton whose states are all finite input words. The reachable product of the quotients by the least right congruences identifying the empty word with nonempty words p and q, respectively, is isomorphic to this automaton exactly when for all positive integers r, s.
Keywords: prime automata, divisibility, reachable synchronous products, right congruences, infinite automata
1. Introduction
For a nonempty set of input letters, let denote the set of all finite words over , including the empty word . For , write for its length. A deterministic automaton over , or a -automaton, is a quadruple , where is the state set, is the initial state, and is the transition function. We extend to words by
Corresponding author.
Email address: 262138051@csu.edu.cn (Chenghe Xu) where uv denotes concatenation. The automaton is accessible if every state is reached from i by some word. All automata in this paper are accessible; no accepting states or output functions are specified. For a set X, we use to represent its cardinality. An automaton is finite if its state set is finite, and nontrivial if it has at least two states. For any automaton A, we write , , and for its state set, initial state, and transition function.
We follow Yao’s definitions of factors, isomorphisms, products, divisibility, and primality [1, Section 5]; see also Kamae and Mendès France [2, Section 2]. Yao works with finite automata over alphabets with at least two letters. We use the same definitions for arbitrary accessible state sets and also include one-letter alphabets.
For accessible -automata , we say that is a factor of if there is a surjective map satisfying
We write for this homomorphism. A bijective homomorphism is an isomorphism; we write when one exists.
For accessible -automata , their reachable synchronous product is
where
for every and . Only states reachable from the initial pair are retained. Throughout the paper, “product” means this reachable synchronous product.
We say that is divisible by , or that is a multiple of , and write , if there is an accessible -automaton such that
Proposition 2.1 shows that divisibility is equivalent to the factor relation even when state sets are infinite.
Over a fixed alphabet, we consider two classes: all accessible deterministic automata, and those with finite state sets. An automaton A in either class is prime in that class if
for all in that class. We call finite-state prime when are required to be finite, and unrestrictedly prime when their state sets may be arbitrary. Outside Section 3, “prime” means unrestrictedly prime unless stated otherwise. One-state automata are included.
This differs from the primality studied by Kupferman and Mosheiff [3] and Spenner [4], where a regular language is composite if it is a finite intersection of languages accepted by deterministic finite automata with fewer states than its minimal automaton. Here primality concerns the underlying accessible transition structure, with no size restriction on the two factors.
Shen proved that no finite nontrivial automaton over a finite alphabet with at least two letters is prime among finite automata [5]. Theorem 3.5 gives a shorter proof. It uses the states reached after the first letter instead of classifying the whole transition graph. The required state information is stored in two finite automata, with explicit bounds on their sizes.
The main new results are Lemma 4.4 and Theorem 4.5. They determine exactly when two quotients by the least right congruences identifying the empty word with chosen nonempty words have product isomorphic to the automaton of all finite input words. This gives more than non-primality: the product retains the entire input word, not just the state reached in a particular automaton. The resulting decomposition applies to arbitrary state sets and alphabets.
An automaton with one input letter is called unary; one with at least two input letters is called non-unary. Over the alphabet , for integers and , define the unary automaton
where
Starting from 0, this automaton makes transitions before entering a cycle of p states. We call the tail length and p the cycle length.
The following is the primality classification of finite-state automata.
Theorem 1.1. Let be a finite accessible deterministic automaton over a finite nonempty alphabet. Primality in this theorem is taken among finite accessible deterministic automata.
(i) If , then A is prime.
(ii) If , then is isomorphic to a unique automaton , with integers and . Apart from the one-state automaton , it is prime if and only if
and is a prime power, or and .
Here a prime power means an integer of the form , where is a prime integer and is an integer.
(iii) If and , then there are finite accessible -automata such that
In particular, A is not prime.
We now allow both finite and infinite state sets. Put . The infinite unary successor automaton is
Thus each input letter increases the state by one. An automaton with one state is called a unit automaton.
Theorem 1.2. Let be an accessible deterministic automaton over a finite nonempty alphabet. Primality in this theorem is taken among all accessible deterministic automata, with no restriction on state-set cardinality.
(i) Every unit automaton is prime.
(ii) If and S is infinite, then A is isomorphic to the infinite unary successor automaton U and is prime.
(iii) If and S is finite, the classification is the same as in Theorem 1.1(ii).
(iv) If and , then A is not prime.
Proposition 2.1. For accessible automata A and B over the same alphabet,
is a factor of .
Proof. If , compose this isomorphism with the projection onto . The projection is a surjective homomorphism because is accessible. Thus is a factor of .
Conversely, let be a surjective homomorphism. Since
the states of are exactly with . Hence is a bijection from onto this state set. It preserves the initial state and commutes with every transition because does. This gives , so .
If and are finite, Proposition 2.1 shows that has the same meaning in both classes: its proof takes the auxiliary factor to be itself. Only the range of in the definition of primality changes.
For , define its reaching map by
An automaton identifies two words if they reach the same state, and distinguishes them if they reach different states.
Lemma 2.2. For accessible automata A and B over ,
Proof. If , Proposition 2.1 gives a surjective homomorphism . Induction on word length gives for every . Thus implies .
Conversely, assume the implication in the statement. For each , accessibility of gives a word with . Define
If another word also reaches in , then , so the assumed implication gives . Thus is well defined on all of . It is surjective: for every , accessibility of gives a word with , and then .
Taking gives . For any and , choose with . Then
Hence is a surjective homomorphism, and Proposition 2.1 gives .
Remark. By Lemma 2.2, if and only if
To prove , it suffices to find two words identified by but distinguished by .
3. Finite-state automata
Throughout this section the alphabet is finite. Every automaton used to prove non-primality also has a finite state set. Thus prime means finite-state prime.
3.1. Unit automata
Proposition 3.1. Every unit automaton is unrestrictedly prime, and hence also finite-state prime.
Proof. Let . For every accessible -automaton , the constant map is surjective, preserves the initial state, and commutes with every transition. Thus is a factor of , and Proposition 2.1 gives . In particular, whenever , one already has ; hence is prime.
3.2. Finite unary automata
Throughout this subsection, let . For a word and , write for the concatenation of copies of , with . We use this notation over any alphabet.
Every finite accessible unary automaton is isomorphic to a unique : the first repeated state determines the tail length and cycle length . For all with ,
Lemma 3.2. For integers and ,
Proof. By Lemma 2.2, divisibility requires that whenever two words reach the same state in , they also reach the same state in . Applying this to and gives and by (1). Conversely, these two conditions and (1) preserve every such equality, so Lemma 2.2 applies.
For positive integers , let denote their least common multiple.
Lemma 3.3. For integers and ,
Proof. The words , , where and , reach the same product state exactly when they reach the same state in both coordinates. By (1), this means
The unique form of the product therefore has the stated parameters.
Theorem 3.4. Let and be integers with . The automaton is finite-state prime if and only if
and is a prime power, and .
Proof. Let be finite accessible unary automata such that . Up to isomorphism, write and , with integers and . The preceding lemmas give
If , the tail inequality holds for one factor. If and is a prime power, then divides or : the exponent of a prime in a least common multiple is the larger of its exponents in the two integers. Lemma 3.2 proves primality in both cases.
For and , we have
If and is not a prime power, write with coprime integers . Then
In each case, Lemma 3.2 shows that divides neither displayed factor.
3.3. Non-unary alphabets: a finite proof
For , write for the set of words beginning with .
The non-primality conclusion below is Shen’s theorem [5]. We give a shorter proof and record the state bounds supplied by the construction. For , put
Theorem 3.5. Let be finite and accessible over a finite alphabet, with and . There are finite accessible -automata with
such that
Consequently, A is not finite-state prime.
Proof. We distinguish two cases.
Case 1: some contains at least two states, where . Choose . There is a word with such that
Indeed, take if . Otherwise ; since contains at least two states, some satisfies , and then works.
To construct , use two distinct new state labels , and a distinct label for each , all different from , . The bar is only a label, not an operation on . Define
with transitions, for ,
and
These transitions stay in : if for and , then for every . The transition depends only on , not on the word used to reach it. Induction on word length gives, for every ,
Thus every state in is reachable: is reached by , by , and each remaining state by a word occurring in its definition. Also . Since has at least two states, there exist with , whereas . Lemma 2.2 therefore gives
To construct C, let P consist of the proper prefixes of u:
.
In particular and . Use state labels for , for , and for . Labels from different families, or with different indices within one family, are distinct. Define
and put . For and , set
For each state of the indicated form in and every , set
The first transition rule is unambiguous: starts with , and neither nor belongs to . For , if starts with , then because ; if starts with , then and . Hence the remaining clause produces a state in .
The other transitions also stay in . If a word does not belong to and begins with neither nor , then the same is true of for every . Otherwise would already be a proper prefix of or begin with or . Thus every transition from a state has its prescribed target in . A transition from , where , has target , also in . The rules depend only on the displayed state indices, so they are independent of the words representing those indices.
Induction on word length now gives
(2)
These formulas show that every state in is reachable. Moreover,
so C is finite. Since but , Lemma 2.2 gives
Finally, let satisfy and . If their common state in is , then . If it is for some , then . Otherwise both words begin with . In this last case, a common state in , with , gives , while a common state , with , gives . If their common state is , with , both words must begin with , because the alternative in (2) begins with . The first state index then gives . We have proved
By the definition of the product and Lemma 2.2, this proves .
Case 2: every contains exactly one state. Put
This assumption gives for all , so every is absorbing, meaning that every input letter fixes it. Accessibility gives . Moreover : if for some , then
for every , contrary to . Hence , where denotes disjoint union.
Suppose first that . Write for the set of integer residue classes modulo , with addition taken modulo . Choose a bijection . Let have states , initial state , and the following transitions. Here means that the letter sends state to state .
Let have states and initial state , with transitions for and given by
Both automata are accessible: word lengths reach all residues of , while a suitable one-letter word reaches each residue of . Each has states. If with and , then
Applying to recovers , and the pair of initial states occurs only at . Therefore by Lemma 2.2.
Choose letters with . Then , so . Let represent modulo , and choose any . Since is absorbing,
Thus .
Finally suppose . Then and every nonempty word reaches the absorbing state . Choose distinct letters . Let have states , with initial state , the letter fixing , and every other letter sending to the absorbing state . Define symmetrically using . Both are accessible and have two states, so the stated bounds hold. The automaton identifies with , and identifies with , so divides neither. Write and . For every ,
Since , the product distinguishes the empty word from every nonempty word, which is exactly the distinction made by . Hence .
3.4. Completion of the finite-state classification
Proof of Theorem 1.1. Part (i) is Proposition 3.1. For part (ii), the tail-cycle description gives the unique form , and Theorem 3.4 gives exactly the stated arithmetic alternatives. Part (iii) is Theorem 3.5; the automata constructed there are finite.
Example 3.6. Let and consider the Thue-Morse automaton , where
For a word , let denote the number of occurrences of 1 in . Then
Thus the state reached by the binary expansion of is the th term of the Thue-Morse sequence, starting with index 0.
Case 1 of the proof of Theorem 3.5 applies with , , and . It gives automata with initial states , shown with in Figure 1. Unattached arrows mark initial states; edge labels are input letters. In the notation of that proof, represents the pair and represents . Both automata are accessible: reach in , and reach in , respectively.



Figure 1: The automata in Example 3.6.
Figure 2 shows their product. It has exactly the five states in the following table. Each is reached by the word in the middle column, and the set is closed under both letter transitions. The last column defines a map .
| product state | reaching word | λ |
|---|---|---|
| ε | 0 | |
| 0 | 0 | |
| 01 | 1 | |
| 1 | 1 | |
| 11 | 0 |

Figure 2: The reachable product in Example 3.6.
The diagrams show that preserves the initial state and commutes with both letters. It is surjective, so . However, identifies 0, 01, whereas distinguishes them. Likewise, identifies 0, 1, whereas distinguishes them. Lemma 2.2 gives and . Hence the Thue–Morse automaton is not finite-state prime.
4. Allowing arbitrary state sets
In this section prime means unrestrictedly prime. The proof of Theorem 3.5 already gives non-primality for arbitrary state sets over a finite alphabet: the construction in Case 1 does not require finiteness, while Case 2 gives , which is finite. After treating unary automata, we prove a stronger decomposition result in Lemma 4.4 and Theorem 4.5: the product of two explicit quotients recovers every input word. This second construction also permits infinite alphabets.
4.1. Unary automata
We again work over the alphabet .
Proposition 4.1. Every accessible infinite unary automaton is isomorphic to U. Every accessible unary automaton divides U.
Proof. For , the map from onto is a surjective homomorphism, so . If two values with indices were equal, every later state would lie among the first n states. Thus, when S is infinite, this map is also injective and is an isomorphism.
Proposition 4.2. For a finite accessible unary automaton, finite-state primality and unrestricted primality are equivalent. Hence the arithmetic classification in Theorem 3.4 is unchanged when are allowed to be infinite.
Proof. Unrestricted primality implies finite-state primality. For the converse, let be finite-state prime and suppose that for accessible unary automata . If both factors are finite, divides one of them by assumption. Otherwise, Proposition 4.1 shows that an infinite factor is isomorphic to and is divisible by .
Theorem 4.3. The infinite unary successor automaton U is unrestrictedly prime.
Proof. If , then the product is infinite, so at least one factor is infinite. By Proposition 4.1, that factor is isomorphic to . Hence divides one factor.
4.2. A decomposition by prefix reduction
We work over any nonempty alphabet . The following right congruences give the decomposition used in Theorem 4.5.
An equivalence relation on is a right congruence if
For a nonempty word , write each uniquely as
where is maximal. This is possible because . The word is obtained by deleting all initial copies of . In particular, . Deleting copies from the beginning does not increase word length.
Lemma 4.4. For each nonempty , the relation defined by
is the smallest right congruence identifying and . For any nonempty ,
where is the equality relation. In particular, the intersection is the equality relation whenever have different first letters.
Proof. Equality of the values of defines an equivalence relation. If , write and , where and . For every , deleting the displayed copies of and then any further initial copies gives
Thus is a right congruence and identifies . Any right congruence identifying these words identifies with for every and . It therefore contains .
Suppose that distinct words are equivalent under both and . Two distinct words with the same -value have different lengths. After interchanging , assume . Their common reduced representative gives for an integer . The same argument for gives for an integer . Cancelling the common suffix from yields . Conversely, if for some , then , but and . This proves the equivalence. Words with different first letters cannot have equal positive powers.
If is an equivalence relation on a set , write for the equivalence class of , and for the set of its classes.
For each nonempty , define the quotient automaton
where
Lemma 4.4 makes the transition independent of the chosen representative. Every class is reached by , so is accessible. Moreover,
Thus is the unique shortest word in its class. We may identify the states with the words in . In this description, the initial state is and the transition is
The free word automaton is
Its state reached by w is w itself. The next theorem gives an exact criterion for the two quotients to recover this automaton.
Theorem 4.5. Let p, q be nonempty words over a nonempty alphabet . Then
If and is a nontrivial accessible -automaton, there are words with different first letters, and , such that
In particular, A is not prime. No finiteness assumption on or is needed.
Proof. The map
is a surjective homomorphism from to . It is the unique homomorphism between these automata, since it must send each word to the state reached by that word. Hence an isomorphism exists exactly when is injective. Lemma 4.4 gives the criterion in (3).
Let be nontrivial and accessible, with . Some letter satisfies ; otherwise every word would fix . Choose and put
In the second case . Thus have different first letters and satisfy and . The automaton identifies , whereas distinguishes them; give the same obstruction for . Lemma 2.2 proves both non-divisibilities.
By (3), every reachable product state has the form for a unique . The map
is therefore well defined. It is surjective by accessibility, preserves the initial state, and commutes with each letter because . This proves .
When have different first letters, at least one of equals . The inverse of then chooses the longer coordinate; equal-length coordinates are both . This recovery rule uses the different-first-letter assumption, not merely the absence of a common positive power. If , each is infinite: for a letter different from the first letter of , the words () are distinct reduced representatives. Thus the finite constructions of Section 3 are still needed when the factors must be finite.
Example 4.6. Let and consider the infinite-state automaton
Here each input letter is also regarded as the integer 0 or 1. For , let be its binary value, defined by
Thus words are read from left to right, and for every . Every natural number is reached by its binary expansion, so is accessible. The first states and transitions are shown in Figure 3(a).
Since and , the proof of Theorem 4.5 chooses and . The states of may be represented by , and those of by . Their initial states are , and their transitions append the input letter and then delete all initial copies of 1 or 01, respectively. Figures 3(b) and 4(a) show these automata.
In , the words , 1 reach the same state; in , the words , 01 reach the same state. Since

(a)

(b)
Figure 3: The automata and in Example 4.6.
Lemma 2.2 shows that divides neither factor.
Figure 4(b) labels the product state by the word ; each transition appends its input letter. Since 1 and 01 have different first letters, the longer coordinate recovers . Thus
is well defined. It is surjective, preserves the initial state, and commutes with both letters by the recursion for . Hence , although divides neither factor.

(a)

(b) .
Figure 4: The automaton and the product .
Remark. The dots in Figures 3 and 4 indicate continuing branches. In , every state has transitions for . The same rule holds in for .
4.3. Completion of the classification
Proof of Theorem 1.2. Proposition 3.1 proves part (i). If the alphabet has one letter, Proposition 4.1 shows that an infinite automaton is isomorphic to U, which is prime by Theorem 4.3. This proves part (ii). For a finite unary automaton, Theorem 3.4 gives the classification among finite automata, and Proposition 4.2 shows that it is unchanged when infinite factors are allowed. This proves part (iii). Theorem 4.5 proves part (iv).
Remark. Theorems 1.1 and 1.2 show that finite-state and unrestricted primality coincide for finite automata over finite alphabets. By Theorem 4.5, Theorem 1.2 also holds for arbitrary alphabets; over an infinite alphabet, only unit automata are prime.
Acknowledgments
Z. Shen was supported by the National Natural Science Foundation of China (Grant No. 12301011).
Declaration of generative AI and AI-assisted technologies in the manuscript preparation process
During the writing of the paper, the authors used AI tools (ChatGPT and DeepSeek) to refine some proof details, adjust the structure of the paper, and improve the exposition. All mathematical statements and proofs in the paper were verified by the authors. The authors take full responsibility for the paper.
References
[1] J.-Y. Yao, Some properties of Ising automata, Theoretical Computer Science 314 (1–2) (2004) 251–279. doi:10.1016/j.tcs.2003.12.020.
[2] T. Kamae, M. Mendès France, A continuous family of automata: the Ising automata, Annales de l'Institut Henri Poincaré, Physique Théorique 64 (3) (1996) 349–372.
[3] O. Kupferman, J. Mosheiff, Prime languages, Information and Computation 240 (2015) 90–107. doi:10.1016/j.ic.2014.09.010.
[4] D. A. Spenner, Deciding DFA-primality is NP-hard, in: S. Bhattacharya, D. Nanongkai, M. Benedikt, G. Puppis (Eds.), 53rd International Colloquium on Automata, Languages, and Programming (ICALP 2026), Vol. 374 of Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2026, pp. 192:1–192:16. doi:10.4230/LIPIcs.ICALP.2026.192.
[5] Z. Shen, Prime automata do not exist, Theoretical Computer Science 922 (2022) 248–256. doi:10.1016/j.tcs.2022.04.027.