Automata theory based on lattice-ordered semirings

0 downloads 0 Views 304KB Size Report
Mar 10, 2010 - ai1 ai2 ءءء aik by Proposition 2.9. □. 3 K automata. In this section, we give the definitions of all kinds of K automata and K languages. Definition ...
Soft Comput (2011) 15:269–280 DOI 10.1007/s00500-010-0565-3

ORIGINAL PAPER

Automata theory based on lattice-ordered semirings Xian Lu • Yun Shang • Ruqian Lu

Published online: 10 March 2010  Springer-Verlag 2010

Abstract In this paper, definitions of K automata, K regular languages, K regular expressions and K regular grammars based on lattice-ordered semirings are given. It is shown that KNFA is equivalent to KDFA under some finite condition, the Pump Lemma holds if K is finite, and KNFA is equivalent to KNFA. Further, it is verified that the concatenation of K regular languages remains a K regular language. Similar to classical cases and automata theory based on lattice-ordered monoids, it is also found that KNFA, K regular expressions and K regular grammars are equivalent to each other when K is a complete lattice. Keywords Lattice-ordered semirings  K automata  K regular languages  K regular expressions  K regular grammars

1 Introduction It is well known that semirings are powerful tools in the study of formal languages and automata theory. Many algebraic properties of formal languages and automata can be characterized by semiring structures (Di Nola and Gerla 2004; Droste and Gastin 2005; Eilenberg 1974; Gerla 2003, 2004, Krob 1998; Simon 1988). Certainly, from the algebraic point of view, we see that some semiring structures have close relation with some algebraic models of logics. Recently, Di Nola and Gerla (2004) introduced the semiring reducts of MV algebras and established the relationship between lattice-ordered commutative semirings X. Lu  Y. Shang (&)  R. Lu Institute of Mathematics, Academia Sinica, AMSS, Beijing 100190, People’s Republic of China e-mail: [email protected]

and MV algebras (BL algebras), which is the main algebraic model of multiple valued logics. In particular, they set up automata theory based on the lattice-ordered commutative semirings, and found that languages of automata still have characters of MV algebras. With the development of non-commutative theory, pseudo MV algebras were proposed by dropping the commutativity axiom from MV algebras (Georgescu and Iorgulescu 2001; Rachunek 2002). They could be applied to the programming languages and non-commutative logics (Baudot 2000; Hajek 2003). Especially, they are in close relation with lattice-ordered groups which play an important role in the development of non-commutative quantum structures (Dvurecˇenskij 2002; Dvurecˇenskij and Pulmannova´ 2000). Further, Shang and Lu (2007) discussed the semiring reducts on pseudo MV algebras, established the relation between pseudo MV algebras and lattice-ordered noncommutative semirings. They set up automata theory based on these non-commutative algebraic structures. And they showed us that some properties of languages of automata such as intersection and reversal have close relation with the commutativity of algebraic operation in semirings. Li and Pedrycz and others proposed automata theory based on lattice-ordered monoid, and get more good properties similar to classical automata theory (Ignjatovic´ et al. 2008; Li et al. 2006; Li and Pedrycz 2005, 2006; Sheng and Li 2006). In this paper, we discuss more properties of automata and languages based on lattice-ordered semirings besides the union, intersection and reversal of languages in (Shang and Lu 2007). In detail, we give the definitions of KDFA, KNFA, K regular expressions and K regular grammars. It is proved that the concatenation of K regular languages is still a K regular language, KNFA and KDFA are

123

270

X. Lu et al.

equivalent under some finite condition and KNFA is equivalent to KNFA. Further, we prove that in the finite case Pump Lemma corresponding to K automata is a trivial conclusion of the equivalence between KNFA and KDFA. At last, we also get the equivalence among KNFA, K regular expressions and K regular grammars when K is a complete lattice, which generalizes the results for the classical automata. Certainly, some properties are similar to those in (Li and Pedrycz 2005; Sheng and Li 2006). This paper is organized as follows. In the next section, some preliminaries on lattice-ordered semirings are presented. In Sect. 3, we give the basic definitions and notions about K automata. In Sect. 4, we prove the equivalence between KNFA and KDFA when K is finite and the equivalence between KNFA and KNFA. In Sect. 5, we verify that K regular languages are closed under the operation of concatenation. In Sect. 6, we establish the equivalence between K regular expressions and KNFA when K is a complete lattice. In Sect. 7, we prove that K regular grammars are equivalent to KNFA. We give our conclusions in the last section. 2 Lattice-ordered semirings Definition 2.1 (Di Nola and Gerla 2004) A semiring R ¼ ðR; þ; 0; ; eÞ is an algebraic structure where 0 and e are distinct elements of R, ? and  are binary operations on R satisfying: (i) (R, ?) is a commutative monoid with identity 0; (ii) ðR; Þ is a monoid with identity e; (iii) Multiplication distributes over addition; (iv) 8r 2 R; 0  r ¼ r  0 ¼ 0.

(i) a þ b ¼ a _ b; (ii) a  b  a ^ b. A semiring R is dual lattice-ordered iff it has the structure of a lattice such that for all a; b 2 R: (i) a þ b ¼ a ^ b, (ii) a  b  a _ b. Let R and S be semirings. A transposition morphism between R and S is a mapping f : R ! S such that

123

Proposition 2.3 (Shang and Lu 2007) Let A ¼ ðAL ; _L ; ^L ; L ; !L ; *L ; 0L ; 1L Þ be a left pseudo BL algebra. Then ðAL ; _L ; L ; 1L Þ is a lattice-ordered semiring. Proposition 2.4 (Shang and Lu 2007) Let A ¼ ðAR ; _R ; ^R ; R ; !R ; *R ; 0R ; 1R Þ be a right pseudo BL algebra. Then AR ¼ ðAR ; R ; ^R ; 0R Þ is a dual latticeordered semiring. Definition 2.5 (Shang and Lu 2007) A right _-coupled semiring A is a structure ðR1 ; R2 ; a; bÞ such that R1 ¼ ðA; _; 0; ; eÞ and R2 ¼ ðA; ^; e; 0 ; 0Þ are a lattice-ordered semiring and a dual lattice-ordered semiring respectively, (ii) a : A ! A; b : A ! A are a pair of transposition semiring isomorphisms from R1 into R2, (iii) aðbðxÞÞ ¼ x; bðaðxÞÞ ¼ x, (iv) for every x; y 2 A; x _ y ¼ x 0 ðbðxÞ  yÞ ¼ ðx 0 aðyÞÞ  y. (i)

Proposition 2.6 (Shang and Lu 2007) Let G ¼ ðG; _; ^; þ; ; 0Þ be an arbitrary l-group and u 2 G; u  0. We put by definition: x 0 y ¼ ðx þ yÞ ^ u; x ¼ u  x; x  ¼ x þ u; x  y ¼ ðx  u þ yÞ _ 0. Then C1 ¼ ð½0; u ; _; 0; ; uÞ is a lattice-ordered semiring, and C2 ¼ ð½0; u ; ^; u; 0 ; 0Þ is a dual lattice-ordered semiring. Further ðC1 ; C2 ; a ¼ ; b ¼  Þ is a right coupled semiring. Proposition 2.7 (Shang and Lu 2007) Let A ¼ ðR1 ; R2 ; a; bÞ be a right coupled semiring, where R1 ¼ ðA; _; 0; ; eÞ and R2 ¼ ðA; ^; e; 0 ; 0Þ. Then ðA; 0 ; ; a; b; 0; eÞ is a right pseudo MV algebra.

Definition 2.2 (Di Nola and Gerla 2004) A semiring R ¼ ðR; þ; 0; ; eÞ is called lattice-ordered semiring iff it has the structure of a lattice such that for all a; b 2 R:

(i) f ð0Þ ¼ 0; f ðeÞ ¼ e, (ii) for all r; r 0 2 R, f ðr þ r 0 Þ ¼ f ðrÞ þ f ðr 0 Þ f ðr  r 0 Þ ¼ f ðr 0 Þ  f ðrÞ.

