
(/VERSIONCHECK 2) 

(DEFUN |ALGFACT;allk| (|l| $)
  (PROG (#0=#:G1824 |x| #1=#:G1825)
    (RETURN
      (SEQ (SPADCALL
               (SPADCALL
                   (PROGN
                     (LETT #0# NIL . #2=(|ALGFACT;allk|))
                     (SEQ (LETT |x| NIL . #2#) (LETT #1# |l| . #2#)
                          G190
                          (COND
                            ((OR (ATOM #1#)
                                 (PROGN
                                   (LETT |x| (CAR #1#) . #2#)
                                   NIL))
                             (GO G191)))
                          (SEQ (EXIT (LETT #0#
                                      (CONS
                                       (SPADCALL |x| (QREFELT $ 9))
                                       #0#) . #2#)))
                          (LETT #1# (CDR #1#) . #2#) (GO G190) G191
                          (EXIT (NREVERSE0 #0#))))
                   (QREFELT $ 12))
               (QREFELT $ 13)))))) 

(DEFUN |ALGFACT;liftpoly| (|p| $)
  (SPADCALL (CONS #'|ALGFACT;liftpoly!0| $) |p| (QREFELT $ 19))) 

(DEFUN |ALGFACT;liftpoly!0| (|#1| $) (SPADCALL |#1| (QREFELT $ 15))) 

(DEFUN |ALGFACT;downpoly| (|p| $)
  (SPADCALL (CONS #'|ALGFACT;downpoly!0| $) |p| (QREFELT $ 23))) 

(DEFUN |ALGFACT;downpoly!0| (|#1| $) (SPADCALL |#1| (QREFELT $ 20))) 

(DEFUN |ALGFACT;ifactor| (|p| |l| $) (|ALGFACT;fact| |p| |l| $)) 

(DEFUN |ALGFACT;factor;UPF;5| (|p| $)
  (|ALGFACT;fact| |p| (|ALGFACT;allk| (SPADCALL |p| (QREFELT $ 25)) $)
      $)) 

(DEFUN |ALGFACT;factor;UPLF;6| (|p| |l| $)
  (|ALGFACT;fact| |p|
      (|ALGFACT;allk|
          (SPADCALL
              (SPADCALL |l| (SPADCALL |p| (QREFELT $ 25))
                  (QREFELT $ 28))
              (QREFELT $ 29))
          $)
      $)) 

(DEFUN |ALGFACT;split;UPF;7| (|p| $)
  (PROG (|fp| |fc| #0=#:G1841 #1=#:G1838 #2=#:G1836 #3=#:G1837)
    (RETURN
      (SEQ (LETT |fp| (SPADCALL |p| (QREFELT $ 27))
                 . #4=(|ALGFACT;split;UPF;7|))
           (EXIT (SPADCALL (SPADCALL |fp| (QREFELT $ 31))
                     (PROGN
                       (LETT #3# NIL . #4#)
                       (SEQ (LETT |fc| NIL . #4#)
                            (LETT #0#
                                  (SPADCALL |fp| (QREFELT $ 34)) . #4#)
                            G190
                            (COND
                              ((OR (ATOM #0#)
                                   (PROGN
                                     (LETT |fc| (CAR #0#) . #4#)
                                     NIL))
                               (GO G191)))
                            (SEQ (EXIT (PROGN
                                         (LETT #1#
                                          (|ALGFACT;extend| (QCAR |fc|)
                                           (QCDR |fc|) $) . #4#)
                                         (COND
                                           (#3#
                                            (LETT #2#
                                             (SPADCALL #2# #1#
                                              (QREFELT $ 35)) . #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| $ 36))))
                     (QREFELT $ 37))))))) 

(DEFUN |ALGFACT;extend| (|p| |n| $)
  (PROG (|q| #0=#:G1846 #1=#:G1850)
    (RETURN
      (SEQ (COND
             ((EQL (SPADCALL |p| (QREFELT $ 40)) 1)
              (SPADCALL |p| |n| (QREFELT $ 42)))
             ('T
              (SEQ (LETT |q|
                         (SPADCALL
                             (SPADCALL (|spadConstant| $ 44) 1
                                 (QREFELT $ 45))
                             (SPADCALL (SPADCALL |p| (QREFELT $ 47))
                                 (QREFELT $ 48))
                             (QREFELT $ 49))
                         . #2=(|ALGFACT;extend|))
                   (EXIT (SPADCALL (SPADCALL |q| |n| (QREFELT $ 42))
                             (SPADCALL
                                 (SPADCALL
                                     (PROG2
                                      (LETT #0#
                                       (SPADCALL |p| |q|
                                        (QREFELT $ 51)) . #2#)
                                      (QCDR #0#)
                                       (|check-union| (QEQCAR #0# 0)
                                        (QREFELT $ 6) #0#))
                                     (QREFELT $ 38))
                                 (PROG1 (LETT #1# |n| . #2#)
                                   (|check-subtype| (>= #1# 0)
                                    '(|NonNegativeInteger|) #1#))
                                 (QREFELT $ 52))
                             (QREFELT $ 35)))))))))) 

(DEFUN |ALGFACT;doublyTransitive?;UPB;9| (|p| $)
  (PROG (#0=#:G1855)
    (RETURN
      (COND
        ((|ALGFACT;irred?| |p| $)
         (|ALGFACT;irred?|
             (PROG2 (LETT #0#
                          (SPADCALL |p|
                              (SPADCALL
                                  (SPADCALL (|spadConstant| $ 44) 1
                                      (QREFELT $ 45))
                                  (SPADCALL
                                      (SPADCALL |p| (QREFELT $ 47))
                                      (QREFELT $ 48))
                                  (QREFELT $ 49))
                              (QREFELT $ 51))
                          |ALGFACT;doublyTransitive?;UPB;9|)
                    (QCDR #0#)
               (|check-union| (QEQCAR #0# 0) (QREFELT $ 6) #0#))
             $))
        ('T 'NIL))))) 

(DEFUN |ALGFACT;irred?| (|p| $)
  (PROG (|fp|)
    (RETURN
      (SEQ (LETT |fp| (SPADCALL |p| (QREFELT $ 27)) |ALGFACT;irred?|)
           (EXIT (COND
                   ((EQL (SPADCALL |fp| (QREFELT $ 55)) 1)
                    (EQL (SPADCALL |fp| 1 (QREFELT $ 56)) 1))
                   ('T 'NIL))))))) 

(DEFUN |ALGFACT;fact| (|p| |l| $)
  (PROG (|dr| |dc| #0=#:G1880 #1=#:G1866 #2=#:G1864 #3=#:G1865
              #4=#:G1815 #5=#:G1881 #6=#:G1870 #7=#:G1868 #8=#:G1869
              |alpha| |q| |newl| |sae| |ups| |fr| |newalpha| |fc|
              #9=#:G1882 #10=#:G1875 #11=#:G1873 #12=#:G1874)
    (RETURN
      (SEQ (COND
             ((EQL (SPADCALL |p| (QREFELT $ 40)) 1)
              (SPADCALL |p| 1 (QREFELT $ 42)))
             ((NULL |l|)
              (SEQ (LETT |dr|
                         (SPADCALL (|ALGFACT;downpoly| |p| $)
                             (QREFELT $ 59))
                         . #13=(|ALGFACT;fact|))
                   (EXIT (SPADCALL
                             (|ALGFACT;liftpoly|
                                 (SPADCALL |dr| (QREFELT $ 60)) $)
                             (PROGN
                               (LETT #3# NIL . #13#)
                               (SEQ (LETT |dc| NIL . #13#)
                                    (LETT #0#
                                     (SPADCALL |dr| (QREFELT $ 63)) . #13#)
                                    G190
                                    (COND
                                      ((OR (ATOM #0#)
                                        (PROGN
                                          (LETT |dc| (CAR #0#) . #13#)
                                          NIL))
                                       #14=(GO G191)))
                                    (SEQ
                                     (EXIT
                                      (PROGN
                                        (LETT #1#
                                         (SPADCALL
                                          (|ALGFACT;liftpoly|
                                           (QCAR |dc|) $)
                                          (QCDR |dc|) (QREFELT $ 42)) . #13#)
                                        (COND
                                          (#3#
                                           (LETT #2#
                                            (SPADCALL #2# #1#
                                             (QREFELT $ 35)) . #13#))
                                          ('T
                                           (PROGN
                                             (LETT #2# #1# . #13#)
                                             (LETT #3# 'T . #13#)))))))
                                    (LETT #0# (CDR #0#) . #13#)
                                    #15=(GO G190) G191 (EXIT NIL))
                               (COND
                                 (#3# #2#)
                                 ('T (|spadConstant| $ 36))))
                             (QREFELT $ 37)))))
             ('T
              (SEQ (LETT |q|
                         (SPADCALL
                             (LETT |alpha|
                                   (PROGN
                                     (LETT #8# NIL . #13#)
                                     (SEQ (LETT #4# NIL . #13#)
                                      (LETT #5# |l| . #13#) G190
                                      (COND
                                        ((OR (ATOM #5#)
                                          (PROGN
                                            (LETT #4# (CAR #5#) . #13#)
                                            NIL))
                                         #14#))
                                      (SEQ
                                       (EXIT
                                        (PROGN
                                          (LETT #6# #4# . #13#)
                                          (COND
                                            (#8#
                                             (LETT #7#
                                              (SPADCALL #7# #6#
                                               (QREFELT $ 65)) . #13#))
                                            ('T
                                             (PROGN
                                               (LETT #7# #6# . #13#)
                                               (LETT #8# 'T . #13#)))))))
                                      (LETT #5# (CDR #5#) . #13#) #15#
                                      G191 (EXIT NIL))
                                     (COND
                                       (#8# #7#)
                                       ('T (|IdentityError| '|max|)))) . #13#)
                             (QREFELT $ 67)) . #13#)
                   (LETT |newl|
                         (SPADCALL
                             (CONS #'|ALGFACT;fact!0|
                                   (VECTOR $ |alpha|))
                             |l| (QREFELT $ 70)) . #13#)
                   (LETT |sae|
                         (|SimpleAlgebraicExtension|
                             (|AlgebraicNumber|)
                             (|SparseUnivariatePolynomial|
                                 (|AlgebraicNumber|))
                             |q|) . #13#)
                   (LETT |ups|
                         (|SparseUnivariatePolynomial| |sae|) . #13#)
                   (LETT |fr|
                         (SPADCALL
                             (SPADCALL
                                 (CONS #'|ALGFACT;fact!1|
                                       (VECTOR |sae| $ |q| |alpha|))
                                 |p|
                                 (|compiledLookupCheck| '|map|
                                     (LIST (|devaluate| |ups|)
                                      (LIST '|Mapping|
                                       (|devaluate| |sae|)
                                       (LIST '|AlgebraicNumber|))
                                      (|devaluate| (ELT $ 6)))
                                     (|UnivariatePolynomialCategoryFunctions2|
                                      (|AlgebraicNumber|) (ELT $ 6)
                                      |sae| |ups|)))
                             (CONS #'|ALGFACT;fact!2|
                                   (VECTOR $ |newl|))
                             (|compiledLookupCheck| '|factor|
                                 (LIST (LIST '|Factored|
                                        (|devaluate| |ups|))
                                       (|devaluate| |ups|)
                                       (LIST '|Mapping|
                                        (LIST '|Factored|
                                         (LIST
                                          '|SparseUnivariatePolynomial|
                                          (LIST '|AlgebraicNumber|)))
                                        (LIST
                                         '|SparseUnivariatePolynomial|
                                         (LIST '|AlgebraicNumber|))))
                                 (|InnerAlgFactor| (|AlgebraicNumber|)
                                     (|SparseUnivariatePolynomial|
                                      (|AlgebraicNumber|))
                                     |sae| |ups|))) . #13#)
                   (LETT |newalpha|
                         (SPADCALL |alpha| (QREFELT $ 74)) . #13#)
                   (EXIT (SPADCALL
                             (SPADCALL
                                 (CONS #'|ALGFACT;fact!3|
                                       (VECTOR $ |newalpha| |sae|))
                                 (SPADCALL |fr|
                                     (|compiledLookupCheck| '|unit|
                                      (LIST (|devaluate| |ups|) '$)
                                      (|Factored| |ups|)))
                                 (|compiledLookupCheck| '|map|
                                     (LIST (|devaluate| (ELT $ 6))
                                      (LIST '|Mapping|
                                       (LIST '|AlgebraicNumber|)
                                       (|devaluate| |sae|))
                                      (|devaluate| |ups|))
                                     (|UnivariatePolynomialCategoryFunctions2|
                                      |sae| |ups| (|AlgebraicNumber|)
                                      (ELT $ 6))))
                             (PROGN
                               (LETT #12# NIL . #13#)
                               (SEQ (LETT |fc| NIL . #13#)
                                    (LETT #9#
                                     (SPADCALL |fr|
                                      (|compiledLookupCheck| '|factors|
                                       (LIST
                                        (LIST '|List|
                                         (LIST '|Record|
                                          (LIST '|:| '|factor|
                                           (|devaluate| |ups|))
                                          (LIST '|:| '|exponent|
                                           (LIST '|Integer|))))
                                        '$)
                                       (|Factored| |ups|))) . #13#)
                                    G190
                                    (COND
                                      ((OR (ATOM #9#)
                                        (PROGN
                                          (LETT |fc| (CAR #9#) . #13#)
                                          NIL))
                                       #14#))
                                    (SEQ
                                     (EXIT
                                      (PROGN
                                        (LETT #10#
                                         (SPADCALL
                                          (SPADCALL
                                           (CONS #'|ALGFACT;fact!4|
                                            (VECTOR $ |newalpha| |sae|))
                                           (QCAR |fc|)
                                           (|compiledLookupCheck|
                                            '|map|
                                            (LIST
                                             (|devaluate| (ELT $ 6))
                                             (LIST '|Mapping|
                                              (LIST '|AlgebraicNumber|)
                                              (|devaluate| |sae|))
                                             (|devaluate| |ups|))
                                            (|UnivariatePolynomialCategoryFunctions2|
                                             |sae| |ups|
                                             (|AlgebraicNumber|)
                                             (ELT $ 6))))
                                          (QCDR |fc|) (QREFELT $ 42)) . #13#)
                                        (COND
                                          (#12#
                                           (LETT #11#
                                            (SPADCALL #11# #10#
                                             (QREFELT $ 35)) . #13#))
                                          ('T
                                           (PROGN
                                             (LETT #11# #10# . #13#)
                                             (LETT #12# 'T . #13#)))))))
                                    (LETT #9# (CDR #9#) . #13#) #15#
                                    G191 (EXIT NIL))
                               (COND
                                 (#12# #11#)
                                 ('T (|spadConstant| $ 36))))
                             (QREFELT $ 37)))))))))) 

(DEFUN |ALGFACT;fact!4| (|#1| $$)
  (SPADCALL
      (SPADCALL |#1|
          (|compiledLookupCheck| '|lift|
              (LIST (LIST '|SparseUnivariatePolynomial|
                          (LIST '|AlgebraicNumber|))
                    '$)
              (QREFELT $$ 2)))
      (QREFELT $$ 1) (QREFELT (QREFELT $$ 0) 75))) 

(DEFUN |ALGFACT;fact!3| (|#1| $$)
  (SPADCALL
      (SPADCALL |#1|
          (|compiledLookupCheck| '|lift|
              (LIST (LIST '|SparseUnivariatePolynomial|
                          (LIST '|AlgebraicNumber|))
                    '$)
              (QREFELT $$ 2)))
      (QREFELT $$ 1) (QREFELT (QREFELT $$ 0) 75))) 

(DEFUN |ALGFACT;fact!2| (|#1| $$)
  (|ALGFACT;ifactor| |#1| (QREFELT $$ 1) (QREFELT $$ 0))) 

(DEFUN |ALGFACT;fact!1| (|#1| $$)
  (SPADCALL
      (SPADCALL |#1| (QREFELT $$ 3) (QREFELT $$ 2)
          (QREFELT (QREFELT $$ 1) 73))
      (|compiledLookupCheck| '|reduce|
          (LIST '$
                (LIST '|SparseUnivariatePolynomial|
                      (LIST '|AlgebraicNumber|)))
          (QREFELT $$ 0)))) 

(DEFUN |ALGFACT;fact!0| (|#1| $$)
  (SPADCALL (QREFELT $$ 1) |#1| (QREFELT (QREFELT $$ 0) 68))) 

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

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

(MAKEPROP '|AlgFactor| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|List| 66)
             (|AlgebraicNumber|) (0 . |kernels|) (|List| $) (|List| 64)
             (5 . |concat|) (10 . |removeDuplicates|) (|Fraction| 41)
             (15 . |coerce|) (|Mapping| 8 14)
             (|SparseUnivariatePolynomial| 14)
             (|UnivariatePolynomialCategoryFunctions2| 14 17 8 6)
             (20 . |map|) (26 . |retract|) (|Mapping| 14 8)
             (|UnivariatePolynomialCategoryFunctions2| 8 6 14 17)
             (31 . |map|) (|List| 8) (37 . |coefficients|)
             (|Factored| 6) |ALGFACT;factor;UPF;5| (42 . |concat|)
             (48 . |removeDuplicates|) |ALGFACT;factor;UPLF;6|
             (53 . |unit|)
             (|Record| (|:| |factor| 6) (|:| |exponent| 41))
             (|List| 32) (58 . |factors|) (63 . *) (69 . |One|)
             (73 . *) |ALGFACT;split;UPF;7| (|NonNegativeInteger|)
             (79 . |degree|) (|Integer|) (84 . |primeFactor|)
             (90 . |One|) (94 . |One|) (98 . |monomial|)
             (|SparseUnivariatePolynomial| $) (104 . |zeroOf|)
             (109 . |coerce|) (114 . -) (|Union| $ '"failed")
             (120 . |exquo|) (126 . **) (|Boolean|)
             |ALGFACT;doublyTransitive?;UPB;9|
             (132 . |numberOfFactors|) (137 . |nthExponent|)
             (|Factored| 17) (|RationalFactorize| 17) (143 . |factor|)
             (148 . |unit|)
             (|Record| (|:| |factor| 17) (|:| |exponent| 41))
             (|List| 61) (153 . |factors|) (|Kernel| 8) (158 . |max|)
             (|Kernel| $) (164 . |minPoly|) (169 . =) (|Mapping| 53 64)
             (175 . |remove|) (|SparseUnivariatePolynomial| 8)
             (|PolynomialCategoryQuotientFunctions|
                 (|IndexedExponents| 64) 64 41
                 (|SparseMultivariatePolynomial| 41 64) 8)
             (181 . |univariate|) (188 . |coerce|) (193 . |elt|))
          '#(|split| 199 |factor| 204 |doublyTransitive?| 215) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 75
                                '(1 8 7 0 9 1 11 0 10 12 1 11 0 0 13 1
                                  8 0 14 15 2 18 6 16 17 19 1 8 14 0 20
                                  2 22 17 21 6 23 1 6 24 0 25 2 24 0 0
                                  0 28 1 24 0 0 29 1 26 6 0 31 1 26 33
                                  0 34 2 26 0 0 0 35 0 26 0 36 2 26 0 6
                                  0 37 1 6 39 0 40 2 26 0 6 41 42 0 6 0
                                  43 0 8 0 44 2 6 0 8 39 45 1 8 0 46 47
                                  1 6 0 8 48 2 6 0 0 0 49 2 6 50 0 0 51
                                  2 26 0 0 39 52 1 26 39 0 55 2 26 41 0
                                  41 56 1 58 57 17 59 1 57 17 0 60 1 57
                                  62 0 63 2 64 0 0 0 65 1 8 46 66 67 2
                                  64 53 0 0 68 2 11 0 69 0 70 3 72 71 8
                                  64 71 73 1 8 0 66 74 2 71 8 0 8 75 1
                                  0 26 6 38 1 0 26 6 27 2 0 26 6 24 30
                                  1 0 53 6 54)))))
          '|lookupComplete|)) 
