David Evans CS150: Computer Science University of Virginia Computer Science Lecture 36: Modeling Computing.

Slides:



Advertisements
Similar presentations
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 26: Proving Uncomputability Visualization.
Advertisements

David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 13: Turing Machines.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
David Evans CS200: Computer Science University of Virginia Computer Science Class 30: Models of Computation.
Class 39: Universality cs1120 Fall 2009 David Evans University of Virginia.
David Evans CS200: Computer Science University of Virginia Computer Science Class 27: Modeling Computation.
Week 7 - Wednesday.  What did we talk about last time?  Set proofs and disproofs  Russell’s paradox.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 39: Lambda Calculus.
Big Words, Busy Beavers, and The Cake of Computing David Evans flickr: mwichary TAPESTRY Workshop University of Virginia 15.
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 40: Computing with Glue and Photons.
Turing Machines CS 105: Introduction to Computer Science.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 2: Modeling Computers.
Class 19: Undecidability in Theory and Practice David Evans cs302: Theory of Computation University of Virginia Computer.
Theory of Computation. Computation Computation is a general term for any type of information processing that can be represented as an algorithm precisely.
Design and Analysis of Algorithms
David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines.
David Evans Turing Machines, Busy Beavers, and Big Questions about Computing.
Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.
David Evans Curing Cancer with Your Cell Phone: Why all Sciences are Becoming Computing Sciences.
1 CO Games Development 2 Week 21 Turing Machines & Computability Gareth Bellaby.
David Evans University of Virginia cs1120 Fall Lecture 38: Modeling Computing.
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 15: Complexity Notes This is selected.
What Every Biologist, Chemist, and Poet Should Know about Computer Science David Evans UVaCompBio 25 April
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Models of Computation - Turing Machines Dale Roberts, Lecturer.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 18: Think Globally, Mutate Locally.
Alan Turing WWII code-breaker mathematical proof of ‘Turing machines’ …in particular, “Universal Turing machine” laid foundations of computer science father.
David Evans CS150: Computer Science University of Virginia Computer Science Class 33: Computing with Photons From The.
Halting Problem Introduction to Computing Science and Programming I.
Cs3102: Theory of Computation Class 14: Turing Machines Spring 2010 University of Virginia David Evans.
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.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 16: Universality and Undecidability.
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.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
Computer Theory Michael J. Watts
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
Chapter 12 Theory of Computation Introduction to CS 1 st Semester, 2014 Sanghyun Park.
Week 7 - Wednesday.  What did we talk about last time?  Proving the subset relationship  Proving set equality  Set counterexamples  Laws of set algebra.
David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice.
Universal Turing Machine
David Evans CS200: Computer Science University of Virginia Computer Science Class 26: Halting Problem It is plain at any.
CSE202: Introduction to Formal Languages and Automata Theory
Introduction to Computing Science and Programming I
Class 27: Universal Turing Machines CS150: Computer Science
Class 30: Models of Computation CS200: Computer Science
CSE 311 Foundations of Computing I
Lecture 37: A Universal Computer
Turing Machines, Busy Beavers, and Big Questions about Computing
Class 19: Think Globally, Mutate Locally CS150: Computer Science
Chapter 9 TURING MACHINES.
Finite State Machines.
Theory of Computation Turing Machines.
Discrete Math for CS CMPSC 360 LECTURE 43 Last time: Variance
Class 33: Making Recursion M.C. Escher, Ascending and Descending
Recall last lecture and Nondeterministic TMs
Class 24: Computability Halting Problems Hockey Team Logo
Class 31: Universal Turing Machines CS200: Computer Science
P.V.G’s College of Engineering, Nashik
Class 34: Models of Computation CS200: Computer Science
Class 26: Modeling Computing CS150: Computer Science
CO Games Development 2 Week 21 Turing Machines & Computability
Lecture 23: Computability CS200: Computer Science
Theory of Computation Lecture 23: Turing Machines III
Presentation transcript:

David Evans CS150: Computer Science University of Virginia Computer Science Lecture 36: Modeling Computing

