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} |