Examples of Turing Machines. Examples of Turing Machines p.1/22

Similar documents
Turing Machines: An Introduction

3515ICT Theory of Computation Turing Machines

24 Uses of Turing Machines

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

Automata and Computability. Solutions to Exercises

Reading 13 : Finite State Automata and Regular Expressions

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Introduction to Finite Automata

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

The Halting Problem is Undecidable

Introduction to Turing Machines

Notes on Complexity Theory Last updated: August, Lecture 1

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Computer Science 281 Binary and Hexadecimal Review

FINITE STATE AND TURING MACHINES

1 Definition of a Turing machine

Regular Languages and Finite State Machines

Turing Machines, Part I

Regular Expressions and Automata using Haskell

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Introduction to Automata Theory. Reading: Chapter 1

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

HFCC Math Lab Arithmetic - 4. Addition, Subtraction, Multiplication and Division of Mixed Numbers

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

Computational Models Lecture 8, Spring 2009

CAs and Turing Machines. The Basis for Universal Computation

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080/6.089 GITCS Feb 12, Lecture 3

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set.

03 - Lexical Analysis

Computability Theory

NP-Completeness and Cook s Theorem

Automata and Formal Languages

5.1 Radical Notation and Rational Exponents

=

Math Workshop October 2010 Fractions and Repeating Decimals

Lecture 2: Universality

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

Regular Languages and Finite Automata

Universal Turing Machine: A Model for all Computational Problems

Positional Numbering System


Properties of Stabilizing Computations

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

Data Flow Diagram. Data Flow Diagrams (DFDs)

How To Compare A Markov Algorithm To A Turing Machine

Introduction to NP-Completeness Written and copyright c by Jie Wang 1

9.4. The Scalar Product. Introduction. Prerequisites. Learning Style. Learning Outcomes

Chapter 4: Computer Codes

Adding vectors We can do arithmetic with vectors. We ll start with vector addition and related operations. Suppose you have two vectors

Finite Automata and Regular Languages

Row Echelon Form and Reduced Row Echelon Form

Notes on NP Completeness

CS 3719 (Theory of Computation and Algorithms) Lecture 4

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

Theory of Computation Chapter 2: Turing Machines

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: b + 90c = c + 10b

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Model Simulation in Rational Software Architect: Business Process Simulation

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

Formal Grammars and Languages

Two-dimensional Languages

SOLVING TRIGONOMETRIC EQUATIONS

Cubes and Cube Roots

MACHINE INSTRUCTIONS AND PROGRAMS

1.6 The Order of Operations

Figure 1. A typical Laboratory Thermometer graduated in C.

THEORY of COMPUTATION

10.2 Series and Convergence

Lecture 8: Synchronous Digital Systems

Just the Factors, Ma am

Composability of Infinite-State Activity Automata*

Overview. Essential Questions. Precalculus, Quarter 4, Unit 4.5 Build Arithmetic and Geometric Sequences and Series

International Securities Identification Number (ISIN)

CHAPTER 2. Logic. 1. Logic Definitions. Notation: Variables are used to represent propositions. The most common variables used are p, q, and r.

Continued Fractions and the Euclidean Algorithm

The Classes P and NP

Math 115 Spring 2011 Written Homework 5 Solutions

Simulation-Based Security with Inexhaustible Interactive Turing Machines

2016 national curriculum tests. Key stage 2. Mathematics test mark schemes. Paper 1: arithmetic Paper 2: reasoning Paper 3: reasoning

Cartesian Products and Relations

Section 1.4 Place Value Systems of Numeration in Other Bases

Lexical analysis FORMAL LANGUAGES AND COMPILERS. Floriano Scioscia. Formal Languages and Compilers A.Y. 2015/2016

Lecture 2. Binary and Hexadecimal Numbers

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix:

1 The Concept of a Mapping

Examination paper for MA0301 Elementær diskret matematikk

THE SEARCH FOR NATURAL DEFINABILITY IN THE TURING DEGREES

7 Relations and Functions

Fundamentele Informatica II

Scanner. tokens scanner parser IR. source code. errors

4/1/2017. PS. Sequences and Series FROM 9.2 AND 9.3 IN THE BOOK AS WELL AS FROM OTHER SOURCES. TODAY IS NATIONAL MANATEE APPRECIATION DAY

Polynomial and Rational Functions

DC mesh current analysis

3.2 Roulette and Markov Chains

Algorithms and Data Structures

Circuit diagrams and symbols (1)

Transcription:

Examples of Turing Machines Examples of Turing Machines p.1/22

Higher level descriptions We can give a formal description to a particular TM by specifying each of its seven components This way a TM can become cumbersome. Note: To avoid this we use higher level descriptions which are precise enough for the purpose of understanding However, every higher level description is actually just a short hand for its formal counterpart. Examples of Turing Machines p.2/22

Example 1 Describe a TM that recognizes the language = "On input string : 1. Sweep left to right across the tape crossing off every other 2. If in stage 1 tape contained a single, accept 3. If in stage 1 tape contained more that a single of s was odd, reject and the number 4. Return the head to the left-hand of the tape 5. Go to stage 1" Examples of Turing Machines p.3/22

