
(/VERSIONCHECK 2) 

(DEFUN |FM;*;R2$;1| (|r| |x| $)
  (PROG (#1=#:G1814 |u| #2=#:G1813)
    (RETURN
     (SEQ
      (COND ((SPADCALL |r| (QREFELT $ 10)) (|spadConstant| $ 11))
            ((SPADCALL |r| (|spadConstant| $ 12) (QREFELT $ 13)) |x|)
            ('T
             (PROGN
              (LETT #2# NIL . #3=(|FM;*;R2$;1|))
              (SEQ (LETT |u| NIL . #3#) (LETT #1# |x| . #3#) G190
                   (COND
                    ((OR (ATOM #1#) (PROGN (LETT |u| (CAR #1#) . #3#) NIL))
                     (GO G191)))
                   (SEQ
                    (EXIT
                     (LETT #2#
                           (CONS
                            (CONS (QCAR |u|)
                                  (SPADCALL |r| (QCDR |u|) (QREFELT $ 14)))
                            #2#)
                           . #3#)))
                   (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                   (EXIT (NREVERSE0 #2#)))))))))) 

(DEFUN |FM;*;R2$;2| (|r| |x| $)
  (PROG (|a| #1=#:G1820 |u| #2=#:G1819)
    (RETURN
     (SEQ
      (COND ((SPADCALL |r| (QREFELT $ 10)) (|spadConstant| $ 11))
            ((SPADCALL |r| (|spadConstant| $ 12) (QREFELT $ 13)) |x|)
            (#3='T
             (PROGN
              (LETT #2# NIL . #4=(|FM;*;R2$;2|))
              (SEQ (LETT |u| NIL . #4#) (LETT #1# |x| . #4#) G190
                   (COND
                    ((OR (ATOM #1#) (PROGN (LETT |u| (CAR #1#) . #4#) NIL))
                     (GO G191)))
                   (SEQ
                    (EXIT
                     (COND
                      ((SEQ
                        (LETT |a| (SPADCALL |r| (QCDR |u|) (QREFELT $ 14))
                              . #4#)
                        (EXIT
                         (COND
                          ((SPADCALL |a| (|spadConstant| $ 16) (QREFELT $ 13))
                           'NIL)
                          (#3# 'T))))
                       (LETT #2# (CONS (CONS (QCAR |u|) |a|) #2#) . #4#)))))
                   (LETT #1# (CDR #1#) . #4#) (GO G190) G191
                   (EXIT (NREVERSE0 #2#)))))))))) 

(DEFUN |FM;*;$R$;3| (|x| |r| $)
  (PROG (#1=#:G1825 |u| #2=#:G1824)
    (RETURN
     (SEQ
      (COND ((SPADCALL |r| (QREFELT $ 10)) (|spadConstant| $ 11))
            ((SPADCALL |r| (|spadConstant| $ 12) (QREFELT $ 13)) |x|)
            ('T
             (PROGN
              (LETT #2# NIL . #3=(|FM;*;$R$;3|))
              (SEQ (LETT |u| NIL . #3#) (LETT #1# |x| . #3#) G190
                   (COND
                    ((OR (ATOM #1#) (PROGN (LETT |u| (CAR #1#) . #3#) NIL))
                     (GO G191)))
                   (SEQ
                    (EXIT
                     (LETT #2#
                           (CONS
                            (CONS (QCAR |u|)
                                  (SPADCALL (QCDR |u|) |r| (QREFELT $ 14)))
                            #2#)
                           . #3#)))
                   (LETT #1# (CDR #1#) . #3#) (GO G190) G191
                   (EXIT (NREVERSE0 #2#)))))))))) 

(DEFUN |FM;*;$R$;4| (|x| |r| $)
  (PROG (|a| #1=#:G1831 |u| #2=#:G1830)
    (RETURN
     (SEQ
      (COND ((SPADCALL |r| (QREFELT $ 10)) (|spadConstant| $ 11))
            ((SPADCALL |r| (|spadConstant| $ 12) (QREFELT $ 13)) |x|)
            (#3='T
             (PROGN
              (LETT #2# NIL . #4=(|FM;*;$R$;4|))
              (SEQ (LETT |u| NIL . #4#) (LETT #1# |x| . #4#) G190
                   (COND
                    ((OR (ATOM #1#) (PROGN (LETT |u| (CAR #1#) . #4#) NIL))
                     (GO G191)))
                   (SEQ
                    (EXIT
                     (COND
                      ((SEQ
                        (LETT |a| (SPADCALL (QCDR |u|) |r| (QREFELT $ 14))
                              . #4#)
                        (EXIT
                         (COND
                          ((SPADCALL |a| (|spadConstant| $ 16) (QREFELT $ 13))
                           'NIL)
                          (#3# 'T))))
                       (LETT #2# (CONS (CONS (QCAR |u|) |a|) #2#) . #4#)))))
                   (LETT #1# (CDR #1#) . #4#) (GO G190) G191
                   (EXIT (NREVERSE0 #2#)))))))))) 

(DEFUN |FM;*;RS$;5| (|r| |s| $)
  (COND
   ((SPADCALL |r| (|spadConstant| $ 16) (QREFELT $ 13)) (|spadConstant| $ 11))
   ('T (LIST (CONS |s| |r|))))) 

(DEFUN |FM;*;SR$;6| (|s| |r| $)
  (COND
   ((SPADCALL |r| (|spadConstant| $ 16) (QREFELT $ 13)) (|spadConstant| $ 11))
   ('T (LIST (CONS |s| |r|))))) 

(DEFUN |FM;coerce;$Of;7| (|x| $)
  (PROG (|le| #1=#:G1849 |rec|)
    (RETURN
     (SEQ
      (COND ((NULL |x|) (SPADCALL (|spadConstant| $ 16) (QREFELT $ 21)))
            ('T
             (SEQ (LETT |le| NIL . #2=(|FM;coerce;$Of;7|))
                  (SEQ (LETT |rec| NIL . #2#) (LETT #1# (REVERSE |x|) . #2#)
                       G190
                       (COND
                        ((OR (ATOM #1#)
                             (PROGN (LETT |rec| (CAR #1#) . #2#) NIL))
                         (GO G191)))
                       (SEQ
                        (EXIT
                         (COND
                          ((SPADCALL (QCDR |rec|) (|spadConstant| $ 12)
                                     (QREFELT $ 13))
                           (LETT |le|
                                 (CONS (SPADCALL (QCAR |rec|) (QREFELT $ 22))
                                       |le|)
                                 . #2#))
                          ('T
                           (LETT |le|
                                 (CONS
                                  (SPADCALL
                                   (SPADCALL (QCDR |rec|) (QREFELT $ 21))
                                   (SPADCALL (QCAR |rec|) (QREFELT $ 22))
                                   (QREFELT $ 23))
                                  |le|)
                                 . #2#)))))
                       (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
                  (EXIT (SPADCALL (ELT $ 24) |le| (QREFELT $ 27)))))))))) 

(DEFUN |FM;leadingMonomial;$S;8| (|x| $) (QCAR (|SPADfirst| |x|))) 

(DEFUN |FM;support;$L;9| (|x| $)
  (PROG (#1=#:G1854 |t| #2=#:G1853)
    (RETURN
     (SEQ
      (PROGN
       (LETT #2# NIL . #3=(|FM;support;$L;9|))
       (SEQ (LETT |t| NIL . #3#) (LETT #1# |x| . #3#) G190
            (COND
             ((OR (ATOM #1#) (PROGN (LETT |t| (CAR #1#) . #3#) NIL))
              (GO G191)))
            (SEQ (EXIT (LETT #2# (CONS (QCAR |t|) #2#) . #3#)))
            (LETT #1# (CDR #1#) . #3#) (GO G190) G191
            (EXIT (NREVERSE0 #2#)))))))) 

(DEFUN |FM;coefficients;$L;10| (|x| $)
  (PROG (#1=#:G1858 |t| #2=#:G1857)
    (RETURN
     (SEQ
      (PROGN
       (LETT #2# NIL . #3=(|FM;coefficients;$L;10|))
       (SEQ (LETT |t| NIL . #3#) (LETT #1# |x| . #3#) G190
            (COND
             ((OR (ATOM #1#) (PROGN (LETT |t| (CAR #1#) . #3#) NIL))
              (GO G191)))
            (SEQ (EXIT (LETT #2# (CONS (QCDR |t|) #2#) . #3#)))
            (LETT #1# (CDR #1#) . #3#) (GO G190) G191
            (EXIT (NREVERSE0 #2#)))))))) 

(DEFUN |FM;monomials;$L;11| (|x| $)
  (PROG (#1=#:G1862 |t| #2=#:G1861)
    (RETURN
     (SEQ
      (PROGN
       (LETT #2# NIL . #3=(|FM;monomials;$L;11|))
       (SEQ (LETT |t| NIL . #3#) (LETT #1# |x| . #3#) G190
            (COND
             ((OR (ATOM #1#) (PROGN (LETT |t| (CAR #1#) . #3#) NIL))
              (GO G191)))
            (SEQ
             (EXIT
              (LETT #2#
                    (CONS (SPADCALL (QCAR |t|) (QCDR |t|) (QREFELT $ 34)) #2#)
                    . #3#)))
            (LETT #1# (CDR #1#) . #3#) (GO G190) G191
            (EXIT (NREVERSE0 #2#)))))))) 

(DEFUN |FM;retractIfCan;$U;12| (|x| $)
  (COND ((NULL (EQL (SPADCALL |x| (QREFELT $ 38)) 1)) (CONS 1 "failed"))
        ('T
         (COND
          ((SPADCALL (QCDR (|SPADfirst| |x|)) (|spadConstant| $ 12)
                     (QREFELT $ 13))
           (CONS 0 (QCAR (|SPADfirst| |x|))))
          ('T (CONS 1 "failed")))))) 

(DEFUN |FM;retract;$S;13| (|x| $)
  (PROG (|rr|)
    (RETURN
     (SEQ (LETT |rr| (SPADCALL |x| (QREFELT $ 40)) |FM;retract;$S;13|)
          (EXIT
           (COND ((QEQCAR |rr| 1) (|error| "FM1.retract impossible"))
                 ('T (QCDR |rr|)))))))) 

(DEFUN |FM;coerce;S$;14| (|s| $) (LIST (CONS |s| (|spadConstant| $ 12)))) 

(DEFUN |FM;monom;SR$;15| (|b| |r| $) (LIST (CONS |b| |r|))) 

(DEFUN |FM;coefficient;$SR;16| (|x| |s| $)
  (COND ((NULL |x|) (|spadConstant| $ 16))
        ((SPADCALL |s| (QCAR (|SPADfirst| |x|)) (QREFELT $ 43))
         (SPADCALL (CDR |x|) |s| (QREFELT $ 44)))
        ((SPADCALL (QCAR (|SPADfirst| |x|)) |s| (QREFELT $ 45))
         (QCDR (|SPADfirst| |x|)))
        ('T (|spadConstant| $ 16)))) 

(DEFUN |FM;monomial?;$B;17| (|x| $) (EQL (SPADCALL |x| (QREFELT $ 38)) 1)) 

(PUT '|FM;listOfTerms;$L;18| '|SPADreplace| '(XLAM (|x|) |x|)) 

(DEFUN |FM;listOfTerms;$L;18| (|x| $) |x|) 

(DEFUN |FM;numberOfMonomials;$Nni;19| (|x| $)
  (LENGTH (SPADCALL |x| (QREFELT $ 49)))) 

(DEFUN |FM;linearExtend;M$R;20| (|f| |x| $)
  (PROG (|res| #1=#:G1892 |t|)
    (RETURN
     (SEQ
      (COND ((SPADCALL |x| (QREFELT $ 50)) (|spadConstant| $ 16))
            ('T
             (SEQ
              (LETT |res| (|spadConstant| $ 16)
                    . #2=(|FM;linearExtend;M$R;20|))
              (SEQ (LETT |t| NIL . #2#)
                   (LETT #1# (SPADCALL |x| (QREFELT $ 49)) . #2#) G190
                   (COND
                    ((OR (ATOM #1#) (PROGN (LETT |t| (CAR #1#) . #2#) NIL))
                     (GO G191)))
                   (SEQ
                    (EXIT
                     (LETT |res|
                           (SPADCALL |res|
                                     (SPADCALL (QCDR |t|)
                                               (SPADCALL (QCAR |t|) |f|)
                                               (QREFELT $ 14))
                                     (QREFELT $ 51))
                           . #2#)))
                   (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
              (EXIT |res|)))))))) 

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

(DEFUN |FreeModule;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|FreeModule|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|FreeModule| DV$1 DV$2) . #1#)
      (LETT $ (GETREFV 60) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (|HasCategory| |#1|
                                                         '(|CommutativeRing|))
                                          (|HasCategory| |#1|
                                                         '(|Comparable|))))
                      . #1#))
      (|haddProp| |$ConstructorCache| '|FreeModule| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 (|List| (|Record| (|:| |k| |#2|) (|:| |c| |#1|))))
      (COND
       ((|HasCategory| |#1| '(|EntireRing|))
        (QSETREFV $ 15 (CONS (|dispatchFunction| |FM;*;R2$;1|) $)))
       ('T (QSETREFV $ 15 (CONS (|dispatchFunction| |FM;*;R2$;2|) $))))
      (COND
       ((|HasCategory| |#1| '(|EntireRing|))
        (QSETREFV $ 17 (CONS (|dispatchFunction| |FM;*;$R$;3|) $)))
       ('T (QSETREFV $ 17 (CONS (|dispatchFunction| |FM;*;$R$;4|) $))))
      (COND
       ((|testBitVector| |pv$| 1)
        (PROGN
         (QSETREFV $ 53
                   (CONS (|dispatchFunction| |FM;linearExtend;M$R;20|) $)))))
      $)))) 

(MAKEPROP '|FreeModule| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL (|IndexedDirectProductAbelianGroup| 6 7)
              (|local| |#1|) (|local| |#2|) '|Rep| (|Boolean|) (0 . |zero?|)
              (5 . |Zero|) (9 . |One|) (13 . =) (19 . *) (25 . *) (31 . |Zero|)
              (35 . *) |FM;*;RS$;5| |FM;*;SR$;6| (|OutputForm|) (41 . |coerce|)
              (46 . |coerce|) (51 . *) (57 . +) (|Mapping| 20 20 20)
              (|List| 20) (63 . |reduce|) |FM;coerce;$Of;7|
              |FM;leadingMonomial;$S;8| (|List| 7) |FM;support;$L;9| (|List| 6)
              |FM;coefficients;$L;10| |FM;monom;SR$;15| (|List| $)
              |FM;monomials;$L;11| (|NonNegativeInteger|)
              |FM;numberOfMonomials;$Nni;19| (|Union| 7 '"failed")
              |FM;retractIfCan;$U;12| |FM;retract;$S;13| |FM;coerce;S$;14|
              (69 . <) |FM;coefficient;$SR;16| (75 . =) |FM;monomial?;$B;17|
              (|Record| (|:| |k| 7) (|:| |c| 6)) (|List| 47)
              |FM;listOfTerms;$L;18| (81 . |zero?|) (86 . +) (|Mapping| 6 7)
              (92 . |linearExtend|) (|Mapping| 6 6) (|Integer|)
              (|Union| $ '"failed") (|PositiveInteger|) (|SingleInteger|)
              (|String|))
           '#(|zero?| 98 |support| 103 |retractIfCan| 108 |retract| 113
              |numberOfMonomials| 118 |monomials| 123 |monomial?| 128 |monom|
              133 |listOfTerms| 139 |linearExtend| 144 |leadingMonomial| 150
              |coerce| 155 |coefficients| 165 |coefficient| 170 |Zero| 176 *
              180)
           'NIL
           (CONS (|makeByteWordVec2| 2 '(0 1 0 0 0 0 0 0 0 0 2 0 0 0 0))
                 (CONS
                  '#(|FreeModuleCategory&| |Module&| NIL NIL NIL
                     |AbelianGroup&| NIL |AbelianMonoid&| NIL
                     |AbelianSemiGroup&| NIL |SetCategory&| |RetractableTo&|
                     |BasicType&| NIL)
                  (CONS
                   '#((|FreeModuleCategory| 6 7) (|Module| 6) (|BiModule| 6 6)
                      (|LeftModule| 6) (|RightModule| 6) (|AbelianGroup|)
                      (|CancellationAbelianMonoid|) (|AbelianMonoid|)
                      (|IndexedDirectProductCategory| 6 7) (|AbelianSemiGroup|)
                      (|Comparable|) (|SetCategory|) (|RetractableTo| 7)
                      (|BasicType|) (|CoercibleTo| 20))
                   (|makeByteWordVec2| 53
                                       '(1 6 9 0 10 0 0 0 11 0 6 0 12 2 6 9 0 0
                                         13 2 6 0 0 0 14 2 0 0 6 0 15 0 6 0 16
                                         2 0 0 0 6 17 1 6 20 0 21 1 7 20 0 22 2
                                         20 0 0 0 23 2 20 0 0 0 24 2 26 20 25 0
                                         27 2 7 9 0 0 43 2 7 9 0 0 45 1 0 9 0
                                         50 2 6 0 0 0 51 2 0 6 52 0 53 1 0 9 0
                                         50 1 0 30 0 31 1 0 39 0 40 1 0 7 0 41
                                         1 0 37 0 38 1 0 35 0 36 1 0 9 0 46 2 0
                                         0 7 6 34 1 0 48 0 49 2 1 6 52 0 53 1 0
                                         7 0 29 1 0 0 7 42 1 0 20 0 28 1 0 32 0
                                         33 2 0 6 0 7 44 0 0 0 11 2 0 0 6 7 18
                                         2 0 0 7 6 19 2 0 0 0 6 17 2 0 0 6 0
                                         15)))))
           '|lookupIncomplete|)) 
