
(/VERSIONCHECK 2) 

(PUT '|RULE;pattern;$P;1| '|SPADreplace| '(XLAM (|x|) (QVELT |x| 0))) 

(DEFUN |RULE;pattern;$P;1| (|x| $) (QVELT |x| 0)) 

(PUT '|RULE;lhs;$F;2| '|SPADreplace| '(XLAM (|x|) (QVELT |x| 1))) 

(DEFUN |RULE;lhs;$F;2| (|x| $) (QVELT |x| 1)) 

(PUT '|RULE;rhs;$F;3| '|SPADreplace| '(XLAM (|x|) (QVELT |x| 2))) 

(DEFUN |RULE;rhs;$F;3| (|x| $) (QVELT |x| 2)) 

(PUT '|RULE;quotedOperators;$L;4| '|SPADreplace|
     '(XLAM (|x|) (QVELT |x| 3))) 

(DEFUN |RULE;quotedOperators;$L;4| (|x| $) (QVELT |x| 3)) 

(PUT '|RULE;mkRule| '|SPADreplace| 'VECTOR) 

(DEFUN |RULE;mkRule| (|pt| |p| |s| |l| $) (VECTOR |pt| |p| |s| |l|)) 

(DEFUN |RULE;coerce;E$;6| (|eq| $)
  (SPADCALL (SPADCALL |eq| (QREFELT $ 17))
      (SPADCALL |eq| (QREFELT $ 18)) NIL (QREFELT $ 19))) 

(DEFUN |RULE;rule;2F$;7| (|l| |r| $)
  (SPADCALL |l| |r| NIL (QREFELT $ 19))) 

(DEFUN |RULE;elt;$2F;8| (|r| |s| $)
  (SPADCALL (LIST |r|) |s| (QREFELT $ 24))) 

(DEFUN |RULE;suchThat;$LM$;9| (|x| |l| |f| $)
  (|RULE;mkRule|
      (SPADCALL (SPADCALL |x| (QREFELT $ 11)) |l| |f| (QREFELT $ 28))
      (SPADCALL |x| (QREFELT $ 12)) (SPADCALL |x| (QREFELT $ 13))
      (SPADCALL |x| (QREFELT $ 15)) $)) 

(DEFUN |RULE;=;2$B;10| (|x| |y| $)
  (COND
    ((SPADCALL (SPADCALL |x| (QREFELT $ 12))
         (SPADCALL |y| (QREFELT $ 12)) (QREFELT $ 31))
     (COND
       ((SPADCALL (SPADCALL |x| (QREFELT $ 13))
            (SPADCALL |y| (QREFELT $ 13)) (QREFELT $ 31))
        (SPADCALL (SPADCALL |x| (QREFELT $ 15))
            (SPADCALL |y| (QREFELT $ 15)) (QREFELT $ 32)))
       ('T 'NIL)))
    ('T 'NIL))) 

(DEFUN |RULE;elt;$FPiF;11| (|r| |s| |n| $)
  (SPADCALL (LIST |r|) |s| |n| (QREFELT $ 35))) 

(DEFUN |RULE;F2Symbol| (|f| $)
  (PROG (|l| #0=#:G1853 |k| #1=#:G1854 #2=#:G1847)
    (RETURN
      (SEQ (LETT |l|
                 (SPADCALL (CONS #'|RULE;F2Symbol!0| $)
                     (SPADCALL |f| (QREFELT $ 41)) (QREFELT $ 44))
                 . #3=(|RULE;F2Symbol|))
           (EXIT (SPADCALL |f| |l|
                     (PROGN
                       (LETT #0# NIL . #3#)
                       (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 (LETT #0#
                                        (CONS
                                         (SPADCALL
                                          (PROG2
                                           (LETT #2#
                                            (SPADCALL |k|
                                             (QREFELT $ 39)) . #3#)
                                           (QCDR #2#)
                                            (|check-union|
                                             (QEQCAR #2# 0) (|Symbol|)
                                             #2#))
                                          (QREFELT $ 46))
                                         #0#) . #3#)))
                            (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                            (EXIT (NREVERSE0 #0#))))
                     (QREFELT $ 48))))))) 

(DEFUN |RULE;F2Symbol!0| (|#1| $)
  (QEQCAR (SPADCALL |#1| (QREFELT $ 39)) 0)) 

(DEFUN |RULE;retractIfCan;$U;13| (|r| $)
  (PROG (|u|)
    (RETURN
      (SEQ (COND
             ((SPADCALL (SPADCALL |r| (QREFELT $ 11)) (QREFELT $ 49))
              (SEQ (LETT |u|
                         (SPADCALL (SPADCALL |r| (QREFELT $ 12))
                             (QREFELT $ 51))
                         |RULE;retractIfCan;$U;13|)
                   (EXIT (COND
                           ((QEQCAR |u| 1) (CONS 1 "failed"))
                           ('T
                            (CONS 0
                                  (SPADCALL
                                      (|RULE;F2Symbol|
                                       (SPADCALL (QCDR |u|)
                                        (QREFELT $ 53))
                                       $)
                                      (SPADCALL |r| (QREFELT $ 13))
                                      (QREFELT $ 54))))))))
             ('T (CONS 1 "failed"))))))) 

(DEFUN |RULE;rule;2FL$;14| (|p| |s| |l| $)
  (PROG (|pt| |lh|)
    (RETURN
      (SEQ (LETT |lh|
                 (|RULE;transformLhs|
                     (LETT |pt| (SPADCALL |p| (QREFELT $ 57))
                           . #0=(|RULE;rule;2FL$;14|))
                     $) . #0#)
           (EXIT (|RULE;mkRule|
                     (SPADCALL (|RULE;opt| (QCDR |lh|) $)
                         (SPADCALL (|RULE;opt| (QCAR |lh|) $) |pt|
                             (QREFELT $ 58))
                         (QREFELT $ 59))
                     (SPADCALL (QCDR |lh|)
                         (SPADCALL (QCAR |lh|) |p| (QREFELT $ 60))
                         (QREFELT $ 61))
                     (SPADCALL (QCDR |lh|)
                         (SPADCALL (QCAR |lh|) |s| (QREFELT $ 60))
                         (QREFELT $ 61))
                     |l| $)))))) 

(DEFUN |RULE;opt| (|f| $)
  (COND
    ((QEQCAR (SPADCALL |f| (QREFELT $ 63)) 0)
     (SPADCALL |f| (QREFELT $ 57)))
    ('T (SPADCALL (SPADCALL |f| (QREFELT $ 65)) (QREFELT $ 57))))) 

(DEFUN |RULE;appear?| (|x| |l| $)
  (PROG (|p| #0=#:G1885 #1=#:G1884 #2=#:G1882)
    (RETURN
      (SEQ (EXIT (SEQ (SEQ (EXIT (SEQ (LETT |p| NIL
                                       . #3=(|RULE;appear?|))
                                      (LETT #0# |l| . #3#) G190
                                      (COND
                                        ((OR (ATOM #0#)
                                          (PROGN
                                            (LETT |p| (CAR #0#) . #3#)
                                            NIL))
                                         (GO G191)))
                                      (SEQ
                                       (EXIT
                                        (COND
                                          ((COND
                                             ((SPADCALL |p| |x|
                                               (QREFELT $ 66))
                                              'NIL)
                                             ('T 'T))
                                           (COND
                                             ((SPADCALL |x|
                                               (SPADCALL |p|
                                                (QREFELT $ 67))
                                               (QREFELT $ 69))
                                              (PROGN
                                                (LETT #2#
                                                 (PROGN
                                                   (LETT #1# 'T . #3#)
                                                   (GO #1#)) . #3#)
                                                (GO #2#))))))))
                                      (LETT #0# (CDR #0#) . #3#)
                                      (GO G190) G191 (EXIT NIL)))
                           #2# (EXIT #2#))
                      (EXIT 'NIL)))
           #1# (EXIT #1#))))) 

(DEFUN |RULE;bad?| (|u| $)
  (PROG (|x| #0=#:G1895 #1=#:G1887 #2=#:G1894 #3=#:G1891)
    (RETURN
      (SEQ (EXIT (COND
                   ((QEQCAR |u| 0)
                    (SEQ (SEQ (EXIT (SEQ
                                     (LETT |x| NIL . #4=(|RULE;bad?|))
                                     (LETT #0#
                                      (PROG2 (LETT #1# |u| . #4#)
                                       (QCDR #1#)
                                        (|check-union| (QEQCAR #1# 0)
                                         (|List|
                                          (|Pattern| (QREFELT $ 6)))
                                         #1#)) . #4#)
                                     G190
                                     (COND
                                       ((OR (ATOM #0#)
                                         (PROGN
                                           (LETT |x| (CAR #0#) . #4#)
                                           NIL))
                                        (GO G191)))
                                     (SEQ
                                      (EXIT
                                       (COND
                                         ((SPADCALL |x| (QREFELT $ 70))
                                          (COND
                                            ((NULL
                                              (|RULE;appear?| |x|
                                               (PROG2
                                                (LETT #1# |u| . #4#)
                                                (QCDR #1#)
                                                 (|check-union|
                                                  (QEQCAR #1# 0)
                                                  (|List|
                                                   (|Pattern|
                                                    (QREFELT $ 6)))
                                                  #1#))
                                               $))
                                             (PROGN
                                               (LETT #3#
                                                (PROGN
                                                  (LETT #2# 'NIL . #4#)
                                                  (GO #2#)) . #4#)
                                               (GO #3#))))))))
                                     (LETT #0# (CDR #0#) . #4#)
                                     (GO G190) G191 (EXIT NIL)))
                              #3# (EXIT #3#))
                         (EXIT 'T)))
                   ('T 'NIL)))
           #2# (EXIT #2#))))) 

(DEFUN |RULE;transformLhs| (|p| $)
  (COND
    ((|RULE;bad?| (SPADCALL |p| (QREFELT $ 72)) $)
     (CONS (SPADCALL (SPADCALL (QREFELT $ 73)) (QREFELT $ 46))
           (|spadConstant| $ 74)))
    ((|RULE;bad?| (SPADCALL |p| (QREFELT $ 75)) $)
     (CONS (|spadConstant| $ 77)
           (SPADCALL (SPADCALL (QREFELT $ 73)) (QREFELT $ 46))))
    ('T (CONS (|spadConstant| $ 77) (|spadConstant| $ 74))))) 

(DEFUN |RULE;coerce;$Of;19| (|x| $)
  (SPADCALL (SPADCALL (SPADCALL " == " (QREFELT $ 79)) (QREFELT $ 81))
      (SPADCALL (SPADCALL |x| (QREFELT $ 12)) (QREFELT $ 82))
      (SPADCALL (SPADCALL |x| (QREFELT $ 13)) (QREFELT $ 82))
      (QREFELT $ 83))) 

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

(DEFUN |RewriteRule;| (|#1| |#2| |#3|)
  (PROG (DV$1 DV$2 DV$3 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|RewriteRule|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT DV$3 (|devaluate| |#3|) . #0#)
        (LETT |dv$| (LIST '|RewriteRule| DV$1 DV$2 DV$3) . #0#)
        (LETT $ (GETREFV 86) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|RewriteRule|
            (LIST DV$1 DV$2 DV$3) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7 |#2|)
        (QSETREFV $ 8 |#3|)
        (QSETREFV $ 9
            (|Record| (|:| |pat| (|Pattern| |#1|)) (|:| |lft| |#3|)
                (|:| |rgt| |#3|) (|:| |qot| (|List| (|Symbol|)))))
        $)))) 

(MAKEPROP '|RewriteRule| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (|local| |#3|) '|Rep| (|Pattern| 6) |RULE;pattern;$P;1|
             |RULE;lhs;$F;2| |RULE;rhs;$F;3| (|List| 45)
             |RULE;quotedOperators;$L;4| (|Equation| 8) (0 . |lhs|)
             (5 . |rhs|) |RULE;rule;2FL$;14| |RULE;coerce;E$;6|
             |RULE;rule;2F$;7| (|List| (|RewriteRule| 6 7 8))
             (|ApplyRules| 6 7 8) (10 . |applyRules|) |RULE;elt;$2F;8|
             (|Mapping| 30 (|List| 8)) (|PatternFunctions1| 6 8)
             (16 . |suchThat|) |RULE;suchThat;$LM$;9| (|Boolean|)
             (23 . =) (29 . =) |RULE;=;2$B;10| (|PositiveInteger|)
             (35 . |applyRules|) |RULE;elt;$FPiF;11|
             (|Union| 45 '"failed") (|Kernel| 8) (42 . |symbolIfCan|)
             (|List| 52) (47 . |tower|) (|Mapping| 30 38) (|List| 38)
             (52 . |select!|) (|Symbol|) (58 . |coerce|) (|List| $)
             (63 . |eval|) (70 . |constant?|) (|Union| 52 '"failed")
             (75 . |retractIfCan|) (|Kernel| $) (80 . |coerce|)
             (85 . =) (|Union| 16 '"failed") |RULE;retractIfCan;$U;13|
             (91 . |convert|) (96 . +) (102 . *) (108 . +) (114 . *)
             (|Union| 7 '"failed") (120 . |retractIfCan|)
             (|FunctionSpaceAssertions| 7 8) (125 . |optional|)
             (130 . =) (136 . |variables|) (|List| 10)
             (141 . |member?|) (147 . |generic?|)
             (|Union| 47 '"failed") (152 . |isPlus|) (157 . |new|)
             (161 . |One|) (165 . |isTimes|) (170 . |Zero|)
             (174 . |Zero|) (|String|) (178 . |coerce|) (|OutputForm|)
             (183 . |coerce|) (188 . |coerce|) (193 . |infix|)
             |RULE;coerce;$Of;19| (|SingleInteger|))
          '#(~= 200 |suchThat| 206 |rule| 213 |rhs| 226 |retractIfCan|
             231 |retract| 236 |quotedOperators| 241 |pattern| 246
             |lhs| 251 |latex| 256 |hash| 261 |elt| 266 |coerce| 279 =
             289)
          'NIL
          (CONS (|makeByteWordVec2| 1 '(0 0 0 0 0))
                (CONS '#(|SetCategory&| |BasicType&| |RetractableTo&|
                         NIL NIL)
                      (CONS '#((|SetCategory|) (|BasicType|)
                               (|RetractableTo| (|Equation| 8))
                               (|Eltable| 8 8) (|CoercibleTo| 80))
                            (|makeByteWordVec2| 85
                                '(1 16 8 0 17 1 16 8 0 18 2 23 8 22 8
                                  24 3 27 10 10 14 26 28 2 8 30 0 0 31
                                  2 14 30 0 0 32 3 23 8 22 8 34 35 1 38
                                  37 0 39 1 8 40 0 41 2 43 0 42 0 44 1
                                  8 0 45 46 3 8 0 0 40 47 48 1 10 30 0
                                  49 1 8 50 0 51 1 8 0 52 53 2 16 0 8 8
                                  54 1 8 10 0 57 2 10 0 0 0 58 2 10 0 0
                                  0 59 2 8 0 0 0 60 2 8 0 0 0 61 1 8 62
                                  0 63 1 64 8 8 65 2 10 30 0 0 66 1 10
                                  47 0 67 2 68 30 10 0 69 1 10 30 0 70
                                  1 10 71 0 72 0 45 0 73 0 8 0 74 1 10
                                  71 0 75 0 7 0 76 0 8 0 77 1 45 0 78
                                  79 1 45 80 0 81 1 8 80 0 82 3 80 0 0
                                  0 0 83 2 0 30 0 0 1 3 0 0 0 14 26 29
                                  2 0 0 8 8 21 3 0 0 8 8 14 19 1 0 8 0
                                  13 1 0 55 0 56 1 0 16 0 1 1 0 14 0 15
                                  1 0 10 0 11 1 0 8 0 12 1 0 78 0 1 1 0
                                  85 0 1 3 0 8 0 8 34 36 2 0 8 0 8 25 1
                                  0 0 16 20 1 0 80 0 84 2 0 30 0 0 33)))))
          '|lookupComplete|)) 
