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}

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 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 FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4060489357901850277-25px003.spad
      using old system compiler.
   AUTOMOR abbreviates domain Automorphism 
------------------------------------------------------------------------
   initializing NRLIB AUTOMOR for Automorphism 
   compiling into NRLIB AUTOMOR 
   compiling exported One : () -> %
Time: 0 SEC.
compiling local err : R -> R AUTOMOR;err is replaced by errorMorphism is not invertible Time: 0 SEC.
compiling local ident : (R,Integer) -> R AUTOMOR;ident is replaced by r Time: 0 SEC.
compiling exported = : (%,%) -> Boolean AUTOMOR;=;2%B;4 is replaced by EQ Time: 0 SEC.
compiling exported elt : (%,R) -> R Time: 0 SEC.
compiling exported inv : % -> % ****** comp fails at level 2 with expression: ****** error in function inv
(|apply| |f| | << #1 >> | (- (|#| 2))) ****** level 2 ****** x:= #1 m:= $EmptyMode f:= ((((|f| # #) (|Rep| #) (|apply| #) (|iterat| #) ...)))
>> Apparent user error: no mode found for #1

fricas
p:=morphism((x:Integer):Integer +-> x+1)$Automorphism(Integer)

\label{eq1}\mbox{\rm R - > R}(1)
Type: Automorphism(Integer)
fricas
p(2)

\label{eq2}3(2)
Type: PositiveInteger?