ChengsongTanPhdThesis/Chapters/Chapter3.tex
author Chengsong
Fri, 27 May 2022 18:28:10 +0100
changeset 520 26584b9d47f4
parent 519 856d025dbc15
permissions -rwxr-xr-x
apters
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
     1
% Chapter Template
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
     2
519
Chengsong
parents: 468
diff changeset
     3
% Main chapter title
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
     4
519
Chengsong
parents: 468
diff changeset
     5
\label{Chapter3} % Change X to a consecutive number; for referencing this chapter elsewhere, use \ref{ChapterX}
Chengsong
parents: 468
diff changeset
     6
%Then we illustrate how the algorithm without bitcodes falls short for such aggressive 
Chengsong
parents: 468
diff changeset
     7
%simplifications and therefore introduce our version of the bitcoded algorithm and 
Chengsong
parents: 468
diff changeset
     8
%its correctness proof in 
Chengsong
parents: 468
diff changeset
     9
%Chapter 3\ref{Chapter3}. 
Chengsong
parents: 468
diff changeset
    10
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    11
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    12
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    13
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    14
%----------------------------------------------------------------------------------------
519
Chengsong
parents: 468
diff changeset
    15
%	SECTION common identities
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    16
%----------------------------------------------------------------------------------------
519
Chengsong
parents: 468
diff changeset
    17
\section{Common Identities In Simplification-Related Functions} 
Chengsong
parents: 468
diff changeset
    18
Need to prove these before starting on the big correctness proof.
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    19
519
Chengsong
parents: 468
diff changeset
    20
%-----------------------------------
Chengsong
parents: 468
diff changeset
    21
%	SUBSECTION 
Chengsong
parents: 468
diff changeset
    22
%-----------------------------------
Chengsong
parents: 468
diff changeset
    23
\subsection{Idempotency of $\simp$}
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    24
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    25
\begin{equation}
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    26
	\simp \;r = \simp\; \simp \; r 
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    27
\end{equation}
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    28
This property means we do not have to repeatedly
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    29
apply simplification in each step, which justifies
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    30
our definition of $\blexersimp$.
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    31
It will also be useful in future proofs where properties such as 
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    32
closed forms are needed.
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    33
The proof is by structural induction on $r$.
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    34
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    35
%-----------------------------------
519
Chengsong
parents: 468
diff changeset
    36
%	SUBSECTION 
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    37
%-----------------------------------
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    38
\subsection{Syntactic Equivalence Under $\simp$}
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    39
We prove that minor differences can be annhilated
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    40
by $\simp$.
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    41
For example,
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    42
\begin{center}
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    43
$\simp \;(\simpALTs\; (\map \;(\_\backslash \; x)\; (\distinct \; \mathit{rs}\; \phi))) = 
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    44
 \simp \;(\simpALTs \;(\distinct \;(\map \;(\_ \backslash\; x) \; \mathit{rs}) \; \phi))$
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    45
\end{center}
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    46
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    47
519
Chengsong
parents: 468
diff changeset
    48
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    49
519
Chengsong
parents: 468
diff changeset
    50
Chengsong
parents: 468
diff changeset
    51
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    52
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    53
%----------------------------------------------------------------------------------------
519
Chengsong
parents: 468
diff changeset
    54
%	SECTION corretness proof
468
a0f27e21b42c all texrelated
Chengsong
parents:
diff changeset
    55
%----------------------------------------------------------------------------------------
519
Chengsong
parents: 468
diff changeset
    56
\section{Correctness of Bit-coded Algorithm with Simplification}
Chengsong
parents: 468
diff changeset
    57
The non-trivial part of proving the correctness of the algorithm with simplification
Chengsong
parents: 468
diff changeset
    58
compared with not having simplification is that we can no longer use the argument 
Chengsong
parents: 468
diff changeset
    59
in \cref{flex_retrieve}.
Chengsong
parents: 468
diff changeset
    60
The function \retrieve needs the structure of the annotated regular expression to 
Chengsong
parents: 468
diff changeset
    61
agree with the structure of the value, but simplification will always mess with the 
Chengsong
parents: 468
diff changeset
    62
structure:
Chengsong
parents: 468
diff changeset
    63
%TODO: after simp does not agree with each other: (a + 0) --> a v.s. Left(Char(a))