xcrit.red 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. module xcrit;
  2. % Critical pairs, critical values
  3. % Author: David Hartley
  4. Comment. Critical pairs are stored as
  5. crit_pr ::= {key, type, pf, pf}
  6. key ::= mon
  7. type ::= 'spoly_pair | 'wedge_pair | 'xcomm_pair
  8. endcomment;
  9. fluid '(xvarlist!* zerodivs!* xtruncate!* !*twosided);
  10. symbolic procedure critical_pairs(q,p,c);
  11. % q,p:list of pf, c:xset -> critical_pairs:xset
  12. % add critical pairs for new poly's q to existing xset c,
  13. % which is based on old poly's p.
  14. begin scalar f;
  15. foreach l on q do
  16. begin
  17. f := car l;
  18. foreach g in cdr l do
  19. (if pr then add_item(pr,c)) where pr = make_spoly_pair(f,g);
  20. foreach g in p do
  21. (if pr then add_item(pr,c)) where pr = make_spoly_pair(f,g);
  22. foreach x in zerodivs!* do
  23. (if pr then add_item(pr,c)) where pr = make_wedge_pair(x,f);
  24. foreach x in if !*twosided then xvarlist!* do
  25. (if pr then add_item(pr,c)) where pr = make_xcomm_pair(x,f);
  26. end;
  27. return c;
  28. end;
  29. symbolic procedure remove_critical_pairs(G,P);
  30. % G:list of pf, P:xset -> remove_critical_pairs:xset
  31. % Remove critical pairs for old poly's G from existing xset P.
  32. <<if G then remove_items(P,G); P>>;
  33. symbolic procedure make_spoly_pair(f,g);
  34. % f,g:pf -> make_spoly_pair:crit_pr|nil
  35. % construct critical pair (spoly) for f and g in canonical order
  36. % return nil if simple criteria fail
  37. if pfordp(g,f) then make_spoly_pair(g,f) else
  38. and(t,
  39. red f or red g,
  40. not triviallcm(l,xval f,xval g),
  41. not xdegreecheck mknwedge l,
  42. {l,'spoly_pair,f,g})
  43. where l = xlcm(xval f,xval g);
  44. symbolic procedure triviallcm(l,p,q);
  45. % l,p,q:mon -> triviallcm:bool
  46. % l is xlcm(p,q), result is t if l = p . q
  47. xdiv(p,l) = q;
  48. symbolic procedure xdegreecheck u;
  49. % u:lpow pf -> xdegreecheck:bool
  50. % result is t if degree of u exceeds truncation
  51. % degree in graded GB's
  52. xtruncate!* and xdegree u > xtruncate!*;
  53. symbolic procedure make_wedge_pair(x,f);
  54. % x:kernel, f:pf -> make_wedge_pair:crit_pr|nil
  55. % construct critical pair (wedge) for x and f
  56. % return nil if simple criteria fail
  57. and(!*twosided and not xtruncate!* or x memq xval f,
  58. not overall_factor(x,f),
  59. not xdegreecheck mknwedge l,
  60. {l,'wedge_pair,!*k2pf x,f})
  61. where l = xlcm({x,x},xval f);
  62. symbolic procedure overall_factor(x,f);
  63. % x:kernel,f:pf -> overall_factor:bool
  64. null f or x memq xval f and overall_factor(x,red f);
  65. symbolic procedure make_xcomm_pair(x,f);
  66. % x:kernel, f:pf -> make_xcomm_pair:crit_pr|nil
  67. % construct critical pair (commutator) for x and f
  68. % return nil if simple criteria fail
  69. and(!*twosided,
  70. not xtruncate!*, % left ideal = right ideal if homogeneous.
  71. {xval f,'xcomm_pair,!*k2pf x,f});
  72. symbolic procedure critical_element pr;
  73. % pr:crit_pr -> critical_element:pf
  74. % calculate a critical element for pr
  75. apply1(pr_type pr,pr);
  76. symbolic procedure spoly_pair pr;
  77. % pr:crit_pr -> spoly_pair:pf
  78. % calculate a critical element for pr
  79. begin scalar l,f,g;
  80. f := pr_lhs pr; g := pr_rhs pr;
  81. l := xkey pr;
  82. f := wedgepf(!*k2pf mknwedge xdiv(xval f,l),f); % left multiplication
  83. g := wedgepf(!*k2pf mknwedge xdiv(xval g,l),g); % left multiplication
  84. return addpf(multpfsq(f,lc g),negpf multpfsq(g,lc f)); % normalise?
  85. end;
  86. symbolic procedure wedge_pair pr;
  87. % pr:crit_pr -> wedge_pair:pf
  88. % calculate a critical element for pr
  89. if !*twosided and not xdiv(xval pr_lhs pr,xval pr_rhs pr) then
  90. wedgepf(wedgepf(pr_lhs pr,pr_rhs pr),pr_lhs pr) % split cofactor
  91. else wedgepf(pr_lhs pr,pr_rhs pr);
  92. symbolic procedure xcomm_pair pr;
  93. % pr:crit_pr -> xcomm_pair:pf
  94. % calculate a critical element for pr
  95. addpf(wedgepf(pr_lhs pr,pr_rhs pr),
  96. if evenp xdegreemon xval pr_rhs pr
  97. then wedgepf(pr_rhs pr,negpf pr_lhs pr)
  98. else wedgepf(pr_rhs pr,pr_lhs pr));
  99. endmodule;
  100. end;