|
|
last edited 11 years ago by Bill Page |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ||
Editor: Bill Page
Time: 2008/05/27 08:06:29 GMT-7 |
||
Note: Re: problem in the compiler |
added:
From BillPage Tue May 27 08:06:29 -0700 2008
From: Bill Page
Date: Tue, 27 May 2008 08:06:29 -0700
Subject: Re: problem in the compiler
Message-ID: <20080527080629-0700@axiom-wiki.newsynthesis.org>
I agree. I am just trying to understand it.
Why does::
Maybe(T: Type) == Union(T,"failed")
and::
Maybe(T: Type):Type == Union(T,"failed")
have such different semantics? Is this a good thing? Maybe there is a need for something that stands for the type of the rhs::
Maybe(T: Type):rhs == Union(T,"failed")
spad)abbrev domain MAYBE Maybe Maybe(T: Type) == Union(T,"failed")
Compiling FriCAS source code from file /var/zope2/var/LatexWiki/3867167196268790065-25px001.spad using old system compiler. MAYBE abbreviates domain Maybe ------------------------------------------------------------------------ initializing NRLIB MAYBE for Maybe compiling into NRLIB MAYBE ;;; *** |Maybe| REDEFINED ;;; *** |Maybe| REDEFINED Time: 0 SEC. Cumulative Statistics for Constructor Maybe Time: 0 seconds >> System error: code vector slot is (Boolean) ; must be number
spad)abbrev domain MAYBE Maybe Maybe(T: Type):Type == Union(T,"failed")
Compiling FriCAS source code from file /var/zope2/var/LatexWiki/6798525157762352212-25px002.spad using old system compiler. MAYBE abbreviates domain Maybe ------------------------------------------------------------------------ initializing NRLIB MAYBE for Maybe compiling into NRLIB MAYBE ;;; *** |Maybe| REDEFINED ;;; *** |Maybe| REDEFINED Time: 0 SEC. Cumulative Statistics for Constructor Maybe Time: 0 seconds --------------non extending category---------------------- .. Maybe #1 of cat (|Type|) has no (|UnionCategory| |#1| "failed") finalizing NRLIB MAYBE Processing Maybe for Browser database: --->-->Maybe(): Missing Description ------------------------------------------------------------------------ Maybe is now explicitly exposed in frame initial Maybe will be automatically loaded when needed from /var/zope2/var/LatexWiki/MAYBE.NRLIB/code
axiom)show Maybe Maybe T$: Type is a domain constructor Abbreviation for Maybe is MAYBE This constructor is exposed in this frame. Issue )edit /var/zope2/var/LatexWiki/6798525157762352212-25px002.spad to see algebra source code for MAYBE ------------------------------- Operations -------------------------------- >> System error: The variable T$ is unbound.
spad)abbrev domain MYFIELD MyField MyField() == Fraction Integer
Compiling FriCAS source code from file /var/zope2/var/LatexWiki/2205496008028295448-25px004.spad using old system compiler. MYFIELD abbreviates domain MyField ------------------------------------------------------------------------ initializing NRLIB MYFIELD for MyField compiling into NRLIB MYFIELD ****** Domain: $ already in scope augmenting $: (CharacteristicNonZero) augmenting (Integer): (PolynomialFactorizationExplicit) ****** Domain: $ already in scope augmenting $: (CharacteristicNonZero) augmenting (Integer): (PolynomialFactorizationExplicit) augmenting (Integer): (ConvertibleTo (Pattern (Float))) augmenting (Integer): (Eltable (Integer) (Integer)) augmenting (Integer): (Evalable (Integer)) augmenting (Integer): (InnerEvalable (Symbol) (Integer)) augmenting (Integer): (PartialDifferentialRing (Symbol)) augmenting (Integer): (PatternMatchable (Float)) augmenting (Integer): (PolynomialFactorizationExplicit) augmenting (Integer): (RetractableTo (Symbol)) (time taken in buildFunctor: 51) ;;; *** |MyField| REDEFINED ;;; *** |MyField| REDEFINED Time: 0.91 SEC. Cumulative Statistics for Constructor MyField Time: 0.91 seconds finalizing NRLIB MYFIELD Processing MyField for Browser database: --->-->MyField(): Missing Description ------------------------------------------------------------------------ MyField is now explicitly exposed in frame initial MyField will be automatically loaded when needed from /var/zope2/var/LatexWiki/MYFIELD.NRLIB/code
axiom)sh MyField MyField is a domain constructor Abbreviation for MyField is MYFIELD This constructor is exposed in this frame. Issue )edit /var/zope2/var/LatexWiki/2205496008028295448-25px004.spad to see algebra source code for MYFIELD ------------------------------- Operations -------------------------------- ?*? : (%,Integer) -> % ?*? : (Integer,%) -> % ?*? : (Fraction Integer,%) -> % ?*? : (%,Fraction Integer) -> % ?*? : (%,%) -> % ?*? : (Integer,%) -> % ?*? : (PositiveInteger,%) -> % ?**? : (%,Integer) -> % ?**? : (%,PositiveInteger) -> % ?+? : (%,%) -> % ?-? : (%,%) -> % -? : % -> % ?/? : (Integer,Integer) -> % ?/? : (%,%) -> % ?=? : (%,%) -> Boolean 1 : () -> % 0 : () -> % ?^? : (%,Integer) -> % ?^? : (%,PositiveInteger) -> % associates? : (%,%) -> Boolean coerce : Integer -> % coerce : Fraction Integer -> % coerce : % -> % coerce : Integer -> % coerce : % -> OutputForm denom : % -> Integer denominator : % -> % factor : % -> Factored % gcd : List % -> % gcd : (%,%) -> % hash : % -> SingleInteger inv : % -> % latex : % -> String lcm : List % -> % lcm : (%,%) -> % numer : % -> Integer numerator : % -> % one? : % -> Boolean prime? : % -> Boolean ?quo? : (%,%) -> % recip : % -> Union(%,"failed") ?rem? : (%,%) -> % retract : % -> Integer sample : () -> % sizeLess? : (%,%) -> Boolean squareFree : % -> Factored % squareFreePart : % -> % unit? : % -> Boolean unitCanonical : % -> % zero? : % -> Boolean ?~=? : (%,%) -> Boolean ?*? : (NonNegativeInteger,%) -> % ?**? : (%,NonNegativeInteger) -> % ?<? : (%,%) -> Boolean if Integer has ORDSET ?<=? : (%,%) -> Boolean if Integer has ORDSET ?>? : (%,%) -> Boolean if Integer has ORDSET ?>=? : (%,%) -> Boolean if Integer has ORDSET D : (%,(Integer -> Integer)) -> % D : (%,(Integer -> Integer),NonNegativeInteger) -> % D : (%,List Symbol,List NonNegativeInteger) -> % if Integer has PDRING SYMBOL D : (%,Symbol,NonNegativeInteger) -> % if Integer has PDRING SYMBOL D : (%,List Symbol) -> % if Integer has PDRING SYMBOL D : (%,Symbol) -> % if Integer has PDRING SYMBOL D : (%,NonNegativeInteger) -> % if Integer has DIFRING D : % -> % if Integer has DIFRING OMwrite : (OpenMathDevice,%,Boolean) -> Void if Integer has INS and Integer has OM OMwrite : (OpenMathDevice,%) -> Void if Integer has INS and Integer has OM OMwrite : (%,Boolean) -> String if Integer has INS and Integer has OM OMwrite : % -> String if Integer has INS and Integer has OM ?^? : (%,NonNegativeInteger) -> % abs : % -> % if Integer has OINTDOM ceiling : % -> Integer if Integer has INS characteristic : () -> NonNegativeInteger charthRoot : % -> Union(%,"failed") if $ has CHARNZ and Integer has PFECAT or Integer has CHARNZ coerce : Symbol -> % if Integer has RETRACT SYMBOL conditionP : Matrix % -> Union(Vector %,"failed") if $ has CHARNZ and Integer has PFECAT convert : % -> DoubleFloat if Integer has REAL convert : % -> Float if Integer has REAL convert : % -> InputForm if Integer has KONVERT INFORM convert : % -> Pattern Float if Integer has KONVERT PATTERN FLOAT convert : % -> Pattern Integer if Integer has KONVERT PATTERN INT differentiate : (%,(Integer -> Integer)) -> % differentiate : (%,(Integer -> Integer),NonNegativeInteger) -> % differentiate : (%,List Symbol,List NonNegativeInteger) -> % if Integer has PDRING SYMBOL differentiate : (%,Symbol,NonNegativeInteger) -> % if Integer has PDRING SYMBOL differentiate : (%,List Symbol) -> % if Integer has PDRING SYMBOL differentiate : (%,Symbol) -> % if Integer has PDRING SYMBOL differentiate : (%,NonNegativeInteger) -> % if Integer has DIFRING differentiate : % -> % if Integer has DIFRING divide : (%,%) -> Record(quotient: %,remainder: %) ?.? : (%,Integer) -> % if Integer has ELTAB(INT,INT) euclideanSize : % -> NonNegativeInteger eval : (%,Symbol,Integer) -> % if Integer has IEVALAB(SYMBOL,INT) eval : (%,List Symbol,List Integer) -> % if Integer has IEVALAB(SYMBOL,INT) eval : (%,List Equation Integer) -> % if Integer has EVALAB INT eval : (%,Equation Integer) -> % if Integer has EVALAB INT eval : (%,Integer,Integer) -> % if Integer has EVALAB INT eval : (%,List Integer,List Integer) -> % if Integer has EVALAB INT expressIdealMember : (List %,%) -> Union(List %,"failed") exquo : (%,%) -> Union(%,"failed") extendedEuclidean : (%,%,%) -> Union(Record(coef1: %,coef2: %),"failed") extendedEuclidean : (%,%) -> Record(coef1: %,coef2: %,generator: %) factorPolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if Integer has PFECAT factorSquareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if Integer has PFECAT floor : % -> Integer if Integer has INS fractionPart : % -> % if Integer has EUCDOM gcdPolynomial : (SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> SparseUnivariatePolynomial % init : () -> % if Integer has STEP map : ((Integer -> Integer),%) -> % max : (%,%) -> % if Integer has ORDSET min : (%,%) -> % if Integer has ORDSET multiEuclidean : (List %,%) -> Union(List %,"failed") negative? : % -> Boolean if Integer has OINTDOM nextItem : % -> Union(%,"failed") if Integer has STEP patternMatch : (%,Pattern Float,PatternMatchResult(Float,%)) -> PatternMatchResult(Float,%) if Integer has PATMAB FLOAT patternMatch : (%,Pattern Integer,PatternMatchResult(Integer,%)) -> PatternMatchResult(Integer,%) if Integer has PATMAB INT positive? : % -> Boolean if Integer has OINTDOM principalIdeal : List % -> Record(coef: List %,generator: %) random : () -> % if Integer has INS reducedSystem : Matrix % -> Matrix Integer reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix Integer,vec: Vector Integer) reducedSystem : (Matrix %,Vector %) -> Record(mat: Matrix Integer,vec: Vector Integer) if Integer has LINEXP INT reducedSystem : Matrix % -> Matrix Integer if Integer has LINEXP INT retract : % -> Integer if Integer has RETRACT INT retract : % -> Fraction Integer if Integer has RETRACT INT retract : % -> Symbol if Integer has RETRACT SYMBOL retractIfCan : % -> Union(Integer,"failed") if Integer has RETRACT INT retractIfCan : % -> Union(Fraction Integer,"failed") if Integer has RETRACT INT retractIfCan : % -> Union(Symbol,"failed") if Integer has RETRACT SYMBOL retractIfCan : % -> Union(Integer,"failed") sign : % -> Integer if Integer has OINTDOM solveLinearPolynomialEquation : (List SparseUnivariatePolynomial %,SparseUnivariatePolynomial %) -> Union(List SparseUnivariatePolynomial %,"failed") if Integer has PFECAT squareFreePolynomial : SparseUnivariatePolynomial % -> Factored SparseUnivariatePolynomial % if Integer has PFECAT subtractIfCan : (%,%) -> Union(%,"failed") unitNormal : % -> Record(unit: %,canonical: %,associate: %) wholePart : % -> Integer if Integer has EUCDOM
axiommacro Maybe(T) == Union(T,"failed")
axiom)sh Maybe(Integer) Union(Integer,"failed") is a domain constructor. ------------------------------- Operations -------------------------------- ?=? : (%,%) -> Boolean autoCoerce : % -> failed autoCoerce : % -> Integer autoCoerce : failed -> % autoCoerce : Integer -> % ?case? : (%,failed) -> Boolean ?case? : (%,Integer) -> Boolean coerce : % -> failed coerce : % -> Integer coerce : % -> OutputForm
axiomx:Maybe(Integer)
axiomx:=-3
(1) |
spad)abbrev domain MAYBE2 Maybe2 Maybe2(T: Type):with _= : (%,%) -> Boolean autoCoerce : % -> failed autoCoerce : % -> T autoCoerce : failed -> % autoCoerce : T -> % _case: (%,failed) -> Boolean _case: (%,T) -> Boolean coerce : % -> failed coerce : % -> T coerce : % -> OutputForm coerce : T -> % == Union(T,"failed") add coerce(x:T):% == autoCoerce(x)
Compiling FriCAS source code from file /var/zope2/var/LatexWiki/7945389118523770429-25px008.spad using old system compiler. MAYBE2 abbreviates domain Maybe2 ------------------------------------------------------------------------ initializing NRLIB MAYBE2 for Maybe2 compiling into NRLIB MAYBE2 compiling exported coerce : T$ -> $ Time: 0 SEC. (time taken in buildFunctor: 0) ;;; *** |Maybe2| REDEFINED ;;; *** |Maybe2| REDEFINED Time: 0 SEC. Cumulative Statistics for Constructor Maybe2 Time: 0 seconds --------------non extending category---------------------- .. Maybe2 #1 of cat (CATEGORY |domain| (SIGNATURE = ((|Boolean|) $ $)) (SIGNATURE |autoCoerce| (|failed| $)) (SIGNATURE |autoCoerce| (|#1| $)) (SIGNATURE |autoCoerce| ($ |failed|)) (SIGNATURE |autoCoerce| ($ |#1|)) (SIGNATURE |case| ((|Boolean|) $ |failed|)) (SIGNATURE |case| ((|Boolean|) $ |#1|)) (SIGNATURE |coerce| (|failed| $)) (SIGNATURE |coerce| (|#1| $)) (SIGNATURE |coerce| ((|OutputForm|) $)) (SIGNATURE |coerce| ($ |#1|))) has no (|UnionCategory| |#1| "failed") finalizing NRLIB MAYBE2 Processing Maybe2 for Browser database: --->-->Maybe2((= ((Boolean) % %))): Not documented!!!! --->-->Maybe2((autoCoerce (failed %))): Not documented!!!! --->-->Maybe2((autoCoerce (T$ %))): Not documented!!!! --->-->Maybe2((autoCoerce (% failed))): Not documented!!!! --->-->Maybe2((autoCoerce (% T$))): Not documented!!!! --->-->Maybe2((case ((Boolean) % failed))): Not documented!!!! --->-->Maybe2((case ((Boolean) % T$))): Not documented!!!! --->-->Maybe2((coerce (failed %))): Not documented!!!! --->-->Maybe2((coerce (T$ %))): Not documented!!!! --->-->Maybe2((coerce ((OutputForm) %))): Not documented!!!! --->-->Maybe2((coerce (% T$))): Not documented!!!! --->-->Maybe2(constructor): Not documented!!!! --->-->Maybe2(): Missing Description ------------------------------------------------------------------------ Maybe2 is now explicitly exposed in frame initial Maybe2 will be automatically loaded when needed from /var/zope2/var/LatexWiki/MAYBE2.NRLIB/code
axiom)show Maybe2 Maybe2 T$: Type is a domain constructor Abbreviation for Maybe2 is MAYBE2 This constructor is exposed in this frame. Issue )edit /var/zope2/var/LatexWiki/7945389118523770429-25px008.spad to see algebra source code for MAYBE2 ------------------------------- Operations -------------------------------- ?=? : (%,%) -> Boolean autoCoerce : % -> failed autoCoerce : % -> T$ autoCoerce : failed -> % autoCoerce : T$ -> % ?case? : (%,failed) -> Boolean ?case? : (%,T$) -> Boolean coerce : % -> failed coerce : % -> T$ coerce : % -> OutputForm coerce : T$ -> %
axiomy:Maybe2(Integer)
axiomy:=-3 Function: autoCoerce : Integer -> % is missing from domain: Maybe2 Integer Internal Error The function autoCoerce with signature $(Integer) is missing from domain Maybe2(Integer)
Why does:
Maybe(T: Type) == Union(T,"failed")
and:
Maybe(T: Type):Type == Union(T,"failed")
have such different semantics? Is this a good thing? Maybe there is a need for something that stands for the type of the rhs:
Maybe(T: Type):rhs == Union(T,"failed")