groebcri.red 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. module groebcri;
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. %
  4. % Criteria for the Buchberger algorithm .
  5. %
  6. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7. smacro procedure atleast2elementsin u;
  8. % Test if u has at least a cadr element .
  9. u and cdr u;
  10. symbolic procedure groebbuchcrit4(p1,p2,e);
  11. % Buchberger criterion 4 . p1 and p2 are distributive
  12. % polynomials . e is the least common multiple of
  13. % the leading exponent vectors of the distributive
  14. % polynomials p1 and p2 . groebBuchcrit4(p1,p2,e)returns a
  15. % boolean expression . True,if the reduction of the
  16. % distributive polynomials p1 and p2 is necessary else false .
  17. % Orig:
  18. % e neq vevsum(vdpevlmon p1,vdpevlmon p2);
  19. << e;groebbuchcrit4t(vdpevlmon p1,vdpevlmon p2)>>;
  20. symbolic procedure groebbuchcrit4t(e1,e2);
  21. % Nonconstructive test of lcm(e1,e2)=e1 + e2;
  22. % equivalent: no matches of nonzero elements .
  23. if null e1 or null e2 then nil else
  24. if(car e1 neq 0)and(car e2 neq 0)then t
  25. else groebbuchcrit4t(cdr e1,cdr e2);
  26. symbolic procedure groebinvokecritbuch4(p,d2);
  27. % Buchberger's criterion 4 is tested on the pair p and the list
  28. % D2 of critical pairs is updated with respect to that crit .
  29. % Result is the updated D2 .
  30. begin scalar p1,p2,vev1,vev2,f1,f2,fd,b4;
  31. p1:=cadr p;p2:=caddr p;vev1:=vdpevlmon p1;vev2:=vdpevlmon p2;
  32. f1:=vdpgetprop(p1,'monfac);f2:=vdpgetprop(p2,'monfac);
  33. % Discard known common factors first .
  34. if f1 and f2 then
  35. << fd:=vevmin(f1,f2);
  36. b4:=groebbuchcrit4t(vevdif(vev1,fd), vevdif(vev2,fd));
  37. if b4 and % Is the body itself a common factor ?
  38. vevdif(vev1,f1)=vevdif(vev2,f2)
  39. % Test if the polys reduced by their monom .
  40. % factor are equal .
  41. and groebbuchcrit4compatible(p1,f1,p2,f2)
  42. then b4:=nil >>
  43. else b4:=groebbuchcrit4t(vev1,vev2);
  44. if b4 then d2:=append(d2,{p})else b4count!*:=b4count!* + 1;
  45. return d2 end;
  46. symbolic procedure groebbuchcrit4compatible(p1,f1,p2,f2);
  47. % p1,p2 polys,f1,f2 exponent vectors(monomials), which are known to
  48. % be factors of their f;
  49. % tests, if p1 / f1=p2 / f2 .
  50. if vdpzero!? p1 then vdpzero!? p2
  51. else if vdplbc p1=vdplbc p2 and
  52. groebbuchcrit4compatiblevev(vdpevlmon p1,f1,vdpevlmon p2,f2)
  53. then groebbuchcrit4compatible(vdpred p1,f1,vdpred p2,f2)
  54. else nil;
  55. symbolic procedure groebbuchcrit4compatiblevev(vev1,f1,vev2,f2);
  56. if null vev1 then null vev2 else
  57. if(if f1 then car vev1 - car f1 else car vev1)=
  58. (if f2 then car vev2 - car f2 else car vev2)then
  59. groebbuchcrit4compatiblevev(cdr vev1,
  60. if f1 then cdr f1 else nil,cdr vev2,
  61. if f2 then cdr f2 else nil)else nil;
  62. symbolic procedure groebinvokecritf d1;
  63. % GroebInvokeCritF tests a list D1 of critical pairs . It cancels all
  64. % critical pairs but one in D1 having the same lcm(i . e . car
  65. % component)as car(D1). This only one is chosen,if possible,
  66. % such that it doesn't satisfy groebBuchcrit4 .
  67. % Version: moeller upgraded 5.7.87 .
  68. begin scalar tp1,p2,active;
  69. tp1:=caar d1;active:=atleast2elementsin d1;
  70. while active do
  71. << p2:=cadr d1;
  72. if car p2=tp1 then
  73. << fcount!*:=fcount!* + 1;
  74. if not groebbuchcrit4t(cadr p2,caddr p2)then d1:=cdr d1
  75. else d1:=groedeletip(p2,d1);
  76. active:=atleast2elementsin d1 >>
  77. else active:=nil >>;
  78. return d1 end;
  79. symbolic procedure groebinvokecritm(p1,d1);
  80. % D1 is a list of critical pairs,p1 is a critical pair .
  81. % Crit M tests,if the lcm of p1 divides one of the lcm's in D1 .
  82. % If so,this object is eliminated .
  83. % Result is the updated D1 .
  84. << for each p3 in d1 do if buchvevdivides!?(car p1,car p3)then
  85. << mcount!*:=mcount!* + 1;
  86. d1:=groedeletip(p3,d1)>>; % Criterion M .
  87. d1 >>;
  88. symbolic procedure groebinvokecritb(fj,d);
  89. % D is a list of critical pairs,fj is a polynomial .
  90. % Crit B allows to eliminate a pair from D,if the leading monomial
  91. % of fj divides the lcm of the pair,but the lcm of fj with each of
  92. % the members of the pair is not the lcm of the pair itself .
  93. % Result is the updated D .
  94. << for each p in d do
  95. if buchvevdivides!?(vdpevlmon fj,car p)and
  96. tt(fj,cadr p)neq car p and % Criterion B .
  97. tt(fj,caddr p)neq car p then
  98. << bcount!*:=bcount!* +1;d:=delete(p,d)>>;d >>;
  99. endmodule;;end;