source: git/Singular/LIB/schreyer.lib @ c1931a4

spielwiese
Last change on this file since c1931a4 was c1931a4, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
new testing procedure testALLA: several tests in many setups!
  • Property mode set to 100644
File size: 52.3 KB
Line 
1///////////////////////////////////////////////////////////////////////////
2version="version schreyer.lib 4.0.0.0 Jun_2013 "; // $Id$
3category="General purpose";
4info="
5LIBRARY: schreyer.lib     Helpers for computing a Schreyer resolution in @code{derham.lib}
6AUTHOR:  Oleksandr Motsak <U@D>, where U={motsak}, D={mathematik.uni-kl.de}
7KEYWORDS: Schreyer ordering; Schreyer resolution; syzygy
8OVERVIEW:
9@* The library contains helper procedures for computing a Schreyer resoltion (cf. [SFO]),
10   originally meant to be used by @code{derham.lib} (which requires resolutions over the homogenized Weyl algebra).
11   The library works both in the commutative and non-commutative setting (cf. [MO]).
12   Here, we call a free resolution a Schreyer resolution if each syzygy module is given by a Groebner basis
13   with respect to the corresponding Schreyer ordering.
14   A Schreyer resolution can be much bigger than a minimal resolution of the same module, but may be easier to construct.
15@* The input for the resolution computations is a set of vectors @code{M} in form of a module over some basering @code{R}.
16   The ring @code{R} may be non-commutative, in which case the ring ordering should be global.
17@* These procedures produce/work with partial Schreyer resolutions of @code{(R^rank(M))/M} in form of
18   a ring (endowed with a special ring ordering that will be extended in the course of a resolution computation)
19   containing a list of modules @code{RES} and a module @code{MRES}:
20@* The list of modules @code{RES} contains the images of maps (also called syzygy modules) substituting the
21   computed beginning of a Schreyer resolution, that is, each syzygy module is given by a Groebner basis
22   with respect to the corresponding Schreyer ordering.
23@* The list @code{RES} starts with a zero map given by @code{rank(M)} zero generators indicating that the image of
24   the first differential map is zero. The second map @code{RES[2]} is given by @code{M}, which indicates that
25   the resolution of @code{(R^rank(M))/M} is being computed.
26@* The module @code{MRES} is a direct sum of modules from @code{RES} and thus comprises all computed differentials.
27@* Syzygies are shifted so that @code{gen(i)} is mapped to @code{MRES[i]} under the differential map.
28@* The Schreyer ordering succesively extends the starting module ordering on @code{M} (defined in Singular by the basering @code{R})
29   and is extended to higher syzygies using the following definition:
30@*        a < b if and only if (d(a) < d(b)) OR ( (d(a) = d(b) AND (comp(a) < comp(b)) ),
31@* where @code{d(a)} is the image of a under the differential (given by @code{MRES}),
32   and @code{comp(a)} is the module component, for any module terms @code{a} and @code{b} from the same higher syzygy module.
33REFERENCES:
34[SFO] Schreyer, F.O.: Die Berechnung von Syzygien mit dem verallgemeinerten Weierstrassschen Divisionssatz,
35      Master's thesis, Univ. Hamburg, 1980.
36[MO]  Motsak, O.: Non-commutative Computer Algebra with applications: Graded commutative algebra and related
37      structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010
38
39NOTE:  requires the dynamic or built-in module @code{syzextra}
40
41PROCEDURES:
42  Sres(M,len)     compute Schreyer resolution of module M of maximal length len
43  Ssyz(M)         compute Schreyer resolution of module M of length 1
44  Scontinue(len)  extend currently active resolution by (at most) len syszygies
45";
46
47static proc prepareSyz( module I, list # )
48{
49  int i;
50  int k = 0;
51  int r = nrows(I);
52  int c = ncols(I);
53
54
55  if( size(#) > 0 )
56  {
57    if( typeof(#[1]) == "int" || typeof(#[1]) == "bigint" )
58    {
59      k = #[1];
60    }
61  }
62
63  if( k < r )
64  {
65    "// *** Wrong k: ", k, " < nrows: ", r, " => setting k = r = ", r;
66    k = r;
67  }
68
69//   "k: ", k;  "c: ", c;   "I: ", I;
70
71  for( i = c; i > 0; i-- )
72  {
73    I[i] = I[i] + gen(k + i);
74  }
75
76//  DetailedPrint(I);
77
78  return(I);
79}
80
81static proc separateSyzGB( module J, int c )
82{
83  module II, G; vector v; int i;
84
85  J = simplify(J, 2);
86
87  for( i = ncols(J); i > 0; i-- )
88  {
89    v = J[i];
90    if( leadcomp(v) > c )
91    {
92      II[i] = v;
93    } else
94    {
95      G[i] = v; // leave only gen(i): i <= c
96    }
97  }
98
99  II = simplify(II, 2);
100  G = simplify(G, 2);
101
102  return (list(G, II));
103}
104
105static proc splitSyzGB( module J, int c )
106{
107  module JJ; vector v, vv; int i;
108
109  for( i = ncols(J); i > 0; i-- )
110  {
111    v = J[i];
112
113    vv = 0;
114   
115    while( leadcomp(v) <= c )
116    {
117      vv = vv + lead(v);
118      v  = v  - lead(v);
119    }
120
121    J[i] = vv;
122    JJ[i] = v;
123  }
124
125  J = simplify(J, 2);
126  JJ = simplify(JJ, 2);
127
128  return (list(J, JJ));
129}
130
131
132static proc Sinit(module M)
133{
134  def @save = basering;
135 
136  int @DEBUG = !system("with", "ndebug");
137  if( @DEBUG )
138  {
139    "Sinit::Input";
140    type(M);
141    DetailedPrint(M);
142    attrib(M);
143  }
144
145  int @RANK = nrows(M); int @SIZE = ncols(M);
146
147  int @IS_A_SB = attrib(M, "isSB"); // ??? only if all weights were zero?!
148
149  if( !@IS_A_SB )
150  {
151    M = std(M); // this should be faster than computing std in S (later on)
152  }
153
154  def S = MakeInducedSchreyerOrdering(1); // 1 puts history terms to the back
155  // TODO: NOTE: +1 causes trouble to Singular interpreter!!!???
156  setring S; // a new ring with a Schreyer ordering
157
158  if( @DEBUG )
159  {
160    "Sinit::StartingISRing";
161    basering;
162//    DetailedPrint(basering);
163  }
164
165  // Setup the leading syzygy^{-1} module to zero:
166  module Z = 0; Z[@RANK] = 0; attrib(Z, "isHomog", intvec(0)); 
167
168  module MRES = Z;
169 
170  list RES; RES[1] = Z;
171
172  module F = freemodule(@RANK);
173  intvec @V = deg(F[1..@RANK]);
174 
175  module M = imap(@save, M);
176 
177  attrib(M, "isHomog", @V);
178  attrib(M, "isSB", 1);
179
180 
181  if( @DEBUG )
182  {
183    "Sinit::SB_Input: ";
184    type(M);
185    attrib(M);
186    attrib(M, "isHomog");
187    DetailedPrint(M);
188  }
189
190  if( @DEBUG )
191  {
192    // 0^th syz. property
193    if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
194    {
195      transpose( transpose(M) * transpose(MRES) );
196      "transpose( transpose(M) * transpose(MRES) ) != 0!!!";
197      $
198    }
199  }
200
201  RES[size(RES)+1] = M; // list of all syzygy modules
202  MRES = MRES, M;
203
204  attrib(MRES, "isHomog", @V); 
205
206  attrib(S, "InducionLeads", lead(M));
207  attrib(S, "InducionStart", @RANK); 
208 
209  if( @DEBUG )
210  {
211    "Sinit::MRES";
212    DetailedPrint(MRES);
213    attrib(MRES, "isHomog");
214    attrib(S);
215  }
216
217  export RES;
218  export MRES;
219  return (S);
220}
221
222static proc Sstep()
223{
224  int @DEBUG = !system("with", "ndebug");
225
226  if( @DEBUG )
227  {
228    "Sstep::NextInducedRing";
229    DetailedPrint(basering);
230
231    attrib(basering, "InducionLeads");
232    attrib(basering, "InducionStart");
233
234    GetInducedData();
235  }
236
237  // syzygy step:
238
239/*
240  // is initial weights are all zeroes!
241  def L =  lead(M);
242  intvec @V = deg(M[1..ncols(M)]);  @W;  @V;  @W = @V;  attrib(L, "isHomog", @W); 
243  SetInducedReferrence(L, @RANK, 0);
244*/
245
246//  def L =  lead(MRES);
247//  @W = @W, @V;
248//  attrib(L, "isHomog", @W); 
249
250
251  // General setting:
252//  SetInducedReferrence(MRES, 0, 0); // limit: 0!
253  int @l = size(RES);
254
255  module M = RES[@l];
256
257  module L = attrib(basering, "InducionLeads");
258  int limit = attrib(basering, "InducionStart");
259
260//  L;  limit;
261 
262  int @RANK = ncols(MRES) - ncols(M); // nrows(M); // what if M is zero?!
263
264/*
265  if( @RANK !=  nrows(M) )
266  {
267    type(MRES);
268    @RANK;
269    type(M);
270    pause();
271  }
272*/
273 
274  intvec @W = attrib(M, "isHomog");
275  intvec @V = deg(M[1..ncols(M)]);
276  @V = @W, @V;
277   
278  if( @DEBUG )
279  {
280    "Sstep::NextInput: ";
281    M;
282    deg(M[1..ncols(M)]); // no use of @W :(?
283    @RANK;   
284    DetailedPrint(MRES);
285    attrib(MRES, "isHomog"); @W;
286    deg(MRES[1..ncols(MRES)]);
287  }
288
289 
290     
291  SetInducedReferrence(L, limit, 0);
292 
293  def K = prepareSyz(M, @RANK);
294//  K;
295 
296//   attrib(K, "isHomog", @V);   DetailedPrint(K, 1000);
297
298//  pause();
299 
300  K = idPrepare(K, @RANK); // std(K); // ?
301  K = simplify(K, 2);
302
303//  K;
304
305  module N = separateSyzGB(K, @RANK)[2]; // 1^st syz. module: vectors which start in lower part (comp >= @RANK)
306
307// "N_0: "; N; DetailedPrint(N, 10);
308
309//  basering; print(@V); type(N);
310//  attrib(N, "isHomog", @V);  // TODO: fix "wrong weights"!!!? deg is wrong :(((
311  N = std(N);
312  attrib(N, "isHomog", @V);
313
314//  N;
315 
316  if( @DEBUG )
317  {
318    if( size(N) > 0 )
319    {
320      // next syz. property
321      if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
322      {
323        MRES;
324
325        "N: "; N; DetailedPrint(N, 10);
326
327        "K:"; K; DetailedPrint(K, 10);
328
329        "RANKS: ", @RANK;
330
331        "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
332        transpose( transpose(N) * transpose(MRES) );
333
334        "transpose(N) * transpose(MRES): ";
335        transpose(N) * transpose(MRES);
336        DetailedPrint(module(_), 2);
337        $
338      }
339    }
340  }
341 
342  RES[@l + 1] = N; // list of all syzygy modules
343 
344  MRES = MRES, N;
345  attrib(MRES, "isHomog", @V);
346
347
348  L = L, lead(N);
349  attrib(basering, "InducionLeads", L);
350
351  if( @DEBUG )
352  {
353    "Sstep::NextSyzOutput: ";
354    DetailedPrint(N);
355    attrib(N, "isHomog");
356  }
357
358}
359
360proc Scontinue(int l)
361"USAGE:  Scontinue(int len)
362RETURN:  nothing, instead it changes the currently active resolution
363PURPOSE: extends the currently active resolution by at most len syzygies
364ASSUME:  must be used within a ring returned by Sres or Ssyz
365EXAMPLE: example Scontinue; shows an example
366"
367{
368  def data = GetInducedData();
369           
370  if( (!defined(RES)) || (!defined(MRES)) || (typeof(data) != "list") || (size(data) != 2) )
371  {
372    ERROR("Sorry, but basering does not seem to be returned by Sres or Ssyz");
373  }
374  for (;  (l != 0) && (size(RES[size(RES)]) > 0); l-- )
375  {
376    Sstep();
377  }
378}
379example
380{ "EXAMPLE:"; echo = 2;
381  ring r;
382  module M = maxideal(1); M;
383  def S = Ssyz(M); setring S; S;
384  "Only the first syzygy: ";
385  RES; MRES;
386  "More syzygies: ";
387  Scontinue(10);
388  RES; MRES;
389}
390
391proc Ssyz(module M)
392"USAGE:  Ssyz(module M)
393RETURN:  ring, containing a Schreyer resolution
394PURPOSE: computes a Schreyer resolution of M of length 1 (see the library overview)
395SEE ALSO: Sres
396EXAMPLE: example Ssyz; shows an example
397"
398{
399  def S = Sinit(M); setring S;
400 
401  Sstep(); // NOTE: what if M is zero?
402
403  return (S);
404}
405example
406{ "EXAMPLE:"; echo = 2;
407  ring r;
408  module M = maxideal(1); M;
409  def S = Ssyz(M); setring S; S;
410  "Only the first syzygy: ";
411  RES;
412  MRES; // Note gen(i)
413  kill S;
414  setring r; kill M;
415
416  module M = 0;
417  def S = Ssyz(M); setring S; S;
418  "Only the first syzygy: ";
419  RES;
420  MRES;
421}
422
423proc Sres(module M, int l)
424"USAGE:  Sres(module M, int len)
425RETURN:  ring, containing a Schreyer resolution
426PURPOSE: computes a Schreyer resolution of M of length at most len (see the library overview)
427NOTE:    If given len is zero then nvars(basering) + 1 is used instead.
428SEE ALSO: Ssyz
429EXAMPLE: example Sres; shows an example
430"
431{
432  def S = Sinit(M); setring S;
433
434  if (l == 0)
435  {
436    l = nvars(basering) + 1; // not really an estimate...?!
437  }
438 
439  Sstep(); l = l - 1;
440 
441  Scontinue(l);
442 
443  return (S);
444}
445example
446{ "EXAMPLE:"; echo = 2;
447  ring r;
448  module M = maxideal(1); M;
449  def S = Sres(M, 0); setring S; S;
450  RES;
451  MRES;
452  kill S;
453  setring r; kill M;
454
455  def A = nc_algebra(-1,0); setring A;
456  ideal Q = var(1)^2, var(2)^2, var(3)^2;
457  qring SCA = twostd(Q);
458  basering;
459
460  module M = maxideal(1);
461  def S = Sres(M, 2); setring S; S;
462  RES;
463  MRES;
464}
465
466
467
468// ================================================================== //
469
470
471LIB "general.lib"; // for sort
472
473/* static proc Tail(def M) // DONE: in C++ (dyn. module: syzextra)!
474{
475  int i = ncols(M); def m;
476  while (i > 0)
477  {
478    m = M[i];
479    m = m - lead(m); // m = tail(m)   
480    M[i] = m;   
481    i--;
482  }
483  return (M);
484}*/
485
486/* static */
487proc MySort(def M)
488{
489  if( typeof( attrib(basering, "DEBUG") ) == "int" )
490  {
491    int @DEBUG = attrib(basering, "DEBUG");
492  } else
493  {
494    int @DEBUG = !system("with", "ndebug");
495  }
496
497  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
498  {
499    int @SYZCHECK = attrib(basering, "SYZCHECK");
500  } else
501  {
502    int @SYZCHECK = @DEBUG;
503  }
504
505
506  if( @DEBUG )
507  {
508    "MySort:: Input: "; M;
509  }
510
511  def @N = M; Sort_c_ds(@N);
512 
513  if( @SYZCHECK )
514  {
515    def iv = sort(lead(M), "c,ds", 1)[2]; // ,1 => reversed! // TODO: not needed?
516    def @M = M;
517    @M = M[iv];
518   
519    // 0^th syz. property
520    if( size(module( matrix(@N) - matrix(@M) )) > 0 )
521    {
522      "@M:"; @M;
523      "@N:"; @N;
524
525      "module( matrix(@N) - matrix(@M) ): ";
526      module( matrix(@N) - matrix(@M) );
527
528      "ERROR: wrong sorting in 'MySort': @N != @M!!!";
529      $
530    }
531  }
532
533  if( @DEBUG )
534  {
535    "MySort:: Ouput: "; @N;
536  }
537 
538  return (@N);
539}
540
541
542/* static */ proc SSinit(def M)
543{
544  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
545  {
546    ERROR("Sorry: need an ideal or a module for input");
547  }
548
549  // TODO! DONE?
550  def @save = basering;
551 
552  int @DEBUG = !system("with", "ndebug");
553
554  if( typeof( attrib(SSinit, "DEBUG") ) == "int" )
555  {
556    @DEBUG = attrib(SSinit, "DEBUG");
557  }
558
559  int @SYZCHECK = @DEBUG;
560
561  if( typeof( attrib(SSinit, "SYZCHECK") ) == "int" )
562  {
563    @SYZCHECK = attrib(SSinit, "SYZCHECK");
564  }
565 
566  if( @DEBUG )
567  {
568    "SSinit::Input";
569    type(M);
570//    DetailedPrint(M);
571    attrib(M);
572  }
573
574  int @RANK = nrows(M); int @SIZE = ncols(M);
575
576  int @IS_A_SB = attrib(M, "isSB"); // ??? only if all weights were zero?!
577
578  if( !@IS_A_SB )
579  {
580    def opts = option(get);
581    option(redSB); option(redTail);
582    M = std(M);
583    option(set, opts);
584    kill opts;
585  } else
586  {
587    M = simplify(M, 2 + 4 + 32);
588  }
589
590  def @N = MySort(M); // TODO: replace with inplace sorting!!!
591  def LEAD = lead(@N);
592
593  if( @SYZCHECK )
594  {
595    def @LEAD = lead(M);
596
597    // sort wrt neg.deg.rev.lex!
598    intvec iv_ds = sort(@LEAD, "c,ds", 1)[2]; // ,1 => reversed!
599
600    M = M[iv_ds]; // sort M wrt ds on current leading terms
601    @LEAD = @LEAD[iv_ds];
602
603    // 0^th syz. property
604    if( size(module( matrix(@N) - matrix(M) )) > 0 )
605    {
606      "M:"; M;
607      "@N:"; @N;
608
609      "module( matrix(@N) - matrix(M) ): ";
610      module( matrix(@N) - matrix(M) );
611
612      "ERROR: wrong sorting (in SSnit): @N != M!!!";
613      $
614    }
615
616    // 0^th syz. property
617    if( size(module( matrix(@LEAD) - matrix(LEAD) )) > 0 )
618    {
619      "LEAD:"; LEAD;
620      "@LEAD:"; @LEAD;
621
622      "module( matrix(@LEAD) - matrix(LEAD) ): ";
623      module( matrix(@LEAD) - matrix(LEAD) );
624
625      "ERROR: wrong sorting (in SSnit): @LEAD != LEAD!!!";
626      $
627    }
628   
629  }
630
631  M = @N;
632 
633 
634 
635 
636  def TAIL = Tail(M);
637 
638  intvec @DEGS = deg(M[1..@SIZE]); // store actuall degrees of input elements
639 
640  // TODO: what about real modules? weighted ones?
641 
642  list @l = ringlist(@save);
643
644  int @z = 0; ideal @m = maxideal(1); intvec @wdeg = deg(@m[1..ncols(@m)]);
645
646  // NOTE: @wdeg will be ignored anyway :(
647  @l[3] = list(list("C", @z), list("lp", @wdeg));
648
649  kill @z, @wdeg; // since these vars are ring independent!
650
651  def S = ring(@l); // --MakeInducedSchreyerOrdering(1);
652
653  module F = freemodule(@RANK);
654  intvec @V = deg(F[1..@RANK]);
655 
656  setring S; // ring with an easy divisibility test ("C, lex")
657
658  if( @DEBUG )
659  {
660    "SSinit::NewRing(C, lex)";
661    basering;
662    DetailedPrint(basering);
663  }
664
665  // Setup the leading syzygy^{-1} module to zero:
666  module Z = 0; Z[@RANK] = 0; attrib(Z, "isHomog", intvec(0)); 
667
668  module MRES = Z;
669 
670  list RES;  RES[1] = Z;
671  list LRES; LRES[1] = Z;
672  list TRES; TRES[1] = Z;
673 
674  def M = imap(@save, M);
675
676  attrib(M, "isHomog", @V);
677  attrib(M, "isSB", 1);
678  attrib(M, "degrees", @DEGS); 
679 
680  def LEAD = imap(@save, LEAD);
681 
682  attrib(LEAD, "isHomog", @V);
683  attrib(LEAD, "isSB", 1); 
684 
685  def TAIL = imap(@save, TAIL);
686
687  if( @DEBUG )
688  {
689    "SSinit::(sorted) SB_Input: ";
690    type(M);
691    attrib(M);
692    attrib(M, "isHomog");
693//    DetailedPrint(M);
694  }
695
696  if( @SYZCHECK )
697  {
698    // 0^th syz. property
699    if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
700    {
701      transpose( transpose(M) * transpose(MRES) );
702      "ERROR: transpose( transpose(M) * transpose(MRES) ) != 0!!!";
703      $
704    }
705  }
706
707  RES [size(RES)+1] = M; // list of all syzygy modules
708  LRES[size(LRES)+1] = LEAD; // list of all syzygy modules
709  TRES[size(TRES)+1] = TAIL; // list of all syzygy modules
710 
711  MRES = MRES, M; //?
712
713  attrib(MRES, "isHomog", @V);
714 
715//  attrib(S, "InducionStart", @RANK);
716
717
718  if( typeof( attrib(SSinit, "LEAD2SYZ") ) == "int" )
719  {
720    attrib(S, "LEAD2SYZ", attrib(SSinit, "LEAD2SYZ") );
721  } else
722  {
723    attrib(S, "LEAD2SYZ", 1);
724  }
725
726  if( typeof( attrib(SSinit, "TAILREDSYZ") ) == "int" )
727  {
728    attrib(S, "TAILREDSYZ", attrib(SSinit, "TAILREDSYZ") );
729  } else
730  {
731    attrib(S, "TAILREDSYZ", 1);
732  }
733
734
735  if( typeof( attrib(SSinit, "HYBRIDNF") ) == "int" )
736  {
737    attrib(S, "HYBRIDNF", attrib(SSinit, "HYBRIDNF") );
738  } else
739  {
740    attrib(S, "HYBRIDNF", 0);
741  }
742 
743  attrib(S, "DEBUG", @DEBUG);
744  attrib(S, "SYZCHECK", @SYZCHECK);
745 
746  if( @DEBUG )
747  {
748    "SSinit::MRES";
749    MRES;
750//    DetailedPrint(MRES);
751    attrib(MRES, "isHomog");
752    attrib(S);
753  }
754
755  export RES;
756  export MRES;
757  export LRES;
758  export TRES;
759  return (S);
760}
761example
762{ "EXAMPLE:"; echo = 2;
763  ring R = 0, (w, x, y, z), dp;
764
765  def M = maxideal(1);
766  def S = SSinit(M); setring S; S;
767 
768  "Only the first initialization: ";
769  RES; LRES; TRES;
770  MRES;
771
772  kill S; setring R; kill M;
773 
774  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
775  def S = SSinit(M); setring S; S;
776
777  "Only the first initialization: ";
778  RES; LRES; TRES;
779  MRES;
780
781  kill S; setring R; kill M;
782}
783
784
785LIB "poly.lib"; // for lcm
786
787
788
789/// Compute L(Syz(L))
790proc SSComputeLeadingSyzygyTerms(def L)
791{
792  if( typeof( attrib(basering, "DEBUG") ) == "int" )
793  {
794    int @DEBUG = attrib(basering, "DEBUG");
795  } else
796  {
797    int @DEBUG = !system("with", "ndebug");
798  }
799
800  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
801  {
802    int @SYZCHECK = attrib(basering, "SYZCHECK");
803  } else
804  {
805    int @SYZCHECK = @DEBUG;
806  }
807 
808  if( @DEBUG )
809  {
810    "SSComputeLeadingSyzygyTerms::Input: ";
811    L;
812  }
813
814  module SS = ComputeLeadingSyzygyTerms(L);
815
816  if( @SYZCHECK )
817  { 
818    int i, j, r;
819    int N = ncols(L);
820    def a, b;
821    poly aa, bb;
822
823    bigint c;
824
825    ideal M;
826
827    module S = 0;
828
829    for(i = 1; i <= N; i++)
830    {
831      a = L[i];
832      c = leadcomp(a);
833      r = int(c);
834
835      aa = leadmonomial(a);
836
837      M = 0;
838
839      for(j = i-1; j > 0; j--)
840      {
841        b = L[j];
842
843        if( leadcomp(b) == c )
844        {
845          bb = leadmonomial(b);
846
847          M[j] = (lcm(aa, bb) / aa);
848        }
849      }
850
851      // TODO: add quotient relations here...
852
853      M = simplify(M, 1 + 2 + 32);
854
855      M = MySort(M);
856
857      S = S, M * gen(i);
858    }
859
860    S = MySort(simplify(S, 2));
861
862    if( size(module(matrix(S) - matrix(SS))) > 0 )
863    {
864        "ERROR: S != SS ";
865
866        "basering: ";
867        DetailedPrint(basering);
868
869        "S: ";  S;
870        DetailedPrint(S, 1);
871        "SS: "; SS;
872        DetailedPrint(SS, 1);
873
874        "DIFF: ";
875        print(matrix(S) - matrix(SS));
876        DetailedPrint(module(matrix(S) - matrix(SS)), 2);     
877        $
878    }
879  }
880
881 
882  if( @DEBUG )
883  {
884    "SSComputeLeadingSyzygyTerms::Output: ";
885    "SS: ";
886    SS;
887  }
888 
889  attrib(SS, "isSB", 1);
890
891  return (SS);
892}
893
894/// Compute Syz(L), where L is a monomial (leading) module
895proc SSCompute2LeadingSyzygyTerms(def L)
896{
897  if( typeof( attrib(basering, "DEBUG") ) == "int" )
898  {
899    int @DEBUG = attrib(basering, "DEBUG");
900  } else
901  {
902    int @DEBUG = !system("with", "ndebug");
903  }
904
905  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
906  {
907    int @SYZCHECK = attrib(basering, "SYZCHECK");
908  } else
909  {
910    int @SYZCHECK = @DEBUG;
911  }
912
913  int @TAILREDSYZ = 1;
914  if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
915  {
916    @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
917  }
918 
919 
920  if( @DEBUG )
921  {
922    "SSCompute2LeadingSyzygyTerms::Input: ";
923    L;
924  }
925
926  int i, j, r;
927  int N = ncols(L);
928  def a, b;
929
930  poly aa, bb, @lcm;
931
932  bigint c;
933
934  module M;
935
936  module S = 0;
937
938  for(i = 1; i <= N; i++)
939  {
940    a = L[i];
941//    "a: ", a;
942    c = leadcomp(a);
943    r = int(c);
944
945    aa = leadmonomial(a);
946
947    M = 0;
948
949    for(j = i-1; j > 0; j--)
950    {
951      b = L[j];
952//      "b: ", b;
953
954      if( leadcomp(b) == c )
955      {
956        bb = leadmonomial(b);
957        @lcm = lcm(aa, bb);
958
959        M[j] = (@lcm / aa)* gen(i) - (@lcm / bb)* gen(j);
960      }
961    }
962   
963    M = simplify(M, 2);
964
965    // TODO: add quotient relations here...
966    S = S, M;
967  }
968
969  if( @TAILREDSYZ )
970  {
971    // Make sure that 2nd syzygy terms are not reducible by 1st
972    def opts = option(get);
973    option(redSB); option(redTail);
974    S = std(S); // binomial module
975    option(set, opts);
976    //  kill opts;
977  } else
978  {
979    S = simplify(S, 2 + 32);
980  }
981
982  S = MySort(S);
983
984  if( @DEBUG )
985  {
986    "SSCompute2LeadingSyzygyTerms::Syz(LEAD): "; S;
987  }
988
989  if( @SYZCHECK )
990  {
991    if( size(S) > 0 and size(L) > 0 )
992    {
993      if( size(module(transpose( transpose(S) * transpose(L) ))) > 0 )
994      {
995        transpose( transpose(S) * transpose(L) );
996        "ERROR: transpose( transpose(S) * transpose(L) ) != 0!!!";
997        $
998      }
999    }
1000   
1001    module SS = Compute2LeadingSyzygyTerms(L);
1002
1003    "S: ";  DetailedPrint(S);
1004    "SS: "; DetailedPrint(SS);
1005   
1006    if( size(module(matrix(S) - matrix(SS))) > 0 )
1007    {
1008      "ERROR: S != SS ";
1009
1010      "basering: ";
1011      DetailedPrint(basering);
1012
1013      "S: ";  S;
1014      DetailedPrint(S, 2);
1015      "SS: "; SS;
1016      DetailedPrint(SS, 2);
1017
1018      "DIFF: ";
1019      print(matrix(S) - matrix(SS));
1020      DetailedPrint(module(matrix(S) - matrix(SS)), 4);
1021      $
1022    }
1023   
1024  } 
1025
1026  module S2 = Tail(S);
1027  S = lead(S); // (C,lp) on base ring!
1028             
1029  if( @DEBUG )
1030  {
1031    "SSCompute2LeadingSyzygyTerms::Output: "; S; S2;
1032  } 
1033 
1034  attrib(S, "isSB", 1);
1035
1036  return (S, S2);
1037}
1038
1039// -------------------------------------------------------- //
1040
1041/// TODO: save shortcut LM(m) * "t" -> ?
1042proc SSReduceTerm(poly m, def t, def L, def T, list #)
1043{
1044  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1045  {
1046    int @DEBUG = attrib(basering, "DEBUG");
1047  } else
1048  {
1049    int @DEBUG = !system("with", "ndebug");
1050  }
1051
1052  if( @DEBUG )
1053  {
1054    "SSReduce::Input: ";
1055
1056    "mult: ", m;
1057    "term: ", t;
1058    "L: ", L;
1059    "T: ", T;
1060    if( size(#) > 0 )
1061    {
1062      "LSyz: ", #;
1063    }
1064//    "attrib(LS, 'isSB')", attrib(LS, "isSB");
1065  }
1066 
1067  vector s = 0;
1068
1069  if( t == 0 )
1070  {
1071    return (s);
1072  }
1073
1074  def product = m * t;
1075
1076  bigint c = leadcomp(t);
1077  int r = int(c);
1078 
1079  def a, b, nf, bb;
1080
1081  // looking for an appropriate reducer
1082  for( int k = ncols(L); k > 0; k-- )
1083  {
1084    a = L[k];
1085    // with the same mod. component
1086    if( leadcomp(a) == c )
1087    {
1088      b = - (leadmonomial(product) / leadmonomial(L[k]));
1089     
1090      // which divides the product
1091      if( b != 0 )
1092      {
1093//        "b: ", b;
1094        bb = b * gen(k);
1095        nf = bb;
1096
1097        if( size(#) > 0 )
1098        {
1099          if( typeof(#[1]) == "module" )
1100          {
1101            nf = NF(bb, #[1]);
1102//        "NF: ", nf;
1103          }
1104        }
1105
1106        // while the complement (the fraction) is not reducible by leading syzygies
1107        if( nf != 0 )
1108        {
1109          /// TODO: save shortcut LM(m) * T[i] -> ?
1110
1111          // choose ANY such reduction... (with the biggest index?)
1112          s = bb + SSTraverseTail(b, T[k], L, T, #);
1113          break;
1114        }
1115      }
1116    }
1117  } 
1118  if( @DEBUG )
1119  {
1120    "SSReduceTerm::Output: ", s;
1121  }
1122  return (s);
1123}
1124
1125// TODO: store m * @tail -.-^-.-^-.--> ?
1126proc SSTraverseTail(poly m, def @tail, def L, def T, list #)
1127{
1128  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1129  {
1130    int @DEBUG = attrib(basering, "DEBUG");
1131  } else
1132  {
1133    int @DEBUG = !system("with", "ndebug");
1134  }
1135
1136  if( @DEBUG )
1137  {
1138    "SSTraverse::Input: ";
1139
1140    "mult: ", m;
1141    "tail: ", @tail; // T[i];
1142
1143    if( size(#) > 0 )
1144    {
1145      "LSyz: "; #[1];
1146    }
1147  }
1148
1149  vector s = 0;
1150
1151  def @l;
1152
1153  // iterate tail-terms in ANY order!
1154  while( size(@tail) > 0 )
1155  {
1156    @l = lead(@tail);
1157    s = s + SSReduceTerm(m, @l, L, T, #);
1158    @tail = @tail - @l;
1159  }
1160
1161  if( @DEBUG )
1162  {
1163    "SSTraverseTail::Output: ", s;
1164  }
1165  return (s);
1166}
1167
1168// -------------------------------------------------------- //
1169
1170// module (N, LL, TT) = SSComputeSyzygy(L, T);
1171// Compute Syz(L ++ T) = N = LL ++ TT
1172proc SSComputeSyzygy(def L, def T)
1173{
1174  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1175  {
1176    int @DEBUG = attrib(basering, "DEBUG");
1177  } else
1178  {
1179    int @DEBUG = !system("with", "ndebug");
1180  }
1181
1182  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
1183  {
1184    int @SYZCHECK = attrib(basering, "SYZCHECK");
1185  } else
1186  {
1187    int @SYZCHECK = @DEBUG;
1188  }
1189 
1190 
1191  if( @DEBUG )
1192  {
1193    "SSComputeSyzygy::Input";
1194    "basering: ", basering; attrib(basering);
1195//    DetailedPrint(basering);
1196
1197//    "iCompShift: ", iCompShift;
1198
1199    "L: "; L;
1200    "T: "; T;
1201  }
1202
1203  def a; bigint c; int r, k; poly aa;
1204
1205  int @LEAD2SYZ = 0;
1206  if( typeof( attrib(basering, "LEAD2SYZ") ) == "int" )
1207  {
1208    @LEAD2SYZ = attrib(basering, "LEAD2SYZ");
1209  }
1210
1211  int @TAILREDSYZ = 1;
1212  if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
1213  {
1214    @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
1215//    @TAILREDSYZ;
1216  }
1217
1218  /// Get the critical leading syzygy terms
1219  if( @LEAD2SYZ ) // & 2nd syz. term
1220  {
1221    def a2; int r2; poly aa2; 
1222    module LL, LL2;
1223    (LL, LL2) = SSCompute2LeadingSyzygyTerms(L); // ++
1224  } else
1225  {
1226    module LL = SSComputeLeadingSyzygyTerms(L);
1227  }
1228
1229  module TT, SYZ;
1230
1231  if( size(LL) > 0 )
1232  {
1233    list LS;
1234
1235    if( @TAILREDSYZ )
1236    {
1237      LS = list(LL);
1238    }
1239   
1240    vector @tail;
1241
1242    for(k = ncols(LL); k > 0; k-- )
1243    {
1244      // leading syz. term:
1245      a = LL[k]; c = leadcomp(a); r = int(c); aa = leadmonomial(a);
1246      //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
1247
1248      /// TODO: save shortcut (aa) * T[r] -> ?
1249      @tail = SSTraverseTail(aa, T[r], L, T, LS);
1250             
1251      // get the 2nd syzygy term...
1252     
1253      if( @LEAD2SYZ ) // with the 2nd syz. term:
1254      {     
1255        a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2);
1256        @tail = @tail +
1257             /// TODO: save shortcut (aa2) * T[r2] -> ?
1258             a2 + SSTraverseTail(aa2, T[r2], L, T, LS);
1259      } else
1260      {
1261        @tail = @tail + SSReduceTerm(aa, L[r], L, T, LS);
1262      }     
1263     
1264      TT[k] = @tail;
1265      SYZ[k] = a + @tail;
1266    }
1267  }
1268
1269/*
1270  def opts = option(get); option(redSB); option(redTail);
1271  module SYZ = std(syz(M));
1272  option(set, opts); kill opts;
1273 
1274  module LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!!
1275  module TT = Tail(SYZ);
1276*/
1277 
1278  if( @DEBUG )
1279  {
1280    "SSComputeSyzygy::Output";
1281
1282    "SYZ: "; SYZ;
1283    "LL: "; LL;
1284    "TT: "; TT;
1285  }
1286
1287  return (SYZ, LL, TT);
1288}
1289
1290// resolution/syzygy step:
1291static proc SSstep()
1292{
1293  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1294  {
1295    int @DEBUG = attrib(basering, "DEBUG");
1296  } else
1297  {
1298    int @DEBUG = !system("with", "ndebug");
1299  }
1300
1301
1302  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
1303  {
1304    int @SYZCHECK = attrib(basering, "SYZCHECK");
1305  } else
1306  {
1307    int @SYZCHECK = @DEBUG;
1308  }
1309
1310  if( @DEBUG )
1311  {
1312    "SSstep::NextInducedRing";
1313    "basering: ", basering; attrib(basering);
1314  }
1315
1316/*
1317  // is initial weights are all zeroes!
1318  def L =  lead(M);
1319  intvec @V = deg(M[1..ncols(M)]);  @W;  @V;  @W = @V;  attrib(L, "isHomog", @W); 
1320  SetInducedReferrence(L, @RANK, 0);
1321*/
1322
1323//  def L =  lead(MRES);
1324//  @W = @W, @V;
1325//  attrib(L, "isHomog", @W); 
1326
1327
1328  // General setting:
1329//  SetInducedReferrence(MRES, 0, 0); // limit: 0!
1330  int @l = size(RES);
1331
1332  def M =  RES[@l];
1333
1334  def L = LRES[@l];
1335  def T = TRES[@l];
1336
1337
1338  //// TODO: wrong !!!!!
1339  int @RANK = ncols(MRES) - ncols(M); // nrows(M); // what if M is zero?!
1340
1341 
1342
1343/*
1344  if( @RANK !=  nrows(M) )
1345  {
1346    type(MRES);
1347    @RANK;
1348    type(M);
1349    pause();
1350  }
1351*/
1352 
1353  intvec @W = attrib(M, "isHomog"); intvec @V = attrib(M, "degrees"); @V = @W, @V;
1354   
1355  if( @DEBUG )
1356  {
1357    "Sstep::NextInput: ";
1358    M;
1359    L;
1360    @V;
1361    @RANK;
1362//    DetailedPrint(MRES);
1363    attrib(MRES, "isHomog");
1364  }
1365
1366     
1367  // TODO: N  = SYZ( M )!!!
1368  module N, LL, TT;
1369  (N, LL, TT) = SSComputeSyzygy(/*M, */L, T/*, @RANK*/);
1370
1371  // shift syz.comp by @RANK:
1372  module Z;
1373  Z = 0; Z[@RANK] = 0; Z = Z, transpose(LL);   LL = transpose(Z);
1374  Z = 0; Z[@RANK] = 0; Z = Z, transpose(TT);   TT = transpose(Z);
1375  Z = 0; Z[@RANK] = 0; Z = Z, transpose(N);     N = transpose(Z);
1376
1377
1378  if( @SYZCHECK )
1379  {
1380    if( size(N) > 0 )
1381    {
1382      // next syz. property
1383      if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
1384      {
1385        "MRES", MRES;
1386
1387        "N: "; N; // DetailedPrint(N, 2);
1388
1389        "LL:"; LL; // DetailedPrint(LL, 1);
1390        "TT:"; TT; // DetailedPrint(TT, 10);
1391
1392        "RANKS: ", @RANK;
1393
1394        "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
1395        transpose( transpose(N) * transpose(MRES) );
1396
1397        "transpose(N) * transpose(MRES): ";
1398        transpose(N) * transpose(MRES);
1399        // DetailedPrint(module(_), 2);
1400        $
1401      }
1402    }
1403  }
1404
1405  attrib(N, "isHomog", @V);
1406
1407  // TODO: correct the following:
1408  intvec @DEGS = deg(N[1..ncols(N)]); // no mod. comp. weights :(
1409
1410 
1411  attrib(N, "degrees", @DEGS);
1412 
1413   RES[@l + 1] = N; // list of all syzygy modules
1414  LRES[@l + 1] = LL; // list of all syzygy modules
1415  TRES[@l + 1] = TT; // list of all syzygy modules
1416
1417  MRES = MRES, N;
1418 
1419  attrib(MRES, "isHomog", @V);
1420
1421//  L = L, lead(N);  attrib(basering, "InducionLeads", L);
1422
1423  if( @DEBUG )
1424  {
1425    "SSstep::NextSyzOutput: ";
1426    N;
1427//    DetailedPrint(N);
1428    attrib(N);
1429  }
1430
1431}
1432
1433proc SScontinue(int l)
1434"USAGE:  SScontinue(l)
1435RETURN:  nothing, instead it changes RES and MRES variables in the current ring
1436PURPOSE: computes further (at most l) syzygies
1437NOTE:    must be used within a ring returned by Sres or Ssyz. RES and MRES are
1438         explained in Sres
1439EXAMPLE: example Scontinue; shows an example
1440"
1441{
1442
1443  /// TODO!
1444//  def data = GetInducedData();
1445
1446  if( (!defined(RES)) || (!defined(MRES)) ) /* || (typeof(data) != "list") || (size(data) != 2) */
1447  {
1448    ERROR("Sorry, but basering does not seem to be returned by Sres or Ssyz");
1449  }
1450  for (;  (l != 0) && (size(RES[size(RES)]) > 0); l-- )
1451  {
1452    SSstep();
1453  }
1454}
1455example
1456{ "EXAMPLE:"; echo = 2;
1457  ring r;
1458  module M = maxideal(1); M;
1459  def S = SSsyz(M); setring S; S;
1460  "Only the first syzygy: ";
1461  RES; MRES;
1462  "More syzygies: ";
1463  SScontinue(10);
1464  RES; MRES;
1465}
1466
1467proc SSsyz(def M)
1468"USAGE:  SSsyz(M)
1469RETURN:  ring, containing a list of modules RES and a module MRES
1470PURPOSE: computes the first syzygy module of M (wrt some Schreyer ordering)?
1471NOTE:    The output is explained in Sres
1472EXAMPLE: example Ssyz; shows an example
1473"
1474{
1475  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
1476  {
1477    ERROR("Sorry: need an ideal or a module for input");
1478  }
1479
1480  def SS = SSinit(M); setring SS;
1481 
1482  SSstep(); // NOTE: what if M is zero?
1483
1484  return (SS);
1485}
1486example
1487{ "EXAMPLE:"; echo = 2;
1488  ring r;
1489
1490/*  ideal M = 0;
1491  def S = SSsyz(M); setring S; S;
1492  "Only the first syzygy: ";
1493  RES; LRES; TRES;
1494  MRES;
1495 
1496  kill S; setring r; kill M;
1497*/ 
1498
1499  ideal M = maxideal(1); M;
1500  def S = SSres(M, 0); setring S; S;
1501  MRES;
1502  RES;
1503  "";
1504  LRES;
1505  "";
1506  TRES;
1507
1508  kill S; setring r; kill M;
1509
1510  kill r;
1511 
1512  ring R = 0, (w, x, y, z), dp;
1513  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
1514 
1515  def S = SSres(M, 0); setring S; S;
1516  MRES;
1517  RES;
1518  "";
1519  LRES;
1520  "";
1521  TRES;
1522}
1523
1524proc SSres(def M, int l)
1525"USAGE:  SSres(I, l)
1526RETURN:  ring, containing a list of modules RES and a module MRES
1527PURPOSE: computes (at most l) syzygy modules of M wrt the classical Schreyer
1528         induced ordering with gen(i) > gen(j) if i > j, provided both gens
1529         are from the same syzygy level.???
1530NOTE:    RES contains the images of maps subsituting the beginning of the
1531         Schreyer free resolution of baseRing^r/M, while MRES is a sum of
1532         these images in a big free sum, containing all the syzygy modules.
1533         The syzygy modules are shifted so that gen(i) correspons to MRES[i].
1534         The leading zero module RES[0] indicates the fact that coker of the
1535         first map is zero. The number of zeroes inducates the rank of input.
1536NOTE:    If l == 0 then l is set to be nvars(basering) + 1
1537EXAMPLE: example SSres; shows an example
1538"
1539{
1540  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
1541  {
1542    ERROR("Sorry: need an ideal or a module for input");
1543  }
1544
1545  def SS = SSinit(M); setring SS;
1546
1547  if (l == 0)
1548  {
1549    l = nvars(basering) + 1; // not really an estimate...?!
1550  }
1551
1552  SSstep(); l = l - 1;
1553
1554  SScontinue(l);
1555
1556  return (SS);
1557}
1558example
1559{ "EXAMPLE:"; echo = 2;
1560  ring r;
1561  module M = maxideal(1); M;
1562  def S = SSres(M, 0); setring S; S;
1563  RES;
1564  MRES;
1565  kill S;
1566  setring r; kill M;
1567
1568  def A = nc_algebra(-1,0); setring A;
1569  ideal Q = var(1)^2, var(2)^2, var(3)^2;
1570  qring SCA = twostd(Q);
1571  basering;
1572
1573  module M = maxideal(1);
1574  def S = SSres(M, 2); setring S; S;
1575  RES;
1576  MRES;
1577}
1578
1579
1580
1581static proc loadme()
1582{
1583  int @DEBUG = !system("with", "ndebug");
1584
1585  if( @DEBUG )
1586  {
1587   
1588    "ndebug?: ", system("with", "ndebug");
1589    "om_ndebug?: ", system("with", "om_ndebug");
1590
1591    listvar(Top);
1592    listvar(Schreyer);
1593  }
1594//  listvar(Syzextra); listvar(Syzextra_g);
1595
1596  if( !defined(DetailedPrint) )
1597  {
1598    if( 1 )
1599    {
1600
1601      if( @DEBUG )
1602      {
1603        "Loading the Release version!";
1604      }
1605      load("syzextra.so");
1606
1607      if( @DEBUG )
1608      {
1609        listvar(Syzextra);
1610      }
1611
1612      exportto(Top, Syzextra::ClearContent);
1613      exportto(Top, Syzextra::ClearDenominators);
1614
1615      exportto(Schreyer, Syzextra::m2_end);
1616     
1617//      export Syzextra;
1618
1619//      exportto(Schreyer, Syzextra::noop);
1620      exportto(Schreyer, Syzextra::DetailedPrint);
1621      exportto(Schreyer, Syzextra::leadmonomial);
1622      exportto(Schreyer, Syzextra::leadcomp);
1623//      exportto(Schreyer, Syzextra::leadrawexp);
1624//      exportto(Schreyer, Syzextra::ISUpdateComponents);
1625      exportto(Schreyer, Syzextra::SetInducedReferrence);
1626      exportto(Schreyer, Syzextra::GetInducedData);
1627//      exportto(Schreyer, Syzextra::GetAMData);
1628//      exportto(Schreyer, Syzextra::SetSyzComp);
1629      exportto(Schreyer, Syzextra::MakeInducedSchreyerOrdering);
1630//      exportto(Schreyer, Syzextra::MakeSyzCompOrdering);
1631      exportto(Schreyer, Syzextra::idPrepare);
1632//      exportto(Schreyer, Syzextra::reduce_syz);
1633//      exportto(Schreyer, Syzextra::p_Content);
1634
1635      exportto(Schreyer, Syzextra::ProfilerStart); exportto(Schreyer, Syzextra::ProfilerStop);
1636
1637      exportto(Schreyer, Syzextra::Tail);
1638      exportto(Schreyer, Syzextra::ComputeLeadingSyzygyTerms);     
1639      exportto(Schreyer, Syzextra::Compute2LeadingSyzygyTerms);
1640      exportto(Schreyer, Syzextra::Sort_c_ds);
1641    }
1642/*
1643    else
1644    {
1645      if( @DEBUG )
1646      {
1647        "Loading the Debug version!";
1648      }
1649
1650      load("syzextra.so");
1651
1652      if( @DEBUG )
1653      {     
1654        listvar(Syzextra_g);
1655      }
1656     
1657      exportto(Top, Syzextra_g::ClearContent);
1658      exportto(Top, Syzextra_g::ClearDenominators);
1659
1660      exportto(Schreyer, Syzextra_g::m2_end);
1661
1662//      export Syzextra_g;
1663//      exportto(Schreyer, Syzextra_g::noop);
1664      exportto(Schreyer, Syzextra_g::DetailedPrint);
1665      exportto(Schreyer, Syzextra_g::leadmonomial);
1666      exportto(Schreyer, Syzextra_g::leadcomp);
1667//      exportto(Schreyer, Syzextra_g::leadrawexp);
1668//      exportto(Schreyer, Syzextra_g::ISUpdateComponents);
1669      exportto(Schreyer, Syzextra_g::SetInducedReferrence);
1670      exportto(Schreyer, Syzextra_g::GetInducedData);
1671//      exportto(Schreyer, Syzextra_g::GetAMData);
1672//      exportto(Schreyer, Syzextra_g::SetSyzComp);
1673      exportto(Schreyer, Syzextra_g::MakeInducedSchreyerOrdering);
1674//      exportto(Schreyer, Syzextra_g::MakeSyzCompOrdering);
1675      exportto(Schreyer, Syzextra_g::idPrepare);
1676//      exportto(Schreyer, Syzextra_g::reduce_syz);
1677//      exportto(Schreyer, Syzextra_g::p_Content);
1678
1679      exportto(Schreyer, Syzextra_g::ProfilerStart); exportto(Schreyer, Syzextra_g::ProfilerStop);
1680
1681      exportto(Schreyer, Syzextra_g::Tail);
1682      exportto(Schreyer, Syzextra_g::ComputeLeadingSyzygyTerms);
1683      exportto(Schreyer, Syzextra_g::Compute2LeadingSyzygyTerms);
1684      exportto(Schreyer, Syzextra_g::Sort_c_ds);
1685     
1686    }
1687*/
1688
1689    exportto(Top, DetailedPrint);
1690    exportto(Top, GetInducedData);
1691
1692    if( @DEBUG )
1693    {
1694      listvar(Top);
1695      listvar(Schreyer);
1696    }
1697  }
1698 
1699  if( !defined(GetInducedData) )
1700  {
1701    ERROR("Sorry but we are missing the dynamic module (syzextra.so)...");
1702  }
1703
1704}
1705
1706static proc mod_init()
1707{
1708  loadme();
1709}
1710
1711
1712proc testallSexamples()
1713{
1714  example Ssyz;
1715  example Scontinue;
1716  example Sres; 
1717}
1718
1719proc testallSSexamples()
1720{
1721  example SSsyz;
1722  example SScontinue;
1723  example SSres; 
1724}
1725
1726example
1727{ "EXAMPLE:"; echo = 2;
1728  testallSexamples();
1729  testallSSexamples();
1730}
1731
1732proc TestSSres(def M)
1733{
1734  "-------------------------------------";
1735  "options: ", attrib(SSinit, "LEAD2SYZ"), attrib(SSinit, "TAILREDSYZ"), attrib(SSinit, "HYBRIDNF"), ": ";
1736  int t = timer;
1737  def S = SSres(M, 0);
1738  int tt = timer;
1739/*
1740  setring S;
1741 
1742  MRES;
1743  RES;
1744  "";
1745  LRES;
1746  "";
1747  TRES;
1748*/ 
1749  kill S;
1750 "0-----------------------------------0 => ", tt - t;
1751}
1752
1753
1754proc TestSSresAttribs(def M)
1755{
1756
1757  // the following 2 setups are bad for AGR@101n3d002s004%1:(((
1758//  attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);
1759//  attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M);
1760
1761  attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);
1762  attrib(SSinit, "LEAD2SYZ", 0); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M);
1763
1764  attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);
1765  attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 0); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M);
1766
1767  attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 0); TestSSres(M);
1768  attrib(SSinit, "LEAD2SYZ", 1); attrib(SSinit, "TAILREDSYZ", 1); attrib(SSinit, "HYBRIDNF", 1); TestSSres(M);
1769}
1770
1771
1772proc testALLA()
1773{
1774  attrib(SSinit, "SYZCHECK", 1); // TODO: only for now!!
1775
1776  ring r; r; ideal M = maxideal(1); M;
1777  TestSSresAttribs(M); 
1778  kill r;
1779
1780  ring r = 0, (a, b, c, d), lp; r; ideal M = maxideal(1); M;
1781  TestSSresAttribs(M); 
1782  kill r;
1783
1784  ring R = 0, (w, x, y, z), dp; R;
1785  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z; M;
1786  TestSSresAttribs(M); 
1787  kill R;
1788
1789 
1790  ring AGR = (101), (a, b, c, d), dp; AGR;
1791  // simple: AGR@101n3d002s004%1:
1792  ideal M = c*d, b*d, a*d, c^2-d^2, b*c, a*c, b^2-d^2, a*b, a^2-d^2;
1793  M;
1794  TestSSresAttribs(M);
1795
1796
1797  // medium: AGR@101n3d004s009%1;
1798  ideal M = a*b+7*a*c-16*b*c-27*a*d+37*b*d-2*c*d, d^3, c*d^2, b*d^2, a*d^2, c^2*d, b*c*d, a*c*d, b^2*d, a^2*d, c^3, b*c^2, a*c^2, b^2*c, a^2*c, b^3, a^3;
1799  M;
1800  TestSSresAttribs(M);
1801
1802  /*
1803  // lengthy: AGR@101n3d008s058%3, toooo long!!! :((((
1804  ideal M = c^4*d^2+4*a^3*d^3+29*a^2*b*d^3-2*a*b^2*d^3+2*b^3*d^3-21*a^2*c*d^3+46*a*b*c*d^3+2*b^2*c*d^3-13*a*c^2*d^3+32*b*c^2*d^3+46*c^3*d^3-28*a^2*d^4+4*a*b*d^4+29*b^2*d^4-8*a*c*d^4+33*b*c*d^4-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4,a*b*c*d^4,a^2*c*d^4,b^3*d^4,a*b^2*d^4,a^2*b*d^4,a^3*d^4;
1805  M;
1806  TestSSresAttribs(M);
1807*/ 
1808  kill AGR;
1809
1810  ring r = 0, (a, b, c, d, e, f), dp; r; ideal M = maxideal(1); M;
1811  TestSSresAttribs(M); 
1812  kill r; 
1813}
1814
1815// TODO: betti!!!
1816
Note: See TracBrowser for help on using the repository browser.