1. Homepage
  2. Homework
  3. comp2022/2922 Models of Computation - A3 - Turing Machines
This question has been solved

comp2022/2922 Models of Computation - A3 - Turing Machines

Engage in a Conversation
SydneyModels of Computationcomp2022comp2922Turing MachinesDeterministic Turing MachineNondeterministic Turing MachineMorphett’s simulator

comp2022/2922 A3 (90 marks) – Turing Machines s2 2023 CourseNana.COM

  • This assignment is due in Week 10 on Sunday 15 October, 11:59pm. CourseNana.COM

  • Submission is on GradeScope. CourseNana.COM

    For problems 1 and 2, you will submit one PDF with your solutions.
    For problem 3, you will submit your TMs in files named problem 3 1.txt, CourseNana.COM

    problem 3 2.txt, problem 3 3.txt. CourseNana.COM

    • –  For problem 4, you will submit files named run.sh, build.sh and other files you require. The first argument of run.sh, either tm to ptm or ptm to tm, should choose the solution that is run. A skeleton will be provided on Ed. CourseNana.COM

    • –  For problem 5, you will submit your 2-tape TM in one file named problem 5.txt. CourseNana.COM

  • All work must be done individually without consulting anyone else’s solutions in accor- CourseNana.COM

    dance with the University’s “Academic Dishonesty and Plagiarism” policies. CourseNana.COM

  • For clarifications and more details on all aspects of this assignment (e.g., level of justifica- tion expected, late penalties, repeated submissions, what to do if you are stuck, etc.) you are expected to regularly monitor the Ed Forum post “Assignment FAQ”. CourseNana.COM

    DTM stands for ”Deterministic Turing Machine”, and NTM stands for ”Nondeterministic Turing Machine”. CourseNana.COM

    All tapes in this assignment are doubly-infinite. When asked to give a low-level description use Morphett’s format, and its extension to 2 tapes as follows: the instruction CourseNana.COM

    qabcdLRs CourseNana.COM

    means that if the TM is in state q and reads a on the first tape and b on the second tape then it writes c on the first tape and d on the second, and moves the first tape left and the second tape right, and changes to state s. CourseNana.COM

    For instance, suppose the question asked you to provide a 2-tape DTM that checks if a string has the same number of 0s as 1s. Here is an answer: CourseNana.COM

; copy0: copies 0’s from tape#1 to tape#2
copy0 0 _ 0 0 R R copy0
copy0 1 _ * * R * copy0
copy0 _ _ * * L L compare
; compare: matches 1s on tape#1 with 0s on tape#2
compare 1 0 * * L L compare
compare 0 * * * L * compare
; same number
compare _ _ * * * * halt-accept
; more 1s than 0s
compare * _ * * * * halt-reject
; more 0s than 1s
compare _ * * * * * halt-reject

comp2022/2922 A3 (90 marks) – Turing Machines s2 2023 CourseNana.COM

NB. The Morphett’s simulator only correctly simulates deterministic TMs. For nondeterministic TMs it resolves nondeterminism randomly, which is not what TMs do! Thus, you cannot rely on the simulator showing you all possible runs on a given input. CourseNana.COM

Problem 1. (20 marks) CourseNana.COM

  1. (5 marks) Is the complement of every context-free language Turing-decidable? Give a brief justification of your answer. CourseNana.COM

  2. (5 marks) Suppose that L is the intersection of a context-free language L1 and a regular language L2. Argue that L is in P. You may use any facts proven in the lecture slides. CourseNana.COM

  3. (5 marks) Fix Σ = {0,1}. Consider the operation dub that maps a string u to the string in which every 0 is replaced by 00. For a language L let dub(L) = {dub(u) : u L}. CourseNana.COM

    For instance, if L = {10, 1001, 11, ε} then dub(L) = {100, 100001, 11, ε}, and ifL={0n1n :n0}thendub(L)={02n1n :n0}. CourseNana.COM

    Suppose that L is decidable. Give a high-level description of a decider for dub(L). CourseNana.COM

  4. (5 marks) Consider the language L consisting of the set of strings (SourceM1,SourceM2,SourceM3) such that L(M1) is not regular, L(M2) is not regular, and L(M1) L(M2) = L(M3). CourseNana.COM

    Show that L is undecidable. You may only use facts from the lecture slides to do so, e.g., that the acceptance problem TMs is undecidable. CourseNana.COM

