cali.red 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. module cali;
  2. % Author H.-G. Graebe | Univ. Leipzig
  3. % graebe@informatik.uni-leipzig.de
  4. % terpri(); write "CALI 2.2.1 Last update June 22, 1995"; terpri();
  5. COMMENT
  6. #########################
  7. #### ####
  8. #### HEADER MODULE ####
  9. #### ####
  10. #########################
  11. This is the header module of the package CALI, a package for
  12. computational commutative algebra.
  13. Author : H.-G. Graebe
  14. Univ. Leipzig
  15. Institut fuer Informatik
  16. Augustusplatz 10 - 11
  17. D - 04109 Leipzig
  18. Germany
  19. email : graebe@informatik.uni-leipzig.de
  20. Version : 2.2.1, finished at June 22, 1995.
  21. See cali.chg for change's documentation.
  22. Please send all Comments, bugs, hints, wishes, criticisms etc. to the
  23. above email address.
  24. Abstract :
  25. This package contains algorithms for computations in commutative
  26. algebra closely related to the Groebner algorithm for ideals and
  27. modules. There are facilities for local computations, using a modern
  28. implementation of Mora's standard basis algorithm, that works for
  29. arbitrary term orders. This reflects the full analogy between modules
  30. over local rings and homogeneous (in fact H-local) modules over
  31. polynomial rings.
  32. CALI extends also the term order facilities of the REDUCE internal
  33. groebner package, defining term orders by degree vector lists, and
  34. the rigid implementation of the sugar idea, by a more flexible ecart
  35. vector, in particular useful for local computations. Version 2.2. has
  36. also a common view on normal forms for noetherian and non-noetherian
  37. term orders.
  38. The package was designed mainly as a symbolic mode programming
  39. environment extending the build-in facilities of REDUCE for the
  40. computational approach to problems arising naturally in commutative
  41. algebra. An algebraic mode interface allows to access (in a more
  42. rigid frame) all important features implemented symbolically.
  43. As main topics CALI contains facilities for
  44. -- defining rings, ideals and modules,
  45. -- computing Groebner bases and local standard bases,
  46. -- computing syzygies, resolutions and (graded) Betti numbers,
  47. -- computing (also weighted) Hilbert series, multiplicities,
  48. independent sets, dimensions,
  49. -- computing normal forms and representations,
  50. -- computing sums, products, intersections, elimination ideals etc.,
  51. -- primality tests, computation of radicals, unmixed radicals,
  52. equidimensional parts, primary decompositions etc. of ideals
  53. and modules,
  54. -- advanced applications of Groebner bases (blowup, associated graded
  55. ring, analytic spread, symmetric algebra, monomial curves),
  56. -- applications of linear algebra techniques to zerodimensional
  57. ideals, as e.g. the FGLM change of term orders, border bases
  58. and affine and projective ideals of sets of points,
  59. -- splitting polynomial systems of equations mixing factorization and
  60. Groebner algorithm, triangular systems, and different versions
  61. of the extended Groebner factorizer.
  62. Reduce version required :
  63. The program was tested under v. 3.4 - 3.6.
  64. (I had some trouble with the module dualbases under 3.4.1)
  65. Relevant publications :
  66. See the bibliography in the manual.
  67. Key words :
  68. Groebner algorithm for ideals and modules, local standard bases,
  69. Groebner factorizer, extended Groebner factorizer, triangular systems,
  70. normal forms, ideal and module operations, Hilbert series, independent
  71. sets, dual bases, border bases, affine and projective sets of points,
  72. free resolution, constructive commutative algebra, primality test,
  73. radical, unmixed radical, equidimensional part, primary decomposition,
  74. blowup, associated graded ring, analytic spread, symmetric algebra,
  75. monomial curves.
  76. To be done :
  77. eo(vars) : test cali!=basering for eliminationorder according to vars
  78. -> eliminate
  79. Remind :
  80. Never "put" variables, that are subject to rebounding via "where" !
  81. end comment;
  82. create!-package( '(
  83. cali % This header module.
  84. bcsf % Base coeff. arithmetics.
  85. ring % Base ring and monomial arithmetics.
  86. mo % Monomial arithmetic.
  87. dpoly % Distr. polynomial (and vector) arithmetics.
  88. bas % Polynomial lists.
  89. dpmat % dpmat's arithmetic.
  90. red % Normal form algorithms and related topics.
  91. groeb % Groebner algorithm and related topics.
  92. groebf % Groebner factorizer and extensions.
  93. matop % Module operations on dpmats.
  94. quot % Different quotients.
  95. moid % Lead. term ideal algorithms.
  96. hf % Hilbert series.
  97. res % Resolutions.
  98. intf % Interface to algebraic mode.
  99. odim % Alg. for zerodimensional ideals and
  100. % modules.
  101. prime % Primality test, radical, and primary
  102. % decomposition.
  103. scripts % Advanced applications, inspired by the
  104. % scripts of Bayer/Stillman.
  105. calimat % CALI's extension of the matrix package.
  106. lf % The dual bases approach (FGLM etc.).
  107. triang % (Zero dimensional) triangular systems.
  108. ),'(contrib cali));
  109. load!-package 'matrix;
  110. fluid '(
  111. cali!=basering % see rings
  112. cali!=degrees % see mons in rings
  113. cali!=monset % see groeb
  114. );
  115. % Default :
  116. switch
  117. hardzerotest, % (off) see bcsf, try simp for each zerotest.
  118. red_total, % (on) see red, do total reductions.
  119. bcsimp, % (on) see red, cancel coefficient's gcd.
  120. noetherian, % (on) see interf, test term orders and
  121. % choose non local algorithms.
  122. factorprimes, % (on) see primes, invoke groebfactor during
  123. % prime decomposition.
  124. factorunits, % (off) see groeb, try to remove units from
  125. % polynomials by factorization.
  126. detectunits, % (off) see groeb, detect generators of the form
  127. % monomial * unit.
  128. lexefgb; % (off) see groebf, invoke the extended
  129. % Groebner factorizer with pure
  130. % lex zerosolve.
  131. % The first initialization :
  132. put('cali,'trace,0); % No tracing.
  133. % linelength 79; % This is much more convenient than 80.
  134. % However, it causes problems in window sys.
  135. % The new tracing. We hope that this shape will easily interface to a
  136. % forthcoming general trace utility.
  137. symbolic operator setcalitrace;
  138. symbolic procedure setcalitrace(n);
  139. % Set trace intensity.
  140. put('cali,'trace,n);
  141. symbolic operator setcaliprintterms;
  142. symbolic procedure setcaliprintterms(n);
  143. % Set number of terms to be printed in intermediate output.
  144. if n<=0 then typerr(n,"number of terms to be printed")
  145. else put('cali,'printterms,n);
  146. symbolic operator clearcaliprintterms;
  147. symbolic procedure clearcaliprintterms;
  148. % Set intermediate output printing to "all".
  149. << remprop('cali,'printterms); write"Term print bound cleared";
  150. terpri();
  151. >>;
  152. symbolic procedure cali_trace();
  153. % Get the trace intensity.
  154. get('cali,'trace);
  155. % ---- Some useful things, probably implemented also elsewhere
  156. % ---- in the system.
  157. % symbolic procedure first x; car x;
  158. % symbolic procedure second x; cadr x;
  159. % symbolic procedure third x; caddr x;
  160. symbolic procedure strcat l;
  161. % Concatenate the items in the list l to a string.
  162. begin scalar u;
  163. u:=for each x in l join explode x;
  164. while memq('!!,u) do u:=delete('!!,u);
  165. while memq('!",u) do u:=delete('!",u);
  166. return compress append(append('(!"),u),'(!"));
  167. end;
  168. symbolic procedure numberlistp l;
  169. % l is a list of numbers.
  170. if null l then t
  171. else fixp car l and numberlistp cdr l;
  172. symbolic procedure merge(l1,l2,fn);
  173. % Returns the (physical) merge of the two sorted lists l1 and l2.
  174. if null l1 then l2
  175. else if null l2 then l1
  176. else if apply2(fn,car l1,car l2) then rplacd(l1,merge(cdr l1,l2,fn))
  177. else rplacd(l2,merge(l1,cdr l2,fn));
  178. symbolic procedure listexpand(fn,l); eval expand(l,fn);
  179. symbolic procedure listtest(a,b,f);
  180. % Return the first u in a s.th. f(u,b) or nil.
  181. if null a then nil
  182. else if apply2(f,car a,b) then if car a=nil then t else car a
  183. else listtest(cdr a,b,f);
  184. symbolic procedure listminimize(a,f);
  185. % Returns a minimal list b such that for all v in a ex. u in b such
  186. % that f(u,v). The elements are in the same order as in a.
  187. if null a then nil else reverse cali!=min(nil,a,f);
  188. symbolic procedure cali!=min(b,a,f);
  189. if null a then b
  190. else if listtest(b,car a,f) or listtest(cdr a,car a,f) then
  191. cali!=min(b,cdr a,f)
  192. else cali!=min(car a . b,cdr a,f);
  193. % symbolic procedure makelist u; 'list . u;
  194. symbolic procedure subsetp(u,v);
  195. % true :<=> u \subset v
  196. if null u then t else member(car u,v) and subsetp(cdr u,v);
  197. symbolic procedure disjoint(a,b);
  198. if null a then t else not member(car a,b) and disjoint(cdr a,b);
  199. symbolic procedure print_lf u;
  200. % Line feed after about 70 characters.
  201. <<if posn()>69 then <<terpri();terpri()>>; prin2 u>>;
  202. symbolic procedure cali_choose(m,k);
  203. % Returns the list of k-subsets of m.
  204. if (length m < k) then nil
  205. else if k=1 then for each x in m collect list x
  206. else nconc(
  207. for each x in cali_choose(cdr m,k-1) collect (car m . x),
  208. cali_choose(cdr m,k));
  209. endmodule;
  210. end;