
(/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 (|r| |newcell| |endcell| |end| |res|)
    (RETURN
      (SEQ (COND
             ((NULL |x|) |y|)
             ((NULL |y|) |x|)
             ('T
              (SEQ (LETT |endcell| NIL . #0=(|IDPAM;+;3$;4|))
                   (LETT |res| NIL . #0#)
                   (SEQ G190
                        (COND
                          ((NULL (COND
                                   ((OR (NULL |x|) (NULL |y|)) 'NIL)
                                   ('T 'T)))
                           (GO G191)))
                        (SEQ (LETT |newcell| NIL . #0#)
                             (COND
                               ((SPADCALL (QCAR (|SPADfirst| |x|))
                                    (QCAR (|SPADfirst| |y|))
                                    (QREFELT $ 13))
                                (SEQ (LETT |r|
                                      (SPADCALL
                                       (QCDR (|SPADfirst| |x|))
                                       (QCDR (|SPADfirst| |y|))
                                       (QREFELT $ 14)) . #0#)
                                     (COND
                                       ((NULL
                                         (SPADCALL |r| (QREFELT $ 15)))
                                        (LETT |newcell|
                                         (CONS
                                          (CONS
                                           (QCAR (|SPADfirst| |x|))
                                           |r|)
                                          NIL) . #0#)))
                                     (LETT |x| (CDR |x|) . #0#)
                                     (EXIT (LETT |y| (CDR |y|) . #0#))))
                               ((SPADCALL (QCAR (|SPADfirst| |y|))
                                    (QCAR (|SPADfirst| |x|))
                                    (QREFELT $ 16))
                                (SEQ (LETT |newcell|
                                      (CONS (|SPADfirst| |x|) NIL) . #0#)
                                     (EXIT (LETT |x| (CDR |x|) . #0#))))
                               ('T
                                (SEQ (LETT |newcell|
                                      (CONS (|SPADfirst| |y|) NIL) . #0#)
                                     (EXIT (LETT |y| (CDR |y|) . #0#)))))
                             (EXIT (COND
                                     ((NULL (NULL |newcell|))
                                      (COND
                                        ((NULL |endcell|)
                                         (SEQ
                                          (LETT |res| |newcell| . #0#)
                                          (EXIT
                                           (LETT |endcell| |res| . #0#))))
                                        ('T
                                         (SEQ
                                          (|IDPAM;qsetrest!| |endcell|
                                           |newcell| $)
                                          (EXIT
                                           (LETT |endcell|
                                            |newcell| . #0#)))))))))
                        NIL (GO G190) G191 (EXIT NIL))
                   (COND
                     ((NULL |x|) (LETT |end| |y| . #0#))
                     ('T (LETT |end| |x| . #0#)))
                   (COND
                     ((NULL |res|) (LETT |res| |end| . #0#))
                     ('T (|IDPAM;qsetrest!| |endcell| |end| $)))
                   (EXIT |res|)))))))) 

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

(DEFUN |IDPAM;monomial;AS$;6| (|r| |s| $)
  (COND
    ((SPADCALL |r| (|spadConstant| $ 18) (QREFELT $ 21))
     (|spadConstant| $ 10))
    ('T (LIST (CONS |s| |r|))))) 

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

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

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

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

(DEFUN |IndexedDirectProductAbelianMonoid;| (|#1| |#2|)
  (PROG (DV$1 DV$2 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|)
              . #0=(|IndexedDirectProductAbelianMonoid|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT |dv$|
              (LIST '|IndexedDirectProductAbelianMonoid| DV$1 DV$2) . #0#)
        (LETT $ (GETREFV 32) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache|
            '|IndexedDirectProductAbelianMonoid| (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)))
        $)))) 

(MAKEPROP '|IndexedDirectProductAbelianMonoid| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL (|IndexedDirectProductObject| 6 7)
             (|local| |#1|) (|local| |#2|) '|Term| '|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|
             (|PositiveInteger|) (|String|) (|OutputForm|)
             (|SingleInteger|))
          '#(|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| 30))
                            (|makeByteWordVec2| 27
                                '(2 7 11 0 0 13 2 6 0 0 0 14 1 6 11 0
                                  15 2 7 11 0 0 16 0 6 0 18 2 6 0 19 0
                                  20 2 6 11 0 0 21 1 0 11 0 12 1 0 0 0
                                  26 2 0 0 6 7 23 2 0 0 24 0 25 1 0 6 0
                                  27 0 0 0 10 2 0 0 0 0 17 2 0 0 19 0
                                  22)))))
          '|lookupIncomplete|)) 
