

last edited 12 years ago by Bill Page 
6  
Editor: Bill Page
Time: 2011/12/11 11:29:04 GMT8 

Note: monad 
changed:  In a domain and in categories referenced in a domain the notation % represents "this domain" (or self in some programming languages). So we commonly write for example:: with f: (%,%) > % to indicate a function f which takes a pair of values in this domain and returns a value in this same domain  whatever domain we happen to be talking about in this context. But what if we are interested in the domain as a functor? Suppose I was writing an "endofunctor" domain constructor like 'Set' and I wanted to treat constructions like 'Set Set R', i.e. sets of sets as something special. E.g. \begin{aldor} )abbrev domain MYSET MySet #pile #include "axiom" MonadCat(T:SetCategory,M:SetCategory>SetCategory):Category == with join: M M T > M T MySet(T:SetCategory): Join(MonadCat(T,MySet),SetAggregate(T)) with finiteAggregate join: MySet MySet T > MySet T == add Rep == List T rep(x:%):Rep == x pretend Rep per(x:Rep):% == x pretend % Rep2 == List List T rep2(x:MySet MySet T):Rep2 == x pretend Rep2 per2(x:Rep2):MySet MySet T == x pretend MySet MySet T coerce(x:%):OutputForm == brace(map(coerce$T, rep x)$ListFunctions2(T,OutputForm)) ((x:%) = (y:%)):Boolean == (rep(x) = rep(y))$Rep construct(x:List T):% == per(removeDuplicates(x)$Rep) parts(x:%):List T == rep x join(x:MySet MySet T):MySet T == construct(concat(rep2 x)$List(T))$% copy(x:%):% == per(copy(rep x)$Rep) empty():% == per(empty()$Rep) map(f:T>T,x:%):% == per(map(f,rep x)$Rep) brace():% == empty()$% brace(x:List(T)):% == construct(x)$% set():% == empty()$% set(x:List(T)):% == construct(x)$%  dummy exports as required by Aldor _<(x:%, y:%):Boolean == true intersect(x:%, y:%):% == empty()$% difference(x:%, y:%):% == empty()$% subset?(x:%, y:%):Boolean == true union(x:%, y:%):% == empty()$% if T has ConvertibleTo(InputForm) then convert(x:%):InputForm == convert(rep(x))$Rep \end{aldor} \begin{axiom} )sh MySet )di op join \end{axiom} \begin{axiom} MySet(Integer) has MonadCat(Integer,MySet) \end{axiom} \begin{axiom} m1:MySet(Integer) := construct([1,2,3])$MySet(Integer) m2:MySet(Integer) := construct([4,5,6])$MySet(Integer) ml:=[m1,m2] mm:MySet MySet Integer := construct([m1,m2])$MySet(MySet(Integer)) join mm \end{axiom}
In a domain and in categories referenced in a domain the notation % represents "this domain" (or self in some programming languages). So we commonly write for example:
with f: (%,%) > %
to indicate a function f which takes a pair of values in this domain and returns a value in this same domain  whatever domain we happen to be talking about in this context.
But what if we are interested in the domain as a functor? Suppose I
was writing an "endofunctor" domain constructor like Set
and I
wanted to treat constructions like Set Set R
, i.e. sets of sets as
something special. E.g.
)abbrev domain MYSET MySet #pile #include "axiom" MonadCat(T:SetCategory,M:SetCategory>SetCategory):Category == with join: M M T > M T
MySet(T:SetCategory): Join(MonadCat(T,MySet), SetAggregate(T)) with finiteAggregate join: MySet MySet T > MySet T == add Rep == List T rep(x:%):Rep == x pretend Rep per(x:Rep):% == x pretend %
Rep2 == List List T rep2(x:MySet MySet T):Rep2 == x pretend Rep2 per2(x:Rep2):MySet MySet T == x pretend MySet MySet T
coerce(x:%):OutputForm == brace(map(coerce$T,rep x)$ListFunctions2(T, OutputForm)) ((x:%) = (y:%)):Boolean == (rep(x) = rep(y))$Rep construct(x:List T):% == per(removeDuplicates(x)$Rep) parts(x:%):List T == rep x join(x:MySet MySet T):MySet T == construct(concat(rep2 x)$List(T))$%
copy(x:%):% == per(copy(rep x)$Rep) empty():% == per(empty()$Rep) map(f:T>T,x:%):% == per(map(f, rep x)$Rep) brace():% == empty()$% brace(x:List(T)):% == construct(x)$% set():% == empty()$% set(x:List(T)):% == construct(x)$%
 dummy exports as required by Aldor _<(x:%,y:%):Boolean == true intersect(x:%, y:%):% == empty()$% difference(x:%, y:%):% == empty()$% subset?(x:%, y:%):Boolean == true union(x:%, y:%):% == empty()$% if T has ConvertibleTo(InputForm) then convert(x:%):InputForm == convert(rep(x))$Rep
Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiomwiki/var/LatexWiki/883507952219038241925px001.as using AXIOMXL compiler and options O Fasy Fao Flsp laxiom MnoALDOR_W_WillObsolete DAxiom Y $AXIOM/algebra I $AXIOM/algebra Use the system command )set compiler args to change these options. #1 (Warning) Could not use archive file `libaxiom.al'. #2 (Warning) Could not use archive file `libaxiom.al'. "/usr/local/aldor/linux/1.1.0/include/axiom.as",line 4: import from AxiomLib; ............^ [L4 C13] #3 (Error) No meaning for identifier `AxiomLib'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as",line 15: import { true: %, false: % } from Boolean; ..................................^ [L15 C35] #4 (Error) No meaning for identifier `Boolean'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as",line 17: string: Literal > %; ........................^.......^ [L17 C25] #5 (Error) No meaning for identifier `Literal'. [L17 C33] #6 (Error) There are no suitable meanings for the operator `>'.
"/usr/local/aldor/linux/1.1.0/include/axiom.as",line 18: } from String; .......^ [L18 C8] #8 (Error) No meaning for identifier `String'.
"/var/lib/zope2.10/instance/axiomwiki/var/LatexWiki/883507952219038241925px001.as",line 4: MonadCat(T:SetCategory, M:SetCategory>SetCategory):Category == with .........^.^........................^ [L4 C10] #12 (Error) Have determined 1 possible types for the expression. Meaning 1: ?, ? The context requires an expression of type Tuple(Type). [L4 C12] #9 (Error) No meaning for identifier `SetCategory'. [L4 C37] #10 (Error) There are no suitable meanings for the operator `>'. [L4 C37] #13 (Fatal Error) Too many errors (use `M emax=n' or `M noemax' to change the limit).
The )library system command was not called after compilation.
)sh MySet
The )show system command is used to display information about types or partial types. For example,)show Integer will show information about Integer .
MySet is not the name of a known type constructor. If you want to see information about any operations named MySet ,issue )display operations MySet
)di op join
There are 2 unexposed functions called join : [1] (JetDifferentialEquation(D1,D2), JetDifferentialEquation(D1, D2)) > JetDifferentialEquation(D1, D2) from JetDifferentialEquation(D1, D2) if D1 has JBC and D2 has JBFC(D1) [2] (SparseEchelonMatrix(D1, D2), SparseEchelonMatrix(D1, D2)) > SparseEchelonMatrix(D1, D2) from SparseEchelonMatrix(D1, D2) if D1 has ORDSET and D2 has RING
MySet(Integer) has MonadCat(Integer,MySet)
There are no library operations named MySet Use HyperDoc Browse or issue )what op MySet to learn if there is any operation containing " MySet " in its name.
Cannot find a definition or applicable library operation named MySet with argument type(s) Type
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.
m1:MySet(Integer) := construct([1,2, 3])$MySet(Integer)
There are no library operations named MySet Use HyperDoc Browse or issue )what op MySet to learn if there is any operation containing " MySet " in its name.
Cannot find a definition or applicable library operation named MySet with argument type(s) Type
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need. m2:MySet(Integer) := construct([4, 5, 6])$MySet(Integer)
There are no library operations named MySet Use HyperDoc Browse or issue )what op MySet to learn if there is any operation containing " MySet " in its name.
Cannot find a definition or applicable library operation named MySet with argument type(s) Type
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need. ml:=[m1, m2]
(1) 
mm:MySet MySet Integer := construct([m1,m2])$MySet(MySet(Integer))
There are no library operations named MySet Use HyperDoc Browse or issue )what op MySet to learn if there is any operation containing " MySet " in its name.
Cannot find a definition or applicable library operation named MySet with argument type(s) Type
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need. join mm
There are no exposed library operations named join but there are 2 unexposed operations with that name. Use HyperDoc Browse or issue )display op join to learn more about the available operations.
Cannot find a definition or applicable library operation named join with argument type(s) Variable(mm)
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.