Boyko Bantchev wrote:
> 
> On 10 April 2011 15:21, Viktor Cerovski <[email protected]> wrote:
>> The dictionary entry for Insert is clear about one
>> item arrays as well.  The relevant bit is:
>>
>>> [...] definition of insertion over an argument having zero items
>>> extends partitioning identities of the form
>>> u/y ↔ (u/k{.y) u (u/k}.y)
>>> to the cases k e. 0,#y .
>>>
>> So for the one item y one should use this identity
>> for k e. 0 1 to figure out what is the value of u/y.
>> Since either 0{. or 1}. has zero items in this case,
>> the identity function of u will be recalled and that way
>> also defined the value of u/y.
> 
> To start off, the Dictionary entry only says that identities like
> the cited one are extended to certain cases.  It does not say
> whether that particular identity holds.  And of course, for most
> values of u and y, the identity does *not* hold.  It is not a
> general identity.
> 
I agree.


> For the particular case of one-item y, witness:
> 
>    u=. -
>    y=. 5
>    u/y
> 5
>    k=. 0
>    (u/k{.y) u (u/k}.y)
> _5
>    k=. 1
>    (u/k{.y) u (u/k}.y)
> 5
> 
Your complaint here is presumably that the last two values 
are not equal.  My answer to this, in short, is that they 
cannot be equal in the case of Minus.  Here is why:

Let's set up an equation comparing k=0 and k=1 cases:

  (u/ 0{.y) u (u/ 0}.y) === (u/ 1{.y) u (u/ 1}.y)

and assume that y is a number. Then:

  1}.y === 0{.y === 0$0
  1{.y === 0}.y === ,:y

Now the Eq. becomes:

  (u/ (0$0)) u (u/,:y) === (u/,:y) u (u/ (0$0))

We now have to figure out what is the value of (u/ 0$0),
and 0$0 of course has no items.  The DoJ says:


> If y has no items (that is, 0=#y), the result of u/y is 
> the *neutral* or *identity element* of the function u .
> A neutral of a function u is a value e such that 
>   x u e ↔ x 
>   or 
>   e u x ↔ x, 
> for every x in the domain (or some significant sub-domain 
> such as boolean) of u .
>  [emphasize in DoJ]

Now notice that only x - e <-> x has a solution, namely e=0.
In other words, we could say that Minus has the right neutral,
but has no left neutral, in contradistinction to + and *, which
both have both neutrals. The same as for Minus holds also for % .

Let's check now what J gives for neutrals:

   > e=: (+/ ; -/ ; */ ; %/) 0$0
0 0 1 1
   $ each e
┌┬┬┬┐
│││││
└┴┴┴┘

Makes sense so far, no?

Let's now plug these fours values for + - * % into the Eq.:

  0 + (+/,:y) === (+/,:y) + 0   (true)
  0 - (-/,:y) === (-/,:y) - 0    (false, as you demonstrated)
  1 * (*/,:y) === (-/,:y) * 1   (true)
  1 % (%/,:y) === (%/,:y) % 1   (false)

We could have made the Eq. for - and % true by setting
-/,:y <-> 0 and %/,:y<->0, but the point here is that 
every 0 above has to be the neutral, and for - and % only 
the r.h.s is the correct one.  

The conclusion is that the following eq. are all true:

  +/y === 0 + (+/,:y) === (+/,:y) + 0
  -/y === (-/,:y) - 0         (true in your example)
  */y === 1 * (*/,:y) === (-/,:y) * 1
  %/y === (%/,:y) % 1


> Even more:
> 
>    y=. 'z'
>    u/y
> z
>    (u/k{.y) u (u/k}.y)
> |domain error: u
> |   (u/k{.y)    u(u/k}.y)
> 
> So, neither the `identity' holds, nor its r.h.s. is guaranteed
> to be at least meaningful.
> 
Well yeah, sure, the "identity" does not hold because each side
of the identity cannot be evaluated.  Indeed, when we plug
'z' into the Eq, we get 'z'-0 and 0-'z', thus the error.



> The very fact that we have to discuss the text of the Dictionary
> in order to come to a conclusion over the semantics of /, and
> that we can easily get wrong in interpreting it, is telling of its
> clarity.
> 
I hope the above clarifies it a bit.


-- 
View this message in context: 
http://old.nabble.com/the-design-of--%5C-tp31343248s24193p31365757.html
Sent from the J Chat mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to