Turing Machine as Transducer. Turing Machines. Computation with Turing Machines. Computation with Turing Machines. Computation with Turing Machines

Similar documents
CS 125 Section #4 RAMs and TMs 9/27/16

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

CSE 105 THEORY OF COMPUTATION

CISC 4090 Theory of Computation

Variants of Turing Machines

CS21 Decidability and Tractability

Recursively Enumerable Languages, Turing Machines, and Decidability

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

pp Variants of Turing Machines (Sec. 3.2)

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

CSCI 3130: Formal Languages and Automata Theory Lecture 16 The Chinese University of Hong Kong, Fall 2010

Actually talking about Turing machines this time

Turing Machine Languages

Storage capacity of labeled graphs

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

ECS 120 Lesson 16 Turing Machines, Pt. 2

CpSc 421 Final Solutions

Computability via Recursive Functions

Theory of Computation, Homework 3 Sample Solution

Enumerations and Turing Machines

SECTION A (40 marks)

Theory of Languages and Automata

CS 44 Exam #2 February 14, 2001

Outline. Language Hierarchy

More Simulations. CS154 Chris Pollett Apr 25, 2007.

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

14.1 Encoding for different models of computation

CSC-461 Exam #2 April 16, 2014

Computability and Complexity

Computability Summary

Turing Machines Part Two

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

Limited Automata and Unary Languages

CS 531: Notes II. January 31, 2014

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Lecture 18: Turing Machines

DECLARAING AND INITIALIZING POINTERS

Material from Recitation 1

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

CSE 120. Computer Science Principles

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

6. Advanced Topics in Computability

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

COMP 382: Reasoning about algorithms

Context Free Languages and Pushdown Automata

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing

what are strings today: strings strings: output strings: declaring and initializing what are strings and why to use them reading: textbook chapter 8

Turing Machines, continued

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia

2.8 Universal Turing Machines and the Halting Problem

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language

Case by Case. Chapter 3

Chapter 3 Linear Structures: Lists

It is better to have 100 functions operate one one data structure, than 10 functions on 10 data structures. A. Perlis

arxiv: v1 [cs.cc] 9 Jan 2015

Formal languages and computation models

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Chapter 14: Pushdown Automata

CS W Introduction to Databases Spring Computer Science Department Columbia University

Chapter 3 Linear Structures: Lists

Abstract Thinking, Intro to the Theory of Computation. SC/COSC Lecture Notes

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

Relational Algebra. Study Chapter Comp 521 Files and Databases Fall

Multiple Choice Questions

Semantics of programming languages

Informatics Ingeniería en Electrónica y Automática Industrial

Lec-5-HW-1, TM basics

Automata Theory CS F-14 Counter Machines & Recursive Functions

CSE Theory of Computing Fall 2017 Project 3: K-tape Turing Machine

Implementation of Neural Network with a variant of Turing Machine for Traffic Flow Control

Introduction to Computers & Programming

Theory of Computations III. WMU CS-6800 Spring -2014

Equivalence of NTMs and TMs

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

CSE 130 [Winter 2014] Programming Languages

III. Supplementary Materials

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

Theory of Computations Spring 2016 Practice Final

Programming Languages

Type Checking and Type Equality


LECTURE 16. Functional Programming

Where Can We Draw The Line?

PROGRAMMING IN HASKELL. Chapter 10 - Interactive Programming

Theory Bridge Exam Example Questions Version of June 6, 2008

1 Parsing (25 pts, 5 each)

Haskell Overview II (2A) Young Won Lim 8/9/16

SOFTWARE ENGINEERING DESIGN I

CSE 5A Final Fall 2006

Quiz 2 CSCI 1103 Computer Science I Honors KEY. Tuesday November 8, 2016 Instructor Muller Boston College. Fall 2016

CS 297 Report. By Yan Yao

CS402 - Theory of Automata Glossary By

(p 300) Theorem 7.27 SAT is in P iff P=NP

A Second Look At ML. Chapter Seven Modern Programming Languages, 2nd ed. 1

Transcription:

