
(/VERSIONCHECK 2) 

(PUT '|IDPAM;Zero;$;1| '|SPADreplace| '(XLAM NIL NIL)) 

(DEFUN |IDPAM;Zero;$;1| ($) NIL) 

(PUT '|IDPAM;zero?;$B;2| '|SPADreplace| 'NULL) 

(DEFUN |IDPAM;zero?;$B;2| (|x| $) (NULL |x|)) 

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

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

(DEFUN |IDPAM;+;3$;4| (|x| |y| $)
  (PROG (|res| |end| |endcell| |newcell| |r|)
    (RETURN
     (SEQ
      (COND ((NULL |x|) |y|) ((NULL |y|) |x|)
            (#1='T
             (SEQ (LETT |endcell| NIL . #2=(|IDPAM;+;3$;4|))
                  (LETT |res| NIL . #2#)
                  (SEQ G190
                       (COND
                        ((NULL
                          (COND ((OR (NULL |x|) (NULL |y|)) 'NIL) ('T 'T)))
                         (GO G191)))
                       (SEQ (LETT |newcell| NIL . #2#)
                            (COND
                             ((SPADCALL (QCAR (|SPADfirst| |x|))
                                        (QCAR (|SPADfirst| |y|))
                                        (QREFELT $ 12))
                              (SEQ
                               (LETT |r|
                                     (SPADCALL (QCDR (|SPADfirst| |x|))
                                               (QCDR (|SPADfirst| |y|))
                                               (QREFELT $ 13))
                                     . #2#)
                               (COND
                                ((NULL (SPADCALL |r| (QREFELT $ 14)))
                                 (LETT |newcell|
                                       (CONS
                                        (CONS (QCAR (|SPADfirst| |x|)) |r|)
                                        NIL)
                                       . #2#)))
                               (LETT |x| (CDR |x|) . #2#)
                               (EXIT (LETT |y| (CDR |y|) . #2#))))
                             ((SPADCALL (QCAR (|SPADfirst| |y|))
                                        (QCAR (|SPADfirst| |x|))
                                        (QREFELT $ 15))
                              (SEQ
                               (LETT |newcell| (CONS (|SPADfirst| |x|) NIL)
                                     . #2#)
                               (EXIT (LETT |x| (CDR |x|) . #2#))))
                             ('T
                              (SEQ
                               (LETT |newcell| (CONS (|SPADfirst| |y|) NIL)
                                     . #2#)
                               (EXIT (LETT |y| (CDR |y|) . #2#)))))
                            (EXIT
                             (COND
                              ((NULL (NULL |newcell|))
                               (COND
                                ((NULL |endcell|)
                                 (SEQ (LETT |res| |newcell| . #2#)
                                      (EXIT (LETT |endcell| |res| . #2#))))
                                ('T
                                 (SEQ (|IDPAM;qsetrest!| |endcell| |newcell| $)
                                      (EXIT
                                       (LETT |endcell| |newcell| . #2#)))))))))
                       NIL (GO G190) G191 (EXIT NIL))
                  (COND ((NULL |x|) (LETT |end| |y| . #2#))
                        (#1# (LETT |end| |x| . #2#)))
                  (COND ((NULL |res|) (LETT |res| |end| . #2#))
                        (#1# (|IDPAM;qsetrest!| |endcell| |end| $)))
                  (EXIT |res|)))))))) 

(DEFUN |IDPAM;*;Nni2$;5| (|n| |x| $)
  (PROG (|a| #1=#:G1839 |u| #2=#:G1838)
    (RETURN
     (SEQ
      (COND ((EQL |n| 0) (|spadConstant| $ 9)) ((EQL |n| 1) |x|)
            (#3='T
             (PROGN
              (LETT #2# NIL . #4=(|IDPAM;*;Nni2$;5|))
              (SEQ (LETT |u| NIL . #4#) (LETT #1# |x| . #4#) G190
                   (COND
                    ((OR (ATOM #1#) (PROGN (LETT |u| (CAR #1#) . #4#) NIL))
                     (GO G191)))
                   (SEQ
                    (EXIT
                     (COND
                      ((SEQ
                        (LETT |a| (SPADCALL |n| (QCDR |u|) (QREFELT $ 19))
                              . #4#)
                        (EXIT
                         (COND
                          ((SPADCALL |a| (|spadConstant| $ 17) (QREFELT $ 20))
                           'NIL)
                          (#3# 'T))))
                       (LETT #2# (CONS (CONS (QCAR |u|) |a|) #2#) . #4#)))))
                   (LETT #1# (CDR #1#) . #4#) (GO G190) G191
                   (EXIT (NREVERSE0 #2#)))))))))) 

(DEFUN |IDPAM;monomial;AS$;6| (|r| |s| $)
  (COND
   ((SPADCALL |r| (|spadConstant| $ 17) (QREFELT $ 20)) (|spadConstant| $ 9))
   ('T (LIST (CONS |s| |r|))))) 

(DEFUN |IDPAM;map;M2$;7| (|f| |x| $)
  (PROG (|a| #1=#:G1848 |tm| #2=#:G1847)
    (RETURN
     (SEQ
      (PROGN
       (LETT #2# NIL . #3=(|IDPAM;map;M2$;7|))
       (SEQ (LETT |tm| NIL . #3#) (LETT #1# |x| . #3#) G190
            (COND
             ((OR (ATOM #1#) (PROGN (LETT |tm| (CAR #1#) . #3#) NIL))
              (GO G191)))
            (SEQ
             (EXIT
              (COND
               ((SEQ (LETT |a| (SPADCALL (QCDR |tm|) |f|) . #3#)
                     (EXIT
                      (COND
                       ((SPADCALL |a| (|spadConstant| $ 17) (QREFELT $ 20))
                        'NIL)
                       ('T 'T))))
                (LETT #2# (CONS (CONS (QCAR |tm|) |a|) #2#) . #3#)))))
            (LETT #1# (CDR #1#) . #3#) (GO G190) G191
            (EXIT (NREVERSE0 #2#)))))))) 

(DEFUN |IDPAM;reductum;2$;8| (|x| $)
  (COND ((NULL |x|) (|spadConstant| $ 9)) ('T (CDR |x|)))) 

(DEFUN |IDPAM;leadingCoefficient;$A;9| (|x| $)
  (COND ((NULL |x|) (|spadConstant| $ 17)) ('T (QCDR (|SPADfirst| |x|))))) 

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

(DEFUN |IndexedDirectProductAbelianMonoid;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|IndexedDirectProductAbelianMonoid|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|IndexedDirectProductAbelianMonoid| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 33) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|IndexedDirectProductAbelianMonoid|
                  (LIST DV$1 DV$2) (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 (|List| (|Record| (|:| |k| |#2|) (|:| |c| |#1|))))
      $)))) 

(MAKEPROP '|IndexedDirectProductAbelianMonoid| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL (|IndexedDirectProductObject| 6 7)
              (|local| |#1|) (|local| |#2|) '|Rep|
              (CONS IDENTITY (FUNCALL (|dispatchFunction| |IDPAM;Zero;$;1|) $))
              (|Boolean|) |IDPAM;zero?;$B;2| (0 . =) (6 . +) (12 . |zero?|)
              (17 . <) |IDPAM;+;3$;4| (23 . |Zero|) (|NonNegativeInteger|)
              (27 . *) (33 . =) |IDPAM;*;Nni2$;5| |IDPAM;monomial;AS$;6|
              (|Mapping| 6 6) |IDPAM;map;M2$;7| |IDPAM;reductum;2$;8|
              |IDPAM;leadingCoefficient;$A;9|
              (|Record| (|:| |k| 7) (|:| |c| 6)) (|List| 27)
              (|PositiveInteger|) (|SingleInteger|) (|String|) (|OutputForm|))
           '#(|zero?| 39 |reductum| 44 |monomial| 49 |map| 55
              |leadingCoefficient| 61 |Zero| 66 + 70 * 76)
           'NIL
           (CONS (|makeByteWordVec2| 1 '(0 0 0 0 0 0))
                 (CONS
                  '#(|AbelianMonoid&| |AbelianSemiGroup&| NIL |SetCategory&|
                     |BasicType&| NIL)
                  (CONS
                   '#((|AbelianMonoid|) (|AbelianSemiGroup|)
                      (|IndexedDirectProductCategory| 6 7) (|SetCategory|)
                      (|BasicType|) (|CoercibleTo| 32))
                   (|makeByteWordVec2| 26
                                       '(2 7 10 0 0 12 2 6 0 0 0 13 1 6 10 0 14
                                         2 7 10 0 0 15 0 6 0 17 2 6 0 18 0 19 2
                                         6 10 0 0 20 1 0 10 0 11 1 0 0 0 25 2 0
                                         0 6 7 22 2 0 0 23 0 24 1 0 6 0 26 0 0
                                         0 9 2 0 0 0 0 16 2 0 0 18 0 21)))))
           '|lookupIncomplete|)) 
