# HG changeset patch # User Christian Urban # Date 1760168015 -3600 # Node ID 674d1258a2fb5057afab4dcd92e6ba5acaeae5c3 # Parent 970ddba0d72e64aff4a30478d9d62d4596df1c4e updated diff -r 970ddba0d72e -r 674d1258a2fb hws/hw03.pdf Binary file hws/hw03.pdf has changed diff -r 970ddba0d72e -r 674d1258a2fb hws/hw03.tex --- a/hws/hw03.tex Fri Oct 10 12:26:29 2025 +0100 +++ b/hws/hw03.tex Sat Oct 11 08:33:35 2025 +0100 @@ -88,8 +88,8 @@ \solution{ - A formula for DFAs is - +s A formula for DFAs is +eed \[L(A) \dn \{s \;|\; \hat{\delta}(start_q, s) \in F\}\] For NFAs you need to first define what $\hat{\rho}$ means. If @@ -275,12 +275,12 @@ \item On Mentimeter there was a question: \textit{``Why does the [regex] $(a^*)^*b$ takes much longer for strings of length 28 compared to say 25?''}\smallskip\\ -For this consider a lake with $1000 m^3$ surface and an invasive plant +For this consider a lake with $1000 m^2$ surface and an invasive plant that tries to cover the lake with leaves, think of the famous water lily that produces leaves on which you can stand. This plant starts out with a -seedling covering just $0.001 m^3$ of the lake, but doubles every day -the surface that is covers. So on day two it would cover $0.002 m^3$, -on day three $0.004 m^3$ and so on. How many days does the plant need to +seedling covering just $0.001 m^2$ of the lake, but doubles every day +the surface that is covers. So on day two it would cover $0.002 m^2$, +on day three $0.004 m^2$ and so on. How many days does the plant need to cover the entire lake? How many days is the lake still 90\% \emph{un}covered? \solution{That is a classic example of the law of exponentiation, meaning an diff -r 970ddba0d72e -r 674d1258a2fb progs/matcher/re1.sc --- a/progs/matcher/re1.sc Fri Oct 10 12:26:29 2025 +0100 +++ b/progs/matcher/re1.sc Sat Oct 11 08:33:35 2025 +0100 @@ -84,6 +84,9 @@ der('y', der('x', r2)) der('z', der('y', der('x', r2))) +// (a*)* b +// (a?){10}a{10} +//a + ONE // Test Cases //============ @@ -119,7 +122,7 @@ def test1() = { println("Test (a?{n}) (a{n})") - for (i <- 0 to 20 by 2) { + for (i <- 0 to 22 by 2) { println(f"$i: ${time_needed(2, matcher(EVIL1(i), "a" * i))}%.5f") } } @@ -129,7 +132,7 @@ def test2() = { println("Test (a*)* b") - for (i <- 0 to 20 by 2) { + for (i <- 0 to 22 by 2) { println(f"$i: ${time_needed(2, matcher(EVIL2, "a" * i))}%.5f") } } diff -r 970ddba0d72e -r 674d1258a2fb progs/matcher/re2.sc --- a/progs/matcher/re2.sc Fri Oct 10 12:26:29 2025 +0100 +++ b/progs/matcher/re2.sc Sat Oct 11 08:33:35 2025 +0100 @@ -93,7 +93,7 @@ def test2() = { println("Test (a*)* b") - for (i <- 0 to 20 by 2) { + for (i <- 0 to 22 by 2) { println(f"$i: ${time_needed(1, matcher(EVIL2, "a" * i))}%.5f") } } diff -r 970ddba0d72e -r 674d1258a2fb slides/slides03.tex --- a/slides/slides03.tex Fri Oct 10 12:26:29 2025 +0100 +++ b/slides/slides03.tex Sat Oct 11 08:33:35 2025 +0100 @@ -35,7 +35,7 @@ \begin{center} \begin{tabular}{ll} Email: & christian.urban at kcl.ac.uk\\ - Office Hour: & Friday 12 -- 14\\ + Office Hour: & Friday 11:30 -- 12:30\\ Location: & N7.07 (North Wing, Bush House)\\ Slides \& Progs: & KEATS\\ Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\ @@ -58,6 +58,11 @@ \end{tikzpicture} \end{center} +\begin{textblock}{5}(12,3) + \includegraphics[scale=0.35]{qr01}\\ + \small{}Wifi: \\ + \small{}Pwd: + \end{textblock} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%