If f is a transposition semiring bimorphism, then f is called a transposition semiring isomorphism.

and

Proposition 2.8 (Shang and Lu 2007) Let A ¼ ðA; R ; R ;R ;  R ; 0R ; 1R Þ be a right pseudo MV algebra. Then the reducts R_A ¼ ðA; _R ; 0R ; R ; 1R Þ and R^A ¼ ðA; ^R ; 1R ; R ; 0R Þ are a lattice-ordered semiring and a dual lattice-ordered semiring respectively. And ðR_A , R^A ;R ;  R Þ is a right-coupled semiring. Certainly, for left pseudo MV algebras, we have similar results. From the above discussions, one can see that lattice-ordered semiring structures are in close relation with the pseudo MV algebras. In the following, K ¼ ðR; þ; 0; ; e; ^; _Þ denotes a lattice-ordered non-commutative semiring. For dual latticeordered semiring, we can discuss similarly. For any lattice-ordered non-commutative semiring, the following properties hold:

Automata theory based on lattice-ordered semirings

271

Proposition 2.9 Let a; b; c 2 K. If a  b, then a  c  b  c and c  a  c  b. Proof From a  b, we have a þ b ¼ a _ b ¼ b. Therefore, ða  cÞ _ ðb  cÞ ¼ ða þ bÞ  c ¼ b  c, that is, a  c  b  c. Similarly, there is c  a  c  b. h Proposition 2.10 Let a1 ; a2 ; . . .; an 2 K, and ai1 ; ai2 ; . . .; aik ð1  i1 \i2 \    \ik  nÞ be any subsequence. Then a1  a2      an  ai1  ai2      aik . Proof Since a  b  a, we know a  b  c  a  c, a  b  c  a  b and a  b  c  b  c. We get a1  a2     an  ai1  ai1 þ1      an  ai1  ai2  ai2 þ1   an  ai1  ai2      aik      an  ai1  ai2      aik by Proposition 2.9. h

Definition 3.6 (KDFA) A KDFA is a KNFA whose transform function E satisfies that, for any p 2 Q and any r 2 R there exists at most one q 2 Q such that Eðp; r; qÞ 6¼ 0. Now we define the languages accepted by the automata above. Definition 3.7 Let M ¼ ðQ; R ; I; T; EÞ be a KNFA. For any s 2 R and s0 ¼ r01    r0n 2 HR , where R is the free monoid over R, the K language accepted by M is defined to be a mapping LðMÞ : R ! K given by " _ _ LðMÞðsÞ ¼ Iðp0 Þ  Eðp0 ; r01 ; p1 Þ      jjs0 jj¼s p0 ;...;pn 2Q

Eðpn1 ; r0n ; pn Þ

  Tðpn Þ

ð2Þ

