SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

Similar documents
CSCC63 Worksheet Turing Machines

Part I: Definitions and Properties

CSE 105 THEORY OF COMPUTATION

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

Please give details of your answer. A direct answer without explanation is not counted.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Turing Machines Part II

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Computation Histories

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

Computability and Complexity

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

Turing Machines. Our most powerful model of a computer is the Turing Machine. This is an FA with an infinite tape for storage.

The Power of One-State Turing Machines

ECS 120 Lesson 15 Turing Machines, Pt. 1

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

V Honors Theory of Computation

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

CSE 105 THEORY OF COMPUTATION

CpSc 421 Final Exam December 15, 2006

Reducability. Sipser, pages

Turing Machines. The Language Hierarchy. Context-Free Languages. Regular Languages. Courtesy Costas Busch - RPI 1

Languages, regular languages, finite automata

Most General computer?

CS21 Decidability and Tractability

CSE 105 THEORY OF COMPUTATION

Automata Theory CS S-12 Turing Machine Modifications

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CSCI3390-Assignment 2 Solutions

Introduction to Turing Machines. Reading: Chapters 8 & 9

Chapter 7 Turing Machines

Foundations of

CSE 105 THEORY OF COMPUTATION

Lecture 12: Mapping Reductions

Computability Theory

Turing Machines. Chapter 17

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

CS 525 Proof of Theorems 3.13 and 3.15

1 Showing Recognizability

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

CPSC 421: Tutorial #1

Chapter 3: The Church-Turing Thesis

Context-Free Languages

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

1 Unrestricted Computation

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

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

ACS2: Decidability Decidability

Turing Machine Variants

Finite Automata. Finite Automata

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Homework Assignment 6 Answers

CS4026 Formal Models of Computation

CSCE 551: Chin-Tser Huang. University of South Carolina

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing Machines Part III

CSE 105 THEORY OF COMPUTATION

Undecidable Problems and Reducibility

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

TURING MAHINES

Pumping Lemma for CFLs

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

Lecture 13: Turing Machine

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

Non-emptiness Testing for TMs

IV. Turing Machine. Yuxi Fu. BASICS, Shanghai Jiao Tong University

Theory of Computation

Homework 5 Solution CSCI 2670 October 6, c) New text q 1 1##1 xq 3 ##1 x#q 5 #1 q reject. Old text. ~q 3 ##1 ~#q 5 #1

Turing Machines. Lecture 8

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CSCE 551: Chin-Tser Huang. University of South Carolina

Turing Machines Part One

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

CSE 105 THEORY OF COMPUTATION

Theory of Computation (IX) Yijia Chen Fudan University

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

Testing Emptiness of a CFL. Testing Finiteness of a CFL. Testing Membership in a CFL. CYK Algorithm

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

Decidability (What, stuff is unsolvable?)

Intro to Theory of Computation

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Further discussion of Turing machines

CS20a: Turing Machines (Oct 29, 2002)

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory

CS20a: Turing Machines (Oct 29, 2002)

The Unsolvability of the Halting Problem. Chapter 19

7.2 Turing Machines as Language Acceptors 7.3 Turing Machines that Compute Partial Functions

Turing Machines Part Two

Transcription:

SE 3310b Theoretical Foundations of Software Engineering Turing Machines Aleksander Essex 1 / 1

Turing Machines 2 / 1

Introduction We ve finally arrived at a complete model of computation: Turing machines. Turing machines capture a model of computation that has: Full effective range of computational power: if you can compute it, there exists a TM that can compute it Fundamental limitations: Even a TM can t solve some problems 3 / 1

Turing Machine Components A Turing machine consists of the following components: 1. Tape: An infinite tape of memory cells 2. Head: A read/write head pointing at a single memory cell on the tape. The head can move left and right along the tape 3. Control: A finite automaton that controls movements of the head, reading from and writing to the tape. It has explicit accept/reject states and the TM stops (halts) whenever it reaches one. Technically the tape is not infinite in both directions: it has a beginning, but continues forever. Initially the input string appears on the tape starting at the beginning. All cells beyond the input are marked \, meaning empty. 4 / 1

