Re: Draft decoration system for discussion
Vincent
On 11 Dec 2012, at 14:18, Vincent Lefevre wrote:
> On 2012-12-11 13:30:40 +0000, John Pryce wrote:
>> On 4 Dec 2012, at 04:34, Michel Hack wrote:
>>> Page 36, 8.8.8, normalInterval() function ...
>> ...I meant this function to convert xx to a decorated
>> interval (yy,dy) of the parent type, but the phone rang or I made
>> coffee or whatever, and forgot. Now done.
>>
>> My spec is
>> If xx is an interval, return (yy,dy) = (xx,t) where t is the threshold.
>
> Do you really mean that for instance, if xx is [0,1] and the
> threshold is ill, then (yy,dd) = ([0,1], ill)? Or if xx is Empty
> and the threshold is dac, then (yy,dd) = (Empty,dac)?
(As Michel pointed out)
A threshold is stated to be necessarily >= trv (in the 3rd paragraph of this subclause). So the first point doesn't apply.
As for the second, recall compressed interval operations are equivalent to converting each operand to a (possibly "arbitrary") decorated interval; doing the decorated interval operation, say phi; and converting back.
Suppose we take my view that such a phi, if returning Empty, only ever decorates it with ill or emp. Since this is necessarily < t, on conversion back to compressed it becomes a decoration, not an interval. If any constructor of compressed intervals (e.g. the compressedInterval() function) behaves the same way, then a compressed xx can *never* be (i) an interval and (ii) empty. So your second point doesn't apply either.
On the other hand, if one takes your view that a decorated interval operation may return (Empty, trv), and if the threshold t is trv, then an empty xx can exist. Then normalInterval(xx) returns (Empty, trv). But an empty xx can't happen if t>trv, so normalInterval(xx) = (Empty,dac) could never happen.
IMO this is another argument in favour of an operation always decorating an Empty result with either ill or emp (my "Level 2 requirement").
BTW I saw another place where I got "dac" and "com" mixed up when editing. In the "worst case semantics" paragraph in 8.8.8, the text in list item (b) should have different sets of decorations, thus:
> (b) For arithmetic operations with at least one bare decoration input, the result is always a bare decoration. A bare decoration d in {emp,ill} is treated as Empty_d. A bare decoration d in {trv,def,dac,com} is treated (conceptually, not algorithmically) as an arbitrary xx_d with nonempty interval xx that is compatible with d: for d in {trv,def,dac}, xx is unrestricted, while for d = com, xx is bounded. ...
John