Myhill.thy
changeset 49 59936c012add
parent 48 61d9684a557a
child 55 d71424eb5d0c
equal deleted inserted replaced
48:61d9684a557a 49:59936c012add
   442 qed
   442 qed
   443 
   443 
   444 subsubsection {* The case for @{const "STAR"} *}
   444 subsubsection {* The case for @{const "STAR"} *}
   445 
   445 
   446 text {* 
   446 text {* 
   447   This turned out to be the trickiest case. 
   447   This turned out to be the trickiest case. The essential goal is 
   448   Any string @{text "x"} in language @{text "L\<^isub>1\<star>"}, 
   448   to proved @{text "y @ z \<in>  L\<^isub>1*"} under the assumptions that @{text "x @ z \<in>  L\<^isub>1*"}
   449   can be splited into a prefix @{text "xa \<in> L\<^isub>1\<star>"} and a suffix @{text "x - xa \<in> L\<^isub>1"}.
   449   and that @{text "x"} and @{text "y"} have the same tag. The reasoning goes as the following:
   450   For one such @{text "x"}, there can be many such splits. The tagging of @{text "x"} is then 
   450   \begin{enumerate}
   451   defined by collecting the @{text "L\<^isub>1"}-state of the suffixe from every possible split.
   451     \item Since @{text "x @ z \<in>  L\<^isub>1*"} holds, a prefix @{text "xa"} of @{text "x"} can be found
       
   452           such that @{text "xa \<in> L\<^isub>1*"} and @{text "(x - xa)@z \<in> L\<^isub>1*"}, as shown in Fig. \ref{first_split}(a).
       
   453           Such a prefix always exists, @{text "xa = []"}, for example, is one. 
       
   454     \item There could be many but fintie many of such @{text "xa"}, from which we can find the longest
       
   455           and name it @{text "xa_max"}, as shown in Fig. \ref{max_split}(b).
       
   456     \item The next step is to split @{text "z"} into @{text "za"} and @{text "zb"} such that
       
   457            @{text "(x - xa_max) @ za \<in> L\<^isub>1"} and @{text "zb \<in> L\<^isub>1*"}  as shown in Fig. \ref{last_split}(d).
       
   458           Such a split always exists because:
       
   459           \begin{enumerate}
       
   460             \item Because @{text "(x - x_max) @ z \<in> L\<^isub>1*"}, it can always be split into prefix @{text "a"}
       
   461               and suffix @{text "b"}, such that @{text "a \<in> L\<^isub>1"} and @{text "b \<in> L\<^isub>1*"},
       
   462               as shown in Fig. \ref{ab_split}(c).
       
   463             \item But the prefix @{text "a"} CANNOT be shorter than @{text "x - xa_max"}, otherwise
       
   464                    @{text "xa_max"} is not the max in it's kind.
       
   465             \item Now, @{text "za"} is just @{text "a - (x - xa_max)"} and @{text "zb"} is just @{text "b"}.
       
   466           \end{enumerate}
       
   467     \item  \label{tansfer_step} 
       
   468          By the assumption that @{text "x"} and @{text "y"} have the same tag, the structure on @{text "x @ z"}
       
   469           can be transferred to @{text "y @ z"} as shown in Fig. \ref{trans_split}(e). The detailed steps are:
       
   470           \begin{enumerate}
       
   471             \item A @{text "y"}-prefix @{text "ya"} corresponding to @{text "xa"} can be found, 
       
   472                   which satisfies conditions: @{text "ya \<in> L\<^isub>1*"} and @{text "(y - ya)@za \<in> L\<^isub>1"}.
       
   473             \item Since we already know @{text "zb \<in> L\<^isub>1*"}, we get @{text "(y - ya)@za@zb \<in> L\<^isub>1*"},
       
   474                   and this is just @{text "(y - ya)@z \<in> L\<^isub>1*"}.
       
   475             \item With fact @{text "ya \<in> L\<^isub>1*"}, we finally get @{text "y@z \<in> L\<^isub>1*"}.
       
   476           \end{enumerate}
       
   477   \end{enumerate}
       
   478 
       
   479   The formal proof of lemma @{text "tag_str_STAR_injI"} faithfully follows this informal argument 
       
   480   while the tagging function @{text "tag_str_STAR"} is defined to make the transfer in step
       
   481   \ref{transfer_step}4 feasible.
       
   482 
       
   483    
       
   484 \begin{figure}[h!]
       
   485 \centering
       
   486 \subfigure[First split]{\label{first_split}
       
   487 \scalebox{0.9}{
       
   488 \begin{tikzpicture}
       
   489     \node[draw,minimum height=3.8ex] (xa) {$\hspace{2em}xa\hspace{2em}$};
       
   490     \node[draw,minimum height=3.8ex, right=-0.03em of xa] (xxa) { $\hspace{5em}x - xa\hspace{5em}$ };
       
   491     \node[draw,minimum height=3.8ex, right=-0.03em of xxa] (z) { $\hspace{21em}$ };
       
   492 
       
   493     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   494            (xa.north west) -- ($(xxa.north east)+(0em,0em)$)
       
   495                node[midway, above=0.5em]{$x$};
       
   496 
       
   497     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   498            (z.north west) -- ($(z.north east)+(0em,0em)$)
       
   499                node[midway, above=0.5em]{$z$};
       
   500 
       
   501     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   502            ($(xa.north west)+(0em,3ex)$) -- ($(z.north east)+(0em,3ex)$)
       
   503                node[midway, above=0.8em]{$x @ z \in L_1*$};
       
   504 
       
   505     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   506            ($(z.south east)+(0em,0ex)$) -- ($(xxa.south west)+(0em,0ex)$)
       
   507                node[midway, below=0.5em]{$(x - xa) @ z \in L_1*$};
       
   508 
       
   509     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   510            ($(xa.south east)+(0em,0ex)$) -- ($(xa.south west)+(0em,0ex)$)
       
   511                node[midway, below=0.5em]{$xa \in L_1*$};
       
   512 \end{tikzpicture}}}
       
   513 
       
   514 \subfigure[Max split]{\label{max_split}
       
   515 \scalebox{0.9}{
       
   516 \begin{tikzpicture}
       
   517     \node[draw,minimum height=3.8ex] (xa) { $\hspace{4em}xa\_max\hspace{4em}$ };
       
   518     \node[draw,minimum height=3.8ex, right=-0.03em of xa] (xxa) { $\hspace{0.5em}x - xa\_max\hspace{0.5em}$ };
       
   519     \node[draw,minimum height=3.8ex, right=-0.03em of xxa] (z) { $\hspace{21em}$ };
       
   520 
       
   521     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   522            (xa.north west) -- ($(xxa.north east)+(0em,0em)$)
       
   523                node[midway, above=0.5em]{$x$};
       
   524 
       
   525     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   526            (z.north west) -- ($(z.north east)+(0em,0em)$)
       
   527                node[midway, above=0.5em]{$z$};
       
   528 
       
   529     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   530            ($(xa.north west)+(0em,3ex)$) -- ($(z.north east)+(0em,3ex)$)
       
   531                node[midway, above=0.8em]{$x @ z \in L_1*$};
       
   532 
       
   533     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   534            ($(z.south east)+(0em,0ex)$) -- ($(xxa.south west)+(0em,0ex)$)
       
   535                node[midway, below=0.5em]{$(x - xa\_max) @ z \in L_1*$};
       
   536 
       
   537     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   538            ($(xa.south east)+(0em,0ex)$) -- ($(xa.south west)+(0em,0ex)$)
       
   539                node[midway, below=0.5em]{$xa \in L_1*$};
       
   540 \end{tikzpicture}}}
       
   541 
       
   542 \subfigure[Max split with $a$ and $b$]{\label{ab_split}
       
   543 \scalebox{0.9}{
       
   544 \begin{tikzpicture}
       
   545     \node[draw,minimum height=3.8ex] (xa) { $\hspace{4em}xa\_max\hspace{4em}$ };
       
   546     \node[draw,minimum height=3.8ex, right=-0.03em of xa] (xxa) { $\hspace{0.5em}x - xa\_max\hspace{0.5em}$ };
       
   547     \node[draw,minimum height=3.8ex, right=-0.03em of xxa] (z) { $\hspace{21em}$ };
       
   548 
       
   549     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   550            (xa.north west) -- ($(xxa.north east)+(0em,0em)$)
       
   551                node[midway, above=0.5em]{$x$};
       
   552 
       
   553     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   554            (z.north west) -- ($(z.north east)+(0em,0em)$)
       
   555                node[midway, above=0.5em]{$z$};
       
   556 
       
   557     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   558            ($(xa.north west)+(0em,3ex)$) -- ($(z.north east)+(0em,3ex)$)
       
   559                node[midway, above=0.8em]{$x @ z \in L_1*$};
       
   560 
       
   561     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   562            ($(z.south east)+(0em,0ex)$) -- ($(xxa.south west)+(0em,0ex)$)
       
   563                node[midway, below=0.5em]{$(x - xa\_max) @ z \in L_1*$};
       
   564 
       
   565     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   566            ($(xa.south east)+(0em,0ex)$) -- ($(xa.south west)+(0em,0ex)$)
       
   567                node[midway, below=0.5em]{$xa \in L_1*$};
       
   568 
       
   569     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   570            ($(xxa.south east)+(6em,-5ex)$) -- ($(xxa.south west)+(0em,-5ex)$)
       
   571                node[midway, below=0.5em]{$a \in L_1$};
       
   572 
       
   573     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   574            ($(z.south east)+(0em,-5ex)$) -- ($(xxa.south east)+(6em,-5ex)$)
       
   575                node[midway, below=0.5em]{$b \in L_1*$};
       
   576 
       
   577 \end{tikzpicture}}}
       
   578 
       
   579 \subfigure[Last split]{\label{last_split}
       
   580 \scalebox{0.9}{
       
   581 \begin{tikzpicture}
       
   582     \node[draw,minimum height=3.8ex] (xa) { $\hspace{4em}xa\_max\hspace{4em}$ };
       
   583     \node[draw,minimum height=3.8ex, right=-0.03em of xa] (xxa) { $\hspace{0.5em}x - xa\_max\hspace{0.5em}$ };
       
   584     \node[draw,minimum height=3.8ex, right=-0.03em of xxa] (za) { $\hspace{2em}za\hspace{2em}$ };
       
   585     \node[draw,minimum height=3.8ex, right=-0.03em of za] (zb) { $\hspace{7em}zb\hspace{7em}$ };
       
   586 
       
   587     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   588            (xa.north west) -- ($(xxa.north east)+(0em,0em)$)
       
   589                node[midway, above=0.5em]{$x$};
       
   590 
       
   591     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   592            (za.north west) -- ($(zb.north east)+(0em,0em)$)
       
   593                node[midway, above=0.5em]{$z$};
       
   594 
       
   595     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   596            ($(xa.north west)+(0em,3ex)$) -- ($(zb.north east)+(0em,3ex)$)
       
   597                node[midway, above=0.8em]{$x @ z \in L_1*$};
       
   598 
       
   599     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   600            ($(za.south east)+(0em,0ex)$) -- ($(xxa.south west)+(0em,0ex)$)
       
   601                node[midway, below=0.5em]{$(x - xa\_max) @ za \in L_1$};
       
   602 
       
   603     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   604            ($(xa.south east)+(0em,0ex)$) -- ($(xa.south west)+(0em,0ex)$)
       
   605                node[midway, below=0.5em]{$xa\_max \in L_1*$};
       
   606 
       
   607     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   608            ($(zb.south east)+(0em,0ex)$) -- ($(zb.south west)+(0em,0ex)$)
       
   609                node[midway, below=0.5em]{$zb \in L_1*$};
       
   610 
       
   611     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   612            ($(zb.south east)+(0em,-4ex)$) -- ($(xxa.south west)+(0em,-4ex)$)
       
   613                node[midway, below=0.5em]{$(x - xa\_max)@z \in L_1*$};
       
   614 \end{tikzpicture}}}
       
   615 
       
   616 
       
   617 \subfigure[Transferring to $y$]{\label{trans_split}
       
   618 \scalebox{0.9}{
       
   619 \begin{tikzpicture}
       
   620     \node[draw,minimum height=3.8ex] (xa) { $\hspace{5em}ya\hspace{5em}$ };
       
   621     \node[draw,minimum height=3.8ex, right=-0.03em of xa] (xxa) { $\hspace{2em}y - ya\hspace{2em}$ };
       
   622     \node[draw,minimum height=3.8ex, right=-0.03em of xxa] (za) { $\hspace{2em}za\hspace{2em}$ };
       
   623     \node[draw,minimum height=3.8ex, right=-0.03em of za] (zb) { $\hspace{7em}zb\hspace{7em}$ };
       
   624 
       
   625     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   626            (xa.north west) -- ($(xxa.north east)+(0em,0em)$)
       
   627                node[midway, above=0.5em]{$y$};
       
   628 
       
   629     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   630            (za.north west) -- ($(zb.north east)+(0em,0em)$)
       
   631                node[midway, above=0.5em]{$z$};
       
   632 
       
   633     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   634            ($(xa.north west)+(0em,3ex)$) -- ($(zb.north east)+(0em,3ex)$)
       
   635                node[midway, above=0.8em]{$y @ z \in L_1*$};
       
   636 
       
   637     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   638            ($(za.south east)+(0em,0ex)$) -- ($(xxa.south west)+(0em,0ex)$)
       
   639                node[midway, below=0.5em]{$(y - ya) @ za \in L_1$};
       
   640 
       
   641     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   642            ($(xa.south east)+(0em,0ex)$) -- ($(xa.south west)+(0em,0ex)$)
       
   643                node[midway, below=0.5em]{$ya \in L_1*$};
       
   644 
       
   645     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   646            ($(zb.south east)+(0em,0ex)$) -- ($(zb.south west)+(0em,0ex)$)
       
   647                node[midway, below=0.5em]{$zb \in L_1*$};
       
   648 
       
   649     \draw[decoration={brace,transform={yscale=3}},decorate]
       
   650            ($(zb.south east)+(0em,-4ex)$) -- ($(xxa.south west)+(0em,-4ex)$)
       
   651                node[midway, below=0.5em]{$(y - ya)@z \in L_1*$};
       
   652 \end{tikzpicture}}}
       
   653 
       
   654 \caption{The case for $STAR$}
       
   655 \end{figure}
       
   656 
   452 *} 
   657 *} 
   453 
   658 
   454 definition 
   659 definition 
   455   tag_str_STAR :: "lang \<Rightarrow> string \<Rightarrow> lang set"
   660   tag_str_STAR :: "lang \<Rightarrow> string \<Rightarrow> lang set"
   456 where
   661 where
   457   "tag_str_STAR L1 = (\<lambda>x. {\<approx>L1 `` {x - xa} | xa. xa < x \<and> xa \<in> L1\<star>})"
   662   "tag_str_STAR L1 = (\<lambda>x. {\<approx>L1 `` {x - xa} | xa. xa < x \<and> xa \<in> L1\<star>})"
   458 
       
   459 
       
   460 
   663 
   461 text {* A technical lemma. *}
   664 text {* A technical lemma. *}
   462 lemma finite_set_has_max: "\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> 
   665 lemma finite_set_has_max: "\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> 
   463            (\<exists> max \<in> A. \<forall> a \<in> A. f a <= (f max :: nat))"
   666            (\<exists> max \<in> A. \<forall> a \<in> A. f a <= (f max :: nat))"
   464 proof (induct rule:finite.induct)
   667 proof (induct rule:finite.induct)
   488 text {* Technical lemma. *}
   691 text {* Technical lemma. *}
   489 lemma finite_strict_prefix_set: "finite {xa. xa < (x::string)}"
   692 lemma finite_strict_prefix_set: "finite {xa. xa < (x::string)}"
   490 apply (induct x rule:rev_induct, simp)
   693 apply (induct x rule:rev_induct, simp)
   491 apply (subgoal_tac "{xa. xa < xs @ [x]} = {xa. xa < xs} \<union> {xs}")
   694 apply (subgoal_tac "{xa. xa < xs @ [x]} = {xa. xa < xs} \<union> {xs}")
   492 by (auto simp:strict_prefix_def)
   695 by (auto simp:strict_prefix_def)
   493 
       
   494 
       
   495 text {*
       
   496   The following lemma @{text "tag_str_STAR_injI"} establishes the injectivity of 
       
   497   the tagging function for case @{text "STAR"}.
       
   498   *}
       
   499 
   696 
   500 
   697 
   501 lemma tag_str_STAR_injI:
   698 lemma tag_str_STAR_injI:
   502   fixes v w
   699   fixes v w
   503   assumes eq_tag: "tag_str_STAR L\<^isub>1 v = tag_str_STAR L\<^isub>1 w"
   700   assumes eq_tag: "tag_str_STAR L\<^isub>1 v = tag_str_STAR L\<^isub>1 w"