|
|
|
last edited 13 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 12:46:05 GMT-7 |
||
| Note: | ||
added:
From BillPage Tue May 27 12:46:05 -0700 2008
From: Bill Page
Date: Tue, 27 May 2008 12:46:05 -0700
Subject:
Message-ID: <20080527124605-0700@axiom-wiki.newsynthesis.org>
Yes, I understand the meaning of 'Type', but "earlier":http://axiom-wiki.newsynthesis.org/SandBoxMaybe#msg20080526202503-0700@axiom-wiki.newsynthesis.org in this thread shows the error message::
System error:
The variable T$ is unbound.
This page is running OpenAxiom:
\begin{axiom}
)version
\end{axiom}
(1) -> <spad>
)abbrev domain MAYBE Maybe Maybe(T: Type) == Union(T,"failed")</spad>
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3867167196268790065-25px001.spad
using old system compiler.
MAYBE abbreviates domain Maybe
------------------------------------------------------------------------
initializing NRLIB MAYBE for Maybe
compiling into NRLIB MAYBE
****** comp fails at level 1 with expression: ******
((|UnionCategory| T$ "failed"))
****** level 1 ******
x:= (UnionCategory T$ failed)
m:= $EmptyMode
f:=
((((T$ # #) (|$DomainsInScope| # #))))
>> Apparent user error:
cannot compile (UnionCategory T$ failed))abbrev domain MAYBE Maybe Maybe(T: Type):Type == Union(T,"failed")
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6798525157762352212-25px002.spad
using old system compiler.
MAYBE abbreviates domain Maybe
------------------------------------------------------------------------
initializing NRLIB MAYBE for Maybe
compiling into NRLIB MAYBE
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
; compiling file "/var/aw/var/LatexWiki/MAYBE.NRLIB/MAYBE.lsp" (written 15 SEP 2026 05:10:50 AM):
; wrote /var/aw/var/LatexWiki/MAYBE.NRLIB/MAYBE.fasl
; compilation finished in 0:00:00.000
------------------------------------------------------------------------
Maybe is now explicitly exposed in frame initial
Maybe will be automatically loaded when needed from
/var/aw/var/LatexWiki/MAYBE.NRLIB/MAYBE)show MaybeNo, there should not be a need for specifying result type. In fact, if you specify "Type" as result type, you explicitly ask for not having any exported operation. That wasn't the intent. The intent was to get whatever the right hand side exported as exports. Such as in
Maybe(T$: Type) is a domain constructor Abbreviation for Maybe is MAYBE This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
)abbrev domain MYFIELD MyField MyField() == Fraction Integer
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/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)
****** Domain: (Integer) already in scope
augmenting (Integer): (ConvertibleTo (Pattern (Float)))
****** Domain: (Integer) already in scope
augmenting (Integer): (Eltable (Integer) (Integer))
****** Domain: (Integer) already in scope
augmenting (Integer): (Evalable (Integer))
****** Domain: (Integer) already in scope
augmenting (Integer): (InnerEvalable (Symbol) (Integer))
****** Domain: (Integer) already in scope
augmenting (Integer): (PartialDifferentialRing (Symbol))
****** Domain: (Integer) already in scope
augmenting (Integer): (PatternMatchable (Float))
****** Domain: (Integer) already in scope
augmenting (Integer): (RetractableTo (Symbol))
(time taken in buildFunctor: 30722)
Time: 0.07 SEC.
Cumulative Statistics for Constructor MyField
Time: 0.07 seconds
finalizing NRLIB MYFIELD
Processing MyField for Browser database:
--->-->MyField(): Missing Description
; compiling file "/var/aw/var/LatexWiki/MYFIELD.NRLIB/MYFIELD.lsp" (written 15 SEP 2026 05:10:50 AM):
; wrote /var/aw/var/LatexWiki/MYFIELD.NRLIB/MYFIELD.fasl
; compilation finished in 0:00:00.004
------------------------------------------------------------------------
MyField is now explicitly exposed in frame initial
MyField will be automatically loaded when needed from
/var/aw/var/LatexWiki/MYFIELD.NRLIB/MYFIELD)sh MyFieldMacro versus domain
MyField is a domain constructor. Abbreviation for MyField is MYFIELD This constructor is exposed in this frame. 87 names for 120 operations in this domain. ------------------------------- Operations --------------------------------
0 : () -> % 1 : () -> % ?*? : (%,%) -> % ?*? : (%, Integer) -> % ?*? : (Integer, %) -> % ?*? : (PositiveInteger, %) -> % ?+? : (%, %) -> % -? : % -> % ?-? : (%, %) -> % ?/? : (%, %) -> % ?/? : (Integer, Integer) -> % ?<? : (%, %) -> Boolean ?<=? : (%, %) -> Boolean ?=? : (%, %) -> Boolean ?>? : (%, %) -> Boolean ?>=? : (%, %) -> Boolean D : % -> % D : (%, NonNegativeInteger) -> % OMwrite : % -> String OMwrite : (%, Boolean) -> String ?^? : (%, Integer) -> % ?^? : (%, PositiveInteger) -> % abs : % -> % annihilate? : (%, %) -> Boolean antiCommutator : (%, %) -> % associates? : (%, %) -> Boolean associator : (%, %, %) -> % ceiling : % -> Integer coerce : % -> % coerce : Fraction(Integer) -> % coerce : Integer -> % coerce : % -> OutputForm commutator : (%, %) -> % convert : % -> DoubleFloat convert : % -> Float convert : % -> InputForm convert : % -> Pattern(Integer) denom : % -> Integer denominator : % -> % differentiate : % -> % factor : % -> Factored(%) floor : % -> Integer fractionPart : % -> % gcd : (%, %) -> % gcd : List(%) -> % hash : % -> SingleInteger init : () -> % inv : % -> % latex : % -> String lcm : (%, %) -> % lcm : List(%) -> % max : (%, %) -> % min : (%, %) -> % negative? : % -> Boolean numer : % -> Integer numerator : % -> % one? : % -> Boolean opposite? : (%, %) -> Boolean positive? : % -> Boolean prime? : % -> Boolean ?quo? : (%, %) -> % recip : % -> Union(%, "failed") ?rem? : (%, %) -> % retract : % -> Fraction(Integer) retract : % -> Integer sample : () -> % sign : % -> Integer sizeLess? : (%, %) -> Boolean smaller? : (%, %) -> Boolean squareFree : % -> Factored(%) squareFreePart : % -> % unit? : % -> Boolean unitCanonical : % -> % wholePart : % -> Integer zero? : % -> Boolean ?~=? : (%, %) -> Boolean ?*? : (%, Fraction(Integer)) -> % ?*? : (Fraction(Integer), %) -> % ?*? : (NonNegativeInteger, %) -> % D : (%, (Integer -> Integer)) -> % D : (%, (Integer -> Integer), NonNegativeInteger) -> % OMwrite : (OpenMathDevice, %) -> Void OMwrite : (OpenMathDevice, %, Boolean) -> Void ?^? : (%, NonNegativeInteger) -> % characteristic : () -> NonNegativeInteger differentiate : (%, (Integer -> Integer)) -> % differentiate : (%, (Integer -> Integer), NonNegativeInteger) -> % differentiate : (%, NonNegativeInteger) -> % divide : (%, %) -> Record(quotient: %, remainder: %) euclideanSize : % -> NonNegativeInteger expressIdealMember : (List(%), %) -> Union(List(%), "failed") ?exquo? : (%, %) -> Union(%, "failed") extendedEuclidean : (%, %) -> Record(coef1: %, coef2: %, generator: %) extendedEuclidean : (%, %, %) -> Union(Record(coef1: %, coef2: %), "failed") factorFraction : % -> Fraction(Factored(Integer)) factorPolynomial : SparseUnivariatePolynomial(%) -> Factored(SparseUnivariatePolynomial(%)) factorSquareFreePolynomial : SparseUnivariatePolynomial(%) -> Factored(SparseUnivariatePolynomial(%)) gcdPolynomial : (SparseUnivariatePolynomial(%), SparseUnivariatePolynomial(%)) -> SparseUnivariatePolynomial(%) hashUpdate! : (HashState, %) -> HashState lcmCoef : (%, %) -> Record(llcm_res: %, coeff1: %, coeff2: %) leftPower : (%, NonNegativeInteger) -> % leftPower : (%, PositiveInteger) -> % leftRecip : % -> Union(%, "failed") map : ((Integer -> Integer), %) -> % multiEuclidean : (List(%), %) -> Union(List(%), "failed") nextItem : % -> Union(%, "failed") patternMatch : (%, Pattern(Integer), PatternMatchResult(Integer, %)) -> PatternMatchResult(Integer, %) plenaryPower : (%, PositiveInteger) -> % principalIdeal : List(%) -> Record(coef: List(%), generator: %) reducedSystem : Matrix(%) -> Matrix(Integer) reducedSystem : (Matrix(%), Vector(%)) -> Record(mat: Matrix(Integer), vec: Vector(Integer)) retractIfCan : % -> Union(Fraction(Integer), "failed") retractIfCan : % -> Union(Integer, "failed") rightPower : (%, NonNegativeInteger) -> % rightPower : (%, PositiveInteger) -> % rightRecip : % -> Union(%, "failed") solveLinearPolynomialEquation : (List(SparseUnivariatePolynomial(%)), SparseUnivariatePolynomial(%)) -> Union(List(SparseUnivariatePolynomial(%)), "failed") squareFreePolynomial : SparseUnivariatePolynomial(%) -> Factored(SparseUnivariatePolynomial(%)) subtractIfCan : (%, %) -> Union(%, "failed") unitNormal : % -> Record(unit: %, canonical: %, associate: %)
macro Maybe(T) == Union(T,"failed")
)sh Maybe(Integer)
Union(Integer,"failed") is a domain constructor. 5 names for 11 operations in this domain. ------------------------------- Operations --------------------------------
?=? : (%,%) -> Boolean autoCoerce : failed -> % autoCoerce : Integer -> % autoCoerce : % -> failed autoCoerce : % -> Integer ?case? : (%, failed) -> Boolean ?case? : (%, Integer) -> Boolean coerce : % -> failed coerce : % -> Integer coerce : % -> OutputForm ?~=? : (%, %) -> Boolean
x:Maybe(Integer)
x:=-3
| (1) |
)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/lib/zope2.10/instance/axiom-wiki/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)
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(constructor): Not documented!!!!
--->-->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(): Missing Description
; compiling file "/var/aw/var/LatexWiki/MAYBE2.NRLIB/MAYBE2.lsp" (written 15 SEP 2026 05:10:50 AM):
; wrote /var/aw/var/LatexWiki/MAYBE2.NRLIB/MAYBE2.fasl
; compilation finished in 0:00:00.004
------------------------------------------------------------------------
Maybe2 is now explicitly exposed in frame initial
Maybe2 will be automatically loaded when needed from
/var/aw/var/LatexWiki/MAYBE2.NRLIB/MAYBE2)show Maybe2
Maybe2(T$: Type) is a domain constructor Abbreviation for Maybe2 is MAYBE2 This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
?=? : (%,%) -> Boolean autoCoerce : % -> failed autoCoerce : % -> T$ autoCoerce : failed -> % autoCoerce : T$ -> % ?case? : (%, failed) -> Boolean ?case? : (%, T$) -> Boolean coerce : % -> failed coerce : % -> T$ coerce : % -> OutputForm coerce : T$ -> %
y:Maybe2(Integer)
y:=-3But, the use of macro is a workaround a fundamental problem in the compiler -- which I'm desperately trying to convey. This and the original bug comes from the same source in the compiler. I agree. I am just trying to understand it.
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")Remember that Type is a category that exports no operation. so when you say
Maybe(T: Type): Type, you are exlicitly saying that Maybe(T: Type) is a domain
constructor that exports no operation. Indeed, if you try )show
with OpenAxiom?, you will see that it say, Maybe has no exported operations.
Which is right.
However, when one says Maybe(T: Type) == Union(T, "failed"), one is saying
that Maybe(T) is exactly like Union(T,"failed"), except for the name.
Consequently, Maybe has the exports inferred from the right hand side.
This works for all domains, except the `builtin' domains. If you
try Record or Enumeration, you should hit a bug in the compiler at some
point.
Type, but earlier in this thread shows the error message:
System error: The variable T$ is unbound.
This page is running OpenAxiom?:
)version
"FriCAS 1.3.12 compiled at Sat 7 Jun 23:54:49 CEST 2025"