Most Complex Regular Ideal Languages

A right ideal (left ideal, two-sided ideal) is a non-empty language $L$ over an alphabet $\Sigma$ such that $L=L\Sigma^*$ ($L=\Sigma^*L$, $L=\Sigma^*L\Sigma^*$). Let $k=3$ for right ideals, 4 for left ideals and 5 for two-sided ideals. We show that there exist sequences ($L_n \mid n \ge k $) of right, left, and two-sided regular ideals, where $L_n$ has quotient complexity (state complexity) $n$, such that $L_n$ is most complex in its class under the following measures of complexity: the size of the syntactic semigroup, the quotient complexities of the left quotients of $L_n$, the number of atoms (intersections of complemented and uncomplemented left quotients), the quotient complexities of the atoms, and the quotient complexities of reversal, star, product (concatenation), and all binary boolean operations. In that sense, these ideals are"most complex"languages in their classes, or"universal witnesses"to the complexity of the various operations.


Introduction
We begin informally, postponing definitions until Section 2. In [4] Brzozowski introduced a list of conditions that a regular language should satisfy in order to be called "most complex", and found a sequence (U n | n 3) of regular languages with quotient/state complexity n that have the smallest possible alphabet and meet all of these conditions [4]. Namely, the languages U n meet the upper bounds for the size of the syntactic semigroup, the quotient complexities of left quotients, the number of atoms (intersections of complemented and uncomplemented left quotients), the quotient complexities of the atoms, and the quotient complexities of the following operations: reversal, star, product (concatenation), and all binary boolean operations. In this sense the languages in this sequence are most complex when compared to other regular languages of the same quotient complexity. However, these "universal witnesses" cannot be used when studying the complexities listed above in subclasses of regular languages, since they generally lack the properties of those classes. This paper is part of an ongoing project to investigate whether the approach used for general regular languages can be extended to subclasses. We present sequences of most complex languages for the classes of right, left, and two-sided regular ideals. Right ideals were chosen as an initial "test case" for this project due to their simple structure; we were able to obtain a sequence of most complex right ideals by making small modifications to the sequence (U n | n 3). A preliminary version of our results about right ideals appeared in [6]. The sequences of witnesses for left and two-sided ideals are more complicated, and first appeared in [15] where they were conjectured to have syntactic semigroups of maximal size; this was later proved in [12]. Our main new result is a demonstration that these sequences are in fact most complex. It has been shown in [11] that a most complex sequence does not exist for the class of suffix-free languages.
Having a single sequence of witnesses for all the complexity measures is useful when one needs to test systems that perform operations on regular languages and finite automata: to determine the sizes of the largest automata that can be handled by the system, one can use the same sequence of witnesses for all the operations.
For a further discussion of regular ideals see [6,8,10,12,15]. It was pointed out in [8] that ideals deserve to be studied for several reasons. They are fundamental objects in semigroup theory. They appear in the theoretical computer science literature as early as 1965, and continue to be of interest; an overview of historical and recent work on ideal languages is given in [8]. Besides being of theoretical interest, ideals also play a role in algorithms for pattern matching: For example, when searching for all words ending in a word from some set L, one is looking for all the words of the left ideal Σ * L. Additional examples of the use of ideals in applications can be found in [1,16,17,24].

