Recall last lecture and Nondeterministic TMs

Slides:



Advertisements
Similar presentations
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Advertisements

Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Variants of Turing machines
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
P, NP, PS, and NPS By Muhannad Harrim. Class P P is the complexity class containing decision problems which can be solved by a Deterministic Turing machine.
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Recursively Enumerable and Recursive Languages
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
Turing Machines A more powerful computation model than a PDA ?
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
1 The Halting Problem and Decidability How powerful is a TM? Any program in a high level language can be simulated by a TM. Any algorithmic procedure carried.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
A Universal Turing Machine
P Vs NP Turing Machine. Definitions - Turing Machine Turing Machine M has a tape of squares Each Square is capable of storing a symbol from set Γ (including.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Lecture 17 Undecidability Topics:  TM variations  Undecidability June 25, 2015 CSCE 355 Foundations of Computation.
Recursively Enumerable and Recursive Languages
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
1 Chapter 9 Undecidability  Turing Machines Coded as Binary Strings  Universal Turing machine  Diagonalizing over Turing Machines  Problems as Languages.
Turing Machines Sections 17.6 – The Universal Turing Machine Problem: All our machines so far are hardwired. ENIAC
Recall last lecture and Nondeterministic TMs Ola Svensson.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Universal Turing Machine
1 Recursively Enumerable and Recursive Languages.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
Turing’s Thesis.
Turing’s Thesis Costas Busch - LSU.
A Universal Turing Machine
CSE202: Introduction to Formal Languages and Automata Theory
Recursively Enumerable and Recursive Languages
Part VI NP-Hardness.
Busch Complexity Lectures: Turing Machines
Busch Complexity Lectures: Reductions
Linear Bounded Automata LBAs
Reductions Costas Busch - LSU.
(Universal Turing Machine)
CS154, Lecture 7: Turing Machines.
OTHER MODELS OF TURING MACHINES
CSE 105 theory of computation
Turing Machines Acceptors; Enumerators
Chapter 9 TURING MACHINES.
Chapter 3: The CHURCH-Turing thesis
Decidable Languages Costas Busch - LSU.
Decidability and Undecidability
Formal Languages, Automata and Models of Computation
Turing Machines Complexity ©D.Moshkovitz.
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Variants of Turing machines
Theory of Computation Lecture 23: Turing Machines III
CSE 105 theory of computation
Presentation transcript:

Recall last lecture and Nondeterministic TMs Ola Svensson

Computational Complexity

Turing Machines

The goals A model that can compute anything computable A model so simple and clean so that we can prove interesting results

A Turing machine 𝑀 is described by a tuple (Γ, 𝑄, 𝛿) A finite alphabet Γ containing (⊳,∎, 0, 1, …) start symbol blank symbol

A Turing machine 𝑀 is described by a tuple (Γ, 𝑄, 𝛿) A finite alphabet Γ containing (⊳,∎, 0, 1, …) A finite set 𝑄 of states containing 𝑞 𝑠𝑡𝑎𝑟𝑡 and 𝑞 ℎ𝑎𝑙𝑡 A function 𝛿: Γ 2 ×𝑄→ Γ × 𝐿,𝑆,𝑅 𝑘 ×𝑄 describing rules of each step: IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Start configuration of 𝑀 on input 𝑥 Input: ⊳ 1 ∎ … ∎ … Work/output: ⊳ ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input ∎ … Work/output: ⊳ ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞  Hey, don’t miss this! IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 IF THEN Input ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 IF THEN Input ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 ℎ𝑎𝑙𝑡 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 ℎ𝑎𝑙𝑡 What do we compute? IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right Stay Left 𝑞 1 𝑞 ℎ𝑎𝑙𝑡

Efficiency and Running Time Let 𝑓: 0,1 ∗ → 0,1 ∗ and let 𝑇:ℕ→ℕ Let 𝑀 be a Turing machine

Efficiency and Running Time Let 𝑓: 0,1 ∗ → 0,1 ∗ and let 𝑇:ℕ→ℕ Let 𝑀 be a Turing machine We say that 𝑀 computes 𝑓 if for every 𝑥∈ 0,1 ∗ , whenever 𝑀 is initialized to the start configuration on input 𝑥, then it halts with f(𝑥) written on its output type.

Efficiency and Running Time Let 𝑓: 0,1 ∗ → 0,1 ∗ and let 𝑇:ℕ→ℕ Let 𝑀 be a Turing machine We say that 𝑀 computes 𝑓 if for every 𝑥∈ 0,1 ∗ , whenever 𝑀 is initialized to the start configuration on input 𝑥, then it halts with f(𝑥) written on its output type. We say that 𝑀 computes 𝑓 in T n -time if its computation on every input 𝑥 requires at most T( 𝑥 ) steps.

Efficiency and Running Time Let 𝑓: 0,1 ∗ → 0,1 ∗ and let 𝑇:ℕ→ℕ Let 𝑀 be a Turing machine We say that 𝑀 computes 𝑓 if for every 𝑥∈ 0,1 ∗ , whenever 𝑀 is initialized to the start configuration on input 𝑥, then it halts with f(𝑥) written on its output type. We say that 𝑀 computes 𝑓 in T n -time if its computation on every input 𝑥 requires at most T( 𝑥 ) steps. DTIME(f(n)) = Set of languages that can be decided by a TM in time 𝑐⋅𝑓(𝑛)

Robustness of definition of Turing Machine The size of the alphabet doesn’t really matter The number of tapes do not really matter (up to a square in the running time) It is able to simulate all other realistic models with polynomial slow down (except potentially quantum computers that still need to be built) Church-Turing Thesis: Any computable function can be computed by a Turing machine

Universal Turing Machine Every binary string represents some Turing machine (write down 𝛿) A Turing machine has infinitely many representations (pad with ones) There exists a TM 𝑈 such that for every 𝑥, 𝛼∈ 0,1 ∗ 𝑈 𝑥, 𝛼 = M 𝛼 (𝑥) Moreover, if 𝑀 𝛼 halts on input 𝑥 within 𝑇 steps then 𝑈(𝑥,𝛼) halts within 𝐶⋅𝑇⋅𝑙𝑜𝑔(𝑇) steps where 𝐶 is a number independent of 𝑥 . (𝐶 depends on the number of states, alphabet, and tapes of 𝑀 𝛼 ).

DIAGONALIZATION

Cantor’s argument The set of infinite binary strings are uncountable 𝑠 1 =(𝟎, 0, 0, 0, 0, 0, 0, … 𝑠 2 =(0, 𝟏, 0, 1, 0, 1, 0, … 𝑠 3 =(0, 1, 𝟏, 0, 1, 1, 0, … 𝑠 4 =(1, 1, 1, 𝟎, 1, 1, 0, … 𝑠 5 =(0, 0, 1, 0, 𝟏, 0, 1, … 𝑠 6 =(0, 0, 1, 0, 0, 𝟏, 1, … 𝑠 7 =(0, 0, 1, 0, 0, 1, 𝟎, … … 𝑠=(1, 0, 0, 1, 0, 0, 1, … s is different from any string in the enumeration so it is not part of the enumeration

Halting Problem The output of 𝑀 𝛼 3 ( 𝛼 5 ) (? if doesn’t halt) 𝜶 𝟏 𝜶 𝟐 𝜶 𝟑 𝜶 𝟒 𝜶 𝟓 𝜶 𝟔 𝟎 1 𝟏 ? … 𝐿= { 𝛼 1 , 𝛼 2 , 𝛼 4 𝛼 5 , 𝛼 6 , …} The set of strings 𝛼 for which M 𝛼 𝛼 =0 or ?

Halting Problem The output of 𝑀 𝛼 3 ( 𝛼 5 ) (? if doesn’t halt) 𝜶 𝟏 𝜶 𝟐 𝜶 𝟑 𝜶 𝟒 𝜶 𝟓 𝜶 𝟔 𝟎 1 𝟏 ? … 𝐿= { 𝛼 1 , 𝛼 2 , 𝛼 4 𝛼 5 , 𝛼 6 , …} The set of strings 𝛼 for which M 𝛼 𝛼 =0 or ? Suppose a TM M decides L. Let 𝛼 be its encoding. Then we get a contradiction on input 𝛼 since 𝛼∈𝐿⇔ 𝑀 𝛼 𝛼 =0

Deterministic Time Hierarchy The output of 𝑀 𝛼 3 ( 𝛼 5 ) (? if does not halt in 𝒏 𝟏.𝟒 steps) 𝜶 𝟏 𝜶 𝟐 𝜶 𝟑 𝜶 𝟒 𝜶 𝟓 𝜶 𝟔 𝟎 1 𝟏 ? … 𝐿= { 𝛼 1 , 𝛼 2 , 𝛼 4 𝛼 5 , 𝛼 6 , …} The set of strings 𝛼 for which M 𝛼 𝛼 =0 or ?

Deterministic Time Hierarchy The output of 𝑀 𝛼 3 ( 𝛼 5 ) (? if does not halt in 𝒏 𝟏.𝟒 steps) 𝜶 𝟏 𝜶 𝟐 𝜶 𝟑 𝜶 𝟒 𝜶 𝟓 𝜶 𝟔 𝟎 1 𝟏 ? … 𝐿= { 𝛼 1 , 𝛼 2 , 𝛼 4 𝛼 5 , 𝛼 6 , …} The set of strings 𝛼 for which M 𝛼 𝛼 =0 or ? Suppose a TM M decides L in time n. Let 𝛼 be its encoding. Then we get a contradiction on input 𝛼 since 𝛼∈𝐿⇔ 𝑀 𝛼 𝛼 =0

Diagonalization The proof technique used two things about TMs They can be encoded efficiently There is a TM that can emulate any other without increasing running time or space too much Otherwise, they treated TMs as ”black boxes” We will show today that such a proof cannot alone resolve P vs NP

Nondeterministic Turing Machines

Nondeterministic Turing machines (NDTMs) Same definition as TMs except that NDTM has two transition functions 𝛿 0 and 𝛿 1 and a special state called 𝑞 𝑎𝑐𝑐𝑒𝑝𝑡 When NDTM computes a function we envision that at each computational step it makes an arbitrary choice as to which of its two transition functions to apply For every input 𝑥, we say that M 𝑥 =1 if there exists some sequences of these choices (called nondeterministic choices) that would make M reach 𝑞 𝑎𝑐𝑐𝑒𝑝𝑡 on input 𝑥 Otherwise if every sequence of choices makes 𝑀 halt without reaching 𝑞 𝑎𝑐𝑐𝑒𝑝𝑡 then we say 𝑀 𝑥 =0 We say that 𝑀 runs in 𝑇 𝑛 -time if for every input 𝑥∈ 0,1 ∗ and every sequence of nondeterministic choices, 𝑀 reaches either the halting state or 𝑞 𝑎𝑐𝑐𝑒𝑝𝑡 within 𝑇( 𝑥 ) steps NTIME(f(n)) = Set of languages that can be decided by a NDTM in time 𝑐⋅𝑓(𝑛)

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example Input: ⊳ 1 ∎ … Work/output: ⊳ ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example Input: ⊳ 1 ∎ … Work/output: ⊳ ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example Input: ⊳ 1 ∎ … Work/output: ⊳ ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞 𝑠𝑡𝑎𝑟𝑡 IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .

If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 . Example What language do we accept? Input: ⊳ 1 ∎ … Work/output: ⊳ 1 ∎ … State: 𝑞  Now normal deterministic execution… IF THEN Input symbol read Work (output) tape read Current state Move input head New work (output) symbol Move work head New state ⊳/0/1 ∎ 𝑞 𝑠𝑡𝑎𝑟𝑡 Right 0 for 𝛿 0 1 for 𝛿 1 Stay Left 𝑞 Once we reach state 𝑞, we run “normal” TM to check if number on work tape divides input. If then move to 𝑞 𝑎𝑐𝑒𝑝𝑡 . If not move to 𝑞 ℎ𝑎𝑙𝑡 .