
(/VERSIONCHECK 2) 

(DEFUN |GENUFACT;factorWarning| (|f| $)
  (SPADCALL
      (LIST (SPADCALL
                "WARNING (genufact): No known algorithm to factor "
                (QREFELT $ 10))
            (SPADCALL |f| (QREFELT $ 13))
            (SPADCALL ", trying square-free." (QREFELT $ 10)))
      (QREFELT $ 17))) 

(DEFUN |GENUFACT;factor;SupF;2| (|f| $)
  (PROG (|var| |up| |upp|)
    (RETURN
      (SEQ (COND
             ((|domainEqual| (QREFELT $ 6) (|Integer|))
              (SPADCALL |f| (QREFELT $ 21)))
             ((|domainEqual| (QREFELT $ 6) (|Fraction| (|Integer|)))
              (SPADCALL |f| (QREFELT $ 23)))
             ((|HasCategory| (QREFELT $ 6) '(|FiniteFieldCategory|))
              (SPADCALL |f| (QREFELT $ 25)))
             ((|domainEqual| (QREFELT $ 6) (|Complex| (|Integer|)))
              (SPADCALL |f| (QREFELT $ 27)))
             ((|domainEqual| (QREFELT $ 6)
                  (|Complex| (|Fraction| (|Integer|))))
              (SPADCALL |f| (QREFELT $ 29)))
             ((|domainEqual| (QREFELT $ 6) (|AlgebraicNumber|))
              (SPADCALL |f| (QREFELT $ 31)))
             ((|HasSignature| (QREFELT $ 6)
                  (LIST '|generator|
                        (LIST (|devaluate| (QREFELT $ 6)))))
              (SEQ (LETT |var|
                         (SPADCALL
                             (SPADCALL
                                 (SPADCALL (SPADCALL (QREFELT $ 32))
                                     (QREFELT $ 33))
                                 (QREFELT $ 35))
                             (QREFELT $ 37))
                         . #0=(|GENUFACT;factor;SupF;2|))
                   (LETT |up|
                         (|UnivariatePolynomial| |var|
                             (|Fraction| (|Integer|))) . #0#)
                   (EXIT (COND
                           ((|HasCategory| (QREFELT $ 6)
                                (LIST '|MonogenicAlgebra|
                                      (LIST '|Fraction| '(|Integer|))
                                      (|devaluate| |up|)))
                            (SPADCALL |f|
                                (|compiledLookupCheck| '|factor|
                                    (LIST
                                     (LIST '|Factored|
                                      (LIST
                                       '|SparseUnivariatePolynomial|
                                       (|devaluate| (ELT $ 6))))
                                     (LIST
                                      '|SparseUnivariatePolynomial|
                                      (|devaluate| (ELT $ 6))))
                                    (|SimpleAlgebraicExtensionAlgFactor|
                                     |up| (ELT $ 6)
                                     (|SparseUnivariatePolynomial|
                                      (ELT $ 6))))))
                           (#1='T
                            (SEQ (LETT |upp|
                                       (|UnivariatePolynomial| |var|
                                        (|Fraction|
                                         (|Polynomial| (|Integer|)))) . #0#)
                                 (EXIT (COND
                                         ((|HasCategory| (QREFELT $ 6)
                                           (LIST '|MonogenicAlgebra|
                                            (LIST '|Fraction|
                                             (LIST '|Polynomial|
                                              '(|Integer|)))
                                            (|devaluate| |upp|)))
                                          (SPADCALL |f|
                                           (|compiledLookupCheck|
                                            '|factor|
                                            (LIST
                                             (LIST '|Factored|
                                              (LIST
                                               '|SparseUnivariatePolynomial|
                                               (|devaluate| (ELT $ 6))))
                                             (LIST
                                              '|SparseUnivariatePolynomial|
                                              (|devaluate| (ELT $ 6))))
                                            (|SAERationalFunctionAlgFactor|
                                             |upp| (ELT $ 6)
                                             (|SparseUnivariatePolynomial|
                                              (ELT $ 6))))))
                                         (#1#
                                          (SEQ
                                           (|GENUFACT;factorWarning|
                                            (SPADCALL |f|
                                             (QREFELT $ 38))
                                            $)
                                           (EXIT
                                            (SPADCALL |f|
                                             (QREFELT $ 40)))))))))))))
             (#1#
              (SEQ (|GENUFACT;factorWarning|
                       (SPADCALL |f| (QREFELT $ 38)) $)
                   (EXIT (SPADCALL |f| (QREFELT $ 40)))))))))) 

(DEFUN |GenUFactorize| (#0=#:G1823)
  (PROG ()
    (RETURN
      (PROG (#1=#:G1824)
        (RETURN
          (COND
            ((LETT #1#
                   (|lassocShiftWithFunction| (LIST (|devaluate| #0#))
                       (HGET |$ConstructorCache| '|GenUFactorize|)
                       '|domainEqualList|)
                   . #2=(|GenUFactorize|))
             (|CDRwithIncrement| #1#))
            ('T
             (UNWIND-PROTECT
               (PROG1 (|GenUFactorize;| #0#) (LETT #1# T . #2#))
               (COND
                 ((NOT #1#)
                  (HREM |$ConstructorCache| '|GenUFactorize|))))))))))) 

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

(MAKEPROP '|GenUFactorize| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|Any|) (|String|)
             (|AnyFunctions1| 8) (0 . |coerce|) (|OutputForm|)
             (|AnyFunctions1| 11) (5 . |coerce|) (|Void|) (|List| 7)
             (|OutputPackage|) (10 . |outputList|) (|Factored| 19)
             (|SparseUnivariatePolynomial| 6)
             (|GaloisGroupFactorizer| 19) (15 . |factor|)
             (|RationalFactorize| 19) (20 . |factor|)
             (|DistinctDegreeFactorize| 6 19) (25 . |factor|)
             (|ComplexFactorization| (|Integer|) 19) (30 . |factor|)
             (|ComplexFactorization| (|Fraction| (|Integer|)) 19)
             (35 . |factor|) (|AlgFactor| 19) (40 . |factor|)
             (45 . |generator|) (49 . |coerce|) (|InputForm|)
             (54 . |convert|) (|Symbol|) (59 . |symbol|)
             (64 . |coerce|) (|Factored| $) (69 . |squareFree|)
             |GENUFACT;factor;SupF;2|)
          '#(|factor| 74) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 41
                                '(1 9 7 8 10 1 12 7 11 13 1 16 14 15 17
                                  1 20 18 19 21 1 22 18 19 23 1 24 18
                                  19 25 1 26 18 19 27 1 28 18 19 29 1
                                  30 18 19 31 0 6 0 32 1 6 11 0 33 1 34
                                  0 11 35 1 34 36 0 37 1 19 11 0 38 1
                                  19 39 0 40 1 0 18 19 41)))))
          '|lookupComplete|)) 
