close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

source: branches/f4grobner/polynomial.lisp@ 3014

Last change on this file since 3014 was 3014, checked in by Marek Rychlik, 9 years ago

* empty log message *

File size: 18.5 KB
RevLine 
[1201]1;;; -*- Mode: Lisp -*-
[77]2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3;;;
4;;; Copyright (C) 1999, 2002, 2009, 2015 Marek Rychlik <rychlik@u.arizona.edu>
5;;;
6;;; This program is free software; you can redistribute it and/or modify
7;;; it under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 2 of the License, or
9;;; (at your option) any later version.
10;;;
11;;; This program is distributed in the hope that it will be useful,
12;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with this program; if not, write to the Free Software
18;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19;;;
20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21
[431]22(defpackage "POLYNOMIAL"
[2462]23 (:use :cl :ring :monom :order :term #| :infix |# )
[2596]24 (:export "POLY"
25 "POLY-TERMLIST"
26 "POLY-TERM-ORDER")
[2522]27 (:documentation "Implements polynomials"))
[143]28
[431]29(in-package :polynomial)
30
[1927]31(proclaim '(optimize (speed 3) (space 0) (safety 0) (debug 0)))
[52]32
[2442]33(defclass poly ()
[2697]34 ((termlist :initarg :termlist :accessor poly-termlist
35 :documentation "List of terms.")
36 (order :initarg :order :accessor poly-term-order
37 :documentation "Monomial/term order."))
[2695]38 (:default-initargs :termlist nil :order #'lex>)
39 (:documentation "A polynomial with a list of terms TERMLIST, ordered
[2696]40according to term order ORDER, which defaults to LEX>."))
[2442]41
[2471]42(defmethod print-object ((self poly) stream)
[2600]43 (format stream "#<POLY TERMLIST=~A ORDER=~A>"
[2595]44 (poly-termlist self)
45 (poly-term-order self)))
[2469]46
[3010]47(defgeneric change-order (self other)
[3012]48 (:documentation "Change term order of SELF to the term order of OTHER.")
[3010]49 (:method ((self poly) (other poly))
50 (unless (eq (poly-term-order self) (poly-term-order other))
51 (setf (poly-termlist self) (sort (poly-termlist self) (poly-term-order other))
52 (poly-term-order self) (poly-term-order other)))
[3012]53 self))
[3010]54
[2650]55(defmethod r-equalp ((self poly) (other poly))
[2680]56 "POLY instances are R-EQUALP if they have the same
57order and if all terms are R-EQUALP."
[2651]58 (and (every #'r-equalp (poly-termlist self) (poly-termlist other))
59 (eq (poly-term-order self) (poly-term-order other))))
[2650]60
[2513]61(defmethod insert-item ((self poly) (item term))
62 (push item (poly-termlist self))
[2514]63 self)
[2464]64
[2513]65(defmethod append-item ((self poly) (item term))
66 (setf (cdr (last (poly-termlist self))) (list item))
67 self)
[2466]68
[52]69;; Leading term
[2442]70(defgeneric leading-term (object)
71 (:method ((self poly))
[2525]72 (car (poly-termlist self)))
73 (:documentation "The leading term of a polynomial, or NIL for zero polynomial."))
[52]74
75;; Second term
[2442]76(defgeneric second-leading-term (object)
77 (:method ((self poly))
[2525]78 (cadar (poly-termlist self)))
79 (:documentation "The second leading term of a polynomial, or NIL for a polynomial with at most one term."))
[52]80
81;; Leading coefficient
[2442]82(defgeneric leading-coefficient (object)
83 (:method ((self poly))
[2526]84 (r-coeff (leading-term self)))
[2545]85 (:documentation "The leading coefficient of a polynomial. It signals error for a zero polynomial."))
[52]86
87;; Second coefficient
[2442]88(defgeneric second-leading-coefficient (object)
89 (:method ((self poly))
[2526]90 (r-coeff (second-leading-term self)))
[2906]91 (:documentation "The second leading coefficient of a polynomial. It
92 signals error for a polynomial with at most one term."))
[52]93
94;; Testing for a zero polynomial
[2445]95(defmethod r-zerop ((self poly))
96 (null (poly-termlist self)))
[52]97
98;; The number of terms
[2445]99(defmethod r-length ((self poly))
100 (length (poly-termlist self)))
[52]101
[2483]102(defmethod multiply-by ((self poly) (other monom))
[2501]103 (mapc #'(lambda (term) (multiply-by term other))
104 (poly-termlist self))
[2483]105 self)
[2469]106
[2501]107(defmethod multiply-by ((self poly) (other scalar))
[2502]108 (mapc #'(lambda (term) (multiply-by term other))
[2501]109 (poly-termlist self))
[2487]110 self)
111
[2607]112
[2761]113(defmacro fast-add/subtract (p q order-fn add/subtract-fn uminus-fn)
[2755]114 "Return an expression which will efficiently adds/subtracts two
115polynomials, P and Q. The addition/subtraction of coefficients is
116performed by calling ADD/SUBTRACT-METHOD-NAME. If UMINUS-METHOD-NAME
117is supplied, it is used to negate the coefficients of Q which do not
[2756]118have a corresponding coefficient in P. The code implements an
119efficient algorithm to add two polynomials represented as sorted lists
120of terms. The code destroys both arguments, reusing the terms to build
121the result."
[2742]122 `(macrolet ((lc (x) `(r-coeff (car ,x))))
123 (do ((p ,p)
124 (q ,q)
125 r)
126 ((or (endp p) (endp q))
127 ;; NOTE: R contains the result in reverse order. Can it
128 ;; be more efficient to produce the terms in correct order?
[2774]129 (unless (endp q)
[2776]130 ;; Upon subtraction, we must change the sign of
131 ;; all coefficients in q
[2774]132 ,@(when uminus-fn
[2775]133 `((mapc #'(lambda (x) (setf x (funcall ,uminus-fn x))) q)))
[2774]134 (setf r (nreconc r q)))
[2742]135 r)
136 (multiple-value-bind
137 (greater-p equal-p)
[2766]138 (funcall ,order-fn (car p) (car q))
[2742]139 (cond
140 (greater-p
141 (rotatef (cdr p) r p)
142 )
143 (equal-p
[2766]144 (let ((s (funcall ,add/subtract-fn (lc p) (lc q))))
[2742]145 (cond
146 ((r-zerop s)
147 (setf p (cdr p))
148 )
149 (t
150 (setf (lc p) s)
151 (rotatef (cdr p) r p))))
152 (setf q (cdr q))
153 )
154 (t
[2743]155 ;;Negate the term of Q if UMINUS provided, signallig
156 ;;that we are doing subtraction
[2908]157 ,(when uminus-fn
158 `(setf (lc q) (funcall ,uminus-fn (lc q))))
[2743]159 (rotatef (cdr q) r q)))))))
[2585]160
[2655]161
[2763]162(defmacro def-add/subtract-method (add/subtract-method-name
[2752]163 uminus-method-name
164 &optional
[2913]165 (doc-string nil doc-string-supplied-p))
[2615]166 "This macro avoids code duplication for two similar operations: ADD-TO and SUBTRACT-FROM."
[2749]167 `(defmethod ,add/subtract-method-name ((self poly) (other poly))
[2615]168 ,@(when doc-string-supplied-p `(,doc-string))
[2769]169 ;; Ensure orders are compatible
[3013]170 (change-order other self)
[2772]171 (setf (poly-termlist self) (fast-add/subtract
172 (poly-termlist self) (poly-termlist other)
173 (poly-term-order self)
174 #',add/subtract-method-name
175 ,(when uminus-method-name `(function ,uminus-method-name))))
[2609]176 self))
[2487]177
[2916]178(eval-when (:compile-toplevel :load-toplevel :execute)
[2777]179
180 (def-add/subtract-method add-to nil
181 "Adds to polynomial SELF another polynomial OTHER.
[2610]182This operation destructively modifies both polynomials.
183The result is stored in SELF. This implementation does
[2752]184no consing, entirely reusing the sells of SELF and OTHER.")
[2609]185
[2777]186 (def-add/subtract-method subtract-from unary-minus
[2753]187 "Subtracts from polynomial SELF another polynomial OTHER.
[2610]188This operation destructively modifies both polynomials.
189The result is stored in SELF. This implementation does
[2752]190no consing, entirely reusing the sells of SELF and OTHER.")
[2610]191
[2916]192 )
[2777]193
[2916]194
195
[2691]196(defmethod unary-minus ((self poly))
[2694]197 "Destructively modifies the coefficients of the polynomial SELF,
198by changing their sign."
[2692]199 (mapc #'unary-minus (poly-termlist self))
[2683]200 self)
[52]201
[2795]202(defun add-termlists (p q order-fn)
[2794]203 "Destructively adds two termlists P and Q ordered according to ORDER-FN."
[2917]204 (fast-add/subtract p q order-fn #'add-to nil))
[2794]205
[2800]206(defmacro multiply-term-by-termlist-dropping-zeros (term termlist
[2927]207 &optional (reverse-arg-order-P nil))
[2799]208 "Multiplies term TERM by a list of term, TERMLIST.
[2792]209Takes into accound divisors of zero in the ring, by
[2927]210deleting zero terms. Optionally, if REVERSE-ARG-ORDER-P
[2928]211is T, change the order of arguments; this may be important
[2927]212if we extend the package to non-commutative rings."
[2800]213 `(mapcan #'(lambda (other-term)
[2907]214 (let ((prod (r*
[2923]215 ,@(cond
[2930]216 (reverse-arg-order-p
[2925]217 `(other-term ,term))
218 (t
219 `(,term other-term))))))
[2800]220 (cond
221 ((r-zerop prod) nil)
222 (t (list prod)))))
223 ,termlist))
[2790]224
[2796]225(defun multiply-termlists (p q order-fn)
[2787]226 (cond
[2917]227 ((or (endp p) (endp q))
228 ;;p or q is 0 (represented by NIL)
229 nil)
[2789]230 ;; If p= p0+p1 and q=q0+q1 then p*q=p0*q0+p0*q1+p1*q
[2787]231 ((endp (cdr p))
[2918]232 (multiply-term-by-termlist-dropping-zeros (car p) q))
233 ((endp (cdr q))
[2919]234 (multiply-term-by-termlist-dropping-zeros (car q) p t))
235 (t
[2948]236 (cons (r* (car p) (car q))
[2949]237 (add-termlists
238 (multiply-term-by-termlist-dropping-zeros (car p) (cdr q))
239 (multiply-termlists (cdr p) q order-fn)
240 order-fn)))))
[2793]241
[2802]242
[2917]243
[2803]244(defmethod multiply-by ((self poly) (other poly))
[3014]245 (change-term-order other self)
[2803]246 (setf (poly-termlist self) (multiply-termlists (poly-termlist self)
247 (poly-termlist other)
248 (poly-term-order self)))
249 self)
250
[2939]251(defmethod r* ((poly1 poly) (poly2 poly))
252 "Non-destructively multiply POLY1 by POLY2."
253 (multiply-by (copy-instance POLY1) (copy-instance POLY2)))
[2916]254
[2785]255#|
256
[2916]257
[52]258(defun poly-standard-extension (plist &aux (k (length plist)))
[2716]259 "Calculate [U1*P1,U2*P2,...,UK*PK], where PLIST=[P1,P2,...,PK]
260is a list of polynomials."
[52]261 (declare (list plist) (fixnum k))
262 (labels ((incf-power (g i)
263 (dolist (x (poly-termlist g))
264 (incf (monom-elt (term-monom x) i)))
265 (incf (poly-sugar g))))
266 (setf plist (poly-list-add-variables plist k))
267 (dotimes (i k plist)
268 (incf-power (nth i plist) i))))
269
[2716]270
[2785]271
[1473]272(defun saturation-extension (ring f plist
273 &aux
274 (k (length plist))
[1474]275 (d (monom-dimension (poly-lm (car plist))))
276 f-x plist-x)
[52]277 "Calculate [F, U1*P1-1,U2*P2-1,...,UK*PK-1], where PLIST=[P1,P2,...,PK]."
[1907]278 (declare (type ring ring))
[1474]279 (setf f-x (poly-list-add-variables f k)
280 plist-x (mapcar #'(lambda (x)
[1843]281 (setf (poly-termlist x)
282 (nconc (poly-termlist x)
283 (list (make-term :monom (make-monom :dimension d)
[1844]284 :coeff (funcall (ring-uminus ring)
285 (funcall (ring-unit ring)))))))
[1474]286 x)
287 (poly-standard-extension plist)))
288 (append f-x plist-x))
[52]289
290
[1475]291(defun polysaturation-extension (ring f plist
292 &aux
293 (k (length plist))
[1476]294 (d (+ k (monom-dimension (poly-lm (car plist)))))
[1494]295 ;; Add k variables to f
[1493]296 (f (poly-list-add-variables f k))
[1495]297 ;; Set PLIST to [U1*P1,U2*P2,...,UK*PK]
[1493]298 (plist (apply #'poly-append (poly-standard-extension plist))))
[1497]299 "Calculate [F, U1*P1+U2*P2+...+UK*PK-1], where PLIST=[P1,P2,...,PK]. It destructively modifies F."
[1493]300 ;; Add -1 as the last term
[1908]301 (declare (type ring ring))
[1493]302 (setf (cdr (last (poly-termlist plist)))
[1845]303 (list (make-term :monom (make-monom :dimension d)
304 :coeff (funcall (ring-uminus ring) (funcall (ring-unit ring))))))
[1493]305 (append f (list plist)))
[52]306
[1477]307(defun saturation-extension-1 (ring f p)
[1497]308 "Calculate [F, U*P-1]. It destructively modifies F."
[1908]309 (declare (type ring ring))
[1477]310 (polysaturation-extension ring f (list p)))
[53]311
312;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
313;;
314;; Evaluation of polynomial (prefix) expressions
315;;
316;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
317
318(defun coerce-coeff (ring expr vars)
319 "Coerce an element of the coefficient ring to a constant polynomial."
320 ;; Modular arithmetic handler by rat
[1908]321 (declare (type ring ring))
[1846]322 (make-poly-from-termlist (list (make-term :monom (make-monom :dimension (length vars))
323 :coeff (funcall (ring-parse ring) expr)))
[53]324 0))
325
[1046]326(defun poly-eval (expr vars
327 &optional
[1668]328 (ring +ring-of-integers+)
[1048]329 (order #'lex>)
[1170]330 (list-marker :[)
[1047]331 &aux
332 (ring-and-order (make-ring-and-order :ring ring :order order)))
[1168]333 "Evaluate Lisp form EXPR to a polynomial or a list of polynomials in
[1208]334variables VARS. Return the resulting polynomial or list of
335polynomials. Standard arithmetical operators in form EXPR are
336replaced with their analogues in the ring of polynomials, and the
337resulting expression is evaluated, resulting in a polynomial or a list
[1209]338of polynomials in internal form. A similar operation in another computer
339algebra system could be called 'expand' or so."
[1909]340 (declare (type ring ring))
[1050]341 (labels ((p-eval (arg) (poly-eval arg vars ring order))
[1140]342 (p-eval-scalar (arg) (poly-eval-scalar arg))
[53]343 (p-eval-list (args) (mapcar #'p-eval args))
[989]344 (p-add (x y) (poly-add ring-and-order x y)))
[53]345 (cond
[1128]346 ((null expr) (error "Empty expression"))
[53]347 ((eql expr 0) (make-poly-zero))
348 ((member expr vars :test #'equalp)
349 (let ((pos (position expr vars :test #'equalp)))
[1657]350 (make-poly-variable ring (length vars) pos)))
[53]351 ((atom expr)
352 (coerce-coeff ring expr vars))
353 ((eq (car expr) list-marker)
354 (cons list-marker (p-eval-list (cdr expr))))
355 (t
356 (case (car expr)
357 (+ (reduce #'p-add (p-eval-list (cdr expr))))
358 (- (case (length expr)
359 (1 (make-poly-zero))
360 (2 (poly-uminus ring (p-eval (cadr expr))))
[989]361 (3 (poly-sub ring-and-order (p-eval (cadr expr)) (p-eval (caddr expr))))
362 (otherwise (poly-sub ring-and-order (p-eval (cadr expr))
[53]363 (reduce #'p-add (p-eval-list (cddr expr)))))))
364 (*
365 (if (endp (cddr expr)) ;unary
366 (p-eval (cdr expr))
[989]367 (reduce #'(lambda (p q) (poly-mul ring-and-order p q)) (p-eval-list (cdr expr)))))
[1106]368 (/
369 ;; A polynomial can be divided by a scalar
[1115]370 (cond
371 ((endp (cddr expr))
[1117]372 ;; A special case (/ ?), the inverse
[1119]373 (coerce-coeff ring (apply (ring-div ring) (cdr expr)) vars))
[1128]374 (t
[1115]375 (let ((num (p-eval (cadr expr)))
[1142]376 (denom-inverse (apply (ring-div ring)
377 (cons (funcall (ring-unit ring))
378 (mapcar #'p-eval-scalar (cddr expr))))))
[1118]379 (scalar-times-poly ring denom-inverse num)))))
[53]380 (expt
381 (cond
382 ((member (cadr expr) vars :test #'equalp)
383 ;;Special handling of (expt var pow)
384 (let ((pos (position (cadr expr) vars :test #'equalp)))
[1657]385 (make-poly-variable ring (length vars) pos (caddr expr))))
[53]386 ((not (and (integerp (caddr expr)) (plusp (caddr expr))))
387 ;; Negative power means division in coefficient ring
388 ;; Non-integer power means non-polynomial coefficient
389 (coerce-coeff ring expr vars))
[989]390 (t (poly-expt ring-and-order (p-eval (cadr expr)) (caddr expr)))))
[53]391 (otherwise
392 (coerce-coeff ring expr vars)))))))
393
[1133]394(defun poly-eval-scalar (expr
395 &optional
[1668]396 (ring +ring-of-integers+)
[1133]397 &aux
398 (order #'lex>))
399 "Evaluate a scalar expression EXPR in ring RING."
[1910]400 (declare (type ring ring))
[1133]401 (poly-lc (poly-eval expr nil ring order)))
402
[1189]403(defun spoly (ring-and-order f g
404 &aux
405 (ring (ro-ring ring-and-order)))
[55]406 "It yields the S-polynomial of polynomials F and G."
[1911]407 (declare (type ring-and-order ring-and-order) (type poly f g))
[55]408 (let* ((lcm (monom-lcm (poly-lm f) (poly-lm g)))
[2913]409 (mf (monom-div lcm (poly-lm f)))
410 (mg (monom-div lcm (poly-lm g))))
[55]411 (declare (type monom mf mg))
412 (multiple-value-bind (c cf cg)
413 (funcall (ring-ezgcd ring) (poly-lc f) (poly-lc g))
414 (declare (ignore c))
415 (poly-sub
[1189]416 ring-and-order
[55]417 (scalar-times-poly ring cg (monom-times-poly mf f))
418 (scalar-times-poly ring cf (monom-times-poly mg g))))))
[53]419
420
[55]421(defun poly-primitive-part (ring p)
422 "Divide polynomial P with integer coefficients by gcd of its
423coefficients and return the result."
[1912]424 (declare (type ring ring) (type poly p))
[55]425 (if (poly-zerop p)
426 (values p 1)
[2913]427 (let ((c (poly-content ring p)))
428 (values (make-poly-from-termlist
429 (mapcar
430 #'(lambda (x)
431 (make-term :monom (term-monom x)
432 :coeff (funcall (ring-div ring) (term-coeff x) c)))
433 (poly-termlist p))
434 (poly-sugar p))
435 c))))
[55]436
437(defun poly-content (ring p)
438 "Greatest common divisor of the coefficients of the polynomial P. Use the RING structure
439to compute the greatest common divisor."
[1913]440 (declare (type ring ring) (type poly p))
[55]441 (reduce (ring-gcd ring) (mapcar #'term-coeff (rest (poly-termlist p))) :initial-value (poly-lc p)))
[1066]442
[1091]443(defun read-infix-form (&key (stream t))
[1066]444 "Parser of infix expressions with integer/rational coefficients
445The parser will recognize two kinds of polynomial expressions:
446
447- polynomials in fully expanded forms with coefficients
448 written in front of symbolic expressions; constants can be optionally
449 enclosed in (); for example, the infix form
450 X^2-Y^2+(-4/3)*U^2*W^3-5
451 parses to
452 (+ (- (EXPT X 2) (EXPT Y 2)) (* (- (/ 4 3)) (EXPT U 2) (EXPT W 3)) (- 5))
453
454- lists of polynomials; for example
455 [X-Y, X^2+3*Z]
456 parses to
457 (:[ (- X Y) (+ (EXPT X 2) (* 3 Z)))
458 where the first symbol [ marks a list of polynomials.
459
460-other infix expressions, for example
461 [(X-Y)*(X+Y)/Z,(X+1)^2]
462parses to:
463 (:[ (/ (* (- X Y) (+ X Y)) Z) (EXPT (+ X 1) 2))
464Currently this function is implemented using M. Kantrowitz's INFIX package."
465 (read-from-string
466 (concatenate 'string
[2913]467 "#I("
468 (with-output-to-string (s)
469 (loop
470 (multiple-value-bind (line eof)
471 (read-line stream t)
472 (format s "~A" line)
473 (when eof (return)))))
474 ")")))
475
[1145]476(defun read-poly (vars &key
477 (stream t)
[1668]478 (ring +ring-of-integers+)
[1145]479 (order #'lex>))
[1067]480 "Reads an expression in prefix form from a stream STREAM.
[1144]481The expression read from the strem should represent a polynomial or a
482list of polynomials in variables VARS, over the ring RING. The
483polynomial or list of polynomials is returned, with terms in each
484polynomial ordered according to monomial order ORDER."
[1146]485 (poly-eval (read-infix-form :stream stream) vars ring order))
[1092]486
[1146]487(defun string->poly (str vars
[1164]488 &optional
[1668]489 (ring +ring-of-integers+)
[1146]490 (order #'lex>))
491 "Converts a string STR to a polynomial in variables VARS."
[1097]492 (with-input-from-string (s str)
[1165]493 (read-poly vars :stream s :ring ring :order order)))
[1095]494
[1143]495(defun poly->alist (p)
496 "Convert a polynomial P to an association list. Thus, the format of the
497returned value is ((MONOM[0] . COEFF[0]) (MONOM[1] . COEFF[1]) ...), where
498MONOM[I] is a list of exponents in the monomial and COEFF[I] is the
499corresponding coefficient in the ring."
[1171]500 (cond
501 ((poly-p p)
502 (mapcar #'term->cons (poly-termlist p)))
503 ((and (consp p) (eq (car p) :[))
[1172]504 (cons :[ (mapcar #'poly->alist (cdr p))))))
[1143]505
[1164]506(defun string->alist (str vars
[2913]507 &optional
508 (ring +ring-of-integers+)
509 (order #'lex>))
[1143]510 "Convert a string STR representing a polynomial or polynomial list to
[1158]511an association list (... (MONOM . COEFF) ...)."
[1166]512 (poly->alist (string->poly str vars ring order)))
[1440]513
514(defun poly-equal-no-sugar-p (p q)
515 "Compare polynomials for equality, ignoring sugar."
[1914]516 (declare (type poly p q))
[1440]517 (equalp (poly-termlist p) (poly-termlist q)))
[1559]518
519(defun poly-set-equal-no-sugar-p (p q)
520 "Compare polynomial sets P and Q for equality, ignoring sugar."
521 (null (set-exclusive-or p q :test #'poly-equal-no-sugar-p )))
[1560]522
523(defun poly-list-equal-no-sugar-p (p q)
524 "Compare polynomial lists P and Q for equality, ignoring sugar."
525 (every #'poly-equal-no-sugar-p p q))
[2456]526|#
Note: See TracBrowser for help on using the repository browser.