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

Edit detail for SandBoxMorphism revision 12 of 15

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Editor: Bill Page
Time: 2008/06/18 19:24:42 GMT-7
Note: new Rep for Morphism

changed:
-  --elt:(%,source)->target
  elt:(%,source)->target

changed:
-  Rep == (source->target)
  -- Rep == (source->target)
  Rep == SExpression

changed:
-  coerce(r:(source->target)):% == per(r)
-  coerce(p:%):(source->target) == p pretend (source->target)
  coerce(r:(source->target)):% == per(r pretend SExpression)
  coerce(p:%):(source->target) == (rep(p) pretend (source->target))

changed:
-  --elt(f,x) == (f::(source->target))(x)
  elt(f,x) == (rep(f) pretend (source->target))(x)

changed:
-      -- Why doesn't this simpler representation work?
-      --Rep := (R -> S)
-      --morphism(f)                     == f(#1)
-      --elt(f, r) == (g := f pretend (R -> S); g(r))
-
-      Rep := ((R, Integer) -> S)
-      morphism(f)                     == (#2; f(#1))
-      elt(f, r) == (g := f pretend ((R, Integer) -> S); g(r, 1))
      -- 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))

changed:
-      coerce(f:%):OutputForm          == message("R -> S")
      coerce(f:%):OutputForm          == message("theMap ...")

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)
  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>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6008188987750019428-25px001.spad
      using 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

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 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-25px003.spad
      using 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?