source: git/Singular/LIB/ratgb.lib @ 380a17b

spielwiese
Last change on this file since 380a17b was 380a17b, checked in by Hans Schoenemann <hannes@…>, 11 years ago
fix: new version numbers for libs
  • Property mode set to 100644
File size: 13.0 KB
Line 
1/////////////////////////////////////////////////////////////////////////
2version="version ratgb.lib 4.0.0.0 Jun_2013 ";
3category="Noncommutative";
4info="
5LIBRARY: ratgb.lib  Groebner bases in Ore localizations of noncommutative G-algebras
6AUTHOR: Viktor Levandovskyy,     levandov@risc.uni-linz.ac.at
7
8OVERVIEW:
9Theory: Let A be an operator algebra with @code{R = K[x1,.,xN]} as subring.
10The operators are usually denoted by @code{d1,..,dM}.
11
12Assume, that A is a @code{G}-algebra, then the set @code{S=R-0} is multiplicatively
13closed Ore set in A.
14That is, for any s in S and a in A, there exist t in S and b in A, such that @code{sa=bt}.
15In other words, one can transform any left fraction into a right fraction.
16The algebra @code{A_S} is called an Ore localization of A with respect to S.
17
18This library provides Groebner basis procedure for A_S, performing polynomial (that is
19fraction-free) computations only. Note, that there is ongoing development of the
20subsystem called Singular:Locapal, which will provide yet another approach to Groebner
21bases over such Ore localizations.
22
23Assumptions: in order to treat such localizations constructively, some care need to be taken.
24We will assume that the variables @code{x1,...,xN} from above (which will become invertible
25in the localization) come as the first block among the variables of the basering.
26Moreover, the ordering on the basering must be an antiblock ordering, that is its
27matrix form has the left upper @code{NxN} block zero. Here is a recipe to create such
28an ordering easily: use 'a(w)' definitions of the ordering N times with intvecs @code{w_i}
29of the following form: @code{w_i} has first N components zero. The rest entries need to
30be positive and such, that @code{w1,..,wN} are linearly independent (see an example below).
31
32Guide: with this library, it is possible
33- to compute a Groebner basis of an ideal or a submodule in the 'rational'
34  Ore localization D = A_S
35- to compute a dimension of associated graded submodule (called D-dimension)
36- to compute a vector space dimension over Quot(R) of a submodule of
37  D-dimension 0 (so called D-finite submodule)
38- to compute a basis over Quot(R) of a D-finite submodule
39
40PROCEDURES:
41ratstd(I, n); compute Groebner basis and dimensions in Ore localization of the basering
42
43Support: SpezialForschungsBereich F1301 of the Austrian FWF and
44Transnational Access Program of RISC Linz, Austria
45
46SEE ALSO: jacobson_lib
47";
48
49LIB "poly.lib";
50LIB "dmodapp.lib"; // for Appel1, Appel2, Appel4
51
52
53static proc rm_content_id(def J)
54"USAGE:  rm_content_id(I);  I an ideal/module
55RETURN:  the same type as input
56PURPOSE: remove the content of every generator of I
57EXAMPLE: example rm_content_id; shows examples
58"
59{
60  def  I = J;
61  int i;
62  int s = ncols(I);
63  for (i=1; i<=s; i++)
64  {
65    if (I[i]!=0)
66    {
67      I[i] = I[i]/content(I[i]);
68    }
69  }
70  return(I);
71}
72example
73{
74  "EXAMPLE:"; echo = 2;
75  ring r = (0,k,n),(K,N),dp;
76  ideal I = n*((k+1)*K - (n-k)), k*((n-k+1)*N - (n+1));
77  I;
78  rm_content_id(I);
79  module M = I[1]*gen(1), I[2]*gen(2);
80  print(rm_content_id(M));
81}
82
83proc ratstd(def I, int is, list #)
84"USAGE:  ratstd(I, n [,eng]);  I an ideal/module, n an integer, eng an optional integer
85RETURN:  ring
86PURPOSE: compute the Groebner basis of I in the Ore localization of
87the basering with respect to the subalgebra, generated by first n variables
88ASSUME: the variables of basering are organized in two blocks and
89- the first block of length n contains the elements with respect to which one localizes,
90- the basering is equipped with the elimination block ordering for the variables
91  in the second block
92NOTE: the output ring C is commutative. The ideal @code{rGBid} in C
93represents the rational form of the output ideal @code{pGBid} in the basering.
94- During the computation, the D-dimension of I and the corresponding
95dimension as K(x)-vector space of I are computed and printed out.
96- Setting optional integer eng to 1, slimgb is taken as Groebner engine
97DISPLAY: In order to see the steps of the computation, set printlevel to >=2
98EXAMPLE: example ratstd; shows examples
99"
100{
101  int ppl = printlevel-voice+1;
102  int eng = 0;
103  // optional arguments
104  if (size(#)>0)
105  {
106    if (typeof(#[1]) == "int")
107    {
108      eng = int(#[1]);
109    }
110  }
111
112  dbprint(ppl,"engine chosen to be");
113  dbprint(ppl,eng);
114
115  // 0. do the subst's /reformulations
116  // for the time being, ASSUME
117  // the ord. is an elim. ord. for D
118  // and the block of X's is on the left
119  // its length is 'is'
120
121  int i,j,k;
122  dbprint(ppl,"// -1- creating K(x)[D]");
123
124  // 1. create K(x)[D], commutative
125  def save = basering;
126  list L = ringlist(save);
127  list RL, tmp1,tmp2,tmp3,tmp4;
128  intvec iv;
129  // copy: field, enlarge it with Xs
130
131  if ( size(L[1]) == 0)
132  {
133    // i.e. the field with char only
134    tmp2[1] = L[1];
135    //    tmp1 = L[2];
136    j    = size(L[2]);
137    iv   = 1;
138    for (i=1; i<=is; i++)
139    {
140      tmp1[i] = L[2][i];
141      iv = iv,1;
142    }
143    iv = iv[1..size(iv)-1]; //extra 1
144    tmp2[2]       = tmp1;
145    tmp3[1] = "lp";
146    tmp3[2] = iv;
147    //    tmp2[3] = 0;
148    tmp4[1] = tmp3;
149    tmp2[3] = tmp4;
150    //[1] = "lp";
151    //    tmp2[3][2] = iv;
152    tmp2[4]       = ideal(0);
153    RL[1] = tmp2;
154  }
155
156  if ( size(L[1]) >0 )
157  {
158    // TODO!!!!!
159    tmp2[1] = L[1][1]; //char K
160    // there are parameters
161    // add to them X's, IGNORE alg.extension
162    // the ordering on pars
163    tmp1 = L[1][2]; // param names
164    j    = size(tmp1);
165    iv = L[1][3][1][2];
166    for (i=1; i<=is; i++)
167    {
168      tmp1[j+i] = L[2][i];
169      iv = iv,1;
170    }
171    tmp2[2] = tmp1;
172    tmp2[3] = L[1][3];
173    tmp2[3][1][2] = iv;
174    tmp2[4] = ideal(0);
175    RL[1] = tmp2;
176  }
177
178  // vars: leave only D's
179  kill tmp1; list tmp1;
180  //  tmp1 = L[2];
181  for (i=is+1; i<= size(L[2]); i++)
182  {
183    tmp1[i-is] = L[2][i];
184  }
185  RL[2] = tmp1;
186
187  // old: assume the ordering is the block with (a(0:is),ORD)
188  // old :set up ORD as the ordering
189  //  L; "RL:"; RL;
190  if (size(L[3]) != 3)
191  {
192    //"note: strange ordering";
193    // NEW assume: ordering is the antiblock with (a(0:is),a(*1),a(*), ORD)
194    // get the a() parts after is => they should form a complete D-ordering
195    list L3 = L[3]; list NL3; kill tmp3; list tmp3;
196    int @sl = size(L3);
197    int w=1; int z; intvec va,vb;
198    while(L3[w][1] == "a")
199    {
200      va = L3[w][2];
201      for(z=1;z<=nvars(save)-is;z++)
202      {
203        vb[z] = va[is+z];
204      }
205      tmp3[1] = "a";
206      tmp3[2] = vb;
207      NL3[w] = tmp3; tmp3=0;
208      w++;
209    }
210    // check for completeness: must be >= nvars(save)-is rows
211    if (w < nvars(save)-is)
212    {
213      "note: ordering is incomplete on D. Adding lower Dp block";
214      // adding: positive things like Dp
215      tmp3[1]= "Dp";
216      for (z=1; z<=nvars(save)-is; z++)
217      {
218        va[is+z] = 1;
219      }
220      tmp3[2] = va;
221      NL3[w] = tmp3; tmp3 = 0;
222      w++;
223    }
224    NL3[w] = L3[@sl]; // module ord?
225    RL[3] = NL3;
226  }
227  else
228  {
229    kill tmp2; list tmp2;
230    tmp2[1] = L[3][2];
231    tmp2[2] = L[3][3];
232    RL[3]   = tmp2;
233  }
234  // factor ideal is ignored
235  RL[4] = ideal(0);
236
237  //  "ringlist:"; RL;
238
239  def @RAT = ring(RL);
240
241  dbprint(ppl,"// -2- preprocessing with content");
242  // 2. preprocess input with rm_content_id
243  setring @RAT;
244  dbprint(ppl-1, @RAT);
245  //  ideal CI = imap(save,I);
246  def CI = imap(save,I);
247  CI = rm_content_id(CI);
248  dbprint(ppl-1, CI);
249
250  dbprint(ppl,"// -3- running groebner");
251  // 3. compute G = GB(I) w.r.t. the elim. ord. for D
252  setring save;
253  //  ideal CI = imap(@RAT,CI);
254  def CI = imap(@RAT,CI);
255  option(redSB);
256  option(redTail);
257  if (eng)
258  {
259    def G = slimgb(CI);
260  }
261  else
262  {
263    def G = groebner(CI);
264  }
265  //  ideal G = groebner(CI); // although slimgb looks better
266  // def G = slimgb(CI);
267  G = simplify(G,2); // to be sure there are no 0's
268  dbprint(ppl-1, G);
269
270  dbprint(ppl,"// -4- postprocessing with content");
271  // 4. postprocess the output with 1) rm_content_id,  2) lm-minimization;
272  setring @RAT;
273  // ideal CG = imap(save,G);
274  def CG = imap(save,G);
275  CG = rm_content_id(CG);
276  CG = simplify(CG,2);
277  dbprint(ppl-1, CG);
278
279  // warning: a bugfarm! in this ring, the ordering might change!!! (see appelF4)
280  // so, simplify(32) should take place in the orig. ring! and NOT here
281  //  CG = simplify(CG,2+32);
282
283  // 4b. create L(G) with X's as coeffs (for minimization)
284  setring save;
285  G = imap(@RAT,CG);
286  int sG  = ncols(G);
287  //  ideal LG;
288  def LG = G;
289   for (i=1; i<= sG; i++)
290   {
291     LG[i] = lead(G[i]);
292   }
293  // compute the D-dimension of the ideal in the ring @RAT
294  setring @RAT;
295  //  ideal LG = imap(save,LG);
296  def LG = imap(save,LG);
297  //  ideal LGG = groebner(LG); // cosmetics
298  def LGG = groebner(LG); // cosmetics
299  int d = dim(LGG);
300  int Ddim = d;
301  printf("the D-dimension is %s",d);
302  if (d==0)
303  {
304    d = vdim(LGG);
305    int Dvdim = d;
306    printf("the K-dimension is %s",d);
307  }
308  //  ideal SLG = simplify(LG,8+32); //contains zeros
309  def SLG = simplify(LG,8+32); //contains zeros
310  setring save;
311  //  ideal SLG = imap(@RAT,SLG);
312  def SLG = imap(@RAT,SLG);
313  // simplify(LG,8+32); //contains zeros
314  intvec islg;
315  if (SLG[1] == 0)
316  {  islg = 0;  }
317  else
318  {    islg = 1;  }
319  for (i=2; i<= ncols(SLG); i++)
320  {
321    if (SLG[i] == 0)
322    {
323      islg = islg, 0;
324    }
325    else
326    {
327      islg = islg, 1;
328    }
329  }
330  for (i=1; i<= ncols(LG); i++)
331  {
332    if (islg[i] == 0)
333    {
334      G[i] = 0;
335    }
336  }
337  G = simplify(G,2); // ready!
338  //  G = imap(@RAT,CG);
339  // return the result
340  //  ideal pGBid = G;
341  def pGBid = G;
342  export pGBid;
343  //  export Ddim;
344  //  export Dvdim;
345  setring @RAT;
346  //  ideal rGBid = imap(save,G);
347  def rGBid = imap(save,G);
348  // CG;
349  export rGBid;
350  setring save;
351  return(@RAT);
352  //  kill @RAT;
353  //  return(G);
354}
355example
356{
357  "EXAMPLE:"; echo = 2;
358  ring r = (0,c),(x,y,Dx,Dy),(a(0,0,1,1),a(0,0,1,0),dp);
359  // this ordering is an antiblock ordering, as it must be
360  def S = Weyl(); setring S;
361  // the ideal I below annihilates parametric Appel F4 function
362  // where we set parameters to a=-2, b=-1 and d=0
363  ideal I =
364    x*Dx*(x*Dx+c-1) - x*(x*Dx+y*Dy-2)*(x*Dx+y*Dy-1),
365    y*Dy*(y*Dy-1) - y*(x*Dx+y*Dy-2)*(x*Dx+y*Dy-1);
366  int is = 2; // hence 1st and 2nd variables, that is x and y
367  // will become invertible in the localization
368  def A = ratstd(I,2); // main call
369  pGBid; // polynomial form of the basis in the localized ring
370  setring A; // A is a commutative ring used for presentation
371  rGBid; // "rational" or "localized" form of the basis
372  //--- Now, let us compute a K(x,y) basis explicitly
373  print(matrix(kbase(rGBid)));
374}
375
376/*
377oldExampleForDoc()
378{
379  // VL: removed since it's too easy
380  ring r = 0,(k,n,K,N),(a(0,0,1,1),a(0,0,1,0),dp);
381  // note, that the ordering must be an antiblock ordering
382  matrix D[4][4]; D[1,3] = K; D[2,4] = N;
383  def S = nc_algebra(1,D);
384  setring S; // S is the 2nd shift algebra
385  ideal I = (k+1)*K - (n-k), (n-k+1)*N - (n+1);
386  int is = 2; // hence 1..2 variables will be treated as invertible
387  def A  = ratstd(I,is);
388  pGBid; // polynomial form
389  setring A;
390  rGBid; // rational form
391}
392*/
393
394/*
395exParamAppelF4()
396{
397  // Appel F4
398  LIB "ratgb.lib";
399  ring r = (0,a,b,c,d),(x,y,Dx,Dy),(a(0,0,1,1),a(0,0,1,0),dp);
400  matrix @D[4][4];
401  @D[1,3]=1; @D[2,4]=1;
402  def S=nc_algebra(1,@D);
403  setring S;
404  ideal I =
405    x*Dx*(x*Dx+c-1) - x*(x*Dx+y*Dy+a)*(x*Dx+y*Dy+b),
406    y*Dy*(y*Dy+d-1) - y*(x*Dx+y*Dy+a)*(x*Dx+y*Dy+b);
407  def A = ratstd(I,2);
408  pGBid; // polynomial form
409  setring A;
410  rGBid; // rational form
411  // hence, the K(x,y) basis is {1,Dx,Dy,Dy^2}
412}
413
414// more examples:
415
416// F1 is hard
417appel F1
418{
419  LIB "dmodapp.lib";
420  LIB "ratgb.lib";
421  def A = appelF1();
422  setring A;
423  IAppel1;
424  def F1 = ratstd(IAppel1,2);
425  lead(pGBid);
426  setring F1; rGBid;
427}
428
429// F2 is much easier
430appel F2
431{
432  LIB "dmodapp.lib";
433  LIB "ratgb.lib";
434  def A = appelF2();
435  setring A;
436  IAppel2;
437  def F1 = ratstd(IAppel2,2);
438  lead(pGBid);
439  setring F1; rGBid;
440}
441
442// F4 is feasible
443appel F4
444{
445  LIB "dmodapp.lib";
446  LIB "ratgb.lib";
447  def A = appelF4();
448  setring A;
449  IAppel4;
450  def F1 = ratstd(IAppel4,2);
451  lead(pGBid);
452  setring F1; rGBid;
453}
454
455
456*/
457
458// Important: example for treating modules
459// take two annihilators in 2 components
460
461/*
462  LIB "nctools.lib";
463  ring r = (0,c),(x,y,Dx,Dy),(a(0,0,1,1),a(0,0,1,0),dp);
464  // this ordering is an antiblock ordering, as it must be
465  def S = Weyl(); setring S;
466  // the ideal I below annihilates parametric Appel F4 function
467  // where we set parameters to a=-2, b=-1 and d=0
468  ideal I =
469    x*Dx*(x*Dx+c-1) - x*(x*Dx+y*Dy-2)*(x*Dx+y*Dy-1),
470    y*Dy*(y*Dy-1) - y*(x*Dx+y*Dy-2)*(x*Dx+y*Dy-1);
471
472  // the ideal J below annihilates parametric Appel F4 function
473  // where we set parameters to a=0, b=-1, c=0, d=0
474
475  ideal J =
476    x*Dx*(x*Dx-1) - x*(x*Dx+y*Dy)*(x*Dx+y*Dy-1),
477    y*Dy*(y*Dy-1) - y*(x*Dx+y*Dy)*(x*Dx+y*Dy-1);
478
479  module M = I*gen(1), J*gen(2);
480
481// harder modification: M = M, Dx*gen(1) + Dy*gen(2);
482// gives K(x,y)-dim 3
483
484  int is = 2; // hence 1st and 2nd variables, that is x and y
485  // will become invertible in the localization
486  def A = ratstd(M,2); // main call
487  pGBid; // polynomial form of the basis in the localized ring
488  setring A;
489  // we see from computations, that the K(x,y) dimension is 8
490  rGBid; // "rational" or "localized" form of the basis
491  print(matrix(kbase(rGBid)));// we see  the K(x,y) basis of the corr. module
492
493*/
Note: See TracBrowser for help on using the repository browser.