1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?

Slides:



Advertisements
Similar presentations
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Advertisements

Variants of Turing machines
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Reducibility Sipser 5.1 (pages ). CS 311 Fall Reducibility.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Recursively Enumerable and Recursive Languages
Fall 2004COMP 3351 Turing Machines. Fall 2004COMP 3352 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
CS 310 – Fall 2006 Pacific University CS310 Turing Machines Section 3.1 November 6, 2006.
Courtesy Costas Busch - RPI1 Turing Machines. Courtesy Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Turing Machines.
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.
Homework #9 Solutions.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Costas Busch - RPI1 Turing Machines. Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
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.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Turing Machines CS 105: Introduction to Computer Science.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
Complexity and Computability Theory I Lecture #13 Instructor: Rina Zviel-Girshin Lea Epstein Yael Moses.
Turing Machines Chapter Plan Turing Machines(TMs) – Alan Turing Church-Turing Thesis – Definitions Computation Configuration Recognizable vs. Decidable.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
1 The Halting Problem and Decidability How powerful is a TM? Any program in a high level language can be simulated by a TM. Any algorithmic procedure carried.
Halting Problem Introduction to Computing Science and Programming I.
A Universal Turing Machine
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CS 3813: Introduction to Formal Languages and Automata Chapter 12 Limits of Algorithmic Computation These class notes are based on material from our textbook,
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
Recursively Enumerable and Recursive Languages
1 IDT Open Seminar ALAN TURING AND HIS LEGACY 100 Years Turing celebration Gordana Dodig Crnkovic, Computer Science and Network Department Mälardalen University.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
Recursively Enumerable and Recursive Languages
Busch Complexity Lectures: Turing Machines
CSE 311 Foundations of Computing I
Reductions Costas Busch - LSU.
Turing Machines Acceptors; Enumerators
Modeling Computation:
Decidable Languages Costas Busch - LSU.
Presentation transcript:

1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?

2 Computability Is there anything a computer cannot compute? Linked to the notion of what is an algorithm.

3 Alan Turing An amazing scientist –Helped solved the Enigma Machine (WWII) –Advances in Probability Theory Invented the theory behind computers –Turing Machine –Turing Test

4 Turing Machines Anything that can be computed by a finite set of rules can be computed by a Turing machine. Turing Equivalence –We saw that finite automata are less powerful than TMs Can’t compute Thus not Turing-equivalent –Modern computers and programming languages are all Turing-equivalent

5 Adapted from slide by Costas Busch, Regular Languages Context-Free Languages Languages accepted by Turing Machines

6 Adapted from slide by Costas Busch, A Turing Machine Tape Read-Write head Control Unit

7 Adapted from slide by Costas Busch, The Tape Read-Write head No boundaries -- infinite length The head moves Left or Right

8 Adapted from slide by Costas Busch, Read-Write head The head at each time step: 1. Reads a symbol 2. Writes a symbol 3. Moves Left or Right

9 Adapted from slide by Costas Busch, Example: Time Time 1 1. Reads 2. Writes 3. Moves Left

10 Adapted from slide by Costas Busch, The Input String Blank symbol head Head starts at the leftmost position of the input string Input string

11 Adapted from slide by Costas Busch, States & Transitions Read Write Move Left Move Right

12 Adapted from slide by Costas Busch, Example: Time 1 current state

13 Adapted from slide by Costas Busch, Time Time 2

14 Adapted from slide by Costas Busch, Determinism Allowed Not Allowed Turing Machines are deterministic

15 Adapted from slide by Costas Busch, Halting The machine halts if there are no possible transitions to follow

16 Adapted from slide by Costas Busch, Example: No possible transition HALT!!!

17 Adapted from slide by Costas Busch, Final States Allowed Not Allowed Final states have no outgoing transitions In a final state the machine halts

18 Adapted from slide by Costas Busch, Acceptance Accept Input If machine halts in a final state Reject Input If machine halts in a non-final state or If machine enters an infinite loop

19 Adapted from slide by Costas Busch, Infinite Loop Example A Turing machine for language

20 Adapted from slide by Costas Busch, Time 0

21 Adapted from slide by Costas Busch, Time 1

22 Adapted from slide by Costas Busch, Time 2

23 Adapted from slide by Costas Busch, Time 2 Time 3 Time 4 Time 5... Infinite Loop

24 Adapted from slides by Lee Wee Sun, Church-Turing Thesis The Church-Turing thesis says that Turing machine algorithms are the same as our intuitive notion of algorithms. –Most people think the Church Turing thesis is correct. –It means, among other things that You can simulate any computer program that runs on any hardware in any language with any other program on any other hardware using any other language. Tasks that humans agree is an algorithm can always be executed on a computer.

25 Adapted from slides by Lee Wee Sun, The Halting Problem An example of something that is not computable. Created by Turing in 1936 to define a problem which no algorithmic procedure can solve. Can we write a program that will take in a user's program and inputs and decide whether –it will eventually stop, or –it will run infinitely in some infinite loop ?

26 Adapted from slides by Lee Wee Sun, Proof (by contradiction) Assume that it is possible to write a program to solve the Halting Problem. Denote this program by HaltAnswerer(prog,inputs). HaltAnswerer(prog,inputs) will –return yes if prog will halt on inputs and –no otherwise. A program is just a string of characters –E.g. your Java program is just a long string of characters An input can also be considered as just a string of characters So HaltAnswerer is effectively just working on two strings

27 Adapted from slides by Lee Wee Sun, Proof (cont.) We can now write another program Loopy(prog) that uses HaltAnswerer The program Loopy(prog) does the following: [1] If HaltAnswerer(prog,prog) returns yes, Loopy will go into an infinite loop. [2] If HaltAnswerer(prog,prog) returns no, Loopy will halt.

28 Adapted from slides by Lee Wee Sun, Proof (cont.) [1] If HaltAnswerer(prog,prog) returns yes, Loopy will go into an infinite loop. [2] If HaltAnswerer(prog,prog) returns no, Loopy will halt. Consider what happens when we run Loopy(Loopy). –If Loopy loops infinitely, HaltAnswerer(Loopy,Loopy) return no which by [2] above means Loopy will halt. –If Loopy halts, HaltAnswerer(Loopy,Loopy) will return yes which by [1] above means Loopy will loop infinitely. Conclusion: Our assumption that it is possible to write a program to solve the Halting Problem has resulted in a contradiction.

29 Diagonalization Not Diagon Alley A proof by contradiction technique –Uses the notion of Infinity The name comes from a proof that shows you can’t ever list all numbers. –Assume you list all possible binary numbers –Diagonalization shows you can always construct a new number that is not yet in the list Have to assume numbers can have infinite length –Construct the new number by choosing the opposite of the number on the diagonal.

30 Diagonalization B100000… B200101… B310110… B401111… B511000… … D11001…1…

31 The Universal Turing Machine There are an infinite number of Turing Machines There are an infinite number of calculations that can be done with a finite set of rules. However, we can define a Universal Turing Machine which can simulate all possible TMs –Comes from the definition of TMs –You convert the description of the TM and its input into two tapes, and use these as the input to the UTM

32 The Halting Problem Halting Problem: –There is no procedure for telling whether an arbitrary TM will halt on a given input. Use Diagonalization to show this. –Again, proof by contradiction –Assume there is a rule for deciding if a TM will halt. Construct a table as follows: –List all Turing machines down the side –List the possible inputs across the top –In position (j,i) put the result of executing Turing machine j on input i If it halts, output H If it doesn’t halt, output ?

33 Diagonalization 12345… T1HH?HH… T2??HHH… T3HHHHH… T4HHH?H… T5HHHHH… … D?H?H?…

34 Diagonalization on the Halting Problem Now define a new TM called D that will halt for all inputs. It outputs –H if TMi(i) does not halt –? if TMi(i) does halt We already said that the assumption is that we can always decide if a TM halts. Also, we said this table lists all possible TMs. –So D must be in the table. But this means that we are saying that D outputs halt if it doesn’t halt! –To see this, give D as input to itself. This is a contradiction. Hence the premise does not hold: We cannot determine if an arbitrary program will halt.

35 “Going Meta” This proof based in part on Gödel’s Theorem If you are interested in these kinds of questions (and other things related to “going meta” like compiler compilers), see –Gödel, Escher, Bach: An Eternal Golden Braid, by Douglas Hofstadter.

36 The Turing Test An observer –Interacts with a keyboard and monitor –Has to distinguish which of two respondents is a computer and which is human. There is a contest with a $100,000 prize! –For the first computer whose responses are indistinguishable from a human's. –The Loebner Prize It’s actually pretty easy to fool people over the short term. Chat room ’bots work quite well.

37 What is Intelligence? Do androids dream … ? What would it take for a computer’s thoughts to be indistinguishable from a human’s? THIS is the deepest question of CS.