5- Regular Properties

  • Upload
    sat258

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

  • 7/27/2019 5- Regular Properties

    1/29

    Prof. Busch - LSU 1

    Properties of

    Regular Languages

  • 7/27/2019 5- Regular Properties

    2/29

    Prof. Busch - LSU 2

    1L 2L

    21LLConcatenation:

    *1LStar:

    21 LL Union:

    Are regular

    Languages

    For regular languages and

    we will prove that:

    1L

    21 LL

    Complement:

    Intersection:

    R

    L1Reversal:

  • 7/27/2019 5- Regular Properties

    3/29

    Prof. Busch - LSU 3

    We say: Regular languages are closed under

    21LLConcatenation:

    *1LStar:

    21 LL Union:

    1L

    21 LL

    Complement:

    Intersection:

    R

    L1Reversal:

  • 7/27/2019 5- Regular Properties

    4/29

    Prof. Busch - LSU 4

    a

    b

    b

    aNFA

    Equivalent

    NFA

    a

    b

    b

    a

    A useful transformation: use one accept state

    2 accept states

    1 accept state

  • 7/27/2019 5- Regular Properties

    5/29

    Prof. Busch - LSU 5

    NFA

    Equivalent NFA

    Singleaccepting

    state

    In General

  • 7/27/2019 5- Regular Properties

    6/29

    Prof. Busch - LSU 6

    NFA without accepting state

    Add an accepting state

    without transitions

    Extreme case

  • 7/27/2019 5- Regular Properties

    7/29Prof. Busch - LSU 7

    1LRegular language

    11 LML

    1

    Single accepting state

    NFA 2

    2L

    Single accepting state

    22 LML

    Regular language

    NFA

    Take two languages

  • 7/27/2019 5- Regular Properties

    8/29Prof. Busch - LSU 8

    }{1 baLn

    a

    b

    1

    baL 2ab

    2

    0n

    Example

  • 7/27/2019 5- Regular Properties

    9/29Prof. Busch - LSU 9

    Union

    NFA for

    1

    2

    21 LL

  • 7/27/2019 5- Regular Properties

    10/29Prof. Busch - LSU 10

    a

    b

    ab

    }{1 baLn

    }{2 baL

    }{}{21 babaLLn

    NFA for

    Example

  • 7/27/2019 5- Regular Properties

    11/29Prof. Busch - LSU 11

    Concatenation

    NFA for 21LL

    1 2

  • 7/27/2019 5- Regular Properties

    12/29Prof. Busch - LSU 12

    NFA for

    a

    b ab

    }{1 baLn

    }{2 baL

    }{}}{{21 bbaababaLL nn

    Example

  • 7/27/2019 5- Regular Properties

    13/29Prof. Busch - LSU 13

    Star Operation

    NFA for *1L

    1

    *1L

    1

    21

    Lw

    wwww

    i

    k

  • 7/27/2019 5- Regular Properties

    14/29Prof. Busch - LSU 14

    NFA for *}{*1 baL n

    a

    b

    }{1 baLn

    Example

  • 7/27/2019 5- Regular Properties

    15/29Prof. Busch - LSU 15

    Reverse

    R

    L1

    1

    NFA for1

    1. Reverse all transitions

    2. Make initial state accepting state

    and vice versa

    1L

    E l

  • 7/27/2019 5- Regular Properties

    16/29Prof. Busch - LSU 16

    }{1 baLn

    a

    b

    1

    }{1nR baL

    ab

    1

    Example

  • 7/27/2019 5- Regular Properties

    17/29Prof. Busch - LSU 17

    Complement

    1. Take the DFAthat accepts 1L

    11L

    11L

    2. Make accepting states non-final,

    and vice-versa

  • 7/27/2019 5- Regular Properties

    18/29

  • 7/27/2019 5- Regular Properties

    19/29Prof. Busch - LSU 19

    Intersection

    1L regular

    2L regular

    We show21

    LL

    regular

  • 7/27/2019 5- Regular Properties

    20/29Prof. Busch - LSU 20

    DeMorgans Law: 2121 LLLL

    21 , LL regular

    21 , LL regular

    21 LL regular

    21 LL regular

    21 LL regular

  • 7/27/2019 5- Regular Properties

    21/29Prof. Busch - LSU 21

    Example

    }{1 baLn

    },{2 baabL

    regular

    regular

    }{21 abLL

    regular

  • 7/27/2019 5- Regular Properties

    22/29

    Prof. Busch - LSU 22

    1Lfor for 2LDFA1

    DFA

    2

    Construct a new DFA that accepts

    Machine Machine

    21 LL

    simulates in parallel and1 2

    Another Proof for Intersection Closure

  • 7/27/2019 5- Regular Properties

    23/29

    Prof. Busch - LSU 23

    States in

    ji

    pq ,

    1 2State in State in

    DFA DFA

  • 7/27/2019 5- Regular Properties

    24/29

    Prof. Busch - LSU 24

    1 2

    1q 2qa

    transition1p 2p

    a

    transition

    DFA DFA

    11, pq a

    New transition

    DFA

    22, pq

    DFA DFA

  • 7/27/2019 5- Regular Properties

    25/29

    Prof. Busch - LSU 25

    0qinitial state

    0p

    initial state

    New initial state

    00 , pq

    1 2DFA DFA

    DFA

    DFA DFA

  • 7/27/2019 5- Regular Properties

    26/29

    Prof. Busch - LSU 26

    iq

    accept state

    jp

    accept states

    New accept states

    ji pq ,

    kp

    ki pq ,

    1 2DFA DFA

    DFA

    Both constituents must be accepting states

    E l

  • 7/27/2019 5- Regular Properties

    27/29

    Prof. Busch - LSU 27

    Example:

    }{1 baLn

    a

    b

    1

    0

    n}{2

    mabL

    b

    b

    2

    0q 1q 0p 1p

    0

    m

    2q 2pa

    a

    ba, ba,

    ba,

    f

  • 7/27/2019 5- Regular Properties

    28/29

    Prof. Busch - LSU 28

    00, pq

    Automaton for intersection

    }{}{}{ ababbaL mn

    10, pqa

    21, pq

    b

    ab11, pq

    20, pq

    a

    12, pq

    22, pq

    b

    ba,

    a

    b

    ba,

    b

    a

  • 7/27/2019 5- Regular Properties

    29/29

    simulates in parallel and1 2

    accepts string w if and only if:

    accepts string w1

    and accepts string w2

    )()()( 21 MLMLML