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

Edit detail for SandBoxMorphism revision 9 of 15

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Editor: Bill Page
Time: 2008/06/18 18:00:36 GMT-7
Note: simpler Automorph

added:
        -- Why doesn't the simpler representation work?

added:
      --Rep := (R -> R)

added:
      --morphism(f)                     == f(#1)

added:
      --elt(f, r) == (g := f pretend (R -> R); g(r))

fricas
(1) -> <spad>
fricas
)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)
  domain(p:%):T == source
  codomain(p:%):T == target
  coerce(r:(source->target)):% == per(r)
  coerce(p:%):(source->target) == p pretend (source->target)
  coerce(p:%):OutputForm == p pretend OutputForm
  --elt(f,x) == (f::(source->target))(x)</spad>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2396666756253990559-25px001.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) (|Mapping| |target| |source|)))
****** level 1  ******
x:= (DEF (Rep) (NIL) (Mapping target source))
m:= $EmptyMode
f:=
((((~= #) (= #) (|coerce| #) (|latex| #) ...)))
>> Apparent user error: unspecified error

If we define elt (commented out above), then f(1.1) gives the following:

  Error: Caught fatal error [memory may be damaged]
  Fast links are on: do (si::use-fast-links nil) for debugging
  Error signalled by RETURN.
  Broken at APPLY.  Type :H for Help.
  BOOT>>
  Error: The variable QUIT is unbound.
  Fast links are on: do (si::use-fast-links nil) for debugging
  Error signalled by EVALHOOK.
  Backtrace: system:universal-error-handler > evalhook > lambda > lambda-closure > block > apply > APPLY

But the same coercion works in the interpreter.

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 AUTOM Automorph
++ Based on Automorphism by: Manuel Bronstein
++ Description:
++       Automorph R is the domain of automorphisms of R.
Automorph(R:Ring): Join(SetCategory, Eltable(R, R)) with
      morphism: (R -> R) -> %
        ++ morphism(f) returns the non-invertible morphism given by f.
        -- Why doesn't the simpler representation work?
   == add
Rep := ((R, Integer) -> R) --Rep := (R -> R)
f = g == EQ(f, g)$Lisp coerce(f:%):OutputForm == message("S -> S") morphism(f) == (#2; f(#1)) --morphism(f) == f(#1) elt(f, r) == (g := f pretend ((R, Integer) -> R); g(r, 1)) --elt(f, r) == (g := f pretend (R -> R); g(r))
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/9049890180255053454-25px003.spad
      using old system compiler.
   AUTOM abbreviates domain Automorph 
------------------------------------------------------------------------
   initializing NRLIB AUTOM for Automorph 
   compiling into NRLIB AUTOM 
   compiling exported = : (%,%) -> Boolean
      AUTOM;=;2%B;1 is replaced by EQ 
Time: 0 SEC.
compiling exported coerce : % -> OutputForm Time: 0 SEC.
compiling exported morphism : R -> R -> % ****** comp fails at level 2 with expression: ****** error in function morphism
(SEQ | << | (|#| 2) | >> | (|exit| 1 (|f| |#1|))) ****** level 2 ****** x:= (# 2) m:= NoValueMode f:= ((((|f| # #) (|Rep| #) (~= #) (= #) ...)))
>> Apparent user error: NoValueMode is an unknown mode

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