15 views

Uploaded by MELJUN CORTES, MBA,MPA

MELJUN CORTES -- AUTOMATA THEORY LECTURE

save

You are on page 1of 33

**CORTES, MBA,MPA,BSCS,ACS
**

CSC 3130: Automata theory and formal languages

Undecidable Languages

Andrej Bogdanov

http://www.cse.cuhk.edu.hk/~andrejb/csc3130

**Are Turing Machines computers?
**

input data instructions (program)

computer

output data

A Turing Machine does not take the program as part of its input. ... but it can!

**The Universal Turing Machine
**

input x program 〈M 〉

U

M on input x

The universal TM U takes as inputs a program M and a string x and simulates M on x The program M itself is specified as a TM!

**Turing Machines as strings
**

☐/☐R

q0 qrej qacc

M

**• This Turing Machine can be described by the string
**

〈M〉 = ((q0, qacc, qrej), ((q0, q0, ☐/☐R), (q0, qacc, 0/0R), (q0, qrej, 1/1R)))

The universal Turing Machine

001

input x

U

((q0, qacc, qrej), ((q0, q0, ☐/☐R), program 〈M

〉

q0

state

U on input (〈M〉, x) will simulate M on input x

**Languages about automata
**

• A TM can take another TM (or DFA, CFG) as input

ADFA = {(〈D〉, w): D is a DFA that accepts input w} APDA = {(〈P〉, w): P is a PDA that accepts w}

ATM = {(〈M〉, w): M is a TM that accepts w}

Which of these is decidable?

**Languages about automata
**

ATM = {(〈M〉, w): M is a TM that accepts w} • Idea: Simulate M on input w • Simulation is correct:

– If M accepts w, we accept – If M rejects w, we reject – If M loops on w, we loop

• This TM recognizes but does not decide ATM

**Recognizing versus deciding
**

The language recognized by a TM is the set of all inputs that make it reach qacc A TM decides language L if it recognizes L and does not loop on any input

– This kind of TM is called a decider

**• The textbook uses different terminology:
**

recognizable = recursively enumerable (r. e.) decidable = recursive

Undecidability

• Turing’s Theorem: The language ATM is undecidable.

• Before we prove this, let’s observe one thing: A Turing Machine M can be given its own description 〈M〉 as an input!

Proof of undecidability

• Proof by contradiction: Suppose ATM is decidable.

Then there is a TM H that decides ATM:

〈M〉, 〈 w M〉

H

accept if M accepts 〈M〉 w

reject if M rejects w 〈M〉 or M loops on 〈M w 〉

What happens when w = 〈M〉?

Proof of undecidability

〈M〉, 〈M 〉

H

accept if M accepts 〈M〉 reject if M rejects 〈M〉 or M loops on 〈M〉

**Let H’ be a TM that does the opposite of H
**

acc

H’

acc rej

H

rej

Proof of undecidability

〈M〉, 〈M〉

H

accept if M accepts 〈M〉 reject if M rejects 〈M〉 or M loops on 〈M〉

〈M〉, 〈M 〉

H’

accept

if M rejects 〈M〉 or M loops on 〈M〉

reject if M accepts 〈M〉

Proof of undecidability

〈M〉, 〈M〉

H’

accept

if M rejects 〈M〉 or M loops on 〈M〉

reject if M accepts 〈M〉

**Let D be the following TM:
**

〈M〉 〈M〉, 〈M〉

copy

H’

Proof of undecidability

〈D 〈M 〉 〉 accept if M rejects 〈D〉 D 〈M〉 or M loops on 〈D〉 D 〈M reject 〉 M accepts 〈D〉 if D 〈

D

M〉

**What happens when M = D?
**

If D accepts 〈D〉 then D rejects 〈D〉

If D rejects 〈D〉 then D accepts 〈D〉

so D does not exist!

**Proof of undecidability: conclusion
**

• Proof by contradiction

– We assumed ATM was decidable – Then we had Turing Machines H, H’, D – But D does not exist!

• Conclusion The language ATM is undecidable.

What happened?

input w e Turing Machine

M1 M2 M3 …

acc rej rej

0

rej acc loop

1

rej loop rej

00

acc rej rej

…

…

We can write an infinite table for every pair (M, w)

…

What happened?

〈M1〉 〈M2〉 〈M3〉 〈M4〉 …

M1 M2 …

acc rej loop acc rej rej rej loop acc acc rej

…

M3 loop

Now let’s look only at those w that describe a TM M

…

What happened?

〈M1〉 〈M2〉 〈M3〉 〈M4〉 … M1 M2 …

acc

rej rej

loop

acc rej

rej

rej acc

acc

acc rej

…

D

…

If ATM is decidable, then TM D is in the table

…

…

What happened?

〈M1〉 〈M2〉 〈M3〉 〈M4〉 … M1 M2 …

acc

rej

loop

acc

rej

rej

acc

acc

…

D

rej

rej

…

acc

rej

**D does the opposite of the diagonal entries
**

〈M〉

D

accept if M rejects or loops on 〈M〉 reject if M accepts 〈M〉

What happened?

〈M1〉 〈M2〉 〈M3〉 〈M4〉 … 〈D〉

loop

M1 M2

…

acc

loop

rej

acc

rej

acc

rej

acc

…

acc

…

D

rej

rej

acc

rej

…

?

We run into trouble when we look at (D, 〈D〉)!

Unrecognizable languages

The language ATM is recognizable but not decidable. • How about languages that are not recognizable?

ATM = {(〈M〉, w): M is a TM that does not accept w} = {(〈M〉, w): M rejects or loops on input w}

The language ATM is not recognizable.

Unrecognizable languages

• General Theorem If L and L are both recognizable, then L is decidable.

• We know ATM is recognizable, so if ATM were also, then ATM would be decidable • Impossible by Turing’s Theorem

Unrecognizable languages

If L and L are both recognizable, then L is decidable. • Proof idea

w

M

accept if w ∈ L rej/loop if w ∉ L

accept

w

w

M’

accept if w ∉ L rej/loop if w ∈ L

reject

Unrecognizable languages

If L and L are both recognizable, then L is decidable. • Proof attempt Problem: If M loops on w, we Let M = TM for L, M’ = TM for L will never get to step 2!

On input w,

① Simulate M on input w. If it accepts, accept. ② Simulate M’ on input w. If it accepts, reject.

Bounded simulation

If L and L are both recognizable, then L is decidable. • Proof

Let M = TM for L, M’ = TM for L

On input w, For k = 0 to infinity Simulate M on input w for k steps. If it accepts, accept. Simulate M’ on input w for k steps. If it accepts, reject.

**Another undecidable language
**

HALTTM = {(〈M〉, w): M is a TM that halts on input w}

HALTTM is an undecidable language

**• To prove this, we will show that
**

If HALTTM can be decided, so can ATM. … so by Turing’s Theorem it is undecidable.

Undecidability of halting

If HALTTM can be decided, so can ATM. • Suppose H decides HALTTM

〈M〉, w

H

accept if M halts on w reject if M loops on w

**• We want to use H to design D for ATM
**

〈M〉, w

?

accept if M accepts w reject if M rejects or loops on w

Undecidability of halting

〈M〉, w

H

accept if M halts on w reject if M loops on w

acc 〈M〉, w

H

rej

simulate M on w rej

acc

D

accept if M accepts w

reject if M rejects or loops on w

**More undecidable problems
**

L1 = {〈M〉: M is a TM that accepts input e} L2 = {〈M〉: M is a TM that accepts some input}

**L3 = {〈M〉: M is a TM that accepts all inputs}
**

L4 = {〈M, M’〉: M and M’ accept the same inputs}

Which of these are recognizable?

**Gödel’s incompleteness theorem
**

Some mathematical statements are true but not provable.

• Proof due to Turing:

If every true statement is provable, then ATM can be decided.

**Proof sketch of Gödel’s theorem
**

• Suppose every true statement has a proof

• For every TM M and input w, one of the statements M accepts w M does not accept w or

is true, so it must have a proof

**Proof sketch of Gödel’s theorem
**

• Consider this algorithm for ATM:

On input 〈M〉, w: For k = 0 to infinity For all possible proofs p of length k If p is a proof of “M accepts w”, accept. If p is a proof of “M does not accept w”, reject.

One of them is true, so it has a proof p Eventually, the algorithm will find this proof

**Proof sketch of Godel’s theorem
**

• Consider this algorithm for ATM:

On input 〈M〉, w: For k = 0 to infinity For all possible proofs p of length k If p is a proof of “M accepts w”, accept. If p is a proof of “M does not accept w”, reject.

Recall that TMs can check if a proof p is correct

- Performance StandardsUploaded byVasilios Sotiropoulos
- Maths is Better Than EnglishUploaded byunsensitive
- lois-sem.pdfUploaded byShivam mittal
- LCDF4_Chap_05_P3Uploaded byYawar Abbas Khan
- Plane and Solid GeometryUploaded byRyan Tegio
- Jokes -- science, engineering and math jokesUploaded bykgrhoads
- FSM ASM DiagramasUploaded byvaz5z
- Hw08 HandoutUploaded byBatman
- Lecture 23Uploaded byJames Yang
- What is Proof?Uploaded byMichael de Villiers
- A Computational Foundation for the Study of CognitionUploaded bygusorh
- The Evolution of Knowledge - AtinerUploaded bystefanpistorius
- [Xinfeng Zhou]A practical Guide to quantitative finance interviews.pdfUploaded byMike Pandey
- MATH3281_2015Lec2Uploaded byPPP
- BTech_CSE_SyllabusUploaded byKushmitha Unnikumar
- Dynamic Test Scheduling in Hardware-In-The-Loop Simulation of Commercial VehiclesUploaded byArash Mazandarani
- Moore and Mealy MachinesUploaded bysgdgp
- Object Modeling in UML-Introduction to UML2Uploaded byMarjan Dimov
- Dinosaur-Roar-FINAL.pdfUploaded byDeyana Marcheva

- MELJUN CORTES - MACHINE LEARNING Part 11Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 14Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 10Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 12Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 9Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 7Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 13Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 7Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES TCU Syllabus Ds 101 Discrete Structures 1 Syllabus Cortes Obe New Formats New Revisions 2018Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 1Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 3Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 5Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 2Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 4Uploaded byMELJUN CORTES, MBA,MPA
- MELJUN CORTES - MACHINE LEARNING Part 6Uploaded byMELJUN CORTES, MBA,MPA