Re: Constructors motion
Baker and P1788
On Dec 3, 2011, at 3:12 AM, John Pryce wrote:
> ...
> I have a query however. When a constructor call "fails", should the call
> (a) return Empty, as currently written;
> (b) return a "Not an Interval" value, which must then exist at Level 1; or
> (c) not return any value, i.e. the function is simply undefined at this input argument?
>
> E.g. text2interval("rubbish").
On 3 Dec 2011, at 12:08, Ralph Baker Kearfott wrote:
> George (et al),
>
> Isn't "not-an-interval" the operator version of an "exception," at
> least in the sense of IEEE since the original 754?
>
> Along these lines, my personal view is that it is OK (if other
> considerations warrant it) to have "not an interval" in level 1,
> since "not an interval" is a logical mathematical statement.
(Recall this is for bare intervals, at Level 1.)
Let me put an argument for (c).
From the mathematical angle, a function being "simply undefined" is no big deal. The basic notion is a relation r from a "source" set X to a "target", or destination, set Y; it means just an arbitrary subset r of X * Y, where * means cartesian product.
The *image* of an arbitrary subset A of X is the set
r(A) = { y in Y | exists x in X s.t. (x,y) in r }.
By default r is a *partial* relation. Its *domain* D_r is the set of x in X where r({x}), the image of the singleton set {x}, is nonempty.
(1) If D_r is all of X, then r is *total*.
(2) If r({x}) is a singleton {y}, for all x in D_r, then r is a *function*. We then write y=r(x) instead of {y}=r({x}), for x in D_r, and say r(x) is undefined for x outside D_r.
(For x outside D_r, r({x}) is either empty, or a set of more than one element.)
These definitions are used in most of mathematics, whether the sets X and Y are sets of reals, or of intervals, or of cohomology bundles over an exoticon space, or whatever.
In Level 1 we've been happy to say a standard function such as log(x) is just "undefined" outside its domain. Dominique Lohez has argued that this is the natural Level 1 convention, and I begin to agree.
At Level 1, we can regard "Is f(x) defined?" as a question that we always know how to answer yes or no. So in a Level 1 algorithm it is OK to say "if f(x) is undefined then ...".
In such an algorithm, undefined output from one operation can be used as input to another, so one has to allow for undefined inputs. It all starts to look rather like NaN and NaI, but I rather like just using "undefined" at Level 1.
Only at Level 2, for efficiency reasons, need we have an actual value such as NaN or NaI that is returned when f is not defined.
That's my 2 pennyworth in favour of choice (c), i.e. saying nums2interval(3,2) is just "undefined" (in the non-Kaucher part of the standard).
John Pryce