The Classical Turing Machine 2IT70 Finite Automata and Process - - PowerPoint PPT Presentation

the classical turing machine 2it70 finite automata and
SMART_READER_LITE
LIVE PREVIEW

The Classical Turing Machine 2IT70 Finite Automata and Process - - PowerPoint PPT Presentation

The Classical Turing Machine 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 14, 2014 Classical Turing machine architecture Input yes/no Automaton Tape Tape aabbaa a b no input and no final states initial


slide-1
SLIDE 1

The Classical Turing Machine 2IT70 Finite Automata and Process Theory

Technische Universiteit Eindhoven May 14, 2014

slide-2
SLIDE 2

Classical Turing machine architecture

Automaton Tape Input yes/no Tape aabbaa a b no input and no final states initial tape content holds start string tape head on leftmost symbol

2 IT70 (2014) The Classical Turing Machine 2 / 13

slide-3
SLIDE 3

Definition classical Turing machine

classical Turing machine M = (Q, ∆, ◻, →, q0 ) Q finite set of states ∆ finite tape alphabet, ◻ ∉ ∆ → ⊆ Q × ∆◻ × ∆◻ × {L,R} × Q transition relation with ∆◻ = ∆ ∪ {◻} q0 ∈ Q is the initial state configurations (q,z) ∈ Q × Z, computation steps (q,z) ⊢ M (q′,z′)

2 IT70 (2014) The Classical Turing Machine 3 / 13

slide-4
SLIDE 4

A classical Turing machine example

q0 q1 q2 q3 a/◻,R a/a,R b/b,R ◻/◻,L b/◻,L a/a,L b/b,L ◻/◻,R q4 ◻/Y ,R q5 q6 b/◻,R a/◻,R b/◻,R ◻/N,R q7 q8 a/◻,L a/◻,R b/◻,R ◻/N,R q9 ◻/N,R

q0 #ˇ aabb# q1 ##ˇ abb# q1 ##aˇ bb# q1 ##abˇ b# q1 ##abbˇ # q2 ##abˇ b# q3 ##aˇ b## q3 ##ˇ ab## q3 #ˇ #ab## q0 ##ˇ ab## q1 ###ˇ b## q1 ###bˇ ## q2 ###ˇ b## q3 ##ˇ #### q0 ###ˇ ### HALT q0 #ˇ aab# q1 ##ˇ ab# q1 ##aˇ b# q1 ##abˇ # q2 ##aˇ b# q3 ##ˇ a## q3 #ˇ #a## q0 ##ˇ a## q1 ###ˇ ## q2 ##ˇ ### HALT q0 #ˇ abb## q1 ##ˇ bb## q1 ##bˇ b## q1 ##bbˇ ## q2 ##bˇ b## q3 ##ˇ b### q3 #ˇ #b### q0 ##ˇ b### HALT

2 IT70 (2014) The Classical Turing Machine 4 / 13

slide-5
SLIDE 5

Function computed by classical Turing machine

classical Turing machine M = (Q, ∆, ◻, →, q0 ) configurations (q,z) ∈ Q × Z with Z ⊆ ∆∗

◻ × ∆◻ × ∆∗ ◻

(q,z) ⊢M (q′,z′) iff ∃e,e′ ∈ ∆∃µ ∈ {L,R} ∶ q

e/e′,µ

  • →M q′ ∧ z′ = z[e/e′,µ]

(q,z) ⊬M iff ¬∃q′ ∈ Q∃z′ ∈ Z ∶ (q,z) ⊢M (q′,z′)

z[e/e′,µ] only defined for z of the form x⟨e⟩y

2 IT70 (2014) The Classical Turing Machine 5 / 13

slide-6
SLIDE 6

Function computed by classical Turing machine (cont.)

a string in the eye: x⟨ε⟩y = x⟨◻⟩y and x⟨dw⟩y = x⟨d⟩w y thus ⟨ε⟩ = ⟨◻⟩ and ⟨dw⟩ = ⟨d⟩w cTM M = (Q, ∆, ◻, →, q0 ) computes function f ∶ Σ∗ → Θ∗ (i) alphabets Σ,Θ ⊆ ∆ (ii) if (q0,⟨w⟩) ⊢M (q,z) ⊬M then z = ⟨f (w)⟩ (iii) no infinite computation (q0,⟨w⟩) ⊢M (q1,z1) ⊢M (q2,z2) ⊢M ⋯

2 IT70 (2014) The Classical Turing Machine 6 / 13

slide-7
SLIDE 7

An example of a computable function

q0 q1 q2 q3 a/◻,R a/a,R b/b,R ◻/◻,L b/◻,L a/a,L b/b,L ◻/◻,R q4 q′

4

◻/Y ,R ◻/◻,R q5 q6 q′

6

b/◻,R a/◻,R b/◻,R ◻/N,R ◻/◻,L q7 q8 q′

8

a/◻,L a/◻,R b/◻,R ◻/N,R ◻/◻,L q9 q′

9

◻/N,R ◻/◻,L

computed function f ∶ {a,b}∗ → {Y ,N}∗ such that f (w) = Y if w = anbn for some n ⩾ 0 f (w) = N

  • therwise

