0% found this document useful (0 votes)
102 views45 pages

Dec Id Ability

This document discusses decidable and undecidable languages in computability theory. It begins by defining a decidable language as one for which there exists a Turing machine that halts and provides an answer (accept or reject) for every input string. It provides examples of decidable languages like the set of prime numbers and describes how to construct Turing machines to decide them. The document then proves that the language of Turing machines that accept a given string (the membership problem) and the language of Turing machines that halt on a given input (the halting problem) are undecidable, showing that some problems are fundamentally unsolvable.

Uploaded by

tariqravian
Copyright
© Attribution Non-Commercial (BY-NC)
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)
102 views45 pages

Dec Id Ability

This document discusses decidable and undecidable languages in computability theory. It begins by defining a decidable language as one for which there exists a Turing machine that halts and provides an answer (accept or reject) for every input string. It provides examples of decidable languages like the set of prime numbers and describes how to construct Turing machines to decide them. The document then proves that the language of Turing machines that accept a given string (the membership problem) and the language of Turing machines that halt on a given input (the halting problem) are undecidable, showing that some problems are fundamentally unsolvable.

Uploaded by

tariqravian
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 45

Decidability

Fall 2003 Costas Busch - RPI 1


Decidable Languages
Recall:
A language A is decidable (recursive),
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:
Accept
Input
string
Decider for A
Reject
Fall 2003 Costas Busch - RPI 2
Problem: Is number x prime?

Corresponding language:

PRIMES  {1, 2, 3, 5, 7, }

Fall 2003 Costas Busch - RPI 3


Decider for PRIMES :
On input number x :
Divide x with all possible numbers
between 2 and x

If any of them divides x


Then reject
Else accept

Fall 2003 Costas Busch - RPI 4


Thus, PRIMES is decidable

We also say that the corresponding


prime number problem is solvable:

we can give an answer (positive or negative)


for every input instance of the problem

Fall 2003 Costas Busch - RPI 5


the decider for the language
solves the corresponding problem
Decider for PRIMES
Accept
YES
Input number x is number prime?
(Accept)

(Input string)
NO
Reject (Reject)

Fall 2003 Costas Busch - RPI 6


Problem: Does DFA M accept
the empty language L(M )  ?

Corresponding Language: X

EMPTYDFA 
{ M : M is a DFA that accepts empty language  }

Description of DFA M as a string


(For example, we can represent M as a
binary string, as we did for Turing machines)
Fall 2003 Costas Busch - RPI 7
Decider for EMPTYDFA :

On input M :
Determine whether there is a path from
the initial state to any accepting state
DFA M DFA M

L (M )   L (M )  

Decision: Reject M Accept M


Fall 2003 Costas Busch - RPI 8
Problem: Does DFA M accept
a finite language?

Corresponding Language: X

FINITE DFA 
{ M : M is a DFA that accepts a finite language}

Decidable language

Fall 2003 Costas Busch - RPI 9


Decider for FINITE DFA :
On input M :
Check if there is a walk with cycle
from the initial state to an accepting state

DFA M DFA M

infinite finite

Decision: Reject M Accept M


Fall 2003 Costas Busch - RPI 10
Problem: Does DFA M accept string w ?

Corresponding Language: X

ADFA 
{ M ,w : M is a DFA that accepts string w }

Decidable language

Fall 2003 Costas Busch - RPI 11


Decider for ADFA :

On input string M ,w :

Run DFA M on input string w

If M accepts w
Then accept M ,w (and halt)
Else reject M ,w (and halt)

Fall 2003 Costas Busch - RPI 12


Problem: Do DFAs M1 and M2
accept the same language?

Corresponding Language: X

EQUALDFA 
{ M1 , M2 : M1 and M2 are DFAs that accept
the same languages }

Decidable language

Fall 2003 Costas Busch - RPI 13


Decider for EQUALDFA :

On input M1 , M2 :
Let L1 be the language of DFA M1
Let L2 be the language of DFA M2

Construct DFA M such that:

L(M )  (L1  L2 )  (L1  L2 )

(combination of DFAs)
Fall 2003 Costas Busch - RPI 14
( L1  L2 )  ( L1  L2 )  

L1  L2   and L1  L2  

L1 L2 L L2 L1 L1
2
L1  L2 L2  L1

L1  L2
Fall 2003 Costas Busch - RPI 15
( L1  L2 )  ( L1  L2 )  

L1  L2   or L1  L2  

L1 L2 L2 L1

L1  L2 L2  L1

L1  L2
Fall 2003 Costas Busch - RPI 16
Therefore, we only need
to determine whether

L(M )  (L1  L2 )  (L1  L2 )  

