```>
> > I was hoping that by saying it is a mapping to a sequence of
> > integers then we can also imply some properties of functions like
> > contains(), for example that contains(A,B) is true if A=B
> is true, and that
> > startswith(A, B) implies A <= B.
>
> The mathematician in me is required to reply with a proof
> that contains()
> can never satisfy such a property.  The problem is that equality is
> reflexive (symmetric), while string containment is not.

I should have been more formal. By "if" I didn't mean "if and only if". The
property I was after was

compare(A, B, C) = 0 implies contains(A, B, C)

It does seem to me that a collation without this property is likely to be
problematic.

Michael Kay

>
> Assume contains(A, B) is true if and only if collation(A) =
> collation(B) is
> true.  Then consider any two strings A and B such that
> contains(A, B) is
> true but contains(B, A) is not (for example, "a" and "aa").  By the
> hypothesis, contains(A, B) implies collation(A)=collation(B),
> but then by
> the collation(B) = collation(A) so by hypothesis contains(B,
> A) is true, a
>
> Therefore there cannot exist a collation for which
> contains(A, B) is true if
> and only if collation(A) = collation(B).  [Note that this proof holds
> regardless of what value space the collation maps into.]
>
>
>
> Cheers,
>
> Michael Brundage
> xquery@comcast.net
> Author, XQuery: The XML Query Language (Addison-Wesley, 2004)
> Co-author, Professional XML Databases (Wrox Press, 2000)
>
>
```

Received on Thursday, 10 June 2004 04:19:08 UTC