|
|
last edited 15 years ago by hemmecke |
1 2 3 | ||
Editor: Bill Page
Time: 2009/03/23 07:19:57 GMT-7 |
||
Note: new |
changed: - **On Tue, Mar 24, 2009 at 4:24 AM, Ralf Hemmecke wrote:** Aldor's libalgebra has some bugs in it that seem to be really hard to track down. I faintly remember one such bug that I could nearly assign to the coexistence of:: *: (Integer, %) -> % and *: (R, %) -> % where R is instantiated with Integer. The problem here is a hidden overloading of implementations. Suppose you implement something like \begin{aldor} #include "axiom" MyWeirdPoly(R: Ring): Ring with { *: (Integer, %) -> %; *: (R, %) -> %; coerce: R -> %; -- ... } == Integer add { coerce(r:R):% == r pretend %; (i: Integer) * (x: %): % == ((i+i)::%)*x; (r: R) * (x: %): % == (r::%) * x -- ... } \end{aldor} \begin {axiom} )show MyWeirdPoly \end{axiom} \begin{axiom} p:=1$MyWeirdPoly(Integer) 3*p \end{axiom}
On Tue, Mar 24, 2009 at 4:24 AM, Ralf Hemmecke wrote:
Aldor's libalgebra has some bugs in it that seem to be really hard to track down. I faintly remember one such bug that I could nearly assign to the coexistence of:
*: (Integer, %) -> % and *: (R, %) -> %
where R is instantiated with Integer. The problem here is a hidden overloading of implementations. Suppose you implement something like
#include "axiom"
MyWeirdPoly(R: Ring): Ring with { *: (Integer, %) -> %; *: (R, %) -> %; coerce: R -> %; -- ... } == Integer add { coerce(r:R):% == r pretend %; (i: Integer) * (x: %): % == ((i+i)::%)*x; (r: R) * (x: %): % == (r::%) * x -- ... }
Compiling FriCAS source code from file /var/zope2/var/LatexWiki/3800008026135362624-25px001.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra Use the system command )set compiler args to change these options. #1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL' Compiling Lisp source code from file ./3800008026135362624-25px001.lsp Issuing )library command for 3800008026135362624-25px001 Reading /var/zope2/var/LatexWiki/3800008026135362624-25px001.asy MyWeirdPoly is now explicitly exposed in frame initial MyWeirdPoly will be automatically loaded when needed from /var/zope2/var/LatexWiki/3800008026135362624-25px001
)show MyWeirdPoly
MyWeirdPoly R: Ring is a domain constructor Abbreviation for MyWeirdPoly is MYWEIRD This constructor is exposed in this frame. Issue )edit 3800008026135362624-25px001.as to see algebra source code for MYWEIRD
------------------------------- Operations -------------------------------- ?*? : (PositiveInteger,%) -> % ?*? : (Integer,%) -> % ?*? : (%,%) -> % ?*? : (R,%) -> % ?**? : (%,PositiveInteger) -> % ?+? : (%,%) -> % -? : % -> % ?-? : (%,%) -> % 0 : () -> % 1 : () -> % ?=? : (%,%) -> Boolean ?^? : (%,PositiveInteger) -> % coerce : % -> OutputForm coerce : Integer -> % coerce : R -> % hash : % -> SingleInteger latex : % -> String one? : % -> Boolean sample : () -> % zero? : % -> Boolean ?~=? : (%,%) -> Boolean ?*? : (NonNegativeInteger,%) -> % ?**? : (%,NonNegativeInteger) -> % ?^? : (%,NonNegativeInteger) -> % characteristic : () -> NonNegativeInteger recip : % -> Union(value1: %,failed: Enumeration failed) subtractIfCan : (%,%) -> Union(value1: %,failed: Enumeration failed)
p:=1$MyWeirdPoly(Integer)
(1) |
3*p
(2) |