
(/VERSIONCHECK 2) 

(DEFUN |EMR;divide;2$R;1| (|x| |y| $)
  (PROG (|t| |xm| |invlcy| |yv| |r|)
    (RETURN
      (SEQ (LETT |t| (SPADCALL (QCDR |x|) (QCDR |y|) (QREFELT $ 10))
                 . #0=(|EMR;divide;2$R;1|))
           (EXIT (COND
                   ((QEQCAR |t| 1) (|error| "incompatible moduli"))
                   ('T
                    (SEQ (LETT |xm| (QCDR |t|) . #0#)
                         (LETT |yv| (QCAR |y|) . #0#)
                         (COND
                           ((SPADCALL (SPADCALL |yv| (QREFELT $ 13))
                                (|spadConstant| $ 14) (QREFELT $ 16))
                            (LETT |invlcy| (|spadConstant| $ 17) . #0#))
                           ('T
                            (SEQ (LETT |invlcy|
                                       (QCAR
                                        (SPADCALL
                                         (SPADCALL
                                          (SPADCALL
                                           (SPADCALL |yv|
                                            (QREFELT $ 13))
                                           (QREFELT $ 18))
                                          |xm| (QREFELT $ 19))
                                         (QREFELT $ 20))) . #0#)
                                 (EXIT (LETT |yv|
                                        (SPADCALL
                                         (SPADCALL |invlcy| |yv|
                                          (QREFELT $ 21))
                                         |xm| (QREFELT $ 9)) . #0#)))))
                         (LETT |r|
                               (SPADCALL (QCAR |x|) |yv|
                                   (QREFELT $ 23)) . #0#)
                         (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 (|t| |xm| |invlcy| |yv| |dy| |d| #0=#:G1858 |xv| #1=#:G1863)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |t|
                            (SPADCALL (QCDR |x|) (QCDR |y|)
                                (QREFELT $ 10))
                            . #2=(|EMR;rem;3$;2|))
                      (EXIT (COND
                              ((QEQCAR |t| 1)
                               (|error| "incompatible moduli"))
                              ('T
                               (SEQ (LETT |xm| (QCDR |t|) . #2#)
                                    (LETT |yv| (QCAR |y|) . #2#)
                                    (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))) . #2#)
                                        (EXIT
                                         (LETT |yv|
                                          (SPADCALL
                                           (SPADCALL |invlcy| |yv|
                                            (QREFELT $ 21))
                                           |xm| (QREFELT $ 9)) . #2#)))))
                                    (LETT |dy|
                                     (SPADCALL |yv| (QREFELT $ 26)) . #2#)
                                    (LETT |xv| (QCAR |x|) . #2#)
                                    (SEQ G190
                                     (COND
                                       ((NULL
                                         (SEQ
                                          (LETT |d|
                                           (-
                                            (SPADCALL |xv|
                                             (QREFELT $ 26))
                                            |dy|) . #2#)
                                          (EXIT
                                           (COND
                                             ((< |d| 0) 'NIL)
                                             ('T 'T)))))
                                        (GO G191)))
                                     (SEQ
                                      (LETT |xv|
                                       (SPADCALL
                                        (SPADCALL |xv|
                                         (PROG1 (LETT #0# |d| . #2#)
                                           (|check-subtype| (>= #0# 0)
                                            '(|NonNegativeInteger|)
                                            #0#))
                                         (SPADCALL |xv| (QREFELT $ 13))
                                         |yv| (QREFELT $ 29))
                                        |xm| (QREFELT $ 9)) . #2#)
                                      (EXIT
                                       (COND
                                         ((SPADCALL |xv|
                                           (|spadConstant| $ 30)
                                           (QREFELT $ 31))
                                          (PROGN
                                            (LETT #1#
                                             (CONS |xv| |xm|) . #2#)
                                            (GO #1#))))))
                                     NIL (GO G190) G191 (EXIT NIL))
                                    (EXIT (CONS |xv| |xm|))))))))
           #1# (EXIT #1#))))) 

(DEFUN |EMR;rem;3$;3| (|x| |y| $)
  (PROG (|t| |xm| |invlcy| |yv| |r|)
    (RETURN
      (SEQ (LETT |t| (SPADCALL (QCDR |x|) (QCDR |y|) (QREFELT $ 10))
                 . #0=(|EMR;rem;3$;3|))
           (EXIT (COND
                   ((QEQCAR |t| 1) (|error| "incompatible moduli"))
                   ('T
                    (SEQ (LETT |xm| (QCDR |t|) . #0#)
                         (LETT |yv| (QCAR |y|) . #0#)
                         (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))) . #0#)
                                 (EXIT (LETT |yv|
                                        (SPADCALL
                                         (SPADCALL |invlcy| |yv|
                                          (QREFELT $ 21))
                                         |xm| (QREFELT $ 9)) . #0#)))))
                         (LETT |r|
                               (SPADCALL (QCAR |x|) |yv|
                                   (QREFELT $ 23)) . #0#)
                         (EXIT (SPADCALL (QCDR |r|) |xm|
                                   (QREFELT $ 19))))))))))) 

(DEFUN |EMR;euclideanSize;$Nni;4| (|x| $)
  (SPADCALL (QCAR |x|) (QREFELT $ 26))) 

(DEFUN |EMR;unitCanonical;2$;5| (|x| $)
  (PROG (|invlcx|)
    (RETURN
      (SEQ (COND
             ((SPADCALL |x| (QREFELT $ 34)) |x|)
             ((EQL (SPADCALL (QCAR |x|) (QREFELT $ 26)) 0)
              (|spadConstant| $ 35))
             ((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$;5|)
                   (EXIT (SPADCALL |invlcx| |x| (QREFELT $ 36)))))))))) 

(DEFUN |EMR;unitNormal;$R;6| (|x| $)
  (PROG (|lcx| |invlcx|)
    (RETURN
      (SEQ (COND
             ((OR (SPADCALL |x| (QREFELT $ 34))
                  (SPADCALL (SPADCALL (QCAR |x|) (QREFELT $ 13))
                      (|spadConstant| $ 14) (QREFELT $ 16)))
              (VECTOR (|spadConstant| $ 35) |x| (|spadConstant| $ 35)))
             ('T
              (SEQ (LETT |lcx|
                         (SPADCALL
                             (SPADCALL
                                 (SPADCALL (QCAR |x|) (QREFELT $ 13))
                                 (QREFELT $ 18))
                             (QCDR |x|) (QREFELT $ 19))
                         . #0=(|EMR;unitNormal;$R;6|))
                   (LETT |invlcx|
                         (SPADCALL |lcx| (QREFELT $ 20)) . #0#)
                   (EXIT (COND
                           ((EQL (SPADCALL (QCAR |x|) (QREFELT $ 26))
                                 0)
                            (VECTOR |lcx| (|spadConstant| $ 35)
                                    |invlcx|))
                           ('T
                            (VECTOR |lcx|
                                    (SPADCALL |invlcx| |x|
                                     (QREFELT $ 36))
                                    |invlcx|))))))))))) 

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

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

(DEFUN |EuclideanModularRing;| (|#1| |#2| |#3| |#4| |#5| |#6|)
  (PROG (DV$1 DV$2 DV$3 DV$4 DV$5 DV$6 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|EuclideanModularRing|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT DV$3 (|devaluate| |#3|) . #0#)
        (LETT DV$4 (|devaluate| |#4|) . #0#)
        (LETT DV$5 (|devaluate| |#5|) . #0#)
        (LETT DV$6 (|devaluate| |#6|) . #0#)
        (LETT |dv$|
              (LIST '|EuclideanModularRing| DV$1 DV$2 DV$3 DV$4 DV$5
                    DV$6) . #0#)
        (LETT $ (GETREFV 55) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|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|)))
        (COND
          ((|HasSignature| |#2|
               (LIST '|fmecg|
                     (LIST (|devaluate| |#2|) (|devaluate| |#2|)
                           '(|NonNegativeInteger|) (|devaluate| |#1|)
                           (|devaluate| |#2|))))
           (QSETREFV $ 32 (CONS (|dispatchFunction| |EMR;rem;3$;2|) $)))
          ('T
           (QSETREFV $ 32 (CONS (|dispatchFunction| |EMR;rem;3$;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|
             (|NonNegativeInteger|) (47 . |degree|) (52 . |Zero|)
             (56 . |Zero|) (60 . |fmecg|) (68 . |Zero|) (72 . =)
             (78 . |rem|) |EMR;euclideanSize;$Nni;4| (84 . |zero?|)
             (89 . |One|) (93 . *) |EMR;unitCanonical;2$;5|
             (|Record| (|:| |unit| $) (|:| |canonical| $)
                 (|:| |associate| $))
             |EMR;unitNormal;$R;6| (99 . |elt|) |EMR;elt;$2R;7|
             (|Union| $ '"failed") (|Union| 44 '"failed") (|List| $)
             (|Record| (|:| |coef1| $) (|:| |coef2| $)
                 (|:| |generator| $))
             (|Record| (|:| |coef1| $) (|:| |coef2| $))
             (|Union| 46 '"failed")
             (|Record| (|:| |coef| 44) (|:| |generator| $))
             (|SparseUnivariatePolynomial| $) (|Integer|)
             (|PositiveInteger|) (|String|) (|OutputForm|)
             (|SingleInteger|))
          '#(|zero?| 105 |unitNormal| 110 |unitCanonical| 115 |rem| 120
             |reduce| 126 |inv| 132 |euclideanSize| 137 |elt| 142
             |divide| 148 |Zero| 154 |One| 158 * 162)
          '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| 53))
                            (|makeByteWordVec2| 41
                                '(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 25
                                  0 26 0 0 0 27 0 6 0 28 4 7 0 0 25 6 0
                                  29 0 7 0 30 2 7 15 0 0 31 2 0 0 0 0
                                  32 1 0 15 0 34 0 0 0 35 2 0 0 0 0 36
                                  2 7 0 0 0 40 1 0 15 0 34 1 0 38 0 39
                                  1 0 0 0 37 2 0 0 0 0 32 2 0 0 7 8 19
                                  1 0 0 0 20 1 0 25 0 33 2 0 7 0 7 41 2
                                  0 22 0 0 24 0 0 0 27 0 0 0 35 2 0 0 0
                                  0 36)))))
          '|lookupIncomplete|)) 
