Some Properties of Brzozowski Derivatives of Regular ... - arXiv

42 downloads 0 Views 78KB Size Report
An elegant construction of deterministic finite automata based on the derivatives of regular expressions was proposed by J.A Brzozowski [2] in the year 1964.
International Journal of Computer Trends and Technology (IJCTT) – volume 13 number 1 – Jul 2014

Some Properties of Brzozowski Derivatives of Regular Expressions N.Murugesan #1, O.V.Shanmuga Sundaram*2 #1

Assistant Professor, Dept of Mathematics, Government Arts College (Autonomous), Coimbatore – 641018, Tamil Nadu, India, *2 Assistant Professor, Dept of Mathematics, Sri Shakthi Institute of Engineering & Technology, Coimbatore – 641062, Tamil Nadu, India. Abstract :- Brzozowski’s derivatives of a regular expression are developed for constructing deterministic automata from the given regular expression in the algebraic way. In this paper, some lemmas of the regular expressions are discussed and the regular languages of the derivatives are illustrated. Also the generalizations of the Brzozowski’s derivatives are proved as theorems with help of properties and known results. AMS MSC2010 Certification: 68Q45, 68Q70



alphabet  . The set of all words over  is denoted by  . The empty word is denoted by  . A regular expression is defined inductively as (i)  is a regular expression. (ii) For any a   , the symbol ‘a’ is a regular expression. (iii) If E and F are regular expressions, 

Keywords— Regular expressions, derivatives, and Kleene Closure.

I. INTRODUCTION Regular expressions are declarative way of defining regular languages recognized by a DFA or a NFA. They are equivalent to one another in the sense that, for a given regular expression, it can be constructed a finite state automata recognizing the same language described by the regular expression, and vice–versa. All over the years, various attempts have been made to accomplish this task. In the year 1960, R.McNaughton and H.Yamada [6] provided an algorithm to construct a non – deterministic finite automaton from a regular expression. G.Berry and R.Sethi [1] discussed the theoretical background for the R.McNaughton and H.Yamada algorithm. V.M.Glushkov [4] has also given a similar algorithm in the year 1961. An elegant construction of deterministic finite automata based on the derivatives of regular expressions was proposed by J.A Brzozowski [2] in the year 1964. J.E.Hopcroft and J.D.Ullman [5] discussed the construction of  - NFA from the given regular expression. J.M.Champarnaud and others [3] described a variant of the step by step construction which associates standard and trim automata to regular languages. In this paper, we discuss some basic set theoretic properties involved in Brzozowski way of constructions of automata have been discussed. II. REGULAR EXPRESSIONS Let  be an alphabet of symbols. A word over an alphabet  is a finite sequence of symbols from that

ISSN: 2231-5381

then E  F , EF ,  E  are all regular expressions. The regular expressions E  F , EF ,



E

are called

respectively union, concatenation, Kleene closure of the corresponding regular expressions. The language of a regular expression E is denoted as L  E  , and defined the same for various regular expressions as follows. (i) L      (ii) L  a   a

.

(iii) L  E  F   L  E   L  F  (iv) L  EF   L  E  L  F 

 

( v) L E    L  E  



The empty set  is also considered as a language of regular expression denoted by the symbol  itself. It is assumed that E      E  E;

E   E  ;

 E  E  E

The properties of the regular languages are discussed in [9]. The following lemma gives some algebraic type identities with respect to regular expressions. 2.1 Lemma Let E and F are any two regular expressions. Then,

i  ii 

EF  F E EF  FE only when

 a E  F or  b oneof E, F is  or . .  iii   E  F   G  E   F  G  iv  v

 

E 

 E

E  F  G  E F  EG

http://www.ijcttjournal.org

Page 29

International Journal of Computer Trends and Technology (IJCTT) – volume 13 number 1 – Jul 2014 Not all algebraic type identities are hold in the case of regular expressions.

 D  ab



a

.

a

3.2 Examples



i   E  F   E  F    ii   EF   E  F   iii 



Let E  a  a  b 

1

.



Then D a  E    a  b 

EF  FE Provided that E and F are not equal to  or  .

Db  E    

Let E  ab  a  b 

2



2.3 Lemma:

Then D a  E   b  a  b  

 i    a 

 a



(vi)   aa  a 





Db  E     

(ii) a    a   a (vii)  a  b   a b



Let E   a  b  a

3









(iv) b  ab  ab 



(v) b  ba  ba

(ix)  a  a    a 



  a  b  a  

 

(xv) 





      a  b  a  

(xiv)  a  a  a

(xii)  a  b c  ac  bc 



  Da  a   Da  b   a  b  a  



( x)   a  a

a b  c  ab  ac



 a  b  a  



Db  E    Db 

  

(xiii)  a  b  a  b  ab



 Then D a  E    D a  a  b   a  D a  a        Da   a  b     a  b   a    

(iii)    a   a  a (viii) a  a   

 xi



a

2.2 Lemma: For any two regular expressions E and F, then,

    a   D  ab   D  a 

