meljun cortes automata theory 17

Upload: meljun-cortes-mbampa

Post on 04-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    1/33

    CSC 3130: Automata theory and formal languages

    Undecidable Languages

    MELJUN P. CORTES MBA MPA BSCS ACS

    MELJUN CORTES

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    2/33

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    3/33

    The Universal Turing Machine

    U

    input x

    program M

    Mon input x

    The universal TMUtakes as inputs a programM

    and a string xand simulatesMon x

    The programMitself is specified as a TM!

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    4/33

    Turing Machines as strings

    This Turing Machine can be described by the

    string

    M= ((q0, qacc, qrej),((q0, q0, /R),(q0, qacc, 0/0R),

    (q0, qrej, 1/1R)))

    M

    q0

    qacc

    qrej

    /R

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    5/33

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    6/33

    Languages about automata

    A TM can take another TM (or DFA, CFG) asinput

    ADFA= {(D, w): Dis a DFA that accepts input w}

    APDA= {(P, w): Pis a PDA that accepts w}

    ATM= {(M, w):Mis a TM that accepts w}

    Which of these is decidable?

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    7/33

    Languages about automata

    Idea: SimulateMon input w

    Simulation is correct: IfMaccepts w, we accept

    IfMrejects w, we reject

    IfMloops on w, we loop

    This TM recognizesbut does not decideATM

    ATM= {(M, w):Mis a TM that accepts w}

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    8/33

    Recognizing versus deciding

    This kind of TM is called a decider

    The textbook uses different terminology:

    The language recognized by a TM is theset ofall inputs that make it reach qacc

    A TM decides language Lif it recognizes L

    anddoes not loop on any input

    recognizable = recursively enumerable (r. e.)

    decidable = recursive

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    9/33

    Undecidability

    Turings Theorem:

    Before we prove this, lets observe one thing:

    The languageATMis undecidable.

    A Turing MachineMcan be given its owndescriptionMas an input!

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    10/33

    Proof of undecidability

    Proof by contradiction:

    SupposeATMis decidable.

    Then there is a TM Hthat decidesATM

    :

    HM, w acceptifMaccepts w

    rejectifMrejects w

    orMloops onw

    M, M

    acceptifMaccepts M

    rejectifMrejects M

    orMloops on M

    What happens whenw= M?

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    11/33

    Proof of undecidability

    HM, M

    acceptifMaccepts M

    rejectifMrejects M

    orMloops on M

    Let Hbe a TM that does the oppositeof H

    H

    acc

    rej

    acc

    rej

    H

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    12/33

    Proof of undecidability

    HM, M acceptifMaccepts M

    rejectifMrejects M

    orMloops on M

    HM, M

    rejectifMaccepts M

    ifMrejects MorMloops on M

    accept

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    13/33

    Proof of undecidability

    HM, M

    rejectifMaccepts M

    ifMrejects MorMloops on M

    accept

    Let Dbe the following TM:

    copy

    M M, M

    H

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    14/33

    Proof of undecidability

    DM

    rejectifMaccepts

    M

    ifMrejects MorMloops on M

    accept

    What happens whenM= D?

    D

    rejectifDacceptsD

    ifDrejectsD

    or Dloops onD

    If Daccepts Dthen Drejects D

    If Drejects Dthen Daccepts Dso Ddoes not exist!

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    15/33

    Proof of undecidability: conclusion

    Proof by contradiction We assumedATMwas decidable

    Then we had Turing Machines H, H, D

    But Ddoes not exist!

    Conclusion

    The languageATMis undecidable.

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    16/33

    What happened?

    M1

    M2M3

    e 0 1 00

    acc rej rej acc

    rej acc loop rejrej loop rej rej

    TuringMachine

    input w

    We can write an infinite table for every pair (M, w)

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    17/33

    What happened?

    M1

    M2M3

    M1 M2 M4

    acc loop rej acc

    rej acc rej accloop rej loop rej

    Now lets look only at those wthat describe a TMM

    M3

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    18/33

    What happened?

    M1

    M2

    M1 M2 M4

    acc loop rej acc

    rej acc rej acc

    IfATMis decidable, then TM Dis in the table

    M3

    D rej rej acc rej

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    19/33

    What happened?

    M1

    M2

    M1 M2 M4

    acc loop rej acc

    rej acc rej acc

    Ddoes the opposite of the diagonal entries

    M3

    D rej rej acc rej

    DM

    reject ifMaccepts M

    accept ifMrejects or loops on M

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    20/33

    What happened?

    M1

    M2

    M1 M2 M4

    acc loop rej acc

    rej acc rej acc

    We run into trouble when we look at (D, D)!

    M3

    D rej rej acc rej

    D

    loop

    acc

    ?

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    21/33

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    22/33

    Unrecognizable languages

    General Theorem

    We knowATMis recognizable, so ifATMwere

    also,

    thenATMwould be decidable

    Impossible by Turings Theorem

    If Land Lare both recognizable, then Lis

    decidable.

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    23/33

    Unrecognizable languages

    Proof idea

    If Land Lare both recognizable, then Lisdecidable.

    M rej/loop ifwLaccept ifwLw

    M rej/loop ifwLaccept ifwLw

    w

    accept

    reject

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    24/33

    Unrecognizable languages

    Proof attempt

    LetM= TM for L, M= TM for L

    On input w,

    SimulateMon input w. If it accepts, accept.

    Simulate Mon input w. If it accepts, reject.

    If Land Lare both recognizable, then Lisdecidable.

    Problem: IfMloops on w, we

    will never get to step 2!

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    25/33

    Bounded simulation

    ProofLetM= TM for L, M= TM for L

    On input w,

    SimulateMon input w for ksteps. If it accepts, accept.

    Simulate Mon input w for ksteps. If it accepts, reject.

    If Land Lare both recognizable, then Lisdecidable.

    For k= 0 to infinity

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    26/33

    Another undecidable language

    To prove this, we will show that

    so by Turings Theorem it is undecidable.

    HALTTM= {(M, w):Mis a TM that halts on input w}

    If HALTTM

    can be decided, so canATM

    .

    HALTTMis an undecidable language

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    27/33

    Undecidability of halting

    Suppose Hdecides HALTTM

    H reject ifMloops onw

    accept ifMhalts on wM, w

    If HALTTMcan be decided, so canATM.

    We want to use Hto design DforATM

    ? reject ifMrejectsorloops on w

    accept ifMaccepts wM, w

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    28/33

    Undecidability of halting

    H reject ifMloops onw

    accept ifMhalts on wM, w

    D

    reject ifMrejects

    orloops on w

    accept ifMaccepts wM, w

    Hrej

    accsimulateMon w rej

    acc

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    29/33

    More undecidable problems

    L1= {M:Mis a TM that accepts input e}

    L2= {M:Mis a TM that accepts some input}

    L4= {M,M:Mand M accept the same inputs}

    Which of these are recognizable?

    L3= {M:Mis a TM that accepts all inputs}

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    30/33

    Gdels incompleteness theorem

    Proof due to Turing:

    Some mathematical

    statements

    are truebut not provable.

    If every true statement is provable, thenATMcan be decided.

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    31/33

    Proof sketch of Gdels theorem

    Suppose every true statement has a proof

    For every TMMand input w, one of the

    statements

    is true, so it must have a proof

    Maccepts w Mdoes not accept wor

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    32/33

    Proof sketch of Gdels theorem

    Consider this algorithm forATM:

    On input M, w:

    Fork= 0 to infinity

    For all possible proofspof length kIfpis a proof of Maccepts w, accept.

    Ifpis a proof of Mdoes not accept w, reject.

    One of them is true, so it has a proofp

    Eventually, the algorithm will find this proof

  • 8/13/2019 MELJUN CORTES Automata Theory 17

    33/33