2 IT70 (2014) The Classical Turing Machine 7 / 13

slide-8
SLIDE 8

More examples of computable functions

q0 q1 q2 a/b,R b/a,R ◻/◻,L a/a,L b/b,L ◻/◻,R q0 q1 q2 q3 a/a,R b/a,R a/b,R b/b,R ◻/◻,L ◻/◻,L a/a,L b/b,L ◻/◻,R q0 q1 q2 q3 q4 a/a,R b/b,R ◻/◻,L a/a,L b/b,L a/a,L b/b,L ◻/a,L a/a,L b/b,L ◻/b,L q5 ◻,◻,R

complement wC where εC = ε, (aw)C = bwC, (bw)C = awC function w ↦ (ab)n if ∣w ∣ = 2n, w ↦ (ab)na if ∣w ∣ = 2n + 1 function ε ↦ ε, w ↦ aw if last(w) = a, w ↦ bw if last(w) = b

2 IT70 (2014) The Classical Turing Machine 8 / 13

slide-9
SLIDE 9

Anthony Morphett’s cTM simulator

;; cTM program 1 0 a b R 0 0 b a R 0 0 _ _ L 1 1 a a L 1 1 b b L 1 1 _ _ R 2 ;; cTM program 2 0 a a R 1 0 b a R 1 0 _ _ R 2 ;; bug 1 a b R 0 1 b b R 0 1 _ _ L 2 2 a a L 2 2 b b L 2 2 _ _ R 3 ;; cTM program 3 0 a a R 0 0 b b R 0 0 _ _ L 1 1 a a L 2 1 b b L 4 2 a a L 2 2 b b L 2 2 _ a L 3 4 a a L 4 4 b b L 4 4 _ b L 3 3 _ _ R 5

http://morphett.info/turing/turing.html

2 IT70 (2014) The Classical Turing Machine 9 / 13

slide-10
SLIDE 10

Clicker question L61

Consider the classical Turing machine M depicted below.

q0 q1 q2 a/b,R ◻/◻,L d/d,L ◻/◻,R d ∈ Σ

Which function does M compute?

  • A. The identity f ∶ {c}∗ → {c}∗
  • B. The function g ∶ {a}∗ → {b}∗ replacing all a’s
  • C. The function h ∶ {a,b}∗ → {a,b}∗ replacing all leading a’s
  • D. Exactly two of the functions above
  • E. Can’t tell

2 IT70 (2014) The Classical Turing Machine 10 / 13

slide-11
SLIDE 11

The copying function copy(w) = ww

q0 q1 q2 q3 q4 q5 A/A,R B/B,R a/A,R d/d,R ◻/A,L d/d,L ◻/◻,R b/B,R d/d,R ◻/B,L d/d,L ◻/◻,R ◻/◻,L A/a,L B/b,L q6 ◻/◻,R d ∈ {a,b,A,B}

q0: find leftmost a or b q1: add a at right end q2: move to left end q3: add b at right end q4: move to left end q5: change A,B to a,b

2 IT70 (2014) The Classical Turing Machine 11 / 13

slide-12
SLIDE 12

The copying function copy(w) = ww (cont.)

q0 q1 q2 q3 q4 q5 A/A,R B/B,R a/A,R d/d,R ◻/A,L d/d,L ◻/◻,R b/B,R d/d,R ◻/B,L d/d,L ◻/◻,R ◻/◻,L A/a,L B/b,L q6 ◻/◻,R d ∈ {a,b,A,B}

q0 #ˇ abaa##### q1 #Aˇ baa##### q1 #Abˇ aa##### q1 #Abaˇ a##### q1 #Abaaˇ ##### q2 #Abaˇ aA#### q3 #Abˇ aaA#### q3 #Aˇ baaA#### q3 #ˇ AbaaA#### q3 ˇ #AbaaA#### q0 #ˇ AbaaA#### q0 #Aˇ baaA#### q3 #ABˇ aaA#### q3 #ABaˇ aA#### q3 #ABaaˇ A#### q3 #ABaaAˇ #### q4 #ABaaˇ AB### q4 #ABaˇ aAB### q4 #ABˇ aaAB### q4 #Aˇ BaaAB### q4 #ˇ ABaaAB### q4 ˇ #ABaaAB### . . .

2 IT70 (2014) The Classical Turing Machine 12 / 13

slide-13
SLIDE 13

Clicker question L62

What will reduce the number of computation steps of the cTM?

q0 q1 q2 q3 q4 q5 A/A,R B/B,R a/A,R d/d,R ◻/A,L d/d,L ◻/◻,R b/B,R d/d,R ◻/B,L d/d,L ◻/◻,R ◻/◻,L A/a,L B/b,L q6 ◻/◻,R d ∈ {a,b,A,B}

  • A. Among others, extend the

tape alphabet

  • B. Identify states q2 and q4
  • C. Find in q2 and q4 the

leftmost a or b

  • D. Among others, move right in

q5 on a and b

  • E. Can’t tell

2 IT70 (2014) The Classical Turing Machine 13 / 13