CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.

Slides:



Advertisements
Similar presentations
Introduction to Computability Theory
Advertisements

CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
1 CSC3130 Formal Languages and Automata Theory Tutorial 9 Undecidable Problem KN Hung SHB 1026.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Variants.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Reducibility Sipser 5.1 (pages ). CS 311 Fall Reducibility.
Reducibility Sipser 5.1 (pages ).
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
Recursively Enumerable and Recursive Languages
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
CHAPTER 4 Decidability Contents Decidable Languages
Tutorial CSC3130 : Formal Languages and Automata Theory Tu Shikui ( ) SHB 905, Office hour: Thursday 2:30pm-3:30pm
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 6 Decidability Jan Maluszynski, IDA, 2007
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2006Costas Busch - RPI1 Undecidable Problems (unsolvable problems)
Prof. Busch - LSU1 Undecidable Problems (unsolvable problems)
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong DFA minimization.
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Recursively Enumerable and Recursive Languages
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
1 Recursively Enumerable and Recursive Languages.
Decidability.
The Acceptance Problem for TMs
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
Recursively Enumerable Languages
Theory of Computability
Recursively Enumerable and Recursive Languages
More variants of Turing Machines
CSCI 2670 Introduction to Theory of Computing
Busch Complexity Lectures: Reductions
Linear Bounded Automata LBAs
Undecidable Problems Costas Busch - LSU.
Reductions Costas Busch - LSU.
Theory of Computability
CS154, Lecture 11: Self Reference, Foundation of Mathematics
Reducibility The Chinese University of Hong Kong Fall 2010
Intro to Theory of Computation
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CS154, Lecture 8: Undecidability, Mapping Reductions
CS154, Lecture 8: Undecidability, Mapping Reductions
More on DFA minimization and DFA equivalence
CSE 105 theory of computation
Decidable Languages Costas Busch - LSU.
Decidability and Undecidability
Decidable and undecidable languages
Formal Languages, Automata and Models of Computation
More undecidable languages
Theory of Computability
Theory of Computability
Theory of Computability
CS154, Lecture 11: Self Reference, Foundation of Mathematics
Theory of Computability
More undecidable languages
CSCI 2670 Introduction to Theory of Computing
Theory of Computability
Automata, Grammars and Languages
CSE 105 theory of computation
Presentation transcript:

CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable Languages Fall 2008

Are Turing Machines computers? A Turing Machine does not take the program as part of its input. computer input data instructions (program) output data... but it can!

The Universal Turing Machine U input x program 〈 M 〉 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 This Turing Machine can be described by the string 〈 M 〉 = ((q0, qacc, qrej), ((q0, q0, ☐ / ☐ R), (q0, qacc, 0/0R), (q0, qrej, 1/1R))) M q0q0 q acc q rej ☐/☐R☐/☐R 0/0R 1/1R

