Constructing forms and basic functionality

In this chapter, all operations to construct sesquilinear and quadratic forms are listed, along with their basic attributes and properties.

Important filters
Categories for forms
The categories IsBilinearForm and IsHermitianForm are categories for bilinear and hermitian forms, respectively. They are disjoint and are both contained in the category IsSesquilinearForm.

Quadratic forms are contained in the category IsQuadraticForm. The categories IsSesquilinearForm and IsQuadraticForm are disjoint and are both contained in the category IsForm.

The user is allowed to construct the trivial form (mapping all vectors to the zero element of the field). The trivial form is an object in the category IsTrivialForm. This category is contained in IsForm and disjoint from IsSesquilinearForm and IsQuadraticForm.
Representation for forms
Every form is represented by a matrix, the base field and a string describing the ``type'' of the form.
Constructing forms using a matrix
a bilinear form
The argument matrix must be a symmetric, or skew-symmetric, square matrix over the finite field field. The argument field is an optional argument, and if it is not given, then we assume that the defining field of the bilinear form is the smallest field containing the entries of matrix. Below we give an example where the defining field can make a difference in some applications. As it is only possible to construct reflexive bilinear forms, it is checked whether the matrix matrix is symmetric or skew symmetric. If matrix matrix is not symmetric nor skew symmetric, then an error message is returned. The output is a bilinear form (i.e., an object in IsBilinearForm) with Gram matrix matrix and defining field field. (See for more on bilinear forms). <#Include SYSTEM "../examples/include/bilformbymatrix.include">
a quadratic form
The argument matrix must be a square matrix over the finite field field. The argument field is an optional argument, and if it is not given, then we assume that the defining field of the bilinear form is the smallest field containing the entries of matrix. Below we give an example where the defining field can make a difference in some applications. Any square matrix determines a quadratic form, but the Gram matrix is recomputed so that it is an upper triangle matrix. The output is a quadratic form (i.e., an object in IsQuadraticForm) with defining field field. (See for more on bilinear forms). <#Include SYSTEM "../examples/include/quadformbymatrix.include"> The following example shows how using the argument field has influence on the properties of the constructed form. <#Include SYSTEM "../examples/include/quadformfields.include">
a quadratic form
The argument matrix must be a hermitian square matrix over the finite field field, and field has square order. The field must be specified, since we can only determine the smallest field containing the entries of matrix. As it is only possible to construct reflexive sesquilinear forms, it is checked whether the matrix is a hermitian matrix, and if not, an error message is returned. The output is a hermitian sesquilinear form (i.e., an object in IsHermitianForm) with Gram matrix matrix and defining field field. (See for more on hermitian forms). <#Include SYSTEM "../examples/include/hermitianformbymatrix.include">
Constructing forms using a polynomial
Suppose that f is a sesquilinear form on an n-dimensional vectorspace. Consider a vector x with coordinates x_1,\ldots,x_{n}x<sub>1</sub>,...,x<sub>n</sub> with x_ix<sub>i</sub> indeterminates over the field. Then f(x,x) is a polynomial in n indeterminates. When f is alternating, f(x,x) is identically zero, but in all other cases, f(x,x) determines f completely.

Conversely, suppose that Q is a quadratic form on an n-dimensional vectorspace. Consider a vector x with coordinates x_1,\ldots,x_{n}x<sub>1</sub>,...,x<sub>n</sub> with x_ix<sub>i</sub> indeterminates over the field. Then Q(x) is a polynomial in n indeterminates, and Q(x) determines Q completely.

Forms
provides functionality to construct bilinear, hermitian and quadratic forms using an appropriate polynomial. a bilinear form The argument poly must be a polynomial in the polynomial ring r. The (optional) last argument is the dimension for the underlying vector space of the resulting form, which by default is the number of indeterminates specified by poly. It is checked whether the polynomial is a homogeneous polynomial of degree two over the given field, and if not, an error message is returned. It is not possible to construct a nontrivial bilinear form from a polynomial in even characteristic. The output is a bilinear (orthogonal) form in the category IsBilinearForm. (See for more on bilinear forms). <#Include SYSTEM "../examples/include/bilformbypoly.include">