which is a solvable problem for DFAs:

L(M )  EMPTYDFA ?

Fall 2003 Costas Busch - RPI 17


Undecidable Languages
undecidable language =
language is not decidable

There is no decider for the language:


there is no Turing Machine
that reaches a decision (halts)
for all input strings of the language

(decision may be reached for some strings)


Fall 2003 Costas Busch - RPI 18
For an undecidable language,
the corresponding problem is unsolvable:

there is no Turing Machine (Algorithm)


that gives an answer (solves the problem)
for all input instances of the problem

(answer may be given for some input instances)

Fall 2003 Costas Busch - RPI 19


We have shown before that there are
undecidable languages:
L
Turing recognizable
L
Decidable

L is Turing recognizable but not decidable


Fall 2003 Costas Busch - RPI 20
We will prove that two particular problems
are unsolvable:

Membership problem

Halting problem

Fall 2003 Costas Busch - RPI 21


Membership Problem
Input: •Turing Machine M
•String w

Question: Does M accept w ?


w L(M ) ?

Corresponding language:
ATM  { M ,w : M is a Turing machine that
accepts string w }
Fall 2003 Costas Busch - RPI 22
Theorem: ATM is undecidable
(The membership problem is unsolvable)

Proof:
Basic idea:
We will assume that ATM is decidable;
We will then prove that
every decidable language
is also Turing recognizable
A contradiction!
Fall 2003 Costas Busch - RPI 23
Suppose that ATM is decidable

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

Fall 2003 Costas Busch - RPI 24


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

Fall 2003 Costas Busch - RPI 25


Decider for L

ML Decider for ATM


YES accept s
H (and halt)
ML accepts s ? NO
s reject s
Input (and halt)
string

Fall 2003 Costas Busch - RPI 26


Therefore, L is decidable
Since L is chosen arbitrarily, every
Turing recognizable language
is also decidable

But there are Turing recognizable


languages which are not decidable

Contradiction!!!!
END OF PROOF
Fall 2003 Costas Busch - RPI 27
We have shown:

Undecidable ATM

Decidable

Fall 2003 Costas Busch - RPI 28


We can actually show:

Turing recognizable
ATM

Decidable

Fall 2003 Costas Busch - RPI 29


ATM is Turing recognizable

Turing machine that accepts ATM :

Run M on input w
M ,w If M accepts w
then accept M ,w

Fall 2003 Costas Busch - RPI 30


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 }
Fall 2003 Costas Busch - RPI 31
Theorem: HALTTM is undecidable
(The halting problem is unsolvable)

Proof:
Basic idea:
Suppose that HALTTM is decidable;
we will prove that
every decidable language
is also Turing recognizable
A contradiction!
Fall 2003 Costas Busch - RPI 32
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

Fall 2003 Costas Busch - RPI 33


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

Fall 2003 Costas Busch - RPI 34


Decider for L
ML
Decider for NO reject s
HALTTM and halt

s ML halts on 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

Fall 2003 Costas Busch - RPI 35


Therefore L is decidable
Since L is chosen arbitrarily, every
Turing recognizable language
is also decidable

But there are Turing recognizable


languages which are not decidable

Contradiction!!!!
END OF PROOF
Fall 2003 Costas Busch - RPI 36
An alternative proof

Theorem: HALTTM is undecidable


(The halting problem is unsolvable)

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

we will obtain a contradiction


using a diagonilization technique
Fall 2003 Costas Busch - RPI 37
Suppose that HALTTM is decidable

Input
string Decider
M ,w for HALTTM

M YES M halts on w
H
w NO doesn’t
M w
halt on
Fall 2003 Costas Busch - RPI 38
Looking inside H
Decider for HALTTM
H q y YES
Input string:
M ,w q0 M halts on w?
qn NO

Fall 2003 Costas Busch - RPI 39


Construct machine H :
H Loop forever
H qy YES qa qb
M ,w q0 M halts on w?
qn NO

If M halts on input w Then Loop Forever


Else Halt
Fall 2003 Costas Busch - RPI 40
Construct machine F :

F
Copy M M, M
M
on tape
H

If M halts on input M
Then loop forever
Else halt
Fall 2003 Costas Busch - RPI 41
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
Fall 2003 Costas Busch - RPI 42
We have shown:

Undecidable HALTTM

Decidable

Fall 2003 Costas Busch - RPI 43


We can actually show:

Turing recognizable
HALTTM

Decidable

Fall 2003 Costas Busch - RPI 44


HALTTM is Turing recognizable

Turing machine that accepts HALTTM :

Run M on input w
M ,w If M halts on w
then accept M ,w

Fall 2003 Costas Busch - RPI 45

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy