Lecture Ref. handout page

Slides:



Advertisements
Similar presentations
Turing Machines Part 1:. 2 Church-Turing Thesis Part 1 An effective procedure is defined as: a procedure which can be broken down into simple.
Advertisements

Computing functions with Turing machines
Chapter 11: Models of Computation
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
CS211 Problems: unsolvable, unfeasible and unsolved Topic 2: Halting problem.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
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.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
CS 461 – Oct. 21 Begin chapter 3 We need a better (more encompassing) model of computation. Ex. { 1 n 2 n 3 n } couldn’t be accepted by PDA. –How could.
Programming Languages Wrap-up. Your Toolkit Object-oriented Imperative Functional Logic.
Copyright © Cengage Learning. All rights reserved.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
Week 7 - Wednesday.  What did we talk about last time?  Set proofs and disproofs  Russell’s paradox.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Undecidability. Church-Turing Thesis n A Turing machine that halts on all inputs is the precise formal notion corresponding to the intuitive notion of.
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.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?
Fall 2006Costas Busch - RPI1 Undecidable Problems (unsolvable problems)
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
Theory of Computation. Computation Computation is a general term for any type of information processing that can be represented as an algorithm precisely.
More Theory of Computing
Context-Free Languages Regular Languages Violates Pumping Lemma For RLs Violates Pumping Lemma For CFLs Described by CFG, PDA 0n1n0n1n 0n1n2n0n1n2n Described.
Complexity and Computability Theory I Lecture #13 Instructor: Rina Zviel-Girshin Lea Epstein Yael Moses.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
1 CO Games Development 2 Week 21 Turing Machines & Computability Gareth Bellaby.
The Recursion Theorem Pages 217– ADVANCED TOPICS IN C O M P U T A B I L I T Y THEORY.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
Halting Problem Introduction to Computing Science and Programming I.
1 More About Turing Machines “Programming Tricks” Restrictions Extensions Closure Properties.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
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.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Computation Motivating questions: What does “computation” mean? What are the similarities and differences between computation in computers and in natural.
Fundamentals of Informatics Lecture 13 Reduction Bas Luttik.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Lecture 17 Undecidability Topics:  TM variations  Undecidability June 25, 2015 CSCE 355 Foundations of Computation.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
Week 7 - Wednesday.  What did we talk about last time?  Proving the subset relationship  Proving set equality  Set counterexamples  Laws of set algebra.
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
Universal Turing Machine
Computability. Turing Machines Read input letter & tape letter, write tape letter, move left or right.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
The Acceptance Problem for TMs
Introduction to Computing Science and Programming I
The Halting Problem.
CSE 311 Foundations of Computing I
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSE 311 Foundations of Computing I
Theory of Computation Turing Machines.
Decidable Languages Costas Busch - LSU.
Halting Problem.
Recall last lecture and Nondeterministic TMs
CSE 311: Foundations of Computing
Algorithms CSCI 235, Spring 2019 Lecture 37 The Halting Problem
CO Games Development 2 Week 21 Turing Machines & Computability
Presentation transcript:

Lecture 14-16 Ref. handout page 57 -65 Turing Machines Lecture 14-16 Ref. handout page 57 -65

Alan Turing 1912-1954 Great mathematician The father of the modern computer

Bletchley Park is near Milton Keynes Half hour from London Alan Turing’s Statue at Bletchley Park Bletchley Park is near Milton Keynes  Half hour from London

Historical Notes For a long time it was believed that any mathematical problem could, at least in principle, be proved from the basic axioms 1931, Kurt Gödel proposed the theorem of undecidability – there exist theorems which can neither be proved or disproved Later, Alonso Church and Alan Turing also found other problems which had no algorithmic solution

Alan Turing was interested in whether there was a way to define which problems were/were not decidable (computable)? can we create a machine to simulate the human brain so that those computable problems can be solved automatically? 1935-36, Turing was working on a paper, “computable numbers”. The Turing machine in this paper turned out to be the simplest prototype of all computers!

Turing’s Idea thinks reads a+b*x/y makes notes State of mind changes

The Turing Machines control unit ...... ...... head Current state control unit Read/Write head ...... ...... (Infinitely long) tape, one symbol per square

A Turing Machine Conceptualization - - - reset - start -

Actions of a Turing Machine depending on current state and current tape symbol Change state Write a new symbol onto the current tape square Move left/right one square

State Transitions A B X,Y / L read write move

State Transitions – comparing with FA and PDA B X,Y / L read write move for TM input value on stack/ op of stack for PDA

A State Transition Table read write move new 1 a b L 2 R 3 c 2 1 3

The Infinite Tape a b a c a Initial position of read/write head (the left most) a b a c a Initial data (finite) Blank tape (infinite)

A Turing Machine Example Test for a palindrome □ □ □ □ aabbabbaaa □ □ □ □ □ □ If ‘a’ then replace with space go to right hand end check for ‘a’ if not found halt -> error else go to left hand end do the same for ‘b’

Cont. Transition Table for checking ‘a’ state read write move New state start a □ findA b deleteA

Answer (cont. TM for detecting palindromes) a,a/R b,b/R findA delA □,□/L a,□/L a,□/R a,a/L b,b/L b,b/L □,□/L start □,□/L yes no return □,□/L a,a/L b,□/R b,□/L findB □,□/L delB a,a/R b,b/R □,□/R

Memo for In-class test 14 [ /5] questions my answers correct answers comments 1 2 3 4 5

Turing Machine Tricks Write as many y’ as there are x’s before □ □ □ □ x x x x □ □ □ □ after □ □ □ □ x x x x □ y y y y □ □ □ □

