0% found this document useful (0 votes)
18 views52 pages

Un Decid Able

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views52 pages

Un Decid Able

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 52

Undecidability

1
– RE languages are accepted (recognized) by TM’s.
– RE languages may be grouped into two classes:
• Class 1 (recursive language) --- each language L
in this class has a TM (thought as an algorithm)
which not only accepts strings of L, but also
tells us what strings are not in L by halting.

• Class 2 (RE but not recursive) --- each language


L in this class has a TM (not thought as an
algorithm) which accepts strings of L, but may
not halt when a given input string is not in L.

2
– Formally, a language L is recursive if L = L(M)
for some TM M such that:
(1) If wL, then M accepts (and therefore
halts).
(2) If wL, then M eventually halts,
although it never enters an accepting state
(i.e., “reject” ) .
– A TM of this type corresponds to the formal
notion of algorithm.
3
Church-Turing Thesis
• A Turing machine that halts on all inputs is
the precise formal notion corresponding to
the intuitive notion of an algorithm.

• An “algorithm” means a precisely defined


set of instructions

• This thesis cannot be formally proven

4
Consequence of Church-Turing Thesis:

If a problem cannot be solved by a Turing


machine then it cannot be solved by a
human using a precisely defined sequence
of instructions

5
A given language L, regarded as a problem, is
called decidable if L is a recursive language;
and undecidable if not.

The existence or nonexistence of an


algorithm to solve a problem (i.e., the problem
is decidable or undecidable) is more important
than the existence or nonexistence of a TM
to solve the problem.

6
Decidable Languages
Recall that:
A language A is decidable,
if there is a Turing machine M (decider)
that accepts the language A and
halts on every input string
Decision
Turing Machine M On Halt:
YES
Accept
Input
Decider for A
string NO
Reject
7
A computational problem is decidable
if the corresponding language is decidable

We also say that the problem is solvable

8
Undecidable Languages
undecidable language = not decidable language

There is no decider:
there is no Turing Machine
which accepts the language
and makes a decision (halts)
for every input string

(machine may make decision for some input strings)

9
For an undecidable language,the corresponding
problem is undecidable (unsolvable):

There is no Turing Machine (Algorithm)


that gives an answer (yes or no)
for every input instance

(answer may be given for some input instances)

10
Remember that there are undecidable
languages (i.e. also undecidable problems):

L
Turing-Acceptable L

Decidable

L is Turing-Acceptable and undecidable


11
We will prove that two particular problems
are unsolvable:

Membership problem

Halting problem

12
Acceptance/Membership Problem
Input: •Turing Machine M
•String w

Question: Does M accept w ?


w L(M ) ?
How can we state this as a language problem?
Corresponding language:
ATM  { M ,w : M is a Turing machine that
accepts string w }
13
If we can decide if a string is in ATM, then
we can solve the Membership Problem

Is ATM Turing-recognizable?

A language L is “Turing-recognizable” if
there exists a TM M such that for all
strings w:
If w  L eventually M enters final state.
If w  L either M enters non-final state
or M never
terminates 14
We can actually show:

Turing-Acceptable ATM

Decidable

15
ATM is Turing-Acceptable

Turing machine that accepts ATM :

1. Run M on input w
M ,w 2. If M accepts w
then accept M ,w

16
Theorem: ATM is undecidable
(The membership problem is unsolvable)

Proof: Proof-by-contradiction:
Basic idea:

We will assume that ATM is decidable; We will


then prove that every Turing-Acceptable
language is decidable.

A contradiction!
17
Suppose that ATM is decidable

Input
string Decider
M ,w for ATM
M YES M accepts w
H
w NO M rejects w

18
Let L be a Turing recognizable language
Let ML be the Turing Machine that accepts L

We will prove that L is also decidable:


we will build a decider for L

19
String description of ML

Decider for L

ML Decider for ATM


YES accept s
ML accepts s ? (and halt)

s NO reject s
Input (and halt)
string

20
Therefore, L is decidable

Since L is chosen arbitrarily, every


Turing-Acceptable language is decidable

But there is a Turing-Acceptable language


which is undecidable

Contradiction!!!!
END OF PROOF
21
We have shown:

Undecidable ATM

Decidable

22
Halting Problem
Input: •Turing Machine M
•String w

Question: Does M halt while


processing input string w ?

Corresponding language:

HALTTM  { M ,w : M is a Turing machine that


halts on input string w }
23
We can actually show:

Turing-Acceptable HALTTM

Decidable

24
HALTTM is Turing-Acceptable

Turing machine that accepts HALTTM :

1. Run M on input w
M ,w
2. If M halts on w
then accept M ,w

25
Theorem: HALTTM is undecidable
(The halting problem is unsolvable)

Proof:
Basic idea:
Suppose that HALTTM is decidable;
we will prove that every Turing-Acceptable
language is also decidable.

A contradiction!
26
Suppose that HALTTM is decidable

Input
string
M ,w
halts on
M YES M w
Decider for input

w HALTTM
NO doesn’t halt
M on input w

27
Let L be a Turing-Acceptable language
Let ML be the Turing Machine that accepts L

We will prove that L is also decidable:


we will build a decider for L

28
Decider for L
Decider for
HALTTM
ML
NO reject s
ML halts on s ? and halt
s YES

