axiom-developer
[Top][All Lists]

## [Axiom-developer] [#99 x^1 abc[y] should be a syntax error] Not a bug

 From: anonymous Subject: [Axiom-developer] [#99 x^1 abc[y] should be a syntax error] Not a bug Date: Thu, 17 Feb 2005 06:07:32 -0600

++added:
To explain this, you have to understand several syntax conventions in Axiom.
When two expressions are separated by a space, it means "apply" as in
'f x' meaning 'f(x)'.  Exactly what "apply" does depends on 'f' and 'x'.
When 'f' is a symbol and 'x' is a list, this application produces a subscripted
symbol.
Also "apply" has higher precedence than any other operation. Finally, a
subscripted
symbol 'c'<SUB>'d'</SUB> when displayed on the Type info line is written as
'*01c d'.

So 'abc' [ 'y' ] &nbsp; is the same as 'abc' &nbsp; [ 'y' ] &nbsp; (because
clearly the left [ terminates the
symbol 'abc') and so this is a subscripted symbol 'abc'<SUB>'y'</SUB>.

\begin{axiom}
abc [y]
\end{axiom}

Now if 'b' is a symbol, then '1 b' is '1' applied to 'b'. Axiom tries to find
what operation
this application is, and finds one in 'UP(b,INT)' where the application means
evaluate
the element '1::UP(b,INT)' as a function at the value 'b' (substitution), which
gives '1'.

\begin{axiom}
1 (b::Symbol)
\end{axiom}

This is the same as

\begin{axiom}
elt(1::UP(b,INT),b::UP(b,INT))\$UP(b,INT)
\end{axiom}

The results reported above are therefore all obtained by the these rules. The
input
'x abc[y]' produces an error because this apply can only take place in UP
(the fact that UP has only one variable makes the substitution unambiguous)
and although it actually makes sense under suitable domains, the interpreter
is not smart enough to find it.

\begin{axiom}
(x::UP(x, POLY INT)) (b::UP(x, POLY INT))
\end{axiom}

and actually, the construction UP(x, POLY INT) is not kosher, but somehow
the extra parentheses helped.

\begin{axiom}
x::UP(x, POLY INT) b::UP(x, POLY INT)
\end{axiom}

--