57 Setalt ("\<^raw:\ensuremath{\bigplus}>_" [1000] 999) and |
57 Setalt ("\<^raw:\ensuremath{\bigplus}>_" [1000] 999) and |
58 Append_rexp2 ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 100) and |
58 Append_rexp2 ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 100) and |
59 Append_rexp_rhs ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 50) and |
59 Append_rexp_rhs ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 50) and |
60 |
60 |
61 uminus ("\<^raw:\ensuremath{\overline{>_\<^raw:}}>" [100] 100) and |
61 uminus ("\<^raw:\ensuremath{\overline{>_\<^raw:}}>" [100] 100) and |
62 tag_Plus ("tag\<^bsub>PLUS\<^esub> _ _" [100, 100] 100) and |
62 tag_Plus ("+tag _ _" [100, 100] 100) and |
63 tag_Plus ("tag\<^bsub>PLUS\<^esub> _ _ _" [100, 100, 100] 100) and |
63 tag_Plus ("+tag _ _ _" [100, 100, 100] 100) and |
64 tag_Times ("tag\<^isub>S\<^isub>E\<^isub>Q _ _" [100, 100] 100) and |
64 tag_Times ("tag\<^isub>S\<^isub>E\<^isub>Q _ _" [100, 100] 100) and |
65 tag_Times ("tag\<^isub>S\<^isub>E\<^isub>Q _ _ _" [100, 100, 100] 100) and |
65 tag_Times ("tag\<^isub>S\<^isub>E\<^isub>Q _ _ _" [100, 100, 100] 100) and |
66 tag_Star ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _" [100] 100) and |
66 tag_Star ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _" [100] 100) and |
67 tag_Star ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _ _" [100, 100] 100) and |
67 tag_Star ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _ _" [100, 100] 100) and |
68 tag_eq ("\<^raw:$\threesim$>\<^bsub>_\<^esub>") and |
68 tag_eq ("\<^raw:$\threesim$>\<^bsub>_\<^esub>") and |
259 |
259 |
260 Functions are much better supported in Isabelle/HOL, but they still lead to similar |
260 Functions are much better supported in Isabelle/HOL, but they still lead to similar |
261 problems as with graphs. Composing, for example, two non-deterministic automata in parallel |
261 problems as with graphs. Composing, for example, two non-deterministic automata in parallel |
262 requires also the formalisation of disjoint unions. Nipkow \cite{Nipkow98} |
262 requires also the formalisation of disjoint unions. Nipkow \cite{Nipkow98} |
263 dismisses for this the option of using identities, because it leads according to |
263 dismisses for this the option of using identities, because it leads according to |
264 him to ``messy proofs''. He |
264 him to ``messy proofs''. Since he does not need to define what a regular |
265 opts for a variant of \eqref{disjointunion} using bit lists, but writes |
265 language is, Nipkow opts for a variant of \eqref{disjointunion} using bit lists, but writes |
266 |
266 |
267 \begin{quote} |
267 \begin{quote} |
268 \it% |
268 \it% |
269 \begin{tabular}{@ {}l@ {}p{0.88\textwidth}@ {}} |
269 \begin{tabular}{@ {}l@ {}p{0.88\textwidth}@ {}} |
270 `` & All lemmas appear obvious given a picture of the composition of automata\ldots |
270 `` & All lemmas appear obvious given a picture of the composition of automata\ldots |
766 \noindent |
766 \noindent |
767 That means we eliminated the dependency of @{text "X\<^isub>3"} on the |
767 That means we eliminated the dependency of @{text "X\<^isub>3"} on the |
768 right-hand side. Note we used the abbreviation |
768 right-hand side. Note we used the abbreviation |
769 @{text "\<^raw:\ensuremath{\bigplus}>{ATOM c\<^isub>1,\<dots>,ATOM c\<^isub>m}"} |
769 @{text "\<^raw:\ensuremath{\bigplus}>{ATOM c\<^isub>1,\<dots>,ATOM c\<^isub>m}"} |
770 to stand for a regular expression that matches with every character. In |
770 to stand for a regular expression that matches with every character. In |
771 our algorithm we are only interested in the existence of such a regular expresion |
771 our algorithm we are only interested in the existence of such a regular expression |
772 and not specify it any further. |
772 and do not specify it any further. |
773 |
773 |
774 It can be easily seen that the @{text "Arden"}-operation mimics Arden's |
774 It can be easily seen that the @{text "Arden"}-operation mimics Arden's |
775 Lemma on the level of equations. To ensure the non-emptiness condition of |
775 Lemma on the level of equations. To ensure the non-emptiness condition of |
776 Arden's Lemma we say that a right-hand side is @{text ardenable} provided |
776 Arden's Lemma we say that a right-hand side is @{text ardenable} provided |
777 |
777 |
1099 \noindent |
1099 \noindent |
1100 hold, which shows that @{term "UNIV // \<approx>(lang r)"} must be finite. |
1100 hold, which shows that @{term "UNIV // \<approx>(lang r)"} must be finite. |
1101 \end{proof} |
1101 \end{proof} |
1102 |
1102 |
1103 \noindent |
1103 \noindent |
1104 Much more interesting, however, are the inductive cases. They seem hard to solve |
1104 Much more interesting, however, are the inductive cases. They seem hard to be solved |
1105 directly. The reader is invited to try. |
1105 directly. The reader is invited to try. |
1106 |
1106 |
1107 In order to see how our proof proceeds consider the following suggestive picture |
1107 In order to see how our proof proceeds consider the following suggestive picture |
1108 taken from Constable et al \cite{Constable00}: |
1108 taken from Constable et al \cite{Constable00}: |
1109 |
1109 |
1137 \end{tabular}} |
1137 \end{tabular}} |
1138 \end{equation} |
1138 \end{equation} |
1139 |
1139 |
1140 \noindent |
1140 \noindent |
1141 The relation @{term "\<approx>(lang r)"} partitions the set of all strings into some |
1141 The relation @{term "\<approx>(lang r)"} partitions the set of all strings into some |
1142 equivalence classes. To show that there are only finitely many of |
1142 equivalence classes. To show that there are only finitely many of them, it |
1143 them, it suffices to show in each induction step the existence of another |
1143 suffices to show in each induction step that another relation, say @{text |
1144 relation, say @{text R}, for which we can show that there are finitely many |
1144 R}, has finitely many equivalence classes and refines @{term "\<approx>(lang r)"}. A |
1145 equivalence classes and which refines @{term "\<approx>(lang r)"}. A relation @{text |
1145 relation @{text "R\<^isub>1"} is said to \emph{refine} @{text "R\<^isub>2"} |
1146 "R\<^isub>1"} is said to \emph{refine} @{text "R\<^isub>2"} provided @{text |
1146 provided @{text "R\<^isub>1 \<subseteq> R\<^isub>2"}. For constructing @{text R} will |
1147 "R\<^isub>1 \<subseteq> R\<^isub>2"}. For constructing @{text R} will rely on some |
1147 rely on some \emph{tagging-functions} defined over strings. Given the |
1148 \emph{tagging-functions} defined over strings. Given the inductive hypothesis, it will |
1148 inductive hypothesis, it will be easy to prove that the \emph{range} of |
1149 be easy to prove that the \emph{range} of these tagging-functions is finite. |
1149 these tagging-functions is finite. The range of a function @{text f} is |
1150 The range of a function @{text f} is defined as |
1150 defined as |
1151 |
1151 |
1152 \begin{center} |
1152 \begin{center} |
1153 @{text "range f \<equiv> f ` UNIV"} |
1153 @{text "range f \<equiv> f ` UNIV"} |
1154 \end{center} |
1154 \end{center} |
1155 |
1155 |
1156 \noindent |
1156 \noindent |
1225 |
1225 |
1226 \noindent |
1226 \noindent |
1227 Chaining Lem.~\ref{finone} and \ref{fintwo} together, means in order to show |
1227 Chaining Lem.~\ref{finone} and \ref{fintwo} together, means in order to show |
1228 that @{term "UNIV // \<approx>(lang r)"} is finite, we have to construct a tagging-function whose |
1228 that @{term "UNIV // \<approx>(lang r)"} is finite, we have to construct a tagging-function whose |
1229 range can be shown to be finite and whose tagging-relation refines @{term "\<approx>(lang r)"}. |
1229 range can be shown to be finite and whose tagging-relation refines @{term "\<approx>(lang r)"}. |
1230 Let us attempt the @{const PLUS}-case first. |
1230 Let us attempt the @{const PLUS}-case first. We take as tagging-function |
1231 |
1231 |
1232 \begin{proof}[@{const "PLUS"}-Case] |
|
1233 We take as tagging-function |
|
1234 % |
|
1235 \begin{center} |
1232 \begin{center} |
1236 @{thm tag_Plus_def[where A="A" and B="B", THEN meta_eq_app]} |
1233 @{thm tag_Plus_def[where A="A" and B="B", THEN meta_eq_app]} |
1237 \end{center} |
1234 \end{center} |
1238 |
1235 |
1239 \noindent |
1236 \noindent |
1240 where @{text "A"} and @{text "B"} are some arbitrary languages. |
1237 where @{text "A"} and @{text "B"} are some arbitrary languages. The reason for this choice |
1241 We can show in general, if @{term "finite (UNIV // \<approx>A)"} and @{term "finite (UNIV // \<approx>B)"} |
1238 is that we need to that @{term "=(tag_Plus A B)="} refines @{term "\<approx>(A \<union> B)"}. This amounts |
1242 then @{term "finite ((UNIV // \<approx>A) \<times> (UNIV // \<approx>B))"} holds. The range of |
1239 to showing @{term "x \<approx>A y"} or @{term "x \<approx>B y"} under the assumption |
1243 @{term "tag_Plus A B"} is a subset of this product set---so finite. It remains to be shown |
1240 @{term "x"}~@{term "=(tag_Plus A B)="}~@{term y}. The definition will allow to infer this. |
1244 that @{text "=tag\<^isub>A\<^isub>L\<^isub>T A B="} refines @{term "\<approx>(A \<union> B)"}. This amounts to |
1241 |
1245 showing |
1242 \begin{proof}[@{const "PLUS"}-Case] |
1246 % |
1243 We can show in general, if @{term "finite (UNIV // \<approx>A)"} and @{term "finite |
1247 \begin{center} |
1244 (UNIV // \<approx>B)"} then @{term "finite ((UNIV // \<approx>A) \<times> (UNIV // \<approx>B))"} |
1248 @{term "tag\<^isub>A\<^isub>L\<^isub>T A B x = tag\<^isub>A\<^isub>L\<^isub>T A B y \<longrightarrow> x \<approx>(A \<union> B) y"} |
1245 holds. The range of @{term "tag_Plus A B"} is a subset of this product |
1249 \end{center} |
1246 set---so finite. For the refinement proof-obligation, we know that @{term |
1250 % |
1247 "(\<approx>A `` {x}, \<approx>B `` {x}) = (\<approx>A `` {y}, \<approx>B `` {y})"} holds by assumption. Then |
1251 \noindent |
1248 clearly either @{term "x \<approx>A y"} or @{term "x \<approx>B y"} hold, as we needed to |
1252 which by unfolding the Myhill-Nerode relation is identical to |
1249 show. Finally we can discharge this case by setting @{text A} to @{term |
1253 % |
1250 "lang r\<^isub>1"} and @{text B} to @{term "lang r\<^isub>2"}. |
1254 \begin{equation}\label{pattern} |
|
1255 @{text "\<forall>z. tag\<^isub>A\<^isub>L\<^isub>T A B x = tag\<^isub>A\<^isub>L\<^isub>T A B y \<and> x @ z \<in> A \<union> B \<longrightarrow> y @ z \<in> A \<union> B"} |
|
1256 \end{equation} |
|
1257 % |
|
1258 \noindent |
|
1259 since both @{text "=tag\<^isub>A\<^isub>L\<^isub>T A B="} and @{term "\<approx>(A \<union> B)"} are symmetric. To solve |
|
1260 \eqref{pattern} we just have to unfold the definition of the tagging-function and analyse |
|
1261 in which set, @{text A} or @{text B}, the string @{term "x @ z"} is. |
|
1262 The definition of the tagging-function will give us in each case the |
|
1263 information to infer that @{text "y @ z \<in> A \<union> B"}. |
|
1264 Finally we |
|
1265 can discharge this case by setting @{text A} to @{term "lang r\<^isub>1"} and @{text B} to @{term "lang r\<^isub>2"}. |
|
1266 \end{proof} |
1251 \end{proof} |
1267 |
1252 |
1268 |
1253 |
1269 \noindent |
1254 \noindent |
1270 The pattern in \eqref{pattern} is repeated for the other two cases. Unfortunately, |
1255 The pattern in \eqref{pattern} is repeated for the other two cases. Unfortunately, |