Background
A deterministic finite automaton (DFA) D = (Q, Σ, δ, q 1 , F ) consists of a finite non-empty set Q of states, a finite non-empty alphabet Σ, a transition function δ : Q × Σ → Q, an initial state q 1 ∈ Q, and a set F ⊆ Q of final states. The transition function is extended to functions δ ′ : Q × Σ * → Q and δ ′′ : 2 Q × Σ * → 2 Q as usual, but these extensions are also denoted by δ. State q ∈ Q is reachable if there is a word w ∈ Σ * such that δ(q 1 , w) = q. The language accepted by D is L(D) = {w ∈ Σ * | δ(q 1 , w) ∈ F }. Two DFAs are equivalent if their languages are equal. The language of a state q is the language accepted by the DFA (Q, Σ, δ, q, F ). Two states are equivalent if their languages are equal; otherwise, they are distinguishable by some word that is in the language of one of the states, but not the other. A DFA is minimal if all of its states are reachable and no two states are equivalent. A state is empty if its language is empty.
A nondeterministic finite automaton (NFA) is a tuple N = (Q, Σ, η, Q I , F ), where Q, Σ, and F are as in a DFA, η : Q × Σ → 2 Q is the transition function and Q I ⊆ Q is the set of initial states. An ε-NFA has all the features of an NFA but its transition function η : Q × (Σ ∪ {ε}) → 2 Q allows also transitions under the empty word ε. The language accepted by an NFA or an ε-NFA is the set of words w for which there exists a sequence of transitions such that the concatenation of the symbols causing the transitions is w, and this sequence leads from a state in Q I to a state in F . Two NFAs are equivalent if they accept the same language.
Without loss of generality we use the set Q n = {1, 2, . . . , n} as the set of states for our automata. A transformation of Q n is a mapping of Q n into itself. We denote the image of a state q under a transformation t by qt. An arbitrary transformation of Q n can be written as t = 1 2 · · · n − 1 n p 1 p 2 · · · p n−1 p n , where p q = qt, 1 q n, and p q ∈ Q n . The image of a set P ⊆ Q n is P t = {pt | p ∈ P }. The identity transformation 1 maps each element to itself, that is, q1 = q for q = 1, . . . , n. For k 2, a transformation t of a set P = {p 1 , . . . , p k } is a k-cycle if there exist pairwise different elements p 1 , . . . , p k such that p 1 t = p 2 , p 2 t = p 3 , . . . , p k−1 t = p k , p k t = p 1 , and all other elements of Q n are mapped to themselves. A k-cycle is denoted by (p 1 , p 2 , . . . , p k ). A transposition is a 2-cycle (p, q). A transformation that changes only one element p to an element q = p is denoted by (p → q). A transformation mapping a subset P of Q n to a single element q and acting as the identity on Q n \ P is denoted by (P → q).
A permutation of Q n is a mapping of Q n onto itself. The set of all permutations of a set Q n of n elements is a group, called the symmetric group of degree n. This group has size n!. It is well known that two generators are necessary and sufficient to generate the symmetric group of degree n; in particular, the pairs {(1, 2, . . . , n), (1, 2)} and {(1, 2, . . . , n), (2, 3, . . . , n)} generate S n .
Let D = (Q, Σ, δ, q 0 , F ) be a DFA. For each word w ∈ Σ * , the transition function induces a transformation δ w of Q by w: for all q ∈ Q, qδ w = δ(q, w). The set T D of all such transformations by non-empty words forms a semigroup of transformations called the transition semigroup of D [23]. Conversely, we can use a set {δ a | a ∈ Σ} of transformations to define δ, and so the DFA D. We write a : t, where t is a transformation of Q, to mean that the transformation δ a induced by a is t.
The Myhill congruence [20] ↔ L of a language L ⊆ Σ * is defined on Σ + as follows: This congruence is also known as the syntactic congruence of L. The quotient set Σ + / ↔ L of equivalence classes of the relation ↔ L is a semigroup called the syntactic semigroup of L. If D is a minimal DFA of L, then T D is isomorphic to the syntactic semigroup T L of L [23], and we represent elements of T L by transformations in T D . The size of the syntactic semigroup has been used as a measure of complexity for regular languages [4,15,18], and is denoted by σ(L). The Nerode right congruence [21] of a language L ⊆ Σ * is defined on Σ * as follows: Thus two words x and y are in the same class of the Nerode right congruence if they define the same quotient, that is, if x −1 L = y −1 L, and the number of equivalence classes of → L is the number of quotients, which is called the quotient complexity [3] of L. An equivalent concept is the state complexity of a regular language [25] L, which is the number of states in a minimal DFA with alphabet Σ that recognizes L. This paper uses the term complexity for both of these equivalent notions. We denote the (quotient/state) complexity of a regular language L by κ(L). Atoms of regular languages were studied in [14], and their complexities in [6,13,19]. Consider the left congruence defined as follows: For x, y ∈ Σ + , x ← L y if and only if wx ∈ L ⇔ wy ∈ L for all w ∈ Σ * . Thus x ← L y if x ∈ w −1 L if and only if y ∈ w −1 L. An equivalence class of this relation is called an atom. It follows that atoms are intersections of complemented and uncomplemented quotients. In particular, if the quotients of L are K 1 , . . . , K n , then for each atom A there is a unique set S ⊆ {K 1 , . . . , K n } such that A = K∈S K ∩ K ∈S (Σ * \ K). In [4] it was argued that for a regular language to be considered "most complex" when compared with other languages of the same (quotient/state) complexity, it should have the maximal possible number of atoms and each atom should have maximal complexity. The complexity of atoms of ideals was studied in [6,7], and we shall state the results obtained there without proofs.
Most of the results in the literature concentrate on the (quotient/state) complexity of operations on regular languages. The complexity of an operation is the maximal complexity of the language resulting from the operation as a function of the complexities of the arguments.
It is generally assumed when studying complexity of binary operations that both arguments are languages over the same alphabet, since if they have different alphabets, we can just view them as languages over the union of the alphabets. However, in 2016, Brzozowski demonstrated that this viewpoint leads to incorrect complexity results for operations on languages over different alphabets [5]. He introduced a notion of unrestricted (quotient/state) complexity of operations, which gives correct results when languages have different alphabets. The traditional notion of complexity, in which languages are assumed to have the same alphabet, is referred to as restricted (quotient/state) complexity of operations. As this paper was written well before [5], all our results are in terms of restricted complexity. A study of unrestricted complexity of binary operations on ideals can be found in [9].
There are two parts to the process of establishing the complexity of an operation. First, one must find an upper bound on the complexity of the result of the operation by using quotient computations or automaton constructions. Second, one must find witnesses that meet this upper bound. One usually defines a sequence (L n | n k) of languages, where k is some small positive integer (the bound may not apply for small values of n). This sequence is called a stream. The languages in a stream usually differ only in the parameter n. For example, one might study unary languages ({a n } * | n 1) that have zero a's modulo n. A unary operation then takes its argument from a stream (L n | n k). For a binary operation, one adds as the second argument a stream (L ′ m | m k). Sometimes one considers the case where the inputs to the operations are restricted to some subclass of the class of regular languages. In this setting, typically the upper bounds on complexity are different and different witnesses must be found. The complexity of operations on regular ideal languages was studied in [8].
While witness streams are normally different for different operations, the main result of this paper shows that for the subclasses of right, left and two-sided ideals, the complexity bounds for all "basic operations" (those mentioned in the introduction) can be met by a single stream of languages along with a stream of "dialects", which are slightly modified versions of the languages. Several types of dialects were introduced in [4]; in this paper we consider only dialects defined as follows: Let Σ = {a 1 , . . . , a k } be an alphabet; we assume that its elements are ordered as shown. Let π be a partial permutation of Σ, that is, a partial function π : Σ → Γ where Γ ⊆ Σ, for which there exists ∆ ⊆ Σ such that π is bijective when restricted to ∆ and undefined on Σ \ ∆. We denote undefined values of π by the symbol "−".
In the sequel we refer to permutational dialects simply as dialects. The notion of a most complex stream of regular languages was introduced informally in [4]. A most complex stream is one whose languages together with their dialects meet all the upper bounds for the complexity measures described in the introduction. We now make this notion precise. First, however, we recall a property of boolean functions. Let the truth values of propositions be 1 (true) and 0 (false). Let A binary boolean function is proper if it is not a constant and not a function of one variable only. Definition 1. Let C be a class of languages and let C n be the subclass of C that consists of all the languages of C that have (quotient/state) complexity n. Let Σ = {a 1 , . . . , a k }, and let (L n (Σ) | n k) be a stream of languages, where L n ∈ C n for all n k. Then (L n (Σ) | n k) is most complex in class C if it satisfies all of the following conditions: 1. The syntactic semigroup of L n (Σ) has maximal cardinality for each n k.
2. Each quotient of L n (Σ) has maximal complexity for each n k.
3. L n (Σ) has the maximal possible number of atoms for each n k.
4. Each atom of L n (Σ) has maximal complexity for each n k.
5. The reverse of L n (Σ) has maximal complexity for each n k.
6. The star of L n (Σ) has maximal complexity for each n k.
7. The product L m (Σ)L n (Σ) has maximal complexity for all m, n k.
8. There exists a dialect L n (π(Σ)) such that each proper binary boolean function L m (Σ) • L n (π(Σ)) has maximal complexity for all m, n k.
A most complex stream (L n | n 3) for the class of regular languages was introduced in [4]. We give the definition of L n below. Definition 2. For n 3, let D n = D n (a, b, c) = (Q n , Σ, δ n , 1, {n}), where Σ = {a, b, c}, and δ n is defined by the transformations a : (1, . . . , n), b : (1, 2), c : (n → 1). Let L n = L n (a, b, c) be the language accepted by D n . The structure of D n (a, b, c) is shown in Figure 1. Our main contributions in this paper are most complex streams for the classes of right, left, and two-sided regular ideals.

