ChengsongTanPhdThesis/Chapters/Finite.tex
changeset 611 bc1df466150a
parent 610 d028c662a3df
child 613 b0f0d884a547
equal deleted inserted replaced
610:d028c662a3df 611:bc1df466150a
   522 
   522 
   523 \section{Details of Closed Forms and Bounds}
   523 \section{Details of Closed Forms and Bounds}
   524 In this section we introduce in detail
   524 In this section we introduce in detail
   525 how the closed forms are obtained for regular expressions'
   525 how the closed forms are obtained for regular expressions'
   526 derivatives and how they are bounded.
   526 derivatives and how they are bounded.
   527 We start by proving some basic identities
   527 We start by proving some basic identities and inequalities
   528 involving the simplification functions for r-regular expressions.
   528 involving the simplification functions for r-regular expressions.
   529 After that we use these identities to establish the
   529 After that we use these identities to establish the
   530 closed forms we need.
   530 closed forms we need.
   531 Finally, we prove the functions such as $\flts$
   531 Finally, we prove the functions such as $\flts$
   532 will keep the size non-increasing.
   532 will keep the size non-increasing.
   536 the closed forms.
   536 the closed forms.
   537 %$r_1\cdot r_2$, $r^*$ and $\sum rs$.
   537 %$r_1\cdot r_2$, $r^*$ and $\sum rs$.
   538 
   538 
   539 
   539 
   540 
   540 
   541 \subsection{Some Basic Identities}
   541 \subsection{Some Basic Identities and Inequalities}
   542 
   542 
   543 
   543 In this subsection, we introduce lemmas 
   544 \subsubsection{$\textit{rdistinct}$'s Deduplicates Successfully}
   544 that are repeatedly used in later proofs.
       
   545 Note that for the $\textit{rdistinct}$ function there
       
   546 will be a lot of conversion from lists to sets.
       
   547 We use the name $set$ to refere to the 
       
   548 function that converts a list $rs$ to the set
       
   549 containing all the elements in $rs$.
       
   550 \subsubsection{$\textit{rdistinct}$'s Does the Job of De-duplication}
   545 The $\textit{rdistinct}$ function, as its name suggests, will
   551 The $\textit{rdistinct}$ function, as its name suggests, will
   546 remove duplicates in an r-regular expression list.
   552 remove duplicates in an r-regular expression list.
   547 It will also correctly exclude any elements that 
   553 It will also correctly exclude any elements that 
   548 is intially in the accumulator set.
   554 is intially in the accumulator set.
   549 \begin{lemma}\label{rdistinctDoesTheJob}
   555 \begin{lemma}\label{rdistinctDoesTheJob}
   597 	By induction on $rs$ and using \ref{rdistinctDoesTheJob}.
   603 	By induction on $rs$ and using \ref{rdistinctDoesTheJob}.
   598 \end{proof}
   604 \end{proof}
   599 \noindent
   605 \noindent
   600 On the other hand, if an element $r$ does not appear in the input list waiting to be deduplicated,
   606 On the other hand, if an element $r$ does not appear in the input list waiting to be deduplicated,
   601 then expanding the accumulator to include that element will not cause the output list to change:
   607 then expanding the accumulator to include that element will not cause the output list to change:
   602 \begin{lemma}
   608 \begin{lemma}\label{rdistinctOnDistinct}
   603 	The accumulator can be augmented to include elements not appearing in the input list,
   609 	The accumulator can be augmented to include elements not appearing in the input list,
   604 	and the output will not change.	
   610 	and the output will not change.	
   605 	\begin{itemize}
   611 	\begin{itemize}
   606 		\item
   612 		\item
   607 			If $r \notin rs$, then $\rdistinct{rs}{acc} = \rdistinct{rs}{\{r\} \cup acc}$.
   613 			If $r \notin rs$, then $\rdistinct{rs}{acc} = \rdistinct{rs}{(\{r\} \cup acc)}$.
   608 		\item
   614 		\item
   609 			Particularly, when $acc = \varnothing$ and $rs$ de-duplicated, we have\\
   615 			Particularly, if $\;\;\textit{isDistinct} \; rs$, then we have\\
   610 			\[ \rdistinct{rs}{\varnothing} = rs \]
   616 			\[ \rdistinct{rs}{\varnothing} = rs \]
   611 	\end{itemize}
   617 	\end{itemize}
   612 \end{lemma}
   618 \end{lemma}
   613 \begin{proof}
   619 \begin{proof}
   614 	The first half is by induction on $rs$. The second half is a corollary of the first.
   620 	The first half is by induction on $rs$. The second half is a corollary of the first.
   615 \end{proof}
   621 \end{proof}
   616 \noindent
   622 \noindent
   617 The next property gives the condition for
   623 The function $\textit{rdistinct}$ removes duplicates from anywhere in a list.
   618 when $\rdistinct{\_}{\_}$ becomes an identical mapping
   624 Despite being seemingly obvious, 
   619 for any prefix of an input list, in other words, when can 
   625 the induction technique is not as straightforward.
   620 we ``push out" the arguments of $\rdistinct{\_}{\_}$:
       
   621 \begin{lemma}\label{distinctRdistinctAppend}
       
   622 	If $\textit{isDistinct} \; rs_1$, and $rs_1 \cap acc = \varnothing$,
       
   623 	then 
       
   624 	\[\textit{rdistinct}\;  (rs_1 @ rsa)\;\, acc
       
   625 	= rs_1@(\textit{rdistinct} rsa \; (acc \cup rs_1))\]
       
   626 \end{lemma}
       
   627 \noindent
       
   628 In other words, it can be taken out and left untouched in the output.
       
   629 \begin{proof}
       
   630 	By an induction on $rs_1$, where $rsa$ and $acc$ are allowed to be arbitrary.
       
   631 \end{proof}
       
   632 \noindent
       
   633 $\rdistinct{}{}$ removes any element in anywhere of a list, if it
       
   634 had appeared previously:
       
   635 \begin{lemma}\label{distinctRemovesMiddle}
   626 \begin{lemma}\label{distinctRemovesMiddle}
   636 	The two properties hold if $r \in rs$:
   627 	The two properties hold if $r \in rs$:
   637 	\begin{itemize}
   628 	\begin{itemize}
   638 		\item
   629 		\item
   639 			$\rdistinct{rs}{rset} = \rdistinct{(rs @ [r])}{rset}$\\
   630 			$\rdistinct{rs}{rset} = \rdistinct{(rs @ [r])}{rset}$\\
   647 	\end{itemize}
   638 	\end{itemize}
   648 \end{lemma}
   639 \end{lemma}
   649 \noindent
   640 \noindent
   650 \begin{proof}
   641 \begin{proof}
   651 	By induction on $rs$. All other variables are allowed to be arbitrary.
   642 	By induction on $rs$. All other variables are allowed to be arbitrary.
   652 	The second half of the lemma requires the first half.
   643 	The second part of the lemma requires the first.
   653 	Note that for each half's two sub-propositions need to be proven concurrently,
   644 	Note that for each part, the two sub-propositions need to be proven concurrently,
   654 	so that the induction goes through.
   645 	so that the induction goes through.
   655 \end{proof}
   646 \end{proof}
   656 
   647 \noindent
   657 \noindent
   648 This allows us to prove a few more equivalence relations involving 
   658 This allows us to prove ``Idempotency" of $\rdistinct{}{}$ of some kind:
   649 $\textit{rdistinct}$ (it will be useful later):
   659 \begin{lemma}\label{rdistinctConcatGeneral}
   650 \begin{lemma}\label{rdistinctConcatGeneral}
   660 	The following equalities involving multiple applications  of $\rdistinct{}{}$ hold:
   651 	\mbox{}
   661 	\begin{itemize}
   652 	\begin{itemize}
   662 		\item
   653 		\item
   663 			$\rdistinct{(rs @ rs')}{\varnothing} = \rdistinct{((\rdistinct{rs}{\varnothing})@ rs')}{\varnothing}$
   654 			$\rdistinct{(rs @ rs')}{\varnothing} = \rdistinct{((\rdistinct{rs}{\varnothing})@ rs')}{\varnothing}$
   664 		\item
   655 		\item
   665 			$\rdistinct{(rs @ rs')}{\varnothing} = \rdistinct{(\rdistinct{rs}{\varnothing} @ rs')}{\varnothing}$
   656 			$\rdistinct{(rs @ rs')}{\varnothing} = \rdistinct{(\rdistinct{rs}{\varnothing} @ rs')}{\varnothing}$
   678 	\end{itemize}
   669 	\end{itemize}
   679 \end{lemma}
   670 \end{lemma}
   680 \begin{proof}
   671 \begin{proof}
   681 	By \ref{rdistinctDoesTheJob} and \ref{distinctRemovesMiddle}.
   672 	By \ref{rdistinctDoesTheJob} and \ref{distinctRemovesMiddle}.
   682 \end{proof}
   673 \end{proof}
   683 
   674 \noindent
   684 \subsubsection{The Properties of $\backslash_r$, $\backslash_{rsimp}$, $\textit{Rflts}$ and $\textit{Rsimp}_{ALTS}$} 
   675 $\textit{rdistinct}$ is composable w.r.t list concatenation:
   685 We give in this subsection some properties of how $\backslash_r$, $\backslash_{rsimp}$, $\textit{Rflts}$ and $\textit{Rsimp}_{ALTS} $ interact with each other and with $@$, the concatenation operator.
   676 \begin{lemma}\label{distinctRdistinctAppend}
       
   677 			If $\;\; \textit{isDistinct} \; rs_1$, 
       
   678 			and $(set \; rs_1) \cap acc = \varnothing$,
       
   679 			then applying $\textit{rdistinct}$ on $rs_1 @ rs_a$ does not 
       
   680 			have an effect on $rs_1$:
       
   681 			\[\textit{rdistinct}\;  (rs_1 @ rsa)\;\, acc
       
   682 			= rs_1@(\textit{rdistinct} rsa \; (acc \cup rs_1))\]
       
   683 \end{lemma}
       
   684 \begin{proof}
       
   685 	By an induction on 
       
   686 	$rs_1$, where $rsa$ and $acc$ are allowed to be arbitrary.
       
   687 \end{proof}
       
   688 \noindent
       
   689 $\textit{rdistinct}$ needs to be applied only once, and 
       
   690 applying it multiple times does not cause any difference:
       
   691 \begin{corollary}\label{distinctOnceEnough}
       
   692 	$\textit{rdistinct} \; (rs @ rsa) {} = \textit{rdistinct} \; (rdistinct \; 
       
   693 	rs \{ \} @ (\textit{rdistinct} \; rs_a \; (set \; rs)))$
       
   694 \end{corollary}
       
   695 \begin{proof}
       
   696 	By lemma \ref{distinctRdistinctAppend}.
       
   697 \end{proof}
       
   698 
       
   699 \subsubsection{The Properties of $\textit{Rflts}$} 
       
   700 We give in this subsection some properties
       
   701 involving $\backslash_r$, $\backslash_{rsimp}$, $\textit{rflts}$ and 
       
   702 $\textit{rsimp}_{ALTS} $, together with any non-trivial lemmas that lead to them.
   686 These will be helpful in later closed form proofs, when
   703 These will be helpful in later closed form proofs, when
   687 we want to transform the ways in which multiple functions involving
   704 we want to transform derivative terms which have
   688 those are composed together
   705 %the ways in which multiple functions involving
   689 in interleaving derivative and  simplification steps.
   706 %those are composed together
   690 
   707 interleaving derivatives and  simplifications applied to them.
   691 When the function $\textit{Rflts}$ 
   708 
   692 is applied to the concatenation of two lists, the output can be calculated by first applying the
   709 \noindent
   693 functions on two lists separately, and then concatenating them together.
   710 %When the function $\textit{Rflts}$ 
       
   711 %is applied to the concatenation of two lists, the output can be calculated by first applying the
       
   712 %functions on two lists separately, and then concatenating them together.
       
   713 $\textit{Rflts}$ is composable in terms of concatenation:
   694 \begin{lemma}\label{rfltsProps}
   714 \begin{lemma}\label{rfltsProps}
   695 	The function $\rflts$ has the below properties:\\
   715 	The function $\rflts$ has the below properties:\\
   696 	\begin{itemize}
   716 	\begin{itemize}
   697 		\item
   717 		\item
   698 			$\rflts \; (rs_1 @ rs_2) = \rflts \; rs_1 @ \rflts \; rs_2$
   718 			$\rflts \; (rs_1 @ rs_2) = \rflts \; rs_1 @ \rflts \; rs_2$
   717 \noindent
   737 \noindent
   718 \begin{proof}
   738 \begin{proof}
   719 	By induction on $rs_1$ in the first sub-lemma, and induction on $r$ in the second part,
   739 	By induction on $rs_1$ in the first sub-lemma, and induction on $r$ in the second part,
   720 	and induction on $rs$, $rs'$, $rs$, $rs'$, $rs_a$ in the third, fourth, fifth, sixth and 
   740 	and induction on $rs$, $rs'$, $rs$, $rs'$, $rs_a$ in the third, fourth, fifth, sixth and 
   721 	last sub-lemma.
   741 	last sub-lemma.
       
   742 \end{proof}
       
   743 \noindent
       
   744 Now we introduce the property that the operations 
       
   745 derivative and $\rsimpalts$
       
   746 commute, this will be used later in deriving the closed form for
       
   747 the alternative regular expression:
       
   748 \begin{lemma}\label{rderRsimpAltsCommute}
       
   749 	$\rder{x}{(\rsimpalts \; rs)} = \rsimpalts \; (\map \; (\rder{x}{\_}) \; rs)$
       
   750 \end{lemma}
       
   751 \noindent
       
   752 \subsubsection{$\textit{rsimp}$ Does Not Increment the Size}
       
   753 Although it seems evident, we need a series
       
   754 of non-trivial lemmas to establish this property.
       
   755 \begin{lemma}\label{rsimpMonoLemmas}
       
   756 	\mbox{}
       
   757 	\begin{itemize}
       
   758 		\item
       
   759 			\[
       
   760 				\llbracket \rsimpalts \; rs \rrbracket_r \leq
       
   761 				\llbracket \sum \; rs \rrbracket_r
       
   762 			\]
       
   763 		\item
       
   764 			\[
       
   765 				\llbracket \rsimpseq \; r_1 \;  r_2 \rrbracket_r \leq
       
   766 				\llbracket r_1 \cdot r_2 \rrbracket_r
       
   767 			\]
       
   768 		\item
       
   769 			\[
       
   770 				\llbracket \rflts \; rs \rrbracket_r  \leq
       
   771 				\llbracket rs \rrbracket_r 
       
   772 			\]
       
   773 		\item
       
   774 			\[
       
   775 				\llbracket \rDistinct \; rs \; ss \rrbracket_r  \leq
       
   776 				\llbracket rs \rrbracket_r 
       
   777 			\]
       
   778 		\item
       
   779 			If all elements $a$ in the set $as$ satisfy the property
       
   780 			that $\llbracket \textit{rsimp} \; a \rrbracket_r \leq
       
   781 			\llbracket a \rrbracket_r$, then we have 
       
   782 			\[
       
   783 				\llbracket \; \rsimpalts \; (\textit{rdistinct} \;
       
   784 				(\textit{rflts} \; (\textit{map}\;\textit{rsimp} as)) \{\})
       
   785 				\rrbracket \leq
       
   786 				\llbracket \; \sum \; (\rDistinct \; (\rflts \;(\map \;
       
   787 				\textit{rsimp} \; x))\; \{ \} ) \rrbracket_r 
       
   788 			\]
       
   789 	\end{itemize}
       
   790 \end{lemma}
       
   791 \begin{proof}
       
   792 	Point 1, 3, 4 can be proven by an induction on $rs$.
       
   793 	Point 2 is by case analysis on $r_1$ and $r_2$.
       
   794 	The last part is a corollary of the previous ones.
       
   795 \end{proof}
       
   796 \noindent
       
   797 With the lemmas for each inductive case in place, we are ready to get 
       
   798 the non-increasing property as a corollary:
       
   799 \begin{corollary}\label{rsimpMono}
       
   800 	$\llbracket \textit{rsimp} \; r \rrbracket_r$
       
   801 \end{corollary}
       
   802 \begin{proof}
       
   803 	By \ref{rsimpMonoLemmas}.
   722 \end{proof}
   804 \end{proof}
   723 
   805 
   724 \subsubsection{The $RL$ Function: Language Interpretation of $\textit{Rrexp}$s}
   806 \subsubsection{The $RL$ Function: Language Interpretation of $\textit{Rrexp}$s}
   725 Much like the definition of $L$ on plain regular expressions, one could also 
   807 Much like the definition of $L$ on plain regular expressions, one could also 
   726 define the language interpretation of $\rrexp$s.
   808 define the language interpretation of $\rrexp$s.
   899 of $\rsimp{}$ application:
   981 of $\rsimp{}$ application:
   900 \begin{lemma}\label{test}
   982 \begin{lemma}\label{test}
   901 	If $\good \;r$ then $\rsimp{r} = r$.
   983 	If $\good \;r$ then $\rsimp{r} = r$.
   902 \end{lemma}
   984 \end{lemma}
   903 \begin{proof}
   985 \begin{proof}
   904 	By an induction on the inductive cases of $\good$.
   986 	By an induction on the inductive cases of $\good$, using lemmas
       
   987 	\ref{goodaltsNonalt} and \ref{rdistinctOnDistinct}.
   905 	The lemma \ref{goodaltsNonalt} is used in the alternative
   988 	The lemma \ref{goodaltsNonalt} is used in the alternative
   906 	case where 2 or more elements are present in the list.
   989 	case where 2 or more elements are present in the list.
   907 \end{proof}
   990 \end{proof}
   908 \noindent
   991 \noindent
   909 Given below is a property involving $\rflts$, $\rdistinct{}{}$, $\rsimp{}$ and $\rsimp_{ALTS}$,
   992 Given below is a property involving $\rflts$, $\rdistinct{}{}$, $\rsimp{}$ and $\rsimp_{ALTS}$,
   926 
  1009 
   927 
  1010 
   928 
  1011 
   929 
  1012 
   930 
  1013 
   931 We are also 
  1014 We are also ready to prove that $\textit{rsimp}$ is idempotent.
   932 \subsection{$\rsimp$ is Idempotent}
  1015 \subsubsection{$\rsimp$ is Idempotent}
   933 The idempotency of $\rsimp$ is very useful in 
  1016 The idempotency of $\rsimp$ is very useful in 
   934 manipulating regular expression terms into desired
  1017 manipulating regular expression terms into desired
   935 forms so that key steps allowing further rewriting to closed forms
  1018 forms so that key steps allowing further rewriting to closed forms
   936 are possible.
  1019 are possible.
   937 \begin{lemma}\label{rsimpIdem}
  1020 \begin{lemma}\label{rsimpIdem}
   973 		\item
  1056 		\item
   974 			$\rsimpalts \; (\rdistinct{\rflts \; [r]}{\varnothing}) = r$.
  1057 			$\rsimpalts \; (\rdistinct{\rflts \; [r]}{\varnothing}) = r$.
   975 	\end{itemize}
  1058 	\end{itemize}
   976 \end{lemma}
  1059 \end{lemma}
   977 \begin{proof}
  1060 \begin{proof}
   978 	By application of \ref{rsimpIdem} and \ref{good1}.
  1061 	By application of lemmas \ref{rsimpIdem} and \ref{good1}.
   979 \end{proof}
  1062 \end{proof}
   980 
  1063 
   981 \noindent
  1064 \noindent
   982 With the idempotency of $\rsimp{}$ and its corollaries, 
  1065 With the idempotency of $\rsimp{}$ and its corollaries, 
   983 we can start proving some key equalities leading to the 
  1066 we can start proving some key equalities leading to the 
  1134 		\inferrule[dB]{}{rs_a @ [a] @ rs_b @[a] @ rs_c \grewrite rs_a @ [a] @ rsb @ rsc}
  1217 		\inferrule[dB]{}{rs_a @ [a] @ rs_b @[a] @ rs_c \grewrite rs_a @ [a] @ rsb @ rsc}
  1135 	\end{mathpar}
  1218 	\end{mathpar}
  1136 \end{center}
  1219 \end{center}
  1137 
  1220 
  1138 \noindent
  1221 \noindent
  1139 The reason why we take the trouble of defining 
  1222 We defined
  1140 two separate list rewriting definitions $\frewrite$ and $\grewrite$
  1223 two separate list rewriting definitions $\frewrite$ and $\grewrite$.
  1141 is to separate the two stages of simplification: flattening and de-duplicating.
  1224 The rewriting steps that take place during
       
  1225 flattening is characterised by $\frewrite$.
       
  1226 $\grewrite$ characterises both flattening and de-duplicating.
  1142 Sometimes $\grewrites$ is slightly too powerful
  1227 Sometimes $\grewrites$ is slightly too powerful
  1143 so we would rather use $\frewrites$ which makes certain rewriting steps 
  1228 so we would rather use $\frewrites$ because we only
  1144 more straightforward to prove.
  1229 need to prove about certain equivalence under the rewriting steps of $\frewrites$.
  1145 For example, when proving the closed-form for the alternative regular expression,
  1230 For example, when proving the closed-form for the alternative regular expression,
  1146 one of the rewriting steps would be:
  1231 one of the rewriting steps would be:
  1147 \begin{lemma}
  1232 \begin{lemma}
  1148 	$\sum (\rDistinct \;\; (\map \; (\_ \backslash x) \; (\rflts \; rs)) \;\; \varnothing) \sequal
  1233 	$\sum (\rDistinct \;\; (\map \; (\_ \backslash x) \; (\rflts \; rs)) \;\; \varnothing) \sequal
  1149 	\sum (\rDistinct \;\;  (\rflts \; (\map \; (\_ \backslash x) \; rs)) \;\; \varnothing)
  1234 	\sum (\rDistinct \;\;  (\rflts \; (\map \; (\_ \backslash x) \; rs)) \;\; \varnothing)
  1271 			(\rdistinct{rs}{\varnothing})) \sequal
  1356 			(\rdistinct{rs}{\varnothing})) \sequal
  1272 			\rsimpalts \; (\rDistinct \; 
  1357 			\rsimpalts \; (\rDistinct \; 
  1273 			(\map \; (\_ \backslash_r x) rs) \;\varnothing  )$
  1358 			(\map \; (\_ \backslash_r x) rs) \;\varnothing  )$
  1274 	\end{itemize}
  1359 	\end{itemize}
  1275 \end{lemma}
  1360 \end{lemma}
  1276 \noindent
  1361 \begin{proof}
  1277 
  1362 	Part 1 is by lemma \ref{insideSimpRemoval},
  1278 Finally,
  1363 	part 2 is by lemmas \ref{insideSimpRemoval} and \ref{distinctDer}.
  1279 together with 
  1364 \end{proof}
  1280 \begin{lemma}\label{rderRsimpAltsCommute}
  1365 \noindent
  1281 	$\rder{x}{(\rsimpalts \; rs)} = \rsimpalts \; (\map \; (\rder{x}{\_}) \; rs)$
  1366 This leads to the first closed form--
  1282 \end{lemma}
       
  1283 \noindent
       
  1284 this leads to the first closed form--
       
  1285 \begin{lemma}\label{altsClosedForm}
  1367 \begin{lemma}\label{altsClosedForm}
  1286 	\begin{center}
  1368 	\begin{center}
  1287 		$\rderssimp{(\sum rs)}{s} \sequal
  1369 		$\rderssimp{(\sum rs)}{s} \sequal
  1288 		\sum \; (\map \; (\rderssimp{\_}{s}) \; rs)$
  1370 		\sum \; (\map \; (\rderssimp{\_}{s}) \; rs)$
  1289 	\end{center}
  1371 	\end{center}
  2096 %size change
  2178 %size change
  2097 %TODO: giving regex1_size_change.data showing a few regular expressions' size changes 
  2179 %TODO: giving regex1_size_change.data showing a few regular expressions' size changes 
  2098 %w;r;t the input characters number, where the size is usually cubic in terms of original size
  2180 %w;r;t the input characters number, where the size is usually cubic in terms of original size
  2099 %a*, aa*, aaa*, .....
  2181 %a*, aa*, aaa*, .....
  2100 %randomly generated regular expressions
  2182 %randomly generated regular expressions
  2101 \begin{center}
  2183 \begin{figure}{H}
  2102 	\begin{tabular}{@{}c@{\hspace{0mm}}c@{\hspace{0mm}}c@{}}
  2184 	\begin{tabular}{@{}c@{\hspace{0mm}}c@{\hspace{0mm}}c@{}}
  2103 		\begin{tikzpicture}
  2185 		\begin{tikzpicture}
  2104 			\begin{axis}[
  2186 			\begin{axis}[
  2105 				xlabel={number of $a$'s},
  2187 				xlabel={number of characters},
  2106 				x label style={at={(1.05,-0.05)}},
  2188 				x label style={at={(1.05,-0.05)}},
  2107 				ylabel={regex size},
  2189 				ylabel={regex size},
  2108 				enlargelimits=false,
  2190 				enlargelimits=false,
  2109 				xtick={0,5,...,30},
  2191 				xtick={0,5,...,30},
  2110 				xmax=33,
  2192 				xmax=33,
  2111 				ymax=1000,
  2193 				%ymax=1000,
  2112 				ytick={0,100,...,1000},
  2194 				%ytick={0,100,...,1000},
  2113 				scaled ticks=false,
  2195 				scaled ticks=false,
  2114 				axis lines=left,
  2196 				axis lines=left,
  2115 				width=5cm,
  2197 				width=5cm,
  2116 				height=4cm, 
  2198 				height=4cm, 
  2117 				legend entries={regex1},  
  2199 				legend entries={regex1},  
  2127 		  x label style={at={(1.05,-0.05)}},
  2209 		  x label style={at={(1.05,-0.05)}},
  2128 		  %ylabel={time in secs},
  2210 		  %ylabel={time in secs},
  2129 		  enlargelimits=false,
  2211 		  enlargelimits=false,
  2130 		  xtick={0,5,...,30},
  2212 		  xtick={0,5,...,30},
  2131 		  xmax=33,
  2213 		  xmax=33,
  2132 		  ymax=1000,
  2214 		  %ymax=1000,
  2133 		  ytick={0,100,...,1000},
  2215 		  %ytick={0,100,...,1000},
  2134 		  scaled ticks=false,
  2216 		  scaled ticks=false,
  2135 		  axis lines=left,
  2217 		  axis lines=left,
  2136 		  width=5cm,
  2218 		  width=5cm,
  2137 		  height=4cm, 
  2219 		  height=4cm, 
  2138 		  legend entries={regex2},  
  2220 		  legend entries={regex2},  
  2148 		  x label style={at={(1.05,-0.05)}},
  2230 		  x label style={at={(1.05,-0.05)}},
  2149 		  %ylabel={time in secs},
  2231 		  %ylabel={time in secs},
  2150 		  enlargelimits=false,
  2232 		  enlargelimits=false,
  2151 		  xtick={0,5,...,30},
  2233 		  xtick={0,5,...,30},
  2152 		  xmax=33,
  2234 		  xmax=33,
  2153 		  ymax=1000,
  2235 		  %ymax=1000,
  2154 		  ytick={0,100,...,1000},
  2236 		  %ytick={0,100,...,1000},
  2155 		  scaled ticks=false,
  2237 		  scaled ticks=false,
  2156 		  axis lines=left,
  2238 		  axis lines=left,
  2157 		  width=5cm,
  2239 		  width=5cm,
  2158 		  height=4cm, 
  2240 		  height=4cm, 
  2159 		  legend entries={regex3},  
  2241 		  legend entries={regex3},  
  2162 		  \addplot[cyan,mark=*, mark options={fill=white}] table {regex3_size_change.data};
  2244 		  \addplot[cyan,mark=*, mark options={fill=white}] table {regex3_size_change.data};
  2163 	  \end{axis}
  2245 	  \end{axis}
  2164   \end{tikzpicture}\\
  2246   \end{tikzpicture}\\
  2165   \multicolumn{3}{c}{Graphs: size change of 3 randomly generated regular expressions $w.r.t.$ input string length.}
  2247   \multicolumn{3}{c}{Graphs: size change of 3 randomly generated regular expressions $w.r.t.$ input string length.}
  2166 	\end{tabular}    
  2248 	\end{tabular}    
  2167 \end{center}  
  2249 \end{figure}  
  2168 \noindent
  2250 \noindent
  2169 Most of the regex's sizes seem to stay within a polynomial bound $w.r.t$ the 
  2251 Most of the regex's sizes seem to stay within a polynomial bound $w.r.t$ the 
  2170 original size.
  2252 original size.
  2171 We will discuss improvements to this bound in the next chapter.
  2253 We will discuss improvements to this bound in the next chapter.
  2172 
  2254 
  2177 %----------------------------------------------------------------------------------------
  2259 %----------------------------------------------------------------------------------------
  2178 
  2260 
  2179 %-----------------------------------
  2261 %-----------------------------------
  2180 %	SECTION syntactic equivalence under simp
  2262 %	SECTION syntactic equivalence under simp
  2181 %-----------------------------------
  2263 %-----------------------------------
  2182 \section{Syntactic Equivalence Under $\simp$}
       
  2183 We prove that minor differences can be annhilated
       
  2184 by $\simp$.
       
  2185 For example,
       
  2186 \begin{center}
       
  2187 	$\simp \;(\simpALTs\; (\map \;(\_\backslash \; x)\; (\distinct \; \mathit{rs}\; \phi))) = 
       
  2188 	\simp \;(\simpALTs \;(\distinct \;(\map \;(\_ \backslash\; x) \; \mathit{rs}) \; \phi))$
       
  2189 \end{center}
       
  2190 
  2264 
  2191 
  2265 
  2192 %----------------------------------------------------------------------------------------
  2266 %----------------------------------------------------------------------------------------
  2193 %	SECTION ALTS CLOSED FORM
  2267 %	SECTION ALTS CLOSED FORM
  2194 %----------------------------------------------------------------------------------------
  2268 %----------------------------------------------------------------------------------------