the classical turing machine 2it70 finite automata and
play

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


  1. The Classical Turing Machine 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 14, 2014

  2. Classical Turing machine architecture Input yes/no Automaton Tape 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

  3. Definition classical Turing machine classical Turing machine M = ( Q , ∆ , ◻ , → , q 0 ) Q finite set of states ∆ finite tape alphabet, ◻ ∉ ∆ → ⊆ Q × ∆ ◻ × ∆ ◻ × { L , R } × Q transition relation with ∆ ◻ = ∆ ∪ {◻} q 0 ∈ 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

  4. A classical Turing machine example ◻/ N , R q 9 ◻/◻ , L a / a , R q 1 q 2 b / b , R a /◻ , R q 7 q 8 a /◻ , L ◻/ N , R b /◻ , R a /◻ , R b /◻ , L a /◻ , R b /◻ , R q 6 q 5 b /◻ , R ◻/ N , R a / a , L q 0 q 3 b / b , L ◻/◻ , R q 4 ◻/ Y , R q0 ## ˇ q0 # ˇ q0 ## ˇ q0 # ˇ a## q0 # ˇ aabb# ab## aab# abb## q1 ### ˇ q1 ### ˇ q1 ## ˇ q1 ## ˇ q1 ## ˇ ## abb# b## ab# bb## q1 ##a ˇ q1 ###b ˇ q1 ##a ˇ q2 ## ˇ q1 ##b ˇ bb# ## b# ### b## q1 ##ab ˇ q2 ### ˇ q1 ##ab ˇ q1 ##bb ˇ b# b## # HALT ## q1 ##abb ˇ q3 ## ˇ q2 ##a ˇ q2 ##b ˇ # #### b# b## q2 ##ab ˇ q0 ### ˇ q3 ## ˇ q3 ## ˇ b# ### a## b### q3 ##a ˇ q3 # ˇ q3 # ˇ b## HALT #a## #b### q0 ## ˇ q3 ## ˇ ab## b### q3 # ˇ #ab## HALT 2 IT70 (2014) The Classical Turing Machine 4 / 13

  5. Function computed by classical Turing machine classical Turing machine M = ( Q , ∆ , ◻ , → , q 0 ) configurations ( q , z ) ∈ Q × Z with Z ⊆ ∆ ∗ ◻ × ∆ ◻ × ∆ ∗ ◻ ∃ e , e ′ ∈ ∆ ∃ µ ∈ { L , R } ∶ ( q , z ) ⊢ M ( q ′ , z ′ ) iff e / e ′ ,µ → M q ′ ∧ z ′ = z [ e / e ′ ,µ ] � � � q ¬∃ q ′ ∈ Q ∃ z ′ ∈ Z ∶ ( q , z ) ⊢ M ( q ′ , z ′ ) ( q , z ) ⊬ M iff z [ e / e ′ ,µ ] only defined for z of the form x ⟨ e ⟩ y 2 IT70 (2014) The Classical Turing Machine 5 / 13

  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 , ∆ , ◻ , → , q 0 ) computes function f ∶ Σ ∗ → Θ ∗ (i) alphabets Σ , Θ ⊆ ∆ (ii) if ( q 0 , ⟨ w ⟩) ⊢ M ( q , z ) ⊬ M then z = ⟨ f ( w )⟩ (iii) no infinite computation ( q 0 , ⟨ w ⟩) ⊢ M ( q 1 , z 1 ) ⊢ M ( q 2 , z 2 ) ⊢ M ⋯ 2 IT70 (2014) The Classical Turing Machine 6 / 13

  7. An example of a computable function ◻/ N , R ◻/◻ , L q 9 q ′ 9 ◻/◻ , L a / a , R q 1 q 2 q ′ 6 b / b , R ◻/ N , R a /◻ , R q 7 a /◻ , L b /◻ , R a /◻ , R q 8 ◻/◻ , L q 6 ◻/◻ , L b /◻ , L a /◻ , R b /◻ , R q 5 b /◻ , R ◻/ N , R a / a , L q 0 q 3 q ′ 8 b / b , L ◻/◻ , R q ′ q 4 4 ◻/ Y , R ◻/◻ , R computed function f ∶ { a , b } ∗ → { Y , N } ∗ such that if w = a n b n for some n ⩾ 0 f ( w ) = Y f ( w ) = N otherwise 2 IT70 (2014) The Classical Turing Machine 7 / 13

  8. More examples of computable functions a / b , R b / a , R a / a , R b / a , R a / a , R q 0 q 0 q 1 q 0 b / b , R a / b , R ◻/◻ , L ◻/◻ , L b / b , R ◻/◻ , L ◻/◻ , L a / a , L a / a , L q 1 q 2 q 1 q 2 b / b , L a / a , L a / a , L ◻/◻ , R ◻/◻ , R b / b , L ◻/ a , L b / b , L b / b , L ◻/ b , L ◻ , ◻ , R a / a , L q 2 q 3 q 4 q 3 q 5 b / b , L complement w C where ε C = ε , ( aw ) C = bw C , ( bw ) C = aw C function w ↦ ( ab ) n if ∣ w ∣ = 2 n , w ↦ ( ab ) n a if ∣ w ∣ = 2 n + 1 function ε ↦ ε , w ↦ aw if last ( w ) = a , w ↦ bw if last ( w ) = b 2 IT70 (2014) The Classical Turing Machine 8 / 13

  9. Anthony Morphett’s cTM simulator ;; cTM program 1 ;; cTM program 2 ;; cTM program 3 0 a b R 0 0 a a R 1 0 a a R 0 0 b a R 0 0 b a R 1 0 b b R 0 0 _ _ L 1 0 _ _ R 2 ;; bug 0 _ _ L 1 1 a a L 1 1 a b R 0 1 a a L 2 1 b b L 1 1 b b R 0 1 b b L 4 1 _ _ R 2 1 _ _ L 2 2 a a L 2 2 a a L 2 2 b b L 2 2 b b L 2 2 _ a L 3 2 _ _ R 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

  10. Clicker question L61 Consider the classical Turing machine M depicted below. a / b , R d / d , L d ∈ Σ ◻/◻ , L ◻/◻ , R q 0 q 1 q 2 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

  11. The copying function copy ( w ) = ww d / d , R d / d , L ◻/ A , L q 1 q 2 a / A , R ◻/◻ , R ◻/◻ , L A / A , R A / a , L q 0 q 5 B / B , R B / b , L ◻/◻ , R ◻/◻ , R b / B , R q 3 q 4 q 6 ◻/ B , L d ∈ { a , b , A , B } d / d , R d / d , L q0: find leftmost a or b q3: add b at right end q1: add a at right end q4: move to left end q2: move to left end q5: change A,B to a,b 2 IT70 (2014) The Classical Turing Machine 11 / 13

  12. The copying function copy ( w ) = ww (cont.) q0 # ˇ d / d , R d / d , L q0 # ˇ abaa##### AbaaA#### q1 #A ˇ q0 #A ˇ baa##### baaA#### ◻/ A , L q1 #Ab ˇ q3 #AB ˇ aa##### aaA#### q 1 q 2 q1 #Aba ˇ q3 #ABa ˇ a##### aA#### q1 #Abaa ˇ q3 #ABaa ˇ a / A , R ◻/◻ , R ##### A#### q3 #ABaaA ˇ q2 #Aba ˇ aA#### #### ◻/◻ , L A / A , R A / a , L q4 #ABaa ˇ q 0 q 5 q3 #Ab ˇ aaA#### AB### B / B , R B / b , L q3 #A ˇ q4 #ABa ˇ baaA#### aAB### q3 # ˇ q4 #AB ˇ ◻/◻ , R AbaaA#### aaAB### b / B , R ◻/◻ , R q3 ˇ q4 #A ˇ #AbaaA#### BaaAB### q 3 q 4 q 6 q4 # ˇ ABaaAB### ◻/ B , L q4 ˇ #ABaaAB### d ∈ { a , b , A , B } d / d , R d / d , L . . . 2 IT70 (2014) The Classical Turing Machine 12 / 13

  13. Clicker question L62 What will reduce the number of computation steps of the cTM? d / d , R d / d , L A. Among others, extend the ◻/ A , L q 1 q 2 tape alphabet a / A , R ◻/◻ , R B. Identify states q 2 and q 4 ◻/◻ , L A / A , R A / a , L C. Find in q 2 and q 4 the q 0 q 5 B / B , R B / b , L leftmost a or b ◻/◻ , R ◻/◻ , R b / B , R D. Among others, move right in q 3 q 4 q 6 q 5 on a and b ◻/ B , L E. Can’t tell d ∈ { a , b , A , B } d / d , R d / d , L 2 IT70 (2014) The Classical Turing Machine 13 / 13

Recommend


More recommend