  
  [1X3 Background Theory on Forms[0X
  
  In  this chapter we give a very brief overview of the theory of sesquilinear
  and quadratic forms. The reader can find more in the texts: Cameron [Cam00],
  Taylor [Tay92], Aschbacher [Asc00], or Kleidman and Liebeck [KL90].
  
  
  [1X3.1 Sesquilinear forms[0X
  
  A  [13Xsesquilinear form[0m on an n-dimensional vector space V over a field F, is a
  map f from Vx V to F which is linear in the first coordinate, but semilinear
  in  the second coordinate; that is, there is a field automorphism alpha (the
  [13Xcompanion automorphism[0m of f) such that f(v,lambda w)=lambda^alpha f(v,w) for
  all v,w in V and lambda in F. If alpha is the identity, then f is [13Xbilinear[0m.
  
  A  bilinear  form  is  [13Xreflexive[0m if f(v,w)=0 => f(w,v)=0 for all v,w in V. A
  bilinear  form  is  [13Xsymmetric[0m if f(v,w)=f(w,v) for all v,w in V. It is clear
  that  a symmetric bilinear form is reflexive. A bilinear form is [13Xalternating[0m
  if  f(v,v)=0  for  all v in V. Using the linearity to compute f(v+w,v+w), we
  see  that  an alternating form is also reflexive. When the characteristic of
  the field differs from 2, an alternating form f can also be characterised as
  f(v,w)  =  -f(w,v)  for  all  v,w  in  V. It can be proved (see Chapter 7 of
  [Tay92])  that  symmetric  and  alternating  bilinear  forms  are  the  only
  reflexive bilinear forms.
  
  For a given sesquilinear form f, the choice of the basis determines uniquely
  an nx n matrix M such that
  
  
       f(v, w) = v M w^{\alpha}^T.
  
  
  This  matrix  is also called the [13XGram matrix[0m of f. Given a sesquilinear form
  f,  we will denote its Gram matrix by M_f . In [5XForms[0m, sesquilinear forms can
  be  constructed  using matrices or polynomials, where we always suppose that
  the  basis  of the vector space is the standard basis (i.e., the rows of the
  identity matrix).
  
  One  proves easily that a bilinear form f is symmetric if and only if M_f is
  a  symmetric  matrix,  i.e.,  M_f^T=M_f  ,  and  that  a  bilinear form f is
  alternating  if and only if M_f is a skew symmetric matrix, i.e., M_f^T=-M_f
  .  When  the characteristic of the field is two, the condition that f(v,v)=0
  for  all  v  in  V implies M_f^T=M_f [12Xand[0m (M_ii)=0 (denoting the matrix M_f =
  (M_ij)).  Since  any  skew  symmetric odd dimensional matrix is singular, it
  follows  that  an  alternating  form  of  an odd dimensional vector space is
  degenerate.
  
  A  sesquilinear form f is [13Xhermitian[0m (n.b., [13Xconjugate-symmetric[0m in [CCNPW85])
  if  f(v,w)=f(w,v)^alpha  holds  for  all  vectors v,w and alpha has order 2.
  Again,  it  can  be easily proved that a sesquilinear form f is hermitian if
  and  only  if m_f^T = m_f^alpha (i.e., a hermitian matix). It is proved (see
  Chapter   7  of  [Tay92])  that  hermitian  forms  are  the  only  reflexive
  sesquilinear  forms  that are not bilinear. Hence, in general, all reflexive
  sesquilinear  forms are known, they are either hermitian or bilinear, and in
  the  latter  case,  they  are  either  symmetric  or alternating (again, see
  Chapter 7 of [Tay92]).
  
  In  [5XForms[0m, only the construction of [12Xreflexive[0m sesquilinear forms is allowed.
  An   error  message  will  be  displayed  if  any  attempt  to  construct  a
  non-reflexive  sesquilinear  form is made. As a consequence, the Gram Matrix
  of  a  sesquilinear  form  is  always  a  symmetric,  a  skew symmetric or a
  hermitian  matrix.  From  now on, the notion of a ``sesquilinear form'' will
  always refer to a ``reflexive sesquilinear form''.
  
  Given a sesquilinear form f, two vectors v and w are [13Xorthogonal[0m with respect
  to  f  if  f(v,w) = 0. Note that the reflexivity makes orthogonality between
  two  vectors  a  symmetric  relation.  A  vector  v  is  called [13Xisotropic[0m if
  f(v,v)=0.  The  [13Xradical[0m  of  f  (n.b.,  [13Xkernel[0m in [CCNPW85]) is the subspace
  consisting of vectors which are orthogonal to every vector. That is,
  
  
       Rad(f) = \{v \in V | f(v,w) = 0,\, \forall w \in V\},
  
  
  and  we  say  that  f  is  [13Xnon-degenerate[0m  if  its  radical  is trivial (and
  [13Xdegenerate[0m otherwise).
  
  Given  a  subspace  W, we denote the set of vectors of V orthogonal with all
  vectors  of W by W^perp. We call a subspace W [13Xtotally isotropic[0m with respect
  to f if W is contained in W^perp, i.e.
  
  
       f(v,w) = 0,\, \forall v,w \in W.
  
  
  Suppose that f is a non-degenerate sesquilinear form. The [13XWitt index[0m of f is
  the  maximum  dimension  of  a totally isotropic subspace with respect to f.
  Notice  that  all  totally  isotropic  subspaces  of  maximal dimension of a
  degenerate form f contain the radical of f.
  
  We  end  this  section  with  a short description of the conventions used in
  [5XForms[0m  for  the notions orthogonal, symplectic, pseudo, hyperbolic, elliptic
  and  parabolic. We call a form f [13Xsymplectic[0m if and only if f is alternating.
  When  the characteristic of the field is odd, we call a form f [13Xorthogonal[0m if
  and  only  f is symmetric, and when the characteristic of the field is even,
  we  call  a form f [13Xpseudo[0m if and only if f is symmetric but not alternating.
  This  terminology  is related to the theory of polar spaces, and in the case
  of  orthogonal  forms, we adopt the terms [13Xhyperbolic[0m, [13Xelliptic[0m and [13Xparabolic[0m
  for  the  three different isometry types of orthogonal forms. From the point
  of view of matrix groups, these three types correspond as follows:
  
      ---------------------------------------------------------------------------
        Hyperbolic | Orthogonal of + type | Even dimension, maximal Witt index    
        Elliptic   | Orthogonal of - type | Even dimension, non-maximal Witt index
        Parabolic  | Orthogonal of o type | Odd dimension                         
      ---------------------------------------------------------------------------
  
       [1XTable:[0X Summary of Orthogonal Forms
  
  
  
  [1X3.1-1 Examples[0X
  
  The  examples we present in this section do not demonstrate the entire suite
  of  operations  entailed  in  [5XForms[0m.  They are intended to allow the user to
  become   familiar   with   particular  aspects  of  this  package.  All  the
  functionality  for  sesquilinear  forms will be listed in detail in the next
  chapter.
  
  We try to construct a bilinear form...
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> mat := [[1,0,0],[0,1,4],[1,2,1]]*Z(5)^0;[0X
    [4X[ [ Z(5)^0, 0*Z(5), 0*Z(5) ], [ 0*Z(5), Z(5)^0, Z(5)^2 ], [0X
    [4X  [ Z(5)^0, Z(5), Z(5)^0 ] ][0X
    [4Xgap> form := BilinearFormByMatrix(mat,GF(5));[0X
    [4XError, Invalid Gram matrix[0X
    [4X called from[0X
    [4XBilinearFormByMatrixOp( m, f ) called from[0X
    [4X<function>( <arguments> ) called from read-eval-loop[0X
    [4XEntering break read-eval-print loop ...[0X
    [4Xyou can 'quit;' to quit to outer loop, or[0X
    [4Xyou can 'return;' to continue[0X
    [4Xbrk> quit;[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  It  is clear that the matrix used is not defining a reflexive bilinear form,
  which causes the system to generate the error message.
  
  We  construct now a reflexive bilinear form. We investigate also the radical
  of the form.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> mat := [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,-1]]*Z(9)^0;[0X
    [4X[ [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ], [0X
    [4X  [ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ], [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3) ] ][0X
    [4Xgap> form := BilinearFormByMatrix(mat,GF(9));[0X
    [4X< bilinear form >[0X
    [4Xgap> Display(form);[0X
    [4XBilinear form[0X
    [4XGram Matrix:[0X
    [4X 1 . . .[0X
    [4X . 1 . .[0X
    [4X . . 1 .[0X
    [4X . . . 2[0X
    [4Xgap> IsReflexiveForm(form);[0X
    [4Xtrue[0X
    [4Xgap> IsSymmetricForm(form);[0X
    [4Xtrue[0X
    [4Xgap> IsAlternatingForm(form);[0X
    [4Xfalse[0X
    [4Xgap> r := RadicalOfForm(form);[0X
    [4X<vector space over GF(3^2), with 0 generators>[0X
    [4Xgap> Dimension(r);[0X
    [4X0[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  Degenerate  forms  are  allowed.  As  an example we construct an alternating
  bilinear form on an odd dimensional vector space.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> mat := [[0,0,-2],[0,0,1],[2,-1,0]]*Z(7)^0;[0X
    [4X[ [ 0*Z(7), 0*Z(7), Z(7)^5 ], [ 0*Z(7), 0*Z(7), Z(7)^0 ], [0X
    [4X  [ Z(7)^2, Z(7)^3, 0*Z(7) ] ][0X
    [4Xgap> form := BilinearFormByMatrix(mat,GF(7));[0X
    [4X< bilinear form >[0X
    [4Xgap> Display(form);[0X
    [4XBilinear form[0X
    [4XGram Matrix:[0X
    [4X . . 5[0X
    [4X . . 1[0X
    [4X 2 6 .[0X
    [4Xgap> IsSymmetricForm(form);[0X
    [4Xfalse[0X
    [4Xgap> IsAlternatingForm(form);[0X
    [4Xtrue[0X
    [4Xgap> r := RadicalOfForm(form);[0X
    [4X<vector space over GF(7), with 1 generators>[0X
    [4Xgap> Dimension(r);[0X
    [4X1[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  When  the characteristic of the field equals two, alternating forms are also
  symmetric. We construct an example.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> mat := [[0,1,0,0,0,0],[1,0,0,0,0,0],[0,0,0,0,0,1],[0X
    [4X>         [0,0,0,0,1,0],[0,0,0,1,0,0],[0,0,1,0,0,0]]*Z(16)^0;[0X
    [4X[ [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], [0X
    [4X  [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], [0X
    [4X  [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], [0X
    [4X  [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2) ], [0X
    [4X  [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], [0X
    [4X  [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2) ] ][0X
    [4Xgap> form := BilinearFormByMatrix(mat,GF(16));[0X
    [4X< bilinear form >[0X
    [4Xgap> Display(form);[0X
    [4XBilinear form[0X
    [4XGram Matrix:[0X
    [4X . 1 . . . .[0X
    [4X 1 . . . . .[0X
    [4X . . . . . 1[0X
    [4X . . . . 1 .[0X
    [4X . . . 1 . .[0X
    [4X . . 1 . . .[0X
    [4Xgap> IsSymmetricForm(form);[0X
    [4Xtrue[0X
    [4Xgap> IsAlternatingForm(form);[0X
    [4Xtrue[0X
    [4Xgap> IsDegenerateForm(form);[0X
    [4Xfalse[0X
    [4Xgap> WittIndex(form);[0X
    [4X3[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  To define a hermitian form, we need a matrix and the companion automorphism.
  Since  this  automorphism has order 2, it exists and is unique if the ground
  field  has  square order. In the next example, the chosen matrix is somewhat
  special. Together with the companion automorphism, it determines a hermitian
  sesquilinear  form.  Without  the  companion  automorphism, it determines an
  alternating bilinear form.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> mat := [[0*Z(5),0*Z(5),0*Z(25),Z(25)^3],[0*Z(5),0*Z(5),Z(25)^3,0*Z(25)],[0X
    [4X>         [0*Z(5),-Z(25)^3,0*Z(5),0*Z(5)],[-Z(25)^3,0*Z(5),0*Z(25),0*Z(25)]];[0X
    [4X[ [ 0*Z(5), 0*Z(5), 0*Z(5), Z(5^2)^3 ], [ 0*Z(5), 0*Z(5), Z(5^2)^3, 0*Z(5) ], [0X
    [4X  [ 0*Z(5), Z(5^2)^15, 0*Z(5), 0*Z(5) ], [0X
    [4X  [ Z(5^2)^15, 0*Z(5), 0*Z(5), 0*Z(5) ] ][0X
    [4Xgap> form := HermitianFormByMatrix(mat,GF(25));[0X
    [4X< hermitian form >[0X
    [4Xgap> Display(form);[0X
    [4XHermitian form[0X
    [4XGram Matrix:[0X
    [4Xz = Z(25)[0X
    [4X    .    .    .  z^3[0X
    [4X    .    .  z^3    .[0X
    [4X    . z^15    .    .[0X
    [4X z^15    .    .    .[0X
    [4Xgap> WittIndex(form);[0X
    [4X2[0X
    [4Xgap> form2 := BilinearFormByMatrix(mat,GF(25));[0X
    [4X< bilinear form >[0X
    [4Xgap> Display(form2);[0X
    [4XBilinear form[0X
    [4XGram Matrix:[0X
    [4Xz = Z(25)[0X
    [4X    .    .    .  z^3[0X
    [4X    .    .  z^3    .[0X
    [4X    . z^15    .    .[0X
    [4X z^15    .    .    .[0X
    [4Xgap> IsAlternatingForm(form2);[0X
    [4Xtrue[0X
    [4Xgap> Display(IsometricCanonicalForm(form));[0X
    [4XHermitian form[0X
    [4XGram Matrix:[0X
    [4X 1 . . .[0X
    [4X . 1 . .[0X
    [4X . . 1 .[0X
    [4X . . . 1[0X
    [4XWitt Index: 2[0X
    [4Xgap> Display(IsometricCanonicalForm(form2));[0X
    [4XBilinear form[0X
    [4XGram Matrix:[0X
    [4X . 1 . .[0X
    [4X 4 . . .[0X
    [4X . . . 1[0X
    [4X . . 4 .[0X
    [4XWitt Index: 2[0X
  [4X------------------------------------------------------------------[0X
  
  We  continue the previous example by exploring a little bit the sesquilinear
  form  [3Xform[0m,  and  hence  demonstrate  some of the functionality of the [5XForms[0m
  package.  Eventually,  we  find  a 2-dimensional totally isotropic subspace,
  which  lets  us conclude that the Witt index of form is at least 2, which is
  confirmed afterwards by calling the appropriate function.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> V := GF(25)^4;[0X
    [4X( GF(5^2)^4 )[0X
    [4Xgap> u := [Z(5)^0,Z(5^2)^11,Z(5)^3,Z(5^2)^13 ];[0X
    [4X[ Z(5)^0, Z(5^2)^11, Z(5)^3, Z(5^2)^13 ][0X
    [4Xgap> [u,u]^form;[0X
    [4X0*Z(5)[0X
    [4Xgap> v := [Z(5)^0,Z(5^2)^5,Z(5^2),Z(5^2)^13 ];[0X
    [4X[ Z(5)^0, Z(5^2)^5, Z(5^2), Z(5^2)^13 ][0X
    [4Xgap> [v,v]^form;                                     [0X
    [4X0*Z(5)[0X
    [4Xgap> [u,v]^form;[0X
    [4XZ(5^2)^7[0X
    [4Xgap> ([v,u]^form)^5;[0X
    [4XZ(5^2)^7[0X
    [4Xgap> w := [Z(5^2)^21,Z(5^2)^19,Z(5^2)^4,Z(5)^3 ];[0X
    [4X[ Z(5^2)^21, Z(5^2)^19, Z(5^2)^4, Z(5)^3 ][0X
    [4Xgap> [w,w]^form;[0X
    [4XZ(5)[0X
    [4Xgap> v := [Z(5)^0,Z(5^2)^10,Z(5^2)^15,Z(5^2)^3 ];[0X
    [4X[ Z(5)^0, Z(5^2)^10, Z(5^2)^15, Z(5^2)^3 ][0X
    [4Xgap> u := [Z(5)^3,Z(5^2)^9,Z(5^2)^4,Z(5^2)^16 ];[0X
    [4X[ Z(5)^3, Z(5^2)^9, Z(5^2)^4, Z(5^2)^16 ][0X
    [4Xgap> w := [Z(5)^2,Z(5^2)^9,Z(5^2)^23,Z(5^2)^11 ];[0X
    [4X[ Z(5)^2, Z(5^2)^9, Z(5^2)^23, Z(5^2)^11 ][0X
    [4Xgap> [u,v]^form;[0X
    [4X0*Z(5)[0X
    [4Xgap> [u,w]^form;[0X
    [4X0*Z(5)[0X
    [4Xgap> [v,w]^form;[0X
    [4X0*Z(5)[0X
    [4Xgap> s := Subspace(V,[v,u,w]);[0X
    [4X<vector space over GF(5^2), with 3 generators>[0X
    [4Xgap> Dimension(s);[0X
    [4X2[0X
    [4Xgap> WittIndex(form);[0X
    [4X2[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X3.2 Quadratic forms[0X
  
  A [13Xquadratic form[0m on an n-dimensional vector space V over a field F, is a map
  Q from V to F satisfying the following two conditions:
  
  
       Q(\lambda v) = \lambda^2 Q(v),\, \forall \lambda \in F, \forall v
       \in V,
  
  
  and, the map f defined from Vx V to F as follows,
  
  
       f(v,w) := Q(v+w) - Q(v) - Q(w),
  
  
  is a bilinear form on V. From this definition it follows that f(v,v) = Q(2v)
  - 2Q(v) = 2Q(v).
  
  The  associated  bilinear  form  f  (which  is called the [13Xpolar form[0m of Q in
  [CCNPW85])  is  clearly  reflexive.  When the characteristic of the field is
  odd,  it is clear that f is a symmetric bilinear form. The equation f(v,v) =
  2Q(v)  allows  us  to reconstruct the quadratic form from the bilinear form,
  and  hence  there is a one-to-one correspondence between quadratic forms and
  symmetric bilinear forms. When the characteristic of the field equals 2, the
  bilinear  form  f  is  alternating  (from the fact that f(v,v) = 2Q(v) = 0).
  Note,  however,  that  different  quadratic  forms  can  determine  the same
  alternating form.
  
  As  in  the  case  of  sesquilinear  forms,  we will associate a matrix to a
  quadratic form. Chosing a basis of the vector space V, it is clear that an n
  x  n  matrix  determines  the  quadratic form completely. In [5XForms[0m, the [13XGram
  matrix[0m of a quadratic form is always an upper triangle matrix M, such that
  
  
       Q(v) = vMv^T,
  
  
  where  the basis of V is the standard basis. Although the Gram matrix stored
  with  the  quadratic  form  is  always an upper triangle matrix, the user is
  allowed  to  use any matrix to define the quadratic form, since any matrix M
  defines  a  quadratic  form  Q(v)  :=  vMv^T.  During  the  construction, an
  appopriate  upper triangle matrix is computed and stored as the Gram matrix.
  So the Gram matrix of the associated bilinear form is M+M^T.
  
  The   associated   bilinear  form  could  be  used  to  define  the  notions
  ``isotropic'',  ``totally isotropic'' and ``non-degenerate'', however, under
  these restrictions the geometry of quadratic forms in even characteristic is
  lost.  In  most  of  the  literature,  these  notions  refer  indeed  to the
  associated  bilinear  form,  and  the  notion of ``singularity'' is added to
  regain the geometrical structure.
  
  In  [5XForms[0m,  we use the above described approach. This means that a vector is
  isotropic  if  and  only  if  it is isotropic with respect to the associated
  bilinear  form. A subspace is totally isotropic if and only if it is totally
  isotropic  with  respect  to  the  associated bilinear form, and we call the
  quadratic  form  degenerate  if  and only if the associated bilinear form is
  degenerate.
  
  A  vector  v is called [13Xsingular[0m with relation to the quadratic form Q if and
  only  if Q(v)=0. two vectors v and w are [13Xorthogonal[0m with respect to Q if and
  only  if they are orthogonal with respect to the associated bilinear form f.
  The  [13Xradical[0m  of the quadratic form Q, is the intersection of the set of all
  singular  vectors  with  relation  to  Q  and  the radical of the associated
  bilinear form f, i.e.
  
  
       Rad(Q) = \{v \in V | Q(v) = 0\,\, \mathrm{and}\,\, v \in Rad(f)\}.
  
  
  We  call a quadratic form Q [13Xnon-singular[0m if and only if the radical contains
  only the zero vector, and [13Xsingular[0m otherwise.
  
  A  subspace  W of the vector space is called [13Xtotally singular[0m if and only if
  all vectors of W are singular, i.e., Q vanishes totally on W. Necessarily, a
  totally  singular  subspace  is  also totally isotropic with relation to the
  associated  bilinear  form  f,  but  the  converse  is  only  true  when the
  characteristic of the field is odd.
  
  Suppose  now that Q is a non-singular quadratic form. The [13XWitt index[0m of Q is
  the  maximum  dimension  of  a  totally singular subspace with respect to Q.
  Notice  that  all  totally  singular  subspaces  of  maximal  dimension of a
  singular quadratic form Q contain the radical of Q.
  
  From  the above definitions, it follows that, when the characteristic of the
  field  differs  from  2, a quadratic form Q is non-degenerate if and only if
  its associated bilinear form f is non-degenerate. When the characteristic of
  the  field  is  2,  one can easily construct non-degenerate quadratic forms,
  with  a degenerate associated bilinear form. We will give an example of this
  situation in the next section.
  
  
  [1X3.2-1 Examples[0X
  
  We construct some quadratic forms to demonstrate some funcionality of [5XForms[0m.
  As  in  the previous example section, they are intended to allow the user to
  gain  some  familiarity.  All  the functionality for quadratic forms will be
  listed in detail in the next chapter.
  
  The user can construct quadratic forms using any matrix (provided it has the
  right  dimension).  The  Gram  matrix  is always stored as an upper triangle
  matrix, as explained above.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> V := GF(4)^3;                           [0X
    [4X( GF(2^2)^3 )[0X
    [4Xgap> mat := [[Z(2^2)^2,Z(2^2),Z(2^2)^2],[Z(2^2)^2,Z(2)^0,Z(2)^0],[0X
    [4X>         [0*Z(2),Z(2)^0,0*Z(2)]];[0X
    [4X[ [ Z(2^2)^2, Z(2^2), Z(2^2)^2 ], [ Z(2^2)^2, Z(2)^0, Z(2)^0 ], [0X
    [4X  [ 0*Z(2), Z(2)^0, 0*Z(2) ] ][0X
    [4Xgap> qform := QuadraticFormByMatrix(mat, GF(4));[0X
    [4X< quadratic form >[0X
    [4Xgap> Display( qform );[0X
    [4XQuadratic form[0X
    [4XGram Matrix:[0X
    [4Xz = Z(4)[0X
    [4X z^2   1 z^2[0X
    [4X   .   1   .[0X
    [4X   .   .   .[0X
    [4Xgap> PolynomialOfForm( qform );[0X
    [4XZ(2^2)^2*x_1^2+x_1*x_2+Z(2^2)^2*x_1*x_3+x_2^2[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  In  the  previous  example,  we  saw  how  we used a polynomial to display a
  quadratic  form.  Conversely, [5XForms[0m allows the user to construct (quadratic)
  forms using a polynomial.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> r := PolynomialRing(GF(8),4);[0X
    [4XGF(2^3)[x_1,x_2,x_3,x_4][0X
    [4Xgap> poly := r.1*r.2+r.3*r.4;[0X
    [4Xx_1*x_2+x_3*x_4[0X
    [4Xgap> qform := QuadraticFormByPolynomial(poly, r);[0X
    [4X< quadratic form >[0X
    [4Xgap> Display(qform);[0X
    [4XQuadratic form[0X
    [4XGram Matrix:[0X
    [4X . 1 . .[0X
    [4X . . . .[0X
    [4X . . . 1[0X
    [4X . . . .[0X
    [4XPolynomial: x_1*x_2+x_3*x_4[0X
    [4Xgap> RadicalOfForm(qform);[0X
    [4X<vector space over GF(2^3), with 0 generators>[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  We  construct  now  two  different  quadratic forms with the same associated
  bilinear form.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> mat := [[Z(16)^3,1,0,0],[0,Z(16)^5,0,0],[0X
    [4X>              [0,0,Z(16)^3,1],[0,0,0,Z(16)^12]]*Z(16)^0;[0X
    [4X[ [ Z(2^4)^3, Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), Z(2^2), 0*Z(2), 0*Z(2) ], [0X
    [4X  [ 0*Z(2), 0*Z(2), Z(2^4)^3, Z(2)^0 ], [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2^4)^12 ] [0X
    [4X ][0X
    [4Xgap> qform := QuadraticFormByMatrix(mat,GF(16));[0X
    [4X< quadratic form >[0X
    [4Xgap> Display( qform );[0X
    [4XQuadratic form[0X
    [4XGram Matrix:[0X
    [4Xz = Z(16)[0X
    [4X  z^3    1    .    .[0X
    [4X    .  z^5    .    .[0X
    [4X    .    .  z^3    1[0X
    [4X    .    .    . z^12[0X
    [4Xgap> mat2 := [[Z(16)^7,1,0,0],[0,0,0,0],[0X
    [4X>              [0,0,Z(16)^2,1],[0,0,0,Z(16)^9]]*Z(16)^0;[0X
    [4X[ [ Z(2^4)^7, Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], [0X
    [4X  [ 0*Z(2), 0*Z(2), Z(2^4)^2, Z(2)^0 ], [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2^4)^9 ] ][0X
    [4Xgap> qform2 := QuadraticFormByMatrix(mat2, GF(16));[0X
    [4X< quadratic form >[0X
    [4Xgap> Display( qform2 );[0X
    [4XQuadratic form[0X
    [4XGram Matrix:[0X
    [4Xz = Z(16)[0X
    [4X  z^7    1    .    .[0X
    [4X    .    .    .    .[0X
    [4X    .    .  z^2    1[0X
    [4X    .    .    .  z^9[0X
    [4Xgap> biform := AssociatedBilinearForm( qform2 );[0X
    [4X< bilinear form >[0X
    [4Xgap> Display( biform );[0X
    [4XBilinear form[0X
    [4XGram Matrix:[0X
    [4X . 1 . .[0X
    [4X 1 . . .[0X
    [4X . . . 1[0X
    [4X . . 1 .[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
  We  end with an example of a non-degenerate quadratic form with a degenerate
  associated bilinear form.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xgap> mat := [ [ Z(2^2), Z(2^2), Z(2^2), Z(2^2), Z(2^2) ], [0X
    [4X>    [ 0*Z(2), Z(2^2), Z(2^2)^2, 0*Z(2), Z(2)^0 ], [0X
    [4X>    [ 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, Z(2)^0 ], [0X
    [4X>    [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0 ], [0X
    [4X>    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ] ];;[0X
    [4Xgap> qform := QuadraticFormByMatrix(mat,GF(4));[0X
    [4X< quadratic form >[0X
    [4Xgap> IsDegenerateForm(qform);[0X
    [4X#I  Testing degeneracy of the *associated bilinear form*[0X
    [4Xtrue[0X
    [4Xgap> biform := AssociatedBilinearForm(qform);[0X
    [4X< bilinear form >[0X
    [4Xgap> Display(biform);[0X
    [4XBilinear form[0X
    [4XGram Matrix:[0X
    [4Xz = Z(4)[0X
    [4X   . z^1 z^1 z^1 z^1[0X
    [4X z^1   . z^2   .   1[0X
    [4X z^1 z^2   .   1   1[0X
    [4X z^1   .   1   .   1[0X
    [4X z^1   1   1   1   .[0X
    [4Xgap> IsDegenerateForm(biform);[0X
    [4Xtrue[0X
    [4X [0X
  [4X------------------------------------------------------------------[0X
  
