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

Edit detail for SandBoxMorphism revision 3 of 15

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Editor: Bill Page
Time: 2008/06/18 16:19:16 GMT-7
Note: Automorphism

removed:
-

added:

Next let's study how this sort of thing is accomplished in a similar domain.
\begin{spad}
)abbrev domain AUTOMOR Automorphism
++ Author: Manuel Bronstein
++ Date Created: 31 January 1994
++ Date Last Updated: 31 January 1994
++ References:
++ Description:
++       Automorphism R is the multiplicative group of automorphisms of R.
-- In fact, non-invertible endomorphism are allowed as partial functions.
-- This domain is noncanonical in that f*f^{-1} will be the identity
-- function but won't be equal to 1.
Automorphism(R:Ring): Join(Group, Eltable(R, R)) with
      morphism: (R -> R) -> %
        ++ morphism(f) returns the non-invertible morphism given by f.
      morphism: (R -> R, R -> R) -> %
        ++ morphism(f, g) returns the invertible morphism given by f, where
        ++ g is the inverse of f..
      morphism: ((R, Integer) -> R) -> %
        ++ morphism(f) returns the morphism given by \spad{f^n(x) = f(x,n)}.
   == add
      err:   R -> R
      ident: (R, Integer) -> R
      iter:  (R -> R, NonNegativeInteger, R) -> R
      iterat: (R -> R, R -> R, Integer, R) -> R
      apply: (%, R, Integer) -> R

      Rep := ((R, Integer) -> R)

      1                               == ident
      err r                           == error "Morphism is not invertible"
      ident(r, n)                     == r
      f = g                           == EQ(f, g)$Lisp
      elt(f, r)                       == apply(f, r, 1)
      inv f                           == apply(f, #1, - #2)
      f ** n                          == apply(f, #1, n * #2)
      coerce(f:%):OutputForm          == message("R -> R")
      morphism(f:(R, Integer) -> R):% == f
      morphism(f:R -> R):%            == morphism(f, err)
      morphism(f, g)                  == iterat(f, g, #2, #1)
      apply(f, r, n) == (g := f pretend ((R, Integer) -> R); g(r, n))

      iterat(f, g, n, r) ==
          n < 0 => iter(g, (-n)::NonNegativeInteger, r)
          iter(f, n::NonNegativeInteger, r)

      iter(f, n, r) ==
          for i in 1..n repeat r := f r
          r

      f * g ==
        f = g => f**2
        iterat(f g #1, (inv g)(inv f) #1, #2, #1)
\end{spad}

\begin{axiom}
p:=morphism((x:Integer):Integer +-> x+1)$Automorphism(Integer)
p(2)
\end{axiom}

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) 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
   Compiling OpenAxiom source code from file 
      /var/zope2/var/LatexWiki/2396666756253990559-25px001.spad using 
      Spad compiler.
   MORPH abbreviates domain Morphism 
   processing macro definition T$ ==> SetCategory 
------------------------------------------------------------------------
   initializing NRLIB MORPH for Morphism 
   compiling into NRLIB MORPH 
   Adding $ modemaps
   Adding source modemaps
   Adding target modemaps
   Parameters of  rep  are of wrong type:
    G1393 must have type source not $
   compiling local rep : source -> source -> target
      MORPH;rep is replaced by G1393 
Time: 0 SEC.
   compiling local per : source -> target -> %
      MORPH;per is replaced by G1393 
Time: 0 SEC.
   compiling exported domain : % -> SetCategory
Time: 0 SEC.
   compiling exported codomain : % -> SetCategory
Time: 0 SEC.
   compiling exported coerce : source -> target -> %
Time: 0 SEC.
   compiling exported coerce : % -> source -> target
      MORPH;coerce;$M;6 is replaced by p 
Time: 0 SEC.
   Adding OutputForm modemaps
   compiling exported coerce : % -> OutputForm
      MORPH;coerce;$Of;7 is replaced by p 
Time: 0 SEC.
(time taken in buildFunctor:  1)
;;;     ***       |Morphism| REDEFINED
;;;     ***       |Morphism| REDEFINED
Time: 0.01 SEC.
   Cumulative Statistics for Constructor Morphism
      Time: 0.01 seconds
--------------non extending category----------------------
   Morphism(#1,#2) of category CATEGORY(domain,domain: % -> 
      SetCategory,codomain: % -> SetCategory,coerce: (#1 -> #2) -> %,
      coerce: % -> (#1 -> #2),coerce: % -> OutputForm)
    has no NIL
   finalizing NRLIB MORPH 
   Processing Morphism for Browser database:
--->-->Morphism((domain (T$ %))): Not documented!!!!
--->-->Morphism((codomain (T$ %))): Not documented!!!!
--->-->Morphism((coerce (% (Mapping target source)))): Not documented!!!!
--->-->Morphism((coerce ((Mapping target source) %))): Not documented!!!!
--->-->Morphism((coerce ((OutputForm) %))): Not documented!!!!
--->-->Morphism(constructor): Not documented!!!!
--->-->Morphism(): Missing Description
------------------------------------------------------------------------
   Morphism is now explicitly exposed in frame initial 
   Morphism will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/MORPH.NRLIB/code.o

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.

axiom
)show Morphism(Float,Integer) Morphism(Float,Integer) is a domain constructor. Abbreviation for Morphism is MORPH This constructor is exposed in this frame. Issue )edit /var/zope2/var/LatexWiki/2396666756253990559-25px001.spad to see algebra source code for MORPH ------------------------------- Operations -------------------------------- codomain : % -> SetCategory coerce : % -> (Float -> Integer) coerce : % -> OutputForm coerce : (Float -> Integer) -> % domain : % -> SetCategory f:Morphism(Float,Integer)
Type: Void
axiom
f:=(x:Float):Integer +->wholePart(x) ; (DEFUN |*1;anonymousFunction;0;initial;internal| ...) is being compiled. ;; The variable |*1;anonymousFunction;0;initial;internal;MV| is undefined. ;; The compiler will assume this variable is a global.
LatexWiki Image(1)
Type: Morphism(Float,Integer)
axiom
f(1.1) There are no library operations named f Use HyperDoc Browse or issue )what op f to learn if there is any operation containing " f " in its name. Cannot find a definition or applicable library operation named f with argument type(s) Float Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. (f::(Float->Integer))(1.1)
LatexWiki Image(2)
Type: PositiveInteger?
axiom
domain f
LatexWiki Image(3)
Type: SetCategory?
axiom
codomain f
LatexWiki Image(4)
Type: SetCategory?
axiom
(f::(domain(f)->codomain(f)))(1.1)
LatexWiki Image(5)
Type: PositiveInteger?

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

spad
)abbrev domain AUTOMOR Automorphism ++ Author: Manuel Bronstein ++ Date Created: 31 January 1994 ++ Date Last Updated: 31 January 1994 ++ References: ++ Description: ++ Automorphism R is the multiplicative group of automorphisms of R. -- In fact, non-invertible endomorphism are allowed as partial functions. -- This domain is noncanonical in that f*f^{-1} will be the identity -- function but won't be equal to 1. Automorphism(R:Ring): Join(Group, Eltable(R, R)) with morphism: (R -> R) -> % ++ morphism(f) returns the non-invertible morphism given by f. morphism: (R -> R, R -> R) -> % ++ morphism(f, g) returns the invertible morphism given by f, where ++ g is the inverse of f.. morphism: ((R, Integer) -> R) -> % ++ morphism(f) returns the morphism given by \spad{f^n(x) = f(x,n)}. == add err: R -> R ident: (R, Integer) -> R iter: (R -> R, NonNegativeInteger, R) -> R iterat: (R -> R, R -> R, Integer, R) -> R apply: (%, R, Integer) -> R Rep := ((R, Integer) -> R) 1 == ident err r == error "Morphism is not invertible" ident(r, n) == r f = g == EQ(f, g)$Lisp elt(f, r) == apply(f, r, 1) inv f == apply(f, #1, - #2) f ** n == apply(f, #1, n * #2) coerce(f:%):OutputForm == message("R -> R") morphism(f:(R, Integer) -> R):% == f morphism(f:R -> R):% == morphism(f, err) morphism(f, g) == iterat(f, g, #2, #1) apply(f, r, n) == (g := f pretend ((R, Integer) -> R); g(r, n)) iterat(f, g, n, r) == n < 0 => iter(g, (-n)::NonNegativeInteger, r) iter(f, n::NonNegativeInteger, r) iter(f, n, r) == for i in 1..n repeat r := f r r f * g == f = g => f**2 iterat(f g #1, (inv g)(inv f) #1, #2, #1)
spad
   Compiling OpenAxiom source code from file 
      /var/zope2/var/LatexWiki/4060489357901850277-25px003.spad using 
      Spad compiler.
   AUTOMOR abbreviates domain Automorphism 
------------------------------------------------------------------------
   initializing NRLIB AUTOMOR for Automorphism 
   compiling into NRLIB AUTOMOR 
   Adding $ modemaps
   Adding R modemaps
   compiling exported One : () -> %
   Adding Integer modemaps
Time: 0.06 SEC.
   compiling local err : R -> R
   Adding OutputForm modemaps
      AUTOMOR;err is replaced by errorMorphism is not invertible 
Time: 0 SEC.
   Adding Integer modemaps
   compiling local ident : (R,Integer) -> R
      AUTOMOR;ident is replaced by r 
Time: 0 SEC.
   Adding Boolean modemaps
   compiling exported = : (%,%) -> Boolean
      AUTOMOR;=;2$B;4 is replaced by EQ 
Time: 0.01 SEC.
   compiling exported elt : (%,R) -> R
   Adding Integer modemaps
Time: 0 SEC.
   compiling exported inv : % -> %
   Adding Integer modemaps
Time: 0 SEC.
   Adding Integer modemaps
   compiling exported ** : (%,Integer) -> %
Time: 0.06 SEC.
   Adding OutputForm modemaps
   compiling exported coerce : % -> OutputForm
   Adding String modemaps
Time: 0 SEC.
   compiling exported morphism : (R,Integer) -> R -> %
   Adding Integer modemaps
      AUTOMOR;morphism;M$;9 is replaced by f 
Time: 0.01 SEC.
   compiling exported morphism : R -> R -> %
Time: 0 SEC.
   compiling exported morphism : (R -> R,R -> R) -> %
   Adding Integer modemaps
Time: 0 SEC.
   Adding Integer modemaps
   compiling local apply : (%,R,Integer) -> R
Time: 0 SEC.
   Adding Integer modemaps
   compiling local iterat : (R -> R,R -> R,Integer,R) -> R
   Adding Boolean modemaps
   Adding NonNegativeInteger modemaps
Time: 0.01 SEC.
   Adding Integer modemaps
   Adding NonNegativeInteger modemaps
   compiling local iter : (R -> R,NonNegativeInteger,R) -> R
   Adding SingleInteger modemaps
Time: 0.01 SEC.
   compiling exported * : (%,%) -> %
   Adding Boolean modemaps
   Adding Integer modemaps
   Adding NonNegativeInteger modemaps
   Adding PositiveInteger modemaps
Time: 0.07 SEC.
(time taken in buildFunctor:  0)
;;;     ***       |Automorphism| REDEFINED
;;;     ***       |Automorphism| REDEFINED
Time: 0 SEC.
   Warnings: 
      [1] **: signature of lhs not unique: ((%,Integer) -> %) chosen
   Cumulative Statistics for Constructor Automorphism
      Time: 0.23 seconds
   finalizing NRLIB AUTOMOR 
   Processing Automorphism for Browser database:
     -- morphism : (R -> R) -> %
     -- morphism : ((R -> R),(R -> R)) -> %
     -- morphism : ((R,Integer) -> R) -> %
     -- constructor
------------------------------------------------------------------------
   Automorphism is now explicitly exposed in frame initial 
   Automorphism will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/AUTOMOR.NRLIB/code.o

axiom
p:=morphism((x:Integer):Integer +-> x+1)$Automorphism(Integer) ; (DEFUN |*1;anonymousFunction;1;initial;internal| ...) is being compiled. ;; The variable |*1;anonymousFunction;1;initial;internal;MV| is undefined. ;; The compiler will assume this variable is a global.
LatexWiki Image(6)
Type: Automorphism Integer
axiom
p(2)
LatexWiki Image(7)
Type: PositiveInteger?