Parallel Composition of Words with Re-entrant Symbols - CiteSeerX

0 downloads 0 Views 198KB Size Report
traces u and v, u; v 2 , then one obtains the shu e of u and v, denoted uttv, and de ned ..... Proof. (i) Without loss of generality we can assume that L a+. 1 a+. 2 :::a+ n . .... some L1, L2 in R . From Proposition 13 (i) we deduce that L./ = L./. 1 ./ L./.
Parallel Composition of Words with Re-entrant Symbols Alexandru Mateescu Arto Salomaa

Turku Centre for Computer Science TUCS Technical Report No 15 May 1996 ISBN 951-650-757-3 ISSN 1239-1891

Abstract We introduce and investigate an operation for words and languages, referred to as the re-entrant product. This operation is related to parallel composition of concurrent processes that contain re-entrant routines. Intuitively the reentrant product of two words contains all traces of the parallel execution of these words assuming that the atomic actions are re-entrant routines. This paper investigates language-theoretic properties of re-entrant products.

TUCS Research Group

Mathematical Structures of Computer Science

1. Introduction

Let  be an alphabet. The set of all words over  is denoted by  and  is the empty word. A word w = a a : : : an 2 , ai 2 , 1  i  n, can be considered as the trace of a process, where ai, 1  i  n, are atomic actions. If one considers all the traces of the parallel execution of two processes with traces u and v, u; v 2 , then one obtains the shue of u and v, denoted uttv, and de ned formally by: 1 2