Input
accept s
ML halts
string and accepts
Run ML and halt

with input s
reject s
ML halts
and rejects
and halt

29
Therefore, L is decidable

Since L is chosen arbitrarily, every


Turing-Acceptable language is decidable

But there is a Turing-Acceptable language


which is undecidable

Contradiction!!!!
END OF PROOF
30
An alternative proof

Theorem: HALTTM is undecidable


(The halting problem is unsolvable)

Proof:
Basic idea:
Assume for contradiction that
the halting problem is decidable;

31
Suppose that HALTTM is decidable
Assume there exists some TM H that decides HALTTM
Input
string Decider
M ,w for HALTTM

M YES M halts on w
H
w NO doesn’t
M w
halt on
32
Looking inside H
Decider for HALTTM
H qaccept YES
Input string:
M ,w q0 M halts on w?
qreject NO

33
Construct machine H :
H Loop forever
H qacceptYES qa qb
M ,w q0 M halts on w?
qreject NO

If M halts on input w Then Loop Forever


Else Halt
34
Construct machine F :

F
Copy M M, M
M
on tape
H

If M halts on input M
Then loop forever
Else halt
35
Run F with input itself
F
Copy F F ,F
F
on tape
H

If F halts on input F
Then F loops forever on input F
Else F halts on input F

CONTRADICTION!!! END OF PROOF


36
We have shown:

Undecidable HALTTM

Decidable

37
Proving Undecidability

38
Proofs of Decidability

How can you prove a language is decidable?

39
What Decidable Means
A language L is decidable if there exists a TM M such that
for all strings w:
– If w  L, M enters qAccept.
– If w  L, M enters qReject.

To prove a language is decidable, we can


show how to construct a TM that decides it.

For a correct proof, need a convincing argument


that the TM always eventually accepts or rejects
any input.
40
Proofs of Undecidability

To prove a language is undecidable, need to


show there is no Turing Machine that can
decide the language.

This is hard: requires reasoning about all


possible TMs.

41
Reduction
Let’s say we want to solve problem of class A
and we know how to solve problems of class B
 If for every problem of class A, we can find a
way to convert it some problem of class B, ...
then, we can solve all problems of class A using our
method for solving problems of class B.
 We can also talk about how much effort is needed
to transform the problem. For most of what we
are interested in here, it is enough that the
transformation can be computed by a Turing
machine.
42
Proof by Reduction

1. We know X does not exist.


X (e.g., X = a TM that can decide ATM )

2. Assume Y exists. Y
(e.g., Y = a TM that can decide B)

3. Show how to use Y to make X.


4. Since X does not exist, but Y could be used
to make X, then Y must not exist.
43
Reduction Proofs
A reduces to B

A reduces to B

means
Y can be used to make
X
that can solve B that can solve A

Hence, A is not a harder problem than B.

44
Converse?
A reduces to B

Y can be used to make


X
that can solve B that can solve A

A is not a harder problem than B.


Does this mean B is as hard as A?

No! Y can be any solver for B. X is one


solver for A. There might be easier solvers
for A. 45
Reduction Pitfalls
• Be careful: the direction matters a great
deal
– Showing a machine that decides B can be used to
build a machine that decides A shows that A is
not harder than B.
– To show equivalence, need reductions in both
directions.
• The transformation must involve only things
you know you can do: otherwise the
contradiction might be because something
else doesn’t exist.
What does can do mean here?
46
What “Can Do” Means?
• The transformations in a reduction proof
are limited by what you are proving.
• For undecidability proofs, you are proving
something about all TMs: the reduction
transformations are anything that a TM
can do that is guaranteed to terminate.

• For complexity proofs (later), you are


proving something about how long it takes:
the time it takes to do the transformation
is limited.
47
The Halting Problem

HALTTM = { <M, w> | M is a TM description


and M halts on input w }

Alternate statement as problem:


Input: A TM M and input w
Output: True if M halts on w, otherwise False.

48
Is HALTTM Decidable?

• Possible “Yes” answer: Prove it is decidable

Design a TM that can decide HALTTM

• Possible “No” answer: prove it is undecidable


Show that no TM can decide HALTTM

Show that a TM that could decide HALTTM


could be used to decide ATM which we already
proved is undecidable.
49
Membership Language

ATM = { <M, w> | M is a TM description


and M accepts input w }

We already proved ATM is undecidable.

Since we know ATM is undecidable, we can show a


new language B is undecidable if a machine that can
decide B could be used to build a machine that can
decide ATM.

50
Reducing ATM to HALTTM

HALTTM = { <M, w> | M is a TM description


and M halts on input w }

ATM = { <M, w> | M is a TM description


and M accepts input w }

<M, w> is in ATM if and only if:


M halts on input w
and when M halts it is in accepting state.

51
Deciding ATM
• Assume HALTTM is decidable.
• Then some TM R can decide HALTTM.
• We can use R to build a machine that decides ATM:
– Simulate R on <M, w>
– If R rejects, it means M doesn’t halt: reject.
– If R accepts, it means M halts:
• Simulate M on w, accept/reject based on M’s
accept/reject.

Since any TM that decides HALTTM could be used to


build a TM that decides ATM (which we know is
impossible) this proves that no TM exists that can
decide HALTTM . 52

You might also like