
(/VERSIONCHECK 2) 

(DEFUN |REDORDER;localbinom| (|j| |i| $)
  (COND ((< |i| |j|) (SPADCALL |j| (+ |i| 1) (QREFELT $ 13))) ('T 0))) 

(DEFUN |REDORDER;locals| (|s| |j| |i| $)
  (COND ((< |i| |j|) (QAREF1 |s| (- (- |j| |i|) 1)))
        ('T (|spadConstant| $ 14)))) 

(DEFUN |REDORDER;ReduceOrder;LLR;3| (|l| |sols| $)
  (PROG (|rec| #1=#:G1820 |s| #2=#:G1819 |neweq| |sol|)
    (RETURN
     (SEQ
      (COND ((NULL |sols|) (CONS |l| NIL))
            ('T
             (SEQ
              (LETT |neweq|
                    (SPADCALL |l|
                              (LETT |sol| (|SPADfirst| |sols|)
                                    . #3=(|REDORDER;ReduceOrder;LLR;3|))
                              (QREFELT $ 15))
                    . #3#)
              (LETT |rec|
                    (SPADCALL |neweq|
                              (PROGN
                               (LETT #2# NIL . #3#)
                               (SEQ (LETT |s| NIL . #3#)
                                    (LETT #1# (CDR |sols|) . #3#) G190
                                    (COND
                                     ((OR (ATOM #1#)
                                          (PROGN
                                           (LETT |s| (CAR #1#) . #3#)
                                           NIL))
                                      (GO G191)))
                                    (SEQ
                                     (EXIT
                                      (LETT #2#
                                            (CONS
                                             (SPADCALL (QREFELT $ 9)
                                                       (SPADCALL |s| |sol|
                                                                 (QREFELT $
                                                                          16))
                                                       (QREFELT $ 17))
                                             #2#)
                                            . #3#)))
                                    (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                                    (EXIT (NREVERSE0 #2#))))
                              (QREFELT $ 20))
                    . #3#)
              (EXIT
               (CONS (QCAR |rec|)
                     (SPADCALL (QCDR |rec|) |sol| (QREFELT $ 21))))))))))) 

(DEFUN |REDORDER;ithcoef| (|eq| |i| |s| $)
  (PROG (|ans| |j|)
    (RETURN
     (SEQ (LETT |ans| (|spadConstant| $ 14) . #1=(|REDORDER;ithcoef|))
          (SEQ G190
               (COND
                ((NULL
                  (COND
                   ((SPADCALL |eq| (|spadConstant| $ 22) (QREFELT $ 24)) 'NIL)
                   ('T 'T)))
                 (GO G191)))
               (SEQ (LETT |j| (SPADCALL |eq| (QREFELT $ 26)) . #1#)
                    (LETT |ans|
                          (SPADCALL |ans|
                                    (SPADCALL
                                     (SPADCALL
                                      (|REDORDER;localbinom| |j| |i| $)
                                      (|REDORDER;locals| |s| |j| |i| $)
                                      (QREFELT $ 27))
                                     (SPADCALL |eq| (QREFELT $ 28))
                                     (QREFELT $ 29))
                                    (QREFELT $ 30))
                          . #1#)
                    (EXIT (LETT |eq| (SPADCALL |eq| (QREFELT $ 31)) . #1#)))
               NIL (GO G190) G191 (EXIT NIL))
          (EXIT |ans|))))) 

(DEFUN |REDORDER;ReduceOrder;LFL;5| (|eq| |sol| $)
  (PROG (|ans| #1=#:G1835 #2=#:G1830 |i| |si| #3=#:G1834 #4=#:G1827 |s| |n|)
    (RETURN
     (SEQ
      (LETT |s|
            (MAKEARR1
             (LETT |n| (SPADCALL |eq| (QREFELT $ 26))
                   . #5=(|REDORDER;ReduceOrder;LFL;5|))
             (|spadConstant| $ 14))
            . #5#)
      (LETT |si| |sol| . #5#) (QSETAREF1 |s| 0 |si|)
      (SEQ (LETT |i| 1 . #5#)
           (LETT #3#
                 (PROG1 (LETT #4# (- |n| 1) . #5#)
                   (|check-subtype| (>= #4# 0) '(|NonNegativeInteger|) #4#))
                 . #5#)
           G190 (COND ((QSGREATERP |i| #3#) #6=(GO G191)))
           (SEQ
            (EXIT
             (QSETAREF1 |s| |i|
                        (LETT |si| (SPADCALL (QREFELT $ 9) |si| (QREFELT $ 17))
                              . #5#))))
           (LETT |i| (QSADD1 |i|) . #5#) #7=(GO G190) G191 (EXIT NIL))
      (LETT |ans| (|spadConstant| $ 22) . #5#)
      (SEQ (LETT |i| 0 . #5#)
           (LETT #1#
                 (PROG1 (LETT #2# (- |n| 1) . #5#)
                   (|check-subtype| (>= #2# 0) '(|NonNegativeInteger|) #2#))
                 . #5#)
           G190 (COND ((QSGREATERP |i| #1#) #6#))
           (SEQ
            (EXIT
             (LETT |ans|
                   (SPADCALL |ans|
                             (SPADCALL (|REDORDER;ithcoef| |eq| |i| |s| $) |i|
                                       (QREFELT $ 32))
                             (QREFELT $ 33))
                   . #5#)))
           (LETT |i| (QSADD1 |i|) . #5#) #7# G191 (EXIT NIL))
      (EXIT |ans|))))) 

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

(DEFUN |ReductionOfOrder;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|ReductionOfOrder|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|ReductionOfOrder| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 34) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|ReductionOfOrder| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 9 (SPADCALL (QREFELT $ 8)))
      $)))) 

(MAKEPROP '|ReductionOfOrder| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (0 . D)
              '|diff| (4 . |One|) (8 . |One|) (|Integer|) (12 . |binomial|)
              (18 . |Zero|) |REDORDER;ReduceOrder;LFL;5| (22 . /) (28 . |elt|)
              (|Record| (|:| |eq| 7) (|:| |op| 19)) (|List| 6)
              |REDORDER;ReduceOrder;LLR;3| (34 . |concat!|) (40 . |Zero|)
              (|Boolean|) (44 . =) (|NonNegativeInteger|) (50 . |degree|)
              (55 . *) (61 . |leadingCoefficient|) (66 . *) (72 . +)
              (78 . |reductum|) (83 . |monomial|) (89 . +))
           '#(|ReduceOrder| 95) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 33
                                                 '(0 7 0 8 0 6 0 10 0 7 0 11 2
                                                   12 0 0 0 13 0 6 0 14 2 6 0 0
                                                   0 16 2 7 6 0 6 17 2 19 0 0 6
                                                   21 0 7 0 22 2 7 23 0 0 24 1
                                                   7 25 0 26 2 6 0 12 0 27 1 7
                                                   6 0 28 2 6 0 0 0 29 2 6 0 0
                                                   0 30 1 7 0 0 31 2 7 0 6 25
                                                   32 2 7 0 0 0 33 2 0 18 7 19
                                                   20 2 0 7 7 6 15)))))
           '|lookupComplete|)) 