Right Ideals
A stream of right ideals that is most complex was defined and studied in [6]. For completeness we include the results from that paper; the proof of Theorem 5 did not appear in [6].
Note that b is the identity when n = 3. Let L n = L n (a, b, c, d) be the language accepted by D n . The structure of D n (a, b, c, d) is shown in Figure 2. 1. The syntactic semigroup of L n (a, b, c, d) has cardinality n n−1 . Moreover, fewer than four inputs do not suffice to meet this bound.
2. The quotients of L n (a, −, −, d) have complexity n, except for the quotient {a, d} * , which has complexity 1.

For each atom
5. The reverse of L n (a, −, −, d) has complexity 2 n−1 .

For any proper binary boolean function •, the complexity of
In particular, Proof: For 1 q n − 1, a non-final state q accepts a n−1−q d and no other non-final state accepts this word. All non-final states are distinguishable from the final state n. Hence D n (a, −, −, d) is minimal and L n (a, −, −, d) has n quotients. Since D(a, b, c, d) has only one final state and that state accepts Σ * , it is a right ideal.
It was proved in [15] that the transition semigroup of a minimal DFA accepting a right ideal has at most n n−1 transformations, and that the transition semigroup of D ′ n has cardinality n n−1 . Since for n 3, (1, 2) is induced by a n−2 b in D n , all the transformations of D ′ n can be induced in D n , and the claim follows. Moreover, it was proved in [12] that an alphabet of at least four letters is required to meet this bound.
2. Each quotient of L n (a, −, −, d), except {a, d} * , has complexity n, since states 1, . . . , n − 1 are strongly connected. Each right ideal must have a final state that accepts Σ * (for L n (a, −, −, d) this is state n), and so the complexity of the quotient corresponding to this final state is 1. Hence the complexities of the quotients are maximal for right ideals.
3. It was proved in [13] that the number of atoms of any regular language L is equal to the complexity of the reverse of L. If L is a right ideal of complexity n, the maximal complexity of the reverse L R is 2 n−1 [8]. For n = 3, it is easily checked that our witness meets this bound. For n > 3, it was proved in [15] that the reverse of L n (a, −, −, d) reaches this bound.

