INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Slides:



Advertisements
Similar presentations
COMPLEXITY THEORY CSci 5403 LECTURE VII: DIAGONALIZATION.
Advertisements

David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
The Recursion Theorem Sipser – pages Self replication Living things are machines Living things can self-reproduce Machines cannot self reproduce.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
The Halting Problem Sipser 4.2 (pages ). CS 311 Mount Holyoke College 2 Taking stock All languages Turing-recognizable Turing-decidable Context-free.
The Halting Problem Sipser 4.2 (pages ).
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
Reducibility A reduction is a way of converting one problem into another problem in such a way that a solution to the second problem can be used to solve.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
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
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 6 Decidability Jan Maluszynski, IDA, 2007
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 5 Reducibility Contents Undecidable Problems from Language Theory.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
Courtesy Costas Busch - RPI1 Reducibility. Courtesy Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.
CS 310 – Fall 2006 Pacific University CS310 The Halting Problem Section 4.2 November 15, 2006.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 18 Instructor: Paul Beame.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
Lecture 27UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27.
CS21 Decidability and Tractability
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Announcements Homework – HW8 due Tues 5/29 11am – HW5 grades are out Monday is Memorial Day; no office hours, etc. – Go see a parade, or some fireworks,
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.
A Universal Turing Machine
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
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.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
The Acceptance Problem for TMs
Recursively Enumerable and Recursive Languages
CSCI 2670 Introduction to Theory of Computing
This statement is false.
Linear Bounded Automata LBAs
Undecidable Problems Costas Busch - LSU.
Lecture12 The Halting Problem
CSCI 2670 Introduction to Theory of Computing
Reductions Costas Busch - LSU.
Theory of Computability
CS154, Lecture 11: Self Reference, Foundation of Mathematics
CSC 4170 Theory of Computation Turing reducibility Section 6.3.
Reducibility The Chinese University of Hong Kong Fall 2010
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CS154, Lecture 8: Undecidability, Mapping Reductions
Andreas Klappenecker [based on slides by Prof. Welch]
CS154, Lecture 8: Undecidability, Mapping Reductions
CSCI 2670 Introduction to Theory of Computing
Decidable Languages Costas Busch - LSU.
Undecidable problems:
CS21 Decidability and Tractability
Formal Languages, Automata and Models of Computation
Intro to Theory of Computation
Theory of Computability
CS21 Decidability and Tractability
More undecidable languages
CSCI 2670 Introduction to Theory of Computing
Theory of Computability
Intro to Theory of Computation
Presentation transcript:

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

SET THEORY 101 A function ƒ : A → B is: 1-1 (or injective) if onto (or surjective) if bijective if it is 1-1 and onto. ƒ(x)=ƒ(y) ⇔ x=y ∀ y Ǝ x: y = ƒ(x) 1-1 then |A| |B| onto then |A| |B| bijective then |B| |A|. ƒ can help us count. If ƒ is: ≤ ≥ =

Let S be any set and (S) be the power set of S Theorem: There is no onto map from S to P(S) Proof: Assume, for a contradiction, that there is an onto map ƒ : S  (S) Let D ƒ = { x  S | x  ƒ(x) } If D ƒ = ƒ(y) then y  D ƒ if and only if y  D ƒ We construct an D ƒ ⊆ S that cannot be the output, ƒ(y), for any y  S. D ƒ is called the diagonal set for ƒ.

x y 1 ∈ ƒ(x)?y 2 ∈ ƒ(x)?y 3 ∈ ƒ(x)?y 4 ∈ ƒ(x)? … y1y1 YNYY y2y2 NYNY y3y3 NNNN y4y4 YNNY  Y Y Y N (y i ∈ D) ≡ (y i ∉ ƒ(y i ))

The process of constructing a counterexample by “contradicting the diagonal” is called DIAGONALIZATION

No matter what, (S) always has more elements than S

THE CHURCH-TURING THESIS L is recognized by a program for some computer* ⇔ L is recognized by a TM * The computer must be “reasonable”

There are languages over {0,1} that are not decidable If we believe the Church-Turing Thesis, this means there are problems that computers inherently cannot solve. We proved this using a “simple” counting argument: There are more Languages than Turing Machines.