Da ab  a  Da ab  Da  a 

 a  b   a  D  a  

b

    Db   a  b     a  b   a    

Some of the proofs of the equivalent regular expressions given in the above lemmas are proved in [7].



  Db  a   Db  b    a  b  a 

      a  b  a

III Derivatives of Regular Expressions 3.1 Definition Given a language L and a symbol ‘a’, the derivative of L with respect to a symbol a is defined as



  a  b  a 

 a  b  a

.

Da  L   b ab  L . The derivatives of regular expressions with respect to a symbol are defined as follows: 1 D a 



D a 





D a   a

  if b  a 2 D a b    O th er w ise  3 Da E  F   Da E   Da F

.



 D a  E  F  D a  F  if   L  E 4 D a E F    o th e rw ise  D a  E  F



 

5 Da E   Da E  E  6 D

E  

E

7

Dwa E



Da Dw E



The operator D is treated as a prefix operator with high precedence than “+”, “.” and “*”. The derivatives involving the operators intersection, and complement are defined by

Da  E  F   Da E  Da F and

Da  E  F   Da E  Da F .

It can be verified that

ISSN: 2231-5381

3.3 Definition Let L be a regular language. We define

  if   L  E      if   L It can be easily seen that i    a    ,

fo r a n y a  

 ii       , a n d       iii    E  F     E     F   iv    E     3.4 Definition Let w  a1a2 ....an and E be a regular expression. Then,

D a1 a 2

E  

D a1 a 2 a 3

http://www.ijcttjournal.org

D a2

E  

 D  E   D  E 

D a3

a1

a1 a 2

Page 30

International Journal of Computer Trends and Technology (IJCTT) – volume 13 number 1 – Jul 2014 In general, we have

Dw  E   Da1a2 a3 ....an  E 

Similarly, we can generalize



 Dan Da1a2 ..... an1  E 





3.5 Theorem Let E, F are two regular expressions and the word w  a1a2 ....an .a string over the Kleene closure of an alphabet  .

       D  E  D EE  ....    D  E     D  E   ....  D  E   D  E 

Da1a2a3 .....an E   Da1a2a3 ....an  E  E 

Then,

a1



a1









    w  aw 

   E  Da1a2  F 

Hence the corresponding regular expression is

In general,



D   D   D   D

EF  



  w  aw  .

 E  F

a 1 a 2 .... a n

a1 a 2 .... a n  1

 E  D  F 

a1 a 2 .... a n  2

 E  D

a n 1 a n

a1 a 2 .... a n  3

 E  D

a n  2 a n 1 a n

D

 .....  

P D

a1

3.9 Lemma Let E be regular expression, then

an

 E  D F 

F 

a 2 a 3 .... . a n

F 

  Da L aE   L E L aE , where a .  

L aE

F 



a1 a 2

  

Case (i): Let E   , then





   D  E  E    D  E    D  E  E    D  E  D  E    D  E  E    D  E   D  E  E    D  E    D  E  D  E 





E   , then L  Da  E    Da  L  E     .

a1



a3

a1

a2a3



ISSN: 2231-5381

a2

a3

E   and E   .

Hence the theorem is true when Case (ii): Let E  a .



a2



a1



On the other hand, if



a1a2a3

a1a2a3

L E  ., and Da  L  E     .

Also Da      , and L Da      .

  Da1  E  Da2a3 E

a2 a3





Proof:

a2

Da1a2a3 E  Da1a2a3  E  E



   E , E a E , ....    E  , a E , a E a E , ....

L  Da  E    Da  L  E   .



a1





3.10 Theorem Let E be any regular expression and a be any symbol over the alphabet  .



a1



  , a E , a E a E , ....

 L  E  L a E

 E    D  E  E  E    D  E  E    D  E  D E  





D a  L a E 

a 2 a 3 .... . a n

3.7 Theorem Let the word w  a1a2 ....an . Then,

a1 a 2





 Da L  aw     , w, waw, wawaw,....       w , aw, awaw,....





where a , w

 L  aw     , aw, awaw, awawaw,....  

Da1a2  EF   Da1a2  E  F    E  Da1  E  Da1  F 

D

an

Proof:

Da1  EF   Da1  E  F    E  Da1  F 

a1

an 1

  Da  aw     w aw ,  

3.6 Theorem Let E, F are two regular expressions and the word w  a1a2 ....an . Then,

D

a2

3.8 Lemma

Dw E  F   Dw E   Dw F

D a1 a 2 .... a n

a2 a3 .... an







Then, Da  a    . Hence L Da  E     . Also

L  E   a ., and Da  L  E      .

http://www.ijcttjournal.org

Page 31

International Journal of Computer Trends and Technology (IJCTT) – volume 13 number 1 – Jul 2014 If Case

E  b  a , then L  Da  E    Da  L  E     .

E  F G . Da  E   Da  F   Da  G  . (iii):Let

F  aF ' Da  E   F ' G ' .and