a quadratic form
The argument poly must be a polynomial in the polynomial ring r. The (optional) last argument is the dimension for the underlying vector space of the resulting form, which by default is the number of indeterminates specified by poly. It is checked whether the polynomial is a homogeneous polynomial of degree two over the given field, and if not, an error message is returned. The output is a quadratic form in the category IsQuadraticForm. (See for more on quadratic forms). <#Include SYSTEM "../examples/include/quadformbypoly.include">
an hermitian form
The argument poly must be a polynomial in the polynomial ring r defined over a finite field of square order q^2q<sup>2</sup> The (optional) last argument is the dimension for the underlying vector space of the resulting form, which by default is the number of indeterminates specified by poly. It is checked whether the polynomial is a homogeneous polynomial of degree q+1, and if not, an error message is returned. The output is a hermitian form in the category IsHermitianForm. (See for more on hermitian forms). <#Include SYSTEM "../examples/include/hermitianformbypoly.include">
Switching between bilinear and quadratic forms
When the characteristic of the field is odd, a homogeneous quadratic polynomial determines a bilinear form, and a quadratic form. In some situations, when a quadratic form Q is given, it is useful to consider the bilinear form f such that f(v,v)=Q(v), i.e., the bilinear form which is determined by exactly the same polynomial determining the quadratic form Q. `Forms` provides functionality to construct a bilinear form f from a given quadratic form Q such that f(v,v)=Q(v). Conversely, we can extract a quadratic form from a given bilinear form. a quadratic form The argument form is an orthogonal bilinear form (and thus it belongs to IsBilinearForm), otherwise a ``No method found'' error is returned. The output is the quadratic form Q (an object in IsQuadraticForm), such that Q(v) = form(v,v) for all vectors v in a vector space equipped with form. An error is returned when the characteristic of the field is even, or when form is not orthogonal. <#Include SYSTEM "../examples/include/quadformbybilform.include"> Note that the given bilinear form form is not the associated bilinear form of the constructed quadratic form Q, according to the definition in Section . We can construct the associated bilinear forms by using . (See for more on quadratic forms).

