  
  [1X8 Derivations[0X
  
  A derivation d of a ring R is a map R -> R that obeys the product rule
  
  
       d(rs) = d(r)s + rd(s)
  
  
  for elements r, s in the field, and which is also distributive over addition
  in the ring
  
  
       d(r+s) = d(r) + d(s)
  
  
  
  [1X8.1 The [9XHAPDerivation[1X datatype[0X
  
  The  [9XHAPDerivation[0m  datatype represents a derivation of a polynomial ring R.
  Given  the  product and addition rules above, a derivation can be completely
  specified in terms of the images of the ring indeterminates. Consequently, a
  [9XHAPDerivation[0m is specified by providing:
  
  --    a polynomial ring R
  
  --    a  list  of  images,  under  the  derivation,  of  each  of the ring's
        indeterminates.
  
  Optionally, you can also provide
  
  --    a  set  of  relations  I  (which  is  assumed  to  be empty if none is
        provided).
  
  The  support  for  derivations  over  quotient  rings using [9XHAPDerivation[0m is
  limited.  The ring is always assumed to simply be the polynomial ring R, but
  when calculating the kernel and homology (see [2XKernelOfDerivation[0m ([14X8.5-2[0m) and
  [2XHomologyOfDerivation[0m  ([14X8.5-3[0m)),  any relations in I are also included in the
  result's  relations,  which  is  the equivalent of calculating the kernel of
  homology of the derivation R/I -> R/I.
  
  
  [1X8.2 Computing the kernel and homology of a derivation[0X
  
  Computing  the  kernel of a derivation is difficult in the general case, but
  for  polynomial  rings  over  F_p  we  have  a  novel  solution which allows
  derivations to be considered as module homomorphisms.
  
  Consider a ring R over GF(2). For any r in R,
  
  
       d(r^2) = d(rr) = d(r)r + rd(r) = 2d(r) = 0
  
  
  In  general,  for  a ring R = F_p[x_1, ..., x_n], the subring S = F_p[x_1^p,
  ...,  x_n^p]  is  in  the kernel of d. For this choice of S, R can always be
  written as a free S-module with 2^n generators.
  
  Consider now taking the derivation of sr where s in S and r in R,
  
  
       d(sr) = sd(r) + d(s)r = sd(r)
  
  
  since  s  is  in  the  kernel  of d. In other words, when R is written as an
  S-module, the derivation d behaves exactly as as an S-module homomorphism.
  
  The  [5XSingular[0m  computer  algebra  system  can  compute the kernels of module
  homomorphisms  over  polynomial  rings, and the [5Xsingular[0m package provides an
  interface  between [5XSingular[0m and [5XGAP[0m. The function [2XKernelOfDerivation[0m ([14X8.5-2[0m)
  constructs S, expresses d as an S-module homomorphism (as well as converting
  any ideal), and asks [5XSingular[0m for the kernel. [5XSingular[0m returns the result as
  a  set  of  module  generators,  which  are  then  reduced  to a set of ring
  generators and a presentation found. This makes further use of [5XSingular[0m, and
  the [10XHAPRingHomomorphism[0m datatype (see Chapter [14X7[0m).
  
  The homology of a derivation is defined to be
  
  
       Hom(d) = \ker (d) / im (d)
  
  
  Given  the  kernel of a derivation and the image (expressed as the images of
  the  module generators), the homology can be readily computed, as is done by
  [2XHomologyOfDerivation[0m   ([14X8.5-3[0m).   The   natural   presentation  obtained  by
  concatenating   the  kernel  relations  and  the  image  typically  contains
  redundancies   and  the  [2XHAPRingReductionHomomorphism[0m  ([14X7.2-4[0m)  is  used  to
  generate a nicer presentation involving fewer indeterminates and relations.
  
  
  [1X8.3 Construction function[0X
  
  
  [1X8.3-1 HAPDerivation construction functions[0X
  
  [2X> HAPDerivation( [0X[3XR[, I], images[0X[2X ) _________________________________[0Xoperation
  [2X> HAPDerivationNC( [0X[3XR, I, images[0X[2X ) _________________________________[0Xoperation
  [6XReturns:[0X  [9XHAPDerivation[0m
  
  Construct  a [9XHAPDerivation[0m object representing the derivation d where [3XR[0m is a
  polynomial  ring  and  [3Ximages[0m  is  the  list  of  the  images  of  the  ring
  indeterminates  under  the  derivation,  d(x_1),  d(x_2),  ...,  d(x_n).  An
  optional  set  of  relations  [3XI[0m  can  also  be provided, which are passed to
  [2XKernelOfDerivation[0m  ([14X8.5-2[0m)  when calculating the kernel or homology of this
  derivation.  The  function  [9XHAPDerivation[0m  checks  that  the  arguments  are
  compatible, while the [10XNC[0m method performs no checks.
  
  
  [1X8.4 Data access function[0X
  
  [1X8.4-1 DerivationRing[0m
  
  [2X> DerivationRing( [0X[3Xd[0X[2X ) _____________________________________________[0Xattribute
  [6XReturns:[0X  Polynomial ring
  
  Returns the ring over which the derivation [3Xd[0m is defined.
  
  [1X8.4-2 DerivationImages[0m
  
  [2X> DerivationImages( [0X[3Xd[0X[2X ) ___________________________________________[0Xattribute
  [6XReturns:[0X  List of polynomials
  
  A  derivation  [3Xd[0m  over  a  (quotient) polynomial ring is defined by a set of
  images.  This  function  returns this list of images. The ith element of the
  list  is the image of indeterminate number i in that ring family. (Note that
  indeterminate  number  i  is  not  necessarily the ith indeterminate in that
  particular ring. See [14X'Reference: Indeterminates'[0m for more details.)
  
  [1X8.4-3 DerivationRelations[0m
  
  [2X> DerivationRelations( [0X[3Xd[0X[2X ) ________________________________________[0Xattribute
  [6XReturns:[0X  List of polynomials
  
  Returns  the  relations  of the quotient ring over which the derivation [3Xd[0m is
  defined.
  
  
  [1X8.4-4 Example: Constructing and accessing data of a [9XHAPDerivation[1X[0X
  
  We  demonstrate creating a [9XHAPDerivation[0m object and reading back its data by
  creating  a  derivation  d of the polynomial ring over the integers with two
  indeterminates, Z[x_1, x_2, x_3], which has the mapping d(x_1) = d(x_2) = 1,
  d(x_3) = 0.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ring := PolynomialRing(Integers, 3);;[0X
    [4Xgap> d := HAPDerivation(ring, [One(ring), One(ring), Zero(ring)]);[0X
    [4X<Derivation>[0X
    [4Xgap>[0X
    [4Xgap> DerivationRing(d);[0X
    [4XIntegers[x_1,x_2,x_3][0X
    [4Xgap> DerivationImages(d);[0X
    [4X[ 1, 1, 0 ][0X
    [4Xgap> DerivationRelations(d);[0X
    [4X[  ][0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X8.5 Image, kernel and homology functions[0X
  
  [1X8.5-1 ImageOfDerivation[0m
  
  [2X> ImageOfDerivation( [0X[3Xd, poly[0X[2X ) ____________________________________[0Xoperation
  [6XReturns:[0X  Polynomial
  
  Returns  the image of the polynomial [3Xpoly[0m under the derivation [3Xd[0m. ([3Xpoly[0m must
  be a polynomial in the derivation's ring.)
  
  [1X8.5-2 KernelOfDerivation[0m
  
  [2X> KernelOfDerivation( [0X[3Xd[, avoid][0X[2X ) ________________________________[0Xoperation
  [6XReturns:[0X  List
  
  Returns  a ring presentation S/J for the kernel of the derivation [3Xd[0m, where S
  is  a polynomial ring and J are a set of relations. This operation returns a
  list with the following elements:
  
  (1)   the new polynomial ring S
  
  (2)   a basis for the ideal, as a set of relations J
  
  (3)   the  ring  isomorphism  between  the  kernel  (i.e.  a  subring of the
        derivation's  ring)  and  the  new  ring.  This  is  given  using  the
        [9XHAPRingHomomorphism[0m type, for details of which see [14X7[0m
  
  An  optional parameter, [3Xavoid[0m, can be provided which lists indeterminates to
  avoid when creating the the new polynomial ring.
  
  [13XThis function is only available if the package [5Xsingular[0m[13X is available[0m.
  
  [1X8.5-3 HomologyOfDerivation[0m
  
  [2X> HomologyOfDerivation( [0X[3Xd[, avoid][0X[2X ) ______________________________[0Xoperation
  [6XReturns:[0X  List
  
  Returns  a ring presentation S/J for the homology of the derivation [3Xd[0m, where
  S  is  a  polynomial ring and J are a set of relations. Returns a polynomial
  ring  presentation  for  the homology ker(d)/im(d) of the derivation [3Xd[0m. This
  operation returns a list with the following elements:
  
  (1)   the new polynomial ring S
  
  (2)   a basis for the ideal, as a set of relations J
  
  (3)   the  ring  isomorphism  between  the  kernel  (i.e.  a  subring of the
        derivation's  ring)  and  the  new  ring.  This  is  given  using  the
        [9XHAPRingHomomorphism[0m type, for details of which see [14X7[0m
  
  An  optional parameter, [3Xavoid[0m, can be provided which lists indeterminates to
  avoid when creating the the new polynomial ring.
  
  
  [1X8.5-4 Example: Homology of a [9XHAPDerivation[1X[0X
  
  In  this example, we wish to calculate the homology of a derivation d on the
  ring  F_2[x,y,z]/(yx^2 + xy^2) where d(x) = d(y) = 0 and d(z) = yx^2 + xy^2.
  To  demonstrate some of the other functions, we also calculate the kernel of
  this derivation and the image of the element xz.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> ring := PolynomialRing(GF(2), 3);;[0X
    [4Xgap> x := ring.1;; y := ring.2;; z := ring.3;;[0X
    [4Xgap> d := HAPDerivation(ring, [x^2 + x*y + y^2],[0X
    [4X>                [Zero(ring), Zero(ring), x^2*y + x*y^2]);[0X
    [4X<Derivation>[0X
    [4Xgap> #[0X
    [4Xgap> ImageOfDerivation(d, x*z);[0X
    [4Xx_1^3*x_2+x_1^2*x_2^2[0X
    [4Xgap> KernelOfDerivation(d);[0X
    [4X[ GF(2)[x_7,x_8,x_9], [ x_7^2+x_7*x_8+x_8^2 ], <Ring homomorphism> ][0X
    [4Xgap> HomologyOfDerivation(d);[0X
    [4X[ GF(2)[x_4,x_5,x_6], [ x_4^2+x_4*x_5+x_5^2, x_5^3 ], <Ring homomorphism> ][0X
  [4X------------------------------------------------------------------[0X
  
  The  result  we  were  after,  the homology of d, can be read from the final
  result as follows. The first two entries in the list give the homology group
  as  a  quotient  ring:  the quotient of the polynomial ring F_2[x_6,x_7,x_8]
  with  the  two  relations (x_7^2+x_7x_8+x_8^2, x_8^3). The last entry in the
  list  gives  the new indeterminates in terms of the original indeterminates,
  and from this we know that it would be friendlier to write the result as
  
  
       F_2[x,y,e^2] / (x^2+xy+y^2, y^3)
  
  
  The kernel of the derivation can read from the result in a similar manner.
  
