Tape. Tape head. Control Unit. Executes a finite set of instructions

Similar documents
Feb 22,2013. CS402- Theory of Automata Solved MCQS From Final term Papers. FINALTERM EXAMINATION Fall 2012 CS402- Theory of Automata

For an alphabet, we can make do with just { s, 0, 1 }, in which for typographic simplicity, s stands for the blank space.

Lecture 3: Nondeterministic Computation

Informatique Fondamentale IMA S8

Artificial Intelligence

The word digital implies information in computers is represented by variables that take a limited number of discrete values.

The Turing Test and Its Discontents

Music and Mathematics: On Symmetry

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

Final Exam review: chapter 4 and 5. Supplement 3 and 4

Testing Transition Systems with Input and Output Testers

Lecture 11: Synchronous Sequential Logic

Sequential Digital Design. Laboratory Manual. Experiment #3. Flip Flop Storage Elements

I Don t Want to Think About it Now: Decision Theory With Costly Computation

How to Predict the Output of a Hardware Random Number Generator

FSM Test Translation Through Context

MC9211 Computer Organization

An Efficient Implementation of Interactive Video-on-Demand

Combinational vs Sequential

Chapter. Synchronous Sequential Circuits

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Digital Signal Processing Lecture One Introduction to Digital Signal Processing Third Stage Prepared by: Marwah Kareem


Quiz #4 Thursday, April 25, 2002, 5:30-6:45 PM

Data Representation. signals can vary continuously across an infinite range of values e.g., frequencies on an old-fashioned radio with a dial

Logic Design II (17.342) Spring Lecture Outline

University of Pennsylvania Department of Electrical and Systems Engineering. Digital Design Laboratory. Lab8 Calculator

Chapter 5 Synchronous Sequential Logic

16 Dec Testing and Programming PCBA s. 1 JTAG Technologies

Bar Codes to the Rescue!

ACT-R ACT-R. Core Components of the Architecture. Core Commitments of the Theory. Chunks. Modules

Department of CSIT. Class: B.SC Semester: II Year: 2013 Paper Title: Introduction to logics of Computer Max Marks: 30

CPU Bach: An Automatic Chorale Harmonization System

Laboratory Exercise 7

18 Nov 2015 Testing and Programming PCBA s. 1 JTAG Technologies

CSC258: Computer Organization. Combinational Logic

CSC 373: Algorithm Design and Analysis Lecture 17

CHAPTER1: Digital Logic Circuits

UNIT III. Combinational Circuit- Block Diagram. Sequential Circuit- Block Diagram

D Latch (Transparent Latch)

Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

Training Note TR-06RD. Schedules. Schedule types

cs281: Introduction to Computer Systems Lab07 - Sequential Circuits II: Ant Brain

EECS 270 Final Exam Spring 2012

Digital Circuits ECS 371

LAB 3 Verilog for Combinational Circuits

Course Administration

Perry High School Bands

Digital Electronics II 2016 Imperial College London Page 1 of 8

Comp 410/510. Computer Graphics Spring Introduction to Graphics Systems

Bit Swapping LFSR and its Application to Fault Detection and Diagnosis Using FPGA

Chapter 5: Synchronous Sequential Logic

Individual Project Report

1. What does the signal for a static-zero hazard look like?

ECE 301 Digital Electronics

Part II. Chapter2: Synchronous Sequential Logic

Copyright 2011 by Enoch Hwang, Ph.D. and Global Specialties. All rights reserved. Printed in Taiwan.

Problems with D-Latch

EET2411 DIGITAL ELECTRONICS

Final Examination (Open Katz, Calculators OK, 3 hours)

Sri Vidya College of Engineering And Technology. Virudhunagar Department of Electrical and Electronics Engineering

Introduction to Probability Exercises

UNIT IV CMOS TESTING. EC2354_Unit IV 1

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) LATCHES and FLIP-FLOPS

Import and quantification of a micro titer plate image

ТМ-04 Multichannel long range UHF alarm transmitter Operating manual. Sectron Ltd.

ILDA Image Data Transfer Format

Cascadable 4-Bit Comparator

Chapter 5 Sequential Systems. Introduction

MODEL QUESTIONS WITH ANSWERS THIRD SEMESTER B.TECH DEGREE EXAMINATION DECEMBER CS 203: Switching Theory and Logic Design. Time: 3 Hrs Marks: 100

Finite State Machine Design

1.1 The Language of Mathematics Expressions versus Sentences

MATHEMATICAL APPROACH FOR RECOVERING ENCRYPTION KEY OF STREAM CIPHER SYSTEM

Jin-Fu Li Advanced Reliable Systems (ARES) Laboratory. National Central University

ISO/IEC INTERNATIONAL STANDARD

Chapter 8 Sequential Circuits

Digital Logic. ECE 206, Fall 2001: Lab 1. Learning Objectives. The Logic Simulator

FPGA Implementation of Sequential Logic

Available online at ScienceDirect. Procedia Computer Science 46 (2015 ) Aida S Tharakan a *, Binu K Mathew b

Fig 1. Flow Chart for the Encoder

Report on 4-bit Counter design Report- 1, 2. Report on D- Flipflop. Course project for ECE533

Math and Music. Cameron Franc

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

Revelation Principle; Quasilinear Utility

ELCT201: DIGITAL LOGIC DESIGN

Agenda. EE 260: Introduction to Digital Design Counters and Registers. Asynchronous (Ripple) Counters. Asynchronous (Ripple) Counters

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

Department of Computer Science and Engineering Question Bank- Even Semester:

Part 1: Introduction to Computer Graphics

Laboratory Exercise 7

Experiment 8 Introduction to Latches and Flip-Flops and registers

To design a sequential logic circuit using D-Flip-flop. To implement the designed circuit.

Available online at ScienceDirect. Procedia Technology 24 (2016 )

Name: Date: Suggested Reading Chapter 7, Digital Systems, Principals and Applications; Tocci

Lab 5 FPGA Design Flow Based on Aldec Active-HDL. Fast Reflex Game.

Task 4_B. Decoder for DCF-77 Radio Clock Receiver

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Introduction to JTAG / boundary scan-based testing for 3D integrated systems. (C) GOEPEL Electronics -

2D ELEMENTARY CELLULAR AUTOMATA WITH FOUR NEIGHBORS

Ilmenau, 9 Dec 2016 Testing and programming PCBA s. 1 JTAG Technologies

Transcription:

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. There is a control unit that contains a finite set of state transition instructions. a Control Unit Tape Tape head Executes a finite set of instructions An instruction reads the symbol in the current tape cell, writes a symbol to the same cell, and then moves the tape head one cell left or right or remains at the same cell, after which the machine enters a new state. Assumptions: The symbol Λ denotes a blank cell. The tape head is initially at the left end of a nonempty input string (unless specified otherwise) There is a designated start state. There is one halt state. The moves are denoted by L, S, R for move left, stay, and move right. Instructions are represented in graphical form or as 5-tuples, as shown in the example to the right. This instruction executes if the current state of the TM is i and the current input symbol is a. The TM writes b into that cell, moves right one cell and enters state j. i a b, R (i, a, b, R, j) j 1

Acceptance An input string on the tape is accepted by the TM if the machine enters the halt state. The language of a TM is the set of all strings accepted by the machine. Example/Quiz. Given the following simple TM. (0, a, a, R, halt). What is the language of the TM? Answer: If an input string begins with the letter a, then the TM executes the instruction and halts. So the string is accepted. Therefore, the language of the TM is the set of all strings that begin with the letter a. Example. Construct a TM to accept the language {ab n n N}. If so, move right to scan b s until Λ is found. (0, a, a, R, 1) (1, Λ, Λ, S, halt) (1, b, b, R, 1). Quiz. Construct a TM to accept the language {ab n a n N}. If so, move right to scan b s until a is found. Then make sure there is Λ to the right. (0, a, a, R, 1) (1, a, a, R, 2) (1, b, b, R, 1) (2, Λ, Λ, S, halt). 2

Quiz. Construct a TM to accept the language of the regular expression a(a + b)*. If so, move right to scan any a s or b s until Λ is found. (0, a, a, R, 1) (1, a, a, R, 1) (1, b, b, R, 1) (1, Λ, Λ, S, halt). Example/Quiz. Find a TM to accept {a n b n n N}. If so, write X and scan right looking for a b to replace by Y. (0, Λ, Λ, S, halt) accept Λ (0, a, X, R, 1) mark a with X (0, Y, Y, R, 3) no more a s Scan right looking for b to pair with a: (1, a, a, R, 1) (1, Y, Y, R, 1) (1, b, Y, L, 2) mark b with Y Scan back left looking for X: (2, a, a, L, 2) (2, Y, Y, L, 2) (2, X, X, R, 0) Scan right looking for Λ and halt: (3, Y, Y, R, 3) (3, Λ, Λ, S, halt) TMs are very powerful. For example, the preceding example can be generalized to a TM that accepts the non-context free language {a n b n c n n N}. (See Example 13.2 in the Text.) So a TM can handle two stacks. In fact, a TM can handle any number of stacks. 3

