This action might not be possible to undo. Are you sure you want to continue?

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 On Halt: Turing Machine M Input string

Fall 2003

**Accept Decider for
**

Costas Busch - RPI

A

Reject

2

Problem:

Is number x prime?

Corresponding language:

P IMES ! {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, PR MES 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

(Accept)

Input number

(Input string)

**is number prime?
**

Reject

NO

(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:

Fall 2003

Reject M

Costas Busch - RPI

Accept M

8

Problem: Does DFA M accept a finite language?

Corresponding Language:

X

FINITE DFA ! { M : M is a DFA t at 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 Decision:

Fall 2003

finite Accept M

10

Reject M

Costas Busch - RPI

Problem: Does DFA M

accept string w ?

Corresponding Language:

X

ADFA ! { M ,w : M is a DFA t at accepts string }

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 M accept the same language?

Corresponding Language:

X

EQUALDFA ! { M1 , M : M1 and M are DFAs that accept the same languages }

Decidable language

Fall 2003 Costas Busch - RPI 13

**Decider for EQUALDFA : On input Let Let
**

M1 ,M2 :

L1 be the language of DFA M1 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 2

L2

L1 L1

L1 L2 L1 ! L2

Fall 2003

L2 L1

Costas Busch - RPI

15

( L1 L2 ) ( L1 L2 ) { L1 L2 {

or

L1 L2 {

L1

L2

L2

L1

L1 L2 L1 { L2

Fall 2003

L2 L1

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
**

Costas Busch - RPI 20

Fall 2003

We will prove that two particular problems are unsolvable:

Membership problem

Halting problem

Fall 2003

Costas Busch - RPI

21

Membership Problem Input: Turing Machine String w Does M

M

Question:

accept w ?

w L(M ) ?

Corresponding language:

**A ! { M ,w : M is a Turing machine that TM accepts string w }
**

Fall 2003 Costas Busch - RPI 22

Theorem: A TM

is undecidable

(The membership problem is unsolvable)

Proof: Basic idea: We will assume that A TM is decidable; We will then prove that every decidable language is also Turing recognizable A contradiction!

Fall 2003 Costas Busch - RPI 23

Suppose that A is decidable TM Input string M,w

Decider for A TM YES

M

M accepts w

M rejects w

24

w

Fall 2003

H

NO

Costas Busch - RPI

Let

L be a Turing recognizable language

Let ML be the Turing Machine that accepts

L

We will prove that

L is also decidable:

L

we will build a decider for

Fall 2003

Costas Busch - RPI

25

Decider for

L

YES accept s

(and halt)

ML Decider for A TM

H

s

ML accepts s ? NO

reject s

(and halt)

Input 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 A TM

Decidable

Fall 2003

Costas Busch - RPI

28

We can actually show:

Turing recognizable

A TM

Decidable

Fall 2003

Costas Busch - RPI

29

A is Turing recognizable TM

Turing machine that accepts A : TM Run M on input

M,w

w

If M accepts w then accept M,w

Fall 2003

Costas Busch - RPI

30

Halting Problem Input: Turing Machine String w

M

Question:

Does M halt while processing input string w ?

Corresponding language:

HALTTM ! { M ,w : M is a Turing

achine that

**halts on input string w }
**

Fall 2003 Costas Busch - RPI 31

**Theorem: HALT is undecidable TM
**

(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 HALT is decidable TM Input string

M,w

M

w

Decider for

YES NO

M

halts on input

w

HALTTM

M

doesn·t halt on input

w

33

Fall 2003

Costas Busch - RPI

Let

L be a Turing recognizable language

Let ML be the Turing Machine that accepts

L

We will prove that

L is also decidable:

L

we will build a decider for

Fall 2003

Costas Busch - RPI

34

Decider for

ML

Decider for HALTTM

L

NO reject s

and halt

s

Input string

**ML halts on s ? YES
**

ML halts and accepts

accept s

and halt

Run ML with input s

ML halts and rejects

reject s

and halt

35

Fall 2003

Costas Busch - RPI

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!!!!

Fall 2003 Costas Busch - RPI

END OF PROOF

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 HALT is decidable TM Input string

M,w

M

w

Decider for HALT TM

H

YES NO

M halts on w

M

doesn·t halt on

w

38

Fall 2003

Costas Busch - RPI

Looking inside

H

Decider for HALTTM Input string:

H

q0

q y YES

M,w

M halts on w?

qn NO

Fall 2003

Costas Busch - RPI

39

Construct machine

: Hd Loop forever

Hd

H

M,w

qy

YES

qa

qb

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

M

Copy M on tape

M, M

Hd

**If M halts on input M Then loop forever Else halt
**

Fall 2003 Costas Busch - RPI 41

Run F

**with input itself
**

F ,F

F

F

Copy F on tape halts on input

Hd

If F

F

**Then F loops forever on input F Else F halts on input F CONTRADICTION!!!
**

Fall 2003 Costas Busch - RPI

END OF PROOF

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

M,w

w

If M halts on w then accept M,w

Fall 2003

Costas Busch - RPI

45

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd