# Theory of Computation

This is the first of two courseworks for Theory of Computation. On completing this
coursework, you should be able to:
• Read and write finite state automata (both deterministic and non-deterministic).
• Understand regular languages and regular expressions.
• Convert regular expressions to and from finite state automata.
• Recognise languages and apply arguments to show that a language is not regular,
including use of the pumping lemma.
• Create finite state transducers.
The subject matter follows lectures 1-3 (and associated class exercises).
Information
Module marks
This coursework is worth 15% of the Theory of Computation module mark. This
coursework is marked out of 100.
Solutions will be graded according to their correctness, including accuracy of the
representation and syntactic correctness.
i, the second j and the third k. The numbers are defined as follows:
1. x = ⎡(k+1)/2⎤. That is, add 1 to k and divide by 2 then take the ceiling (round up).
2. y = ⎡(j+1)/2⎤
3. z = ⎣k/5⎦+4. That is, divide k by 5, take the floor (round down) and add 4.
4. u = ⎡(j+1)/4⎤
5. v = ⎡(i+1)/2⎤
6. w = 6-y
For example, if your login was abcd036, then i = 0, j = 3, k = 6 and you would find that
x=4, y=2, z=5, u=1, v=1 and w=4.
Consider the incomplete NFSA (indeed disconnected), with Σ = {a,b,c}, represented as a
transition diagram below:
Complete this NFSA (to give NFSA V) by indicating start and accept states and adding
four transitions, as follows (where the values of x, y, z, u, v, w are as calculated above;
recall that ((s,α),t) is a transition from state s to state t, labelled with α):
1. x is the start state
2. y is the accept state
3. ((3,c),z)
4. ((4,c),u)
5. ((v,ε),w)
6. ((1,a),y)
Represent V as a transition diagram.
ii) Now take the NFSA V produced in part i) and transform it into a DFSA that accepts
the same language. It is not necessary to draw its transition diagram, a transition table
including an indication of start and accept states is enough.
[30 marks]
Question 2
Apply the algorithm contained in the proof of Kleene’s Theorem to construct a regular
expression that generates the language recognised by the NFSA V from Question 1. The
solution should clearly show each step of the process.
[25 marks]
4
Question 3
Suppose Σ is the last two letters in your login (if these are the same, that’s OK) and call
those letters α, β in the order in which they occur. Let i, j be the second and third digits
the following language:
{αnβjαn+iβ| n≥ 0}
For example, if Σ = {c,d} and i = 1, j = 2, then this language is {cnd2cn+1d| n≥ 0} and
ccddcccd is in the language, but ccdcccd, ccddccc, ccddccd are not.
Is your language regular? If so, give a regular expression for the language. If not,
demonstrate this using the Pumping Lemma for regular languages.
[25 marks]
Question 4
Recall that a finite state transducer (see Sipser, page 87) is like a deterministic FSA,
except that in addition to consuming input, each transition can produce an output.
Notationally, a transition looks like this:
where b is the consumed input and x is the output.
• An ant lives in a grid world, an n x m two-dimensional grid of cells. Within this grid
is a pheromone trail leading to the tree whose leaves are the ant’s food, each point of
the trail consists of one cell. The trail is continuous, with one spot being either to the
north, south, east of west of the next spot; no diagonals are allowed.
• The ant can detect what is straight ahead of it: either nothing [including the grid
boundary] (E), the trail (P) or the tree (T).
• If the ant detects the tree it moves forward one cell (F), then will remain in the same
place (S) forever.
• If the ant detects a trail cell, it moves forward one cell (F).
• If the ant detects empty it moves 90 degrees to the left (L) and again detects what is
ahead of it. If it again detects empty it will move 90 degrees to the right (R) twice
and again detect what is ahead of it.
• If the ant has detected empty ahead, to the left and to the right it remains in the
same place forever.
• You may assume that at any point the ant will be able to detect at most one cell in
the pheromone trail (there are no choices available).
• Using these rules the ant, initially at the west side of the grid facing east, can start at
the beginning of a pheromone trail and follow it to the tree. For example (where the
coloured cells are the trail, and the arrow is the ant pointing forwards

## Why US?

##### 100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

##### Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

##### Original Writing

We complete all papers from scratch. You can get a plagiarism report.

##### Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.