source: git/Singular/LIB/schreyer.lib @ 8b78ee

spielwiese
Last change on this file since 8b78ee was 8b78ee, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
sorting for Syz/Res project: add: inplace sorting 'Sort_c_ds' add: MySort to schreyer.lib for testing 'Sort_c_ds' chg: ComputeLeadingSyzygyTerms now sorts the output fix: MySort for non-monomial modules
  • Property mode set to 100644
File size: 34.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  int @SYZCHECK = 1 || @DEBUG; // TODO: only for now!!
554 
555  if( @DEBUG )
556  {
557    "SSinit::Input";
558    type(M);
559//    DetailedPrint(M);
560    attrib(M);
561  }
562
563  int @RANK = nrows(M); int @SIZE = ncols(M);
564
565  int @IS_A_SB = attrib(M, "isSB"); // ??? only if all weights were zero?!
566
567  if( !@IS_A_SB )
568  {
569    def opts = option(get);
570    option(redSB); option(redTail);
571    M = std(M);
572    option(set, opts);
573    kill opts;
574  } else
575  {
576    M = simplify(M, 2 + 4 + 32);
577  }
578
579  def @N = MySort(M); // TODO: replace with inplace sorting!!!
580  def LEAD = lead(@N);
581
582  if( @SYZCHECK )
583  {
584    def @LEAD = lead(M);
585
586    // sort wrt neg.deg.rev.lex!
587    intvec iv_ds = sort(@LEAD, "c,ds", 1)[2]; // ,1 => reversed!
588
589    M = M[iv_ds]; // sort M wrt ds on current leading terms
590    @LEAD = @LEAD[iv_ds];
591
592    // 0^th syz. property
593    if( size(module( matrix(@N) - matrix(M) )) > 0 )
594    {
595      "M:"; M;
596      "@N:"; @N;
597
598      "module( matrix(@N) - matrix(M) ): ";
599      module( matrix(@N) - matrix(M) );
600
601      "ERROR: wrong sorting (in SSnit): @N != M!!!";
602      $
603    }
604
605    // 0^th syz. property
606    if( size(module( matrix(@LEAD) - matrix(LEAD) )) > 0 )
607    {
608      "LEAD:"; LEAD;
609      "@LEAD:"; @LEAD;
610
611      "module( matrix(@LEAD) - matrix(LEAD) ): ";
612      module( matrix(@LEAD) - matrix(LEAD) );
613
614      "ERROR: wrong sorting (in SSnit): @LEAD != LEAD!!!";
615      $
616    }
617   
618  }
619
620  M = @N;
621 
622 
623 
624 
625  def TAIL = Tail(M);
626 
627  intvec @DEGS = deg(M[1..@SIZE]); // store actuall degrees of input elements
628 
629  // TODO: what about real modules? weighted ones?
630 
631  list @l = ringlist(@save);
632
633  int @z = 0; ideal @m = maxideal(1); intvec @wdeg = deg(@m[1..ncols(@m)]);
634
635  // NOTE: @wdeg will be ignored anyway :(
636  @l[3] = list(list("C", @z), list("lp", @wdeg));
637
638  kill @z, @wdeg; // since these vars are ring independent!
639
640  def S = ring(@l); // --MakeInducedSchreyerOrdering(1);
641
642  module F = freemodule(@RANK);
643  intvec @V = deg(F[1..@RANK]);
644 
645  setring S; // ring with an easy divisibility test ("C, lex")
646
647  if( @DEBUG )
648  {
649    "SSinit::NewRing(C, lex)";
650    basering;
651    DetailedPrint(basering);
652  }
653
654  // Setup the leading syzygy^{-1} module to zero:
655  module Z = 0; Z[@RANK] = 0; attrib(Z, "isHomog", intvec(0)); 
656
657  module MRES = Z;
658 
659  list RES;  RES[1] = Z;
660  list LRES; LRES[1] = Z;
661  list TRES; TRES[1] = Z;
662 
663  def M = imap(@save, M);
664
665  attrib(M, "isHomog", @V);
666  attrib(M, "isSB", 1);
667  attrib(M, "degrees", @DEGS); 
668 
669  def LEAD = imap(@save, LEAD);
670 
671  attrib(LEAD, "isHomog", @V);
672  attrib(LEAD, "isSB", 1); 
673 
674  def TAIL = imap(@save, TAIL);
675
676  if( @DEBUG )
677  {
678    "SSinit::(sorted) SB_Input: ";
679    type(M);
680    attrib(M);
681    attrib(M, "isHomog");
682//    DetailedPrint(M);
683  }
684
685  if( @SYZCHECK )
686  {
687    // 0^th syz. property
688    if( size(module(transpose( transpose(M) * transpose(MRES) ))) > 0 )
689    {
690      transpose( transpose(M) * transpose(MRES) );
691      "ERROR: transpose( transpose(M) * transpose(MRES) ) != 0!!!";
692      $
693    }
694  }
695
696  RES [size(RES)+1] = M; // list of all syzygy modules
697  LRES[size(LRES)+1] = LEAD; // list of all syzygy modules
698  TRES[size(TRES)+1] = TAIL; // list of all syzygy modules
699 
700  MRES = MRES, M; //?
701
702  attrib(MRES, "isHomog", @V);
703 
704//  attrib(S, "InducionStart", @RANK);
705  attrib(S, "LEAD2SYZ", 0);
706  attrib(S, "TAILREDSYZ", 1);
707  attrib(S, "DEBUG", @DEBUG);
708  attrib(S, "SYZCHECK", @SYZCHECK);
709 
710  if( @DEBUG )
711  {
712    "SSinit::MRES";
713    MRES;
714//    DetailedPrint(MRES);
715    attrib(MRES, "isHomog");
716    attrib(S);
717  }
718
719  export RES;
720  export MRES;
721  export LRES;
722  export TRES;
723  return (S);
724}
725example
726{ "EXAMPLE:"; echo = 2;
727  ring R = 0, (w, x, y, z), dp;
728
729  def M = maxideal(1);
730  def S = SSinit(M); setring S; S;
731 
732  "Only the first initialization: ";
733  RES; LRES; TRES;
734  MRES;
735
736  kill S; setring R; kill M;
737 
738  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
739  def S = SSinit(M); setring S; S;
740
741  "Only the first initialization: ";
742  RES; LRES; TRES;
743  MRES;
744
745  kill S; setring R; kill M;
746}
747
748
749LIB "poly.lib"; // for lcm
750
751
752
753/// Compute L(Syz(L))
754proc SSComputeLeadingSyzygyTerms(def L)
755{
756  if( typeof( attrib(basering, "DEBUG") ) == "int" )
757  {
758    int @DEBUG = attrib(basering, "DEBUG");
759  } else
760  {
761    int @DEBUG = !system("with", "ndebug");
762  }
763
764  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
765  {
766    int @SYZCHECK = attrib(basering, "SYZCHECK");
767  } else
768  {
769    int @SYZCHECK = @DEBUG;
770  }
771 
772  if( @DEBUG )
773  {
774    "SSComputeLeadingSyzygyTerms::Input: ";
775    L;
776  }
777
778  module SS = ComputeLeadingSyzygyTerms(L);
779
780  if( @SYZCHECK )
781  { 
782    int i, j, r;
783    int N = ncols(L);
784    def a, b;
785    poly aa, bb;
786
787    bigint c;
788
789    ideal M;
790
791    module S = 0;
792
793    for(i = 1; i <= N; i++)
794    {
795      a = L[i];
796      c = leadcomp(a);
797      r = int(c);
798
799      aa = leadmonomial(a);
800
801      M = 0;
802
803      for(j = i-1; j > 0; j--)
804      {
805        b = L[j];
806
807        if( leadcomp(b) == c )
808        {
809          bb = leadmonomial(b);
810
811          M[j] = (lcm(aa, bb) / aa);
812        }
813      }
814
815      // TODO: add quotient relations here...
816
817      M = simplify(M, 1 + 2 + 32);
818
819      M = MySort(M);
820
821      S = S, M * gen(i);
822    }
823
824    S = MySort(simplify(S, 2));
825
826    if( size(module(matrix(S) - matrix(SS))) > 0 )
827    {
828        "ERROR: S != SS ";
829
830        "basering: ";
831        DetailedPrint(basering);
832
833        "S: ";  S;
834        DetailedPrint(S, 1);
835        "SS: "; SS;
836        DetailedPrint(SS, 1);
837
838        "DIFF: ";
839        print(matrix(S) - matrix(SS));
840        DetailedPrint(module(matrix(S) - matrix(SS)), 2);     
841        $
842    }
843  }
844
845 
846  if( @DEBUG )
847  {
848    "SSComputeLeadingSyzygyTerms::Output: ";
849    "SS: ";
850    SS;
851  }
852 
853  attrib(SS, "isSB", 1);
854
855  return (SS);
856}
857
858/// Compute Syz(L), where L is a monomial (leading) module
859proc SSCompute2LeadingSyzygyTerms(def L, int @TAILREDSYZ)
860{
861  if( typeof( attrib(basering, "DEBUG") ) == "int" )
862  {
863    int @DEBUG = attrib(basering, "DEBUG");
864  } else
865  {
866    int @DEBUG = !system("with", "ndebug");
867  }
868
869  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
870  {
871    int @SYZCHECK = attrib(basering, "SYZCHECK");
872  } else
873  {
874    int @SYZCHECK = @DEBUG;
875  }
876 
877  if( @DEBUG )
878  {
879    "SSCompute2LeadingSyzygyTerms::Input: ";
880    L;
881    "@TAILREDSYZ: ", @TAILREDSYZ;
882  }
883
884  int i, j, r;
885  int N = ncols(L);
886  def a, b;
887
888  poly aa, bb, @lcm;
889
890  bigint c;
891
892  module M;
893
894  module S = 0;
895
896  for(i = 1; i <= N; i++)
897  {
898    a = L[i];
899//    "a: ", a;
900    c = leadcomp(a);
901    r = int(c);
902
903    aa = leadmonomial(a);
904
905    M = 0;
906
907    for(j = i-1; j > 0; j--)
908    {
909      b = L[j];
910//      "b: ", b;
911
912      if( leadcomp(b) == c )
913      {
914        bb = leadmonomial(b);
915        @lcm = lcm(aa, bb);
916
917        M[j] = (@lcm / aa)* gen(i) - (@lcm / bb)* gen(j);
918      }
919    }
920   
921    M = simplify(M, 2);
922
923    // TODO: add quotient relations here...
924    S = S, M;
925  }
926
927  if( @TAILREDSYZ )
928  {
929    // Make sure that 2nd syzygy terms are not reducible by 1st
930    def opts = option(get);
931    option(redSB); option(redTail);
932    S = std(S); // binomial module
933    option(set, opts);
934    //  kill opts;
935  } else
936  {
937    S = simplify(S, 2 + 32);
938  }
939
940  S = MySort(S);
941
942  if( @DEBUG )
943  {
944    "SSCompute2LeadingSyzygyTerms::Syz(LEAD): "; S;
945  }
946
947  if( @SYZCHECK )
948  {
949    if( size(S) > 0 and size(L) > 0 )
950    {
951      if( size(module(transpose( transpose(S) * transpose(L) ))) > 0 )
952      {
953        transpose( transpose(S) * transpose(L) );
954        "ERROR: transpose( transpose(S) * transpose(L) ) != 0!!!";
955        $
956      }
957    }
958  }
959
960  module S2 = Tail(S);
961  S = lead(S); // (C,lp) on base ring!
962             
963  if( @DEBUG )
964  {
965    "SSCompute2LeadingSyzygyTerms::Output: "; S; S2;
966  } 
967 
968  attrib(S, "isSB", 1);
969
970  return (S, S2);
971}
972
973// -------------------------------------------------------- //
974
975/// TODO: save shortcut LM(m) * "t" -> ?
976proc SSReduceTerm(poly m, def t, def L, def T, list #)
977{
978  if( typeof( attrib(basering, "DEBUG") ) == "int" )
979  {
980    int @DEBUG = attrib(basering, "DEBUG");
981  } else
982  {
983    int @DEBUG = !system("with", "ndebug");
984  }
985
986  if( @DEBUG )
987  {
988    "SSReduce::Input: ";
989
990    "mult: ", m;
991    "term: ", t;
992    "L: ", L;
993    "T: ", T;
994    if( size(#) > 0 )
995    {
996      "LSyz: ", #;
997    }
998//    "attrib(LS, 'isSB')", attrib(LS, "isSB");
999  }
1000 
1001  vector s = 0;
1002
1003  if( t == 0 )
1004  {
1005    return (s);
1006  }
1007
1008  def product = m * t;
1009
1010  bigint c = leadcomp(t);
1011  int r = int(c);
1012 
1013  def a, b, nf, bb;
1014
1015  // looking for an appropriate reducer
1016  for( int k = ncols(L); k > 0; k-- )
1017  {
1018    a = L[k];
1019    // with the same mod. component
1020    if( leadcomp(a) == c )
1021    {
1022      b = - (leadmonomial(product) / leadmonomial(L[k]));
1023     
1024      // which divides the product
1025      if( b != 0 )
1026      {
1027//        "b: ", b;
1028        bb = b * gen(k);
1029        nf = bb;
1030
1031        if( size(#) > 0 )
1032        {
1033          if( typeof(#[1]) == "module" )
1034          {
1035            nf = NF(bb, #[1]);
1036//        "NF: ", nf;
1037          }
1038        }
1039
1040        // while the complement (the fraction) is not reducible by leading syzygies
1041        if( nf != 0 )
1042        {
1043          /// TODO: save shortcut LM(m) * T[i] -> ?
1044
1045          // choose ANY such reduction... (with the biggest index?)
1046          s = bb + SSTraverseTail(b, T[k], L, T, #);
1047          break;
1048        }
1049      }
1050    }
1051  } 
1052  if( @DEBUG )
1053  {
1054    "SSReduceTerm::Output: ", s;
1055  }
1056  return (s);
1057}
1058
1059// TODO: store m * @tail -.-^-.-^-.--> ?
1060proc SSTraverseTail(poly m, def @tail, def L, def T, list #)
1061{
1062  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1063  {
1064    int @DEBUG = attrib(basering, "DEBUG");
1065  } else
1066  {
1067    int @DEBUG = !system("with", "ndebug");
1068  }
1069
1070  if( @DEBUG )
1071  {
1072    "SSTraverse::Input: ";
1073
1074    "mult: ", m;
1075    "tail: ", @tail; // T[i];
1076
1077    if( size(#) > 0 )
1078    {
1079      "LSyz: "; #[1];
1080    }
1081  }
1082
1083  vector s = 0;
1084
1085  def @l;
1086
1087  // iterate tail-terms in ANY order!
1088  while( size(@tail) > 0 )
1089  {
1090    @l = lead(@tail);
1091    s = s + SSReduceTerm(m, @l, L, T, #);
1092    @tail = @tail - @l;
1093  }
1094
1095  if( @DEBUG )
1096  {
1097    "SSTraverseTail::Output: ", s;
1098  }
1099  return (s);
1100}
1101
1102// -------------------------------------------------------- //
1103
1104// module (N, LL, TT) = SSComputeSyzygy(L, T);
1105// Compute Syz(L ++ T) = N = LL ++ TT
1106proc SSComputeSyzygy(def L, def T)
1107{
1108  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1109  {
1110    int @DEBUG = attrib(basering, "DEBUG");
1111  } else
1112  {
1113    int @DEBUG = !system("with", "ndebug");
1114  }
1115 
1116  if( @DEBUG )
1117  {
1118    "SSComputeSyzygy::Input";
1119    "basering: ", basering; attrib(basering);
1120//    DetailedPrint(basering);
1121
1122//    "iCompShift: ", iCompShift;
1123
1124    "L: "; L;
1125    "T: "; T;
1126  }
1127
1128  def a; bigint c; int r, k; poly aa;
1129
1130  int @LEAD2SYZ = 0;
1131  if( typeof( attrib(basering, "LEAD2SYZ") ) == "int" )
1132  {
1133    @LEAD2SYZ = attrib(basering, "LEAD2SYZ");
1134  }
1135
1136  int @TAILREDSYZ = 1;
1137  if( typeof( attrib(basering, "TAILREDSYZ") ) == "int" )
1138  {
1139    @TAILREDSYZ = attrib(basering, "TAILREDSYZ");
1140//    @TAILREDSYZ;
1141  }
1142
1143  /// Get the critical leading syzygy terms
1144  if( @LEAD2SYZ ) // & 2nd syz. term
1145  {
1146    def a2; int r2; poly aa2; 
1147    module LL, LL2;
1148    (LL, LL2) = SSCompute2LeadingSyzygyTerms(L, @TAILREDSYZ); // ++
1149  } else
1150  {
1151    module LL = SSComputeLeadingSyzygyTerms(L);
1152  }
1153
1154  module TT, SYZ;
1155
1156  if( size(LL) > 0 )
1157  {
1158    list LS;
1159
1160    if( @TAILREDSYZ )
1161    {
1162      LS = list(LL);
1163    }
1164   
1165    vector @tail;
1166
1167    for(k = ncols(LL); k > 0; k-- )
1168    {
1169      // leading syz. term:
1170      a = LL[k]; c = leadcomp(a); r = int(c); aa = leadmonomial(a);
1171      //    "A: ", a, " --->>>> ", aa, " **** [", r, "]: ";
1172
1173      /// TODO: save shortcut (aa) * T[r] -> ?
1174      @tail = SSTraverseTail(aa, T[r], L, T, LS);
1175             
1176      // get the 2nd syzygy term...
1177     
1178      if( @LEAD2SYZ ) // with the 2nd syz. term:
1179      {     
1180        a2 = LL2[k]; c = leadcomp(a2); r2 = int(c); aa2 = leadmonomial(a2);
1181        @tail = @tail +
1182             /// TODO: save shortcut (aa2) * T[r2] -> ?
1183             a2 + SSTraverseTail(aa2, T[r2], L, T, LS);
1184      } else
1185      {
1186        @tail = @tail + SSReduceTerm(aa, L[r], L, T, LS);
1187      }     
1188     
1189      TT[k] = @tail;
1190      SYZ[k] = a + @tail;
1191    }
1192  }
1193
1194/*
1195  def opts = option(get); option(redSB); option(redTail);
1196  module SYZ = std(syz(M));
1197  option(set, opts); kill opts;
1198 
1199  module LL = lead(SYZ); // TODO: WRONG ORDERING!!!!!!!!
1200  module TT = Tail(SYZ);
1201*/
1202 
1203  if( @DEBUG )
1204  {
1205    "SSComputeSyzygy::Output";
1206
1207    "SYZ: "; SYZ;
1208    "LL: "; LL;
1209    "TT: "; TT;
1210  }
1211
1212  return (SYZ, LL, TT);
1213}
1214
1215// resolution/syzygy step:
1216static proc SSstep()
1217{
1218  if( typeof( attrib(basering, "DEBUG") ) == "int" )
1219  {
1220    int @DEBUG = attrib(basering, "DEBUG");
1221  } else
1222  {
1223    int @DEBUG = !system("with", "ndebug");
1224  }
1225
1226
1227  if( typeof( attrib(basering, "SYZCHECK") ) == "int" )
1228  {
1229    int @SYZCHECK = attrib(basering, "SYZCHECK");
1230  } else
1231  {
1232    int @SYZCHECK = @DEBUG;
1233  }
1234
1235  if( @DEBUG )
1236  {
1237    "SSstep::NextInducedRing";
1238    "basering: ", basering; attrib(basering);
1239  }
1240
1241/*
1242  // is initial weights are all zeroes!
1243  def L =  lead(M);
1244  intvec @V = deg(M[1..ncols(M)]);  @W;  @V;  @W = @V;  attrib(L, "isHomog", @W); 
1245  SetInducedReferrence(L, @RANK, 0);
1246*/
1247
1248//  def L =  lead(MRES);
1249//  @W = @W, @V;
1250//  attrib(L, "isHomog", @W); 
1251
1252
1253  // General setting:
1254//  SetInducedReferrence(MRES, 0, 0); // limit: 0!
1255  int @l = size(RES);
1256
1257  def M =  RES[@l];
1258
1259  def L = LRES[@l];
1260  def T = TRES[@l];
1261
1262
1263  //// TODO: wrong !!!!!
1264  int @RANK = ncols(MRES) - ncols(M); // nrows(M); // what if M is zero?!
1265
1266 
1267
1268/*
1269  if( @RANK !=  nrows(M) )
1270  {
1271    type(MRES);
1272    @RANK;
1273    type(M);
1274    pause();
1275  }
1276*/
1277 
1278  intvec @W = attrib(M, "isHomog"); intvec @V = attrib(M, "degrees"); @V = @W, @V;
1279   
1280  if( @DEBUG )
1281  {
1282    "Sstep::NextInput: ";
1283    M;
1284    L;
1285    @V;
1286    @RANK;
1287//    DetailedPrint(MRES);
1288    attrib(MRES, "isHomog");
1289  }
1290
1291     
1292  // TODO: N  = SYZ( M )!!!
1293  module N, LL, TT;
1294  (N, LL, TT) = SSComputeSyzygy(/*M, */L, T/*, @RANK*/);
1295
1296  // shift syz.comp by @RANK:
1297  module Z;
1298  Z = 0; Z[@RANK] = 0; Z = Z, transpose(LL);   LL = transpose(Z);
1299  Z = 0; Z[@RANK] = 0; Z = Z, transpose(TT);   TT = transpose(Z);
1300  Z = 0; Z[@RANK] = 0; Z = Z, transpose(N);     N = transpose(Z);
1301
1302
1303  if( @SYZCHECK )
1304  {
1305    if( size(N) > 0 )
1306    {
1307      // next syz. property
1308      if( size(module(transpose( transpose(N) * transpose(MRES) ))) > 0 )
1309      {
1310        "MRES", MRES;
1311
1312        "N: "; N; // DetailedPrint(N, 2);
1313
1314        "LL:"; LL; // DetailedPrint(LL, 1);
1315        "TT:"; TT; // DetailedPrint(TT, 10);
1316
1317        "RANKS: ", @RANK;
1318
1319        "transpose( transpose(N) * transpose(MRES) ) != 0!!!";
1320        transpose( transpose(N) * transpose(MRES) );
1321
1322        "transpose(N) * transpose(MRES): ";
1323        transpose(N) * transpose(MRES);
1324        // DetailedPrint(module(_), 2);
1325        $
1326      }
1327    }
1328  }
1329
1330  attrib(N, "isHomog", @V);
1331
1332  // TODO: correct the following:
1333  intvec @DEGS = deg(N[1..ncols(N)]); // no mod. comp. weights :(
1334
1335 
1336  attrib(N, "degrees", @DEGS);
1337 
1338   RES[@l + 1] = N; // list of all syzygy modules
1339  LRES[@l + 1] = LL; // list of all syzygy modules
1340  TRES[@l + 1] = TT; // list of all syzygy modules
1341
1342  MRES = MRES, N;
1343 
1344  attrib(MRES, "isHomog", @V);
1345
1346//  L = L, lead(N);  attrib(basering, "InducionLeads", L);
1347
1348  if( @DEBUG )
1349  {
1350    "SSstep::NextSyzOutput: ";
1351    N;
1352//    DetailedPrint(N);
1353    attrib(N);
1354  }
1355
1356}
1357
1358proc SScontinue(int l)
1359"USAGE:  SScontinue(l)
1360RETURN:  nothing, instead it changes RES and MRES variables in the current ring
1361PURPOSE: computes further (at most l) syzygies
1362NOTE:    must be used within a ring returned by Sres or Ssyz. RES and MRES are
1363         explained in Sres
1364EXAMPLE: example Scontinue; shows an example
1365"
1366{
1367
1368  /// TODO!
1369//  def data = GetInducedData();
1370
1371  if( (!defined(RES)) || (!defined(MRES)) ) /* || (typeof(data) != "list") || (size(data) != 2) */
1372  {
1373    ERROR("Sorry, but basering does not seem to be returned by Sres or Ssyz");
1374  }
1375  for (;  (l != 0) && (size(RES[size(RES)]) > 0); l-- )
1376  {
1377    SSstep();
1378  }
1379}
1380example
1381{ "EXAMPLE:"; echo = 2;
1382  ring r;
1383  module M = maxideal(1); M;
1384  def S = SSsyz(M); setring S; S;
1385  "Only the first syzygy: ";
1386  RES; MRES;
1387  "More syzygies: ";
1388  SScontinue(10);
1389  RES; MRES;
1390}
1391
1392proc SSsyz(def M)
1393"USAGE:  SSsyz(M)
1394RETURN:  ring, containing a list of modules RES and a module MRES
1395PURPOSE: computes the first syzygy module of M (wrt some Schreyer ordering)?
1396NOTE:    The output is explained in Sres
1397EXAMPLE: example Ssyz; shows an example
1398"
1399{
1400  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
1401  {
1402    ERROR("Sorry: need an ideal or a module for input");
1403  }
1404
1405  def SS = SSinit(M); setring SS;
1406 
1407  SSstep(); // NOTE: what if M is zero?
1408
1409  return (SS);
1410}
1411example
1412{ "EXAMPLE:"; echo = 2;
1413  ring r;
1414
1415/*  ideal M = 0;
1416  def S = SSsyz(M); setring S; S;
1417  "Only the first syzygy: ";
1418  RES; LRES; TRES;
1419  MRES;
1420 
1421  kill S; setring r; kill M;
1422*/ 
1423
1424  ideal M = maxideal(1); M;
1425  def S = SSres(M, 0); setring S; S;
1426  MRES;
1427  RES;
1428  "";
1429  LRES;
1430  "";
1431  TRES;
1432
1433  kill S; setring r; kill M;
1434
1435  kill r;
1436 
1437  ring R = 0, (w, x, y, z), dp;
1438  ideal M = w^2 - x*z,  w*x - y*z,  x^2 - w*y, x*y - z^2, y^2 - w*z;
1439 
1440  def S = SSres(M, 0); setring S; S;
1441  MRES;
1442  RES;
1443  "";
1444  LRES;
1445  "";
1446  TRES;
1447}
1448
1449proc SSres(def M, int l)
1450"USAGE:  SSres(I, l)
1451RETURN:  ring, containing a list of modules RES and a module MRES
1452PURPOSE: computes (at most l) syzygy modules of M wrt the classical Schreyer
1453         induced ordering with gen(i) > gen(j) if i > j, provided both gens
1454         are from the same syzygy level.???
1455NOTE:    RES contains the images of maps subsituting the beginning of the
1456         Schreyer free resolution of baseRing^r/M, while MRES is a sum of
1457         these images in a big free sum, containing all the syzygy modules.
1458         The syzygy modules are shifted so that gen(i) correspons to MRES[i].
1459         The leading zero module RES[0] indicates the fact that coker of the
1460         first map is zero. The number of zeroes inducates the rank of input.
1461NOTE:    If l == 0 then l is set to be nvars(basering) + 1
1462EXAMPLE: example SSres; shows an example
1463"
1464{
1465  if( (typeof(M) != "module") && (typeof(M) != "ideal") )
1466  {
1467    ERROR("Sorry: need an ideal or a module for input");
1468  }
1469
1470  def SS = SSinit(M); setring SS;
1471
1472  if (l == 0)
1473  {
1474    l = nvars(basering) + 1; // not really an estimate...?!
1475  }
1476
1477  SSstep(); l = l - 1;
1478
1479  SScontinue(l);
1480
1481  return (SS);
1482}
1483example
1484{ "EXAMPLE:"; echo = 2;
1485  ring r;
1486  module M = maxideal(1); M;
1487  def S = SSres(M, 0); setring S; S;
1488  RES;
1489  MRES;
1490  kill S;
1491  setring r; kill M;
1492
1493  def A = nc_algebra(-1,0); setring A;
1494  ideal Q = var(1)^2, var(2)^2, var(3)^2;
1495  qring SCA = twostd(Q);
1496  basering;
1497
1498  module M = maxideal(1);
1499  def S = SSres(M, 2); setring S; S;
1500  RES;
1501  MRES;
1502}
1503
1504
1505
1506static proc loadme()
1507{
1508  int @DEBUG = !system("with", "ndebug");
1509
1510  if( @DEBUG )
1511  {
1512   
1513    "ndebug?: ", system("with", "ndebug");
1514    "om_ndebug?: ", system("with", "om_ndebug");
1515
1516    listvar(Top);
1517    listvar(Schreyer);
1518  }
1519//  listvar(Syzextra); listvar(Syzextra_g);
1520
1521  if( !defined(DetailedPrint) )
1522  {
1523    if( 1 )
1524    {
1525
1526      if( @DEBUG )
1527      {
1528        "Loading the Release version!";
1529      }
1530      load("syzextra.so");
1531
1532      if( @DEBUG )
1533      {
1534        listvar(Syzextra);
1535      }
1536
1537      exportto(Top, Syzextra::ClearContent);
1538      exportto(Top, Syzextra::ClearDenominators);
1539
1540      exportto(Schreyer, Syzextra::m2_end);
1541     
1542//      export Syzextra;
1543
1544//      exportto(Schreyer, Syzextra::noop);
1545      exportto(Schreyer, Syzextra::DetailedPrint);
1546      exportto(Schreyer, Syzextra::leadmonomial);
1547      exportto(Schreyer, Syzextra::leadcomp);
1548//      exportto(Schreyer, Syzextra::leadrawexp);
1549//      exportto(Schreyer, Syzextra::ISUpdateComponents);
1550      exportto(Schreyer, Syzextra::SetInducedReferrence);
1551      exportto(Schreyer, Syzextra::GetInducedData);
1552//      exportto(Schreyer, Syzextra::GetAMData);
1553//      exportto(Schreyer, Syzextra::SetSyzComp);
1554      exportto(Schreyer, Syzextra::MakeInducedSchreyerOrdering);
1555//      exportto(Schreyer, Syzextra::MakeSyzCompOrdering);
1556      exportto(Schreyer, Syzextra::idPrepare);
1557//      exportto(Schreyer, Syzextra::reduce_syz);
1558//      exportto(Schreyer, Syzextra::p_Content);
1559
1560      exportto(Schreyer, Syzextra::ProfilerStart); exportto(Schreyer, Syzextra::ProfilerStop);
1561
1562      exportto(Schreyer, Syzextra::Tail);
1563      exportto(Schreyer, Syzextra::ComputeLeadingSyzygyTerms);     
1564      exportto(Schreyer, Syzextra::Sort_c_ds);
1565    }
1566/*
1567    else
1568    {
1569      if( @DEBUG )
1570      {
1571        "Loading the Debug version!";
1572      }
1573
1574      load("syzextra.so");
1575
1576      if( @DEBUG )
1577      {     
1578        listvar(Syzextra_g);
1579      }
1580     
1581      exportto(Top, Syzextra_g::ClearContent);
1582      exportto(Top, Syzextra_g::ClearDenominators);
1583
1584      exportto(Schreyer, Syzextra_g::m2_end);
1585
1586//      export Syzextra_g;
1587//      exportto(Schreyer, Syzextra_g::noop);
1588      exportto(Schreyer, Syzextra_g::DetailedPrint);
1589      exportto(Schreyer, Syzextra_g::leadmonomial);
1590      exportto(Schreyer, Syzextra_g::leadcomp);
1591//      exportto(Schreyer, Syzextra_g::leadrawexp);
1592//      exportto(Schreyer, Syzextra_g::ISUpdateComponents);
1593      exportto(Schreyer, Syzextra_g::SetInducedReferrence);
1594      exportto(Schreyer, Syzextra_g::GetInducedData);
1595//      exportto(Schreyer, Syzextra_g::GetAMData);
1596//      exportto(Schreyer, Syzextra_g::SetSyzComp);
1597      exportto(Schreyer, Syzextra_g::MakeInducedSchreyerOrdering);
1598//      exportto(Schreyer, Syzextra_g::MakeSyzCompOrdering);
1599      exportto(Schreyer, Syzextra_g::idPrepare);
1600//      exportto(Schreyer, Syzextra_g::reduce_syz);
1601//      exportto(Schreyer, Syzextra_g::p_Content);
1602
1603      exportto(Schreyer, Syzextra_g::ProfilerStart); exportto(Schreyer, Syzextra_g::ProfilerStop);
1604
1605      exportto(Schreyer, Syzextra_g::Tail);
1606      exportto(Schreyer, Syzextra_g::ComputeLeadingSyzygyTerms);
1607      exportto(Schreyer, Syzextra_g::Sort_c_ds);
1608     
1609    }
1610*/
1611
1612    exportto(Top, DetailedPrint);
1613    exportto(Top, GetInducedData);
1614
1615    if( @DEBUG )
1616    {
1617      listvar(Top);
1618      listvar(Schreyer);
1619    }
1620  }
1621 
1622  if( !defined(GetInducedData) )
1623  {
1624    ERROR("Sorry but we are missing the dynamic module (syzextra.so)...");
1625  }
1626
1627}
1628
1629static proc mod_init()
1630{
1631  loadme();
1632}
1633
1634
1635proc testallSexamples()
1636{
1637  example Ssyz;
1638  example Scontinue;
1639  example Sres; 
1640}
1641
1642proc testallSSexamples()
1643{
1644  example SSsyz;
1645  example SScontinue;
1646  example SSres; 
1647}
1648
1649example
1650{ "EXAMPLE:"; echo = 2;
1651  testallSexamples();
1652  testallSSexamples();
1653}
Note: See TracBrowser for help on using the repository browser.