
(/VERSIONCHECK 2) 

(DEFUN |DEGRED;degrees| (|u| $)
  (PROG (|l|)
    (RETURN
      (SEQ (LETT |l| NIL . #0=(|DEGRED;degrees|))
           (SEQ G190
                (COND
                  ((NULL (COND
                           ((SPADCALL |u| (|spadConstant| $ 11)
                                (QREFELT $ 13))
                            'NIL)
                           ('T 'T)))
                   (GO G191)))
                (SEQ (LETT |l|
                           (CONS (SPADCALL |u| (QREFELT $ 15)) |l|) . #0#)
                     (EXIT (LETT |u|
                                 (SPADCALL |u| (QREFELT $ 16)) . #0#)))
                NIL (GO G190) G191 (EXIT NIL))
           (EXIT |l|))))) 

(DEFUN |DEGRED;reduce;SupR;2| (|u| $)
  (PROG (|d| #0=#:G1836 #1=#:G1823 #2=#:G1821 #3=#:G1822 |g| #4=#:G1825
             #5=#:G1830 #6=#:G1832)
    (RETURN
      (SEQ (LETT |g|
                 (PROGN
                   (LETT #3# NIL . #7=(|DEGRED;reduce;SupR;2|))
                   (SEQ (LETT |d| NIL . #7#)
                        (LETT #0# (|DEGRED;degrees| |u| $) . #7#) G190
                        (COND
                          ((OR (ATOM #0#)
                               (PROGN (LETT |d| (CAR #0#) . #7#) NIL))
                           (GO G191)))
                        (SEQ (EXIT (PROGN
                                     (LETT #1# |d| . #7#)
                                     (COND
                                       (#3#
                                        (LETT #2# (GCD #2# #1#) . #7#))
                                       ('T
                                        (PROGN
                                          (LETT #2# #1# . #7#)
                                          (LETT #3# 'T . #7#)))))))
                        (LETT #0# (CDR #0#) . #7#) (GO G190) G191
                        (EXIT NIL))
                   (COND (#3# #2#) ('T 0))) . #7#)
           (LETT |u|
                 (PROG2 (LETT #5#
                              (SPADCALL |u|
                                  (PROG1 (LETT #4# |g| . #7#)
                                    (|check-subtype| (> #4# 0)
                                     '(|PositiveInteger|) #4#))
                                  (QREFELT $ 18)) . #7#)
                        (QCDR #5#)
                   (|check-union| (QEQCAR #5# 0)
                       (|SparseUnivariatePolynomial| (QREFELT $ 6))
                       #5#)) . #7#)
           (EXIT (CONS |u|
                       (PROG1 (LETT #6# |g| . #7#)
                         (|check-subtype| (> #6# 0)
                             '(|PositiveInteger|) #6#)))))))) 

(DEFUN |DEGRED;rootOfUnity| (|j| |n| $)
  (PROG (|arg|)
    (RETURN
      (SEQ (COND
             ((EQL |j| 0) (|spadConstant| $ 22))
             ('T
              (SEQ (LETT |arg|
                         (SPADCALL
                             (SPADCALL (SPADCALL 2 |j| (QREFELT $ 25))
                                 (SPADCALL (QREFELT $ 26))
                                 (QREFELT $ 27))
                             (SPADCALL |n| (QREFELT $ 28))
                             (QREFELT $ 29))
                         |DEGRED;rootOfUnity|)
                   (EXIT (SPADCALL (SPADCALL |arg| (QREFELT $ 30))
                             (SPADCALL
                                 (SPADCALL
                                     (SPADCALL (|spadConstant| $ 22)
                                      (QREFELT $ 36))
                                     (SPADCALL 1 2 (QREFELT $ 35))
                                     (QREFELT $ 37))
                                 (SPADCALL |arg| (QREFELT $ 38))
                                 (QREFELT $ 39))
                             (QREFELT $ 40)))))))))) 

(DEFUN |DEGRED;expand;EPiL;4| (|s| |g| $)
  (PROG (#0=#:G1841 |i| #1=#:G1842)
    (RETURN
      (SEQ (COND
             ((EQL |g| 1) (LIST |s|))
             ('T
              (PROGN
                (LETT #0# NIL . #2=(|DEGRED;expand;EPiL;4|))
                (SEQ (LETT |i| 0 . #2#) (LETT #1# (- |g| 1) . #2#) G190
                     (COND ((QSGREATERP |i| #1#) (GO G191)))
                     (SEQ (EXIT (LETT #0#
                                      (CONS
                                       (SPADCALL
                                        (|DEGRED;rootOfUnity| |i| |g|
                                         $)
                                        (SPADCALL |s|
                                         (SPADCALL 1 |g|
                                          (QREFELT $ 35))
                                         (QREFELT $ 37))
                                        (QREFELT $ 39))
                                       #0#) . #2#)))
                     (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191
                     (EXIT (NREVERSE0 #0#)))))))))) 

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

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

(MAKEPROP '|DegreeReductionPackage| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (0 . |Zero|) (4 . |Zero|) (|SparseUnivariatePolynomial| 6)
             (8 . |Zero|) (|Boolean|) (12 . =) (|NonNegativeInteger|)
             (18 . |degree|) (23 . |reductum|) (|Union| $ '"failed")
             (28 . |divideExponents|)
             (|Record| (|:| |pol| 10) (|:| |deg| 23))
             |DEGRED;reduce;SupR;2| (|Expression| 7) (34 . |One|)
             (|PositiveInteger|) (|Integer|) (38 . *) (44 . |pi|)
             (48 . *) (54 . |coerce|) (59 . /) (65 . |cos|)
             (70 . |One|) (74 . |One|) (78 . -) (|Fraction| 24)
             (83 . /) (89 . -) (94 . **) (100 . |sin|) (105 . *)
             (111 . +) (|List| 21) |DEGRED;expand;EPiL;4|)
          '#(|reduce| 117 |expand| 122) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 42
                                '(0 6 0 8 0 7 0 9 0 10 0 11 2 10 12 0 0
                                  13 1 10 14 0 15 1 10 0 0 16 2 10 17 0
                                  14 18 0 21 0 22 2 24 0 23 0 25 0 21 0
                                  26 2 21 0 24 0 27 1 21 0 24 28 2 21 0
                                  0 0 29 1 21 0 0 30 0 6 0 31 0 7 0 32
                                  1 6 0 0 33 2 34 0 24 24 35 1 21 0 0
                                  36 2 21 0 0 34 37 1 21 0 0 38 2 21 0
                                  0 0 39 2 21 0 0 0 40 1 0 19 10 20 2 0
                                  41 21 23 42)))))
          '|lookupComplete|)) 
