
(/VERSIONCHECK 2) 

(DEFUN |OMEXPR;outputOMArith1| (|dev| |sym| |args| $)
  (PROG (#1=#:G680 |arg|)
    (RETURN
     (SEQ (SPADCALL |dev| (QREFELT $ 18))
          (SPADCALL |dev| "arith1" |sym| (QREFELT $ 20))
          (SEQ (LETT |arg| NIL . #2=(|OMEXPR;outputOMArith1|))
               (LETT #1# |args| . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |arg| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ (EXIT (SPADCALL |dev| |arg| 'NIL (QREFELT $ 22))))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT (SPADCALL |dev| (QREFELT $ 23))))))) 

(DEFUN |OMEXPR;outputOMLambda| (|dev| |ex| |var| $)
  (SEQ (SPADCALL |dev| (QREFELT $ 24))
       (SPADCALL |dev| "fns1" "lambda" (QREFELT $ 20))
       (SPADCALL |dev| (QREFELT $ 25))
       (SPADCALL |dev| |var| 'NIL (QREFELT $ 22))
       (SPADCALL |dev| (QREFELT $ 26))
       (SPADCALL |dev| |ex| 'NIL (QREFELT $ 22))
       (EXIT (SPADCALL |dev| (QREFELT $ 27))))) 

(DEFUN |OMEXPR;outputOMInterval| (|dev| |lo| |hi| $)
  (SEQ (SPADCALL |dev| (QREFELT $ 18))
       (SPADCALL |dev| "interval1" "interval" (QREFELT $ 20))
       (SPADCALL |dev| |lo| 'NIL (QREFELT $ 22))
       (SPADCALL |dev| |hi| 'NIL (QREFELT $ 22))
       (EXIT (SPADCALL |dev| (QREFELT $ 23))))) 

(DEFUN |OMEXPR;outputOMIntInterval| (|dev| |lo| |hi| $)
  (SEQ (SPADCALL |dev| (QREFELT $ 18))
       (SPADCALL |dev| "interval1" "integer_interval" (QREFELT $ 20))
       (SPADCALL |dev| |lo| 'NIL (QREFELT $ 22))
       (SPADCALL |dev| |hi| 'NIL (QREFELT $ 22))
       (EXIT (SPADCALL |dev| (QREFELT $ 23))))) 

(DEFUN |OMEXPR;outputOMBinomial| (|dev| |args| $)
  (PROG (#1=#:G691 |arg|)
    (RETURN
     (SEQ
      (COND
       ((NULL (EQL (LENGTH |args|) 2))
        (|error| "Wrong number of arguments to binomial"))
       ('T
        (SEQ (SPADCALL |dev| (QREFELT $ 18))
             (SPADCALL |dev| "combinat1" "binomial" (QREFELT $ 20))
             (SEQ (LETT |arg| NIL . #2=(|OMEXPR;outputOMBinomial|))
                  (LETT #1# |args| . #2#) G190
                  (COND
                   ((OR (ATOM #1#) (PROGN (LETT |arg| (CAR #1#) . #2#) NIL))
                    (GO G191)))
                  (SEQ (EXIT (SPADCALL |dev| |arg| 'NIL (QREFELT $ 22))))
                  (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
             (EXIT (SPADCALL |dev| (QREFELT $ 23)))))))))) 

(DEFUN |OMEXPR;outputOMPower| (|dev| |args| $)
  (COND
   ((NULL (EQL (LENGTH |args|) 2))
    (|error| "Wrong number of arguments to power"))
   ('T (|OMEXPR;outputOMArith1| |dev| "power" |args| $)))) 

(DEFUN |OMEXPR;outputOMDefsum| (|dev| |args| $)
  (SEQ
   (COND
    ((NULL (EQL (LENGTH |args|) 5))
     (|error| "Unexpected number of arguments to a defsum"))
    ('T
     (SEQ (SPADCALL |dev| (QREFELT $ 18))
          (SPADCALL |dev| "arith1" "sum" (QREFELT $ 20))
          (|OMEXPR;outputOMIntInterval| |dev|
           (SPADCALL |args| 4 (QREFELT $ 30))
           (SPADCALL |args| 5 (QREFELT $ 30)) $)
          (|OMEXPR;outputOMLambda| |dev|
           (SPADCALL (SPADCALL |args| 1 (QREFELT $ 30))
                     (SPADCALL |args| 2 (QREFELT $ 30))
                     (SPADCALL |args| 3 (QREFELT $ 30)) (QREFELT $ 33))
           (SPADCALL |args| 3 (QREFELT $ 30)) $)
          (EXIT (SPADCALL |dev| (QREFELT $ 23)))))))) 

(DEFUN |OMEXPR;outputOMDefprod| (|dev| |args| $)
  (SEQ
   (COND
    ((NULL (EQL (LENGTH |args|) 5))
     (|error| "Unexpected number of arguments to a defprod"))
    ('T
     (SEQ (SPADCALL |dev| (QREFELT $ 18))
          (SPADCALL |dev| "arith1" "product" (QREFELT $ 20))
          (|OMEXPR;outputOMIntInterval| |dev|
           (SPADCALL |args| 4 (QREFELT $ 30))
           (SPADCALL |args| 5 (QREFELT $ 30)) $)
          (|OMEXPR;outputOMLambda| |dev|
           (SPADCALL (SPADCALL |args| 1 (QREFELT $ 30))
                     (SPADCALL |args| 2 (QREFELT $ 30))
                     (SPADCALL |args| 3 (QREFELT $ 30)) (QREFELT $ 33))
           (SPADCALL |args| 3 (QREFELT $ 30)) $)
          (EXIT (SPADCALL |dev| (QREFELT $ 23)))))))) 

(DEFUN |OMEXPR;outputOMDefint| (|dev| |args| $)
  (SEQ
   (COND
    ((NULL (EQL (LENGTH |args|) 5))
     (|error| "Unexpected number of arguments to a defint"))
    ('T
     (SEQ (SPADCALL |dev| (QREFELT $ 18))
          (SPADCALL |dev| "calculus1" "defint" (QREFELT $ 20))
          (|OMEXPR;outputOMInterval| |dev| (SPADCALL |args| 4 (QREFELT $ 30))
           (SPADCALL |args| 5 (QREFELT $ 30)) $)
          (|OMEXPR;outputOMLambda| |dev|
           (SPADCALL (SPADCALL |args| 1 (QREFELT $ 30))
                     (SPADCALL |args| 2 (QREFELT $ 30))
                     (SPADCALL |args| 3 (QREFELT $ 30)) (QREFELT $ 33))
           (SPADCALL |args| 3 (QREFELT $ 30)) $)
          (EXIT (SPADCALL |dev| (QREFELT $ 23)))))))) 

(DEFUN |OMEXPR;outputOMInt| (|dev| |args| $)
  (SEQ
   (COND
    ((NULL (EQL (LENGTH |args|) 3))
     (|error| "Unexpected number of arguments to a defint"))
    ('T
     (SEQ (SPADCALL |dev| (QREFELT $ 18))
          (SPADCALL |dev| "calculus1" "int" (QREFELT $ 20))
          (|OMEXPR;outputOMLambda| |dev|
           (SPADCALL (SPADCALL |args| 1 (QREFELT $ 30))
                     (SPADCALL |args| 2 (QREFELT $ 30))
                     (SPADCALL |args| 3 (QREFELT $ 30)) (QREFELT $ 33))
           (SPADCALL |args| 3 (QREFELT $ 30)) $)
          (EXIT (SPADCALL |dev| (QREFELT $ 23)))))))) 

(DEFUN |OMEXPR;outputOMFunction| (|dev| |op| |args| $)
  (PROG (#1=#:G719 |arg| |omOp| |nargs|)
    (RETURN
     (SEQ (LETT |nargs| (LENGTH |args|) . #2=(|OMEXPR;outputOMFunction|))
          (EXIT
           (COND
            ((ZEROP |nargs|)
             (SEQ
              (LETT |omOp| (SPADCALL |op| (QREFELT $ 14) (QREFELT $ 36)) . #2#)
              (EXIT
               (COND
                ((QEQCAR |omOp| 1)
                 (|error|
                  (|concat|
                   (|construct| "No OpenMath definition for nullary function "
                                (|coerce| |op|)))))
                (#3='T
                 (SPADCALL |dev| (QCAR (QCDR |omOp|)) (QCDR (QCDR |omOp|))
                           (QREFELT $ 20)))))))
            ((EQL |nargs| 1)
             (SEQ
              (LETT |omOp| (SPADCALL |op| (QREFELT $ 15) (QREFELT $ 36)) . #2#)
              (EXIT
               (COND
                ((QEQCAR |omOp| 1)
                 (|error|
                  (|concat|
                   (|construct| "No OpenMath definition for unary function "
                                (|coerce| |op|)))))
                (#3#
                 (SEQ (SPADCALL |dev| (QREFELT $ 18))
                      (SPADCALL |dev| (QCAR (QCDR |omOp|)) (QCDR (QCDR |omOp|))
                                (QREFELT $ 20))
                      (SEQ (LETT |arg| NIL . #2#) (LETT #1# |args| . #2#) G190
                           (COND
                            ((OR (ATOM #1#)
                                 (PROGN (LETT |arg| (CAR #1#) . #2#) NIL))
                             (GO G191)))
                           (SEQ
                            (EXIT (SPADCALL |dev| |arg| 'NIL (QREFELT $ 22))))
                           (LETT #1# (CDR #1#) . #2#) (GO G190) G191
                           (EXIT NIL))
                      (EXIT (SPADCALL |dev| (QREFELT $ 23)))))))))
            ((EQUAL |op| '|%defint|) (|OMEXPR;outputOMDefint| |dev| |args| $))
            ((EQUAL |op| '|integral|) (|OMEXPR;outputOMInt| |dev| |args| $))
            ((EQUAL |op| '|%defsum|) (|OMEXPR;outputOMDefsum| |dev| |args| $))
            ((EQUAL |op| '|%defprod|)
             (|OMEXPR;outputOMDefprod| |dev| |args| $))
            ((EQUAL |op| '|%power|) (|OMEXPR;outputOMPower| |dev| |args| $))
            ((EQUAL |op| '|binomial|)
             (|OMEXPR;outputOMBinomial| |dev| |args| $))
            (#3#
             (|error|
              (SPADCALL
               (SPADCALL
                (LIST "No OpenMath definition for function "
                      (SPADCALL |op| (QREFELT $ 38)))
                (QREFELT $ 40))
               (QREFELT $ 42)))))))))) 

(DEFUN |OMEXPR;outputOMExpr| (|dev| |ex| $)
  (PROG (|k| #1=#:G757 |z| |s| |x| |w| |v|)
    (RETURN
     (SEQ
      (COND
       ((SPADCALL |ex| (QREFELT $ 43))
        (SPADCALL |dev| (SPADCALL |ex| (QREFELT $ 44)) 'NIL (QREFELT $ 45)))
       ('T
        (SEQ
         (EXIT
          (SEQ
           (SEQ
            (LETT |v| (SPADCALL |ex| (QREFELT $ 47))
                  . #2=(|OMEXPR;outputOMExpr|))
            (EXIT
             (COND
              ((NULL (QEQCAR |v| 1))
               (PROGN
                (LETT #1# (SPADCALL |dev| (QCDR |v|) (QREFELT $ 48)) . #2#)
                (GO #1#))))))
           (SEQ (LETT |w| (SPADCALL |ex| (QREFELT $ 50)) . #2#)
                (EXIT
                 (COND
                  ((NULL (QEQCAR |w| 1))
                   (PROGN
                    (LETT #1#
                          (|OMEXPR;outputOMArith1| |dev| "plus" (QCDR |w|) $)
                          . #2#)
                    (GO #1#))))))
           (SEQ (LETT |w| (SPADCALL |ex| (QREFELT $ 51)) . #2#)
                (EXIT
                 (COND
                  ((NULL (QEQCAR |w| 1))
                   (PROGN
                    (LETT #1#
                          (|OMEXPR;outputOMArith1| |dev| "times" (QCDR |w|) $)
                          . #2#)
                    (GO #1#))))))
           (SEQ (LETT |x| (SPADCALL |ex| (QREFELT $ 54)) . #2#)
                (EXIT
                 (COND
                  ((NULL (QEQCAR |x| 1))
                   (COND
                    ((NULL (EQL (QCDR (QCDR |x|)) 1))
                     (PROGN
                      (LETT #1#
                            (SEQ
                             (LETT |s|
                                   (SPADCALL (QCAR (QCDR |x|)) (QREFELT $ 56))
                                   . #2#)
                             (EXIT
                              (COND
                               ((NULL (QEQCAR |s| 1))
                                (PROGN
                                 (LETT #1#
                                       (SEQ (SPADCALL |dev| (QREFELT $ 18))
                                            (SPADCALL |dev| "arith1" "power"
                                                      (QREFELT $ 20))
                                            (SPADCALL |dev| (QCDR |s|)
                                                      (QREFELT $ 48))
                                            (SPADCALL |dev| (QCDR (QCDR |x|))
                                                      (QREFELT $ 57))
                                            (EXIT
                                             (SPADCALL |dev| (QREFELT $ 23))))
                                       . #2#)
                                 (GO #1#))))))
                            . #2#)
                      (GO #1#))))))))
           (SEQ (LETT |z| (SPADCALL |ex| (QREFELT $ 60)) . #2#)
                (EXIT
                 (COND
                  ((NULL (QEQCAR |z| 1))
                   (COND
                    ((NULL (EQL (QCDR (QCDR |z|)) 1))
                     (PROGN
                      (LETT #1#
                            (|OMEXPR;outputOMPower| |dev|
                             (LIST (QCAR (QCDR |z|))
                                   (SPADCALL (QCDR (QCDR |z|)) (QREFELT $ 61)))
                             $)
                            . #2#)
                      (GO #1#))))))))
           (LETT |k| (|SPADfirst| (SPADCALL |ex| (QREFELT $ 63))) . #2#)
           (EXIT
            (|OMEXPR;outputOMFunction| |dev|
             (SPADCALL (SPADCALL |k| (QREFELT $ 65)) (QREFELT $ 66))
             (SPADCALL |k| (QREFELT $ 67)) $))))
         #1# (EXIT #1#)))))))) 

(DEFUN |OMEXPR;OMwrite;ES;13| (|ex| $)
  (PROG (|s| |dev| |sp|)
    (RETURN
     (SEQ (LETT |s| "" . #1=(|OMEXPR;OMwrite;ES;13|))
          (LETT |sp| (OM-STRINGTOSTRINGPTR |s|) . #1#)
          (LETT |dev| (SPADCALL |sp| (SPADCALL (QREFELT $ 69)) (QREFELT $ 70))
                . #1#)
          (SPADCALL |dev| (QREFELT $ 71)) (|OMEXPR;outputOMExpr| |dev| |ex| $)
          (SPADCALL |dev| (QREFELT $ 72)) (SPADCALL |dev| (QREFELT $ 73))
          (LETT |s| (OM-STRINGPTRTOSTRING |sp|) . #1#) (EXIT |s|))))) 

(DEFUN |OMEXPR;OMwrite;EBS;14| (|ex| |wholeObj| $)
  (PROG (|s| |dev| |sp|)
    (RETURN
     (SEQ (LETT |s| "" . #1=(|OMEXPR;OMwrite;EBS;14|))
          (LETT |sp| (OM-STRINGTOSTRINGPTR |s|) . #1#)
          (LETT |dev| (SPADCALL |sp| (SPADCALL (QREFELT $ 69)) (QREFELT $ 70))
                . #1#)
          (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 71))))
          (|OMEXPR;outputOMExpr| |dev| |ex| $)
          (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 72))))
          (SPADCALL |dev| (QREFELT $ 73))
          (LETT |s| (OM-STRINGPTRTOSTRING |sp|) . #1#) (EXIT |s|))))) 

(DEFUN |OMEXPR;OMwrite;OmdEV;15| (|dev| |ex| $)
  (SEQ (SPADCALL |dev| (QREFELT $ 71)) (|OMEXPR;outputOMExpr| |dev| |ex| $)
       (EXIT (SPADCALL |dev| (QREFELT $ 72))))) 

(DEFUN |OMEXPR;OMwrite;OmdEBV;16| (|dev| |ex| |wholeObj| $)
  (SEQ (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 71))))
       (|OMEXPR;outputOMExpr| |dev| |ex| $)
       (EXIT (COND (|wholeObj| (SPADCALL |dev| (QREFELT $ 72))))))) 

(DEFUN |ExpressionToOpenMath| (#1=#:G768)
  (PROG ()
    (RETURN
     (PROG (#2=#:G769)
       (RETURN
        (COND
         ((LETT #2#
                (|lassocShiftWithFunction| (LIST (|devaluate| #1#))
                                           (HGET |$ConstructorCache|
                                                 '|ExpressionToOpenMath|)
                                           '|domainEqualList|)
                . #3=(|ExpressionToOpenMath|))
          (|CDRwithIncrement| #2#))
         ('T
          (UNWIND-PROTECT
              (PROG1 (|ExpressionToOpenMath;| #1#) (LETT #2# T . #3#))
            (COND
             ((NOT #2#)
              (HREM |$ConstructorCache| '|ExpressionToOpenMath|))))))))))) 

(DEFUN |ExpressionToOpenMath;| (|#1|)
  (PROG (|pv$| $ |dv$| DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|ExpressionToOpenMath|))
      (LETT |dv$| (LIST '|ExpressionToOpenMath| DV$1) . #1#)
      (LETT $ (GETREFV 77) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|ExpressionToOpenMath| (LIST DV$1)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 14
                (SPADCALL (LIST (CONS '|pi| (CONS "nums1" "pi")))
                          (QREFELT $ 13)))
      (QSETREFV $ 15
                (SPADCALL
                 (LIST (CONS '|exp| (CONS #2="transc1" "exp"))
                       (CONS '|log| (CONS #2# "ln"))
                       (CONS '|sin| (CONS #2# "sin"))
                       (CONS '|cos| (CONS #2# "cos"))
                       (CONS '|tan| (CONS #2# "tan"))
                       (CONS '|cot| (CONS #2# "cot"))
                       (CONS '|sec| (CONS #2# "sec"))
                       (CONS '|csc| (CONS #2# "csc"))
                       (CONS '|asin| (CONS #2# "arcsin"))
                       (CONS '|acos| (CONS #2# "arccos"))
                       (CONS '|atan| (CONS #2# "arctan"))
                       (CONS '|acot| (CONS #2# "arccot"))
                       (CONS '|asec| (CONS #2# "arcsec"))
                       (CONS '|acsc| (CONS #2# "arccsc"))
                       (CONS '|sinh| (CONS #2# "sinh"))
                       (CONS '|cosh| (CONS #2# "cosh"))
                       (CONS '|tanh| (CONS #2# "tanh"))
                       (CONS '|coth| (CONS #2# "coth"))
                       (CONS '|sech| (CONS #2# "sech"))
                       (CONS '|csch| (CONS #2# "csch"))
                       (CONS '|asinh| (CONS #2# "arcsinh"))
                       (CONS '|acosh| (CONS #2# "arccosh"))
                       (CONS '|atanh| (CONS #2# "arctanh"))
                       (CONS '|acoth| (CONS #2# "arccoth"))
                       (CONS '|asech| (CONS #2# "arcsech"))
                       (CONS '|acsch| (CONS #2# "arccsch"))
                       (CONS '|factorial| (CONS "integer1" "factorial"))
                       (CONS '|abs| (CONS "arith1" "abs")))
                 (QREFELT $ 13)))
      $)))) 

(MAKEPROP '|ExpressionToOpenMath| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|Expression| 6)
              (0 . |pi|) (|Record| (|:| |cd| 19) (|:| |name| 19))
              (|Record| (|:| |key| 35) (|:| |entry| 9)) (|List| 10)
              (|AssociationList| 35 9) (4 . |construct|)
              '|nullaryFunctionAList| '|unaryFunctionAList| (|Void|)
              (|OpenMathDevice|) (9 . |OMputApp|) (|String|)
              (14 . |OMputSymbol|) (|Boolean|) |OMEXPR;OMwrite;OmdEBV;16|
              (21 . |OMputEndApp|) (26 . |OMputBind|) (31 . |OMputBVar|)
              (36 . |OMputEndBVar|) (41 . |OMputEndBind|) (|Integer|)
              (|List| 7) (46 . |elt|) (52 . |One|) (56 . |One|) (60 . |eval|)
              (|Union| 9 '"failed") (|Symbol|) (67 . |search|) (73 . |coerce|)
              (78 . |string|) (|List| $) (83 . |concat|) (|OutputForm|)
              (88 . |coerce|) (93 . |ground?|) (98 . |ground|)
              (103 . |OMwrite|) (|Union| 35 '"failed") (110 . |retractIfCan|)
              (115 . |OMputVariable|) (|Union| 39 '#1="failed")
              (121 . |isPlus|) (126 . |isTimes|)
              (|Record| (|:| |var| (|Kernel| $)) (|:| |exponent| 28))
              (|Union| 52 '#1#) (131 . |isExpt|) (|Kernel| 7)
              (136 . |symbolIfCan|) (141 . |OMputInteger|)
              (|Record| (|:| |val| $) (|:| |exponent| 28)) (|Union| 58 '#1#)
              (147 . |isPower|) (152 . |coerce|) (|List| (|Kernel| $))
              (157 . |kernels|) (|BasicOperator|) (162 . |operator|)
              (167 . |name|) (172 . |argument|) (|OpenMathEncoding|)
              (177 . |OMencodingXML|) (181 . |OMopenString|)
              (187 . |OMputObject|) (192 . |OMputEndObject|) (197 . |OMclose|)
              |OMEXPR;OMwrite;ES;13| |OMEXPR;OMwrite;EBS;14|
              |OMEXPR;OMwrite;OmdEV;15|)
           '#(|OMwrite| 202) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 76
                                                 '(0 7 0 8 1 12 0 11 13 1 17 16
                                                   0 18 3 17 16 0 19 19 20 1 17
                                                   16 0 23 1 17 16 0 24 1 17 16
                                                   0 25 1 17 16 0 26 1 17 16 0
                                                   27 2 29 7 0 28 30 0 6 0 31 0
                                                   7 0 32 3 7 0 0 0 0 33 2 12
                                                   34 35 0 36 1 7 0 35 37 1 35
                                                   19 0 38 1 19 0 39 40 1 19 41
                                                   0 42 1 7 21 0 43 1 7 6 0 44
                                                   3 6 16 17 0 21 45 1 7 46 0
                                                   47 2 17 16 0 35 48 1 7 49 0
                                                   50 1 7 49 0 51 1 7 53 0 54 1
                                                   55 46 0 56 2 17 16 0 28 57 1
                                                   7 59 0 60 1 7 0 28 61 1 7 62
                                                   0 63 1 55 64 0 65 1 64 35 0
                                                   66 1 55 29 0 67 0 68 0 69 2
                                                   17 0 19 68 70 1 17 16 0 71 1
                                                   17 16 0 72 1 17 16 0 73 2 0
                                                   19 7 21 75 1 0 19 7 74 3 0
                                                   16 17 7 21 22 2 0 16 17 7
                                                   76)))))
           '|lookupComplete|)) 
