jmbr / cl-buchberger

Buchberger's algorithm in Common Lisp. Moved to https://git.sr.ht/~jmbr/cl-buchberger

Home Page:https://git.sr.ht/~jmbr/cl-buchberger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

member-p function fails

davazp opened this issue · comments

If we eval the following chunk of code in the cl-buchberger package:

(defvar f (make-polynomial '((1 1 0))))    ;  f = x
(defvar g (make-polynomial '((1 1 0) (1 0 1))))  ;  g = x+y
(defvar i (make-ideal (list f g)))
(member-p (ring* g g) i)

a simple-error is signaled:

There is no applicable method for the generic function
  #<STANDARD-GENERIC-FUNCTION RING-ZERO-P (2)>
when called with arguments
  (#(#<POLYNOMIAL x> #<POLYNOMIAL x+y>)).
   [Condition of type SIMPLE-ERROR]

In fact, though I patched this little bug, the member-p function assumes the generators of ideal are a Groebner basis since the last form evals to nil. So, I think it would fine to normalize ideals computing the Groebner basis when the ideal is initialized.

Thank you for noticing this. I'll fix it ASAP.