Star
Theorem 2 (Right Ideals: Star [6]). For n 3 the complexity of the star of L n (a, −, −, d) is n + 1.
Proof: If L is a right ideal, then L * = L ∪ {ε}. Consider the DFA for star constructed as follows. To add ε to L, the initial state 1 of our witness cannot be made final since this would add other words to the language, for example, a n−1 . Thus an additional state, say 0, is required; this state is both initial and final in the DFA for L * , its outgoing transitions are the same as those of the initial state 1 of the DFA for L, and it has no incoming transitions. Since this DFA accepts L ∪ {ε}, n + 1 states are sufficient. All the states are pairwise distinguishable, since 0 rejects d, while n accepts it, and all the non-final states are distinguishable by words in a * d.

Product
We use the DFAs Figure 3 for m = 4 and n = 5, where Σ = {a, b, d} and the states of the first DFA are primed to distinguish them from those of the second DFA.
We show that the complexity of the product of L m (a, b, −, d)L n (a, b, −, d) reaches the maximum possible bound m + 2 n−2 derived in [8]. Define the ε- This ε-NFA accepts L m L n , and is illustrated in Figure 3. Assume now that we can reach all sets {m ′ , 1} ∪ S with |S| = k, and suppose that we want to reach {m ′ , 1} ∪ T with T = {q 0 , q 1 , . . . , q k } with 2 q 0 < q 1 < · · · < q k n − 1. This can be done by starting with S = {q 1 − q 0 + 1, . . . , q k − q 0 + 1} and applying ab q0−2 . Finally, to reach {m ′ , 1, n}, apply d to Also, state p ∈ Q n with 2 p n − 1 accepts a n−1−p d and no other state q ∈ Q n with 2 q n − 1 accepts this word.
Hence all the non-final states are distinguishable, and {m ′ , 1, n} is the only final state.

