Gaby, Since SubDomain has recently been discussed in the fricas list as well, I hope you do not mind that I continue this thread from *-patches here on the *-devel list where it might be more accessible to others interested in this subject.
Given your comments below about problems with evaluating domains in 'EVAL', I could just wait for the longer term until someone else finds sufficient time to work on this problem, but since I believe that SubDomain is a very important concept in panAxiom I thought I would at least try to understand better what is going on and maybe find a shorter term fix. In order to study this problem more closely I disabled the check in the compiler: p...@linux-9fx0:~/open-axiom-src> svn diff Index: src/interp/define.boot =================================================================== --- src/interp/define.boot (revision 1057) +++ src/interp/define.boot (working copy) @@ -1444,8 +1444,8 @@ " cannot be interpreted with #1: ",domainForm],nil) pred := lispize u.expr -- For now, reject predicates that directly reference domains - CONTAINED("$",pred) => - stackAndThrow('"predicate %1pb is not simple enough",[predicate]) + --CONTAINED("$",pred) => + -- stackAndThrow('"predicate %1pb is not simple enough",[predicate]) emitSubdomainInfo($form,domainForm,pred) $lisplibSuperDomain := [domainForm,predicate] [domainForm,m,e] --- and re-built open-axiom. Now I can compile the example: (1) -> )sys cat nz.spad )abbrev domain NZ NonZero NonZero(R:AbelianGroup): AbelianSemiGroup == SubDomain(R, (#1 ~= 0$R)$R) (1) -> )co nz.spad Compiling OpenAxiom source code from file /home/page/nz.spad using Spad compiler. NZ abbreviates domain NonZero ------------------------------------------------------------------------ initializing NRLIB NZ for NonZero compiling into NRLIB NZ Adding $ modemaps Adding R modemaps Adding Boolean modemaps (time taken in buildFunctor: 0) Time: 0.01 SEC. Cumulative Statistics for Constructor NonZero Time: 0.01 seconds finalizing NRLIB NZ Processing NonZero for Browser database: --->-->NonZero: Missing Description ------------------------------------------------------------------------ NonZero is now explicitly exposed in frame frame1398 NonZero will be automatically loaded when needed from /home/page/NZ.NRLIB/code.o --- but as you implied, when I run it I get the following error: (1) -> x:NZ(INT) Type: Void (2) -> x:=1 ; (DEFUN COMPILER::CMP-ANON ...) is being compiled. ;; The variable $ is undefined. ;; The compiler will assume this variable is a global. >> System error: Caught fatal error [memory may be damaged] ---- The message about "variable $" is apparently coming from the lisp compiler. I presume that the presence of this variable in the generated lisp code is what 'define.boot' is checking for and thus avoiding the error later when lisp is called during run-time. Would it be sufficient to replace or bind $ to something appropriate (.e.g. Is it supposed to refer to the current domain which is now denoted by %)? I presume that there is already code of this sort available which is called in the case of local functions defined within the main body of the domain. I looked for something like this is the source, but for now this is still too opaque to me. Regards, Bill Page. > | On Sat, Jan 3, 2009 at 5:35 AM, Gabriel Dos Reis wrote: > | > > | > Subdomains were discribed in general terms as feature of the > | > Scratchpad II system. However, their implementation in the > | > opensourced AXIOM system was severly deficient. In particular: > | > * No support for parameterized subdomains. > | > * Only a handful of subdomains were supported. Even then the > | > hardcoded information were conflicting. E.g. the database > | > claimed that there were only two subdomains in the world and has > | > explicit comment to that effect, when -- in fact -- the library > | > contained three subdomains. > | > * User-defined subdomains were not supported. > | > > | > This patch adds support for parameterized subdomains to OpenAxiom, and > | > fixes all of the above mentioned deficiencies. > | > > | > Note that there remains one deficient from the old system that is not > | > fixed by this patch: subsumption in general remains unsound for > | > some subdomains. So, some care is needed. > | > That will be fixed with in the future. > | > > | > Tested on an x8_64-suse-linux. > | > Applied to mainline. > | > > > Bill Page writes: > | Perhaps I do not understand something fairly basic about how to use > | SubDomain in OpenAxiom built from Rev: 1057. I would really appreciate > | your help. > | > | Could you explain why I get the error message: > | > | "predicate ~=(#1,0) is not simple enough" > | > | in the following example? Earlier Bill Page wrote: > > > > p...@linux-9fx0:~> open-axiom -nox > > GCL (GNU Common Lisp) 2.6.8 CLtL1 Feb 9 2009 10:12:44 > > Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl) > > Binary License: GPL due to GPL'ed components: (BFD UNEXEC) > > Modifications of this banner must retain notice of a compatible license > > Dedicated to the memory of W. Schelter > > > > Use (help) to get some basic information on how to use GCL. > > Temporary directory for compiler files set to /tmp/ > > OpenAxiom: The Open Scientific Computation Platform > > Version: OpenAxiom 1.3.0-2009-01-28 > > Built on Monday February 9, 2009 at 10:21:14 > > ----------------------------------------------------------------------------- > > Issue )copyright to view copyright notices. > > Issue )summary for a summary of useful system commands. > > Issue )quit to leave OpenAxiom and return to shell. > > ----------------------------------------------------------------------------- > > > > (1) -> > > (1) -> )sys cat nz.spad > > )abbrev domain NZ NonZero > > NonZero(R:AbelianGroup): AbelianSemiGroup == SubDomain(R, not (#1 = 0)) > > > > (1) -> )co nz.spad > > Compiling OpenAxiom source code from file /home/page/nz.spad using > > Spad compiler. > > NZ abbreviates domain NonZero > > ------------------------------------------------------------------------ > > initializing NRLIB NZ for NonZero > > compiling into NRLIB NZ > > Adding $ modemaps > > Adding R modemaps > > Adding Boolean modemaps > > ****** comp fails at level 1 with expression: ****** > > ((|SubDomain| R (|not| (= |#1| 0)))) > > ****** level 1 ****** > > $x:= (SubDomain R (not (= #1 (Zero)))) > > $m:= (AbelianSemiGroup) > > $f:= > > ((((~= # . #1=(# #)) (= # . #3=(# #)) (|coerce| # . #5=(# #)) > > (|hash| # . #7=(# #)) ...))) > > > > >> Apparent user error: > > predicate not =#1Zero() is not simple enough > > > > --- > > > > But it does work fine in this case: > > > > (1) -> )sys cat nzi.spad > > )abbrev domain NZI NonZeroInteger > > NonZeroInteger(): AbelianSemiGroup == SubDomain(Integer, not (#1 = 0)) > > > > (1) -> )co nzi.spad > > Compiling OpenAxiom source code from file /home/page/nzi.spad using > > Spad compiler. > > NZI abbreviates domain NonZeroInteger > > ------------------------------------------------------------------------ > > initializing NRLIB NZI for NonZeroInteger > > compiling into NRLIB NZI > > Adding $ modemaps > > Adding Integer modemaps > > Adding Boolean modemaps > > (time taken in buildFunctor: 0) > > Time: 0 SEC. > > > > > > Cumulative Statistics for Constructor NonZeroInteger > > Time: 0 seconds > > > > --------------non extending category---------------------- > > NonZeroInteger of category AbelianSemiGroup > > has no IntegerNumberSystem > > finalizing NRLIB NZI > > Processing NonZeroInteger for Browser database: > > --->-->NonZeroInteger: Missing Description > > ------------------------------------------------------------------------ > > NonZeroInteger is now explicitly exposed in frame frame1398 > > NonZeroInteger will be automatically loaded when needed from > > /home/page/NZI.NRLIB/code.o > > > > (1) -> )sh NZI > > NonZeroInteger is a domain constructor > > Abbreviation for NonZeroInteger is NZI > > This constructor is exposed in this frame. > > Issue )edit /home/page/nzi2.spad to see algebra source code for NZI > > > > ------------------------------- Operations -------------------------------- > > ?*? : (PositiveInteger,%) -> % ?+? : (%,%) -> % > > ?=? : (%,%) -> Boolean coerce : % -> OutputForm > > hash : % -> SingleInteger latex : % -> String > > ?~=? : (%,%) -> Boolean > > > > (1) -> x:NZI:=2 > > > > (1) 2 > > Type: NonZeroInteger > > (2) -> (x+2)$NZI > > > > (2) 4 > > Type: NonZeroInteger On Wed, Feb 11, 2009 at 3:11 AM, Gabriel Dos Reis wrote: > I preferred to err on the safe side than sorry/mislead. Contrary to > popular belief the previous code that dealt with SubDomain did not > really worked -- except for two (or three) domains that had all the > information hardcoded as explained above. By `work', I mean being > able to compile separately domains, load them later and use them. > > | The difference being, I guess, that in the first case NZ depends is a > | parameter. > | > | In 'interp/define.boot' I see the following code: > | > | -- > | compSubDomain1(domainForm,predicate,m,e) == > | [.,.,e]:= > | compMakeDeclaration("#1",domainForm,addDomain(domainForm,e)) > | u:= > | compCompilerPredicate(predicate,e) or > | stackSemanticError(["predicate: ",predicate, > | " cannot be interpreted with #1: ",domainForm],nil) > | pred := lispize u.expr > | -- For now, reject predicates that directly reference domains > | CONTAINED("$",pred) => > | stackAndThrow('"predicate %1pb is not simple enough",[predicate]) > | emitSubdomainInfo($form,domainForm,pred) > | $lisplibSuperDomain := [domainForm,predicate] > | [domainForm,m,e] > | -- > | > | Would it be difficult to accommodate such a parameter without major > | changes to this code? > > The problem is not with that particular code. The problem is with how > we evaluate domains -- 'EVAL'. That needs to be reworked, and that is > some work. > > | Anything you can say to make it clearer how SubDomain does or should > | work in OpenAxiom would be great! > > Depending on parameters is not the real problem -- in fact OpenAxiom > has parameterized SubDomains, see Int8, Int16, etc. The issue is how > 'complicated' the result of the compilation of the predicate turns out > to be. But, a long term solution is to revise our evaluate domain > objects. > > For uses of parameterized SubDomains, see SystemInteger in the > OpenAxiom library. > ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel