|
|
|
last edited 17 years ago by Bill Page |
| 1 2 3 4 | ||
|
Editor: Bill Page
Time: 2008/11/12 22:07:50 GMT-8 |
||
| Note: Type-safe (rep,per) version with equality | ||
(1) -> <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 10 JAN 2025 07:11:05 PM):
; wrote /var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT.fasl
; compilation finished in 0:00:00.004
------------------------------------------------------------------------
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 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 10 JAN 2025 07:11:05 PM):
; wrote /var/aw/var/LatexWiki/CHARSPEC.NRLIB/CHARSPEC.fasl
; compilation finished in 0:00:00.012
------------------------------------------------------------------------
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 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.
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])
The file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6792422082361307195-25px002.boot
is needed but does not exist.S1 := 1$Species INT
Species is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead?
pretend. OpenAxiom normally expects type-safe code written with rep and per in the following style:
)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)
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 10 JAN 2025 07:11:05 PM):
; wrote /var/aw/var/LatexWiki/SPECCAT.NRLIB/SPECCAT.fasl
; compilation finished in 0:00:00.000
------------------------------------------------------------------------
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) (|Set| L)))
****** level 1 ******
$x:= (DEF (Rep) (NIL) (Set L))
$m:= $EmptyMode
$f:=
((((~= #) (= #) (|coerce| #) (|latex| #) ...)))
>> Apparent user error:
unspecified errorX := 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 *?