## Assignment 2: Computability

### 1 Overview

This assignment requires you to demonstrate your knowledge of some key issues in computability, and of non-determinism. There is also a part which deals with the Platypus game.

### 2 Assessment details 计算理论代写

The Dwarves of the Lonely Mountain have a lot of time on their hands, and are very worried about information about the size of their horde of gold getting around various parts of Middle-Earth, as they fear invasion by all and sundry if any hint of their true wealth were to be revealed. Accordingly King Durin XIII decrees that all records are to be written only in encrypted Khuzdul, in which there are 32 distinct characters. The encryption process is based on a Khuzdul keyword of n characters in length. Durin’s advisors inform him that an evil wizard with an army of orc-slaves at his disposal (or a few of the lesser intelligent hobbits :-)) could exhaustively search through all possible keywords at a rate of 100,000 keywords per day. Durin decrees that the royal Khuzdul keyword must be secure ”until the end of the age”.

(a) Determine an appropriate interpretation of Durin’s statement ”until the end of the age”. In other words, defifine what you think this means and hence what the maximum such time would be. (2 marks)

(c) Sillibo, a passing hobbit, happens to point out to Durin that not all of the 32 Khuzdul characters are equally likely to be used, as there are 18 that are only used very rarely. Hence an outsider might concentrate on the other 14 and make signifificant progress. Assuming Sillibo is correct, calculate how long it would take an evil wizard to discover a Khuzdul keyword of length given inyour previous answer, assuming that at most 14 difffferent Khuzdul characters are used in the keyword. (2 marks)

(d) Sillibo also tells Durin, who is very impressed with the hobbit’s knowledge, that the royal keyword should not include a Khuzdul translation of the name ”Arkenpebble” (a famous jewel revered by all dwarves), as this is very well known to all in Middle-Earth, and hence will certainly be known to any evil wizard. Given the translation of Arkenpebble into Khuzdul uses 6 characters, evaluate Sillibo’s claim. In other words, is the royal keyword still as secure as Durin would like if it does contain the translation of Arkenpebble and the evil wizard correctly guesses this. (2 marks)

1. ### Computability

(14 marks)

The generalised 3-player Platypus game is defifined as follows. Let M1, M2, and M3 be Turing machines, which share the same tape. The tape is initially blank. The initial confifiguration of the three machines is as shown below.

As in the Platypus game, each machine takes turns to move (but there is no scoring involved).

(a) Show that the halting problem for the 3-player generalised Platypus game is undecidable. You may use any reduction you like. (6 marks)

(b) Suppose the 3-player generalised Platypus game is played on a Turing machine with a fifinite tape (making the halting problem decidable), and that this problem has been shown to be NP-complete. Given your above reduction from some problem A to the 3-player generalised Platypus game, can this reduction be used to conclude that A is NP-complete? Why or why not? Explain your answer. (2 marks)

(c) Consider the two Turing machines M1 and M2 below.

M1: Whatever the input is, M1 overwrites each character in the input, resulting in a totally blank tape. M1 then terminates.

M2: Given an input string w, M2 outputs another Turing machine Mw which will take a blank tape as input, print w on the tape and then terminate. Explain how these two Turing machines are used in at least three reductions of the Halting problem to other undecidable problems. (6 marks)

#### 3.Nondeterminism   (8 marks)

Consider the incomplete NFA M0 below, whose alphabet is {0, 1}.

Use M0 to create three more NFAs M1, M2 and M3 according to the constraints below. Explain in one or two English sentences how you constructed each NFA. 计算理论代写

•  Each of M1, M2 and M3 must contain at least 10 transitions (potentially but not necessarily including λ-transitions) and must be an NFA but not a DFA. Specififically there must be at least one combination of state and input (either 0 or 1) for which there are at least two possible states. Put another way, removing all λ-transitions must not result in a DFA.
•  Use JFLAP to transform M1, M2 and M3 into equivalent DFAs.
• The sizes of the DFA resulting from the determinising algorithm must be as below. Note that the JFLAP implementation of this often omits an “error” state, i.e. it may be necessary to add an extra state to the result from JFLAP in order to account for this. The size constraints below assume a fully deterministic DFA; one way to check for this is that if the DFA has k states, there must be exactly 2k transitions (one for each of 0 and 1 in each state).

(a) The size of the DFA corresponding to M1 is 2.   (3 marks)

(b) The size of the DFA corresponding to M2 is 5   (2 marks)

