Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.

Similar presentations


Presentation on theme: "CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines."— Presentation transcript:

1 CSC 3130: Automata theory and formal languages Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130 The Chinese University of Hong Kong Turing Machines and Variants Fall 2009

2 The Church-Turing Thesis Turing Machine quantum computing DNA computing cosmic computing

3 The Church-Turing Thesis “On Computable Numbers, with an Application to the Entscheidungsproblem” 1936: Section 9. The extent of the computable numbers All arguments [for the CT Thesis] which can be given are bound to be, fundamentally, appeals to intuition, and for this reason rather unsatisfactory mathematically. The arguments which I shall use are of three kinds: 1. A direct appeal to intuition 2. A proof of the equivalence of two definitions (In case the new definition has greater intuitive appeal) 3. Giving examples of large classes of numbers [languages] which are computable.

4 Looping behavior Something strange can happen in a Turing Machine: Inputs can be divided into three types q0q0 q acc q rej  = {0, 1} input:  ☐/☐R☐/☐R 0/0R 1/1R This machine never halts q acc q rej accept rejectloop forever

5 Recognizing versus deciding Looping is an undesirable behavior so we say The language recognized by a TM is the set of all inputs that make it reach q acc A TM decides language L if it recognizes L and does not loop on any input acceptrejectloop

6 Examples of decidable languages L 2 = { $a i b j c k : i  j = k and i, j, k > 0 } L 1 = {w$w: w ∈ { a, b }*} L 3 = { $ x 1 $ x 2... $ x l : x i ∈ {0, 1}* and x i ≠ x j for each i ≠ j} L 4 = { 〈 G 〉 : G is a connected undirected graph} We will describe how these Turing Machines work, but avoid unnecessary implementation detail

7 Programming Turing Machines L 3 = { $ x 1 $ x 2... $ x l : x i ∈ {0, 1}* and x i ≠ x j for each i ≠ j} $01$0011$1 input: Place a mark on the leftmost $ (i.e. replace $ by $ ) and move right  1. 0. If current symbol is ☐, accept Otherwise, if it is not $, reject $01$0011$1  Place another mark on the next $ (If there are no more $, accept) 2. $01$0011$1  

8 Programming Turing Machines L 3 = { $ x 1 $ x 2... $ x l : x i ∈ {0, 1}* and x i ≠ x j for each i ≠ j} current state: Go to stage 3 5. 4.Move the right $ to the right If not possible, move the left $ to the right and put the right one next to it If not possible, accept $01$0011$1     Compare the two strings to the right of marked $. If there are same, reject 3. $01$0011$1      

9 Programming Turing Machines L 3 = { $ x 1 $ x 2... $ x l : x i ∈ {0, 1}* and x i ≠ x j for each i ≠ j} Go to stage 3 5. 4.Move the right $ to the right If not possible, move the left $ to the right and put the right one next to it If not possible, accept $01$0011$1     Compare the two strings to the right of marked $. If there are same, reject 3. $01$0011$1   accept

10 Programming Turing Machines L 4 = { 〈 G 〉 : G is a connected undirected graph} Q: How do we feed a graph into a Turing Machine? A: We represent it by a string, e.g. 12 34 (1,2,3,4)((1,4),(2,3),(3,4)(4,2)) Convention for describing graphs: ( nodes )( edges ) no node must repeat edges are pairs ( node 1, node 2 )

11 Programming Turing Machines L 4 = { 〈 G 〉 : G is a connected undirected graph} To check if 〈 G 〉 is in L 4 : 0. Verify that 〈 G 〉 is the description of a graph (no vertex repeats; edges only go between nodes) 1.Mark the first node of G 2.Repeat until no new nodes are marked: For each node, mark it if it is attached to an already marked node 3.If all nodes are marked accept, otherwise reject.

12 Programming Turing Machines L 4 = { 〈 G 〉 : G is a connected undirected graph} (1,2,3,4)((1,4)(2,3)(3,4)(4,2))               etc. 12 34 (1,2,3,4)((1,4)(2,3)(3,4)(4,2))    

13 The Church-Turing Thesis “On Computable Numbers, with an Application to the Entscheidungsproblem” 1936: Section 9. The extent of the computable numbers All arguments [for the CT Thesis] which can be given are bound to be, fundamentally, appeals to intuition, and for this reason rather unsatisfactory mathematically. The arguments which I shall use are of three kinds: 1. A direct appeal to intuition 2. A proof of the equivalence of two definitions (In case the new definition has greater intuitive appeal) 3. Giving examples of large classes of numbers [languages] which are computable.

14 The multitape Turing Machine The transition may depend on the contents of all the cells Different tape heads can be moved independently state control tape 1 … 010 tape 2 … 01 tape 3 … 100

15 The multitape Turing Machine Multiple tapes are convenient, e.g. one can serve as temporary storage … 010 … 01 … 100 … 110 … 100 q3q3 q7q7 0/1R ☐ /1R 0/0L … 011

16 The multitape Turing Machine Multitape Turing Machines are equivalent to single-tape Turing Machines M … 010 … 01 … 100  = {0, 1, ☐ } S … 01010##0#10   ’ = {0, 1, ☐, 0, 1, ☐, #}   #

17 The multitape Turing Machine We show how to simulate a multitape TM on an ordinary (single tape TM) –To be specific, let’s do a 3-tape TM At each point, the tape contents should be like where exactly one of the x s, y s, and z s is dotted #x 1 x 2...x i #y 1 y 2...y j #z 1 z 2...z k #

18 Simulating a multitape Turing Machine Initialization: Take the input and turn it into w 1 w 2...w n #w 1 w 2...w n # ☐ # ☐ #    … 010###  #  … 010

19 The multitape Turing Machine Simulating a single move in M Scan the tape from left to right … 01010##0#10  # Remember state of M and symbols under dots in state of S Update according to transition of M 0☐00☐0 q3q3 q3q3 0/1R ☐ /1R 0/0L q7q7 This may require you to “free up” some space … 01010##0#10  #


Download ppt "CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines."

Similar presentations


Ads by Google