Skip to content

Commit

Permalink
Copy examples to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Dec 6, 2023
1 parent 5099b2b commit b99cf2b
Show file tree
Hide file tree
Showing 42 changed files with 1,195 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tst/examples/assocbilform.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
gap> START_TEST("Forms: assocbilform.tst");
gap> #Constructing form: AssociatedBilinearForm
gap> r:= PolynomialRing(GF(121),6);
GF(11^2)[x_1,x_2,x_3,x_4,x_5,x_6]
gap> poly := r.1*r.5-r.2*r.6+r.3*r.4;
x_1*x_5-x_2*x_6+x_3*x_4
gap> form := QuadraticFormByPolynomial(poly,r);
< quadratic form >
gap> aform := AssociatedBilinearForm(form);
< bilinear form >
gap> Display(aform);
Bilinear form
Gram Matrix:
. . . . 1 .
. . . . . 10
. . . 1 . .
. . 1 . . .
1 . . . . .
. 10 . . . .
gap> STOP_TEST("assocbilform.tst", 10000 );
28 changes: 28 additions & 0 deletions tst/examples/basechangehom.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
gap> START_TEST("Forms: basechangehom.tst");
gap> #morphisms: BaseChangeHomomorphism
gap> gl:=GL(3,3);
GL(3,3)
gap> go:=GO(3,3);
GO(0,3,3)
gap> form := PreservedSesquilinearForms(go)[1];
< bilinear form >
gap> gram := GramMatrix( form );
[ [ 0*Z(3), Z(3)^0, 0*Z(3) ], [ Z(3)^0, 0*Z(3), 0*Z(3) ],
[ 0*Z(3), 0*Z(3), Z(3) ] ]
gap> b := BaseChangeToCanonical(form);;
gap> hom := BaseChangeHomomorphism(b, GF(3));
^[ [ 0*Z(3), 0*Z(3), Z(3) ], [ Z(3), Z(3), Z(3)^0 ], [ Z(3), 0*Z(3), Z(3) ] ]
gap> newgo := Image(hom, go);
Group(
[
[ [ Z(3)^0, 0*Z(3), Z(3) ], [ Z(3)^0, Z(3), Z(3)^0 ],
[ 0*Z(3), 0*Z(3), Z(3) ] ],
[ [ Z(3), Z(3)^0, 0*Z(3) ], [ 0*Z(3), Z(3), 0*Z(3) ],
[ Z(3)^0, Z(3)^0, Z(3) ] ] ])
gap> gens := GeneratorsOfGroup(newgo);;
gap> canonical := b * gram * TransposedMat(b);
[ [ Z(3), 0*Z(3), 0*Z(3) ], [ 0*Z(3), 0*Z(3), Z(3)^0 ],
[ 0*Z(3), Z(3)^0, 0*Z(3) ] ]
gap> ForAll(gens, y -> y * canonical * TransposedMat(y) = canonical);
true
gap> STOP_TEST("basechangehom.tst", 10000 );
22 changes: 22 additions & 0 deletions tst/examples/basechangetocanonical.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
gap> START_TEST("Forms: basechangetocanonical.tst");
gap> #morphisms: BaseChangeToCanonical
gap> gf := GF(3);
GF(3)
gap> gram := [
> [0,0,0,1,0,0],
> [0,0,0,0,1,0],
> [0,0,0,0,0,1],
> [-1,0,0,0,0,0],
> [0,-1,0,0,0,0],
> [0,0,-1,0,0,0]] * One(gf);;
gap> form := BilinearFormByMatrix( gram, gf );
< bilinear form >
gap> b := BaseChangeToCanonical( form );;
gap> Display( b * gram * TransposedMat(b) );
. 1 . . . .
2 . . . . .
. . . 1 . .
. . 2 . . .
. . . . . 1
. . . . 2 .
gap> STOP_TEST("basechangetocanonical.tst", 10000 );
8 changes: 8 additions & 0 deletions tst/examples/bg_th_ex1.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
gap> START_TEST("Forms: bg_th_ex1.tst");
gap> #Background theory: example 1
gap> mat := [[1,0,0],[0,1,4],[1,2,1]]*Z(5)^0;
[ [ Z(5)^0, 0*Z(5), 0*Z(5) ], [ 0*Z(5), Z(5)^0, Z(5)^2 ],
[ Z(5)^0, Z(5), Z(5)^0 ] ]
gap> form := BilinearFormByMatrix(mat,GF(5));
Error, Invalid Gram matrix
gap> STOP_TEST("bg_th_ex1.tst", 10000 );
25 changes: 25 additions & 0 deletions tst/examples/bg_th_ex2.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
gap> START_TEST("Forms: bg_th_ex2.tst");
gap> #Background theory: example 2
gap> mat := [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,-1]]*Z(9)^0;
[ [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ],
[ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ], [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3) ] ]
gap> form := BilinearFormByMatrix(mat,GF(9));
< bilinear form >
gap> Display(form);
Bilinear form
Gram Matrix:
1 . . .
. 1 . .
. . 1 .
. . . 2
gap> IsReflexiveForm(form);
true
gap> IsSymmetricForm(form);
true
gap> IsAlternatingForm(form);
false
gap> r := RadicalOfForm(form);
<vector space of dimension 0 over GF(3^2)>
gap> Dimension(r);
0
gap> STOP_TEST("bg_th_ex2.tst", 10000 );
22 changes: 22 additions & 0 deletions tst/examples/bg_th_ex3.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
gap> START_TEST("Forms: bg_th_ex3.tst");
gap> #Background theory: example 3
gap> mat := [[0,0,-2],[0,0,1],[2,-1,0]]*Z(7)^0;
[ [ 0*Z(7), 0*Z(7), Z(7)^5 ], [ 0*Z(7), 0*Z(7), Z(7)^0 ],
[ Z(7)^2, Z(7)^3, 0*Z(7) ] ]
gap> form := BilinearFormByMatrix(mat,GF(7));
< bilinear form >
gap> Display(form);
Bilinear form
Gram Matrix:
. . 5
. . 1
2 6 .
gap> IsSymmetricForm(form);
false
gap> IsAlternatingForm(form);
true
gap> r := RadicalOfForm(form);
<vector space of dimension 1 over GF(7)>
gap> Dimension(r);
1
gap> STOP_TEST("bg_th_ex3.tst", 10000 );
30 changes: 30 additions & 0 deletions tst/examples/bg_th_ex4.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
gap> START_TEST("Forms: bg_th_ex4.tst");
gap> #Background theory: example 4
gap> mat := [[0,1,0,0,0,0],[1,0,0,0,0,0],[0,0,0,0,0,1],
> [0,0,0,0,1,0],[0,0,0,1,0,0],[0,0,1,0,0,0]]*Z(16)^0;
[ [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ],
[ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ],
[ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ],
[ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2) ],
[ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ],
[ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2) ] ]
gap> form := BilinearFormByMatrix(mat,GF(16));
< bilinear form >
gap> Display(form);
Bilinear form
Gram Matrix:
. 1 . . . .
1 . . . . .
. . . . . 1
. . . . 1 .
. . . 1 . .
. . 1 . . .
gap> IsSymmetricForm(form);
true
gap> IsAlternatingForm(form);
true
gap> IsDegenerateForm(form);
false
gap> WittIndex(form);
3
gap> STOP_TEST("bg_th_ex4.tst", 10000 );
84 changes: 84 additions & 0 deletions tst/examples/bg_th_ex5.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
gap> START_TEST("Forms: bg_th_ex5.tst");
gap> #Background theory: example 5
gap> 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)],
> [0*Z(5),-Z(25)^3,0*Z(5),0*Z(5)],[-Z(25)^3,0*Z(5),0*Z(25),0*Z(25)]];
[ [ 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) ],
[ 0*Z(5), Z(5^2)^15, 0*Z(5), 0*Z(5) ],
[ Z(5^2)^15, 0*Z(5), 0*Z(5), 0*Z(5) ] ]
gap> form := HermitianFormByMatrix(mat,GF(25));
< hermitian form >
gap> Display(form);
Hermitian form
Gram Matrix:
z = Z(25)
. . . z^3
. . z^3 .
. z^15 . .
z^15 . . .
gap> WittIndex(form);
2
gap> form2 := BilinearFormByMatrix(mat,GF(25));
< bilinear form >
gap> Display(form2);
Bilinear form
Gram Matrix:
z = Z(25)
. . . z^3
. . z^3 .
. z^15 . .
z^15 . . .
gap> IsAlternatingForm(form2);
true
gap> Display(IsometricCanonicalForm(form));
Hermitian form
Gram Matrix:
1 . . .
. 1 . .
. . 1 .
. . . 1
Witt Index: 2
gap> Display(IsometricCanonicalForm(form2));
Bilinear form
Gram Matrix:
. 1 . .
4 . . .
. . . 1
. . 4 .
Witt Index: 2
gap> V := GF(25)^4;
( GF(5^2)^4 )
gap> u := [Z(5)^0,Z(5^2)^11,Z(5)^3,Z(5^2)^13 ];
[ Z(5)^0, Z(5^2)^11, Z(5)^3, Z(5^2)^13 ]
gap> [u,u]^form;
0*Z(5)
gap> v := [Z(5)^0,Z(5^2)^5,Z(5^2),Z(5^2)^13 ];
[ Z(5)^0, Z(5^2)^5, Z(5^2), Z(5^2)^13 ]
gap> [v,v]^form;
0*Z(5)
gap> [u,v]^form;
Z(5^2)^7
gap> ([v,u]^form)^5;
Z(5^2)^7
gap> w := [Z(5^2)^21,Z(5^2)^19,Z(5^2)^4,Z(5)^3 ];
[ Z(5^2)^21, Z(5^2)^19, Z(5^2)^4, Z(5)^3 ]
gap> [w,w]^form;
Z(5)
gap> v := [Z(5)^0,Z(5^2)^10,Z(5^2)^15,Z(5^2)^3 ];
[ Z(5)^0, Z(5^2)^10, Z(5^2)^15, Z(5^2)^3 ]
gap> u := [Z(5)^3,Z(5^2)^9,Z(5^2)^4,Z(5^2)^16 ];
[ Z(5)^3, Z(5^2)^9, Z(5^2)^4, Z(5^2)^16 ]
gap> w := [Z(5)^2,Z(5^2)^9,Z(5^2)^23,Z(5^2)^11 ];
[ Z(5)^2, Z(5^2)^9, Z(5^2)^23, Z(5^2)^11 ]
gap> [u,v]^form;
0*Z(5)
gap> [u,w]^form;
0*Z(5)
gap> [v,w]^form;
0*Z(5)
gap> s := Subspace(V,[v,u,w]);
<vector space over GF(5^2), with 3 generators>
gap> Dimension(s);
2
gap> WittIndex(form);
2
gap> STOP_TEST("bg_th_ex5.tst", 10000 );
20 changes: 20 additions & 0 deletions tst/examples/bg_th_ex6.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
gap> START_TEST("Forms: bg_th_ex6.tst");
gap> #Background theory: example 6
gap> V := GF(4)^3;
( GF(2^2)^3 )
gap> mat := [[Z(2^2)^2,Z(2^2),Z(2^2)^2],[Z(2^2)^2,Z(2)^0,Z(2)^0],
> [0*Z(2),Z(2)^0,0*Z(2)]];
[ [ Z(2^2)^2, Z(2^2), Z(2^2)^2 ], [ Z(2^2)^2, Z(2)^0, Z(2)^0 ],
[ 0*Z(2), Z(2)^0, 0*Z(2) ] ]
gap> qform := QuadraticFormByMatrix(mat, GF(4));
< quadratic form >
gap> Display( qform );
Quadratic form
Gram Matrix:
z = Z(4)
z^2 1 z^2
. 1 .
. . .
gap> PolynomialOfForm( qform );
Z(2^2)^2*x_1^2+x_1*x_2+Z(2^2)^2*x_1*x_3+x_2^2
gap> STOP_TEST("bg_th_ex6.tst", 10000 );
20 changes: 20 additions & 0 deletions tst/examples/bg_th_ex7.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
gap> START_TEST("Forms: bg_th_ex7.tst");
gap> #Background theory: example 7
gap> r := PolynomialRing(GF(8),4);
GF(2^3)[x_1,x_2,x_3,x_4]
gap> poly := r.1*r.2+r.3*r.4;
x_1*x_2+x_3*x_4
gap> qform := QuadraticFormByPolynomial(poly, r);
< quadratic form >
gap> Display(qform);
Quadratic form
Gram Matrix:
. 1 . .
. . . .
. . . 1
. . . .
Polynomial: x_1*x_2+x_3*x_4