(c) The size of the DFA corresponding to M3 is at least 9 (this may be harder than you think!) (3 marks)

1. #### Pumping Lemma (20 marks) 计算理论代写

(a) There are three errors in the statement of the Pumping Lemma for regular languages below. Find all three, and state how to correct them. Explain each of your corrections. (4 marks)

Let L be a regular language. Then n 1 such that for some w L such that |w| ≥ n, x, y, z such that w = xyz where

(b) One fifine day, as soon as lockdown was over, Elladan and Elrohir talk an afternoon walk in the gardens of Lothlorien. While contemplating the meaning of existence underneath the massive ancient trees, they come across ten pieces of parchment, which appear to have been hastily ripped up during the recent War of the Ring, on which are written some strange runes that they cannot read. Desperate to fifind out what these mean, they send the fragments to Imladris for analysis, where the wisest still in Middle Earth would be found. After several anxious weeks, a passing eagle delivers a package to them.

Inside they fifind a letter from Elrond himself, explaining that despite their best efffforts, they were unable to fully translate the runes, and so there are some places where there are several possible translations of particular phrases. Elladan and Elrohir therefore have two tasks. The fifirst one is to arrange the fragments in the most likely order. Then they have to select from each of the possible translations so that the overall message makes sense.

The fragments are below, with the parts where there are alternative transla tions labelled with capital letters, like this: 计算理论代写

(Translated text) A (Translated text)

A1: Alternative 1

A2: Alternative 2

A3: Alternative 3

#### You do not need to write the proof out in full. Just indicate the fragment order and your choice for each of the letters in a sequence like the one below.

9K2 8J3 4E4 … (6 marks)

(c) Let L be any regular language and let M be a DFA for it with n states. Explain how you can use the Pumping Lemma to show that L is infifinite iffff there is a string w L such that n ≤ |w| ≤ 2n 1. (4 marks)

(d) Let L be any regular language over {a, b, c}. Show how the Pumping Lemma can be used to demonstrate that in order to determine whether or not L is empty, we need only test at most (3n 1)/2 strings. (2 marks)

(e) The Pumping Lemma for context-free languages is below.

Let L be a context-free language. Then there is an n 1 such that for any  string w L with |w| ≥ n there exists strings x, y, z, u, v such that w = xyzuv

and

i.|yzu| ≤ n

ii.|y| + |u| > 0

iii. xyi zuiv L for all i 0

Use this to show that the language L = {ai2+i | i 0} is not context-free by fifilling in the gaps below. (4 marks) 计算理论代写

#### xyzuv and

i.|yzu| ≤ n

ii.|y| + |u| > 0

iii. xyi zuiv L for all i 0

Let_______. So w L and |w| ≥ n, and w = xyzuv, |yzu| ≤ n, |y| + |u| > 0 and xyi zuiv L for all i 0. Now as , this means |yzu| = |y| + |z| + |u| ≤ n and so |y| + |u| ≤ n.

Let i = 0 and consider |xy0 zu0v| = |xzv| = −|y| − |u| = n2 + n −  (|y| + |u|) n2 + n n >  = (n 1)2 + (n 1). So n2 + n = > |xy0 zu0v| > (n 1)2 + (n 1), and so xy0 zu0v 6∈ L. This is a contradiction, and so L is not context-free.

1. #### Intractable problems (10 marks) 计算理论代写

Intractable problems are decidable problems, but for which the best known solution is exponential (or worse). Describe two intractable problems and their practical 5application. You should write one introductory paragraph on intractable problems, and two further paragraphs, one on each problem, and a reason that you selected each one. Some suggestions will be given in class and on Canvas.

Please note that I am not at all interested in what you can fifind on Google or Wikipedia or anything like that. What I really want to see is some evidence of you thinking about intractable problems and what effffect these have, such as the relationship between the vertex cover problem and sensor networks.

Perhaps an interesting way to address this is to consider what difffferences it would make if your intractable problem could be solved effiffifficiently. For example, if we could solve say the Travelling Salesperson problem in O(nn ) time, what would be possible that is impossible now?

Another possibility is to consider how intractability can be a useful thing, such as keeping information secure in cryptosystems or in related applications such as blockchain.

Whatever problems you choose, please avoid the temptation to ’cut, copy and edit’; as soon as you do that, you have done something wrong. I would far prefer to read your own words and your own perspective on these problems.

