
(/VERSIONCHECK 2) 

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

(DEFUN |INTTOOLS;varselect;LSL;2| (|l| |x| $)
  (PROG (#0=#:G1835 |k| #1=#:G1836)
    (RETURN
      (SEQ (PROGN
             (LETT #0# NIL . #2=(|INTTOOLS;varselect;LSL;2|))
             (SEQ (LETT |k| NIL . #2#) (LETT #1# |l| . #2#) G190
                  (COND
                    ((OR (ATOM #1#)
                         (PROGN (LETT |k| (CAR #1#) . #2#) NIL))
                     (GO G191)))
                  (SEQ (EXIT (COND
                               ((SPADCALL |x|
                                    (SPADCALL
                                     (SPADCALL |k| (QREFELT $ 16))
                                     (QREFELT $ 18))
                                    (QREFELT $ 20))
                                (LETT #0# (CONS |k| #0#) . #2#)))))
                  (LETT #1# (CDR #1#) . #2#) (GO G190) G191
                  (EXIT (NREVERSE0 #0#)))))))) 

(DEFUN |INTTOOLS;ksec;KLSK;3| (|k| |l| |x| $)
  (SPADCALL
      (SPADCALL (SPADCALL |k| |l| (QREFELT $ 23))
          (SPADCALL (SPADCALL |k| (QREFELT $ 25)) |x| (QREFELT $ 26))
          (QREFELT $ 13))
      (QREFELT $ 27))) 

(DEFUN |INTTOOLS;vark;LSL;4| (|l| |x| $)
  (PROG (#0=#:G1842 |f| #1=#:G1843)
    (RETURN
      (SEQ (SPADCALL
               (SPADCALL (ELT $ 13)
                   (PROGN
                     (LETT #0# NIL . #2=(|INTTOOLS;vark;LSL;4|))
                     (SEQ (LETT |f| NIL . #2#) (LETT #1# |l| . #2#)
                          G190
                          (COND
                            ((OR (ATOM #1#)
                                 (PROGN
                                   (LETT |f| (CAR #1#) . #2#)
                                   NIL))
                             (GO G191)))
                          (SEQ (EXIT (LETT #0#
                                      (CONS
                                       (SPADCALL |f| (QREFELT $ 30))
                                       #0#) . #2#)))
                          (LETT #1# (CDR #1#) . #2#) (GO G190) G191
                          (EXIT (NREVERSE0 #0#))))
                   NIL (QREFELT $ 33))
               |x| (QREFELT $ 21)))))) 

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

(DEFUN |INTTOOLS;better?| (|x| |y| $)
  (COND
    ((NULL (EQL (SPADCALL |y| (QREFELT $ 35))
                (SPADCALL |x| (QREFELT $ 35))))
     (< (SPADCALL |y| (QREFELT $ 35)) (SPADCALL |x| (QREFELT $ 35))))
    ('T
     (COND
       ((SPADCALL (SPADCALL |y| (QREFELT $ 37)) (QREFELT $ 11)
            (QREFELT $ 38))
        'T)
       ((SPADCALL |y| (SPADCALL "exp" (QREFELT $ 10)) (QREFELT $ 39))
        (COND
          ((OR (SPADCALL |x| (SPADCALL "exp" (QREFELT $ 10))
                   (QREFELT $ 39))
               (SPADCALL (SPADCALL |x| (QREFELT $ 37)) (QREFELT $ 11)
                   (QREFELT $ 38)))
           'NIL)
          ('T 'T)))
       ('T 'NIL))))) 

(DEFUN |INTTOOLS;removeConstantTerm;FSF;7| (|f| |x| $)
  (PROG (|den| |num| |u| |term| #0=#:G1868 |ans|)
    (RETURN
      (SEQ (COND
             ((NULL (SPADCALL
                        (SPADCALL
                            (LETT |den| (SPADCALL |f| (QREFELT $ 41))
                                  . #1=(|INTTOOLS;removeConstantTerm;FSF;7|))
                            (QREFELT $ 42))
                        |x| (QREFELT $ 43)))
              |f|)
             ('T
              (SEQ (LETT |u|
                         (SPADCALL
                             (LETT |num|
                                   (SPADCALL |f| (QREFELT $ 44)) . #1#)
                             (QREFELT $ 47)) . #1#)
                   (EXIT (COND
                           ((QEQCAR |u| 1)
                            (COND
                              ((SPADCALL
                                   (SPADCALL |num| (QREFELT $ 42)) |x|
                                   (QREFELT $ 43))
                               (|spadConstant| $ 48))
                              ('T |f|)))
                           ('T
                            (SEQ (LETT |ans|
                                       (|spadConstant| $ 49) . #1#)
                                 (SEQ (LETT |term| NIL . #1#)
                                      (LETT #0# (QCDR |u|) . #1#) G190
                                      (COND
                                        ((OR (ATOM #0#)
                                          (PROGN
                                            (LETT |term|
                                             (CAR #0#) . #1#)
                                            NIL))
                                         (GO G191)))
                                      (SEQ
                                       (EXIT
                                        (COND
                                          ((NULL
                                            (SPADCALL
                                             (SPADCALL |term|
                                              (QREFELT $ 42))
                                             |x| (QREFELT $ 43)))
                                           (LETT |ans|
                                            (SPADCALL |ans| |term|
                                             (QREFELT $ 50)) . #1#)))))
                                      (LETT #0# (CDR #0#) . #1#)
                                      (GO G190) G191 (EXIT NIL))
                                 (EXIT (SPADCALL |ans| |den|
                                        (QREFELT $ 51)))))))))))))) 

(DEFUN |INTTOOLS;logsimp| (|f| |x| $)
  (PROG (|r1| |r2| |g|)
    (RETURN
      (SEQ (LETT |r1|
                 (|INTTOOLS;psimp| (SPADCALL |f| (QREFELT $ 44)) |x| $)
                 . #0=(|INTTOOLS;logsimp|))
           (LETT |r2|
                 (|INTTOOLS;psimp| (SPADCALL |f| (QREFELT $ 41)) |x| $) . #0#)
           (LETT |g| (GCD (QCAR |r1|) (QCAR |r2|)) . #0#)
           (EXIT (SPADCALL |g|
                     (SPADCALL
                         (SPADCALL
                             (SPADCALL (QCDR |r1|)
                                 (QUOTIENT2 (QCAR |r1|) |g|)
                                 (QREFELT $ 54))
                             (SPADCALL (QCDR |r2|)
                                 (QUOTIENT2 (QCAR |r2|) |g|)
                                 (QREFELT $ 54))
                             (QREFELT $ 55))
                         (QREFELT $ 56))
                     (QREFELT $ 57))))))) 

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

(DEFUN |INTTOOLS;linearLog?| (|k| |f| |x| $)
  (PROG (|u|)
    (RETURN
      (SEQ (COND
             ((SPADCALL |k| (SPADCALL "log" (QREFELT $ 10))
                  (QREFELT $ 39))
              (SEQ (LETT |u|
                         (SPADCALL (SPADCALL |f| |k| (QREFELT $ 67))
                             (QREFELT $ 70))
                         |INTTOOLS;linearLog?|)
                   (EXIT (COND
                           ((QEQCAR |u| 0)
                            (COND
                              ((EQL (SPADCALL (QCDR |u|)
                                     (QREFELT $ 72))
                                    1)
                               (COND
                                 ((SPADCALL |x|
                                      (SPADCALL
                                       (SPADCALL (QCDR |u|)
                                        (QREFELT $ 74))
                                       (QREFELT $ 18))
                                      (QREFELT $ 20))
                                  'NIL)
                                 ('T 'T)))
                              ('T 'NIL)))
                           ('T 'NIL)))))
             ('T 'NIL)))))) 

(DEFUN |INTTOOLS;mkPrim;FSF;11| (|f| |x| $)
  (PROG (#0=#:G1892 #1=#:G1893 |lg| #2=#:G1894 |k| #3=#:G1895)
    (RETURN
      (SEQ (LETT |lg|
                 (PROGN
                   (LETT #0# NIL . #4=(|INTTOOLS;mkPrim;FSF;11|))
                   (SEQ (LETT |k| NIL . #4#)
                        (LETT #1# (SPADCALL |f| (QREFELT $ 30)) . #4#)
                        G190
                        (COND
                          ((OR (ATOM #1#)
                               (PROGN (LETT |k| (CAR #1#) . #4#) NIL))
                           #5=(GO G191)))
                        (SEQ (EXIT (COND
                                     ((|INTTOOLS;linearLog?| |k| |f|
                                       |x| $)
                                      (LETT #0# (CONS |k| #0#) . #4#)))))
                        (LETT #1# (CDR #1#) . #4#) #6=(GO G190) G191
                        (EXIT (NREVERSE0 #0#)))) . #4#)
           (EXIT (SPADCALL |f| |lg|
                     (PROGN
                       (LETT #2# NIL . #4#)
                       (SEQ (LETT |k| NIL . #4#) (LETT #3# |lg| . #4#)
                            G190
                            (COND
                              ((OR (ATOM #3#)
                                   (PROGN
                                     (LETT |k| (CAR #3#) . #4#)
                                     NIL))
                               #5#))
                            (SEQ (EXIT (LETT #2#
                                        (CONS
                                         (|INTTOOLS;logsimp|
                                          (|SPADfirst|
                                           (SPADCALL |k|
                                            (QREFELT $ 25)))
                                          |x| $)
                                         #2#) . #4#)))
                            (LETT #3# (CDR #3#) . #4#) #6# G191
                            (EXIT (NREVERSE0 #2#))))
                     (QREFELT $ 76))))))) 

(DEFUN |INTTOOLS;psimp| (|p| |x| $)
  (PROG (#0=#:G1901 |u|)
    (RETURN
      (SEQ (LETT |u|
                 (SPADCALL
                     (LETT |p|
                           (PROG2 (LETT #0#
                                        (SPADCALL |p|
                                         (|INTTOOLS;cont| |p|
                                          (SPADCALL
                                           (SPADCALL |p|
                                            (QREFELT $ 78))
                                           |x| (QREFELT $ 21))
                                          $)
                                         (QREFELT $ 80))
                                        . #1=(|INTTOOLS;psimp|))
                                  (QCDR #0#)
                             (|check-union| (QEQCAR #0# 0)
                                 (|SparseMultivariatePolynomial|
                                     (QREFELT $ 6)
                                     (|Kernel| (QREFELT $ 7)))
                                 #0#)) . #1#)
                     (QREFELT $ 83)) . #1#)
           (EXIT (COND
                   ((QEQCAR |u| 1)
                    (CONS 1 (SPADCALL |p| (QREFELT $ 42))))
                   ('T
                    (CONS (QCDR (QCDR |u|))
                          (SPADCALL (QCAR (QCDR |u|)) (QREFELT $ 16)))))))))) 

(DEFUN |INTTOOLS;intPatternMatch;FSMMIr;13| (|f| |x| |int| |pmint| $)
  (PROG (|ir| |l| |rec| #0=#:G1936 |u| |rc| |ir0| |ans| |lg| |nl|)
    (RETURN
      (SEQ (LETT |ir| (SPADCALL |f| |x| |int|)
                 . #1=(|INTTOOLS;intPatternMatch;FSMMIr;13|))
           (EXIT (COND
                   ((NULL (LETT |l|
                                (SPADCALL |ir| (QREFELT $ 89)) . #1#))
                    |ir|)
                   ('T
                    (SEQ (LETT |ans|
                               (SPADCALL |ir| (QREFELT $ 90)) . #1#)
                         (LETT |nl| NIL . #1#)
                         (LETT |lg|
                               (SPADCALL |ir| (QREFELT $ 93)) . #1#)
                         (SEQ (LETT |rec| NIL . #1#)
                              (LETT #0# |l| . #1#) G190
                              (COND
                                ((OR (ATOM #0#)
                                     (PROGN
                                       (LETT |rec| (CAR #0#) . #1#)
                                       NIL))
                                 (GO G191)))
                              (SEQ (LETT |u|
                                    (SPADCALL (QCAR |rec|)
                                     (SPADCALL (QCDR |rec|)
                                      (QREFELT $ 94))
                                     |pmint|) . #1#)
                                   (EXIT
                                    (COND
                                      ((QEQCAR |u| 0)
                                       (SEQ
                                        (LETT |rc| (QCDR |u|) . #1#)
                                        (LETT |ans|
                                         (SPADCALL |ans| (QCAR |rc|)
                                          (QREFELT $ 95)) . #1#)
                                        (EXIT
                                         (COND
                                           ((NULL
                                             (SPADCALL (QCDR |rc|)
                                              (|spadConstant| $ 48)
                                              (QREFELT $ 96)))
                                            (SEQ
                                             (LETT |ir0|
                                              (SPADCALL (QCDR |rc|) |x|
                                               |int| |pmint|
                                               (QREFELT $ 101)) . #1#)
                                             (LETT |ans|
                                              (SPADCALL |ans|
                                               (SPADCALL |ir0|
                                                (QREFELT $ 90))
                                               (QREFELT $ 95)) . #1#)
                                             (LETT |lg|
                                              (SPADCALL
                                               (SPADCALL |ir0|
                                                (QREFELT $ 93))
                                               |lg| (QREFELT $ 102)) . #1#)
                                             (EXIT
                                              (LETT |nl|
                                               (SPADCALL
                                                (SPADCALL |ir0|
                                                 (QREFELT $ 89))
                                                |nl| (QREFELT $ 103)) . #1#))))))))
                                      ('T
                                       (LETT |nl|
                                        (CONS |rec| |nl|) . #1#)))))
                              (LETT #0# (CDR #0#) . #1#) (GO G190) G191
                              (EXIT NIL))
                         (EXIT (SPADCALL |ans| |lg| |nl|
                                   (QREFELT $ 104))))))))))) 

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

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

(MAKEPROP '|IntegrationTools| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (|String|) (|Symbol|) (0 . |coerce|) 'ALGOP (|List| 22)
             (5 . |setUnion|) |INTTOOLS;union;3L;1| (|Kernel| $)
             (11 . |coerce|) (|List| 9) (16 . |variables|) (|Boolean|)
             (21 . |member?|) |INTTOOLS;varselect;LSL;2| (|Kernel| 7)
             (27 . |remove|) (|List| 7) (33 . |argument|)
             |INTTOOLS;vark;LSL;4| |INTTOOLS;kmax;LK;5|
             |INTTOOLS;ksec;KLSK;3| (|List| 15) (38 . |kernels|)
             (|Mapping| 12 12 12) (|List| 12) (43 . |reduce|)
             (|NonNegativeInteger|) (50 . |height|) (|BasicOperator|)
             (55 . |operator|) (60 . |has?|) (66 . |is?|)
             (|SparseMultivariatePolynomial| 6 15) (72 . |denom|)
             (77 . |coerce|) (82 . |freeOf?|) (88 . |numer|)
             (|Union| 75 '"failed")
             (|SparseMultivariatePolynomial| 6 22) (93 . |isPlus|)
             (98 . |Zero|) (102 . |Zero|) (106 . +) (112 . /)
             (118 . |removeConstantTerm|) (|Integer|) (124 . **)
             (130 . /) (136 . |log|) (141 . *)
             (|SparseUnivariatePolynomial| $) (147 . |univariate|)
             (|SparseUnivariatePolynomial| 46)
             (153 . |leadingCoefficient|)
             (|Record| (|:| |unit| $) (|:| |canonical| $)
                 (|:| |associate| $))
             (158 . |unitNormal|) (163 . |content|) (168 . *)
             (|Fraction| 58) (174 . |univariate|)
             (|Union| 71 '"failed") (|Fraction| 71)
             (180 . |retractIfCan|) (|SparseUnivariatePolynomial| 7)
             (185 . |degree|) (190 . |One|)
             (194 . |leadingCoefficient|) (|List| $) (199 . |eval|)
             (206 . |mkPrim|) (212 . |variables|) (|Union| $ '"failed")
             (217 . |exquo|)
             (|Record| (|:| |var| 22) (|:| |exponent| 34))
             (|Union| 81 '"failed") (223 . |isExpt|) (228 . |One|)
             '#:G1830 (|Record| (|:| |integrand| 7) (|:| |intvar| 7))
             (|List| 86) (|IntegrationResult| 7) (232 . |notelem|)
             (237 . |ratpart|)
             (|Record| (|:| |scalar| (|Fraction| 53)) (|:| |coeff| 71)
                 (|:| |logand| 71))
             (|List| 91) (242 . |logpart|) (247 . |retract|) (252 . +)
             (258 . =) (|Mapping| 88 7 9)
             (|Record| (|:| |special| 7) (|:| |integrand| 7))
             (|Union| 98 '"failed") (|Mapping| 99 7 9)
             (264 . |intPatternMatch|) (272 . |concat|)
             (278 . |concat|) (284 . |mkAnswer|))
          '#(|varselect| 291 |vark| 297 |union| 303
             |removeConstantTerm| 309 |mkPrim| 315 |ksec| 321 |kmax|
             328 |intPatternMatch| 333)
          'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 104
                                '(1 9 0 8 10 2 12 0 0 0 13 1 7 0 15 16
                                  1 7 17 0 18 2 17 19 9 0 20 2 12 0 22
                                  0 23 1 22 24 0 25 1 7 29 0 30 3 32 12
                                  31 0 12 33 1 22 34 0 35 1 22 36 0 37
                                  2 36 19 0 9 38 2 22 19 0 9 39 1 7 40
                                  0 41 1 7 0 40 42 2 7 19 0 9 43 1 7 40
                                  0 44 1 46 45 0 47 0 7 0 48 0 46 0 49
                                  2 46 0 0 0 50 2 7 0 40 40 51 2 0 7 7
                                  9 52 2 7 0 0 53 54 2 7 0 0 0 55 1 7 0
                                  0 56 2 7 0 53 0 57 2 46 58 0 22 59 1
                                  60 46 0 61 1 46 62 0 63 1 60 46 0 64
                                  2 46 0 0 0 65 2 7 66 0 15 67 1 69 68
                                  0 70 1 71 34 0 72 0 7 0 73 1 71 7 0
                                  74 3 7 0 0 29 75 76 2 0 7 7 9 77 1 46
                                  12 0 78 2 46 79 0 0 80 1 46 82 0 83 0
                                  6 0 84 1 88 87 0 89 1 88 7 0 90 1 88
                                  92 0 93 1 7 9 0 94 2 7 0 0 0 95 2 7
                                  19 0 0 96 4 0 88 7 9 97 100 101 2 92
                                  0 0 0 102 2 87 0 0 0 103 3 88 0 7 92
                                  87 104 2 0 12 12 9 21 2 0 12 24 9 26
                                  2 0 12 12 12 14 2 3 7 7 9 52 2 2 7 7
                                  9 77 3 0 22 22 12 9 28 1 0 22 12 27 4
                                  1 88 7 9 97 100 101)))))
          '|lookupComplete|)) 
