# HG changeset patch # User Christian Urban # Date 1760168015 -3600 # Node ID fe2edf2cbd74f0e4994225c1ab4f2950838efe65 # Parent f6dec8af3d800e4e60dd06c84930171caba32aa2 updated diff -r f6dec8af3d80 -r fe2edf2cbd74 hws/hw03.pdf Binary file hws/hw03.pdf has changed diff -r f6dec8af3d80 -r fe2edf2cbd74 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 f6dec8af3d80 -r fe2edf2cbd74 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 f6dec8af3d80 -r fe2edf2cbd74 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 f6dec8af3d80 -r fe2edf2cbd74 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} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%