author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Tue, 28 Oct 2014 12:24:11 +0000 | |
changeset 292 | 7ed2a25dd115 |
parent 267 | a1544b804d1e |
child 294 | c29853b672fb |
permissions | -rw-r--r-- |
22 | 1 |
\documentclass{article} |
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
2 |
\usepackage{../style} |
22 | 3 |
|
4 |
\begin{document} |
|
5 |
||
6 |
\section*{Homework 2} |
|
7 |
||
8 |
\begin{enumerate} |
|
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
9 |
\item What is the language recognised by the regular expressions |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
10 |
$(\varnothing^*)^*$. |
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
11 |
|
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
12 |
\item Review the first handout about sets of strings and read the |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
13 |
second handout. Assuming the alphabet is the set $\{a, b\}$, decide |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
14 |
which of the following equations are true in general for arbitrary |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
15 |
languages $A$, $B$ and $C$: |
115
86c1c049eb3e
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
104
diff
changeset
|
16 |
|
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
17 |
\begin{eqnarray} |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
18 |
(A \cup B) @ C & =^? & A @ C \cup B @ C\nonumber\\ |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
19 |
A^* \cup B^* & =^? & (A \cup B)^*\nonumber\\ |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
20 |
A^* @ A^* & =^? & A^*\nonumber\\ |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
21 |
(A \cap B)@ C & =^? & (A@C) \cap (B@C)\nonumber |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
22 |
\end{eqnarray} |
104
ffde837b1db1
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
102
diff
changeset
|
23 |
|
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
24 |
\noindent In case an equation is true, give an explanation; otherwise |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
25 |
give a counter-example. |
104
ffde837b1db1
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
102
diff
changeset
|
26 |
|
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
27 |
\item Given the regular expressions $r_1 = \epsilon$ and $r_2 = |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
28 |
\varnothing$ and $r_3 = a$. How many strings can the regular |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
29 |
expressions $r_1^*$, $r_2^*$ and $r_3^*$ each match? |
104
ffde837b1db1
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
102
diff
changeset
|
30 |
|
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
31 |
\item Give regular expressions for (a) decimal numbers and for (b) |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
32 |
binary numbers. (Hint: Observe that the empty string is not a |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
33 |
number. Also observe that leading 0s are normally not written.) |
22 | 34 |
|
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
35 |
\item Decide whether the following two regular expressions are |
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
36 |
equivalent $(\epsilon + a)^* \equiv^? a^*$ and $(a \cdot b)^* \cdot |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
37 |
a \equiv^? a \cdot (b \cdot a)^*$. |
22 | 38 |
|
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
39 |
\item Given the regular expression $r = (a \cdot b + b)^*$. Compute |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
40 |
what the derivative of $r$ is with respect to $a$, $b$ and $c$. Is |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
41 |
$r$ nullable? |
22 | 42 |
|
43 |
\item Prove that for all regular expressions $r$ we have |
|
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
44 |
|
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
45 |
\begin{center} |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
46 |
$\textit{nullable}(r) \quad \text{if and only if} |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
47 |
\quad [] \in L(r)$ |
22 | 48 |
\end{center} |
49 |
||
258
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
50 |
Write down clearly in each case what you need to prove and |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
51 |
what are the assumptions. |
1e4da6d2490c
updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
132
diff
changeset
|
52 |
|
292
7ed2a25dd115
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
267
diff
changeset
|
53 |
\item Define what is meant by the derivative of a regular expressions |
267
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
54 |
with respoect to a character. (Hint: The derivative is defined |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
55 |
recursively.) |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
56 |
|
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
57 |
\item Assume the set $Der$ is defined as |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
58 |
|
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
59 |
\begin{center} |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
60 |
$Der\,c\,A \dn \{ s \;|\; c\!::\!s \in A\}$ |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
61 |
\end{center} |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
62 |
|
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
63 |
What is the relation between $Der$ and the notion of derivative of |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
64 |
regular expressions? |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
65 |
|
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
66 |
\item Give a regular expression over the alphabet $\{a,b\}$ |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
67 |
recognising all strings that do not contain any substring $bb$ and |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
68 |
end in $a$. |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
69 |
|
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
70 |
\item Do $(a + b)^* \cdot b^+$ and $(a^* \cdot b^+) + (b^*\cdot b^+)$ define |
a1544b804d1e
updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
258
diff
changeset
|
71 |
the same language? |
22 | 72 |
\end{enumerate} |
73 |
||
74 |
\end{document} |
|
75 |
||
76 |
%%% Local Variables: |
|
77 |
%%% mode: latex |
|
78 |
%%% TeX-master: t |
|
79 |
%%% End: |