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

spad
)abb category SPECCAT SpeciesCategory
SpeciesCategory(L: SetCategory): Category == SetCategory with
       structures: Set L -> List %
       name: () -> String
)abb domain CHARSPEC CharacteristicSpecies CharacteristicSpecies(L: SetCategory, n: Integer): SpeciesCategory L == add Rep := Set L
coerce(t: %): OutputForm == coerce(t)$Rep
structures s == if #s = n then [s] else []
name () == concat ["CharacteristicSpecies(", string n, ")"]
)abb domain SPECIES Species Species(L: SetCategory): Ring with coerce: % -> SpeciesCategory L == add Rep := SpeciesCategory L
coerce(s: %): OutputForm == S := s pretend SpeciesCategory(L) name()$S::OutputForm
coerce(s: %): SpeciesCategory L == s pretend SpeciesCategory(L)
0 == CharacteristicSpecies(L, 0) pretend Rep 1 == CharacteristicSpecies(L, 1) pretend Rep
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/32396914629305039-25px001.spad
      using old system compiler.
   SPECCAT abbreviates category SpeciesCategory 
------------------------------------------------------------------------
   initializing NRLIB SPECCAT for SpeciesCategory 
   compiling into NRLIB SPECCAT 
;;; *** |SpeciesCategory| REDEFINED Time: 0 SEC.
finalizing NRLIB SPECCAT Processing SpeciesCategory for Browser database: --->-->SpeciesCategory(constructor): Not documented!!!! --->-->SpeciesCategory((structures ((List %) (Set L)))): Not documented!!!! --->-->SpeciesCategory((name ((String)))): Not documented!!!! --->-->SpeciesCategory(): Missing Description ; compiling file "/var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT.lsp" (written 16 SEP 2013 05:00:57 PM):
; /var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT.fasl written ; compilation finished in 0:00:00.006 ------------------------------------------------------------------------ SpeciesCategory is now explicitly exposed in frame initial SpeciesCategory will be automatically loaded when needed from /var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT
CHARSPEC abbreviates domain CharacteristicSpecies ------------------------------------------------------------------------ initializing NRLIB CHARSPEC for CharacteristicSpecies compiling into NRLIB CHARSPEC compiling exported coerce : $ -> OutputForm Time: 0 SEC.
compiling exported structures : Set L -> List $ Time: 0.01 SEC.
compiling exported name : () -> String Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |CharacteristicSpecies| REDEFINED
;;; *** |CharacteristicSpecies| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor CharacteristicSpecies Time: 0.01 seconds
finalizing NRLIB CHARSPEC Processing CharacteristicSpecies for Browser database: --->-->CharacteristicSpecies(constructor): Not documented!!!! --->-->CharacteristicSpecies((structures ((List %) (Set L)))): Not documented!!!! --->-->CharacteristicSpecies((name ((String)))): Not documented!!!! --->-->CharacteristicSpecies(): Missing Description ; compiling file "/var/aw/var/LatexWiki/CHARSPEC.NRLIB/CHARSPEC.lsp" (written 16 SEP 2013 05:00:57 PM):
; /var/aw/var/LatexWiki/CHARSPEC.NRLIB/CHARSPEC.fasl written ; compilation finished in 0:00:00.016 ------------------------------------------------------------------------ CharacteristicSpecies is now explicitly exposed in frame initial CharacteristicSpecies will be automatically loaded when needed from /var/aw/var/LatexWiki/CHARSPEC.NRLIB/CHARSPEC
SPECIES abbreviates domain Species ------------------------------------------------------------------------ initializing NRLIB SPECIES for Species compiling into NRLIB SPECIES compiling exported coerce : $ -> OutputForm Time: 0 SEC.
compiling exported coerce : $ -> SpeciesCategory L SPECIES;coerce;$Sc;2 is replaced by s Time: 0 SEC.
compiling exported Zero : () -> $ ****** comp fails at level 1 with expression: ****** error in function Zero
((|Category|)) ****** level 1 ****** $x:= (Category) $m:= $EmptyMode $f:= ((((|Rep| #) (|$Information| #) (~= #) (= #) ...)))
>> Apparent user error: cannot compile (Category)

On Tue, Nov 11, 2008 at 7:38 PM Waldek Hebisch wrote:

Martin wrote:

 I did the following experiment.

 In FriCAS, I get an error when I uncomment the line containing the Rep in
 SPECIES.  This does not happen in Open-Axiom.  Otherwise, it compiles and I can
 do

 (1) -> S1 := 1$Species INT

    (1)  "CharacteristicSpecies(1)"

                                            Type: Species(Integer)
 (2) -> S2 := S1::SpeciesCategory INT

    You cannot use SpeciesCategory(Integer) or any other category in a
       target, coercion, or package-call context.

I am slightly suprized that the file compiles and is doing someting sensible.

This is message S2IE0014 (normal tactic when looking at simlar cases is to search src/share/doc/msgs/s2-us.msgs to find message id and then grep sources to find where the id is used). It appears twice in i-spec1.boot:

  grep -n S2IE0014 *
  i-spec1.boot:383:  categoryForm?(m) => throwKeyedMsg("S2IE0014",[m])
  i-spec1.boot:408:  categoryForm?(m) => throwKeyedMsg("S2IE0014",[m])

Try commenting out the checks.

boot
import i_-analy
namespace BOOT
--% Handlers for TARGET
upTARGET t == -- Evaluates the rhs to a mode,which is used as the target type for -- the lhs. t isnt [op,lhs,rhs] => nil -- do not (yet) support local variables on the rhs (not $genValue) and or/[CONTAINED(var,rhs) for var in $localVars] => keyedMsgCompFailure("S2IC0010",[rhs]) $declaredMode: local := NIL m:= evaluateType unabbrev rhs not isLegitimateMode(m,NIL,NIL) => throwKeyedMsg("S2IE0004",[m]) --categoryForm?(m) => throwKeyedMsg("S2IE0014",[m]) $declaredMode:= m not atom(lhs) and putTarget(lhs,m) ms := bottomUp lhs first ms ^= m => throwKeyedMsg("S2IC0011",[first ms,m]) putValue(op,getValue lhs) putModeSet(op,ms)
--% Handlers for COERCE
upCOERCE t == -- evaluate the lhs and then tries to coerce the result to the -- mode which is the rhs. -- previous to 5/16/89, this had the same semantics as -- (lhs@rhs) :: rhs -- this must be made explicit now. t isnt [op,lhs,rhs] => nil $useConvertForCoercions : local := true -- do not (yet) support local variables on the rhs (not $genValue) and or/[CONTAINED(var,rhs) for var in $localVars] => keyedMsgCompFailure("S2IC0006",[rhs]) $declaredMode: local := NIL m := evaluateType unabbrev rhs not isLegitimateMode(m,NIL,NIL) => throwKeyedMsg("S2IE0004",[m]) --categoryForm?(m) => throwKeyedMsg("S2IE0014",[m]) $declaredMode:= m -- 05/16/89 (RSS) following line commented out to give correct -- semantic difference between :: and @ bottomUp lhs type:=evalCOERCE(op,lhs,m) putModeSet(op,[type])
boot
 
   >> System error:
   invalid number of arguments: 1
; compiling file "/var/aw/var/LatexWiki/6792422082361307195-25px002.clisp" (written 29 DEC 2008 06:42:04 PM):
; /var/aw/var/LatexWiki/6792422082361307195-25px002.fasl written ; compilation finished in 0:00:00.014
>> System error: The variable |i-analy| is unbound.

fricas
S1 := 1$Species INT
Species is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead? S2 := coerce(S1)@SpeciesCategory(Integer)
An expression involving @ SpeciesCategory(Integer) actually evaluated to one of type None . Perhaps you should use :: SpeciesCategory(Integer) . structures([1])$S2
The function structures is not implemented in NIL . structures([1,2,3])$S2
The function structures is not implemented in NIL . S3 := S1::SpeciesCategory(Integer)
Cannot convert from type Variable(S1) to SpeciesCategory(Integer) for value S1
structures([1])$S3
The function structures is not implemented in NIL . structures([1,2,3])$S3
The function structures is not implemented in NIL .

Type-safe (rep,per) version with equality --Bill Page, Wed, 12 Nov 2008 22:07:43 -0800 reply
The code above appears to be type unsafe because of the use of pretend. OpenAxiom normally expects type-safe code written with rep and per in the following style:
spad
)abb category SPECCAT SpeciesCategory
SpeciesCategory(L: SetCategory): Category == SetCategory with
       structures: Set L -> List %
)abb domain CHARSPEC CharacteristicSpecies CharacteristicSpecies(L: SetCategory, n: Integer): SpeciesCategory L == add Rep == Set L
coerce(t: %): OutputForm == coerce(rep t) x=y == rep(x)=rep(y) structures(s:Set L):List % == if #s = n then [per s] else []
)abb domain SPECIES Species Species(L: SetCategory): Ring with coerce: % -> SpeciesCategory L == add Rep == Domain
coerce(s: %): OutputForm == rep(s)::OutputForm coerce(s: %): SpeciesCategory L == rep(s) pretend SpeciesCategory(L) x=y == rep(x)=rep(y) 0 == per CharacteristicSpecies(L, 0) 1 == per CharacteristicSpecies(L, 1)
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1039357515318325496-25px004.spad
      using old system compiler.
   SPECCAT abbreviates category SpeciesCategory 
------------------------------------------------------------------------
   initializing NRLIB SPECCAT for SpeciesCategory 
   compiling into NRLIB SPECCAT 
;;; *** |SpeciesCategory| REDEFINED Time: 0 SEC.
finalizing NRLIB SPECCAT Processing SpeciesCategory for Browser database: --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/32396914629305039-25px001.spad-->SpeciesCategory(constructor): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/32396914629305039-25px001.spad-->SpeciesCategory((structures ((List %) (Set L)))): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/32396914629305039-25px001.spad-->SpeciesCategory(): Missing Description ; compiling file "/var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT.lsp" (written 16 SEP 2013 05:00:57 PM):
; /var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT.fasl written ; compilation finished in 0:00:00.003 ------------------------------------------------------------------------ SpeciesCategory is already explicitly exposed in frame initial SpeciesCategory will be automatically loaded when needed from /var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT
CHARSPEC abbreviates domain CharacteristicSpecies ------------------------------------------------------------------------ initializing NRLIB CHARSPEC for CharacteristicSpecies compiling into NRLIB CHARSPEC ************* USER ERROR ********** available signatures for Rep: NONE NEED Rep: () -> ? ****** comp fails at level 1 with expression: ****** ((DEF (|Rep|) (NIL) (NIL) (|Set| L))) ****** level 1 ****** $x:= (DEF (Rep) (NIL) (NIL) (Set L)) $m:= $EmptyMode $f:= ((((~= #) (= #) (|coerce| #) (|hash| #) ...)))
>> Apparent user error: unspecified error

fricas
X := 0$Species INT
Species is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead? Y := 1$Species INT
Species is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead? (X=Y)@Boolean

\label{eq1} \mbox{\rm false} (1)
Type: Boolean
fricas
X+Y

\label{eq2}Y + X(2)
Type: Polynomial(Integer)

If a Species is a Ring, how can we define + and *?




  Subject:   Be Bold !!
  ( 13 subscribers )  
Please rate this page: