
(/VERSIONCHECK 2) 

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

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

(PUT '|XPR;#;$Nni;3| '|SPADreplace| 'LENGTH) 

(DEFUN |XPR;#;$Nni;3| (|x| $) (LENGTH |x|)) 

(DEFUN |XPR;maxdeg;$E;4| (|p| $)
  (COND ((NULL |p|) (|error| "zero polynomial !!"))
        ('T (QCAR (|SPADfirst| |p|))))) 

(DEFUN |XPR;mindeg;$E;5| (|p| $)
  (COND ((NULL |p|) (|error| "zero polynomial !!"))
        ('T (QCAR (SPADCALL |p| (QREFELT $ 18)))))) 

(DEFUN |XPR;coef;$ER;6| (|p| |e| $)
  (PROG (#1=#:G1825 #2=#:G1829 #3=#:G1830 |tm|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (SEQ (LETT |tm| NIL . #4=(|XPR;coef;$ER;6|)) (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 $ 21))
                 (PROGN (LETT #2# (QCDR |tm|) . #4#) (GO #2#)))
                ('T
                 (SEQ
                  (EXIT
                   (COND
                    ((SPADCALL (QCAR |tm|) |e| (QREFELT $ 22))
                     (PROGN
                      (LETT #1#
                            (PROGN
                             (LETT #2# (|spadConstant| $ 23) . #4#)
                             (GO #2#))
                            . #4#)
                      (GO #1#)))))
                  #1# (EXIT #1#))))))
             (LETT #3# (CDR #3#) . #4#) (GO G190) G191 (EXIT NIL))
        (EXIT (|spadConstant| $ 23))))
      #2# (EXIT #2#))))) 

(DEFUN |XPR;constant?;$B;7| (|p| $)
  (COND ((SPADCALL |p| (|spadConstant| $ 25) (QREFELT $ 26)) 'T)
        ('T
         (SPADCALL (SPADCALL |p| (QREFELT $ 16)) (|spadConstant| $ 9)
                   (QREFELT $ 21))))) 

(DEFUN |XPR;constant;$R;8| (|p| $)
  (SPADCALL |p| (|spadConstant| $ 9) (QREFELT $ 24))) 

(DEFUN |XPR;quasiRegular?;$B;9| (|p| $)
  (COND
   ((OR (SPADCALL |p| (|spadConstant| $ 25) (QREFELT $ 26))
        (NULL
         (SPADCALL (QCAR (SPADCALL |p| (QREFELT $ 18))) (|spadConstant| $ 9)
                   (QREFELT $ 21))))
    'T)
   ('T 'NIL))) 

(DEFUN |XPR;quasiRegular;2$;10| (|p| $)
  (PROG (#1=#:G1843 |t| #2=#:G1842)
    (RETURN
     (SEQ
      (COND ((SPADCALL |p| (QREFELT $ 29)) |p|)
            (#3='T
             (PROGN
              (LETT #2# NIL . #4=(|XPR;quasiRegular;2$;10|))
              (SEQ (LETT |t| NIL . #4#) (LETT #1# |p| . #4#) G190
                   (COND
                    ((OR (ATOM #1#) (PROGN (LETT |t| (CAR #1#) . #4#) NIL))
                     (GO G191)))
                   (SEQ
                    (EXIT
                     (COND
                      ((COND
                        ((SPADCALL (QCAR |t|) (|spadConstant| $ 9)
                                   (QREFELT $ 21))
                         'NIL)
                        (#3# 'T))
                       (LETT #2# (CONS |t| #2#) . #4#)))))
                   (LETT #1# (CDR #1#) . #4#) (GO G190) G191
                   (EXIT (NREVERSE0 #2#)))))))))) 

(DEFUN |XPR;recip;$U;11| (|p| $)
  (PROG (|u|)
    (RETURN
     (SEQ
      (COND
       ((OR (SPADCALL |p| (|spadConstant| $ 25) (QREFELT $ 26))
            (SPADCALL (|spadConstant| $ 9) (QCAR (|SPADfirst| |p|))
                      (QREFELT $ 22)))
        (CONS 1 "failed"))
       ('T
        (SEQ
         (LETT |u| (SPADCALL (QCDR (|SPADfirst| |p|)) (QREFELT $ 32))
               |XPR;recip;$U;11|)
         (EXIT
          (COND ((QEQCAR |u| 1) (CONS 1 "failed"))
                ('T (CONS 0 (SPADCALL (QCDR |u|) (QREFELT $ 33))))))))))))) 

(DEFUN |XPR;coerce;R$;12| (|r| $)
  (COND
   ((SPADCALL |r| (|spadConstant| $ 23) (QREFELT $ 35)) (|spadConstant| $ 25))
   ('T (LIST (CONS (|spadConstant| $ 9) |r|))))) 

(DEFUN |XPR;coerce;I$;13| (|n| $)
  (SPADCALL (SPADCALL |n| (QREFELT $ 37)) (QREFELT $ 33))) 

(DEFUN |XPR;*;3$;14| (|p1| |p2| $)
  (PROG (#1=#:G1863 #2=#:G1862 #3=#:G1864 #4=#:G1870 |t2| #5=#:G1869 #6=#:G1868
         |t1|)
    (RETURN
     (SEQ
      (COND ((OR (NULL |p1|) (NULL |p2|)) (|spadConstant| $ 25))
            ('T
             (COND
              ((SPADCALL (QCAR (|SPADfirst| |p1|)) (|spadConstant| $ 9)
                         (QREFELT $ 21))
               (SPADCALL (QCDR (|SPADfirst| |p1|)) |p2| (QREFELT $ 39)))
              ((SPADCALL |p2| (|spadConstant| $ 11) (QREFELT $ 26)) |p1|)
              (#7='T
               (PROGN
                (LETT #1# NIL . #8=(|XPR;*;3$;14|))
                (SEQ (LETT |t1| NIL . #8#) (LETT #6# |p1| . #8#) G190
                     (COND
                      ((OR (ATOM #6#) (PROGN (LETT |t1| (CAR #6#) . #8#) NIL))
                       #9=(GO G191)))
                     (SEQ
                      (EXIT
                       (PROGN
                        (LETT #3#
                              (PROGN
                               (LETT #5# NIL . #8#)
                               (SEQ (LETT |t2| NIL . #8#) (LETT #4# |p2| . #8#)
                                    G190
                                    (COND
                                     ((OR (ATOM #4#)
                                          (PROGN
                                           (LETT |t2| (CAR #4#) . #8#)
                                           NIL))
                                      #9#))
                                    (SEQ
                                     (EXIT
                                      (LETT #5#
                                            (CONS
                                             (CONS
                                              (SPADCALL (QCAR |t1|) (QCAR |t2|)
                                                        (QREFELT $ 40))
                                              (SPADCALL (QCDR |t1|) (QCDR |t2|)
                                                        (QREFELT $ 41)))
                                             #5#)
                                            . #8#)))
                                    (LETT #4# (CDR #4#) . #8#) #10=(GO G190)
                                    G191 (EXIT (NREVERSE0 #5#))))
                              . #8#)
                        (COND
                         (#1#
                          (LETT #2# (SPADCALL #2# #3# (QREFELT $ 42)) . #8#))
                         ('T
                          (PROGN (LETT #2# #3# . #8#) (LETT #1# 'T . #8#)))))))
                     (LETT #6# (CDR #6#) . #8#) #10# G191 (EXIT NIL))
                (COND (#1# #2#) (#7# (|spadConstant| $ 25)))))))))))) 

(DEFUN |XPR;*;3$;15| (|p1| |p2| $)
  (PROG (#1=#:G1873 #2=#:G1872 #3=#:G1874 |r| #4=#:G1881 |t2| #5=#:G1880
         #6=#:G1879 |t1|)
    (RETURN
     (SEQ
      (COND ((OR (NULL |p1|) (NULL |p2|)) (|spadConstant| $ 25))
            ('T
             (COND
              ((SPADCALL (QCAR (|SPADfirst| |p1|)) (|spadConstant| $ 9)
                         (QREFELT $ 21))
               (SPADCALL (QCDR (|SPADfirst| |p1|)) |p2| (QREFELT $ 39)))
              ((SPADCALL |p2| (|spadConstant| $ 11) (QREFELT $ 26)) |p1|)
              (#7='T
               (PROGN
                (LETT #1# NIL . #8=(|XPR;*;3$;15|))
                (SEQ (LETT |t1| NIL . #8#) (LETT #6# |p1| . #8#) G190
                     (COND
                      ((OR (ATOM #6#) (PROGN (LETT |t1| (CAR #6#) . #8#) NIL))
                       #9=(GO G191)))
                     (SEQ
                      (EXIT
                       (PROGN
                        (LETT #3#
                              (PROGN
                               (LETT #5# NIL . #8#)
                               (SEQ (LETT |t2| NIL . #8#) (LETT #4# |p2| . #8#)
                                    G190
                                    (COND
                                     ((OR (ATOM #4#)
                                          (PROGN
                                           (LETT |t2| (CAR #4#) . #8#)
                                           NIL))
                                      #9#))
                                    (SEQ
                                     (EXIT
                                      (COND
                                       ((SEQ
                                         (LETT |r|
                                               (SPADCALL (QCDR |t1|)
                                                         (QCDR |t2|)
                                                         (QREFELT $ 41))
                                               . #8#)
                                         (EXIT
                                          (COND
                                           ((SPADCALL |r| (|spadConstant| $ 23)
                                                      (QREFELT $ 35))
                                            'NIL)
                                           ('T 'T))))
                                        (LETT #5#
                                              (CONS
                                               (CONS
                                                (SPADCALL (QCAR |t1|)
                                                          (QCAR |t2|)
                                                          (QREFELT $ 40))
                                                |r|)
                                               #5#)
                                              . #8#)))))
                                    (LETT #4# (CDR #4#) . #8#) #10=(GO G190)
                                    G191 (EXIT (NREVERSE0 #5#))))
                              . #8#)
                        (COND
                         (#1#
                          (LETT #2# (SPADCALL #2# #3# (QREFELT $ 42)) . #8#))
                         ('T
                          (PROGN (LETT #2# #3# . #8#) (LETT #1# 'T . #8#)))))))
                     (LETT #6# (CDR #6#) . #8#) #10# G191 (EXIT NIL))
                (COND (#1# #2#) (#7# (|spadConstant| $ 25)))))))))))) 

(DEFUN |XPR;^;$Nni$;16| (|p| |nn| $) (|XPR;repeatMultExpt| |p| |nn| $)) 

(DEFUN |XPR;repeatMultExpt| (|x| |nn| $)
  (PROG (|y| |i|)
    (RETURN
     (SEQ
      (COND ((EQL |nn| 0) (|spadConstant| $ 11))
            ('T
             (SEQ (LETT |y| |x| . #1=(|XPR;repeatMultExpt|))
                  (SEQ (LETT |i| 2 . #1#) G190
                       (COND ((QSGREATERP |i| |nn|) (GO G191)))
                       (SEQ
                        (EXIT
                         (LETT |y| (SPADCALL |x| |y| (QREFELT $ 43)) . #1#)))
                       (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191 (EXIT NIL))
                  (EXIT |y|)))))))) 

(DEFUN |XPR;outTerm| (|r| |m| $)
  (COND
   ((SPADCALL |r| (|spadConstant| $ 10) (QREFELT $ 35))
    (SPADCALL |m| (QREFELT $ 46)))
   ((SPADCALL |m| (|spadConstant| $ 9) (QREFELT $ 21))
    (SPADCALL |r| (QREFELT $ 47)))
   ('T
    (SPADCALL (SPADCALL |r| (QREFELT $ 47)) (SPADCALL |m| (QREFELT $ 46))
              (QREFELT $ 48))))) 

(DEFUN |XPR;coerce;$Of;19| (|a| $)
  (PROG (#1=#:G1894 |t| #2=#:G1893)
    (RETURN
     (SEQ
      (COND ((NULL |a|) (SPADCALL (|spadConstant| $ 23) (QREFELT $ 47)))
            ('T
             (SPADCALL (ELT $ 49)
                       (NREVERSE
                        (PROGN
                         (LETT #2# NIL . #3=(|XPR;coerce;$Of;19|))
                         (SEQ (LETT |t| NIL . #3#) (LETT #1# |a| . #3#) G190
                              (COND
                               ((OR (ATOM #1#)
                                    (PROGN (LETT |t| (CAR #1#) . #3#) NIL))
                                (GO G191)))
                              (SEQ
                               (EXIT
                                (LETT #2#
                                      (CONS
                                       (|XPR;outTerm| (QCDR |t|) (QCAR |t|) $)
                                       #2#)
                                      . #3#)))
                              (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                              (EXIT (NREVERSE0 #2#)))))
                       (QREFELT $ 52)))))))) 

(DEFUN |XPR;/;$R$;20| (|x| |r| $)
  (SPADCALL (SPADCALL |r| (QREFELT $ 54)) |x| (QREFELT $ 39))) 

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

(DEFUN |XPolynomialRing;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|XPolynomialRing|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|XPolynomialRing| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 65) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (|HasCategory| |#1|
                                                         '(|canonicalUnitNormal|))
                                          (|HasCategory| |#1|
                                                         '(|noZeroDivisors|))
                                          (|HasCategory| |#1|
                                                         '(|CommutativeRing|))
                                          (|HasCategory| |#1| '(|Field|))
                                          (|HasCategory| |#1|
                                                         '(|unitsKnown|))))
                      . #1#))
      (|haddProp| |$ConstructorCache| '|XPolynomialRing| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 (|List| (|Record| (|:| |k| |#2|) (|:| |c| |#1|))))
      (COND
       ((|testBitVector| |pv$| 2)
        (QSETREFV $ 43 (CONS (|dispatchFunction| |XPR;*;3$;14|) $)))
       ('T (QSETREFV $ 43 (CONS (|dispatchFunction| |XPR;*;3$;15|) $))))
      (COND
       ((|testBitVector| |pv$| 4)
        (QSETREFV $ 55 (CONS (|dispatchFunction| |XPR;/;$R$;20|) $))))
      $)))) 

(MAKEPROP '|XPolynomialRing| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL (|FreeModule| 6 7) (|local| |#1|)
              (|local| |#2|) '|Rep| (0 . |One|) (4 . |One|)
              (CONS IDENTITY (FUNCALL (|dispatchFunction| |XPR;One;$;1|) $))
              (|NonNegativeInteger|) (8 . |characteristic|)
              |XPR;characteristic;Nni;2| |XPR;#;$Nni;3| |XPR;maxdeg;$E;4|
              (|Record| (|:| |k| 7) (|:| |c| 6)) (12 . |last|)
              |XPR;mindeg;$E;5| (|Boolean|) (17 . =) (23 . <) (29 . |Zero|)
              |XPR;coef;$ER;6| (33 . |Zero|) (37 . =) |XPR;constant?;$B;7|
              |XPR;constant;$R;8| |XPR;quasiRegular?;$B;9|
              |XPR;quasiRegular;2$;10| (|Union| $ '"failed") (43 . |recip|)
              |XPR;coerce;R$;12| |XPR;recip;$U;11| (48 . =) (|Integer|)
              (54 . |coerce|) |XPR;coerce;I$;13| (59 . *) (65 . *) (71 . *)
              (77 . +) (83 . *) |XPR;^;$Nni$;16| (|OutputForm|) (89 . |coerce|)
              (94 . |coerce|) (99 . *) (105 . +) (|Mapping| 45 45 45)
              (|List| 45) (111 . |reduce|) |XPR;coerce;$Of;19| (117 . |inv|)
              (122 . /) (|Union| 7 '"failed") (|List| 17) (|Mapping| 6 6)
              (|List| 6) (|List| $) (|List| 7) (|PositiveInteger|) (|String|)
              (|SingleInteger|))
           '#(|recip| 128 |quasiRegular?| 133 |quasiRegular| 138 |mindeg| 143
              |maxdeg| 148 |constant?| 153 |constant| 158 |coerce| 163 |coef|
              178 |characteristic| 184 ^ 188 |Zero| 194 |One| 198 = 202 / 208 +
              214 * 220 |#| 232)
           'NIL
           (CONS
            (|makeByteWordVec2| 3
                                '(0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
                                  0 1 2))
            (CONS
             '#(NIL NIL |Algebra&| |Module&| NIL |Ring&| NIL NIL NIL NIL
                |AbelianGroup&| NIL NIL |AbelianMonoid&| |Monoid&| NIL NIL
                |SemiGroup&| |AbelianSemiGroup&| |SetCategory&|
                |RetractableTo&| NIL |BasicType&| NIL NIL NIL)
             (CONS
              '#((|XAlgebra| 6) (|FreeModuleCategory| 6 7) (|Algebra| 6)
                 (|Module| 6) (|BiModule| 6 6) (|Ring|) (|LeftModule| 6)
                 (|Rng|) (|RightModule| 6) (|LeftModule| $$) (|AbelianGroup|)
                 (|CancellationAbelianMonoid|) (|SemiRing|) (|AbelianMonoid|)
                 (|Monoid|) (|SemiRng|) (|IndexedDirectProductCategory| 6 7)
                 (|SemiGroup|) (|AbelianSemiGroup|) (|SetCategory|)
                 (|RetractableTo| 7) (|unitsKnown|) (|BasicType|)
                 (|CoercibleTo| 45) (|canonicalUnitNormal|) (|noZeroDivisors|))
              (|makeByteWordVec2| 55
                                  '(0 7 0 9 0 6 0 10 0 6 12 13 1 8 17 0 18 2 7
                                    20 0 0 21 2 7 20 0 0 22 0 6 0 23 0 0 0 25 2
                                    0 20 0 0 26 1 6 31 0 32 2 6 20 0 0 35 1 6 0
                                    36 37 2 0 0 6 0 39 2 7 0 0 0 40 2 6 0 0 0
                                    41 2 0 0 0 0 42 2 0 0 0 0 43 1 7 45 0 46 1
                                    6 45 0 47 2 45 0 0 0 48 2 45 0 0 0 49 2 51
                                    45 50 0 52 1 6 0 0 54 2 0 0 0 6 55 1 0 31 0
                                    34 1 0 20 0 29 1 0 0 0 30 1 0 7 0 19 1 0 7
                                    0 16 1 0 20 0 27 1 0 6 0 28 1 0 0 36 38 1 0
                                    0 6 33 1 0 45 0 53 2 0 6 0 7 24 0 0 12 14 2
                                    0 0 0 12 44 0 0 0 25 0 0 0 11 2 0 20 0 0 26
                                    2 4 0 0 6 55 2 0 0 0 0 42 2 0 0 6 0 39 2 0
                                    0 0 0 43 1 0 12 0 15)))))
           '|lookupIncomplete|)) 