Boolean Operations
We restrict our attention to the four boolean operations ∪, ∩, \, ⊕, since the complexity of any other proper binary boolean operation can be obtained from these four. For example, we have κ( Tight upper bounds for boolean operations on right ideals [8] are mn for intersection and symmetric difference, mn − (m − 1) for difference, and mn − (m + n − 2) for union. Since L n ∪ L n = L n ∩ L n = L n , and L n \ L n = L n ⊕ L n = ∅, two different languages must be used to reach the bounds if m = n.
We use the DFAs Figure 4 for m = 4 and n = 5.  Let

The complexity of
That is, H ′ is the second last row of states, and V ′ is the second last column, restricted to S. By [2, Theorem 1], all states in S are distinguishable with respect to H ′ • V ′ , for each boolean operation • ∈ {∩, ⊕, \, ∪}. We claim that they are also distinguishable with respect to H • V for • ∈ {∩, ⊕, \, ∪}.
To see this, one verifies the following statement: for each • ∈ {∩, ⊕, \, ∪} and each state (p ′ , q) ∈ S, we have (p ′ , q) ∈ H ′ • V ′ if and only if (p ′ , q)d ∈ H • V . (This only applies to states (p ′ , q) ∈ S; for example, in Figure 5 we see that (4 ′ , 4)d ∈ H ∩ V but (4 ′ , 4) ∈ H ′ • V ′ .) Since states in S are distinguishable with respect to H ′ • V ′ , it follows that for any pair of states (p ′ , q), (r ′ , s) ∈ S there is a word w with (p ′ , q)w ∈ H ′ • V ′ and (r ′ , s) ∈ H ′ • V ′ . Then by the statement, the word wd sends (p ′ , q) into H • V and (r ′ , s) outside of H • V , thus distinguishing the two states with respect to H • V .
Thus for each boolean operation •, all states in S are distinguishable from each other with respect to the final state set H • V . Next, we prove that the states in S are distinguishable from the rest of the states (those in H ∪ V ) with respect to the final state set H • V .
Since all states in S are non-final, it suffices to distinguish states in S from states in X = H ∪V \ (H • V ), the set of non-final states in H ∪ V . If • = ∪, then X contains no states and there is nothing to be done. If • = ⊕, the only state in X is (m ′ , n), which is empty, but all states in S are non-empty. If • = \, then all states in X are empty but no states in S are. Finally, if • = ∩, observe that each state in X accepts a word containing a single d, while states in S \ {((m − 1) ′ , n − 1)} accept only words with at least two occurrences of d. To distinguish ((m − 1) ′ , n − 1) from (p ′ , q) ∈ X, apply a (which maps ((m − 1) ′ , n − 1) to (1 ′ , 2)) and then apply a word which distinguishes (1 ′ , 2) from (p ′ , q)a.
We have shown that each state in S is distinguishable from every other state in the direct product     Remark 1. For each class of languages we studied in this paper, our goal was to find a single DFA stream that meets the upper bounds (for that class) on all of our complexity measures. For regular right ideals, a four-letter alphabet was necessary to achieve this, because fewer than four letters are not sufficient for the size of the syntactic semigroup to be maximal. Having found such a DFA, we then observed that the alphabet of this DFA can be reduced for several operations. On the other hand, if one wishes to minimize the alphabet for one particular operation only, it is possible to find witnesses over even smaller alphabets.

Left Ideals
The following stream of left ideals was defined in [15]:  Proof: DFA D n (a, −, −, d, e) is minimal since only state 1 does not accept any word in a * , whereas every other state p > 1 accepts a n−p and no state q with 1 < q = p accepts this word. It was proved in [15] that D n (a, b, c, d, e) accepts a left ideal.
1. It was shown in [10] that the syntactic semigroup of a left ideal of complexity n has cardinality at most n n−1 + n− 1, and in [15] that the syntactic semigroup of L n (a, b, c, d, e) has cardinality n n−1 + n− 1.
Moreover, it was proved in [12] that an alphabet of at least five letters is required to meet this bound.
2. Each quotient of L n (a, −, −, d, e) has complexity n, since its minimal DFA is strongly connected.
3. The number of atoms of any regular language L is equal to the complexity of the reverse of L [13]. It was proved in [15] that the complexity of the reverse of L n (a, −, c, d, e) is 2 n−1 + 1.
6. The argument is the same as for the star of right ideals.

Product
We now show that the complexity of the product of D ′ m (a, −, −, −, e) with D n (a, −, −, −, e) reaches the maximum possible bound m + n − 1 derived in [8]. As in [8] we use the following construction: Define a DFA D from DFAs D ′ m and D n by omitting the final state of D ′ m and all the transitions from the final state, and redirecting all the transitions that go from a non-final state of D ′ m to the final state of D ′ m to the initial state of D n . It was proved in [8] that D accepts L m L n . The construction is illustrated in Figure 7 for m = 4 and n = 5. Proof: By construction D has m + n − 1 states. It is also clear that the shortest word accepted by state 1 ′ is ea m−2 ea n−2 , whereas for a state p ′ with 2 p m − 1 it is a m−p ea n−2 , for state 1 it is ea n−2 , and for any state q with 2 q n it is a n−q . Hence all the states are distinguishable by their shortest words.

Boolean Operations
As pointed out earlier, two different languages have to be used to reach the maximal complexity for boolean
We prove distinguishability using a number of claims: 2) is distinguishable from every other state in Column 2.
(a) If the operation is intersection (symmetric difference), then (m ′ , n) is distinguishable from all other states in Column n, since (m ′ , n) is the only final (non-final) state in this column. Note that a m−1 (a n−1 ) acts as the identity on the set Q ′ m \ {1 ′ } (Q n \ {1}). Hence a lcm(m−1,n−1) is the identity on Q ′ m \ {1} × Q n \ {1}, and x = a lcm(m−1,n−1)−1 maps (2 ′ , 2) to (m ′ , n). If two states are in the same column, then so are their successors after a ℓ is applied, for any ℓ 0. Therefore applying x to (p ′ , 2) leads to a state in Column n; so (2 ′ , 2) and (p ′ , 2) are distinguishable by x.
The argument is symmetric to that for Claim 1, when the operation is intersection, symmetric difference, or union. If the operation is difference, the states can be distinguished by a lcm(m−1,n−1)−1 since this maps (2 ′ , 2) to (m ′ , n), which is distinguishable from all other states in Row m.
3. For any two states in the same column there is a word mapping exactly one of them to (2 ′ , 2). Let the two states be (p ′ , q) and (r ′ , q). If {p, r} = {2, m}, let s = 1; otherwise, let s = 0. Applying a s results in (p ′ 1 , q 1 ) and (r ′ 1 , q 1 ), where {p 1 , r 1 } = {2, m}, since m 4. Thus we can assume that the pair of states to be distinguished is (p ′ , q) and (r ′ , q), where {p, r} = {2, m}. Now c takes these states to (p ′ 1 , 2) and (r ′ 1 , 2), and p 1 = r 1 , since c can map two states of Q ′ m \{1 ′ } to the same state only if these states are 2 ′ and m ′ . Observe that ac cyclically permutes states {(p ′ , 2) | 2 p m − 1}. So applying ac a sufficient number of times maps exactly one of the two states to (2 ′ , 2).