2 Lecture 36: Modeling Computing How convincing is our Halting Problem proof? (define (contradict-halts x) (if (halts? contradict-halts) (loop-forever) #t)) contradicts-halts cannot exist. Everything we used to make it except halts? does exist, therefore halts? cannot exist. This “proof” assumes Scheme exists and is consistent!

3 Lecture 36: Modeling Computing DrScheme Is DrScheme a proof that Scheme exists? (define (make-huge n) (if (= n 0) null (cons (make-huge (- n 1)) (make-huge (- n 1))))) (make-huge 10000) Scheme/Charme/Python/etc. all fail to evaluate some program!

4 Lecture 36: Modeling Computing Solutions Option 1: Prove “Scheme” does exist –Show that we could implement all the evaluation rules (if we had “Python”, our Charme interpreter would be a good start, but we don’t have “Python”) Option 2: Find a simpler computing model –Define it precisely –Show that “contradict-halts” can be defined in this model

5 Lecture 36: Modeling Computing Modeling Computation For a more convincing proof, we need a more precise (but simple) model of what a computer can do Another reason we need a model: Does complexity really make sense without this? (how do we know what a “step” is? are they the same for all computers?)

6 Lecture 36: Modeling Computing What is a model?

7 Lecture 36: Modeling Computing How should we model a Computer? Apollo Guidance Computer (1969) Colossus (1944) IBM 5100 (1975) Cray-1 (1976) Turing invented the model we’ll use today in What “computer” was he modeling?

8 Lecture 36: Modeling Computing “Computers” before WWII

9 Lecture 36: Modeling Computing Modeling Computers Input –Without it, we can’t describe a problem Output –Without it, we can’t get an answer Processing –Need some way of getting from the input to the output Memory –Need to keep track of what we are doing

10 Lecture 36: Modeling Computing Modeling Input Engelbart’s mouse and keypad Punch Cards Altair BASIC Paper Tape, 1976

11 Lecture 36: Modeling Computing Turing’s “Computer” “Computing is normally done by writing certain symbols on paper. We may suppose this paper is divided into squares like a child’s arithmetic book.” Alan Turing, On computable numbers, with an application to the Entscheidungsproblem, 1936

12 Lecture 36: Modeling Computing Simplest Input Non-interactive: like punch cards and paper tape One-dimensional: just a single tape of values, pointer to one square on tape How long should the tape be? Infinitely long! We are modeling a computer, not building one. Our model should not have silly practical limitations (like a real computer does).

13 Lecture 36: Modeling Computing Modeling Output Blinking lights are cool, but hard to model Output is what is written on the tape at the end of a computation Connection Machine CM-5, 1993

14 Lecture 36: Modeling Computing Modeling Processing (Brains) Rules for steps Remember a little “For the present I shall only say that the justification lies in the fact that the human memory is necessarily limited.” Alan Turing

15 Lecture 36: Modeling Computing Modeling Processing Evaluation Rules –Given an input on our tape, how do we evaluate to produce the output What do we need: –Read what is on the tape at the current square –Move the tape one square in either direction –Write into the current square Is that enough to model a computer?

16 Lecture 36: Modeling Computing Modeling Processing Read, write and move is not enough We also need to keep track of what we are doing: –How do we know whether to read, write or move at each step? –How do we know when we’re done? What do we need for this?

17 Lecture 36: Modeling Computing Finite State Machines 1 Start 2 HALT # 0

18 Lecture 36: Modeling Computing Hmmm…maybe we don’t need those infinite tapes after all? 1 Start 2 HALT ( not a paren ) # ) ERROR What if the next input symbol is ( in state 2?

19 Lecture 36: Modeling Computing How many states do we need? 1 Start 2 HALT ( not a paren ) # ) ERROR 3 not a paren ( ) 4 ( ) (

20 Lecture 36: Modeling Computing Finite State Machine There are lots of things we can’t compute with only a finite number of states Solutions: –Infinite State Machine Hard to describe and draw –Add an infinite tape to the Finite State Machine

21 Lecture 36: Modeling Computing Turing’s Explanation “We have said that the computable numbers are those whose decimals are calculable by finite means.... For the present I shall only say that the justification lies in the fact that the human memory is necessarily limited.”

22 Lecture 36: Modeling Computing FSM + Infinite Tape Start: –FSM in Start State –Input on Infinite Tape –Pointer to start of input Step: –Read one input symbol from tape –Write symbol on tape, and move L or R one square –Follow transition rule from current state Finish: –Transition to halt state

23 Lecture 36: Modeling Computing Turing Machine 1 Start 2 Input: # Write: # Move:  # # Input: 1 Write: 0 Move:  Input: 1 Write: 1 Move:  Input: 0 Write: 0 Move:  3 Input: 0 Write: # Move: 

24 Lecture 36: Modeling Computing Matching Parentheses Find the leftmost ) –If you don’t find one, the parentheses match, write a 1 at the tape head and halt. Replace it with an X Look left for the first ( –If you find it, replace it with an X (they matched) –If you don’t find it, the parentheses didn’t match – end write a 0 at the tape head and halt

25 Lecture 36: Modeling Computing Matching Parentheses 1: look for ) Start HALT Input: ) Write: X Move: L ), X, L 2: look for ( X, X, R X, X, L (, X, R #, 0, # #, 1, # (, (, R Will this report the correct result for (()?

26 Lecture 36: Modeling Computing Matching Parentheses 1 Start HALT ), X, L 2: look for ( (, (, R (, X, R #, 0, # #, 1, # X, X, L X, X, R #, #, L 3: look for ( X, X, L #, 1, # (, 0, #

27 Lecture 36: Modeling Computing Turing Machine zzzzzzzzzzzzzzzzzzzzzz TuringMachine ::= Alphabet ::= { Symbol* } Tape ::= OneSquare ::= Symbol | # Current ::= OneSquare LeftSide ::= [ Square* ] RightSide ::= [ Square* ] Everything to left of LeftSide is #. Everything to right of RightSide is #. 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine How well does this model your computer? Infinite Tape

28 Lecture 36: Modeling Computing Exam 2 Out now, due Friday at 12:02 pm (beginning of class) Honor the Honor Code It is meant to be short enough that you can also make progress on ps9 this week (but don’t wait to start the exam) –When you meet with your teammates, don’t talk about the exam