a bilinear form
The argument Q must be a quadratic form (and thus it belongs to IsQuadraticForm). The output is the orthogonal bilinear form f (an object in IsBilinearForm), such that f(v,v) = Q(v) for all vectors v in a vector space equipped with Q. An error is returned when the characteristic of the field is even. <#Include SYSTEM "../examples/include/bilformbyquadform.include"> Note that the constructed bilinear form f is not the associated bilinear form of the given quadratic form Q, according to the definition in Section . We can construct the associated bilinear forms by using . (See for more on quadratic forms).
a bilinear form
The argument Q must be a quadratic form (and thus it belongs to IsQuadraticForm). The output is the associated bilinear form f (an object in IsBilinearForm), as defined in Section , i.e. the bilinear form f such that f(v,w) = Q(v+w)-Q(v)-Q(w) for all vectors v,w in a vector space equipped with Q. (See for more on quadratic forms). <#Include SYSTEM "../examples/include/assocbilform.include">
Evaluating forms
a finite field element
The argument f is either a sesquilinear or quadratic form defined over a finite field GF(q). The other argument is a pair of vectors or matrices, or a single vector or matrix, which represent the bases of given subspaces of GF(q)^dGF(q)<sup>d</sup>. This operation evaluates the form on the given vector or pair of vectors and returns an element in GF(q). There is also an overloading of the operation \^ where (u,v)^f represents f(u,v) in the case that f is sesquilinear, and u^f stands for f(u) in the quadratic case. So for convenience, the user may use this compressed version of this operation, which we show in the following example: <#Include SYSTEM "../examples/include/evalform.include">
Orthogonality, totally isotropic subspaces, and totally singular subspaces
a base of the subspace orthogonal to the given vector with relation to the given form
The argument form is a sesquilinear or quadratic form. The operation returns a base of the subspace orthogonal to the given vector v with relation to the sesquilinear form or with relation to the associated bilinear form of the quadratic form form <#Include SYSTEM "../examples/include/orthogonaltovector.include">
true or false
The operation return true if and only if v is isotropic with relation to the sesquilinear or quadratic form form. <#Include SYSTEM "../examples/include/isisotropicvector.include">
true or false
The operation return true if and only if v is singular with relation to the quadratic form form. Note that only when the characteristic of the field is odd, the singular vectors with relation to a quadratic form are the isotropic vectors with relation to its associated form. <#Include SYSTEM "../examples/include/issingularvector.include">
true or false
The operation return true if and only if the subspace spanned by the vectors in the list sub is totally isotropic with relation to the sesquilinear or quadratic form form. Note that when form is a quadratic form, it is checked whether sub generates a subspace that is totally isotropic with relation to the associated bilinear form of form. <#Include SYSTEM "../examples/include/istotallyisotropic.include">
true or false
The operation return true if and only if the subspace spanned by the vectors in the list sub is totally singular with relation to quadratic form form. Note that only when the characteristic of the field is odd, the totally singular subspaces of given dimension n with relation to a quadratic form are exactly the totally isotropic subspaces of dimension n with relation to its associated form. <#Include SYSTEM "../examples/include/istotallysingular.include">
Attributes and properties of forms
true or false.
A sesquilinear form f on a vector space V is reflexive Form if f(v,w)=0 \Rightarrow f(w,v)=0 for all v,w \in V. The argument f must be a sesquilinear form (and thus it belongs to IsSesquilinearForm). A sesquilinear form f is reflexive if whenever we have f(u,v)=0, for two vectors u,v in the associated vector space, then we also have f(v,u)=0. This attribute simply returns true or false according to whether f is reflexive or not, and is stored as a property of f. It is not possible in this version of `Forms` to construct non-reflexive forms. (See for more on reflexive sesquilinear forms).
true or false.
A sesquilinear form f on a vector space V is alternating Form if f(v,v)=0 for all v \in V. The argument f must be a sesquilinear form (and thus it belongs to IsSesquilinearForm). A bilinear form f is alternating if f(v,v)=0 for all v. This method simply returns true or false according to whether f is alternating or not, and is stored as a property of f. (See for more on alternating sesquilinear forms).
true or false.
A sesquilinear form f on a vector space V is symmetric Form if f(v,w)=f(w,v) for all v,w \in V. The argument f must be a sesquilinear form (and thus it belongs to IsSesquilinearForm). A bilinear form f is symmetric if f(u,v)=f(v,u) for all pairs of vectors u and v. This attribute simply returns true or false according to whether f is symmetric or not, and is stored as a property of f. (See for more on symmetric sesquilinear forms).
true or false.
The argument f must be a sesquilinear form (and thus it belongs to IsSesquilinearForm). A bilinear form f is called orthogonal Form if the characteristic of the underlying field is odd, and f is a symmetric form. (See for more on bilinear forms). This operation simply returns true or false according to whether f is an orthogonal bilinear form or not, and is stored as a property of f.
true or false.
When the characteristic of the field is odd, we call a form f orthogonal if and only f is symmetric, and when the characteristic of the field is even, we call a form f pseudo Form if and only if f is symmetric but not alternating. The argument f must be a sesquilinear form (and thus it belongs to IsSesquilinearForm). (See for more on pseudo forms). This method simply returns true or false according to whether f is a pseudo form or not, and is stored as a property of f.
true or false.
We call a bilinear form f symplectic Form if and only if f is alternating. The argument f must be a sesquilinear form (and thus it belongs to IsSesquilinearForm). (See for more on symplectic forms). This method simply returns true or false according to whether f is symplectic or not, and is stored as a property of f.
true or false.
The argument f must be a form (and thus it belongs to IsForm). A sesquilinear form f is degenerate if its radical is non-trivial. A quadratic form is degenerate if and only if the radical of the associated bilinear form is non-trivial. Note that degeneracy for quadratic forms is too restrictive if the characteristic is even. See also . This attribute simply returns true or false according to whether f is degenerate or not, and is stored as a property of f.
true or false.
The argument f must be a quadratic form (and thus it belongs to IsQuadraticForm). A quadratic form f is singular if its radical is non-trivial. When the characteristic of the field is odd, a quadratic form is singular if and only if it is degenerate. This is not the case when the characteristic of the field is even. This method simply returns true or false according to whether f is singular or not, and is stored as a property of f.
the underlying field of f.
The argument f must be a form (and thus it belongs to IsForm). The method returns the field which is stored as the defining field of f. We sometimes stipulate in `Forms` that a form have a defining field, for mathematical reasons. Clearly, to define a hermitian form one needs to specify the field of scalars for the vector space that you wish your hermitian form to act on. The default, if the user has not specified a field on creation of a form, is the smallest field containing the entries or coefficients of the input (a matrix or polynomial). Having a particular defining field for a form can be very useful, for example, when one wants to find a change of basis from one form to another (isometric) form. In this case, one needs to know in which GL(d,q) the base-transition matrix should be taken.
the Gram matrix of f.
The argument f must be a form (and thus it belongs to IsForm). This method returns the Gram matrix of f (see and ).
The radical of the form f
The argument f must be a form (and thus it belongs to IsForm) on some vector space V. The radical of a form f is the subspace consisting of vectors which are orthogonal to every vector, i.e., Rad(f) = \{v \in V | f(v,w) = 0,\, \forall w \in V\}.Rad(f) = {v ∈ V | f(v,w) = 0 for all w ∈ V}. <#Include SYSTEM "../examples/include/radicalofform.include">
the polynomial associated with f.
The argument f must be a form (and thus it belongs to IsForm). All forms, except for bilinear forms in even characteristic, have an associated polynomial defining a quadratic or hermitian form (see and ). This method returns the polynomial associated with f, and if not already bound, stores it as a property of f. <#Include SYSTEM "../examples/include/polyofform.include">
a string
The argument f must be a form (and thus it belongs to IsForm). Given a quadratic or bilinear form f of even dimension, this operation returns a string: ``square'' or ``nonsquare''. More specifically, let f be a from over GF(q), and let M be the Gram matrix of f. Define the discriminant of Q (n.b., quasideterminant in ) as `square' if det(M) is a square of GF(q), and `non-square' otherwise. The discriminant is an invariant of nondegenerate orthogonal spaces over finite fields of odd order, up to isometry. Thus, discriminants can be used to delineate the isometry type of an orthogonal form in even (algebraic) dimension. The discriminant of a hermitian form is not defined, and applying this operation on a hermitian form, will result in an error message. <#Include SYSTEM "../examples/include/discofform.include">
Recognition of sesquilinear forms preserved by a classical group