4.
For any two states in the same row there is a word mapping exactly one of them to (2 ′ , 2).
The proof is symmetric to that for Claim 3, if we interchange rows and columns and replace c by e.

5.
For any pair of states, there exists a word that maps one of the states to (2 ′ , 2) and the other to a state (p ′ , 2), p = 2, or (2 ′ , q), q = 2. There are several cases: (f) In the remaining case, one state is in Row m and the other state is in Column n; furthermore, neither state is the state (m ′ , n) from Case (d), and the pair of states being considered is not the pair (m ′ , n − 1) and ((m − 1) ′ , n) from Case (e). If the state in Row m is not (m ′ , n− 1), applying a sends it to a state that is not in Column n, and the other state to Column 2; so Case (c) applies. Otherwise, the state in Row m is (m ′ , n − 1) and the state in Column n is not ((m − 1) ′ , n). Applying a sends the first state to Row 2 and the other state to a state not in Row m; so Case (b) applies.
We have shown that for any pair of states, there exists a word that takes one of the states to (2 ′ , 2) and the other state not to (2 ′ , 2) but to either Row 2 or Column 2 by Claim 5. By Claims 1 and 2, those states are distinguishable. Therefore the original states are also distinguishable.
Remark 2. For regular left ideals, the minimal alphabet required to meet all the bounds has five letters. As was the case with right ideals, it is possible to reduce the alphabet for some operations [8]. The sizes are as follows: reversal (3/4), star (2/2), product (1/2), union (4/3), intersection (2/3), symmetric difference (2/3), and difference (3/3). Note that the previously known witness for union used a four-letter alphabet, while ours only uses three letters.

