
(/VERSIONCHECK 2) 

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

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

(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| $ 9)) ('T (QCAR (|SPADfirst| |p|))))) 

(DEFUN |PR;minimumDegree;$E;5| (|p| $)
  (COND ((NULL |p|) (|spadConstant| $ 9))
        ('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 (#1=#:G1865 #2=#:G1869 #3=#:G1870 |tm|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (SEQ (LETT |tm| NIL . #4=(|PR;coefficient;$ER;10|))
             (LETT #3# |p| . #4#) G190
             (COND
              ((OR (ATOM #3#) (PROGN (LETT |tm| (CAR #3#) . #4#) NIL))
               (GO G191)))
             (SEQ
              (EXIT
               (COND
                ((SPADCALL (QCAR |tm|) |e| (QREFELT $ 29))
                 (PROGN (LETT #2# (QCDR |tm|) . #4#) (GO #2#)))
                ('T
                 (SEQ
                  (EXIT
                   (COND
                    ((SPADCALL (QCAR |tm|) |e| (QREFELT $ 30))
                     (PROGN
                      (LETT #1#
                            (PROGN
                             (LETT #2# (|spadConstant| $ 20) . #4#)
                             (GO #2#))
                            . #4#)
                      (GO #1#)))))
                  #1# (EXIT #1#))))))
             (LETT #3# (CDR #3#) . #4#) (GO G190) G191 (EXIT NIL))
        (EXIT (|spadConstant| $ 20))))
      #2# (EXIT #2#))))) 

(DEFUN |PR;recip;$U;11| (|p| $)
  (PROG (|u|)
    (RETURN
     (SEQ
      (COND
       ((OR (NULL |p|)
            (SPADCALL (|spadConstant| $ 9) (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| $ 9) |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 $ 16)) (QREFELT $ 26)))
        ('T 'NIL))) 

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

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

(DEFUN |PR;times!| (|r| |x| $)
  (PROG (|endcell| |res| |xx| |newend| |tx| #1=#:G1906)
    (RETURN
     (SEQ
      (COND
       ((QREFELT $ 41)
        (SEQ
         (SEQ (LETT |tx| NIL . #2=(|PR;times!|)) (LETT #1# |x| . #2#) G190
              (COND
               ((OR (ATOM #1#) (PROGN (LETT |tx| (CAR #1#) . #2#) NIL))
                #3=(GO G191)))
              (SEQ
               (EXIT
                (PROGN
                 (RPLACD |tx| (SPADCALL |r| (QCDR |tx|) (QREFELT $ 42)))
                 (QCDR |tx|))))
              (LETT #1# (CDR #1#) . #2#) #4=(GO G190) G191 (EXIT NIL))
         (EXIT |x|)))
       ('T
        (SEQ (LETT |xx| |x| . #2#) (LETT |res| NIL . #2#)
             (SEQ G190 (COND ((NULL (COND ((NULL |xx|) 'NIL) ('T 'T))) #3#))
                  (SEQ (LETT |tx| (|SPADfirst| |xx|) . #2#)
                       (PROGN
                        (RPLACD |tx| (SPADCALL |r| (QCDR |tx|) (QREFELT $ 42)))
                        (QCDR |tx|))
                       (EXIT
                        (COND
                         ((SPADCALL (QCDR |tx|) (QREFELT $ 36))
                          (LETT |xx| (CDR |xx|) . #2#))
                         ('T
                          (SEQ (LETT |newend| |xx| . #2#)
                               (LETT |xx| (CDR |xx|) . #2#)
                               (EXIT
                                (COND
                                 ((NULL |res|)
                                  (SEQ (LETT |res| |newend| . #2#)
                                       (EXIT (LETT |endcell| |res| . #2#))))
                                 ('T
                                  (SEQ (|PR;qsetrest!| |endcell| |newend| $)
                                       (EXIT
                                        (LETT |endcell| |newend|
                                              . #2#)))))))))))
                  NIL #4# 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 (|r| #1=#:G1914 |tx| #2=#:G1913)
    (RETURN
     (SEQ
      (COND
       ((QREFELT $ 41)
        (SPADCALL (CONS #'|PR;times!0| (VECTOR $ |tex| |tco|)) |rx|
                  (QREFELT $ 45)))
       (#3='T
        (PROGN
         (LETT #2# NIL . #4=(|PR;times|))
         (SEQ (LETT |tx| NIL . #4#) (LETT #1# |rx| . #4#) G190
              (COND
               ((OR (ATOM #1#) (PROGN (LETT |tx| (CAR #1#) . #4#) NIL))
                (GO G191)))
              (SEQ
               (EXIT
                (COND
                 ((COND
                   ((SPADCALL
                     (LETT |r| (SPADCALL |tco| (QCDR |tx|) (QREFELT $ 42))
                           . #4#)
                     (QREFELT $ 36))
                    'NIL)
                   (#3# 'T))
                  (LETT #2#
                        (CONS
                         (CONS (SPADCALL |tex| (QCAR |tx|) (QREFELT $ 43)) |r|)
                         #2#)
                        . #4#)))))
              (LETT #1# (CDR #1#) . #4#) (GO G190) G191
              (EXIT (NREVERSE0 #2#)))))))))) 

(DEFUN |PR;times!0| (|x1| $$)
  (PROG (|tco| |tex| $)
    (LETT |tco| (QREFELT $$ 2) . #1=(|PR;times|))
    (LETT |tex| (QREFELT $$ 1) . #1#)
    (LETT $ (QREFELT $$ 0) . #1#)
    (RETURN (PROGN (|PR;termTimes| |tco| |tex| |x1| $))))) 

(DEFUN |PR;addm!| (|p1| |coef| |exp| |p2| $)
  (PROG (|newcell| |endcell| |res| |ttt| |newcoef| |exy| |ty| |tx|)
    (RETURN
     (SEQ (LETT |res| NIL . #1=(|PR;addm!|)) (LETT |endcell| NIL . #1#)
          (SEQ G190
               (COND
                ((NULL (COND ((OR (NULL |p1|) (NULL |p2|)) 'NIL) ('T 'T)))
                 (GO G191)))
               (SEQ (LETT |tx| (|SPADfirst| |p1|) . #1#)
                    (LETT |ty| (|SPADfirst| |p2|) . #1#)
                    (LETT |exy| (SPADCALL |exp| (QCAR |ty|) (QREFELT $ 43))
                          . #1#)
                    (LETT |newcell| NIL . #1#)
                    (COND
                     ((SPADCALL (QCAR |tx|) |exy| (QREFELT $ 29))
                      (SEQ
                       (LETT |newcoef|
                             (SPADCALL (QCDR |tx|)
                                       (SPADCALL |coef| (QCDR |ty|)
                                                 (QREFELT $ 42))
                                       (QREFELT $ 46))
                             . #1#)
                       (COND
                        ((NULL (SPADCALL |newcoef| (QREFELT $ 36)))
                         (SEQ (PROGN (RPLACD |tx| |newcoef|) (QCDR |tx|))
                              (EXIT (LETT |newcell| |p1| . #1#)))))
                       (LETT |p1| (CDR |p1|) . #1#)
                       (EXIT (LETT |p2| (CDR |p2|) . #1#))))
                     ((SPADCALL |exy| (QCAR |tx|) (QREFELT $ 30))
                      (SEQ (LETT |newcell| |p1| . #1#)
                           (EXIT (LETT |p1| (CDR |p1|) . #1#))))
                     ('T
                      (SEQ
                       (LETT |newcoef|
                             (SPADCALL |coef| (QCDR |ty|) (QREFELT $ 42))
                             . #1#)
                       (COND
                        ((OR (QREFELT $ 41)
                             (NULL (SPADCALL |newcoef| (QREFELT $ 36))))
                         (SEQ (LETT |ttt| (CONS |exy| |newcoef|) . #1#)
                              (EXIT (LETT |newcell| (CONS |ttt| NIL) . #1#))))
                        ('T (LETT |newcell| NIL . #1#)))
                       (EXIT (LETT |p2| (CDR |p2|) . #1#)))))
                    (EXIT
                     (COND
                      ((NULL (NULL |newcell|))
                       (COND
                        ((NULL |res|)
                         (SEQ (LETT |res| |newcell| . #1#)
                              (EXIT (LETT |endcell| |res| . #1#))))
                        ('T
                         (SEQ (|PR;qsetrest!| |endcell| |newcell| $)
                              (EXIT (LETT |endcell| |newcell| . #1#)))))))))
               NIL (GO G190) G191 (EXIT NIL))
          (COND
           ((NULL |p1|)
            (LETT |newcell| (|PR;times| |coef| |exp| |p2| $) . #1#))
           (#2='T (LETT |newcell| |p1| . #1#)))
          (EXIT
           (COND ((NULL |res|) |newcell|)
                 (#2#
                  (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 (|res| #1=#:G1944 |tx| |xx| |yy|)
    (RETURN
     (SEQ (LETT |xx| |p1| . #2=(|PR;*;3$;21|))
          (EXIT
           (COND ((NULL |xx|) |p1|)
                 (#3='T
                  (SEQ (LETT |yy| |p2| . #2#)
                       (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)))
                              (#3#
                               (SEQ (LETT |xx| (REVERSE |xx|) . #2#)
                                    (LETT |res| NIL . #2#)
                                    (SEQ (LETT |tx| NIL . #2#)
                                         (LETT #1# |xx| . #2#) G190
                                         (COND
                                          ((OR (ATOM #1#)
                                               (PROGN
                                                (LETT |tx| (CAR #1#) . #2#)
                                                NIL))
                                           (GO G191)))
                                         (SEQ
                                          (EXIT
                                           (LETT |res|
                                                 (|PR;addm!| |res| (QCDR |tx|)
                                                  (QCAR |tx|) |yy| $)
                                                 . #2#)))
                                         (LETT #1# (CDR #1#) . #2#) (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| $ 11)) ((EQL |nn| 1) |p|)
           (#1='T
            (COND
             ((NULL (CDR |p|))
              (COND
               ((SPADCALL
                 (LETT |cc|
                       (SPADCALL (QCDR (|SPADfirst| |p|)) |nn| (QREFELT $ 54))
                       |PR;^;$Nni$;25|)
                 (QREFELT $ 36))
                (|spadConstant| $ 22))
               (#1#
                (LIST
                 (CONS (SPADCALL |nn| (QCAR (|SPADfirst| |p|)) (QREFELT $ 55))
                       |cc|)))))
             (#1#
              (SPADCALL (LIST (|SPADfirst| |p|)) (CDR |p|) |nn|
                        (QREFELT $ 56))))))))) 

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

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

(DEFUN |PR;unitNormal;$R;28| (|p| $)
  (PROG (|a| |cf| |u| |#G62|)
    (RETURN
     (SEQ
      (COND
       ((OR (NULL |p|)
            (SPADCALL (QCDR (|SPADfirst| |p|)) (|spadConstant| $ 10)
                      (QREFELT $ 57)))
        (VECTOR (|spadConstant| $ 11) |p| (|spadConstant| $ 11)))
       ('T
        (SEQ
         (PROGN
          (LETT |#G62| (SPADCALL (QCDR (|SPADfirst| |p|)) (QREFELT $ 62))
                . #1=(|PR;unitNormal;$R;28|))
          (LETT |u| (QVELT |#G62| 0) . #1#)
          (LETT |cf| (QVELT |#G62| 1) . #1#)
          (LETT |a| (QVELT |#G62| 2) . #1#)
          |#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 (|a| |cf| |u| |#G64|)
    (RETURN
     (SEQ
      (COND
       ((OR (NULL |p|)
            (SPADCALL (QCDR (|SPADfirst| |p|)) (|spadConstant| $ 10)
                      (QREFELT $ 57)))
        |p|)
       ('T
        (SEQ
         (PROGN
          (LETT |#G64| (SPADCALL (QCDR (|SPADfirst| |p|)) (QREFELT $ 62))
                . #1=(|PR;unitCanonical;2$;29|))
          (LETT |u| (QVELT |#G64| 0) . #1#)
          (LETT |cf| (QVELT |#G64| 1) . #1#)
          (LETT |a| (QVELT |#G64| 2) . #1#)
          |#G64|)
         (EXIT
          (CONS (CONS (QCAR (|SPADfirst| |p|)) |cf|)
                (SPADCALL |a| (CDR |p|) (QREFELT $ 48))))))))))) 

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

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

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

(DEFUN |PR;exquo;2$U;33| (|p1| |p2| $)
  (PROG (|rout| #1=#:G2010 |ee| |a|)
    (RETURN
     (SEQ
      (EXIT
       (COND ((NULL |p2|) (|error| "Division by 0"))
             ((SPADCALL |p2| (|spadConstant| $ 11) (QREFELT $ 65))
              (CONS 0 |p1|))
             ((SPADCALL |p1| |p2| (QREFELT $ 65))
              (CONS 0 (|spadConstant| $ 11)))
             (#2='T
              (SEQ (LETT |rout| NIL . #3=(|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 $ 64))
                               . #3#)
                         (EXIT
                          (COND
                           ((QEQCAR |a| 1)
                            (PROGN
                             (LETT #1# (CONS 1 "failed") . #3#)
                             (GO #1#)))
                           ('T
                            (SEQ
                             (LETT |ee|
                                   (SPADCALL (QCAR (|SPADfirst| |p1|))
                                             (QCAR (|SPADfirst| |p2|))
                                             (QREFELT $ 70))
                                   . #3#)
                             (EXIT
                              (COND
                               ((QEQCAR |ee| 1)
                                (PROGN
                                 (LETT #1# (CONS 1 "failed") . #3#)
                                 (GO #1#)))
                               ('T
                                (SEQ
                                 (LETT |p1|
                                       (SPADCALL (CDR |p1|) (QCDR |ee|)
                                                 (QCDR |a|) (CDR |p2|)
                                                 (QREFELT $ 69))
                                       . #3#)
                                 (EXIT
                                  (LETT |rout|
                                        (CONS (CONS (QCDR |ee|) (QCDR |a|))
                                              |rout|)
                                        . #3#)))))))))))
                        NIL (GO G190) G191 (EXIT NIL))
                   (EXIT
                    (COND ((NULL |p1|) (CONS 0 (REVERSE |rout|)))
                          (#2# (CONS 1 "failed"))))))))
      #1# (EXIT #1#))))) 

(DEFUN |PR;exquo;2$U;34| (|p1| |p2| $)
  (PROG (|rout| #1=#:G2025 |ee| |a|)
    (RETURN
     (SEQ
      (EXIT
       (COND ((NULL |p2|) (|error| "Division by 0"))
             ((SPADCALL |p2| (|spadConstant| $ 11) (QREFELT $ 65))
              (CONS 0 |p1|))
             (#2='T
              (SEQ (LETT |rout| NIL . #3=(|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 $ 64))
                               . #3#)
                         (EXIT
                          (COND
                           ((QEQCAR |a| 1)
                            (PROGN
                             (LETT #1# (CONS 1 "failed") . #3#)
                             (GO #1#)))
                           ('T
                            (SEQ
                             (LETT |ee|
                                   (SPADCALL (QCAR (|SPADfirst| |p1|))
                                             (QCAR (|SPADfirst| |p2|))
                                             (QREFELT $ 70))
                                   . #3#)
                             (EXIT
                              (COND
                               ((QEQCAR |ee| 1)
                                (PROGN
                                 (LETT #1# (CONS 1 "failed") . #3#)
                                 (GO #1#)))
                               ('T
                                (SEQ
                                 (LETT |p1|
                                       (SPADCALL (CDR |p1|) (QCDR |ee|)
                                                 (QCDR |a|) (CDR |p2|)
                                                 (QREFELT $ 69))
                                       . #3#)
                                 (EXIT
                                  (LETT |rout|
                                        (CONS (CONS (QCDR |ee|) (QCDR |a|))
                                              |rout|)
                                        . #3#)))))))))))
                        NIL (GO G190) G191 (EXIT NIL))
                   (EXIT
                    (COND ((NULL |p1|) (CONS 0 (REVERSE |rout|)))
                          (#2# (CONS 1 "failed"))))))))
      #1# (EXIT #1#))))) 

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

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

(DEFUN |PolynomialRing;| (|#1| |#2|)
  (PROG (|pv$| #1=#:G2039 $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #2=(|PolynomialRing|))
      (LETT DV$2 (|devaluate| |#2|) . #2#)
      (LETT |dv$| (LIST '|PolynomialRing| DV$1 DV$2) . #2#)
      (LETT $ (GETREFV 82) . #2#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (|HasCategory| |#1|
                                                         '(|Algebra|
                                                           (|Fraction|
                                                            (|Integer|))))
                                          (|HasCategory| |#1|
                                                         '(|IntegralDomain|))
                                          (LETT #1#
                                                (|HasCategory| |#1|
                                                               '(|CommutativeRing|))
                                                . #2#)
                                          (OR #1#
                                              (|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|)))))))
                      . #2#))
      (|haddProp| |$ConstructorCache| '|PolynomialRing| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 (|List| (|Record| (|:| |k| |#2|) (|:| |c| |#1|))))
      (QSETREFV $ 41 (|HasCategory| |#1| '(|EntireRing|)))
      (COND
       ((|testBitVector| |pv$| 3)
        (PROGN
         (QSETREFV $ 53 (CONS (|dispatchFunction| |PR;^;$Pi$;22|) $))
         (QSETREFV $ 53 (CONS (|dispatchFunction| |PR;^;$Pi$;23|) $))
         (QSETREFV $ 51 (CONS (|dispatchFunction| |PR;^;$Nni$;24|) $))
         (QSETREFV $ 51 (CONS (|dispatchFunction| |PR;^;$Nni$;25|) $)))))
      (COND
       ((|testBitVector| |pv$| 10)
        (PROGN
         (QSETREFV $ 60 (CONS (|dispatchFunction| |PR;unitNormal;$R;26|) $))
         (QSETREFV $ 61
                   (CONS (|dispatchFunction| |PR;unitCanonical;2$;27|) $))))
       ((|testBitVector| |pv$| 2)
        (PROGN
         (QSETREFV $ 60 (CONS (|dispatchFunction| |PR;unitNormal;$R;28|) $))
         (QSETREFV $ 61
                   (CONS (|dispatchFunction| |PR;unitCanonical;2$;29|) $)))))
      (COND
       ((|testBitVector| |pv$| 2)
        (PROGN
         (QSETREFV $ 66 (CONS (|dispatchFunction| |PR;associates?;2$B;30|) $))
         (QSETREFV $ 67 (CONS (|dispatchFunction| |PR;exquo;$RU;31|) $))
         (COND
          ((|HasCategory| |#2| '(|CancellationAbelianMonoid|))
           (PROGN
            (QSETREFV $ 69 (CONS (|dispatchFunction| |PR;fmecg;$ER2$;32|) $))
            (COND
             ((|HasCategory| |#1| '(|Approximate|))
              (QSETREFV $ 71 (CONS (|dispatchFunction| |PR;exquo;2$U;33|) $)))
             ('T
              (QSETREFV $ 71
                        (CONS (|dispatchFunction| |PR;exquo;2$U;34|)
                              $))))))))))
      (COND
       ((|testBitVector| |pv$| 10)
        (QSETREFV $ 72 (CONS (|dispatchFunction| |PR;/;$R$;35|) $))))
      $)))) 

(MAKEPROP '|PolynomialRing| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL (|FreeModule| 6 7) (|local| |#1|)
              (|local| |#2|) '|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| (|Record| (|:| |k| 7) (|:| |c| 6)) (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| 17 17) (69 . |map|)
              (75 . +) |PR;pomopo!;$RE2$;20| (81 . *) (87 . *) |PR;*;3$;21|
              (93 . ^) (|PositiveInteger|) (99 . ^) (105 . ^) (111 . *)
              (117 . |binomThmExpt|) (124 . =) (130 . |inv|)
              (|Record| (|:| |unit| $) (|:| |canonical| $) (|:| |associate| $))
              (135 . |unitNormal|) (140 . |unitCanonical|) (145 . |unitNormal|)
              (150 . |associates?|) (156 . |exquo|) (162 . =)
              (168 . |associates?|) (174 . |exquo|) (180 . -) (185 . |fmecg|)
              (193 . |subtractIfCan|) (199 . |exquo|) (205 . /) (|Fraction| 37)
              (|Union| 73 '#1="failed") (|Union| 37 '#1#) (|Mapping| 7 7)
              (|List| 6) (|Mapping| 6 6) (|String|) (|OutputForm|)
              (|SingleInteger|))
           '#(~= 211 |zero?| 217 |unitNormal| 222 |unitCanonical| 227 |unit?|
              232 |subtractIfCan| 237 |sample| 243 |retractIfCan| 247 |retract|
              262 |reductum| 277 |recip| 282 |primitivePart| 287 |pomopo!| 292
              |one?| 300 |numberOfMonomials| 305 |monomial?| 310 |monomial| 315
              |minimumDegree| 321 |mapExponents| 326 |map| 332
              |leadingMonomial| 338 |leadingCoefficient| 343 |latex| 348 |hash|
              353 |ground?| 358 |ground| 363 |fmecg| 368 |exquo| 376 |degree|
              388 |content| 393 |coerce| 398 |coefficients| 423 |coefficient|
              428 |charthRoot| 434 |characteristic| 439 |binomThmExpt| 443
              |associates?| 450 ^ 456 |Zero| 468 |One| 472 = 476 / 482 - 488 +
              499 * 505)
           '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| 73) (|Algebra| $$) (|Algebra| 6)
                 (|Module| 73) (|CommutativeRing|) (|Module| $$) (|EntireRing|)
                 (|CharacteristicNonZero|) (|CharacteristicZero|) (|Module| 6)
                 (|Ring|) (|BiModule| 6 6) (|BiModule| 73 73)
                 (|BiModule| $$ $$) (|Rng|) (|LeftModule| 6) (|RightModule| 6)
                 (|LeftModule| $$) (|LeftModule| 73) (|RightModule| 73)
                 (|RightModule| $$) (|AbelianGroup|)
                 (|CancellationAbelianMonoid|) (|SemiRing|) (|AbelianMonoid|)
                 (|Monoid|) (|SemiRng|) (|SemiGroup|) (|AbelianSemiGroup|)
                 (|FullyRetractableTo| 6) (|SetCategory|) (|RetractableTo| 6)
                 (|unitsKnown|) (|BasicType|) (|CoercibleTo| 80)
                 (|CommutativeStar|) (|noZeroDivisors|) (|RetractableTo| 73)
                 (|RetractableTo| 37) (|canonicalUnitNormal|))
              (|makeByteWordVec2| 81
                                  '(0 7 0 9 0 6 0 10 0 6 12 13 1 8 17 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 8 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 12 51 2 0 0 0 52 53 2 6 0 0 12 54 2 7 0
                                    12 0 55 3 0 0 0 0 12 56 2 6 25 0 0 57 1 6 0
                                    0 58 1 0 59 0 60 1 0 0 0 61 1 6 59 0 62 2 6
                                    25 0 0 63 2 6 32 0 0 64 2 0 25 0 0 65 2 0
                                    25 0 0 66 2 0 32 0 6 67 1 6 0 0 68 4 0 0 0
                                    7 6 0 69 2 7 32 0 0 70 2 0 32 0 0 71 2 0 0
                                    0 6 72 2 0 25 0 0 1 1 0 25 0 1 1 2 59 0 60
                                    1 2 0 0 61 1 2 25 0 1 2 0 32 0 0 1 0 0 0 1
                                    1 7 74 0 1 1 8 75 0 1 1 0 27 0 28 1 7 73 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 12 0 15 1 0 25 0 1 2 0 0 6 7 1 1 0 7 0 19
                                    2 0 0 76 0 1 2 0 0 78 0 1 1 0 0 0 23 1 0 6
                                    0 21 1 0 79 0 1 1 0 81 0 1 1 0 25 0 40 1 0
                                    6 0 1 4 12 0 0 7 6 0 69 2 2 32 0 6 67 2 2
                                    32 0 0 71 1 0 7 0 16 1 11 6 0 1 1 13 0 73 1
                                    1 2 0 0 1 1 0 0 6 34 1 0 0 37 39 1 0 80 0 1
                                    1 0 77 0 1 2 0 6 0 7 31 1 5 32 0 1 0 0 12
                                    14 3 3 0 0 0 12 56 2 2 25 0 0 66 2 0 0 0 12
                                    51 2 0 0 0 52 53 0 0 0 22 0 0 0 11 2 0 25 0
                                    0 65 2 10 0 0 6 72 1 0 0 0 1 2 0 0 0 0 1 2
                                    0 0 0 0 1 2 1 0 73 0 1 2 1 0 0 73 1 2 0 0 6
                                    0 48 2 0 0 0 6 49 2 0 0 37 0 1 2 0 0 0 0 50
                                    2 0 0 12 0 1 2 0 0 52 0 1)))))
           '|lookupComplete|)) 
