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

Similar documents
Busch Complexity Lectures: Turing Machines. Prof. Busch - LSU 1

HIS LEGACY. 100 Years Turing celebration. Gordana Dodig Crnkovic, IDT Open Seminar. Computer Science and Network Department Mälardalen University

and Models of Computation

Chapter 1 Welcome Aboard

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

Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage?

Busch Complexity Lectures: Turing s Thesis. Costas Busch - LSU 1

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

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

CSCC63 Worksheet Turing Machines

Part I: Definitions and Properties

Introduction to Turing Machines

Turing s Thesis. Fall Costas Busch - RPI!1

Turing Machines Part II

CSE 105 THEORY OF COMPUTATION

Turing Machine properties. Turing Machines. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions

Turing Machines. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

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

Homework. Turing Machines. Announcements. Plan for today. Now our picture looks like. Languages

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

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

Chapter 3: The Church-Turing Thesis

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

Chapter 8. Turing Machine (TMs)

Lecture 14: Recursive Languages

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

Lecture notes on Turing machines

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

A Universal Turing Machine

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Computability Theory. CS215, Lecture 6,

Lecture 13: Turing Machine

Equivalent Variations of Turing Machines

CPSC 421: Tutorial #1

CpSc 421 Homework 9 Solution

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Theory of Computation (IX) Yijia Chen Fudan University

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

CSCI3390-Assignment 2 Solutions

CS21 Decidability and Tractability

Turing Machines. Chapter 17

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

1 Showing Recognizability

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

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

Lecture 12: Mapping Reductions

The Church-Turing Thesis

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

Most General computer?

Introduction to Turing Machines. Reading: Chapters 8 & 9

Verifying whether One-Tape Turing Machines Run in Linear Time

ECS 120 Lesson 15 Turing Machines, Pt. 1

Theory of Computation

Theory of Computation

Before We Start. Turing Machines. Languages. Now our picture looks like. Theory Hall of Fame. The Turing Machine. Any questions? The $64,000 Question

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

CSCE 551 Final Exam, Spring 2004 Answer Key

Turing Machines. Lecture 8

CS20a: Turing Machines (Oct 29, 2002)

Computability and Complexity

V Honors Theory of Computation

where Q is a finite set of states

6.5.3 An NP-complete domino game

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

Reducability. Sipser, pages

Computation Histories

Designing 1-tape Deterministic Turing Machines

Automata Theory (2A) Young Won Lim 5/31/18

Theory of Computation

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Turing Machines Part III

CS20a: Turing Machines (Oct 29, 2002)

Variations of the Turing Machine

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

Foundations of

1 Unrestricted Computation

CSci 311, Models of Computation Chapter 9 Turing Machines

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

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

Theory of Computation Turing Machine and Pushdown Automata

Turing Machines. Nicholas Geis. February 5, 2015

CS5371 Theory of Computation. Lecture 15: Computability VI (Post s Problem, Reducibility)

Turing Machines. Wolfgang Schreiner

Homework 8. a b b a b a b. two-way, read/write

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

CS 21 Decidability and Tractability Winter Solution Set 3

CS 525 Proof of Theorems 3.13 and 3.15

Automata Theory CS S-12 Turing Machine Modifications

CS4026 Formal Models of Computation

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Turing Machines and Time Complexity

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

Theory of Computation

Introduction to Formal Languages, Automata and Computability p.1/42

Turing Machines and the Church-Turing Thesis

CSE 105 THEORY OF COMPUTATION

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Fundamentals of Computer Science

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Transcription:

Turing Machines a n b n c The anguage Hierarchy n? ww? Context-Free anguages a n b n egular anguages a * a *b* ww Courtesy Costas Busch - PI

a n b n c n Turing Machines anguages accepted by Turing Machines ww Context-Free anguages a n b n egular anguages a * a *b* ww Courtesy Costas Busch - PI 2

A Turing Machine Tape...... ead-write head Control Unit Courtesy Costas Busch - PI 3

The Tape The head moves eft or ight No boundaries -- infinite length...... ead-write head The head at each time step:. eads a symbol 2. Writes a symbol 3. Moves eft or ight Courtesy Costas Busch - PI 4

... Time 0 Turing Machines a a c b...... Time a b k c.... eads 2. Writes a k 3. Moves eft Courtesy Costas Busch - PI 5

... Turing Machines Time a b k c...... Time 2 a f k c.... eads 2. Writes b f 3. Moves ight Courtesy Costas Busch - PI 6

The Input String Head starts at the leftmost position of the input string Input string Blank symbol... a b a c... head emark: the input string is never empty Courtesy Costas Busch - PI 7

States & Transitions ead Write Move eft q a b, q2 Move ight q a b, q2 Courtesy Costas Busch - PI 8

Example: States & Transitions Time... a b a c... q current state q a b, q2 Time 2... a b b c... q 2 Courtesy Costas Busch - PI 9

Example: Time... a b a c... q a b, q2 q Time 2... a b b c... q 2 Courtesy Costas Busch - PI 0

Example: Time... a b a c... g, q q2 q Time 2... a b a c g... q 2 Courtesy Costas Busch - PI

Determinism Turing Machines are deterministic Allowed Not Allowed a b, q 2 a b, q 2 q q b d, a d, Courtesy Costas Busch - PI 2

Partial Transition Function Example:... a b a c... q a b, q 2 Allowed: q b d, No transition for input symbol C Courtesy Costas Busch - PI 3

Example: Halting The machine halts if there are no possible transitions to follow.... a b b c... q 2 q a b, b d, q 2 No possible transition HAT!!! Courtesy Costas Busch - PI 4

