
(/VERSIONCHECK 2) 

(DEFUN |PR;One;$;1| ($)
  (LIST (CONS (|spadConstant| $ 10) (|spadConstant| $ 11)))) 

(DEFUN |PR;characteristic;Nni;2| ($) (SPADCALL (QREFELT $ 14))) 

(PUT '|PR;numberOfMonomials;$Nni;3| '|SPADreplace| 'LENGTH) 

(DEFUN |PR;numberOfMonomials;$Nni;3| (|x| $) (LENGTH |x|)) 

(DEFUN |PR;degree;$E;4| (|p| $)
  (COND
    ((NULL |p|) (|spadConstant| $ 10))
    ('T (QCAR (|SPADfirst| |p|))))) 

(DEFUN |PR;minimumDegree;$E;5| (|p| $)
  (COND
    ((NULL |p|) (|spadConstant| $ 10))
    ('T (QCAR (SPADCALL |p| (QREFELT $ 18)))))) 

(DEFUN |PR;leadingCoefficient;$R;6| (|p| $)
  (COND
    ((NULL |p|) (|spadConstant| $ 20))
    ('T (QCDR (|SPADfirst| |p|))))) 

(DEFUN |PR;leadingMonomial;2$;7| (|p| $)
  (COND
    ((NULL |p|) (|spadConstant| $ 22))
    ('T (LIST (|SPADfirst| |p|))))) 

(DEFUN |PR;reductum;2$;8| (|p| $)
  (COND ((NULL |p|) |p|) ('T (CDR |p|)))) 

(DEFUN |PR;retractIfCan;$U;9| (|p| $)
  (COND
    ((NULL |p|) (CONS 0 (|spadConstant| $ 20)))
    ((NULL (NULL (CDR |p|))) (CONS 1 "failed"))
    ('T
     (COND
       ((SPADCALL (QCAR (|SPADfirst| |p|)) (QREFELT $ 26))
        (CONS 0 (QCDR (|SPADfirst| |p|))))
       ('T (CONS 1 "failed")))))) 

(DEFUN |PR;coefficient;$ER;10| (|p| |e| $)
  (PROG (|tm| #0=#:G1874 #1=#:G1873 #2=#:G1869)
    (RETURN
      (SEQ (EXIT (SEQ (SEQ (LETT |tm| NIL
                                 . #3=(|PR;coefficient;$ER;10|))
                           (LETT #0# |p| . #3#) G190
                           (COND
                             ((OR (ATOM #0#)
                                  (PROGN
                                    (LETT |tm| (CAR #0#) . #3#)
                                    NIL))
                              (GO G191)))
                           (SEQ (EXIT (COND
                                        ((SPADCALL (QCAR |tm|) |e|
                                          (QREFELT $ 29))
                                         (PROGN
                                           (LETT #1# (QCDR |tm|) . #3#)
                                           (GO #1#)))
                                        ('T
                                         (SEQ
                                          (EXIT
                                           (COND
                                             ((SPADCALL (QCAR |tm|) |e|
                                               (QREFELT $ 30))
                                              (PROGN
                                                (LETT #2#
                                                 (PROGN
                                                   (LETT #1#
                                                    (|spadConstant| $
                                                     20) . #3#)
                                                   (GO #1#)) . #3#)
                                                (GO #2#)))))
                                          #2# (EXIT #2#))))))
                           (LETT #0# (CDR #0#) . #3#) (GO G190) G191
                           (EXIT NIL))
                      (EXIT (|spadConstant| $ 20))))
           #1# (EXIT #1#))))) 

(DEFUN |PR;recip;$U;11| (|p| $)
  (PROG (|u|)
    (RETURN
      (SEQ (COND
             ((OR (NULL |p|)
                  (SPADCALL (|spadConstant| $ 10)
                            (QCAR (|SPADfirst| |p|)) (QREFELT $ 30)))
              (CONS 1 "failed"))
             ('T
              (SEQ (LETT |u|
                         (SPADCALL (QCDR (|SPADfirst| |p|))
                             (QREFELT $ 33))
                         |PR;recip;$U;11|)
                   (EXIT (COND
                           ((QEQCAR |u| 1) (CONS 1 "failed"))
                           ('T
                            (CONS 0
                                  (SPADCALL (QCDR |u|) (QREFELT $ 34))))))))))))) 

(DEFUN |PR;coerce;R$;12| (|r| $)
  (COND
    ((SPADCALL |r| (QREFELT $ 36)) (|spadConstant| $ 22))
    ('T (LIST (CONS (|spadConstant| $ 10) |r|))))) 

(DEFUN |PR;coerce;I$;13| (|n| $)
  (SPADCALL (SPADCALL |n| (QREFELT $ 38)) (QREFELT $ 34))) 

(DEFUN |PR;ground?;$B;14| (|p| $)
  (COND
    ((NULL |p|) 'T)
    ((NULL (CDR |p|))
     (SPADCALL (SPADCALL |p| (QREFELT $ 17)) (QREFELT $ 26)))
    ('T 'NIL))) 

(PUT '|PR;qsetrest!| '|SPADreplace| 'RPLACD) 

(DEFUN |PR;qsetrest!| (|l| |e| $) (RPLACD |l| |e|)) 

(DEFUN |PR;times!| (|r| |x| $)
  (PROG (#0=#:G1904 |tx| |newend| |xx| |res| |endcell|)
    (RETURN
      (SEQ (COND
             ((QREFELT $ 41)
              (SEQ (LETT |tx| NIL . #1=(|PR;times!|))
                   (LETT #0# |x| . #1#) G190
                   (COND
                     ((OR (ATOM #0#)
                          (PROGN (LETT |tx| (CAR #0#) . #1#) NIL))
                      #2=(GO G191)))
                   (SEQ (EXIT (PROGN
                                (RPLACD |tx|
                                        (SPADCALL |r| (QCDR |tx|)
                                         (QREFELT $ 42)))
                                (QCDR |tx|))))
                   (LETT #0# (CDR #0#) . #1#) #3=(GO G190) G191
                   (EXIT NIL)))
             ('T
              (SEQ (LETT |xx| |x| . #1#) (LETT |res| NIL . #1#)
                   (SEQ G190
                        (COND
                          ((NULL (COND ((NULL |xx|) 'NIL) ('T 'T)))
                           #2#))
                        (SEQ (LETT |tx| (|SPADfirst| |xx|) . #1#)
                             (PROGN
                               (RPLACD |tx|
                                       (SPADCALL |r| (QCDR |tx|)
                                        (QREFELT $ 42)))
                               (QCDR |tx|))
                             (EXIT (COND
                                     ((SPADCALL (QCDR |tx|)
                                       (QREFELT $ 36))
                                      (LETT |xx| (CDR |xx|) . #1#))
                                     ('T
                                      (SEQ (LETT |newend| |xx| . #1#)
                                       (LETT |xx| (CDR |xx|) . #1#)
                                       (EXIT
                                        (COND
                                          ((NULL |res|)
                                           (SEQ
                                            (LETT |res| |newend| . #1#)
                                            (EXIT
                                             (LETT |endcell|
                                              |res| . #1#))))
                                          ('T
                                           (SEQ
                                            (|PR;qsetrest!| |endcell|
                                             |newend| $)
                                            (EXIT
                                             (LETT |endcell|
                                              |newend| . #1#)))))))))))
                        NIL #3# G191 (EXIT NIL))
                   (EXIT |res|)))))))) 

(DEFUN |PR;termTimes| (|r| |e| |tx| $)
  (CONS (SPADCALL |e| (QCAR |tx|) (QREFELT $ 43))
        (SPADCALL |r| (QCDR |tx|) (QREFELT $ 42)))) 

(DEFUN |PR;times| (|tco| |tex| |rx| $)
  (PROG (#0=#:G1911 |tx| #1=#:G1912 |r|)
    (RETURN
      (SEQ (COND
             ((QREFELT $ 41)
              (SPADCALL (CONS #'|PR;times!0| (VECTOR $ |tex| |tco|))
                  |rx| (QREFELT $ 45)))
             ('T
              (PROGN
                (LETT #0# NIL . #2=(|PR;times|))
                (SEQ (LETT |tx| NIL . #2#) (LETT #1# |rx| . #2#) G190
                     (COND
                       ((OR (ATOM #1#)
                            (PROGN (LETT |tx| (CAR #1#) . #2#) NIL))
                        (GO G191)))
                     (SEQ (EXIT (COND
                                  ((COND
                                     ((SPADCALL
                                       (LETT |r|
                                        (SPADCALL |tco| (QCDR |tx|)
                                         (QREFELT $ 42)) . #2#)
                                       (QREFELT $ 36))
                                      'NIL)
                                     ('T 'T))
                                   (LETT #0#
                                    (CONS
                                     (CONS
                                      (SPADCALL |tex| (QCAR |tx|)
                                       (QREFELT $ 43))
                                      |r|)
                                     #0#) . #2#)))))
                     (LETT #1# (CDR #1#) . #2#) (GO G190) G191
                     (EXIT (NREVERSE0 #0#)))))))))) 

(DEFUN |PR;times!0| (|#1| $$)
  (|PR;termTimes| (QREFELT $$ 2) (QREFELT $$ 1) |#1| (QREFELT $$ 0))) 

(DEFUN |PR;addm!| (|p1| |coef| |exp| |p2| $)
  (PROG (|tx| |ty| |exy| |newcoef| |ttt| |res| |endcell| |newcell|)
    (RETURN
      (SEQ (LETT |res| NIL . #0=(|PR;addm!|))
           (LETT |endcell| NIL . #0#)
           (SEQ G190
                (COND
                  ((NULL (COND
                           ((OR (NULL |p1|) (NULL |p2|)) 'NIL)
                           ('T 'T)))
                   (GO G191)))
                (SEQ (LETT |tx| (|SPADfirst| |p1|) . #0#)
                     (LETT |ty| (|SPADfirst| |p2|) . #0#)
                     (LETT |exy|
                           (SPADCALL |exp| (QCAR |ty|) (QREFELT $ 43)) . #0#)
                     (LETT |newcell| NIL . #0#)
                     (COND
                       ((SPADCALL (QCAR |tx|) |exy| (QREFELT $ 29))
                        (SEQ (LETT |newcoef|
                                   (SPADCALL (QCDR |tx|)
                                    (SPADCALL |coef| (QCDR |ty|)
                                     (QREFELT $ 42))
                                    (QREFELT $ 46)) . #0#)
                             (COND
                               ((NULL (SPADCALL |newcoef|
                                       (QREFELT $ 36)))
                                (SEQ (PROGN
                                       (RPLACD |tx| |newcoef|)
                                       (QCDR |tx|))
                                     (EXIT (LETT |newcell| |p1| . #0#)))))
                             (LETT |p1| (CDR |p1|) . #0#)
                             (EXIT (LETT |p2| (CDR |p2|) . #0#))))
                       ((SPADCALL |exy| (QCAR |tx|) (QREFELT $ 30))
                        (SEQ (LETT |newcell| |p1| . #0#)
                             (EXIT (LETT |p1| (CDR |p1|) . #0#))))
                       ('T
                        (SEQ (LETT |newcoef|
                                   (SPADCALL |coef| (QCDR |ty|)
                                    (QREFELT $ 42)) . #0#)
                             (COND
                               ((OR (QREFELT $ 41)
                                    (NULL
                                     (SPADCALL |newcoef|
                                      (QREFELT $ 36))))
                                (SEQ (LETT |ttt|
                                      (CONS |exy| |newcoef|) . #0#)
                                     (EXIT
                                      (LETT |newcell|
                                       (CONS |ttt| NIL) . #0#))))
                               ('T (LETT |newcell| NIL . #0#)))
                             (EXIT (LETT |p2| (CDR |p2|) . #0#)))))
                     (EXIT (COND
                             ((NULL (NULL |newcell|))
                              (COND
                                ((NULL |res|)
                                 (SEQ (LETT |res| |newcell| . #0#)
                                      (EXIT
                                       (LETT |endcell| |res| . #0#))))
                                ('T
                                 (SEQ (|PR;qsetrest!| |endcell|
                                       |newcell| $)
                                      (EXIT
                                       (LETT |endcell| |newcell| . #0#)))))))))
                NIL (GO G190) G191 (EXIT NIL))
           (COND
             ((NULL |p1|)
              (LETT |newcell| (|PR;times| |coef| |exp| |p2| $) . #0#))
             ('T (LETT |newcell| |p1| . #0#)))
           (EXIT (COND
                   ((NULL |res|) |newcell|)
                   ('T
                    (SEQ (|PR;qsetrest!| |endcell| |newcell| $)
                         (EXIT |res|))))))))) 

(DEFUN |PR;pomopo!;$RE2$;20| (|p1| |r| |e| |p2| $)
  (|PR;addm!| |p1| |r| |e| |p2| $)) 

(DEFUN |PR;*;3$;21| (|p1| |p2| $)
  (PROG (|yy| |xx| |tx| #0=#:G1942 |res|)
    (RETURN
      (SEQ (LETT |xx| |p1| . #1=(|PR;*;3$;21|))
           (EXIT (COND
                   ((NULL |xx|) |p1|)
                   ('T
                    (SEQ (LETT |yy| |p2| . #1#)
                         (EXIT (COND
                                 ((NULL |yy|) |p2|)
                                 ((SPADCALL (QCAR (|SPADfirst| |xx|))
                                      (QREFELT $ 26))
                                  (SPADCALL (QCDR (|SPADfirst| |xx|))
                                      |p2| (QREFELT $ 48)))
                                 ((SPADCALL (QCAR (|SPADfirst| |yy|))
                                      (QREFELT $ 26))
                                  (SPADCALL |p1|
                                      (QCDR (|SPADfirst| |yy|))
                                      (QREFELT $ 49)))
                                 ('T
                                  (SEQ (LETT |xx| (REVERSE |xx|) . #1#)
                                       (LETT |res| NIL . #1#)
                                       (SEQ (LETT |tx| NIL . #1#)
                                        (LETT #0# |xx| . #1#) G190
                                        (COND
                                          ((OR (ATOM #0#)
                                            (PROGN
                                              (LETT |tx|
                                               (CAR #0#) . #1#)
                                              NIL))
                                           (GO G191)))
                                        (SEQ
                                         (EXIT
                                          (LETT |res|
                                           (|PR;addm!| |res|
                                            (QCDR |tx|) (QCAR |tx|)
                                            |yy| $) . #1#)))
                                        (LETT #0# (CDR #0#) . #1#)
                                        (GO G190) G191 (EXIT NIL))
                                       (EXIT |res|))))))))))))) 

(DEFUN |PR;**;$Pi$;22| (|p| |np| $)
  (SPADCALL |p| |np| (QREFELT $ 51))) 

(DEFUN |PR;^;$Pi$;23| (|p| |np| $) (SPADCALL |p| |np| (QREFELT $ 51))) 

(DEFUN |PR;^;$Nni$;24| (|p| |nn| $)
  (SPADCALL |p| |nn| (QREFELT $ 51))) 

(DEFUN |PR;**;$Nni$;25| (|p| |nn| $)
  (PROG (|cc|)
    (RETURN
      (COND
        ((NULL |p|) (|spadConstant| $ 22))
        ((ZEROP |nn|) (|spadConstant| $ 12))
        ((EQL |nn| 1) |p|)
        ('T
         (COND
           ((NULL (CDR |p|))
            (COND
              ((SPADCALL
                   (LETT |cc|
                         (SPADCALL (QCDR (|SPADfirst| |p|)) |nn|
                             (QREFELT $ 56))
                         |PR;**;$Nni$;25|)
                   (QREFELT $ 36))
               (|spadConstant| $ 22))
              ('T
               (LIST (CONS (SPADCALL |nn| (QCAR (|SPADfirst| |p|))
                               (QREFELT $ 57))
                           |cc|)))))
           ('T
            (SPADCALL (LIST (|SPADfirst| |p|)) (CDR |p|) |nn|
                (QREFELT $ 58))))))))) 

(DEFUN |PR;unitNormal;$R;26| (|p| $)
  (PROG (|#G1| |lcf| #0=#:G1952 |a|)
    (RETURN
      (SEQ (EXIT (SEQ (COND
                        ((NULL |p|)
                         (EXIT (VECTOR (|spadConstant| $ 12) |p|
                                       (|spadConstant| $ 12))))
                        ('T
                         (SEQ (LETT |#G1| (QCDR (|SPADfirst| |p|))
                                    . #1=(|PR;unitNormal;$R;26|))
                              (LETT |lcf| |#G1| . #1#)
                              (EXIT (COND
                                      ((SPADCALL |#G1|
                                        (|spadConstant| $ 11)
                                        (QREFELT $ 59))
                                       (PROGN
                                         (LETT #0#
                                          (VECTOR (|spadConstant| $ 12)
                                           |p| (|spadConstant| $ 12)) . #1#)
                                         (GO #0#))))))))
                      (LETT |a| (SPADCALL |lcf| (QREFELT $ 60)) . #1#)
                      (EXIT (VECTOR (SPADCALL |lcf| (QREFELT $ 34))
                                    (CONS
                                     (CONS (QCAR (|SPADfirst| |p|))
                                      (|spadConstant| $ 11))
                                     (SPADCALL |a| (CDR |p|)
                                      (QREFELT $ 48)))
                                    (SPADCALL |a| (QREFELT $ 34))))))
           #0# (EXIT #0#))))) 

(DEFUN |PR;unitCanonical;2$;27| (|p| $)
  (PROG (|#G2| |lcf| #0=#:G1956 |a|)
    (RETURN
      (SEQ (EXIT (SEQ (COND
                        ((NULL |p|) (EXIT |p|))
                        ('T
                         (SEQ (LETT |#G2| (QCDR (|SPADfirst| |p|))
                                    . #1=(|PR;unitCanonical;2$;27|))
                              (LETT |lcf| |#G2| . #1#)
                              (EXIT (COND
                                      ((SPADCALL |#G2|
                                        (|spadConstant| $ 11)
                                        (QREFELT $ 59))
                                       (PROGN
                                         (LETT #0# |p| . #1#)
                                         (GO #0#))))))))
                      (LETT |a| (SPADCALL |lcf| (QREFELT $ 60)) . #1#)
                      (EXIT (CONS (CONS (QCAR (|SPADfirst| |p|))
                                        (|spadConstant| $ 11))
                                  (SPADCALL |a| (CDR |p|)
                                      (QREFELT $ 48))))))
           #0# (EXIT #0#))))) 

(DEFUN |PR;unitNormal;$R;28| (|p| $)
  (PROG (|#G62| |u| |cf| |a|)
    (RETURN
      (SEQ (COND
             ((OR (NULL |p|)
                  (SPADCALL (QCDR (|SPADfirst| |p|))
                      (|spadConstant| $ 11) (QREFELT $ 59)))
              (VECTOR (|spadConstant| $ 12) |p| (|spadConstant| $ 12)))
             ('T
              (SEQ (PROGN
                     (LETT |#G62|
                           (SPADCALL (QCDR (|SPADfirst| |p|))
                               (QREFELT $ 64))
                           . #0=(|PR;unitNormal;$R;28|))
                     (LETT |u| (QVELT |#G62| 0) . #0#)
                     (LETT |cf| (QVELT |#G62| 1) . #0#)
                     (LETT |a| (QVELT |#G62| 2) . #0#)
                     |#G62|)
                   (EXIT (VECTOR (SPADCALL |u| (QREFELT $ 34))
                                 (CONS (CONS (QCAR (|SPADfirst| |p|))
                                        |cf|)
                                       (SPADCALL |a| (CDR |p|)
                                        (QREFELT $ 48)))
                                 (SPADCALL |a| (QREFELT $ 34))))))))))) 

(DEFUN |PR;unitCanonical;2$;29| (|p| $)
  (PROG (|#G64| |u| |cf| |a|)
    (RETURN
      (SEQ (COND
             ((OR (NULL |p|)
                  (SPADCALL (QCDR (|SPADfirst| |p|))
                      (|spadConstant| $ 11) (QREFELT $ 59)))
              |p|)
             ('T
              (SEQ (PROGN
                     (LETT |#G64|
                           (SPADCALL (QCDR (|SPADfirst| |p|))
                               (QREFELT $ 64))
                           . #0=(|PR;unitCanonical;2$;29|))
                     (LETT |u| (QVELT |#G64| 0) . #0#)
                     (LETT |cf| (QVELT |#G64| 1) . #0#)
                     (LETT |a| (QVELT |#G64| 2) . #0#)
                     |#G64|)
                   (EXIT (CONS (CONS (QCAR (|SPADfirst| |p|)) |cf|)
                               (SPADCALL |a| (CDR |p|) (QREFELT $ 48))))))))))) 

(DEFUN |PR;associates?;2$B;30| (|p1| |p2| $)
  (PROG (#0=#:G1968)
    (RETURN
      (COND
        ((NULL |p1|) (NULL |p2|))
        ((NULL |p2|) 'NIL)
        ('T
         (COND
           ((SPADCALL (QCAR (|SPADfirst| |p1|))
                (QCAR (|SPADfirst| |p2|)) (QREFELT $ 29))
            (COND
              ((SPADCALL (QCDR (|SPADfirst| |p1|))
                   (QCDR (|SPADfirst| |p2|)) (QREFELT $ 65))
               (SPADCALL
                   (SPADCALL
                       (PROG2 (LETT #0#
                                    (SPADCALL (QCDR (|SPADfirst| |p2|))
                                     (QCDR (|SPADfirst| |p1|))
                                     (QREFELT $ 66))
                                    |PR;associates?;2$B;30|)
                              (QCDR #0#)
                         (|check-union| (QEQCAR #0# 0) (QREFELT $ 6)
                             #0#))
                       (CDR |p1|) (QREFELT $ 48))
                   (CDR |p2|) (QREFELT $ 67)))
              ('T 'NIL)))
           ('T 'NIL))))))) 

(DEFUN |PR;exquo;$RU;31| (|p| |r| $)
  (PROG (#0=#:G1982 |tm| #1=#:G1983 |a| #2=#:G1981)
    (RETURN
      (SEQ (EXIT (CONS 0
                       (PROGN
                         (LETT #0# NIL . #3=(|PR;exquo;$RU;31|))
                         (SEQ (LETT |tm| NIL . #3#)
                              (LETT #1# |p| . #3#) G190
                              (COND
                                ((OR (ATOM #1#)
                                     (PROGN
                                       (LETT |tm| (CAR #1#) . #3#)
                                       NIL))
                                 (GO G191)))
                              (SEQ (EXIT
                                    (LETT #0#
                                     (CONS
                                      (SEQ
                                       (LETT |a|
                                        (SPADCALL (QCDR |tm|) |r|
                                         (QREFELT $ 66)) . #3#)
                                       (EXIT
                                        (COND
                                          ((QEQCAR |a| 1)
                                           (PROGN
                                             (LETT #2#
                                              (CONS 1 "failed") . #3#)
                                             (GO #2#)))
                                          ('T
                                           (CONS (QCAR |tm|)
                                            (QCDR |a|))))))
                                      #0#) . #3#)))
                              (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                              (EXIT (NREVERSE0 #0#))))))
           #2# (EXIT #2#))))) 

(DEFUN |PR;fmecg;$ER2$;32| (|p1| |e| |r| |p2| $)
  (PROG (|tm| #0=#:G1993 |e2| |c2| |u| |rout|)
    (RETURN
      (SEQ (LETT |rout| NIL . #1=(|PR;fmecg;$ER2$;32|))
           (LETT |r| (SPADCALL |r| (QREFELT $ 70)) . #1#)
           (SEQ (LETT |tm| NIL . #1#) (LETT #0# |p2| . #1#) G190
                (COND
                  ((OR (ATOM #0#)
                       (PROGN (LETT |tm| (CAR #0#) . #1#) NIL))
                   #2=(GO G191)))
                (SEQ (LETT |e2|
                           (SPADCALL |e| (QCAR |tm|) (QREFELT $ 43)) . #1#)
                     (LETT |c2|
                           (SPADCALL |r| (QCDR |tm|) (QREFELT $ 42)) . #1#)
                     (EXIT (COND
                             ((SPADCALL |c2| (|spadConstant| $ 20)
                                  (QREFELT $ 59))
                              "next term")
                             ('T
                              (SEQ (SEQ G190
                                    (COND
                                      ((NULL
                                        (COND
                                          ((NULL |p1|) 'NIL)
                                          ('T
                                           (SPADCALL |e2|
                                            (QCAR (|SPADfirst| |p1|))
                                            (QREFELT $ 30)))))
                                       #2#))
                                    (SEQ
                                     (LETT |rout|
                                      (CONS (|SPADfirst| |p1|) |rout|) . #1#)
                                     (EXIT
                                      (LETT |p1| (CDR |p1|) . #1#)))
                                    NIL #3=(GO G190) G191 (EXIT NIL))
                                   (COND
                                     ((OR (NULL |p1|)
                                       (SPADCALL
                                        (QCAR (|SPADfirst| |p1|)) |e2|
                                        (QREFELT $ 30)))
                                      (EXIT
                                       (LETT |rout|
                                        (CONS (CONS |e2| |c2|) |rout|) . #1#))))
                                   (SEQ
                                    (LETT |u|
                                     (SPADCALL
                                      (QCDR (|SPADfirst| |p1|)) |c2|
                                      (QREFELT $ 46)) . #1#)
                                    (EXIT
                                     (COND
                                       ((NULL
                                         (SPADCALL |u|
                                          (|spadConstant| $ 20)
                                          (QREFELT $ 59)))
                                        (LETT |rout|
                                         (CONS (CONS |e2| |u|) |rout|) . #1#)))))
                                   (EXIT (LETT |p1| (CDR |p1|) . #1#)))))))
                (LETT #0# (CDR #0#) . #1#) #3# G191 (EXIT NIL))
           (EXIT (NRECONC |rout| |p1|)))))) 

(DEFUN |PR;exquo;2$U;33| (|p1| |p2| $)
  (PROG (|a| |ee| #0=#:G2008 |rout|)
    (RETURN
      (SEQ (EXIT (COND
                   ((NULL |p2|) (|error| "Division by 0"))
                   ((SPADCALL |p2| (|spadConstant| $ 12)
                        (QREFELT $ 67))
                    (CONS 0 |p1|))
                   ((SPADCALL |p1| |p2| (QREFELT $ 67))
                    (CONS 0 (|spadConstant| $ 12)))
                   (#1='T
                    (SEQ (LETT |rout| NIL . #2=(|PR;exquo;2$U;33|))
                         (SEQ G190
                              (COND
                                ((NULL (COND
                                         ((NULL |p1|) 'NIL)
                                         ('T 'T)))
                                 (GO G191)))
                              (SEQ (LETT |a|
                                    (SPADCALL (QCDR (|SPADfirst| |p1|))
                                     (QCDR (|SPADfirst| |p2|))
                                     (QREFELT $ 66)) . #2#)
                                   (EXIT
                                    (COND
                                      ((QEQCAR |a| 1)
                                       (PROGN
                                         (LETT #0#
                                          (CONS 1 "failed") . #2#)
                                         (GO #0#)))
                                      ('T
                                       (SEQ
                                        (LETT |ee|
                                         (SPADCALL
                                          (QCAR (|SPADfirst| |p1|))
                                          (QCAR (|SPADfirst| |p2|))
                                          (QREFELT $ 72)) . #2#)
                                        (EXIT
                                         (COND
                                           ((QEQCAR |ee| 1)
                                            (PROGN
                                              (LETT #0#
                                               (CONS 1 "failed") . #2#)
                                              (GO #0#)))
                                           ('T
                                            (SEQ
                                             (LETT |p1|
                                              (SPADCALL (CDR |p1|)
                                               (QCDR |ee|) (QCDR |a|)
                                               (CDR |p2|)
                                               (QREFELT $ 71)) . #2#)
                                             (EXIT
                                              (LETT |rout|
                                               (CONS
                                                (CONS (QCDR |ee|)
                                                 (QCDR |a|))
                                                |rout|) . #2#)))))))))))
                              NIL (GO G190) G191 (EXIT NIL))
                         (EXIT (COND
                                 ((NULL |p1|)
                                  (CONS 0 (REVERSE |rout|)))
                                 (#1# (CONS 1 "failed"))))))))
           #0# (EXIT #0#))))) 

(DEFUN |PR;exquo;2$U;34| (|p1| |p2| $)
  (PROG (|a| |ee| #0=#:G2023 |rout|)
    (RETURN
      (SEQ (EXIT (COND
                   ((NULL |p2|) (|error| "Division by 0"))
                   ((SPADCALL |p2| (|spadConstant| $ 12)
                        (QREFELT $ 67))
                    (CONS 0 |p1|))
                   (#1='T
                    (SEQ (LETT |rout| NIL . #2=(|PR;exquo;2$U;34|))
                         (SEQ G190
                              (COND
                                ((NULL (COND
                                         ((NULL |p1|) 'NIL)
                                         ('T 'T)))
                                 (GO G191)))
                              (SEQ (LETT |a|
                                    (SPADCALL (QCDR (|SPADfirst| |p1|))
                                     (QCDR (|SPADfirst| |p2|))
                                     (QREFELT $ 66)) . #2#)
                                   (EXIT
                                    (COND
                                      ((QEQCAR |a| 1)
                                       (PROGN
                                         (LETT #0#
                                          (CONS 1 "failed") . #2#)
                                         (GO #0#)))
                                      ('T
                                       (SEQ
                                        (LETT |ee|
                                         (SPADCALL
                                          (QCAR (|SPADfirst| |p1|))
                                          (QCAR (|SPADfirst| |p2|))
                                          (QREFELT $ 72)) . #2#)
                                        (EXIT
                                         (COND
                                           ((QEQCAR |ee| 1)
                                            (PROGN
                                              (LETT #0#
                                               (CONS 1 "failed") . #2#)
                                              (GO #0#)))
                                           ('T
                                            (SEQ
                                             (LETT |p1|
                                              (SPADCALL (CDR |p1|)
                                               (QCDR |ee|) (QCDR |a|)
                                               (CDR |p2|)
                                               (QREFELT $ 71)) . #2#)
                                             (EXIT
                                              (LETT |rout|
                                               (CONS
                                                (CONS (QCDR |ee|)
                                                 (QCDR |a|))
                                                |rout|) . #2#)))))))))))
                              NIL (GO G190) G191 (EXIT NIL))
                         (EXIT (COND
                                 ((NULL |p1|)
                                  (CONS 0 (REVERSE |rout|)))
                                 (#1# (CONS 1 "failed"))))))))
           #0# (EXIT #0#))))) 

(DEFUN |PR;/;$R$;35| (|x| |r| $)
  (SPADCALL (SPADCALL |r| (QREFELT $ 60)) |x| (QREFELT $ 48))) 

(DEFUN |PolynomialRing| (&REST #0=#:G2034)
  (PROG ()
    (RETURN
      (PROG (#1=#:G2035)
        (RETURN
          (COND
            ((LETT #1#
                   (|lassocShiftWithFunction| (|devaluateList| #0#)
                       (HGET |$ConstructorCache| '|PolynomialRing|)
                       '|domainEqualList|)
                   . #2=(|PolynomialRing|))
             (|CDRwithIncrement| #1#))
            ('T
             (UNWIND-PROTECT
               (PROG1 (APPLY (|function| |PolynomialRing;|) #0#)
                 (LETT #1# T . #2#))
               (COND
                 ((NOT #1#)
                  (HREM |$ConstructorCache| '|PolynomialRing|))))))))))) 

(DEFUN |PolynomialRing;| (|#1| |#2|)
  (PROG (DV$1 DV$2 |dv$| $ #0=#:G2033 |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #1=(|PolynomialRing|))
        (LETT DV$2 (|devaluate| |#2|) . #1#)
        (LETT |dv$| (LIST '|PolynomialRing| DV$1 DV$2) . #1#)
        (LETT $ (GETREFV 84) . #1#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3
            (LETT |pv$|
                  (|buildPredVector| 0 0
                      (LIST (|HasCategory| |#1|
                                '(|Algebra| (|Fraction| (|Integer|))))
                            (|HasCategory| |#1| '(|IntegralDomain|))
                            (LETT #0#
                                  (|HasCategory| |#1|
                                      '(|CommutativeRing|)) . #1#)
                            (OR #0#
                                (|HasCategory| |#1|
                                    '(|IntegralDomain|)))
                            (|HasCategory| |#1|
                                '(|CharacteristicNonZero|))
                            (|HasCategory| |#1|
                                '(|CharacteristicZero|))
                            (|HasCategory| |#1|
                                '(|RetractableTo|
                                     (|Fraction| (|Integer|))))
                            (|HasCategory| |#1|
                                '(|RetractableTo| (|Integer|)))
                            (|HasCategory| |#1|
                                '(|canonicalUnitNormal|))
                            (|HasCategory| |#1| '(|Field|))
                            (|HasCategory| |#1| '(|GcdDomain|))
                            (AND (|HasCategory| |#1|
                                     '(|IntegralDomain|))
                                 (|HasCategory| |#2|
                                     '(|CancellationAbelianMonoid|)))
                            (OR (|HasCategory| |#1|
                                    '(|Algebra|
                                      (|Fraction| (|Integer|))))
                                (|HasCategory| |#1|
                                    '(|RetractableTo|
                                      (|Fraction| (|Integer|))))))) . #1#))
        (|haddProp| |$ConstructorCache| '|PolynomialRing|
            (LIST DV$1 DV$2) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7 |#2|)
        (QSETREFV $ 8 (|Record| (|:| |k| |#2|) (|:| |c| |#1|)))
        (QSETREFV $ 9 (|List| (QREFELT $ 8)))
        (QSETREFV $ 41 (|HasCategory| |#1| '(|EntireRing|)))
        (COND
          ((|testBitVector| |pv$| 3)
           (PROGN
             (QSETREFV $ 53
                 (CONS (|dispatchFunction| |PR;**;$Pi$;22|) $))
             (QSETREFV $ 54
                 (CONS (|dispatchFunction| |PR;^;$Pi$;23|) $))
             (QSETREFV $ 55
                 (CONS (|dispatchFunction| |PR;^;$Nni$;24|) $))
             (QSETREFV $ 51
                 (CONS (|dispatchFunction| |PR;**;$Nni$;25|) $)))))
        (COND
          ((|testBitVector| |pv$| 10)
           (PROGN
             (QSETREFV $ 62
                 (CONS (|dispatchFunction| |PR;unitNormal;$R;26|) $))
             (QSETREFV $ 63
                 (CONS (|dispatchFunction| |PR;unitCanonical;2$;27|) $))))
          ((|testBitVector| |pv$| 2)
           (PROGN
             (QSETREFV $ 62
                 (CONS (|dispatchFunction| |PR;unitNormal;$R;28|) $))
             (QSETREFV $ 63
                 (CONS (|dispatchFunction| |PR;unitCanonical;2$;29|) $)))))
        (COND
          ((|testBitVector| |pv$| 2)
           (PROGN
             (QSETREFV $ 68
                 (CONS (|dispatchFunction| |PR;associates?;2$B;30|) $))
             (QSETREFV $ 69
                 (CONS (|dispatchFunction| |PR;exquo;$RU;31|) $))
             (COND
               ((|HasCategory| |#2| '(|CancellationAbelianMonoid|))
                (PROGN
                  (QSETREFV $ 71
                      (CONS (|dispatchFunction| |PR;fmecg;$ER2$;32|) $))
                  (COND
                    ((|HasCategory| |#1| '(|Approximate|))
                     (QSETREFV $ 73
                         (CONS (|dispatchFunction| |PR;exquo;2$U;33|)
                               $)))
                    ('T
                     (QSETREFV $ 73
                         (CONS (|dispatchFunction| |PR;exquo;2$U;34|)
                               $))))))))))
        (COND
          ((|testBitVector| |pv$| 10)
           (QSETREFV $ 74 (CONS (|dispatchFunction| |PR;/;$R$;35|) $))))
        $)))) 

(MAKEPROP '|PolynomialRing| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL (|FreeModule| 6 7) (|local| |#1|)
             (|local| |#2|) '|Term| '|Rep| (0 . |Zero|) (4 . |One|)
             (CONS IDENTITY
                   (FUNCALL (|dispatchFunction| |PR;One;$;1|) $))
             (|NonNegativeInteger|) (8 . |characteristic|)
             |PR;characteristic;Nni;2| |PR;numberOfMonomials;$Nni;3|
             |PR;degree;$E;4| (12 . |last|) |PR;minimumDegree;$E;5|
             (17 . |Zero|) |PR;leadingCoefficient;$R;6| (21 . |Zero|)
             |PR;leadingMonomial;2$;7| |PR;reductum;2$;8| (|Boolean|)
             (25 . |zero?|) (|Union| 6 '"failed")
             |PR;retractIfCan;$U;9| (30 . =) (36 . <)
             |PR;coefficient;$ER;10| (|Union| $ '"failed")
             (42 . |recip|) |PR;coerce;R$;12| |PR;recip;$U;11|
             (47 . |zero?|) (|Integer|) (52 . |coerce|)
             |PR;coerce;I$;13| |PR;ground?;$B;14| '|entireRing?|
             (57 . *) (63 . +) (|Mapping| 8 8) (69 . |map|) (75 . +)
             |PR;pomopo!;$RE2$;20| (81 . *) (87 . *) |PR;*;3$;21|
             (93 . **) (|PositiveInteger|) (99 . **) (105 . ^)
             (111 . ^) (117 . **) (123 . *) (129 . |binomThmExpt|)
             (136 . =) (142 . |inv|)
             (|Record| (|:| |unit| $) (|:| |canonical| $)
                 (|:| |associate| $))
             (147 . |unitNormal|) (152 . |unitCanonical|)
             (157 . |unitNormal|) (162 . |associates?|) (168 . |exquo|)
             (174 . =) (180 . |associates?|) (186 . |exquo|) (192 . -)
             (197 . |fmecg|) (205 . |subtractIfCan|) (211 . |exquo|)
             (217 . /) (|Fraction| 37) (|Union| 75 '"failed")
             (|Union| 37 '"failed") (|Mapping| 7 7) (|List| 6)
             (|Mapping| 6 6) (|SingleInteger|) (|String|)
             (|OutputForm|))
          '#(~= 223 |zero?| 229 |unitNormal| 234 |unitCanonical| 239
             |unit?| 244 |subtractIfCan| 249 |sample| 255
             |retractIfCan| 259 |retract| 274 |reductum| 289 |recip|
             294 |primitivePart| 299 |pomopo!| 304 |one?| 312
             |numberOfMonomials| 317 |monomial?| 322 |monomial| 327
             |minimumDegree| 333 |mapExponents| 338 |map| 344
             |leadingMonomial| 350 |leadingCoefficient| 355 |latex| 360
             |hash| 365 |ground?| 370 |ground| 375 |fmecg| 380 |exquo|
             388 |degree| 400 |content| 405 |coerce| 410 |coefficients|
             435 |coefficient| 440 |charthRoot| 446 |characteristic|
             451 |binomThmExpt| 455 |associates?| 462 ^ 468 |Zero| 480
             |One| 484 = 488 / 494 - 500 + 511 ** 517 * 529)
          'NIL
          (CONS (|makeByteWordVec2| 9
                    '(0 0 2 1 2 3 1 4 2 2 5 6 3 0 0 1 4 0 0 0 0 1 1 3 0
                      0 0 0 0 0 0 0 0 0 0 0 0 0 3 2 7 8 9))
                (CONS '#(|FiniteAbelianMonoidRing&|
                         |AbelianMonoidRing&| |IntegralDomain&|
                         |Algebra&| |Algebra&| |Algebra&| |Module&| NIL
                         |Module&| NIL NIL NIL |Module&| |Ring&| NIL
                         NIL NIL NIL NIL NIL NIL NIL NIL NIL
                         |AbelianGroup&| NIL NIL |AbelianMonoid&|
                         |Monoid&| NIL |SemiGroup&| |AbelianSemiGroup&|
                         |FullyRetractableTo&| |SetCategory&|
                         |RetractableTo&| NIL |BasicType&| NIL NIL NIL
                         |RetractableTo&| |RetractableTo&| NIL)
                      (CONS '#((|FiniteAbelianMonoidRing| 6 7)
                               (|AbelianMonoidRing| 6 7)
                               (|IntegralDomain|) (|Algebra| 75)
                               (|Algebra| $$) (|Algebra| 6)
                               (|Module| 75) (|CommutativeRing|)
                               (|Module| $$) (|EntireRing|)
                               (|CharacteristicNonZero|)
                               (|CharacteristicZero|) (|Module| 6)
                               (|Ring|) (|BiModule| 6 6)
                               (|BiModule| 75 75) (|BiModule| $$ $$)
                               (|Rng|) (|LeftModule| 6)
                               (|RightModule| 6) (|LeftModule| $$)
                               (|LeftModule| 75) (|RightModule| 75)
                               (|RightModule| $$) (|AbelianGroup|)
                               (|CancellationAbelianMonoid|)
                               (|SemiRing|) (|AbelianMonoid|)
                               (|Monoid|) (|SemiRng|) (|SemiGroup|)
                               (|AbelianSemiGroup|)
                               (|FullyRetractableTo| 6) (|SetCategory|)
                               (|RetractableTo| 6) (|unitsKnown|)
                               (|BasicType|) (|CoercibleTo| 83)
                               (|CommutativeStar|) (|noZeroDivisors|)
                               (|RetractableTo| 75)
                               (|RetractableTo| 37)
                               (|canonicalUnitNormal|))
                            (|makeByteWordVec2| 83
                                '(0 7 0 10 0 6 0 11 0 6 13 14 1 9 8 0
                                  18 0 6 0 20 0 0 0 22 1 7 25 0 26 2 7
                                  25 0 0 29 2 7 25 0 0 30 1 6 32 0 33 1
                                  6 25 0 36 1 6 0 37 38 2 6 0 0 0 42 2
                                  7 0 0 0 43 2 9 0 44 0 45 2 6 0 0 0 46
                                  2 0 0 6 0 48 2 0 0 0 6 49 2 0 0 0 13
                                  51 2 0 0 0 52 53 2 0 0 0 52 54 2 0 0
                                  0 13 55 2 6 0 0 13 56 2 7 0 13 0 57 3
                                  0 0 0 0 13 58 2 6 25 0 0 59 1 6 0 0
                                  60 1 0 61 0 62 1 0 0 0 63 1 6 61 0 64
                                  2 6 25 0 0 65 2 6 32 0 0 66 2 0 25 0
                                  0 67 2 0 25 0 0 68 2 0 32 0 6 69 1 6
                                  0 0 70 4 0 0 0 7 6 0 71 2 7 32 0 0 72
                                  2 0 32 0 0 73 2 0 0 0 6 74 2 0 25 0 0
                                  1 1 0 25 0 1 1 2 61 0 62 1 2 0 0 63 1
                                  2 25 0 1 2 0 32 0 0 1 0 0 0 1 1 7 76
                                  0 1 1 8 77 0 1 1 0 27 0 28 1 7 75 0 1
                                  1 8 37 0 1 1 0 6 0 1 1 0 0 0 24 1 0
                                  32 0 35 1 11 0 0 1 4 0 0 0 6 7 0 47 1
                                  0 25 0 1 1 0 13 0 16 1 0 25 0 1 2 0 0
                                  6 7 1 1 0 7 0 19 2 0 0 78 0 1 2 0 0
                                  80 0 1 1 0 0 0 23 1 0 6 0 21 1 0 82 0
                                  1 1 0 81 0 1 1 0 25 0 40 1 0 6 0 1 4
                                  12 0 0 7 6 0 71 2 2 32 0 6 69 2 2 32
                                  0 0 73 1 0 7 0 17 1 11 6 0 1 1 13 0
                                  75 1 1 2 0 0 1 1 0 0 6 34 1 0 0 37 39
                                  1 0 83 0 1 1 0 79 0 1 2 0 6 0 7 31 1
                                  5 32 0 1 0 0 13 15 3 3 0 0 0 13 58 2
                                  2 25 0 0 68 2 0 0 0 13 55 2 0 0 0 52
                                  54 0 0 0 22 0 0 0 12 2 0 25 0 0 67 2
                                  10 0 0 6 74 2 0 0 0 0 1 1 0 0 0 1 2 0
                                  0 0 0 1 2 0 0 0 13 51 2 0 0 0 52 53 2
                                  1 0 0 75 1 2 1 0 75 0 1 2 0 0 0 6 49
                                  2 0 0 6 0 48 2 0 0 0 0 50 2 0 0 37 0
                                  1 2 0 0 13 0 1 2 0 0 52 0 1)))))
          '|lookupComplete|)) 
