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