File: groebner.gd

package info (click to toggle)
gap 4r4p10-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 29,224 kB
  • ctags: 7,084
  • sloc: ansic: 98,591; sh: 3,284; perl: 2,263; makefile: 467; awk: 6
file content (271 lines) | stat: -rw-r--r-- 11,187 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#############################################################################
##
#W  groebner.gd                   GAP Library               Alexander Hulpke   
##
#H  @(#)$Id: groebner.gd,v 4.1.2.2 2006/03/28 16:34:44 gap Exp $
##
#Y  Copyright (C) 2002 The GAP Group
##
##  This file contains the declarations for monomial orderings and Groebner
##  bases.
Revision.groebner_gd :=
    "@(#)$Id: groebner.gd,v 4.1.2.2 2006/03/28 16:34:44 gap Exp $";

#############################################################################
##
#P  IsPolynomialRingIdeal(<I>)
##
##  A polynomial ring ideal is a (two sided) ideal in a (commutative)
##  polynomial ring.
DeclareSynonym("IsPolynomialRingIdeal",
  IsRing and IsRationalFunctionCollection and HasLeftActingRingOfIdeal
  and HasRightActingRingOfIdeal);

#############################################################################
##
#V  InfoGroebner
##
##  This info class gives information about Groebner basis calculations.
DeclareInfoClass("InfoGroebner");

#############################################################################
##
#C  IsMonomialOrdering(<obj>)
##
##  A monomial ordering is an object representing a monomial ordering. Its 
##  attributes `MonomialComparisonFunction' and
##  `MonomialExtrepComparisonFun' are actual comparison functions.
DeclareCategory("IsMonomialOrdering",IsObject);

#############################################################################
##
#R  IsMonomialOrderingDefaultRep
##
DeclareRepresentation("IsMonomialOrderingDefaultRep",
  IsAttributeStoringRep and IsPositionalObjectRep and IsMonomialOrdering,[]);

BindGlobal("MonomialOrderingsFamily",
  NewFamily("MonomialOrderingsFamily",IsMonomialOrdering,IsMonomialOrdering));

#############################################################################
##
#A  MonomialComparisonFunction(<O>)
##
##  If <O> is an object representing a monomial ordering, this attribute
##  returns a *function* that can be used to compare or sort monomials (and
##  polynomials which will be compared by their monomials in decreasing
##  order) in this order.
DeclareAttribute("MonomialComparisonFunction",IsMonomialOrdering);


#############################################################################
##
#A  MonomialExtrepComparisonFun(<O>)
##
##  If <O> is an object representing a monomial ordering, this attribute
##  returns a *function* that can be used to compare or sort monomials *in
##  their external representation* (as lists). This comparison variant is
##  used inside algorithms that manipulate the external representation.
DeclareAttribute("MonomialExtrepComparisonFun",IsObject);

#############################################################################
##
#A  OccuringVariableIndices(<O>)
#A  OccuringVariableIndices(<P>)
##
##  If <O> is an object representing a monomial ordering, this attribute
##  returns either a list of variable indices for which this ordering is
##  defined, or `true' in case it is defined for all variables.
##
##  If <P> is a polynomial, it returns the indices of all variables occuring
##  in it.
DeclareAttribute("OccuringVariableIndices",IsMonomialOrdering);

#############################################################################
##
#F  LeadingMonomialOfPolynomial(<pol>,<ord>)
##
##  returns the leading monomial (with respect to the ordering <ord>)
##  of the polynomial <pol>.
##
DeclareOperation("LeadingMonomialOfPolynomial",
  [IsPolynomialFunction,IsMonomialOrdering]);

#############################################################################
##
#O  LeadingCoefficientOfPolynomial( <pol>,<ord> )
##
##  returns the leading coefficient (that is the coefficient of the leading
##  monomial, see~"LeadingMonomialOfPolynomial") of the polynomial <pol>.
##
DeclareOperation("LeadingCoefficientOfPolynomial",
  [IsPolynomialFunction,IsMonomialOrdering]);

#############################################################################
##
#F  LeadingTermOfPolynomial(<pol>,<ord>)
##
##  returns the leading term (with respect to the ordering <ord>)
##  of the polynomial <pol>, i.e. the product of leading coefficient and
##  leading monomial.
##
DeclareOperation("LeadingTermOfPolynomial",
  [IsPolynomialFunction,IsMonomialOrdering]);


#############################################################################
##
#F  MonomialLexOrdering()
#F  MonomialLexOrdering(<vari>)
##
##  This function creates a lexicographic ordering for monomials. Monomials
##  are compared first by the exponents of the largest variable, then the
##  exponents of the second largest variable and so on.
##
##  The variables are ordered according to their (internal) index, i.e. $x_1$
##  is larger than $x_2$ and so on.
##  If <vari> is given, and is a list of variables or variable indices,
##  instead this arrangement of variables (in descending order; i.e. the
##  first variable is larger than the second) is 
##  used as the underlying order of variables.
DeclareGlobalFunction("MonomialLexOrdering");

#############################################################################
##
#F  MonomialGrlexOrdering()
#F  MonomialGrlexOrdering(<vari>)
##
##  This function creates a degree/lexicographic ordering. In this oredring
##  monomials are compared first by their total degree, then lexicographically
##  (see `MonomialLexOrdering').
##
##  The variables are ordered according to their (internal) index, i.e. $x_1$
##  is larger than $x_2$ and so on.
##  If <vari> is given, and is a list of variables or variable indices,
##  instead this arrangement of variables (in descending order; i.e. the
##  first variable is larger than the second) is 
##  used as the underlying order of variables.
DeclareGlobalFunction("MonomialGrlexOrdering");

