hggroeb.red 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. module hggroeb; % Homogeneous Graded Grobner bases.
  2. % Buchberger algorithm for homogeneous graded polynomial
  3. % systems. d1 and d2 are positive integers (d2 may be
  4. % infinity). Compute the basis for the sectin [d1,d2].
  5. %
  6. % see Becker-Weispfenning, Chapter 10.
  7. %
  8. % A local redefinition of the function groebspolynom is
  9. % used to exclude pairs which do not fit into the grade interval.
  10. fluid '(dd!-1!*, dd!-2!*);
  11. % imported fluids.
  12. symbolic procedure dd_groebner!* q;
  13. (begin scalar vars,w,np,oldorder,!*redefmsg;
  14. integer pcount!*;
  15. w := for each j in groerevlist u
  16. collect if eqexpr j then !*eqn2a j else j;
  17. vars := groebnervars(w,nil);
  18. if null vars then rerror(groebner,4,"empty system groebner");
  19. groedomainmode();
  20. oldorder := vdpinit vars;
  21. % cancel common denominators
  22. w := for each j in w collect f2vdp numr simp j;
  23. dd_homog!-check w;
  24. if not !*vdpInteger then
  25. <<np := t;
  26. for each p in w do
  27. np := if np then vdpcoeffcientsfromdomain!? p else nil;
  28. if not np then <<!*vdpmodular:= nil; !*vdpinteger := t>>;
  29. >>;
  30. if !*groebprot then <<groebprotfile := '(list)>>;
  31. w := dd!-bbg(w);
  32. if !*gltbasis then
  33. gltb :=
  34. 'list . for each base in w collect
  35. 'list . for each j in base collect
  36. vdp2a vdpfmon(a2vbc 1,vdpevlmon j);
  37. w := 'list . for each j in w collect vdp2a j;
  38. vdpcleanup();
  39. gvarslast := 'list . vars;
  40. return w
  41. end) where dd!-1!*=ieval car q,
  42. dd!-2!*=reval cadr q,
  43. u=reval caddr q;
  44. put('dd_groebner,'psopfn,'dd_groebner!*);
  45. put('dd_groebner,'number!-of!-args,3);
  46. symbolic procedure dd!-bbg w;
  47. begin scalar r;
  48. copyd('groebspolynom,'dd!-groebspolynom);
  49. r:=errorset({'groebner2,mkquote w,nil},t,nil);
  50. copyd('groebspolynom,'true!-groebspolynom);
  51. if errorp r then rederr "dd_groebner failed";
  52. return caar r end;
  53. symbolic procedure dd_homog!-check w;
  54. begin scalar d,q,tst,q;
  55. if not memq(dipsortmode!*,'(graded weighted gradlex revgradlex))
  56. then typerr(dipsortmode!*,"term order for dd_groebner");
  57. for each p in w do
  58. <<q:=p; p:=vdppoly p;
  59. d:=ev!-gamma(dipevlmon p); p:=dipmred p;
  60. while not dipzero!? p do
  61. <<tst:=tst or d neq ev!-gamma(dipevlmon p); p:=dipmred p>>;
  62. if tst then typerr(vdp2a q,"homogeneous polynomial");
  63. >> end ;
  64. copyd('true!-groebspolynom,'groebspolynom);
  65. symbolic procedure dd!-groebspolynom(p1,p2);
  66. (if (dd!-1!* <= d and (dd!-2!*='infinity or d <= dd!-2!*)) then
  67. true!-groebspolynom(p1,p2) else a2vdp 0)
  68. where d=ev!-gamma vevlcm(vdpevlmon p1, vdpevlmon p2);
  69. endmodule;;end;