
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




