3 views

Original Title: Solution

Uploaded by Divyesh Kumar

- Thought Works
- Data Handling
- ori@nokia
- Alan Mathison Turing
- Discovery of Meaningful Rules in Time Series
- Compliance Table
- Articulo Descargado
- June 7 Math 10
- 7517_1-QP-ComputerScience-A-11Jun18-AM.pdf
- D.qsnake
- BPMN+Quick Reference
- Characters Strings
- Lecture 02
- Username and Groupname in HPUX
- TOC-UNIT-IV
- Datatype
- Functions
- Lecture 6 (Strings in Java)
- Putnam Training Problems
- Lingpipe Book 0.2

You are on page 1of 2

Homework 7 Solutions

B = { 0n 1n 2n | n 0 }.

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 isnt.

2. Return tape head to left-hand end of tape.

3. Repeat the following until no more 0s left on tape.

4. Replace the leftmost 0 with x.

5. Scan right until a 1 occurs. If there are no 1s, reject.

6. Replace the leftmost 1 with x.

7. Scan right until a 2 occurs. If there are no 2s, 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 1s or 2s, reject. Otherwise, accept.

2. (a) Show that the class of decidable languages is closed under union.

Answer: For any two decidable languages L1 and L2 , let M1 and M2 , respec-

tively be the TMs that decide them. We construct a TM M 0 that decides the

union of L1 and L2 :

M 0 = On input string w:

1. Run M1 on w. If it accepts, accept.

2. Run M2 on w. If it accepts, accept. Otherwise, reject.

(b) Show that the class of Turing-recognizable languages is closed under union.

Answer: For any two Turing-recognizable languages L1 and L2 , let M1 and

M2 , respectively be the TMs that recognize them. We construct a TM M 0 that

1

recognizes the union of L1 and L2 :

M 0 = On input string w:

1. Run M1 and M2 alternatively on w step by step.

If either accepts, accept. If both halt and reject, reject.

its accepting state after a finite number of steps. Note that if both M1 and M2

reject and either of them does so by looping, then M 0 will loop.

enumerates it. Why didnt we use the following simpler algorithm for the forward

direction of the proof? As before, s1 , s2 , . . . is a list of all strings in .

1. Repeat the following for i = 1, 2, 3, . . .

2. Run M on si .

3. If it accepts, print out si .

Answer: The problem with the proof is that M on si might loop forever. If it loops

forever, then E doesnt print out si . More importantly, E isnt going to move on to

test the next string. Therefore, it wont be able to enumerate any other strings in L.

For this reason, we need to simulate M on each of the strings for a fixed length of time

so that no looping can occur.

4. A Turing machine with doubly infinite tape is similar to an ordinary Turing machine,

but its tape is infinite to the left as well as to the right. The tape is initially filled with

blanks except for the portion that contains the input. Computation is defined as usual

except that the head never encounters an end to the tape as it moves leftward. Show

that this type of Turing machine recognizes the class of Turing-recognizable languages.

Answer: A TM with doubly infinite tape can simulate an ordinary TM. It marks the

left-hand end of the input to detect and prevent the head from moving off of that end.

To simulate the doubly infinite tape TM by an ordinary TM, we show how to simulate

it with a 2-tape TM, which was already shown to be equivalent in power to an ordinary

TM. The first tape of the 2-tape TM is written with the input string, and the second

tape is blank. We cut the tape of the doubly infinite tape TM into two parts, at the

starting cell of the input string. The portion with the input string and all the blank

spaces to its right appears on the first tape of the 2-tape TM. The portion to the left

of the input string appears on the second tape, in reverse order.

- Thought WorksUploaded bySriRao
- Data HandlingUploaded bySyed Abdul Haseeb Ahmed
- ori@nokiaUploaded byAnet Augustin
- Alan Mathison TuringUploaded byMaulida Ayu Noriza
- Discovery of Meaningful Rules in Time SeriesUploaded byjamey_mork1
- Compliance TableUploaded byccarnero
- Articulo DescargadoUploaded byFernando Gomez
- June 7 Math 10Uploaded byEdcel BhemBhem Ladrillo Bagsic
- 7517_1-QP-ComputerScience-A-11Jun18-AM.pdfUploaded byJeff Nippard
- D.qsnakeUploaded bySumedha Swayansidha
- BPMN+Quick ReferenceUploaded byJulio Jorge Moura
- Characters StringsUploaded byVera Rusmalawati
- Lecture 02Uploaded byMian Saeed Rafique
- Username and Groupname in HPUXUploaded byRicardo Bolanos
- TOC-UNIT-IVUploaded byanilosta
- DatatypeUploaded byHamad Heasat
- FunctionsUploaded bymiriyamsatyanarayana
- Lecture 6 (Strings in Java)Uploaded byDeepak Dewani
- Putnam Training ProblemsUploaded bygauss202
- Lingpipe Book 0.2Uploaded byGiang Le
- Mathematics - 2Uploaded byBharat & Company
- Functions for StringUploaded byUsama Ahmed
- Java ScriptUploaded byMananJain
- Arduino 2Uploaded byRica Siagan
- String BufferUploaded byMahesh Sanjiva
- PS 0372 exam 2008Uploaded bySKH
- Tutorial how to create Barcode Reader app in Android Studio 1.docxUploaded bytrustmeon18
- Tutorial How to Create Barcode Reader App in Android Studio 1Uploaded bytrustmeon18
- Roman DVCLub India 2014Uploaded bytvivek2889t
- formula and materials to be available for exam or quiz_v2Uploaded byHi Ther

