
(/VERSIONCHECK 2) 

(DEFUN |EMR;divide;2$R;1| (|x| |y| $)
  (PROG (|r| |yv| |invlcy| |xm| |t|)
    (RETURN
     (SEQ
      (LETT |t| (SPADCALL (QCDR |x|) (QCDR |y|) (QREFELT $ 10))
            . #1=(|EMR;divide;2$R;1|))
      (EXIT
       (COND ((QEQCAR |t| 1) (|error| "incompatible moduli"))
             (#2='T
              (SEQ (LETT |xm| (QCDR |t|) . #1#) (LETT |yv| (QCAR |y|) . #1#)
                   (COND
                    ((SPADCALL (SPADCALL |yv| (QREFELT $ 13))
                               (|spadConstant| $ 14) (QREFELT $ 16))
                     (LETT |invlcy| (|spadConstant| $ 17) . #1#))
                    (#2#
                     (SEQ
                      (LETT |invlcy|
                            (QCAR
                             (SPADCALL
                              (SPADCALL
                               (SPADCALL (SPADCALL |yv| (QREFELT $ 13))
                                         (QREFELT $ 18))
                               |xm| (QREFELT $ 19))
                              (QREFELT $ 20)))
                            . #1#)
                      (EXIT
                       (LETT |yv|
                             (SPADCALL (SPADCALL |invlcy| |yv| (QREFELT $ 21))
                                       |xm| (QREFELT $ 9))
                             . #1#)))))
                   (LETT |r| (SPADCALL (QCAR |x|) |yv| (QREFELT $ 23)) . #1#)
                   (EXIT
                    (CONS
                     (SPADCALL (SPADCALL |invlcy| (QCAR |r|) (QREFELT $ 21))
                               |xm| (QREFELT $ 19))
                     (SPADCALL (QCDR |r|) |xm| (QREFELT $ 19)))))))))))) 

(DEFUN |EMR;rem;3$;2| (|x| |y| $)
  (PROG (|r| |yv| |invlcy| |xm| |t|)
    (RETURN
     (SEQ
      (LETT |t| (SPADCALL (QCDR |x|) (QCDR |y|) (QREFELT $ 10))
            . #1=(|EMR;rem;3$;2|))
      (EXIT
       (COND ((QEQCAR |t| 1) (|error| "incompatible moduli"))
             ('T
              (SEQ (LETT |xm| (QCDR |t|) . #1#) (LETT |yv| (QCAR |y|) . #1#)
                   (COND
                    ((NULL
                      (SPADCALL (SPADCALL |yv| (QREFELT $ 13))
                                (|spadConstant| $ 14) (QREFELT $ 16)))
                     (SEQ
                      (LETT |invlcy|
                            (QCAR
                             (SPADCALL
                              (SPADCALL
                               (SPADCALL (SPADCALL |yv| (QREFELT $ 13))
                                         (QREFELT $ 18))
                               |xm| (QREFELT $ 19))
                              (QREFELT $ 20)))
                            . #1#)
                      (EXIT
                       (LETT |yv|
                             (SPADCALL (SPADCALL |invlcy| |yv| (QREFELT $ 21))
                                       |xm| (QREFELT $ 9))
                             . #1#)))))
                   (LETT |r| (SPADCALL (QCAR |x|) |yv| (QREFELT $ 23)) . #1#)
                   (EXIT (SPADCALL (QCDR |r|) |xm| (QREFELT $ 19))))))))))) 

(DEFUN |EMR;euclideanSize;$Nni;3| (|x| $) (SPADCALL (QCAR |x|) (QREFELT $ 27))) 

(DEFUN |EMR;unitCanonical;2$;4| (|x| $)
  (PROG (|invlcx|)
    (RETURN
     (SEQ
      (COND ((SPADCALL |x| (QREFELT $ 29)) |x|)
            ((EQL (SPADCALL (QCAR |x|) (QREFELT $ 27)) 0)
             (|spadConstant| $ 31))
            ((SPADCALL (SPADCALL (QCAR |x|) (QREFELT $ 13))
                       (|spadConstant| $ 14) (QREFELT $ 16))
             |x|)
            ('T
             (SEQ
              (LETT |invlcx|
                    (SPADCALL
                     (SPADCALL
                      (SPADCALL (SPADCALL (QCAR |x|) (QREFELT $ 13))
                                (QREFELT $ 18))
                      (QCDR |x|) (QREFELT $ 19))
                     (QREFELT $ 20))
                    |EMR;unitCanonical;2$;4|)
              (EXIT (SPADCALL |invlcx| |x| (QREFELT $ 32)))))))))) 

(DEFUN |EMR;unitNormal;$R;5| (|x| $)
  (PROG (|invlcx| |lcx|)
    (RETURN
     (SEQ
      (COND
       ((OR (SPADCALL |x| (QREFELT $ 29))
            (SPADCALL (SPADCALL (QCAR |x|) (QREFELT $ 13))
                      (|spadConstant| $ 14) (QREFELT $ 16)))
        (VECTOR (|spadConstant| $ 31) |x| (|spadConstant| $ 31)))
       ('T
        (SEQ
         (LETT |lcx|
               (SPADCALL
                (SPADCALL (SPADCALL (QCAR |x|) (QREFELT $ 13)) (QREFELT $ 18))
                (QCDR |x|) (QREFELT $ 19))
               . #1=(|EMR;unitNormal;$R;5|))
         (LETT |invlcx| (SPADCALL |lcx| (QREFELT $ 20)) . #1#)
         (EXIT
          (COND
           ((EQL (SPADCALL (QCAR |x|) (QREFELT $ 27)) 0)
            (VECTOR |lcx| (|spadConstant| $ 31) |invlcx|))
           ('T
            (VECTOR |lcx| (SPADCALL |invlcx| |x| (QREFELT $ 32))
                    |invlcx|))))))))))) 

(DEFUN |EMR;elt;$2R;6| (|x| |s| $)
  (SPADCALL (SPADCALL (QCAR |x|) |s| (QREFELT $ 36)) (QCDR |x|) (QREFELT $ 9))) 

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

(DEFUN |EuclideanModularRing;| (|#1| |#2| |#3| |#4| |#5| |#6|)
  (PROG (|pv$| $ |dv$| DV$6 DV$5 DV$4 DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|EuclideanModularRing|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT DV$3 (|devaluate| |#3|) . #1#)
      (LETT DV$4 (|devaluate| |#4|) . #1#)
      (LETT DV$5 (|devaluate| |#5|) . #1#)
      (LETT DV$6 (|devaluate| |#6|) . #1#)
      (LETT |dv$| (LIST '|EuclideanModularRing| DV$1 DV$2 DV$3 DV$4 DV$5 DV$6)
            . #1#)
      (LETT $ (GETREFV 51) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|EuclideanModularRing|
                  (LIST DV$1 DV$2 DV$3 DV$4 DV$5 DV$6) (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (QSETREFV $ 9 |#4|)
      (QSETREFV $ 10 |#5|)
      (QSETREFV $ 11 |#6|)
      (QSETREFV $ 12 (|Record| (|:| |val| |#2|) (|:| |modulo| |#3|)))
      $)))) 

(MAKEPROP '|EuclideanModularRing| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL (|ModularRing| 7 8 9 10 11) (|local| |#1|)
              (|local| |#2|) (|local| |#3|) (|local| |#4|) (|local| |#5|)
              (|local| |#6|) '|Rep| (0 . |leadingCoefficient|) (5 . |One|)
              (|Boolean|) (9 . =) (15 . |One|) (19 . |coerce|) (24 . |reduce|)
              (30 . |inv|) (35 . *)
              (|Record| (|:| |quotient| $) (|:| |remainder| $))
              (41 . |monicDivide|) |EMR;divide;2$R;1| |EMR;rem;3$;2|
              (|NonNegativeInteger|) (47 . |degree|) |EMR;euclideanSize;$Nni;3|
              (52 . |zero?|) (57 . |Zero|) (61 . |One|) (65 . *)
              |EMR;unitCanonical;2$;4|
              (|Record| (|:| |unit| $) (|:| |canonical| $) (|:| |associate| $))
              |EMR;unitNormal;$R;5| (71 . |elt|) |EMR;elt;$2R;6|
              (|Union| $ '"failed") (|Union| 40 '#1="failed") (|List| $)
              (|Record| (|:| |coef1| $) (|:| |coef2| $) (|:| |generator| $))
              (|Record| (|:| |coef1| $) (|:| |coef2| $)) (|Union| 42 '#1#)
              (|Record| (|:| |coef| 40) (|:| |generator| $))
              (|SparseUnivariatePolynomial| $) (|Integer|) (|PositiveInteger|)
              (|String|) (|OutputForm|) (|SingleInteger|))
           '#(|zero?| 77 |unitNormal| 82 |unitCanonical| 87 |rem| 92 |reduce|
              98 |inv| 104 |euclideanSize| 109 |elt| 114 |divide| 120 |Zero|
              126 |One| 130 * 134)
           '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 0
                                  0 0 0 0))
            (CONS
             '#(|EuclideanDomain&| NIL |GcdDomain&| |IntegralDomain&|
                |Algebra&| NIL NIL |Module&| NIL |Ring&| NIL NIL NIL
                |AbelianGroup&| NIL NIL |AbelianMonoid&| |Monoid&| NIL
                |SemiGroup&| |AbelianSemiGroup&| |SetCategory&| NIL NIL NIL
                |BasicType&| NIL)
             (CONS
              '#((|EuclideanDomain|) (|PrincipalIdealDomain|) (|GcdDomain|)
                 (|IntegralDomain|) (|Algebra| $$) (|CommutativeRing|)
                 (|EntireRing|) (|Module| $$) (|BiModule| $$ $$) (|Ring|)
                 (|LeftModule| $$) (|Rng|) (|RightModule| $$) (|AbelianGroup|)
                 (|CancellationAbelianMonoid|) (|SemiRing|) (|AbelianMonoid|)
                 (|Monoid|) (|SemiRng|) (|SemiGroup|) (|AbelianSemiGroup|)
                 (|SetCategory|) (|noZeroDivisors|) (|CommutativeStar|)
                 (|unitsKnown|) (|BasicType|) (|CoercibleTo| 49))
              (|makeByteWordVec2| 37
                                  '(1 7 6 0 13 0 6 0 14 2 6 15 0 0 16 0 7 0 17
                                    1 7 0 6 18 2 0 0 7 8 19 1 0 0 0 20 2 7 0 0
                                    0 21 2 7 22 0 0 23 1 7 26 0 27 1 0 15 0 29
                                    0 0 0 30 0 0 0 31 2 0 0 0 0 32 2 7 0 0 0 36
                                    1 0 15 0 29 1 0 34 0 35 1 0 0 0 33 2 0 0 0
                                    0 25 2 0 0 7 8 19 1 0 0 0 20 1 0 26 0 28 2
                                    0 7 0 7 37 2 0 22 0 0 24 0 0 0 30 0 0 0 31
                                    2 0 0 0 0 32)))))
           '|lookupIncomplete|)) 