3 K automata In this section, we give the definitions of all kinds of K automata and K languages. Definition 3.1 (Length) Let HR ¼ fa1 a2    an jai 2 R [ fg; n  1g, where R is an alphabet. For any s 2 HR , the ‘‘length’’ of s, denoted by |s|, is defined as the count of all nonempty characters in s. If jsj  1, jjsjj denotes the sequence composed of all nonempty characters of s in their original order; define jjsjj ¼  if jsj ¼ 0. Definition 3.2 (K Automata) Let R ¼ R [ fg. A K automata is a quintuple: M ¼ ðQ; R ; I; T; EÞ, in which (i) (ii) (iii) (iv) (v)

Q is the nonempty set of states; R is the set of input characters; I : Q ! K is the initial state function; T : Q ! K is the terminal state function; E : Q HR Q ! K is the transform function, where for any s ¼ r01    r0n 2 HR ðn  2Þ _ Eðp; r01 ; p1 Þ      Eðpn1 ; r0n ; qÞ Eðp; s; qÞ ¼ p1 ;...;pn1 2Q

ð1Þ

Proposition 3.8 When  is not considered, this is the Klanguage defined in (Shang and Lu 2007). Obviously, for a KNFA M there is Eðpi1 ; r0i ; pi Þ 6¼ 0 for some iBn if Iðp0 Þ  Eðp0 ; r01 ; p1 Þ      0 Eðpn1 ; rn ; pn Þ  Tðpn Þ 6¼ 0. If r0i ¼ , then pi1 ¼ pi and Eðpi1 ; r0i ; pi Þ ¼ e. Therefore, we can delete this Eðpi1 ; r0i ; pi Þ from Iðp0 Þ  Eðp0 ; r01 ; p1 Þ      Eðpn1 ; r0n ; pn Þ  Tðpn Þ without affecting the value of Eq. 2. Thus the language function Eq. 2 can be simplified as: _ IðpÞ  Eðp; s; qÞ  TðqÞ ð3Þ LðMÞðsÞ ¼ p;q2Q

Especially, the value of  is: " _ _ LðMÞðÞ ¼ Iðp0 Þ  Eðp0 ; ; p1 Þ      n  0 p0 ;...;pn 2Q



ð4Þ

Eðpn1 ; ; pn Þ  Tðpn Þ If M is a KNFA, Eq. 4 can be simplified as: _ LðMÞðÞ ¼ IðpÞ  TðpÞ

ð5Þ

p2Q

From Eq. 1, we know that E is totally determined by EjQ R Q (restricted in the domain Q R Q).

Definition 3.9 (K Regular Languages) The K language accepted by any KNFA is called K regular language.

Proposition 3.3 Obviously if the alphabet of the K automata is R, rather than R , the K automata defined above is exactly the K  R automata in (Shang and Lu 2007).

In the following sections, for two KNFAs (note that KNFA and KDFA are special type of KNFA) M1 and M2 , we say they are equivalent or M1 could be simulated by M2 if they accept the same K language, that is, LðM1 Þ ¼ LðM2 Þ. We say that a type of automata T1 (for example, T1 could be the class of all KNFAs) is more powerful than another type of automata T2 if for any automaton M2 2 T2 there exists some M1 2 T1 such that M2 could be simulated by M1 . We say T1 and T2 are

Definition 3.4 (KNFA) A KNFA is a K automata whose transform function E satisfies: 8q 2 Q; Eðq; ; qÞ ¼ e. Definition 3.5 (KNFA) A KNFA is a KNFA whose transform function E satisfies: 8p; q 2 Q; p 6¼ q; Eðp; ; qÞ ¼ 0.

123

272

X. Lu et al.

equivalent if T1 is more powerful than T2 , and meanwhile T2 is more powerful than T1 .

Corollary 4.2 equivalent.

4 KDFA, KNFA and KNFA As we know, DFA and NFA with and without emptymoves are equivalent in classical automata theory (Hopcroft et al. 2001). In this section we also obtain similar results for K automata under some finite condition. Denote the domain of any function f to be Dðf Þ. For a KNFA M ¼ ðQ; R ; I; T; EÞ denote RM ¼ DðIÞ [ DðEÞ [DðTÞ. Assume SM is the subsemiring in K generated by RM (the minimum subsemiring containing RM ), we could prove the following conclusion. Theorem 4.1 For any KNFA M, if SM is finite, then M could be simulated by a KDFA. Proof SQ M is finite since SM and Q are finite. Similar to the mechanism of Sect. 4 of Ying (2005), we construct a 0 0 0 KDFAM 0 ¼ ðSQ M ; R ; I ; T ; E Þ as:  _ e; if X ¼ I I 0 ðXÞ ¼ ; T 0 ðXÞ ¼ XðpÞ  TðpÞ: 0; otherwise p2Q Q For any WX 2 SQ M and r 2 R, define YX;r 2 SM as: YX;r ðqÞ ¼ p2Q XðpÞ  Eðp; r; qÞ. For all X; Y 2 SQ M , we also define E0 to be:  e; if Y ¼ YX;r 0 E ðX; r; YÞ ¼ 0; otherwise r1

X0 ;Xn 2SQ M

E0 ðXn1 ;rn ;Xn Þ  T 0 ðXn Þ ¼ I 0 ðIÞ  E0 ðI;r1 ;X1 Þ   E0 ðXn1 ;rn ;Xn Þ  T 0 ðXn Þ ¼ T 0 ðXn Þ _ Xn ðpn Þ  Tðpn Þ ¼ pn 2Q

¼

"

_

# Xn1 ðpn1 Þ  Eðpn1 ;rn ;pn Þ  Tðpn Þ

pn 2Q pn1 2Q

¼

_

Iðp0 Þ  Eðp0 ;r1 ;p1 Þ  

p0 ;...;pn 2Q

Eðpn1 ;rn ;pn Þ  Tðpn Þ In the case of s ¼ , LðM 0 ÞðÞ ¼ I 0 ðIÞ  T 0 ðIÞ ¼ T 0 ðIÞ ¼ _p2Q IðpÞ  TðpÞ ¼ LðMÞðÞ. Therefore, we can simulate a KNFA with a KDFA if S is finite. h

123

If K is finite, then KNFA and KDFA are

Generally, We have not proved whether KNFA is more powerful than KDFA or not. As a comparison, in Li and Pedrycz (2005), it was proved that N L-FFA is more powerful than D L-FFA, and they are equivalent if and only if L is locally finite. Here, we proved that KNFA and KDFA are equivalent under the finiteness of SM , which is a weaker condition than locally finiteness. As an application of Corollary 4.2, now we present Pump Lemma in the frame of lattice-ordered non-commutative semirings. Theorem 4.3 (Pump Lemma) Let M ¼ ðQ; R ; I; T; EÞ be a KNFA and N be the cardinal of KQ . If K is finite, then for any s 2 Rþ , if jsj [ N then it can be divided as s ¼ uvw such that LðMÞðsÞ ¼ LðMÞðuvi wÞ where u; w 2 R ; v 2 Rþ and i 2 N. Proof Suppose M0 is the KDFA constructed from M in the same way as that in Theorem 4.1. Denote s ¼ r1    rn 2 Rþ . It is proved that LðM 0 ÞðsÞ ¼ T 0 ðXn Þ, where Xn ¼ YXn1 ;rn ; . . .; X1 ¼ YI;r1 . Denote I ¼ X0 . When n [ N, there must be Xj ¼ Xk for some 0  j\k  n. Let v ¼ rjþ1    rk ; u ¼ r1    rj ; w ¼ rkþ1    rn . It is easy to see that the terminal state of the path accepting uvi w in M0 is always Xn . Therefore, LðMÞðuvi wÞ ¼ LðM 0 Þðuvi wÞ ¼ T 0 ðXn Þ ¼ LðM 0 ÞðsÞ ¼ LðMÞðsÞ. h

r2

For any s ¼ r1 r2    rn 2 Rþ , the path I!X1 ! rn X2    !Xn and the terminal state Xn are determined by I and s. Note that Xi ¼ YXi1 ;ri in this path. Therefore, _ I 0 ðX0 Þ  E0 ðX0 ;r1 ;X1 Þ   LðM 0 ÞðsÞ ¼

_

Clearly, SM is finite when K is finite. Hence we give the equivalence of KNFA and KDFA.

Moreover, the classes of nondeterministic automata with and without empty-moves based on lattice-ordered semirings are equivalent. Theorem 4.4

The KNFA and KNFA are equivalent.

Proof Since KNFA is a special type of KNFA, we only need to prove that for any KNFA M1 , there exists an equivalent KNFA M2 . For any KNFA, M1 ¼ ðQ; R ; I; T; EÞ, construct a KNFA, M2 ¼ ðQ; R; I; T 0 ; E0 Þ as follows. First we denote W Eðp; k ; qÞ ¼ p1 ;...;pk1 2Q ½Eðp; ; p1 Þ      Eðpk1 ; ; qÞ for k  2 and Eðp; 0 ; qÞ ¼ e, Eðp; 1 ; qÞ ¼ Eðp; ; qÞ. Then define _   Eðp; k ; pk Þ  Eðpk ; r; qÞ E0 ðp; r; qÞ ¼ k  0;pk 2Q 0

T ðpÞ ¼

_



Eðp; k ; pk Þ  Tðpk Þ



k  0;pk 2Q

For any given set of states fp1 ; . . .; pk g, if k [ jQj, then there must be pi ¼ pj for some 1  i\j  k since Q is finite. Thus, Eðp0 ; ; p1 Þ      Eðpk1 ; ; pk Þ  Eðp0 ; ; p1 Þ    

Automata theory based on lattice-ordered semirings

273

2

Eðpi1 ; ; pi Þ  Eðpj ; ; pjþ1 Þ      Eðpk1 ; ; pk Þ by W Proposition 2.10. Therefore, Eðp; k ; qÞ  l  jQj Eðp; l ; qÞ  W for any k  0. Then T 0 ðpÞ ¼ k  jQj;pk 2Q Eðp; k ; pk Þ Tðpk Þ  W and E0 ðp; r; qÞ ¼ k  jQj;pk 2Q Eðp; k ; pk Þ Eðpk ; r; qÞ . In the following, we denote m0 ¼ 0; mnþ1 ¼ m and S ¼ fð0; m1 ; . . .; mnþ1 Þjmiþ1  mi  jQj þ 1; mnþ1 mn  jQj; i ¼ 0; . . .; n  1g f0g Nnþ1 , T ¼ f0g Nnþ1  S. For any s ¼ r1 r2    rn , the Eq. 2 is _

_

LðM1 ÞðsÞ ¼

Iðp0 Þ 

mi \miþ1 pmi 2Q

2

_

4

mmn  jQj pm 2Q

¼

4

pmi 2Q;i  n

miþ1 mi 1

; qmi Þ  Eðqmi ; rmiþ1 ; pmiþ1 Þ5

Eðpmi ; miþ1 mi 1 ; qmi Þ  Eðqmi ; rmiþ1 ; pmiþ1 Þ5

¼

; pm Þ  Tðpm Þ

¼

For any ðm0 ; . . .; mnþ1 Þ 2 T, there is mjþ1  mj  1 [ jQj for some 0  j\n or mnþ1  mn [ jQj. Then " n1 _ Y Iðp0 Þ  Eðpmi ; miþ1 mi1 ; qmi Þ

_

mmn

; pm Þ  Tðpm Þ

Eðpmi ; miþ1 mi1 ; qmi Þ

qmi 2Q

#

_

Eðqmi ; rmiþ1 ; pmiþ1 Þ 

Eðpmj ;  ; qj Þ

 Eðqj ; rmjþ1 ; pmjþ1 Þ      Eðpmn ; mmn ; pm Þ  Tðpm Þ

LðM1 ÞðsÞ ¼

W

ðm0 ;...;mnþ1 Þ2T ð  Þ 

_ _

Iðp0 Þ 

4

_

ðm0 ;...;mnþ1 Þ2S ð  Þ

i¼0

Eðpmi ; 

miþ1 mi 1

3 ; qmi Þ  Eðqmi ; rmiþ1 ; pmiþ1 Þ5

qmi 2Q mmn

 Eðpmn ;  ¼

_ pmi 2Q;i  n

in Eq. 6

n1 Y

S pmi 2Q

2

W

; pm Þ  Tðpm Þ

Iðp0 Þ 

n1 Y i¼0

n

Iðp0 Þ  Eðp0 ;  ; pn Þ  Tðpn Þ

2

_

_

Iðp0 Þ  4

_

3 Eðp0 ; n ; pn Þ  Tðpn Þ5

n  jQj;pn 2Q 0

Iðp0 Þ  T ðp0 Þ ¼ LðM2 ÞðÞ

p0 2Q

Therefore, a KNFA could be simulated by a KNFA. h 5 K regular languages

Definition 5.1 K subsets

l

l  jQj;qj 2Q

Therefore, and

#

_

In this section, we will discuss the properties of K regular languages in detail. We will see that non-commutativity of the operations in lattice-ordered semirings will play an important role in some properties of languages such as intersection, reversal, but not affect the union, concatenation and Kleene closure.

#

Eðqmi ; rmiþ1 ; pmiþ1 Þ  Eðpmn ; 

i¼0

"

p0 2Q

ð6Þ

 Iðp0 Þ 

i¼0

0  n  jQj p0 ;pn 2Q

3

 Eðpmn ; 

"

_

¼

i¼0

mmn

j1 Y

E0 ðpmi ; rmi þ1 ; pmi þ1 Þ  T 0 ðpmn Þ

n  0 p0 ;pn 2Q

n1 Y

Iðp0 Þ 

qmi 2Q

n1 Y

In the case of s ¼ , by Eq. 4, " # _ _ n Iðp0 Þ  Eðp0 ;  ; pn Þ  Tðpn Þ LðM1 ÞðÞ ¼

qmi 2Q

i¼0

Iðp0 Þ 

¼ LðM2 ÞðsÞ 3

Eðpmi ; 

_

_

i¼0

S[T pmi 2Q

2

Eðpmi ; miþ1 mi 1 ; qmi Þ

 Eðqmi ; rmiþ1 ; pmiþ1 Þ 2 3 _ _ mm n 4 Eðpmn ;  ; pm Þ  Tðpm Þ5

 Eðpmn ; mmn ; pm Þ  Tðpm Þ ¼

_

miþ1 mi 1  jQj qmi 2Q

n1 Y

qmi 2Q

_ _

_

4



(Shang and Lu 2007) Let f ; g; h 2 KR be

The union of f and g, denoted by f [ g, is defined as ðf [ gÞðsÞ ¼ f ðsÞ _ gðsÞ for any s 2 R . (ii) The intersection of f and g, denoted by f \ g, is defined as ðf \ gÞðsÞ ¼ f ðsÞ ^ gðsÞ for any s 2 R . The generalized intersection of f and g, denoted by f u g, is defined as ðf u gÞðsÞ ¼ f ðsÞ  gðsÞ for any s 2 R . (iii) The reversal of f, namely f 1 , is defined as f 1 ðsÞ¼f ðs1 Þ, where s¼r1 r2 rn , s1 ¼ rn r2 r1 .

(i)

Note that the empty-move  was not considered in (Shang and Lu 2007). The K  R automaton defined in Shang and Lu (2007) is the KNFA in this paper except that the value of  accepted by automaton is defined here, while its value is missed in Shang and Lu (2007). However, it is

123

274

X. Lu et al.

easy to check that the following properties also hold even when the value of  is taken into account. Proposition 5.2 (Shang and Lu 2007) K regular languages are closed under the operation of union. The M1  M2 and M1 ^ M2 are constructed straightforward as the product of M1 and M2 in Shang and Lu (2007), we omit the details here. Theorem 5.3 (Shang and Lu 2007) For every KNFA M1 and M2, LðM1  M2 Þ ¼ LðM1 Þ u LðM2 Þ iff the multiplication operation satisfies the commutative law. Theorem 5.4 (Shang and Lu 2007) For every KNFA M1 and M2, LðM1 ^ M2 Þ ¼ LðM1 Þ \ LðM2 Þ iff the multiplication operation is the infimum operation in lattice-ordered semiring K. Theorem 5.5 (Shang and Lu 2007) For any KNFA M and its reversal M 1 ; LðMÞ ¼ LðM 1 Þ iff the multiplication operation satisfies the commutative law. From the above, we find that the non-commutative property of multiplication can determine intersection and reversal of languages of automata. However, in the following, we show that it does not affect the concatenation of languages. Thus the Kleene closure holds in the frame of lattice-ordered non-commutative semirings. Definition 5.6 (Concatenation) For any K regular languages l1 and l2 , their concatenation, denoted by l1  l2 , is defined as _ l1 ðs1 Þ  l2 ðs2 Þ ðl1  l2 ÞðsÞ ¼ jjs1 s2 jj¼s;si 2R

For any s ¼ r1    rn 2 Rþ , we have E3 ðp; s; qÞ ¼ E1 ðp; s; qÞ when p; q 2 Q1 and E3 ðp; s; qÞ ¼ E2 ðp; s; qÞ when p; q 2 Q2 . It is easy to check that if p 2 Q1 ; q 2 Q2 then _ _ E1 ðp; s1 ; p0 Þ  T1 ðp0 Þ E3 ðp; s; qÞ ¼ jjs1 s2 jj¼s;si 2R p0 2Q1 ;p00 2Q2  I2 ðp00 Þ  E2 ðp00 ; s2 ; qÞ

if p 2 Q2 ; q 2 Q1 then E3 ðp; s; qÞ ¼ 0. Therefore, for any W s 2 Rþ ; LðM3 ÞðsÞ ¼ I ðpÞ  E3 ðp; s; qÞ  T3 ðqÞ ¼ W W p;q2Q3 3 W ¼ s I  E1 ðp; s1 ; p0 Þ T1 ðp0 Þ  0 00 1 jjs1 s2 jj p;p 2Q1 q;p 2Q2 ðpÞ W 00 00 I2 ðp Þ  E2 ðp ; s2 ; qÞ  T2 ðqÞ ¼ s1 s2 ¼s LðM1 Þðs1 Þ  LðM2 Þ W W ðs2 Þ. If s ¼ ; LðM3 ÞðÞ ¼ p2Q1 I1 ðpÞ  T3 ðpÞ ¼ p2Q1 I1 ðpÞ  T1 ðpÞ  LðM2 ÞðÞ ¼ LðM1 ÞðÞ  LðM2 ÞðÞ. Thus LðM3 Þ ¼ LðM1 Þ  LðM2 Þ. h The K regular languages are closed under the operations of union and concatenation, so we could infer the following theorem: Corollary 5.8 (Kleene Closure) The K regular languages are closed under the Kleene star operation. Further, all K regular languages form a non-commutative semiring. Let 0 denote the K language R ! f0g and 1 denote R ! feg. RegðKÞ denotes the set of K regular languages. It is easy to see 0; 1 2 RegðKÞ. Corollary 5.9 semiring.

Proof First, for all l1 ; l2 ; l3 2 RegðKÞ, then l1  ðl2 _ l3 Þ ¼ ðl1 _ l2 Þ  ðl1 _ l3 Þ. In fact, for any s 2 R , _ l1 ðs1 Þ  ðl2 _ l3 Þðs2 Þ ðl1  ðl2 _ l3 ÞÞðsÞ ¼ jjs1 s2 jj¼s;si 2R

Theorem 5.7 For any K regular languages l1 and l2 , their concatenation is also a K regular language.

123

_

¼

l1 ðs1 Þ  ðl2 ðs2 Þ _ l3 ðs2 ÞÞ

jjs1 s2 jj¼s;si 2R

Proof Assume the KNFA of li is Mi ¼ ðQi ; R ; Ii ; Ti ; Ei Þ (i ¼ 1; 2) where Q1 \ Q2 ¼ /. First we construct a KNFA M3 ¼ ðQ3 ; R ; I3 ; T3 ; E3 Þ as: Q3 ¼ Q1 [ Q2 ,  I1 ðpÞ; if p 2 Q1 ; I3 ðpÞ ¼ 0; if p 2 Q2  T1 ðpÞ  LðM2 ÞðÞ; if p 2 Q1 T3 ðpÞ ¼ T2 ðpÞ; if p 2 Q2

8 Ei ðp; r; qÞ; > > hW iW > > > < p0 2Q1 E1 ðp; r; p0 Þ  T1 ðp0 Þ  I2 ðqÞ E3 ðp; r; qÞ ¼ hW i > 00 00 > 00 2Q T1 ðpÞ  I2 ðp Þ  E2 ðp ; r; qÞ ; > p > 2 > : 0;

ðRegðKÞ; _; 0; ; 1Þ is a non-commutative

_

¼

ðl1 ðs1 Þ  l2 ðs2 ÞÞ _ ðl1 ðs1 Þ

jjs1 s2 jj¼s;si 2R

 l3 ðs2 ÞÞ ¼ ðl1  l2 ÞðsÞ _ ðl1  l3 ÞðsÞ ¼ ððl1  l2 Þ _ ðl1  l3 ÞÞðsÞ:

if p; q 2 Qi ð7Þ if r 2 R; p 2 Q1 ; q 2 Q2 if p 2 Q2 ;

q 2 Q1

Automata theory based on lattice-ordered semirings

Easy to check that ðRegðKÞ; _; 0Þ is an Abelian monoid and ðRegðKÞ; ; 1Þ is a non-Abelian monoid. Hence ðRegðKÞ; _; 0; ; 1Þ forms a non-commutative semiring. h Similarly, the family of NL-FFA languages is also closed under the operations of union, concatenation and the Kleene closure (Li and Pedrycz 2005). 6 K regular expressions In this section, we prove that the regular expressions based on lattice-ordered non-commutative semirings are equivalent to KNFA, which generalizes the result for classical automata theory (Hopcroft et al. 2001). We first define the K regular expressions and their languages in a recursive way. In the following definition u, v, w are variables varying through all K regular expressions, and L(u), L(v), L(w) are their K languages, respectively. Definition 6.1 Suppose K is complete lattice and R is an alphabet. A K regular expression u over R is an element of ðR [ K [ f; /g [ fþ; ; 1; ð; ÞgÞ which satisfies one of the following conditions: (i) (ii) (iii) (iv)

(v)

u ¼ / is a K regular expression over R; Lð/ÞðsÞ ¼ 0 for all s 2 R . u ¼  is a K regular expression over R; LðÞðsÞ ¼ e if s ¼  and LðÞðsÞ ¼ 0 otherwise. u ¼ r 2 R is a K regular expression over R; LðrÞðsÞ ¼ e if s ¼ r and LðrÞðsÞ ¼ 0 otherwise. If v is a K regular expression over R, then for any k; l 2 K; u1 ¼ ðk  vÞ; u2 ¼ ðv  lÞ are K regular expressions over R, their languages are Lðu1 ÞðsÞ ¼ k  LðvÞðsÞ, Lðu2 ÞðsÞ ¼ LðvÞðsÞ  l, respectively. If v, w are K regular expressions over R, then u ¼ ðv þ wÞ is a K regular expression over R; LðuÞðsÞ ¼ LðvÞðsÞ _ LðwÞðsÞ for all s 2 R ; (b) u ¼ ðv  wÞ is a K regular expression over R; LðuÞ ¼ LðvÞ  LðwÞ; we denote u1 ¼ u, ukþ1 ¼ ðuk  uÞ for k  1; (c) u ¼ ðv1 Þ is a K regular expression over R; LðuÞ ¼ LðvÞ _ Lðv2 Þ _   . (a)

Before the main theorem, we first give two characters about K regular expressions: Proposition 6.2 tributive law. Proof

275

Lðu  ðv þ wÞÞðsÞ _ LðuÞðs1 Þ  Lðv þ wÞðs2 Þ ¼ jjs1 s2 jj¼s;si 2R

LðuÞðs1 Þ  ðLðvÞðs2 Þ _ LðwÞðs2 ÞÞ

jjs1 s2 jj¼s;si 2R

_

¼

ðLðuÞðs1 Þ  LðvÞðs2 ÞÞ _ ðLðuÞðs1 Þ  LðwÞðs2 ÞÞ

jjs1 s2 jj¼s;si 2R

0

¼@

1

_

LðuÞðs1 Þ  LðvÞðs2 ÞA

jjs1 s2 jj¼s;si 2R

0

_

_@

jjs1 s2 jj¼s;si 2R

1

LðuÞðs1 Þ  LðwÞðs2 ÞA

¼ Lðu  vÞðsÞ _ Lðu  wÞðsÞ ¼ Lððu  vÞ þ ðu  wÞÞðsÞ Namely, u  ðv þ wÞ ¼ ðu  vÞ þ ðu  wÞ. In a similar way, there is ðu þ vÞ  w ¼ ðu  wÞ þ ðv  wÞ. h Proposition 6.3 Assume that u is a K regular expression over R, then Lðu1 ÞðsÞ ¼ LðuÞðsÞ _ Lðu2 ÞðsÞ _    Lðun ÞðsÞ for all s 2 Rn . Let s ¼ r1    rn , _ LðuÞðs1 Þ      LðuÞðsk Þ Lðuk ÞðsÞ ¼

Proof

jjs1 sk jj¼s;si 2R

for all k  n þ 1. Since the length of s is n, there must exist empty sequences in s1 ; . . .; sk . Denote these nonempty sequences by si1 ; . . .; sil ðl  nÞ in their original order. Then by Proposition 2.10, LðuÞðs1 Þ      LðuÞðsk Þ  LðuÞðsi1 Þ      LðuÞðsil Þ Obviously, each LðuÞðsi1 Þ      LðuÞðsil Þ is contained in the expanded form of Lðul ÞðsÞ. Therefore, Lðuk ÞðsÞ  LðuÞðsÞ _ Lðu2 ÞðsÞ _    _ Lðun ÞðsÞ and Lðu1 ÞðsÞ ¼ LðuÞðsÞ _ Lðu2 ÞðsÞ _    _ Lðun ÞðsÞ.

h

Now we prove that K regular expressions are equivalent to KNFA. Theorem 6.4 Given a K regular expression u, its language L(u) is a K regular language. Proof (1)

K regular expressions satisfy the dis-

For any s 2 R , we have

_

¼

(2)

We prove this theorem inductively.

If u ¼ /, the corresponding KNFA is M ¼ ðQ; R ; I; T; EÞ with IðpÞ ¼ 0; TðpÞ ¼ 0 for all p 2 Q. It is easy to see that LðuÞ ¼ LðMÞ. If u ¼ , the corresponding KNFA is M ¼ ðQ; R ; I; T; EÞ, in which IðpÞ ¼ TðpÞ ¼ e for

123

276

X. Lu et al.

all p 2 Q and Eðp; r; qÞ ¼ 0 for all r 2 R; p; q 2 Q. It is easy to see that LðuÞ ¼ LðMÞ. (3) If u ¼ r for some r 2 R, its KNFA is M ¼ ðfp; qg; R ; I; T; EÞ, where IðpÞ ¼ TðqÞ ¼ e, IðqÞ ¼ TðpÞ ¼ 0, and  e; if d ¼ r; r ¼ p; t ¼ q Eðr; d; tÞ ¼ 0; otherwise It is easy to prove LðMÞ ¼ LðuÞ. (4) Now we are to prove Lðk  uÞ and Lðu  lÞ are K regular languages. Assume the KNFA of u is M ¼ ðQ; R ; I; T; EÞ. We construct Mk ¼ ðQ; R ; Ik ; T; EÞ from M as: 8p 2 Q; Ik ðpÞ ¼ k  IðpÞ. It is easy to prove Lðk  uÞ ¼ LðMk Þ. Construct Ml ¼ ðQ; R ; I; Tl ; EÞ where Tl ðpÞ ¼ TðpÞ l; 8p 2 Q. Similarly, it is easy to see Lðu  lÞ ¼ LðMl Þ. Hence Lðk  uÞ and Lðu  lÞ are K regular languages. (5) Given K regular expressions u and v, now we prove: if L(u) and L(v) are K regular languages then Lðu þ vÞ; Lðu  vÞ and Lðu1 Þ are K regular languages. It can be proved that Lðu þ vÞ is K regular language in a similar way to the proof of Proposition 4.2 of Shang and Lu (2007). (b) It has been proved that Lðu  vÞ ¼ LðuÞ  LðvÞ is K regular language in Theorem 5.7; (c) Assume the KNFA of L(u) is M1 ¼ ðQ1 ; R ; I1 ; T1 ; E1 Þ, the cardinal of Q1 is N. Define

(a)

Fðp; q;nÞ 8W > p ;...;p 2Q T1 ðpÞ  I1 ðp1 Þ > > 1 n1 1 < T1 ðp1 Þ     I1 ðpn1 Þ  T1 ðpn1 Þ  I1 ðqÞ; n 1 ¼ > e; n ¼ 0;p ¼ q > > : 0; otherwise for all p; q 2 Q1 and n 2 N. It is easy to prove:

• • • •

W if p ¼ q ¼ p0 ; E2 ðp; r; qÞ ¼ n;m  N;ri ;si 2Q1 I1 ðr1 Þ  Fðr1 ; r2 ; nÞ  E1 ðr2 ; r; s1 Þ  Fðs1 ; s2 ; mÞ  T1 ðs2 Þ; W if p ¼ p0 ; q 2 Q1 ; E2 ðp; r; qÞ ¼ n;m  N;ri ;s1 2Q1 I1 ðr1 Þ Fðr1 ; r2 ; nÞ  E1 ðr2 ; r; s1 Þ  Fðs1 ; q; mÞ; W if p 2 Q1 ; q ¼ p0 ; E2 ðp; r; qÞ ¼ n;m  N;r1 ;si 2Q1 Fðp; r1 ; nÞ  E1 ðr1 ; r; s1 Þ  Fðs1 ; s2 ; mÞ  T1 ðs2 Þ; W if p; q 2 Q1 ; E2 ðp; r; qÞ ¼ n;m  N;r1 ;s1 2Q1 Fðp; r1 ; nÞ E1 ðr1 ; r; s1 Þ  Fðs1 ; q; mÞ. For any s ¼ r1    rn 2 Rþ , _ I2 ðp0 Þ  E2 ðp0 ; s; pn Þ  T2 ðpn Þ

p0 ;pn 2Q2

¼

_

E2 ðp0 ; r1 ; p1 Þ      E2 ðpn1 ; rn ; pn Þ  T2 ðpn Þ

p1 ;...;pn 2Q2

¼

_

_

p1 ;...;pn 2Q2 r10 ;ri ;s0n ;si 2Q1



Fðr10 ; r1 ; k0 Þ

_

I1 ðr10 Þ

k0 ;kn  N;ki  2Nþ1

 E1 ðr1 ; r1 ; s1 Þ

Fðs1 ; r2 ; k1 Þ      Fðsn1 ; rn ; kn1 Þ  E1 ðrn ; rn ; sn Þ  Fðsn ; s0n ; kn Þ  T1 ðs0n Þ _ I1 ðr1 Þ  E1 ðr1 ; r1 ; s1 Þ  Fðs1 ; r2 ; k1 Þ ¼ ri ;si 2Q1 ;ki  1

 E1 ðr2 ; r2 ; s2 Þ      Fðsn1 ; rn ; kn1 Þ ¼

 E1 ðrn ; rn ; sn Þ  T1 ðsn Þ _ _

I1 ðr1 Þ  E1 ðr1 ; r1 ; s1 Þ

0  l  n1;1  i1 \\il  n1 ri ;si 2Q1

     E1 ðri1 ; ri1 ; si1 Þ Fðsi1 ; ri1 þ1 ; 1Þ      E1 ðrn ; rn ; sn Þ  T1 ðsn Þ _ LðuÞðr1   rii Þ ¼ 0  l  n1;1  i1 \\il  n1

 LðuÞðri1 þ1   ri2 Þ      LðuÞðril þ1   rn Þ _ Lðulþ1 ÞðsÞ ¼ 0  l  n1

Fðp; q; nÞ  Fðq; r; mÞ ¼ Fðp; r; n þ mÞ

ð8Þ

Fðp; q; n þ 1Þ  Fðp; q; nÞ

ð9Þ

Construct the KNFA M2 ¼ ðQ2 ; R ; I2 ; T2 ; E2 Þ of Lðuþ Þ: Q2 ¼ Q1 [ fp0 g where p0 2 6 Q1 , 

e; p ¼ p0 ; ð10Þ 0; otherwise W Fðp; r; nÞ  T1 ðrÞ; p 2 Q1 T2 ðpÞ ¼ Wr2Q1 ;n  N p ¼ p0 r;s2Q1 ;n  N I1 ðrÞ  Fðr; s; nÞ  T1 ðsÞ;

I2 ðpÞ ¼

ð11Þ

123

Define E2 as:

by Eqs. 8, 9. Therefore, LðM2 ÞðsÞ ¼ Lðu1 ÞðsÞ by Proposition 6.3. In the case of s ¼ , by Eqs. 5, 10, 11 and Proposition W 2.10, LðM2 ÞðÞ ¼ T2 ðp0 Þ ¼ ð_r2Q1 I1 ðrÞ  T1 ðrÞÞ ð_r;s2Q1 I1 ðrÞ  T1 ðrÞ  I1 ðsÞ  T1 ðsÞÞ ¼ _r2Q1 I1 ðrÞ  T1 ðrÞ ¼ L ðM1 ÞðÞ. Obviously, LðuÞðÞ ¼ Lðu1 ÞðÞ, so LðM2 ÞðsÞ ¼ Lðu1 ÞðsÞ for any s 2 R . h Conversely, we can also prove the reverse of the theorem above. The mechanism is a straightforward extension of Theorem 3.4 of Hopcroft et al. (2001).

Automata theory based on lattice-ordered semirings

277

Theorem 6.5 Suppose that K is complete lattice. Then any K regular language is the language of some K regular expression. Proof For a K regular language f, denote its KNFA to be M ¼ ðQ; R ; I; T; EÞ where Q ¼ fp1 ; . . .; pn g. Now we define K regular expression Rki;j ðk ¼ 0; . . .; n; i; j ¼ 1; . . .; nÞ over R as follows: when k = 0, define R0i;j ¼  P þ P r Eðpi ; r; pj Þ  r; if i ¼ j otherwise r Eðpi ; r; pj Þ  r; k1 k1 when 1  k  n, define Rki;j ¼ Rk1 i;j þ Ri;k  Rk;j þ k1 k1 þ k1 ½Ri;k  ðRk;k Þ  Rk;j





By this definition, we have 8 0; if s ¼ ; i 6¼ j > > < e; if s ¼ ; i ¼ j 0 LðRi;j ÞðsÞ ¼ > Eðpi ; s; pj Þ; if s 2 R > : 0; if jsj  2

 Eðql1 ; rl ; pj Þ When h = 1, LðRhi;j ÞðsÞ ¼ LðR0i;j ÞðsÞ _ LðR0i;1  R01;j ÞðsÞ _ LðR0i;1  ðR11;1 Þþ  R01;j ÞðsÞ

¼ LðR0i;1 Þðr1 Þ  LðR01;1 Þðr2 Þ      LðR01;1 Þðrl1 Þ  LðR01;j Þðrl Þ

If jsj ¼ l  1, first we prove LðRni;j ÞðsÞ ¼ LðR0i;j ÞðsÞ by induction. Obviously LðRhi;j ÞðsÞ ¼ LðR0i;j ÞðsÞ if h = 0. Now there is LðRhi;j ÞðsÞ ¼ LðR0i;j ÞðsÞ for h\n by hypothesis. When h = n, n1 n1 LðRhi;j ÞðÞ ¼ LðRn1 i;j ÞðÞ _ LðRi;n  Rn;j ÞðÞ

q1 ;...;ql1 2Q

¼ LðR0i;1  R01;j ÞðsÞ _ LðR0i;1  ðR01;1 Þþ  R01;j ÞðsÞ ( LðR0i;1 Þðr1 Þ  LðR01;j Þðr2 Þ; if l ¼ 2 ¼ 0 0 þ 0 LðRi;1 Þðr1 Þ  LððR1;1 Þ Þðr2    rl1 Þ  LðR1;j Þðrl Þ; if l  3

Now we prove LðMÞðsÞ ¼ ðRi;j Iðpi Þ  Rni;j  Tðpj ÞÞðsÞ: (1).

W P Further, Lð i;j Iðpi Þ  Rni;j  Tðpj ÞÞðÞ ¼ i;j Iðpi Þ  LðR0i;j Þ W ðÞ  Tðpj Þ ¼ i Iðpi Þ  Tðpi Þ ¼ LðMÞðÞ. P In a similar way, we know Lð i;j Iðpi Þ  Rni;j  Tðpj ÞÞðrÞ ¼ W W 0 i;j Iðpi Þ  LðRi;j ÞðrÞ  Tðpj Þ ¼ i;j Iðpi Þ Eðpi ; r; pj Þ  Tðpi Þ ¼ LðMÞðrÞ. (2). If jsj ¼ l  2, denote s ¼ r1    rl . We show that _ Eðpi ; r1 ; q1 Þ     LðRni;j ÞðsÞ ¼

¼ Eðpi ; rl ; p1 Þ  Eðp1 ; r2 ; p1 Þ      Eðp1 ; rl1 ; p1 Þ  Eðp1 ; rl ; pj Þ _ Eðpi ; r1 ; q1 Þ      Eðql1 ; rl ; pj Þ ¼ q1 ;...;ql1 2fp1 g

The hypothesis holds for h \ n, in the case of h = n we have n1 n1 LðRhi;j ÞðsÞ ¼ LðRn1 i;j ÞðsÞ _ LðRi;n  Rn;j ÞðsÞ

n1 þ n1 _ LðRn1 i;n  ðRn;n Þ  Rn;j ÞðÞ

n1 þ n1 _ LðRn1 i;n  ðRn;n Þ  Rn;j ÞðsÞ

¼ LðR0i;j ÞðÞ _ LðR0i;n  R0n;j ÞðÞ

n1 n1 ¼ LðRn1 i;j ÞðsÞ _ LðRi;n  Rn;j ÞðsÞ

_ LðR0i;n  ðR0n;n Þþ  R0n;j ÞðÞ 8 > < 0 _ 0 _ 0; if i 6¼ j ¼ e _ 0 _ 0; if i ¼ j 6¼ n > : e _ e _ e; if i ¼ j ¼ n

n1 n1 2 _ LðRn1 i;n  ðRn;n þ ðRn;n Þ þ   

¼

l2 Þ  Rn1 þ ðRn1 n;n Þ n;j ÞðsÞ n1 n1 ¼ LðRn1 i;j ÞðsÞ _ LðRi;n  Rn;j ÞðsÞ n1 n1 _ LðRn1 i;n  Rn;n  Rn;j ÞðsÞ _   

LðR0i;j ÞðÞ

n1 l2  Rn1 _ LðRn1 i;n  ðRn;n Þ n;j ÞðsÞ

For any r 2 R, we get

n1 n1 LðRhi;j ÞðrÞ ¼ LðRn1 i;j ÞðrÞ _ LðRi;n  Rn;j ÞðrÞ n1 þ n1 _ LðRn1 i;n  ðRn;n Þ  Rn;j ÞðrÞ

¼ LðR0i;j ÞðrÞ _ LðR0i;n  R0n;j ÞðrÞ _ LðR0i;n  ðR0n;n Þþ  R0n;j ÞðrÞ 8 Eðpi ; r; pj Þ _ 0 _ 0; > > > > > > < Eðpi ; r; pj Þ _ Eðpi ; r; pj Þ _ Eðpi ; r; pj Þ; ¼ Eðpi ; r; pj Þ _ Eðpi ; r; pj Þ _ Eðpi ; r; pj Þ; > > > Eðpi ; r; pj Þ _ 0 _ 0; > > > : Eðpi ; r; pj Þ _ Eðpi ; r; pj Þ _ Eðpi ; r; pj Þ; ¼ Eðpi ; r; pj Þ ¼

if i 6¼ j; i 6¼ n; j 6¼ n if i ¼ 6 j; i ¼ n; j 6¼ n if i 6¼ j; i 6¼ n; j ¼ n if i ¼ j; i 6¼ n; j 6¼ n if i ¼ j ¼ n

LðR0i;j ÞðrÞ

123

278

X. Lu et al.

such that G0 ¼ ðV 0 ; R; S; P0 Þ and all generators in P0 are in the form of ‘‘A ! r ’’ or ‘‘A ! rB ’’ where A; B 2 V 0 ; r 2 R.

¼ _fEðpi ; r1 ; q1 Þ      Eðql1 ; rl ; pj Þ jq1 ; . . .; ql1 2 Q; no qi is pn g _ fEðpi ; r1 ; q1 Þ      Eðql1 ; rl ; pj Þ jq1 ; . . .; ql1 2 Q; one qi is pn g   

Proposition 7.3 If GK ¼ ðG; lÞ is a K regular grammar and G ¼ ðV; R; S; PÞ, then there is an equivalent K regular grammar G0K ¼ ðG0 ; l0 Þ and G0 ¼ ðV 0 ; R; S0 ; P0 Þ, where S0 never appears on the right side of any generator of P0 .

_ fEðpi ; r1 ; q1 Þ      Eðql1 ; rl ; pj Þ jq1 ; . . .; ql1 2 Q; every qi is pn g _ Eðpi ; r1 ; q1 Þ      Eðql1 ; rl ; pj Þ ¼ q1 ;...;ql1 2Q

P Therefore, we have proved Lð i;j Iðpi Þ  Rni;j  Tðpj ÞÞðsÞ ¼ W q0 ;...;ql2Q Iðq0 Þ Eðq0 ; r1 ; q1 Þ      Eðql1 ; rl ; ql Þ  Tðql Þ ¼ LðMÞðsÞ. P Hence f ¼ Lð i;j Iðpi Þ  Rni;j  Tðpj ÞÞ. h In fact, a generalization of the results of Theorem 6.4 and 6.5 is known as Kleene-Schuetzenberger Theorem (Theorem VII.5.1 of Eilenberg 1974). Similarly, the Kleene Theorem of automata based on lattice-ordered monoid also holds (Li and Pedrycz 2005).

As we know, the languages of regular grammars are regular languages in classical automata theory. It is easy to transform a right linear grammar to a DFA and vice versa. Now we extend this mechanism in the framework of lattice-ordered non-commutative semirings and obtain the same results. Theorem 7.4 The K languages of K regular grammars are K regular languages.

7 K regular grammars

Proof Suppose GK ¼ ðG; lÞ with G ¼ ðV; R; S; PÞ is a K regular grammar. Without lose of generality, we could assume generators in P are in the form of ‘‘A ! r; A ! rB ’’ by Proposition 7.2, and assume S does not appear on the right side of any generator in P by Proposition 7.3. Construct a KNFAM ¼ ðQ; R; I; T; EÞ as follows:

In this section, we show that the K regular languages are exactly the K languages generated by K regular grammars. There are similar results when based on lattice-ordered monoid (Sheng and Li 2006). A K grammar GK consists of G and l, where G ¼ ðV; R; S; PÞ is a classical grammar and l is a mapping from P to K. Denote the language of G to be L(G). As we know, every s 2 LðGÞ could be generated by at least one ordered sequence ðP1 ; . . .; Pk Þ starting from S where Pi 2 P. Denote the set of all such sequences generating s to be P(s). The K language of GK is defined by:

Q ¼ V [ fZg and Z 62 V,  e; if X ¼ S (ii) IðXÞ ¼ 0; otherwise  e; if X ¼ Z (iii) TðXÞ ¼ if S !  62 P; TðXÞ ¼ 0; otherwise 8 < lðS ! Þ; if X ¼ S e; if X ¼ Z if S !  2 P; : 0; otherwise (iv) EðA; a; BÞ ¼ lðA ! aBÞ if A ! aB 2 P; EðA; a; ZÞ ¼ lðA ! aÞ if A ! a 2 P; EðX; r; YÞ ¼ 0 for all other ðX; r; YÞ 2 Q R Q.

LðGK ÞðsÞ W ðP1 ;...;Pk Þ2PðsÞ lðP1 Þ      lðPk Þ; if s 2 LðGÞ ¼ 0; otherwise

For s ¼ r1    rn 2 Rþ , we get _ IðQ0 Þ  EðQ0 ; r1 ; Q1 Þ      LðMÞðsÞ ¼

ð12Þ We say two K grammars are equivalent if they share the same language. Definition 7.1 [K Regular Grammars] GK is a K regular grammar if G is a classical right linear grammar. Here, two conclusions in the classical automata theory also exist in K regular grammar. Their proofs are straightforward. Proposition 7.2 GK ¼ ðG; lÞ is a K regular grammar with a classical right linear grammar G ¼ ðV; R; S; PÞ. There is an equivalent K regular grammar G0K ¼ ðG0 ; l0 Þ

123

(i)

Q0 ;...;Qn 2Q

EðQn1 ; rn ; Qn Þ  TðQn Þ _ EðS; r1 ; Q1 Þ      EðQn1 ; rn ; ZÞ ¼ Q1 ;...;Qn1 2Q

¼

_

lðS ! r1 Q1 Þ      lðQn1 ! rn Þ

Q1 ;...;Qn1 2Q

¼

_

lðP1 Þ  lðP2 Þ      lðPn Þ

ðP1 ;...;Pn Þ2PðsÞ

¼ LðGK ÞðsÞ As to s ¼ , if  2 LðGÞ W then LðGK ÞðÞ ¼ lðS ! Þ by definition and LðMÞðÞ ¼ Q0 2Q IðQ0 Þ  TðQ0 Þ ¼ IðSÞ TðSÞ ¼ lðS ! Þ; if  62 LðGÞ then LðGK ÞðÞ ¼ 0 by

Automata theory based on lattice-ordered semirings

W definition and LðMÞðÞ ¼ Q0 2Q IðQ0 Þ  TðQ0 Þ ¼ 0. Therefore, there is always LðMÞðsÞ ¼ LðGK ÞðsÞ. h The reverse of above theorem also holds: Theorem 7.5 Any K regular language is the K language of some K regular grammar. Proof Suppose M ¼ ðQ; R ; I; T; EÞ is an arbitrary KNFA. We construct a K regular grammar GK ¼ ðG; lÞ as follows: G ¼ ðQ [ fSg; R; S; PÞ where S 62 Q W (i) S ! rQ1 2 P and lðS ! rQ1 Þ ¼ Q0 2Q IðP0 Þ  EðQ0 ; r; Q1 Þ for 8Q1 2 Q; 8r 2 R; (ii) Q0 ! rQ1 2 P and lðQ0 ! rQ1 Þ ¼ EðQ0 ; r; Q1 Þ for 8Q0 ; Q1 2 Q; 8r 2 R; W (iii) Q0 ! r 2 P and lðQ0 ! rÞ ¼ Q1 2Q EðQ0 ; r; Q1 Þ TðQ1 Þ for 8Q0 2 Q; 8r 2 R; (iv) S !  2 P and lðS ! Þ ¼ LðMÞðÞ. Then for any s ¼ r1    rn 2 Rþ , we get _ lðP0 Þ      lðPn Þ LðGK ÞðsÞ ¼ ðP0 ;...;Pn Þ2PðsÞ

¼

_

lðS ! r1 Q1 Þ  lðQ1 ! r2 Q2 Þ

Q1 ;...;Qn1 2Q

     lðQn2 ! rn1 Qn1 Þ  lðQn1 ! rn Þ ! _ _ IðQ0 Þ  EðQ0 ; r1 ; Q1 Þ ¼ Q1 ;...;Qn1 2Q

Q0 2Q

 EðQ1 ; r2 ; Q2 Þ      EðQn2 ; rn1 ; Qn1 Þ ! _  EðQn1 ; rn ; Qn Þ  TðQn Þ Qn 2Q

¼

_

IðQ0 Þ  EðQ0 ; r1 ; Q1 Þ     

279

8 Conclusions In this paper, we mainly introduced finite state automata, regular languages, regular grammars and regular expressions based on lattice-ordered non-commutative semirings. We proved that the Pump Lemma holds under some finite condition, K regular languages are closed under the concatenation operation, and KNFA, K regular expressions and K regular grammars are equivalent when K is a complete lattice. However, there are some interesting problems left to be solved in the future. As stated above, KNFA could be simulated by KDFA when K is a finite lattice-ordered semiring, and KNFA is equivalent to KNFA. Naturally, we want to find out the necessary and sufficient condition in which KNFA and KDFA are equivalent. Among the operations of languages, K regular languages are not universally closed under intersection and reversal. It leads to that ðRegðKÞ; _; 0; ; 1Þ is just a non-commutative semiring rather than a lattice-ordered non-commutative semiring. Next we are concerned with how far is the structure ðRegðKÞ; _; 0; ; 1Þ away from a latticeordered semiring. Another further important problem is to investigate the properties of pushdown automata and Turing machines based on K, and to compare them with the classical theory and the theory in the current paper. Acknowledgments This work was supported by NSFC Major Research Program 60496324; NSFC No. 6002530760234010, 60603002; Pre-973 Project 2001CCA03000; 863 High-Tech Project 2001AA113130; 973 Project 2001CB312004; CAS Brain and Mind Science Project; China Postdoctoral Science Foundation.

Q0 ;...;Qn 2Q

EðQn1 ; rn ; Qn Þ  TðQn Þ

References

¼ LðMÞðsÞ Because S !  is the only one in P generating , there is LðGK ÞðÞ ¼ lðS ! Þ ¼ LðMÞðÞ by Eq. 12. Therefore, we have LðGK Þ ¼ LðMÞ. h From the above two theorems, we find that K regular languages and K regular grammars are equivalent. From Theorem 6.4 and Theorem 6.5, we conclude that K regular languages and K regular expressions are equivalent when K is a complete lattice. Therefore, we have the following conclusion: Corollary 7.6 K regular languages, K regular expressions and K regular grammars are equivalent when K is a complete lattice. From the above proofs, we see that the results about K regular grammars follow directly the classical proof.

Baudot R (2000) Non-commutative programming language NoClog. In: Symposium LICS, Santa Barbara (Short Presentations), pp 3– 9 Di Nola A, Gerla B (2004) Algebras of Lstrok; ukasiewicz Logic and their semiring reducts. In: Litvinov GL, Maslov VP (eds) Proceedings of the conference on idempotent mathematics and mathematial physics Droste M, Gastin P (2005) Weighted automata and weighted logics. In: Proceedings of 32nd international colloquium on automata, languages and programming (ICALP’05), LNCS, Springer, Lisboa Dvurecˇenskij (2002) Pseudo-MV algebras are intervals in l-groups. J Austral Math Soc 72:427–445 Dvurecˇenskij, Pulmannova´ (2000) New trends in quantum structures. Kluwer, Dordrecht Eilenberg S (1974) Automata, languages, and machines. Academic, New York Georgescu G, Iorgulescu A (2001) Pseudo-MV algebras. MultiValued Logic 6:95–135 Gerla B (2003) Many-valued Logic and semirings. Neural Netw Worlds 5:467–480

123

280 Gerla B (2004) Automata over MV algebra. In: Proceedings of 34th international symposium on multiple-valued logic, pp 49–54 Hajek P (2003) Observations on non-commutative fuzzy logic. Soft Comput 8:38–43 Ignjatovic´ J, C´iric´ M, Bogdanovic´ S (2008) Determinization of fuzzy automata with membership values in complete residuated lattices. Inf Sci 178:164–180 Hopcroft JE, Motwani R, Ullman JD (2001) Introduction to automata theory, languages, and computation, 2nd edn. Addison Wesley, Krob D (1998) Some automata-theoretic aspects of min-max-plus semirings. In: Gunawardena J (eds) Idempotency. Cambridge University Press, Cambridge, pp 70–79 Li ZH, Li P, Li YM (2006) The relationships among several types of fuzzy automata. Inf Sci 176:2208–2226 Li YM, Pedrycz W (2005) Fuzzy finite automata and fuzzy regular expressions with membership values in lattice-ordered monoids. Fuzzy Sets Syst 156:68–92

123

X. Lu et al. Li YM, Pedrycz W (2006) The equivalence between fuzzy Mealy and Moore machines. Soft Comput 10:953–959 Ying M (2005) A theory of computation based on quantum logic (I). Theor Comput Sci 344(2):134–207 Rachunek J (2002) A non-commutative generalized of MV-algebras. Czechoslovak Math J 52:255–273 Simon I (1988) Recognizable sets with multiplicities in the tropical semiring. Lect Notes Comput Sci 324:107–120 Shang Y, Lu R (2007) Semirings and pseudo MV algebras. Soft Comput 11:847–853 Sheng L, Li YM (2006) Regular grammars with values in latticeordered monoid and their languages. Soft Comput 10:79–86