
(/VERSIONCHECK 2) 

(DEFUN |INTTOOLS;union;3L;1| (|l1| |l2| $) (SPADCALL |l1| |l2| (QREFELT $ 10))) 

(DEFUN |INTTOOLS;varselect;LSL;2| (|l| |x| $)
  (PROG (#1=#:G682 |k| #2=#:G681)
    (RETURN
     (SEQ
      (PROGN
       (LETT #2# NIL . #3=(|INTTOOLS;varselect;LSL;2|))
       (SEQ (LETT |k| NIL . #3#) (LETT #1# |l| . #3#) G190
            (COND
             ((OR (ATOM #1#) (PROGN (LETT |k| (CAR #1#) . #3#) NIL))
              (GO G191)))
            (SEQ
             (EXIT
              (COND
               ((SPADCALL |x|
                          (SPADCALL (SPADCALL |k| (QREFELT $ 13))
                                    (QREFELT $ 15))
                          (QREFELT $ 18))
                (LETT #2# (CONS |k| #2#) . #3#)))))
            (LETT #1# (CDR #1#) . #3#) (GO G190) G191
            (EXIT (NREVERSE0 #2#)))))))) 

(DEFUN |INTTOOLS;ksec;KLSK;3| (|k| |l| |x| $)
  (SPADCALL
   (SPADCALL (SPADCALL |k| |l| (QREFELT $ 21))
             (SPADCALL (SPADCALL |k| (QREFELT $ 23)) |x| (QREFELT $ 24))
             (QREFELT $ 10))
   (QREFELT $ 25))) 

(DEFUN |INTTOOLS;vark;LSL;4| (|l| |x| $)
  (PROG (#1=#:G689 |f| #2=#:G688)
    (RETURN
     (SEQ
      (SPADCALL
       (SPADCALL (ELT $ 10)
                 (PROGN
                  (LETT #2# NIL . #3=(|INTTOOLS;vark;LSL;4|))
                  (SEQ (LETT |f| NIL . #3#) (LETT #1# |l| . #3#) G190
                       (COND
                        ((OR (ATOM #1#) (PROGN (LETT |f| (CAR #1#) . #3#) NIL))
                         (GO G191)))
                       (SEQ
                        (EXIT
                         (LETT #2# (CONS (SPADCALL |f| (QREFELT $ 28)) #2#)
                               . #3#)))
                       (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                       (EXIT (NREVERSE0 #2#))))
                 NIL (QREFELT $ 31))
       |x| (QREFELT $ 19)))))) 

(DEFUN |INTTOOLS;kmax;LK;5| (|l| $)
  (PROG (|ans| #1=#:G694 |k|)
    (RETURN
     (SEQ (LETT |ans| (|SPADfirst| |l|) . #2=(|INTTOOLS;kmax;LK;5|))
          (SEQ (LETT |k| NIL . #2#) (LETT #1# (CDR |l|) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |k| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ
                (EXIT
                 (COND
                  ((|INTTOOLS;better?| |k| |ans| $) (LETT |ans| |k| . #2#)))))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |ans|))))) 

(DEFUN |INTTOOLS;better?| (|x| |y| $)
  (COND
   ((NULL (EQL (SPADCALL |y| (QREFELT $ 33)) (SPADCALL |x| (QREFELT $ 33))))
    (< (SPADCALL |y| (QREFELT $ 33)) (SPADCALL |x| (QREFELT $ 33))))
   ('T
    (COND
     ((SPADCALL (SPADCALL |y| (QREFELT $ 35)) (QREFELT $ 8) (QREFELT $ 36)) 'T)
     ((SPADCALL |y| '|exp| (QREFELT $ 37))
      (COND
       ((OR (SPADCALL |x| '|exp| (QREFELT $ 37))
            (SPADCALL (SPADCALL |x| (QREFELT $ 35)) (QREFELT $ 8)
                      (QREFELT $ 36)))
        'NIL)
       ('T 'T)))
     ('T 'NIL))))) 

(DEFUN |INTTOOLS;removeConstantTerm;FSF;7| (|f| |x| $)
  (PROG (|ans| #1=#:G714 |term| |u| |num| |den|)
    (RETURN
     (SEQ
      (COND
       ((NULL
         (SPADCALL
          (SPADCALL
           (LETT |den| (SPADCALL |f| (QREFELT $ 39))
                 . #2=(|INTTOOLS;removeConstantTerm;FSF;7|))
           (QREFELT $ 40))
          |x| (QREFELT $ 41)))
        |f|)
       ('T
        (SEQ
         (LETT |u|
               (SPADCALL (LETT |num| (SPADCALL |f| (QREFELT $ 42)) . #2#)
                         (QREFELT $ 45))
               . #2#)
         (EXIT
          (COND
           ((QEQCAR |u| 1)
            (COND
             ((SPADCALL (SPADCALL |num| (QREFELT $ 40)) |x| (QREFELT $ 41))
              (|spadConstant| $ 46))
             (#3='T |f|)))
           (#3#
            (SEQ (LETT |ans| (|spadConstant| $ 47) . #2#)
                 (SEQ (LETT |term| NIL . #2#) (LETT #1# (QCDR |u|) . #2#) G190
                      (COND
                       ((OR (ATOM #1#)
                            (PROGN (LETT |term| (CAR #1#) . #2#) NIL))
                        (GO G191)))
                      (SEQ
                       (EXIT
                        (COND
                         ((NULL
                           (SPADCALL (SPADCALL |term| (QREFELT $ 40)) |x|
                                     (QREFELT $ 41)))
                          (LETT |ans| (SPADCALL |ans| |term| (QREFELT $ 48))
                                . #2#)))))
                      (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
                 (EXIT (SPADCALL |ans| |den| (QREFELT $ 49)))))))))))))) 

(DEFUN |INTTOOLS;logsimp| (|f| |x| $)
  (PROG (|g| |r2| |r1|)
    (RETURN
     (SEQ
      (LETT |r1| (|INTTOOLS;psimp| (SPADCALL |f| (QREFELT $ 42)) |x| $)
            . #1=(|INTTOOLS;logsimp|))
      (LETT |r2| (|INTTOOLS;psimp| (SPADCALL |f| (QREFELT $ 39)) |x| $) . #1#)
      (LETT |g| (GCD (QCAR |r1|) (QCAR |r2|)) . #1#)
      (EXIT
       (SPADCALL |g|
                 (SPADCALL
                  (SPADCALL
                   (SPADCALL (QCDR |r1|) (QUOTIENT2 (QCAR |r1|) |g|)
                             (QREFELT $ 52))
                   (SPADCALL (QCDR |r2|) (QUOTIENT2 (QCAR |r2|) |g|)
                             (QREFELT $ 52))
                   (QREFELT $ 53))
                  (QREFELT $ 54))
                 (QREFELT $ 55))))))) 

(DEFUN |INTTOOLS;cont| (|p| |l| $)
  (PROG (|q|)
    (RETURN
     (SEQ
      (COND ((NULL |l|) |p|)
            ('T
             (SEQ
              (LETT |q| (SPADCALL |p| (|SPADfirst| |l|) (QREFELT $ 57))
                    |INTTOOLS;cont|)
              (EXIT
               (|INTTOOLS;cont|
                (SPADCALL
                 (QVELT (SPADCALL (SPADCALL |q| (QREFELT $ 59)) (QREFELT $ 61))
                        0)
                 (SPADCALL |q| (QREFELT $ 62)) (QREFELT $ 63))
                (CDR |l|) $))))))))) 

(DEFUN |INTTOOLS;linearLog?| (|k| |f| |x| $)
  (PROG (|u|)
    (RETURN
     (SEQ
      (COND
       ((SPADCALL |k| '|log| (QREFELT $ 37))
        (SEQ
         (LETT |u| (SPADCALL (SPADCALL |f| |k| (QREFELT $ 65)) (QREFELT $ 68))
               |INTTOOLS;linearLog?|)
         (EXIT
          (COND
           ((QEQCAR |u| 0)
            (COND
             ((EQL (SPADCALL (QCDR |u|) (QREFELT $ 70)) 1)
              (COND
               ((SPADCALL |x|
                          (SPADCALL (SPADCALL (QCDR |u|) (QREFELT $ 72))
                                    (QREFELT $ 15))
                          (QREFELT $ 18))
                'NIL)
               (#1='T 'T)))
             (#1# 'NIL)))
           (#1# 'NIL)))))
       (#1# 'NIL)))))) 

(DEFUN |INTTOOLS;mkPrim;FSF;11| (|f| |x| $)
  (PROG (#1=#:G741 |k| #2=#:G740 |lg| #3=#:G739 #4=#:G738)
    (RETURN
     (SEQ
      (LETT |lg|
            (PROGN
             (LETT #4# NIL . #5=(|INTTOOLS;mkPrim;FSF;11|))
             (SEQ (LETT |k| NIL . #5#)
                  (LETT #3# (SPADCALL |f| (QREFELT $ 28)) . #5#) G190
                  (COND
                   ((OR (ATOM #3#) (PROGN (LETT |k| (CAR #3#) . #5#) NIL))
                    #6=(GO G191)))
                  (SEQ
                   (EXIT
                    (COND
                     ((|INTTOOLS;linearLog?| |k| |f| |x| $)
                      (LETT #4# (CONS |k| #4#) . #5#)))))
                  (LETT #3# (CDR #3#) . #5#) #7=(GO G190) G191
                  (EXIT (NREVERSE0 #4#))))
            . #5#)
      (EXIT
       (SPADCALL |f| |lg|
                 (PROGN
                  (LETT #2# NIL . #5#)
                  (SEQ (LETT |k| NIL . #5#) (LETT #1# |lg| . #5#) G190
                       (COND
                        ((OR (ATOM #1#) (PROGN (LETT |k| (CAR #1#) . #5#) NIL))
                         #6#))
                       (SEQ
                        (EXIT
                         (LETT #2#
                               (CONS
                                (|INTTOOLS;logsimp|
                                 (|SPADfirst| (SPADCALL |k| (QREFELT $ 23)))
                                 |x| $)
                                #2#)
                               . #5#)))
                       (LETT #1# (CDR #1#) . #5#) #7# G191
                       (EXIT (NREVERSE0 #2#))))
                 (QREFELT $ 74))))))) 

(DEFUN |INTTOOLS;psimp| (|p| |x| $)
  (PROG (|u| #1=#:G747)
    (RETURN
     (SEQ
      (LETT |u|
            (SPADCALL
             (LETT |p|
                   (PROG2
                       (LETT #1#
                             (SPADCALL |p|
                                       (|INTTOOLS;cont| |p|
                                        (SPADCALL (SPADCALL |p| (QREFELT $ 76))
                                                  |x| (QREFELT $ 19))
                                        $)
                                       (QREFELT $ 78))
                             . #2=(|INTTOOLS;psimp|))
                       (QCDR #1#)
                     (|check-union| (QEQCAR #1# 0)
                                    (|SparseMultivariatePolynomial|
                                     (QREFELT $ 6) (|Kernel| (QREFELT $ 7)))
                                    #1#))
                   . #2#)
             (QREFELT $ 81))
            . #2#)
      (EXIT
       (COND ((QEQCAR |u| 1) (CONS 1 (SPADCALL |p| (QREFELT $ 40))))
             ('T
              (CONS (QCDR (QCDR |u|))
                    (SPADCALL (QCAR (QCDR |u|)) (QREFELT $ 13)))))))))) 

(DEFUN |INTTOOLS;intPatternMatch;FSMMIr;13| (|f| |x| |int| |pmint| $)
  (PROG (|nl| |lg| |ans| |ir0| |rc| |u| #1=#:G782 |rec| |l| |ir|)
    (RETURN
     (SEQ
      (LETT |ir| (SPADCALL |f| |x| |int|)
            . #2=(|INTTOOLS;intPatternMatch;FSMMIr;13|))
      (EXIT
       (COND ((NULL (LETT |l| (SPADCALL |ir| (QREFELT $ 87)) . #2#)) |ir|)
             ('T
              (SEQ (LETT |ans| (SPADCALL |ir| (QREFELT $ 88)) . #2#)
                   (LETT |nl| NIL . #2#)
                   (LETT |lg| (SPADCALL |ir| (QREFELT $ 91)) . #2#)
                   (SEQ (LETT |rec| NIL . #2#) (LETT #1# |l| . #2#) G190
                        (COND
                         ((OR (ATOM #1#)
                              (PROGN (LETT |rec| (CAR #1#) . #2#) NIL))
                          (GO G191)))
                        (SEQ
                         (LETT |u|
                               (SPADCALL (QCAR |rec|)
                                         (SPADCALL (QCDR |rec|) (QREFELT $ 92))
                                         |pmint|)
                               . #2#)
                         (EXIT
                          (COND
                           ((QEQCAR |u| 0)
                            (SEQ (LETT |rc| (QCDR |u|) . #2#)
                                 (LETT |ans|
                                       (SPADCALL |ans| (QCAR |rc|)
                                                 (QREFELT $ 93))
                                       . #2#)
                                 (EXIT
                                  (COND
                                   ((NULL
                                     (SPADCALL (QCDR |rc|)
                                               (|spadConstant| $ 46)
                                               (QREFELT $ 94)))
                                    (SEQ
                                     (LETT |ir0|
                                           (SPADCALL (QCDR |rc|) |x| |int|
                                                     |pmint| (QREFELT $ 99))
                                           . #2#)
                                     (LETT |ans|
                                           (SPADCALL |ans|
                                                     (SPADCALL |ir0|
                                                               (QREFELT $ 88))
                                                     (QREFELT $ 93))
                                           . #2#)
                                     (LETT |lg|
                                           (SPADCALL
                                            (SPADCALL |ir0| (QREFELT $ 91))
                                            |lg| (QREFELT $ 100))
                                           . #2#)
                                     (EXIT
                                      (LETT |nl|
                                            (SPADCALL
                                             (SPADCALL |ir0| (QREFELT $ 87))
                                             |nl| (QREFELT $ 101))
                                            . #2#))))))))
                           ('T (LETT |nl| (CONS |rec| |nl|) . #2#)))))
                        (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
                   (EXIT (SPADCALL |ans| |lg| |nl| (QREFELT $ 102))))))))))) 

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

(DEFUN |IntegrationTools;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|IntegrationTools|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|IntegrationTools| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 103) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (AND
                                           (|HasCategory| |#1| '(|GcdDomain|))
                                           (|HasCategory| |#1|
                                                          '(|ConvertibleTo|
                                                            (|Pattern|
                                                             (|Integer|))))
                                           (|HasCategory| |#1|
                                                          '(|PatternMatchable|
                                                            (|Integer|)))
                                           (|HasCategory| |#2|
                                                          '(|ElementaryFunctionCategory|))
                                           (|HasCategory| |#2|
                                                          '(|LiouvillianFunctionCategory|))
                                           (|HasCategory| |#2|
                                                          '(|RetractableTo|
                                                            (|Symbol|))))
                                          (AND
                                           (|HasCategory| |#1| '(|GcdDomain|))
                                           (|HasCategory| |#2|
                                                          '(|ElementaryFunctionCategory|)))
                                          (|HasCategory| |#1|
                                                         '(|IntegralDomain|))))
                      . #1#))
      (|haddProp| |$ConstructorCache| '|IntegrationTools| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 '|%alg|)
      (COND
       ((|testBitVector| |pv$| 3)
        (QSETREFV $ 50
                  (CONS
                   (|dispatchFunction| |INTTOOLS;removeConstantTerm;FSF;7|)
                   $))))
      (COND
       ((|HasCategory| |#1| '(|GcdDomain|))
        (COND
         ((|HasCategory| |#2| '(|ElementaryFunctionCategory|))
          (PROGN
           (QSETREFV $ 75
                     (CONS (|dispatchFunction| |INTTOOLS;mkPrim;FSF;11|) $))
           (COND
            ((|HasCategory| |#1| '(|ConvertibleTo| (|Pattern| (|Integer|))))
             (COND
              ((|HasCategory| |#1| '(|PatternMatchable| (|Integer|)))
               (PROGN
                (QSETREFV $ 83
                          (COND
                           ((|HasCategory| |#2|
                                           '(|LiouvillianFunctionCategory|))
                            (|HasCategory| |#2| '(|RetractableTo| (|Symbol|))))
                           ('T 'NIL)))
                (COND
                 ((QREFELT $ 83)
                  (QSETREFV $ 99
                            (CONS
                             (|dispatchFunction|
                              |INTTOOLS;intPatternMatch;FSMMIr;13|)
                             $))))))))))))))
      $)))) 

(MAKEPROP '|IntegrationTools| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) 'ALGOP
              (|List| 20) (0 . |setUnion|) |INTTOOLS;union;3L;1| (|Kernel| $)
              (6 . |coerce|) (|List| 17) (11 . |variables|) (|Boolean|)
              (|Symbol|) (16 . |member?|) |INTTOOLS;varselect;LSL;2|
              (|Kernel| 7) (22 . |remove|) (|List| 7) (28 . |argument|)
              |INTTOOLS;vark;LSL;4| |INTTOOLS;kmax;LK;5| |INTTOOLS;ksec;KLSK;3|
              (|List| 12) (33 . |kernels|) (|Mapping| 9 9 9) (|List| 9)
              (38 . |reduce|) (|NonNegativeInteger|) (45 . |height|)
              (|BasicOperator|) (50 . |operator|) (55 . |has?|) (61 . |is?|)
              (|SparseMultivariatePolynomial| 6 12) (67 . |denom|)
              (72 . |coerce|) (77 . |freeOf?|) (83 . |numer|)
              (|Union| 73 '"failed") (|SparseMultivariatePolynomial| 6 20)
              (88 . |isPlus|) (93 . |Zero|) (97 . |Zero|) (101 . +) (107 . /)
              (113 . |removeConstantTerm|) (|Integer|) (119 . ^) (125 . /)
              (131 . |log|) (136 . *) (|SparseUnivariatePolynomial| $)
              (142 . |univariate|) (|SparseUnivariatePolynomial| 44)
              (148 . |leadingCoefficient|)
              (|Record| (|:| |unit| $) (|:| |canonical| $) (|:| |associate| $))
              (153 . |unitNormal|) (158 . |content|) (163 . *) (|Fraction| 56)
              (169 . |univariate|) (|Union| 69 '"failed") (|Fraction| 69)
              (175 . |retractIfCan|) (|SparseUnivariatePolynomial| 7)
              (180 . |degree|) (185 . |One|) (189 . |leadingCoefficient|)
              (|List| $) (194 . |eval|) (201 . |mkPrim|) (207 . |variables|)
              (|Union| $ '"failed") (212 . |exquo|)
              (|Record| (|:| |var| 20) (|:| |exponent| 32))
              (|Union| 79 '"failed") (218 . |isExpt|) (223 . |One|) '#:G676
              (|Record| (|:| |integrand| 7) (|:| |intvar| 7)) (|List| 84)
              (|IntegrationResult| 7) (227 . |notelem|) (232 . |ratpart|)
              (|Record| (|:| |scalar| (|Fraction| 51)) (|:| |coeff| 69)
                        (|:| |logand| 69))
              (|List| 89) (237 . |logpart|) (242 . |retract|) (247 . +)
              (253 . =) (|Mapping| 86 7 17)
              (|Record| (|:| |special| 7) (|:| |integrand| 7))
              (|Union| 96 '"failed") (|Mapping| 97 7 17)
              (259 . |intPatternMatch|) (267 . |concat|) (273 . |concat|)
              (279 . |mkAnswer|))
           '#(|varselect| 286 |vark| 292 |union| 298 |removeConstantTerm| 304
              |mkPrim| 310 |ksec| 316 |kmax| 323 |intPatternMatch| 328)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 102
                                                 '(2 9 0 0 0 10 1 7 0 12 13 1 7
                                                   14 0 15 2 14 16 17 0 18 2 9
                                                   0 20 0 21 1 20 22 0 23 1 7
                                                   27 0 28 3 30 9 29 0 9 31 1
                                                   20 32 0 33 1 20 34 0 35 2 34
                                                   16 0 17 36 2 20 16 0 17 37 1
                                                   7 38 0 39 1 7 0 38 40 2 7 16
                                                   0 17 41 1 7 38 0 42 1 44 43
                                                   0 45 0 7 0 46 0 44 0 47 2 44
                                                   0 0 0 48 2 7 0 38 38 49 2 0
                                                   7 7 17 50 2 7 0 0 51 52 2 7
                                                   0 0 0 53 1 7 0 0 54 2 7 0 51
                                                   0 55 2 44 56 0 20 57 1 58 44
                                                   0 59 1 44 60 0 61 1 58 44 0
                                                   62 2 44 0 0 0 63 2 7 64 0 12
                                                   65 1 67 66 0 68 1 69 32 0 70
                                                   0 7 0 71 1 69 7 0 72 3 7 0 0
                                                   27 73 74 2 0 7 7 17 75 1 44
                                                   9 0 76 2 44 77 0 0 78 1 44
                                                   80 0 81 0 6 0 82 1 86 85 0
                                                   87 1 86 7 0 88 1 86 90 0 91
                                                   1 7 17 0 92 2 7 0 0 0 93 2 7
                                                   16 0 0 94 4 0 86 7 17 95 98
                                                   99 2 90 0 0 0 100 2 85 0 0 0
                                                   101 3 86 0 7 90 85 102 2 0 9
                                                   9 17 19 2 0 9 22 17 24 2 0 9
                                                   9 9 11 2 3 7 7 17 50 2 2 7 7
                                                   17 75 3 0 20 20 9 17 26 1 0
                                                   20 9 25 4 1 86 7 17 95 98
                                                   99)))))
           '|lookupComplete|)) 
