--- a/ChengsongTanPhdThesis/Chapters/Cubic.tex Mon Jun 06 03:06:32 2022 +0100
+++ b/ChengsongTanPhdThesis/Chapters/Cubic.tex Mon Jun 06 15:57:17 2022 +0100
@@ -183,6 +183,7 @@
that have "language duplicates", but only eliminate the "exact duplicates".
For this we need to break up terms $(a+b)\cdot c$ into two
terms $a\cdot c$ and $b\cdot c$ before we add them to the accumulator:
+\begin{figure}
\begin{verbatim}
def distinctWith(rs: List[ARexp],
pruneFunction: (ARexp, Set[Rexp]) => ARexp,
@@ -202,8 +203,11 @@
}
}
\end{verbatim}
+\caption{A Stronger Version of $\textit{distinctBy}$}
+\end{figure}
\noindent
This process is done by the function $\textit{turnIntoTerms}$:
+\begin{figure}
\begin{verbatim}
def turnIntoTerms(r: Rexp): List[Rexp] = r match {
case SEQ(r1, r2) => if(isOne(r1))
@@ -215,8 +219,12 @@
case _ => r :: Nil
}
\end{verbatim}
+\caption{function that breaks up regular expression into "atomic" terms}
+\end{figure}
+
\noindent
The pruning function can be defined recursively:
+\begin{figure}
\begin{verbatim}
def prune7(r: ARexp, acc: Set[Rexp]) : ARexp = r match{
case AALTS(bs, rs) => rs.map(r => prune7(r, acc)).filter(_ != ZERO) match
@@ -233,52 +241,49 @@
case r => if(acc(erase(r))) AZERO else r
}
\end{verbatim}
+\caption{pruning function}
+\end{figure}
+
+
+\pgfplotsset{
+ myplotstyle/.style={
+ legend style={draw=none, font=\small},
+ legend cell align=left,
+ legend pos=north east,
+ ylabel style={align=center, font=\bfseries\boldmath},
+ xlabel style={align=center, font=\bfseries\boldmath},
+ x tick label style={font=\bfseries\boldmath},
+ y tick label style={font=\bfseries\boldmath},
+ scaled ticks=true,
+ every axis plot/.append style={thick},
+ },
+}
\begin{figure}
\centering
\begin{tabular}{@{}c@{\hspace{0mm}}c@{\hspace{0mm}}c@{}}
\begin{tikzpicture}
\begin{axis}[
- xlabel={$n$},
- x label style={at={(1.05,-0.05)}},
+ %xlabel={$n$},
+ myplotstyle,
+ xlabel={input length},
ylabel={size},
- enlargelimits=false,
- xtick={0,5,...,30},
- xmax=30,
- ymax=800,
- ytick={0,200,...,800},
- scaled ticks=false,
- axis lines=left,
- width=5cm,
- height=4cm,
- legend entries={$bsimpStrong$ size growth},
- legend pos=north west,
- legend cell align=left]
+ ]
\addplot[red,mark=*, mark options={fill=white}] table {strongSimpCurve.data};
\end{axis}
\end{tikzpicture}
&
\begin{tikzpicture}
\begin{axis}[
- xlabel={$n$},
- x label style={at={(1.05,-0.05)}},
+ %xlabel={$n$},
+ myplotstyle,
+ xlabel={input length},
ylabel={size},
- enlargelimits=false,
- xtick={0,5,...,30},
- xmax=30,
- ymax=42000,
- ytick={0,10000,...,40000},
- scaled ticks=true,
- axis lines=left,
- width=5cm,
- height=4cm,
- legend entries={$bsimp$ size growth},
- legend pos=north west,
- legend cell align=left]
+ ]
\addplot[blue,mark=*, mark options={fill=white}] table {bsimpExponential.data};
\end{axis}
\end{tikzpicture}\\
-\multicolumn{2}{c}{Graphs: Runtime for matching $((a^* + (aa)^* + \ldots + (aaaaa)^* )^*)^*$ with strings
+\multicolumn{2}{l}{Graphs: Runtime for matching $((a^* + (aa)^* + \ldots + (aaaaa)^* )^*)^*$ with strings
of the form $\underbrace{aa..a}_{n}$.}
\end{tabular}
\caption{aaaaaStarStar} \label{fig:aaaaaStarStar}