Final States q q2 Allowed q q2 Not Allowed Final states have no outgoing transitions In a final state the machine halts Courtesy Costas Busch - PI 5

Acceptance Accept Input If machine halts in a final state If machine halts eject Input in a non-final state or If machine enters an infinite loop Courtesy Costas Busch - PI 6

Turing Machine Example Turing machine for the language { a n b n } q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 7

Time 0 a a b b q 0 q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 8

Time x a b b q q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 9

Time 2 x a b b q q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 20

Time 3 x a y b q 2 q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 2

Time 4 x a y b q 2 q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 22

Time 5 x a y b q 0 q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 23

Time 6 x x y b q q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 24

Time 7 x x y b q q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 25

Time 8 x x y y q 2 q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 26

Time 9 x x y y q 2 q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 27

Time 0 x x y y q 0 q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 28

Time x x y y q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 29

Time 2 x x y y q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 30

Time 3 x x y y q 4 Halt & Accept q 4, a a, a a, a x, q0 b y, q q2 x x, Courtesy Costas Busch - PI 3

Observation If we modify the machine for the language { a n b n } we can easily construct { a b c } a machine for the language n n n Courtesy Costas Busch - PI 32

Formal Definition of Turing Machines Transition Function q a b, q2 δ ( 2 q, a) = ( q, b, ) Courtesy Costas Busch - PI 33

Formal Definition of Turing Machines Transition Function q c d, q2 δ ( 2 q, c) = ( q, d, ) Courtesy Costas Busch - PI 34

Formal Definition of Turing Machines States Input alphabet Tape alphabet M = ( Q, Σ, Γ, δ, q0,, F ) Transition function Σ Γ Γ, Σ q 0 Initial F state Q Q blank Final states Courtesy Costas Busch - PI 35

Configuration c a b a q Instantaneous description: ca q ba Courtesy Costas Busch - PI 36

Configuration Time Time 2 x a y b x a y b q 2 q 0 A Move: Courtesy Costas Busch - PI 37

Time Time 2 x a y b x a y b q 2 q 0 Time 3 Time 4 x x y b x x y b q q Courtesy Costas Busch - PI 38

Configuration Equivalent notation: Courtesy Costas Busch - PI 39

Initial configuration: Configuration q 0 w Input string w a a b b q 0 Courtesy Costas Busch - PI 40

The Accepted anguage For any Turing Machine M Initial state Final state Courtesy Costas Busch - PI 4

Computing Functions using TM A function f (w) Domain: D has: esult egion: S w D f (w) f ( w) S Courtesy Costas Busch - PI 42

Computing Functions using TM A function may have many parameters: Example: Addition function f ( x, y) = x + y Courtesy Costas Busch - PI 43

Computing Functions using TM Integer Domain Decimal: 5 Binary: 0 Unary: We prefer unary representation: easier to manipulate with Turing machines Courtesy Costas Busch - PI 44

Definition: f A function is computable if M there is a Turing Machine such that: Initial configuration w Final configuration f (w) q 0 initial state q f final state For all w D Domain Courtesy Costas Busch - PI 45

In other words: f A function is computable if M there is a Turing Machine such that: Initial Configuration Final Configuration For all w D Domain Courtesy Costas Busch - PI 46

Example The function f ( x, y) = x + y is computable x, y are integers Turing Machine: Input string: x0 y unary Output string: xy0 unary Courtesy Costas Busch - PI 47

x y Start Λ 0 Λ q 0 initial state The 0 is the delimiter that separates the two numbers Courtesy Costas Busch - PI 48

x y Start Λ 0 Λ q 0 initial state x + y Finish Λ 0 q f final state Courtesy Costas Busch - PI 49

The 0 helps when we use the result for other operations x + y Finish Λ 0 q f final state Courtesy Costas Busch - PI 50

Turing machine for function f ( x, y) = x + y q 0 0,, q q2 0, q 4, Courtesy Costas Busch - PI 5

Execution Example: Time 0 x = (2) x y 0 y = (2) q 0 Final esult x + y 0 q 4 Courtesy Costas Busch - PI 52

Time 0 0 q 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 53

Time 0 q 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 54

Time 2 0 q 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 55

Time 3 q 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 56

Time 4 q 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 57

Time 5 q 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 58

Time 6 q 2 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 59

Time 7 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 60

Time 8 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 6

Time 9 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 62

Time 0 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 63

Time 0 0, q0, q q2 0, q 4, Courtesy Costas Busch - PI 64

Time 2 0 q 4 0, q0, q q2 0, HAT & accept q 4, Courtesy Costas Busch - PI 65

Another Example The function f ( x) = 2x is computable x is integer Turing Machine: Input string: x unary Output string: xx unary Courtesy Costas Busch - PI 66

x Start Λ q 0 initial state 2x Finish Λ q f final state Courtesy Costas Busch - PI 67

Turing Machine for f ( x) = 2x $,, q0 q $, q2,, Courtesy Costas Busch - PI 68

Start Example Finish q 0 $,, q0 q $, q2,, Courtesy Costas Busch - PI 69

Another Example The function f ( x, y) = is computable x > y 0 if if x y Courtesy Costas Busch - PI 70

Turing Machine for f ( x, y) = if x > y 0 if x y Input: x0 y Output: or 0 Courtesy Costas Busch - PI 7

Combining Turing Machines Courtesy Costas Busch - PI 72

Block Diagram input Turing Machine output Courtesy Costas Busch - PI 73

Example: x + y if x > y f ( x, y) = 0 if x y x, y Adder x + y x, y Comparer x > y x y Eraser 0 Courtesy Costas Busch - PI 74