#############################################################################
##
#F  MonomialGrevlexOrdering()
#F  MonomialGrevlexOrdering(<vari>)
##
##  This function creates a ``grevlex'' ordering. In this ordering monomials
##  are compared first by total degree and then backwards lexicographically.
##  (This is different than ``grlex'' ordering with variables reversed.) 
##
##  The variables are ordered according to their (internal) index, i.e. $x_1$
##  is larger than $x_2$ and so on.
##  If <vari> is given, and is a list of variables or variable indices,
##  instead this arrangement of variables (in descending order; i.e. the
##  first variable is larger than the second) is 
##  used as the underlying order of variables.
DeclareGlobalFunction("MonomialGrevlexOrdering");

#############################################################################
##
#F  EliminationOrdering(<elim>)
#F  EliminationOrdering(<elim>,<rest>)
##
##  This function creates an elimination ordering for eliminating the
##  variables in <elim>. Two monomials are compared first by the exponent
##  vectors for the variables listed in <elim> (a lexicographic comparison
##  with respect to the ordering indicated in <elim>).
##  If these submonomial are equal, the submonomials given by the other
##  variables are compared by a graded lexicographic ordering (with respect
##  to the variable order given in <rest>, if called with two parameters).
##  
##  Both <elim> and <rest> may be a list of variables of a list of variable
##  indices.
DeclareGlobalFunction("EliminationOrdering");

#############################################################################
##
#F  PolynomialDivisionAlgorithm(<poly>,<gens>,<order>)
##
##  This function implements the division algorithm for multivariate
##  polynomials as given in theorem~3 in chapter~2 of \cite{coxlittleoshea}.
##  (It might be slower than `PolynomialReduction' but the remainders are
##  guaranteed to agree with the textbook.)
##
##  The operation returns a list of length two, the first entry is the
##  remainder after the reduction. The second entry is a list of quotients
##  corresponding to <gens>.
DeclareGlobalFunction("PolynomialDivisionAlgorithm");

#############################################################################
##
#F  PolynomialReduction(<poly>,<gens>,<order>)
##
##  reduces the polynomial <poly> by the ideal generated by the polynomials
##  in <gens>, using the order <order> of monomials.  Unless <gens> is a
##  Gr{\accent127 o}bner basis the result is not guaranteed to be unique.
##
##  The operation returns a list of length two, the first entry is the
##  remainder after the reduction. The second entry is a list of quotients
##  corresponding to <gens>.
##
##  Note that the strategy used by `PolynomialReduction' differs from the 
##  standard textbook reduction algorithm, which is provided by
##  `PolynomialDivisionAlgorithm'.
DeclareGlobalFunction("PolynomialReduction");

#############################################################################
##
#F  PolynomialReducedRemainder(<poly>,<gens>,<order>)
##
##  thios operation does the same way as `PolynomialReduction'
##  (see~"PolynomialReduction") but does not keep track of the actual quotients
##  and returns only the remainder (it is therfore slightly faster).
DeclareGlobalFunction("PolynomialReducedRemainder");


#############################################################################
##
#O  GroebnerBasis(<L>,<O>)
#O  GroebnerBasis(<I>,<O>)
#O  GroebnerBasisNC(<L>,<O>)
##
##  Let <O> be a monomial ordering and <L> be a list of polynomials that
##  generate an ideal <I>. This operation returns a Groebner basis of
##  <I> with respect to the ordering <O>.\\
##
##  `GroebnerBasisNC' works like `GroebnerBasis' with the only distinction
##  that the first argument has to be a list of polynomials and that no test is
##  performed to check whether the ordering is defined for all occuring
##  variables.
##
##  Note that {\GAP} at the moment only includes
##  a na{\"\i}ve implementation of Buchberger's algorithm (which is mainly
##  intended as a teaching tool). It might not be
##  sufficient for serious problems.
DeclareOperation("GroebnerBasis",
  [IsHomogeneousList and IsRationalFunctionCollection,IsMonomialOrdering]);
DeclareOperation("GroebnerBasis",[IsPolynomialRingIdeal,IsMonomialOrdering]);
DeclareGlobalFunction("GroebnerBasisNC");

#############################################################################
##
#O  ReducedGroebnerBasis(<L>,<O>)
#O  ReducedGroebnerBasis(<I>,<O>)
##
##  a Groebner basis <B> (see~"GroebnerBasis") is *reduced* if no monomial
##  in a polynomial in <B> is divisible by the leading monomial of another
##  polynomial in <B>. This operation computes a Groebner basis with respect
##  to <O> and then reduces it.
DeclareOperation("ReducedGroebnerBasis",
  [IsHomogeneousList and IsRationalFunctionCollection,IsMonomialOrdering]);
DeclareOperation("ReducedGroebnerBasis",
  [IsPolynomialRingIdeal,IsMonomialOrdering]);

#############################################################################
##
#A  StoredGroebnerBasis(<I>)
##
##  For an ideal <I> in a polynomial ring, this attribute holds a list
##  [<B>,<O>] where <B> is a Groebner basis for the monomial ordering <O>.
##  this can be used to test membership or canonical coset representatives.
DeclareAttribute("StoredGroebnerBasis",IsPolynomialRingIdeal);