Two-Sided Ideals
The following stream of two-sided ideals was defined in [15]:    Proof: Notice that inputs a, e and f are needed to make all the states reachable. It was proved in [15] that D n (a, b, c, d, e, f ) is minimal and accepts a two-sided ideal.
1. It was shown in [10] that the syntactic semigroup of a two-sided ideal of complexity n has cardinality at most n n−2 + (n − 2)2 n−2 + 1, and in [15] that the syntactic semigroup of L n (a, b, c, d, e, f ) has that cardinality. Moreover, it was proved in [12] that an alphabet of at least six letters is required to meet this bound.
3. The number of atoms of any regular language L is equal to the complexity of the reverse of L [13]. It was proved in [15] that the complexity of the reverse of L n (a, −, −, d, e, f ) is 2 n−2 + 1.
6. The argument is the same as for the star of right ideals.

Product
We show that the complexity of the product of the DFA D ′ m (a, −, −, −, e, f ) with D n (a, −, −, −, e, f ) meets the upper bound m + n − 1 derived in [8]. We use the same construction as for left ideals for the product DFA D. The construction is illustrated in Figure 10 for m = n = 5.
Proof: By construction D has m + n − 1 states. We know that all the states in D ′ m are pairwise distinguishable. Hence in D, for each pair there exists a word that takes one state to state 1 and the other to a state in Q ′ m \ {m ′ }. Also, all pairs of distinct states in D n are distinguishable. To distinguish a state p ′ from a state q in D, note that every word accepted from p ′ contains two f 's, whereas there are words accepted from q that contain only one f .  For Row 1, first note that (1 ′ , 2) is reachable since ((m − 1) ′ , 2)d = (1 ′ , 2). Then (1 ′ , q)b = (1 ′ , q + 1) for 2 q n− 2, so we can reach (1 ′ , 3), . . . , (1 ′ , n− 1). Finally, we can reach (1 ′ , n) since (1 ′ , 2)f = (1 ′ , n).

Boolean Operations
A symmetric argument applies to Column 1. For Row m, note (m ′ , 1) is reachable since it is in Column 1. Then we have (m ′ , 1)e = (m ′ , 2), and (m ′ , q)b = (m ′ , q + 1), for 2 q n − 2, and finally (m ′ , 2)f = (m ′ , n). A symmetric argument applies to Column n. Before we begin the distinguishability proofs, we make a few observations. Let (p ′ , q) and (r ′ , s) be states with 1 p < r m; note that r > 1.
1. If r < m, the word a m−r sends (r ′ , s) to a state in Row 2. It sends (p ′ , q) to either Row 1 (if p = 1) or Row p + m − r (if p 2); in either case (p ′ , q) is not sent to Row 2 or Row m.
2. If r < m, the word a m−r f sends (r ′ , s) to Row m, and it sends (p ′ , q) to the same row as a m−r .
3. If r < m, then a m−r f m−r = a m−r f sends (r ′ , s) to Row m, and (p ′ , q) to a row other than Row m. If r = m, then a m−r f m−r = ε, the state (r ′ , s) = (m ′ , s) is in Row m, and the state (p ′ , q) is not in Row m.
Thus the word a m−r f m−r will send any state in Row r to Row m, and any state not in Row r to a row other than Row m. By a symmetric argument, the word b n−s f n−s sends states in Column s to Column n, and states not in Column s to a different column, for 1 q < s n. We use this fact frequently to distinguish states.
For each boolean operation we now prove that the number of distinguishable states meets the relevant upper bound.
1. Intersection/Symmetric Difference. For intersection, the only final state is (m ′ , n). For symmetric difference, every state in Row m or Column n except (m ′ , n) is final, and (m ′ , n) is the only empty state. We can use the same distinguishing words in both cases.
(a) States in distinct rows, p < r m: States (p ′ , q) and (r ′ , s), q, s ∈ Q n , are distinguishable by first applying a m−r f m−r . This sends one of the states to Row m, and the other to a different row. We then apply ea 2 f : applying e sends the state in Row m to (m ′ , 2) or (m ′ , n), and the state not in Row m to (2 ′ , 2) or (2 ′ , n). Then a 2 fixes (m ′ , 2) or (m ′ , n) and sends the other state to (4 ′ , 2) or (4 ′ , n). Finally, applying f sends one state to (m ′ , n), and the other state to (4 ′ , n). Since all states are distinguishable, the complexity is mn.

