thys/Paper/Paper.thy
changeset 140 a05b3c89e8aa
parent 139 f28cf86a1e7f
child 141 879d43256063
equal deleted inserted replaced
139:f28cf86a1e7f 140:a05b3c89e8aa
   959   similar ordering for GREEDY matching and they show that their GREEDY
   959   similar ordering for GREEDY matching and they show that their GREEDY
   960   matching algorithm always produces a maximal element according to this
   960   matching algorithm always produces a maximal element according to this
   961   ordering (from all possible solutions). The only difference between their
   961   ordering (from all possible solutions). The only difference between their
   962   GREEDY ordering and the ``ordering'' by Sulzmann and Lu is that GREEDY, if
   962   GREEDY ordering and the ``ordering'' by Sulzmann and Lu is that GREEDY, if
   963   possible, always prefers a $Left$-value over a $Right$-value, no matter
   963   possible, always prefers a $Left$-value over a $Right$-value, no matter
   964   what the underlying string is. This seems like only a very minor
   964   what the underlying string is. This seems to be only a very minor
   965   difference, but it leads to drastic consequences in terms what
   965   difference, but it has drastic consequences in terms of what
   966   properties both orderings enjoy. What is interesting for our purposes is
   966   properties both orderings enjoy. What is interesting for our purposes is
   967   that the properties reflexivity, totality and transitivity for this GREEDY
   967   that the properties reflexivity, totality and transitivity for this GREEDY
   968   ordering can be proved relatively easily by induction.
   968   ordering can be proved relatively easily by induction.
   969 
   969 
   970   These properties of GREEDY, however, do not transfer to the POSIX
   970   These properties of GREEDY, however, do not transfer to the POSIX
   971   ``ordering'' by Sulzmann and Lu. To start with, $v \geq_r v′$ is not
   971   ``ordering'' by Sulzmann and Lu. To start with, $v \geq_r v'$ is not
   972   defined inductively, but as $v = v′$ or $v >_r v′ \wedge |v| = |v′|$. This
   972   defined inductively, but as $v = v'$ or $v >_r v' \wedge |v| = |v'|$. This
   973   means that $v >_r v′$ does not imply $v \geq_r v′$. Moreover, transitivity
   973   means that $v >_r v'$ does not imply $v \geq_r v'$. Moreover, transitivity
   974   does not hold in the ``usual'' formulation, for example:
   974   does not hold in the ``usual'' formulation, for example:
   975 
   975 
   976 \begin{proposition}
   976 \begin{proposition}
   977 Suppose $v_1 : r$, $v_2 : r$ and $v_3 : r$.
   977 Suppose $v_1 : r$, $v_2 : r$ and $v_3 : r$.
   978 If $v_1 \posix_r v_2$ and $v_2 \posix_r v_3$
   978 If $v_1 \posix_r v_2$ and $v_2 \posix_r v_3$
   979 then $v_1 \posix_r v_3$.
   979 then $v_1 \posix_r v_3$.
   980 \end{proposition}
   980 \end{proposition}
   981 
   981 
   982 \noindent If formulated like this, then there are various counter examples:
   982 \noindent If formulated in this way, then there are various counter examples:
   983 FOr example let $r$ be $a + ((a + a)\cdot (a + \textbf{0}))$ then the $v_1$,
   983 For example let $r$ be $a + ((a + a)\cdot (a + \textbf{0}))$ then the $v_1$,
   984 $v_2$ and $v_3$ below are values of $r$:
   984 $v_2$ and $v_3$ below are values of $r$:
   985 
   985 
   986 \begin{center}
   986 \begin{center}
   987 \begin{tabular}{lcl}
   987 \begin{tabular}{lcl}
   988  $v_1$ & $=$ & $Left(Char\;a)$\\
   988  $v_1$ & $=$ & $Left(Char\;a)$\\
   989  $v_2$ & $=$ & $Right((Left(Char\;a), Right(Void)))$\\
   989  $v_2$ & $=$ & $Right((Left(Char\;a), Right()))$\\
   990  $v_3$ & $=$ & $Right((Right(Char\;a), Left(Char\;a)))$
   990  $v_3$ & $=$ & $Right((Right(Char\;a), Left(Char\;a)))$
   991 \end{tabular}
   991 \end{tabular}
   992 \end{center}
   992 \end{center}
   993 
   993 
   994 \noindent Moreover $v_1 \posix_r v_2$ and $v_2 \posix_r v_3$,
   994 \noindent Moreover $v_1 \posix_r v_2$ and $v_2 \posix_r v_3$,
   995 but \emph{not} $v_1 \posix_r v_3$! The reason is that although
   995 but \emph{not} $v_1 \posix_r v_3$! The reason is that although
   996 $v_3$ is a $Right$-value, it can match a longer string, namely
   996 $v_3$ is a $Right$-value, it can match a longer string, namely
   997 $|v_3| = aa$, while $|v_1|$ (and $|v_2|$) matches only $a$. So
   997 $|v_3| = [a,a]$, while $|v_1|$ (and $|v_2|$) matches only $[a]$. So
   998 transitivity in this formulation does not hold---in this
   998 transitivity in this formulation does not hold---in this
   999 example actually $v_3 \posix_r v_1$!
   999 example actually $v_3 \posix_r v_1$!
  1000 
  1000 
  1001 Sulzmann and Lu ``fix'' this problem by weakening the
  1001 Sulzmann and Lu ``fix'' this problem by weakening the
  1002 transitivity property. They require in addition that the
  1002 transitivity property. They require in addition that the
  1003 underlying strings are of the same length. This excludes the
  1003 underlying strings are of the same length. This excludes the
  1004 counter example above and any counter-example we were able 
  1004 counter example above and any counter-example we were able 
  1005 to find (by hand and by machine). Thus the transitivity 
  1005 to find (by hand and by machine). Thus the transitivity 
  1006 lemma in should be formulated as:
  1006 lemma should be formulated as:
  1007 
  1007 
  1008 \begin{property}
  1008 \begin{proposition}
  1009 Suppose $v_1 : r$, $v_2 : r$ and 
  1009 Suppose $v_1 : r$, $v_2 : r$ and 
  1010 $v_3 : r$, and also $|v_1|=|v_2|=|v_3|$.\\
  1010 $v_3 : r$, and also $|v_1|=|v_2|=|v_3|$.\\
  1011 If $v_1 \posix_r v_2$ and $v_2 \posix_r v_3$
  1011 If $v_1 \posix_r v_2$ and $v_2 \posix_r v_3$
  1012 then $v_1 \posix_r v_3$.
  1012 then $v_1 \posix_r v_3$.
  1013 \end{property}
  1013 \end{proposition}
  1014 
  1014 
  1015 \noindent While we agree with Sulzmann and Lu that this property probably
  1015 \noindent While we agree with Sulzmann and Lu that this property probably(!)
  1016 holds, proving it seems not so straightforward: although one begins with the
  1016 holds, proving it seems not so straightforward: although one begins with the
  1017 assumption that the values have the same flattening, this
  1017 assumption that the values have the same flattening, this
  1018 cannot be maintained as one descends into the induction. This is 
  1018 cannot be maintained as one descends into the induction. This is 
  1019 a problem that occurs in a number of places in their proof.
  1019 a problem that occurs in a number of places in the proofs by Sulzmann and Lu.
  1020 Sulzmann and Lu do not give an explicit proof
  1020 
  1021 of the transitivity property, but give a closely related
  1021 Although they do not give an explicit proof
       
  1022 of the transitivity property, they give a closely related
  1022 property about the existence of maximal elements. They state
  1023 property about the existence of maximal elements. They state
  1023 that this can be verified by an induction on $r$. We disagree
  1024 that this can be verified by an induction on $r$. We disagree
  1024 with this as we shall show next in case of transitivity.
  1025 with this as we shall show next in case of transitivity.
  1025 
       
  1026 The case where the reasoning breaks down is the sequence case,
  1026 The case where the reasoning breaks down is the sequence case,
  1027 say $r_1\cdot r_2$. The induction hypotheses in this case
  1027 say $r_1\cdot r_2$. The induction hypotheses in this case
  1028 are
  1028 are
  1029 
  1029 
  1030 \begin{center}
  1030 \begin{center}
  1065 \noindent
  1065 \noindent
  1066 hold, and furthermore that the values have equal length, 
  1066 hold, and furthermore that the values have equal length, 
  1067 namely:
  1067 namely:
  1068 
  1068 
  1069 \begin{equation}
  1069 \begin{equation}
  1070 |(v_{1l}, v_{1r})| = |(v_{2l}, v_{2r})|
  1070 |Seq\,v_{1l}\, v_{1r}| = |Seq\,v_{2l}\, v_{2r}|
  1071 \qquad\textrm{and}\qquad
  1071 \qquad\textrm{and}\qquad
  1072 |(v_{2l}, v_{2r})| = |(v_{3l}, v_{3r})|
  1072 |Seq\,v_{2l}\, v_{2r}| = |Seq\,v_{3l}\, v_{3r}|
  1073 \label{lens}
  1073 \label{lens}
  1074 \end{equation}
  1074 \end{equation}
  1075 
  1075 
  1076 \noindent
  1076 \noindent
  1077 We need to show that
  1077 We need to show that
  1078 
  1078 
  1079 \[
  1079 \[
  1080 Seq\,v_{1l}\, v_{1r}) \posix_{r_1\cdot r_2} Seq\, v_{3l}\, v_{3r}
  1080 Seq\,v_{1l}\, v_{1r} \posix_{r_1\cdot r_2} Seq\, v_{3l}\, v_{3r}
  1081 \]
  1081 \]
  1082 
  1082 
  1083 \noindent holds. We can proceed by analysing how the
  1083 \noindent holds. We can proceed by analysing how the
  1084 assumptions in \eqref{assms} have arisen. There are four
  1084 assumptions in \eqref{assms} have arisen. There are four
  1085 cases. Let us assume we are in the case where
  1085 cases. Let us assume we are in the case where
  1107 \]
  1107 \]
  1108 
  1108 
  1109 \noindent but still \eqref{lens} will hold. Now we are stuck,
  1109 \noindent but still \eqref{lens} will hold. Now we are stuck,
  1110 since the IH does not apply. As said, this problem where the
  1110 since the IH does not apply. As said, this problem where the
  1111 induction hypothesis does not apply arises in several places in
  1111 induction hypothesis does not apply arises in several places in
  1112 the proof of Sulzmann and LU, not just when proving transitivity.
  1112 the proof of Sulzmann and Lu, not just for proving transitivity.
  1113 
  1113 
  1114 *}
  1114 *}
  1115 
  1115 
  1116 section {* Conclusion *}
  1116 section {* Conclusion *}
  1117 
  1117