This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1693 - [FS] lack of quantification and double subscripting is seriously wrong
Summary: [FS] lack of quantification and double subscripting is seriously wrong
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows 2000
: P2 major
Target Milestone: ---
Assignee: Jerome Simeon
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-17 22:17 UTC by Fred Zemke
Modified: 2005-09-06 13:05 UTC (History)
0 users

See Also:


Attachments

Description Fred Zemke 2005-07-17 22:17:21 UTC
4.1.5 Function calls
Under "dynamic errors", the second error condition considered is
when some argument cannot be promoted to the type of its formal
parameter in any eligible signature.  The prose description
is "If, for all possible function signatures, the evaluation
of some actual argument yields a value that cannot be
promoted to the corresponding formal type of the parameter, 
the function call raises a type error."

The logical structure of this sentence is:

 If (for all possible function signatures FS)
      (there exists an actual argument AA)
        (AA can not be promoted to the formal type of the 
         corresponding parameter of FS)
 then raise a type error.

I agree with this rule.  However, I think that the formalization of
it is incorrect.  I think your formal inference expresses the 
following (incorrect) rule:

 If (there exists an actual argument AA)
      (for all possible function signatures FS) 
        (AA can not be promoted to the formal type of the 
         corresponding parameter of FS)
 then raise a type error.

For example, the incorrect rule just given cannot detect the 
type error in fs:eq ($a, $b) when $a is an xs:double and $b
is an xs:boolean.  According to appendix B.2 "Mapping of 
overloaded internal functions",
there is a signature of fs:eq for which the first argument is
acceptable, and there is a different signature of fs:eq for which
the second argument is acceptable, but there is no signature for
which both arguments are acceptable. 

It is very hard to be sure what the inference means
because your inferences do not have explicit quantification
(a major no-no in my book).  Let me explain why I think the 
inference as stated expresses the incorrect rule rather than
the correct one.

In the first premise, expanded-QName is a free variable which 
must have existential quantification.  Similarly for m and 
FuncDecl1 through FuncDeclm in the second premise.

The third premise admirably ends with
"for all 1 <= j <= m", though "for all j, 1 <= j <= m" would 
be better (m is not actually a free variable; it is bound by 
being the number of function declarations in the preceding premise,
so you cannot mean "for all j, m, 1 <= j <= m").  

However, the third premise also has variables n, Type1, ... Typen,
and Type,
which all need quantification.  n is just the arity of the 
function, which is essentially bound by the conclusion of the 
inference.  This leaves Type1 through Typen, plus Type, to quantify.
My working hypothesis is that variables introduced in the premises
have existential quantification by default.  Then the next issue
is whether this quantification occurs before or after the 
"for all j, 1 <= j <= m".  If we read it

  (there exists Type1, ... Typen, Type) 
    (for all j, 1 <= j <= m)
      FuncDecln = define function expanded-QName(Type1, ... Typen)
                                 as Type

this won't work because it is saying that every FuncDecl has the
same list of parameter types.  Thus it must be

  (for all j, 1 <= j <= m)
    (there exists Type1, ... Typen, Type)
      FuncDecln = define function expanded-QName(Type1, ... Typen)
                                 as Type

Probably the rule would be better stated using double subscripts 
on the Type's.

In the next premise, "dynEnv |- Expri => Valuei",
the subscript i is a free variable.  I think you mean 
existential quantification on i, that is, "if there exists an 
i such that yada-yada, then raise typeError".   However, the 
last premise ends with the cryptic "1 <= i <= n".  You
don't state whether this is existential or universal quantification.
The earlier line with "for all 1 <= j <= m" suggests that you
simply forgot to include "for all" on this one, but on the other
hand, the preceding premise seems to require existential 
quantification of i.  So perhaps your convention is that you 
write universal quantification explicitly but omit the existential
quantifiers.  And indeed the logic of the situation for
this premise also inclines toward existential quantification:
you only need one i such that Valuei does not promote in order
to have a type error.
Seen in this light, the last two premises are linked, and the 
value of i must be the same in both.  

For that matter, the Type1, ... Typen introduced in the third
premise must have the same values in the last premise.

In addition, it seems clear
that the Valuei' in the final premise has existential quantification.

The conclusion I come to is
that the last three premises are interpreted as:

  (for all j, 1 <= j <= m)
    (there exists FuncDeclj, Type1, ... Typen, Type)
      [
        FuncDeclj = define function expanded-QName(Type1, ... Typen)
                                 as Type
      and
        (there exists i, 1 <= i <= n)
          (there exists Valuei, Valuei')
            [
              dynEnv |- Expri => Valuei
            and
              statEnv |- not (Valuei against Typei 
                              promotes to Valuei')
            ]
       ]

Thus the rules seem to say: there exists a single function 
declaration FuncDeclj and a single argument number i such that
the i-th argument does not promote the the i-th parameter type.
And of course this is not good enough.
Comment 1 Jerome Simeon 2005-07-22 23:10:07 UTC
The WGs have decided to remove the formal specification of dynamic error and
error propagation from the FS document (see bug
http://www.w3.org/Bugs/Public/show_bug.cgi?id=1554).

As a result it seems to me that this comment is moot.

- Jerome
Comment 2 Jim Melton 2005-07-26 15:55:09 UTC
This is the official response from the XML Query WG and the XSL WG. 

We believe that this comment has been overtaken by events, as indicated in
Additional Comment #1.  As a result, we are closing this bug based on the action
taken in bug number 1545. 

Please let us know if you agree with this resolution of your issue, by adding a
comment to the issue record and changing the Status of the issue to Closed. Or,
if you do not agree with this resolution, please add a comment explaining why.
If you wish to appeal the WG's decision to the Director, then also change the
Status of the record to Reopened. If you wish to record your dissent, but do not
wish to appeal the decision to the Director, then change the Status of the
record to Closed. If we do not hear from you in the next two weeks, we will
assume you agree with the WG decision.