Journal/Paper.thy
changeset 203 5d724fe0e096
parent 201 9fbf6d9f85ae
child 217 05da74214979
equal deleted inserted replaced
202:09e6f3719cbc 203:5d724fe0e096
    35 abbreviation "PLUS \<equiv> Plus"
    35 abbreviation "PLUS \<equiv> Plus"
    36 abbreviation "TIMES \<equiv> Times"
    36 abbreviation "TIMES \<equiv> Times"
    37 abbreviation "TIMESS \<equiv> Timess"
    37 abbreviation "TIMESS \<equiv> Timess"
    38 abbreviation "STAR \<equiv> Star"
    38 abbreviation "STAR \<equiv> Star"
    39 
    39 
       
    40 definition
       
    41   Delta :: "'a lang \<Rightarrow> 'a lang"
       
    42 where
       
    43   "Delta A = (if [] \<in> A then {[]} else {})"
    40 
    44 
    41 notation (latex output)
    45 notation (latex output)
    42   str_eq ("\<approx>\<^bsub>_\<^esub>") and
    46   str_eq ("\<approx>\<^bsub>_\<^esub>") and
    43   str_eq_applied ("_ \<approx>\<^bsub>_\<^esub> _") and
    47   str_eq_applied ("_ \<approx>\<^bsub>_\<^esub> _") and
    44   conc (infixr "\<cdot>" 100) and
    48   conc (infixr "\<cdot>" 100) and
    69   tag_eq ("\<^raw:$\threesim$>\<^bsub>_\<^esub>" [100] 100) and
    73   tag_eq ("\<^raw:$\threesim$>\<^bsub>_\<^esub>" [100] 100) and
    70   Delta ("\<Delta>'(_')") and
    74   Delta ("\<Delta>'(_')") and
    71   nullable ("\<delta>'(_')") and
    75   nullable ("\<delta>'(_')") and
    72   Cons ("_ :: _" [100, 100] 100) and
    76   Cons ("_ :: _" [100, 100] 100) and
    73   Rev ("Rev _" [1000] 100) and
    77   Rev ("Rev _" [1000] 100) and
    74   Der ("Der _ _" [1000, 1000] 100) and
    78   Deriv ("Der _ _" [1000, 1000] 100) and
       
    79   Derivs ("Ders") and
    75   ONE ("ONE" 999) and
    80   ONE ("ONE" 999) and
    76   ZERO ("ZERO" 999) and
    81   ZERO ("ZERO" 999) and
    77   pders_lang ("pdersl") and
    82   pderivs_lang ("pdersl") and
    78   UNIV1 ("UNIV\<^isup>+") and
    83   UNIV1 ("UNIV\<^isup>+") and
    79   Ders_lang ("Dersl")
    84   Deriv_lang ("Dersl") and
       
    85   deriv ("der") and
       
    86   derivs ("ders") and
       
    87   pderiv ("pder") and
       
    88   pderivs ("pders") and
       
    89   pderivs_set ("pderss")
       
    90   
       
    91   
       
    92 lemmas Deriv_simps = Deriv_empty Deriv_epsilon Deriv_char Deriv_union
       
    93 
       
    94 definition
       
    95   Der :: "'a \<Rightarrow> 'a lang \<Rightarrow> 'a lang"
       
    96 where
       
    97   "Der c A \<equiv> {s. [c] @ s \<in> A}"
       
    98 
       
    99 definition
       
   100   Ders :: "'a list \<Rightarrow> 'a lang \<Rightarrow> 'a lang"
       
   101 where
       
   102   "Ders s A \<equiv> {s'. s @ s' \<in> A}"
       
   103 
    80 
   104 
    81 lemma meta_eq_app:
   105 lemma meta_eq_app:
    82   shows "f \<equiv> \<lambda>x. g x \<Longrightarrow> f x \<equiv> g x"
   106   shows "f \<equiv> \<lambda>x. g x \<Longrightarrow> f x \<equiv> g x"
    83   by auto
   107   by auto
    84 
   108 
   131   "_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop"
   155   "_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop"
   132   ("\<^raw:{\normalsize{}>If\<^raw:\,}> _ /\<^raw:{\normalsize \,>then\<^raw:\,}>/ _.")
   156   ("\<^raw:{\normalsize{}>If\<^raw:\,}> _ /\<^raw:{\normalsize \,>then\<^raw:\,}>/ _.")
   133   "_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" ("_ /\<^raw:{\normalsize \,>and\<^raw:\,}>/ _")
   157   "_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" ("_ /\<^raw:{\normalsize \,>and\<^raw:\,}>/ _")
   134   "_asm" :: "prop \<Rightarrow> asms" ("_")
   158   "_asm" :: "prop \<Rightarrow> asms" ("_")
   135 
   159 
       
   160 lemma pow_length:
       
   161   assumes a: "[] \<notin> A"
       
   162   and     b: "s \<in> A \<up> Suc n"
       
   163   shows "n < length s"
       
   164 using b
       
   165 proof (induct n arbitrary: s)
       
   166   case 0
       
   167   have "s \<in> A \<up> Suc 0" by fact
       
   168   with a have "s \<noteq> []" by auto
       
   169   then show "0 < length s" by auto
       
   170 next
       
   171   case (Suc n)
       
   172   have ih: "\<And>s. s \<in> A \<up> Suc n \<Longrightarrow> n < length s" by fact
       
   173   have "s \<in> A \<up> Suc (Suc n)" by fact
       
   174   then obtain s1 s2 where eq: "s = s1 @ s2" and *: "s1 \<in> A" and **: "s2 \<in> A \<up> Suc n"
       
   175     by (auto simp add: Seq_def)
       
   176   from ih ** have "n < length s2" by simp
       
   177   moreover have "0 < length s1" using * a by auto
       
   178   ultimately show "Suc n < length s" unfolding eq 
       
   179     by (simp only: length_append)
       
   180 qed
   136 
   181 
   137 (*>*)
   182 (*>*)
   138 
   183 
   139 
   184 
   140 section {* Introduction *}
   185 section {* Introduction *}
   443   @{term "[] \<notin> A"}. However we will need the following `reversed' 
   488   @{term "[] \<notin> A"}. However we will need the following `reversed' 
   444   version of Arden's Lemma (`reversed' in the sense of changing the order of @{term "A \<cdot> X"} to
   489   version of Arden's Lemma (`reversed' in the sense of changing the order of @{term "A \<cdot> X"} to
   445   \mbox{@{term "X \<cdot> A"}}).
   490   \mbox{@{term "X \<cdot> A"}}).
   446 
   491 
   447   \begin{lmm}[Reversed Arden's Lemma]\label{arden}\mbox{}\\
   492   \begin{lmm}[Reversed Arden's Lemma]\label{arden}\mbox{}\\
   448   If @{thm (prem 1) arden} then
   493   If @{thm (prem 1) reversed_Arden} then
   449   @{thm (lhs) arden} if and only if
   494   @{thm (lhs) reversed_Arden} if and only if
   450   @{thm (rhs) arden}.
   495   @{thm (rhs) reversed_Arden}.
   451   \end{lmm}
   496   \end{lmm}
   452 
   497 
   453   \begin{proof}
   498   \begin{proof}
   454   For the right-to-left direction we assume @{thm (rhs) arden} and show
   499   For the right-to-left direction we assume @{thm (rhs) reversed_Arden} and show
   455   that @{thm (lhs) arden} holds. From Property~\ref{langprops}@{text "(i)"} 
   500   that @{thm (lhs) reversed_Arden} holds. From Property~\ref{langprops}@{text "(i)"} 
   456   we have @{term "A\<star> = A \<cdot> A\<star> \<union> {[]}"},
   501   we have @{term "A\<star> = A \<cdot> A\<star> \<union> {[]}"},
   457   which is equal to @{term "A\<star> = A\<star> \<cdot> A \<union> {[]}"}. Adding @{text B} to both 
   502   which is equal to @{term "A\<star> = A\<star> \<cdot> A \<union> {[]}"}. Adding @{text B} to both 
   458   sides gives @{term "B \<cdot> A\<star> = B \<cdot> (A\<star> \<cdot> A \<union> {[]})"}, whose right-hand side
   503   sides gives @{term "B \<cdot> A\<star> = B \<cdot> (A\<star> \<cdot> A \<union> {[]})"}, whose right-hand side
   459   is equal to @{term "(B \<cdot> A\<star>) \<cdot> A \<union> B"}. Applying the assumed equation 
   504   is equal to @{term "(B \<cdot> A\<star>) \<cdot> A \<union> B"}. Applying the assumed equation 
   460   completes this direction. 
   505   completes this direction. 
   461 
   506 
   462   For the other direction we assume @{thm (lhs) arden}. By a simple induction
   507   For the other direction we assume @{thm (lhs) reversed_Arden}. By a simple induction
   463   on @{text n}, we can establish the property
   508   on @{text n}, we can establish the property
   464 
   509 
   465   \begin{center}
   510   \begin{center}
   466   @{text "(*)"}\hspace{5mm} @{thm (concl) arden_helper}
   511   @{text "(*)"}\hspace{5mm} @{thm (concl) reversed_arden_helper}
   467   \end{center}
   512   \end{center}
   468   
   513   
   469   \noindent
   514   \noindent
   470   Using this property we can show that @{term "B \<cdot> (A \<up> n) \<subseteq> X"} holds for
   515   Using this property we can show that @{term "B \<cdot> (A \<up> n) \<subseteq> X"} holds for
   471   all @{text n}. From this we can infer @{term "B \<cdot> A\<star> \<subseteq> X"} using the definition
   516   all @{text n}. From this we can infer @{term "B \<cdot> A\<star> \<subseteq> X"} using the definition
   472   of @{text "\<star>"}.
   517   of @{text "\<star>"}.
   473   For the inclusion in the other direction we assume a string @{text s}
   518   For the inclusion in the other direction we assume a string @{text s}
   474   with length @{text k} is an element in @{text X}. Since @{thm (prem 1) arden}
   519   with length @{text k} is an element in @{text X}. Since @{thm (prem 1) reversed_Arden}
   475   we know by Property~\ref{langprops}@{text "(ii)"} that 
   520   we know by Property~\ref{langprops}@{text "(ii)"} that 
   476   @{term "s \<notin> X \<cdot> (A \<up> Suc k)"} since its length is only @{text k}
   521   @{term "s \<notin> X \<cdot> (A \<up> Suc k)"} since its length is only @{text k}
   477   (the strings in @{term "X \<cdot> (A \<up> Suc k)"} are all longer). 
   522   (the strings in @{term "X \<cdot> (A \<up> Suc k)"} are all longer). 
   478   From @{text "(*)"} it follows then that
   523   From @{text "(*)"} it follows then that
   479   @{term s} must be an element in @{term "(\<Union>m\<in>{0..k}. B \<cdot> (A \<up> m))"}. This in turn
   524   @{term s} must be an element in @{term "(\<Union>m\<le>k. B \<cdot> (A \<up> m))"}. This in turn
   480   implies that @{term s} is in @{term "(\<Union>n. B \<cdot> (A \<up> n))"}. Using Property~\ref{langprops}@{text "(iii)"} 
   525   implies that @{term s} is in @{term "(\<Union>n. B \<cdot> (A \<up> n))"}. Using Property~\ref{langprops}@{text "(iii)"} 
   481   this is equal to @{term "B \<cdot> A\<star>"}, as we needed to show.
   526   this is equal to @{term "B \<cdot> A\<star>"}, as we needed to show.
   482   \end{proof}
   527   \end{proof}
   483 
   528 
   484   \noindent
   529   \noindent
   518   of such a regular expression and therefore we use Isabelle/HOL's @{const "fold_graph"} and Hilbert's
   563   of such a regular expression and therefore we use Isabelle/HOL's @{const "fold_graph"} and Hilbert's
   519   @{text "\<epsilon>"} to define @{term "\<Uplus>rs"}. This operation, roughly speaking, folds @{const PLUS} over the 
   564   @{text "\<epsilon>"} to define @{term "\<Uplus>rs"}. This operation, roughly speaking, folds @{const PLUS} over the 
   520   set @{text rs} with @{const ZERO} for the empty set. We can prove that for a finite set @{text rs}
   565   set @{text rs} with @{const ZERO} for the empty set. We can prove that for a finite set @{text rs}
   521   %
   566   %
   522   \begin{equation}\label{uplus}
   567   \begin{equation}\label{uplus}
   523   \mbox{@{thm (lhs) folds_alt_simp} @{text "= \<Union> (\<calL> ` rs)"}}
   568   \mbox{@{thm (lhs) folds_plus_simp} @{text "= \<Union> (\<calL> ` rs)"}}
   524   \end{equation}
   569   \end{equation}
   525 
   570 
   526   \noindent
   571   \noindent
   527   holds, whereby @{text "\<calL> ` rs"} stands for the 
   572   holds, whereby @{text "\<calL> ` rs"} stands for the 
   528   image of the set @{text rs} under function @{text "\<calL>"} defined as
   573   image of the set @{text rs} under function @{text "\<calL>"} defined as
  1572   showed this directly by induction on @{text "r"} using tagging-functions. 
  1617   showed this directly by induction on @{text "r"} using tagging-functions. 
  1573   However, there is also  an indirect method to come up with such a refined 
  1618   However, there is also  an indirect method to come up with such a refined 
  1574   relation by using derivatives of regular expressions~\cite{Brzozowski64}. 
  1619   relation by using derivatives of regular expressions~\cite{Brzozowski64}. 
  1575 
  1620 
  1576   Assume the following two definitions for the \emph{left-quotient} of a language,
  1621   Assume the following two definitions for the \emph{left-quotient} of a language,
  1577   which we write as @{term "Der c A"} and @{term "Ders s A"} where @{text c}
  1622   which we write as @{term "Deriv c A"} and @{term "Derivs s A"} where @{text c}
  1578   is a character and @{text s} a string, respectively:
  1623   is a character and @{text s} a string, respectively:
  1579 
  1624 
  1580   \begin{center}
  1625   \begin{center}
  1581   \begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{2mm}}l}
  1626   \begin{tabular}{r@ {\hspace{1mm}}c@ {\hspace{2mm}}l}
  1582   @{thm (lhs) Der_def}  & @{text "\<equiv>"} & @{thm (rhs) Der_def}\\
  1627   @{thm (lhs) Der_def}  & @{text "\<equiv>"} & @{thm (rhs) Der_def}\\
  1586 
  1631 
  1587   \noindent
  1632   \noindent
  1588   In order to aid readability, we shall make use of the following abbreviation
  1633   In order to aid readability, we shall make use of the following abbreviation
  1589 
  1634 
  1590   \begin{center}
  1635   \begin{center}
  1591   @{abbrev "Derss s As"}
  1636   @{abbrev "Derivss s As"}
  1592   \end{center}
  1637   \end{center}
  1593   
  1638   
  1594   \noindent
  1639   \noindent
  1595   where we apply the left-quotient to a set of languages and then combine the results.
  1640   where we apply the left-quotient to a set of languages and then combine the results.
  1596   Clearly we have the following equivalence between the Myhill-Nerode relation
  1641   Clearly we have the following equivalence between the Myhill-Nerode relation
  1597   (Definition~\ref{myhillneroderel}) and left-quotients
  1642   (Definition~\ref{myhillneroderel}) and left-quotients
  1598 
  1643 
  1599   \begin{equation}\label{mhders}
  1644   \begin{equation}\label{mhders}
  1600   @{term "x \<approx>A y"} \hspace{4mm}\text{if and only if}\hspace{4mm} @{term "Ders x A = Ders y A"}
  1645   @{term "x \<approx>A y"} \hspace{4mm}\text{if and only if}\hspace{4mm} @{term "Derivs x A = Derivs y A"}
  1601   \end{equation}
  1646   \end{equation}
  1602 
  1647 
  1603   \noindent
  1648   \noindent
  1604   It is also straightforward to establish the following properties of left-quotients
  1649   It is also straightforward to establish the following properties of left-quotients
  1605   
  1650   
  1606   \begin{equation}
  1651   \begin{equation}
  1607   \mbox{\begin{tabular}{l@ {\hspace{1mm}}c@ {\hspace{2mm}}l}
  1652   \mbox{\begin{tabular}{l@ {\hspace{1mm}}c@ {\hspace{2mm}}l}
  1608   @{thm (lhs) Der_simps(1)} & $=$ & @{thm (rhs) Der_simps(1)}\\
  1653   @{thm (lhs) Deriv_simps(1)} & $=$ & @{thm (rhs) Deriv_simps(1)}\\
  1609   @{thm (lhs) Der_simps(2)} & $=$ & @{thm (rhs) Der_simps(2)}\\
  1654   @{thm (lhs) Deriv_simps(2)} & $=$ & @{thm (rhs) Deriv_simps(2)}\\
  1610   @{thm (lhs) Der_simps(3)} & $=$ & @{thm (rhs) Der_simps(3)}\\
  1655   @{thm (lhs) Deriv_simps(3)} & $=$ & @{thm (rhs) Deriv_simps(3)}\\
  1611   @{thm (lhs) Der_simps(4)} & $=$ & @{thm (rhs) Der_simps(4)}\\
  1656   @{thm (lhs) Deriv_simps(4)} & $=$ & @{thm (rhs) Deriv_simps(4)}\\
  1612   @{thm (lhs) Der_conc}  & $=$ & @{thm (rhs) Der_conc}\\
  1657   @{thm (lhs) Der_conc}  & $=$ & @{thm (rhs) Der_conc}\\
  1613   @{thm (lhs) Der_star}  & $=$ & @{thm (rhs) Der_star}\\
  1658   @{thm (lhs) Deriv_star}  & $=$ & @{thm (rhs) Deriv_star}\\
  1614   @{thm (lhs) Ders_simps(1)} & $=$ & @{thm (rhs) Ders_simps(1)}\\
  1659   @{thm (lhs) Derivs_simps(1)} & $=$ & @{thm (rhs) Derivs_simps(1)}\\
  1615   @{thm (lhs) Ders_simps(2)} & $=$ & @{thm (rhs) Ders_simps(2)}\\
  1660   @{thm (lhs) Derivs_simps(2)} & $=$ & @{thm (rhs) Derivs_simps(2)}\\
  1616   %@{thm (lhs) Ders_simps(3)[where ?s1.0="s\<^isub>1" and ?s2.0="s\<^isub>2"]}  & $=$ 
  1661   %@{thm (lhs) Derivs_simps(3)[where ?s1.0="s\<^isub>1" and ?s2.0="s\<^isub>2"]}  & $=$ 
  1617   %   & @{thm (rhs) Ders_simps(3)[where ?s1.0="s\<^isub>1" and ?s2.0="s\<^isub>2"]}\\
  1662   %   & @{thm (rhs) Derivs_simps(3)[where ?s1.0="s\<^isub>1" and ?s2.0="s\<^isub>2"]}\\
  1618   \end{tabular}}
  1663   \end{tabular}}
  1619   \end{equation}
  1664   \end{equation}
  1620 
  1665 
  1621   \noindent
  1666   \noindent
  1622   where @{text "\<Delta>"} in the fifth line is a function that tests whether the
  1667   where @{text "\<Delta>"} in the fifth line is a function that tests whether the
  1623   empty string is in the language and returns @{term "{[]}"} or @{term "{}"},
  1668   empty string is in the language and returns @{term "{[]}"} or @{term "{}"},
  1624   accordingly.  Note also that in the last equation we use the list-cons operator written
  1669   accordingly.  Note also that in the last equation we use the list-cons operator written
  1625   \mbox{@{text "_ :: _"}}.  The only interesting case is the case of @{term "A\<star>"}
  1670   \mbox{@{text "_ :: _"}}.  The only interesting case is the case of @{term "A\<star>"}
  1626   where we use Property~\ref{langprops}@{text "(i)"} in order to infer that
  1671   where we use Property~\ref{langprops}@{text "(i)"} in order to infer that
  1627   @{term "Der c (A\<star>) = Der c (A \<cdot> A\<star>)"}. We can then complete the proof by
  1672   @{term "Deriv c (A\<star>) = Deriv c (A \<cdot> A\<star>)"}. We can then complete the proof by
  1628   using the fifth equation and noting that @{term "Delta A \<cdot> Der c (A\<star>) \<subseteq> (Der
  1673   using the fifth equation and noting that @{term "Delta A \<cdot> Deriv c (A\<star>) \<subseteq> (Deriv
  1629   c A) \<cdot> A\<star>"}. 
  1674   c A) \<cdot> A\<star>"}. 
  1630 
  1675 
  1631   Brzozowski observed that the left-quotients for languages of
  1676   Brzozowski observed that the left-quotients for languages of
  1632   regular expressions can be calculated directly using the notion of
  1677   regular expressions can be calculated directly using the notion of
  1633   \emph{derivatives of a regular expression} \cite{Brzozowski64}. We define
  1678   \emph{derivatives of a regular expression} \cite{Brzozowski64}. We define
  1634   this notion in Isabelle/HOL as follows:
  1679   this notion in Isabelle/HOL as follows:
  1635 
  1680 
  1636   \begin{center}
  1681   \begin{center}
  1637   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1.5mm}}l@ {}}
  1682   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1.5mm}}l@ {}}
  1638   @{thm (lhs) der.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) der.simps(1)}\\
  1683   @{thm (lhs) deriv.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) deriv.simps(1)}\\
  1639   @{thm (lhs) der.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) der.simps(2)}\\
  1684   @{thm (lhs) deriv.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) deriv.simps(2)}\\
  1640   @{thm (lhs) der.simps(3)[where c'="d"]}  & @{text "\<equiv>"} & @{thm (rhs) der.simps(3)[where c'="d"]}\\
  1685   @{thm (lhs) deriv.simps(3)[where c'="d"]}  & @{text "\<equiv>"} & @{thm (rhs) deriv.simps(3)[where c'="d"]}\\
  1641   @{thm (lhs) der.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1686   @{thm (lhs) deriv.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1642      & @{text "\<equiv>"} & @{thm (rhs) der.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1687      & @{text "\<equiv>"} & @{thm (rhs) deriv.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1643   @{thm (lhs) der.simps(5)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1688   @{thm (lhs) deriv.simps(5)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1644      & @{text "\<equiv>"} & @{text "if"}~@{term "nullable r\<^isub>1"}~@{text "then"}~%
  1689      & @{text "\<equiv>"} & @{text "if"}~@{term "nullable r\<^isub>1"}~@{text "then"}~%
  1645        @{term "Plus (Times (der c r\<^isub>1) r\<^isub>2) (der c r\<^isub>2)"}\\
  1690        @{term "Plus (Times (deriv c r\<^isub>1) r\<^isub>2) (deriv c r\<^isub>2)"}\\
  1646      &             & \phantom{@{text "if"}~@{term "nullable r\<^isub>1"}~}@{text "else"}~%  
  1691      &             & \phantom{@{text "if"}~@{term "nullable r\<^isub>1"}~}@{text "else"}~%  
  1647                     @{term "Times (der c r\<^isub>1) r\<^isub>2"}\\ 
  1692                     @{term "Times (deriv c r\<^isub>1) r\<^isub>2"}\\ 
  1648   @{thm (lhs) der.simps(6)}  & @{text "\<equiv>"} & @{thm (rhs) der.simps(6)}\smallskip\\
  1693   @{thm (lhs) deriv.simps(6)}  & @{text "\<equiv>"} & @{thm (rhs) deriv.simps(6)}\smallskip\\
  1649   @{thm (lhs) ders.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) ders.simps(1)}\\
  1694   @{thm (lhs) derivs.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) derivs.simps(1)}\\
  1650   @{thm (lhs) ders.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) ders.simps(2)}\\
  1695   @{thm (lhs) derivs.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) derivs.simps(2)}\\
  1651   \end{tabular}
  1696   \end{tabular}
  1652   \end{center}
  1697   \end{center}
  1653 
  1698 
  1654   \noindent
  1699   \noindent
  1655   The last two clauses extend derivatives from characters to strings. The
  1700   The last two clauses extend derivatives from characters to strings. The
  1677   one can easily show that left-quotients and derivatives of regular expressions 
  1722   one can easily show that left-quotients and derivatives of regular expressions 
  1678   relate as follows (see for example~\cite{Sakarovitch09}):
  1723   relate as follows (see for example~\cite{Sakarovitch09}):
  1679 
  1724 
  1680   \begin{equation}\label{Dersders}
  1725   \begin{equation}\label{Dersders}
  1681   \mbox{\begin{tabular}{c}
  1726   \mbox{\begin{tabular}{c}
  1682   @{thm Der_der}\\
  1727   @{thm Deriv_deriv}\\
  1683   @{thm Ders_ders}
  1728   @{thm Derivs_derivs}
  1684   \end{tabular}}
  1729   \end{tabular}}
  1685   \end{equation}
  1730   \end{equation}
  1686 
  1731 
  1687   \noindent
  1732   \noindent
  1688   The importance of this fact in the context of the Myhill-Nerode theorem is that 
  1733   The importance of this fact in the context of the Myhill-Nerode theorem is that 
  1689   we can use \eqref{mhders} and \eqref{Dersders} in order to 
  1734   we can use \eqref{mhders} and \eqref{Dersders} in order to 
  1690   establish that 
  1735   establish that 
  1691 
  1736 
  1692   \begin{center}
  1737   \begin{center}
  1693   @{term "x \<approx>(lang r) y"} \hspace{4mm}if and only if\hspace{4mm}
  1738   @{term "x \<approx>(lang r) y"} \hspace{4mm}if and only if\hspace{4mm}
  1694   @{term "lang (ders x r) = lang (ders y r)"}. 
  1739   @{term "lang (derivs x r) = lang (derivs y r)"}. 
  1695   \end{center}
  1740   \end{center}
  1696 
  1741 
  1697   \noindent
  1742   \noindent
  1698   holds and hence
  1743   holds and hence
  1699 
  1744 
  1700   \begin{equation}
  1745   \begin{equation}
  1701   @{term "x \<approx>(lang r) y"}\hspace{4mm}\mbox{provided}\hspace{4mm}@{term "ders x r = ders y r"}
  1746   @{term "x \<approx>(lang r) y"}\hspace{4mm}\mbox{provided}\hspace{4mm}@{term "derivs x r = derivs y r"}
  1702   \end{equation}
  1747   \end{equation}
  1703 
  1748 
  1704 
  1749 
  1705   \noindent
  1750   \noindent
  1706   This means the right-hand side (seen as a relation) refines the Myhill-Nerode
  1751   This means the right-hand side (seen as a relation) refines the Myhill-Nerode
  1741   derivatives}. They were introduced by Antimirov \cite{Antimirov95} and can be defined
  1786   derivatives}. They were introduced by Antimirov \cite{Antimirov95} and can be defined
  1742   in Isabelle/HOL as follows:
  1787   in Isabelle/HOL as follows:
  1743 
  1788 
  1744   \begin{center}
  1789   \begin{center}
  1745   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1.5mm}}l@ {}}
  1790   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1.5mm}}l@ {}}
  1746   @{thm (lhs) pder.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) pder.simps(1)}\\
  1791   @{thm (lhs) pderiv.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) pderiv.simps(1)}\\
  1747   @{thm (lhs) pder.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) pder.simps(2)}\\
  1792   @{thm (lhs) pderiv.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) pderiv.simps(2)}\\
  1748   @{thm (lhs) pder.simps(3)[where c'="d"]}  & @{text "\<equiv>"} & @{thm (rhs) pder.simps(3)[where c'="d"]}\\
  1793   @{thm (lhs) pderiv.simps(3)[where c'="d"]}  & @{text "\<equiv>"} & @{thm (rhs) pderiv.simps(3)[where c'="d"]}\\
  1749   @{thm (lhs) pder.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1794   @{thm (lhs) pderiv.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1750      & @{text "\<equiv>"} & @{thm (rhs) pder.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1795      & @{text "\<equiv>"} & @{thm (rhs) pderiv.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1751   @{thm (lhs) pder.simps(5)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1796   @{thm (lhs) pderiv.simps(5)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}  
  1752      & @{text "\<equiv>"} & @{text "if"}~@{term "nullable r\<^isub>1"}~@{text "then"}~%
  1797      & @{text "\<equiv>"} & @{text "if"}~@{term "nullable r\<^isub>1"}~@{text "then"}~%
  1753        @{term "(Timess (pder c r\<^isub>1) r\<^isub>2) \<union> (pder c r\<^isub>2)"}\\
  1798        @{term "(Timess (pderiv c r\<^isub>1) r\<^isub>2) \<union> (pderiv c r\<^isub>2)"}\\
  1754      & & \phantom{@{text "if"}~@{term "nullable r\<^isub>1"}~}@{text "else"}~%  
  1799      & & \phantom{@{text "if"}~@{term "nullable r\<^isub>1"}~}@{text "else"}~%  
  1755                     @{term "Timess (pder c r\<^isub>1) r\<^isub>2"}\\ 
  1800                     @{term "Timess (pderiv c r\<^isub>1) r\<^isub>2"}\\ 
  1756   @{thm (lhs) pder.simps(6)}  & @{text "\<equiv>"} & @{thm (rhs) pder.simps(6)}\smallskip\\
  1801   @{thm (lhs) pderiv.simps(6)}  & @{text "\<equiv>"} & @{thm (rhs) pderiv.simps(6)}\smallskip\\
  1757   @{thm (lhs) pders.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) pders.simps(1)}\\
  1802   @{thm (lhs) pderivs.simps(1)}  & @{text "\<equiv>"} & @{thm (rhs) pderivs.simps(1)}\\
  1758   @{thm (lhs) pders.simps(2)}  & @{text "\<equiv>"} & @{text "\<Union> (pders s) ` (pder c r)"}\\
  1803   @{thm (lhs) pderivs.simps(2)}  & @{text "\<equiv>"} & @{text "\<Union> (pders s) ` (pder c r)"}\\
  1759   \end{tabular}
  1804   \end{tabular}
  1760   \end{center}
  1805   \end{center}
  1761 
  1806 
  1762   \noindent
  1807   \noindent
  1763   Again the last two clauses extend partial derivatives from characters to strings. 
  1808   Again the last two clauses extend partial derivatives from characters to strings. 
  1771 
  1816 
  1772   \noindent
  1817   \noindent
  1773   in order to `sequence' a regular expression with a set of regular
  1818   in order to `sequence' a regular expression with a set of regular
  1774   expressions. Note that in the last clause we first build the set of partial
  1819   expressions. Note that in the last clause we first build the set of partial
  1775   derivatives w.r.t~the character @{text c}, then build the image of this set under the
  1820   derivatives w.r.t~the character @{text c}, then build the image of this set under the
  1776   function @{term "pders s"} and finally `union up' all resulting sets. It will be
  1821   function @{term "pderivs s"} and finally `union up' all resulting sets. It will be
  1777   convenient to introduce for this the following abbreviation
  1822   convenient to introduce for this the following abbreviation
  1778 
  1823 
  1779   \begin{center}
  1824   \begin{center}
  1780   @{abbrev "pderss s rs"}
  1825   @{abbrev "pderivs_set s rs"}
  1781   \end{center}
  1826   \end{center}
  1782 
  1827 
  1783   \noindent
  1828   \noindent
  1784   which simplifies the last clause of @{const "pders"} to
  1829   which simplifies the last clause of @{const "pderivs"} to
  1785 
  1830 
  1786   \begin{center}
  1831   \begin{center}
  1787   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1.5mm}}l@ {}}
  1832   \begin{tabular}{@ {}l@ {\hspace{1mm}}c@ {\hspace{1.5mm}}l@ {}}
  1788   @{thm (lhs) pders.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) pders.simps(2)}\\
  1833   @{thm (lhs) pderivs.simps(2)}  & @{text "\<equiv>"} & @{thm (rhs) pderivs.simps(2)}\\
  1789   \end{tabular}
  1834   \end{tabular}
  1790   \end{center}
  1835   \end{center}
  1791 
  1836 
  1792   Partial derivatives can be seen as having the @{text "ACI"}-identities already built in: 
  1837   Partial derivatives can be seen as having the @{text "ACI"}-identities already built in: 
  1793   taking the partial derivatives of the
  1838   taking the partial derivatives of the
  1795   equal sets.  Antimirov \cite{Antimirov95} showed a similar result to
  1840   equal sets.  Antimirov \cite{Antimirov95} showed a similar result to
  1796   \eqref{Dersders} for partial derivatives, namely
  1841   \eqref{Dersders} for partial derivatives, namely
  1797 
  1842 
  1798   \begin{equation}\label{Derspders}
  1843   \begin{equation}\label{Derspders}
  1799   \mbox{\begin{tabular}{lc}
  1844   \mbox{\begin{tabular}{lc}
  1800   @{text "(i)"}  & @{thm Der_pder}\\
  1845   @{text "(i)"}  & @{thm Deriv_pderiv}\\
  1801   @{text "(ii)"} & @{thm Ders_pders}
  1846   @{text "(ii)"} & @{thm Derivs_pderivs}
  1802   \end{tabular}}
  1847   \end{tabular}}
  1803   \end{equation} 
  1848   \end{equation} 
  1804 
  1849 
  1805   \begin{proof}
  1850   \begin{proof}
  1806   The first fact is by a simple induction on @{text r}. For the second we slightly
  1851   The first fact is by a simple induction on @{text r}. For the second we slightly
  1807   modify Antimirov's proof by performing an induction on @{text s} where we
  1852   modify Antimirov's proof by performing an induction on @{text s} where we
  1808   generalise over all @{text r}. That means in the @{text "cons"}-case the 
  1853   generalise over all @{text r}. That means in the @{text "cons"}-case the 
  1809   induction hypothesis is
  1854   induction hypothesis is
  1810 
  1855 
  1811   \begin{center}
  1856   \begin{center}
  1812   @{text "(IH)"}\hspace{3mm}@{term "\<forall>r. Ders s (lang r) = \<Union> lang ` (pders s r)"}
  1857   @{text "(IH)"}\hspace{3mm}@{term "\<forall>r. Derivs s (lang r) = \<Union> lang ` (pderivs s r)"}
  1813   \end{center}
  1858   \end{center}
  1814 
  1859 
  1815   \noindent
  1860   \noindent
  1816   With this we can establish
  1861   With this we can establish
  1817 
  1862 
  1818   \begin{center}
  1863   \begin{center}
  1819   \begin{tabular}{r@ {\hspace{1.5mm}}c@ {\hspace{1.5mm}}ll}
  1864   \begin{tabular}{r@ {\hspace{1.5mm}}c@ {\hspace{1.5mm}}ll}
  1820   @{term "Ders (c # s) (lang r)"} 
  1865   @{term "Derivs (c # s) (lang r)"} 
  1821     & @{text "="} & @{term "Ders s (Der c (lang r))"} & by def.\\
  1866     & @{text "="} & @{term "Derivs s (Deriv c (lang r))"} & by def.\\
  1822     & @{text "="} & @{term "Ders s (\<Union> lang ` (pder c r))"} & by @{text "("}\ref{Derspders}@{text ".i)"}\\
  1867     & @{text "="} & @{term "Derivs s (\<Union> lang ` (pderiv c r))"} & by @{text "("}\ref{Derspders}@{text ".i)"}\\
  1823     & @{text "="} & @{term "\<Union> (Ders s) ` (lang ` (pder c r))"} & by def.~of @{text "Ders"}\\
  1868     & @{text "="} & @{term "\<Union> (Derivs s) ` (lang ` (pderiv c r))"} & by def.~of @{text "Ders"}\\
  1824     & @{text "="} & @{term "\<Union> lang ` (\<Union> pders s ` (pder c r))"} & by IH\\
  1869     & @{text "="} & @{term "\<Union> lang ` (\<Union> pderivs s ` (pderiv c r))"} & by IH\\
  1825     & @{text "="} & @{term "\<Union> lang ` (pders (c # s) r)"} & by def.\\
  1870     & @{text "="} & @{term "\<Union> lang ` (pderivs (c # s) r)"} & by def.\\
  1826   \end{tabular}
  1871   \end{tabular}
  1827   \end{center}
  1872   \end{center}
  1828   
  1873   
  1829   \noindent
  1874   \noindent
  1830   Note that in order to apply the induction hypothesis in the fourth equation, we
  1875   Note that in order to apply the induction hypothesis in the fourth equation, we
  1836   Taking \eqref{Dersders} and \eqref{Derspders} together gives the relationship 
  1881   Taking \eqref{Dersders} and \eqref{Derspders} together gives the relationship 
  1837   between languages of derivatives and partial derivatives
  1882   between languages of derivatives and partial derivatives
  1838 
  1883 
  1839   \begin{equation}
  1884   \begin{equation}
  1840   \mbox{\begin{tabular}{lc}
  1885   \mbox{\begin{tabular}{lc}
  1841   @{text "(i)"}  & @{thm der_pder[symmetric]}\\
  1886   @{text "(i)"}  & @{thm deriv_pderiv[symmetric]}\\
  1842   @{text "(ii)"} & @{thm ders_pders[symmetric]}
  1887   @{text "(ii)"} & @{thm derivs_pderivs[symmetric]}
  1843   \end{tabular}}
  1888   \end{tabular}}
  1844   \end{equation} 
  1889   \end{equation} 
  1845 
  1890 
  1846   \noindent
  1891   \noindent
  1847   These two properties confirm the observation made earlier 
  1892   These two properties confirm the observation made earlier 
  1851   Antimirov also proved that for every language and regular expression 
  1896   Antimirov also proved that for every language and regular expression 
  1852   there are only finitely many partial derivatives, whereby the set of partial
  1897   there are only finitely many partial derivatives, whereby the set of partial
  1853   derivatives of @{text r} w.r.t.~a language @{text A} is defined as
  1898   derivatives of @{text r} w.r.t.~a language @{text A} is defined as
  1854 
  1899 
  1855   \begin{equation}\label{Pdersdef}
  1900   \begin{equation}\label{Pdersdef}
  1856   @{thm pders_lang_def}
  1901   @{thm pderivs_lang_def}
  1857   \end{equation}
  1902   \end{equation}
  1858 
  1903 
  1859   \begin{thrm}[Antimirov \cite{Antimirov95}]\label{antimirov}
  1904   \begin{thrm}[Antimirov \cite{Antimirov95}]\label{antimirov}
  1860   For every language @{text A} and every regular expression @{text r}, 
  1905   For every language @{text A} and every regular expression @{text r}, 
  1861   \mbox{@{thm finite_pders_lang}}.
  1906   \mbox{@{thm finite_pderivs_lang}}.
  1862   \end{thrm}
  1907   \end{thrm}
  1863 
  1908 
  1864   \noindent
  1909   \noindent
  1865   Antimirov's proof first establishes this theorem for the language @{term UNIV1}, 
  1910   Antimirov's proof first establishes this theorem for the language @{term UNIV1}, 
  1866   which is the set of all non-empty strings. For this he proves:
  1911   which is the set of all non-empty strings. For this he proves:
  1867 
  1912 
  1868   \begin{equation}\label{pdersunivone}
  1913   \begin{equation}\label{pdersunivone}
  1869   \mbox{\begin{tabular}{l}
  1914   \mbox{\begin{tabular}{l}
  1870   @{thm pders_lang_Zero}\\
  1915   @{thm pderivs_lang_Zero}\\
  1871   @{thm pders_lang_One}\\
  1916   @{thm pderivs_lang_One}\\
  1872   @{thm pders_lang_Atom}\\
  1917   @{thm pderivs_lang_Atom}\\
  1873   @{thm pders_lang_Plus[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1918   @{thm pderivs_lang_Plus[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1874   @{thm pders_lang_Times[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1919   @{thm pderivs_lang_Times[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\
  1875   @{thm pders_lang_Star}\\
  1920   @{thm pderivs_lang_Star}\\
  1876   \end{tabular}}
  1921   \end{tabular}}
  1877   \end{equation}
  1922   \end{equation}
  1878 
  1923 
  1879   \noindent
  1924   \noindent
  1880   from which one can deduce by induction on @{text r} that
  1925   from which one can deduce by induction on @{text r} that
  1881 
  1926 
  1882   \begin{center}
  1927   \begin{center}
  1883   @{thm finite_pders_lang_UNIV1}
  1928   @{thm finite_pderivs_lang_UNIV1}
  1884   \end{center}
  1929   \end{center}
  1885 
  1930 
  1886   \noindent
  1931   \noindent
  1887   holds. Now Antimirov's theorem follows because
  1932   holds. Now Antimirov's theorem follows because
  1888 
  1933 
  1889   \begin{center}
  1934   \begin{center}
  1890   @{thm pders_lang_UNIV}\\
  1935   @{thm pderivs_lang_UNIV}\\
  1891   \end{center}
  1936   \end{center}
  1892 
  1937 
  1893   \noindent
  1938   \noindent
  1894   and for all languages @{text "A"}, @{term "pders_lang A r"} is a subset of
  1939   and for all languages @{text "A"}, @{term "pderivs_lang A r"} is a subset of
  1895   @{term "pders_lang UNIV r"}.  Since we follow Antimirov's proof quite
  1940   @{term "pderivs_lang UNIV r"}.  Since we follow Antimirov's proof quite
  1896   closely in our formalisation (only the last two cases of
  1941   closely in our formalisation (only the last two cases of
  1897   \eqref{pdersunivone} involve some non-routine induction arguments), we omit
  1942   \eqref{pdersunivone} involve some non-routine induction arguments), we omit
  1898   the details.
  1943   the details.
  1899 
  1944 
  1900   Let us now return to our proof for the second direction in the Myhill-Nerode
  1945   Let us now return to our proof for the second direction in the Myhill-Nerode
  1905   \begin{proof}[Proof of Theorem~\ref{myhillnerodetwo} (second version)]
  1950   \begin{proof}[Proof of Theorem~\ref{myhillnerodetwo} (second version)]
  1906   Using \eqref{mhders}
  1951   Using \eqref{mhders}
  1907   and \eqref{Derspders} we can easily infer that
  1952   and \eqref{Derspders} we can easily infer that
  1908 
  1953 
  1909   \begin{center}
  1954   \begin{center}
  1910   @{term "x \<approx>(lang r) y"}\hspace{4mm}\mbox{provided}\hspace{4mm}@{term "pders x r = pders y r"}
  1955   @{term "x \<approx>(lang r) y"}\hspace{4mm}\mbox{provided}\hspace{4mm}@{term "pderivs x r = pderivs y r"}
  1911   \end{center}
  1956   \end{center}
  1912 
  1957 
  1913   \noindent
  1958   \noindent
  1914   which means the tagging-relation @{text "\<^raw:$\threesim$>\<^bsub>(\<lambda>x. pders x r)\<^esub>"} refines @{term "\<approx>(lang r)"}.
  1959   which means the tagging-relation @{text "\<^raw:$\threesim$>\<^bsub>(\<lambda>x. pders x r)\<^esub>"} refines @{term "\<approx>(lang r)"}.
  1915   So we know by Lemma~\ref{fintwo}, \mbox{@{term "finite (UNIV // (\<approx>(lang r)))"}} 
  1960   So we know by Lemma~\ref{fintwo}, \mbox{@{term "finite (UNIV // (\<approx>(lang r)))"}} 
  1916   holds if @{term "finite (UNIV // (=(\<lambda>x. pders x r)=))"}. In order to establish 
  1961   holds if @{term "finite (UNIV // (=(\<lambda>x. pderivs x r)=))"}. In order to establish 
  1917   the latter, we can use Lemma~\ref{finone} and show that the range of the 
  1962   the latter, we can use Lemma~\ref{finone} and show that the range of the 
  1918   tagging-function \mbox{@{term "\<lambda>x. pders x r"}} is finite. For this recall Definition
  1963   tagging-function \mbox{@{term "\<lambda>x. pderivs x r"}} is finite. For this recall Definition
  1919   \ref{Pdersdef}, which gives us that 
  1964   \ref{Pdersdef}, which gives us that 
  1920 
  1965 
  1921   \begin{center}
  1966   \begin{center}
  1922   @{thm pders_lang_def[where A="UNIV", simplified]}
  1967   @{thm pderivs_lang_def[where A="UNIV", simplified]}
  1923   \end{center}
  1968   \end{center}
  1924 
  1969 
  1925   \noindent
  1970   \noindent
  1926   Now the range of @{term "\<lambda>x. pders x r"} is a subset of @{term "Pow (pders_lang UNIV r)"},
  1971   Now the range of @{term "\<lambda>x. pderivs x r"} is a subset of @{term "Pow (pderivs_lang UNIV r)"},
  1927   which we know is finite by Theorem~\ref{antimirov}. Consequently there 
  1972   which we know is finite by Theorem~\ref{antimirov}. Consequently there 
  1928   are only finitely many equivalence classes of @{text "\<^raw:$\threesim$>\<^bsub>(\<lambda>x. pders x r)\<^esub>"},
  1973   are only finitely many equivalence classes of @{text "\<^raw:$\threesim$>\<^bsub>(\<lambda>x. pders x r)\<^esub>"},
  1929   which refines @{term "\<approx>(lang r)"}, and therefore we can again conclude the 
  1974   which refines @{term "\<approx>(lang r)"}, and therefore we can again conclude the 
  1930   second part of the Myhill-Nerode theorem.
  1975   second part of the Myhill-Nerode theorem.
  1931   \end{proof}
  1976   \end{proof}
  2005 
  2050 
  2006   A perhaps surprising fact is that regular languages are closed under any
  2051   A perhaps surprising fact is that regular languages are closed under any
  2007   left-quotient. Define
  2052   left-quotient. Define
  2008 
  2053 
  2009   \begin{center}
  2054   \begin{center}
  2010   @{abbrev "Ders_lang B A"}
  2055   @{abbrev "Deriv_lang B A"}
  2011   \end{center}
  2056   \end{center}
  2012 
  2057 
  2013   \noindent
  2058   \noindent
  2014   and assume @{text B} is any language and @{text A} is regular, then @{term
  2059   and assume @{text B} is any language and @{text A} is regular, then @{term
  2015   "Ders_lang B A"} is regular. To see this consider the following argument
  2060   "Deriv_lang B A"} is regular. To see this consider the following argument
  2016   using partial derivatives: From @{text A} being regular we know there exists
  2061   using partial derivatives: From @{text A} being regular we know there exists
  2017   a regular expression @{text r} such that @{term "A = lang r"}. We also know
  2062   a regular expression @{text r} such that @{term "A = lang r"}. We also know
  2018   that @{term "pders_lang B r"} is finite for every language @{text B} and 
  2063   that @{term "pderivs_lang B r"} is finite for every language @{text B} and 
  2019   regular expression @{text r} (recall Theorem~\ref{antimirov}). By definition 
  2064   regular expression @{text r} (recall Theorem~\ref{antimirov}). By definition 
  2020   and \eqref{Derspders} therefore
  2065   and \eqref{Derspders} therefore
  2021 
  2066 
  2022   
  2067   
  2023   \begin{equation}\label{eqq}
  2068   \begin{equation}\label{eqq}
  2024   @{term "Ders_lang B (lang r) = (\<Union> lang ` (pders_lang B r))"}
  2069   @{term "Deriv_lang B (lang r) = (\<Union> lang ` (pderivs_lang B r))"}
  2025   \end{equation}
  2070   \end{equation}
  2026 
  2071 
  2027   \noindent
  2072   \noindent
  2028   Since there are only finitely many regular expressions in @{term "pders_lang
  2073   Since there are only finitely many regular expressions in @{term "pderivs_lang
  2029   B r"}, we know by \eqref{uplus} that there exists a regular expression so that
  2074   B r"}, we know by \eqref{uplus} that there exists a regular expression so that
  2030   the right-hand side of \eqref{eqq} is equal to the language \mbox{@{term "lang (\<Uplus>(pders_lang B
  2075   the right-hand side of \eqref{eqq} is equal to the language \mbox{@{term "lang (\<Uplus>(pderivs_lang B
  2031   r))"}}. Thus the regular expression @{term "\<Uplus>(pders_lang B r)"} verifies that
  2076   r))"}}. Thus the regular expression @{term "\<Uplus>(pderivs_lang B r)"} verifies that
  2032   @{term "Ders_lang B A"} is regular.
  2077   @{term "Deriv_lang B A"} is regular.
  2033 *}
  2078 *}
  2034 
  2079 
  2035 
  2080 
  2036 section {* Conclusion and Related Work *}
  2081 section {* Conclusion and Related Work *}
  2037 
  2082