cws/cw01.tex
changeset 918 53e7da9f372a
parent 907 8160c55991b9
child 938 91c20364402b
--- 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}