1. Introduction
In algebraic theory of formal languages, there are two common methods to cluster languages. One is constructing algebra structure for a given class of languages, the other is collecting languages that satisfy a property with respect to a binary relation over the free monoid (generated by a finite alphabet ). This paper aims at constructing an algebra structure for a class of languages that is defined by a partial order. Furthermore, we characterize the algebra structure as a model of a free object for a variety.
It is noted that algebraic and combinatorial properties of languages and words play a role in both clustering methods mentioned above. This is the case for the regular languages which can be defined by regular expressions. Let
denote the class of regular languages over
and let ∪, ∘ and
denote the well-known regular operations, i.e., set union, catenation and Kleene closure, respectively. It can be obtained from the combinatorial properties of regular languages that
is closed under all these operations. Hence,
forms an algebra structure [
1], which contains all the regular expressions as its elements. This algebra has been widely applied in theoretical computer and information science. Another example is the semiring of finite languages. Let
denote the class of all finite languages over
. It easy to see that
is closed under the operations ∪ and ∘, and so
forms an algebra structure. However, language classes are not always closed under regular operations.
On the other hand, a partial order seems a more convenient tool for defining a language. Generally, for a given partial order ≤ over , three types of language might be proposed. A language is said to be convex with respect to ≤, if for any with , the inequalities and always imply that , where . Further, L is said to be closed with respect to ≤, if and imply that . Furthermore, L is said to be free with respect to ≤, if it is an independent set with respect to ≤.
Many convex and free languages with respect to various binary relations were introduced by G. Thierrin, M. Ito and their co-researchers, and further studied by T. Ang and J. Brzozowski. They established the algebraic properties, combinatorial structures and decision algorithms of these three types of languages with respect to prefix relation, suffix relation, outfix relation, infix relation, factor relation, subword relation and so on. We refer the reader to [
2,
3,
4,
5] for details. In particular, a
hypercode is a free language with respect to the embedding order (also known as a subword relation) also studied by L. Haines in [
6]. Here, an
embedding order, denoted by
, is a partial order over
defined by: for any
,
if and only if
and
, where
n is a positive integer and
,
. A language
L is a hypercode means that for any
,
.
Since the definition of embedding order explicates directly the combination characterization of words involved in it, the combinatorial properties of hypercodes are almost certain to relate to them. L. Haines proved that every hypercode was finite. H. Shyr and G. Thierrin [
3] proved that the class of all hypercodes over
, denoted by
, was closed under the regular operation ∘. Further, Z. Wang et al. defined in [
7] a binary operation
in
by picking out the minimal elements (in the sense of
) from the union
of
. It was shown that
was closed under
and hence
formed an algebra structure.
Moreover, to construct an algebra structure for a language class also makes some sense in the effort to find a model of a free object for a variety. The well-known examples are structures of free semigroups and free commutative (noncommutative) algebras. The operation rules in these structures reflect the combinatorial properties among words and commutative (noncommutative) polynomials, which represent, respectively, the combinatorial properties of elements in a semigroup and commutative (noncommutative) algebra. When it comes to an algebra structure of a class of languages, if its operation rules reflect (or are defined by) the combinatorial characterizations of languages, then this structure has a probability to be a model of a free object for a variety, just as a free semigroup does.
By an
additively idempotent semiring (ai-semiring for short) we mean a semiring whose additive reduct is a semilattice, i.e., a commutative idempotent semigroup. The variety of all ai-semirings is denoted by
. M. Kuřil and L. Polák initiated the studies in the field of constructing a model of a free object for an ai-semiring variety by an algebra structure of a class of languages. In [
8], they proved that the structure
was freely generated by
in the variety
. We refer the reader to [
9] for more detail on subvarieties of semilattice ordered algebras.
In addition, the algebra
was also characterized as a model of a free object for an ai-semiring variety satisfying the additional identities
and
(see [
7] for details). Undoubtedly, these two identities (named absorption laws) reflect some special combinatorial properties of hypercodes, which are derived from the embedding order.
Further, more ai-semiring varieties with absorption laws as additional identities were studied in [
10]. The authors established combinatorial properties of three classes of languages containing hypercodes and constructed algebra structures for these classes, respectively. All these three structures were proved to be models of free objects for ai-semiring varieties satisfying
,
and
, respectively. For literature on studying ai-semiring varieties by establishing combinatorial properties of words, we refer the reader to [
11,
12,
13,
14,
15,
16,
17].
Following the study in [
10], this paper focuses on ai-semiring varieties with absorption laws as additional identities. We define a class of so-called prefix-strict languages, denoted by
, and recall some notions in
Section 2 as preliminary. In
Section 3, we study a subset of the embedding order, which might be proved a partial order, say
. It is shown that the class of free languages with respect to
coincides with the class
. Further, we establish in
Section 4 some combinatorial properties for languages in
, which are used to verify the operation properties of the algebra structure construct for
. In
Section 5, the class
is characterized as a universe of an ai-semiring, which is freely generated by
in the variety with additional identities
and
. Moreover, some parallel concepts and results are introduced in this paper, simultaneously.
2. Preliminaries
Let be a nonempty finite alphabet and the set of all finite words. Denote the empty word by and let . Given two words , we say u is a prefix (suffix) of v, if there exists such that (). Furthermore, u is an infix of v, if for some . Clearly, a prefix or a suffix is also an infix.
Let . u is called a subword of v, if . Further, if and , then u is a proper subword of v. Furthermore, u is said to be a factor of v, if there exist such that . Thus, a prefix (suffix) or an infix of a word v must be its subword and factor as well.
Suppose that u is a subword of v. The following example shows that u, as a string of letters, may be embedded letter by letter into a word for obtaining v in different ways.
Example 1. Let and be two words in . It is easy to see that is a prefix (suffix) and an infix of v. Now, if we consider as , where and , then we get another case to show that u is a subword of v.
We concern ourselves with the case that being a prefix (infix) is the unique way to show that u is a subword v. Formally, we have the following definition.
Definition 1. Let . For any and any , if , together with , always implies that (, , respectively), then u is called a strict prefix (strict suffix, strict infix, respectively) of v. In particular, if and there is only one occurrence of u in the word v, then u is also a strict infix of v.
By this definition, we know that the word in Example 1 is neither a strict prefix (strict suffix) nor a strict infix of v. Furthermore, it is easy to see that a strict prefix (strict suffix) must be a strict infix. The following two propositions give necessary and sufficient conditions for a prefix and infix to be strict, respectively.
Proposition 1. Let and be two words in , where and . Then, u is a strict prefix of v if and only if there is no occurrence of σ in the word z.
Proof. From the assumptions and , we know that u is a prefix of v.
Suppose that u is a strict prefix of v. Assume that is a factor of z. Then, for some . Thus, the equality holds. If we write as , where and , then , a contradiction. Therefore, is not a factor of z, as required.
Conversely, suppose that there is no occurrence of
in the word
z. Note that
u is a subword of
v, since
u is a prefix of
v. Given
and
, if both
and
hold, then there exists
such that
since
is the right-most letter of
u. This means that
. In the following, we show that
is not a factor of
. In fact, if assume that if
is a factor of
, then there exists
such that
. Hence, we have that
. It follows that
. Therefore,
and so
. Since
, we also have
, a contradiction.
Now, we know that there is no occurrence of in the . Then, we have that and so . This implies that . Therefore, u is a strict prefix of v, as required. □
In an analogue fashion, we can verify the following proposition and we omit the proof.
Proposition 2. Let and be two words in , where , . Then, u is a strict infix of v if and only if there is no occurrence of θ in y and there is no occurrence of σ in z.
Definition 2. A language is said to be prefix-strict (suffix-strict, infix-strict, respectively) if and only if for any , implies that u is a strict prefix (strict suffix, strict infix, respectively) of v. The class of all prefix-strict, suffix-strict and infix-strict languages in are denoted by , and , respectively.
Let be a word with , . Then, n is called the length of w and is denoted by . Suppose that L is prefix-strict and that with . Then, we know from Definition 2 that either u is a strict prefix of v or . Hence, we have that a free language with respect to must be a strict prefix. This means that . Similarly, we can get that and .
Example 2. Let . Suppose that , . Then, . It is easy to see that A is prefix-strict and infix-strict but is not suffix-strict. B is prefix-strict (suffix-strict) and infix-strict, since . C is neither prefix-strict (suffix-stric) nor infix-strict, since is neither a strict prefix (strict suffix) nor a strict infix of , even if it is a subword.
Now, recall the three subsets of the embedding order introduced in [
10]. For any
,
(
) if and only if there exist some
and
such that
and
(
). In addition,
if and only if there exist some
and
such that
and
.
All these binary relations prove to be partial orders over . They show different manners to embed some string of words into the word u for obtaining v. Denote the class of all free languages with respect to , and by , and , respectively. It is true that , for all .
In the following, we recall the formal definitions of notions mentioned in the introduction section.
By a semiring, we mean an algebra such that:
The additive reduct is a commutative semigroup;
The multiplicative reduct is a semigroup;
satisfies the identities and .
A semiring
is called an
ai-semiring, if it satisfies the identity
. An algebra
is called a
-
type algebra if there are two binary operations involved in this algebra. In this manner, the additive reduct
of
is a
-type algebra. For the formal definition of a type of an algebra and more examples, we refer the reader to Definition 1.2 in [
18].
By a variety, we mean a class of algebras of the same type that is closed under subalgebras, homomorphic images and direct products. It is well known (Birkhoff’s theorem) that a class of algebras of the same type is a variety if and only if it is an equational class, i.e., a class of algebras that satisfies all the members in a given set of identities.
An ai-semiring identity over
is an expression of the form
, where
. For the free object
in
, we write + as ∪ and write
as the ai-semiring identity
, for convenience. We give an example in the following to show that a variety is an equational class.
Example 3. Given a set of identitiesSince all ai-semirings satisfy the identities in E, the varietyis an equational class. Furthermore, we denote an ai-semiring variety satisfying the additional identities , by , where and n is a positive integer. Then, is an equational class defined by the set , where E is the set of identities given by Example 2.
Let
be an algebra variety of type
and let
be an algebra of type
which is generated by
. If for every
and for every map
there is a unique homomorphism
which extends
(i.e.,
for
), then
is said to be
a free object in
generated by
(or
is freely generated by
in
). For more details on free algebra, we refer the reader to [
18].
In this paper, we take the following steps to show an algebra structure to be a model of a free object for an ai-semiring variety. Firstly, we verify that this algebra structure is a member of the given variety. Secondly, we prove that it is a free object in the variety.
In the sequel, and w are words in , unless otherwise specified.
3. Partial Orders
In this section, we shall characterize the class as a independent set of a certain partial order, namely, to show that languages in are free with respect to a partial order. Similar results for and are obtained. Furthermore, we study the inclusion relations among those classes of languages we mentioned in the last section.
Definition 3. Let be a binary relation over . For any , if and only if there exist and such that and and such that the implication holds as well.
It is easy to see that . The following example shows that the implication in the definition of may not always hold for every finite sequence to state , even if .
Example 4. Let . Suppose that , and . By the definition of , we have that but . Further, assume that . Then, , since we can set , where and . From this, we deduce that the implication holds. However, if we write as , where and , then the implication is not true.
Similar to the definition of , we have:
Definition 4. Let be a binary relation over . For any , if and only if there exist and such that and and such that the implication holds as well.
Let u be a proper subword of v. In the following, we present a necessary and sufficient condition for to hold.
Assume that and . Then, there must exist and such that and and scuh that . In fact, if , we know from the implication in Definition 1 that . This yields , a contradiction.
Conversely, assume that and for some and , where . In this case, the implication in Definition 1 holds. We thus have that u is a proper subword of v, since .
Summarizing the above discussion with a similar condition for to hold, we give the following remark to interpret the relations and in detail.
Remark 1. Let u be a proper subword of v. Then, () if and only if and for some and , where ().
Let u be a proper subword of v. Suppose now that u is a strict prefix of v. Then, for any and , together with implies that . This means that .
For any two words u and v, the following proposition gives the necessary and sufficient condition for to hold, which may be used handily.
Proposition 3. Let and be two words in , where , and there is no occurrence of σ in the word z. Then, if and only if either x is a proper subword of y or .
Proof. Suppose that and so . Since there is no occurrence of in the word z, we get that . If x is not a proper subword of y, then . This deduce that and that . By Proposition 1, we get that is a strict prefix of . Thus, we know from the discussion in Remark 1 that and hence .
Conversely, is it a trivial that implies . Suppose now that x is a proper subword of y. Then, there exist some and such that and , where . By Remark 1, , as required. □
In the following, we shall prove that and are partial orders. By Definition 4, and are reflexive. Furthermore, it is a routine matter to verify that they are antisymmetric. Then, we have proved part of the following theorem.
Theorem 1. Both and are partial orders.
Proof. We only need to prove that and are transitive.
Assume that and . If or , it is easy to see that . Otherwise, u is a proper subword of v and v is a proper subword of w. Thus, u is a proper subword of w. Suppose now that and , where , and there is no occurrence of in the word z. By Proposition 3, x is a proper subword of y. Furthermore, there must exist such that (since is a factor of v an so a factor of w), where there is no occurrence of in c. Associate this fact with the truth , we can verify as a matter of routine. Hence, we get that x is a proper subword of b. Therefore, we know from Proposition 3 that and so is transitive, as required.
A similar result is also true for and we omit the proof. □
Definition 5. Let be a binary relation over . For any , if and only if there exist and such that and and that the implication holds as well. In particular, if , then if only if .
The following example shows that the implication in Definition 5 may not always hold for every finite sequence to state , even if .
Example 5. Let . Suppose that , and . By the definition of , we have that but . Further, assume that . Then, , since we can set , where , and . Thus, we deduce that the implication holds. However, if we write as , where , and , then the implication is not true.
Similar to Remark 1, the following remark give a further specification for Definition 5.
Remark 2. Let u (with ) be a proper subword of v. Then, if and only if and for some and , where .
Let u be a proper subword of v. Suppose now that u is a strict infix of v. Then, for any and , together with implies that . This means that .
From Remarks 1 and 2, we have and .
We give a necessary and sufficient condition for to hold. Since the proof process is similar to Proposition 3, we omit the proof.
Proposition 4. Let and , where , and there is no occurrence of θ and σ in the words x and z, respectively. Then, if and only if either a is a proper subword of y or .
Using this proposition, we can prove the following theorem.
Theorem 2. is a partial order.
Proof. It is a routine matter to verify that is reflexive and antisymmetric. Now, we show that it is also transitive.
Assume that and . If or , it is easy to see that . Otherwise, u is a proper subword of v and v is a proper subword of w. Thus, u is a proper subword of w.
Suppose now that and , where , and there are no occurrences of and in the words x and z, respectively. By Proposition 4, a is a proper subword of y. Furthermore, there must exist such that (since both and are factors of v and so are factors of w), where there are no occurrences of and in the words b and d, respectively. Associate this fact with the truth , we deduce that . Hence, we get that a is a proper subword of c. Therefore, we know from Proposition 4 that and so is transitive. Then, we obtain that is a partial order, as required. □
Recall that the classes , and are collections of all prefix-strict, suffix-strict and infix-strict languages in , respectively. In the following, we show that for any , is exactly the collection of all free languages with respect to the partial order .
Proposition 5. and are the classes of all free languages with respect to and , respectively.
Proof. Let be a prefix-strict language and be distinct words in L. On one hand, if u and v are incomparable under the relation , they are also incomparable under . On the other hand, we suppose that u is a proper subword of v. Then, u is a strict prefix of v. By Remark 1, and hence L is a free language with respect to .
Conversely, let L be a free language with respect to and . Suppose that . For any and , if and , then it is true that (in fact, if , we get that , contradict to the assumption) and it follows that u is a strict prefix of v. Therefore, L is prefix-strict.
We can prove that is the class of all free languages with respect to in a similar way. Therefore, the proof is omitted. □
Proposition 6. is the class of all free languages with respect to ,
Proof. Let be an infix-strict language and be distinct words in L. If , then . Otherwise, assume that u is a proper subword of v. Then, u is a strict infix of v. By Remark 2, . Therefore, L is a free language with respect to .
Conversely, let L be a free language with respect to and be two distinct words in L. For any and any , if and , then it is true that and it follows that u is a strict infix of v. Therefore, L is infix-strict. □
Recall that a binary relation
on
is said to be
strict ([
4]) if for all
,
- (1)
;
- (2)
;
- (3)
.
It is can be easily verified that for any , is strict. Based on the following lemma, we can figure out the inclusion relation about all these strict relations.
Lemma 1 ([
4]).
Let be two strict binary relations on and and be the classes of all independent sets with respect to and , respectively. Then, if and only if . Since
for any
, we know form Lemma 1 that
Furthermore, it is routine to verify that
,
and
. We then have that
In addition, it is shown in [
10] that
where
. We illustrate all above inclusion relations by
Figure 1.
Since it was proved in [
10] that every language in
is finite, we get that any language in
is also finite.
4. Combinatorial Properties
In this section, we study the combinatorial properties of languages we defined in the last section. Let
be languages of
. We write
to mean
Shyr and Thierrin [
3] proved that the class of
was closed under the operation ∘ and Ito et al. [
2] showed a similar result for the class of outfix-free languages. However, for two prefix-strict (suffix-strict, infix-strict, respectively) languages
A and
B,
does not need to be prefix-strict (suffix-strict, infix-strict, respectively), as the following example shows.
Example 6. Let . Suppose that , . Then, . It is easy to see that A and B are prefix-strict, but is not prefix-strict, since .
Next, we give a necessary and sufficient condition for to be closed under the operation ∘, where .
Proposition 7. Let . Then, if and only if .
Proof. Let . Then, for any with , we have that either or a is a strict prefix of .
Assume that . Then, it is a truth that a is not a strict prefix of . In fact, if for some , then for any , we have that . Since , we get , a contradiction. This shows that and hence .
Conversely, assume that and . Given . Suppose that u is a subword of v. Then, and for some and . Now, we prove that u is a strict prefix of v.
Let
i and
j be two integers such that
and
It is true that
. In fact, if
, then we have from the fact
that
Both of these two cases contradict to
. Furthermore, we have
. In fact, if
, then we have that
which contradicts
. Hence, we have
. It follows that
(or
) and that
(or
). This implies that
u is a strict prefix of
v. Therefore,
. □
By a similar method, one can verify the following proposition.
Proposition 8. Let . Then, if and only if .
Proposition 9. Let . Then, if and only if and .
Proof. Let
. Suppose that
. If we assume that there exist
such that
, then there exist
and
such that
and
with
. It follows that
for any
, which is a contradiction with
. Hence, we deduce that
. In a similar way, we can prove that
.
Conversely, assume that and . Given . Suppose that u is a subword of v. Then, and for some and . Now, we prove that u is a strict infix of v.
Let
i and
j be two integers such that
and
It is true that
. In fact, if
, then we have from the fact
that
Both of these two cases contradict
. Furthermore, we have
. In fact, if
, then we have that
which contradicts to
. Hence, we have
. If follows that
and
(or
) are elements in
A. This implies that
(or
). Furthermore, from the fact that
and
(or
) are elements in
B, we have that
(or
). Hence,
u is a strict infix of
v. Therefore,
. □
Let
. For any
. We denote the set
by
, which is a free language with respect to
. Thus,
. It is easy to see that
if and only if
. Then, we have
. Further, we have:
Lemma 2. Both and hold for any and .
Proof. We only prove the equality . The other one can be proved in analogous fashion.
Suppose that . Then, a is a minimal element in A with respect to . Since , a is also a minimal element in with respect to . That is to say, and so .
On the other hand, suppose that . We now show that a is a minimal element in A with respect to . Let for some . If , then , since a a minimal element in with respect to ; otherwise, . Then, there exists such that and so , since . We thus have . This implies that and so . Therefore, and hence , as required. □
We conclude this section with the following results.
Proposition 10. Let. Then
- (1)
;
- (2)
;
- (3)
.
Proof. Since and , we know from Proposition 9 that . It follows that . Notice that and . Then, . We thus have and so
On the other hand, let
. Then,
for some
. Thus,
for any
. It follows that
. This shows that
Hence, we have that
. Further, if
then
for some
. We thus have
for any
and so
. This shows that
which means that
. Then, we obtain that
, as required.
In an analogous fashion, we can prove and by using Propositions 7 and 8, respectively. So we omit the proof. □