Lecture9_Decidability

Embed Size (px)

Citation preview

  • 7/26/2019 Lecture9_Decidability

    1/14

    TIC 2151 Theory of

    Computation

    Lecture 9

    Decidability

    TIC 2151Theory of Computation

  • 7/26/2019 Lecture9_Decidability

    2/14

    2

    Lecture 09 - Outline

    Decidability

    What is it?

    Undecidable problems: some examples.

    The Turing machine halting problem

  • 7/26/2019 Lecture9_Decidability

    3/14

    3

    A Turning machine can do everything a real computer can do.

    ChurchTuring thesis states that a function on the natural numbers is

    computable if and only if it is computable by a Turing machine.

    TM Execution Possible Outcomes

    Accept: Running TMM on input w eventually leads to qaccept.Reject: Running TMM on input w eventually leads to qreject.

    No Decision: Running TMM on input w runs forever, never reaches qacceptor

    qreject.

    Introduction

  • 7/26/2019 Lecture9_Decidability

    4/14

    4

    Recognizing vs. Deciding

    Turing-decidable: A language L is Turing-decidable if there exists a TMM

    such that for all strings w:

    If w L: eventually Menters qaccept.

    If w L: eventually Menters qreject

    also called a recursive language

  • 7/26/2019 Lecture9_Decidability

    5/14

    5

    Recognizing vs. Deciding

    Turing-recognizable : A language L is Turing recognizable if there exists a

    TMMsuch that for all strings w:

    If w L: eventually Menters qaccept.

    If w L: either M enters qreject or Mnever terminates.

    also called a recursively enumerable language

  • 7/26/2019 Lecture9_Decidability

    6/14

    6

    Inside LTM:

    A language is Turing-recognizable or recursively enumerable if some Turing machine

    recognizes it.

    A language is Turing-decidable (decidable, or recursive) if some Turing machine decides it.

    We call a language decidable if some Turing Machines decides it.

    We call a language decidable if there is a Turing Machines saying Yes or No on every input.

    Every decidable language is Turing-recognizable.

    Decidability

    Lr.e.Lde L

  • 7/26/2019 Lecture9_Decidability

    7/14

    7

    Lr.e.Lde L

    Inside LTM:

    Here the Turing Machine

    has to stop on every inputand say Yes or No!

    Here the Turing Machine

    has to stop on the inputonly when saying Yes!

    Here the Turing Machine will either not stop or print

    wrong results as their cannot be a program for the problem!

    Decidability

    Decider vs. Recognizer?

    Deciders always terminate.

    Recognizers can run forever without deciding.

  • 7/26/2019 Lecture9_Decidability

    8/14

    8

    Lr.e.Lde L

    Remember! Already inside

    here it is difficult tocompute a result as

    sometimes the machine runs

    forever. But unfortunately

    many real-world problems

    are lying in this class.

    PCPHALTING

    Lne

    Busy Beaver

    ~HALTING

    Le**

    Lne = language not empty,Le = language empty.

    PCP = Post Correspondence Problem

    Decidability

  • 7/26/2019 Lecture9_Decidability

    9/14

    9

    Lfin Lreg LDPDA Lcf Lcs Lde Lre L

    Complete Summary:

    Decidability

  • 7/26/2019 Lecture9_Decidability

    10/14

    10

    Decidable Problem (example)

    For example, theacceptance problem for DFAs of testingwhether a particular DFA

    accepts a given string can be expressed as a language, ADFA. This language contains theencodings of all DFAs together with strings that the DFAs accept. Let

    The problem of testing whether a DFA B accepts an input w is the same as the

    problem of testing whether B,w. is a member of the language ADFA.

    ADFA is a decidable language.

    B,w is a representation of a DFA B together with a string w. One reasonable representation

    of B is simply a list of its five components: Q, S, d, q0, andF. M carries out the simulation

    directly. It keeps track of Bs current state and Bs current position in the input w by writing

    this information down on its tape. If the simulation ends in an accept state, accept. If itends in a nonaccepting state, reject

    PROOF IDEA : We simply need to present a TM M that decides ADFA.

    M = On input B,w, where B is a DFA and w is a string:

    1. Simulate B on input w.

    2. If the simulation ends in an accept state, accept. If it ends in anonaccepting state, reject.

  • 7/26/2019 Lecture9_Decidability

    11/14

    11

    Undecidability

    There is a specific problem that is algorithmically unsolvable. Computers appear to

    be so powerful that you may believe that all problems will eventually yield to them.The theorem presented here demonstrates that computers are limited in a

    fundamental way.

    you are given a computer program and a precise specification of what that

    program is supposed to do (e.g., sort a list of numbers). You need to verify thatthe program performs as specified (i.e., that it is correct).

    The general problem of software verification is not solvable by computer.

    The problem of determining whether a Turing machine accepts a given input string

    we call it ATMby analogy with ADFA and ACFG. But, whereas ADFA and ACFG weredecidable, ATM is not.

    ATM is Turing-undecidable language.

    ATM is Turing-recognizable language

  • 7/26/2019 Lecture9_Decidability

    12/14

    12

    Undecidability

    ATM is undecidable language.. Proof by contradiction Step 1

    1) Suppose ATM is decidable andH is a decider forATM.

    2) Construct a new TMD withHas a subroutine. It callsHto determine whatM does

    when the input toM is its own description M. OnceD knows this, it does theopposite.

    3) What happens when we runD with its own description D?

    Can you see the contradiction?

    Neither TMD nor TMHcan exist.

    ATM is undecidable language

    .acceptnotdoesif

    acceptsif),(

    wMreject

    wMacceptwMH TMHM, w

    Accept (ifMaccepts)

    Reject (ifMrejects)

    .acceptsif

    acceptnotdoesif),(

    MMreject

    MMacceptMMD

    .acceptsif

    acceptnotdoesif),(

    DDreject

    DDacceptDDD

  • 7/26/2019 Lecture9_Decidability

    13/14

    13

    Undecidability

    Halting problem. HALTTM, the problem of determining whether aTuring machine

    halts (by accepting or rejecting) on a given input.

    Is there an algorithm able to decide whether a given code will terminate?

    In some programs it helps to look at some variables, in others look at the loops, or tolook at the recursive calls, or ... or ... (and here come infinitely many ors)

    Undecidabe languages examples

  • 7/26/2019 Lecture9_Decidability

    14/14

    14

    Learning Outcomes

    Upon completion of this lecture, you should be able to:

    Explain the definition of Turing-decidable (recursive)

    and Turing-recognizable (recursive enumerable)

    languages. Tell that problems in Lr.e. and L are undecidable, but

    for problems in Lr.e. we can give a TM program

    accepting and stopping for at least all the Yes-instances.

    Name some problems from undecidable language (Lr.e.and L).