
(/VERSIONCHECK 2) 

(DEFUN |FFINTBAS;squaredFactors| (|px| $)
  (PROG (|ffe| #0=#:G1832 #1=#:G1829 #2=#:G1827 #3=#:G1828)
    (RETURN
      (SEQ (PROGN
             (LETT #3# NIL . #4=(|FFINTBAS;squaredFactors|))
             (SEQ (LETT |ffe| NIL . #4#)
                  (LETT #0#
                        (SPADCALL (SPADCALL |px| (QREFELT $ 10))
                            (QREFELT $ 14)) . #4#)
                  G190
                  (COND
                    ((OR (ATOM #0#)
                         (PROGN (LETT |ffe| (CAR #0#) . #4#) NIL))
                     (GO G191)))
                  (SEQ (EXIT (PROGN
                               (LETT #1#
                                     (COND
                                       ((< 1 (QCDR |ffe|))
                                        (QCAR |ffe|))
                                       ('T (|spadConstant| $ 15))) . #4#)
                               (COND
                                 (#3# (LETT #2#
                                       (SPADCALL #2# #1#
                                        (QREFELT $ 19)) . #4#))
                                 ('T
                                  (PROGN
                                    (LETT #2# #1# . #4#)
                                    (LETT #3# 'T . #4#)))))))
                  (LETT #0# (CDR #0#) . #4#) (GO G190) G191 (EXIT NIL))
             (COND (#3# #2#) ('T (|spadConstant| $ 15)))))))) 

(DEFUN |FFINTBAS;iIntegralBasis| (|tfm| |disc| |sing| $)
  (PROG (|n| |tfm0| |disc0| |id| |idinv| |index| |g| |rb| |rbden|
             |rbinv| |indexChange| |oldIndex| #0=#:G1846 #1=#:G1839)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |n| (SPADCALL (QREFELT $ 21))
                            . #2=(|FFINTBAS;iIntegralBasis|))
                      (LETT |tfm0|
                            (SPADCALL |tfm| (QREFELT $ 23)) . #2#)
                      (LETT |disc0| |disc| . #2#)
                      (LETT |rb|
                            (SPADCALL |n| (|spadConstant| $ 15)
                                (QREFELT $ 25)) . #2#)
                      (LETT |rbinv|
                            (SPADCALL |n| (|spadConstant| $ 15)
                                (QREFELT $ 25)) . #2#)
                      (LETT |rbden| (|spadConstant| $ 15) . #2#)
                      (LETT |index| (|spadConstant| $ 15) . #2#)
                      (LETT |oldIndex| (|spadConstant| $ 15) . #2#)
                      (COND
                        ((NULL (SPADCALL (|spadConstant| $ 15) |sing|
                                   (QREFELT $ 27)))
                         (EXIT (VECTOR |rb| |rbden| |rbinv|))))
                      (EXIT (SEQ G190 NIL
                                 (SEQ (LETT |idinv|
                                       (SPADCALL
                                        (SPADCALL
                                         (SPADCALL |tfm| |sing|
                                          (QREFELT $ 29))
                                         (QREFELT $ 30))
                                        (QREFELT $ 31)) . #2#)
                                      (LETT |id|
                                       (SPADCALL
                                        (SPADCALL |idinv| |sing|
                                         (QREFELT $ 33))
                                        (QREFELT $ 34)) . #2#)
                                      (LETT |idinv|
                                       (SPADCALL |id| |sing|
                                        (QREFELT $ 35)) . #2#)
                                      (LETT |rbinv|
                                       (SPADCALL
                                        (SPADCALL |id| |rb|
                                         (QREFELT $ 36))
                                        (SPADCALL |rbinv| |idinv|
                                         (QREFELT $ 36))
                                        (SPADCALL |sing| |rbden|
                                         (QREFELT $ 19))
                                        (QREFELT $ 38)) . #2#)
                                      (LETT |index|
                                       (SPADCALL |rbinv|
                                        (QREFELT $ 39)) . #2#)
                                      (LETT |rb|
                                       (SPADCALL
                                        (SPADCALL |rbinv|
                                         (SPADCALL |rbden| |sing|
                                          (QREFELT $ 19))
                                         (QREFELT $ 33))
                                        (QREFELT $ 34)) . #2#)
                                      (LETT |g|
                                       (SPADCALL |rb| |sing| |n|
                                        (QREFELT $ 40)) . #2#)
                                      (COND
                                        ((SPADCALL
                                          (|spadConstant| $ 15) |g|
                                          (QREFELT $ 27))
                                         (LETT |rb|
                                          (PROG2
                                           (LETT #1#
                                            (SPADCALL |rb| |g|
                                             (QREFELT $ 42)) . #2#)
                                           (QCDR #1#)
                                            (|check-union|
                                             (QEQCAR #1# 0)
                                             (|Matrix| (QREFELT $ 6))
                                             #1#)) . #2#)))
                                      (LETT |rbden|
                                       (SPADCALL |rbden|
                                        (SPADCALL |sing| |g|
                                         (QREFELT $ 43))
                                        (QREFELT $ 19)) . #2#)
                                      (LETT |rbinv|
                                       (SPADCALL |rb| |rbden|
                                        (QREFELT $ 35)) . #2#)
                                      (LETT |disc|
                                       (SPADCALL |disc0|
                                        (SPADCALL |index| |index|
                                         (QREFELT $ 19))
                                        (QREFELT $ 43)) . #2#)
                                      (LETT |indexChange|
                                       (SPADCALL |index| |oldIndex|
                                        (QREFELT $ 43)) . #2#)
                                      (LETT |oldIndex| |index| . #2#)
                                      (LETT |sing|
                                       (SPADCALL |indexChange|
                                        (|FFINTBAS;squaredFactors|
                                         |disc| $)
                                        (QREFELT $ 44)) . #2#)
                                      (COND
                                        ((NULL
                                          (SPADCALL
                                           (|spadConstant| $ 15) |sing|
                                           (QREFELT $ 27)))
                                         (EXIT
                                          (PROGN
                                            (LETT #0#
                                             (VECTOR |rb| |rbden|
                                              |rbinv|) . #2#)
                                            (GO #0#)))))
                                      (EXIT
                                       (LETT |tfm|
                                        (PROG2
                                         (LETT #1#
                                          (SPADCALL
                                           (SPADCALL
                                            (SPADCALL |rb| |tfm0|
                                             (QREFELT $ 36))
                                            (SPADCALL |rb|
                                             (QREFELT $ 31))
                                            (QREFELT $ 36))
                                           (SPADCALL |rbden| |rbden|
                                            (QREFELT $ 19))
                                           (QREFELT $ 42)) . #2#)
                                         (QCDR #1#)
                                          (|check-union| (QEQCAR #1# 0)
                                           (|Matrix| (QREFELT $ 6))
                                           #1#)) . #2#)))
                                 NIL (GO G190) G191 (EXIT NIL)))))
           #0# (EXIT #0#))))) 

(DEFUN |FFINTBAS;integralBasis;R;3| ($)
  (PROG (|n| |p| |tfm| |disc| |sing|)
    (RETURN
      (SEQ (LETT |n| (SPADCALL (QREFELT $ 21))
                 . #0=(|FFINTBAS;integralBasis;R;3|))
           (LETT |p| (SPADCALL (QREFELT $ 45)) . #0#)
           (COND
             ((NULL (ZEROP |p|))
              (COND
                ((NULL (< |n| |p|))
                 (EXIT (|error| "integralBasis: possible wild ramification"))))))
           (LETT |tfm| (SPADCALL (QREFELT $ 46)) . #0#)
           (LETT |disc| (SPADCALL |tfm| (QREFELT $ 47)) . #0#)
           (LETT |sing| (|FFINTBAS;squaredFactors| |disc| $) . #0#)
           (EXIT (|FFINTBAS;iIntegralBasis| |tfm| |disc| |sing| $)))))) 

(DEFUN |FFINTBAS;localIntegralBasis;RR;4| (|prime| $)
  (PROG (|n| |p| |tfm| |disc|)
    (RETURN
      (SEQ (LETT |n| (SPADCALL (QREFELT $ 21))
                 . #0=(|FFINTBAS;localIntegralBasis;RR;4|))
           (LETT |p| (SPADCALL (QREFELT $ 45)) . #0#)
           (COND
             ((NULL (ZEROP |p|))
              (COND
                ((NULL (< |n| |p|))
                 (EXIT (|error| "integralBasis: possible wild ramification"))))))
           (LETT |tfm| (SPADCALL (QREFELT $ 46)) . #0#)
           (LETT |disc| (SPADCALL |tfm| (QREFELT $ 47)) . #0#)
           (EXIT (COND
                   ((QEQCAR (SPADCALL |disc|
                                (SPADCALL |prime| |prime|
                                    (QREFELT $ 19))
                                (QREFELT $ 50))
                            1)
                    (VECTOR (SPADCALL |n| (|spadConstant| $ 15)
                                (QREFELT $ 25))
                            (|spadConstant| $ 15)
                            (SPADCALL |n| (|spadConstant| $ 15)
                                (QREFELT $ 25))))
                   ('T
                    (|FFINTBAS;iIntegralBasis| |tfm| |disc| |prime| $)))))))) 

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

(DEFUN |FunctionFieldIntegralBasis;| (|#1| |#2| |#3|)
  (PROG (DV$1 DV$2 DV$3 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|)
              . #0=(|FunctionFieldIntegralBasis|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT DV$3 (|devaluate| |#3|) . #0#)
        (LETT |dv$|
              (LIST '|FunctionFieldIntegralBasis| DV$1 DV$2 DV$3) . #0#)
        (LETT $ (GETREFV 52) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|FunctionFieldIntegralBasis|
            (LIST DV$1 DV$2 DV$3) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7 |#2|)
        (QSETREFV $ 8 |#3|)
        $)))) 

(MAKEPROP '|FunctionFieldIntegralBasis| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (|local| |#3|) (|Factored| $) (0 . |squareFree|)
             (|Record| (|:| |factor| 6) (|:| |exponent| (|Integer|)))
             (|List| 11) (|Factored| 6) (5 . |factors|) (10 . |One|)
             (14 . |One|) (18 . |One|) (22 . |One|) (26 . *)
             (|PositiveInteger|) (32 . |rank|) (|Matrix| 6)
             (36 . |copy|) (|NonNegativeInteger|) (41 . |scalarMatrix|)
             (|Boolean|) (47 . |sizeLess?|)
             (|ModularHermitianRowReduction| 6) (53 . |rowEchelon|)
             (59 . |squareTop|) (64 . |transpose|)
             (|TriangularMatrixOperations| 6 (|Vector| 6) (|Vector| 6)
                 22)
             (69 . |LowTriBddDenomInv|) (75 . |rowEchelon|)
             (80 . |UpTriBddDenomInv|) (86 . *)
             (|IntegralBasisTools| 6 7 8) (92 . |idealiser|)
             (99 . |diagonalProduct|) (104 . |matrixGcd|)
             (|Union| $ '"failed") (111 . |exquo|) (117 . |quo|)
             (123 . |gcd|) (129 . |characteristic|)
             (133 . |traceMatrix|) (137 . |determinant|)
             (|Record| (|:| |basis| 22) (|:| |basisDen| 6)
                 (|:| |basisInv| 22))
             |FFINTBAS;integralBasis;R;3| (142 . |exquo|)
             |FFINTBAS;localIntegralBasis;RR;4|)
          '#(|localIntegralBasis| 148 |integralBasis| 153) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 51
                                '(1 6 9 0 10 1 13 12 0 14 0 6 0 15 0 7
                                  0 16 0 8 0 17 0 13 0 18 2 6 0 0 0 19
                                  0 8 20 21 1 22 0 0 23 2 22 0 24 6 25
                                  2 6 26 0 0 27 2 28 22 22 6 29 1 22 0
                                  0 30 1 22 0 0 31 2 32 22 22 6 33 1 22
                                  0 0 34 2 32 22 22 6 35 2 22 0 0 0 36
                                  3 37 22 22 22 6 38 1 37 6 22 39 3 37
                                  6 22 6 24 40 2 22 41 0 6 42 2 6 0 0 0
                                  43 2 6 0 0 0 44 0 8 24 45 0 8 22 46 1
                                  22 6 0 47 2 6 41 0 0 50 1 0 48 6 51 0
                                  0 48 49)))))
          '|lookupComplete|)) 
