NFA for basic regular expressions by S9AJ32J8

VIEWS: 5 PAGES: 8

									บทท 3 Regular Languages & Regular Grammar                               3-5


Theorem     Let    r    be    regular
expression. Then there exists some
nondeterministic finite accepter that
accepts .             L(r)


  Consequently,        is a regular                  L(r)


language.

                                                                  MD
  cc pts                 แ                                  nfa  dfa
                                                                  MN
accepts L

                                                            MN     cc pts




b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12
บทท 3 Regular Languages & Regular Grammar                       3-6


                            nfa accepting L(r)
                               accepting state                 1

                                                  
                                                 
                                                


 NFA for basic regular expressions
r={}                               r=                r=a
                                                           a


L(MN) = {}                          L(MN) = { } L(MN)= { a}


b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12
บทท 3 Regular Languages & Regular Grammar                                    3-7


 NFA for union
                                              M(r1)
                                      S
                                                                     
                 


                                             M(r2)
                                      S                              

                  r = r1+r2 , L(MN) = L(r1+r2)

 NFA for concatenation
      
              M(r1)
                           S
                                                                 

                                                         M(r2)           
                                                     S


               r = r1 r2 , L(MN) = L(r1)L(r2)
                           


b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12
บทท 3 Regular Languages & Regular Grammar                      3-8


 NFA for *
                                               

                                               M(r1)
                                      S                   



                                               
                                                 
                    
                                     =
                     r = r1* , L(MN)  L(r1*)
       .          r = 1*
                                        1
                                    q0               แ
           แ                       t
                                           

                                      1               

                                        
b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12
บทท 3 Regular Languages & Regular Grammar                        3-9


   ฝ.                 accept L(c+b*a) และ
            L(ab(a+cb*c))

Theorem Let L be a regular
language, then there exists a regular
expression r such that L = L(r)

                                                     cc pt
nfa                 Generalized Transition Graphs

                    Regular Expression

GTG                                                          edges
       .
                              a+b

                       a                       c
            L(r) = L(a*+a*(a+b)c*)
b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12
บทท 3 Regular Languages & Regular Grammar                                3-10


       .                                 e
                         d                               c

                  q1                   qX                    q2
                           a                         b

              State qX (qXF, qXq0)

                                 q1  q 2
                                 q1  q 1
                                 q2  q 2
                                 q2  q1
                  state qX
  cc pt
                  q1  q2                    by      taking       ae*d
                  q1  q1                    by      taking       ae*b
                  q2  q2                    by      taking       ce*d
                  q2  q1                    by      taking       ce*b

b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12
บทท 3 Regular Languages & Regular Grammar                      3-11




                ae*d                      ce*d        ce*b


                       q1                            q2

                                         ae*b




                   r1                       r3            r4

                       q1                            q2

                                           r2




                    r = r1* r2(r4 + r3 r1* r2)*

b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12
บทท 3 Regular Languages & Regular Grammar                                   3-12




       .                                 0
                                  A
                                                     1
                                                                 1
                             0
                                             1           C
                               B
                                                     0




                       0                                             11*0
                                           11*0
                              A                              B

                                                 0




                 r = ( 0 + (11*0)(11*0)*0 ) *
b669607a-537a-465e-9660-c7bdcf68bc2b.doc \ 14/6/12

								
To top