1----------------------------------------------------------------------
2-- Hilbert Functions 1
3-- Gradings
4----------------------------------------------------------------------
5
6-- INTRODUCTION
7
8-- In CoCoA there are two degree functions:  deg and wdeg
9
10use QQ[x,y,z];
11-- The default is the standard grading, i.e. all indeterminates have degree 1
12
13T := x^3*y^4*z^5;
14deg(T);
15wdeg(T);
16
17-- In this course we are interested in wdeg, the degree defined by a
18-- weight matrix.
19
20-- The degree is an intrinsic attribute of a polynomial ring; this is
21-- how to specify a weight matrix in a ring definition:
22-- the standard grading
23
24WSt := RowMat([1,1,1]);
25P := NewPolyRing(QQ, "x,y,z", MakeTermOrd(WSt), NumRows(WSt));
26use P;
27wdeg(BringIn(T));
28
29-- a 2-grading with whose first row is standard
30W2St := mat([[1,1,1], [1,2,0]]);
31P := NewPolyRing(QQ, "x,y,z", MakeTermOrd(W2St), NumRows(W2St));
32use P;
33wdeg(BringIn(T));
34
35-- a 2-grading with whose first row is not standard
36W := mat([[1,2,3], [1,2,0]]);
37P := NewPolyRing(QQ, "x,y,z", MakeTermOrd(W), NumRows(W));
38use P;
39wdeg(BringIn(T));
40
41-- NB: In CoCoA-4 not all positive gradings are allowed, e.g.
42-- this is a positive grading:
43WFine := LexMat(3);  WFine;
44-- but CoCoA-4 requires that all the elements in the first row must be
45-- all strictly positive
46P := NewPolyRing(QQ, "x,y,z", WFine, 3);
47use P;
48wdeg(BringIn(T));
49
50-- NB: In this prototype of CoCoA-5 not all positive gradings are allowed e.g.
51-- this is a positive grading:
52WNeg := StdDegRevLexMat(3);  WNeg;
53-- but CoCoA-5 requires that all weights are non-negative
54P := NewPolyRing(QQ, "x,y,z", WNeg, 1); --> this is OK
55//  P := NewPolyRing(QQ, "x,y,z", WNeg, 2);
56-- we will see that this is not a problem in tutorial 3
57
58----------------------------------------------------------------------
59-- TIME TO EXPERIMENT!
60
61-- we want to experiment with many weight matrices, so it is more convenient
62-- to define a function  MyDeg(T, W)
63-- where T is a monomial, and W a weight matrix:
64
65use QQ[x,y,z];
66T := x^3*y^4*z^5;
67
68define MyDeg(T, W)
69  R := RingOf(W);
70  deg := W * ColMat(R,exponents(T));
71  return [AsINT(deg[i,1]) | i in 1..NumRows(deg)];
72enddefine; -- MyDeg
73-- test
74MyDeg(T, WSt);
75MyDeg(T, W2St);
76MyDeg(T, W);
77MyDeg(T, WFine);
78
79-- EXERCISE
80-- Compute the following sets with your preferred technique:
81-- by reasoning, by hand, by trial and Error, by brute force computing....
82-- Then verify your sets with CoCoA.
83-- (1) all power-products of degree 4 wrt WSt
84-- (2) all power-products of degree (4,2) wrt W2St
85-- (3) all power-products of degree (6,2) wrt W
86-- (4) all power-products of degree (6,2,1) wrt WFine
87L := support((x+y+z)^4);  L;
88
89-- brute force computing:
90L := support((x+y+z+1)^9);  L;
91[ T in L | MyDeg(T, WSt) = [4] ];
92[ T in L | MyDeg(T, W2St) = [4,2] ];
93[ T in L | MyDeg(T, W) = [6,2] ];
94[ T in L | MyDeg(T, WFine) = [6,2,1] ];
95
96-- EXERCISE
97-- Given two weight matrices W1, W2 such that W2 = M*W1, det(M)<>0,
98-- find (by reasoning) how to compute the W1-degree given the W2-degree.
99-- Deduce that the homogeneous components are the same.
100-- Implement the function  W1Deg(D2, M), where D2 a W2-degree,
101-- and test it on some examples.
102-- Show how this applies to the case of a "positive-type" grading.
103
104-- EXERCISE
105-- Standard grading (nice and easy ;-)
106-- Consider P/I, where
107I := ideal(x^3, x*y, y^4, y*z^2, y^3*z, z^3);
108-- Compute all power-products not in I of degree 0, 1, 2, 3, 4, ....
109-- Compute the dimension (QQ-vec.sp.) of P/I in degree 0, 1, 2, 3, 4, ....
110
111