# hw4.txt - 1 Q={q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,qa S={0,1...

• 3

This preview shows page 1 - 3 out of 3 pages.

1. Q={q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,qa}; S={0,1,#}; T={0,1,\_,#,x}; tapes=2; moves={L,R,S}; q0=q0; /* accept \e */ q0->qa: \_->\_,R // \_->\_,R; /* accept after computation is finished */ q1->qa: #->#,S // \_->\_,S; /* mark the beginning of tape 2 */ q0->q1: 0->0,S // \_->\_,R; q0->q1: 1->1,S // \_->\_,R; q1->q2: 0->x,R // \_->\_,S; q1->q3: 1->x,R // \_->\_,S; q2->q2: 0->0,R // \_->\_,S; q2->q2: 1->1,R // \_->\_,S; q3->q3: 0->0,R // \_->\_,S; q3->q3: 1->1,R // \_->\_,S; q2->q4: #->#,R // \_->\_,S; q3->q5: #->#,R // \_->\_,S; q5->q5: x->x,R // \_->\_,S; q4->q4: x->x,R // \_->\_,S; q4->q6: 0->x,L // \_->0,R; q4->q6: 1->x,L // \_->0,R; q5->q7: 0->x,L // \_->0,R; q5->q7: 1->x,L // \_->1,R; q6->q6: x->x,L // \_->\_,S; q7->q7: x->x,L // \_->\_,S; q6->q8: #->#,L // \_->\_,S; q7->q9: #->#,L // \_->\_,S; q8->q8: 0->0,L // \_->\_,S; q8->q8: 1->1,L // \_->\_,S; q9->q9: 0->0,L // \_->\_,S; q9->q9: 1->1,L // \_->\_,S; /* go back to beginning until complete */ q8->q1: x->x,R // \_->\_,S; q9->q1: x->x,R // \_->\_,S; 2.
(a) On input <M,w>, where M is a TM and w is a string: 1. Construct new TM M_1 that rejects all input, and 2. Construct new TM M_2 with any input, 1. Run M on w 2. ACCEPTS if M accepts 3. Write <M_1,M_2> (b) YES => YES