meljun cortes -- automata theory lecture - 18

Upload: meljun-cortes-mbampa

Post on 04-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    1/29

    CSC 3130: Automata theory and formal languages

    Andrej Bogdanov

    http://www.cse.cuhk.edu.hk/~andrejb/csc3130

    More undecidable languages

    Fall 2008

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    2/29

    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}

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

    decidable recognizable but

    undecidable

    unrecognizable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    3/29

    Example 1

    Step 1: You gotta believe it

    To know ifMaccepts e, it looks like we have to

    simulate it

    But then we might end up in a loop

    Step 2: Use what you know

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

    ATM is undecidable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    4/29

    Proof by reduction

    Show that ifL1 can be decided,

    ... so canATM

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

    Areject if not

    accept ifMaccepts eM

    ?M, w

    reject if not

    accept ifMaccepts w

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    5/29

    Proof by reduction

    M, w

    reject

    if not

    accept

    ifMaccepts w

    Areject if not

    accept ifMaccepts eM

    AM

    M is a Turing Machine such that:

    IfMaccepts w, then Maccepts e

    IfMdoes not accept w, then Mdoes not accept e

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    6/29

    Proof by reduction

    M, w

    reject

    if not

    acceptifMaccepts w

    AM

    M: On input z,

    Ifz = e, then simulateMon w

    Otherwise, reject

    constructM

    M

    q0

    qaccqrej

    /L

    q1

    M

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    7/29

    Recognizable or not?

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

    decidable recognizable but

    undecidable

    unrecognizable

    Algorithm forL1

    On input M:SimulateMon input e

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    8/29

    Example 2

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

    Step 1: You gotta believe it

    To know ifMaccepts, it looks like we have to simulate

    it

    But then we might end up in a loop

    Step 2: Use what you knowATM is undecidable L1 is undecidable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    9/29

    Example 2

    M

    reject

    if not

    accept

    ifMaccepts e

    Areject if not

    accept ifMaccepts some inputM

    AM

    M is a Turing Machine such that:

    IfMaccepts e, then Maccepts some input

    IfMdoes not accept e, then Mdoes not accept anything

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    10/29

    Example 2

    M

    reject

    if not

    acceptifMaccepts w

    AMconstruct

    M

    M: On input w,

    Ifw = e, then simulateMon e

    Otherwise, reject

    decidable recognizable but

    undecidable

    unrecognizable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    11/29

    Is it recognizable?

    Attempt to recognize L2:

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

    SimulateMon input e

    SimulateMon input 0

    SimulateMon input 1

    SimulateMon input00

    ...

    Accept if one of them accepts

    ... but there are infinitely many!

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    12/29

    Is it recognizable?

    Attempt to recognize L2:

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

    For all possible strings x(in lexicographic order):

    SimulateMon input x

    If it accepts, accept.

    If it rejects, reject.

    lexicographic order: e, 0, 1, 00, 01, 10, 11, 000, 001, ...

    what ifMloops on e

    butMaccepts, say, 11?

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    13/29

    Is it recognizable?

    Description of Turing Machine that recognizes L2:

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

    For all possible strings x(in lexicographic order):

    For all stringsythat come before x

    If it accepts, accept.

    If it rejects, reject.

    k := 1

    k := k + 1

    SimulateMonyfork steps

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    14/29

    Explanation of algorithm

    Execution of algorithm

    inputs e 0 1 00 01 ...

    SimulateMon e for1 step

    SimulateMon e for2 stepsSimulateMon 0for2 steps

    SimulateMon e for3 stepsSimulateMon 0for3 steps

    SimulateMon 1for3 steps..

    .

    IfMaccepts some w,algorithm will see this

    in some stage of the

    simulation

    decidable recognizable but

    undecidable

    unrecognizable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    15/29

    Example 3

    Step 1: You gotta believe it

    To know ifMaccepts, it looks like we have to simulateit

    But then we might end up in a loop

    Step 2: Use what you know... by yourself this

    time!

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

    decidable recognizable but

    undecidable

    unrecognizable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    16/29

    Is it recognizable?

    Lets try...

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

    SimulateMon e for1 step

    SimulateMon e for2 stepsSimulateMon 0for2 steps

    SimulateMon e for3 stepsSimulateMon 0for3 steps

    SimulateMon 1for3 steps..

    .

    and then what?

    accept if all of them accept

    but there are infinitely many!

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    17/29

    Is it recognizable?

    To check that Mis in L3, it looks like we have to wait

    for an infinite numberof simulations to finish

    But we dont have that much time!

    Step 1: You gotta believe it

    ... but I dont!

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

    decidable recognizable but

    undecidable

    unrecognizable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    18/29

    How to argue unrecognizability

    First attempt: Remember that

    ... so we can try to argue that L3is recognizable

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

    IfLand Lare both recognizable, then Lis

    decidable.

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    19/29

    First attempt

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

    L3 = {M:Mis a TM that does not accept all inputs}

    Lets try...

    SimulateMon e for1 step

    SimulateMon e for2 stepsSimulateMon 0for2 steps

    SimulateMon e for3 stepsSimulateMon 0for3 stepsSimulateMon 1for3 steps

    .

    .

    .

    accept ifMrejects or loops

    but how to know if it loops?

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    20/29

    How to argue unrecognizability

    Second attempt: Use what you know

    We can try to argue that

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

    ATM is not recognizable

    If we can recognize L3then we can also

    recognizeATM

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    21/29

    Proof by reduction

    Arej/loop if not

    accept ifMaccepts all inputsM

    M, w

    rej/loop

    ifMaccepts w

    accept

    ifMdoes not accept w

    AMconstruct

    M

    M is a Turing Machine such that:

    IfMdoes not accept w, thenMaccepts all inputs

    IfMaccepts w, thenM rejects or loops on some input

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    22/29

    Constructing M

    To do this, we want to simulateMon w... but what if simulation

    loops?

    Idea:M keeps accepting more and more of its

    inputs as long asMhas not halted on w

    IfMneverhalts on w, Mwill accept all inputs

    Mis a Turing Machine such that:

    IfMdoes not accept w, thenMaccepts all inputs

    IfMaccepts w, thenM rejects or loops on some input

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    23/29

    Constructing M

    Description ofM:

    On input z,

    SimulateMon input wfor|z| steps

    If simulation ofMreaches state qacc, reject.If simulation ofMreaches state qrej, accept.

    If neither state is reached, accept.

    M is a Turing Machine such that:

    IfMdoes not accept w, thenMaccepts all inputs

    IfMaccepts w, thenM rejects or loops on some input

    length ofz

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    24/29

    Correctness of construction

    M is a Turing Machine such that:

    IfMdoes not accept w, thenMaccepts all inputs

    IfMaccepts w, thenM rejects or loops on some input

    On input z,

    SimulateMon input wfor|z| steps

    If simulation ofMreaches state qacc, reject.

    If simulation ofMreaches state qrej, accept.If neither state is reached, accept.

    Description ofM:

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    25/29

    Correctness of construction

    SimulateMon input wfor|z| steps

    If simulation ofMreaches state qacc, reject.

    If simulation ofMreaches state qrej, accept.If neither state is reached, accept.

    M is a Turing Machine such that:

    IfMdoes not accept w, thenMaccepts all inputs

    IfMaccepts w, thenM rejects or loops on some input

    On input z,

    Description ofM: In k steps z= 0k

    M rejects input 0k

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    26/29

    Example 3 recap

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

    We showed that

    ... but we knowATM is not recognizableso

    If we can recognize L3then we can alsorecognizeATM

    decidable recognizable but

    undecidable

    unrecognizable

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    27/29

    Example 4

    Step 1: You gotta believe it

    Step 2: Use what you know

    decidable recognizable butundecidable

    unrecognizable

    ATM is recognizable

    but undecidable

    L1 is recognizable

    but undecidable

    L2 is recognizable

    but undecidable

    L3 is unrecognizableATM is unrecognizable

    L4 = {(M1, M2):M1andM2 accept the same inputs

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    28/29

    Example 4

    L4 = {(M1, M2):M1andM2 accept the same inputs}

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

    ?M

    rej/loop if not

    accept ifMaccepts all inputs

    Arej/loop if not

    accept ifM1, M2 accept same inputsM1, M2

  • 7/31/2019 MELJUN CORTES -- AUTOMATA THEORY LECTURE - 18

    29/29

    Example 4

    Arej/loop if not

    accept ifM1, M2 accept same inputsM1, M2

    M

    rej/loop

    if not

    accept

    ifMaccepts all inputs

    AM1

    M2

    IfMaccepts all inputs, then M1, M2 accepts same inputsIfMdoes not, then M1, M2 do not accept same inputs

    M1 =M M2 = TM that always accepts

    qacc