login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Using OpenAxiom

fricas
(1) -> )version
"FriCAS 1.3.10 compiled at Wed 10 Jan 02:19:45 CET 2024"

spad
)abbrev domain MORPH Morphism
T ==> SetCategory
Morphism(source:T, target:T): with
  domain:%->T
  codomain:%->T
  coerce:(source->target)  -> %
  coerce:%->(source->target)
  coerce:%->OutputForm
  elt:(%,source)->target
 == (source->target) add
  -- Rep == (source->target)
  Rep == SExpression
  domain(p:%):T == source
  codomain(p:%):T == target
  coerce(r:(source->target)):% == per(r pretend SExpression)
  coerce(p:%):(source->target) == (rep(p) pretend (source->target))
  coerce(p:%):OutputForm == p pretend OutputForm
  elt(f,x) == (rep(f) pretend (source->target))(x)
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6008188987750019428-25px002.spad
      using old system compiler.
   MORPH abbreviates domain Morphism 
------------------------------------------------------------------------
   initializing NRLIB MORPH for Morphism 
   compiling into NRLIB MORPH 
************* USER ERROR **********
available signatures for Rep: 
    NONE
NEED Rep: () -> ?
****** comp fails at level 1 with expression: ******
((DEF (|Rep|) (NIL) (|SExpression|)))
****** level 1  ******
$x:= (DEF (Rep) (NIL) (SExpression))
$m:= $EmptyMode
$f:=
((((~= #) (= #) (|coerce| #) (|latex| #) ...)))
>> Apparent user error: unspecified error

The naive representation of Rep == (source->target) gives the following error:

  Error: Caught fatal error [memory may be damaged]
  ...
  Error signalled by EVALHOOK.
  Backtrace: system:universal-error-handler > evalhook > lambda > lambda-closure > block > apply > APPLY

But using SExpression seems to work.

fricas
)show Morphism(Float,Integer)
Morphism is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead?

Next let's study how this sort of thing is accomplished in a similar domain.

spad
)abbrev domain HOM Hom
++ Based on Automorphism by: Manuel Bronstein
++ Description:
++       Hom(R,S) is the domain of homomorphisms - Mapping(S,R).
Hom(R:SetCategory,S:SetCategory): Join(SetCategory, Eltable(R, S)) with
      morphism: (R -> S) -> %
        ++ morphism(f) returns the non-invertible morphism given by f.
   == add
      -- Why doesn't the obvious representation just (R->S) work?
      Rep == SExpression
      morphism(f) == per(f pretend SExpression)
      elt(f, r)   == (rep(f) pretend (R->S))(r)
--Rep == List(R -> S) --morphism(f) == per([f #1]) --elt(f, r) == (rep(f)(1))(r)
--Rep := ((R, Integer) -> S) --morphism(f) == (#2; f(#1)) --elt(f, r) == (g := f pretend ((R, Integer) -> S); g(r, 1))
f = g == EQ(f, g)$Lisp coerce(f:%):OutputForm == message("theMap ...")
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/8077618115899383420-25px004.spad
      using old system compiler.
   HOM abbreviates domain Hom 
------------------------------------------------------------------------
   initializing NRLIB HOM for Hom 
   compiling into NRLIB HOM 
************* USER ERROR **********
available signatures for Rep: 
    NONE
NEED Rep: () -> ?
****** comp fails at level 1 with expression: ******
((DEF (|Rep|) (NIL) (|SExpression|)))
****** level 1  ******
$x:= (DEF (Rep) (NIL) (SExpression))
$m:= $EmptyMode
$f:=
((((~= #) (= #) (|coerce| #) (|latex| #) ...)))
>> Apparent user error: unspecified error

fricas
p:=morphism((x:Integer):Float +-> x+1.0)$Hom(Integer,Float)
Hom is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead?




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