Problem 2. (10 marks) Below is a NTM over input alphabet {a, b}. CourseNana.COM

  1. (5 marks) Describe in one sentence the language that it accepts. Briefly justify your answer. No marks will be awarded for describing how the TM operates. CourseNana.COM

  2. (5 marks) What is the asymptotic time complexity (aka running time) of the NTM? Give your answer in big-Theta notation, and briefly explain your answer. CourseNana.COM

; initial state is 0
; input alphabet is {a,b}

0aaR0 0bbR0 0aAL1 CourseNana.COM

1**L1 1__R2 CourseNana.COM

2AAR4 CourseNana.COM

2 a _ R 2a
2a * * R 2a
2a A A R 2A
2A A A R 2A
2A a A L 1
2 b _ R 2b
2b * * R 2b
2b A A R 2B
2B A A R 2B
2B b A L 1

4AAR4
4 _ * * halt-accept
CourseNana.COM

Problem 3. (20 marks) Fix Σ = {0, 1}. CourseNana.COM

  1. (5 marks) Give a low-level implementation (in Morphett’s format) of a 1- tape DTM that decides the language consisting of strings of the form x1y where |x| = |y|. For instance, 1, 011, 10100 should be accepted, while ε, 0, 00, 000, 11, 11000 should be rejected. CourseNana.COM

  2. (5 marks) Give a low-level implementation (in Morphett’s format) of a 1- tape DTM that decides the language consisting of strings of the form x1x. For instance, 1,010,10110 should be accepted, while ε,0,00,000,11,10101 should be rejected. CourseNana.COM

  3. (10 marks) Give a low-level implementation (in Morphett’s format) of a 1- tape DTM that decides the language consisting of strings of the form xyxxz where x is non-empty. For instance, 1011, 000, 01110110110, 1001000010101 should be accepted, while ε, 0, 1101, 01101101, 0011101 should be rejected. CourseNana.COM

Problem 4. (20 marks) Following recent advances in interdimensional technol- ogy, a new type of Turing Machine has been developed, the portal Turing Machine (PTM). These machines have the remarkable power to use 0 symbols on the tape as portals, allowing them to traverse unbounded distances in a single step. (0 looks like a portal, you see.) CourseNana.COM

The semantics of a PTM are that when a machine is in a cell with a 0 and moves left or right, instead of moving one cell, it moves to the next 0 in that direction. CourseNana.COM

If there is no 0 in that direction, it ”wraps around” the tape and moves to the 0 furthest in the other direction (eg. from the leftmost 0, a ”move left” instruction moves to the rightmost 0). If there is only one 0 on the entire tape, a move left or move right instruction causes it to stay put. Note that in each step, the write instruction is executed before the movement instruction (since this may affect whether a 0 is present when moving). CourseNana.COM

As a high ranking member of the Church of Turing, you want to uphold your Thesis by showing that these new devices are equivalent in computational power to traditional TMs. CourseNana.COM

1. (10 marks) Write a program to convert a basic TM into an equivalent PTM. 2. (10 marks) Write a program to convert a PTM into an equivalent basic TM. CourseNana.COM

Input will be a machine with input alphabet {0, 1}, tape alphabet {0, 1, , 2, 3}, all states other than the two halting-states (”halt-reject” and ”halt-accept”) are of the form 0, 1, 2, · · · , 9 (i.e. states are single digit numbers and there are at most 10 non-halting states). Your output should be a machine with the same input alphabet. The tape alphabet may be larger. Input and output machines are both expected in Morphett’s format. Particularly, your output should start with the state named 0 (zero). CourseNana.COM