1. #### Universality (24 marks) 计算理论代写

In a nutshell, you are expected to revise and extend your work on this topic in Assignment 1.

In Assignment 1, you investigated one of the following three topics, or came up with your own related topic or creative story.

• Two-dimensional Turing machines
• Small universal Turing machines
•  Notable universal Turing machines

For this assignment, you are expected to either continue your investigation from Assignment 1 on the same topic in more depth, or to make a  difffferent choice. In other words, you can either continue with your choice from Assignment 1, or make a difffferent one now. Whatever your decision, you are expected to write about 1800-2000 words (9 or 10 paragraphs) overall. This should include a revised version of your Assignment 1 submission, so that if you continue with the same choice as in Assignment 1, this is will be an extended form of that work. If you make a difffferent choice, that is fifine, but you should include your (potentially revised) Assignment 1 submission as part of this submission.

#### So you have two difffferent choices for the two assignments, you are expected to write about the same length on each; if you have the same choice for each, you should write about 1800-2000 words overall. Either way, the submission for Assignment 2  will involve around 1000 words over and above what you submitted for Assignment 1.

As in Assignment 1, you may also propose an alternative topic, or write a creative  story involving a Turing machine of some kind. You can do this even if you did not choose either of these in Assignment 1. However, for any alternative topic or  creative story, please seek approval from the lecturer before commencing  6work on it. This is to make sure that what you are doing is appropriate for this assignment — I would hate to see an outcome where you do a lot of work, only for it not to count because it does not address the intended content. 计算理论代写

One alternative topic of particular interest is quantum computing; if anyone is interested in pursuing this, you are strongly encouraged to do so (but as above, please do consult me fifirst). Another possibility is zero-knowledge proofs, but again please consult me before doing this.

#### A further point is that you can present your information in other ways  that a formal report if you wish. Some suggestions are below. Please keep in mind that you still need to discuss the technical content; the point is to fifind a way that assists you with this, rather than being a blockage for you.

•  Pick a side in the debate about the 2007 universal TM competition
•  Langton’s Ant vs Paterson’s worm
• ‘Cellular automata are better than Turing machines’
• Write a children’s story, movie scene, poem, . . .
• 2D TMs as a game, map, drawing a picture, annotating photos, . . .
• Implementation of some aspects (be careful of rabbit holes!)
• Experiment with Java implementation of 2D Universal TM
• Langton’s ant with ‘boundaries’ (see an example here)

You will be marked according to the rubric below.

1. #### The Platypus game. (16 marks)

We have previously talked about running as large a tournament as possible with the Platypus game. The way we will do this in this assignment is for each of your to run a tournament of 2,500 machines. From these, you will report your top 10 machines (see below for details). These 10 will then be part of a knock-out tournament to determine the overall winner. Before answering the questions below, do the following.

• Get your allocation of 2,500 machines. These will in a OneDrive directory that will be shared with you. Once you have the link, look for a fifile in the folder with your student number, i.e. if your student number is 7654321, look for the fifile 7654321.pl. Store this somewhere that suits you with a name like machines.pl for convenience.
• Open a new SWI-Prolog shell and consult both platypus.pl and machines.pl (or whatever you called it). Then run the command below. This will classify your list of machines into three categories, and will generate one fifile each cate gory named none.pl, reachable.pl and unreachable.pl, as per the description below. This will be in the directory specifified by the results directory predicate in platypus.pl; you can change this to something more convenient for you if you like.

#### ?- classify machines. 计算理论代写

None    The machine has no platypus state in the fourth row of columns 1-6

Reachable    It is possible reach the platypus state from the kangaroo state

Unreachable    It is not possible reach the platypus state from the kangaroo state

The point of this analysis is to work out whether it is possible for the machine to terminate the game or not. An example of each class of machine is below. In the fifirst case, the machine cannot terminate the game, as it is not possible for it to go from the start state (kangaroo) to the platypus state as there is no transition that will move the machine into the platypus state.

The second and third cases occur when there is indeed such a platypus state. When it is possible to move from the kangaroo state to the platypus state (depending on the cells on the tape of course), then the machine is classifified as reachable, as in the machine below. This is because it is possible to move from the kangaroo state to the emu state (column 1 or 2), from the emu state to the wombat state (column 3) and from the wombat state to the platypus state (column 6).

