regular properties

Upload: tariqravian

Post on 30-May-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Regular Properties

    1/31

    Fall 2005 Costas Busch - RPI 1

    Single Accepting

    State for NFAs

  • 8/9/2019 Regular Properties

    2/31

    Fall 2005 Costas Busch - RPI 2

    Any NFA can be converted

    to an equivalent NFA

    with a single accepting state

  • 8/9/2019 Regular Properties

    3/31

    Fall 2005 Costas Busch - RPI 3

    a

    b

    b

    a NFA

    Equivalent NFA

    PP

    a

    b

    b

    a

    Example

  • 8/9/2019 Regular Properties

    4/31

    Fall 2005 Costas Busch - RPI 4

    NFAIn General

    Equivalent NFA

    Singleaccepting

    state

    PPP

  • 8/9/2019 Regular Properties

    5/31

    Fall 2005 Costas Busch - RPI 5

    Extreme Case

    NFA without accepting state

    Add an accepting state

    without transitions

  • 8/9/2019 Regular Properties

    6/31

    Fall 2005 Costas Busch - RPI 6

    Properties of

    Regular Languages

  • 8/9/2019 Regular Properties

    7/31

    Fall 2005 Costas Busch - RPI 7

    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:

  • 8/9/2019 Regular Properties

    8/31

    Fall 2005 Costas Busch - RPI 8

    We say: Regular languages are closed under

    21LLConcatenation:

    *1LStar:

    21 LL Union:

    1L

    21 LL

    Complement:

    Intersection:

    R

    L1Reversal:

  • 8/9/2019 Regular Properties

    9/31

    Fall 2005 Costas Busch - RPI 9

    1LRegular language

    11 LML !

    1M

    Single accepting state

    NFA 2M

    2L

    Single accepting state

    22 LML !

    Regular language

    NFA

  • 8/9/2019 Regular Properties

    10/31

    Fall 2005 Costas Busch - RPI 10

    Example

    }{1 baLn!

    a

    b

    1M

    _ abaL !2ab

    2M

    0un

  • 8/9/2019 Regular Properties

    11/31

    Fall 2005 Costas Busch - RPI 11

    Union

    NFA for

    1M

    2M

    21

    LL

    P

    P

  • 8/9/2019 Regular Properties

    12/31

    Fall 2005 Costas Busch - RPI 12

    Example

    a

    b

    ab

    P

    P

    }{1 baLn

    !

    }{2 baL !

    }{}{21baba

    LL

    n

    !

    NFA for

  • 8/9/2019 Regular Properties

    13/31

    Fall 2005 Costas Busch - RPI 13

    Concatenation

    NFA for 21LL

    1 2

    P P

  • 8/9/2019 Regular Properties

    14/31

    Fall 2005 Costas Busch - RPI 14

    Example

    NFA for

    a

    b ab

    }{1 baLn!

    }{2 baL !

    }{}}{{21 bbaababaLLnn !!

    P P

  • 8/9/2019 Regular Properties

    15/31

    Fall 2005 Costas Busch - RPI 15

    Star Operation

    NFA for *1L

    1M

    P

    P

    *1LP

    P P

    1

    21

    Lw

    wwww

    i

    k

    ! .

  • 8/9/2019 Regular Properties

    16/31

    Fall 2005 Costas Busch - RPI 16

    Example

    NFA for *}{*1 baLn!

    a

    b

    }{1 baLn

    !

    P

    P

    P

    P

  • 8/9/2019 Regular Properties

    17/31

    Fall 2005 Costas Busch - RPI 17

    Reverse

    R

    L1

    1

    NFA for

    d1M

    1. Reverse all transitions

    2. Make initial state accepting state

    and vice versa

    1L

  • 8/9/2019 Regular Properties

    18/31

    Fall 2005 Costas Busch - RPI 18

    Example

    }{1 baLn!

    a

    b

    1M

    }{1nR

    baL !a

    b

    d1M

  • 8/9/2019 Regular Properties

    19/31

    Fall 2005 Costas Busch - RPI 19

    Complement

    1. Take the DFA that accepts 1L

    1M1Ld

    1M1L

    2. Make final states non-final,

    and vice-versa

  • 8/9/2019 Regular Properties

    20/31

    Fall 2005 Costas Busch - RPI 20

    Example

    }{1 baLn

    !

    a

    b

    1M

    ba,

    ba,

    }{*},{1 babaLn! a

    b

    d1M

    ba,

    ba,

  • 8/9/2019 Regular Properties

    21/31

    Fall 2005 Costas Busch - RPI 21

    Intersection

    1L regular

    2L regularWe show 21 LL

    regular

  • 8/9/2019 Regular Properties

    22/31

    Fall 2005 Costas Busch - RPI 22

    DeMorgans Law: 2121 LLLL !

    21 , LL regular

    21 , LL regular

    21 LL regular

    21 LL regular

    21 LL regular

  • 8/9/2019 Regular Properties

    23/31

    Fall 2005 Costas Busch - RPI 23

    Example

    }{1 baLn

    !

    },{2 baabL !

    regular

    regular

    }{21

    abLL !

    regular

  • 8/9/2019 Regular Properties

    24/31

    Fall 2005 Costas Busch - RPI 24

    1Lfor for 2LFA

    1M

    FA

    2M

    Construct a new FA that accepts

    Machine Machine

    M 21 LL

    M simulates in parallel and1M 2M

    Another Proof for Intersection Closure

  • 8/9/2019 Regular Properties

    25/31

    Fall 2005 Costas Busch - RPI 25

    States in M

    ji pq ,

    1M

    2MState in State in

  • 8/9/2019 Regular Properties

    26/31

    Fall 2005 Costas Busch - RPI 26

    1M 2M

    1q 2qa

    transition

    1p 2pa

    transition

    FA FA

    11, pq a

    New transition

    MFA

    22, pq

  • 8/9/2019 Regular Properties

    27/31

    Fall 2005 Costas Busch - RPI 27

    0q

    initial state

    0p

    initial state

    New initial state

    00 , pq

    1M 2MFA FA

    MFA

  • 8/9/2019 Regular Properties

    28/31

    Fall 2005 Costas Busch - RPI 28

    iq

    accept state

    jp

    accept states

    New accept states

    ji pq ,

    kp

    ki pq ,

    1M 2MFA FA

    MFA

    Both constituents must be accepting states

  • 8/9/2019 Regular Properties

    29/31

    Fall 2005 Costas Busch - RPI 29

    Example:

    }{1 baLn!

    a

    b

    1M

    0un

    }{2m

    abL !

    b

    b

    2M

    0q 1q 0p 1p

    0um

    2q 2pa

    a

    ba, ba,

    ba,

  • 8/9/2019 Regular Properties

    30/31

    Fall 2005 Costas Busch - RPI 30

    00, pq

    Automaton for intersection

    }{}{}{ ababbaL nn !!

    10, pqa

    21, pq

    b

    ab11, pq

    20, pq

    a

    12, pq

    22, pq

    b

    ba,

    a

    b

    ba,

    b

    a

  • 8/9/2019 Regular Properties

    31/31

    Fall 2005 Costas Busch - RPI 31

    M simulates in parallel and1M 2M

    M accepts string w if and only if

    accepts string andw1Maccepts string w2M

    )()()( 21 MLMLML !