Turing Machines Languages over {0,1}

Not all languages over {0,1} are decidable Turing Machines Strings of 0s and 1s Sets of strings of 0s and 1s Languages over {0,1} S(S) OK, but what does an undecidable language look like?

THE DIAGONAL LANGUAGE D TM = { 〈 M 〉 | M does not accept 〈 M 〉 } is undecidable. T M 1 ∈ L(T)?M 2 ∈ L(T)?M 3 ∈ L(T)?M 4 ∈ L(T)? … M1M1 YNYY M2M2 NYNY M3M3 NNNN M4M4 YNNY  Y Y Y N *Note: Hypothetical. May not correspond to an actual encoding *

Programs can “accept” their code as input: $ grep grep </usr/bin/grep Binary file (standard input) matches $ cat > /tmp/example.pl <<EOP #!/usr/bin/perl –n print “Yippee!\n” if /#/; EOP $ /tmp/example.pl </tmp/example.pl Yippee! Programs can “reject” their code as input: $ /usr/bin/python </usr/bin/python SyntaxError: invalid syntax

A TM = { 〈 M,w 〉 | M is a TM that accepts string w } THE ACCEPTANCE PROBLEM Theorem: A TM is Turing-recognizable but NOT decidable A TM is Turing-recognizable: Define TM U as follows: On input 〈 M,w 〉, U runs M on w. If M ever accepts: accept. If M ever rejects: reject. If M(w) loops forever: U( 〈 M,w 〉 ) loops forever.

A TM = { 〈 M,w 〉 | M is a TM that accepts string w } A TM is undecidable:(proof by contradiction) Assume TM acceptsInput decides A TM acceptsInput(M,w) = Acceptif M(w) accepts Reject otherwise Construct a new TM LLPF as follows: on input 〈 M 〉 run acceptsInput (M, 〈 M 〉 ) and output the opposite LLPF( M ) = Rejectif M accepts M Accept if M does not accept M LLPF

M1M1 M2M2 M3M3 M4M4 : M1M1 M2M2 M3M3 M4M4 … accept reject OUTPUT OF acceptsInput(M,N)* accept reject LLPF reject accept reject accept ? *Note: Hypothetical. May not correspond to an actual encoding

Theorem: A TM is Turing-recognizable (r.e.) but NOT decidable Theorem:  A TM is not even Turing-recognizable! Proof: Suppose ¬A TM is recognized by TM V. We know A TM is recognized by U. Build Z to decide A TM : run V(M,w) and U(M,w) in parallel. If V accepts, reject; if U accepts, accept.

A language is called Turing-recognizable, semi-decidable, or recursively enumerable if some TM recognizes it A language is called decidable or recursive if some TM decides it recursive languages r.e. languages all languages

HALT TM = { 〈 M,w 〉 | M is a TM that halts on string w } Theorem: HALT TM is undecidable THE HALTING PROBLEM Proof: Assume, for a contradiction, that TM haltsOnInput decides HALT TM haltsOnInput(M,w) = Acceptif M(w) halts Reject if M(w) loops We construct the machine liarLiar as follows: liarLiar( 〈 M 〉 ): if haltsOnInput(M, 〈 M 〉 ): return liarLiar( 〈 M 〉 ) else: return true. liarLiar( 〈 liarLiar 〉 ) halts iff liarLiar( 〈 liarLiar 〉 ) loops!

We can also prove that A TM is undecidable by “reusing” the proof that D TM is undecidable. Theorem. If A TM is decidable, then so is D TM. Proof: Suppose we have a program, acceptsInput, that decides A TM, e.g. acceptsInput(M,w) returns true if 〈 M,w 〉  A TM and returns false otherwise. We can build a TM notDiagonal to decide ¬D TM : Theorem. If HALT TM is decidable, then so is A TM. Proof: acceptsInput(M,w) = let M’ = M with q reject replaced by q loop. return haltsOnInput(M’,w) notDiagonal( 〈 M 〉 ) = return acceptsInput(M, 〈 M 〉 )