Xq 5 x x q 5 x x x q 5

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
rightangleswrightanglese xq 5 0 x 0 x rightangleswrightanglese q 5 x 0 x 0 x q 5 rightangleswrightanglese x 0 x 0 x rightangleswrightanglese q 2 x 0 x 0 x rightangleswrightanglese xq 2 0 x 0 x rightangleswrightanglese xxq 3 x 0 x rightangleswrightanglese xxxq 3 0 x rightangleswrightanglese xxx 0 q 4 x rightangleswrightanglese xxx 0 xq 4 rightangleswrightanglese rightangleswrightanglese xxx 0 x rightangleswrightanglese q reject 2. Give an implementation-level description of a Turing machine that decides the language B = { 0 n 1 n 2 n | n 0 } . 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Answer: M = “On input string w : 1. Scan the input from left to right to make sure that it is a member of 0 1 2 , and reject if it isn’t. 2. Return tape head to left-hand end of tape. 3. Repeat the following until no more 0 s left on tape. 4. Replace the leftmost 0 with x . 5. Scan right until a 1 occurs. If there are no 1 s, reject . 6. Replace the leftmost 1 with x . 7. Scan right until a 2 occurs. If there are no 2 s, reject . 8. Replace the leftmost 2 with x . 9. Return tape head to left-hand end of tape, and go to stage 3. 10. If the tape contains any 1 s or 2 s, reject . Otherwise, accept .” 3. (a) Show that the collection of decidable languages is closed under union. Answer: For any two decidable languages L 1 and L 2 , let M 1 and M 2 , respectively be the TMs that decide them. We construct a TM M that decides the union of L 1 and L 2 : M = “On input string w : 1. Run M 1 on w . If it accepts, accept .
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern