
(/VERSIONCHECK 2) 

(DEFUN |ZMOD;size;Nni;1| ($) (QREFELT $ 6)) 

(DEFUN |ZMOD;characteristic;Nni;2| ($) (QREFELT $ 6)) 

(DEFUN |ZMOD;lookup;$Pi;3| (|x| $)
  (PROG (#1=#:G1799)
    (RETURN
     (COND ((SPADCALL |x| (QREFELT $ 11)) (QREFELT $ 6))
           ('T
            (PROG1 (LETT #1# (SPADCALL |x| (QREFELT $ 13)) |ZMOD;lookup;$Pi;3|)
              (|check-subtype| (> #1# 0) '(|PositiveInteger|) #1#))))))) 

(PUT '|ZMOD;convert;$I;4| '|SPADreplace| '(XLAM (|x|) |x|)) 

(DEFUN |ZMOD;convert;$I;4| (|x| $) |x|) 

(DEFUN |ZMOD;coerce;I$;5| (|n| $) (SPADCALL |n| (QREFELT $ 6) (QREFELT $ 18))) 

(DEFUN |ZMOD;coerce;$Of;6| (|x| $) (SPADCALL |x| (QREFELT $ 21))) 

(PUT '|ZMOD;Zero;$;7| '|SPADreplace| '(XLAM NIL 0)) 

(DEFUN |ZMOD;Zero;$;7| ($) 0) 

(PUT '|ZMOD;One;$;8| '|SPADreplace| '(XLAM NIL 1)) 

(DEFUN |ZMOD;One;$;8| ($) 1) 

(PUT '|ZMOD;init;$;9| '|SPADreplace| '(XLAM NIL 0)) 

(DEFUN |ZMOD;init;$;9| ($) 0) 

(DEFUN |ZMOD;nextItem;$U;10| (|n| $)
  (PROG (|m|)
    (RETURN
     (SEQ
      (LETT |m| (SPADCALL |n| (|spadConstant| $ 24) (QREFELT $ 26))
            |ZMOD;nextItem;$U;10|)
      (EXIT
       (COND
        ((SPADCALL |m| (|spadConstant| $ 23) (QREFELT $ 27)) (CONS 1 "failed"))
        ('T (CONS 0 |m|)))))))) 

(PUT '|ZMOD;=;2$B;11| '|SPADreplace| 'EQL) 

(DEFUN |ZMOD;=;2$B;11| (|x| |y| $) (EQL |x| |y|)) 

(DEFUN |ZMOD;*;3$;12| (|x| |y| $)
  (SPADCALL |x| |y| (QREFELT $ 6) (QREFELT $ 30))) 

(DEFUN |ZMOD;*;I2$;13| (|n| |x| $)
  (SPADCALL (SPADCALL |n| (QREFELT $ 6) (QREFELT $ 18)) |x| (QREFELT $ 6)
            (QREFELT $ 30))) 

(DEFUN |ZMOD;+;3$;14| (|x| |y| $)
  (SPADCALL |x| |y| (QREFELT $ 6) (QREFELT $ 33))) 

(DEFUN |ZMOD;-;3$;15| (|x| |y| $)
  (SPADCALL |x| |y| (QREFELT $ 6) (QREFELT $ 34))) 

(DEFUN |ZMOD;random;$;16| ($) (RANDOM (QREFELT $ 6))) 

(DEFUN |ZMOD;index;Pi$;17| (|a| $) (SPADCALL |a| (QREFELT $ 6) (QREFELT $ 18))) 

(DEFUN |ZMOD;-;2$;18| (|x| $)
  (COND ((SPADCALL |x| (QREFELT $ 11)) (|spadConstant| $ 23))
        ('T (- (QREFELT $ 6) |x|)))) 

(DEFUN |ZMOD;^;$Nni$;19| (|x| |n| $)
  (SPADCALL |x| |n| (QREFELT $ 6) (QREFELT $ 39))) 

(DEFUN |ZMOD;recip;$U;20| (|x| $)
  (PROG (|g| |c2| |c1| |#G23|)
    (RETURN
     (SEQ
      (PROGN
       (LETT |#G23| (SPADCALL |x| (QREFELT $ 6) (QREFELT $ 42))
             . #1=(|ZMOD;recip;$U;20|))
       (LETT |c1| (QVELT |#G23| 0) . #1#)
       (LETT |c2| (QVELT |#G23| 1) . #1#)
       (LETT |g| (QVELT |#G23| 2) . #1#)
       |#G23|)
      (EXIT
       (COND
        ((SPADCALL |g| (|spadConstant| $ 24) (QREFELT $ 27))
         (CONS 0 (SPADCALL |c1| (QREFELT $ 6) (QREFELT $ 18))))
        ('T (CONS 1 "failed")))))))) 

(DEFUN |ZMOD;bloodyCompiler| (|n| $)
  (SPADCALL |n| (QREFELT $ 6) (QREFELT $ 47))) 

(PUT '|ZMOD;convert;$I;22| '|SPADreplace| '(XLAM (|x|) |x|)) 

(DEFUN |ZMOD;convert;$I;22| (|x| $) |x|) 

(DEFUN |ZMOD;coerce;$Of;23| (|x| $) (SPADCALL |x| (QREFELT $ 21))) 

(DEFUN |ZMOD;coerce;I$;24| (|n| $) (|ZMOD;bloodyCompiler| |n| $)) 

(PUT '|ZMOD;Zero;$;25| '|SPADreplace| '(XLAM NIL 0)) 

(DEFUN |ZMOD;Zero;$;25| ($) 0) 

(PUT '|ZMOD;One;$;26| '|SPADreplace| '(XLAM NIL 1)) 

(DEFUN |ZMOD;One;$;26| ($) 1) 

(PUT '|ZMOD;init;$;27| '|SPADreplace| '(XLAM NIL 0)) 

(DEFUN |ZMOD;init;$;27| ($) 0) 

(DEFUN |ZMOD;nextItem;$U;28| (|n| $)
  (PROG (|m|)
    (RETURN
     (SEQ
      (LETT |m| (SPADCALL |n| (|spadConstant| $ 24) (QREFELT $ 26))
            |ZMOD;nextItem;$U;28|)
      (EXIT
       (COND
        ((SPADCALL |m| (|spadConstant| $ 23) (QREFELT $ 27)) (CONS 1 "failed"))
        ('T (CONS 0 |m|)))))))) 

(PUT '|ZMOD;=;2$B;29| '|SPADreplace| 'EQL) 

(DEFUN |ZMOD;=;2$B;29| (|x| |y| $) (EQL |x| |y|)) 

(DEFUN |ZMOD;*;3$;30| (|x| |y| $) (QSMULTMOD |x| |y| (QREFELT $ 46))) 

(DEFUN |ZMOD;*;I2$;31| (|n| |x| $)
  (QSMULTMOD (|ZMOD;bloodyCompiler| |n| $) |x| (QREFELT $ 46))) 

(DEFUN |ZMOD;+;3$;32| (|x| |y| $) (QSADDMOD |x| |y| (QREFELT $ 46))) 

(DEFUN |ZMOD;-;3$;33| (|x| |y| $) (QSDIFMOD |x| |y| (QREFELT $ 46))) 

(DEFUN |ZMOD;random;$;34| ($) (RANDOM (QREFELT $ 46))) 

(DEFUN |ZMOD;index;Pi$;35| (|a| $)
  (SPADCALL (SPADCALL |a| (QREFELT $ 19)) (QREFELT $ 46) (QREFELT $ 18))) 

(DEFUN |ZMOD;-;2$;36| (|x| $)
  (COND ((SPADCALL |x| (QREFELT $ 11)) (|spadConstant| $ 23))
        ('T (QSDIFFERENCE (QREFELT $ 46) |x|)))) 

(DEFUN |ZMOD;^;$Nni$;37| (|x| |n| $)
  (COND
   ((< |n| (QREFELT $ 6))
    (SPADCALL |x| (SPADCALL |n| (QREFELT $ 19)) (QREFELT $ 46) (QREFELT $ 39)))
   ('T
    (SPADCALL (SPADCALL |x| (QREFELT $ 13)) |n| (QREFELT $ 6) (QREFELT $ 48))))) 

(DEFUN |ZMOD;recip;$U;38| (|x| $)
  (PROG (|g| |c2| |c1| |#G44|)
    (RETURN
     (SEQ
      (PROGN
       (LETT |#G44| (SPADCALL |x| (QREFELT $ 46) (QREFELT $ 42))
             . #1=(|ZMOD;recip;$U;38|))
       (LETT |c1| (QVELT |#G44| 0) . #1#)
       (LETT |c2| (QVELT |#G44| 1) . #1#)
       (LETT |g| (QVELT |#G44| 2) . #1#)
       |#G44|)
      (EXIT
       (COND
        ((SPADCALL |g| (|spadConstant| $ 24) (QREFELT $ 27))
         (CONS 0 (SPADCALL |c1| (QREFELT $ 46) (QREFELT $ 18))))
        ('T (CONS 1 "failed")))))))) 

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

(DEFUN |IntegerMod;| (|#1|)
  (PROG (|pv$| $ |dv$| DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|IntegerMod|))
      (LETT |dv$| (LIST '|IntegerMod| DV$1) . #1#)
      (LETT $ (GETREFV 51) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|IntegerMod| (LIST DV$1) (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 16 (< MOST-POSITIVE-FIXNUM |#1|))
      (COND
       ((QREFELT $ 16)
        (PROGN
         (QSETREFV $ 17 (|Integer|))
         (QSETREFV $ 13 (CONS (|dispatchFunction| |ZMOD;convert;$I;4|) $))
         (QSETREFV $ 19 (CONS (|dispatchFunction| |ZMOD;coerce;I$;5|) $))
         (QSETREFV $ 22 (CONS (|dispatchFunction| |ZMOD;coerce;$Of;6|) $))
         (QSETREFV $ 23
                   (CONS IDENTITY
                         (FUNCALL (|dispatchFunction| |ZMOD;Zero;$;7|) $)))
         (QSETREFV $ 24
                   (CONS IDENTITY
                         (FUNCALL (|dispatchFunction| |ZMOD;One;$;8|) $)))
         (QSETREFV $ 25
                   (CONS IDENTITY
                         (FUNCALL (|dispatchFunction| |ZMOD;init;$;9|) $)))
         (QSETREFV $ 29 (CONS (|dispatchFunction| |ZMOD;nextItem;$U;10|) $))
         (QSETREFV $ 27 (CONS (|dispatchFunction| |ZMOD;=;2$B;11|) $))
         (QSETREFV $ 31 (CONS (|dispatchFunction| |ZMOD;*;3$;12|) $))
         (QSETREFV $ 32 (CONS (|dispatchFunction| |ZMOD;*;I2$;13|) $))
         (QSETREFV $ 26 (CONS (|dispatchFunction| |ZMOD;+;3$;14|) $))
         (QSETREFV $ 35 (CONS (|dispatchFunction| |ZMOD;-;3$;15|) $))
         (QSETREFV $ 36 (CONS (|dispatchFunction| |ZMOD;random;$;16|) $))
         (QSETREFV $ 37 (CONS (|dispatchFunction| |ZMOD;index;Pi$;17|) $))
         (QSETREFV $ 38 (CONS (|dispatchFunction| |ZMOD;-;2$;18|) $))
         (QSETREFV $ 40 (CONS (|dispatchFunction| |ZMOD;^;$Nni$;19|) $))
         (QSETREFV $ 43 (CONS (|dispatchFunction| |ZMOD;recip;$U;20|) $))))
       ('T
        (PROGN
         (SETELT $ 17 (|SingleInteger|))
         (QSETREFV $ 46 (SPADCALL |#1| (QREFELT $ 45)))
         NIL
         (QSETREFV $ 13 (CONS (|dispatchFunction| |ZMOD;convert;$I;22|) $))
         (QSETREFV $ 22 (CONS (|dispatchFunction| |ZMOD;coerce;$Of;23|) $))
         (QSETREFV $ 19 (CONS (|dispatchFunction| |ZMOD;coerce;I$;24|) $))
         (QSETREFV $ 23
                   (CONS IDENTITY
                         (FUNCALL (|dispatchFunction| |ZMOD;Zero;$;25|) $)))
         (QSETREFV $ 24
                   (CONS IDENTITY
                         (FUNCALL (|dispatchFunction| |ZMOD;One;$;26|) $)))
         (QSETREFV $ 25
                   (CONS IDENTITY
                         (FUNCALL (|dispatchFunction| |ZMOD;init;$;27|) $)))
         (QSETREFV $ 29 (CONS (|dispatchFunction| |ZMOD;nextItem;$U;28|) $))
         (QSETREFV $ 27 (CONS (|dispatchFunction| |ZMOD;=;2$B;29|) $))
         (QSETREFV $ 31 (CONS (|dispatchFunction| |ZMOD;*;3$;30|) $))
         (QSETREFV $ 32 (CONS (|dispatchFunction| |ZMOD;*;I2$;31|) $))
         (QSETREFV $ 26 (CONS (|dispatchFunction| |ZMOD;+;3$;32|) $))
         (QSETREFV $ 35 (CONS (|dispatchFunction| |ZMOD;-;3$;33|) $))
         (QSETREFV $ 36 (CONS (|dispatchFunction| |ZMOD;random;$;34|) $))
         (QSETREFV $ 37 (CONS (|dispatchFunction| |ZMOD;index;Pi$;35|) $))
         (QSETREFV $ 38 (CONS (|dispatchFunction| |ZMOD;-;2$;36|) $))
         (QSETREFV $ 40 (CONS (|dispatchFunction| |ZMOD;^;$Nni$;37|) $))
         (QSETREFV $ 43 (CONS (|dispatchFunction| |ZMOD;recip;$U;38|) $)))))
      $)))) 

(MAKEPROP '|IntegerMod| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|NonNegativeInteger|)
              |ZMOD;size;Nni;1| |ZMOD;characteristic;Nni;2| (|Boolean|)
              (0 . |zero?|) (|Integer|) (5 . |convert|) (|PositiveInteger|)
              |ZMOD;lookup;$Pi;3| '#:G1793 '|Rep| (10 . |positiveRemainder|)
              (16 . |coerce|) (|OutputForm|) (21 . |coerce|) (26 . |coerce|)
              (31 . |Zero|) (35 . |One|) (39 . |init|) (43 . +) (49 . =)
              (|Union| $ '"failed") (55 . |nextItem|) (60 . |mulmod|) (67 . *)
              (73 . *) (79 . |addmod|) (86 . |submod|) (93 . -) (99 . |random|)
              (103 . |index|) (108 . -) (113 . |powmod|) (120 . ^)
              (|Record| (|:| |coef1| $) (|:| |coef2| $) (|:| |generator| $))
              (126 . |extendedEuclidean|) (132 . |recip|) (|SingleInteger|)
              (137 . |coerce|) '|q| (142 . |positiveRemainder|)
              (148 . |powmod|) (|List| $) (|String|))
           '#(~= 155 |zero?| 161 |subtractIfCan| 166 |size| 172 |sample| 176
              |recip| 180 |random| 185 |one?| 189 |nextItem| 194 |lookup| 199
              |latex| 204 |init| 209 |index| 213 |hash| 218 |enumerate| 223
              |convert| 227 |coerce| 232 |characteristic| 242 ^ 246 |Zero| 258
              |One| 262 = 266 - 272 + 283 * 289)
           'NIL
           (CONS
            (|makeByteWordVec2| 1
                                '(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))
            (CONS
             '#(NIL |Ring&| NIL NIL NIL NIL |AbelianGroup&| NIL NIL
                |AbelianMonoid&| |Monoid&| NIL NIL |Finite&| |SemiGroup&|
                |AbelianSemiGroup&| |SetCategory&| NIL NIL NIL |BasicType&|
                NIL)
             (CONS
              '#((|CommutativeRing|) (|Ring|) (|BiModule| $$ $$) (|Rng|)
                 (|RightModule| $$) (|LeftModule| $$) (|AbelianGroup|)
                 (|CancellationAbelianMonoid|) (|SemiRing|) (|AbelianMonoid|)
                 (|Monoid|) (|SemiRng|) (|StepThrough|) (|Finite|)
                 (|SemiGroup|) (|AbelianSemiGroup|) (|SetCategory|)
                 (|ConvertibleTo| 12) (|CommutativeStar|) (|unitsKnown|)
                 (|BasicType|) (|CoercibleTo| 20))
              (|makeByteWordVec2| 50
                                  '(1 0 10 0 11 1 0 12 0 13 2 17 0 0 0 18 1 0 0
                                    12 19 1 17 20 0 21 1 0 20 0 22 0 0 0 23 0 0
                                    0 24 0 0 0 25 2 0 0 0 0 26 2 0 10 0 0 27 1
                                    0 28 0 29 3 17 0 0 0 0 30 2 0 0 0 0 31 2 0
                                    0 12 0 32 3 17 0 0 0 0 33 3 17 0 0 0 0 34 2
                                    0 0 0 0 35 0 0 0 36 1 0 0 14 37 1 0 0 0 38
                                    3 17 0 0 0 0 39 2 0 0 0 7 40 2 17 41 0 0 42
                                    1 0 28 0 43 1 44 0 12 45 2 12 0 0 0 47 3 12
                                    0 0 0 0 48 2 0 10 0 0 1 1 0 10 0 11 2 0 28
                                    0 0 1 0 0 7 8 0 0 0 1 1 0 28 0 43 0 0 0 36
                                    1 0 10 0 1 1 0 28 0 29 1 0 14 0 15 1 0 50 0
                                    1 0 0 0 25 1 0 0 14 37 1 0 44 0 1 0 0 49 1
                                    1 0 12 0 13 1 0 0 12 19 1 0 20 0 22 0 0 7 9
                                    2 0 0 0 7 40 2 0 0 0 14 1 0 0 0 23 0 0 0 24
                                    2 0 10 0 0 27 1 0 0 0 38 2 0 0 0 0 35 2 0 0
                                    0 0 26 2 0 0 12 0 32 2 0 0 0 0 31 2 0 0 7 0
                                    1 2 0 0 14 0 1)))))
           '|lookupComplete|)) 
