Presentation is loading. Please wait.

Presentation is loading. Please wait.

Turing Machine Read/Write – Move Left/Right BB Read/Write Head 001000 State Qi.

Similar presentations


Presentation on theme: "Turing Machine Read/Write – Move Left/Right BB Read/Write Head 001000 State Qi."— Presentation transcript:

1 Turing Machine Read/Write – Move Left/Right BB Read/Write Head State Qi

2 State Diagram for Modulus 3 shows only the tape input Q0 Q1 Q2 Start Q3 Q4 B B B B,0,1

3 Turing Machine Program To Compute Values Modulus 3 State, Write, Direction State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3 Halt Halt Halt Q43,1,L3,1,L3,1,L

4 Modulus 3 53 % 3 BB State Q0 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L New State – Write B

5 Modulus 3 53 % 3 BBB10101 State Q1 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L

6 Modulus 3 53 % 3 BBBB0101 State Q0 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L Write B

7 Modulus 3 53 % 3 BBBBB101 State Q0 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L New State – Write B

8 Modulus 3 53 % 3 BBBBBB01 State Q1 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L New State – Write B

9 Modulus 3 53 % 3 BBBBBBB1 State Q2 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L Write B

10 Modulus 3 53 % 3 BBBBBBBB State Q2 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L New State – Write 0

11 Modulus 3 53 % 3 B0BBBBBB State Q4 State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L New State – Write 1

12 Modulus 3 53 % 3 B0BBBBB1 Q3 Halt State B 0 1 Q03,0,L,0,B,R1,B,R Q13,1,L2,B,R0,B,R Q24,0,L1,B,R2,B,R Q3Halt Halt Halt Q43,1,L3,1,L3,1,L

13 Turing Machine Program To Add Unary Numbers State, Write, Direction State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3 3,1,Halt Halt3,1,L

14 Adding Two Unary Numbers = 5 BB State Q0 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

15 Adding Two Unary numbers = 5 BB State Q0 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

16 Adding Two Unary numbers = 5 BB State Q0New State – Write B State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

17 Adding Two Unary numbers = 5 BB11B111 State Q1 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

18 Adding Two Unary numbers = 5 BB11B111 State Q1 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

19 Adding Two Unary numbers = 5 BB11B111 State Q1 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

20 Adding Two Unary numbers = 5 BB11B111 State Q1New State State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

21 Adding Two Unary numbers = 5 BB11B111 State Q2 New State – Write B State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

22 Adding Two Unary numbers = 5 BB11B11B State Q3 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

23 Adding Two Unary numbers = 5 BB11B11B State Q3 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

24 Adding Two Unary numbers = 5 BB11111B Q3 HALT HALT – Write 1 State B 0 1 Q0Halt1,B,R0,1,R Q12,B,L Halt1,1,R Q2Halt Halt3,B,L Q3- 1,Halt Halt3,1,L

25 Turing Machine Program To Subtract Unary Numbers State, Write, Direction State B 0 1 Q01,B,L0,0,R0,1,R Q1 1,B,Halt 1,B,Halt2,B,L Q23,B,R 2,0,L2,1,L Q3 3,B,Halt 3,B,Halt0,B,R

26 Turing Machine with Halt State Program To Subtract Unary Numbers State, Write, Direction State B 0 1 Q01,B,L0,0,R0,1,R Q1 1,B,4 1,B,42,B,L Q23,B,R 2,0,L2,1,L Q33,B,4 3,B,40,B,R Q4 Halt Halt Halt

27 Subtracting Two Unary Numbers 5 − 2 = 3 BB State Q0 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

28 Subtracting Two Unary Numbers 5 − 2 = 3 BB State Q0 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R...

29 Subtracting Two Unary Numbers 5 − 2 = 3 BB State Q1 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

30 Subtracting Two Unary Numbers 5 − 2 = 3 BB B State Q2 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

31 Subtracting Two Unary Numbers 5 − 2 = 3 BB B State Q2 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

32 Subtracting Two Unary Numbers 5 − 2 = 3 BB B State Q2 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R...

33 Subtracting Two Unary Numbers 5 − 2 = 3 BB B State Q3 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

34 Subtracting Two Unary Numbers 5 − 2 = 3 BB B B State Q0 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

35 Subtracting Two Unary Numbers 5 − 2 = 3 BB B B State Q0 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R...

36 Subtracting Two Unary Numbers 5 − 2 = 3 BB B B State Q1 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

37 Subtracting Two Unary Numbers 5 − 2 = 3 BB B 11 0B B State Q2 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

38 Subtracting Two Unary Numbers 5 − 2 = 3 BB B 11 0B B State Q2 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R...

39 Subtracting Two Unary Numbers 5 − 2 = 3 BB B 11 0B B State Q3 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

40 Subtracting Two Unary Numbers 5 − 2 = 3 BB B B1 0B B State Q0 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

41 Subtracting Two Unary Numbers 5 − 2 = 3 BB B B1 0B B State Q0 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 2,1,L Q3 3,B,Halt 3,B,Halt 0,B,R...

42 Subtracting Two Unary Numbers 5 − 2 = 3 BB B B1 0B B Q1 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 1,1,L Q3 3,B,Halt 3,B,Halt 0,B,R

43 Subtracting Two Unary Numbers 5 − 2 = 3 BB B B1 BB B Q1 HaltWrite Blank 1 1 State B 0 1 Q0 1,B,L 0,0,R 0,1,R Q1 1,B,Halt 1,B,Halt 2,B,L Q2 3,B,R 2,0,L 1,1,L Q3 3,B,Halt 3,B,Halt 0,B,R


Download ppt "Turing Machine Read/Write – Move Left/Right BB Read/Write Head 001000 State Qi."

Similar presentations


Ads by Google