The universal Turing Machine U ((q0, qacc, qrej), ((q0, q0, ☐ / ☐ R), 001 input x 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 A DFA = {( 〈 D 〉, w): D is a DFA that accepts input w} A PDA = {( 〈 P 〉, w): P is a PDA that accepts w} A TM = {( 〈 M 〉, w): M is a TM that accepts w} Which of these is decidable? decidable

Languages about automata 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 A TM A TM = {( 〈 M 〉, w): M is a TM that accepts w}

Recognizing versus deciding –This kind of TM is called a decider The textbook uses different terminology: The language recognized by a TM is the set of all inputs that make it reach q acc A TM decides language L if it recognizes L and does not loop on any input recognizable = recursively enumerable (r. e.) decidable = recursive

Undecidability Turing’s Theorem: Before we prove this, let’s observe one thing: The language A TM is undecidable. A Turing Machine M can be given its own description 〈 M 〉 as an input!

Proof of undecidability Proof by contradiction: Suppose A TM is decidable. Then there is a TM H that decides A TM : H 〈M〉,w〈M〉,w accept if M accepts w reject if M rejects w or M loops on w 〈M〉,〈M〉〈M〉,〈M〉 accept if M accepts 〈 M 〉 reject if M rejects 〈 M 〉 or M loops on 〈 M 〉 What happens when w = 〈 M 〉 ?

Proof of undecidability H 〈M〉,〈M〉〈M〉,〈M〉 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 H acc rej acc rej H’

Proof of undecidability H 〈 M 〉, 〈 M 〉 accept if M accepts 〈 M 〉 reject if M rejects 〈 M 〉 or M loops on 〈 M 〉 H’H’ 〈M〉,〈M〉〈M〉,〈M〉 reject if M accepts 〈 M 〉 if M rejects 〈 M 〉 or M loops on 〈 M 〉 accept

Proof of undecidability H’H’ 〈 M 〉, 〈 M 〉 reject if M accepts 〈 M 〉 if M rejects 〈 M 〉 or M loops on 〈 M 〉 accept Let D be the following TM: copy 〈M〉〈M〉 〈 M 〉, 〈 M 〉 H’

Proof of undecidability D 〈M〉〈M〉 reject if M accepts 〈 M 〉 if M rejects 〈 M 〉 or M loops on 〈 M 〉 accept What happens when M = D ? 〈D〉〈D〉 reject if D accepts 〈 D 〉 if D rejects 〈 D 〉 or D loops on 〈 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 A TM was decidable –Then we had Turing Machines H, H’, D –But D does not exist! Conclusion The language A TM is undecidable.

What happened? M1M1 M2M2 M3M3 …  … accrej acc rejacclooprej looprej … … Turing Machine input w We can write an infinite table for every pair (M, w)

What happened? M1M1 M2M2 M3M3 … 〈M1〉〈M1〉〈M2〉〈M2〉 〈M4〉〈M4〉 … acclooprejacc rejaccrejacc looprejlooprej … … Now let’s look only at those w that describe a TM M 〈M3〉〈M3〉

What happened? M1M1 M2M2 … 〈M1〉〈M1〉〈M2〉〈M2〉 〈M4〉〈M4〉 … acclooprejacc rejaccrejacc … … If A TM is decidable, then TM D is in the table 〈M3〉〈M3〉 D rej accrej … …

What happened? M1M1 M2M2 … 〈M1〉〈M1〉〈M2〉〈M2〉 〈M4〉〈M4〉 … acclooprejacc rejaccrejacc … … D does the opposite of the diagonal entries 〈M3〉〈M3〉 D rej accrej D 〈M〉〈M〉 reject if M accepts 〈 M 〉 accept if M rejects or loops on 〈 M 〉

What happened? M1M1 M2M2 … 〈M1〉〈M1〉〈M2〉〈M2〉 〈M4〉〈M4〉 … acclooprejacc rejaccrejacc … … We run into trouble when we look at (D, 〈 D 〉 ) ! 〈M3〉〈M3〉 D rej accrej 〈D〉〈D〉 loop acc ? …

Unrecognizable languages How about languages that are not recognizable? The language A TM is recognizable but not decidable. A TM = {( 〈 M 〉, w): M is a TM that does not accept w} = {( 〈 M 〉, w): M rejects or loops on input w} The language A TM is not recognizable.

Unrecognizable languages General Theorem We know A TM is recognizable, so if A TM were also, then A TM would be decidable Impossible by Turing’s Theorem If L and L are both recognizable, then L is decidable.

Unrecognizable languages Proof idea If L and L are both recognizable, then L is decidable. M rej/loop if w ∉ L accept if w ∈ L w M’ rej/loop if w ∈ L accept if w ∉ L w w accept reject

Unrecognizable languages Proof attempt Let M = TM for L, M’ = TM for L On input w, Simulate M on input w. If it accepts, accept. Simulate M’ on input w. If it accepts, reject. If L and L are both recognizable, then L is decidable. Problem: If M loops on w, we will never get to step 2! ① ②

Bounded simulation Proof Let M = TM for L, M’ = TM for L On input w, Simulate M on input w for k steps. If it accepts, accept. Simulate M’ on input w for k steps. If it accepts, reject. If L and L are both recognizable, then L is decidable. For k = 0 to infinity

Another undecidable language To prove this, we will show that … so by Turing’s Theorem it is undecidable. HALT TM = {( 〈 M 〉, w): M is a TM that halts on input w} If HALT TM can be decided, so can A TM. HALT TM is an undecidable language

Undecidability of halting Suppose H decides HALT TM H reject if M loops on w accept if M halts on w 〈 M 〉, w If HALT TM can be decided, so can A TM. We want to use H to design D for A TM ? reject if M rejects or loops on w accept if M accepts w 〈 M 〉, w

Undecidability of halting H reject if M loops on w accept if M halts on w 〈 M 〉, w D reject if M rejects or loops on w accept if M accepts w 〈 M 〉, w H rej acc simulate M on w rej acc

More undecidable problems L 1 = { 〈 M 〉 : M is a TM that accepts input  } L 2 = { 〈 M 〉 : M is a TM that accepts some input } L 4 = { 〈 M, M’ 〉 : M and M’ accept the same inputs } Which of these are recognizable? L 3 = { 〈 M 〉 : M is a TM that accepts all inputs }

Gödel’s incompleteness theorem Proof due to Turing: Some mathematical statements are true but not provable. If every true statement is provable, then A TM 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 is true, so it must have a proof M accepts wM does not accept w or

Proof sketch of Gödel’s theorem Consider this algorithm for A TM : 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 A TM : 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