class06_001 pumping lemma

Upload: rajesh-shisodiya

Post on 04-Apr-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Class06_001 Pumping Lemma

    1/41

    1

    Formal Languages

    Non-Regular LanguagesSlides based on RPI CSCI 2400

    Thanks to Petros Drineas

  • 7/31/2019 Class06_001 Pumping Lemma

    2/41

    2

    Evert: Session 3Posix notation

  • 7/31/2019 Class06_001 Pumping Lemma

    3/41

    3

    Evert: Session 1Vollstaendige Induktion

  • 7/31/2019 Class06_001 Pumping Lemma

    4/41

    4

    Regular languagesa* cb*

    .et

    (acb

    Non-regular languages:{ nbann

    ,{:{

    avvvR

  • 7/31/2019 Class06_001 Pumping Lemma

    5/41

    5

    How can we prove that a language

    is not regular?L

    Prove that there is no DFA that acceptsL

    Problem: this is not easy to prove

    Solution: the Pumping Lemma !!!

  • 7/31/2019 Class06_001 Pumping Lemma

    6/41

    6

    The Pigeonhole Principle

  • 7/31/2019 Class06_001 Pumping Lemma

    7/417

    pigeons

    pigeonholes

    4

    3

  • 7/31/2019 Class06_001 Pumping Lemma

    8/418

    A pigeonhole mustcontain at least two pigeons

  • 7/31/2019 Class06_001 Pumping Lemma

    9/419

    ...........

    ...........

    pigeons

    pigeonholes

    n

    m n

  • 7/31/2019 Class06_001 Pumping Lemma

    10/4110

    The Pigeonhole Principle

    ...........

    pigeonspigeonholes

    nm

    n

    There is a pigeonhole

    with at least 2 pigeons

  • 7/31/2019 Class06_001 Pumping Lemma

    11/4111

    The Pigeonhole Principle

    and

    DFAs

  • 7/31/2019 Class06_001 Pumping Lemma

    12/4112

    DFA with states4

    1q 2q 3qa

    b

    4q

    b

    b b

    b

    a a

  • 7/31/2019 Class06_001 Pumping Lemma

    13/4113

    1q 2q 3qa

    b

    4q

    b

    b

    b

    aa

    a

    In walks of strings:

    aab

    aa

    a no state

    is repeated

  • 7/31/2019 Class06_001 Pumping Lemma

    14/4114

    In walks of strings:

    1q 2q 3qa

    b

    4q

    b

    b

    b

    aa

    a

    ...abbbabbabb

    abbabb

    bbaa

    aabb a state

    is repeated

  • 7/31/2019 Class06_001 Pumping Lemma

    15/4115

    If string has length :

    1q 2q 3qa

    b

    4q

    b

    b

    b

    aa

    a

    w ||w

    Thus, a state must be repeated

    Then the transitions of stringare more than the states of the DFAw

    l

  • 7/31/2019 Class06_001 Pumping Lemma

    16/4116

    In general, for any DFA:

    String has length number of statesw

    A state must be repeated in the walk ofw

    q

    q...... ......

    walk of w

    Repeated state

  • 7/31/2019 Class06_001 Pumping Lemma

    17/4117

    In other words for a string :

    transitions are pigeons

    states are pigeonholesq

    a

    w

    q...... ......

    walk of w

    Repeated state

  • 7/31/2019 Class06_001 Pumping Lemma

    18/4118

    The Pumping Lemma

  • 7/31/2019 Class06_001 Pumping Lemma

    19/4119

    Take an infinite regular language L

    There exists a DFA that accepts L

    mstates

  • 7/31/2019 Class06_001 Pumping Lemma

    20/4120

    Take string withw w

    There is a walk with label :w

    .........

    walk w

    If t i h l th ||

  • 7/31/2019 Class06_001 Pumping Lemma

    21/4121

    If string has lengthw w|| (numberof states

    of DFA)

    then, from the pigeonhole principle:

    a state is repeated in the walk w

    q...... ......

    walk w

  • 7/31/2019 Class06_001 Pumping Lemma

    22/41

    22

    q

    q...... ......

    walk w

    Let be the first state repeated in the

    walk of w

  • 7/31/2019 Class06_001 Pumping Lemma

    23/41

    23

    Write xw

    q...... ......

    x

    y

    z

  • 7/31/2019 Class06_001 Pumping Lemma

    24/41

    24

    q...... ......

    x

    y

    z

    Observations: yx||length number

    of states

    of DFA||ylength

  • 7/31/2019 Class06_001 Pumping Lemma

    25/41

    25

    The string

    is accepted

    xObservation:

    q...... ......

    x

    y

    z

  • 7/31/2019 Class06_001 Pumping Lemma

    26/41

    26

    The string

    is accepted

    yxObservation:

    q...... ......

    x

    y

    z

  • 7/31/2019 Class06_001 Pumping Lemma

    27/41

    27

    The string

    is accepted

    yyObservation:

    q...... ......

    x

    y

    z

    i

  • 7/31/2019 Class06_001 Pumping Lemma

    28/41

    28

    The string

    is accepted

    yxi

    In General:

    ,,1,0i

    q...... ......

    x

    y

    z

  • 7/31/2019 Class06_001 Pumping Lemma

    29/41

    29

    zyxiIn General: ,,1,0

    i

    q...... ......

    x

    y

    z

    Language accepted by the DFA

  • 7/31/2019 Class06_001 Pumping Lemma

    30/41

    30

    In other words, we described:

    The Pumping Lemma !!!

  • 7/31/2019 Class06_001 Pumping Lemma

    31/41

    31

    The Pumping Lemma:

    Given an infinite regular languageL

    there exists an integer m

    for any string with lengthw w||

    we can write xw

    with andyx|| ||y

    such that:zyxi ,,1,0i

  • 7/31/2019 Class06_001 Pumping Lemma

    32/41

    32

    Applications

    of

    the Pumping Lemma

  • 7/31/2019 Class06_001 Pumping Lemma

    33/41

    33

    Theorem: The language :{ nbaLnn

    is not regular

    Proof: Use the Pumping Lemma

    {bLnn

  • 7/31/2019 Class06_001 Pumping Lemma

    34/41

    34

    Assume for contradiction

    that is a regular languageL

    Since is infinitewe can apply the Pumping Lemma

    L

    :{ nbaLnn

    {bLnn

  • 7/31/2019 Class06_001 Pumping Lemma

    35/41

    35

    Let be the integer in the Pumping Lemma

    Pick a string such that:w w

    w||length

    awWe pick

    m

    :{ nbaLnn

    bmm

  • 7/31/2019 Class06_001 Pumping Lemma

    36/41

    36

    it must be that length

    From the Pumping Lemma||,||yx

    aabayzmm......

    , kayk

    x y z

    m m

    Write: xbamm

    Thus:

  • 7/31/2019 Class06_001 Pumping Lemma

    37/41

    kk

  • 7/31/2019 Class06_001 Pumping Lemma

    38/41

    38

    From the Pumping Lemma:

    aaaazy ...........2

    x y

    m m

    Thus:

    zyx2

    azy , kayk

    y

    ba

    km

    b

    km k

  • 7/31/2019 Class06_001 Pumping Lemma

    39/41

    39

    bakm

    :{ nbaLnn

    BUT:

    bamkm

    CONTRADICTION!!!

    k

  • 7/31/2019 Class06_001 Pumping Lemma

    40/41

    40

    Our assumption that

    is a regular language is not true

    L

    Conclusion: L is not a regular language

    Therefore:

  • 7/31/2019 Class06_001 Pumping Lemma

    41/41

    Regular languages

    Non-regular languages :{ nbann