Re: Motion 8 and sqrt
Ian McIntosh wrote:
> The way I'd suggest you propagate decorations for a unary operation
> like sqrt is to set the result decorations field to the input
> decorations, then change the individual decorations as needed. For
> most operations the result cannot be defined unless the input was, so
> if the input deco:defined is -1 the result deco:defined needs to be
> too. If the input deco:defined is 1 then the result deco:defined
> will be what you show. If the input deco:defined is 0 (unknown) then
> I think the result deco:defined must also be unknown.
At one point when working on Motion 8, we had in place the idea that each
trit was explicitly represented as two bits. For the "defined" property, the
two bits and their values were
(1) (0)
isDefined possiblyDefined
possiblyUndefined isUndefined
When considering both bits as a trit, we therefore had:
(isDefined,possiblyUndefined) = certainlyDefined
(possiblyDefined,possiblyUndefined) = onTheFence
(possiblyDefined,isUndefined) = certainlyUndefined
It seems a little complex at first glance, but there was one really nice
thing about this approach: when combining decorations, the pairwise-AND of
the decoration always gave the correct result!
For example, we had
([1,3],certainlyDefined) + sqrt(([0,4],certainlyDefined))
= ([1,3],certainlyDefined) + ([0,2],certainlyDefined)
= ([1,5],certainlyDefined)
([1,3],certainlyDefined) + sqrt(([-3,4],certainlyDefined))
= ([1,3],certainlyDefined) + ([0,2],onTheFence)
= ([1,5],onTheFence)
([1,3],certainlyDefined) + sqrt(([-3,-1],certainlyDefined))
= ([1,3],certainlyDefined) + (Empty,certainlyUndefined)
= (Empty,certainlyUndefined)
This is very efficient, since if the decorations are represented in a
concrete implmentation as integers, the resulting decoration can be computed
simply as the bitwise-AND of the decorations.
It works nicely for the "defined" property. The main difficulty is it didn't
seem to generalize to some trit properties like "empty", "entire" and
"bounded." So we took it out of the motion. It was a shame, because it was
such a simple and efficient rule. However, we both agreed it was more
important to leave open the option of possibly more complicated rules for
other trits.
Nate Hayes