  
  [1X3 Graded algebras[0X
  
  A  graded  algebra  A  is  a  ring  that has a direct sum decomposition into
  Abelian additive groups (called degrees)
  
  
       A = A_1 + A_2 + A_3 + ...
  
  
  and where multiplication of elements follows a grading such that
  
  
       A_s x A_r --> A_s+r
  
  
  This  means that for any elements x in A_s and y in A_r, the product lies in
  degree r+s, i.e. xy in A_s+r.
  
  
  [1X3.1 Graded algebras in [5XHAP[1X (and [5XHAPprime[1X)[0X
  
  Small finite algebras can be represented explicitly in [5XGAP[0m using a basis and
  a  structure  constant  table  [14X'Tutorial:  Algebras'[0m,  which  specifies  all
  products  of basis elements. [5XHAP[0m extends this definition to provide a finite
  approximation  to  a graded algebra, storing all basis elements and products
  up to a given degree, n. The graded algebras used by [5XHAP[0m add a new component
  to  the algebra object [10XA[0m, the function [10XA!.degree(e)[0m which returns the degree
  of an algebra element [10Xe[0m.
  
  [5XHAPprime[0m  uses  this  [5XHAP[0m algebra object and adds some attributes, providing
  information  on the basis and generators of the algebra. A ring presentation
  for   this   algebra   can  also  be  computed  and  represented  using  the
  [9XGradedAlgebraPresentation[0m datatype (see Section [14X4[0m).
  
  
  [1X3.2 Data access functions[0X
  
  [1X3.2-1 ModPRingGeneratorDegrees[0m
  
  [2X> ModPRingGeneratorDegrees( [0X[3XA[0X[2X ) ___________________________________[0Xattribute
  [6XReturns:[0X  List
  
  Returns  a  list  containing  the  degree  of  each  generator  in a minimal
  generating  set  for the mod-p cohomology ring [3XA[0m. The ith degree in the list
  corresponds  to  the  ith  generator  returned  by  [2XModPRingGenerators[0m ([14XHAP:
  ModPRingGenerators[0m)
  
  [1X3.2-2 ModPRingNiceBasis[0m
  
  [2X> ModPRingNiceBasis( [0X[3XA[0X[2X ) __________________________________________[0Xattribute
  [6XReturns:[0X  List
  
  Returns  the  information  needed  to  convert  the  basis  for [3XA[0m (see [2XBasis[0m
  ([14XReference:  Basis[0m))  into a nicer basis consisting of only products of ring
  generators.  The  function  returns  a  pair of lists [10X[Coeff, Bas][0m. The list
  [10XCoeff[0m  is  a  change-of-basis  matrix,  where the ith row gives the standard
  basis element i in terms of the nice basis. The list [10XBas[0m can be used to form
  the  new  basis and is a list of integers where the ith 'nice basis' element
  is given by [10XProduct(List(Bas[i], x->Basis(A)[x]))[0m.
  
  This  attribute  returns  exactly  the same list as is provided by component
  [10XA!.niceBasis[0m   (see   [2XModPCohomologyRing[0m   ([14XHAP:   ModPCohomologyRing[0m),  but
  automatically constructs this list if it is not available.
  
  [1X3.2-3 ModPRingNiceBasisAsPolynomials[0m
  
  [2X> ModPRingNiceBasisAsPolynomials( [0X[3XA[0X[2X ) _____________________________[0Xattribute
  [6XReturns:[0X  List
  
  A  list  which  gives  the 'nice basis' of the algebra [3XA[0m (as returned by the
  second  element  of  [2XModPRingNiceBasis[0m  ([14X3.2-2[0m)) in terms of products of the
  indeterminates     in     the     ring    presentation    (as    given    by
  [2XPresentationOfGradedStructureConstantAlgebra[0m  ([14X3.3-1[0m)). The ith entry in the
  list  corresponds  to  the  ith  basis element returned by [2XModPRingNiceBasis[0m
  ([14X3.2-2[0m).
  
  [1X3.2-4 ModPRingBasisAsPolynomials[0m
  
  [2X> ModPRingBasisAsPolynomials( [0X[3XA[0X[2X ) _________________________________[0Xattribute
  [6XReturns:[0X  List
  
  A  list  which gives the basis of the algebra [3XA[0m (as returned by [10XBasis(A)[0m) in
  terms of sums of products of the indeterminates in the ring presentation (as
  given  by  [2XPresentationOfGradedStructureConstantAlgebra[0m  ([14X3.3-1[0m)).  The  ith
  entry  in  the  list  corresponds to the ith basis element returned by [2XBasis[0m
  ([14XReference: Basis[0m).
  
  
  [1X3.3 Other functions[0X
  
  [1X3.3-1 PresentationOfGradedStructureConstantAlgebra[0m
  
  [2X> PresentationOfGradedStructureConstantAlgebra( [0X[3XA[0X[2X ) _______________[0Xattribute
  [6XReturns:[0X  [9XGradedAlgebraPresentation[0m
  
  Returns  a  ring presentation for the graded algebra [3XA[0m. The ring [3XA[0m must be a
  structure  constant  algebra  with  embedded degrees, such as is returned by
  [2XModPCohomologyRing[0m   ([14XHAP:   ModPCohomologyRing[0m).   The  generators  of  the
  [9XGradedAlgebraPresentation[0m             (as             returned            by
  [2XIndeterminatesOfGradedAlgebraPresentation[0m    ([14X4.3-3[0m)   are   in   one-to-one
  correspondance  with  the  generators of [3XA[0m as returned by [2XModPRingGenerators[0m
  ([14XHAP:  ModPRingGenerators[0m) (ignoring the first generator, which is in degree
  zero).
  
  
  [1X3.4 Example: Graded algebras and mod-p cohomology rings[0X
  
  The  mod-p  cohomology ring of a p-group is a graded algebra (see [14X'HAPprime:
  Computing mod-p cohomology rings and their Poincaré series'[0m). As an example,
  we  use  the  [5XHAP[0m  function  [2XModPCohomologyRing[0m ([14XHAP: ModPCohomologyRing[0m) to
  compute this algebra for the quaternion group Q_8 up to and including degree
  five.  We  can  display  its  generators  and  basis  (and degrees), and the
  information to construct a 'nice basis'
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> A := ModPCohomologyRing(SmallGroup(8, 4), 5);[0X
    [4X<algebra of dimension 9 over GF(2)>[0X
    [4Xgap> Display(Basis(A));[0X
    [4XCanonicalBasis( Algebra( GF(2), [ v.1, v.2, v.3, v.4, v.5, v.6, v.7, v.8, v.9[0X
    [4X ] ) )[0X
    [4Xgap> List(Basis(A), i->A!.degree(i));[0X
    [4X[ 0, 1, 1, 2, 2, 3, 4, 5, 5 ][0X
    [4Xgap> ModPRingGenerators(A);[0X
    [4X[ v.1, v.2, v.3, v.7 ][0X
    [4Xgap> ModPRingGeneratorDegrees(A);[0X
    [4X[ 0, 1, 1, 4 ][0X
    [4Xgap> ModPRingNiceBasis(A);[0X
    [4X[ [ [ 1, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 1, 0, 0, 0, 0, 0, 0, 0 ],[0X
    [4X      [ 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0, 0 ],[0X
    [4X      [ 0, 0, 0, 0, 1, 1, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 1 ],[0X
    [4X      [ 0, 0, 0, 1, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1, 0 ],[0X
    [4X      [ 0, 0, 0, 0, 0, 0, 1, 1, 0 ] ],[0X
    [4X  [ [ 1, 1, 1 ], [ 1, 1, 2 ], [ 1, 1, 3 ], [ 1, 1, 7 ], [ 1, 2, 2 ],[0X
    [4X      [ 1, 2, 3 ], [ 1, 2, 7 ], [ 1, 3, 7 ], [ 2, 2, 3 ] ] ][0X
  [4X------------------------------------------------------------------[0X
  
  A    presentation    for    this    algebra   can   be   constructed   using
  [2XPresentationOfGradedStructureConstantAlgebra[0m   ([14X3.3-1[0m),  which  (see  below)
  returns the presentation to be
  
  
       H^*(G, F) = F[x_1, x_2, x_3] / (x_1^2 + x_1x_2 + x_2^2, x_2^3)
  
  
  where  x_1  and x_2 have degree one and x_3 is degree four. The 'nice basis'
  referred to above is monomials of degree up to five in this polynomial ring,
  and  is  not necessarily the same as the basis of the algebra given by [2XBasis[0m
  ([14XReference: Basis[0m), as demonstrated below.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> A := ModPCohomologyRing(SmallGroup(8, 4), 5);;[0X
    [4Xgap> PresentationOfGradedStructureConstantAlgebra(A);[0X
    [4XGraded algebra GF(2)[ x_1, x_2, x_3 ] / [ x_1^2+x_1*x_2+x_2^2, x_2^3[0X
    [4X ] with indeterminate degrees [ 1, 1, 4 ][0X
    [4X[0X
    [4Xgap> ModPRingNiceBasisAsPolynomials(A);[0X
    [4X[ Z(2)^0, x_1, x_2, x_3, x_1^2, x_1*x_2, x_1*x_3, x_2*x_3, x_1^2*x_2 ][0X
    [4Xgap> ModPRingBasisAsPolynomials(A);[0X
    [4X[ Z(2)^0, x_1, x_2, x_1*x_2, x_1^2+x_1*x_2, x_1^2*x_2, x_3, x_2*x_3,[0X
    [4X  x_1*x_3+x_2*x_3 ][0X
  [4X------------------------------------------------------------------[0X
  