Difference.
Here the final states are those which are in Row m, but not Column n. States in Column n are indistinguishable and empty, since no word can take any of these states out of Column n, and that column contains only non-final states. Hence there are at most mn − (m − 1) distinguishable states.
(a) States in Row m, 1 q < s n: States (m ′ , q) and (m ′ , s) are distinguishable by b n−s f n−s , since (m ′ , n) is the only non-final state in Row m.
(b) States in distinct rows, and one state is in Column n: Any state outside of Column n accepts eb 2 f , and thus all of these states are non-empty. It follows that all states outside of Column n are distinguishable from the empty states in Column n.
(c) States in distinct rows, and neither state is in Column n: States (p ′ , q) and (r ′ , s), with p < r m and q, s n − 1, are distinguishable by a m−r f m−r unless this word sends (r ′ , s) to (m ′ , n). This occurs only if r < m and a m−r sends (r ′ , s) to (2 ′ , 2). In this case, applying b 2 after a m−r sends (2 ′ , 2) to (2 ′ , 4), and does not affect the row numbers; thus one of them will be in Row 2 and the other in neither Row 2 nor Row m. Then f distinguishes the states. Since all states in Q ′ m × (Q n \ {n}) are distinguishable, the complexity of difference is mn − (m − 1).

3.
Union. The final states are those in Row m and Column n. All final states are indistinguishable, since they all accept Σ * . Therefore there are at most 1+(m−1)(n−1) = mn−(m+n−2) distinguishable states.
(a) Non-final states in distinct rows: Two non-final states (p ′ , q) and (r ′ , s), with p < r < m and q, s < n, are distinguishable by a m−r f , unless this word sends (p ′ , q) to Column n (since it also sends (r ′ , s) to Row m). This occurs only if a m−r sends (p ′ , q) to Column 2. In this case we can use a m−r b 2 f to distinguish the states; this is similar to Case (c) of the difference operation.
(b) Non-final states in distinct columns: These states are distinguishable by a symmetric argument.
Thus the complexity of union is mn − (m + n − 2).
If m = n, the complexity bounds for boolean operations can be met by using languages from the stream (L n (a, b, −, d, e, f ) | n 5) for both arguments. That is, we can meet the bounds for boolean operations without the dialect stream (L n (b, a, −, d, e, f ) | n 5). The proof that all states are reachable is identical to the proof above, except state (1, n − 1) is reachable from (1, n − 2) by a instead of b, and when applying [2, Theorem 1] the special cases we must verify are only (m − 2, n − 2) ∈ {(3, 4), (4, 3)}, since we are assuming m = n. Also, for states (p ′ , q) and (r ′ , s) with p < r, the same remark about the word a m−r f m−r applies, i.e., this word sends (r ′ , s) to Row m and (p ′ , q) to a different row. For (p ′ , q) and (r ′ , s) with q < s, the word a n−s f n−s sends (r ′ , s) to Column n and (p ′ , q) to a different column (previously we used b n−s f n−s for this purpose).
For each boolean operation we now prove that the number of distinguishable states meets the relevant upper bound.