# Most complex regular ideal languages.

A right ideal (left ideal, two-sided ideal) is a non-empty language L over an alphabet [summation] such that L = L[summation]* (L = [summation]* L, L = [summation]* L[summation]*). Let k = 3 for right ideals, 4 for left ideals and 5 for two-sided ideals. We show that there exist sequences ([L.sub.n] | n [TEXT NOT REPRODUCIBLE IN ASCII] k) of right, left, and two-sided regular ideals, where [L.sub.n] has quotient complexity (state complexity) n, such that [L.sub.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.sub.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.

Keywords: atom, basic operations, ideal, most complex, quotient, regular language, state complexity, syntactic semi-group, universal witness

1 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.sub.n] | n [TEXT NOT REPRODUCIBLE IN ASCII] 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.sub.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.sub.n] | n [TEXT NOT REPRODUCIBLE IN ASCII] 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 [summation]*L. Additional examples of the use of ideals in applications can be found in [1, 16, 17, 24].

2 Background

A deterministic finite automaton (DFA) V = (Q, [summation], [delta], q1, F) consists of a finite non-empty set Q of states, a finite non-empty alphabet E, a transition function 5 : Q x [summation] [right arrow] Q, an initial state q1 [member of] Q, and a set F [??] Q of final states. The transition function is extended to functions [[delta].sup.1] : Q x [summation]* [right arrow] Q and 5'' : [2.sup.Q] x [summation]* [right arrow] [2.sup.Q] as usual, but these extensions are also denoted by [delta]. State q [member of] Q is reachable if there is a word [omega] [member of] [summation]* suchthat [delta](q1,[omega]) = q. The language accepted by D is L(D) = {[omega] [member of] [summation]* | [delta](q1,[omega]) [member of] F}. Two DFAs are equivalent if their languages are equal. The language ofa state q is the language accepted by the DFA (Q, [summation], [delta], 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, [summation], [eta], [Q.sub.I], F), where Q, [summation], and F are as in a DFA, [eta] : Q x [summation] [right arrow] [2.sup.Q] is the transition function and [Q.sub.I] [??] Q is the set of initial states. An [epsilon]-NFA has all the features of an NFA but its transition function [eta] : Q x ([summation] U {[epsilon]}) [right arrow] [2.sup.Q] allows also transitions under the empty word [epsilon]. The language accepted by an NFA or an [epsilon]-NFA is the set of words [omega] 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.sub.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.sub.n] = {1, 2,..., [eta]} as the set of states for our automata. A transformation of [Q.sub.n] is a mapping of [Q.sub.n] into itself. We denote the image of a state q under a transformation t by qt. An arbitrary transformation of [Q.sub.n] can be written as

[TEXT NOT REPRODUCIBLE IN ASCII]

where [p.sub.q] = qt, 1 [??] q [??] n, and [p.sub.q] [member of] [Q.sub.n]. The image of a set P [??] [Q.sub.n] is Pt = {pt | p [member of] P}.

The identity transformation 1 maps each element to itself, that is, ql = q for q = 1,..., n. For k [??] 2, a transformation t of a set P = {[p.sub.1],... ,[p.sub.k]} is a k-cycle if there exist pairwise different elements [p.sub.1],... ,[p.sub.k] such that [p.sub.1] t = [p.sub.2] ,[p.sub.2] t = [p.sub.3],... ,[p.sub.k-1]t = [p.sub.k], [p.sub.k]t = [p.sub.1], and all other elements of [Q.sub.n] are mapped to themselves. A [kappa]-cycle is denoted by ([p.sub.1],[p.sub.2],... ,[p.sub.k]). A transposition is a 2-cycle (p, q). A transformation that changes only one element p to an element q [not equal to] p is denoted by (p [right arrow] q). A transformation mapping a subset P of [Q.sub.n] to a single element q and acting as the identity on [Q.sub.n] \ P is denoted by (P [right arrow] q).

A permutation of [Q.sub.n] is a mapping of [Q.sub.n] onto itself. The set of all permutations of a set [Q.sub.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.sub.n]

The set [TEXT NOT REPRODUCIBLE IN ASCII] of all transformations of [Q.sub.n] is a semigroup, in fact a monoid with 1 as the identity. It is well known that three transformations are necessary and sufficient to generate [TEXT NOT REPRODUCIBLE IN ASCII] ; in particular, the triples {(1, 2,..., n), (1,2), (n [right arrow] 1)} and {(1,2,..., n), (2, 3,..., n), (n [right arrow] 1)} generate [TEXT NOT REPRODUCIBLE IN ASCII].

Let D = (Q, [summation], [delta], [q.sub.0], F) be a DFA. For each word [omega] G [[member of].sup.*], the transition function induces a transformation [[delta].sub.[omega]] of Q by [omega]: for all q [member of] Q, q[[delta].sub.[omega]] = [delta](q, [omega]). The set [T.sub.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 {[[delta].sub.a] | a [member of] [summation]} of transformations to define [delta], and so the DFA D. We write a : t, where t is a transformation of Q, to mean that the transformation [[delta].sub.a] induced by a is t.

The Myhill congruence [20][[left and right arrow].sub.L] of a language L [??] [summation]* is defined on [[summation].sup.+] as follows:

For x, y G [[summation].sup.+], x [[left and right arrow].sub.L] y if and only if wxz [member of] L wyz [member of] L for all w, z [member of] [summation]*.

This congruence is also known as the syntactic congruence of L. The quotient set [E.sup.+]/ [[left and right arrow].sub.L] of equivalence classes of the relation [[left and right arrow].sub.L] is a semigroup called the syntactic semigroup of L. If D is a minimal DFA of L, then [T.sub.D] is isomorphic to the syntactic semigroup [T.sub.L] of L [23], and we represent elements of [T.sub.L] by transformations in [T.sub.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 [sigma](L).

The Nerode right congruence [21] of a language L [??] [summation]* is defined on [summation]* as follows:

For x, y [member of] [summation]*, x [right arrow] L y if and only if xz [member of] L [??] yz [member of] L for all z [member of] [summation]*.

The (left) quotient of L [??] [summation]* by a word w G [summation]* is the language [[omega].sup.-1]L = {x [member of] [summation]* | wx [member of] L}. 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.sup.-1] L = [y.sup.-1] L, and the number of equivalence classes of [[right arrow].sub.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 [summation] 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 [kappa](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 [member of] [[summation].sup.+], x [[left arrow].sub.L] y if and only if wx [member of] L [??] wy [member of] L for all w [member of] [summation]*.

Thus x [[left arrow].sub.L] y if x [member of] [[omega].sup.-1]L if and only if y [member of] [[omega].sup.-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.sub.1],..., [K.sub.n], then for each atom A there is a unique set S [??] {[K.sub.1]..., [K.sub.n]} such that [TEXT NOT REPRODUCIBLE IN ASCII]([summation]* \ 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.sub.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.sup.n]}.sup.*] | n [??] 1) that have zero a's modulo n. A unary operation then takes its argument from a stream ([L.sub.n] | n [??] k). For a binary operation, one adds as the second argument a stream ([L'.sub.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 [summation] = {[a.sub.1],..., [a.sub.k]} be an alphabet; we assume that its elements are ordered as shown. Let [pi] be a partial permutation of [summation], that is, a partial function [pi] : [summation] [right arrow] [GAMMA] where [GAMMA] [??] [summation], for which there exists [DELTA] [??] [summation] such that [pi] is bijective when restricted to [DELTA] and undefined on [summation] \ [DELTA]. We denote undefined values of [pi] by the symbol "-".

