# Languages and Finite Automata by dfhdhdhdhjr

VIEWS: 4 PAGES: 29

• pg 1
```									  Properties of
Regular Languages

Prof. Busch - LSU   1
For regular languages      L1       and   L2
we will prove that:

Union:   L1  L2
Concatenation:   L1L2
Star:                           Are regular
L1 *
Languages
Reversal:   L1R

Complement:     L1
Intersection:   L1  L2
Prof. Busch - LSU                    2
We say: Regular languages are closed under

Union:   L1  L2
Concatenation:   L1L2
Star:    L1 *
Reversal:   L1R

Complement:     L1
Intersection:   L1  L2
Prof. Busch - LSU        3
A useful transformation: use one accept state

NFA
a
b                   2 accept states
a
b

Equivalent
NFA
a
1 accept state
a               b

b                        

Prof. Busch - LSU                     4
In General
NFA

Equivalent NFA
     Single
      accepting

state
Prof. Busch - LSU               5
Extreme case

NFA without accepting state

without transitions

Prof. Busch - LSU                   6
Take two languages

Regular language          L1            Regular language          L2

LM1   L1                              LM 2   L2

NFA      M1                               NFA   M2

Single accepting state                  Single accepting state

Prof. Busch - LSU                           7
Example

M1
n0
a
L1  {a b}
n
b

M2
L2  ba                 b          a

Prof. Busch - LSU       8
Union
NFA for   L1  L2
M1



            M2

Prof. Busch - LSU   9
Example

NFA for   L1  L2  {a b}  {ba}
n

L1  {a b}     n
a
b


        L2  {ba}
b           a
Prof. Busch - LSU   10
Concatenation

NFA for   L1L2

M1                            M2


Prof. Busch - LSU        11
Example

NFA for   L1L2  {a b}{ba}  {a bba}
n                     n

L1  {a b}n

a                          L2  {ba}
b                      b       a

Prof. Busch - LSU           12
Star Operation
NFA for L1 *                           w  w1w2  wk
               wi  L1
M1
  L1 *
                             


Prof. Busch - LSU               13
Example

NFA for   L1*  {a b} *
n



L1  {a b}      n

a
           b               


Prof. Busch - LSU       14
Reverse
R
NFA for L1

L1   M1                                 M1

1. Reverse all transitions

2. Make initial state accepting state
and vice versa
Prof. Busch - LSU                 15
Example

M1
a
L1  {a b}
n
b

M1
a
R
L1     {ba }
n                 b

Prof. Busch - LSU   16
Complement

L1     M1                            L1    M1

1. Take the DFA that accepts              L1

2. Make accepting states non-final,
and vice-versa
Prof. Busch - LSU               17
Example

M1
a                        a, b

L1  {a b}
n                        b       a, b

M1
a                          a, b
L1  {a, b} * {a b}
n

b     a, b

Prof. Busch - LSU                  18
Intersection

L1   regular

We show          L1  L2
L2   regular                          regular

Prof. Busch - LSU             19
DeMorgan’s Law:      L1  L2  L1  L2

L1 , L2               regular

L1 , L2               regular

L1  L2               regular

L1  L2               regular
L1  L2               regular
Prof. Busch - LSU         20
Example

L1  {a b} regular
n
L1  L2  {ab}
L2  {ab, ba} regular                    regular

Prof. Busch - LSU                21
Another Proof for Intersection Closure

Machine   M1                        Machine   M2
DFA for    L1                        DFA for   L2

Construct a new DFA   M that accepts L1  L2

M simulates in parallel M1 and M 2
Prof. Busch - LSU                  22
States in M

qi , p j

State in   M1          State in      M2

Prof. Busch - LSU        23
DFA   M1                                 DFA      M2

q1         a       q2                        p1        a       p2
transition                                   transition

DFA          M

q1, p1          a            q2 , p2
New transition
Prof. Busch - LSU                          24
DFA   M1                            DFA   M2

q0                                  p0
initial state                       initial state

DFA          M

q0 , p0
New initial state
Prof. Busch - LSU                   25
DFA M1                                    DFA     M2

qi                                     pj          pk

accept state                              accept states

DFA         M
qi , p j                       qi , pk

New accept states

Both constituents must be accepting states
Prof. Busch - LSU                       26
Example:

n0                                        m0
L1  {a b}  n
L2  {ab }      m

M1                                    M2
a                                                 b
q0   b    q1                          p0   a    p1
a, b                        b          a
q2                                    p2
a, b                                  a, b
Prof. Busch - LSU                         27
Automaton for intersection

L  {a b }  {ab }  {ab }
n                    m

a, b

q0 , p0    a        q0 , p1      b            q1, p1    a   q2 , p2

b                    a                        b      a
q1, p2      b       q0 , p2                   q2 , p1

a             b
a, b
Prof. Busch - LSU                           28
M simulates in parallel M1 and M 2

M accepts string w if and only if:
M1 accepts string w
and M 2 accepts string w

L( M )  L( M1)  L( M 2 )
Prof. Busch - LSU    29

```
To top