
(/VERSIONCHECK 2) 

(DEFUN |QUATCAT-;characteristic;Nni;1| ($) (SPADCALL (QREFELT $ 9))) 

(DEFUN |QUATCAT-;conjugate;2S;2| (|x| $)
  (SPADCALL (SPADCALL |x| (QREFELT $ 11))
            (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 13))
            (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 13))
            (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 13))
            (QREFELT $ 16))) 

(DEFUN |QUATCAT-;map;M2S;3| (|fn| |x| $)
  (SPADCALL (SPADCALL (SPADCALL |x| (QREFELT $ 11)) |fn|)
            (SPADCALL (SPADCALL |x| (QREFELT $ 12)) |fn|)
            (SPADCALL (SPADCALL |x| (QREFELT $ 14)) |fn|)
            (SPADCALL (SPADCALL |x| (QREFELT $ 15)) |fn|) (QREFELT $ 16))) 

(DEFUN |QUATCAT-;norm;SR;4| (|x| $)
  (SPADCALL (SPADCALL |x| (SPADCALL |x| (QREFELT $ 20)) (QREFELT $ 21))
            (QREFELT $ 22))) 

(DEFUN |QUATCAT-;=;2SB;5| (|x| |y| $)
  (COND
   ((SPADCALL (SPADCALL |x| (QREFELT $ 11)) (SPADCALL |y| (QREFELT $ 11))
              (QREFELT $ 25))
    (COND
     ((SPADCALL (SPADCALL |x| (QREFELT $ 12)) (SPADCALL |y| (QREFELT $ 12))
                (QREFELT $ 25))
      (COND
       ((SPADCALL (SPADCALL |x| (QREFELT $ 14)) (SPADCALL |y| (QREFELT $ 14))
                  (QREFELT $ 25))
        (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (SPADCALL |y| (QREFELT $ 15))
                  (QREFELT $ 25)))
       (#1='T 'NIL)))
     (#1# 'NIL)))
   (#1# 'NIL))) 

(DEFUN |QUATCAT-;+;3S;6| (|x| |y| $)
  (SPADCALL
   (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (SPADCALL |y| (QREFELT $ 11))
             (QREFELT $ 27))
   (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (SPADCALL |y| (QREFELT $ 12))
             (QREFELT $ 27))
   (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (SPADCALL |y| (QREFELT $ 14))
             (QREFELT $ 27))
   (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (SPADCALL |y| (QREFELT $ 15))
             (QREFELT $ 27))
   (QREFELT $ 16))) 

(DEFUN |QUATCAT-;-;3S;7| (|x| |y| $)
  (SPADCALL
   (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (SPADCALL |y| (QREFELT $ 11))
             (QREFELT $ 29))
   (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (SPADCALL |y| (QREFELT $ 12))
             (QREFELT $ 29))
   (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (SPADCALL |y| (QREFELT $ 14))
             (QREFELT $ 29))
   (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (SPADCALL |y| (QREFELT $ 15))
             (QREFELT $ 29))
   (QREFELT $ 16))) 

(DEFUN |QUATCAT-;-;2S;8| (|x| $)
  (SPADCALL (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 13))
            (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 13))
            (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 13))
            (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 13))
            (QREFELT $ 16))) 

(DEFUN |QUATCAT-;*;R2S;9| (|r| |x| $)
  (SPADCALL (SPADCALL |r| (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 32))
            (SPADCALL |r| (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 32))
            (SPADCALL |r| (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 32))
            (SPADCALL |r| (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 32))
            (QREFELT $ 16))) 

(DEFUN |QUATCAT-;*;I2S;10| (|n| |x| $)
  (SPADCALL (SPADCALL |n| (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 35))
            (SPADCALL |n| (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 35))
            (SPADCALL |n| (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 35))
            (SPADCALL |n| (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 35))
            (QREFELT $ 16))) 

(DEFUN |QUATCAT-;differentiate;SMS;11| (|x| |d| $)
  (SPADCALL (SPADCALL (SPADCALL |x| (QREFELT $ 11)) |d|)
            (SPADCALL (SPADCALL |x| (QREFELT $ 12)) |d|)
            (SPADCALL (SPADCALL |x| (QREFELT $ 14)) |d|)
            (SPADCALL (SPADCALL |x| (QREFELT $ 15)) |d|) (QREFELT $ 16))) 

(DEFUN |QUATCAT-;coerce;RS;12| (|r| $)
  (SPADCALL |r| (|spadConstant| $ 38) (|spadConstant| $ 38)
            (|spadConstant| $ 38) (QREFELT $ 16))) 

(DEFUN |QUATCAT-;coerce;IS;13| (|n| $)
  (SPADCALL (SPADCALL |n| (QREFELT $ 40)) (|spadConstant| $ 38)
            (|spadConstant| $ 38) (|spadConstant| $ 38) (QREFELT $ 16))) 

(DEFUN |QUATCAT-;one?;SB;14| (|x| $)
  (COND
   ((SPADCALL (SPADCALL |x| (QREFELT $ 11)) (|spadConstant| $ 42)
              (QREFELT $ 25))
    (COND
     ((SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 43))
      (COND
       ((SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 43))
        (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 43)))
       (#1='T 'NIL)))
     (#1# 'NIL)))
   (#1# 'NIL))) 

(DEFUN |QUATCAT-;zero?;SB;15| (|x| $)
  (COND
   ((SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 43))
    (COND
     ((SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 43))
      (COND
       ((SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 43))
        (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 43)))
       (#1='T 'NIL)))
     (#1# 'NIL)))
   (#1# 'NIL))) 

(DEFUN |QUATCAT-;retract;SR;16| (|x| $)
  (SEQ
   (COND
    ((SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 43))
     (COND
      ((SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 43))
       (COND
        ((NULL (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 43)))
         (EXIT (|error| #1="Cannot retract quaternion.")))))
      (#2='T (EXIT (|error| #1#)))))
    (#2# (EXIT (|error| #1#))))
   (EXIT (SPADCALL |x| (QREFELT $ 11))))) 

(DEFUN |QUATCAT-;retractIfCan;SU;17| (|x| $)
  (SEQ
   (COND
    ((SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 43))
     (COND
      ((SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 43))
       (COND
        ((NULL (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 43)))
         (EXIT (CONS 1 #1="failed")))))
      (#2='T (EXIT (CONS 1 #1#)))))
    (#2# (EXIT (CONS 1 #1#))))
   (EXIT (CONS 0 (SPADCALL |x| (QREFELT $ 11)))))) 

(DEFUN |QUATCAT-;coerce;SOf;18| (|x| $)
  (PROG (|part| |z| |y|)
    (RETURN
     (SEQ
      (COND
       ((SPADCALL |x| (QREFELT $ 49))
        (SPADCALL (|spadConstant| $ 38) (QREFELT $ 51)))
       ((NULL (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 43)))
        (SEQ
         (LETT |y|
               (SPADCALL (|spadConstant| $ 38) (SPADCALL |x| (QREFELT $ 12))
                         (SPADCALL |x| (QREFELT $ 14))
                         (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 16))
               . #1=(|QUATCAT-;coerce;SOf;18|))
         (EXIT
          (COND
           ((SPADCALL |y| (QREFELT $ 49))
            (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 51)))
           (#2='T
            (SPADCALL (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 51))
                      (SPADCALL |y| (QREFELT $ 52)) (QREFELT $ 53)))))))
       ((NULL (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 43)))
        (SEQ
         (LETT |y|
               (SPADCALL (|spadConstant| $ 38) (|spadConstant| $ 38)
                         (SPADCALL |x| (QREFELT $ 14))
                         (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 16))
               . #1#)
         (LETT |z|
               (SEQ (LETT |part| (SPADCALL '|i| (QREFELT $ 55)) . #1#)
                    (EXIT
                     (COND
                      ((SPADCALL (SPADCALL |x| (QREFELT $ 12))
                                 (|spadConstant| $ 42) (QREFELT $ 25))
                       |part|)
                      (#2#
                       (SPADCALL
                        (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 51))
                        |part| (QREFELT $ 56))))))
               . #1#)
         (EXIT
          (COND ((SPADCALL |y| (QREFELT $ 49)) |z|)
                (#2#
                 (SPADCALL |z| (SPADCALL |y| (QREFELT $ 52))
                           (QREFELT $ 53)))))))
       ((NULL (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 43)))
        (SEQ
         (LETT |y|
               (SPADCALL (|spadConstant| $ 38) (|spadConstant| $ 38)
                         (|spadConstant| $ 38) (SPADCALL |x| (QREFELT $ 15))
                         (QREFELT $ 16))
               . #1#)
         (LETT |z|
               (SEQ (LETT |part| (SPADCALL '|j| (QREFELT $ 55)) . #1#)
                    (EXIT
                     (COND
                      ((SPADCALL (SPADCALL |x| (QREFELT $ 14))
                                 (|spadConstant| $ 42) (QREFELT $ 25))
                       |part|)
                      (#2#
                       (SPADCALL
                        (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 51))
                        |part| (QREFELT $ 56))))))
               . #1#)
         (EXIT
          (COND ((SPADCALL |y| (QREFELT $ 49)) |z|)
                (#2#
                 (SPADCALL |z| (SPADCALL |y| (QREFELT $ 52))
                           (QREFELT $ 53)))))))
       ('T
        (SEQ (LETT |part| (SPADCALL '|k| (QREFELT $ 55)) . #1#)
             (EXIT
              (COND
               ((SPADCALL (SPADCALL |x| (QREFELT $ 15)) (|spadConstant| $ 42)
                          (QREFELT $ 25))
                |part|)
               (#2#
                (SPADCALL
                 (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 51)) |part|
                 (QREFELT $ 56)))))))))))) 

(DEFUN |QUATCAT-;inv;2S;19| (|x| $)
  (COND
   ((SPADCALL (SPADCALL |x| (QREFELT $ 58)) (|spadConstant| $ 38)
              (QREFELT $ 25))
    (|error| "This quaternion is not invertible."))
   ('T
    (SPADCALL (SPADCALL (SPADCALL |x| (QREFELT $ 58)) (QREFELT $ 59))
              (SPADCALL |x| (QREFELT $ 20)) (QREFELT $ 60))))) 

(DEFUN |QUATCAT-;convert;SIf;20| (|x| $)
  (PROG (|l|)
    (RETURN
     (SEQ
      (LETT |l|
            (LIST (SPADCALL (SPADCALL "quatern" (QREFELT $ 63)) (QREFELT $ 65))
                  (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 66))
                  (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 66))
                  (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 66))
                  (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 66)))
            |QUATCAT-;convert;SIf;20|)
      (EXIT (SPADCALL |l| (QREFELT $ 68))))))) 

(DEFUN |QUATCAT-;<;2SB;21| (|x| |y| $)
  (COND
   ((SPADCALL (SPADCALL |x| (QREFELT $ 11)) (SPADCALL |y| (QREFELT $ 11))
              (QREFELT $ 25))
    (COND
     ((SPADCALL (SPADCALL |x| (QREFELT $ 12)) (SPADCALL |y| (QREFELT $ 12))
                (QREFELT $ 25))
      (COND
       ((SPADCALL (SPADCALL |x| (QREFELT $ 14)) (SPADCALL |y| (QREFELT $ 14))
                  (QREFELT $ 25))
        (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (SPADCALL |y| (QREFELT $ 15))
                  (QREFELT $ 70)))
       (#1='T
        (SPADCALL (SPADCALL |x| (QREFELT $ 14)) (SPADCALL |y| (QREFELT $ 14))
                  (QREFELT $ 70)))))
     (#1#
      (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (SPADCALL |y| (QREFELT $ 12))
                (QREFELT $ 70)))))
   (#1#
    (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (SPADCALL |y| (QREFELT $ 11))
              (QREFELT $ 70))))) 

(DEFUN |QUATCAT-;abs;SR;22| (|x| $)
  (SPADCALL (SPADCALL |x| (QREFELT $ 58)) (QREFELT $ 72))) 

(DEFUN |QUATCAT-;rational?;SB;23| (|x| $)
  (COND
   ((SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 43))
    (COND
     ((SPADCALL (SPADCALL |x| (QREFELT $ 14)) (QREFELT $ 43))
      (SPADCALL (SPADCALL |x| (QREFELT $ 15)) (QREFELT $ 43)))
     (#1='T 'NIL)))
   (#1# 'NIL))) 

(DEFUN |QUATCAT-;rational;SF;24| (|x| $)
  (COND
   ((SPADCALL |x| (QREFELT $ 75))
    (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 77)))
   ('T (|error| "Not a rational number")))) 

(DEFUN |QUATCAT-;rationalIfCan;SU;25| (|x| $)
  (COND
   ((SPADCALL |x| (QREFELT $ 75))
    (CONS 0 (SPADCALL (SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 77))))
   ('T (CONS 1 "failed")))) 

(DEFUN |QuaternionCategory&| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|QuaternionCategory&|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|QuaternionCategory&| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 85) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (|HasCategory| |#2|
                                                         '(|IntegerNumberSystem|))
                                          (|HasCategory| |#2|
                                                         '(|RealNumberSystem|))
                                          (|HasCategory| |#2|
                                                         '(|CharacteristicNonZero|))
                                          (|HasCategory| |#2|
                                                         '(|CharacteristicZero|))
                                          (|HasCategory| |#2|
                                                         '(|ConvertibleTo|
                                                           (|InputForm|)))
                                          (|HasCategory| |#2| '(|Field|))
                                          (|HasCategory| |#2| '(|OrderedSet|))
                                          (|HasCategory| |#2|
                                                         '(|EntireRing|))))
                      . #1#))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (COND
       ((|testBitVector| |pv$| 6)
        (QSETREFV $ 61 (CONS (|dispatchFunction| |QUATCAT-;inv;2S;19|) $))))
      (COND
       ((|testBitVector| |pv$| 5)
        (QSETREFV $ 69
                  (CONS (|dispatchFunction| |QUATCAT-;convert;SIf;20|) $))))
      (COND
       ((|testBitVector| |pv$| 7)
        (QSETREFV $ 71 (CONS (|dispatchFunction| |QUATCAT-;<;2SB;21|) $))))
      (COND
       ((|testBitVector| |pv$| 2)
        (QSETREFV $ 73 (CONS (|dispatchFunction| |QUATCAT-;abs;SR;22|) $))))
      (COND
       ((|testBitVector| |pv$| 1)
        (PROGN
         (QSETREFV $ 74
                   (CONS (|dispatchFunction| |QUATCAT-;rational?;SB;23|) $))
         (QSETREFV $ 78
                   (CONS (|dispatchFunction| |QUATCAT-;rational;SF;24|) $))
         (QSETREFV $ 80
                   (CONS (|dispatchFunction| |QUATCAT-;rationalIfCan;SU;25|)
                         $)))))
      $)))) 

(MAKEPROP '|QuaternionCategory&| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|NonNegativeInteger|) (0 . |characteristic|)
              |QUATCAT-;characteristic;Nni;1| (4 . |real|) (9 . |imagI|)
              (14 . -) (19 . |imagJ|) (24 . |imagK|) (29 . |quatern|)
              |QUATCAT-;conjugate;2S;2| (|Mapping| 7 7) |QUATCAT-;map;M2S;3|
              (37 . |conjugate|) (42 . *) (48 . |retract|) |QUATCAT-;norm;SR;4|
              (|Boolean|) (53 . =) |QUATCAT-;=;2SB;5| (59 . +)
              |QUATCAT-;+;3S;6| (65 . -) |QUATCAT-;-;3S;7| |QUATCAT-;-;2S;8|
              (71 . *) |QUATCAT-;*;R2S;9| (|Integer|) (77 . *)
              |QUATCAT-;*;I2S;10| |QUATCAT-;differentiate;SMS;11| (83 . |Zero|)
              |QUATCAT-;coerce;RS;12| (87 . |coerce|) |QUATCAT-;coerce;IS;13|
              (92 . |One|) (96 . |zero?|) |QUATCAT-;one?;SB;14|
              |QUATCAT-;zero?;SB;15| |QUATCAT-;retract;SR;16|
              (|Union| 7 '"failed") |QUATCAT-;retractIfCan;SU;17|
              (101 . |zero?|) (|OutputForm|) (106 . |coerce|) (111 . |coerce|)
              (116 . +) (|Symbol|) (122 . |coerce|) (127 . *)
              |QUATCAT-;coerce;SOf;18| (133 . |norm|) (138 . |inv|) (143 . *)
              (149 . |inv|) (|String|) (154 . |coerce|) (|InputForm|)
              (159 . |convert|) (164 . |convert|) (|List| $) (169 . |convert|)
              (174 . |convert|) (179 . <) (185 . <) (191 . |sqrt|)
              (196 . |abs|) (201 . |rational?|) (206 . |rational?|)
              (|Fraction| 34) (211 . |rational|) (216 . |rational|)
              (|Union| 76 '"failed") (221 . |rationalIfCan|) (|List| 54)
              (|List| 8) (|Union| 34 '"failed") (|PositiveInteger|))
           '#(|zero?| 226 |retractIfCan| 231 |retract| 236 |rationalIfCan| 241
              |rational?| 246 |rational| 251 |one?| 256 |norm| 261 |map| 266
              |inv| 272 |differentiate| 277 |convert| 283 |conjugate| 288
              |coerce| 293 |characteristic| 308 |abs| 312 = 317 < 323 - 329 +
              340 * 346)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 80
                                                 '(0 7 8 9 1 6 7 0 11 1 6 7 0
                                                   12 1 7 0 0 13 1 6 7 0 14 1 6
                                                   7 0 15 4 6 0 7 7 7 7 16 1 6
                                                   0 0 20 2 6 0 0 0 21 1 6 7 0
                                                   22 2 7 24 0 0 25 2 7 0 0 0
                                                   27 2 7 0 0 0 29 2 7 0 0 0 32
                                                   2 7 0 34 0 35 0 7 0 38 1 7 0
                                                   34 40 0 7 0 42 1 7 24 0 43 1
                                                   6 24 0 49 1 7 50 0 51 1 6 50
                                                   0 52 2 50 0 0 0 53 1 54 50 0
                                                   55 2 50 0 0 0 56 1 6 7 0 58
                                                   1 7 0 0 59 2 6 0 7 0 60 1 0
                                                   0 0 61 1 54 0 62 63 1 64 0
                                                   54 65 1 7 64 0 66 1 64 0 67
                                                   68 1 0 64 0 69 2 7 24 0 0 70
                                                   2 0 24 0 0 71 1 7 0 0 72 1 0
                                                   7 0 73 1 0 24 0 74 1 6 24 0
                                                   75 1 7 76 0 77 1 0 76 0 78 1
                                                   0 79 0 80 1 0 24 0 45 1 0 47
                                                   0 48 1 0 7 0 46 1 0 79 0 80
                                                   1 0 24 0 74 1 0 76 0 78 1 0
                                                   24 0 44 1 0 7 0 23 2 0 0 18
                                                   0 19 1 0 0 0 61 2 0 0 0 18
                                                   37 1 0 64 0 69 1 0 0 0 17 1
                                                   0 0 7 39 1 0 0 34 41 1 0 50
                                                   0 57 0 0 8 10 1 0 7 0 73 2 0
                                                   24 0 0 26 2 0 24 0 0 71 1 0
                                                   0 0 31 2 0 0 0 0 30 2 0 0 0
                                                   0 28 2 0 0 7 0 33 2 0 0 34 0
                                                   36)))))
           '|lookupComplete|)) 