If L is a language over E, we denote it by L([a.sub.1],...,[a.sub.k]) to stress its dependence on [summation]. If [pi] is a partial permutation, let [s.sub.[pi]] be the language substitution defined as follows: for a [member of] [summation], a [right arrow] {[pi](a)} when n(a) is defined, and a [right arrow] [empty set] when [pi](a) is not defined. Forexample, if [summation] = {a, b, c}, L(a, b, c) = {a, b, c}(*){ab, acc}, and [pi](a) = c, [pi](b) = -, and [pi](c) = b, then [s.sub.[pi]] (L) = {b, c}(*){cbb}. In other words, the letter c plays the role of a, and b plays the role of c. A permutational dialect of L([a.sub.1],..., [a.sub.k]) is a language of the form [s.sub.[pi]] (L([a.sub.1],..., [a.sub.k])), where [pi] is a partial permutation of [summation]; this dialect is denoted by L([pi]([a.sub.1]),..., [pi]([a.sub.k])). If the order on E is understood, we use L(E) for L([a.sub.1],..., [a.sub.k]) and L([pi]([summation])) for L([summation]([a.sub.1]),..., [summation]([a.sub.k])).

Let [summation] = {[a.sub.1],..., [a.sub.k]}, and let V = (Q, [summation], 5, [q.sub.1], F) be aDFA; we denote it by D([a.sub.1],..., [a.sub.k]) to stress its dependence on E. If n is a partial permutation, then the permutational dialect

D([pi]([a.sub.1]),...,[pi]([a.sub.k]))

of V([a.sub.1],..., [a.sub.k]) is obtained by changing the alphabet of D from [summation] to [pi]([summation]), and modifying 5 so that in the modified DFA [pi]([a.sub.i]) induces the transformation induced by [a.sub.i] in the original DFA; thus [pi]([a.sub.i]) plays the role of One verifies that if the language L([a.sub.1],..., [a.sub.k]) is accepted by DFA D([a.sub.1],..., [a.sub.k]), then L([pi]([a.sub.1]),..., [pi]([a.sub.k])) is accepted by D([pi]([a.sub.1]),..., [pi]([a.sub.k])).

In the sequel we refer to permutational dialects simply as dialects.