(auttbv) = a(uttbv) [ b(auttv);

and

(utt) = (ttu) = fug; where u ,v 2  and a ,b 2  . The shue operation is extended in a natural way to languages : the shue of two languages L and L is : 1

L ttL = 1

2

2

[

u2L1 ;v2L2

uttv:

It is well known that the shue operation is a commutative and an associative operation with the unit element . The shue operation is not suitable to describe the existence of re-entrant routines. A re-entrant routine, see [1], [3], is a routine that can be executed concurrently by more than one user (process). Throughout this paper the reader may consult the monograph [15] for all unexplained notions of formal languages. For general results concerning the theory of semirings, the reader may consult the monographs [5] and [9]. Related problems of re-entrant routines are studied also in [6] and [10]. Consider the following version of the Latin product, denoted by . If u = a a : : :an and v = b b : : :bm are words over , then 1 2

(

1 2

b u  v = aa aa :: :: :: aanbb bb :: :: :: bbm;; ifif aan = n m n 6= b 1

2

2 3

1

1

2

1 2

1

By de nition, u   =   u = u. It is easy to observe that the ordered system M = (; ; ) is a monoid, called the Latin monoid. Let  be the embedding of  to M, i.e.,  :  ?! M, (a) = a, for all a 2 . Clearly,  can be extended to a unique morphism of monoids

fl :  ?! M: 1

The set of at-words over , denoted Fl() is the set of all xed points of the morphism fl, i.e.,

Fl() = fw 2  j fl(w) = wg: For instance, if  = fa; bg, then aba, baba are in Fl(), but ab a, b a b are not in Fl(). Note that the set of at-words, Fl(), is exactly the set of all words free of square letters. The at-image of an word w is by de nition the word fl(w). For instance, fl(ab a) = aba, fl(b a b) = bab. If w is in Fl() the the at-image of w is w. De nition 1. Let w = ai1 ai2 : : :ainn be a nonempty word over , where ai 2 , 1  i  n and ij  1, for all j , 1  j  n, and, moreover, ak is di erent of ak , for all 1  k  n ? 1. The power of w is the vector p(w) = (i ; i ; : : :in). 3

3

2 2

2 2

1

2

+1

1

2

De nition 2. The re-entrant order or r-order, denoted r, is de ned as u r v i fl(u) = fl(v) and p(u)  p(v); where u; v 2  . (Here p(u)  p(v) means the componentwise order between vectors of nonnegative integers.) By de nition,  r w, for any w 2 . +

Remark 3. The relation r is a partial order relation on  with the

rst element .

Example 4. Note that, for instance ba b r b a b, whereas ba b and ba 2

2 3

2

are not comparable.

The proof of the following proposition is omitted.

Proposition 5. (i) If ui r vi, 1  i  n, then u u : : : un r v v : : :vn. (ii) If u r v v : : :vn, then there are ui, 1  i  n, such that u = u u : : : un and ui r vi, 1  i  n. (iii) If u u : : :un r v, then there are vi, 1  i  n, such that v = v v : : :vn and ui r vi, 1  i  n. 1

2

1 2

1

2

1

2

1 2

2

1 2

2. The re-entrant product

In this section we introduce the main operation of this paper, called the re-entrant product. De nition 6. Let L be a language. The downr mapping is de ned as:

downr (L) = fu j u r v; for some v 2 Lg: Note that downr is a closure operator. De nition 7. Let u and v be words over . The re-entrant product of u with v, denoted u ./ v is:

u ./ v = downr (uttv): The above operation is extended in the natural way to languages. If L and L are languages, then: 1

2

L ./ L = 1

2

[

u2L1 ;v2L2

u ./ v:

Note that

L ./ L = downr (L ttL ): The re-entrant product is a monotonous operation in each argument. 1

2

1

2

Theorem 8. The re-entrant product is a commutative and associative operation. Proof. Obviously, ./ is a commutative operation. Now assume that x 2 u ./ (v ./ w), where x; u; v; w 2 . It follows that there is a word t = u0 1u1 : : : n un such that x r t, where u0u1 : : : un = u and 1 2 : : : n 2 v ./ w. Hence, there exists z 2 v ./ w such that 1 2 : : : n r z. From Proposition 5, (iii), it follows that z = z1z2 : : : zn, such that i r zi, 1  i  n. Note that y = u0z1u1 : : :zn un is in utt(vttw) and thus in the set (uttv)ttw. Moreover, x r t = u u : : : n un r u z u : : : znun = y 2 (uttv)ttw: 0 1

1

0 1

1

Thus, x 2 (uttv) ./ w. Since (uttv) ./ w  (u ./ v) ./ w we conclude that x 2 (u ./ v) ./ w. Note that ./ is distributive over union, but ./ does not have unit element. Thus we obtain: 3

Corollary 9. Let  be an alphabet. The quadruple Hr = (P (); [; ./; ;) is a commutative hemiring (i.e., a semiring without unit element for the multiplication operation, see [5], [9]).

De nition 10. Let L be a language. The shue closure of L, denoted by Ltt , is de ned by [ Ltt = Lk tt ; (

)

k0

where Lk tt denotes the shue product of L with itself (k ? 1)-times, if k  2. L tt = fg and L tt = L. Analogously, the re-entrant closure of L is denoted by L./. Thus, [ L./ = Lk ./ ; (

)

0(

)

1(

)

(

)

k0

where Lk ./ denotes the re-entrant product of L with itself (k ? 1)-times, if k  2. Moreover, L ./ = fg and L ./ = L. (

)

0(

)

1(

)

In the next sections we will show that there are some signi cant di erences between the shue closure operator and the re-entrant closure operator.

3. Some properties of the re-entrant product

Here we present some properties of the re-entrant product and of the re-entrant closure operator. Proposition 11. Let L be an arbitrary language. (i) L./ = (downr (L))./: (ii) L./ = (L)./: (iii) L./ = (Ltt )./: Proof. Since the operator downr is distributive over union and idempotent, we obtain the equality (i). Now observe that L  L  L./ and thus, L./  (L)./  (L./)./ = L./. Similarly, one can show the equality (iii).

The proof of the following proposition is omitted. Proposition 12. Let L; L ; L be languages. 1

2

4

(i) L./ ./ L./ = L./: (ii) (L./ ./ L./)./ = L./ ./ L./: 1

2

1

2

Proposition 13. Let L and L be languages. 1

2

(i) (L [ L )./ = L./ ./ L./. 1

2

1

2

(ii) If  2 L \ L , then (L L )./ = L./ ./ L./. 1

2

1

2

1

2

Proof. (i) Note that (L1 [ L2 )  L./1 ./ L./2 . Hence (L1 [ L2 )./  (L./1 ./ L./2 )./. From Proposition 12, (ii) it follows that (L1 [ L2)./  L./1 ./ L./2 . Obviously, the converse inclusion does hold. (ii) Observe that since  2 L1 \ L2, it follows that L1L2 = L1 [ L2 [ L1L2. Therefore, (L1 [ L2)./  (L1L2)./. For the converse inclusion, it is easy to see that for all k  0,

(L L )k tt  (L [ L ) k tt : 1

2

(

)

1

2

2 (

)

Hence, (L L )./ = (L [L )./ and using the equality (i) we obtain the equality (ii). 1

2

1

2

Proposition 14. Let A; B; C be languages. Then, (AB C )./ = (ABC )./: +

Obviously, (ABC )./  (AB +C )./. Now observe that AB +C = S Proof. k k1 AB C . One can show that

downr (AB k1 C tt : : : ttAB kn C )  downr ((ABC ) k1 (

:::+kn )(tt) ):

+

Therefore the equality holds.

Proposition 15. Let A be a full AFL. (i) A is closed under the operator downr . (ii) If A is closed under shue, then A is closed under the re-entrant product, ./.

5

Proof. (i) Let L   be a language in A. We de ne a GSM , M = (Q; ; ; ; q0; F ) such that L(M ) = downr (L). Q = fq0g [ fqa j a 2 g, F = Q, (q0; a) = f(qa; a)g, for all a 2 . (qa; a) = f(qa; a); (qa; )g and if a 6= b, then (qa; b) = f(qb; b)g. One can verify that L(M ) = downr (L). (ii) It follows from (i) and the closure of A under shue.

Corollary 16. The families of regular languages and of recursively enumerable languages are closed under the re-entrant product. Remark 17. The family of context-free languages is not closed under the re-entrant product. Consider the languages: L = f(ab)n(cd)n j n  1g and L = f(ef )m(gh)m j m  1g. Let L be the language L ./ L . Observe that the language L0 = L \ (ab) (ef ) (cd) (gh) is not context-free and 1

2

+

+

+

+

1

2

hence L ./ L is not context-free. 1

2

4. Some properties of the re-entrant closure

In this section we prove some properties of the re-entrant closure. We will show that in many respects the re-entrant closure is di erent from the shue closure, although, apparently, they seem to be closely related: L./ = downr (Ltt ). Remark 18. The shue closure of a word can be a non-context-free language. Let w be the word abc and consider the language L = wtt = (abc)tt. Since L \ a b c = fanbncn j n  0g: we conclude that L cannot be a context-free language. If w = ab, then wtt is the Dyck language over fa; bg which is a context-free language but not a regular language. In general, one can show that the shue closure of a word w is a regular language if and only if w is a word over a one-letter alphabet. However, this is not the case for the re-entrant closure of a word. Theorem 19. Let w be a word over some alphabet . The re-entrant closure of w, w./ , is a regular language. Proof. Firstly, we will show the property for some xed words and then we will give the general construction. Assume that w = ab and  = fa; bg. We will prove that (ab)./ = ab [ fg: () Obviously, (ab)./  ab [fg. For the converse inclusion, note that  is in (ab)./ and let u = avb be a word from ab. The proof is by induction on + + +

6

the length n of v. If n = 0, then u = ab 2 (ab)./. Assume that the property holds for words v of length n and let v be a word of length n +1. Then v = av0 or v = bv0 for some word v0 of length n. By the inductive assumption, av0b 2 (ab)./. Hence there is a k  0 such that av0b 2 downr ((ab)k tt ). Therefore, there is t = at0b 2 (ab)k tt such that av0b r at0b. Now observe that z = aat0bb 2 (ab) k tt and that aav0b r aat0bb. Hence avb = aav0b 2 (ab)./. For the second case, i.e., v = bv0, de ne the word z as being z = aabt0b and note that again abv0b r z and z 2 (ab) k tt . Hence the equality () holds. Assume that w = abc and  = fa; b; cg. A similar proof shows that: (

(

( +1)(

)

)

)

( +1)(

)

(abc)./ = a bbc [ a bc [ fg: +

+

+

()

+

In general, assume that w = a a : : : an is a word over some alphabet , where ai 2 , 1  i  n. We start by de ning recursively the languages Li, 2  i  n ? 1 and Kj , 2  j  n ? 1 as follows: L = a a , K = a, Li = (Li ai ) (K [ : : : [ Ki)ai , Ki = (Liai ), where 2  i  n ? 2. Similarly, we de ne Rn? = an? an , Jn? = an, Rn?i? = an?i? (Jn?i [ : : : [ Jn? )(an?iRn?i ) , Jn?i? = (an?i Rn?i ), where 1  i  n ? 3. One can verify the following claims: (i) If uai 2 Pref (wtt ) and j u jai =0, then uai 2 Li, for all 2  i  n ? 1. (ii) If aj v 2 Suf (wtt ) and j v jaj =0, then aj v 2 Rj , for all 2  j  n ? 1. Now consider the set An? ; = Ln? R . Observe that if t is a word from wtt such that the rst (leftmost) occurrence of an? precedes the last (rightmost) occurrence of a , then t 2 An? ; . Now we consider the set Bn? ; such that this set contains all the words t from wtt such that the rst (leftmost) occurrence of an? does not precede the last (rightmost) occurrence of a , i.e., all occurrences of a precede all occurrences of an? . The set Bn? ; is obtained from the set An? ; = Ln? R = (: : :)an? a (: : :) by replacing the expression an? a with the expression a ;n? an? , where  ;n? = fa ; : : :; an? g. We continue the above process for all pairs of indices (i; j ), with i > j , until we obtain the language Bk ;k = a a : : : an , for some 2  k  n ? 1. Let M be the language obtained as the union of An? ; with all these languages Bj;i. Claim: w./ = downr (M ). Proof of Claim. One can easily see that wtt is a subset of M and therefore w./ = downr (wtt )  downr (M ). For the reverse inclusion consider a word u 2 M . We omit the details of an inductive argument based on the length of u (see the example for  = fa; bg 1 2

+

+1

2

+1

+

1

+ 1 2

2

1

1

+1 +

1

2

1

1

1

12

1

2

1

2

12

12

1

2

2

1

12

12

1

3

2

3

1

2

2

+ 2

1

3

2

+ + 1 2

+1

+

12

7

2

+

2

1

1

and  = fa; b; cg), showing that there is a word z 2 wtt such that u r z. Hence, u 2 downr (wtt ) = w./. Finally, note that M is a regular language and from Proposition 15, (i), we conclude that downr (M ) = w./ is a regular language.

De nition 20. A language L is strictly bounded i L  aa : : :an for some letters a ; a ; : : : ; an. A language L is bounded i L  ww : : :wn for 1 2

1

2

1

2

1

some words w ; w ; : : :; wn .

2

Theorem 21. Let L be an arbitrary strictly bounded language. (i) The language downr (L) is a regular language. (ii) The language L./ is a regular language. Proof. (i) Without loss of generality we can assume that L  a+1a+2 : : :a+n . (Otherwise L is a nite union of languages, each of them being a subset of some a+j1 a+j2 : : :a+jm , where 1  jf  n, 1  f  m.) If L is a nite language, then downr (L) is a nite language and thus a regular language. If L is a an in nite language, then let i1; i2; : : :; ik be all those indices in f1; 2; : :+: ; ng with the property that L contains an in nite number of subwords from ait , 1  t  k. Moreover, if ir is an index not in fi1; i2; : : : ; ikg, then let mr be the largest power of a word in a+ir that is a subword in L. One can verify that downr (L) = ap11 ap22 : : : apnn ; where ps = + if ps 2 fi1; i2; : : : ; ik g and ps = ms, otherwise. Therefore, from Proposition 15, (i), downr (L) is a regular language. (ii) Firstly assume that L  a+1 a+2 : : : a+n . From (i) we deduce that

downr (L) = ap1 ap2 : : : apnn ; where ps = +, if ps 2 fi ; i ; : : :; ik g and ps = ms, otherwise. Now using Proposition 14, we obtain that 1

1

2

2

L./ = (aq1 aq2 : : :aqnn )./; where qs = 1, if ps = +, and qs = ps , otherwise. Observe that the language F = aq1 aq2 : : : aqnn is nite, say F = fv ; v ; : : :; vmg. From Proposition 13, (i), it follows that: L./ = F ./ = v./ ./ v./ ./ : : : ./ vm./: 1

2

1

1

2

2

1

8

2

By Theorem 19 and from Corollary 16 we conclude that L is a regular language. Now consider the general case, i.e., L = L [ L [ : : : [ Ln , where each Li is a subset of some aj1 aj2 : : :ajm . By Proposition 13, (ii), L./ = L./ ./ L./ ./ : : : ./ L./n. From the above proof and using Corllary 16, we conclude that L./ is a regular language. +

+

1

+

2

1

2

Note that in the above Theorem 21, the language L is not necessarily a recursively enumerable language and still downr (L) and L./ are regular languages. Moreover, observe that although L is a strictly bounded language, the language L./ can be even non-bounded. The results from Theorem 21 are not true for bounded languages. For instance, the language L from Remark 17 is a bounded language. Observe that downr (L ) = L and, obviously, L is not a regular language. Let L , L be the languages from Remark 17 and consider the language L = L [ L . Note that L is a bounded context-free language but L./ is not a context-free language (see the argument from Remark 17). Now we will extend the result of Theorem 19 to a certain family of regular languages. Notation. If L is a language, then L = L [ fg. De nition 22. The family of strong -regular languages, denoted R, is the smallest family of languages such that: 1

1

1

1

1

2

1

2

(i) If F is a nite language, then F is in R. (ii) The family R is closed under union, catenation and Kleene star operations.

Remark 23. Note that if a language L is in R, then L is regular. The

converse is not true. Moreover, there are regular languages that contain  and which are not in R. For instance the language L = a b [ fg is a regular language that contains  but L is not in R. + +

Theorem 24. If L 2 R, then L./ is a regular language. Proof. Let L be a language in R. The proof is by induction on the structure of L. If L = F for some nite language F = fu ; u ; : : : ; ung, then from Proposition 13, (i), it follows that:

L./ = u./ ./ u./ ./ : : : ./ u./n: 1

2

9

1

2

By Theorem 19 and from Corollary 16 we conclude that L is a regular language. Now consider the inductive step. Firstly, assume that L = L [ L , for some L , L in R. From Proposition 13 (i) we deduce that L./ = L./ ./ L./. By the inductive assumption L./ and L./ are regular languages. Since the re-entrant product of regular languages is a regular language, it follows that L./ is a regular language. Assume that L = L L , for some L , L in R. Note that  2 L \ L . Hence, by Proposition 13, (ii), L./ = L./ ./ L./. By the inductive assumption L./ and L./ are regular languages and thus L./ is a regular language. Finally, consider that L = L for some L in R. From Proposition 11, (ii), we deduce that L./ = L./. Therefore, by the inductive assumption, L./ is a regular language. 1

1

2

1

1

1

2

2

2

1

1

1

2

2

1

2

2

2

1

1

1

However, the following problem remains open: Open Problem. Let L be a regular language. Is L./ a regular language? We state one more property of the re-entrant product. Theorem 25. Let L be a language over an alphabet . There exists a nite language F such that L ./  = F ./ . Proof. From Higman's Theorem, it follows that there is a nite language F such that Ltt = F tt. Hence, L ./  = downr (Ltt) = downr (F tt) = F ./ .

5. Conclusions

The re-entrant routines are used in many operating systems like for instance in the kernel of UNIX, LINUX, etc. An algebraic development of processes was initiated in [13], namely CCS . An important contribution on this line is the paper [4], see also [2], that is the starting point for a more algebraic theory of concurrent processes. Here we model some aspects of parallel compositions of concurrent processes that contain re-entrant routines. For other versions of the shue operation the reader may consult [6], [7], [8], [12]. The in ltration operation considered in [14], see also [11], is an alternative product for modeling some aspects of the use of re-entrant routines in parallel execution of processes. We hope to continue this study in a forthcoming paper.

10

7. References 1. T. Axford; Concurrent Programming Fundamental Techniques for Real Time and Parallel Software Design, John Wiley & Sons, New York, 1989. 2. J.C.M. Baeten, W.P. Weijland; Process Algebra , Cambridge Tracts in Theoretical Computer Science 18, Cambridge University Press, Cambridge, 1990. 3. M. Ben-Ari; Principles of Concurrent and Distributed Programming, Prentince Hall international series in computer science, C.A.R. Hoare, Series Editor, Prentice Hall International, 1990. 4. J.A. Bergstra, J.W. Klop; Algebra of Communicating Processes , in Math. and Comp. Sci., ed. J.W.Bakker, M.Hazewinkel, J.K.Lenstra, North-Holland, Amsterdam, 1986, 89-138. 5. J.S. Golan; The Theory of Semirings with Applications in Mathematics and Theoretical Computer Science , Longman Scienti c and Technical, Harlow, Essex, 1992 (Pitman Monographs and Surveys in Pure and Applied Mathematics 54). 6. J. S. Golan, A. Mateescu, D. Vaida; Semirings and Parallel Composition of Processes, submitted. 7. M. Kudlek, A. Mateescu; Distributed Catenation and Chomsky Hierarchy. Fundamentals of Computation Theory, FCT'95, Dresda, Lecture Notes in Computer Science, LNCS 965, Springer Verlag, 1995, 313-322. 8. M. Kudlek, A. Mateescu; Rational and Algebraic Languages with Distributed Catenation. Developments in Language Theory, DLT'95, Magdeburg, 1995, to appear in World Sci. Publ. 9. W. Kuich, A. Salomaa; Semirings, Automata, Languages, EATCS Monographs on Theoretical Computer Science, Springer-Verlag, Berlin, 1986. 10. M. Lipponen, T. Harju, A. Mateescu; Flatwords and Post Correspondence Problem, to appear in Theoretical Computer Science, TCS. 11. M. Lothaire; Combinatorics on Words , Addison-Wesley Publ.Comp., Reading Mass., Encyclopedia of Math. and Appl., vol. 17, Gian-Carlo Rota, Ed., 1983. 11

12. A. Mateescu; On (Left) Partial Shue, in: Results and Trends in Theoretical Computer Science, Graz, June, 1994, LNCS 812, SpringerVerlag, (1994) 264-278. 13. R. Milner; A Calculus of Communicating Systems, LNCS 92, SpringerVerlag, Berlin, 1980. 14. J. Sakarovitch, I. Simon; Subwords, in Combinatorics on Words, M. Lothaire, Addison-Wesley, Read. Mass., 1983. 15. A. Salomaa; Formal Languages, Academic Press, New York, 1973.

12

Turku Centre for Computer Science Lemminkaisenkatu 14 FIN-20520 Turku Finland http://www.tucs.abo.

University of Turku  Department of Mathematical Sciences

 Abo Akademi University  Department of Computer Science  Institute for Advanced Management Systems Research

Turku School of Economics and Business Administration  Institute of Information Systems Science

Suggest Documents