
(/VERSIONCHECK 2) 

(DEFUN |FRMOD;One;$;1| ($) (QREFELT $ 10)) 

(PUT '|FRMOD;module;V$;2| '|SPADreplace| '(XLAM (|v|) |v|)) 

(DEFUN |FRMOD;module;V$;2| (|v| $) |v|) 

(PUT '|FRMOD;basis;$V;3| '|SPADreplace| '(XLAM (|m|) |m|)) 

(DEFUN |FRMOD;basis;$V;3| (|m| $) |m|) 

(DEFUN |FRMOD;rowdiv| (|r| |f| $)
  (PROG (#0=#:G1822 #1=#:G1823 |i| #2=#:G1824)
    (RETURN
      (SEQ (PRIMVEC2ARR
               (PROGN
                 (LETT #0#
                       (GETREFV (QSADD1 (- #3=(QVSIZE |r|)
                                         #4=(SPADCALL |r|
                                             (QREFELT $ 29)))))
                       . #5=(|FRMOD;rowdiv|))
                 (SEQ (LETT #1# 0 . #5#) (LETT |i| #4# . #5#)
                      (LETT #2# #3# . #5#) G190
                      (COND ((> |i| #2#) (GO G191)))
                      (SEQ (EXIT (SETELT #0# #1#
                                         (SPADCALL
                                          (SPADCALL |r| |i|
                                           (QREFELT $ 30))
                                          |f| (QREFELT $ 31)))))
                      (LETT |i|
                            (PROG1 (+ |i| 1)
                              (LETT #1# (QSADD1 #1#) . #5#)) . #5#)
                      (GO G190) G191 (EXIT NIL))
                 #0#)))))) 

(DEFUN |FRMOD;coerce;$Of;5| (|m| $)
  (SPADCALL (SPADCALL |m| (QREFELT $ 26)) (QREFELT $ 33))) 

(DEFUN |FRMOD;W2A| (|v| $)
  (SPADCALL (SPADCALL |v| (|FRMOD;intmat| $) (QREFELT $ 36))
      (QREFELT $ 37))) 

(DEFUN |FRMOD;wmatrix| (|v| $)
  (SPADCALL (SPADCALL |v| (QREFELT $ 39)) (|FRMOD;invintmat| $)
      (QREFELT $ 40))) 

(DEFUN |FRMOD;getinvintmat| ($)
  (PROG (#0=#:G1832 |m| |i| #1=#:G1838 |j| #2=#:G1839)
    (RETURN
      (SEQ (LETT |m|
                 (PROG2 (LETT #0#
                              (SPADCALL (|FRMOD;intmat| $)
                                  (QREFELT $ 42))
                              . #3=(|FRMOD;getinvintmat|))
                        (QCDR #0#)
                   (|check-union| (QEQCAR #0# 0)
                       (|Matrix| (QREFELT $ 7)) #0#)) . #3#)
           (SEQ (LETT |i| (SPADCALL |m| (QREFELT $ 43)) . #3#)
                (LETT #1# (SPADCALL |m| (QREFELT $ 44)) . #3#) G190
                (COND ((> |i| #1#) #4=(GO G191)))
                (SEQ (EXIT (SEQ (LETT |j|
                                      (SPADCALL |m| (QREFELT $ 45)) . #3#)
                                (LETT #2#
                                      (SPADCALL |m| (QREFELT $ 46)) . #3#)
                                G190 (COND ((> |j| #2#) #4#))
                                (SEQ (EXIT
                                      (SPADCALL (QREFELT $ 21) |i| |j|
                                       (SPADCALL |m| |i| |j|
                                        (QREFELT $ 47))
                                       (QREFELT $ 48))))
                                (LETT |j| (+ |j| 1) . #3#) #5=(GO G190)
                                G191 (EXIT NIL))))
                (LETT |i| (+ |i| 1) . #3#) #5# G191 (EXIT NIL))
           (EXIT 'NIL))))) 

(DEFUN |FRMOD;getintmat| ($)
  (PROG (|m| |i| #0=#:G1844 |j| #1=#:G1845)
    (RETURN
      (SEQ (LETT |m| (SPADCALL (QREFELT $ 10) (QREFELT $ 39))
                 . #2=(|FRMOD;getintmat|))
           (SEQ (LETT |i| (SPADCALL |m| (QREFELT $ 43)) . #2#)
                (LETT #0# (SPADCALL |m| (QREFELT $ 44)) . #2#) G190
                (COND ((> |i| #0#) #3=(GO G191)))
                (SEQ (EXIT (SEQ (LETT |j|
                                      (SPADCALL |m| (QREFELT $ 45)) . #2#)
                                (LETT #1#
                                      (SPADCALL |m| (QREFELT $ 46)) . #2#)
                                G190 (COND ((> |j| #1#) #3#))
                                (SEQ (EXIT
                                      (SPADCALL (QREFELT $ 22) |i| |j|
                                       (SPADCALL |m| |i| |j|
                                        (QREFELT $ 47))
                                       (QREFELT $ 48))))
                                (LETT |j| (+ |j| 1) . #2#) #4=(GO G190)
                                G191 (EXIT NIL))))
                (LETT |i| (+ |i| 1) . #2#) #4# G191 (EXIT NIL))
           (EXIT 'NIL))))) 

(DEFUN |FRMOD;invintmat| ($)
  (SEQ (COND
         ((SPADCALL (QREFELT $ 15) (QREFELT $ 49))
          (SPADCALL (QREFELT $ 15) (|FRMOD;getinvintmat| $)
              (QREFELT $ 50))))
       (EXIT (QREFELT $ 21)))) 

(DEFUN |FRMOD;intmat| ($)
  (SEQ (COND
         ((SPADCALL (QREFELT $ 16) (QREFELT $ 49))
          (SPADCALL (QREFELT $ 16) (|FRMOD;getintmat| $)
              (QREFELT $ 50))))
       (EXIT (QREFELT $ 22)))) 

(DEFUN |FRMOD;vectProd| (|v1| |v2| $)
  (PROG (|v| |i| #0=#:G1855 |j| #1=#:G1856 |k|)
    (RETURN
      (SEQ (LETT |k|
                 (SPADCALL
                     (LETT |v|
                           (SPADCALL (* (QVSIZE |v1|) (QVSIZE |v2|))
                               (|spadConstant| $ 51) (QREFELT $ 52))
                           . #2=(|FRMOD;vectProd|))
                     (QREFELT $ 53)) . #2#)
           (SEQ (LETT |i| (SPADCALL |v1| (QREFELT $ 54)) . #2#)
                (LETT #0# (QVSIZE |v1|) . #2#) G190
                (COND ((> |i| #0#) #3=(GO G191)))
                (SEQ (EXIT (SEQ (LETT |j|
                                      (SPADCALL |v2| (QREFELT $ 54)) . #2#)
                                (LETT #1# (QVSIZE |v2|) . #2#) G190
                                (COND ((> |j| #1#) #3#))
                                (SEQ (SPADCALL |v| |k|
                                      (SPADCALL
                                       (SPADCALL |v1| |i|
                                        (QREFELT $ 55))
                                       (SPADCALL |v2| |j|
                                        (QREFELT $ 55))
                                       (QREFELT $ 56))
                                      (QREFELT $ 57))
                                     (EXIT (LETT |k| (+ |k| 1) . #2#)))
                                (LETT |j| (+ |j| 1) . #2#) #4=(GO G190)
                                G191 (EXIT NIL))))
                (LETT |i| (+ |i| 1) . #2#) #4# G191 (EXIT NIL))
           (EXIT |v|))))) 

(DEFUN |FRMOD;norm;$F;13| (|m| $)
  (COND
    ((NULL (EQL (QVSIZE (SPADCALL |m| (QREFELT $ 26)))
                (QVSIZE (QREFELT $ 10))))
     (|error| "Module not of rank n"))
    ('T
     (SPADCALL
         (SPADCALL
             (SPADCALL (SPADCALL |m| (QREFELT $ 26)) (QREFELT $ 39))
             (|FRMOD;invintmat| $) (QREFELT $ 40))
         (QREFELT $ 59))))) 

(DEFUN |FRMOD;*;3$;14| (|m1| |m2| $)
  (PROG (|cd| |m| #0=#:G1867 |i| #1=#:G1868 |u|)
    (RETURN
      (SEQ (LETT |m|
                 (SPADCALL
                     (QCAR (LETT |cd|
                                 (SPADCALL
                                     (|FRMOD;wmatrix|
                                      (|FRMOD;vectProd|
                                       (SPADCALL |m1| (QREFELT $ 26))
                                       (SPADCALL |m2| (QREFELT $ 26))
                                       $)
                                      $)
                                     (QREFELT $ 63))
                                 . #2=(|FRMOD;*;3$;14|)))
                     (QREFELT $ 66)) . #2#)
           (EXIT (SPADCALL
                     (PRIMVEC2ARR
                         (LIST2VEC
                             (PROGN
                               (LETT #0# NIL . #2#)
                               (SEQ (LETT |i|
                                     (SPADCALL |m| (QREFELT $ 67)) . #2#)
                                    (LETT #1#
                                     (SPADCALL |m| (QREFELT $ 68)) . #2#)
                                    G190 (COND ((> |i| #1#) (GO G191)))
                                    (SEQ
                                     (EXIT
                                      (COND
                                        ((SEQ
                                          (LETT |u|
                                           (|FRMOD;W2A|
                                            (|FRMOD;rowdiv|
                                             (SPADCALL |m| |i|
                                              (QREFELT $ 69))
                                             (QCDR |cd|) $)
                                            $) . #2#)
                                          (EXIT
                                           (COND
                                             ((SPADCALL |u|
                                               (|spadConstant| $ 51)
                                               (QREFELT $ 71))
                                              'NIL)
                                             ('T 'T))))
                                         (LETT #0#
                                          (CONS |u| #0#) . #2#)))))
                                    (LETT |i| (+ |i| 1) . #2#)
                                    (GO G190) G191
                                    (EXIT (NREVERSE0 #0#))))))
                     (QREFELT $ 25))))))) 

(DEFUN |FRMOD;module;Fi$;15| (|i| $)
  (SPADCALL (SPADCALL (SPADCALL |i| (QREFELT $ 74)) (QREFELT $ 25))
            (SPADCALL (QREFELT $ 10) (QREFELT $ 25)) (QREFELT $ 72))) 

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

(DEFUN |FramedModule;| (|#1| |#2| |#3| |#4| |#5|)
  (PROG (DV$1 DV$2 DV$3 DV$4 DV$5 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|FramedModule|))
        (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$|
              (LIST '|FramedModule| DV$1 DV$2 DV$3 DV$4 DV$5) . #0#)
        (LETT $ (GETREFV 79) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3
            (LETT |pv$|
                  (|buildPredVector| 0 0
                      (LIST (|HasCategory| |#4|
                                (LIST '|RetractableTo|
                                      (|devaluate| |#2|))))) . #0#))
        (|haddProp| |$ConstructorCache| '|FramedModule|
            (LIST DV$1 DV$2 DV$3 DV$4 DV$5) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7 |#2|)
        (QSETREFV $ 8 |#3|)
        (QSETREFV $ 9 |#4|)
        (QSETREFV $ 10 |#5|)
        (QSETREFV $ 11 (|Vector| |#4|))
        (QSETREFV $ 15 (SPADCALL 'T (QREFELT $ 14)))
        (QSETREFV $ 16 (SPADCALL 'T (QREFELT $ 14)))
        (QSETREFV $ 21
            (SPADCALL (QVSIZE |#5|) (QVSIZE |#5|) (|spadConstant| $ 17)
                (QREFELT $ 20)))
        (QSETREFV $ 22
            (SPADCALL (QVSIZE |#5|) (QVSIZE |#5|) (|spadConstant| $ 17)
                (QREFELT $ 20)))
        (COND
          ((|testBitVector| |pv$| 1)
           (QSETREFV $ 75
               (CONS (|dispatchFunction| |FRMOD;module;Fi$;15|) $))))
        $)))) 

(MAKEPROP '|FramedModule| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (|local| |#3|) (|local| |#4|) (|local| |#5|) '|Rep|
             (|Boolean|) (|Reference| 12) (0 . |ref|) '|iflag?|
             '|wflag?| (5 . |Zero|) (|NonNegativeInteger|) (|Matrix| 7)
             (9 . |new|) '|imat| '|wmat|
             (CONS IDENTITY
                   (FUNCALL (|dispatchFunction| |FRMOD;One;$;1|) $))
             (|Vector| 9) |FRMOD;module;V$;2| |FRMOD;basis;$V;3|
             (|Integer|) (|Vector| 6) (16 . |minIndex|) (21 . |elt|)
             (27 . /) (|OutputForm|) (33 . |coerce|)
             |FRMOD;coerce;$Of;5| (|Vector| 7) (38 . *)
             (44 . |represents|) (|Vector| $) (49 . |coordinates|)
             (54 . *) (|Union| $ '"failed") (60 . |inverse|)
             (65 . |minRowIndex|) (70 . |maxRowIndex|)
             (75 . |minColIndex|) (80 . |maxColIndex|) (85 . |qelt|)
             (92 . |setelt|) (100 . |elt|) (105 . |setelt|)
             (111 . |Zero|) (115 . |new|) (121 . |minIndex|)
             (126 . |minIndex|) (131 . |qelt|) (137 . *)
             (143 . |qsetelt!|) (150 . |One|) (154 . |determinant|)
             |FRMOD;norm;$F;13| (|Record| (|:| |num| 64) (|:| |den| 6))
             (|MatrixCommonDenominator| 6 7) (159 . |splitDenominator|)
             (|Matrix| 6) (|ModularHermitianRowReduction| 6)
             (164 . |rowEch|) (169 . |minRowIndex|)
             (174 . |maxRowIndex|) (179 . |row|) (185 . |Zero|)
             (189 . =) |FRMOD;*;3$;14| (|FractionalIdeal| 6 7 8 9)
             (195 . |basis|) (200 . |module|) (|PositiveInteger|)
             (|SingleInteger|) (|String|))
          '#(~= 205 |sample| 211 |recip| 215 |one?| 220 |norm| 225
             |module| 230 |latex| 240 |hash| 245 |coerce| 250 |basis|
             255 ^ 260 |One| 272 = 276 ** 282 * 294)
          'NIL
          (CONS (|makeByteWordVec2| 1 '(0 0 0 0 0))
                (CONS '#(|Monoid&| |SemiGroup&| |SetCategory&|
                         |BasicType&| NIL)
                      (CONS '#((|Monoid|) (|SemiGroup|) (|SetCategory|)
                               (|BasicType|) (|CoercibleTo| 32))
                            (|makeByteWordVec2| 78
                                '(1 13 0 12 14 0 7 0 17 3 19 0 18 18 7
                                  20 1 28 27 0 29 2 28 6 0 27 30 2 7 0
                                  6 6 31 1 24 32 0 33 2 19 35 35 0 36 1
                                  9 0 35 37 1 9 19 38 39 2 19 0 0 0 40
                                  1 19 41 0 42 1 19 27 0 43 1 19 27 0
                                  44 1 19 27 0 45 1 19 27 0 46 3 19 7 0
                                  27 27 47 4 19 7 0 27 27 7 48 1 13 12
                                  0 49 2 13 12 0 12 50 0 9 0 51 2 24 0
                                  18 9 52 1 24 27 0 53 1 11 27 0 54 2
                                  11 9 0 27 55 2 9 0 0 0 56 3 11 9 0 27
                                  9 57 0 9 0 58 1 19 7 0 59 1 62 61 19
                                  63 1 65 64 64 66 1 64 27 0 67 1 64 27
                                  0 68 2 64 28 0 27 69 0 6 0 70 2 9 12
                                  0 0 71 1 73 24 0 74 1 0 0 73 75 2 0
                                  12 0 0 1 0 0 0 1 1 0 41 0 1 1 0 12 0
                                  1 1 0 7 0 60 1 1 0 73 75 1 0 0 24 25
                                  1 0 78 0 1 1 0 77 0 1 1 0 32 0 34 1 0
                                  24 0 26 2 0 0 0 18 1 2 0 0 0 76 1 0 0
                                  0 23 2 0 12 0 0 1 2 0 0 0 18 1 2 0 0
                                  0 76 1 2 0 0 0 0 72)))))
          '|lookupComplete|)) 
