kernel.red 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. module kernel; % Functions for operations on kernels.
  2. % Author: Anthony C. Hearn.
  3. % Copyright (c) 1990 The RAND Corporation. All rights reserved.
  4. global '(exlist!* kprops!*);
  5. symbolic procedure fkern u;
  6. % Finds the unique "p-list" reference to the kernel U. The choice of
  7. % the search and merge used here has a strong influence on some
  8. % timings. The ordered list used here is also used by prepsq* to
  9. % order factors in printed output, so cannot be unilaterally changed.
  10. begin scalar x,y;
  11. if atom u then return list(u,nil)
  12. else if x := get(car u,'fkernfn) then return apply1(x,u);
  13. y := if atom car u then get(car u,'klist) else exlist!*;
  14. if not (x := assoc(u,y))
  15. then <<x := list(u,nil);
  16. y := ordad(x,y);
  17. if atom car u
  18. then <<kprops!* := union(list car u,kprops!*);
  19. put(car u,'klist,y)>>
  20. else exlist!* := y>>;
  21. return x
  22. end;
  23. symbolic procedure kernels u;
  24. % Returns list of kernels in standard form u.
  25. kernels1(u,nil);
  26. symbolic procedure kernels1(u,v);
  27. % We append to end of list to put kernels in the right order, even
  28. % though a cons on the front of the list would be faster.
  29. if domainp u then v
  30. else kernels1(lc u,
  31. kernels1(red u,
  32. if x memq v then v else append(v,list x)))
  33. where x=mvar u;
  34. symbolic procedure kernp u;
  35. % True if U is standard quotient representation for a kernel.
  36. denr u=1 and not domainp(u := numr u)
  37. and null red u and lc u=1 and ldeg u=1; % onep
  38. endmodule;
  39. end;