- dbmsindexUploaded byDivyesh Kumar
- dbmsUploaded byDivyesh Kumar
- dbmsUploaded byDivyesh Kumar
- dynprogUploaded byankit47
- dynprogUploaded byankit47
- ITUploaded byDivyesh Kumar
- Object Oriented ProgrammingUploaded byDivyesh Kumar
- WinterfUploaded byDivyesh Kumar
- CGM_COVERUploaded byDivyesh Kumar
- Dbms File DivyUploaded byDivyesh Kumar
- TemplateUploaded byDivyesh Kumar
- CSLD Phan Tan Va Song SongUploaded byLê Anh Trung
- GroupB-SEPTEMBER2012Uploaded byDivyesh Kumar
- New Microsoft Word DocumentUploaded byDivyesh Kumar
- Air Pollution.Uploaded byDivyesh Kumar
- HeroUploaded byDivyesh Kumar
- HeroUploaded byDivyesh Kumar
- HeroUploaded byDivyesh Kumar
- Application of plain carbon steelUploaded byDivyesh Kumar
- (92451309) heroUploaded byDivyesh Kumar
- UnitIII Lecture 4 CompleteUploaded byDivyesh Kumar
- First Year-DTU-SyllabusUploaded byAbhishek Singh
- BMEUploaded byDivyesh Kumar

- 10mm Plug PlayUploaded byElias
- A-BE212-4040-DSUploaded byLuis Antonio Hermoza
- AdverbUploaded byAlfian Militan
- A Sakai 2011Uploaded byjheny
- Engineering Drawing - Lettering and Lines Presentation (1).pptUploaded bySanjay Gomasta
- 20111007-Fernandez-Torres（revised）Uploaded bygfernand34
- Indigo ManualUploaded byplatentdg
- ASTM A500Uploaded bytirumala srinivas
- Gen Math Learning CompetenciesUploaded byMaJoy L. Encarnacion
- angles in real lifeUploaded byapi-358839685
- Hot Econ ProfsUploaded byZerohedge
- HW4Solutions.pdfUploaded byDavid Lee
- 113575494 Aguiar Collares Pereira 1992 TAG a Time Dependent Autoregressive Gaussian Model for Generating Synthetic Hourly RadiationUploaded byEsther Otto
- An Experimental Analysis of IC Engine by Using Hydrogen BlendUploaded byIJSTE
- ch09test.rtfUploaded bycool_sp
- Wavelet Transformation Tool User Manual PetrelUploaded byAgung Sandi Agustina
- Frequency DistributionUploaded bySahibzadaAtiqRehmanShah
- SizingUploaded byJorge Enrique Mosquera Rodriguez
- Sigrist_ETH - Lecture Notes-Cond Matter-2011.pdfUploaded byAnonymous 9rJe2lOskx
- A Vector Analysis of Beckett's QuadUploaded byAndrew Key
- RESULTS AND DISCUSSION 11.docxUploaded byfengyuheng
- Antenna Theory notes3Uploaded by87kimera
- Restructuring ClausesUploaded bysdgm1
- Diamond ModelUploaded byMaimoona Ghani
- BKI Rules Vol 03 Section 11 ( for Machinery Instalation ) Page 148 ( Pipe Wall THK )Uploaded byellypar
- Integrate Hibernate With Spring Using AnnotationsUploaded byPhani Varma
- Series PG-2, 3, 4, 5 and 6 Specification SheetUploaded byWatts
- Constant-Pressure Turbocharger Matching by Michael M. W. de SilvaUploaded byMichael M. W. de Silva
- ADAPT(FM1)Uploaded bySumaiyyahRoshidi
- eae400Uploaded byRamaleela Kannan