Top Banner
Fall 2003 Costas Busch - RPI 1 Decidability
45

Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Dec 19, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 1

Decidability

Page 2: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 2

Recall: A language is decidable (recursive), if there is a Turing machine (decider) that accepts the language and halts on every input string

AM

A

Turing Machine

Inputstring

Accept

Reject

M

Decider for A

DecisionOn Halt:

Decidable Languages

Page 3: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 3

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

Is number prime? x

Corresponding language:

Problem:

Page 4: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 4

On input number :x

Divide with all possible numbersbetween and

If any of them divides Then rejectElse accept

x2 x

Decider for : PRIMES

x

Page 5: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 5

We also say that the correspondingprime number problem is solvable:

we can give an answer (positive or negative)for every input instance of the problem

Thus, PRIMES is decidable

Page 6: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 6

(Input string)

Accept

Reject

is number prime?

Decider for PRIMES

Input numberxYES

NO

the decider for the languagesolves the corresponding problem

(Accept)

(Reject)

Page 7: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 7

Problem:Does DFA acceptthe empty language ?

M

Corresponding Language:

} language empty accepts that DFA a is :{

MM

EMPTYDFA

X

Description of DFA as a stringM

)(ML

(For example, we can represent as a binary string, as we did for Turing machines)

M

Page 8: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 8

Determine whether there is a path from the initial state to any accepting state

Decider for :

On input : M

DFA

)(ML

M DFA M

)(ML

Reject MDecision: Accept M

DFAEMPTY

Page 9: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 9

Problem: Does DFA accept a finite language?

M

Corresponding Language:

}language finite a accepts that DFA a is :{ MM

FINITE DFA X

Decidable language

Page 10: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 10

Decider for :

On input : M

DFA M DFA M

Reject MDecision: Accept M

Check if there is a walk with cyclefrom the initial state to an accepting state

infinite finite

DFAFINITE

Page 11: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 11

Problem: Does DFA accept string ? M

Corresponding Language:

} string accepts that DFA a is :,{ wMwM

ADFA X

w

Decidable language

Page 12: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 12

Decider for :

On input string :

DFAA

Run DFA on input string M w

If accepts Then accept (and halt)Else reject (and halt)

M wwM,

wM,

wM,

Page 13: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 13

Problem:Do DFAs and accept the same language?

1M

Corresponding Language:

}languages same the

accept that DFAs are and :,{ 2121 MMMM

EQUALDFA X

Decidable language

2M

Page 14: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 14

Let be the language of DFA Let be the language of DFA

1L

2L

)()()( 2121 LLLLML

Decider for :

On input : 21,MM

1M

2M

Construct DFA such that:M

(combination of DFAs)

DFAEQUAL

Page 15: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 15

)()( 2121 LLLL

21 LL 21 LLand

21 LL

1L 2L 1L2L

21 LL 12 LL 2L 1L

Page 16: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 16

)()( 2121 LLLL

21 LL 21 LLor

1L 2L 1L2L

21 LL 12 LL

21 LL

Page 17: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 17

Therefore, we only need to determine whether

)()()( 2121 LLLLML

which is a solvable problem for DFAs:

?)( DFAEMPTYML

Page 18: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 18

Undecidable Languages

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

undecidable language =language is not decidable

There is no decider for the language:

(decision may be reached for some strings)

Page 19: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 19

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)

Page 20: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 20

We have shown before that there are undecidable languages:

Decidable

Turing recognizable

L

L

Lis Turing recognizable but not decidable

Page 21: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 21

We will prove that two particular problemsare unsolvable:

Membership problem

Halting problem

Page 22: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 22

Membership Problem

Input: •Turing MachineM•String w

Question: Does accept ? M w?)(MLw

Corresponding language:

} string accepts