Answer

Unary Numbers 0 x x x x x + x x x = x x x x x x x x ? + ? = ? x x x ...... x x x x + x x x = x x x x x x ? + ? = ?

The Limitations of TMs control unit ...... ...... Control Unit does one thing only control unit ‘hardware’ specific ...... ......

The 2-Tape Turing Machine control unit data tape program tape ...... ...... program tape stores the description of a 1-tape TM’s transition table

The 2-tape TM – The Universal TM control unit Data tape Program tape ...... ......

2-Tape Transitions tape 1 tape 2 state read write move new Includes ‘no move’

extras, e.g. the current state The Emulator control unit data tape program tape ...... ...... extras, e.g. the current state

An Example of UTM (Universal Turing Machine) Adding one to a binary number e.g. before □ □ □ □ 1 0 1 0 □ □ □ □ after □ □ □ □ 1 0 1 1 □ □ □ □ before □ □ □ □ 1 0 1 1 □ □ □ □ after □ □ □ □ 1 1 0 0 □ □ □ □ before □ □ □ □ 1 1 1 1 □ □ □ □ after □ □ □ 1 0 0 0 0 □ □ □ □

An Example of UTM Cont. How to go about writing a TM for adding one (a single-tape first)? Idea (algorithm): Move the head to the right most position If the right most is 0, replace it by 1,stop move to left one space If the current value is ‘0’ or a blank replace it by 1, stop Go to step 3

An Example of UTM Cont. start 1 R check □ L _ stop carry start check state read write mov new start 1 R check □ L _ stop carry □,□ /L start check 1,0,L 1,0,L 0,1,_ carry stop 0,1,_ □,1, _ A TM which adds one in binary

Cont. change to 3-tape TM Program tape S 1 1 R S S 0 0 R S S □ □ L C Data tape 1 1 0 1 Extra tape S

What’s so Special? The lever – many lifting jobs The wheel – lots of uses UTM – anything you can ‘program’ UTM

Memo for In-class test 15 [ /5] questions my answers correct answers comments 1 2 3 4 5

A Real Computer Control unit: processor Data tape: user memory Program tape: program memory Extra tape: system memory I/O facilities added

TMs and ‘Real’ Computer - 2 Write a TM which simulates a PC TM Anything a real computer can do,a TM can do

TMs and ‘Real’ Computer - 1 Write a Java program which simulates a TM TM Anything a TM can do, a real computer can do

The Church-Turing Thesis Anything which can be computed can be computed by a Turing Machine corollary Anything which can’t be done by a TM can’t be done by any computer

So ...... If there is anything a TM can’t do it probably can’t be done But may be a TM can do anything we can imagine (?) Is there anything which TMs can’t do???

Decision Problems It is harder to say what we will never be able to do rather than what we can do (computable). Consider only simpler problems – decision problems where the answer is ‘yea’ or ‘no’. Consider only TMs with two halt states ‘yes’ and ‘no’. A problem is decidable if we can have a TM for it which eventually enters either the ‘yes’ or ‘no’ state depending on its input.

The Halting Problem ...... In searching of an undecidable problem. The best-known such problem is called the halting problem. Given an arbitrary program with an arbitrary input, can we make a Turing Machine to test whether the program stop or loop forever?

The Barber Paradox (by Bertrand Russell ) Once upon a time, a village barber put a notice outside his shop I shave all and only those men in the village who do not shave themselves. Q. Does the barber shave himself?

The Barber Paradox U = { every man in the village } S = { men shave themselves } U \ S = { men don’t shave themselves} Where does the barber belong to, S or U \ S ?

The Barber Paradox – trouble in either ways Assume: the barber does shave himself Any man in this village who shaves himself is not shaved by barber. Therefore, the barber does not shave himself. Assume: the barber doesn’t shave himself Any man in this village is shaved by the barber if and only if he is not shaved by himself. Therefore, the barber does shaves himself.

Why is the Barber Paradox important? A paradox with importance to mathematical logic and set theory. It was constructed to demonstrate the self-contradictory nature of the elementary set theory It underlies the proof of Alan Turing’s proof of the undesirability of the halting problem.

Program Testing – (another way to look at the halting problem) A Java program is stored in a file The title is called ‘abc.java’ I have tested ‘abc’ with different data It always works It’s never got into an infinite loop Can I be sure it never will for any input?

Automated Program Testing A file containing a program A file of test data Prog Test MyTest infinite loop /halt

The Java Prog Test Class public class Prog Test { Public boolean halt(String prog, String data) if prog halts when given data as input return true; else return false; }

Using Prog Test import Prog Text public class MyTest { static public void main(String[] args) { String s = args[0]; if(ProgTest.halt(s,s)) // loop forever while(true) continue; }

Running MyTest java MyTest MyTest.java MyTest (program To test) with itself as data command to run java

Suppose It Loops static public void main(String[] args) { String s = args[0]; s = MyTest.java if(ProgTest.halt(s,s)) // loop forever while(true) continue; } ProgTest.halt(“MyTest.java, “MyTest.java”)

The Dilemma If it halts it loops forever ... If it loops forever it halts ...

The Solution The result is nonsense – MyTest must halt or loop We got into this mess by assuming that ProgTest.halts could be written So ProgTest.halts doesn’t (can’t) exist.

Conclusion There are some things computer can’t do ProgTest.halts can’t be written No program exists which can tell whether any given program halts for any given data There are some things computer can’t do

Memo for In-class test 16 [ /5] questions my answers correct answers comments 1 2 3 4 5