Example 1. Suppose D = D(a, b, c) = ({1,2, 3}, {a, b, c}, [delta], [q.sub.1], F), where [delta] is defined by the transformations a : (1, 2,3), b : (3 [right arrow] 1), and c : (1, 2). Let L = L(a,b,c) be the language of this DFA. Consider the partial permutation [pi](a) = b, [pi](b) = -, and [pi](c) = a. In the dialect associated with [pi], the letter b plays the role of a, and a plays the role of c. Thus D(b, -, a) is the DFA ({1,2, 3}, {a, b}, [[delta].sup.[pi]], [q.sub.1], F), where [[delta].sup.[pi]] is defined by a : (1,2) and b : (1, 2,3). The language of D(b, -, a) is the dialect L(b, -, a) of L.

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 o : {0,1} X {0,1} [right arrow] {0,1} be a binary boolean function. Extend o to a function [TEXT NOT REPRODUCIBLE IN ASCII]: If [omega] [member of] [summation]* and L, L' [??] [summation]*, then [omega] [member of] (L [??] L')[??] ([summation] [member of] L) [??] ([omega] [member of] L'). A binary boolean function is proper if it is not a constant and not a function ofone variable only.

Definition 1. Let C be a class of languages and let [C.sub.n] be the subclass of C that consists of all the languages of C that have (quotient/state) complexity n. Let [summation] = {[a.sub.1],...,[a.sub.k]}, and let ([L.sub.n]([summation]) | n [??] k) be a stream of languages, where [L.sub.n] [member of] [C.sub.n] for all n [??] k. Then ([L.sub.n]([summation]) | n [??] k) is most complex in class C if it satisfies all of the following conditions:

1. The syntactic semigroup of [L.sub.n]([summation]) has maximal cardinality for each n [??] k.

2. Each quotient of [L.sub.n] ([summation]) has maximal complexity for each n [??] k.

3. [L.sub.n]([summation]) has the maximal possible number of atoms for each n [??] k.

4. Each atom of [L.sub.n]([summation]) has maximal complexity for each n [??] k.

5. The reverse of [L.sub.n]([summation]) has maximal complexity for each n [??] k.

6. The star of [L.sub.n]([summation]) has maximal complexity for each n [??] k.

7. The product [L.sub.m]([summation])[L.sub.n] ([summation]) has maximal complexity for all m, n [??] k.

8. There exists a dialect [L.sub.m](n([summation])) such that each proper binary boolean function ([L.sub.m]([summation]) o ([L.sub.n]([pi]([summation])) has maximal complexity for all m, n [??] k.

A most complex stream ([L.sub.m] | n [??] 3) for the class of regular languages was introduced in [4]. We give the definition of [L.sub.m] below.

Definition 2. For n [??] 3, let [D.sub.n] = [D.sub.n](a, b, c) = ([Q.sub.n], E, [[delta].sub.n], 1, {n}), where [summation] = {a, b, c}, and [[delta].sub.n] is defined by the transformations a : (1,..., n), b : (1,2), c : (n [right arrow] 1). Let [L.sub.n] = [L.sub.n](a, b, c) be the language accepted by [D.sub.n]. The structure of [D.sub.n](a, b, c) is shown in Figure 1.

[FIGURE 1 OMITTED]

Our main contributions in this paper are most complex streams for the classes of right, left, and two-sided regular ideals.

3 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].

Definition 3. For n [??] 3, let [D.sub.n] = [D.sub.n](a, b, c, d) = ([Q.sub.n], [summation], [[delta].sub.n], 1, {n}), where [summation] = {a, b, c, d}, and [[delta].sub.n] is defined by the transformations a : (1,..., n - 1), b : (2,..., n - 1), c: (n - 1 [right arrow] 1) and d: (n - 1 [right arrow] n). Note that b is the identity when n = 3. Let [D.sub.n] = [D.sub.n](a, b, c, d) be the language accepted by [D.sub.n]. The structure of [D.sub.n] (a, b, c, d) is shown in Figure 2.

[FIGURE 2 OMITTED]

The DFA of Figure 2 has a similar structure to the DFA of Figure 1. More precisely, DFA [D.sub.n] of Figure 2 is constructed by taking DFA [D.sub.n-1] of Figure 1, adding a new state n and a new input d : (n - 1 [right arrow] n), making n the only final state, and having b induce the cyclic permutation (2,..., n - 1), rather than the transposition (1,2). The new state and input d ensure that [L.sub.n] is a right ideal. The new transformation by b is necessary since, if b induces (1, 2) in [D.sub.n], then [L.sub.n] does not meet the bound for product.

Theorem 1 (Right Ideals [6]). For each n [??] 3, the DFA [D.sub.n](a, b, c, d) of Definition 3 is minimal and its language [L.sub.n](a, b, c, d) is a right ideal of complexity n. The stream ([L.sub.n](a, b, c, d) | n [??] 3) with dialect stream ([L.sub.n](b, a, c, d) | n [??] 3) is most complex in the class of regular right ideals. In particular, this stream meets all the complexity bounds listed below, which are maximal for right ideals. In several cases the bounds can be met with restricted alphabets, as shown below.

1. The syntactic semigroup of [L.sub.n](a, b, c, d) has cardinality [n.sup.n-1]. Moreover, fewer than four inputs do not suffice to meet this bound.

2. The quotients of ([L.sub.n](a, -, -, d) have complexity n, except for the quotient [{a, d}.sup.*], which has complexity1.

3. [L.sub.n](a, -, -, d) has [2.sup.N-1] atoms.

4. For each atom [A.sub.S] of [L.sub.n](a, b, c, d), the complexity K([A.sub.S]) satisfies:

[TEXT NOT REPRODUCIBLE IN ASCII]

5. The reverse of [L.sub.n] (a, - , -, d) has complexity [2.sup.N- 1].

6. The star of [L.sub.n] (a, -, -, d) has complexity n + 1.

7. The product [L.sub.m] (a, b, -, d)[L.sub.n](a, b, -, d) has complexity m + [2.sup.n-2].

8. For any proper binary boolean function o, the complexity of [L.sub.m](a, b, -, d)o[L.sub.n](b, a, -, d) is maximal. In particular,

(a) [L.sub.m](a, b, -, d) [intersection] [L.sub.n](b, a, -, d) and [L.sub.m](a, b, -, d) [direct sum] [L.sub.n](b, a, -, d) have complexity mn.

(b) [L.sub.m](a, b, -, d) \ [L.sub.n](b, a, -, d) has complexity mn - (m - 1).

(c) [L.sub.m](a, b, -, d) [union] [L.sub.n](b, a, -, d) has complexity mn - (m + n - 2).

(d) If m [not equal to] n, the bounds are met by [L.sub.m] (a, b, -, d) and [L.sub.n](a, b, -, d).

Proof: For 1 [??] q [??]n - 1, a non-final state q accepts [a.sup.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.sub.n](a, - , - , d) is minimal and [L.sub.n](a, -, -, d) has n quotients. Since D(a, b, c, d) has only one final state and that state accepts [summation]*, it is a right ideal.

1. The case n = 3 is easily checked. For n [??] 4, let = [TEXT NOT REPRODUCIBLE IN ASCII], where [summation] = {a, b, c, d}, and a : (1,...,n - 1), b : (1,2), c : (n - 1 [right arrow] 1) and d : (n - 1 [right arrow] n). It was proved in [15] that the transition semigroup of a minimal DFA accepting a right ideal has at most [n.sup.n-1] transformations, and that the transition semigroup of [TEXT NOT REPRODUCIBLE IN ASCII] has cardinality [n.sup.n-1]. Since for n [??] 3, (1, 2) is induced by [a.sup.n-2]b in [D.sub.n], all the transformations of [TEXT NOT REPRODUCIBLE IN ASCII] can be induced in [D.sub.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.sub.n](a, -, -, d), except [{a, d}.sup.*], has complexity n, since states 1,..., n - 1 are strongly connected. Each right ideal must have a final state that accepts [summation]* (for [L.sub.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.sup.R] is [2.sup.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.sub.n](a, -, -, d) reaches this bound.

4. This was proved in [7].

5. See Item 3 above.

6. See Theorem 2.

7. See Theorem 3.

8. See Theorems 4 and 5.

3.1 Star

Theorem 2 (Right Ideals: Star [6]). For n [??] 3 the complexity of the star of [L.sub.n] (a, - , -, d) is n + 1.

Proof: If L is a right ideal, then [L*] = L [union] {[member of]}. Consider the DFA for star constructed as follows. To add [member of] 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.sup.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 [union] {[member of]}, 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.

3.2 Product

We use the DFAs [TEXT NOT REPRODUCIBLE IN ASCII] and [D.sub.n](a, b, -, d) = ([Q.sub.n], [summation], [[delta].sub.n], 1, {n}) shown in Figure 3 for m = 4 and n = 5, where [summation] = {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.sub.m] (a, b, -, d)[L.sub.n](a, b, -, d) reaches the maximum possible bound m + [2.sup.n-2] derived in [8]. Define the e-NFA [TEXT NOT REPRODUCIBLE IN ASCII], where [TEXT NOT REPRODUCIBLE IN ASCII] if q [member of] [Q.sub.n], a [member of] [summation], and [[delta].sub.p](m',[member of]) = {1}. This [member of]-NFA accepts [L.sub.m][L.sub.n], and is illustrated in Figure 3.

[FIGURE 3 OMITTED]

Theorem 3 (Right Ideals: Product [6]). For m, n [??] 3 the complexity of the product of [L.sub.m](a, b, -, d) and [L.sub.n](a, b, -, d) is m + [2.sup.n-2].

Proof: It was shown in [8] that m + [2.sup.n-2] is an upper bound on the complexity of the product of two right ideals. To prove this bound is met, we apply the subset construction to P to obtain a DFA D for [L.sub.m][L.sub.n]. The states of D are subsets of [TEXT NOT REPRODUCIBLE IN ASCII] We prove that all states of the form {p'}, p = 1,..., m - 1 and all states of the form {m', 1} [union] S, where S [??] [Q.sub.n] \ {1, n}, and state {m', 1, n} are reachable, for a total of m + [2.sup.n-2] states.

State {1'} is the initial state, and {p'} is reached by [a.sup.p-1] for p = 2,..., m - 1. Also, {m', 1} is reached by [a.sup.m-2]d, and states m' and 1 are present in every subset reachable from {m', 1}. By applying [ab.sup.q-2] to {m', 1} we reach {m', 1, q}; hence all subsets {m', 1} [union] S with |S| = 1 are reachable.

Assume now that we can reach all sets {m', 1} U S with |S | = k, and suppose that we want to reach {m', 1} [union] T with T = {[q.sub.0], [q.sub.1],..., [q.sub.k]} with 2 [??] [q.sub.0] < [q.sub.1] < < [q.sub.k] [??] n - 1. This can be done by starting with S = {[q.sub.1] - [q.sub.0] + 1,..., [q.sub.k] - [q.sub.0] + 1} and applying a[b.sup.qo-2]. Finally, to reach {m', 1, n}, apply d to {m , 1 , n - 1}.

if 1 [??] p<q [??] m - 1, then state {p'} is distinguishable from {q'} by [a.sup.m-1-q]d[a.sup.n-1]d. Also, state p G [Q.sub.n] with 2 [??] p [??] n - 1 accepts [a.sup.n-1-p]d and no other state q [member of] [Q.sub.n] with 2 [??] q [??] n - 1 accepts this word. Hence, if S, T [??] [Q.sub.n] \ {1, n} and S [not equal to] T, then {m', 1} [union] S and {m', 1} [union] T are distinguishable. State {p'} with 2 [??] p [??] m - 1 is distinguishable from state {m', 1} [union] S because there is a word with a single d that is accepted from {m', 1} [union] S but no such word is accepted by {q'}. Hence all the non-final states are distinguishable, and {m', 1, n} is the only final state.

3.3 Boolean Operations

We restrict our attention to the four boolean operations [union],[intersection], \, [direct sum], since the complexity of any other proper binary boolean operation can be obtained from these four. For example, we have [TEXT NOT REPRODUCIBLE IN ASCII].

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.sub.n] [union] [L.sub.n] = [L.sub.n] [intersection] [L.sub.n] = [L.sub.n], and [L.sub.n] \ [L.sub.n] = [L.sub.n] [direct sum] [L.sub.n] = [empty set], two different languages must be used to reach the bounds if m = n.

We use the DFAs [TEXT NOT REPRODUCIBLE IN ASCII] and [D.sub.n](b,a,-,d) = ([Q.sub.n], E,[[delta].sub.n], 1, {n}) shown in Figure 4 for m = 4 and n = 5.

[FIGURE 4 OMITTED]

Let [TEXT NOT REPRODUCIBLE IN ASCII] Depending on the assignment of final states, this DFA recognizes different boolean operations on [L.sub.m] and [L.sub.n]. The direct product of [D.sub.4](a,b, -,d) and [D.sub.5](b,a, -, d) isinFigure5.

Let [S.sub.n] denote the symmetric group of degree n. A basis [22] of [S.sub.n] is an ordered pair (s, t) of distinct transformations of [Q.sub.n] = {1,..., n} that generate [S.sub.n]. A DFA has a basis ([t.sub.a], [t.sub.a]) for [S.sub.n] if it has letters a, b [member of] E such that a induces [t.sub.a] and b induces [t.sub.b]. In the case of our right ideal [TEXT NOT REPRODUCIBLE IN ASCII], the transitions [TEXT NOT REPRODUCIBLE IN ASCII] and [TEXT NOT REPRODUCIBLE IN ASCII] ([[delta].sub.a] and [[delta].sub.b]) restricted to {1',..., (m -..., n - 1}), constitute a basis for [S.sub.m-1] ([S.sub.n-i]). Consider DFAs [TEXT NOT REPRODUCIBLE IN ASCII] and [A.sub.n-i] = ([Q.sub.n-i], EE,[[delta]n-1], 1, {n - 1}), where E = {a, b} and the transitions of [TEXT NOT REPRODUCIBLE IN ASCII] are the same as those of [TEXT NOT REPRODUCIBLE IN ASCII] restricted to [TEXT NOT REPRODUCIBLE IN ASCII]. By [2, Theorem 1] all the states in the direct product of [TEXT NOT REPRODUCIBLE IN ASCII] and [A.sub.n-1] are reachable and distinguishable for m - 1,n - 1 [??] 2, (m - 1,n - 1) [??] {(2, 2), (3,4), (4, 3), (4,4)}. We shall use this result to simplify our proofofthe nexttheorem.

Theorem 4 (Right Ideals: Boolean Operations [6]). If m, n [??] 3, then

1. The complexity of [L.sub.m](a, b, -, d) [intersection] [L.sub.n](b, a, -, d) is mn.

2. The complexity of [L.sub.m](a, b, -, d) [direct sum] [L.sub.n](b, a, -, d) is mn.

3. The complexity of [L.sub.m](a, b, -, d) \ [L.sub.n](b, a, -, d) is mn - (m - 1).

[FIGURE 5 OMITTED]

4. The complexity of [L.sub.m](a, b, -, d) [union] [L.sub.n](b, a, -, d) is mn - (m + n - 2).

Proof: In the cases where (m, n) [member of] {(3, 3), (4, 5), (5,4), (5,5)}, we cannot apply the result from [2, Theorem 1], but we have verified computationally that the bounds are met. Thus we assume that (m, n) [??] {(3, 3), (4, 5), (5, 4), (5, 5)}.

Our first task is to show that all mn states of [L.sub.m,n] are reachable. By [2, Theorem 1], all states in the set S = {(p', q) | 1 [??] p [??] m - 1,1 [??] q [??] n - 1} are reachable. The remaining states are the ones in the last row or last column (that is, Row m or Column n) ofthe direct product.

For 1 [??] q [??] n - 2, from state ((m - 1)', q) we can reach (m', q) by d. From state (m', n - 2) we can reach (m', n - 1) by a. From state ((m - 1)', n - 1) we can reach (m', n) by d. Hence all states in Row m are reachable.

For 1 [??] p [??] m - 2, from state (p', n - 1) we can reach (p', n) by d. From state ((m - 2)', n) we can reach ((m - 1)', n) by a. Hence all states in Column n are reachable, and thus all mn states are reachable.

We now count the number of distinguishable states for each operation. Let H = {(m', q) | 1 [??] q [??] n} be the set of states in the last row and let V = {(p', n) | 1 [??] p [??] m} be the set of states in the last column. If [??] [member of] {[intersection], [direct sum], \, [union]}, then [L.sub.m](a, b, -, d) o [L.sub.n](b, a, -, d) is recognized by [D.sub.m,n], where the set of final states is taken to be H o V.

Let H' = {((m - 1)', q) | 1 [??] q [??] n - 1} and let V' = {(p',n - 1) | 1 [??] p [??] m - 1}. 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 ' o V ', for each boolean operation [??] [member of] {[intersection], [direct sum], \, [union]}. We claim that they are also distinguishable with respect to H [??] V for o [member of] {[intersection], [direct sum], \, [union]}.

To see this, one verifies the following statement: for each [??] [member of] {[intersection], [direct sum], \, [union]} and each state (p', q) [member of] S, we have (p', q) [member of] H ' [??] V ' if and only if (p', q)d [member of] H [??] V. (This only applies to states (p', q) [member of] S; for example, in Figure 5 we see that (4', 4)d [member of] H [intersection] 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) [member of] S there is a word [omega] with (p', q)[omega] [member of] 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 [union] 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 [union] V \ (H [??] V), the set of non-final states in H [union] V. If [??] = [union], then X contains no states and there is nothing to be done. If [??] = [direct sum], 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 [??] = [intersection], 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) [member of] 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 [D.sub.m,n], with respect to each of the four final state sets H [??] V with [??] [member of] {[intersection], [direct sum],\, [union]}. Since there are (m - 1)(n -1) = mn - m - n +1 states in S, there are at least that many distinguishable states for each operation [??]. To show that the complexity bounds are reached by [L.sub.m](a, b, -, d) [??] [L.sub.n](b, a, -, d), it suffices to consider how many of the remaining m + n - 1 states in H [union] V are distinguishable with respect to H [??] V. We consider each operation in turn.

Intersection: Here the set of final states is H [intersection] V = {(m', n)}. State (m', n) is the only final state and hence is distinguishable from all the other states. Any two states in H (V) are distinguished by words in b* d (a*d). State (m', 1) accepts [b.sup.n-2]d, while (1', n) rejects it. For 2 [??] q [??] n - 1, (m', q) is sent to (m', 1) by [b.sup.n-q], while state (1', n) is not changed by that word. Hence (m', q) is distinguishable from (1', n). By a symmetric argument, (p', n) is distinguishable from (m', 1) for 2 [??] p [??] m - 1. For 2 [??] q [??] n - 1 and 2 [??] p [??] m - 1, (m', q) is distinguished from (p', n) because [b.sup.n-q] sends the former to (m', 1) and the latter to a state of the form (r', n), where 2 [??] r [??] m -1. Hence all pairs of states from H [union] V are distinguishable. Since there are m + n - 1 states in H [union] V, it follows there are (mn - m - n + 1) + (m + n - 1) = mn distinguishable states.

Symmetric Difference: Here the set of final states is H [direct sum] V, that is, all states in the last row and column except (m', n), which is the only empty state. This situation is complementary to that for intersection. Thus every two states from H [union] V are distinguishable by the same word as for intersection. Hence there are mn distinguishable states.

Difference: Here the set of final states is H \ V, that is, all states in the last row H except (m', n), which is empty. All other states in the last column V are also empty. The m empty states in V are all equivalent, and the n - 1 final states in H \ V are distinguished in the same way as for intersection. Hence there are (n - 1) +1 = n distinguishable states in H \ V. It follows there are (mn - m - n +1) + n = mn - (m - 1) distinguishable states.

Union: Here the set of final states is H [union] V. From a state in H [union] V it is possible to reach only other states in H [union] V, and all these states are final; so every state in H [union] V accepts [summation]*. Thus all the states in H [union] V are equivalent, and so there are (mn - m - n+l) + l = mn - (m + n - 2) distinguishable states.

Although it is impossible for the stream ([L.sub.n](a, b, -, d) | n [??] 3) to meet the bounds for boolean operations when m = n, this stream is as complex as it could possibly be in view of the following theorem:

Theorem 5 (Right Ideals: Boolean Operations, m [not equal to] n). Suppose m, n [??] 3 and m [??] n.

1. The complexity of [L.sub.m](a, b, -, d) [intersection] [L.sub.n](a, b, -, d) is mn.

2. The complexity of [L.sub.m](a, b, -, d) [direct sum] [L.sub.n](a, b, -, d) is mn.

3. The complexity of [L.sub.m](a, b, -, d) \ [L.sub.n](a, b, -, d) is mn - (m - 1).

4. The complexity of [L.sub.m](a, b, -, d) [union] [L.sub.n](a, b, -, d) is mn - (m + n - 2).

Proof: Let [D'.sub.m] = [D.sub.m](a, b, -, d), [D.sub.n] = [D.sub.n](a, b, -, d), and [D.sub.m,n] = [D.sub.m] X [D.sub.n] be the direct product automaton. If (m, n) [member of] {(4, 5), (5,4)}, we have verified computationally that the bounds are met. If (m,n) [??] {(4,5), (5,4)}, we can apply [2, Theorem 1]. Thus by the arguments used in the proof of Theorem 4, all states of [D.sub.m,n] are reachable.

Most of the distinguish ability arguments carry over as well. If H and V are the last row and column of states in [D.sub.m,n] respectively, and S is the set of states lying outside of H [union] V, we can use nearly identical arguments as in the proof of Theorem 4 to show that for [??] [member of]{[intersection], [direct sum], \ , [union]}, every state in S is distinguishable from every other state in [D.sub.m,n] with respect to H [??] V. It remains to count the number of states in H [union] V that are distinguishable with respect to H [??] V.

Intersection: Here the set of final states is H [intersection] V = {(m', n)}. Since (m', n) is the only final state, it is distinguishable from all other states. Any two states both in H (or both in V) are distinguished by words in a*d. Suppose m < n. Then [a.sup.m-1] sends (m', 1) to (m', m) and fixes (1', n). Words in b* can send (m', m) to (m', q) for 2 [??] q [??] n - 1, and they fix (1', n). For 2 [??] q [??] n - 1, (m', q) accepts [b.sup.n-1-q] d, while (1', n) remains fixed. Hence (m', q) is distinguishable from (1', n) for all q. For 2 [??] p [??] m - 1 and 2 [??] q [??] n - 1, (m', q) is distinguished from (p', n) because [a.sup.m-p] sends (p', n) to (1', n) and (m', q) to some state that is distinguishable from (1', n). Hence all pairs of states from H [union] V are distinguishable if m < n. A symmetric argument works for m > n. Thus all mn states are distinguishable.

Symmetric Difference, Difference, and Union: The arguments are similar to those used in the proof of Theorem 4.

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.

We list here each operation with the size of the smallest known alphabet (first entry) along with our alphabet size (second entry): reversal (2/2), star (2/2), product (2/3), union (2/3), intersection (2/3), symmetric difference (2/3), and difference (2/3).

As an example, consider the two binary witnesses for the product operation that are used in [8]: [MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII], where a, b : ((m - 1)' [right arrow] m')((m - 2)' [right arrow] (m - 1)') ... (1' [right arrow] 2'), and [D.sub.n] = ([Q.sub.n], {a,b}, [[delta].sub.n], 1, {n}), where a : (1, 2,..., n - 1), b : (n - 1 [right arrow] n)(n - 2 [right arrow] n - 1) ... (2 [right arrow] 3). Note that, although only two inputs are used, they induce three different transformations. Thus one can argue that these witnesses are not simpler than ours.

4 Left Ideals

The following stream of left ideals was defined in [15]:

Definition 4. For n [??] 4, let [D.sub.n] = [D.sub.n](a, b, c, d, e) = ([Q.sub.n], [summation], [[delta].sub.n], 1, {n}), where [summation] = {a, b, c, d, e}, and [[delta].sub.n] is defined by transformations a : (2,..., n), b : (2, 3), c : (n [right arrow] 2), d : (n [right arrow] 1), e : ([Q.sub.n] [right arrow] 2). Let [L.sub.n] = [L.sub.n](a, b, c, d, e) be the language accepted by [D.sub.n]. The structure of [D.sub.n](a, b, c, d, e) is shown in Figure 6.

This stream of languages is closely related to the stream of Figure 1. The DFA [D.sub.n](a, b, c, d, e) of Definition 4 is constructed by taking [D.sub.n-1] (a, b, c) of Figure 1 with states relabeled 2,..., n, adding a new state 1 and new inputs d : (n [right arrow] 1) and e : ([Q.sub.n] [right arrow] 2).

[FIGURE 6 OMITTED]

Theorem 6 (Left Ideals). For each n [??] 4, the DFA [V.sub.n](a, b, c, d, e) of Definition 4 is minimal and its language [L.sub.n](a, b, c, d, e) is a left ideal of complexity n. The stream ([L.sub.n](a, b, c, d, e) | n [??] 4) with dialect stream ([L.sub.n](a, b, e, d, c) | n [??] 4) is most complex in the class of regular left ideals. In particular, this stream meets all the complexity bounds listed below, which are maximal for left ideals. In several cases the bounds can be met with restricted alphabets, as shown below.

1. The syntactic semigroup of [L.sub.n](a, b, c, d, e) has cardinality [n.sup.n-1] + n - 1. Moreover, fewer than five inputs do not suffice to meet this bound.

2. All quotients of [L.sub.n](a, -, -, d, e) have complexity n.

3. [L.sub.n](a, -, c, d, e) has [2.sup.n-1] + 1 atoms.

4. For each atom A[.sub.S] of [L.sub.n](a, b, c, d, e), the complexity [kappa](A[.sub.S]) satisfies:

[MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII]

5. The reverse of [L.sub.n](a, -, c, d, e) has complexity[2.sup.n-1] + 1.

6. The star of [L.sub.n](a, -, -, -, e) has complexity n + 1.

7. The product [L.sub.m] (a, -, -, -, e) [L.sub.n](a, -, -, -, e) has complexity m + n - 1.

8. For any proper binary boolean function o, the complexity of [L.sub.m] (a, -, c, -, e) [??] [L.sub.n](a, -, e, -, c) is mn.

Proof: DFA [V.sub.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.sup.n-p] and no state q with 1 < q [not equal to] = p accepts this word. It was proved in [15] that [D.sub.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.sup.n-1] + n -1, and in [15] that the syntactic semigroup of [L.sub.n](a, b, c, d, e) has cardinality [n.sup.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.sub.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.sub.n](a, -, c, d, e) is [2.sup.n-1] + 1.

4. This was proved in [7].

5. See Item 3 above.

6. The argument is the same as for the star of right ideals.

7. See Theorem 7.

8. See Theorem 8.

4.1 Product

We now show that the complexity of the product of [D'.sub.m] (a, -, -, -, e) with [D.sub.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'.sub.m] and [D.sub.n] by omitting the final state of [D'.sub.m] and all the transitions from the final state, and redirecting all the transitions that go from a non-final state of [D'.sub.m] to the final state of [D'.sub.m] to the initial state of [D.sub.n]. It was proved in [8] that D accepts [L.sub.m] [L.sub.n]. The construction is illustrated in Figure 7 for m = 4 and n = 5.

[FIGURE 7 OMITTED]

Theorem 7 (Left Ideals: Product). For m, n [??] 4, the complexity of the product of [L.sub.m](a, -, -, -, e) and [L.sub.n](a, -, -, -, e) is m + n - 1.

Proof: By construction D has m + n - 1 states. It is also clear that the shortest word accepted by state 1' is e[a.sup.m-2]e[a.sup.n-2], whereas for a state p' with 2 [??] p [??] m - 1 it is [a.sup.m-p]e[a.sup.n-2], for state 1 it is e[a.sup.n-2], and for any state q with 2 [??] q [??] n it is [a.sup.n-q]. Hence all the states are distinguishable by their shortest words.

[FIGURE 8 OMITTED]

4.2 Boolean Operations

As pointed out earlier, two different languages have to be used to reach the maximal complexity for boolean operations. Let [D'.sub.m] = [D'.sub.m] (a, -, c, -, e), [D.sub.n] = [D.sub.n] (a, -, e, -, c), and [D.sub.m-n] = [D'.sub.m] X [D.sub.n]. Figure 8 shows DFAs [D'.sub.4](a, -, c, -, e) and [D.sub.5](a, -, e, -, c).

Theorem 8 (Left Ideals: Boolean Operations). If m, n [??] 4 and [??] is any proper binary boolean function, then the complexity of [L.sub.m] (a, -, c, -, e) [??] [L.sub.n](a, -, e, -, c) is mn.

Proof: Our first task is to show that all mn states of [D.sub.m,n] are reachable. State (1', 1) is the initial state. For q = 2,..., n, (1', q) is reachable by c[a.sup.q-2], and for p = 2,..., m, (p', 1) is reachable by e[a.sup.p-2]. Next, (p', 2) is reached from (p', 1) by c for p = 2,..., m -1, and (2', q) is reached from (1', q) by e for q = 2,..., n -1.

Let g = gcd(m - 1, n - 1) and l = lcm(m - 1, n - 1); then g [??] l = (m - 1)(n - 1). Note that a is a permutation on the set S = {(p', q) | 2 [??] p [??] m, 2 [??] q [??] n}. Since a is a cyclic permutation of order m - 1 on [Q'.sub.m] \ {1'}, and a is also a cyclic permutation of order n - 1 on [Q.sub.n] \ {1}, a is a permutation of order l = lcm(m - 1,n - 1) on S.

Let ([p'.sub.1], [q.sub.1]) and ([p'.sub.2], [q.sub.2]) be elements of S, suchthat [p.sub.1] - [q.sub.1] [equivalent to] [p.sub.2] - [q.sub.2] mod g. Then [p.sub.2] - [p.sub.1] [equivalent to] [q.sub.2] - [q.sub.1] mod g. Since m - 1 and [MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII] are coprime, by the Chinese Remainder Theorem the equivalences k [equivalent to] [p.sub.2] -[p.sub.1] mod (m - 1) and k [equivalent to] [g.sub.2] - [q.sub.1] mod [MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII] have a unique solution modulo [MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII] for k. Since k [equivalent to] [p.sub.2]-[p.sub.1] mod (m- 1), we have k [equivalent to] [p.sub.2] - [p.sub.1] [equivalent to] [q.sub.2] - [q.sub.1] mod g. Combined with k [equivalent to] [q.sub.2] - [q.sub.1] mod [MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII], this gives k [equivalent to] [q.sub.2] - [q.sub.1] mod (n - 1). Applying [a.sup.k] to ([p'.sub.1], [q.sub.1]), gives the state ([p'.sub.1] + k mod (m - 1), [q.sub.1] + k mod (n - 1)) = ([p'.sub.2], [q.sub.2]). So for every pair ([p'.sub.1], [q.sub.1]) and ([p'.sub.2], [q.sub.2]) such that [p.sub.1] - [q.sub.1] [equivalent to] [p.sub.2] - [q.sub.2] mod g, ([p'.sub.2], [q.sub.2]) is reachable from ([p'.sub.1], [q.sub.1]) by some number of a's.

If ([p'.sub.1], [q.sub.1]) [member of] S is reachable, all (p', q) [member of] S such that [p.sub.1] - [q.sub.1] [equivalent to] p - q mod g are also reachable. Since ([p'.sub.1], 2) is reachable for [p.sub.1] = 2,..., m - 1, all (p', q) [member of] S suchthat p - q [member of] {0, 1, 2,..., (m - 3) mod g} are reachable. Since (2', 3) is reachable, all (p', q) G S such that p - q [equivalent to] -1 [equivalent to] (m - 2) mod g are reachable. Since all remainders modulo g have at least one representative, all of S is reachable.

We prove distinguishability using a number of claims:

1. (2', 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.sup.m-1] ([a.sup.n-1]) acts as the identity on the set [Q'.sub.m] \ {1'} ([Q.sub.n] \ {1}). Hence [a.sup.lcm(m-1,n-1)] is the identity on [Q'.sub.m] \ {1} X [Q.sub.n] \ {1}, and x = [a.sup.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.sup.l] is applied, for any l [??] 0. Therefore applying x to (p', 2) leads to a state in Column n; so (2', 2) and (p', 2) are distinguishable by x.

(b) If the operation is union (difference), then (m', n - 1) is distinguishable from any other state in Column n - 1. Consider (2', 2) and (p', 2); applying ac results in (3', 2) and (r', 2), where r [not equal to] 3. Following this by [a.sup.1cm(m-1, n-1)-2] yields (m', n - 1) and (s', n - 1), where s [not equal to] m. Hence [aca.sup.1cm(m-1, n-1)-2] distinguishes (2', 2) from (p', 2).

2. (2', 2) is distinguishable from every other state in Row 2.

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.sup.1cm(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.sup.s] results in ([p'.sub.1], [q.sub.1]) and ([r'.sub.1], [q.sub.1]), where {[p.sub.1], [r.sub.1]} [not equal to] {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} [not equal to] {2, m}. Now c takes these states to ([p'.sub.1], 2) and ([r'.sub.1], 2), and [p.sub.1] [not equal to] [r.sub.1], since c can map two states of [Q'.sub.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 [not equal to] 2, or (2', q), q [not equal to] 2. There are several cases:

(a) If the states are in the same column or row, then the result holds by Claims 3 and 4. Hence assume they are not in the same column or row.

(b) If both states lie outside of Row m, then c takes both states to Column 2 but it takes each state to a different row. The result now follows by Claim 3.

(c) If both states lie outside of Column n, then e takes both states to Row 2 but it takes each state to a different column. The result now follows by Claim 4.

(d) If one of the states is (m', n), then a takes it to (2', 2). If Case (b) does not apply, the other state must have been taken to Row m. If Case (c) also does not apply, it must also have been taken to Column n. Thus the other state must have been taken to (m', n). Applying a again results in (2', 2) and (3', 3), and this reduces to Case (b).

(e) If the states are (m', n - 1) and ((m - 1)', n), then applying a2 results in (3', 2) and (2', 3), and Case (b) applies.

(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.

5 Two-Sided Ideals

The following stream of two-sided ideals was defined in [15]:

Definition 5. For n [??] 5, let [D.sub.n] = [D.sub.n](a, b, c, d, e, f) = ([Q.sub.n], [summation], [delta], 1, {n}), where [summation] = {a, b, c, d, e, f}, and [[delta].sub.n] is defined by the transformations a: (2, 3,..., n - 1), b: (2, 3), c: (n - 1 [right arrow] 2), d: (n - 1 [right arrow] 1), e: ([Q.sub.n-1] [right arrow] 2), and f: (2 [right arrow] n). The structure of [D.sub.n](a, b, c, d, e, f) is shown in Figure 9.

[FIGURE 9 OMITTED]

This stream of languages is closely related to the stream of Figure 1. The DFA [D.sub.n](a, b, c, d, e, f) of Definition 5 is constructed by taking [D.sub.n-2](a, b, c) of Figure 1 with states relabeled 2,..., n - 1, adding new states 1 and n, and new inputs d: (n - 1 [right arrow] 1), e: ([Q.sub.n-1] [right arrow] 2), and f: (2 [right arrow] n).

Theorem 9 (Two-Sided Ideals). For each n [??] 5, the DFA [D.sub.n] (a, b, c, d, e, f) of Definition 5 is minimal and its language [L.sub.n](a, b, c, d, e, f) is a two-sided ideal of complexity n. The stream ([L.sub.n](a, b, c, d, e, f) | n [??] 5) with dialect stream ([L.sub.n](b, a, c, d, e, f) | n [??] 5) is most complex in the class of regular two-sided ideals. In particular, this stream meets all the complexity bounds listed below, which are maximal for two-sided ideals. In several cases the bounds can be met with restricted alphabets, as shown below.

1. The syntactic semigroup of [L.sub.n](a, b, c, d, e, f) has cardinality [n.sup.n-2] + (n - 2)[2.sup.n-2] + 1. Moreover, fewer than six inputs do not suffice to meet this bound.

2. All quotients of [L.sub.n](a, -, -, d, e, f) have complexity n, except the quotient corresponding to state n, which has complexity 1.

3. [L.sub.n](a, - , - , d, e, f) has [2.sup.n-2] + 1 atoms.

4. For each atom [A.sub.S] of [L.sub.n](a, b, c, d, e, f), the complexity

[MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII]

5. The reverse of [L.sub.n](a, -, -, d, e, f) has complexity [2.sup.n-2] + 1.

6. The starof [L.sub.n](a, -, -, -, e, f) has complexity n + 1.

7. The product [L.sub.m] (a, -, -, -, e, f) [L.sub.n](a, -, -, -, e, f) has complexity m + n - 1.

8. For any proper binary boolean function o, the complexityof [L.sub.m](a, b, -, d, e, f) o [L.sub.n](b, a, -, d, e, f) is maximal. In particular,

(a) [L.sub.m] (a, b, -, d, e, f) [intersection] [L.sub.n](b, a, -, d, e, f) has complexity mn, as does [L.sub.m] (a, b, -, d, e, f) [direct sum] [L.sub.n](b, a, -, d, e, f).

(b) [L.sub.m] (a, b, -, d, e, f) \ [L.sub.n](b, a, -, d, e, f) has complexity mn - (m - 1).

(c) [L.sub.m] (a, b, -, d, e, f) [union] [L.sub.n](b, a, -, d, e, f) has complexity mn - (m + n - 2).

(d) If m [not equal to] n, the bounds are met by [L.sub.m](a, b, -, d, e, f) and [L.sub.n](a, b, -, d, e, f).

Proof: Notice that inputs a, e and f are needed to make all the states reachable. It was proved in [15] that [D.sub.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.sup.n-2] + (n - 2)[2.sup.n-2] + 1, and in [15] that the syntactic semigroup of [L.sub.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.

2. This follows from Definition 5.

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.sub.n](a, -, -, d, e, f) is [2.sup.n-2] + 1.

4. This was proved in [7].

5. See Item 3 above.

6. The argument is the same as for the star of right ideals.

7. See Theorem 10.

8. See Theorems 11 and 12.

5.1 Product

We show that the complexity of the product of the DFA [D'.sub.m] (a, -, -, -, e, f) with [D.sub.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.

Theorem 10 (Two-Sided Ideals: Product). For m,n [??] 5, the product of the language [L.sub.m](a, -, -, -,e,f) with [L.sub.n](a, -, -, -, e, f) has complexity m + n - 1.

Proof: By construction D has m + n - 1 states. We know that all the states in [D'.sub.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'.sub.m] \ {m'}. Also, all pairs of distinct states in [D.sub.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.

[FIGURE 10 OMITTED]

5.2 Boolean Operations

Theorem 11 (Two-Sided Ideals: Boolean Operations). If m, n [??] 5, then

1. The complexity of [L.sub.m](a, b, -, d, e, f) [intersection] [L.sub.n](b, a, -, d, e, f) is mn.

2. The complexity of [L.sub.m](a, b, -, d, e, f) [direct sum] [L.sub.n](b, a, -, d, e, f) is mn.

3. The complexity of [L.sub.m](a, b, -, d, e, f) \ [L.sub.n](b, a, -, d, e, f) is mn - (m - 1).

4. The complexity of [L.sub.m](a, b, -, d, e, f) [union] [L.sub.n](b, a, -, d, e, f) is mn - (m + n - 2).

Proof: As before, we take the direct product DFA [D.sub.m-n] = [D'.sub.m] (a, b, -, d, e, f) X [D.sub.n](b, a, -, d, e, f) and count reachable and distinguishable states. First we prove all states are reachable, as illustrated in Figure 11. State (1', 1) is the initial state, and (2', 2) is reached from (1', 1) by e. Since {a, b} generates all permutations of [Q'.sub.m]\{1', m'} and [Q.sub.n]\{1, n}, by [2, Theorem 1] all states in ([Q'.sub.m]\{1', m'}) X ([Q.sub.n]\{1, n}) are reachable, unless (m - 2, n - 2) [member of] {(2, 2), (3, 4), (4, 3), (4, 4)}; the case (2, 2) does not occur since m, n [??] 5, and we have verified the other special cases computationally. Thus it remains to show that all states in Rows 1 and m and Columns 1 and n are reachable.

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). 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.

[FIGURE 11 OMITTED]

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.sup.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.sup.m-r] f sends (r', s) to Row m, and it sends (p', q) to the same row as [a.sup.m-r].

3. If r < m, then [a.sup.m-r] [f.sup.m-r] = [a.sup.m-r] f sends (r', s) to Row m, and (p', q) to a row other than Row m. If r = m, then [a.sup.m-r] [f.sup.m-r] = [epsilon], the state (r', s) = (m', s) is in Row m, and the state (p', q) is not in Row m.

Thus the word [a.sup.m-r] [f.sup.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.sup.n-s][f.sup.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 [member of] [Q.sub.n], are distinguishable by first applying [a.sup.m-r] [f.sup.m-r]. This sends one of the states to Row m, and the other to a different row. We then apply e[a.sup.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.sup.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).

(b) States in distinct columns, q < s [??] n: The argument is symmetric if we interchange a and b. Since all states are distinguishable, the complexity is mn.

2. 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.sup.n-s][f.sup.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 e[b.sup.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.sup.m-r][f.sup.m-r] unless this word sends (r', s) to (m', n). This occurs only if r < m and [a.sup.m-r] sends (r', s) to (2', 2). In this case, applying [b.sup.2] after [a.sup.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.

(d) States in distinct columns: The arrangement of final and non-final states in Row m matches that of symmetric difference. Thus the argument used for intersection/symmetric difference applies here also.

Since all states in [Q'.sub.m] x ([Q.sub.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 [summation]*. 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.sup.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.sup.m-r] sends (p', q) to Column 2. In this case we can use [a.sup.m-r] [b.sup.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 [not equal to] n, the complexity bounds for boolean operations can be met by using languages from the stream ([L.sub.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.sub.n](b, a, - , d, e, f) | n [??] 5).

Theorem 12 (Two-Sided Ideals: Boolean Operations, m = n). Suppose m, n [??] 5 and m [not equal to] n.

1. The complexity of [L.sub.m](a, b, -, d, e, f) [intersection] [L.sub.n](a, b, -, d, e, f) is mn.

2. The complexity of [L.sub.m](a, b, -, d, e, f) [direct sum] [L.sub.n](a, b, -, d, e, f) is mn.

3. The complexity of [L.sub.m](a, b, -, d, e, f) \ [L.sub.n](a, b, -, d, e, f) is mn - (m - 1).

4. The complexity of [L.sub.m](a, b, -, d, e, f) [union] [L.sub.n](a, b, -, d, e, f) is mn - (m + n - 2).

Proof: Here we consider the DFA [D.sub.m-n] = [D'.sub.m] (a, b, -, d, e, f) X [D.sub.n] (a, b, -, d, e, f). 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) [member of] {(3, 4), (4, 3)}, since we are assuming m [not equal to] n. Also, for states (p', q) and (r', s) with p < r, the same remark about the word [a.sup.m-r][f.sup.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.sup.n-s][f.sup.n-s] sends (r', s) to Column n and (p', q) to a different column (previously we used [b.sup.n-s][f.sup.n-s] for this purpose).

For each boolean operation we now prove that the number of distinguishable states meets the relevant upper bound.

1. Intersection/Symmetric Difference. As before, the same distinguishing words can be used for intersection and symmetric difference.

(a) States in Column n: States (p', n) and (r', n), with p < r [??] m, are distinguishable by [a.sup.m-r] [f.sup.m-r].

(b) States (2', 2) and (m', 2) are distinguishable as follows. Since all states in ([Q'.sub.m] \ {1', m'}) X ([Q.sub.n] \ {1, n}) are reachable from (2', 2) using words in {a, b}*, there is a word w [member of] {a, b}* which sends (2', 2) to (3', 2). If we view w as a permutation on [Q.sub.n] \ {1, n} alone, it must fix 2. Thus w sends (m', 2) to (m', 2). Then (3', 2) and (m', 2) are distinguished by f.

(c) States in Column q < n: States (p', q) and (r', q), with p < r [??] m, are distinguishable since the word [a.sup.m-r][f.sup.m-r] e reduces this case to Case (a) or (b).

(d) By symmetry, states in the same row are distinguishable.

(e) States in distinct columns: (p', q) and (r', s), q < s [??] n, are distinguishable by first applying [a.sup.n-s][f.sup.n-s] e. This sends (p', q) to some state in Column 2 and (r', s) to some state in Column n. If these successor states are in the same row, then this case reduces to Case (d). Otherwise, since e was applied, the only possible states are (2', 2) and (m', n), or (2', n) and (m', 2). In either case, these states are distinguished by [a.sup.min(m, n)-2]f.

(f) By symmetry, states in distinct rows are distinguishable.

Since all states are distinguishable, the complexity of intersection is mn.

2. Difference. States in Column n are empty and thus indistinguishable.

(a) States in distinct columns, and one state is in Column n: All states (p', q), q < n are non-empty, and thus distinguishable from those in Column n. To see this, observe that if p = m, then (p', q) is a final state and thus is non-empty. If p < m then e sends (p', q) to (2', 2). Since every state in ([Q'.sub.m] \ {1', m'}) X ([Q.sub.n] \ {1, n}) is reachable from (2', 2), there is a word w [member of] {a, b}* that sends (2', 2) to (2', 3). Then f sends (2', 3) to the final state (m', 3).

(b) States in distinct columns, and neither state is in Column n: States (p', q) and (r', s), with q < s < n are distinguishable since applying [a.sup.n-s] f reduces this case to Case (a).

(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 not both equal to n, are distinguishable by [a.sup.m-r][f.sup.m-r], unless this word sends (r', s) to (m', n). This occurs only if r < m and [a.sup.m-r] sends (r', s) to (2', 2). Recall that [a.sup.m-r] sends (r', s) to Row 2, and sends (p', q) to a row other than Row 2 or Row m; so suppose that after applying [a.sup.m-r] the states are (2', 2) and (i', k) for some i [??] {2, m}. There is a word w [member of] {a, b}* which sends (2', 2) to (2', 3). If we view w as a permutation on [Q'.sub.m] {1', m'}, it sends 2' to 2', so it sends i' to some j' [??] {2', m'}. So w sends (2', 2) and (i', k) to (2', 3) and (j', [??]) respectively; since j' [??] {2', m'} these states are distinguished by f.

Since ([Q'.sub.m] X ([Q.sub.n] \ {n})) [union] {(m', n)} is a maximal distinguishable set, the complexity of set difference is m(n - 1) + 1 = mn - (m - 1).

3. Union. All final states are indistinguishable, since they all accept [summation]*.

(a) Non-final states in the same row: Consider states (p', q) and (p', s) with p < m and q < s < n. The word [a.sup.n-s] takes these to (r', q + n - s) or (r', 1), and (r', 2) respectively for some r; note that in either case (p', q) does not get mapped to Column 2. Hence the two states are sent to (r', i) where i [not equal to] 2 and (r', 2), respectively. If r [not equal to] 2, then these states are distinguished by f. If r = 2, there exists a word w [member of] {a, b}* which maps (r', 2) = (2', 2) to (3', 2). We can view w as a permutation on [Q.sub.n] which fixes 1 and n; it sends 2 to 2 and sends i to some j [not equal to] 2, since it is bijective. Hence the other state (r', i) is sent to (3', j) for some j [not equal to] 2. Then (3', 2) and (3', j) are distinguished by f.

(b) Non-final states in the same column: These are distinguishable by a symmetric argument.

(c) Non-final states in distinct columns: Non-final states (p', q) and (r', s), with p, r < m and q < s < n, are distinguishable by [a.sup.n-s]f, unless this word sends (p', q) to Row m (since it also sends (r', s) to Column n). This occurs only if [a.sub.n-s] sends (p', q) to Row 2. Note that [a.sub.n-s] sends (r', s) to Column 2; so after applying [a.sup.n-s] the states are (i', 2) and (2', j) for some i and j. By (a) and (b), we can assume i, j [not equal to] 2. Then [a.sup.mm(m, n)-2]f distinguishes the states.

(d) Non-final states in distinct rows: A symmetric argument works.

Since all non-final states are distinguishable and all final states are indistinguishable, the complexity of union is (m - 1)(n - 1) + 1 = mn - (m + n - 1).

Remark 3. For regular two-sided ideals, the minimal alphabet required to meet all the bounds has six letters. As before, it is possible to reduce the alphabet for some operations [8]. The sizes are as follows: reversal (3/4), star (2/3), product (1/3), union (2/5), intersection (2/5), symmetric difference (2/5), and difference (2/5).

6 Conclusions

In the case of regular right, left, and two-sided ideals, we have demonstrated that there exist single witness streams that meet the bounds for all of our complexity measures, and that the only dialects required are those in which two letters are interchanged; this is needed in the case where the bounds for boolean operations are to be met with witnesses of the same complexity.

References

[1] Aho, A., Corasick, M.J.: Efficient string matching: An aid to bibliographic search. Communications of the ACM 18(6), 333-340 (1975)

[2] Bell, J., Brzozowski, J., Moreira, N., Reis, R.: Symmetric groups and quotient complexity of boolean operations. In: Esparza, J., et al. (eds.) ICALP 2014. LNCS, vol. 8573, pp. 1-12. Springer (2014)

[3] Brzozowski, J.: Quotient complexity of regular languages. J. Autom. Lang. Comb. 15(1/2), 71-89 (2010)

[4] Brzozowski, J.: In search of the most complex regular languages. Int. J. Found. Comput. Sci., 24(6), 691-708 (2013)

[5] Brzozowski, J.: Unrestricted state complexity of binary operations on regular languages. In: Campeanu, C., Manea, F., Shallit, J. (eds.) DCFS 2016. LNCS, vol. 9777, pp. 60-72. Springer (2016)

[6] Brzozowski, J., Davies, G.: Most complex regular right ideals. In: Jurgensen, H., Karhumaki, J., Okhotin, A. (eds.) DCFS 2014. LNCS, vol. 8614, pp. 90-101. Springer (2014)

[7] Brzozowski, J., Davies, S.: Quotient complexities of atoms in regular ideal languages. Acta Cybernetica 22(2), 293-311 (2015)

[8] Brzozowski, J., Jiraskova, G., Li, B.: Quotient complexity of ideal languages. Theoret. Comput. Sci. 470, 36-52 (2013)

[9] Brzozowski, J., Sinnamon, C.: Unrestricted state complexity of binary operations on regular and ideal languages (2016), http://arxiv.org/abs/1609.04439

[10] Brzozowski, J., Szykula, M.: Upper bounds on syntactic complexity of left and two-sided ideals. In: Shur, A.M., Volkov, M.V (eds.) DLT 2014. LNCS, vol. 8633, pp. 13-24. Springer (2014)

[11] Brzozowski, J., Szykula, M.: Complexity of suffix-free regular languages. In: Kosowski, A., Walukiewicz, I. (eds.) FCT 2015. LNCS, vol. 9210, pp. 146-159. Springer (2015)

[12] Brzozowski, J., Szykula, M., Ye, Y.: Syntactic complexity of regular ideals (September 2015), http://arxiv.org/abs/1509.06032

[13] Brzozowski, J., Tamm, H.: Quotient complexities of atoms of regular languages. Int. J. Found. Comput. Sci. 24(7), 1009-1027 (2013)

[14] Brzozowski, J., Tamm, H.: Theory of atomata. Theoret. Comput. Sci. 539, 13-27 (2014)

[15] Brzozowski, J., Ye, Y.: Syntactic complexity of ideal and closed languages. In: Mauri, G., Leporati, A. (eds.) DLT 2011. LNCS, vol. 6795, pp. 117-128. Springer Berlin/Heidelberg (2011)

[16] Crochemore, M., Hancart, C.: Automata for pattern matching. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, vol. 2, pp. 399-462. Springer (1997)

[17] Crochemore, M., Hancart, C., Lecroq, T.: Algorithms on Strings. Cambridge University Press (2007), 392 pages

[18] Holzer, M., Konig, B.: On deterministic finite automata and syntactic monoid size. Theoret. Comput. Sci. 327(3), 319-347 (2004)

[19] Ivan, S.: Complexity of atoms, combinatorially. Inform. Process. Lett. 116(5), 356-360 (2016)

[20] Myhill, J. : Finite automata and representation of events. Wright Air Development Center Technical Report 57-624 (1957)

[21] Nerode, A.: Linear automaton transformations. Proc. Amer. Math. Soc. 9, 541-544 (1958)

[22] Piccard, S.: Sur les bases du groupe symetrique. Casopis pro pestovani matematiky a fysiky 68(1), 15-30 (1939)

[23] Pin, J.E.: Syntactic semigroups. In: Handbook of Formal Languages, vol. 1: Word, Language, Grammar, pp. 679-746. Springer, New York, NY, USA (1997)

[24] Yu, F., Chen, Z., Diao, Y., Lakshman, T.V., Katz, R.H.: Fast and memory-efficient regular expression matching for deep packet inspection. In: Proceedings of the 2006 ACM/IEEE Symposium on Architecture for Networking and Communications Systems (ANCS). pp. 93-102. ACM, New York (2006)

[25] Yu, S.: State complexity of regular languages. J. Autom. Lang. Comb. 6, 221-234 (2001)

Janusz Brzozowski (1*)

Sylvie Davies (2)

Bo Yang Victor Liu

(1) David R. Cheriton School of Computer Science, University of Waterloo

(2) Department of Pure Mathematics, University of Waterloo

received [3.sup.rd]Dec. 2015, revised [4.sup.th] Oct. 2016, accepted [11.sup.th] Oct. 2016.

(*) This work was supported by the Natural Sciences and Engineering Research Council of Canada under grant No. OGP0000871.