Analysis At each iteration, stage 1 cuts the number of s in half. If the resulting number of s is odd and greater than one, the original number could not have been a power of 2 and machine rejects If the number of is one than the original number of zeros must have been a power of 2, so machine accepts. Rationale: Hence, if it means that. Examples of Turing Machines p.4/22

Formal description of where: is described in Figure 1,, The start, accept, reject are respectively Examples of Turing Machines p.5/22

State diagram of!!!!" Examples of Turing Machines p.6/22

Notations is denoted by an arrow that starts at, and is labeled by is denoted by an arrow that starts at, and is labeled by is denoted by an arrow that starts at, and is labeled by is denoted by an arrow that starts at, and is labeled by, ends at, ends at, ends at, ends at Examples of Turing Machines p.7/22

Examples of Turing Machines p.8/22 Example run : On input

Comments The arrow labeled the machine goes to, writes The arrow labeled : 0 without affecting the tape. i.e., in state in means with head reading,, and moves to right in means moves to the right when reading a Note: This machines begins by writing a blank over the leftmost zero. This allows it to find the left-end of the tape in stage 4 It also allows only, in stage 2 to identify the case when tape contains one zero Examples of Turing Machines p.9/22

Example 2 is the TM that decides the language, is described in Figure 2, Start, accept, and reject states are respectively Examples of Turing Machines p.10/22

High-level description of = "On input : 1. Scan the input tape to be sure that it contains a single reject. If not, 2. Zig-zag across the tape to corresponding positions on either side of to check whether these positions contain the same symbol. If they do not, reject. Cross off the symbols as they are checked 3. When all symbols to the left of have been crossed off, check for the remaining symbols to the right of. If any symbol remain, reject; otherwise accept" Note: High-level descriptions of TM-s are also called implementation descriptions. Examples of Turing Machines p.11/22

Turing machine Figure 2: State diagram for TM Examples of Turing Machines p.12/22

More notations Transitions in states and means that machines moves to the right as long as 0 or 1 is on the tape. The machine starts by writing a blank symbol to delimit the left-hand edge of the tape Stage 1 is implemented by states through :,, if the first symbol of input is, and if the first input symbol was. To simplify the figure we don t show the reject state or transitions going to reject state. These transitions occur implicitly whenever a state lacks an outgoing transition for a particular symbol. Example, on # is such a transition Note: using different states for input starting with 1 and 0 allows to implement the matching operation Examples of Turing Machines p.13/22

Note The transition diagram in Figure 2 is rather complex. One can understand better what happens from the high-level description than from Figure 2. Therefore further we will replace transition diagrams by high-level descriptions, as initially suggested Examples of Turing Machines p.14/22

Example 3 is a Turing machine that performs some elementary arithmetic. It decides the language ="On input string 1. Scan the input from left to right to be sure that it is a member of ; reject if it is not 2. Return the head at the left-hand end of the tape 3. Cross off an and scan to the right until a occurs. Shuttle between the s and s crossing off one of each until all s are gone. If all s have been crossed of and some s remain reject. 4. Restores the crossed off s and repeat stage 3 if there is another to cross off. If all s are crossed off, determine whether all s are crossed off. If yes accept, otherwise reject." Examples of Turing Machines p.15/22

Analyzing In stage 1 operates as a finite automaton; no writing is necessary as the head moves from left to right:,, 1.,, 2.,, 3. Examples of Turing Machines p.16/22

Stage 2 finding the left-hand end Mark the left-hand end by writing a before the input (this have been seen before) Note that if the machine tries to move the head to the left of the left-hand end of the tape the head remains in the same place. This feature can be made "the left-hand end detector" by: 1. Write a special symbol over the current position, while recording the symbol that it replaced in the control 2. Attempt to move to the left. If the head is still over the special symbol, the leftward move did not succeed, and the head must have been at the left-hand end. If the head is over a different symbol, some symbols are to the left of that position Examples of Turing Machines p.17/22

Note Stage 3 and stage 4 of implementations have straightforward Examples of Turing Machines p.18/22

Element distinctness problem Given a list of strings over separated by, determine if all strings are different. A TM that solves this problem accepts the language Examples of Turing Machines p.19/22

Example 4 is the TM that solves the element distinctness problem works by comparing comparing with with, and so on, then by Examples of Turing Machines p.20/22

Informal description ="On input : 1. Place a mark on top of the leftmost tape symbol. If that symbol was a blank, accept. If that symbol was a continue with the next stage. Otherwise reject. 2. Scan right to the next and place a second mark on top of it. If no is encountered before a blank symbol, only was present, so accept. 3. By zig-zagging, compare the two strings to the right of the marked -s. If they are equal, reject 4. Move the rightmost of the two marks to the next symbol to the right. If no symbol is encountered before a blank symbol, move the leftmost mark to the next to its right and the rightmost mark to the after that. If no is available for the rightmost mark, all Examples of Turing Machines p.21/22

Marking tape symbols In stage two the machine places a mark above a symbol, in this case. In the actual implementation the machine has two different symbols, and in the tape alphabet Thus, when machine places a mark above symbol it actually writes the marked symbol of at that location Removing the mark means write the symbol at the location where the marked symbol was. Examples of Turing Machines p.22/22