Suppose,

if

We

first

trivially true. If Da  F   F ' F  , then

,then

L Da E

prove

G  aG '

and











Da  L  E    Da L  aF '





.





In the second case, L  F   bw b  a, w  



.and L  G   bu b  a, u  







.





L  E   bw, bu b  a, w, u   .



alphabet  . Then D w  E   D a n

D

a1 a 2 a 3 .... a n 1

 E  .

w   then Dw E  E , As an illustration, let w  aba and E   a  b ab .then Suppose if

 a  b  a b   D  a  b  a b  D  D  a   D  b   a b .  D      a b

D w  E   D a ba  Da



Therefore, Da L  E        .

 Da



Hence L Da  E   Da L  E  ,

 Da

When E  F  G .

ab

b

a

a

b

 D a   a b   a b  

Case (iv): Let E  FG . Suppose if F and G are two regular expressions begin with a symbol ‘a’, then it can be found as in the case (iii), that

L Da  E   Da  L E   L F ' L G' . Similarly, if F and G are regular expressions begin with other than ‘a’, it can be found as

L Da  E   Da  L E   . Case (v):

 

Let E  F , then Da  E   Da F



 Da  F  F  .

Again there are two possibilities, say

F  aF ' or F  bF ' when a  b .  In the first case, Da  F   F ' and Da  F   F ' F . In the second case, Da  F    . Therefore Da  E    .

ISSN: 2231-5381



3.11 Theorem Let w  a1a2 ....an , and E be a regular expression over an





.

This proves the theorem.

i.e., Da L  E   L  F '   L  G '  .





 L  F '  L  F  

L  E   aL  F '   aL  G '  .





Hence L Da  E   Da L  E  .











.

Hence L  E   aw, au w, u  





. 

Hence

Da  E    and L  Da  E     .





 

L  E   L F  L  aF '

In the first case, L  F   aw w ,

Hence



L  F ' L F 

is

On the other hand, if E  F and F  aF '  aw . Then

Da  F     Da  G 





 





Let F and G are two regular expressions begin with a symbol other than ‘a’. Then

and L  G   au u  



 L  F ' L  F

L  Da  E    L  F '  L  G ' 

Hence



Hence the statement L Da  E   Da L  E 

Generalizing the above illustration, the following theorems are obtained. 3.12 Theorem Let

w  n and

E  m; n  m

;

.

then

Dw  E    . 3.13 Theorem If E  w , then

Dw  E    .

3.14 Theorem 

If w  au , u   , and

E  av, v   . Then

Dw  E   Du  v  , where a   . Proof: Let u  a1a2 ....an . Then

http://www.ijcttjournal.org

Page 32

International Journal of Computer Trends and Technology (IJCTT) – volume 13 number 1 – Jul 2014



D w  E   D a n D a1 a 2 a 3 .... a n 1  E 

  D D D D

the size of the derivatives of the expressions research oriented work.



 D a n D a n 1 D a1 a 2 a 3 .... a n  2  E   D an  D an



a n 1

an  2

a n 1

an  2



REFERENCES

 D  E  ....   v ....

[1].

a

[2]. [3].



 D a n D a1 .... a n 1 v

[4].

 D a1 a 2 a 3 .... a n  v 

[5].

 D u v 

[6]. [7].

3.15 Theorem 

[8].

If w  au ; E  bv, where a, b  and u, v  , Then

Dw  E    . [9].

III. CONCLUSION Brzozowski derivatives of the regular expressions are always helpful tool for constructing DFA. The generalizations of the derivatives are useful for transforming

ISSN: 2231-5381

Berry G, Sethi R, From regular expressions to deterministic automata, Theoretical Computer Science 48 (1986), 117 – 126. Brzozowski J.A, Derivatives of regular expressions, J.ACM 11(4):481- 494, 1964. Champarnaud J.M, Ponty J.L, Ziadi D, From regular expressions to finite automata, Int.J. Com.M, 72(4), 1999, 415 – 431 Glushkov V.M, The Abstract Theory of Automata, Russian Mathematical Surveys 16(1961), 1-53. Hopcroft J.E and Ullman J.D, , Introduction to Automata Theory, Languages and Computation, Addison – Wesley, 1979. McNaughton R, Yamada H, Regular expressions and state graphs for automata, IRE Trans. on Electronic Computers EC-9:1 (1960) 38 – 47. Murugesan N, Principles of Automata theory and Computation, 2004, Sahithi Publications. Murugesan N and Shanmugasundaram O.V, Construction of State diagram of a regular expressionusing Derivatives,www.mhikari.com/ams/ams-2012/ams.../sundaramAMS21-242012.pdf,Applied Mathematical Sciences, Vol. 6, 2012, no. 24, 1173 – 1179. Yu S, Regular Languages, in: A.Salaomaa, eds., Handbook of Formal Languages, Vol. I, Springer-Verlag, Berlin, 1997, 41 – 110.

http://www.ijcttjournal.org

Page 33

Suggest Documents