# HG changeset patch # User Christian Urban # Date 1696498265 -3600 # Node ID f85e784d3014903a9788378e0400a2a54c8ddb85 # Parent 91c20364402b03d3fa45bceb1801c247d344bf50 updated diff -r 91c20364402b -r f85e784d3014 hws/hw01.pdf Binary file hws/hw01.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw02.pdf Binary file hws/hw02.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw03.pdf Binary file hws/hw03.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw04.pdf Binary file hws/hw04.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw04.tex --- a/hws/hw04.tex Tue Oct 03 23:23:57 2023 +0100 +++ b/hws/hw04.tex Thu Oct 05 10:31:05 2023 +0100 @@ -95,35 +95,57 @@ } -\item \textbf{(Deleted)} Assume that $s^{-1}$ stands for the operation of reversing a - string $s$. Given the following \emph{reversing} function on regular - expressions - - \begin{center} - \begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l} - $rev(\ZERO)$ & $\dn$ & $\ZERO$\\ - $rev(\ONE)$ & $\dn$ & $\ONE$\\ - $rev(c)$ & $\dn$ & $c$\\ - $rev(r_1 + r_2)$ & $\dn$ & $rev(r_1) + rev(r_2)$\\ - $rev(r_1 \cdot r_2)$ & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\ - $rev(r^*)$ & $\dn$ & $rev(r)^*$\\ - \end{tabular} - \end{center} +%\item \textbf{(Deleted)} Assume that $s^{-1}$ stands for the operation of reversing a +% string $s$. Given the following \emph{reversing} function on regular +% expressions +% +% \begin{center} +% \begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l} +% $rev(\ZERO)$ & $\dn$ & $\ZERO$\\ +% $rev(\ONE)$ & $\dn$ & $\ONE$\\ +% $rev(c)$ & $\dn$ & $c$\\ +% $rev(r_1 + r_2)$ & $\dn$ & $rev(r_1) + rev(r_2)$\\ +% $rev(r_1 \cdot r_2)$ & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\ +% $rev(r^*)$ & $\dn$ & $rev(r)^*$\\ +% \end{tabular} +% \end{center} +% +% and the set +% +% \begin{center} +% $Rev\,A \dn \{s^{-1} \;|\; s \in A\}$ +% \end{center} +% +% prove whether +% +% \begin{center} +% $L(rev(r)) = Rev (L(r))$ +% \end{center} +% +% holds. - and the set - - \begin{center} - $Rev\,A \dn \{s^{-1} \;|\; s \in A\}$ - \end{center} +\item Construct a regular expression that can validate passwords. A + password should be at least 8 characters long and consist of upper- + and lower-case letters and digits. It should contain at least a + single lower-case letter, at least a single upper-case letter and at + least a single digit. If possible ise the intersection regular + expression from CW1, written $\_\&\_$, the bounded regular + expressions; you can also assume a regular expression written + \texttt{ALL} that can match any character. - prove whether + \solution{ + You can build-up the different constraints separately and then + use the intersection operator: - \begin{center} - $L(rev(r)) = Rev (L(r))$ + \begin{center} + \begin{tabular}{lll} + $ALL^{\{8..\}}$ & \;\&\; & $(ALL^*\cdot [a-z]\cdot ALL^*)$\\ + & \;\&\; & $(ALL^*\cdot [A-Z]\cdot ALL^*)$\\ + & \;\&\; & $(ALL^*\cdot [0-9]\cdot ALL^*)$\\ + \end{tabular} \end{center} - - holds. - + } + \item Assume the delimiters for comments are \texttt{$\slash$*} and \texttt{*$\slash$}. Give a regular expression that can recognise comments of the diff -r 91c20364402b -r f85e784d3014 hws/hw05.pdf Binary file hws/hw05.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw06.pdf Binary file hws/hw06.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw07.pdf Binary file hws/hw07.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw08.pdf Binary file hws/hw08.pdf has changed diff -r 91c20364402b -r f85e784d3014 hws/hw09.pdf Binary file hws/hw09.pdf has changed diff -r 91c20364402b -r f85e784d3014 slides/slides04.tex --- a/slides/slides04.tex Tue Oct 03 23:23:57 2023 +0100 +++ b/slides/slides04.tex Thu Oct 05 10:31:05 2023 +0100 @@ -279,7 +279,7 @@ OP:\\ \hspace{5mm}\texttt{"+"}, \texttt{"-"}\\ NUM:\\ -\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + {''0''}\\ +\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + {"0"}\\ NUMBER:\\ \hspace{5mm}NUM + (\texttt{"-"} $\cdot$ NUM)\\ \end{tabular}