Turing Machine A Turing Machine is essentially a finite automaton with the ability to read and write from a memory tape: TM a a b b \ \ \... As the Turning machine reads a character from the tape, it may move its head left or right, and may write a new character to the tape. 5 / 1

Turing Machine Example Example: A Turing Machine erasing the last symbol on the input tape: TM a b \ \ \ \... Step 1: Cell not blank, move right TM a b \ \ \ \... Step 2: Cell not blank, move right TM a b \ \ \ \... Step 3: Cell blank, move left TM a \ \ \ \ \... Step 4: Write \ and halt 6 / 1

Turing Machine Definition In order to be more self-consistent with the defnitions for NFAs and PDAs (and to make your life a little easier) we ll follow along the lines of the Peter Linz definition of TMs instead of Sipser s (see comparison here): 1. The tape may extend infinitely in either direction, and the read head is free to move beyond the input in either direction 2. Instead of having a single final accept state, you can may allow F Ď Q to be a set of accept states. 3. Instead of having a single, explicit reject state, you can assume (like in NFAs and PDAs) that input is rejected if there s no transition out of the current state You may leave it to faith (or to an intrepid Google search) that two definitions are essentially equivalent. 7 / 1

Turing Machine Definition Definition 1 (Turing machine). A Turing machine is a 7-tuple: 1. Q: Finite set of states 2. Σ: Input alphabet (not containing blank symbol \) 3. Γ: Taple alphabet where \ P Γ and Σ Ď Γ 4. δ : Q ˆ Σ Ñ Q ˆ Γ ˆ tl, Ru: Transition function 5. q 0 P Q: Start state 6. F Ď Q: Set of final/accept states 8 / 1

Example 1: String-copy language Recall the string-copy language L = tww : w P t0, 1u u. Recall from the pumping lemma for context-free languages that L is not context-free, meaning there is no CFG that can generate this language, or similarly a PDA that can recognize it. Let s now see how a Turing machine is able to recognize this langauge. As a simpifying assumption, let s assume there s a delimiter # between the two sub strings, i.e., L = tw#w : w P t0, 1u u 9 / 1

Example 1: Solution Strategy 1. Move back and forth across the tape to matching positions on either side of the delimier 2. If the symbols don t match, or no delimiter is found, reject (and halt) 3. In order to keep track of which comparisons you ve made already, cross out symbols on the tape, e.g., by replacing a symbol with X. 4. When all the symbols on the right of the # have been crossed out, check if there are any uncrossed symbols left on the right. If so, reject. Otherwise accept. 10 / 1

Example 1: Computation flow The notation ǎ is used to denote the current location of the head. Let s=011000#011000: ˇ0 1 1 0 0 0 # 0 1 1 0 0 0 \ begin X ˇ1 1 0 0 0 # 0 1 1 0 0 0 \ cross out X 1 1 0 0 0 # ˇX 1 1 0 0 0 \ cross matching position ˇX 1 1 0 0 0 # X 1 1 0 0 0 \ find last position X ˇX 1 0 0 0 # X 1 1 0 0 0 \ cross out next. X X X X X X # X X X X X X ˇ\ accept 11 / 1

Example 1: State transition Let s draw the state transition diagaram for L: (in class - see Example 3.9 in course text) 12 / 1

Related Languages We saw the strategy for recognizing L = tw#w : w P t0, 1uu. What about arbitrary copies? I.e., L = tw#w#w#...u Recall we proved this counting language non context-free: L 1 = ta i b i c i : i ě 0u But with Turing machines, we can follow the strategy of moving back and forth, crossing out symbols at corresponding positions, and like the string copy language, we can design a program to count arbitrary (non-infinite) copies. 13 / 1

Example 2: Multiplication Let s see a Turing machine performing mulitplication. Remember, in our model of formal languages, we re not computing the answer k to inputs i j, rather we re inputting ijk and recognizing the language where i j = k. For simplicity, we ll use unary representation. Let argument 1 be i repetitions of a, argument 2 be j repetitions of b and argument 3 be k repetitions of c. The language then becomes: L = ta i b j c k : ij = k and i, j, k ě 1u (See Example 3.11 in course text) 14 / 1