Deterministic Turing Machines
Unique accept state. Also no arrows are coming out. Constituents Infinite tape Head Transition diagram … … q1 q0 qf Unique accept state. Also no arrows are coming out.
Formal definition A Deterministic Turing Machine (DTM) is a sextuple (Q, Σ, Γ, δ, q0, qf) where: Q is a finite set of states Σ is the input alphabet Γ is the tape alphabet, There is a special blank symbol □ in Γ q0 is the start state qf is the final state δ: Q x Γ → Q x Γ x {L,R,S}, where L stands for Left, R stands for Right and S stands for Stay.
Formal definition (cont.) δ(q , a) = (q’ , b, L) means: “if you are in state q and the head in the tape points to symbol a then move to state q’, replace symbol a with symbol b in the tape and move the head one position to the left” Illustration: … … … … a b head head q‘ q‘ a→b,L … a→b,L … … q … q
Determinism Determinism means that I have no choices! The transition function δ sends pair (q, a) to at most one triple (q’, ?, ?) (in other words there is at most one arrow from state q reading symbol a –maybe there are no such arrows). No ε-moves are allowed (I must read something in the tape in order to change state).
Special status Start: Be at initial state , the tape contains only the input and the head points to the first (leftmost symbol of the input) Accept: Reach the accept state. The machine stops the computation and accept (notice that part of the input might not be read). Reject: Be in a state q, read symbol a and find no outgoing arrow under symbol a. Loop for ever: There are some cases that a machine enters a subset of states from which it can’t exit (different than the “reject case”)
Example Find a DTM that computes the language L = {an bn , n ≥ 0}. High level program: Repeat Erase an a. Pass along the rest of as. Erase a b Pass along the rest of bs. Go to the beginning of the input. Until or the input is erased (accept) or you find an unmatched a or b (reject).
Example Find a DTM that computes the language L = {an bn , n ≥ 0}. Answer: a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Example Test the machine for several possible inputs to see if it works as it should. Test inputs: ε (it should accept) aaabbb (it should accept) aaabb (it should reject) aabbb (it should reject) aabba (it should reject)
Test input: ε … … a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: ε … … a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … a a a b b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a b b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a b b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a b b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … a a a b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x a a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x a x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aaabb … … No arrow under □ so REJECT! x x x x x a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … a a b b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a b b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a b b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x a x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x b b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabbb … … No arrow under b so REJECT! x x x x b a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabba … … a a b b a a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabba … … x a b b a a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabba … … x a b b a a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabba … … x a x b a a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabba … … x a x b a a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L
Test input: aabba … … No arrow under a so REJECT! x a x b a a → a , R x → x , R x → x , R b → b , R a → x , R b → x , R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L