The Reactive Turing Machine 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 12, 2014
Reactive Turing machine architecture Input yes/no Automaton Tape Tape 2 IT70 (2014) The Reactive Turing Machine 2 / 20
A simple reactive Turing machine a [◻/ 1 , R ] b [ 1 /◻ , L ] τ [◻/◻ , L ] q 0 q 1 ( q 0 , aab , ⟨◻⟩) ⊢ M ( q 0 , ab , 1 ⟨◻⟩) ⊢ M ( q 0 , b , 11 ⟨◻⟩) ⊢ M ( q 1 , b , 1 ⟨ 1 ⟩) ⊢ M ( q 1 ,ε, ⟨ 1 ⟩) ( q 0 , abb , ⟨◻⟩) ⊢ M ( q 0 , bb , 1 ⟨◻⟩) ⊢ M ( q 1 , bb , ⟨ 1 ⟩) ⊢ M ( q 1 , b , ⟨◻⟩) ( q 0 , aa , ⟨◻⟩) ⊢ M ( q 0 , a , 1 ⟨◻⟩) ⊢ M ( q 0 ,ε, 11 ⟨◻⟩) ⊢ M ( q 1 ,ε, 1 ⟨ 1 ⟩) 2 IT70 (2014) The Reactive Turing Machine 3 / 20
Definition reactive Turing machine reactive Turing machine M = ( Q , Σ , ∆ , ◻ , → , q 0 , F ) Q finite set of states Σ finite alphabet, τ ∉ Σ ∆ finite tape alphabet, blank ◻ ∉ ∆ → ⊆ Q × Σ τ × ∆ ◻ × ∆ ◻ × { L , R } × Q transition relation where Σ τ = Σ ∪ { τ } and ∆ ◻ = ∆ ∪ {◻} q 0 ∈ Q is the initial state F ⊆ Q is the set of final states a [ e / e ′ ,µ ] τ [ e / e ′ ,µ ] → q ′ and q → q ′ transitions q � � � � � � � � � � 2 IT70 (2014) The Reactive Turing Machine 4 / 20
Configurations reactive Turing machine M = ( Q , Σ , ∆ , ◻ , → , q 0 , F ) configuration ( q , w , z ) of M control is in state q string w not read from input yet z current tape content tape content z ∈ Z = { x ⟨ e ⟩ y ∣ x ∈ ∆ ∗ ◻ ∶ x = ε ∨ first ( x ) ≠ ◻ , e ∈ ∆ ◻ , y ∈ ∆ ∗ ◻ ∶ y = ε ∨ last ( y ) ≠ ◻} 2 IT70 (2014) The Reactive Turing Machine 5 / 20
Clicker question L51 a b bb (i) tape yields tape content a ◻ b ⟨◻⟩ bb ab bb (ii) tape yields tape content ab ⟨◻⟩ bb ab b (iii) tape yields tape content ab ⟨◻⟩ b abbba (iv) tape yields tape content ab ⟨ b ⟩ ba Which of the statements (i) to (iv) above does not hold? A. Statement (i) C. Statement (iii) B. Statement (ii) D. Statement (iv) 2 IT70 (2014) The Reactive Turing Machine 6 / 20
Execution steps ( q , w , x ⟨ e ⟩ y ) ⊢ M ( q ′ , w ′ , z ′ ) if ∃ a ∈ Σ ∃ e , e ′ ∈ ∆ ◻ ∃ µ ∈ { L , R } ∶ a [ e / e ′ ,µ ] w = aw ′ ∧ q → M q ′ ∧ z [ e / e ′ ,µ ] = z ′ � � � � � � where x ⟨ e ⟩ dy [ e / e ′ , R ] = xe ′ ⟨ d ⟩ y xd ⟨ e ⟩ y [ e / e ′ , L ] = x ⟨ d ⟩ e ′ y x ⟨ e ⟩ ε [ e / e ′ , R ] = xe ′ ⟨◻⟩ ε ε ⟨ e ⟩ y [ e / e ′ , L ] = ε ⟨◻⟩ e ′ y 2 IT70 (2014) The Reactive Turing Machine 7 / 20
Execution steps (cont.) a [ e / e ′ , L ] → M q ′ then ( q , aw , xd ⟨ e ⟩ y ) ⊢ M ( q ′ , w , x ⟨ d ⟩ e ′ y ) if q � � � � � � a [ e / e ′ , L ] → M q ′ then ( q , aw ,ε ⟨ e ⟩ y ) ⊢ M ( q ′ , w ,ε ⟨◻⟩ e ′ y ) if q � � � � � � τ [ e / e ′ , L ] → M q ′ then ( q , w , xd ⟨ e ⟩ y ) ⊢ M ( q ′ , w , x ⟨ d ⟩ e ′ y ) if q � � � � � � τ [ e / e ′ , L ] → M q ′ then ( q , w ,ε ⟨ e ⟩ y ) ⊢ M ( q ′ , w ,ε ⟨◻⟩ e ′ y ) if q � � � � � � 2 IT70 (2014) The Reactive Turing Machine 8 / 20
Clicker question L52 τ [ e / e ′ , R ] → M q ′ Suppose q � � � � � � (i) ( q , aw , x ⟨ e ⟩ dy ) ⊢ M ( q ′ , w , x ⟨ e ′ ⟩ y ) (ii) ( q , aw , x ⟨ e ⟩ dy ) ⊢ M ( q ′ , aw , x ⟨ e ′ ⟩ y ) (iii) ( q , aw , x ⟨ d ⟩ ey ) ⊢ M ( q ′ , w , xd ⟨ e ′ ⟩ y ) (iv) ( q , aw , x ⟨ e ⟩ ε ) ⊢ M ( q ′ , aw , xe ′ ⟨◻⟩ ε ) Only one of the statements above is true. Which one is it? C. Statement (iii) A. Statement (i) D. Statement (iv) B. Statement (ii) E. Can’t tell 2 IT70 (2014) The Reactive Turing Machine 9 / 20
Another example Turing machine a [ ◻ / 1 , R ] b [ 1 / ◻ , L ] τ [ ◻ / ◻ , L ] τ [ ◻ / ◻ , R ] q 0 q 1 q 2 accepting computation for aaabbb ( q 0 , aaabbb , ⟨◻⟩) ⊢ M ( q 0 , aabbb , 1 ⟨◻⟩) ⊢ M ( q 0 , abbb , 11 ⟨◻⟩) ⊢ M ( q 0 , bbb , 111 ⟨◻⟩) ⊢ M ( q 1 , bbb , 11 ⟨ 1 ⟩) ⊢ M ( q 1 , bb , 1 ⟨ 1 ⟩) ⊢ M ( q 1 , b , ⟨ 1 ⟩) ⊢ M ( q 1 ,ε, ⟨◻⟩) ⊢ M ( q 2 ,ε, ⟨◻⟩) 2 IT70 (2014) The Reactive Turing Machine 10 / 20
Another example Turing machine (cont.) a [ ◻ / 1 , R ] b [ 1 / ◻ , L ] τ [ ◻ / ◻ , L ] τ [ ◻ / ◻ , R ] q 0 q 1 q 2 non-accepting computation for aaabbb ( q 0 , aaabbb , ⟨◻⟩) ⊢ M ( q 0 , aabbb , 1 ⟨◻⟩) ⊢ M ( q 0 , abbb , 11 ⟨◻⟩) ⊢ M ( q 1 , abbb , 1 ⟨ 1 ⟩) / ⊢ M 2 IT70 (2014) The Reactive Turing Machine 11 / 20
Language accepted by a reactive Turing machine reactive Turing machine M = ( Q , Σ , ∆ , ◻ , → , q 0 , F ) L ( M ) = { w ∈ Σ ∗ ∣ ∃ q ∈ F ∃ z ∈ Z ∶( q 0 , w , ⟨◻⟩) ⊢ ∗ M ( q ,ε, z )} a [ ◻ / 1 , R ] b [ 1 / ◻ , L ] τ [ ◻ / ◻ , L ] q 0 q 1 L ( M ) = { a n b m ∣ n ⩾ m ⩾ 0 } reactive Turing machines accept recursively enumerable languages ⊢ ∗ M reflexive and transitive closure of ⊢ M 2 IT70 (2014) The Reactive Turing Machine 12 / 20
Language accepted by a reactive Turing machine (cont.) reactive Turing machine M = ( Q , Σ , ∆ , ◻ , → , q 0 , F ) L ( M ) = { w ∈ Σ ∗ ∣ ∃ q ∈ F ∃ z ∈ Z ∶( q 0 , w , ⟨◻⟩) ⊢ ∗ M ( q ,ε, z )} a [ ◻ / 1 , R ] b [ 1 / ◻ , L ] τ [ ◻ / ◻ , L ] τ [ ◻ / ◻ , R ] q 0 q 1 q 2 L ( M ) = { a n b n ∣ n ⩾ 0 } ⊢ ∗ M reflexive and transitive closure of ⊢ M 2 IT70 (2014) The Reactive Turing Machine 13 / 20
Accepting a non-context-free language a [ ◻ / 1 , R ] b [ 1 / 1 , L ] c [ 1 / ◻ , R ] τ [ ◻ / ◻ , L ] τ [ ◻ / ◻ , R ] τ [ ◻ / ◻ , L ] q 0 q 1 q 2 q 3 L ( M ) = { a n b n c n ∣ n ⩾ 0 } 2 IT70 (2014) The Reactive Turing Machine 14 / 20
Accepting a non-context-free language (cont.) a [ ◻ / 1 , R ] b [ 1 / 1 , L ] c [ 1 / ◻ , R ] τ [ ◻ / ◻ , L ] τ [ ◻ / ◻ , R ] τ [ ◻ / ◻ , L ] q 0 q 1 q 2 q 3 # ˇ #### q0 aaabbbccc # ˇ #### q0 aaabbbccc # 1 ˇ # 1 ˇ ### ### q0 aabbbccc q0 aabbbccc # 1 1 ˇ # 1 1 ˇ ## ## q0 abbbccc q0 abbbccc # 1 ˇ 1 ## # 1 1 1 ˇ q1 abbbccc # q0 bbbccc REJECT # 1 1 ˇ 1 # q1 bbbccc # 1 ˇ 1 1 # q1 bbccc # ˇ 1 1 1 # q1 bccc ˇ # 1 1 1 # q1 ccc # ˇ 1 1 1 # q2 ccc ## ˇ 1 1 # q2 cc ### ˇ 1 # q2 c #### ˇ # q2 ε ### ˇ ## q3 ε ACCEPT 2 IT70 (2014) The Reactive Turing Machine 15 / 20
Clicker question L53 with d ∈ { a , b } d [ ◻ / d , R ] d [ d / ◻ , L ] d [ ◻ / ◻ , L ] τ [ ◻ / ◻ , R ] q 0 q 1 q 2 Which language is accepted by the Turing machine above? A. L ( M ) = { w ∈ { a , b } ∗ ∣ # a ( w ) ≠ # b ( w )} B. L ( M ) = { w ∈ { a , b } ∗ ∣ w = w R } C. L ( M ) = { w ∈ { a , b } ∗ ∣ ∣ w ∣ is odd } D. L ( M ) = { w ∈ { a , b } ∗ ∣ ∣ w ∣ is odd ∧ w = w R } E. Can’t tell 2 IT70 (2014) The Reactive Turing Machine 16 / 20
A Turing machine accepting odd palindromes with d ∈ { a , b } d [◻/ d , R ] d [ d /◻ , L ] d [◻/◻ , L ] τ [◻/◻ , R ] q 0 q 1 q 2 # ˇ # ˇ #### q0 baababb #### q0 baabaab # b ˇ ### # b ˇ q0 aababb ### q0 aabaab # b a ˇ ## q0 ababb # b a ˇ ## q0 abaab # b a a ˇ # q0 babb # b a a ˇ # q0 baab # b a ˇ a # q1 abb # b a ˇ a # q1 aab # b ˇ a ## q1 bb # b ˇ a ## REJECT q1 ab # ˇ b ### q1 b ˇ ##### q1 ε # ˇ #### q2 ε ACCEPT 2 IT70 (2014) The Reactive Turing Machine 17 / 20
A Turing machine accepting all palindromes with d ∈ { a , b } d [◻/ d , R ] d [ d /◻ , L ] d [◻/◻ , L ] τ [◻/◻ , R ] q 0 q 1 q 2 τ [◻/◻ , L ] # ˇ # ˇ #### #### q0 baaaab q0 bbbaaa # b ˇ # b ˇ ### ### q0 aaaab q0 bbaaa # b a ˇ # b b ˇ ## ## q0 aaab q0 baaa # b a a ˇ # b b b ˇ # # q0 aab q0 aaa # b b ˇ # b a ˇ a # b # q1 aab q1 aaa # b ˇ a ## q1 ab . . . # ˇ b ### q1 b ˇ ##### q1 ε # ˇ #### q2 ε ACCEPT REJECT 2 IT70 (2014) The Reactive Turing Machine 18 / 20
Simulating a DFA a b b a q 0 q 1 q 2 a ˇ ####### q0 abaaab b q 3 a , b # ˇ ###### q1 baaab ## ˇ ##### q2 aaab ### ˇ q 0 a [ # / # , R ] q 1 #### q1 aab #### ˇ q 0 b [ # / # , R ] q 3 ### q1 ab ##### ˇ ## q1 b q 1 a [ # / # , R ] q 1 ###### ˇ # q2 ε q 1 b [ # / # , R ] q 2 ACCEPT q 2 a [ # / # , R ] q 1 q 2 b [ # / # , R ] q 2 q 3 a [ # / # , R ] q 3 q 3 b [ # / # , R ] q 3 2 IT70 (2014) The Reactive Turing Machine 19 / 20
Regular languages are recursively enumerable if L = L ( D ) for a DFA D then theorem L = L ( M ) for a reactive TM M suppose D = ( Q , Σ , δ, q 0 , F ) proof put M = ( Q , Σ , ∅ , ◻ , → , q 0 , F ) a [◻/◻ , R ] transitions q → δ ( q , a ) for q ∈ Q , a ∈ Σ � � � � � then ( q , w ) ⊢ D ( q ′ , w ′ ) iff ( q , w , ⟨◻⟩) ⊢ M ( q ′ , w ′ , ⟨◻⟩) hence ( q 0 , w ) ⊢ ∗ D ( q ,ε ) iff ( q 0 , w , ⟨◻⟩) ⊢ ∗ M ( q ,ε, ⟨◻⟩) therefore L ( D ) = L ( M ) ⊠ 2 IT70 (2014) The Reactive Turing Machine 20 / 20
Recommend
More recommend