TIC 2151 – Theory of Computation Lecture 9 Decidability
TIC 2151 – 2151 – Theory Theory of Computation
Lecture 09 - Outline
Decidability – What is it?
Undecidable problems: some examples.
The Turing machine halting problem
Introduction
“A Turning machine can do everything a real computer can do.” Church – Turing 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 TM M on input w eventually leads to qaccept . Reject: Running TM M on input w eventually leads to qreject . No Decision: Running TM M on input w runs forever, never reaches qaccept or qreject .
3
Recognizing vs. Deciding
Turing-decidable: A language L is “Turing-decidable” if there exists a TM M such that for all strings w: L: eventually M enters qaccept. – If w L: eventually M enters qreject – If w – also called a recur sive language
4
Recognizing vs. Deciding
Turing-recognizable : A language L is “Turing recognizable” if there exists a TM M such that for all strings w: L: eventually M enters qaccept. – If w L: either M enters qreject or M never terminates. – If w – also called a r ecur sively enu mer able language
5
Decidability Inside LTM:
Lde
Lr.e. L
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. 6
Decidability Here the Turing Machine will either not stop or print wrong results as their cannot be a program for the problem!
Inside LTM:
Lde Here the Turing Machine has to stop on every input and say Yes or No!
Lr.e. L Here the Turing Machine has to stop on the input only when saying Yes!
Decider vs. Recognizer? Deciders always terminate. Recognizers can run forever without deciding.
7
Decidability
Lde
Lr.e. L
** Lne = language not empty, Le = language empty. PCP = Post Correspondence Problem
Remember! Already inside here it is difficult to compute a result as sometimes the machine runs forever. But unfortunately many real-world problems are lying in this class. Busy Beaver ~HALTING Le PCP HALTING Lne
8
Decidability Complete Summary:
Lfin
Lreg
LDPDA
Lcf
Lcs
Lde
Lre
L 9
Decidable Problem (example) For example, the acceptance problem for DFAs of testi ng whether a particular DFA accepts a given string can be expressed as a language, ADFA. This language contains the encodings 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. 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 a nonaccepting state, reject .” 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, and F . M carries out the simulation directly. It keeps track of B’s current state and B’s current position in the input w by writing this information down on its tape. If the simulation ends in an accept state, accept . If it 10
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 that the 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 ATM by analogy with ADFA and ACFG. But, whereas ADFA and ACFG were decidable, ATM is not.
ATM is Turing-undecidable language. A is Turing-recognizable language
11
Undecidability ATM is undecidable language.. Proof by contradiction Step 1 1) Suppose ATM is decidable and H is a decider for ATM.
accept if M accepts w H ( M , w ) reject if M does not accept w.
Accept (if M accepts)
M , w
TMH
Reject (if M rejects)
2) Construct a new TM D with H as a subroutine. It calls H to determine what M does when the input to M is its own description M . Once D knows this, it does the opposite.
accept if M does not accept M D( M , M ) reject if M accepts M . 3) What happens when we run D with its own description D?
accept if D does not accept D D( D, D) reject if D accepts D. Can you see the contradiction? Neither TM D nor TM H can exist. ATM is undecidable language
12
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 to look at the recursive calls, or ... or ... (and here come infinitely many or s) ’
Undecidabe languages examples
13
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 (L r.e. and L).