Download presentation
Presentation is loading. Please wait.
2
Homework 8 Solutions
3
#1 True or False a) Regular languages are recursive b) Context free languages are recursively enumerable (r.e.) c) Recursive languages are r.e d) R.e. languages are recursive TRUE FALSE
4
#2. a) Show computations with 000111 and 101 on the following Turing Machine 101 q 0 ├101 ├ q 0 101 dead end! ├X0q 1 0111 ├X00q 1 111 ├X0q 2 0Y11 ├Xq 2 00Y11 ├q 2 X00Y11 ├Xq 0 00Y11 ├XXq 1 0Y11 ├XX0q 1 Y11 ├XX0Yq 1 11 ├XX0q 2 YY1 ├XXq 2 0YY1 ├Xq 2 X0YY1 ├XXq 0 0YY1 Continued above ├XXXq1YY1 ├XXXYq1Y1 ├XXXYYq11 ├XXXYq2YY ├XXXq2YYY ├XXq2XYYY ├XXXq0YYY ├XXXYq3YY XXXYYq3Y XXXYYYq3 XXXYYYBq4 halt q4 is a final state b) What is L(M) (you’ll have to guess) q 0 ├000111… 000111 ├ q 0 000111… ├Xq 1 00111 “Looks like” {0n1n | n > 0}
5
#3. Construct a Turing Machine to compute {w w R | w {0,1}* a) Show pseudo-code that describes how the TM operates If symbol is 0 write X enter a “branch” that iterates to the 1st Blank,X,Y if last symbol is 0 go back to the beginning, repeat (Similar for 1) (Accept if read X or Y at 1st step)
6
3b) Create the actual transitions
7
Show your TM processing (i) 1001, (ii) 101 and (iii) 110 q 0 ├1001 ├q 0 1001 ├ Yq 4 001 ├Y0q 4 01 ├Y00q 4 1 ├Y001q 4 ├Y00q 5 1 ├Y0q 6 0Y ├Yq 6 00Y ├q 6 Y00Y ├Yq 0 00Y ├YXq 1 0Y ├YX0q 1 Y ├YXq 2 0Y ├Yq 3 XXY ├YXq 0 XY ├Yq 7 XXY ├q 7 YXXY q 7 ├YXXY accept q 0 ├101 ├q 0 101 ├ Yq 4 01 ├Y0q 4 1 ├Y01q 4 ├Y0q 5 1 ├Yq 6 0Y ├q 6 Y0Y ├Yq 0 0Y ├YXq 1 Y ├Yq 2 XY reject 110 is similar (it is rejected)
8
#4. Show that r.e. languages are closed under union and intersection. union Assume L 1 and L 2 are recursively enumerable. We can consider two single tape machines M 1 and M 2, which accept L 1 and L 1 respectively. We define M as a single tape TM with three tracks. Track 1 will hold the input. M will simulate M 1 using track 2. If M 1 halts in an accepting configuration then M accepts; otherwise M moves the tape head back to the left end and starts simulating M 2 on track 3. If M 2 accepts the input string then the string is accepted by M. intersection Assume L 1 and L 2 are recursively enumerable. We can consider two single tape machines M 1 and M 2, which accept L 1 and L 1 respectively. We define M as a single tape TM with three tracks. Track 1 will hold the input. M will simulates M 1 using track 2. If M 1 halts in an accepting configuration M moves the tape head back to the left end and starts simulating M 2 on track 3. If M 2 also accepts the input string then the string is accepted by M.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.