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