• No results found

The halting problem

N/A
N/A
Protected

Academic year: 2022

Share "The halting problem"

Copied!
27
0
0

Loading.... (view fulltext now)

Full text

(1)

CS310 : Automata Theory 2019

Lecture 28: Reductions

Instructor: S. Akshay

IITB, India

14-03-2019

(2)

Recap of previous lecture

Regular (Decidable (Recursively Enumerable( All languages DFA/NFA <Algorithms/Halting TM<Semi-algorithms/TM Properties

1. There exist languages that are not R.E.

2. There exist languages that are R.E but are undecidable.

Eg. universal TM langLATM ={hM,wi |M is a TM andM accepts w} 3. Decidable languages are closed under complementation.

4. L is decidable iffL isR.E andL is also R.E.

(3)

The halting problem

The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?

I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.

Proof: Suppose there exists TMH deciding LHALTTM , then construct a TMD s.t., on inputhM,wi:

I runs TMH on inputhM,wi I if H rejects then reject.

I if H accepts, then simulate M onw until it halts. I if at halting M has acceptedw, accept, else reject. ButD decidesLATM which is undecidable. A contradiction. This proof strategy is called a reduction.

(4)

The halting problem

The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?

I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.

Proof: Suppose there exists TM H decidingLHALTTM , then construct a TMD s.t., on inputhM,wi:

I runs TMH on inputhM,wi I if H rejects then reject.

I if H accepts, then simulate M onw until it halts.

I if at halting M has acceptedw, accept, else reject.

But D decidesLATM which is undecidable. A contradiction.

This proof strategy is called a reduction.

(5)

The halting problem

The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?

I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.

Proof: Suppose there exists TM H decidingLHALTTM , then construct a TMD s.t., on inputhM,wi:

I runs TMH on inputhM,wi I if H rejects then reject.

I if H accepts, then simulate M onw until it halts.

I if at halting M has acceptedw, accept, else reject.

But D decidesLATM which is undecidable. A contradiction.

(6)

Reduction from the acceptance problem

The halting problem for Turing Machines is undecidable Does a given Turing machine halt on a given input?

I LHALTTM ={hM,wi |M is a TM andM halts on inputw}.

hM,wi H

M Acc w

Rej Rej

Rej Rej Acc Acc

(7)

Some more undecidable problems

The emptiness problem for TMs

Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R. I DefineM1 which on input x,

I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts. I ConstructS which decidesATM: Given inputhM,wi,

I ConstructM1on tape fromM andw, I RunR on inputhM1i.

I IfR accepts,reject; ifR rejects thenaccept.

(8)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I DefineM1 which on input x, I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts. I ConstructS which decidesATM: Given inputhM,wi,

I ConstructM1on tape fromM andw, I RunR on inputhM1i.

I IfR accepts,reject; ifR rejects thenaccept.

(9)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I DefineM1 which on input x, I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts.

I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,

I RunR on inputhM1i.

I IfR accepts,reject; ifR rejects thenaccept.

(10)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I DefineM1 which on input x, I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts.

I ConstructS which decidesATM: Given inputhM,wi,

I ConstructM1on tape fromM andw, I RunR on inputhM1i.

I IfR accepts,reject; ifR rejects thenaccept.

(11)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I DefineM1 which on input x, I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts.

I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,

I RunR on inputhM1i.

I IfR accepts,reject; ifR rejects thenaccept.

(12)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I DefineM1 which on input x, I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts.

I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,

I IfR accepts,reject; ifR rejects thenaccept.

(13)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I DefineM1 which on input x, I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts.

I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,

I RunR on inputhM1i.

reject; ifR rejects thenaccept.

(14)

Some more undecidable problems

The emptiness problem for TMs is undecidable Does a given Turing machine accept any word?

I LTM ={hMi |M is a TM andL(M) =∅}.

Proof:

I For contradiction, assume its decidable, say by TM R.

I DefineM1 which on input x, I ifx6=w, it rejects

I ifx=w, runM onw and accept ifM accepts.

I ConstructS which decidesATM: Given inputhM,wi, I ConstructM1on tape fromM andw,

(15)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM ={hMi |M is a TM andL(M) is a regular language}.

Proof: By contradiction, assumeR decides Reg. We define S I S = On input hM,wi;

I construct TMM2as follows: M2on input x does the foll:

I ifx has the form 0n1n, accept.

I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.

I IfR accepts,accept; ifR rejects,reject.

(16)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM ={hMi |M is a TM andL(M) is a regular language}.

Proof: By contradiction, assume R decides Reg. We define S

I S = On input hM,wi;

I construct TMM2as follows: M2on input x does the foll:

I ifx has the form 0n1n, accept.

I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.

I IfR accepts,accept; ifR rejects,reject.

(17)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM ={hMi |M is a TM andL(M) is a regular language}.

Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;

I construct TMM2as follows:

M2on input x does the foll: I ifx has the form 0n1n, accept.

I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.

I IfR accepts,accept; ifR rejects,reject.

(18)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM ={hMi |M is a TM andL(M) is a regular language}.

Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;

I construct TMM2as follows:

M2on input x does the foll:

I ifx has the form 0n1n, accept.

I If not, runM onw and accept ifM acceptsw.

I RunR onhM2i.

I IfR accepts,accept; ifR rejects,reject.

(19)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM ={hMi |M is a TM andL(M) is a regular language}.

Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;

I construct TMM2as follows:

M2on input x does the foll:

I ifx has the form 0n1n, accept.

I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.

I IfR accepts,accept; ifR rejects,reject.

(20)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LREGTM ={hMi |M is a TM andL(M) is a regular language}.

Proof: By contradiction, assume R decides Reg. We define S I S = On input hM,wi;

I construct TMM2as follows:

M2on input x does the foll:

I ifx has the form 0n1n, accept.

I If not, runM onw and accept ifM acceptsw. I RunR onhM2i.

(21)

The principle of reduction

Reduction: An algorithm (TM!) to convert instances of one problem to another

I Convert instance of P1 to instance ofP2 I answer is yes forP1 iff answer is yes forP2

I then P2 is at least as hard asP1, i.e., I ifP1is not decidable, neither isP2 I ifP1is not r.e., neither isP2.

I note that every instance ofP2 need not be covered!

(22)

The principle of reduction

Reduction: An algorithm (TM!) to convert instances of one problem to another

I Convert instance of P1 to instance ofP2 I answer is yes forP1 iff answer is yes forP2 I then P2 is at least as hard asP1, i.e.,

I ifP1is not decidable, neither isP2 I ifP1is not r.e., neither isP2.

I note that every instance ofP2 need not be covered!

(23)

The principle of reduction

Reduction: An algorithm (TM!) to convert instances of one problem to another

I Convert instance of P1 to instance ofP2 I answer is yes forP1 iff answer is yes forP2 I then P2 is at least as hard asP1, i.e.,

I ifP1is not decidable, neither isP2

I ifP1is not r.e., neither isP2.

I note that every instance ofP2 need not be covered!

(24)

The principle of reduction

Reduction: An algorithm (TM!) to convert instances of one problem to another

I Convert instance of P1 to instance ofP2 I answer is yes forP1 iff answer is yes forP2 I then P2 is at least as hard asP1, i.e.,

I ifP1is not decidable, neither isP2 I ifP1is not r.e., neither isP2.

I note that every instance ofP2 need not be covered!

(25)

The principle of reduction

Reduction: An algorithm (TM!) to convert instances of one problem to another

I Convert instance of P1 to instance ofP2 I answer is yes forP1 iff answer is yes forP2 I then P2 is at least as hard asP1, i.e.,

I ifP1is not decidable, neither isP2 I ifP1is not r.e., neither isP2.

I note that every instance ofP2 need not be covered!

(26)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LEQTM ={hM1,M2i |M are TMs andL(M1) =L(M2)}.

Proof: Exercise.

(27)

Some more undecidable problems

The regularity problem for TMs

Does a given Turing machine accept a regular language?

I LEQTM ={hM1,M2i |M are TMs andL(M1) =L(M2)}.

Proof: Exercise.

References

Related documents

– Nondeterministic finite state automata (also with ε-transitions) – Kleene’s regular expressions, also appeared as Type-3 languages in!. Chomsky’s

All languages arising from MSGs are finitely generated, so the language ac- cepted by the message-passing automaton on Figure 2 shows that not all regular MSC languages can be

Convex sets, (Univariate) Functions, Optimization problem Unconstrained Optimization: Analysis and Algorithms Constrained Optimization: Analysis and Algorithms Optimization

Theorem (Space Hierarchy Theorem, [Stearns, Hartmanis, Lewis, 65]) There exists a language L that is computed by a TM in space O (s (n)) such that no TM running in space o(s(n))

We reduce Minsky machine halting problem to singular hybrid automata reachability

MANNITOL, a straight- chain alchohol, a white water- soluble crystelline powder, is another product which can be extracted from brown algae. This can be utilised as a sub- stitute

• Recall a closure property is a statement that a certain operation on languages, when applied to languages in a class, produces a result that is also in that class.. • For

• For the second equality, note that (a+b)* denotes strings over a and b, that a string either contains ab or it doesn’t; the first half of the left-hand expression describes