login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for Indefinite Types revision 1 of 2

1 2
Editor: Bill Page
Time: 2007/11/13 18:34:38 GMT-8
Note: transferred from axiom-developer.org

changed:
-
Declaring Types
 
  The idea that one should be able to "declare the type" of a
variable in Axiom by the command
\begin{axiom}
n:PositiveInteger
\end{axiom}

is a frequent expectation of new users of Axiom - especially if one
has used other computer algebra systems, after all Axiom is supposed
to be a "strongly typed" system, right?

Unfortunately Axiom does not attempt to use this type information
when forming expressions - but worse - declaring the type actually
interferes with the use of the variable to form expressions!
\begin{axiom}
n+1
\end{axiom}

When you write 'n:PositiveInteger' what this tells Axiom is that
'n' will be assigned an integer value greater than 0 - only that.
After it is actually assigned some value, then it can be used
exactly like that value, but not before.

To me, this is a tremedous waste of an opportunity in Axiom to
to deal with "domain of computation" issues such as are
addressed in other untyped computer algebra systems by the use
of "assumptions" such as::

  assume(x,PositiveInteger);

Such knowledge can be used to considerably improve the quality
and generality of the computations.

There was plenty of discussion on axiom-developer, but no
concensus yet, I'm afraid. Here are some of the related threads:

-  http://lists.gnu.org/archive/html/axiom-developer/2004-06/msg00191.html

-  http://lists.gnu.org/archive/html/axiom-developer/2004-06/msg00212.html

-  http://lists.nongnu.org/archive/html/axiom-developer/2006-09/msg00518.html

-  http://lists.nongnu.org/archive/html/axiom-developer/2006-09/msg00549.html

See also "The Unknown In Computer Algebra":http://portal.axiom-developer.org/refs/articles/TheUnknownInComputerAlgebra.dvi

From BillPage Tue Sep 19 09:21:21 -0500 2006
From: Bill Page
Date: Tue, 19 Sep 2006 09:21:21 -0500
Subject: pdf format
Message-ID: <20060919092121-0500@wiki.axiom-developer.org>

Article by James Davenport and Christèle Faure in pdf format:

"The Unknown In Computer Algebra":http://wiki.axiom-developer.org/public/TheUnknownInComputerAlgebra.pdf

From BillPage Tue Sep 19 09:52:30 -0500 2006
From: Bill Page
Date: Tue, 19 Sep 2006 09:52:30 -0500
Subject: example code from above
Message-ID: <20060919095230-0500@wiki.axiom-developer.org>

\begin{spad}
)abbrev domain PUNINT PureUnknownInteger
PureUnknownInteger (D,BasicUnknown):Ring == Implementation where
    D:IntegerNumberSystem
    BasicUnknown:List Symbol
  Implementation ==> LocalAlgebra (Polynomial D,D,D) with
    "/" : ($,D) -> $
    ++ a/n computes the expression whose value is a/n if it
    ++ is actually an unknown integer
\end{spad}


Declaring Types

The idea that one should be able to "declare the type" of a variable in Axiom by the command

fricas
n:PositiveInteger
Type: Void

is a frequent expectation of new users of Axiom - especially if one has used other computer algebra systems, after all Axiom is supposed to be a "strongly typed" system, right?

Unfortunately Axiom does not attempt to use this type information when forming expressions - but worse - declaring the type actually interferes with the use of the variable to form expressions!

fricas
n+1
n is declared as being in PositiveInteger but has not been given a value.

When you write n:PositiveInteger what this tells Axiom is that n will be assigned an integer value greater than 0 - only that. After it is actually assigned some value, then it can be used exactly like that value, but not before.

To me, this is a tremedous waste of an opportunity in Axiom to to deal with "domain of computation" issues such as are addressed in other untyped computer algebra systems by the use of "assumptions" such as:

  assume(x,PositiveInteger);

Such knowledge can be used to considerably improve the quality and generality of the computations.

There was plenty of discussion on axiom-developer, but no concensus yet, I'm afraid. Here are some of the related threads:

See also The Unknown In Computer Algebra

pdf format --Bill Page, Tue, 19 Sep 2006 09:21:21 -0500 reply
Article by James Davenport and Christèle Faure in pdf format:

The Unknown In Computer Algebra

example code from above --Bill Page, Tue, 19 Sep 2006 09:52:30 -0500 reply
spad
)abbrev domain PUNINT PureUnknownInteger
PureUnknownInteger (D,BasicUnknown):Ring == Implementation where
    D:IntegerNumberSystem
    BasicUnknown:List Symbol
  Implementation ==> LocalAlgebra (Polynomial D,D,D) with
    "/" : ($,D) -> $
    ++ a/n computes the expression whose value is a/n if it
    ++ is actually an unknown integer
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7349452271109161057-25px003.spad
      using old system compiler.
   PUNINT abbreviates domain PureUnknownInteger 
******** Spad syntax error detected ********
Expected: |)|
The prior line was:
5> Implementation ==> LocalAlgebra (Polynomial D,D,D) with
The current line is:
6> "/" : ($,D) -> $
The number of valid tokens is 1. The prior token was #S(TOKEN :SYMBOL |(| :TYPE KEYWORD :NONBLANK 6) The current token is #S(TOKEN :SYMBOL $ :TYPE KEYWORD :NONBLANK 6)