that machine Turing a is :,{

w

MwMATM

Page 23: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 23

Theorem:

(The membership problem is unsolvable)

Proof:

We will assume that is decidable;We will then prove that every decidable languageis also Turing recognizable

TMA is undecidable

TMABasic idea:

A contradiction!

Page 24: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 24

Suppose that is decidable

HM

w

YES M accepts w

NO M rejects w

TMA

Deciderfor TMAwM,

Input string

Page 25: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 25

Let be a Turing recognizable language L

Let be the Turing Machine that acceptsLM L

We will prove that is also decidable: L

we will build a decider for L

Page 26: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 26

NO

YESLM

s

H accept

L

reject

Decider for

(and halt)

(and halt)

Decider forTMA

Inputstring

s

sLM accepts ?s

Page 27: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 27

Therefore, L is decidable

But there are Turing recognizablelanguages which are not decidable

Contradiction!!!!

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

L

END OF PROOF

Page 28: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 28

We have shown:

Decidable

TMAUndecidable

Page 29: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 29

We can actually show:

Decidable

TMATuring recognizable

Page 30: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 30

Turing machine that accepts :TMA

wM,

Run on input

If accepts then accept

M w

M wwM,

TMA is Turing recognizable

Page 31: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 31

Halting Problem

Input: •Turing MachineM•String w

Question: Does halt whileprocessing input string ?

M

w

Corresponding language:

} string input on halts

that machine Turing a is :,{

w

MwMHALTTM

Page 32: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 32

Theorem:

(The halting problem is unsolvable)

Proof:

Suppose that is decidable;we will prove that every decidable languageis also Turing recognizable

TMHALT is undecidable

Basic idea:

A contradiction!

TMHALT

Page 33: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 33

M

w

YES Mhalts oninput

w

Mdoesn’t halt on input wNO

Suppose that is decidableTMHALT

Decider for

TMHALT

wM,

Input string

Page 34: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 34

Let be a Turing recognizable language L

Let be the Turing Machine that acceptsLM L

We will prove that is also decidable: L

Lwe will build a decider for

Page 35: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 35

haltsand accepts

LM halts on ?s YES

NOLM

Run with input

LM

rejects

accept

reject

LDecider for

s

s

s

Inputstring

Decider for

TMHALT

s

LM

and halt

haltsand rejects

LM

and halt

and halt

Page 36: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 36

Therefore L is decidable

But there are Turing recognizablelanguages which are not decidable

Contradiction!!!!

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

L

END OF PROOF

Page 37: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 37

Theorem:

Proof:

Assume for contradiction thatthe halting problem is decidable;

(The halting problem is unsolvable)

TMHALT is undecidable

we will obtain a contradictionusing a diagonilization technique

An alternative proof

Basic idea:

Page 38: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 38

HM

w

YES M halts on w

Mdoesn’t halt on

wNO

Suppose that is decidableTMHALT

Deciderfor TMHALTwM,

Input string

Page 39: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 39

H

wM, 0q

yq

nq

Input string: YES

NO

Looking inside

H

Decider for TMHALT

M halts on ?w

Page 40: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 40

H

0q

yq

nq NO

aq bq

H Loop forever

YES

wM,

Construct machine :H

If halts on input Then Loop Forever Else Halt

M w

M halts on ?w

Page 41: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 41

Construct machine :

MM,Copyon tape

H F

If M halts on input M

Then loop forever

Else halt

MM

F

Page 42: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 42

Run with input itself

FF ,Copyon tape

H

If F halts on input F

Then loops forever on input

Else halts on input

FF

F

F

FF

FF

END OF PROOFCONTRADICTION!!!

Page 43: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 43

We have shown:

Decidable

Undecidable TMHALT

Page 44: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 44

We can actually show:

Decidable

Turing recognizable

TMHALT

Page 45: Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)

Fall 2003 Costas Busch - RPI 45

Turing machine that accepts :

wM,

Run on input

If halts on then accept

M w

M wwM,

TMHALT

is Turing recognizableTMHALT