Turing Machine as Transducer Turing Computation and programming Transducer -- any device that converts a signal from one form to another Turning machine Converts input to output Start with string on the tape After acceptance string left on the tape Computing functions with TMs The result of the function applied to an input string x, will be left on the tape when the machine accepts. Functions with multiple arguments can be placed on the input tape with arguments separated by some character. Turing s original use of his machine was to calculate integer valued functions. Integers were represented in unary as blocks of a single symbol. Example 111111 would represent 6 1111 would represent 4 In our text 1s are used as the unary symbol 0s are used to separate arguments Computing functions with TMs Formally, Let M = (Q, Σ, Γ, δ, q 0,, F) be a TM and let f be a partial function on Σ *. We say T computes f (or f is Turing-computable) if for every x Σ * where f is defined: q 0 x a * pf(x) Where p F And for every other x, T rejects on input x. Computing functions with TMs Formally (with multiple arguments) Let M = (Q, Σ, Γ, δ, q 0,, F) be a TM and let f be a partial function on (Σ*) k. We say T computes f (or f is Turing-computable) if for every (x 1, x 2., x k ) where f is defined: q 0 x 1 0x 2 0x k a * pf(x 1, x 2., x k ) Where p F And for every other k-tuple, T rejects on input x. 1

Example Addition x + y Create a machine that will perform the computation q 0 1 x 01 y a * p1 x 1 y Where p F Example Addition x + y q 0 1 x 01 y a * p1 x 1 y Basic idea: Simply remove the 0 between the two sets of ones. Read all 1s up to 1st 0 Replace 0 with 1 Remove last 1 Example Addition (JFLAP) Another example Copy routine Copies its input and concatenates a copy of itself on the tape q 0 1 x a * p1 x 1 x Another example copy routine Basic idea: count number of 1 s by replacing with X Go back and re-read all Xs and as you re-read each X, add a 1 to the end of the tape. Repeat until all Xs are converted back to 1s Another example copy routine 2

One more example One more example A simple if statement Create a TM that will accept in one state if a condition is true (e.g. x y) and another if the condition is false. q 0 1 x 01 y a * p1 x 01 y if x > y q 0 1 x 01 y a * r1 x 01 y if x y Note that contents of tape is the same after computation. Simple if statement Basic idea: similar to 0 i 1 i example Match 1 s before 0 with 1 s after. Will either exhaust all initial 1s or trailing 1 s. Go to target state based on cases above MUST return tape to initial input when done. If statement Reality check Turing Machine as transducer Converts input to output Turing-Computable functions Combining Turing Suppose an algorithm has a number of tasks to perform Each task has its own TM Much like subroutines or functions They can be combined into a single TM T 1 T 2 is the composite TM T 1 T 2 Combining Turing Composite TMs T 1 T 2 Start at start state of T 1 For any move that causes T 1 to enter the halt state, have T 1 move to the start state of T 2. So T 2 will get executed immediately after T 1 as long as T 1 will halt on a given input. Allows one to define subroutines. 3

TMs and subroutines Each TM subroutine must define Start state The final state (with conditions) Contents of tape after acceptance Position of tape head after acceptance TMs and subroutines Example " f (x, y) = # x + y if x > y $ 0 otherwise TMs and subroutines Now we have TMs for doing the following Logical compare of x with y Addition of x with y We could easily write one: Erasing all 1s TM and Subroutines The Eraser TM building blocks " f (x, y) = # x + y if x > y $ 0 otherwise TM and subroutines Modified if 4

Building TM from blocks Example L = { xx x { a, b } * } Basic idea Find and mark the middle of the string Compare characters starting from the start of the string with characters starting from the middle of the string. Example L = { xx x { a, b } * } Three subroutines Find and mark the middle of the string Convert the 1 st half of the string back to lower case. Match and compare Example L = { xx x { a, b } * } Finding the middle of the string Convert first character to it s upper case equiv. Move all the way to the right to the last lower case character and change it to upper case. Move all the way back left to the first lower case character and change it to upper case And so on. Example L = { xx x { a, b } * } Finding the middle of the string Start with tape head at first symbol on tape End with tape head at the last character of the 1st half of string Will reject if string is not even. Middle 5

Once you ve found the middle, Convert the 1 st half of the string back to lower case. Start from current tape position and change read backwards to end converting characters along the way. Leaves tape at start of input when done. Tolower Once you ve found the middle and converted to lower case Start from the left of the tape Match lower case chars in 1 st half with upper case chars in the 2 nd. Replace a matched upper case char with blanks Repeat until only 1st half remains Assumes string of form lluu Match The routine will leave the repeated string on the tape Questions? Putting it together 6

Summary Turing Computation on TMs Subroutines To come Next time: TM Variants Languages associated with TMs. Questions 7