For full marks, your simulating machines should have at most 100 states and be reasonably efficient. Public tests and guidelines will be provided to judge this efficiency. CourseNana.COM

Problem 5. (20 marks) CourseNana.COM

Build a 2-tape DTM S that takes as input an automaton A over input alphabet {0,1,#} on tape 1, and a string u ∈ {0,1}+ on tape 2, and accepts if u L(A), and rejects otherwise. The TM S should run in polynomial time. CourseNana.COM

The input string u is guaranteed to be non-empty, but is otherwise an arbitrary string the alphabet {0, 1}. CourseNana.COM

The states of our automata are denoted q1, q2, · · · , qn for some n. The initial state is q1, and qn is the only final state (for simplicity). The automaton has no epsilon transitions. Such an automaton will be represented as a string over input alphabet {0,1,#} as follows. The string encoding the automaton is of the form u1u2 . . . un where each ui is of the form #vi,1#vi,2# . . . #vi,n# where each vi,j ∈ {00, 01, 10, 11} is defined as follows: the first bit of vi,j is 1 iff the automaton has a transition from qi to qj on symbol 0, and the second bit of vi,j is 1 iff the automaton has a transition from qi to qj on symbol 1. CourseNana.COM

You can assume that the input string to your TM is an encoding of an automaton, i.e., the string matches the regular expression (#((0|1)2#)n)n for some n. Subject to this syntactic requirement, the automaton is otherwise arbitrary. CourseNana.COM

For example, the string CourseNana.COM

CourseNana.COM

#11#10#00##00#00#01##00#00#11# encodes the following NFA:
CourseNana.COM

0,1 0,1 q0q1q CourseNana.COM

start 1 2 3 CourseNana.COM

For full marks, your TM should have at most 100 states and be reasonably effi- cient. Public tests and guidelines will be provided to judge this efficiency. CourseNana.COM

Your TM should be written in the extension of Morphett’s format to 2-tape ma- chines (described above). CourseNana.COM

10 marks are when A is a DFA, and 10 marks are when A is an NFA. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Sydney代写,Models of Computation代写,comp2022代写,comp2922代写,Turing Machines代写,Deterministic Turing Machine代写,Nondeterministic Turing Machine代写,Morphett’s simulator代写,Sydney代编,Models of Computation代编,comp2022代编,comp2922代编,Turing Machines代编,Deterministic Turing Machine代编,Nondeterministic Turing Machine代编,Morphett’s simulator代编,Sydney代考,Models of Computation代考,comp2022代考,comp2922代考,Turing Machines代考,Deterministic Turing Machine代考,Nondeterministic Turing Machine代考,Morphett’s simulator代考,Sydneyhelp,Models of Computationhelp,comp2022help,comp2922help,Turing Machineshelp,Deterministic Turing Machinehelp,Nondeterministic Turing Machinehelp,Morphett’s simulatorhelp,Sydney作业代写,Models of Computation作业代写,comp2022作业代写,comp2922作业代写,Turing Machines作业代写,Deterministic Turing Machine作业代写,Nondeterministic Turing Machine作业代写,Morphett’s simulator作业代写,Sydney编程代写,Models of Computation编程代写,comp2022编程代写,comp2922编程代写,Turing Machines编程代写,Deterministic Turing Machine编程代写,Nondeterministic Turing Machine编程代写,Morphett’s simulator编程代写,Sydneyprogramming help,Models of Computationprogramming help,comp2022programming help,comp2922programming help,Turing Machinesprogramming help,Deterministic Turing Machineprogramming help,Nondeterministic Turing Machineprogramming help,Morphett’s simulatorprogramming help,Sydneyassignment help,Models of Computationassignment help,comp2022assignment help,comp2922assignment help,Turing Machinesassignment help,Deterministic Turing Machineassignment help,Nondeterministic Turing Machineassignment help,Morphett’s simulatorassignment help,Sydneysolution,Models of Computationsolution,comp2022solution,comp2922solution,Turing Machinessolution,Deterministic Turing Machinesolution,Nondeterministic Turing Machinesolution,Morphett’s simulatorsolution,