Binary file cws/cw01.pdf has changed
--- a/cws/cw01.tex Sun Sep 10 12:24:55 2023 +0100
+++ b/cws/cw01.tex Fri Sep 15 10:49:33 2023 +0100
@@ -2,6 +2,7 @@
\documentclass{article}
\usepackage{../style}
\usepackage{../langs}
+\usepackage[normalem]{ulem}
\usepackage{array}
@@ -17,19 +18,24 @@
containing the answers for the questions below. You can do the
implementation in any programming language you like, but you need to
submit the source code with which you answered the questions,
-otherwise a mark of 0\% will be awarded. You can submit your answers
-in a txt-file or pdf. Code send as code. Please package everything
-inside a zip-file that creates a directory with the name
-\[\texttt{YournameYourfamilyname}\]
+otherwise a mark of 0\% will be awarded. You need to submit your written
+answers as pdf---see attached questionaire. Code send as code. If you use
+Scala in your code, a good place to start is the file \texttt{re3.sc}
+that is uploaded to Github.
-\noindent on my end. Thanks!
+%Please package everything
+%inside a zip-file that creates a directory with the name
+%\[\texttt{YournameYourfamilyname}\]
+%
+%\noindent on my end. Thanks!
\subsubsection*{Disclaimer\alert}
It should be understood that the work you submit represents
-your \textbf{own} effort. You have not copied from anyone else. An
+your \textbf{own} effort. You have not copied from anyone else
+including CoPilot, ChatGPT \& Co. An
exception is the Scala code I showed during the lectures or
uploaded to KEATS, which you can freely use. Do not
be tempted to ask Github Copilot for help or do any other
@@ -37,7 +43,7 @@
\noindent
If you have any questions, please send me an email in \textbf{good}
-time.\bigskip
+time!\bigskip
\subsection*{Task}
@@ -123,7 +129,7 @@
\subsection*{Question 1 (Unmarked)}
What is your King's email address (you will need it in
-Question 5)? Also could you please let me know whether you are
+Question 5)? Also, could you please let me know whether you are
a BSc / MSci and the year you are in (in case of MSci). Thanks!
@@ -136,39 +142,11 @@
\subsection*{Question 3}
-From the
-lectures you have seen the definitions for the functions
+From the lectures you have seen the definitions for the functions
\textit{nullable} and \textit{der} for the basic regular
-expressions. Implement and \underline{write down} the rules for the extended
-regular expressions:
+expressions. Implement and \underline{write down} the rules for the
+extended regular expressions (see questionaire at the end).
-\begin{center}
-\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
- $\textit{nullable}([c_1,c_2,\ldots,c_n])$ & $\dn$ & $?$\\
- $\textit{nullable}(r^+)$ & $\dn$ & $?$\\
- $\textit{nullable}(r^?)$ & $\dn$ & $?$\\
- $\textit{nullable}(r_1 \,\&\, r_2)$ & $\dn$ & $?$\\
- $\textit{nullable}(r^{\{n\}})$ & $\dn$ & $?$\\
- $\textit{nullable}(r^{\{..m\}})$ & $\dn$ & $?$\\
- $\textit{nullable}(r^{\{n..\}})$ & $\dn$ & $?$\\
- $\textit{nullable}(r^{\{n..m\}})$ & $\dn$ & $?$\\
- $\textit{nullable}(\sim{}r)$ & $\dn$ & $?$
-\end{tabular}
-\end{center}
-
-\begin{center}
-\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
- $der\, c\, ([c_1,c_2,\ldots,c_n])$ & $\dn$ & $?$\\
- $der\, c\, (r^+)$ & $\dn$ & $?$\\
- $der\, c\, (r^?)$ & $\dn$ & $?$\\
- $der\, c\, (r_1 \,\&\, r_2)$ & $\dn$ & $?$\\
- $der\, c\, (r^{\{n\}})$ & $\dn$ & $?$\\
- $der\, c\, (r^{\{..m\}})$ & $\dn$ & $?$\\
- $der\, c\, (r^{\{n..\}})$ & $\dn$ & $?$\\
- $der\, c\, (r^{\{n..m\}})$ & $\dn$ & $?$\\
- $der\, c\, (\sim{}r)$ & $\dn$ & $?$\\
-\end{tabular}
-\end{center}
\noindent
Remember your definitions have to satisfy the two properties
@@ -325,7 +303,7 @@
to not introducing any other character.
\begin{enumerate}
-\setcounter{enumi}{4}
+\setcounter{enumi}{0}
\item \texttt{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
@@ -337,7 +315,127 @@
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
\end{enumerate}
+\newpage
+\section*{Answers}
+\mbox{}
+
+\noindent
+\textbf{Name:}\uline{\hfill}\bigskip
+
+\noindent
+\textbf{BSc / MSci \hspace{2cm} Year:\uline{\hspace{2cm}}}\bigskip
+
+\noindent
+\textbf{Programming Languages:}\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\bigskip\bigskip
+
+\noindent
+\textbf{Question 3:}
+
+\begin{center}
+\def\arraystretch{1.6}
+\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
+ $\textit{nullable}([c_1,c_2,\ldots,c_n])$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(r^+)$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(r^?)$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(r_1 \,\&\, r_2)$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(r^{\{n\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(r^{\{..m\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(r^{\{n..\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(r^{\{n..m\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $\textit{nullable}(\sim{}r)$ & $\dn$ & \uline{\hspace{8cm}}\\
+% \\
+\end{tabular}
+\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
+ $der\, c\, ([c_1,c_2,\ldots,c_n])$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $der\, c\, (r^+)$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $der\, c\, (r^?)$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $der\, c\, (r_1 \,\&\, r_2)$ & $\dn$ & \uline{\hspace{8cm}}\\
+ $der\, c\, (r^{\{n\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $der\, c\, (r^{\{..m\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $der\, c\, (r^{\{n..\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $der\, c\, (r^{\{n..m\}})$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ $der\, c\, (\sim{}r)$ & $\dn$ & \uline{\hspace{8cm}}
+\end{tabular}
+\end{center}\bigskip
+
+
+\noindent
+\textbf{Question 4:}
+
+\begin{center}
+\def\arraystretch{1.6}
+\begin{tabular}{@ {}r@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
+ $\textit{nullable}(CFUN(f))$ & $\dn$ & \uline{\hspace{8cm}}\\
+ \\
+ $der\, c\, (CFUN(f))$ & $\dn$ & \uline{\hspace{8cm}}\\
+ & & \uline{\hspace{8cm}}\\
+ \\
+ \\
+ $c$ & $\dn$ & \textit{CFUN}(\uline{\hspace{7cm}})\medskip\\
+ $[c_1,c_2,\ldots,c_n]$ & $\dn$ & \textit{CFUN}(\uline{\hspace{7cm}})\medskip\\
+ $\textit{ALL}$ & $\dn$ & \textit{CFUN}(\uline{\hspace{7cm}})\medskip\\
+\end{tabular}
+\end{center}
+
+\newpage
+
+\noindent
+\textbf{Question 5 (`mathematical' notation):}
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\bigskip\bigskip
+
+\noindent
+\textbf{Question 6:}\medskip
+
+\noindent
+\textbf{1)}\; Yes / No\qquad
+\textbf{2)}\; Yes / No\qquad
+\textbf{3)}\; Yes / No\qquad
+\textbf{4)}\; Yes / No\bigskip\bigskip
+
+
+\noindent
+\textbf{Question 7:}\medskip
+
+\def\arraystretch{1.5}
+\begin{tabular}{l|c|c}
+ & $\quad{}r_1\quad$ & $\quad{}r_2\quad$\\\hline
+ 1. & & \\\hline
+ 2. & & \\\hline
+ 3. & & \\
+\end{tabular}
\end{document}
Binary file cws/cw02.pdf has changed
--- a/cws/cw02.tex Sun Sep 10 12:24:55 2023 +0100
+++ b/cws/cw02.tex Fri Sep 15 10:49:33 2023 +0100
@@ -2,6 +2,7 @@
\documentclass{article}
\usepackage{../style}
\usepackage{../langs}
+\usepackage[normalem]{ulem}
\begin{document}
@@ -12,19 +13,22 @@
WHILE language. You can do the implementation in any programming
language you like, but you need to submit the source code with which
you answered the questions, otherwise a mark of 0\% will be
-awarded. You can submit your answers in a txt-file or as pdf. Code
-submit as code. Please package everything in a zip-file that creates a
-directory with the name \texttt{YournameYourfamilyname} on my end. Thanks!
+awarded. You need to submit your written
+answers as pdf---see attached questionaire. Code send as code. If you use
+Scala in your code, a good place to start is the file \texttt{re3.sc}
+that is uploaded to Github.
\subsection*{Disclaimer\alert}
It should be understood that the work you submit represents
-your own effort. You have not copied from anyone else. An
+your own effort. You have not copied from anyone else
+including CoPilot, ChatGPT \& Co. An
exception is the Scala code from KEATS and the code I showed
during the lectures, which you can both freely use. You can
-also use your own code from the CW~1. But do not
-be tempted to ask Github Copilot for help or do any other
-shenanigans like this!
+also use your own code from the CW~1.
+%But do not
+%be tempted to ask Github Copilot for help or do any other
+%shenanigans like this!
\subsection*{Question 1}
@@ -132,7 +136,8 @@
this you need to implement the functions $nullable$ and $der$
(you can use your code from CW~1), as well as $mkeps$ and
$inj$. These functions need to be appropriately extended for
-the extended regular expressions from Q1. Write down the
+the extended regular expressions from Q1. Write down in the
+questionaire at the end the
clauses for
\begin{center}
@@ -217,6 +222,45 @@
between 1 and 100.\label{collatz}}
\end{figure}
+\clearpage
+\newpage
+\section*{Answers}
+
+\mbox{}
+
+\noindent
+\textbf{Question 2:}
+
+\begin{center}
+ \def\arraystretch{1.6}
+\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
+$mkeps([c_1,c_2,\ldots,c_n])$ & $\dn$ & \uline{\hspace{8cm}}\\
+$mkeps(r^+)$ & $\dn$ & \uline{\hspace{8cm}}\\
+$mkeps(r^?)$ & $\dn$ & \uline{\hspace{8cm}}\\
+$mkeps(r^{\{n\}})$ & $\dn$ & \uline{\hspace{8cm}}\bigskip\\
+$inj\, ([c_1,c_2,\ldots,c_n])\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\
+$inj\, (r^+)\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\
+$inj\, (r^?)\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\
+$inj\, (r^{\{n\}})\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\
+\end{tabular}
+\end{center}\bigskip
+
+\noindent
+Tokens for \code{"read n;"}\\
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+\noindent
+\uline{\hfill}\medskip
+
+
\end{document}
%%% Local Variables: