
(/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|) (ELT |s| (- (- |j| |i|) 1)))
    ('T (|spadConstant| $ 14)))) 

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

(DEFUN |REDORDER;ithcoef| (|eq| |i| |s| $)
  (PROG (|j| |ans|)
    (RETURN
      (SEQ (LETT |ans| (|spadConstant| $ 14) . #0=(|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)) . #0#)
                     (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)) . #0#)
                     (EXIT (LETT |eq|
                                 (SPADCALL |eq| (QREFELT $ 31)) . #0#)))
                NIL (GO G190) G191 (EXIT NIL))
           (EXIT |ans|))))) 

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

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

(DEFUN |ReductionOfOrder;| (|#1| |#2|)
  (PROG (DV$1 DV$2 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|ReductionOfOrder|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT |dv$| (LIST '|ReductionOfOrder| DV$1 DV$2) . #0#)
        (LETT $ (GETREFV 36) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|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|) (|PrimitiveArray| 6)
             (83 . |new|) (89 . |monomial|) (95 . +))
          '#(|ReduceOrder| 101) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 35
                                '(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 32 0 25 6 33 2 7 0 6 25 34 2 7 0 0
                                  0 35 2 0 18 7 19 20 2 0 7 7 6 15)))))
          '|lookupComplete|)) 