gap> RadicalOfForm(qform);
<vector space of dimension 0 over GF(2^3)>
gap> STOP_TEST("bg_th_ex7.tst", 10000 );
41 changes: 41 additions & 0 deletions tst/examples/bg_th_ex8.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
gap> START_TEST("Forms: bg_th_ex8.tst");
gap> #Background theory: example 8
gap> mat := [[Z(16)^3,1,0,0],[0,Z(16)^5,0,0],
> [0,0,Z(16)^3,1],[0,0,0,Z(16)^12]]*Z(16)^0;
[ [ 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) ],
[ 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 ]
]
gap> qform := QuadraticFormByMatrix(mat,GF(16));
< quadratic form >
gap> Display( qform );
Quadratic form
Gram Matrix:
z = Z(16)
z^3 1 . .
. z^5 . .
. . z^3 1
. . . z^12
gap> mat2 := [[Z(16)^7,1,0,0],[0,0,0,0],
> [0,0,Z(16)^2,1],[0,0,0,Z(16)^9]]*Z(16)^0;
[ [ 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) ],
[ 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 ] ]
gap> qform2 := QuadraticFormByMatrix(mat2, GF(16));
< quadratic form >
gap> Display( qform2 );
Quadratic form
Gram Matrix:
z = Z(16)
z^7 1 . .
. . . .
. . z^2 1
. . . z^9
gap> biform := AssociatedBilinearForm( qform2 );
< bilinear form >
gap> Display( biform );
Bilinear form
Gram Matrix:
. 1 . .
1 . . .
. . . 1
. . 1 .
gap> STOP_TEST("bg_th_ex8.tst", 10000 );
28 changes: 28 additions & 0 deletions tst/examples/bg_th_ex9.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
gap> START_TEST("Forms: bg_th_ex9.tst");
gap> #Background theory: example 9
gap> mat := [ [ Z(2^2), Z(2^2), Z(2^2), Z(2^2), Z(2^2) ],
> [ 0*Z(2), Z(2^2), Z(2^2)^2, 0*Z(2), Z(2)^0 ],
> [ 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, Z(2)^0 ],
> [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0 ],
> [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ] ];;
gap> qform := QuadraticFormByMatrix(mat,GF(4));
< quadratic form >
gap> IsSingularForm(qform);
false
gap> IsDegenerateForm(qform);
#I Testing degeneracy of the *associated bilinear form*
true
gap> biform := AssociatedBilinearForm(qform);
< bilinear form >
gap> Display(biform);
Bilinear form
Gram Matrix:
z = Z(4)
. z^1 z^1 z^1 z^1
z^1 . z^2 . 1
z^1 z^2 . 1 1
z^1 . 1 . 1
z^1 1 1 1 .
gap> IsDegenerateForm(biform);
true
gap> STOP_TEST("bg_th_ex9.tst", 10000 );
Loading

0 comments on commit b99cf2b

Please sign in to comment.