In this section, we describe a function that was initially developed by Frank Celler (and which has now been adapted to `Forms`) for the recognition of sesquilinear forms left invariant by a matrix group. More importantly, we should stress that this routine differs to that already offered by the `MeatAxe` in that it finds sesquilinear forms preserved up to scalars. Eventually, the procedure used for finding preserved sesquilinear forms does use the `MeatAxe` but in some cases it can rule out the existence of preserved forms without calling the `MeatAxe`. For more information on the algorithm, please see .

a list of forms
The argument group is a matrix group. The function uses random methods to find all of the bilinear or unitary forms preserved by group (the trivial form is also a possibility) up to a scalar. Since the procedure relies on a pseudo-random generator, the user may need to execute the operation more than once to find all invariant sesquilinear forms. <#Include SYSTEM "../examples/include/pres_sesforms1.include"> Here is another example which shows that this procedure is suitable in some cases where using the `MeatAxe` is not applicable. Here, our matrix group is the group of similarities preserving a (hyperbolic) bilinear form on GF(3)^6. <#Include SYSTEM "../examples/include/pres_sesforms2.include">
The trivial form and some of its properties

It can be useful to work with trivial a quadratic or sesquilinear form, i.e. a form mapping all vectors, couples of vectors respectively, to the zero element of their basefield. As mentioned in Section , `Forms` allows the construction of an object in the Category IsTrivialForm. <#Include SYSTEM "../examples/include/trivialform.include">

As we have seen by the above example, there is only one trivial form for a given vector space over a finite field, and such a trivial form can result from the construction of a quadratic form or a sesquilinear form, but the trivial form itself is none of these, although it can behave as a sesquilinear or a quadratic form, depending on its arguments.

<#Include SYSTEM "../examples/include/trivialform2.include">

The attributes and properties described in Section are all applicable to trivial forms.

<#Include SYSTEM "../examples/include/trivialform_prop.include">