Comp3702 - ps1
Comp3702 - ps1
Instructions: There are three problems on this assignment, worth a total of 50 points. You
should attempt all problems.
For a string x, let [x]k denote the integer value of x treated as a number written in base k.
For example [101]2 = 5 and [0210]3 = 21. For any k, We define []k = 0.
When asked to present an FA, unless explicitly asked, you do not need to prove that your FA
is correct, but you should, instead, provide a brief explanation of how it was designed, and
an argument for its correctness by describing what the states accomplish (including why only
the appropriate strings end in accepting states). If you wish you may offer a proof sketch, if
you feel comfortable doing so. Do not tell me what it does on each transition – I can read
that from the diagram.
Let
A = {[uv] ∈ Σ∗2 | [v]2 = 5[u]2 }
Show that A is regular. [10]
b. The finite field of size 2, denoted F2 contains only two members 0 and 1. The polynomial ring
F2 [x] is the set of all polynomials in x that have coefficients from F2 . Addition, subtraction
and multiplication in F2 [x] works just like it would with a usual polynomial with rational
coefficients. Importantly though, coefficients are never allowed to leave the field F2 , so they
are always reduced modulo 2. So, for example, in F2 [x], adding x2 + x and x + 1 gives x2 + 1
and not x2 + 2x + 1 (since 2x is equivalent to 0x in F2 [x]). For any w ∈ {0, 1}∗ , where
w = wn−1 . . . w1 w0 , let p(w) represent the polynomial wn−1 xn−1 + . . . + w1 x + w0 in F2 [x].
Show that
B = {w ∈ {0, 1}∗ | p(w) is divisible by x2 + x + 1 in F2 [x]}
COMP3702–Theory of Computation, Sem II, 2023—Assignment 1 2
a. Use the GNFA method to obtain an equivalent regular expression for the language recognised
by the NFA given in Figure 1. [10]
0
s0 s2
1 0 1
0
0
s1
a. Recall in class the discussion that for a given NFA, N1 = hQ, Σ, δ, q1 , F i, if we wanted to
construct an NFA, N , such that L(N ) = L(N1 )∗ then it was necessary to create a new start
state q0 that was also an accepting state. Then we added -transitions from q0 to q1 and from
each state of F back to q0 .
A student proposes omitting q0 and simply putting -transitions from F back to q1 and making
q1 be an accepting state so that N would accept . Explain why q0 is necessary by providing
a counter example to the student’s proposed construction. (That is, present an NFA N1 such
that the student’s proposed NFA N does not recognise the appropriate language. Note in
showing that the NFA recognises the wrong language, you need to present a string that it
either should accept, but doesn’t or vice-versa.) [7]
b. (i) Given DFAs DA and DB , that recognise languages A and B respectively, give a direct
construction for a DFA D that accepts strings that are either in both A and B or in
neither. Give a brief “proof” that your construction is correct. [8]
(ii) Use the result from the previous part to construct a DFA that accepts all and only
strings that either contain two consecutive 0’s or two consecutive 1’s or neither. [5]
1
CRC checksums are defined by treating the data as a polynomial in F2 [x] and obtaining their residue modulo
some fixed irreducible polynomial.