Thoughts on mrow default intent

I've given a little thought to what I think is wrong about the defaults for
mrow and have some suggestions and open questions.

The defaults for mrow are @op or @append. @op is used when "a unique
visible descendant mo element' is present, otherwise @append is used.

Here are some mrow cases:

   1. a+b -- single <mo>
   2. a+b+c+d -- multiple <mo>s, all the same (do we need to distinguish
   between ones that only allow two args (i.e., binary vs nary)?
   3. a | b -- (potentially different than '1' because of '4')
   4. |a| -- same <mo> as '3' (potentially different Unicode, but not
   necessarily). Multiple  <mo>s like '2' but not infix, so different behavior.
   5. (a) -- multiple <mo>s, but "matching" ops
   6. a+b=c -- multiple *different*  <mo>s
   7. 2a -- no <mo> (no invisible one given)

I think Sam means to include '1' - '4' as using @op, but maybe only cases 1
and 3.

Cases '3' and '4' (might) mean the "form" (prefix, infix, postfix) should
be part of the operator value look up.

Case '5' (and '4' if not included above) seem relatively common and should
pick up a default meaning. The match would be the pattern starts with mo
and ends with mo and the lookup would need to pass both in. Potentially
this is restricted to starts with prefix mo and ends with postfix mo, but
that restriction misses out on the alternate interval notation "]a,b["
(etc) along with (maybe) the braket notation "<a|". Removing that
restriction would pick up oddball cases like "-3!", but the point of the
default is to be right *most* of the time so that the need for explicit
markup is minimized.

Rather than calling 6 and 7 (and any other cases that don't become "@op")
"@append", I think something like @uninterpreted or the shorter @unparsed
would be a better name.

@extend probably wants to be redefined to be "process the children; if the
previous intent is @unparsed [or whatever name we use], append the contents
to the previous contents; otherwise create a new wrapper with
intent @unparsed with the content consisting of the previous content and
the @extend's content children".

The alternative to @append/@uninterpretted/@unparsed is to actually parse
the mrow to form an intent. For example, '6' would essentially become
'{a+b} = c' where there is one operator and so we get the obvious
intent='equals( plus($1, $3), $5)'. Requiring parsing likely is a bridge
too far for interpreting the value of an attribute.
Some food for thought/discussion...

   Neil

Received on Wednesday, 16 December 2020 20:47:03 UTC