#### It is also possible that even if such a platypus state exists, it is not possible to move into that state from the kangaroo state. In this case, the machine is classifified as unreachable, as in the machine below. In this machine we can get from the kangaroo state to the wombat state and vice-versa, but we can never get to the emu state or platypus state from either of these.

Intuitively, machines classifified as reachable are in some sense “genuine” with the others being “imposters”. Accordingly, having separate tournaments for each seems only fair.

• Run a tournament for each of the following classes of machines

All 2,500 machines

Only machines classifified as reachable

Only machines classifified none or unreachable (ie all those not classifified as reachable).

To do this, you will fifirst have to prepare a fifile containing only the machines as above (the above classify machines command will more or less do this for you). You will also need to use the command below, which will run the tournament with all of the options below.

#### ?- my tournament([competition]). 计算理论代写

Variation Description

Tree     5 points for whenever either tree is reached

Green     2 points rather than 1 for changing green to yellow

Animal      1 point every time a change of animal occurs

Tiebreaker    A random starting confifiguration is chosen with game length is 200

(a) For each of your tournaments, report the overall time taken, the top 10 machines (by ’football’ ranking), the overall number of wins and draws, and the number of winless machines. How many machines were classifified as none, reachable and unreachable respectively? Report your results in a table as below. (2 marks)

(b) Re-run your tournament of all machines, but this time you are to include 10 extra machines of your own choice. These should be difffferent from any machines in your list already, but otherwise you are free to choose them however you like.

You can use platypus.pl from Canvas (link here) to assist with this if you wish. This will check whether your 10 added machines are ’legal’, and whether or not they were already part of your allocation. To do this, consult platypus.pl and machines.pl as above, and a third fifile extra.pl. Then run the command

#### ?- check new. 计算理论代写

This will then output whether your added machines are legal, and whether they are already part of your allocation or not (and if they are, which ones are already in their allocation).

You should report where each of these 10 machines fifinish in the ’football’ ranking, and your reasons for choosing each of them. (2 marks)

(c) Were you surprised how your chosen 10 machines performed? What can you conclude from this about high performing Platypus machines? If you had to choose one machine to represent you in a tournament, what machine would it be? Brieflfly explain your decision. (4 marks)

(d) In the previous assignment, your calculated the largest Platypus tournament you can play on your machine in 4 hours, ie 4 × 60 × 60 = 14, 400 seconds. 计算理论代写

This is of course for the ’standard’ 2-player game. 3-player and 4-player tournaments will of course take longer. Calculate the largest 3- and 4-player tournaments you can play on your machine in 4 hours. You may assume that a 3-or 4-player match takes the same time as a 2-player one. You may also fifind the following table useful (see the notes on 3- and 4-player tournaments for how these are derived). (2 marks)

#### (e) If the Platypus tournament were to be run again, what alterations would you recommend? Some ideas are below; you can add others as you see fifit. You should have at least three suggestions. (6 marks)

• Once students are allocated their machines, they play a tournament amongst these to fifind the best 10. These 10 then take on the best 10 from other students. This could include the possibility of students choosing their 10 machines from their allocation or from the set of machines which are not allocated to any student.
• The initial tape and scoring processes are changed from tournament to tournament. These are announced in advance, and allow choices to be made for which machines will be used.
• Non-player machines can be added. These are not competitors, but may change the tape in ways that inflfluence the game. Such machines would not be allowed to terminate the game (presumably by allowing them tran sitions for a green cell with a platypus).
• When a player has a platypus on a green cell, the game does not halt, but is “rebooted”, i.e. the tape reverts to its initial state, the player which ’halted’ the game gets a bonus or a penalty, and the machines involved are changed in some way. This change could be swapping rows 3, 4 and 5 of column 1 and 2 (kangaroo), and the same for columns 3 and 4 (emu) and 5 and 6 (wombat). There could be a maximum of say 5 reboots per game.

### 3 Submission 计算理论代写

You should submit a PDF fifile, and all tournament.csv fifiles from your tournaments. Do

not use a zip fifile. Just add attach all relevant fifiles to the submission on Canvas.

No other fifile formats will be accepted.

In addition, for Questions 4b and 4e, you must fifill in your answers on the Canvas Quiz here. As noted in announcements, this will assist with marking assignments more quickly.

### 4 Marking guidelines 计算理论代写

Your assessment will be marked according to the criteria below.

•  Completeness and accuracy of your answers to the fifirst fifive questions.
• Completion of your section of the Platypus game tournament.