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.01 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 04 APR 2022 07:03:48 PM):
; /var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT.fasl written ; compilation finished in 0:00:00.005 ------------------------------------------------------------------------ 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(): Missing Description ; compiling file "/var/aw/var/LatexWiki/CHARSPEC.NRLIB/CHARSPEC.lsp" (written 04 APR 2022 07:03:48 PM):
; /var/aw/var/LatexWiki/CHARSPEC.NRLIB/CHARSPEC.fasl written ; compilation finished in 0:00:00.014 ------------------------------------------------------------------------ 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 Local variable Rep type redefined: (Category) to (FiniteSetAggregate L) compiling exported coerce : $ -> OutputForm Time: 0.01 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| #) (~= #) (= #) (|coerce| #) ...)))
>> 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
ERROR IN LINE 20
  first ms ^= m =>
............|
syntax error
ignored from line 20
  first ms ^= m =>
..|
ignored through line 21
    throwKeyedMsg("S2IC0011",[first ms,m])
.........................................|
6792422082361307195-25px002.clisp PRODUCED
; compiling file "/var/aw/var/LatexWiki/6792422082361307195-25px002.clisp" (written 04 APR 2022 07:03:48 PM):
; /var/aw/var/LatexWiki/6792422082361307195-25px002.fasl written ; compilation finished in 0:00:00.013
>> 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?

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.01 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 04 APR 2022 07:03:48 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?

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




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