CS 154 Formal Languages and Computability April 12 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.

Slides:



Advertisements
Similar presentations
Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Advertisements

THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
Programming Languages Wrap-up. Your Toolkit Object-oriented Imperative Functional Logic.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Based on Slides by Zeph Grunschlag from Columbia University www1.cs.columbia.edu/~zeph/3261/L14/L14.ppt Basic Computability Reading Material: J. Savage,
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 ? ?
1 Computing Functions with Turing Machines. 2 A function Domain: Result Region: has:
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Costas Busch - RPI1 Turing Machines. Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
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 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
Turing Machines Chapter Plan Turing Machines(TMs) – Alan Turing Church-Turing Thesis – Definitions Computation Configuration Recognizable vs. Decidable.
CSE202: Introduction to Formal Languages and Automata Theory Chapter 9 The Turing Machine These class notes are based on material from our textbook, An.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
Finite State Automata / Machines and Turing Machines.
1 Turing Machines There are languages that are not context-free. What can we say about the most powerful automata and the limits of computation?. Alan.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
Turing Machines (13.5) Based on slides by Costas Busch from the course
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.
1 Turing machines Chapter 4, Smith and Kimber. A Turing machine is an abstraction of a human “computer”. Consists of - control, in the form of states -
Recursively Enumerable and Recursive Languages
CS 154 Formal Languages and Computability February 4 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
1 IDT Open Seminar ALAN TURING AND HIS LEGACY 100 Years Turing celebration Gordana Dodig Crnkovic, Computer Science and Network Department Mälardalen University.
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
CS 154 Formal Languages and Computability February 9 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
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 ? ?
CS 154 Formal Languages and Computability March 8 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 154 Formal Languages and Computability March 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 154 Formal Languages and Computability April 19 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 3240 – Chapter 9.  Turing Machines  From Alan Turing, 1936  Turns out to be the LAST machine  The only machine you'll ever need  The Church-Turing.
CS 154 Formal Languages and Computability April 28 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
1 Computing Functions with Turing Machines. 2 A function Domain Result Region has:
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
Turing Machines. The next level of Machine… PDAs improved on FSAs by adding memory. We make the memory more flexible to do more complicated tasks.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Theory of Computation Automata Theory Dr. Ayman Srour.
Universal Turing Machine
CS 154 Formal Languages and Computability April 5 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 154 Formal Languages and Computability April 7 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Computability. Turing Machines Read input letter & tape letter, write tape letter, move left or right.
1 Recursively Enumerable and Recursive Languages.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
TM Macro Language MA/CSSE 474 Theory of Computation.
CSE202: Introduction to Formal Languages and Automata Theory
Pumping Lemma Revisited
Computing Functions with Turing Machines
Turing Machines 2nd 2017 Lecture 9.
Chapter 9 TURING MACHINES.
Theory of Computation Turing Machines.
Computing Functions with Turing Machines
Theory of computing, part 4
Instructor: Aaron Roth
Instructor: Aaron Roth
Formal Definitions for Turing Machines
Presentation transcript:

CS 154 Formal Languages and Computability April 12 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing Machines as Language Acceptors  A string w is accepted by a TM if w is written on the tape with blanks before and after The TM reads w, enters a final state, and halts.  The string w is rejected by the TM if The TM halts in a nonfinal state. The TM fails to halt.  Let be a TM.  Then the language L(M) consists of all strings over Σ that are accepted by M. 2

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing Machines as Transducers  Because TMs are models for all computers, we must also consider TMs that produce output. i.e., transducers  Input for a TM’s computation are the nonblank symbols on the tape at the initial time.  Output is whatever is on the tape at the conclusion of the computation. 3

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing-Computable Functions  Suppose M is a transducer TM that is given input w and produces output f(w).  f is a function such that for some final state q final of M. For input string w, TM M produces output string f(w) and halts in a final state.  A function f over domain D is Turing-computable if there is a TM such that for all strings. 4 q 0 w *

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Is Addition Turing-Computable?  Given two positive integers x and y, design a TM that computes x + y.  Represent the quantities x and y by strings of x 1 ’s and y 1 ’s, respectively, (unary notation) and separate the two strings with a 0. Example: Represent as  Program the TM to move the 0 to the right end of the string. Example: = 5, or

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Is Addition Turing-Computable? cont’d 6 Demo: Jexample9.9.jff

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak A Turing Machine that Copies a String  A TM that performs the computation for any.  Pseudocode: 1. Replace every 1 by an x. 2. Find the rightmost x and replace it with a Repeatedly move the head right to the first blank and write a 1 in place of the blank. 4. Repeat steps 2 and 3 until there are no more x ’s. 7 q 0 w * q final ww

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak A Turing Machine that Copies a String, cont’d 8 Demo Jexample9.10.jff

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak A Turing Machine that Compares Values  Represent two positive integers x and y in unary notation on the input tape, separated by a 0.  Design a TM that: Halts in final state q GE if x ≥ y. Halts in final state q LT if x < y.  Algorithm description: Match 1 ’s on either side of the 0 by replacing each 1 with an x. When the matching is done:  If tape is (e.g.) xxx…110xxx...x, restore 1 ’s and halt in final state q GE  If tape is (e.g.) xxx…x0xxx...11, restore 1 ’s and halt in final state q LT  Else REJECT. 9 So now we know that we can program a TM to make decisions based on arithmetic comparisons.

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak A Turing Machine that Compares Values, cont’d  Class exercise! Design a Turing Machine that compares values.  For input string :  For input string :  For input string : 10 q * q GE q * q LT q * q GE

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak A Turing Machine that Compares Values, cont’d 11 Demo Jexample9.11.jff

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Combining Turing Machines  Design a TM to compute the function  Create the TM by combining smaller TMs: 12 f (x, y) = x + y if x ≥ y 0 if x < y { Formal Languages and Automata, 5 th ed. Peter Linz Jones & Bartlett, 2012

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing Machine Subprograms  Suppose TM A wants to call subprogram TM B.  We need to store A ’s configuration so we can recreate the configuration upon return from B.  Example: A is in some state q i with the read/write head at a particular tape cell when it invokes B. Upon return from B, resume A in state q i with the read/write head restored to its original place.  We want A to pass information (parameters) to B. 13

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing Machine Subprograms, cont’d  Before A calls B : A writes its state and any arguments for B to tape region T.  A passes control to B. B reads tape region T for its input and starts execution. B writes any results to tape region T. B returns to A. 14

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing Machine Subprograms, cont’d  A resumes control: A reads the results and its previous state in tape region T. A continues execution. 15

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing’s Thesis  Claim: Any computation that can be carried out by mechanical means can be performed by some Turing Machine. How can we prove this?  Evidence (but not proof): TMs are more powerful than pushdown automata. TMs can do arithmetic, string manipulation, and simple comparisons. More powerful TMs can be built from simpler TMs. A TM can be a subprogram for another TM. 16

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing’s Thesis, cont’d  Is there a counterexample?  Can we find a procedure for which we can write a computer program, but for which we can show that no TM can exist.  No one has found such a counterexample. 17

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing’s Thesis as a Definition  Definition: A computation is mechanical if and only if it can be performed by some TM.  Arguments in favor of this definition: Anything that can be done on any existing digital computer can be done by a TM. No one has yet been able to suggest a problem, solvable by what we intuitively consider an algorithm, for which a TM program cannot be written. No alternative models proposed for mechanical computation is more powerful than the TM model. 18

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing’s Thesis as Basic Laws  Turing’s thesis plays the same role in computer science as the basic laws of physics and chemistry. Newton’s laws of motion are plausible models that explain much of the physical world. They agree with our experiences and observations. They cannot be proved to be true. But they can possibly be invalidated.  Turing’s thesis are laws that agree with our experiences and observations about computers. Attempts to invalidate them have failed so far. 19

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Definition of an Algorithm  An algorithm for a function is a Turing machine M, which given as input any on its tape, eventually halts with the correct answer on its tape.  Specifically, we require that for all. 20 q 0 d * q final f (d)

Computer Science Dept. Spring 2016: April 12 CS 154: Formal Languages and Computability © R. Mak Turing’s Writings  “Computing Machinery and Intelligence” The imitation game hr3pvq5j64p208/imwwvqfucgv7/The_Imitation_Game.pdf hr3pvq5j64p208/imwwvqfucgv7/The_Imitation_Game.pdf  The Annotated Turing A guided tour through Alan Turing’s Historic Paper on Computability and the Turing Machine by Charles Petzold Computability/dp/ /ref=sr_1_1?s=books&ie=UTF8& qid= &sr=1-1&keywords=annotated+turing Computability/dp/ /ref=sr_1_1?s=books&ie=UTF8& qid= &sr=1-1&keywords=annotated+turing 21