Turing Machines with Output Specify the form of the output on the tape when the machine halts. Example/Quiz. Find a TM to add 4 to a natural number represented in binary. Start with the tape head at the right end of the input string and halt with the tape head at the left end of the output string. Solution. Let the start state be 0. Move two cells left: Add 1: (0, 0, 0, L, 1) (0, 1, 1, L, 1) (1, 0, 0, L, 2) (1, 1, 1, L, 2) (1, Λ, 0, L, 2) (2, 0, 1, L, 3) Move left (2, 1, 0, L, 2) Carry (2, Λ, 1, S, halt) Done Quiz. How would you construct a TM to add 5 to a binary number? Find left end of the string: (3, 0, 0, L, 3) (3, 1, 1, L, 3) (3, Λ, Λ, R, halt) Done One Solution: Add 1, move back to right end, and then use the preceding solution. For this purpose, let the start state be 4. Add 1: (4, 0, 1, R, 5) Move right (4, 1, 0, L, 4) Carry (4, Λ, 1, R, 5) Move right Find right end of the string: (5, 0, 0, R, 5) (5, 1, 1, R, 5) (5, Λ, Λ, L, 0) Go add 4 4

Example/Quiz. Find a TM to move any string over {a, b} to the left one cell position. Assume the tape head ends at the left end of any nonempty output string. Solution. Let the start state be 0. Find a or b to move: (0, a, Λ, L, 1) Go write a (0, b, Λ, L, 2) Go write b (0, Λ, Λ, L, 4) Done A trace for input aba (tape head is red): Λ a b a Λ (0, a, Λ, L, 1) Λ Λ b a Λ (1, Λ, a, R, 3) a Λ b a Λ (3, Λ, Λ, R, 0) a Λ b a Λ (0, b, Λ, L, 2) a Λ Λ a Λ (2, Λ, b, R, 3) a b Λ a Λ (3, Λ, Λ, R, 0) a b Λ a Λ (0, a, Λ, L, 1) a b Λ Λ Λ (1, Λ, a, R, 3) a b a Λ Λ (3, Λ, Λ, R, 0) a b a Λ Λ (0, Λ, Λ, L, 4) a b a Λ Λ (4, Λ, Λ, L, 5) a b a Λ Λ (5, a, a, L, 5) a b a Λ Λ (5, b, b, L, 5) a b a Λ Λ (5, a, a, L, 5) Λ a b a Λ Λ (5, Λ, Λ, R, halt) Λ a b a Λ Λ Output. Write a or b: (1, Λ, a, R, 3) Write a (2, Λ, b, R, 3) Write b (3, Λ, Λ, R, 0) Skip Λ Move to left end of output: (4, Λ, Λ, L, 5) (5, a, a, L, 5) (5, b, b, L, 5) (5, Λ, Λ, R, halt). Quiz. (Exercise 2). Find a TM to search for the symbol # on an otherwise empty tape, where the tape head starts at a random cell. A Solution: Use a new symbol, say x, to mark cells that have been searched as the machine alternately looks left and right. A Sample Trace: # Λ Λ Λ Λ # Λ x Λ Λ # x x Λ Λ # x x Λ Λ # x x x Λ # x x x Λ # x x x Λ. 5

Alternative Definitions of Turing Machine One-way Infinite Tape Multihead Multitape Quiz. Why are they all equal in power to the original definition of a Turing machine? An n-head or n-tape instruction contains n-tuples for the cell contents and move operations. Example. A typical instruction for a 2-head or a 2-tape TM is (0, (a, b), (c, d), (L, R), 1). Example/Quiz. Implement some sample PDA instructions as TM instructions for a 2-tape TM. Assume one tape holds the input string and the other tape holds the stack. Assume the input is scanned left to right and the the stack grows from right to left. PDA Instruction: 1. (i, a, X, nop, j) 2. (i, a, X, pop, j) 3. (i, a, X, push(y), j) 4. (i, Λ, X, pop, j). TM Instruction: 1. (i, (a, X), (a, X), (R, S), j) 2. (i, (a, X), (a, Λ), (R, R), j) 3. (i, (a, X), (a, X), (S, L), k) and (k, (a, Λ), (a, Y), (R, S), j) 4. For each letter a: (i, (a, X), (a, Λ), (S, R), j). a input stack X 6

Nondeterministic Turing Machines Example. Generate an arbitrary string over {a, b} of length n. Solution: Assume the input is any string over {a, b} of length n. The tape head is at the right end of the output string. (0, a, a, R, 0) (0, a, b, R, 0) (0, b, a, R, 0) (0, b, b, R, 0) (0, Λ, Λ, L, halt). Nondeterministic TMs have the same power as deterministic TMs The idea: Any nondeterministic TM can be simulated by a deterministic TM that simulates all 1-step computations, then all 2-step computations, and so on. The process stops if some computation enters the halt state. 7