
(/VERSIONCHECK 2) 

(DEFPARAMETER |SquareMatrixCategory;CAT| 'NIL) 

(DEFPARAMETER |SquareMatrixCategory;AL| 'NIL) 

(DEFUN |SquareMatrixCategory| (&REST #1=#:G1806)
  (LET (#2=#:G1807)
    (COND
     ((SETQ #2# (|assoc| #3=(|devaluateList| #1#) |SquareMatrixCategory;AL|))
      (CDR #2#))
     (T
      (SETQ |SquareMatrixCategory;AL|
              (|cons5|
               (CONS #3# (SETQ #2# (APPLY #'|SquareMatrixCategory;| #1#)))
               |SquareMatrixCategory;AL|))
      #2#)))) 

(DEFUN |SquareMatrixCategory;| (|t#1| |t#2| |t#3| |t#4|)
  (PROG (#1=#:G1805)
    (RETURN
     (PROG1
         (LETT #1#
               (|sublisV|
                (PAIR '(|t#1| |t#2| |t#3| |t#4|)
                      (LIST (|devaluate| |t#1|) (|devaluate| |t#2|)
                            (|devaluate| |t#3|) (|devaluate| |t#4|)))
                (COND (|SquareMatrixCategory;CAT|)
                      ('T
                       (LETT |SquareMatrixCategory;CAT|
                             (|Join| (|SemiRng|) (|AbelianMonoid|)
                                     (|BiModule| '|t#2| '|t#2|)
                                     (|RectangularMatrixCategory| |t#1| |t#1|
                                                                  '|t#2| '|t#3|
                                                                  '|t#4|)
                                     (|FullyRetractableTo| '|t#2|)
                                     (|mkCategory|
                                      '(((|scalarMatrix| ($ |t#2|)) T)
                                        ((|diagonalMatrix| ($ (|List| |t#2|)))
                                         T)
                                        ((|diagonal| (|t#3| $)) T)
                                        ((|trace| (|t#2| $)) T)
                                        ((|diagonalProduct| (|t#2| $)) T)
                                        ((* (|t#4| $ |t#4|)) T)
                                        ((* (|t#3| |t#3| $)) T)
                                        ((|determinant| (|t#2| $))
                                         (|has| |t#2| (|CommutativeRing|)))
                                        ((|minordet| (|t#2| $))
                                         (|has| |t#2| (|CommutativeRing|)))
                                        ((|Pfaffian| (|t#2| $))
                                         (|has| |t#2| (|CommutativeRing|)))
                                        ((|inverse| ((|Union| $ "failed") $))
                                         (|has| |t#2| (|Field|)))
                                        ((^ ($ $ (|Integer|)))
                                         (|has| |t#2| (|Field|))))
                                      '(((|SemiRing|)
                                         (|has| |t#2| (|SemiRing|)))
                                        ((|DifferentialExtension| |t#2|)
                                         (|has| |t#2| (|Ring|)))
                                        ((|FullyLinearlyExplicitRingOver|
                                          |t#2|)
                                         (|has| |t#2| (|Ring|)))
                                        ((|Module| |t#2|)
                                         (|has| |t#2| (|CommutativeRing|)))
                                        ((|Algebra| |t#2|)
                                         (|has| |t#2| (|CommutativeRing|))))
                                      '((|Integer|) (|List| |t#2|)) NIL))
                             . #2=(|SquareMatrixCategory|)))))
               . #2#)
       (SETELT #1# 0
               (LIST '|SquareMatrixCategory| (|devaluate| |t#1|)
                     (|devaluate| |t#2|) (|devaluate| |t#3|)
                     (|devaluate| |t#4|))))))) 
