<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>14652</bug_id>
          
          <creation_ts>2011-11-01 11:10:26 +0000</creation_ts>
          <short_desc>[XPath 3.0] Definition of &apos;subtype&apos; is incorrect/inconsistent</short_desc>
          <delta_ts>2013-06-19 08:42:14 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XPath 3.0</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>59385</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2011-11-01 11:10:26 +0000</bug_when>
    <thetext>Is the union type Union(P, Q) a subtype of Union(P, Q, R)?

According to the XSD rules, no. According to the detailed list of rules in 2.5.6.2, no. But according to the  definition of &apos;subtype&apos;, yes.

The definition of &apos;subtype&apos; is:

A sequence type A is a subtype of a sequence type B if and only if, for every value V, if V matches A according to the rules of SequenceType matching, then V also matches B.

Since every value that matches Union(P, Q) matches either P or Q and therefore matches Union(P, Q, R), this definition would imply that Union(P, Q) is a subtype of Union(P, Q, R).

Note also that the union type V = Union(P, Q) is unambiguously a subtype of Union(V, R). But if two union types V and W are both defined as Union(P, Q), then V is a subtype of Union(V, R) but W is not, although the definition of &apos;subtype&apos; would suggest that it is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60049</commentid>
    <comment_count>1</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2011-11-15 15:25:34 +0000</bug_when>
    <thetext>Perhaps we should change the definition to this:

[Definition: A sequence type A is a subtype of a sequence type B if subtype(A, B) is true.] 

That is the effective definition in the document, and it&apos;s hard to come up with a succinct intensional definition.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60050</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2011-11-15 16:34:08 +0000</bug_when>
    <thetext>&gt;[Definition: A sequence type A is a subtype of a sequence type B if subtype(A,
B) is true.] 

Seems OK to me. One could add the rider:

When subtype(A, B) is true, it is always the case that for any value V, (V instance of A) implies (V instance of B).

Note: the converse is not necessarily true: for example every instance of union(P, Q) is also an instance of union(P, Q, R), but there is no subtype relationship between these two types.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60052</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2011-11-15 17:10:45 +0000</bug_when>
    <thetext>We agreed to resolve this using the following definition:

[Definition: A sequence type A is a subtype of a sequence type B if the judgement subtype(A, B) is true.]</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>