1 % |
|
2 \begin{isabellebody}% |
|
3 \setisabellecontext{Paper}% |
|
4 % |
|
5 \isadelimtheory |
|
6 % |
|
7 \endisadelimtheory |
|
8 % |
|
9 \isatagtheory |
|
10 % |
|
11 \endisatagtheory |
|
12 {\isafoldtheory}% |
|
13 % |
|
14 \isadelimtheory |
|
15 % |
|
16 \endisadelimtheory |
|
17 % |
|
18 \isadelimproof |
|
19 % |
|
20 \endisadelimproof |
|
21 % |
|
22 \isatagproof |
|
23 % |
|
24 \endisatagproof |
|
25 {\isafoldproof}% |
|
26 % |
|
27 \isadelimproof |
|
28 % |
|
29 \endisadelimproof |
|
30 % |
|
31 \isadelimproof |
|
32 % |
|
33 \endisadelimproof |
|
34 % |
|
35 \isatagproof |
|
36 % |
|
37 \endisatagproof |
|
38 {\isafoldproof}% |
|
39 % |
|
40 \isadelimproof |
|
41 % |
|
42 \endisadelimproof |
|
43 % |
|
44 \isadelimdocument |
|
45 % |
|
46 \endisadelimdocument |
|
47 % |
|
48 \isatagdocument |
|
49 % |
|
50 \isamarkupsection{Core of the proof% |
|
51 } |
|
52 \isamarkuptrue% |
|
53 % |
|
54 \endisatagdocument |
|
55 {\isafolddocument}% |
|
56 % |
|
57 \isadelimdocument |
|
58 % |
|
59 \endisadelimdocument |
|
60 % |
|
61 \begin{isamarkuptext}% |
|
62 This paper builds on previous work by Ausaf and Urban using |
|
63 regular expression'd bit-coded derivatives to do lexing that |
|
64 is both fast and satisfies the POSIX specification. |
|
65 In their work, a bit-coded algorithm introduced by Sulzmann and Lu |
|
66 was formally verified in Isabelle, by a very clever use of |
|
67 flex function and retrieve to carefully mimic the way a value is |
|
68 built up by the injection funciton. |
|
69 |
|
70 In the previous work, Ausaf and Urban established the below equality: |
|
71 \begin{lemma} |
|
72 \isa{{\normalsize{}If\,}\ v\ {\isacharcolon}{\kern0pt}\ r{\isacharbackslash}{\kern0pt}s\ {\normalsize \,then\,}\ Some\ {\isacharparenleft}{\kern0pt}flex\ r\ id\ s\ v{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ decode\ {\isacharparenleft}{\kern0pt}retrieve\ {\isacharparenleft}{\kern0pt}r\mbox{$^\uparrow$}\mbox{$\bbslash$}s{\isacharparenright}{\kern0pt}\ v{\isacharparenright}{\kern0pt}\ r{\isachardot}{\kern0pt}} |
|
73 \end{lemma} |
|
74 |
|
75 This lemma establishes a link with the lexer without bit-codes. |
|
76 |
|
77 With it we get the correctness of bit-coded algorithm. |
|
78 \begin{lemma} |
|
79 \isa{lexer\mbox{$_b$}\ r\ s\ {\isacharequal}{\kern0pt}\ lexer\ r\ s} |
|
80 \end{lemma} |
|
81 |
|
82 However what is not certain is whether we can add simplification |
|
83 to the bit-coded algorithm, without breaking the correct lexing output. |
|
84 |
|
85 |
|
86 The reason that we do need to add a simplification phase |
|
87 after each derivative step of $\textit{blexer}$ is |
|
88 because it produces intermediate |
|
89 regular expressions that can grow exponentially. |
|
90 For example, the regular expression $(a+aa)^*$ after taking |
|
91 derivative against just 10 $a$s will have size 8192. |
|
92 |
|
93 %TODO: add figure for this? |
|
94 |
|
95 |
|
96 Therefore, we insert a simplification phase |
|
97 after each derivation step, as defined below: |
|
98 \begin{lemma} |
|
99 \isa{blexer{\isacharunderscore}{\kern0pt}simp\ r\ s\ {\isasymequiv}\ \textrm{if}\ nullable\mbox{$_b$}\ {\isacharparenleft}{\kern0pt}bders{\isacharunderscore}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r\mbox{$^\uparrow$}{\isacharparenright}{\kern0pt}\ s{\isacharparenright}{\kern0pt}\ \textrm{then}\ decode\ {\isacharparenleft}{\kern0pt}mkeps\mbox{$_b$}\ {\isacharparenleft}{\kern0pt}bders{\isacharunderscore}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r\mbox{$^\uparrow$}{\isacharparenright}{\kern0pt}\ s{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ r\ \textrm{else}\ None} |
|
100 \end{lemma} |
|
101 |
|
102 The simplification function is given as follows: |
|
103 |
|
104 \begin{center} |
|
105 \begin{tabular}{lcl} |
|
106 \isa{bsimp\ {\isacharparenleft}{\kern0pt}ASEQ\ bs\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{bsimp{\isacharunderscore}{\kern0pt}ASEQ\ bs\ {\isacharparenleft}{\kern0pt}bsimp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}bsimp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
107 \isa{bsimp\ {\isacharparenleft}{\kern0pt}AALTs\ bs{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}\ rs{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{bsimp{\isacharunderscore}{\kern0pt}AALTs\ bs{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}\ {\isacharparenleft}{\kern0pt}distinctBy\ {\isacharparenleft}{\kern0pt}flts\ {\isacharparenleft}{\kern0pt}map\ bsimp\ rs{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ erase\ {\isasymemptyset}{\isacharparenright}{\kern0pt}}\\ |
|
108 \isa{bsimp\ AZERO} & $\dn$ & \isa{AZERO}\\ |
|
109 |
|
110 \end{tabular} |
|
111 \end{center} |
|
112 |
|
113 And the two helper functions are: |
|
114 \begin{center} |
|
115 \begin{tabular}{lcl} |
|
116 \isa{bsimp{\isacharunderscore}{\kern0pt}AALTs\ bs\isactrlsub {\isadigit{1}}\ {\isacharbrackleft}{\kern0pt}r{\isacharbrackright}{\kern0pt}} & $\dn$ & \isa{bsimp{\isacharunderscore}{\kern0pt}ASEQ\ bs\isactrlsub {\isadigit{1}}\ {\isacharparenleft}{\kern0pt}bsimp\ r{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}bsimp\ r{\isadigit{2}}{\isachardot}{\kern0pt}{\isadigit{0}}{\isacharparenright}{\kern0pt}}\\ |
|
117 \isa{bsimp{\isacharunderscore}{\kern0pt}AALTs\ bs{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}\ {\isacharbrackleft}{\kern0pt}r{\isacharbrackright}{\kern0pt}} & $\dn$ & \isa{bsimp{\isacharunderscore}{\kern0pt}AALTs\ bs{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}\ {\isacharparenleft}{\kern0pt}distinctBy\ {\isacharparenleft}{\kern0pt}flts\ {\isacharparenleft}{\kern0pt}map\ bsimp\ rs{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ erase\ {\isasymemptyset}{\isacharparenright}{\kern0pt}}\\ |
|
118 \isa{bsimp{\isacharunderscore}{\kern0pt}AALTs\ bs{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}\ {\isacharparenleft}{\kern0pt}v\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vb\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vc{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{AZERO}\\ |
|
119 |
|
120 \end{tabular} |
|
121 \end{center} |
|
122 |
|
123 |
|
124 This might sound trivial in the case of producing a YES/NO answer, |
|
125 but once we require a lexing output to be produced (which is required |
|
126 in applications like compiler front-end, malicious attack domain extraction, |
|
127 etc.), it is not straightforward if we still extract what is needed according |
|
128 to the POSIX standard. |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 By simplification, we mean specifically the following rules: |
|
135 |
|
136 \begin{center} |
|
137 \begin{tabular}{lcl} |
|
138 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{ASEQ\ bs\ AZERO\ r\isactrlsub {\isadigit{2}}\ {\isasymleadsto}\ AZERO}}}\\ |
|
139 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{ASEQ\ bs\ r\isactrlsub {\isadigit{1}}\ AZERO\ {\isasymleadsto}\ AZERO}}}\\ |
|
140 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{ASEQ\ bs\ {\isacharparenleft}{\kern0pt}AONE\ bs\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymleadsto}\ fuse\ {\isacharparenleft}{\kern0pt}bs\ {\isacharat}{\kern0pt}\ bs\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ r\isactrlsub {\isadigit{1}}}}}\\ |
|
141 \isa{\mbox{}\inferrule{\mbox{r\isactrlsub {\isadigit{1}}\ {\isasymleadsto}\ r\isactrlsub {\isadigit{2}}}}{\mbox{ASEQ\ bs\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{3}}\ {\isasymleadsto}\ ASEQ\ bs\ r\isactrlsub {\isadigit{2}}\ r\isactrlsub {\isadigit{3}}}}}\\ |
|
142 \isa{\mbox{}\inferrule{\mbox{r\isactrlsub {\isadigit{3}}\ {\isasymleadsto}\ r\isactrlsub {\isadigit{4}}}}{\mbox{ASEQ\ bs\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{3}}\ {\isasymleadsto}\ ASEQ\ bs\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{4}}}}}\\ |
|
143 \isa{\mbox{}\inferrule{\mbox{r\ {\isasymleadsto}\ r{\isacharprime}{\kern0pt}}}{\mbox{AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}r{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ rs\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymleadsto}\ AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}r{\isacharprime}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ rs\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}}}\\ |
|
144 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub a\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}AZERO{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ rs\isactrlsub b{\isacharparenright}{\kern0pt}\ {\isasymleadsto}\ AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub a\ {\isacharat}{\kern0pt}\ rs\isactrlsub b{\isacharparenright}{\kern0pt}}}}\\ |
|
145 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub a\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}AALTs\ bs\isactrlsub {\isadigit{1}}\ rs\isactrlsub {\isadigit{1}}{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ rs\isactrlsub b{\isacharparenright}{\kern0pt}\ {\isasymleadsto}\ AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub a\ {\isacharat}{\kern0pt}\ map\ {\isacharparenleft}{\kern0pt}fuse\ bs\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ rs\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ rs\isactrlsub b{\isacharparenright}{\kern0pt}}}}\\ |
|
146 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{AALTs\ {\isacharparenleft}{\kern0pt}bs\ {\isacharat}{\kern0pt}\ bs\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ rs\ {\isasymleadsto}\ AALTs\ bs\ {\isacharparenleft}{\kern0pt}map\ {\isacharparenleft}{\kern0pt}fuse\ bs\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ rs{\isacharparenright}{\kern0pt}}}}\\ |
|
147 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{AALTs\ bs\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymleadsto}\ AZERO}}}\\ |
|
148 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{AALTs\ bs\ {\isacharbrackleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbrackright}{\kern0pt}\ {\isasymleadsto}\ fuse\ bs\ r\isactrlsub {\isadigit{1}}}}}\\ |
|
149 \isa{\mbox{}\inferrule{\mbox{a\isactrlsub {\isadigit{1}}\mbox{$^\downarrow$}\ {\isacharequal}{\kern0pt}\ a\isactrlsub {\isadigit{2}}\mbox{$^\downarrow$}}}{\mbox{AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub a\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}a\isactrlsub {\isadigit{1}}{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ rs\isactrlsub b\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}a\isactrlsub {\isadigit{2}}{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ rs\isactrlsub c{\isacharparenright}{\kern0pt}\ {\isasymleadsto}\ AALTs\ bs\ {\isacharparenleft}{\kern0pt}rs\isactrlsub a\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}a\isactrlsub {\isadigit{1}}{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ rs\isactrlsub b\ {\isacharat}{\kern0pt}\ rs\isactrlsub c{\isacharparenright}{\kern0pt}}}}\\ |
|
150 |
|
151 \end{tabular} |
|
152 \end{center} |
|
153 |
|
154 |
|
155 And these can be made compact by the following simplification function: |
|
156 |
|
157 where the function $\mathit{bsimp_AALTs}$ |
|
158 |
|
159 The core idea of the proof is that two regular expressions, |
|
160 if "isomorphic" up to a finite number of rewrite steps, will |
|
161 remain "isomorphic" when we take the same sequence of |
|
162 derivatives on both of them. |
|
163 This can be expressed by the following rewrite relation lemma: |
|
164 \begin{lemma} |
|
165 \isa{{\isacharparenleft}{\kern0pt}r\mbox{$\bbslash$}s{\isacharparenright}{\kern0pt}\ {\isasymleadsto}{\isacharasterisk}{\kern0pt}\ bders{\isacharunderscore}{\kern0pt}simp\ r\ s} |
|
166 \end{lemma} |
|
167 |
|
168 This isomorphic relation implies a property that leads to the |
|
169 correctness result: |
|
170 if two (nullable) regular expressions are "rewritable" in many steps |
|
171 from one another, |
|
172 then a call to function $\textit{bmkeps}$ gives the same |
|
173 bit-sequence : |
|
174 \begin{lemma} |
|
175 \isa{{\normalsize{}If\,}\ \mbox{r{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}\ {\isasymleadsto}{\isacharasterisk}{\kern0pt}\ r{\isadigit{2}}{\isachardot}{\kern0pt}{\isadigit{0}}}\ {\normalsize \,and\,}\ \mbox{nullable\mbox{$_b$}\ r{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}}\ {\normalsize \,then\,}\ mkeps\mbox{$_b$}\ r{\isadigit{1}}{\isachardot}{\kern0pt}{\isadigit{0}}\ {\isacharequal}{\kern0pt}\ mkeps\mbox{$_b$}\ r{\isadigit{2}}{\isachardot}{\kern0pt}{\isadigit{0}}{\isachardot}{\kern0pt}} |
|
176 \end{lemma} |
|
177 |
|
178 Given the same bit-sequence, the decode function |
|
179 will give out the same value, which is the output |
|
180 of both lexers: |
|
181 \begin{lemma} |
|
182 \isa{lexer\mbox{$_b$}\ r\ s\ {\isasymequiv}\ \textrm{if}\ nullable\mbox{$_b$}\ {\isacharparenleft}{\kern0pt}r\mbox{$^\uparrow$}\mbox{$\bbslash$}s{\isacharparenright}{\kern0pt}\ \textrm{then}\ decode\ {\isacharparenleft}{\kern0pt}mkeps\mbox{$_b$}\ {\isacharparenleft}{\kern0pt}r\mbox{$^\uparrow$}\mbox{$\bbslash$}s{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ r\ \textrm{else}\ None} |
|
183 \end{lemma} |
|
184 |
|
185 \begin{lemma} |
|
186 \isa{blexer{\isacharunderscore}{\kern0pt}simp\ r\ s\ {\isasymequiv}\ \textrm{if}\ nullable\mbox{$_b$}\ {\isacharparenleft}{\kern0pt}bders{\isacharunderscore}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r\mbox{$^\uparrow$}{\isacharparenright}{\kern0pt}\ s{\isacharparenright}{\kern0pt}\ \textrm{then}\ decode\ {\isacharparenleft}{\kern0pt}mkeps\mbox{$_b$}\ {\isacharparenleft}{\kern0pt}bders{\isacharunderscore}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r\mbox{$^\uparrow$}{\isacharparenright}{\kern0pt}\ s{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ r\ \textrm{else}\ None} |
|
187 \end{lemma} |
|
188 |
|
189 And that yields the correctness result: |
|
190 \begin{lemma} |
|
191 \isa{lexer\ r\ s\ {\isacharequal}{\kern0pt}\ blexer{\isacharunderscore}{\kern0pt}simp\ r\ s} |
|
192 \end{lemma} |
|
193 |
|
194 The nice thing about the above% |
|
195 \end{isamarkuptext}\isamarkuptrue% |
|
196 % |
|
197 \isadelimdocument |
|
198 % |
|
199 \endisadelimdocument |
|
200 % |
|
201 \isatagdocument |
|
202 % |
|
203 \isamarkupsection{Additional Simp Rules?% |
|
204 } |
|
205 \isamarkuptrue% |
|
206 % |
|
207 \endisatagdocument |
|
208 {\isafolddocument}% |
|
209 % |
|
210 \isadelimdocument |
|
211 % |
|
212 \endisadelimdocument |
|
213 % |
|
214 \begin{isamarkuptext}% |
|
215 One question someone would ask is: |
|
216 can we add more "atomic" simplification/rewriting rules, |
|
217 so the simplification is even more aggressive, making |
|
218 the intermediate results smaller, and therefore more space-efficient? |
|
219 For example, one might want to do open up alternatives who is a child |
|
220 of a sequence: |
|
221 |
|
222 \begin{center} |
|
223 \begin{tabular}{lcl} |
|
224 \isa{ASEQ\ bs\ {\isacharparenleft}{\kern0pt}AALTs\ bs{\isadigit{1}}\ rs{\isacharparenright}{\kern0pt}\ r\ {\isasymleadsto}{\isacharquery}{\kern0pt}\ AALTs\ {\isacharparenleft}{\kern0pt}bs\ {\isacharat}{\kern0pt}\ bs{\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}map\ {\isacharparenleft}{\kern0pt}{\isasymlambda}r{\isacharprime}{\kern0pt}{\isachardot}{\kern0pt}\ ASEQ\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ r{\isacharprime}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ rs{\isacharparenright}{\kern0pt}}\\ |
|
225 \end{tabular} |
|
226 \end{center} |
|
227 |
|
228 This rule allows us to simplify \mbox{\isa{a\ {\isacharplus}{\kern0pt}\ b\ {\isasymcdot}\ c\ {\isacharplus}{\kern0pt}\ a\ {\isasymcdot}\ c}}% |
|
229 \end{isamarkuptext}\isamarkuptrue% |
|
230 % |
|
231 \isadelimdocument |
|
232 % |
|
233 \endisadelimdocument |
|
234 % |
|
235 \isatagdocument |
|
236 % |
|
237 \isamarkupsection{Introduction% |
|
238 } |
|
239 \isamarkuptrue% |
|
240 % |
|
241 \endisatagdocument |
|
242 {\isafolddocument}% |
|
243 % |
|
244 \isadelimdocument |
|
245 % |
|
246 \endisadelimdocument |
|
247 % |
|
248 \begin{isamarkuptext}% |
|
249 Brzozowski \cite{Brzozowski1964} introduced the notion of the {\em |
|
250 derivative} \isa{r{\isacharbackslash}{\kern0pt}c} of a regular expression \isa{r} w.r.t.\ |
|
251 a character~\isa{c}, and showed that it gave a simple solution to the |
|
252 problem of matching a string \isa{s} with a regular expression \isa{r}: if the derivative of \isa{r} w.r.t.\ (in succession) all the |
|
253 characters of the string matches the empty string, then \isa{r} |
|
254 matches \isa{s} (and {\em vice versa}). The derivative has the |
|
255 property (which may almost be regarded as its specification) that, for |
|
256 every string \isa{s} and regular expression \isa{r} and character |
|
257 \isa{c}, one has \isa{cs\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}} if and only if \mbox{\isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}}}. |
|
258 The beauty of Brzozowski's derivatives is that |
|
259 they are neatly expressible in any functional language, and easily |
|
260 definable and reasoned about in theorem provers---the definitions just |
|
261 consist of inductive datatypes and simple recursive functions. A |
|
262 mechanised correctness proof of Brzozowski's matcher in for example HOL4 |
|
263 has been mentioned by Owens and Slind~\cite{Owens2008}. Another one in |
|
264 Isabelle/HOL is part of the work by Krauss and Nipkow \cite{Krauss2011}. |
|
265 And another one in Coq is given by Coquand and Siles \cite{Coquand2012}. |
|
266 |
|
267 If a regular expression matches a string, then in general there is more |
|
268 than one way of how the string is matched. There are two commonly used |
|
269 disambiguation strategies to generate a unique answer: one is called |
|
270 GREEDY matching \cite{Frisch2004} and the other is POSIX |
|
271 matching~\cite{POSIX,Kuklewicz,OkuiSuzuki2010,Sulzmann2014,Vansummeren2006}. |
|
272 For example consider the string \isa{xy} and the regular expression |
|
273 \mbox{\isa{{\isacharparenleft}{\kern0pt}x\ {\isacharplus}{\kern0pt}\ y\ {\isacharplus}{\kern0pt}\ xy{\isacharparenright}{\kern0pt}\isactrlsup {\isasymstar}}}. Either the string can be |
|
274 matched in two `iterations' by the single letter-regular expressions |
|
275 \isa{x} and \isa{y}, or directly in one iteration by \isa{xy}. The |
|
276 first case corresponds to GREEDY matching, which first matches with the |
|
277 left-most symbol and only matches the next symbol in case of a mismatch |
|
278 (this is greedy in the sense of preferring instant gratification to |
|
279 delayed repletion). The second case is POSIX matching, which prefers the |
|
280 longest match. |
|
281 |
|
282 In the context of lexing, where an input string needs to be split up |
|
283 into a sequence of tokens, POSIX is the more natural disambiguation |
|
284 strategy for what programmers consider basic syntactic building blocks |
|
285 in their programs. These building blocks are often specified by some |
|
286 regular expressions, say \isa{r\isactrlbsub key\isactrlesub } and \isa{r\isactrlbsub id\isactrlesub } for recognising keywords and identifiers, |
|
287 respectively. There are a few underlying (informal) rules behind |
|
288 tokenising a string in a POSIX \cite{POSIX} fashion: |
|
289 |
|
290 \begin{itemize} |
|
291 \item[$\bullet$] \emph{The Longest Match Rule} (or \emph{``{M}aximal {M}unch {R}ule''}): |
|
292 The longest initial substring matched by any regular expression is taken as |
|
293 next token.\smallskip |
|
294 |
|
295 \item[$\bullet$] \emph{Priority Rule:} |
|
296 For a particular longest initial substring, the first (leftmost) regular expression |
|
297 that can match determines the token.\smallskip |
|
298 |
|
299 \item[$\bullet$] \emph{Star Rule:} A subexpression repeated by ${}^\star$ shall |
|
300 not match an empty string unless this is the only match for the repetition.\smallskip |
|
301 |
|
302 \item[$\bullet$] \emph{Empty String Rule:} An empty string shall be considered to |
|
303 be longer than no match at all. |
|
304 \end{itemize} |
|
305 |
|
306 \noindent Consider for example a regular expression \isa{r\isactrlbsub key\isactrlesub } for recognising keywords such as \isa{if}, |
|
307 \isa{then} and so on; and \isa{r\isactrlbsub id\isactrlesub } |
|
308 recognising identifiers (say, a single character followed by |
|
309 characters or numbers). Then we can form the regular expression |
|
310 \isa{{\isacharparenleft}{\kern0pt}r\isactrlbsub key\isactrlesub \ {\isacharplus}{\kern0pt}\ r\isactrlbsub id\isactrlesub {\isacharparenright}{\kern0pt}\isactrlsup {\isasymstar}} |
|
311 and use POSIX matching to tokenise strings, say \isa{iffoo} and |
|
312 \isa{if}. For \isa{iffoo} we obtain by the Longest Match Rule |
|
313 a single identifier token, not a keyword followed by an |
|
314 identifier. For \isa{if} we obtain by the Priority Rule a keyword |
|
315 token, not an identifier token---even if \isa{r\isactrlbsub id\isactrlesub } |
|
316 matches also. By the Star Rule we know \isa{{\isacharparenleft}{\kern0pt}r\isactrlbsub key\isactrlesub \ {\isacharplus}{\kern0pt}\ r\isactrlbsub id\isactrlesub {\isacharparenright}{\kern0pt}\isactrlsup {\isasymstar}} matches \isa{iffoo}, |
|
317 respectively \isa{if}, in exactly one `iteration' of the star. The |
|
318 Empty String Rule is for cases where, for example, the regular expression |
|
319 \isa{{\isacharparenleft}{\kern0pt}a\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\isactrlsup {\isasymstar}} matches against the |
|
320 string \isa{bc}. Then the longest initial matched substring is the |
|
321 empty string, which is matched by both the whole regular expression |
|
322 and the parenthesised subexpression. |
|
323 |
|
324 |
|
325 One limitation of Brzozowski's matcher is that it only generates a |
|
326 YES/NO answer for whether a string is being matched by a regular |
|
327 expression. Sulzmann and Lu~\cite{Sulzmann2014} extended this matcher |
|
328 to allow generation not just of a YES/NO answer but of an actual |
|
329 matching, called a [lexical] {\em value}. Assuming a regular |
|
330 expression matches a string, values encode the information of |
|
331 \emph{how} the string is matched by the regular expression---that is, |
|
332 which part of the string is matched by which part of the regular |
|
333 expression. For this consider again the string \isa{xy} and |
|
334 the regular expression \mbox{\isa{{\isacharparenleft}{\kern0pt}x\ {\isacharplus}{\kern0pt}\ {\isacharparenleft}{\kern0pt}y\ {\isacharplus}{\kern0pt}\ xy{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\isactrlsup {\isasymstar}}} |
|
335 (this time fully parenthesised). We can view this regular expression |
|
336 as tree and if the string \isa{xy} is matched by two Star |
|
337 `iterations', then the \isa{x} is matched by the left-most |
|
338 alternative in this tree and the \isa{y} by the right-left alternative. This |
|
339 suggests to record this matching as |
|
340 |
|
341 \begin{center} |
|
342 \isa{Stars\ {\isacharbrackleft}{\kern0pt}Left\ {\isacharparenleft}{\kern0pt}Char\ x{\isacharparenright}{\kern0pt}{\isacharcomma}{\kern0pt}\ Right\ {\isacharparenleft}{\kern0pt}Left\ {\isacharparenleft}{\kern0pt}Char\ y{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isacharbrackright}{\kern0pt}} |
|
343 \end{center} |
|
344 |
|
345 \noindent where \isa{Stars}, \isa{Left}, \isa{Right} and \isa{Char} are constructors for values. \isa{Stars} records how many |
|
346 iterations were used; \isa{Left}, respectively \isa{Right}, which |
|
347 alternative is used. This `tree view' leads naturally to the idea that |
|
348 regular expressions act as types and values as inhabiting those types |
|
349 (see, for example, \cite{HosoyaVouillonPierce2005}). The value for |
|
350 matching \isa{xy} in a single `iteration', i.e.~the POSIX value, |
|
351 would look as follows |
|
352 |
|
353 \begin{center} |
|
354 \isa{Stars\ {\isacharbrackleft}{\kern0pt}Seq\ {\isacharparenleft}{\kern0pt}Char\ x{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}Char\ y{\isacharparenright}{\kern0pt}{\isacharbrackright}{\kern0pt}} |
|
355 \end{center} |
|
356 |
|
357 \noindent where \isa{Stars} has only a single-element list for the |
|
358 single iteration and \isa{Seq} indicates that \isa{xy} is matched |
|
359 by a sequence regular expression. |
|
360 |
|
361 %, which we will in what follows |
|
362 %write more formally as \isa{x\ {\isasymcdot}\ y}. |
|
363 |
|
364 |
|
365 Sulzmann and Lu give a simple algorithm to calculate a value that |
|
366 appears to be the value associated with POSIX matching. The challenge |
|
367 then is to specify that value, in an algorithm-independent fashion, |
|
368 and to show that Sulzmann and Lu's derivative-based algorithm does |
|
369 indeed calculate a value that is correct according to the |
|
370 specification. The answer given by Sulzmann and Lu |
|
371 \cite{Sulzmann2014} is to define a relation (called an ``order |
|
372 relation'') on the set of values of \isa{r}, and to show that (once |
|
373 a string to be matched is chosen) there is a maximum element and that |
|
374 it is computed by their derivative-based algorithm. This proof idea is |
|
375 inspired by work of Frisch and Cardelli \cite{Frisch2004} on a GREEDY |
|
376 regular expression matching algorithm. However, we were not able to |
|
377 establish transitivity and totality for the ``order relation'' by |
|
378 Sulzmann and Lu. There are some inherent problems with their approach |
|
379 (of which some of the proofs are not published in |
|
380 \cite{Sulzmann2014}); perhaps more importantly, we give in this paper |
|
381 a simple inductive (and algorithm-independent) definition of what we |
|
382 call being a {\em POSIX value} for a regular expression \isa{r} and |
|
383 a string \isa{s}; we show that the algorithm by Sulzmann and Lu |
|
384 computes such a value and that such a value is unique. Our proofs are |
|
385 both done by hand and checked in Isabelle/HOL. The experience of |
|
386 doing our proofs has been that this mechanical checking was absolutely |
|
387 essential: this subject area has hidden snares. This was also noted by |
|
388 Kuklewicz \cite{Kuklewicz} who found that nearly all POSIX matching |
|
389 implementations are ``buggy'' \cite[Page 203]{Sulzmann2014} and by |
|
390 Grathwohl et al \cite[Page 36]{CrashCourse2014} who wrote: |
|
391 |
|
392 \begin{quote} |
|
393 \it{}``The POSIX strategy is more complicated than the greedy because of |
|
394 the dependence on information about the length of matched strings in the |
|
395 various subexpressions.'' |
|
396 \end{quote} |
|
397 |
|
398 |
|
399 |
|
400 \noindent {\bf Contributions:} We have implemented in Isabelle/HOL the |
|
401 derivative-based regular expression matching algorithm of |
|
402 Sulzmann and Lu \cite{Sulzmann2014}. We have proved the correctness of this |
|
403 algorithm according to our specification of what a POSIX value is (inspired |
|
404 by work of Vansummeren \cite{Vansummeren2006}). Sulzmann |
|
405 and Lu sketch in \cite{Sulzmann2014} an informal correctness proof: but to |
|
406 us it contains unfillable gaps.\footnote{An extended version of |
|
407 \cite{Sulzmann2014} is available at the website of its first author; this |
|
408 extended version already includes remarks in the appendix that their |
|
409 informal proof contains gaps, and possible fixes are not fully worked out.} |
|
410 Our specification of a POSIX value consists of a simple inductive definition |
|
411 that given a string and a regular expression uniquely determines this value. |
|
412 We also show that our definition is equivalent to an ordering |
|
413 of values based on positions by Okui and Suzuki \cite{OkuiSuzuki2010}. |
|
414 |
|
415 %Derivatives as calculated by Brzozowski's method are usually more complex |
|
416 %regular expressions than the initial one; various optimisations are |
|
417 %possible. We prove the correctness when simplifications of \isa{\isactrlbold {\isadigit{0}}\ {\isacharplus}{\kern0pt}\ r}, |
|
418 %\isa{r\ {\isacharplus}{\kern0pt}\ \isactrlbold {\isadigit{0}}}, \isa{\isactrlbold {\isadigit{1}}\ {\isasymcdot}\ r} and \isa{r\ {\isasymcdot}\ \isactrlbold {\isadigit{1}}} to |
|
419 %\isa{r} are applied. |
|
420 |
|
421 We extend our results to ??? Bitcoded version??% |
|
422 \end{isamarkuptext}\isamarkuptrue% |
|
423 % |
|
424 \isadelimdocument |
|
425 % |
|
426 \endisadelimdocument |
|
427 % |
|
428 \isatagdocument |
|
429 % |
|
430 \isamarkupsection{Preliminaries% |
|
431 } |
|
432 \isamarkuptrue% |
|
433 % |
|
434 \endisatagdocument |
|
435 {\isafolddocument}% |
|
436 % |
|
437 \isadelimdocument |
|
438 % |
|
439 \endisadelimdocument |
|
440 % |
|
441 \begin{isamarkuptext}% |
|
442 \noindent Strings in Isabelle/HOL are lists of characters with |
|
443 the empty string being represented by the empty list, written \isa{{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}, and list-cons being written as \isa{\underline{\hspace{2mm}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}\underline{\hspace{2mm}}}. Often |
|
444 we use the usual bracket notation for lists also for strings; for |
|
445 example a string consisting of just a single character \isa{c} is |
|
446 written \isa{{\isacharbrackleft}{\kern0pt}c{\isacharbrackright}{\kern0pt}}. We use the usual definitions for |
|
447 \emph{prefixes} and \emph{strict prefixes} of strings. By using the |
|
448 type \isa{char} for characters we have a supply of finitely many |
|
449 characters roughly corresponding to the ASCII character set. Regular |
|
450 expressions are defined as usual as the elements of the following |
|
451 inductive datatype: |
|
452 |
|
453 \begin{center} |
|
454 \isa{r\ {\isacharcolon}{\kern0pt}{\isacharequal}{\kern0pt}} |
|
455 \isa{\isactrlbold {\isadigit{0}}} $\mid$ |
|
456 \isa{\isactrlbold {\isadigit{1}}} $\mid$ |
|
457 \isa{c} $\mid$ |
|
458 \isa{r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}} $\mid$ |
|
459 \isa{r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}} $\mid$ |
|
460 \isa{r\isactrlsup {\isasymstar}} |
|
461 \end{center} |
|
462 |
|
463 \noindent where \isa{\isactrlbold {\isadigit{0}}} stands for the regular expression that does |
|
464 not match any string, \isa{\isactrlbold {\isadigit{1}}} for the regular expression that matches |
|
465 only the empty string and \isa{c} for matching a character literal. The |
|
466 language of a regular expression is also defined as usual by the |
|
467 recursive function \isa{L} with the six clauses: |
|
468 |
|
469 \begin{center} |
|
470 \begin{tabular}{l@ {\hspace{4mm}}rcl} |
|
471 \textit{(1)} & \isa{L{\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{0}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isasymemptyset}}\\ |
|
472 \textit{(2)} & \isa{L{\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{1}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}}\\ |
|
473 \textit{(3)} & \isa{L{\isacharparenleft}{\kern0pt}c{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}c{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}}\\ |
|
474 \textit{(4)} & \isa{L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & |
|
475 \isa{L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharat}{\kern0pt}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
476 \textit{(5)} & \isa{L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & |
|
477 \isa{L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymunion}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
478 \textit{(6)} & \isa{L{\isacharparenleft}{\kern0pt}r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isasymstar}}\\ |
|
479 \end{tabular} |
|
480 \end{center} |
|
481 |
|
482 \noindent In clause \textit{(4)} we use the operation \isa{\underline{\hspace{2mm}}\ {\isacharat}{\kern0pt}\ \underline{\hspace{2mm}}} for the concatenation of two languages (it is also list-append for |
|
483 strings). We use the star-notation for regular expressions and for |
|
484 languages (in the last clause above). The star for languages is defined |
|
485 inductively by two clauses: \isa{{\isacharparenleft}{\kern0pt}i{\isacharparenright}{\kern0pt}} the empty string being in |
|
486 the star of a language and \isa{{\isacharparenleft}{\kern0pt}ii{\isacharparenright}{\kern0pt}} if \isa{s\isactrlsub {\isadigit{1}}} is in a |
|
487 language and \isa{s\isactrlsub {\isadigit{2}}} in the star of this language, then also \isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}} is in the star of this language. It will also be convenient |
|
488 to use the following notion of a \emph{semantic derivative} (or \emph{left |
|
489 quotient}) of a language defined as |
|
490 % |
|
491 \begin{center} |
|
492 \isa{Der\ c\ A\ {\isasymequiv}\ {\isacharbraceleft}{\kern0pt}s\ \mbox{\boldmath$\mid$}\ c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s\ {\isasymin}\ A{\isacharbraceright}{\kern0pt}}\;. |
|
493 \end{center} |
|
494 |
|
495 \noindent |
|
496 For semantic derivatives we have the following equations (for example |
|
497 mechanically proved in \cite{Krauss2011}): |
|
498 % |
|
499 \begin{equation}\label{SemDer} |
|
500 \begin{array}{lcl} |
|
501 \isa{Der\ c\ {\isasymemptyset}} & \dn & \isa{{\isasymemptyset}}\\ |
|
502 \isa{Der\ c\ {\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}} & \dn & \isa{{\isasymemptyset}}\\ |
|
503 \isa{Der\ c\ {\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}d{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}} & \dn & \isa{\textrm{if}\ c\ {\isacharequal}{\kern0pt}\ d\ \textrm{then}\ {\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ \textrm{else}\ {\isasymemptyset}}\\ |
|
504 \isa{Der\ c\ {\isacharparenleft}{\kern0pt}A\ {\isasymunion}\ B{\isacharparenright}{\kern0pt}} & \dn & \isa{Der\ c\ A\ {\isasymunion}\ Der\ c\ B}\\ |
|
505 \isa{Der\ c\ {\isacharparenleft}{\kern0pt}A\ {\isacharat}{\kern0pt}\ B{\isacharparenright}{\kern0pt}} & \dn & \isa{{\isacharparenleft}{\kern0pt}Der\ c\ A\ {\isacharat}{\kern0pt}\ B{\isacharparenright}{\kern0pt}\ {\isasymunion}\ {\isacharparenleft}{\kern0pt}\textrm{if}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymin}\ A\ \textrm{then}\ Der\ c\ B\ \textrm{else}\ {\isasymemptyset}{\isacharparenright}{\kern0pt}}\\ |
|
506 \isa{Der\ c\ {\isacharparenleft}{\kern0pt}A{\isasymstar}{\isacharparenright}{\kern0pt}} & \dn & \isa{Der\ c\ A\ {\isacharat}{\kern0pt}\ A{\isasymstar}} |
|
507 \end{array} |
|
508 \end{equation} |
|
509 |
|
510 |
|
511 \noindent \emph{\Brz's derivatives} of regular expressions |
|
512 \cite{Brzozowski1964} can be easily defined by two recursive functions: |
|
513 the first is from regular expressions to booleans (implementing a test |
|
514 when a regular expression can match the empty string), and the second |
|
515 takes a regular expression and a character to a (derivative) regular |
|
516 expression: |
|
517 |
|
518 \begin{center} |
|
519 \begin{tabular}{lcl} |
|
520 \isa{nullable\ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{0}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{False}\\ |
|
521 \isa{nullable\ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{1}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{True}\\ |
|
522 \isa{nullable\ {\isacharparenleft}{\kern0pt}c{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{False}\\ |
|
523 \isa{nullable\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{nullable\ r\isactrlsub {\isadigit{1}}\ {\isasymor}\ nullable\ r\isactrlsub {\isadigit{2}}}\\ |
|
524 \isa{nullable\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{nullable\ r\isactrlsub {\isadigit{1}}\ {\isasymand}\ nullable\ r\isactrlsub {\isadigit{2}}}\\ |
|
525 \isa{nullable\ {\isacharparenleft}{\kern0pt}r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{True}\medskip\\ |
|
526 |
|
527 % \end{tabular} |
|
528 % \end{center} |
|
529 |
|
530 % \begin{center} |
|
531 % \begin{tabular}{lcl} |
|
532 |
|
533 \isa{\isactrlbold {\isadigit{0}}{\isacharbackslash}{\kern0pt}c} & $\dn$ & \isa{\isactrlbold {\isadigit{0}}}\\ |
|
534 \isa{\isactrlbold {\isadigit{1}}{\isacharbackslash}{\kern0pt}c} & $\dn$ & \isa{\isactrlbold {\isadigit{0}}}\\ |
|
535 \isa{d{\isacharbackslash}{\kern0pt}c} & $\dn$ & \isa{\textrm{if}\ c\ {\isacharequal}{\kern0pt}\ d\ \textrm{then}\ \isactrlbold {\isadigit{1}}\ \textrm{else}\ \isactrlbold {\isadigit{0}}}\\ |
|
536 \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isacharplus}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}}\\ |
|
537 \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c} & $\dn$ & \isa{\textrm{if}\ nullable\ r\isactrlsub {\isadigit{1}}\ \textrm{then}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}\ {\isacharplus}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ \textrm{else}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}}\\ |
|
538 \isa{{\isacharparenleft}{\kern0pt}r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsup {\isasymstar}} |
|
539 \end{tabular} |
|
540 \end{center} |
|
541 |
|
542 \noindent |
|
543 We may extend this definition to give derivatives w.r.t.~strings: |
|
544 |
|
545 \begin{center} |
|
546 \begin{tabular}{lcl} |
|
547 \isa{r{\isacharbackslash}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} & $\dn$ & \isa{r}\\ |
|
548 \isa{r{\isacharbackslash}{\kern0pt}{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}s}\\ |
|
549 \end{tabular} |
|
550 \end{center} |
|
551 |
|
552 \noindent Given the equations in \eqref{SemDer}, it is a relatively easy |
|
553 exercise in mechanical reasoning to establish that |
|
554 |
|
555 \begin{proposition}\label{derprop}\mbox{}\\ |
|
556 \begin{tabular}{ll} |
|
557 \textit{(1)} & \isa{nullable\ r} if and only if |
|
558 \isa{{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}}, and \\ |
|
559 \textit{(2)} & \isa{L{\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ Der\ c\ {\isacharparenleft}{\kern0pt}L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}}. |
|
560 \end{tabular} |
|
561 \end{proposition} |
|
562 |
|
563 \noindent With this in place it is also very routine to prove that the |
|
564 regular expression matcher defined as |
|
565 % |
|
566 \begin{center} |
|
567 \isa{match\ r\ s\ {\isasymequiv}\ nullable\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}s{\isacharparenright}{\kern0pt}} |
|
568 \end{center} |
|
569 |
|
570 \noindent gives a positive answer if and only if \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}}. |
|
571 Consequently, this regular expression matching algorithm satisfies the |
|
572 usual specification for regular expression matching. While the matcher |
|
573 above calculates a provably correct YES/NO answer for whether a regular |
|
574 expression matches a string or not, the novel idea of Sulzmann and Lu |
|
575 \cite{Sulzmann2014} is to append another phase to this algorithm in order |
|
576 to calculate a [lexical] value. We will explain the details next.% |
|
577 \end{isamarkuptext}\isamarkuptrue% |
|
578 % |
|
579 \isadelimdocument |
|
580 % |
|
581 \endisadelimdocument |
|
582 % |
|
583 \isatagdocument |
|
584 % |
|
585 \isamarkupsection{POSIX Regular Expression Matching\label{posixsec}% |
|
586 } |
|
587 \isamarkuptrue% |
|
588 % |
|
589 \endisatagdocument |
|
590 {\isafolddocument}% |
|
591 % |
|
592 \isadelimdocument |
|
593 % |
|
594 \endisadelimdocument |
|
595 % |
|
596 \begin{isamarkuptext}% |
|
597 There have been many previous works that use values for encoding |
|
598 \emph{how} a regular expression matches a string. |
|
599 The clever idea by Sulzmann and Lu \cite{Sulzmann2014} is to |
|
600 define a function on values that mirrors (but inverts) the |
|
601 construction of the derivative on regular expressions. \emph{Values} |
|
602 are defined as the inductive datatype |
|
603 |
|
604 \begin{center} |
|
605 \isa{v\ {\isacharcolon}{\kern0pt}{\isacharequal}{\kern0pt}} |
|
606 \isa{Empty} $\mid$ |
|
607 \isa{Char\ c} $\mid$ |
|
608 \isa{Left\ v} $\mid$ |
|
609 \isa{Right\ v} $\mid$ |
|
610 \isa{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}} $\mid$ |
|
611 \isa{Stars\ vs} |
|
612 \end{center} |
|
613 |
|
614 \noindent where we use \isa{vs} to stand for a list of |
|
615 values. (This is similar to the approach taken by Frisch and |
|
616 Cardelli for GREEDY matching \cite{Frisch2004}, and Sulzmann and Lu |
|
617 for POSIX matching \cite{Sulzmann2014}). The string underlying a |
|
618 value can be calculated by the \isa{flat} function, written |
|
619 \isa{{\isacharbar}{\kern0pt}\underline{\hspace{2mm}}{\isacharbar}{\kern0pt}} and defined as: |
|
620 |
|
621 \begin{center} |
|
622 \begin{tabular}[t]{lcl} |
|
623 \isa{{\isacharbar}{\kern0pt}Empty{\isacharbar}{\kern0pt}} & $\dn$ & \isa{{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}\\ |
|
624 \isa{{\isacharbar}{\kern0pt}Char\ c{\isacharbar}{\kern0pt}} & $\dn$ & \isa{{\isacharbrackleft}{\kern0pt}c{\isacharbrackright}{\kern0pt}}\\ |
|
625 \isa{{\isacharbar}{\kern0pt}Left\ v{\isacharbar}{\kern0pt}} & $\dn$ & \isa{{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}}\\ |
|
626 \isa{{\isacharbar}{\kern0pt}Right\ v{\isacharbar}{\kern0pt}} & $\dn$ & \isa{{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}} |
|
627 \end{tabular}\hspace{14mm} |
|
628 \begin{tabular}[t]{lcl} |
|
629 \isa{{\isacharbar}{\kern0pt}Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} & $\dn$ & \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharat}{\kern0pt}\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}}\\ |
|
630 \isa{{\isacharbar}{\kern0pt}Stars\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbar}{\kern0pt}} & $\dn$ & \isa{{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}\\ |
|
631 \isa{{\isacharbar}{\kern0pt}Stars\ {\isacharparenleft}{\kern0pt}v\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs{\isacharparenright}{\kern0pt}{\isacharbar}{\kern0pt}} & $\dn$ & \isa{{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}\ {\isacharat}{\kern0pt}\ {\isacharbar}{\kern0pt}Stars\ vs{\isacharbar}{\kern0pt}}\\ |
|
632 \end{tabular} |
|
633 \end{center} |
|
634 |
|
635 \noindent We will sometimes refer to the underlying string of a |
|
636 value as \emph{flattened value}. We will also overload our notation and |
|
637 use \isa{{\isacharbar}{\kern0pt}vs{\isacharbar}{\kern0pt}} for flattening a list of values and concatenating |
|
638 the resulting strings. |
|
639 |
|
640 Sulzmann and Lu define |
|
641 inductively an \emph{inhabitation relation} that associates values to |
|
642 regular expressions. We define this relation as |
|
643 follows:\footnote{Note that the rule for \isa{Stars} differs from |
|
644 our earlier paper \cite{AusafDyckhoffUrban2016}. There we used the |
|
645 original definition by Sulzmann and Lu which does not require that |
|
646 the values \isa{v\ {\isasymin}\ vs} flatten to a non-empty |
|
647 string. The reason for introducing the more restricted version of |
|
648 lexical values is convenience later on when reasoning about an |
|
649 ordering relation for values.} |
|
650 |
|
651 \begin{center} |
|
652 \begin{tabular}{c@ {\hspace{12mm}}c}\label{prfintros} |
|
653 \\[-8mm] |
|
654 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{Empty\ {\isacharcolon}{\kern0pt}\ \isactrlbold {\isadigit{1}}}}} & |
|
655 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{Char\ c\ {\isacharcolon}{\kern0pt}\ c}}}\\[4mm] |
|
656 \isa{\mbox{}\inferrule{\mbox{v\isactrlsub {\isadigit{1}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{1}}}}{\mbox{Left\ v\isactrlsub {\isadigit{1}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}}}} & |
|
657 \isa{\mbox{}\inferrule{\mbox{v\isactrlsub {\isadigit{2}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{1}}}}{\mbox{Right\ v\isactrlsub {\isadigit{2}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{2}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{1}}}}}\\[4mm] |
|
658 \isa{\mbox{}\inferrule{\mbox{v\isactrlsub {\isadigit{1}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{1}}}\\\ \mbox{v\isactrlsub {\isadigit{2}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{2}}}}{\mbox{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}}}} & |
|
659 \isa{\mbox{}\inferrule{\mbox{{\isasymforall}v{\isasymin}vs{\isachardot}{\kern0pt}\ v\ {\isacharcolon}{\kern0pt}\ r\ {\isasymand}\ {\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}}{\mbox{Stars\ vs\ {\isacharcolon}{\kern0pt}\ r\isactrlsup {\isasymstar}}}} |
|
660 \end{tabular} |
|
661 \end{center} |
|
662 |
|
663 \noindent where in the clause for \isa{Stars} we use the |
|
664 notation \isa{v\ {\isasymin}\ vs} for indicating that \isa{v} is a |
|
665 member in the list \isa{vs}. We require in this rule that every |
|
666 value in \isa{vs} flattens to a non-empty string. The idea is that |
|
667 \isa{Stars}-values satisfy the informal Star Rule (see Introduction) |
|
668 where the $^\star$ does not match the empty string unless this is |
|
669 the only match for the repetition. Note also that no values are |
|
670 associated with the regular expression \isa{\isactrlbold {\isadigit{0}}}, and that the |
|
671 only value associated with the regular expression \isa{\isactrlbold {\isadigit{1}}} is |
|
672 \isa{Empty}. It is routine to establish how values ``inhabiting'' |
|
673 a regular expression correspond to the language of a regular |
|
674 expression, namely |
|
675 |
|
676 \begin{proposition}\label{inhabs} |
|
677 \isa{L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbraceleft}{\kern0pt}{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}\ \mbox{\boldmath$\mid$}\ v\ {\isacharcolon}{\kern0pt}\ r{\isacharbraceright}{\kern0pt}} |
|
678 \end{proposition} |
|
679 |
|
680 \noindent |
|
681 Given a regular expression \isa{r} and a string \isa{s}, we define the |
|
682 set of all \emph{Lexical Values} inhabited by \isa{r} with the underlying string |
|
683 being \isa{s}:\footnote{Okui and Suzuki refer to our lexical values |
|
684 as \emph{canonical values} in \cite{OkuiSuzuki2010}. The notion of \emph{non-problematic |
|
685 values} by Cardelli and Frisch \cite{Frisch2004} is related, but not identical |
|
686 to our lexical values.} |
|
687 |
|
688 \begin{center} |
|
689 \isa{LV\ r\ s\ {\isasymequiv}\ {\isacharbraceleft}{\kern0pt}v\ \mbox{\boldmath$\mid$}\ v\ {\isacharcolon}{\kern0pt}\ r\ {\isasymand}\ {\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ s{\isacharbraceright}{\kern0pt}} |
|
690 \end{center} |
|
691 |
|
692 \noindent The main property of \isa{LV\ r\ s} is that it is alway finite. |
|
693 |
|
694 \begin{proposition} |
|
695 \isa{finite\ {\isacharparenleft}{\kern0pt}LV\ r\ s{\isacharparenright}{\kern0pt}} |
|
696 \end{proposition} |
|
697 |
|
698 \noindent This finiteness property does not hold in general if we |
|
699 remove the side-condition about \isa{{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} in the |
|
700 \isa{Stars}-rule above. For example using Sulzmann and Lu's |
|
701 less restrictive definition, \isa{LV\ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{1}}\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} would contain |
|
702 infinitely many values, but according to our more restricted |
|
703 definition only a single value, namely \isa{LV\ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{1}}\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbraceleft}{\kern0pt}Stars\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}}. |
|
704 |
|
705 If a regular expression \isa{r} matches a string \isa{s}, then |
|
706 generally the set \isa{LV\ r\ s} is not just a singleton set. In |
|
707 case of POSIX matching the problem is to calculate the unique lexical value |
|
708 that satisfies the (informal) POSIX rules from the Introduction. |
|
709 Graphically the POSIX value calculation algorithm by Sulzmann and Lu |
|
710 can be illustrated by the picture in Figure~\ref{Sulz} where the |
|
711 path from the left to the right involving \isa{derivatives}/\isa{nullable} is the first phase of the algorithm |
|
712 (calculating successive \Brz's derivatives) and \isa{mkeps}/\isa{inj}, the path from right to left, the second |
|
713 phase. This picture shows the steps required when a regular |
|
714 expression, say \isa{r\isactrlsub {\isadigit{1}}}, matches the string \isa{{\isacharbrackleft}{\kern0pt}a{\isacharcomma}{\kern0pt}\ b{\isacharcomma}{\kern0pt}\ c{\isacharbrackright}{\kern0pt}}. We first build the three derivatives (according to |
|
715 \isa{a}, \isa{b} and \isa{c}). We then use \isa{nullable} |
|
716 to find out whether the resulting derivative regular expression |
|
717 \isa{r\isactrlsub {\isadigit{4}}} can match the empty string. If yes, we call the |
|
718 function \isa{mkeps} that produces a value \isa{v\isactrlsub {\isadigit{4}}} |
|
719 for how \isa{r\isactrlsub {\isadigit{4}}} can match the empty string (taking into |
|
720 account the POSIX constraints in case there are several ways). This |
|
721 function is defined by the clauses: |
|
722 |
|
723 \begin{figure}[t] |
|
724 \begin{center} |
|
725 \begin{tikzpicture}[scale=2,node distance=1.3cm, |
|
726 every node/.style={minimum size=6mm}] |
|
727 \node (r1) {\isa{r\isactrlsub {\isadigit{1}}}}; |
|
728 \node (r2) [right=of r1]{\isa{r\isactrlsub {\isadigit{2}}}}; |
|
729 \draw[->,line width=1mm](r1)--(r2) node[above,midway] {\isa{\underline{\hspace{2mm}}{\isacharbackslash}{\kern0pt}a}}; |
|
730 \node (r3) [right=of r2]{\isa{r\isactrlsub {\isadigit{3}}}}; |
|
731 \draw[->,line width=1mm](r2)--(r3) node[above,midway] {\isa{\underline{\hspace{2mm}}{\isacharbackslash}{\kern0pt}b}}; |
|
732 \node (r4) [right=of r3]{\isa{r\isactrlsub {\isadigit{4}}}}; |
|
733 \draw[->,line width=1mm](r3)--(r4) node[above,midway] {\isa{\underline{\hspace{2mm}}{\isacharbackslash}{\kern0pt}c}}; |
|
734 \draw (r4) node[anchor=west] {\;\raisebox{3mm}{\isa{nullable}}}; |
|
735 \node (v4) [below=of r4]{\isa{v\isactrlsub {\isadigit{4}}}}; |
|
736 \draw[->,line width=1mm](r4) -- (v4); |
|
737 \node (v3) [left=of v4] {\isa{v\isactrlsub {\isadigit{3}}}}; |
|
738 \draw[->,line width=1mm](v4)--(v3) node[below,midway] {\isa{inj\ r\isactrlsub {\isadigit{3}}\ c}}; |
|
739 \node (v2) [left=of v3]{\isa{v\isactrlsub {\isadigit{2}}}}; |
|
740 \draw[->,line width=1mm](v3)--(v2) node[below,midway] {\isa{inj\ r\isactrlsub {\isadigit{2}}\ b}}; |
|
741 \node (v1) [left=of v2] {\isa{v\isactrlsub {\isadigit{1}}}}; |
|
742 \draw[->,line width=1mm](v2)--(v1) node[below,midway] {\isa{inj\ r\isactrlsub {\isadigit{1}}\ a}}; |
|
743 \draw (r4) node[anchor=north west] {\;\raisebox{-8mm}{\isa{mkeps}}}; |
|
744 \end{tikzpicture} |
|
745 \end{center} |
|
746 \mbox{}\\[-13mm] |
|
747 |
|
748 \caption{The two phases of the algorithm by Sulzmann \& Lu \cite{Sulzmann2014}, |
|
749 matching the string \isa{{\isacharbrackleft}{\kern0pt}a{\isacharcomma}{\kern0pt}\ b{\isacharcomma}{\kern0pt}\ c{\isacharbrackright}{\kern0pt}}. The first phase (the arrows from |
|
750 left to right) is \Brz's matcher building successive derivatives. If the |
|
751 last regular expression is \isa{nullable}, then the functions of the |
|
752 second phase are called (the top-down and right-to-left arrows): first |
|
753 \isa{mkeps} calculates a value \isa{v\isactrlsub {\isadigit{4}}} witnessing |
|
754 how the empty string has been recognised by \isa{r\isactrlsub {\isadigit{4}}}. After |
|
755 that the function \isa{inj} ``injects back'' the characters of the string into |
|
756 the values. |
|
757 \label{Sulz}} |
|
758 \end{figure} |
|
759 |
|
760 \begin{center} |
|
761 \begin{tabular}{lcl} |
|
762 \isa{mkeps\ \isactrlbold {\isadigit{1}}} & $\dn$ & \isa{Empty}\\ |
|
763 \isa{mkeps\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{Seq\ {\isacharparenleft}{\kern0pt}mkeps\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}mkeps\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
764 \isa{mkeps\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{\textrm{if}\ nullable\ r\isactrlsub {\isadigit{1}}\ \textrm{then}\ Left\ {\isacharparenleft}{\kern0pt}mkeps\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ \textrm{else}\ Right\ {\isacharparenleft}{\kern0pt}mkeps\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
765 \isa{mkeps\ {\isacharparenleft}{\kern0pt}r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{Stars\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}\\ |
|
766 \end{tabular} |
|
767 \end{center} |
|
768 |
|
769 \noindent Note that this function needs only to be partially defined, |
|
770 namely only for regular expressions that are nullable. In case \isa{nullable} fails, the string \isa{{\isacharbrackleft}{\kern0pt}a{\isacharcomma}{\kern0pt}\ b{\isacharcomma}{\kern0pt}\ c{\isacharbrackright}{\kern0pt}} cannot be matched by \isa{r\isactrlsub {\isadigit{1}}} and the null value \isa{None} is returned. Note also how this function |
|
771 makes some subtle choices leading to a POSIX value: for example if an |
|
772 alternative regular expression, say \isa{r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}}, can |
|
773 match the empty string and furthermore \isa{r\isactrlsub {\isadigit{1}}} can match the |
|
774 empty string, then we return a \isa{Left}-value. The \isa{Right}-value will only be returned if \isa{r\isactrlsub {\isadigit{1}}} cannot match the empty |
|
775 string. |
|
776 |
|
777 The most interesting idea from Sulzmann and Lu \cite{Sulzmann2014} is |
|
778 the construction of a value for how \isa{r\isactrlsub {\isadigit{1}}} can match the |
|
779 string \isa{{\isacharbrackleft}{\kern0pt}a{\isacharcomma}{\kern0pt}\ b{\isacharcomma}{\kern0pt}\ c{\isacharbrackright}{\kern0pt}} from the value how the last derivative, \isa{r\isactrlsub {\isadigit{4}}} in Fig.~\ref{Sulz}, can match the empty string. Sulzmann and |
|
780 Lu achieve this by stepwise ``injecting back'' the characters into the |
|
781 values thus inverting the operation of building derivatives, but on the level |
|
782 of values. The corresponding function, called \isa{inj}, takes three |
|
783 arguments, a regular expression, a character and a value. For example in |
|
784 the first (or right-most) \isa{inj}-step in Fig.~\ref{Sulz} the regular |
|
785 expression \isa{r\isactrlsub {\isadigit{3}}}, the character \isa{c} from the last |
|
786 derivative step and \isa{v\isactrlsub {\isadigit{4}}}, which is the value corresponding |
|
787 to the derivative regular expression \isa{r\isactrlsub {\isadigit{4}}}. The result is |
|
788 the new value \isa{v\isactrlsub {\isadigit{3}}}. The final result of the algorithm is |
|
789 the value \isa{v\isactrlsub {\isadigit{1}}}. The \isa{inj} function is defined by recursion on regular |
|
790 expressions and by analysing the shape of values (corresponding to |
|
791 the derivative regular expressions). |
|
792 % |
|
793 \begin{center} |
|
794 \begin{tabular}{l@ {\hspace{5mm}}lcl} |
|
795 \textit{(1)} & \isa{inj\ d\ c\ {\isacharparenleft}{\kern0pt}Empty{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{Char\ d}\\ |
|
796 \textit{(2)} & \isa{inj\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ c\ {\isacharparenleft}{\kern0pt}Left\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}} & $\dn$ & |
|
797 \isa{Left\ {\isacharparenleft}{\kern0pt}inj\ r\isactrlsub {\isadigit{1}}\ c\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}}\\ |
|
798 \textit{(3)} & \isa{inj\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ c\ {\isacharparenleft}{\kern0pt}Right\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & |
|
799 \isa{Right\ {\isacharparenleft}{\kern0pt}inj\ r\isactrlsub {\isadigit{2}}\ c\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
800 \textit{(4)} & \isa{inj\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ c\ {\isacharparenleft}{\kern0pt}Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ |
|
801 & \isa{Seq\ {\isacharparenleft}{\kern0pt}inj\ r\isactrlsub {\isadigit{1}}\ c\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ v\isactrlsub {\isadigit{2}}}\\ |
|
802 \textit{(5)} & \isa{inj\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ c\ {\isacharparenleft}{\kern0pt}Left\ {\isacharparenleft}{\kern0pt}Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}} & $\dn$ |
|
803 & \isa{Seq\ {\isacharparenleft}{\kern0pt}inj\ r\isactrlsub {\isadigit{1}}\ c\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ v\isactrlsub {\isadigit{2}}}\\ |
|
804 \textit{(6)} & \isa{inj\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ c\ {\isacharparenleft}{\kern0pt}Right\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ |
|
805 & \isa{Seq\ {\isacharparenleft}{\kern0pt}mkeps\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}inj\ r\isactrlsub {\isadigit{2}}\ c\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
806 \textit{(7)} & \isa{inj\ {\isacharparenleft}{\kern0pt}r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\ c\ {\isacharparenleft}{\kern0pt}Seq\ v\ {\isacharparenleft}{\kern0pt}Stars\ vs{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}} & $\dn$ |
|
807 & \isa{Stars\ {\isacharparenleft}{\kern0pt}inj\ r\ c\ v\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs{\isacharparenright}{\kern0pt}}\\ |
|
808 \end{tabular} |
|
809 \end{center} |
|
810 |
|
811 \noindent To better understand what is going on in this definition it |
|
812 might be instructive to look first at the three sequence cases (clauses |
|
813 \textit{(4)} -- \textit{(6)}). In each case we need to construct an ``injected value'' for |
|
814 \isa{r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}}. This must be a value of the form \isa{Seq\ \underline{\hspace{2mm}}\ \underline{\hspace{2mm}}}\,. Recall the clause of the \isa{derivative}-function |
|
815 for sequence regular expressions: |
|
816 |
|
817 \begin{center} |
|
818 \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c} $\dn$ \isa{\textrm{if}\ nullable\ r\isactrlsub {\isadigit{1}}\ \textrm{then}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}\ {\isacharplus}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ \textrm{else}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}} |
|
819 \end{center} |
|
820 |
|
821 \noindent Consider first the \isa{else}-branch where the derivative is \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}}. The corresponding value must therefore |
|
822 be of the form \isa{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}}, which matches the left-hand |
|
823 side in clause~\textit{(4)} of \isa{inj}. In the \isa{if}-branch the derivative is an |
|
824 alternative, namely \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}\ {\isacharplus}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}}. This means we either have to consider a \isa{Left}- or |
|
825 \isa{Right}-value. In case of the \isa{Left}-value we know further it |
|
826 must be a value for a sequence regular expression. Therefore the pattern |
|
827 we match in the clause \textit{(5)} is \isa{Left\ {\isacharparenleft}{\kern0pt}Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}, |
|
828 while in \textit{(6)} it is just \isa{Right\ v\isactrlsub {\isadigit{2}}}. One more interesting |
|
829 point is in the right-hand side of clause \textit{(6)}: since in this case the |
|
830 regular expression \isa{r\isactrlsub {\isadigit{1}}} does not ``contribute'' to |
|
831 matching the string, that means it only matches the empty string, we need to |
|
832 call \isa{mkeps} in order to construct a value for how \isa{r\isactrlsub {\isadigit{1}}} |
|
833 can match this empty string. A similar argument applies for why we can |
|
834 expect in the left-hand side of clause \textit{(7)} that the value is of the form |
|
835 \isa{Seq\ v\ {\isacharparenleft}{\kern0pt}Stars\ vs{\isacharparenright}{\kern0pt}}---the derivative of a star is \isa{{\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsup {\isasymstar}}. Finally, the reason for why we can ignore the second argument |
|
836 in clause \textit{(1)} of \isa{inj} is that it will only ever be called in cases |
|
837 where \isa{c\ {\isacharequal}{\kern0pt}\ d}, but the usual linearity restrictions in patterns do |
|
838 not allow us to build this constraint explicitly into our function |
|
839 definition.\footnote{Sulzmann and Lu state this clause as \isa{inj\ c\ c\ {\isacharparenleft}{\kern0pt}Empty{\isacharparenright}{\kern0pt}} $\dn$ \isa{Char\ c}, |
|
840 but our deviation is harmless.} |
|
841 |
|
842 The idea of the \isa{inj}-function to ``inject'' a character, say |
|
843 \isa{c}, into a value can be made precise by the first part of the |
|
844 following lemma, which shows that the underlying string of an injected |
|
845 value has a prepended character \isa{c}; the second part shows that |
|
846 the underlying string of an \isa{mkeps}-value is always the empty |
|
847 string (given the regular expression is nullable since otherwise |
|
848 \isa{mkeps} might not be defined). |
|
849 |
|
850 \begin{lemma}\mbox{}\smallskip\\\label{Prf_injval_flat} |
|
851 \begin{tabular}{ll} |
|
852 (1) & \isa{{\normalsize{}If\,}\ v\ {\isacharcolon}{\kern0pt}\ r{\isacharbackslash}{\kern0pt}c\ {\normalsize \,then\,}\ {\isacharbar}{\kern0pt}inj\ r\ c\ v{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}{\isachardot}{\kern0pt}}\\ |
|
853 (2) & \isa{{\normalsize{}If\,}\ nullable\ r\ {\normalsize \,then\,}\ {\isacharbar}{\kern0pt}mkeps\ r{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isachardot}{\kern0pt}} |
|
854 \end{tabular} |
|
855 \end{lemma} |
|
856 |
|
857 \begin{proof} |
|
858 Both properties are by routine inductions: the first one can, for example, |
|
859 be proved by induction over the definition of \isa{derivatives}; the second by |
|
860 an induction on \isa{r}. There are no interesting cases.\qed |
|
861 \end{proof} |
|
862 |
|
863 Having defined the \isa{mkeps} and \isa{inj} function we can extend |
|
864 \Brz's matcher so that a value is constructed (assuming the |
|
865 regular expression matches the string). The clauses of the Sulzmann and Lu lexer are |
|
866 |
|
867 \begin{center} |
|
868 \begin{tabular}{lcl} |
|
869 \isa{lexer\ r\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} & $\dn$ & \isa{\textrm{if}\ nullable\ r\ \textrm{then}\ Some\ {\isacharparenleft}{\kern0pt}mkeps\ r{\isacharparenright}{\kern0pt}\ \textrm{else}\ None}\\ |
|
870 \isa{lexer\ r\ {\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{case} \isa{lexer\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ s} \isa{of}\\ |
|
871 & & \phantom{$|$} \isa{None} \isa{{\isasymRightarrow}} \isa{None}\\ |
|
872 & & $|$ \isa{Some\ v} \isa{{\isasymRightarrow}} \isa{Some\ {\isacharparenleft}{\kern0pt}inj\ r\ c\ v{\isacharparenright}{\kern0pt}} |
|
873 \end{tabular} |
|
874 \end{center} |
|
875 |
|
876 \noindent If the regular expression does not match the string, \isa{None} is |
|
877 returned. If the regular expression \emph{does} |
|
878 match the string, then \isa{Some} value is returned. One important |
|
879 virtue of this algorithm is that it can be implemented with ease in any |
|
880 functional programming language and also in Isabelle/HOL. In the remaining |
|
881 part of this section we prove that this algorithm is correct. |
|
882 |
|
883 The well-known idea of POSIX matching is informally defined by some |
|
884 rules such as the Longest Match and Priority Rules (see |
|
885 Introduction); as correctly argued in \cite{Sulzmann2014}, this |
|
886 needs formal specification. Sulzmann and Lu define an ``ordering |
|
887 relation'' between values and argue that there is a maximum value, |
|
888 as given by the derivative-based algorithm. In contrast, we shall |
|
889 introduce a simple inductive definition that specifies directly what |
|
890 a \emph{POSIX value} is, incorporating the POSIX-specific choices |
|
891 into the side-conditions of our rules. Our definition is inspired by |
|
892 the matching relation given by Vansummeren~\cite{Vansummeren2006}. |
|
893 The relation we define is ternary and |
|
894 written as \mbox{\isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}}, relating |
|
895 strings, regular expressions and values; the inductive rules are given in |
|
896 Figure~\ref{POSIXrules}. |
|
897 We can prove that given a string \isa{s} and regular expression \isa{r}, the POSIX value \isa{v} is uniquely determined by \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}. |
|
898 |
|
899 % |
|
900 \begin{figure}[t] |
|
901 \begin{center} |
|
902 \begin{tabular}{c} |
|
903 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{{\isacharparenleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharcomma}{\kern0pt}\ \isactrlbold {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Empty}}}\isa{P}\isa{\isactrlbold {\isadigit{1}}} \qquad |
|
904 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{{\isacharparenleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}c{\isacharbrackright}{\kern0pt}{\isacharcomma}{\kern0pt}\ c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Char\ c}}}\isa{P}\isa{c}\medskip\\ |
|
905 \isa{\mbox{}\inferrule{\mbox{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}}{\mbox{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Left\ v}}}\isa{P{\isacharplus}{\kern0pt}L}\qquad |
|
906 \isa{\mbox{}\inferrule{\mbox{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}\\\ \mbox{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}}}{\mbox{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Right\ v}}}\isa{P{\isacharplus}{\kern0pt}R}\medskip\\ |
|
907 $\mprset{flushleft} |
|
908 \inferrule |
|
909 {\isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{1}}} \qquad |
|
910 \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{2}}} \\\\ |
|
911 \isa{{\isasymnexists}s\isactrlsub {\isadigit{3}}\ s\isactrlsub {\isadigit{4}}{\isachardot}{\kern0pt}a{\isachardot}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{3}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{4}}\ {\isacharequal}{\kern0pt}\ s\isactrlsub {\isadigit{2}}\ {\isasymand}\ s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{4}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}} |
|
912 {\isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}}}$\isa{PS}\\ |
|
913 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{{\isacharparenleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharcomma}{\kern0pt}\ r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Stars\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}}}\isa{P{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}\medskip\\ |
|
914 $\mprset{flushleft} |
|
915 \inferrule |
|
916 {\isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v} \qquad |
|
917 \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Stars\ vs} \qquad |
|
918 \isa{{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} \\\\ |
|
919 \isa{{\isasymnexists}s\isactrlsub {\isadigit{3}}\ s\isactrlsub {\isadigit{4}}{\isachardot}{\kern0pt}a{\isachardot}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{3}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{4}}\ {\isacharequal}{\kern0pt}\ s\isactrlsub {\isadigit{2}}\ {\isasymand}\ s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{4}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}}} |
|
920 {\isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Stars\ {\isacharparenleft}{\kern0pt}v\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs{\isacharparenright}{\kern0pt}}}$\isa{P{\isasymstar}} |
|
921 \end{tabular} |
|
922 \end{center} |
|
923 \caption{Our inductive definition of POSIX values.}\label{POSIXrules} |
|
924 \end{figure} |
|
925 |
|
926 |
|
927 |
|
928 \begin{theorem}\mbox{}\smallskip\\\label{posixdeterm} |
|
929 \begin{tabular}{ll} |
|
930 (1) & If \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v} then \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}} and \isa{{\isacharbar}{\kern0pt}v{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ s}.\\ |
|
931 (2) & \isa{{\normalsize{}If\,}\ \mbox{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}\ {\normalsize \,and\,}\ \mbox{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isacharprime}{\kern0pt}}\ {\normalsize \,then\,}\ v\ {\isacharequal}{\kern0pt}\ v{\isacharprime}{\kern0pt}{\isachardot}{\kern0pt}} |
|
932 \end{tabular} |
|
933 \end{theorem} |
|
934 |
|
935 \begin{proof} Both by induction on the definition of \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}. |
|
936 The second parts follows by a case analysis of \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isacharprime}{\kern0pt}} and |
|
937 the first part.\qed |
|
938 \end{proof} |
|
939 |
|
940 \noindent |
|
941 We claim that our \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v} relation captures the idea behind the four |
|
942 informal POSIX rules shown in the Introduction: Consider for example the |
|
943 rules \isa{P{\isacharplus}{\kern0pt}L} and \isa{P{\isacharplus}{\kern0pt}R} where the POSIX value for a string |
|
944 and an alternative regular expression, that is \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}, |
|
945 is specified---it is always a \isa{Left}-value, \emph{except} when the |
|
946 string to be matched is not in the language of \isa{r\isactrlsub {\isadigit{1}}}; only then it |
|
947 is a \isa{Right}-value (see the side-condition in \isa{P{\isacharplus}{\kern0pt}R}). |
|
948 Interesting is also the rule for sequence regular expressions (\isa{PS}). The first two premises state that \isa{v\isactrlsub {\isadigit{1}}} and \isa{v\isactrlsub {\isadigit{2}}} |
|
949 are the POSIX values for \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}} and \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} |
|
950 respectively. Consider now the third premise and note that the POSIX value |
|
951 of this rule should match the string \mbox{\isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}}}. According to the |
|
952 Longest Match Rule, we want that the \isa{s\isactrlsub {\isadigit{1}}} is the longest initial |
|
953 split of \mbox{\isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}}} such that \isa{s\isactrlsub {\isadigit{2}}} is still recognised |
|
954 by \isa{r\isactrlsub {\isadigit{2}}}. Let us assume, contrary to the third premise, that there |
|
955 \emph{exist} an \isa{s\isactrlsub {\isadigit{3}}} and \isa{s\isactrlsub {\isadigit{4}}} such that \isa{s\isactrlsub {\isadigit{2}}} |
|
956 can be split up into a non-empty string \isa{s\isactrlsub {\isadigit{3}}} and a possibly empty |
|
957 string \isa{s\isactrlsub {\isadigit{4}}}. Moreover the longer string \isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{3}}} can be |
|
958 matched by \isa{r\isactrlsub {\isadigit{1}}} and the shorter \isa{s\isactrlsub {\isadigit{4}}} can still be |
|
959 matched by \isa{r\isactrlsub {\isadigit{2}}}. In this case \isa{s\isactrlsub {\isadigit{1}}} would \emph{not} be the |
|
960 longest initial split of \mbox{\isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}}} and therefore \isa{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}} cannot be a POSIX value for \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}. |
|
961 The main point is that our side-condition ensures the Longest |
|
962 Match Rule is satisfied. |
|
963 |
|
964 A similar condition is imposed on the POSIX value in the \isa{P{\isasymstar}}-rule. Also there we want that \isa{s\isactrlsub {\isadigit{1}}} is the longest initial |
|
965 split of \isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}} and furthermore the corresponding value |
|
966 \isa{v} cannot be flattened to the empty string. In effect, we require |
|
967 that in each ``iteration'' of the star, some non-empty substring needs to |
|
968 be ``chipped'' away; only in case of the empty string we accept \isa{Stars\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} as the POSIX value. Indeed we can show that our POSIX values |
|
969 are lexical values which exclude those \isa{Stars} that contain subvalues |
|
970 that flatten to the empty string. |
|
971 |
|
972 \begin{lemma}\label{LVposix} |
|
973 \isa{{\normalsize{}If\,}\ {\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\ {\normalsize \,then\,}\ v\ {\isasymin}\ LV\ r\ s{\isachardot}{\kern0pt}} |
|
974 \end{lemma} |
|
975 |
|
976 \begin{proof} |
|
977 By routine induction on \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}.\qed |
|
978 \end{proof} |
|
979 |
|
980 \noindent |
|
981 Next is the lemma that shows the function \isa{mkeps} calculates |
|
982 the POSIX value for the empty string and a nullable regular expression. |
|
983 |
|
984 \begin{lemma}\label{lemmkeps} |
|
985 \isa{{\normalsize{}If\,}\ nullable\ r\ {\normalsize \,then\,}\ {\isacharparenleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ mkeps\ r{\isachardot}{\kern0pt}} |
|
986 \end{lemma} |
|
987 |
|
988 \begin{proof} |
|
989 By routine induction on \isa{r}.\qed |
|
990 \end{proof} |
|
991 |
|
992 \noindent |
|
993 The central lemma for our POSIX relation is that the \isa{inj}-function |
|
994 preserves POSIX values. |
|
995 |
|
996 \begin{lemma}\label{Posix2} |
|
997 \isa{{\normalsize{}If\,}\ {\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\ {\normalsize \,then\,}\ {\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ inj\ r\ c\ v{\isachardot}{\kern0pt}} |
|
998 \end{lemma} |
|
999 |
|
1000 \begin{proof} |
|
1001 By induction on \isa{r}. We explain two cases. |
|
1002 |
|
1003 \begin{itemize} |
|
1004 \item[$\bullet$] Case \isa{r\ {\isacharequal}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}}. There are |
|
1005 two subcases, namely \isa{{\isacharparenleft}{\kern0pt}a{\isacharparenright}{\kern0pt}} \mbox{\isa{v\ {\isacharequal}{\kern0pt}\ Left\ v{\isacharprime}{\kern0pt}}} and \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isacharprime}{\kern0pt}}; and \isa{{\isacharparenleft}{\kern0pt}b{\isacharparenright}{\kern0pt}} \isa{v\ {\isacharequal}{\kern0pt}\ Right\ v{\isacharprime}{\kern0pt}}, \isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}} and \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isacharprime}{\kern0pt}}. In \isa{{\isacharparenleft}{\kern0pt}a{\isacharparenright}{\kern0pt}} we |
|
1006 know \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isacharprime}{\kern0pt}}, from which we can infer \isa{{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ inj\ r\isactrlsub {\isadigit{1}}\ c\ v{\isacharprime}{\kern0pt}} by induction hypothesis and hence \isa{{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ inj\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ c\ {\isacharparenleft}{\kern0pt}Left\ v{\isacharprime}{\kern0pt}{\isacharparenright}{\kern0pt}} as needed. Similarly |
|
1007 in subcase \isa{{\isacharparenleft}{\kern0pt}b{\isacharparenright}{\kern0pt}} where, however, in addition we have to use |
|
1008 Proposition~\ref{derprop}(2) in order to infer \isa{c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}} from \isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}}.\smallskip |
|
1009 |
|
1010 \item[$\bullet$] Case \isa{r\ {\isacharequal}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}}. There are three subcases: |
|
1011 |
|
1012 \begin{quote} |
|
1013 \begin{description} |
|
1014 \item[\isa{{\isacharparenleft}{\kern0pt}a{\isacharparenright}{\kern0pt}}] \isa{v\ {\isacharequal}{\kern0pt}\ Left\ {\isacharparenleft}{\kern0pt}Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} and \isa{nullable\ r\isactrlsub {\isadigit{1}}} |
|
1015 \item[\isa{{\isacharparenleft}{\kern0pt}b{\isacharparenright}{\kern0pt}}] \isa{v\ {\isacharequal}{\kern0pt}\ Right\ v\isactrlsub {\isadigit{1}}} and \isa{nullable\ r\isactrlsub {\isadigit{1}}} |
|
1016 \item[\isa{{\isacharparenleft}{\kern0pt}c{\isacharparenright}{\kern0pt}}] \isa{v\ {\isacharequal}{\kern0pt}\ Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}} and \isa{{\isasymnot}\ nullable\ r\isactrlsub {\isadigit{1}}} |
|
1017 \end{description} |
|
1018 \end{quote} |
|
1019 |
|
1020 \noindent For \isa{{\isacharparenleft}{\kern0pt}a{\isacharparenright}{\kern0pt}} we know \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{1}}} and |
|
1021 \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{2}}} as well as |
|
1022 % |
|
1023 \[\isa{{\isasymnexists}s\isactrlsub {\isadigit{3}}\ s\isactrlsub {\isadigit{4}}{\isachardot}{\kern0pt}a{\isachardot}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{3}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{4}}\ {\isacharequal}{\kern0pt}\ s\isactrlsub {\isadigit{2}}\ {\isasymand}\ s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{4}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\] |
|
1024 |
|
1025 \noindent From the latter we can infer by Proposition~\ref{derprop}(2): |
|
1026 % |
|
1027 \[\isa{{\isasymnexists}s\isactrlsub {\isadigit{3}}\ s\isactrlsub {\isadigit{4}}{\isachardot}{\kern0pt}a{\isachardot}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{3}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{4}}\ {\isacharequal}{\kern0pt}\ s\isactrlsub {\isadigit{2}}\ {\isasymand}\ c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{4}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\] |
|
1028 |
|
1029 \noindent We can use the induction hypothesis for \isa{r\isactrlsub {\isadigit{1}}} to obtain |
|
1030 \isa{{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ inj\ r\isactrlsub {\isadigit{1}}\ c\ v\isactrlsub {\isadigit{1}}}. Putting this all together allows us to infer |
|
1031 \isa{{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Seq\ {\isacharparenleft}{\kern0pt}inj\ r\isactrlsub {\isadigit{1}}\ c\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ v\isactrlsub {\isadigit{2}}}. The case \isa{{\isacharparenleft}{\kern0pt}c{\isacharparenright}{\kern0pt}} |
|
1032 is similar. |
|
1033 |
|
1034 For \isa{{\isacharparenleft}{\kern0pt}b{\isacharparenright}{\kern0pt}} we know \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{1}}} and |
|
1035 \isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}. From the former |
|
1036 we have \isa{{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ inj\ r\isactrlsub {\isadigit{2}}\ c\ v\isactrlsub {\isadigit{1}}} by induction hypothesis |
|
1037 for \isa{r\isactrlsub {\isadigit{2}}}. From the latter we can infer |
|
1038 % |
|
1039 \[\isa{{\isasymnexists}s\isactrlsub {\isadigit{3}}\ s\isactrlsub {\isadigit{4}}{\isachardot}{\kern0pt}a{\isachardot}{\kern0pt}\ s\isactrlsub {\isadigit{3}}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{3}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{4}}\ {\isacharequal}{\kern0pt}\ c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s\ {\isasymand}\ s\isactrlsub {\isadigit{3}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymand}\ s\isactrlsub {\isadigit{4}}\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\] |
|
1040 |
|
1041 \noindent By Lemma~\ref{lemmkeps} we know \isa{{\isacharparenleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ mkeps\ r\isactrlsub {\isadigit{1}}} |
|
1042 holds. Putting this all together, we can conclude with \isa{{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Seq\ {\isacharparenleft}{\kern0pt}mkeps\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}inj\ r\isactrlsub {\isadigit{2}}\ c\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}}, as required. |
|
1043 |
|
1044 Finally suppose \isa{r\ {\isacharequal}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\isactrlsup {\isasymstar}}. This case is very similar to the |
|
1045 sequence case, except that we need to also ensure that \isa{{\isacharbar}{\kern0pt}inj\ r\isactrlsub {\isadigit{1}}\ c\ v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isasymnoteq}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}. This follows from \isa{{\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ inj\ r\isactrlsub {\isadigit{1}}\ c\ v\isactrlsub {\isadigit{1}}} (which in turn follows from \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{1}}} and the induction hypothesis).\qed |
|
1046 \end{itemize} |
|
1047 \end{proof} |
|
1048 |
|
1049 \noindent |
|
1050 With Lemma~\ref{Posix2} in place, it is completely routine to establish |
|
1051 that the Sulzmann and Lu lexer satisfies our specification (returning |
|
1052 the null value \isa{None} iff the string is not in the language of the regular expression, |
|
1053 and returning a unique POSIX value iff the string \emph{is} in the language): |
|
1054 |
|
1055 \begin{theorem}\mbox{}\smallskip\\\label{lexercorrect} |
|
1056 \begin{tabular}{ll} |
|
1057 (1) & \isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}} if and only if \isa{lexer\ r\ s\ {\isacharequal}{\kern0pt}\ None}\\ |
|
1058 (2) & \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}} if and only if \isa{{\isasymexists}v{\isachardot}{\kern0pt}\ lexer\ r\ s\ {\isacharequal}{\kern0pt}\ Some\ v\ {\isasymand}\ {\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}\\ |
|
1059 \end{tabular} |
|
1060 \end{theorem} |
|
1061 |
|
1062 \begin{proof} |
|
1063 By induction on \isa{s} using Lemma~\ref{lemmkeps} and \ref{Posix2}.\qed |
|
1064 \end{proof} |
|
1065 |
|
1066 \noindent In \textit{(2)} we further know by Theorem~\ref{posixdeterm} that the |
|
1067 value returned by the lexer must be unique. A simple corollary |
|
1068 of our two theorems is: |
|
1069 |
|
1070 \begin{corollary}\mbox{}\smallskip\\\label{lexercorrectcor} |
|
1071 \begin{tabular}{ll} |
|
1072 (1) & \isa{lexer\ r\ s\ {\isacharequal}{\kern0pt}\ None} if and only if \isa{{\isasymnexists}v{\isachardot}{\kern0pt}a{\isachardot}{\kern0pt}\ {\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}\\ |
|
1073 (2) & \isa{lexer\ r\ s\ {\isacharequal}{\kern0pt}\ Some\ v} if and only if \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}\\ |
|
1074 \end{tabular} |
|
1075 \end{corollary} |
|
1076 |
|
1077 \noindent This concludes our correctness proof. Note that we have |
|
1078 not changed the algorithm of Sulzmann and Lu,\footnote{All |
|
1079 deviations we introduced are harmless.} but introduced our own |
|
1080 specification for what a correct result---a POSIX value---should be. |
|
1081 In the next section we show that our specification coincides with |
|
1082 another one given by Okui and Suzuki using a different technique.% |
|
1083 \end{isamarkuptext}\isamarkuptrue% |
|
1084 % |
|
1085 \isadelimdocument |
|
1086 % |
|
1087 \endisadelimdocument |
|
1088 % |
|
1089 \isatagdocument |
|
1090 % |
|
1091 \isamarkupsection{Ordering of Values according to Okui and Suzuki% |
|
1092 } |
|
1093 \isamarkuptrue% |
|
1094 % |
|
1095 \endisatagdocument |
|
1096 {\isafolddocument}% |
|
1097 % |
|
1098 \isadelimdocument |
|
1099 % |
|
1100 \endisadelimdocument |
|
1101 % |
|
1102 \begin{isamarkuptext}% |
|
1103 While in the previous section we have defined POSIX values directly |
|
1104 in terms of a ternary relation (see inference rules in Figure~\ref{POSIXrules}), |
|
1105 Sulzmann and Lu took a different approach in \cite{Sulzmann2014}: |
|
1106 they introduced an ordering for values and identified POSIX values |
|
1107 as the maximal elements. An extended version of \cite{Sulzmann2014} |
|
1108 is available at the website of its first author; this includes more |
|
1109 details of their proofs, but which are evidently not in final form |
|
1110 yet. Unfortunately, we were not able to verify claims that their |
|
1111 ordering has properties such as being transitive or having maximal |
|
1112 elements. |
|
1113 |
|
1114 Okui and Suzuki \cite{OkuiSuzuki2010,OkuiSuzukiTech} described |
|
1115 another ordering of values, which they use to establish the |
|
1116 correctness of their automata-based algorithm for POSIX matching. |
|
1117 Their ordering resembles some aspects of the one given by Sulzmann |
|
1118 and Lu, but overall is quite different. To begin with, Okui and |
|
1119 Suzuki identify POSIX values as minimal, rather than maximal, |
|
1120 elements in their ordering. A more substantial difference is that |
|
1121 the ordering by Okui and Suzuki uses \emph{positions} in order to |
|
1122 identify and compare subvalues. Positions are lists of natural |
|
1123 numbers. This allows them to quite naturally formalise the Longest |
|
1124 Match and Priority rules of the informal POSIX standard. Consider |
|
1125 for example the value \isa{v} |
|
1126 |
|
1127 \begin{center} |
|
1128 \isa{v\ {\isasymequiv}\ Stars\ {\isacharbrackleft}{\kern0pt}Seq\ {\isacharparenleft}{\kern0pt}Char\ x{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}Char\ y{\isacharparenright}{\kern0pt}{\isacharcomma}{\kern0pt}\ Char\ z{\isacharbrackright}{\kern0pt}} |
|
1129 \end{center} |
|
1130 |
|
1131 \noindent |
|
1132 At position \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{0}}{\isacharcomma}{\kern0pt}{\isadigit{1}}{\isacharbrackright}{\kern0pt}} of this value is the |
|
1133 subvalue \isa{Char\ y} and at position \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{1}}{\isacharbrackright}{\kern0pt}} the |
|
1134 subvalue \isa{Char\ z}. At the `root' position, or empty list |
|
1135 \isa{{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}}, is the whole value \isa{v}. Positions such as \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{0}}{\isacharcomma}{\kern0pt}{\isadigit{1}}{\isacharcomma}{\kern0pt}{\isadigit{0}}{\isacharbrackright}{\kern0pt}} or \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{2}}{\isacharbrackright}{\kern0pt}} are outside of \isa{v}. If it exists, the subvalue of \isa{v} at a position \isa{p}, written \isa{v\mbox{$\downharpoonleft$}\isactrlbsub p\isactrlesub }, can be recursively defined by |
|
1136 |
|
1137 \begin{center} |
|
1138 \begin{tabular}{r@ {\hspace{0mm}}lcl} |
|
1139 \isa{v} & \isa{{\isasymdownharpoonleft}\isactrlbsub {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\isactrlesub } & \isa{{\isasymequiv}}& \isa{v}\\ |
|
1140 \isa{Left\ v} & \isa{{\isasymdownharpoonleft}\isactrlbsub {\isadigit{0}}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}ps\isactrlesub } & \isa{{\isasymequiv}}& \isa{v\mbox{$\downharpoonleft$}\isactrlbsub ps\isactrlesub }\\ |
|
1141 \isa{Right\ v} & \isa{{\isasymdownharpoonleft}\isactrlbsub {\isadigit{1}}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}ps\isactrlesub } & \isa{{\isasymequiv}} & |
|
1142 \isa{v\mbox{$\downharpoonleft$}\isactrlbsub ps\isactrlesub }\\ |
|
1143 \isa{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}} & \isa{{\isasymdownharpoonleft}\isactrlbsub {\isadigit{0}}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}ps\isactrlesub } & \isa{{\isasymequiv}} & |
|
1144 \isa{v\isactrlsub {\isadigit{1}}\mbox{$\downharpoonleft$}\isactrlbsub ps\isactrlesub } \\ |
|
1145 \isa{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}} & \isa{{\isasymdownharpoonleft}\isactrlbsub {\isadigit{1}}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}ps\isactrlesub } |
|
1146 & \isa{{\isasymequiv}} & |
|
1147 \isa{v\isactrlsub {\isadigit{2}}\mbox{$\downharpoonleft$}\isactrlbsub ps\isactrlesub } \\ |
|
1148 \isa{Stars\ vs} & \isa{{\isasymdownharpoonleft}\isactrlbsub n{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}ps\isactrlesub } & \isa{{\isasymequiv}}& \isa{vs\ensuremath{_{[\mathit{n}]}}\mbox{$\downharpoonleft$}\isactrlbsub ps\isactrlesub }\\ |
|
1149 \end{tabular} |
|
1150 \end{center} |
|
1151 |
|
1152 \noindent In the last clause we use Isabelle's notation \isa{vs\ensuremath{_{[\mathit{n}]}}} for the |
|
1153 \isa{n}th element in a list. The set of positions inside a value \isa{v}, |
|
1154 written \isa{Pos\ v}, is given by |
|
1155 |
|
1156 \begin{center} |
|
1157 \begin{tabular}{lcl} |
|
1158 \isa{Pos\ {\isacharparenleft}{\kern0pt}Empty{\isacharparenright}{\kern0pt}} & \isa{{\isasymequiv}} & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}}\\ |
|
1159 \isa{Pos\ {\isacharparenleft}{\kern0pt}Char\ c{\isacharparenright}{\kern0pt}} & \isa{{\isasymequiv}} & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}}\\ |
|
1160 \isa{Pos\ {\isacharparenleft}{\kern0pt}Left\ v{\isacharparenright}{\kern0pt}} & \isa{{\isasymequiv}} & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isasymunion}\ {\isacharbraceleft}{\kern0pt}{\isadigit{0}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\ \mbox{\boldmath$\mid$}\ ps\ {\isasymin}\ Pos\ v{\isacharbraceright}{\kern0pt}}\\ |
|
1161 \isa{Pos\ {\isacharparenleft}{\kern0pt}Right\ v{\isacharparenright}{\kern0pt}} & \isa{{\isasymequiv}} & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isasymunion}\ {\isacharbraceleft}{\kern0pt}{\isadigit{1}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\ \mbox{\boldmath$\mid$}\ ps\ {\isasymin}\ Pos\ v{\isacharbraceright}{\kern0pt}}\\ |
|
1162 \isa{Pos\ {\isacharparenleft}{\kern0pt}Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} |
|
1163 & \isa{{\isasymequiv}} |
|
1164 & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isasymunion}\ {\isacharbraceleft}{\kern0pt}{\isadigit{0}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\ \mbox{\boldmath$\mid$}\ ps\ {\isasymin}\ Pos\ v\isactrlsub {\isadigit{1}}{\isacharbraceright}{\kern0pt}\ {\isasymunion}\ {\isacharbraceleft}{\kern0pt}{\isadigit{1}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\ \mbox{\boldmath$\mid$}\ ps\ {\isasymin}\ Pos\ v\isactrlsub {\isadigit{2}}{\isacharbraceright}{\kern0pt}}\\ |
|
1165 \isa{Pos\ {\isacharparenleft}{\kern0pt}Stars\ vs{\isacharparenright}{\kern0pt}} & \isa{{\isasymequiv}} & \isa{{\isacharbraceleft}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isasymunion}\ {\isacharparenleft}{\kern0pt}{\isasymUnion}n\ {\isacharless}{\kern0pt}\ len\ vs\ {\isacharbraceleft}{\kern0pt}n\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\ \mbox{\boldmath$\mid$}\ ps\ {\isasymin}\ Pos\ vs\ensuremath{_{[\mathit{n}]}}{\isacharbraceright}{\kern0pt}{\isacharparenright}{\kern0pt}}\\ |
|
1166 \end{tabular} |
|
1167 \end{center} |
|
1168 |
|
1169 \noindent |
|
1170 whereby \isa{len} in the last clause stands for the length of a list. Clearly |
|
1171 for every position inside a value there exists a subvalue at that position. |
|
1172 |
|
1173 |
|
1174 To help understanding the ordering of Okui and Suzuki, consider again |
|
1175 the earlier value |
|
1176 \isa{v} and compare it with the following \isa{w}: |
|
1177 |
|
1178 \begin{center} |
|
1179 \begin{tabular}{l} |
|
1180 \isa{v\ {\isasymequiv}\ Stars\ {\isacharbrackleft}{\kern0pt}Seq\ {\isacharparenleft}{\kern0pt}Char\ x{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}Char\ y{\isacharparenright}{\kern0pt}{\isacharcomma}{\kern0pt}\ Char\ z{\isacharbrackright}{\kern0pt}}\\ |
|
1181 \isa{w\ {\isasymequiv}\ Stars\ {\isacharbrackleft}{\kern0pt}Char\ x{\isacharcomma}{\kern0pt}\ Char\ y{\isacharcomma}{\kern0pt}\ Char\ z{\isacharbrackright}{\kern0pt}} |
|
1182 \end{tabular} |
|
1183 \end{center} |
|
1184 |
|
1185 \noindent Both values match the string \isa{xyz}, that means if |
|
1186 we flatten these values at their respective root position, we obtain |
|
1187 \isa{xyz}. However, at position \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{0}}{\isacharbrackright}{\kern0pt}}, \isa{v} matches |
|
1188 \isa{xy} whereas \isa{w} matches only the shorter \isa{x}. So |
|
1189 according to the Longest Match Rule, we should prefer \isa{v}, |
|
1190 rather than \isa{w} as POSIX value for string \isa{xyz} (and |
|
1191 corresponding regular expression). In order to |
|
1192 formalise this idea, Okui and Suzuki introduce a measure for |
|
1193 subvalues at position \isa{p}, called the \emph{norm} of \isa{v} |
|
1194 at position \isa{p}. We can define this measure in Isabelle as an |
|
1195 integer as follows |
|
1196 |
|
1197 \begin{center} |
|
1198 \isa{{\isasymparallel}v{\isasymparallel}\isactrlbsub p\isactrlesub \ {\isasymequiv}\ \textrm{if}\ p\ {\isasymin}\ Pos\ v\ \textrm{then}\ len\ {\isacharbar}{\kern0pt}v\mbox{$\downharpoonleft$}\isactrlbsub p\isactrlesub {\isacharbar}{\kern0pt}\ \textrm{else}\ {\isacharminus}{\kern0pt}\ {\isadigit{1}}} |
|
1199 \end{center} |
|
1200 |
|
1201 \noindent where we take the length of the flattened value at |
|
1202 position \isa{p}, provided the position is inside \isa{v}; if |
|
1203 not, then the norm is \isa{{\isacharminus}{\kern0pt}{\isadigit{1}}}. The default for outside |
|
1204 positions is crucial for the POSIX requirement of preferring a |
|
1205 \isa{Left}-value over a \isa{Right}-value (if they can match the |
|
1206 same string---see the Priority Rule from the Introduction). For this |
|
1207 consider |
|
1208 |
|
1209 \begin{center} |
|
1210 \isa{v\ {\isasymequiv}\ Left\ {\isacharparenleft}{\kern0pt}Char\ x{\isacharparenright}{\kern0pt}} \qquad and \qquad \isa{w\ {\isasymequiv}\ Right\ {\isacharparenleft}{\kern0pt}Char\ x{\isacharparenright}{\kern0pt}} |
|
1211 \end{center} |
|
1212 |
|
1213 \noindent Both values match \isa{x}. At position \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{0}}{\isacharbrackright}{\kern0pt}} |
|
1214 the norm of \isa{v} is \isa{{\isadigit{1}}} (the subvalue matches \isa{x}), |
|
1215 but the norm of \isa{w} is \isa{{\isacharminus}{\kern0pt}{\isadigit{1}}} (the position is outside |
|
1216 \isa{w} according to how we defined the `inside' positions of |
|
1217 \isa{Left}- and \isa{Right}-values). Of course at position |
|
1218 \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{1}}{\isacharbrackright}{\kern0pt}}, the norms \isa{{\isasymparallel}v{\isasymparallel}\isactrlbsub {\isacharbrackleft}{\kern0pt}{\isadigit{1}}{\isacharbrackright}{\kern0pt}\isactrlesub } and \isa{{\isasymparallel}w{\isasymparallel}\isactrlbsub {\isacharbrackleft}{\kern0pt}{\isadigit{1}}{\isacharbrackright}{\kern0pt}\isactrlesub } are reversed, but the point is that subvalues |
|
1219 will be analysed according to lexicographically ordered |
|
1220 positions. According to this ordering, the position \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{0}}{\isacharbrackright}{\kern0pt}} |
|
1221 takes precedence over \isa{{\isacharbrackleft}{\kern0pt}{\isadigit{1}}{\isacharbrackright}{\kern0pt}} and thus also \isa{v} will be |
|
1222 preferred over \isa{w}. The lexicographic ordering of positions, written |
|
1223 \isa{\underline{\hspace{2mm}}\ {\isasymprec}\isactrlbsub lex\isactrlesub \ \underline{\hspace{2mm}}}, can be conveniently formalised |
|
1224 by three inference rules |
|
1225 |
|
1226 \begin{center} |
|
1227 \begin{tabular}{ccc} |
|
1228 \isa{\mbox{}\inferrule{\mbox{}}{\mbox{{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ {\isasymprec}\isactrlbsub lex\isactrlesub \ p\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps}}}\hspace{1cm} & |
|
1229 \isa{\mbox{}\inferrule{\mbox{p\isactrlsub {\isadigit{1}}\ {\isacharless}{\kern0pt}\ p\isactrlsub {\isadigit{2}}}}{\mbox{p\isactrlsub {\isadigit{1}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\isactrlsub {\isadigit{1}}\ {\isasymprec}\isactrlbsub lex\isactrlesub \ p\isactrlsub {\isadigit{2}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\isactrlsub {\isadigit{2}}}}}\hspace{1cm} & |
|
1230 \isa{\mbox{}\inferrule{\mbox{ps\isactrlsub {\isadigit{1}}\ {\isasymprec}\isactrlbsub lex\isactrlesub \ ps\isactrlsub {\isadigit{2}}}}{\mbox{p\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\isactrlsub {\isadigit{1}}\ {\isasymprec}\isactrlbsub lex\isactrlesub \ p\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}ps\isactrlsub {\isadigit{2}}}}} |
|
1231 \end{tabular} |
|
1232 \end{center} |
|
1233 |
|
1234 With the norm and lexicographic order in place, |
|
1235 we can state the key definition of Okui and Suzuki |
|
1236 \cite{OkuiSuzuki2010}: a value \isa{v\isactrlsub {\isadigit{1}}} is \emph{smaller at position \isa{p}} than |
|
1237 \isa{v\isactrlsub {\isadigit{2}}}, written \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\isactrlbsub p\isactrlesub \ v\isactrlsub {\isadigit{2}}}, |
|
1238 if and only if $(i)$ the norm at position \isa{p} is |
|
1239 greater in \isa{v\isactrlsub {\isadigit{1}}} (that is the string \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}\mbox{$\downharpoonleft$}\isactrlbsub p\isactrlesub {\isacharbar}{\kern0pt}} is longer |
|
1240 than \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}\mbox{$\downharpoonleft$}\isactrlbsub p\isactrlesub {\isacharbar}{\kern0pt}}) and $(ii)$ all subvalues at |
|
1241 positions that are inside \isa{v\isactrlsub {\isadigit{1}}} or \isa{v\isactrlsub {\isadigit{2}}} and that are |
|
1242 lexicographically smaller than \isa{p}, we have the same norm, namely |
|
1243 |
|
1244 \begin{center} |
|
1245 \begin{tabular}{c} |
|
1246 \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\isactrlbsub p\isactrlesub \ v\isactrlsub {\isadigit{2}}} |
|
1247 \isa{{\isasymequiv}} |
|
1248 $\begin{cases} |
|
1249 (i) & \isa{{\isasymparallel}v\isactrlsub {\isadigit{2}}{\isasymparallel}\isactrlbsub p\isactrlesub \ {\isacharless}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{1}}{\isasymparallel}\isactrlbsub p\isactrlesub } \quad\text{and}\smallskip \\ |
|
1250 (ii) & \isa{{\isasymforall}q{\isasymin}Pos\ v\isactrlsub {\isadigit{1}}\ {\isasymunion}\ Pos\ v\isactrlsub {\isadigit{2}}{\isachardot}{\kern0pt}\ q\ {\isasymprec}\isactrlbsub lex\isactrlesub \ p\ {\isasymlongrightarrow}\ {\isasymparallel}v\isactrlsub {\isadigit{1}}{\isasymparallel}\isactrlbsub q\isactrlesub \ {\isacharequal}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{2}}{\isasymparallel}\isactrlbsub q\isactrlesub } |
|
1251 \end{cases}$ |
|
1252 \end{tabular} |
|
1253 \end{center} |
|
1254 |
|
1255 \noindent The position \isa{p} in this definition acts as the |
|
1256 \emph{first distinct position} of \isa{v\isactrlsub {\isadigit{1}}} and \isa{v\isactrlsub {\isadigit{2}}}, where both values match strings of different length |
|
1257 \cite{OkuiSuzuki2010}. Since at \isa{p} the values \isa{v\isactrlsub {\isadigit{1}}} and \isa{v\isactrlsub {\isadigit{2}}} match different strings, the |
|
1258 ordering is irreflexive. Derived from the definition above |
|
1259 are the following two orderings: |
|
1260 |
|
1261 \begin{center} |
|
1262 \begin{tabular}{l} |
|
1263 \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}\ {\isasymequiv}\ {\isasymexists}p{\isachardot}{\kern0pt}\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\isactrlbsub p\isactrlesub \ v\isactrlsub {\isadigit{2}}}\\ |
|
1264 \isa{v\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{2}}\ {\isasymequiv}\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}\ {\isasymor}\ v\isactrlsub {\isadigit{1}}\ {\isacharequal}{\kern0pt}\ v\isactrlsub {\isadigit{2}}} |
|
1265 \end{tabular} |
|
1266 \end{center} |
|
1267 |
|
1268 While we encountered a number of obstacles for establishing properties like |
|
1269 transitivity for the ordering of Sulzmann and Lu (and which we failed |
|
1270 to overcome), it is relatively straightforward to establish this |
|
1271 property for the orderings |
|
1272 \isa{\underline{\hspace{2mm}}\ {\isasymprec}\ \underline{\hspace{2mm}}} and \isa{\underline{\hspace{2mm}}\ \mbox{$\preccurlyeq$}\ \underline{\hspace{2mm}}} |
|
1273 by Okui and Suzuki. |
|
1274 |
|
1275 \begin{lemma}[Transitivity]\label{transitivity} |
|
1276 \isa{{\normalsize{}If\,}\ \mbox{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}}\ {\normalsize \,and\,}\ \mbox{v\isactrlsub {\isadigit{2}}\ {\isasymprec}\ v\isactrlsub {\isadigit{3}}}\ {\normalsize \,then\,}\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{3}}{\isachardot}{\kern0pt}} |
|
1277 \end{lemma} |
|
1278 |
|
1279 \begin{proof} From the assumption we obtain two positions \isa{p} |
|
1280 and \isa{q}, where the values \isa{v\isactrlsub {\isadigit{1}}} and \isa{v\isactrlsub {\isadigit{2}}} (respectively \isa{v\isactrlsub {\isadigit{2}}} and \isa{v\isactrlsub {\isadigit{3}}}) are `distinct'. Since \isa{{\isasymprec}\isactrlbsub lex\isactrlesub } is trichotomous, we need to consider |
|
1281 three cases, namely \isa{p\ {\isacharequal}{\kern0pt}\ q}, \isa{p\ {\isasymprec}\isactrlbsub lex\isactrlesub \ q} and |
|
1282 \isa{q\ {\isasymprec}\isactrlbsub lex\isactrlesub \ p}. Let us look at the first case. Clearly |
|
1283 \isa{{\isasymparallel}v\isactrlsub {\isadigit{2}}{\isasymparallel}\isactrlbsub p\isactrlesub \ {\isacharless}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{1}}{\isasymparallel}\isactrlbsub p\isactrlesub } and \isa{{\isasymparallel}v\isactrlsub {\isadigit{3}}{\isasymparallel}\isactrlbsub p\isactrlesub \ {\isacharless}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{2}}{\isasymparallel}\isactrlbsub p\isactrlesub } imply \isa{{\isasymparallel}v\isactrlsub {\isadigit{3}}{\isasymparallel}\isactrlbsub p\isactrlesub \ {\isacharless}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{1}}{\isasymparallel}\isactrlbsub p\isactrlesub }. It remains to show |
|
1284 that for a \isa{p{\isacharprime}{\kern0pt}\ {\isasymin}\ Pos\ v\isactrlsub {\isadigit{1}}\ {\isasymunion}\ Pos\ v\isactrlsub {\isadigit{3}}} |
|
1285 with \isa{p{\isacharprime}{\kern0pt}\ {\isasymprec}\isactrlbsub lex\isactrlesub \ p} that \isa{{\isasymparallel}v\isactrlsub {\isadigit{1}}{\isasymparallel}\isactrlbsub p{\isacharprime}{\kern0pt}\isactrlesub \ {\isacharequal}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{3}}{\isasymparallel}\isactrlbsub p{\isacharprime}{\kern0pt}\isactrlesub } holds. Suppose \isa{p{\isacharprime}{\kern0pt}\ {\isasymin}\ Pos\ v\isactrlsub {\isadigit{1}}}, then we can infer from the first assumption that \isa{{\isasymparallel}v\isactrlsub {\isadigit{1}}{\isasymparallel}\isactrlbsub p{\isacharprime}{\kern0pt}\isactrlesub \ {\isacharequal}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{2}}{\isasymparallel}\isactrlbsub p{\isacharprime}{\kern0pt}\isactrlesub }. But this means |
|
1286 that \isa{p{\isacharprime}{\kern0pt}} must be in \isa{Pos\ v\isactrlsub {\isadigit{2}}} too (the norm |
|
1287 cannot be \isa{{\isacharminus}{\kern0pt}{\isadigit{1}}} given \isa{p{\isacharprime}{\kern0pt}\ {\isasymin}\ Pos\ v\isactrlsub {\isadigit{1}}}). |
|
1288 Hence we can use the second assumption and |
|
1289 infer \isa{{\isasymparallel}v\isactrlsub {\isadigit{2}}{\isasymparallel}\isactrlbsub p{\isacharprime}{\kern0pt}\isactrlesub \ {\isacharequal}{\kern0pt}\ {\isasymparallel}v\isactrlsub {\isadigit{3}}{\isasymparallel}\isactrlbsub p{\isacharprime}{\kern0pt}\isactrlesub }, |
|
1290 which concludes this case with \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{3}}}. The reasoning in the other cases is similar.\qed |
|
1291 \end{proof} |
|
1292 |
|
1293 \noindent |
|
1294 The proof for $\preccurlyeq$ is similar and omitted. |
|
1295 It is also straightforward to show that \isa{{\isasymprec}} and |
|
1296 $\preccurlyeq$ are partial orders. Okui and Suzuki furthermore show that they |
|
1297 are linear orderings for lexical values \cite{OkuiSuzuki2010} of a given |
|
1298 regular expression and given string, but we have not formalised this in Isabelle. It is |
|
1299 not essential for our results. What we are going to show below is |
|
1300 that for a given \isa{r} and \isa{s}, the orderings have a unique |
|
1301 minimal element on the set \isa{LV\ r\ s}, which is the POSIX value |
|
1302 we defined in the previous section. We start with two properties that |
|
1303 show how the length of a flattened value relates to the \isa{{\isasymprec}}-ordering. |
|
1304 |
|
1305 \begin{proposition}\mbox{}\smallskip\\\label{ordlen} |
|
1306 \begin{tabular}{@ {}ll} |
|
1307 (1) & |
|
1308 \isa{{\normalsize{}If\,}\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}\ {\normalsize \,then\,}\ len\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}\ {\isasymle}\ len\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}{\isachardot}{\kern0pt}}\\ |
|
1309 (2) & |
|
1310 \isa{{\normalsize{}If\,}\ len\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}\ {\isacharless}{\kern0pt}\ len\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\normalsize \,then\,}\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}{\isachardot}{\kern0pt}} |
|
1311 \end{tabular} |
|
1312 \end{proposition} |
|
1313 |
|
1314 \noindent Both properties follow from the definition of the ordering. Note that |
|
1315 \textit{(2)} entails that a value, say \isa{v\isactrlsub {\isadigit{2}}}, whose underlying |
|
1316 string is a strict prefix of another flattened value, say \isa{v\isactrlsub {\isadigit{1}}}, then |
|
1317 \isa{v\isactrlsub {\isadigit{1}}} must be smaller than \isa{v\isactrlsub {\isadigit{2}}}. For our proofs it |
|
1318 will be useful to have the following properties---in each case the underlying strings |
|
1319 of the compared values are the same: |
|
1320 |
|
1321 \begin{proposition}\mbox{}\smallskip\\\label{ordintros} |
|
1322 \begin{tabular}{ll} |
|
1323 \textit{(1)} & |
|
1324 \isa{{\normalsize{}If\,}\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}\ {\normalsize \,then\,}\ Left\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ Right\ v\isactrlsub {\isadigit{2}}{\isachardot}{\kern0pt}}\\ |
|
1325 \textit{(2)} & If |
|
1326 \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} \;then\; |
|
1327 \isa{Left\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ Left\ v\isactrlsub {\isadigit{2}}} \;iff\; |
|
1328 \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}}\\ |
|
1329 \textit{(3)} & If |
|
1330 \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} \;then\; |
|
1331 \isa{Right\ v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ Right\ v\isactrlsub {\isadigit{2}}} \;iff\; |
|
1332 \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}}\\ |
|
1333 \textit{(4)} & If |
|
1334 \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}w\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} \;then\; |
|
1335 \isa{Seq\ v\ v\isactrlsub {\isadigit{2}}\ {\isasymprec}\ Seq\ v\ w\isactrlsub {\isadigit{2}}} \;iff\; |
|
1336 \isa{v\isactrlsub {\isadigit{2}}\ {\isasymprec}\ w\isactrlsub {\isadigit{2}}}\\ |
|
1337 \textit{(5)} & If |
|
1338 \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharat}{\kern0pt}\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}w\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharat}{\kern0pt}\ {\isacharbar}{\kern0pt}w\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} \;and\; |
|
1339 \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ w\isactrlsub {\isadigit{1}}} \;then\; |
|
1340 \isa{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}\ {\isasymprec}\ Seq\ w\isactrlsub {\isadigit{1}}\ w\isactrlsub {\isadigit{2}}}\\ |
|
1341 \textit{(6)} & If |
|
1342 \isa{{\isacharbar}{\kern0pt}vs\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}vs\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} \;then\; |
|
1343 \isa{Stars\ {\isacharparenleft}{\kern0pt}vs\ {\isacharat}{\kern0pt}\ vs\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymprec}\ Stars\ {\isacharparenleft}{\kern0pt}vs\ {\isacharat}{\kern0pt}\ vs\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} \;iff\; |
|
1344 \isa{Stars\ vs\isactrlsub {\isadigit{1}}\ {\isasymprec}\ Stars\ vs\isactrlsub {\isadigit{2}}}\\ |
|
1345 |
|
1346 \textit{(7)} & If |
|
1347 \isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{1}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} \;and\; |
|
1348 \isa{v\isactrlsub {\isadigit{1}}\ {\isasymprec}\ v\isactrlsub {\isadigit{2}}} \;then\; |
|
1349 \isa{Stars\ {\isacharparenleft}{\kern0pt}v\isactrlsub {\isadigit{1}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isasymprec}\ Stars\ {\isacharparenleft}{\kern0pt}v\isactrlsub {\isadigit{2}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1350 \end{tabular} |
|
1351 \end{proposition} |
|
1352 |
|
1353 \noindent One might prefer that statements \textit{(4)} and \textit{(5)} |
|
1354 (respectively \textit{(6)} and \textit{(7)}) |
|
1355 are combined into a single \textit{iff}-statement (like the ones for \isa{Left} and \isa{Right}). Unfortunately this cannot be done easily: such |
|
1356 a single statement would require an additional assumption about the |
|
1357 two values \isa{Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}} and \isa{Seq\ w\isactrlsub {\isadigit{1}}\ w\isactrlsub {\isadigit{2}}} |
|
1358 being inhabited by the same regular expression. The |
|
1359 complexity of the proofs involved seems to not justify such a |
|
1360 `cleaner' single statement. The statements given are just the properties that |
|
1361 allow us to establish our theorems without any difficulty. The proofs |
|
1362 for Proposition~\ref{ordintros} are routine. |
|
1363 |
|
1364 |
|
1365 Next we establish how Okui and Suzuki's orderings relate to our |
|
1366 definition of POSIX values. Given a \isa{POSIX} value \isa{v\isactrlsub {\isadigit{1}}} |
|
1367 for \isa{r} and \isa{s}, then any other lexical value \isa{v\isactrlsub {\isadigit{2}}} in \isa{LV\ r\ s} is greater or equal than \isa{v\isactrlsub {\isadigit{1}}}, namely: |
|
1368 |
|
1369 |
|
1370 \begin{theorem}\label{orderone} |
|
1371 \isa{{\normalsize{}If\,}\ \mbox{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{1}}}\ {\normalsize \,and\,}\ \mbox{v\isactrlsub {\isadigit{2}}\ {\isasymin}\ LV\ r\ s}\ {\normalsize \,then\,}\ v\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{2}}{\isachardot}{\kern0pt}} |
|
1372 \end{theorem} |
|
1373 |
|
1374 \begin{proof} By induction on our POSIX rules. By |
|
1375 Theorem~\ref{posixdeterm} and the definition of \isa{LV}, it is clear |
|
1376 that \isa{v\isactrlsub {\isadigit{1}}} and \isa{v\isactrlsub {\isadigit{2}}} have the same |
|
1377 underlying string \isa{s}. The three base cases are |
|
1378 straightforward: for example for \isa{v\isactrlsub {\isadigit{1}}\ {\isacharequal}{\kern0pt}\ Empty}, we have |
|
1379 that \isa{v\isactrlsub {\isadigit{2}}\ {\isasymin}\ LV\ \isactrlbold {\isadigit{1}}\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} must also be of the form |
|
1380 \mbox{\isa{v\isactrlsub {\isadigit{2}}\ {\isacharequal}{\kern0pt}\ Empty}}. Therefore we have \isa{v\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{2}}}. The inductive cases for |
|
1381 \isa{r} being of the form \isa{r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}} and |
|
1382 \isa{r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}} are as follows: |
|
1383 |
|
1384 |
|
1385 \begin{itemize} |
|
1386 |
|
1387 \item[$\bullet$] Case \isa{P{\isacharplus}{\kern0pt}L} with \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Left\ w\isactrlsub {\isadigit{1}}}: In this case the value |
|
1388 \isa{v\isactrlsub {\isadigit{2}}} is either of the |
|
1389 form \isa{Left\ w\isactrlsub {\isadigit{2}}} or \isa{Right\ w\isactrlsub {\isadigit{2}}}. In the |
|
1390 latter case we can immediately conclude with \mbox{\isa{v\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{2}}}} since a \isa{Left}-value with the |
|
1391 same underlying string \isa{s} is always smaller than a |
|
1392 \isa{Right}-value by Proposition~\ref{ordintros}\textit{(1)}. |
|
1393 In the former case we have \isa{w\isactrlsub {\isadigit{2}}\ {\isasymin}\ LV\ r\isactrlsub {\isadigit{1}}\ s} and can use the induction hypothesis to infer |
|
1394 \isa{w\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ w\isactrlsub {\isadigit{2}}}. Because \isa{w\isactrlsub {\isadigit{1}}} and \isa{w\isactrlsub {\isadigit{2}}} have the same underlying string |
|
1395 \isa{s}, we can conclude with \isa{Left\ w\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ Left\ w\isactrlsub {\isadigit{2}}} using |
|
1396 Proposition~\ref{ordintros}\textit{(2)}.\smallskip |
|
1397 |
|
1398 \item[$\bullet$] Case \isa{P{\isacharplus}{\kern0pt}R} with \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Right\ w\isactrlsub {\isadigit{1}}}: This case similar to the previous |
|
1399 case, except that we additionally know \isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}}. This is needed when \isa{v\isactrlsub {\isadigit{2}}} is of the form |
|
1400 \mbox{\isa{Left\ w\isactrlsub {\isadigit{2}}}}. Since \mbox{\isa{{\isacharbar}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}w\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}} \isa{{\isacharequal}{\kern0pt}\ s}} and \isa{w\isactrlsub {\isadigit{2}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{1}}}, we can derive a contradiction for \mbox{\isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}}} using |
|
1401 Proposition~\ref{inhabs}. So also in this case \mbox{\isa{v\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{2}}}}.\smallskip |
|
1402 |
|
1403 \item[$\bullet$] Case \isa{PS} with \isa{{\isacharparenleft}{\kern0pt}s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Seq\ w\isactrlsub {\isadigit{1}}\ w\isactrlsub {\isadigit{2}}}: We can assume \isa{v\isactrlsub {\isadigit{2}}\ {\isacharequal}{\kern0pt}\ Seq\ u\isactrlsub {\isadigit{1}}\ u\isactrlsub {\isadigit{2}}} with \isa{u\isactrlsub {\isadigit{1}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{1}}} and \mbox{\isa{u\isactrlsub {\isadigit{2}}\ {\isacharcolon}{\kern0pt}\ r\isactrlsub {\isadigit{2}}}}. We have \isa{s\isactrlsub {\isadigit{1}}\ {\isacharat}{\kern0pt}\ s\isactrlsub {\isadigit{2}}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}u\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}\ {\isacharat}{\kern0pt}\ {\isacharbar}{\kern0pt}u\isactrlsub {\isadigit{2}}{\isacharbar}{\kern0pt}}. By the side-condition of the |
|
1404 \isa{PS}-rule we know that either \isa{s\isactrlsub {\isadigit{1}}\ {\isacharequal}{\kern0pt}\ {\isacharbar}{\kern0pt}u\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}} or that \isa{{\isacharbar}{\kern0pt}u\isactrlsub {\isadigit{1}}{\isacharbar}{\kern0pt}} is a strict prefix of |
|
1405 \isa{s\isactrlsub {\isadigit{1}}}. In the latter case we can infer \isa{w\isactrlsub {\isadigit{1}}\ {\isasymprec}\ u\isactrlsub {\isadigit{1}}} by |
|
1406 Proposition~\ref{ordlen}\textit{(2)} and from this \isa{v\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{2}}} by Proposition~\ref{ordintros}\textit{(5)} |
|
1407 (as noted above \isa{v\isactrlsub {\isadigit{1}}} and \isa{v\isactrlsub {\isadigit{2}}} must have the |
|
1408 same underlying string). |
|
1409 In the former case we know |
|
1410 \isa{u\isactrlsub {\isadigit{1}}\ {\isasymin}\ LV\ r\isactrlsub {\isadigit{1}}\ s\isactrlsub {\isadigit{1}}} and \isa{u\isactrlsub {\isadigit{2}}\ {\isasymin}\ LV\ r\isactrlsub {\isadigit{2}}\ s\isactrlsub {\isadigit{2}}}. With this we can use the |
|
1411 induction hypotheses to infer \isa{w\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ u\isactrlsub {\isadigit{1}}} and \isa{w\isactrlsub {\isadigit{2}}\ \mbox{$\preccurlyeq$}\ u\isactrlsub {\isadigit{2}}}. By |
|
1412 Proposition~\ref{ordintros}\textit{(4,5)} we can again infer |
|
1413 \isa{v\isactrlsub {\isadigit{1}}\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{2}}}. |
|
1414 |
|
1415 \end{itemize} |
|
1416 |
|
1417 \noindent The case for \isa{P{\isasymstar}} is similar to the \isa{PS}-case and omitted.\qed |
|
1418 \end{proof} |
|
1419 |
|
1420 \noindent This theorem shows that our \isa{POSIX} value for a |
|
1421 regular expression \isa{r} and string \isa{s} is in fact a |
|
1422 minimal element of the values in \isa{LV\ r\ s}. By |
|
1423 Proposition~\ref{ordlen}\textit{(2)} we also know that any value in |
|
1424 \isa{LV\ r\ s{\isacharprime}{\kern0pt}}, with \isa{s{\isacharprime}{\kern0pt}} being a strict prefix, cannot be |
|
1425 smaller than \isa{v\isactrlsub {\isadigit{1}}}. The next theorem shows the |
|
1426 opposite---namely any minimal element in \isa{LV\ r\ s} must be a |
|
1427 \isa{POSIX} value. This can be established by induction on \isa{r}, but the proof can be drastically simplified by using the fact |
|
1428 from the previous section about the existence of a \isa{POSIX} value |
|
1429 whenever a string \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}}. |
|
1430 |
|
1431 |
|
1432 \begin{theorem} |
|
1433 \isa{{\normalsize{}If\,}\ \mbox{v\isactrlsub {\isadigit{1}}\ {\isasymin}\ LV\ r\ s}\ {\normalsize \,and\,}\ \mbox{{\isasymforall}v\isactrlsub {\isadigit{2}}{\isasymin}LV\ r\ s{\isachardot}{\kern0pt}\ v\isactrlsub {\isadigit{2}}\ \mbox{$\not\prec$}\ v\isactrlsub {\isadigit{1}}}\ {\normalsize \,then\,}\ {\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub {\isadigit{1}}{\isachardot}{\kern0pt}} |
|
1434 \end{theorem} |
|
1435 |
|
1436 \begin{proof} |
|
1437 If \isa{v\isactrlsub {\isadigit{1}}\ {\isasymin}\ LV\ r\ s} then |
|
1438 \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}} by Proposition~\ref{inhabs}. Hence by Theorem~\ref{lexercorrect}(2) |
|
1439 there exists a |
|
1440 \isa{POSIX} value \isa{v\isactrlsub P} with \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\isactrlsub P} |
|
1441 and by Lemma~\ref{LVposix} we also have \mbox{\isa{v\isactrlsub P\ {\isasymin}\ LV\ r\ s}}. |
|
1442 By Theorem~\ref{orderone} we therefore have |
|
1443 \isa{v\isactrlsub P\ \mbox{$\preccurlyeq$}\ v\isactrlsub {\isadigit{1}}}. If \isa{v\isactrlsub P\ {\isacharequal}{\kern0pt}\ v\isactrlsub {\isadigit{1}}} then |
|
1444 we are done. Otherwise we have \isa{v\isactrlsub P\ {\isasymprec}\ v\isactrlsub {\isadigit{1}}}, which |
|
1445 however contradicts the second assumption about \isa{v\isactrlsub {\isadigit{1}}} being the smallest |
|
1446 element in \isa{LV\ r\ s}. So we are done in this case too.\qed |
|
1447 \end{proof} |
|
1448 |
|
1449 \noindent |
|
1450 From this we can also show |
|
1451 that if \isa{LV\ r\ s} is non-empty (or equivalently \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}}) then |
|
1452 it has a unique minimal element: |
|
1453 |
|
1454 \begin{corollary} |
|
1455 \isa{{\normalsize{}If\,}\ LV\ r\ s\ {\isasymnoteq}\ {\isasymemptyset}\ {\normalsize \,then\,}\ {\isasymexists}{\isacharbang}{\kern0pt}vmin{\isachardot}{\kern0pt}\ vmin\ {\isasymin}\ LV\ r\ s\ {\isasymand}\ {\isacharparenleft}{\kern0pt}{\isasymforall}v{\isasymin}LV\ r\ s{\isachardot}{\kern0pt}\ vmin\ \mbox{$\preccurlyeq$}\ v{\isacharparenright}{\kern0pt}{\isachardot}{\kern0pt}} |
|
1456 \end{corollary} |
|
1457 |
|
1458 |
|
1459 |
|
1460 \noindent To sum up, we have shown that the (unique) minimal elements |
|
1461 of the ordering by Okui and Suzuki are exactly the \isa{POSIX} |
|
1462 values we defined inductively in Section~\ref{posixsec}. This provides |
|
1463 an independent confirmation that our ternary relation formalises the |
|
1464 informal POSIX rules.% |
|
1465 \end{isamarkuptext}\isamarkuptrue% |
|
1466 % |
|
1467 \isadelimdocument |
|
1468 % |
|
1469 \endisadelimdocument |
|
1470 % |
|
1471 \isatagdocument |
|
1472 % |
|
1473 \isamarkupsection{Bitcoded Lexing% |
|
1474 } |
|
1475 \isamarkuptrue% |
|
1476 % |
|
1477 \endisatagdocument |
|
1478 {\isafolddocument}% |
|
1479 % |
|
1480 \isadelimdocument |
|
1481 % |
|
1482 \endisadelimdocument |
|
1483 % |
|
1484 \begin{isamarkuptext}% |
|
1485 Incremental calculation of the value. To simplify the proof we first define the function |
|
1486 \isa{flex} which calculates the ``iterated'' injection function. With this we can |
|
1487 rewrite the lexer as |
|
1488 |
|
1489 \begin{center} |
|
1490 \isa{lexer\ r\ s\ {\isacharequal}{\kern0pt}\ {\isacharparenleft}{\kern0pt}\textrm{if}\ nullable\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}s{\isacharparenright}{\kern0pt}\ \textrm{then}\ Some\ {\isacharparenleft}{\kern0pt}flex\ r\ id\ s\ {\isacharparenleft}{\kern0pt}mkeps\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}s{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ \textrm{else}\ None{\isacharparenright}{\kern0pt}} |
|
1491 \end{center}% |
|
1492 \end{isamarkuptext}\isamarkuptrue% |
|
1493 % |
|
1494 \isadelimdocument |
|
1495 % |
|
1496 \endisadelimdocument |
|
1497 % |
|
1498 \isatagdocument |
|
1499 % |
|
1500 \isamarkupsection{Optimisations% |
|
1501 } |
|
1502 \isamarkuptrue% |
|
1503 % |
|
1504 \endisatagdocument |
|
1505 {\isafolddocument}% |
|
1506 % |
|
1507 \isadelimdocument |
|
1508 % |
|
1509 \endisadelimdocument |
|
1510 % |
|
1511 \begin{isamarkuptext}% |
|
1512 Derivatives as calculated by \Brz's method are usually more complex |
|
1513 regular expressions than the initial one; the result is that the |
|
1514 derivative-based matching and lexing algorithms are often abysmally slow. |
|
1515 However, various optimisations are possible, such as the simplifications |
|
1516 of \isa{\isactrlbold {\isadigit{0}}\ {\isacharplus}{\kern0pt}\ r}, \isa{r\ {\isacharplus}{\kern0pt}\ \isactrlbold {\isadigit{0}}}, \isa{\isactrlbold {\isadigit{1}}\ {\isasymcdot}\ r} and |
|
1517 \isa{r\ {\isasymcdot}\ \isactrlbold {\isadigit{1}}} to \isa{r}. These simplifications can speed up the |
|
1518 algorithms considerably, as noted in \cite{Sulzmann2014}. One of the |
|
1519 advantages of having a simple specification and correctness proof is that |
|
1520 the latter can be refined to prove the correctness of such simplification |
|
1521 steps. While the simplification of regular expressions according to |
|
1522 rules like |
|
1523 |
|
1524 \begin{equation}\label{Simpl} |
|
1525 \begin{array}{lcllcllcllcl} |
|
1526 \isa{\isactrlbold {\isadigit{0}}\ {\isacharplus}{\kern0pt}\ r} & \isa{{\isasymRightarrow}} & \isa{r} \hspace{8mm}%\\ |
|
1527 \isa{r\ {\isacharplus}{\kern0pt}\ \isactrlbold {\isadigit{0}}} & \isa{{\isasymRightarrow}} & \isa{r} \hspace{8mm}%\\ |
|
1528 \isa{\isactrlbold {\isadigit{1}}\ {\isasymcdot}\ r} & \isa{{\isasymRightarrow}} & \isa{r} \hspace{8mm}%\\ |
|
1529 \isa{r\ {\isasymcdot}\ \isactrlbold {\isadigit{1}}} & \isa{{\isasymRightarrow}} & \isa{r} |
|
1530 \end{array} |
|
1531 \end{equation} |
|
1532 |
|
1533 \noindent is well understood, there is an obstacle with the POSIX value |
|
1534 calculation algorithm by Sulzmann and Lu: if we build a derivative regular |
|
1535 expression and then simplify it, we will calculate a POSIX value for this |
|
1536 simplified derivative regular expression, \emph{not} for the original (unsimplified) |
|
1537 derivative regular expression. Sulzmann and Lu \cite{Sulzmann2014} overcome this obstacle by |
|
1538 not just calculating a simplified regular expression, but also calculating |
|
1539 a \emph{rectification function} that ``repairs'' the incorrect value. |
|
1540 |
|
1541 The rectification functions can be (slightly clumsily) implemented in |
|
1542 Isabelle/HOL as follows using some auxiliary functions: |
|
1543 |
|
1544 \begin{center} |
|
1545 \begin{tabular}{lcl} |
|
1546 \isa{F\isactrlbsub Right\isactrlesub \ f\ v} & $\dn$ & \isa{Right\ {\isacharparenleft}{\kern0pt}f\ v{\isacharparenright}{\kern0pt}}\\ |
|
1547 \isa{F\isactrlbsub Left\isactrlesub \ f\ v} & $\dn$ & \isa{Left\ {\isacharparenleft}{\kern0pt}f\ v{\isacharparenright}{\kern0pt}}\\ |
|
1548 |
|
1549 \isa{F\isactrlbsub Alt\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}\ {\isacharparenleft}{\kern0pt}Right\ v{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{Right\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ v{\isacharparenright}{\kern0pt}}\\ |
|
1550 \isa{F\isactrlbsub Alt\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}\ {\isacharparenleft}{\kern0pt}Left\ v{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{Left\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ v{\isacharparenright}{\kern0pt}}\\ |
|
1551 |
|
1552 \isa{F\isactrlbsub Seq{\isadigit{1}}\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}\ v} & $\dn$ & \isa{Seq\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ {\isacharparenleft}{\kern0pt}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ v{\isacharparenright}{\kern0pt}}\\ |
|
1553 \isa{F\isactrlbsub Seq{\isadigit{2}}\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}\ v} & $\dn$ & \isa{Seq\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ v{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ {\isacharparenleft}{\kern0pt}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}}\\ |
|
1554 \isa{F\isactrlbsub Seq\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}\ {\isacharparenleft}{\kern0pt}Seq\ v\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{Seq\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\medskip\\ |
|
1555 %\end{tabular} |
|
1556 % |
|
1557 %\begin{tabular}{lcl} |
|
1558 \isa{simp\isactrlbsub Alt\isactrlesub \ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{0}}{\isacharcomma}{\kern0pt}\ \underline{\hspace{2mm}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F\isactrlbsub Right\isactrlesub \ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1559 \isa{simp\isactrlbsub Alt\isactrlesub \ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{0}}{\isacharcomma}{\kern0pt}\ \underline{\hspace{2mm}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ F\isactrlbsub Left\isactrlesub \ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}}\\ |
|
1560 \isa{simp\isactrlbsub Alt\isactrlesub \ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F\isactrlbsub Alt\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1561 \isa{simp\isactrlbsub Seq\isactrlesub \ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F\isactrlbsub Seq{\isadigit{1}}\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1562 \isa{simp\isactrlbsub Seq\isactrlesub \ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}\isactrlbold {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ F\isactrlbsub Seq{\isadigit{2}}\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1563 \isa{simp\isactrlbsub Seq\isactrlesub \ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F\isactrlbsub Seq\isactrlesub \ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1564 \end{tabular} |
|
1565 \end{center} |
|
1566 |
|
1567 \noindent |
|
1568 The functions \isa{simp\isactrlbsub Alt\isactrlesub } and \isa{simp\isactrlbsub Seq\isactrlesub } encode the simplification rules |
|
1569 in \eqref{Simpl} and compose the rectification functions (simplifications can occur |
|
1570 deep inside the regular expression). The main simplification function is then |
|
1571 |
|
1572 \begin{center} |
|
1573 \begin{tabular}{lcl} |
|
1574 \isa{simp\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{simp\isactrlbsub Alt\isactrlesub \ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1575 \isa{simp\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} & $\dn$ & \isa{simp\isactrlbsub Seq\isactrlesub \ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}}\\ |
|
1576 \isa{simp\ r} & $\dn$ & \isa{{\isacharparenleft}{\kern0pt}r{\isacharcomma}{\kern0pt}\ id{\isacharparenright}{\kern0pt}}\\ |
|
1577 \end{tabular} |
|
1578 \end{center} |
|
1579 |
|
1580 \noindent where \isa{id} stands for the identity function. The |
|
1581 function \isa{simp} returns a simplified regular expression and a corresponding |
|
1582 rectification function. Note that we do not simplify under stars: this |
|
1583 seems to slow down the algorithm, rather than speed it up. The optimised |
|
1584 lexer is then given by the clauses: |
|
1585 |
|
1586 \begin{center} |
|
1587 \begin{tabular}{lcl} |
|
1588 \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}\ r\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} & $\dn$ & \isa{\textrm{if}\ nullable\ r\ \textrm{then}\ Some\ {\isacharparenleft}{\kern0pt}mkeps\ r{\isacharparenright}{\kern0pt}\ \textrm{else}\ None}\\ |
|
1589 \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}\ r\ {\isacharparenleft}{\kern0pt}c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s{\isacharparenright}{\kern0pt}} & $\dn$ & |
|
1590 \isa{let\ {\isacharparenleft}{\kern0pt}r\isactrlsub s{\isacharcomma}{\kern0pt}\ f\isactrlsub r{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ simp\ {\isacharparenleft}{\kern0pt}r}$\backslash$\isa{c{\isacharparenright}{\kern0pt}\ in}\\ |
|
1591 & & \isa{case} \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}\ r\isactrlsub s\ s} \isa{of}\\ |
|
1592 & & \phantom{$|$} \isa{None} \isa{{\isasymRightarrow}} \isa{None}\\ |
|
1593 & & $|$ \isa{Some\ v} \isa{{\isasymRightarrow}} \isa{Some\ {\isacharparenleft}{\kern0pt}inj\ r\ c\ {\isacharparenleft}{\kern0pt}f\isactrlsub r\ v{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}} |
|
1594 \end{tabular} |
|
1595 \end{center} |
|
1596 |
|
1597 \noindent |
|
1598 In the second clause we first calculate the derivative \isa{r{\isacharbackslash}{\kern0pt}c} |
|
1599 and then simpli |
|
1600 |
|
1601 text \isa{\ \ Incremental\ calculation\ of\ the\ value{\isachardot}{\kern0pt}\ To\ simplify\ the\ proof\ we\ first\ define\ the\ function\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}const\ flex{\isacharbraceright}{\kern0pt}\ which\ calculates\ the\ {\isacharbackquote}{\kern0pt}{\isacharbackquote}{\kern0pt}iterated{\isacharprime}{\kern0pt}{\isacharprime}{\kern0pt}\ injection\ function{\isachardot}{\kern0pt}\ With\ this\ we\ can\ rewrite\ the\ lexer\ as\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ lexer{\isacharunderscore}{\kern0pt}flex{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ {\isachardoublequote}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ {\isachardoublequote}{\kern0pt}v\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}v\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{7}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ code{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{7}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ areg{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}{\isacharequal}{\kern0pt}{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}AZERO{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}mid{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}AONE\ bs{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}mid{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}ACHAR\ bs\ c{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}mid{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}AALT\ bs\ r{\isadigit{1}}\ r{\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}mid{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}ASEQ\ bs\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}mid{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}ASTAR\ bs\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ intern{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ erase{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ Some\ simple\ facts\ about\ erase\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}lemma{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}mbox{\isacharbraceleft}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ erase{\isacharunderscore}{\kern0pt}bder{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ erase{\isacharunderscore}{\kern0pt}intern{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}lemma{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bnullable{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}medskip{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ \ {\isacharpercent}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharpercent}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ {\isacharpercent}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharpercent}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ \ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{5}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bder{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{6}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{3}}{\isacharparenright}{\kern0pt}{\isacharbrackleft}{\kern0pt}of\ bs\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}\ {\isachardoublequote}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ bmkeps{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{4}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}medskip{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ \ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharbrackleft}{\kern0pt}mode{\isacharequal}{\kern0pt}IfThen{\isacharbrackright}{\kern0pt}\ bder{\isacharunderscore}{\kern0pt}retrieve{\isacharbraceright}{\kern0pt}\ \ By\ induction\ on\ {\isasymopen}r{\isasymclose}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}theorem{\isacharbraceright}{\kern0pt}{\isacharbrackleft}{\kern0pt}Main\ Lemma{\isacharbrackright}{\kern0pt}{\isacharbackslash}{\kern0pt}mbox{\isacharbraceleft}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharbrackleft}{\kern0pt}mode{\isacharequal}{\kern0pt}IfThen{\isacharbrackright}{\kern0pt}\ MAIN{\isacharunderscore}{\kern0pt}decode{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}theorem{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}noindent\ Definition\ of\ the\ bitcoded\ lexer\ \ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ blexer{\isacharunderscore}{\kern0pt}def{\isacharbraceright}{\kern0pt}\ \ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}theorem{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ blexer{\isacharunderscore}{\kern0pt}correctness{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}theorem{\isacharbraceright}{\kern0pt}\ \ } |
|
1602 |
|
1603 section \isa{Optimisations} |
|
1604 |
|
1605 text \isa{\ \ Derivatives\ as\ calculated\ by\ {\isacharbackslash}{\kern0pt}Brz{\isacharprime}{\kern0pt}s\ method\ are\ usually\ more\ complex\ regular\ expressions\ than\ the\ initial\ one{\isacharsemicolon}{\kern0pt}\ the\ result\ is\ that\ the\ derivative{\isacharminus}{\kern0pt}based\ matching\ and\ lexing\ algorithms\ are\ often\ abysmally\ slow{\isachardot}{\kern0pt}\ However{\isacharcomma}{\kern0pt}\ various\ optimisations\ are\ possible{\isacharcomma}{\kern0pt}\ such\ as\ the\ simplifications\ of\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}ALT\ ZERO\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharcomma}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}ALT\ r\ ZERO{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharcomma}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}SEQ\ ONE\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}SEQ\ r\ ONE{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ to\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ r{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ These\ simplifications\ can\ speed\ up\ the\ algorithms\ considerably{\isacharcomma}{\kern0pt}\ as\ noted\ in\ {\isacharbackslash}{\kern0pt}cite{\isacharbraceleft}{\kern0pt}Sulzmann{\isadigit{2}}{\isadigit{0}}{\isadigit{1}}{\isadigit{4}}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ One\ of\ the\ advantages\ of\ having\ a\ simple\ specification\ and\ correctness\ proof\ is\ that\ the\ latter\ can\ be\ refined\ to\ prove\ the\ correctness\ of\ such\ simplification\ steps{\isachardot}{\kern0pt}\ While\ the\ simplification\ of\ regular\ expressions\ according\ to\ rules\ like\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}equation{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}label{\isacharbraceleft}{\kern0pt}Simpl{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}array{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcllcllcllcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}ALT\ ZERO\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}{\isasymRightarrow}{\isasymclose}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ r{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}hspace{\isacharbraceleft}{\kern0pt}{\isadigit{8}}mm{\isacharbraceright}{\kern0pt}{\isacharpercent}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}ALT\ r\ ZERO{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}{\isasymRightarrow}{\isasymclose}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ r{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}hspace{\isacharbraceleft}{\kern0pt}{\isadigit{8}}mm{\isacharbraceright}{\kern0pt}{\isacharpercent}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}SEQ\ ONE\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ \ {\isacharampersand}{\kern0pt}\ {\isasymopen}{\isasymRightarrow}{\isasymclose}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ r{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}hspace{\isacharbraceleft}{\kern0pt}{\isadigit{8}}mm{\isacharbraceright}{\kern0pt}{\isacharpercent}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}SEQ\ r\ ONE{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ \ {\isacharampersand}{\kern0pt}\ {\isasymopen}{\isasymRightarrow}{\isasymclose}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ r{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}array{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}equation{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}noindent\ is\ well\ understood{\isacharcomma}{\kern0pt}\ there\ is\ an\ obstacle\ with\ the\ POSIX\ value\ calculation\ algorithm\ by\ Sulzmann\ and\ Lu{\isacharcolon}{\kern0pt}\ if\ we\ build\ a\ derivative\ regular\ expression\ and\ then\ simplify\ it{\isacharcomma}{\kern0pt}\ we\ will\ calculate\ a\ POSIX\ value\ for\ this\ simplified\ derivative\ regular\ expression{\isacharcomma}{\kern0pt}\ {\isacharbackslash}{\kern0pt}emph{\isacharbraceleft}{\kern0pt}not{\isacharbraceright}{\kern0pt}\ for\ the\ original\ {\isacharparenleft}{\kern0pt}unsimplified{\isacharparenright}{\kern0pt}\ derivative\ regular\ expression{\isachardot}{\kern0pt}\ Sulzmann\ and\ Lu\ {\isacharbackslash}{\kern0pt}cite{\isacharbraceleft}{\kern0pt}Sulzmann{\isadigit{2}}{\isadigit{0}}{\isadigit{1}}{\isadigit{4}}{\isacharbraceright}{\kern0pt}\ overcome\ this\ obstacle\ by\ not\ just\ calculating\ a\ simplified\ regular\ expression{\isacharcomma}{\kern0pt}\ but\ also\ calculating\ a\ {\isacharbackslash}{\kern0pt}emph{\isacharbraceleft}{\kern0pt}rectification\ function{\isacharbraceright}{\kern0pt}\ that\ {\isacharbackquote}{\kern0pt}{\isacharbackquote}{\kern0pt}repairs{\isacharprime}{\kern0pt}{\isacharprime}{\kern0pt}\ the\ incorrect\ value{\isachardot}{\kern0pt}\ \ The\ rectification\ functions\ can\ be\ {\isacharparenleft}{\kern0pt}slightly\ clumsily{\isacharparenright}{\kern0pt}\ implemented\ \ in\ Isabelle{\isacharslash}{\kern0pt}HOL\ as\ follows\ using\ some\ auxiliary\ functions{\isacharcolon}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}RIGHT{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}Right\ {\isacharparenleft}{\kern0pt}f\ v{\isacharparenright}{\kern0pt}{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}LEFT{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}Left\ {\isacharparenleft}{\kern0pt}f\ v{\isacharparenright}{\kern0pt}{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ \ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}ALT{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}Right\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ v{\isacharparenright}{\kern0pt}{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}ALT{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}Left\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ v{\isacharparenright}{\kern0pt}{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ \ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}SEQ{\isadigit{1}}{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}Seq\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ {\isacharparenleft}{\kern0pt}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ v{\isacharparenright}{\kern0pt}{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}SEQ{\isadigit{2}}{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}Seq\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ v{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ {\isacharparenleft}{\kern0pt}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}SEQ{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}Seq\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{1}}\ v\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}f\isactrlsub {\isadigit{2}}\ v\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isasymclose}{\isacharbackslash}{\kern0pt}medskip{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharpercent}{\kern0pt}{\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharpercent}{\kern0pt}\ {\isacharpercent}{\kern0pt}{\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}ALT\ {\isacharparenleft}{\kern0pt}ZERO{\isacharcomma}{\kern0pt}\ DUMMY{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}RIGHT\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}ALT\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}ZERO{\isacharcomma}{\kern0pt}\ DUMMY{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}LEFT\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}ALT\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharparenleft}{\kern0pt}ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}ALT\ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}SEQ\ {\isacharparenleft}{\kern0pt}ONE{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}SEQ{\isadigit{1}}\ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}SEQ\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}ONE{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}SEQ{\isadigit{2}}\ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}SEQ\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharparenleft}{\kern0pt}SEQ\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isacharcomma}{\kern0pt}\ F{\isacharunderscore}{\kern0pt}SEQ\ f\isactrlsub {\isadigit{1}}\ f\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}noindent\ The\ functions\ {\isasymopen}simp\isactrlbsub Alt\isactrlesub {\isasymclose}\ and\ {\isasymopen}simp\isactrlbsub Seq\isactrlesub {\isasymclose}\ encode\ the\ simplification\ rules\ in\ {\isacharbackslash}{\kern0pt}eqref{\isacharbraceleft}{\kern0pt}Simpl{\isacharbraceright}{\kern0pt}\ and\ compose\ the\ rectification\ functions\ {\isacharparenleft}{\kern0pt}simplifications\ can\ occur\ deep\ inside\ the\ regular\ expression{\isacharparenright}{\kern0pt}{\isachardot}{\kern0pt}\ The\ main\ simplification\ function\ is\ then\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}ALT\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}SEQ\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp{\isacharunderscore}{\kern0pt}SEQ\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}simp\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharparenleft}{\kern0pt}r{\isacharcomma}{\kern0pt}\ id{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}noindent\ where\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}id{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ stands\ for\ the\ identity\ function{\isachardot}{\kern0pt}\ The\ function\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}const\ simp{\isacharbraceright}{\kern0pt}\ returns\ a\ simplified\ regular\ expression\ and\ a\ corresponding\ rectification\ function{\isachardot}{\kern0pt}\ Note\ that\ we\ do\ not\ simplify\ under\ stars{\isacharcolon}{\kern0pt}\ this\ seems\ to\ slow\ down\ the\ algorithm{\isacharcomma}{\kern0pt}\ rather\ than\ speed\ it\ up{\isachardot}{\kern0pt}\ The\ optimised\ lexer\ is\ then\ given\ by\ the\ clauses{\isacharcolon}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}lcl{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ slexer{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}rhs{\isacharparenright}{\kern0pt}\ slexer{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ {\isacharparenleft}{\kern0pt}lhs{\isacharparenright}{\kern0pt}\ slexer{\isachardot}{\kern0pt}simps{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}dn{\isachardollar}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}let\ {\isacharparenleft}{\kern0pt}r\isactrlsub s{\isacharcomma}{\kern0pt}\ f\isactrlsub r{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ simp\ {\isacharparenleft}{\kern0pt}r\ {\isasymclose}{\isachardollar}{\kern0pt}{\isacharbackslash}{\kern0pt}backslash{\isachardollar}{\kern0pt}{\isasymopen}\ c{\isacharparenright}{\kern0pt}\ in{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isasymopen}case{\isasymclose}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}slexer\ r\isactrlsub s\ s{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isasymopen}of{\isasymclose}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharbackslash}{\kern0pt}phantom{\isacharbraceleft}{\kern0pt}{\isachardollar}{\kern0pt}{\isacharbar}{\kern0pt}{\isachardollar}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}None{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ \ {\isasymopen}{\isasymRightarrow}{\isasymclose}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ None{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isachardollar}{\kern0pt}{\isacharbar}{\kern0pt}{\isachardollar}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}Some\ v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ {\isasymopen}{\isasymRightarrow}{\isasymclose}\ {\isasymopen}Some\ {\isacharparenleft}{\kern0pt}inj\ r\ c\ {\isacharparenleft}{\kern0pt}f\isactrlsub r\ v{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isasymclose}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}center{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}noindent\ In\ the\ second\ clause\ we\ first\ calculate\ the\ derivative\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}der\ c\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ then\ simplify\ the\ result{\isachardot}{\kern0pt}\ This\ gives\ us\ a\ simplified\ derivative\ {\isasymopen}r\isactrlsub s{\isasymclose}\ and\ a\ rectification\ function\ {\isasymopen}f\isactrlsub r{\isasymclose}{\isachardot}{\kern0pt}\ The\ lexer\ is\ then\ recursively\ called\ with\ the\ simplified\ derivative{\isacharcomma}{\kern0pt}\ but\ before\ we\ inject\ the\ character\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ c{\isacharbraceright}{\kern0pt}\ into\ the\ value\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ v{\isacharbraceright}{\kern0pt}{\isacharcomma}{\kern0pt}\ we\ need\ to\ rectify\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ v{\isacharbraceright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}that\ is\ construct\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}f\isactrlsub r\ v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isachardot}{\kern0pt}\ Before\ we\ can\ establish\ the\ correctness\ of\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}slexer{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharcomma}{\kern0pt}\ we\ need\ to\ show\ that\ simplification\ preserves\ the\ language\ and\ simplification\ preserves\ our\ POSIX\ relation\ once\ the\ value\ is\ rectified\ {\isacharparenleft}{\kern0pt}recall\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}const\ {\isachardoublequote}{\kern0pt}simp{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ generates\ a\ {\isacharparenleft}{\kern0pt}regular\ expression{\isacharcomma}{\kern0pt}\ rectification\ function{\isacharparenright}{\kern0pt}\ pair{\isacharparenright}{\kern0pt}{\isacharcolon}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}lemma{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}mbox{\isacharbraceleft}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}smallskip{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}label{\isacharbraceleft}{\kern0pt}slexeraux{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}{\isacharbraceleft}{\kern0pt}ll{\isacharbraceright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ L{\isacharunderscore}{\kern0pt}fst{\isacharunderscore}{\kern0pt}simp{\isacharbrackleft}{\kern0pt}symmetric{\isacharbrackright}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharbackslash}{\kern0pt}{\isacharbackslash}{\kern0pt}\ {\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isacharampersand}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm{\isacharbrackleft}{\kern0pt}mode{\isacharequal}{\kern0pt}IfThen{\isacharbrackright}{\kern0pt}\ Posix{\isacharunderscore}{\kern0pt}simp{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}tabular{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}lemma{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}proof{\isacharbraceright}{\kern0pt}\ Both\ are\ by\ induction\ on\ {\isasymopen}r{\isasymclose}{\isachardot}{\kern0pt}\ There\ is\ no\ interesting\ case\ for\ the\ first\ statement{\isachardot}{\kern0pt}\ For\ the\ second\ statement{\isacharcomma}{\kern0pt}\ of\ interest\ are\ the\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}r\ {\isacharequal}{\kern0pt}\ ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}r\ {\isacharequal}{\kern0pt}\ SEQ\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ cases{\isachardot}{\kern0pt}\ In\ each\ case\ we\ have\ to\ analyse\ four\ subcases\ whether\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ equals\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}const\ ZERO{\isacharbraceright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}respectively\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}const\ ONE{\isacharbraceright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isachardot}{\kern0pt}\ For\ example\ for\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}r\ {\isacharequal}{\kern0pt}\ ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharcomma}{\kern0pt}\ consider\ the\ subcase\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ ZERO{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymnoteq}\ ZERO{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ By\ assumption\ we\ know\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ fst\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ From\ this\ we\ can\ infer\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ by\ IH\ also\ {\isacharparenleft}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ r\isactrlsub {\isadigit{2}}\ {\isasymrightarrow}\ {\isacharparenleft}{\kern0pt}snd\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ v{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ Given\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ ZERO{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ we\ know\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}L\ {\isacharparenleft}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isacharbraceleft}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ By\ the\ first\ statement\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}L\ r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ is\ the\ empty\ set{\isacharcomma}{\kern0pt}\ meaning\ {\isacharparenleft}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymnotin}\ L\ r\isactrlsub {\isadigit{1}}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ Taking\ {\isacharparenleft}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharparenright}{\kern0pt}\ and\ {\isacharparenleft}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharparenright}{\kern0pt}\ together\ gives\ by\ the\ {\isacharbackslash}{\kern0pt}mbox{\isacharbraceleft}{\kern0pt}{\isasymopen}P{\isacharplus}{\kern0pt}R{\isasymclose}{\isacharbraceright}{\kern0pt}{\isacharminus}{\kern0pt}rule\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}\ {\isasymrightarrow}\ Right\ {\isacharparenleft}{\kern0pt}snd\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ v{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ In\ turn\ this\ gives\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}\ {\isasymrightarrow}\ snd\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}ALT\ r\isactrlsub {\isadigit{1}}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ as\ we\ need\ to\ show{\isachardot}{\kern0pt}\ The\ other\ cases\ are\ similar{\isachardot}{\kern0pt}{\isacharbackslash}{\kern0pt}qed\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}proof{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}noindent\ We\ can\ now\ prove\ relatively\ straightforwardly\ that\ the\ optimised\ lexer\ produces\ the\ expected\ result{\isacharcolon}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}theorem{\isacharbraceright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}thm\ slexer{\isacharunderscore}{\kern0pt}correctness{\isacharbraceright}{\kern0pt}\ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}theorem{\isacharbraceright}{\kern0pt}\ \ {\isacharbackslash}{\kern0pt}begin{\isacharbraceleft}{\kern0pt}proof{\isacharbraceright}{\kern0pt}\ By\ induction\ on\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ s{\isacharbraceright}{\kern0pt}\ generalising\ over\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ r{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ The\ case\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ is\ trivial{\isachardot}{\kern0pt}\ For\ the\ cons{\isacharminus}{\kern0pt}case\ suppose\ the\ string\ is\ of\ the\ form\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}c\ {\isacharhash}{\kern0pt}\ s{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ By\ induction\ hypothesis\ we\ know\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}slexer\ r\ s\ {\isacharequal}{\kern0pt}\ lexer\ r\ s{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ holds\ for\ all\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ r{\isacharbraceright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}in\ particular\ for\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ being\ the\ derivative\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}der\ c\ r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isachardot}{\kern0pt}\ Let\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}r\isactrlsub s{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ be\ the\ simplified\ derivative\ regular\ expression{\isacharcomma}{\kern0pt}\ that\ is\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}der\ c\ r{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharcomma}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}f\isactrlsub r{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ be\ the\ rectification\ function{\isacharcomma}{\kern0pt}\ that\ is\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}snd\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}der\ c\ r{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ \ We\ distinguish\ the\ cases\ whether\ {\isacharparenleft}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ L\ {\isacharparenleft}{\kern0pt}der\ c\ r{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ or\ not{\isachardot}{\kern0pt}\ In\ the\ first\ case\ we\ have\ by\ Theorem{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}lexercorrect{\isacharbraceright}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}\ a\ value\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ so\ that\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}lexer\ {\isacharparenleft}{\kern0pt}der\ c\ r{\isacharparenright}{\kern0pt}\ s\ {\isacharequal}{\kern0pt}\ Some\ v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ der\ c\ r\ {\isasymrightarrow}\ v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ hold{\isachardot}{\kern0pt}\ By\ Lemma{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}slexeraux{\isacharbraceright}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}\ we\ can\ also\ infer\ from{\isachartilde}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isacharasterisk}{\kern0pt}{\isacharparenright}{\kern0pt}\ that\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ L\ r\isactrlsub s{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ holds{\isachardot}{\kern0pt}\ \ Hence\ we\ know\ by\ Theorem{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}lexercorrect{\isacharbraceright}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}\ that\ there\ exists\ a\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}v{\isacharprime}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ with\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}lexer\ r\isactrlsub s\ s\ {\isacharequal}{\kern0pt}\ Some\ v{\isacharprime}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ r\isactrlsub s\ {\isasymrightarrow}\ v{\isacharprime}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ From\ the\ latter\ we\ know\ by\ Lemma{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}slexeraux{\isacharbraceright}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isadigit{2}}{\isacharparenright}{\kern0pt}\ that\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymin}\ der\ c\ r\ {\isasymrightarrow}\ {\isacharparenleft}{\kern0pt}f\isactrlsub r\ v{\isacharprime}{\kern0pt}{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ holds{\isachardot}{\kern0pt}\ By\ the\ uniqueness\ of\ the\ POSIX\ relation\ {\isacharparenleft}{\kern0pt}Theorem{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}posixdeterm{\isacharbraceright}{\kern0pt}{\isacharparenright}{\kern0pt}\ we\ can\ infer\ that\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ v{\isacharbraceright}{\kern0pt}\ is\ equal\ to\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}f\isactrlsub r\ v{\isacharprime}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isacharminus}{\kern0pt}{\isacharminus}{\kern0pt}{\isacharminus}{\kern0pt}that\ is\ the\ rectification\ function\ applied\ to\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}v{\isacharprime}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ produces\ the\ original\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}v{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ \ Now\ the\ case\ follows\ by\ the\ definitions\ of\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}const\ lexer{\isacharbraceright}{\kern0pt}\ and\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}const\ slexer{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ \ In\ the\ second\ case\ where\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymnotin}\ L\ {\isacharparenleft}{\kern0pt}der\ c\ r{\isacharparenright}{\kern0pt}{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ we\ have\ that\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}lexer\ {\isacharparenleft}{\kern0pt}der\ c\ r{\isacharparenright}{\kern0pt}\ s\ {\isacharequal}{\kern0pt}\ None{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ by\ Theorem{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}lexercorrect{\isacharbraceright}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}{\isachardot}{\kern0pt}\ \ We\ also\ know\ by\ Lemma{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}slexeraux{\isacharbraceright}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}\ that\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}s\ {\isasymnotin}\ L\ r\isactrlsub s{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ Hence\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}lexer\ r\isactrlsub s\ s\ {\isacharequal}{\kern0pt}\ None{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}\ by\ Theorem{\isachartilde}{\kern0pt}{\isacharbackslash}{\kern0pt}ref{\isacharbraceleft}{\kern0pt}lexercorrect{\isacharbraceright}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isadigit{1}}{\isacharparenright}{\kern0pt}\ and\ by\ IH\ then\ also\ {\isacharat}{\kern0pt}{\isacharbraceleft}{\kern0pt}term\ {\isachardoublequote}{\kern0pt}slexer\ r\isactrlsub s\ s\ {\isacharequal}{\kern0pt}\ None{\isachardoublequote}{\kern0pt}{\isacharbraceright}{\kern0pt}{\isachardot}{\kern0pt}\ With\ this\ we\ can\ conclude\ in\ this\ case\ too{\isachardot}{\kern0pt}{\isacharbackslash}{\kern0pt}qed\ \ {\isacharbackslash}{\kern0pt}end{\isacharbraceleft}{\kern0pt}proof{\isacharbraceright}{\kern0pt}\ \ } |
|
1606 fy the result. This gives us a simplified derivative |
|
1607 \isa{r\isactrlsub s} and a rectification function \isa{f\isactrlsub r}. The lexer |
|
1608 is then recursively called with the simplified derivative, but before |
|
1609 we inject the character \isa{c} into the value \isa{v}, we need to rectify |
|
1610 \isa{v} (that is construct \isa{f\isactrlsub r\ v}). Before we can establish the correctness |
|
1611 of \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}}, we need to show that simplification preserves the language |
|
1612 and simplification preserves our POSIX relation once the value is rectified |
|
1613 (recall \isa{simp} generates a (regular expression, rectification function) pair): |
|
1614 |
|
1615 \begin{lemma}\mbox{}\smallskip\\\label{slexeraux} |
|
1616 \begin{tabular}{ll} |
|
1617 (1) & \isa{L{\isacharparenleft}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ L{\isacharparenleft}{\kern0pt}r{\isacharparenright}{\kern0pt}}\\ |
|
1618 (2) & \isa{{\normalsize{}If\,}\ {\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ fst\ {\isacharparenleft}{\kern0pt}simp\ r{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v\ {\normalsize \,then\,}\ {\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ snd\ {\isacharparenleft}{\kern0pt}simp\ r{\isacharparenright}{\kern0pt}\ v{\isachardot}{\kern0pt}} |
|
1619 \end{tabular} |
|
1620 \end{lemma} |
|
1621 |
|
1622 \begin{proof} Both are by induction on \isa{r}. There is no |
|
1623 interesting case for the first statement. For the second statement, |
|
1624 of interest are the \isa{r\ {\isacharequal}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}} and \isa{r\ {\isacharequal}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isasymcdot}\ r\isactrlsub {\isadigit{2}}} cases. In each case we have to analyse four subcases whether |
|
1625 \isa{fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}} and \isa{fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}} equals \isa{\isactrlbold {\isadigit{0}}} (respectively \isa{\isactrlbold {\isadigit{1}}}). For example for \isa{r\ {\isacharequal}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}}, consider the subcase \isa{fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ \isactrlbold {\isadigit{0}}} and |
|
1626 \isa{fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymnoteq}\ \isactrlbold {\isadigit{0}}}. By assumption we know \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ fst\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v}. From this we can infer \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v} |
|
1627 and by IH also (*) \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ snd\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ v}. Given \isa{fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ \isactrlbold {\isadigit{0}}} |
|
1628 we know \isa{L{\isacharparenleft}{\kern0pt}fst\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharequal}{\kern0pt}\ {\isasymemptyset}}. By the first statement |
|
1629 \isa{L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}} is the empty set, meaning (**) \isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}{\isacharparenright}{\kern0pt}}. |
|
1630 Taking (*) and (**) together gives by the \mbox{\isa{P{\isacharplus}{\kern0pt}R}}-rule |
|
1631 \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ Right\ {\isacharparenleft}{\kern0pt}snd\ {\isacharparenleft}{\kern0pt}simp\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ v{\isacharparenright}{\kern0pt}}. In turn this |
|
1632 gives \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ snd\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\ {\isacharplus}{\kern0pt}\ r\isactrlsub {\isadigit{2}}{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ v} as we need to show. |
|
1633 The other cases are similar.\qed |
|
1634 \end{proof} |
|
1635 |
|
1636 \noindent We can now prove relatively straightforwardly that the |
|
1637 optimised lexer produces the expected result: |
|
1638 |
|
1639 \begin{theorem} |
|
1640 \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}\ r\ s\ {\isacharequal}{\kern0pt}\ lexer\ r\ s} |
|
1641 \end{theorem} |
|
1642 |
|
1643 \begin{proof} By induction on \isa{s} generalising over \isa{r}. The case \isa{{\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}} is trivial. For the cons-case suppose the |
|
1644 string is of the form \isa{c\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}s}. By induction hypothesis we |
|
1645 know \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}\ r\ s\ {\isacharequal}{\kern0pt}\ lexer\ r\ s} holds for all \isa{r} (in |
|
1646 particular for \isa{r} being the derivative \isa{r{\isacharbackslash}{\kern0pt}c}). Let \isa{r\isactrlsub s} be the simplified derivative regular expression, that is \isa{fst\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}}, and \isa{f\isactrlsub r} be the rectification |
|
1647 function, that is \isa{snd\ {\isacharparenleft}{\kern0pt}simp\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}}. We distinguish the cases |
|
1648 whether (*) \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}} or not. In the first case we |
|
1649 have by Theorem~\ref{lexercorrect}(2) a value \isa{v} so that \isa{lexer\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ s\ {\isacharequal}{\kern0pt}\ Some\ v} and \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v} hold. |
|
1650 By Lemma~\ref{slexeraux}(1) we can also infer from~(*) that \isa{s\ {\isasymin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub s{\isacharparenright}{\kern0pt}} holds. Hence we know by Theorem~\ref{lexercorrect}(2) that |
|
1651 there exists a \isa{v{\isacharprime}{\kern0pt}} with \isa{lexer\ r\isactrlsub s\ s\ {\isacharequal}{\kern0pt}\ Some\ v{\isacharprime}{\kern0pt}} and |
|
1652 \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r\isactrlsub s{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ v{\isacharprime}{\kern0pt}}. From the latter we know by |
|
1653 Lemma~\ref{slexeraux}(2) that \isa{{\isacharparenleft}{\kern0pt}s{\isacharcomma}{\kern0pt}\ r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymrightarrow}\ f\isactrlsub r\ v{\isacharprime}{\kern0pt}} holds. |
|
1654 By the uniqueness of the POSIX relation (Theorem~\ref{posixdeterm}) we |
|
1655 can infer that \isa{v} is equal to \isa{f\isactrlsub r\ v{\isacharprime}{\kern0pt}}---that is the |
|
1656 rectification function applied to \isa{v{\isacharprime}{\kern0pt}} |
|
1657 produces the original \isa{v}. Now the case follows by the |
|
1658 definitions of \isa{lexer} and \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}}. |
|
1659 |
|
1660 In the second case where \isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}} we have that |
|
1661 \isa{lexer\ {\isacharparenleft}{\kern0pt}r{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ s\ {\isacharequal}{\kern0pt}\ None} by Theorem~\ref{lexercorrect}(1). We |
|
1662 also know by Lemma~\ref{slexeraux}(1) that \isa{s\ {\isasymnotin}\ L{\isacharparenleft}{\kern0pt}r\isactrlsub s{\isacharparenright}{\kern0pt}}. Hence |
|
1663 \isa{lexer\ r\isactrlsub s\ s\ {\isacharequal}{\kern0pt}\ None} by Theorem~\ref{lexercorrect}(1) and |
|
1664 by IH then also \isa{lexer\isactrlsup {\isacharplus}{\kern0pt}\ r\isactrlsub s\ s\ {\isacharequal}{\kern0pt}\ None}. With this we can |
|
1665 conclude in this case too.\qed |
|
1666 |
|
1667 \end{proof}% |
|
1668 \end{isamarkuptext}\isamarkuptrue% |
|
1669 % |
|
1670 \isadelimdocument |
|
1671 % |
|
1672 \endisadelimdocument |
|
1673 % |
|
1674 \isatagdocument |
|
1675 % |
|
1676 \isamarkupsection{HERE% |
|
1677 } |
|
1678 \isamarkuptrue% |
|
1679 % |
|
1680 \endisatagdocument |
|
1681 {\isafolddocument}% |
|
1682 % |
|
1683 \isadelimdocument |
|
1684 % |
|
1685 \endisadelimdocument |
|
1686 % |
|
1687 \begin{isamarkuptext}% |
|
1688 \begin{lemma} |
|
1689 \isa{{\normalsize{}If\,}\ v\ {\isacharcolon}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c\ {\normalsize \,then\,}\ retrieve\ {\isacharparenleft}{\kern0pt}r\mbox{$\bbslash$}c{\isacharparenright}{\kern0pt}\ v\ {\isacharequal}{\kern0pt}\ retrieve\ r\ {\isacharparenleft}{\kern0pt}inj\ {\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}\ c\ v{\isacharparenright}{\kern0pt}{\isachardot}{\kern0pt}} |
|
1690 \end{lemma} |
|
1691 |
|
1692 \begin{proof} |
|
1693 By induction on the definition of \isa{r\mbox{$^\downarrow$}}. The cases for rule 1) and 2) are |
|
1694 straightforward as \isa{\isactrlbold {\isadigit{0}}{\isacharbackslash}{\kern0pt}c} and \isa{\isactrlbold {\isadigit{1}}{\isacharbackslash}{\kern0pt}c} are both equal to |
|
1695 \isa{\isactrlbold {\isadigit{0}}}. This means \isa{v\ {\isacharcolon}{\kern0pt}\ \isactrlbold {\isadigit{0}}} cannot hold. Similarly in case of rule 3) |
|
1696 where \isa{r} is of the form \isa{ACHAR\ d} with \isa{c\ {\isacharequal}{\kern0pt}\ d}. Then by assumption |
|
1697 we know \isa{v\ {\isacharcolon}{\kern0pt}\ \isactrlbold {\isadigit{1}}}, which implies \isa{v\ {\isacharequal}{\kern0pt}\ Empty}. The equation follows by |
|
1698 simplification of left- and right-hand side. In case \isa{c\ {\isasymnoteq}\ d} we have again |
|
1699 \isa{v\ {\isacharcolon}{\kern0pt}\ \isactrlbold {\isadigit{0}}}, which cannot hold. |
|
1700 |
|
1701 For rule 4a) we have again \isa{v\ {\isacharcolon}{\kern0pt}\ \isactrlbold {\isadigit{0}}}. The property holds by IH for rule 4b). |
|
1702 The induction hypothesis is |
|
1703 \[ |
|
1704 \isa{retrieve\ {\isacharparenleft}{\kern0pt}r\mbox{$\bbslash$}c{\isacharparenright}{\kern0pt}\ v\ {\isacharequal}{\kern0pt}\ retrieve\ r\ {\isacharparenleft}{\kern0pt}inj\ {\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}\ c\ v{\isacharparenright}{\kern0pt}} |
|
1705 \] |
|
1706 which is what left- and right-hand side simplify to. The slightly more interesting case |
|
1707 is for 4c). By assumption we have |
|
1708 \isa{v\ {\isacharcolon}{\kern0pt}\ {\isacharparenleft}{\kern0pt}{\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isacharplus}{\kern0pt}\ {\isacharparenleft}{\kern0pt}{\isacharparenleft}{\kern0pt}{\isacharparenleft}{\kern0pt}AALTs\ bs\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}rs{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}}. This means we |
|
1709 have either (*) \isa{v{\isadigit{1}}\ {\isacharcolon}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{1}}\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c} with \isa{v\ {\isacharequal}{\kern0pt}\ Left\ v{\isadigit{1}}} or |
|
1710 (**) \isa{v{\isadigit{2}}\ {\isacharcolon}{\kern0pt}\ {\isacharparenleft}{\kern0pt}{\isacharparenleft}{\kern0pt}AALTs\ bs\ {\isacharparenleft}{\kern0pt}r\isactrlsub {\isadigit{2}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}rs{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c} with \isa{v\ {\isacharequal}{\kern0pt}\ Right\ v{\isadigit{2}}}. |
|
1711 The former case is straightforward by simplification. The second case is \ldots TBD. |
|
1712 |
|
1713 Rule 5) TBD. |
|
1714 |
|
1715 Finally for rule 6) the reasoning is as follows: By assumption we have |
|
1716 \isa{v\ {\isacharcolon}{\kern0pt}\ {\isacharparenleft}{\kern0pt}{\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c{\isacharparenright}{\kern0pt}\ {\isasymcdot}\ {\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}\isactrlsup {\isasymstar}}. This means we also have |
|
1717 \isa{v\ {\isacharequal}{\kern0pt}\ Seq\ v{\isadigit{1}}\ v{\isadigit{2}}}, \isa{v{\isadigit{1}}\ {\isacharcolon}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}{\isacharbackslash}{\kern0pt}c} and \isa{v{\isadigit{2}}\ {\isacharequal}{\kern0pt}\ Stars\ vs}. |
|
1718 We want to prove |
|
1719 \begin{align} |
|
1720 & \isa{retrieve\ {\isacharparenleft}{\kern0pt}ASEQ\ bs\ {\isacharparenleft}{\kern0pt}fuse\ {\isacharbrackleft}{\kern0pt}Z{\isacharbrackright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\mbox{$\bbslash$}c{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}ASTAR\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ r{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ v}\\ |
|
1721 &= \isa{retrieve\ {\isacharparenleft}{\kern0pt}ASTAR\ bs\ r{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}inj\ {\isacharparenleft}{\kern0pt}{\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}\isactrlsup {\isasymstar}{\isacharparenright}{\kern0pt}\ c\ v{\isacharparenright}{\kern0pt}} |
|
1722 \end{align} |
|
1723 The right-hand side \isa{inj}-expression is equal to |
|
1724 \isa{Stars\ {\isacharparenleft}{\kern0pt}inj\ {\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}\ c\ v{\isadigit{1}}\mbox{$\,$}{\isacharcolon}{\kern0pt}{\isacharcolon}{\kern0pt}\mbox{$\,$}vs{\isacharparenright}{\kern0pt}}, which means the \isa{retrieve}-expression |
|
1725 simplifies to |
|
1726 \[ |
|
1727 \isa{bs\ {\isacharat}{\kern0pt}\ {\isacharbrackleft}{\kern0pt}Z{\isacharbrackright}{\kern0pt}\ {\isacharat}{\kern0pt}\ retrieve\ r\ {\isacharparenleft}{\kern0pt}inj\ {\isacharparenleft}{\kern0pt}r\mbox{$^\downarrow$}{\isacharparenright}{\kern0pt}\ c\ v{\isadigit{1}}{\isacharparenright}{\kern0pt}\ {\isacharat}{\kern0pt}\ retrieve\ {\isacharparenleft}{\kern0pt}ASTAR\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}Stars\ vs{\isacharparenright}{\kern0pt}} |
|
1728 \] |
|
1729 The left-hand side (3) above simplifies to |
|
1730 \[ |
|
1731 \isa{bs\ {\isacharat}{\kern0pt}\ retrieve\ {\isacharparenleft}{\kern0pt}fuse\ {\isacharbrackleft}{\kern0pt}Z{\isacharbrackright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}r\mbox{$\bbslash$}c{\isacharparenright}{\kern0pt}{\isacharparenright}{\kern0pt}\ v{\isadigit{1}}\ {\isacharat}{\kern0pt}\ retrieve\ {\isacharparenleft}{\kern0pt}ASTAR\ {\isacharbrackleft}{\kern0pt}{\isacharbrackright}{\kern0pt}\ r{\isacharparenright}{\kern0pt}\ {\isacharparenleft}{\kern0pt}Stars\ vs{\isacharparenright}{\kern0pt}} |
|
1732 \] |
|
1733 We can move out the \isa{fuse\ {\isacharbrackleft}{\kern0pt}Z{\isacharbrackright}{\kern0pt}} and then use the IH to show that left-hand side |
|
1734 and right-hand side are equal. This completes the proof. |
|
1735 \end{proof} |
|
1736 |
|
1737 |
|
1738 |
|
1739 \bibliographystyle{plain} |
|
1740 \bibliography{root}% |
|
1741 \end{isamarkuptext}\isamarkuptrue% |
|
1742 % |
|
1743 \isadelimtheory |
|
1744 % |
|
1745 \endisadelimtheory |
|
1746 % |
|
1747 \isatagtheory |
|
1748 % |
|
1749 \endisatagtheory |
|
1750 {\isafoldtheory}% |
|
1751 % |
|
1752 \isadelimtheory |
|
1753 \isanewline |
|
1754 % |
|
1755 \endisadelimtheory |
|
1756 \isanewline |
|
1757 \isanewline |
|
1758 % |
|
1759 \end{isabellebody}% |
|
1760 \endinput |
|
1761 %:%file=~/Dropbox/Workspace/journalpaper/lexing/thys2/Journal/Paper.thy%:% |
|
1762 %:%50=134%:% |
|
1763 %:%62=136%:% |
|
1764 %:%63=137%:% |
|
1765 %:%64=138%:% |
|
1766 %:%65=139%:% |
|
1767 %:%66=140%:% |
|
1768 %:%67=141%:% |
|
1769 %:%68=142%:% |
|
1770 %:%69=143%:% |
|
1771 %:%70=144%:% |
|
1772 %:%71=145%:% |
|
1773 %:%72=146%:% |
|
1774 %:%73=147%:% |
|
1775 %:%74=148%:% |
|
1776 %:%75=149%:% |
|
1777 %:%76=150%:% |
|
1778 %:%77=151%:% |
|
1779 %:%78=152%:% |
|
1780 %:%79=153%:% |
|
1781 %:%80=154%:% |
|
1782 %:%81=155%:% |
|
1783 %:%82=156%:% |
|
1784 %:%83=157%:% |
|
1785 %:%84=158%:% |
|
1786 %:%85=159%:% |
|
1787 %:%86=160%:% |
|
1788 %:%87=161%:% |
|
1789 %:%88=162%:% |
|
1790 %:%89=163%:% |
|
1791 %:%90=164%:% |
|
1792 %:%91=165%:% |
|
1793 %:%92=166%:% |
|
1794 %:%93=167%:% |
|
1795 %:%94=168%:% |
|
1796 %:%95=169%:% |
|
1797 %:%96=170%:% |
|
1798 %:%97=171%:% |
|
1799 %:%98=172%:% |
|
1800 %:%99=173%:% |
|
1801 %:%100=174%:% |
|
1802 %:%101=175%:% |
|
1803 %:%102=176%:% |
|
1804 %:%103=177%:% |
|
1805 %:%104=178%:% |
|
1806 %:%105=179%:% |
|
1807 %:%106=180%:% |
|
1808 %:%107=181%:% |
|
1809 %:%108=182%:% |
|
1810 %:%109=183%:% |
|
1811 %:%110=184%:% |
|
1812 %:%111=185%:% |
|
1813 %:%112=186%:% |
|
1814 %:%113=187%:% |
|
1815 %:%114=188%:% |
|
1816 %:%115=189%:% |
|
1817 %:%116=190%:% |
|
1818 %:%117=191%:% |
|
1819 %:%118=192%:% |
|
1820 %:%119=193%:% |
|
1821 %:%120=194%:% |
|
1822 %:%121=195%:% |
|
1823 %:%122=196%:% |
|
1824 %:%123=197%:% |
|
1825 %:%124=198%:% |
|
1826 %:%125=199%:% |
|
1827 %:%126=200%:% |
|
1828 %:%127=201%:% |
|
1829 %:%128=202%:% |
|
1830 %:%129=203%:% |
|
1831 %:%130=204%:% |
|
1832 %:%131=205%:% |
|
1833 %:%132=206%:% |
|
1834 %:%133=207%:% |
|
1835 %:%134=208%:% |
|
1836 %:%135=209%:% |
|
1837 %:%136=210%:% |
|
1838 %:%137=211%:% |
|
1839 %:%138=212%:% |
|
1840 %:%139=213%:% |
|
1841 %:%140=214%:% |
|
1842 %:%141=215%:% |
|
1843 %:%142=216%:% |
|
1844 %:%143=217%:% |
|
1845 %:%144=218%:% |
|
1846 %:%145=219%:% |
|
1847 %:%146=220%:% |
|
1848 %:%147=221%:% |
|
1849 %:%148=222%:% |
|
1850 %:%149=223%:% |
|
1851 %:%150=224%:% |
|
1852 %:%151=225%:% |
|
1853 %:%152=226%:% |
|
1854 %:%153=227%:% |
|
1855 %:%154=228%:% |
|
1856 %:%155=229%:% |
|
1857 %:%156=230%:% |
|
1858 %:%157=231%:% |
|
1859 %:%158=232%:% |
|
1860 %:%159=233%:% |
|
1861 %:%160=234%:% |
|
1862 %:%161=235%:% |
|
1863 %:%162=236%:% |
|
1864 %:%163=237%:% |
|
1865 %:%164=238%:% |
|
1866 %:%165=239%:% |
|
1867 %:%166=240%:% |
|
1868 %:%167=241%:% |
|
1869 %:%168=242%:% |
|
1870 %:%169=243%:% |
|
1871 %:%170=244%:% |
|
1872 %:%171=245%:% |
|
1873 %:%172=246%:% |
|
1874 %:%173=247%:% |
|
1875 %:%174=248%:% |
|
1876 %:%175=249%:% |
|
1877 %:%176=250%:% |
|
1878 %:%177=251%:% |
|
1879 %:%178=252%:% |
|
1880 %:%179=253%:% |
|
1881 %:%180=254%:% |
|
1882 %:%181=255%:% |
|
1883 %:%182=256%:% |
|
1884 %:%183=257%:% |
|
1885 %:%184=258%:% |
|
1886 %:%185=259%:% |
|
1887 %:%186=260%:% |
|
1888 %:%187=261%:% |
|
1889 %:%188=262%:% |
|
1890 %:%189=263%:% |
|
1891 %:%190=264%:% |
|
1892 %:%191=265%:% |
|
1893 %:%192=266%:% |
|
1894 %:%193=267%:% |
|
1895 %:%194=268%:% |
|
1896 %:%203=272%:% |
|
1897 %:%215=276%:% |
|
1898 %:%216=277%:% |
|
1899 %:%217=278%:% |
|
1900 %:%218=279%:% |
|
1901 %:%219=280%:% |
|
1902 %:%220=281%:% |
|
1903 %:%221=282%:% |
|
1904 %:%222=283%:% |
|
1905 %:%223=284%:% |
|
1906 %:%224=285%:% |
|
1907 %:%225=286%:% |
|
1908 %:%226=287%:% |
|
1909 %:%227=288%:% |
|
1910 %:%228=289%:% |
|
1911 %:%237=297%:% |
|
1912 %:%249=303%:% |
|
1913 %:%250=304%:% |
|
1914 %:%251=305%:% |
|
1915 %:%252=306%:% |
|
1916 %:%252=307%:% |
|
1917 %:%253=308%:% |
|
1918 %:%254=309%:% |
|
1919 %:%255=310%:% |
|
1920 %:%256=311%:% |
|
1921 %:%257=312%:% |
|
1922 %:%258=313%:% |
|
1923 %:%259=314%:% |
|
1924 %:%260=315%:% |
|
1925 %:%261=316%:% |
|
1926 %:%262=317%:% |
|
1927 %:%263=318%:% |
|
1928 %:%264=319%:% |
|
1929 %:%265=320%:% |
|
1930 %:%266=321%:% |
|
1931 %:%267=322%:% |
|
1932 %:%268=323%:% |
|
1933 %:%269=324%:% |
|
1934 %:%270=325%:% |
|
1935 %:%271=326%:% |
|
1936 %:%272=327%:% |
|
1937 %:%273=328%:% |
|
1938 %:%274=329%:% |
|
1939 %:%275=330%:% |
|
1940 %:%276=331%:% |
|
1941 %:%277=332%:% |
|
1942 %:%278=333%:% |
|
1943 %:%279=334%:% |
|
1944 %:%280=335%:% |
|
1945 %:%281=336%:% |
|
1946 %:%282=337%:% |
|
1947 %:%283=338%:% |
|
1948 %:%284=339%:% |
|
1949 %:%285=340%:% |
|
1950 %:%286=341%:% |
|
1951 %:%287=342%:% |
|
1952 %:%288=343%:% |
|
1953 %:%289=344%:% |
|
1954 %:%290=345%:% |
|
1955 %:%291=346%:% |
|
1956 %:%292=347%:% |
|
1957 %:%293=348%:% |
|
1958 %:%294=349%:% |
|
1959 %:%295=350%:% |
|
1960 %:%296=351%:% |
|
1961 %:%297=352%:% |
|
1962 %:%298=353%:% |
|
1963 %:%299=354%:% |
|
1964 %:%300=355%:% |
|
1965 %:%301=356%:% |
|
1966 %:%302=357%:% |
|
1967 %:%303=358%:% |
|
1968 %:%304=359%:% |
|
1969 %:%305=360%:% |
|
1970 %:%306=361%:% |
|
1971 %:%307=362%:% |
|
1972 %:%308=363%:% |
|
1973 %:%309=364%:% |
|
1974 %:%310=365%:% |
|
1975 %:%311=366%:% |
|
1976 %:%312=367%:% |
|
1977 %:%313=368%:% |
|
1978 %:%314=369%:% |
|
1979 %:%315=370%:% |
|
1980 %:%316=371%:% |
|
1981 %:%316=372%:% |
|
1982 %:%317=373%:% |
|
1983 %:%318=374%:% |
|
1984 %:%319=375%:% |
|
1985 %:%320=376%:% |
|
1986 %:%321=377%:% |
|
1987 %:%322=378%:% |
|
1988 %:%323=379%:% |
|
1989 %:%324=380%:% |
|
1990 %:%325=381%:% |
|
1991 %:%326=382%:% |
|
1992 %:%327=383%:% |
|
1993 %:%328=384%:% |
|
1994 %:%329=385%:% |
|
1995 %:%330=386%:% |
|
1996 %:%331=387%:% |
|
1997 %:%332=388%:% |
|
1998 %:%333=389%:% |
|
1999 %:%334=390%:% |
|
2000 %:%335=391%:% |
|
2001 %:%336=392%:% |
|
2002 %:%337=393%:% |
|
2003 %:%338=394%:% |
|
2004 %:%339=395%:% |
|
2005 %:%340=396%:% |
|
2006 %:%341=397%:% |
|
2007 %:%342=398%:% |
|
2008 %:%343=399%:% |
|
2009 %:%344=400%:% |
|
2010 %:%345=401%:% |
|
2011 %:%346=402%:% |
|
2012 %:%347=403%:% |
|
2013 %:%348=404%:% |
|
2014 %:%349=405%:% |
|
2015 %:%350=406%:% |
|
2016 %:%351=407%:% |
|
2017 %:%352=408%:% |
|
2018 %:%353=409%:% |
|
2019 %:%354=410%:% |
|
2020 %:%355=411%:% |
|
2021 %:%356=412%:% |
|
2022 %:%357=413%:% |
|
2023 %:%358=414%:% |
|
2024 %:%359=415%:% |
|
2025 %:%360=416%:% |
|
2026 %:%361=417%:% |
|
2027 %:%362=418%:% |
|
2028 %:%363=419%:% |
|
2029 %:%364=420%:% |
|
2030 %:%365=421%:% |
|
2031 %:%366=422%:% |
|
2032 %:%367=423%:% |
|
2033 %:%368=424%:% |
|
2034 %:%369=425%:% |
|
2035 %:%370=426%:% |
|
2036 %:%371=427%:% |
|
2037 %:%372=428%:% |
|
2038 %:%373=429%:% |
|
2039 %:%374=430%:% |
|
2040 %:%375=431%:% |
|
2041 %:%376=432%:% |
|
2042 %:%377=433%:% |
|
2043 %:%378=434%:% |
|
2044 %:%379=435%:% |
|
2045 %:%380=436%:% |
|
2046 %:%381=437%:% |
|
2047 %:%382=438%:% |
|
2048 %:%383=439%:% |
|
2049 %:%384=440%:% |
|
2050 %:%385=441%:% |
|
2051 %:%386=442%:% |
|
2052 %:%387=443%:% |
|
2053 %:%388=444%:% |
|
2054 %:%389=445%:% |
|
2055 %:%390=446%:% |
|
2056 %:%391=447%:% |
|
2057 %:%392=448%:% |
|
2058 %:%393=449%:% |
|
2059 %:%394=450%:% |
|
2060 %:%395=451%:% |
|
2061 %:%396=452%:% |
|
2062 %:%397=453%:% |
|
2063 %:%398=454%:% |
|
2064 %:%399=455%:% |
|
2065 %:%400=456%:% |
|
2066 %:%401=457%:% |
|
2067 %:%402=458%:% |
|
2068 %:%403=459%:% |
|
2069 %:%404=460%:% |
|
2070 %:%405=461%:% |
|
2071 %:%406=462%:% |
|
2072 %:%407=463%:% |
|
2073 %:%408=464%:% |
|
2074 %:%409=465%:% |
|
2075 %:%410=466%:% |
|
2076 %:%411=467%:% |
|
2077 %:%412=468%:% |
|
2078 %:%413=469%:% |
|
2079 %:%414=470%:% |
|
2080 %:%415=471%:% |
|
2081 %:%416=472%:% |
|
2082 %:%417=473%:% |
|
2083 %:%418=474%:% |
|
2084 %:%419=475%:% |
|
2085 %:%420=476%:% |
|
2086 %:%421=477%:% |
|
2087 %:%430=484%:% |
|
2088 %:%442=486%:% |
|
2089 %:%443=487%:% |
|
2090 %:%443=488%:% |
|
2091 %:%444=489%:% |
|
2092 %:%445=490%:% |
|
2093 %:%446=491%:% |
|
2094 %:%447=492%:% |
|
2095 %:%448=493%:% |
|
2096 %:%449=494%:% |
|
2097 %:%450=495%:% |
|
2098 %:%451=496%:% |
|
2099 %:%452=497%:% |
|
2100 %:%453=498%:% |
|
2101 %:%454=499%:% |
|
2102 %:%455=500%:% |
|
2103 %:%456=501%:% |
|
2104 %:%457=502%:% |
|
2105 %:%458=503%:% |
|
2106 %:%459=504%:% |
|
2107 %:%460=505%:% |
|
2108 %:%461=506%:% |
|
2109 %:%462=507%:% |
|
2110 %:%463=508%:% |
|
2111 %:%464=509%:% |
|
2112 %:%465=510%:% |
|
2113 %:%466=511%:% |
|
2114 %:%467=512%:% |
|
2115 %:%468=513%:% |
|
2116 %:%469=514%:% |
|
2117 %:%470=515%:% |
|
2118 %:%471=516%:% |
|
2119 %:%472=517%:% |
|
2120 %:%473=518%:% |
|
2121 %:%474=519%:% |
|
2122 %:%475=520%:% |
|
2123 %:%476=521%:% |
|
2124 %:%477=522%:% |
|
2125 %:%478=523%:% |
|
2126 %:%479=524%:% |
|
2127 %:%480=525%:% |
|
2128 %:%481=526%:% |
|
2129 %:%482=527%:% |
|
2130 %:%482=528%:% |
|
2131 %:%483=529%:% |
|
2132 %:%484=530%:% |
|
2133 %:%485=531%:% |
|
2134 %:%486=532%:% |
|
2135 %:%487=533%:% |
|
2136 %:%487=534%:% |
|
2137 %:%488=535%:% |
|
2138 %:%489=536%:% |
|
2139 %:%490=537%:% |
|
2140 %:%491=538%:% |
|
2141 %:%492=539%:% |
|
2142 %:%493=540%:% |
|
2143 %:%494=541%:% |
|
2144 %:%495=542%:% |
|
2145 %:%496=543%:% |
|
2146 %:%497=544%:% |
|
2147 %:%498=545%:% |
|
2148 %:%499=546%:% |
|
2149 %:%500=547%:% |
|
2150 %:%501=548%:% |
|
2151 %:%502=549%:% |
|
2152 %:%503=550%:% |
|
2153 %:%504=551%:% |
|
2154 %:%505=552%:% |
|
2155 %:%506=553%:% |
|
2156 %:%507=554%:% |
|
2157 %:%508=555%:% |
|
2158 %:%509=556%:% |
|
2159 %:%510=557%:% |
|
2160 %:%511=558%:% |
|
2161 %:%512=559%:% |
|
2162 %:%513=560%:% |
|
2163 %:%514=561%:% |
|
2164 %:%515=562%:% |
|
2165 %:%516=563%:% |
|
2166 %:%517=564%:% |
|
2167 %:%518=565%:% |
|
2168 %:%519=566%:% |
|
2169 %:%520=567%:% |
|
2170 %:%521=568%:% |
|
2171 %:%522=569%:% |
|
2172 %:%523=570%:% |
|
2173 %:%524=571%:% |
|
2174 %:%525=572%:% |
|
2175 %:%526=573%:% |
|
2176 %:%527=574%:% |
|
2177 %:%528=575%:% |
|
2178 %:%529=576%:% |
|
2179 %:%530=577%:% |
|
2180 %:%531=578%:% |
|
2181 %:%532=579%:% |
|
2182 %:%533=580%:% |
|
2183 %:%534=581%:% |
|
2184 %:%535=582%:% |
|
2185 %:%536=583%:% |
|
2186 %:%537=584%:% |
|
2187 %:%538=585%:% |
|
2188 %:%539=586%:% |
|
2189 %:%540=587%:% |
|
2190 %:%541=588%:% |
|
2191 %:%542=589%:% |
|
2192 %:%543=590%:% |
|
2193 %:%544=591%:% |
|
2194 %:%545=592%:% |
|
2195 %:%546=593%:% |
|
2196 %:%547=594%:% |
|
2197 %:%548=595%:% |
|
2198 %:%549=596%:% |
|
2199 %:%550=597%:% |
|
2200 %:%551=598%:% |
|
2201 %:%552=599%:% |
|
2202 %:%553=600%:% |
|
2203 %:%554=601%:% |
|
2204 %:%555=602%:% |
|
2205 %:%556=603%:% |
|
2206 %:%557=604%:% |
|
2207 %:%558=605%:% |
|
2208 %:%559=606%:% |
|
2209 %:%560=607%:% |
|
2210 %:%561=608%:% |
|
2211 %:%562=609%:% |
|
2212 %:%563=610%:% |
|
2213 %:%564=611%:% |
|
2214 %:%565=612%:% |
|
2215 %:%566=613%:% |
|
2216 %:%567=614%:% |
|
2217 %:%568=615%:% |
|
2218 %:%569=616%:% |
|
2219 %:%570=617%:% |
|
2220 %:%571=618%:% |
|
2221 %:%572=619%:% |
|
2222 %:%573=620%:% |
|
2223 %:%574=621%:% |
|
2224 %:%575=622%:% |
|
2225 %:%576=623%:% |
|
2226 %:%585=627%:% |
|
2227 %:%597=631%:% |
|
2228 %:%598=632%:% |
|
2229 %:%599=633%:% |
|
2230 %:%600=634%:% |
|
2231 %:%601=635%:% |
|
2232 %:%602=636%:% |
|
2233 %:%603=637%:% |
|
2234 %:%604=638%:% |
|
2235 %:%605=639%:% |
|
2236 %:%606=640%:% |
|
2237 %:%607=641%:% |
|
2238 %:%608=642%:% |
|
2239 %:%609=643%:% |
|
2240 %:%610=644%:% |
|
2241 %:%611=645%:% |
|
2242 %:%612=646%:% |
|
2243 %:%613=647%:% |
|
2244 %:%614=648%:% |
|
2245 %:%615=649%:% |
|
2246 %:%616=650%:% |
|
2247 %:%617=651%:% |
|
2248 %:%618=652%:% |
|
2249 %:%619=653%:% |
|
2250 %:%620=654%:% |
|
2251 %:%621=655%:% |
|
2252 %:%622=656%:% |
|
2253 %:%623=657%:% |
|
2254 %:%624=658%:% |
|
2255 %:%625=659%:% |
|
2256 %:%626=660%:% |
|
2257 %:%627=661%:% |
|
2258 %:%628=662%:% |
|
2259 %:%629=663%:% |
|
2260 %:%630=664%:% |
|
2261 %:%631=665%:% |
|
2262 %:%632=666%:% |
|
2263 %:%633=667%:% |
|
2264 %:%634=668%:% |
|
2265 %:%635=669%:% |
|
2266 %:%636=670%:% |
|
2267 %:%637=671%:% |
|
2268 %:%638=672%:% |
|
2269 %:%639=673%:% |
|
2270 %:%640=674%:% |
|
2271 %:%641=675%:% |
|
2272 %:%642=676%:% |
|
2273 %:%643=677%:% |
|
2274 %:%644=678%:% |
|
2275 %:%645=679%:% |
|
2276 %:%646=680%:% |
|
2277 %:%647=681%:% |
|
2278 %:%648=682%:% |
|
2279 %:%649=683%:% |
|
2280 %:%650=684%:% |
|
2281 %:%651=685%:% |
|
2282 %:%652=686%:% |
|
2283 %:%653=687%:% |
|
2284 %:%654=688%:% |
|
2285 %:%655=689%:% |
|
2286 %:%656=690%:% |
|
2287 %:%657=691%:% |
|
2288 %:%658=692%:% |
|
2289 %:%659=693%:% |
|
2290 %:%660=694%:% |
|
2291 %:%661=695%:% |
|
2292 %:%662=696%:% |
|
2293 %:%663=697%:% |
|
2294 %:%664=698%:% |
|
2295 %:%665=699%:% |
|
2296 %:%666=700%:% |
|
2297 %:%667=701%:% |
|
2298 %:%668=702%:% |
|
2299 %:%669=703%:% |
|
2300 %:%670=704%:% |
|
2301 %:%671=705%:% |
|
2302 %:%672=706%:% |
|
2303 %:%673=707%:% |
|
2304 %:%674=708%:% |
|
2305 %:%675=709%:% |
|
2306 %:%676=710%:% |
|
2307 %:%677=711%:% |
|
2308 %:%678=712%:% |
|
2309 %:%679=713%:% |
|
2310 %:%680=714%:% |
|
2311 %:%681=715%:% |
|
2312 %:%682=716%:% |
|
2313 %:%683=717%:% |
|
2314 %:%684=718%:% |
|
2315 %:%685=719%:% |
|
2316 %:%686=720%:% |
|
2317 %:%687=721%:% |
|
2318 %:%688=722%:% |
|
2319 %:%689=723%:% |
|
2320 %:%690=724%:% |
|
2321 %:%691=725%:% |
|
2322 %:%692=726%:% |
|
2323 %:%693=727%:% |
|
2324 %:%694=728%:% |
|
2325 %:%695=729%:% |
|
2326 %:%696=730%:% |
|
2327 %:%697=731%:% |
|
2328 %:%698=732%:% |
|
2329 %:%699=733%:% |
|
2330 %:%700=734%:% |
|
2331 %:%701=735%:% |
|
2332 %:%702=736%:% |
|
2333 %:%703=737%:% |
|
2334 %:%704=738%:% |
|
2335 %:%705=739%:% |
|
2336 %:%706=740%:% |
|
2337 %:%707=741%:% |
|
2338 %:%708=742%:% |
|
2339 %:%709=743%:% |
|
2340 %:%710=744%:% |
|
2341 %:%711=745%:% |
|
2342 %:%711=746%:% |
|
2343 %:%712=747%:% |
|
2344 %:%712=748%:% |
|
2345 %:%713=749%:% |
|
2346 %:%714=750%:% |
|
2347 %:%714=751%:% |
|
2348 %:%715=752%:% |
|
2349 %:%716=753%:% |
|
2350 %:%717=754%:% |
|
2351 %:%718=755%:% |
|
2352 %:%719=756%:% |
|
2353 %:%720=757%:% |
|
2354 %:%721=758%:% |
|
2355 %:%722=759%:% |
|
2356 %:%723=760%:% |
|
2357 %:%724=761%:% |
|
2358 %:%725=762%:% |
|
2359 %:%726=763%:% |
|
2360 %:%727=764%:% |
|
2361 %:%728=765%:% |
|
2362 %:%729=766%:% |
|
2363 %:%730=767%:% |
|
2364 %:%731=768%:% |
|
2365 %:%732=769%:% |
|
2366 %:%733=770%:% |
|
2367 %:%734=771%:% |
|
2368 %:%735=772%:% |
|
2369 %:%736=773%:% |
|
2370 %:%737=774%:% |
|
2371 %:%738=775%:% |
|
2372 %:%739=776%:% |
|
2373 %:%740=777%:% |
|
2374 %:%741=778%:% |
|
2375 %:%742=779%:% |
|
2376 %:%743=780%:% |
|
2377 %:%744=781%:% |
|
2378 %:%745=782%:% |
|
2379 %:%746=783%:% |
|
2380 %:%747=784%:% |
|
2381 %:%748=785%:% |
|
2382 %:%749=786%:% |
|
2383 %:%750=787%:% |
|
2384 %:%751=788%:% |
|
2385 %:%752=789%:% |
|
2386 %:%753=790%:% |
|
2387 %:%754=791%:% |
|
2388 %:%755=792%:% |
|
2389 %:%756=793%:% |
|
2390 %:%757=794%:% |
|
2391 %:%758=795%:% |
|
2392 %:%759=796%:% |
|
2393 %:%760=797%:% |
|
2394 %:%761=798%:% |
|
2395 %:%762=799%:% |
|
2396 %:%763=800%:% |
|
2397 %:%764=801%:% |
|
2398 %:%765=802%:% |
|
2399 %:%766=803%:% |
|
2400 %:%767=804%:% |
|
2401 %:%768=805%:% |
|
2402 %:%769=806%:% |
|
2403 %:%770=807%:% |
|
2404 %:%770=808%:% |
|
2405 %:%770=809%:% |
|
2406 %:%771=810%:% |
|
2407 %:%772=811%:% |
|
2408 %:%773=812%:% |
|
2409 %:%774=813%:% |
|
2410 %:%775=814%:% |
|
2411 %:%776=815%:% |
|
2412 %:%777=816%:% |
|
2413 %:%778=817%:% |
|
2414 %:%779=818%:% |
|
2415 %:%779=819%:% |
|
2416 %:%780=820%:% |
|
2417 %:%781=821%:% |
|
2418 %:%782=822%:% |
|
2419 %:%783=823%:% |
|
2420 %:%784=824%:% |
|
2421 %:%785=825%:% |
|
2422 %:%786=826%:% |
|
2423 %:%787=827%:% |
|
2424 %:%788=828%:% |
|
2425 %:%789=829%:% |
|
2426 %:%790=830%:% |
|
2427 %:%791=831%:% |
|
2428 %:%792=832%:% |
|
2429 %:%793=833%:% |
|
2430 %:%794=834%:% |
|
2431 %:%795=835%:% |
|
2432 %:%796=836%:% |
|
2433 %:%797=837%:% |
|
2434 %:%798=838%:% |
|
2435 %:%799=839%:% |
|
2436 %:%800=840%:% |
|
2437 %:%801=841%:% |
|
2438 %:%802=842%:% |
|
2439 %:%803=843%:% |
|
2440 %:%804=844%:% |
|
2441 %:%805=845%:% |
|
2442 %:%806=846%:% |
|
2443 %:%807=847%:% |
|
2444 %:%808=848%:% |
|
2445 %:%809=849%:% |
|
2446 %:%810=850%:% |
|
2447 %:%811=851%:% |
|
2448 %:%812=852%:% |
|
2449 %:%813=853%:% |
|
2450 %:%814=854%:% |
|
2451 %:%814=855%:% |
|
2452 %:%815=856%:% |
|
2453 %:%816=857%:% |
|
2454 %:%817=858%:% |
|
2455 %:%818=859%:% |
|
2456 %:%819=860%:% |
|
2457 %:%820=861%:% |
|
2458 %:%821=862%:% |
|
2459 %:%821=863%:% |
|
2460 %:%822=864%:% |
|
2461 %:%823=865%:% |
|
2462 %:%824=866%:% |
|
2463 %:%824=867%:% |
|
2464 %:%825=868%:% |
|
2465 %:%826=869%:% |
|
2466 %:%827=870%:% |
|
2467 %:%828=871%:% |
|
2468 %:%829=872%:% |
|
2469 %:%830=873%:% |
|
2470 %:%831=874%:% |
|
2471 %:%832=875%:% |
|
2472 %:%833=876%:% |
|
2473 %:%834=877%:% |
|
2474 %:%835=878%:% |
|
2475 %:%835=879%:% |
|
2476 %:%836=880%:% |
|
2477 %:%837=881%:% |
|
2478 %:%838=882%:% |
|
2479 %:%839=883%:% |
|
2480 %:%839=884%:% |
|
2481 %:%840=885%:% |
|
2482 %:%841=886%:% |
|
2483 %:%842=887%:% |
|
2484 %:%843=888%:% |
|
2485 %:%844=889%:% |
|
2486 %:%845=890%:% |
|
2487 %:%846=891%:% |
|
2488 %:%847=892%:% |
|
2489 %:%848=893%:% |
|
2490 %:%849=894%:% |
|
2491 %:%850=895%:% |
|
2492 %:%851=896%:% |
|
2493 %:%852=897%:% |
|
2494 %:%853=898%:% |
|
2495 %:%854=899%:% |
|
2496 %:%855=900%:% |
|
2497 %:%856=901%:% |
|
2498 %:%857=902%:% |
|
2499 %:%858=903%:% |
|
2500 %:%859=904%:% |
|
2501 %:%860=905%:% |
|
2502 %:%861=906%:% |
|
2503 %:%862=907%:% |
|
2504 %:%863=908%:% |
|
2505 %:%864=909%:% |
|
2506 %:%865=910%:% |
|
2507 %:%866=911%:% |
|
2508 %:%867=912%:% |
|
2509 %:%868=913%:% |
|
2510 %:%869=914%:% |
|
2511 %:%870=915%:% |
|
2512 %:%871=916%:% |
|
2513 %:%872=917%:% |
|
2514 %:%873=918%:% |
|
2515 %:%874=919%:% |
|
2516 %:%875=920%:% |
|
2517 %:%876=921%:% |
|
2518 %:%877=922%:% |
|
2519 %:%878=923%:% |
|
2520 %:%879=924%:% |
|
2521 %:%880=925%:% |
|
2522 %:%881=926%:% |
|
2523 %:%882=927%:% |
|
2524 %:%883=928%:% |
|
2525 %:%884=929%:% |
|
2526 %:%885=930%:% |
|
2527 %:%886=931%:% |
|
2528 %:%887=932%:% |
|
2529 %:%888=933%:% |
|
2530 %:%889=934%:% |
|
2531 %:%890=935%:% |
|
2532 %:%891=936%:% |
|
2533 %:%892=937%:% |
|
2534 %:%893=938%:% |
|
2535 %:%894=939%:% |
|
2536 %:%895=940%:% |
|
2537 %:%896=941%:% |
|
2538 %:%897=942%:% |
|
2539 %:%897=943%:% |
|
2540 %:%898=944%:% |
|
2541 %:%899=945%:% |
|
2542 %:%900=946%:% |
|
2543 %:%901=947%:% |
|
2544 %:%902=948%:% |
|
2545 %:%903=949%:% |
|
2546 %:%904=950%:% |
|
2547 %:%905=951%:% |
|
2548 %:%906=952%:% |
|
2549 %:%907=953%:% |
|
2550 %:%908=954%:% |
|
2551 %:%909=955%:% |
|
2552 %:%910=956%:% |
|
2553 %:%911=957%:% |
|
2554 %:%912=958%:% |
|
2555 %:%913=959%:% |
|
2556 %:%914=960%:% |
|
2557 %:%915=961%:% |
|
2558 %:%916=962%:% |
|
2559 %:%917=963%:% |
|
2560 %:%918=964%:% |
|
2561 %:%919=965%:% |
|
2562 %:%920=966%:% |
|
2563 %:%921=967%:% |
|
2564 %:%922=968%:% |
|
2565 %:%923=969%:% |
|
2566 %:%924=970%:% |
|
2567 %:%925=971%:% |
|
2568 %:%926=972%:% |
|
2569 %:%927=973%:% |
|
2570 %:%928=974%:% |
|
2571 %:%929=975%:% |
|
2572 %:%930=976%:% |
|
2573 %:%930=977%:% |
|
2574 %:%931=978%:% |
|
2575 %:%932=979%:% |
|
2576 %:%933=980%:% |
|
2577 %:%934=981%:% |
|
2578 %:%935=982%:% |
|
2579 %:%936=983%:% |
|
2580 %:%937=984%:% |
|
2581 %:%938=985%:% |
|
2582 %:%939=986%:% |
|
2583 %:%940=987%:% |
|
2584 %:%941=988%:% |
|
2585 %:%942=989%:% |
|
2586 %:%943=990%:% |
|
2587 %:%944=991%:% |
|
2588 %:%945=992%:% |
|
2589 %:%946=993%:% |
|
2590 %:%947=994%:% |
|
2591 %:%948=995%:% |
|
2592 %:%949=996%:% |
|
2593 %:%950=997%:% |
|
2594 %:%951=998%:% |
|
2595 %:%952=999%:% |
|
2596 %:%953=1000%:% |
|
2597 %:%954=1001%:% |
|
2598 %:%955=1002%:% |
|
2599 %:%956=1003%:% |
|
2600 %:%957=1004%:% |
|
2601 %:%958=1005%:% |
|
2602 %:%959=1006%:% |
|
2603 %:%960=1007%:% |
|
2604 %:%960=1008%:% |
|
2605 %:%961=1009%:% |
|
2606 %:%962=1010%:% |
|
2607 %:%963=1011%:% |
|
2608 %:%964=1012%:% |
|
2609 %:%965=1013%:% |
|
2610 %:%966=1014%:% |
|
2611 %:%967=1015%:% |
|
2612 %:%968=1016%:% |
|
2613 %:%968=1017%:% |
|
2614 %:%969=1018%:% |
|
2615 %:%970=1019%:% |
|
2616 %:%971=1020%:% |
|
2617 %:%972=1021%:% |
|
2618 %:%973=1022%:% |
|
2619 %:%974=1023%:% |
|
2620 %:%975=1024%:% |
|
2621 %:%976=1025%:% |
|
2622 %:%977=1026%:% |
|
2623 %:%978=1027%:% |
|
2624 %:%979=1028%:% |
|
2625 %:%980=1029%:% |
|
2626 %:%981=1030%:% |
|
2627 %:%982=1031%:% |
|
2628 %:%983=1032%:% |
|
2629 %:%984=1033%:% |
|
2630 %:%985=1034%:% |
|
2631 %:%986=1035%:% |
|
2632 %:%987=1036%:% |
|
2633 %:%988=1037%:% |
|
2634 %:%989=1038%:% |
|
2635 %:%990=1039%:% |
|
2636 %:%991=1040%:% |
|
2637 %:%992=1041%:% |
|
2638 %:%993=1042%:% |
|
2639 %:%994=1043%:% |
|
2640 %:%995=1044%:% |
|
2641 %:%996=1045%:% |
|
2642 %:%997=1046%:% |
|
2643 %:%998=1047%:% |
|
2644 %:%999=1048%:% |
|
2645 %:%1000=1049%:% |
|
2646 %:%1001=1050%:% |
|
2647 %:%1002=1051%:% |
|
2648 %:%1003=1052%:% |
|
2649 %:%1004=1053%:% |
|
2650 %:%1005=1054%:% |
|
2651 %:%1005=1055%:% |
|
2652 %:%1005=1056%:% |
|
2653 %:%1006=1057%:% |
|
2654 %:%1006=1058%:% |
|
2655 %:%1006=1059%:% |
|
2656 %:%1007=1060%:% |
|
2657 %:%1008=1061%:% |
|
2658 %:%1008=1062%:% |
|
2659 %:%1009=1063%:% |
|
2660 %:%1010=1064%:% |
|
2661 %:%1011=1065%:% |
|
2662 %:%1012=1066%:% |
|
2663 %:%1013=1067%:% |
|
2664 %:%1014=1068%:% |
|
2665 %:%1015=1069%:% |
|
2666 %:%1016=1070%:% |
|
2667 %:%1017=1071%:% |
|
2668 %:%1018=1072%:% |
|
2669 %:%1019=1073%:% |
|
2670 %:%1020=1074%:% |
|
2671 %:%1021=1075%:% |
|
2672 %:%1022=1076%:% |
|
2673 %:%1023=1077%:% |
|
2674 %:%1024=1078%:% |
|
2675 %:%1025=1079%:% |
|
2676 %:%1026=1080%:% |
|
2677 %:%1027=1081%:% |
|
2678 %:%1028=1082%:% |
|
2679 %:%1029=1083%:% |
|
2680 %:%1030=1084%:% |
|
2681 %:%1031=1085%:% |
|
2682 %:%1032=1086%:% |
|
2683 %:%1033=1087%:% |
|
2684 %:%1034=1088%:% |
|
2685 %:%1035=1089%:% |
|
2686 %:%1036=1090%:% |
|
2687 %:%1037=1091%:% |
|
2688 %:%1038=1092%:% |
|
2689 %:%1039=1093%:% |
|
2690 %:%1040=1094%:% |
|
2691 %:%1041=1095%:% |
|
2692 %:%1042=1096%:% |
|
2693 %:%1042=1097%:% |
|
2694 %:%1043=1098%:% |
|
2695 %:%1044=1099%:% |
|
2696 %:%1045=1100%:% |
|
2697 %:%1045=1101%:% |
|
2698 %:%1045=1102%:% |
|
2699 %:%1045=1103%:% |
|
2700 %:%1046=1104%:% |
|
2701 %:%1047=1105%:% |
|
2702 %:%1048=1106%:% |
|
2703 %:%1049=1107%:% |
|
2704 %:%1050=1108%:% |
|
2705 %:%1051=1109%:% |
|
2706 %:%1052=1110%:% |
|
2707 %:%1053=1111%:% |
|
2708 %:%1054=1112%:% |
|
2709 %:%1055=1113%:% |
|
2710 %:%1056=1114%:% |
|
2711 %:%1057=1115%:% |
|
2712 %:%1058=1116%:% |
|
2713 %:%1059=1117%:% |
|
2714 %:%1060=1118%:% |
|
2715 %:%1061=1119%:% |
|
2716 %:%1062=1120%:% |
|
2717 %:%1063=1121%:% |
|
2718 %:%1064=1122%:% |
|
2719 %:%1065=1123%:% |
|
2720 %:%1066=1124%:% |
|
2721 %:%1067=1125%:% |
|
2722 %:%1068=1126%:% |
|
2723 %:%1069=1127%:% |
|
2724 %:%1070=1128%:% |
|
2725 %:%1071=1129%:% |
|
2726 %:%1072=1130%:% |
|
2727 %:%1073=1131%:% |
|
2728 %:%1074=1132%:% |
|
2729 %:%1075=1133%:% |
|
2730 %:%1076=1134%:% |
|
2731 %:%1077=1135%:% |
|
2732 %:%1078=1136%:% |
|
2733 %:%1079=1137%:% |
|
2734 %:%1080=1138%:% |
|
2735 %:%1081=1139%:% |
|
2736 %:%1082=1140%:% |
|
2737 %:%1091=1144%:% |
|
2738 %:%1103=1148%:% |
|
2739 %:%1104=1149%:% |
|
2740 %:%1105=1150%:% |
|
2741 %:%1106=1151%:% |
|
2742 %:%1107=1152%:% |
|
2743 %:%1108=1153%:% |
|
2744 %:%1109=1154%:% |
|
2745 %:%1110=1155%:% |
|
2746 %:%1111=1156%:% |
|
2747 %:%1112=1157%:% |
|
2748 %:%1113=1158%:% |
|
2749 %:%1114=1159%:% |
|
2750 %:%1115=1160%:% |
|
2751 %:%1116=1161%:% |
|
2752 %:%1117=1162%:% |
|
2753 %:%1118=1163%:% |
|
2754 %:%1119=1164%:% |
|
2755 %:%1120=1165%:% |
|
2756 %:%1121=1166%:% |
|
2757 %:%1122=1167%:% |
|
2758 %:%1123=1168%:% |
|
2759 %:%1124=1169%:% |
|
2760 %:%1125=1170%:% |
|
2761 %:%1126=1171%:% |
|
2762 %:%1127=1172%:% |
|
2763 %:%1128=1173%:% |
|
2764 %:%1129=1174%:% |
|
2765 %:%1130=1175%:% |
|
2766 %:%1131=1176%:% |
|
2767 %:%1132=1177%:% |
|
2768 %:%1133=1178%:% |
|
2769 %:%1134=1179%:% |
|
2770 %:%1135=1180%:% |
|
2771 %:%1136=1181%:% |
|
2772 %:%1137=1182%:% |
|
2773 %:%1138=1183%:% |
|
2774 %:%1139=1184%:% |
|
2775 %:%1140=1185%:% |
|
2776 %:%1141=1186%:% |
|
2777 %:%1142=1187%:% |
|
2778 %:%1143=1188%:% |
|
2779 %:%1144=1189%:% |
|
2780 %:%1145=1190%:% |
|
2781 %:%1146=1191%:% |
|
2782 %:%1147=1192%:% |
|
2783 %:%1148=1193%:% |
|
2784 %:%1149=1194%:% |
|
2785 %:%1150=1195%:% |
|
2786 %:%1151=1196%:% |
|
2787 %:%1152=1197%:% |
|
2788 %:%1153=1198%:% |
|
2789 %:%1154=1199%:% |
|
2790 %:%1155=1200%:% |
|
2791 %:%1156=1201%:% |
|
2792 %:%1157=1202%:% |
|
2793 %:%1158=1203%:% |
|
2794 %:%1159=1204%:% |
|
2795 %:%1160=1205%:% |
|
2796 %:%1161=1206%:% |
|
2797 %:%1162=1207%:% |
|
2798 %:%1163=1208%:% |
|
2799 %:%1164=1209%:% |
|
2800 %:%1165=1210%:% |
|
2801 %:%1166=1211%:% |
|
2802 %:%1167=1212%:% |
|
2803 %:%1168=1213%:% |
|
2804 %:%1169=1214%:% |
|
2805 %:%1170=1215%:% |
|
2806 %:%1171=1216%:% |
|
2807 %:%1172=1217%:% |
|
2808 %:%1173=1218%:% |
|
2809 %:%1174=1219%:% |
|
2810 %:%1175=1220%:% |
|
2811 %:%1176=1221%:% |
|
2812 %:%1177=1222%:% |
|
2813 %:%1178=1223%:% |
|
2814 %:%1179=1224%:% |
|
2815 %:%1180=1225%:% |
|
2816 %:%1181=1226%:% |
|
2817 %:%1182=1227%:% |
|
2818 %:%1183=1228%:% |
|
2819 %:%1184=1229%:% |
|
2820 %:%1185=1230%:% |
|
2821 %:%1186=1231%:% |
|
2822 %:%1187=1232%:% |
|
2823 %:%1188=1233%:% |
|
2824 %:%1189=1234%:% |
|
2825 %:%1190=1235%:% |
|
2826 %:%1191=1236%:% |
|
2827 %:%1192=1237%:% |
|
2828 %:%1193=1238%:% |
|
2829 %:%1194=1239%:% |
|
2830 %:%1195=1240%:% |
|
2831 %:%1196=1241%:% |
|
2832 %:%1197=1242%:% |
|
2833 %:%1198=1243%:% |
|
2834 %:%1199=1244%:% |
|
2835 %:%1200=1245%:% |
|
2836 %:%1201=1246%:% |
|
2837 %:%1202=1247%:% |
|
2838 %:%1203=1248%:% |
|
2839 %:%1204=1249%:% |
|
2840 %:%1205=1250%:% |
|
2841 %:%1206=1251%:% |
|
2842 %:%1207=1252%:% |
|
2843 %:%1208=1253%:% |
|
2844 %:%1209=1254%:% |
|
2845 %:%1210=1255%:% |
|
2846 %:%1211=1256%:% |
|
2847 %:%1212=1257%:% |
|
2848 %:%1213=1258%:% |
|
2849 %:%1214=1259%:% |
|
2850 %:%1215=1260%:% |
|
2851 %:%1216=1261%:% |
|
2852 %:%1217=1262%:% |
|
2853 %:%1218=1263%:% |
|
2854 %:%1218=1264%:% |
|
2855 %:%1219=1265%:% |
|
2856 %:%1220=1266%:% |
|
2857 %:%1221=1267%:% |
|
2858 %:%1222=1268%:% |
|
2859 %:%1223=1269%:% |
|
2860 %:%1224=1270%:% |
|
2861 %:%1225=1271%:% |
|
2862 %:%1226=1272%:% |
|
2863 %:%1227=1273%:% |
|
2864 %:%1228=1274%:% |
|
2865 %:%1229=1275%:% |
|
2866 %:%1229=1276%:% |
|
2867 %:%1230=1277%:% |
|
2868 %:%1231=1278%:% |
|
2869 %:%1232=1279%:% |
|
2870 %:%1233=1280%:% |
|
2871 %:%1234=1281%:% |
|
2872 %:%1235=1282%:% |
|
2873 %:%1236=1283%:% |
|
2874 %:%1237=1284%:% |
|
2875 %:%1238=1285%:% |
|
2876 %:%1239=1286%:% |
|
2877 %:%1240=1287%:% |
|
2878 %:%1241=1288%:% |
|
2879 %:%1242=1289%:% |
|
2880 %:%1243=1290%:% |
|
2881 %:%1244=1291%:% |
|
2882 %:%1245=1292%:% |
|
2883 %:%1246=1293%:% |
|
2884 %:%1247=1294%:% |
|
2885 %:%1248=1295%:% |
|
2886 %:%1249=1296%:% |
|
2887 %:%1250=1297%:% |
|
2888 %:%1251=1298%:% |
|
2889 %:%1252=1299%:% |
|
2890 %:%1253=1300%:% |
|
2891 %:%1254=1301%:% |
|
2892 %:%1255=1302%:% |
|
2893 %:%1256=1303%:% |
|
2894 %:%1257=1304%:% |
|
2895 %:%1258=1305%:% |
|
2896 %:%1259=1306%:% |
|
2897 %:%1260=1307%:% |
|
2898 %:%1261=1308%:% |
|
2899 %:%1262=1309%:% |
|
2900 %:%1263=1310%:% |
|
2901 %:%1264=1311%:% |
|
2902 %:%1265=1312%:% |
|
2903 %:%1266=1313%:% |
|
2904 %:%1267=1314%:% |
|
2905 %:%1268=1315%:% |
|
2906 %:%1269=1316%:% |
|
2907 %:%1270=1317%:% |
|
2908 %:%1271=1318%:% |
|
2909 %:%1272=1319%:% |
|
2910 %:%1273=1320%:% |
|
2911 %:%1274=1321%:% |
|
2912 %:%1275=1322%:% |
|
2913 %:%1276=1323%:% |
|
2914 %:%1277=1324%:% |
|
2915 %:%1278=1325%:% |
|
2916 %:%1279=1326%:% |
|
2917 %:%1280=1327%:% |
|
2918 %:%1281=1328%:% |
|
2919 %:%1282=1329%:% |
|
2920 %:%1283=1330%:% |
|
2921 %:%1283=1331%:% |
|
2922 %:%1283=1332%:% |
|
2923 %:%1284=1333%:% |
|
2924 %:%1285=1334%:% |
|
2925 %:%1285=1335%:% |
|
2926 %:%1285=1336%:% |
|
2927 %:%1285=1337%:% |
|
2928 %:%1286=1338%:% |
|
2929 %:%1287=1339%:% |
|
2930 %:%1288=1340%:% |
|
2931 %:%1289=1341%:% |
|
2932 %:%1290=1342%:% |
|
2933 %:%1290=1343%:% |
|
2934 %:%1291=1344%:% |
|
2935 %:%1292=1345%:% |
|
2936 %:%1293=1346%:% |
|
2937 %:%1294=1347%:% |
|
2938 %:%1295=1348%:% |
|
2939 %:%1296=1349%:% |
|
2940 %:%1297=1350%:% |
|
2941 %:%1298=1351%:% |
|
2942 %:%1299=1352%:% |
|
2943 %:%1300=1353%:% |
|
2944 %:%1301=1354%:% |
|
2945 %:%1302=1355%:% |
|
2946 %:%1303=1356%:% |
|
2947 %:%1304=1357%:% |
|
2948 %:%1305=1358%:% |
|
2949 %:%1306=1359%:% |
|
2950 %:%1307=1360%:% |
|
2951 %:%1308=1361%:% |
|
2952 %:%1309=1362%:% |
|
2953 %:%1310=1363%:% |
|
2954 %:%1311=1364%:% |
|
2955 %:%1312=1365%:% |
|
2956 %:%1313=1366%:% |
|
2957 %:%1314=1367%:% |
|
2958 %:%1315=1368%:% |
|
2959 %:%1316=1369%:% |
|
2960 %:%1317=1370%:% |
|
2961 %:%1318=1371%:% |
|
2962 %:%1319=1372%:% |
|
2963 %:%1320=1373%:% |
|
2964 %:%1321=1374%:% |
|
2965 %:%1322=1375%:% |
|
2966 %:%1323=1376%:% |
|
2967 %:%1324=1377%:% |
|
2968 %:%1325=1378%:% |
|
2969 %:%1326=1379%:% |
|
2970 %:%1327=1380%:% |
|
2971 %:%1328=1381%:% |
|
2972 %:%1329=1382%:% |
|
2973 %:%1330=1383%:% |
|
2974 %:%1331=1384%:% |
|
2975 %:%1332=1385%:% |
|
2976 %:%1333=1386%:% |
|
2977 %:%1334=1387%:% |
|
2978 %:%1335=1388%:% |
|
2979 %:%1336=1389%:% |
|
2980 %:%1337=1390%:% |
|
2981 %:%1338=1391%:% |
|
2982 %:%1338=1392%:% |
|
2983 %:%1339=1393%:% |
|
2984 %:%1339=1394%:% |
|
2985 %:%1340=1395%:% |
|
2986 %:%1340=1396%:% |
|
2987 %:%1341=1397%:% |
|
2988 %:%1342=1398%:% |
|
2989 %:%1343=1399%:% |
|
2990 %:%1344=1400%:% |
|
2991 %:%1345=1401%:% |
|
2992 %:%1346=1402%:% |
|
2993 %:%1347=1403%:% |
|
2994 %:%1347=1404%:% |
|
2995 %:%1348=1405%:% |
|
2996 %:%1348=1406%:% |
|
2997 %:%1349=1407%:% |
|
2998 %:%1349=1408%:% |
|
2999 %:%1350=1409%:% |
|
3000 %:%1351=1410%:% |
|
3001 %:%1352=1411%:% |
|
3002 %:%1353=1412%:% |
|
3003 %:%1354=1413%:% |
|
3004 %:%1355=1414%:% |
|
3005 %:%1356=1415%:% |
|
3006 %:%1357=1416%:% |
|
3007 %:%1358=1417%:% |
|
3008 %:%1359=1418%:% |
|
3009 %:%1360=1419%:% |
|
3010 %:%1361=1420%:% |
|
3011 %:%1362=1421%:% |
|
3012 %:%1363=1422%:% |
|
3013 %:%1364=1423%:% |
|
3014 %:%1365=1424%:% |
|
3015 %:%1366=1425%:% |
|
3016 %:%1367=1426%:% |
|
3017 %:%1368=1427%:% |
|
3018 %:%1369=1428%:% |
|
3019 %:%1370=1429%:% |
|
3020 %:%1371=1430%:% |
|
3021 %:%1372=1431%:% |
|
3022 %:%1373=1432%:% |
|
3023 %:%1374=1433%:% |
|
3024 %:%1375=1434%:% |
|
3025 %:%1376=1435%:% |
|
3026 %:%1377=1436%:% |
|
3027 %:%1378=1437%:% |
|
3028 %:%1379=1438%:% |
|
3029 %:%1380=1439%:% |
|
3030 %:%1380=1440%:% |
|
3031 %:%1381=1441%:% |
|
3032 %:%1382=1442%:% |
|
3033 %:%1383=1443%:% |
|
3034 %:%1384=1444%:% |
|
3035 %:%1385=1445%:% |
|
3036 %:%1386=1446%:% |
|
3037 %:%1387=1447%:% |
|
3038 %:%1387=1448%:% |
|
3039 %:%1388=1449%:% |
|
3040 %:%1389=1450%:% |
|
3041 %:%1390=1451%:% |
|
3042 %:%1390=1452%:% |
|
3043 %:%1391=1453%:% |
|
3044 %:%1392=1454%:% |
|
3045 %:%1393=1455%:% |
|
3046 %:%1393=1456%:% |
|
3047 %:%1394=1457%:% |
|
3048 %:%1394=1458%:% |
|
3049 %:%1395=1459%:% |
|
3050 %:%1395=1460%:% |
|
3051 %:%1396=1461%:% |
|
3052 %:%1397=1462%:% |
|
3053 %:%1398=1463%:% |
|
3054 %:%1398=1464%:% |
|
3055 %:%1399=1465%:% |
|
3056 %:%1399=1466%:% |
|
3057 %:%1400=1467%:% |
|
3058 %:%1400=1468%:% |
|
3059 %:%1400=1469%:% |
|
3060 %:%1400=1470%:% |
|
3061 %:%1401=1471%:% |
|
3062 %:%1401=1472%:% |
|
3063 %:%1402=1473%:% |
|
3064 %:%1403=1474%:% |
|
3065 %:%1403=1476%:% |
|
3066 %:%1403=1477%:% |
|
3067 %:%1403=1478%:% |
|
3068 %:%1403=1479%:% |
|
3069 %:%1403=1480%:% |
|
3070 %:%1404=1481%:% |
|
3071 %:%1404=1482%:% |
|
3072 %:%1405=1483%:% |
|
3073 %:%1405=1484%:% |
|
3074 %:%1406=1485%:% |
|
3075 %:%1406=1486%:% |
|
3076 %:%1407=1487%:% |
|
3077 %:%1408=1488%:% |
|
3078 %:%1409=1489%:% |
|
3079 %:%1410=1490%:% |
|
3080 %:%1410=1491%:% |
|
3081 %:%1411=1492%:% |
|
3082 %:%1411=1493%:% |
|
3083 %:%1412=1494%:% |
|
3084 %:%1413=1495%:% |
|
3085 %:%1413=1496%:% |
|
3086 %:%1414=1497%:% |
|
3087 %:%1415=1498%:% |
|
3088 %:%1416=1499%:% |
|
3089 %:%1417=1500%:% |
|
3090 %:%1418=1501%:% |
|
3091 %:%1419=1502%:% |
|
3092 %:%1420=1503%:% |
|
3093 %:%1421=1504%:% |
|
3094 %:%1422=1505%:% |
|
3095 %:%1423=1506%:% |
|
3096 %:%1424=1507%:% |
|
3097 %:%1425=1508%:% |
|
3098 %:%1426=1509%:% |
|
3099 %:%1427=1510%:% |
|
3100 %:%1428=1511%:% |
|
3101 %:%1429=1512%:% |
|
3102 %:%1430=1513%:% |
|
3103 %:%1431=1514%:% |
|
3104 %:%1432=1515%:% |
|
3105 %:%1433=1516%:% |
|
3106 %:%1434=1517%:% |
|
3107 %:%1435=1518%:% |
|
3108 %:%1436=1519%:% |
|
3109 %:%1437=1520%:% |
|
3110 %:%1438=1521%:% |
|
3111 %:%1439=1522%:% |
|
3112 %:%1440=1523%:% |
|
3113 %:%1441=1524%:% |
|
3114 %:%1442=1525%:% |
|
3115 %:%1443=1526%:% |
|
3116 %:%1444=1527%:% |
|
3117 %:%1445=1528%:% |
|
3118 %:%1446=1529%:% |
|
3119 %:%1447=1530%:% |
|
3120 %:%1448=1531%:% |
|
3121 %:%1449=1532%:% |
|
3122 %:%1450=1533%:% |
|
3123 %:%1451=1534%:% |
|
3124 %:%1452=1535%:% |
|
3125 %:%1453=1536%:% |
|
3126 %:%1454=1537%:% |
|
3127 %:%1455=1538%:% |
|
3128 %:%1456=1539%:% |
|
3129 %:%1457=1540%:% |
|
3130 %:%1458=1541%:% |
|
3131 %:%1459=1542%:% |
|
3132 %:%1460=1543%:% |
|
3133 %:%1461=1544%:% |
|
3134 %:%1462=1545%:% |
|
3135 %:%1463=1546%:% |
|
3136 %:%1464=1547%:% |
|
3137 %:%1473=1551%:% |
|
3138 %:%1485=1558%:% |
|
3139 %:%1486=1559%:% |
|
3140 %:%1487=1560%:% |
|
3141 %:%1488=1561%:% |
|
3142 %:%1489=1562%:% |
|
3143 %:%1490=1563%:% |
|
3144 %:%1491=1564%:% |
|
3145 %:%1500=1569%:% |
|
3146 %:%1512=1573%:% |
|
3147 %:%1513=1574%:% |
|
3148 %:%1514=1575%:% |
|
3149 %:%1515=1576%:% |
|
3150 %:%1516=1577%:% |
|
3151 %:%1517=1578%:% |
|
3152 %:%1518=1579%:% |
|
3153 %:%1519=1580%:% |
|
3154 %:%1520=1581%:% |
|
3155 %:%1521=1582%:% |
|
3156 %:%1522=1583%:% |
|
3157 %:%1523=1584%:% |
|
3158 %:%1524=1585%:% |
|
3159 %:%1525=1586%:% |
|
3160 %:%1526=1587%:% |
|
3161 %:%1527=1588%:% |
|
3162 %:%1528=1589%:% |
|
3163 %:%1529=1590%:% |
|
3164 %:%1530=1591%:% |
|
3165 %:%1531=1592%:% |
|
3166 %:%1532=1593%:% |
|
3167 %:%1533=1594%:% |
|
3168 %:%1534=1595%:% |
|
3169 %:%1535=1596%:% |
|
3170 %:%1536=1597%:% |
|
3171 %:%1537=1598%:% |
|
3172 %:%1538=1599%:% |
|
3173 %:%1539=1600%:% |
|
3174 %:%1540=1601%:% |
|
3175 %:%1541=1602%:% |
|
3176 %:%1542=1603%:% |
|
3177 %:%1543=1604%:% |
|
3178 %:%1544=1605%:% |
|
3179 %:%1545=1606%:% |
|
3180 %:%1546=1607%:% |
|
3181 %:%1547=1608%:% |
|
3182 %:%1548=1609%:% |
|
3183 %:%1549=1610%:% |
|
3184 %:%1550=1611%:% |
|
3185 %:%1551=1612%:% |
|
3186 %:%1552=1613%:% |
|
3187 %:%1553=1614%:% |
|
3188 %:%1554=1615%:% |
|
3189 %:%1555=1616%:% |
|
3190 %:%1556=1617%:% |
|
3191 %:%1557=1618%:% |
|
3192 %:%1558=1619%:% |
|
3193 %:%1559=1620%:% |
|
3194 %:%1560=1621%:% |
|
3195 %:%1561=1622%:% |
|
3196 %:%1562=1623%:% |
|
3197 %:%1563=1624%:% |
|
3198 %:%1564=1625%:% |
|
3199 %:%1565=1626%:% |
|
3200 %:%1566=1627%:% |
|
3201 %:%1567=1628%:% |
|
3202 %:%1568=1629%:% |
|
3203 %:%1569=1630%:% |
|
3204 %:%1570=1631%:% |
|
3205 %:%1571=1632%:% |
|
3206 %:%1572=1633%:% |
|
3207 %:%1573=1634%:% |
|
3208 %:%1574=1635%:% |
|
3209 %:%1575=1636%:% |
|
3210 %:%1576=1637%:% |
|
3211 %:%1577=1638%:% |
|
3212 %:%1578=1639%:% |
|
3213 %:%1579=1640%:% |
|
3214 %:%1580=1641%:% |
|
3215 %:%1581=1642%:% |
|
3216 %:%1582=1643%:% |
|
3217 %:%1583=1644%:% |
|
3218 %:%1584=1645%:% |
|
3219 %:%1585=1646%:% |
|
3220 %:%1586=1647%:% |
|
3221 %:%1587=1648%:% |
|
3222 %:%1588=1649%:% |
|
3223 %:%1589=1650%:% |
|
3224 %:%1590=1651%:% |
|
3225 %:%1591=1652%:% |
|
3226 %:%1592=1653%:% |
|
3227 %:%1593=1654%:% |
|
3228 %:%1594=1655%:% |
|
3229 %:%1595=1656%:% |
|
3230 %:%1596=1657%:% |
|
3231 %:%1597=1658%:% |
|
3232 %:%1598=1659%:% |
|
3233 %:%1599=1660%:% |
|
3234 %:%1600=1661%:% |
|
3235 %:%1601=1662%:% |
|
3236 %:%1601=1778%:% |
|
3237 %:%1602=1779%:% |
|
3238 %:%1603=1780%:% |
|
3239 %:%1604=1781%:% |
|
3240 %:%1605=1782%:% |
|
3241 %:%1605=1943%:% |
|
3242 %:%1606=1944%:% |
|
3243 %:%1607=1945%:% |
|
3244 %:%1608=1946%:% |
|
3245 %:%1609=1947%:% |
|
3246 %:%1610=1948%:% |
|
3247 %:%1611=1949%:% |
|
3248 %:%1612=1950%:% |
|
3249 %:%1613=1951%:% |
|
3250 %:%1614=1952%:% |
|
3251 %:%1615=1953%:% |
|
3252 %:%1616=1954%:% |
|
3253 %:%1617=1955%:% |
|
3254 %:%1618=1956%:% |
|
3255 %:%1619=1957%:% |
|
3256 %:%1620=1958%:% |
|
3257 %:%1621=1959%:% |
|
3258 %:%1622=1960%:% |
|
3259 %:%1623=1961%:% |
|
3260 %:%1624=1962%:% |
|
3261 %:%1624=1963%:% |
|
3262 %:%1625=1964%:% |
|
3263 %:%1625=1965%:% |
|
3264 %:%1625=1966%:% |
|
3265 %:%1626=1967%:% |
|
3266 %:%1626=1968%:% |
|
3267 %:%1627=1969%:% |
|
3268 %:%1628=1970%:% |
|
3269 %:%1629=1971%:% |
|
3270 %:%1630=1972%:% |
|
3271 %:%1631=1973%:% |
|
3272 %:%1632=1974%:% |
|
3273 %:%1633=1975%:% |
|
3274 %:%1634=1976%:% |
|
3275 %:%1635=1977%:% |
|
3276 %:%1636=1978%:% |
|
3277 %:%1637=1979%:% |
|
3278 %:%1638=1980%:% |
|
3279 %:%1639=1981%:% |
|
3280 %:%1640=1982%:% |
|
3281 %:%1641=1983%:% |
|
3282 %:%1642=1984%:% |
|
3283 %:%1643=1985%:% |
|
3284 %:%1643=1986%:% |
|
3285 %:%1644=1987%:% |
|
3286 %:%1645=1988%:% |
|
3287 %:%1646=1989%:% |
|
3288 %:%1646=1990%:% |
|
3289 %:%1646=1991%:% |
|
3290 %:%1647=1992%:% |
|
3291 %:%1648=1993%:% |
|
3292 %:%1649=1994%:% |
|
3293 %:%1649=1995%:% |
|
3294 %:%1650=1996%:% |
|
3295 %:%1650=1997%:% |
|
3296 %:%1651=1998%:% |
|
3297 %:%1652=1999%:% |
|
3298 %:%1653=2000%:% |
|
3299 %:%1654=2001%:% |
|
3300 %:%1655=2002%:% |
|
3301 %:%1656=2003%:% |
|
3302 %:%1657=2004%:% |
|
3303 %:%1658=2005%:% |
|
3304 %:%1659=2006%:% |
|
3305 %:%1660=2007%:% |
|
3306 %:%1661=2008%:% |
|
3307 %:%1662=2009%:% |
|
3308 %:%1663=2010%:% |
|
3309 %:%1664=2011%:% |
|
3310 %:%1665=2012%:% |
|
3311 %:%1666=2013%:% |
|
3312 %:%1667=2014%:% |
|
3313 %:%1676=2019%:% |
|
3314 %:%1688=2023%:% |
|
3315 %:%1689=2024%:% |
|
3316 %:%1690=2025%:% |
|
3317 %:%1691=2026%:% |
|
3318 %:%1692=2027%:% |
|
3319 %:%1693=2028%:% |
|
3320 %:%1694=2029%:% |
|
3321 %:%1695=2030%:% |
|
3322 %:%1696=2031%:% |
|
3323 %:%1697=2032%:% |
|
3324 %:%1698=2033%:% |
|
3325 %:%1699=2034%:% |
|
3326 %:%1700=2035%:% |
|
3327 %:%1701=2036%:% |
|
3328 %:%1702=2037%:% |
|
3329 %:%1703=2038%:% |
|
3330 %:%1704=2039%:% |
|
3331 %:%1705=2040%:% |
|
3332 %:%1706=2041%:% |
|
3333 %:%1707=2042%:% |
|
3334 %:%1708=2043%:% |
|
3335 %:%1709=2044%:% |
|
3336 %:%1710=2045%:% |
|
3337 %:%1711=2046%:% |
|
3338 %:%1712=2047%:% |
|
3339 %:%1713=2048%:% |
|
3340 %:%1714=2049%:% |
|
3341 %:%1715=2050%:% |
|
3342 %:%1716=2051%:% |
|
3343 %:%1717=2052%:% |
|
3344 %:%1718=2053%:% |
|
3345 %:%1719=2054%:% |
|
3346 %:%1720=2055%:% |
|
3347 %:%1721=2056%:% |
|
3348 %:%1722=2057%:% |
|
3349 %:%1723=2058%:% |
|
3350 %:%1724=2059%:% |
|
3351 %:%1725=2060%:% |
|
3352 %:%1726=2061%:% |
|
3353 %:%1727=2062%:% |
|
3354 %:%1728=2063%:% |
|
3355 %:%1729=2064%:% |
|
3356 %:%1730=2065%:% |
|
3357 %:%1731=2066%:% |
|
3358 %:%1732=2067%:% |
|
3359 %:%1733=2068%:% |
|
3360 %:%1734=2069%:% |
|
3361 %:%1735=2070%:% |
|
3362 %:%1736=2071%:% |
|
3363 %:%1737=2072%:% |
|
3364 %:%1738=2073%:% |
|
3365 %:%1739=2074%:% |
|
3366 %:%1740=2075%:% |
|
3367 %:%1753=2081%:% |
|
3368 %:%1756=2082%:% |
|
3369 %:%1757=2083%:% |
|