
(/VERSIONCHECK 2) 

(DEFUN |PRIMELT;multi| (|p| |v| $)
  (SPADCALL (SPADCALL (LIST #'|PRIMELT;multi!0|) |p| (QREFELT $ 9)) |v|
      (QREFELT $ 12))) 

(DEFUN |PRIMELT;multi!0| (|#1| $$) |#1|) 

(DEFUN |PRIMELT;randomInts| (|n| |m| $)
  (PROG (#0=#:G1827 |i|)
    (RETURN
      (SEQ (PROGN
             (LETT #0# NIL . #1=(|PRIMELT;randomInts|))
             (SEQ (LETT |i| 1 . #1#) G190
                  (COND ((QSGREATERP |i| |n|) (GO G191)))
                  (SEQ (EXIT (LETT #0#
                                   (CONS
                                    (SPADCALL (RANDOM |m|) |m|
                                     (QREFELT $ 14))
                                    #0#) . #1#)))
                  (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                  (EXIT (NREVERSE0 #0#)))))))) 

(DEFUN |PRIMELT;incl?| (|a| |b| $)
  (SPADCALL (CONS #'|PRIMELT;incl?!0| (VECTOR $ |b|)) |a|
      (QREFELT $ 19))) 

(DEFUN |PRIMELT;incl?!0| (|#1| $$)
  (SPADCALL |#1| (QREFELT $$ 1) (QREFELT (QREFELT $$ 0) 17))) 

(DEFUN |PRIMELT;primitiveElement;LLR;4| (|l| |v| $)
  (SPADCALL |l| |v| (SPADCALL (QREFELT $ 20)) (QREFELT $ 23))) 

(DEFUN |PRIMELT;primitiveElement;PSPSR;5| (|p1| |a1| |p2| |a2| $)
  (PROG (|u| |b| |i| |c| |w| |r| #0=#:G1840 #1=#:G1835)
    (RETURN
      (SEQ (EXIT (COND
                   ((EQL (SPADCALL |p2| |a1| (QREFELT $ 26)) 1)
                    (VECTOR 0 1
                            (SPADCALL
                                (SPADCALL |p1| |p2| |a1|
                                    (QREFELT $ 30))
                                (QREFELT $ 31))))
                   ('T
                    (SEQ (LETT |u|
                               (SPADCALL (SPADCALL (QREFELT $ 20))
                                   (QREFELT $ 32))
                               . #2=(|PRIMELT;primitiveElement;PSPSR;5|))
                         (LETT |b|
                               (SPADCALL |a2| (QREFELT $ 32)) . #2#)
                         (EXIT (SEQ (LETT |i| 10 . #2#) G190 NIL
                                    (SEQ
                                     (EXIT
                                      (SEQ
                                       (LETT |c|
                                        (SPADCALL (RANDOM |i|) |i|
                                         (QREFELT $ 14)) . #2#)
                                       (LETT |w|
                                        (SPADCALL |u|
                                         (SPADCALL |c| |b|
                                          (QREFELT $ 33))
                                         (QREFELT $ 34)) . #2#)
                                       (LETT |r|
                                        (SPADCALL
                                         (SPADCALL
                                          (SPADCALL |p1| |a1| |w|
                                           (QREFELT $ 35))
                                          (SPADCALL |p2| |a1| |w|
                                           (QREFELT $ 35))
                                          |a2| (QREFELT $ 30))
                                         (QREFELT $ 31)) . #2#)
                                       (EXIT
                                        (COND
                                          ((NULL
                                            (SPADCALL |r|
                                             (QREFELT $ 36)))
                                           (COND
                                             ((SPADCALL |r|
                                               (SPADCALL |r|
                                                (QREFELT $ 37))
                                               (QREFELT $ 38))
                                              (PROGN
                                                (LETT #1#
                                                 (PROGN
                                                   (LETT #0#
                                                    (VECTOR 1 |c| |r|) . #2#)
                                                   (GO #0#)) . #2#)
                                                (GO #1#)))))))))
                                     #1# (EXIT #1#))
                                    (LETT |i| (+ |i| 1) . #2#)
                                    (GO G190) G191 (EXIT NIL)))))))
           #0# (EXIT #0#))))) 

(DEFUN |PRIMELT;findUniv| (|l| |v| |opt| $)
  (PROG (|p| #0=#:G1849 #1=#:G1848 #2=#:G1846)
    (RETURN
      (SEQ (EXIT (SEQ (SEQ (EXIT (SEQ (LETT |p| NIL
                                       . #3=(|PRIMELT;findUniv|))
                                      (LETT #0# |l| . #3#) G190
                                      (COND
                                        ((OR (ATOM #0#)
                                          (PROGN
                                            (LETT |p| (CAR #0#) . #3#)
                                            NIL))
                                         (GO G191)))
                                      (SEQ
                                       (EXIT
                                        (COND
                                          ((< 0
                                            (SPADCALL |p| |v|
                                             (QREFELT $ 26)))
                                           (COND
                                             ((|PRIMELT;incl?|
                                               (SPADCALL |p|
                                                (QREFELT $ 42))
                                               (LIST |v| |opt|) $)
                                              (PROGN
                                                (LETT #2#
                                                 (PROGN
                                                   (LETT #1#
                                                    (CONS 0 |p|) . #3#)
                                                   (GO #1#)) . #3#)
                                                (GO #2#))))))))
                                      (LETT #0# (CDR #0#) . #3#)
                                      (GO G190) G191 (EXIT NIL)))
                           #2# (EXIT #2#))
                      (EXIT (CONS 1 "failed"))))
           #1# (EXIT #1#))))) 

(DEFUN |PRIMELT;triangularLinearIfCan| (|l| |lv| |w| $)
  (PROG (|pw| |v| #0=#:G1871 |u| |p| #1=#:G1870 #2=#:G1866 |bc| |ll|)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |u| (|PRIMELT;findUniv| |l| |w| |w| $)
                            . #3=(|PRIMELT;triangularLinearIfCan|))
                      (EXIT (COND
                              ((QEQCAR |u| 1) (CONS 1 "failed"))
                              ('T
                               (SEQ (LETT |pw|
                                     (SPADCALL (QCDR |u|)
                                      (QREFELT $ 31)) . #3#)
                                    (LETT |ll| NIL . #3#)
                                    (SEQ (LETT |v| NIL . #3#)
                                     (LETT #0# |lv| . #3#) G190
                                     (COND
                                       ((OR (ATOM #0#)
                                         (PROGN
                                           (LETT |v| (CAR #0#) . #3#)
                                           NIL))
                                        (GO G191)))
                                     (SEQ
                                      (EXIT
                                       (SEQ
                                        (SEQ
                                         (LETT |u|
                                          (|PRIMELT;findUniv| |l| |v|
                                           |w| $) . #3#)
                                         (EXIT
                                          (COND
                                            ((OR (QEQCAR |u| 1)
                                              (NULL
                                               (EQL
                                                (SPADCALL
                                                 (LETT |p|
                                                  (SPADCALL (QCDR |u|)
                                                   |v| (QREFELT $ 44)) . #3#)
                                                 (QREFELT $ 46))
                                                1)))
                                             (PROGN
                                               (LETT #2#
                                                (PROGN
                                                  (LETT #1#
                                                   (CONS 1 "failed") . #3#)
                                                  (GO #1#)) . #3#)
                                               (GO #2#))))))
                                        (LETT |bc|
                                         (SPADCALL
                                          (SPADCALL
                                           (SPADCALL |p|
                                            (QREFELT $ 47))
                                           (QREFELT $ 31))
                                          |pw| (|spadConstant| $ 48)
                                          (QREFELT $ 51)) . #3#)
                                        (EXIT
                                         (COND
                                           ((QEQCAR |bc| 1)
                                            (|error|
                                             "Should not happen"))
                                           ('T
                                            (LETT |ll|
                                             (CONS
                                              (SPADCALL
                                               (LIST
                                                #'|PRIMELT;triangularLinearIfCan!0|)
                                               (SPADCALL
                                                (SPADCALL
                                                 (SPADCALL
                                                  (SPADCALL
                                                   (SPADCALL |p| 0
                                                    (QREFELT $ 53))
                                                   (QREFELT $ 31))
                                                  (QCAR (QCDR |bc|))
                                                  (QREFELT $ 54))
                                                 (QREFELT $ 55))
                                                |pw| (QREFELT $ 56))
                                               (QREFELT $ 9))
                                              |ll|) . #3#))))))
                                      #2# (EXIT #2#))
                                     (LETT #0# (CDR #0#) . #3#)
                                     (GO G190) G191 (EXIT NIL))
                                    (EXIT
                                     (CONS 0
                                      (CONS
                                       (SPADCALL
                                        (LIST
                                         #'|PRIMELT;triangularLinearIfCan!1|)
                                        |pw| (QREFELT $ 9))
                                       (NREVERSE |ll|))))))))))
           #1# (EXIT #1#))))) 

(DEFUN |PRIMELT;triangularLinearIfCan!1| (|#1| $$) |#1|) 

(DEFUN |PRIMELT;triangularLinearIfCan!0| (|#1| $$) |#1|) 

(DEFUN |PRIMELT;primitiveElement;LLSR;8| (|l| |vars| |uu| $)
  (PROG (|u| #0=#:G1888 |v| #1=#:G1889 |vv| |elim| |w| |n| |i| |cf| |t|
             #2=#:G1891 |c| #3=#:G1890 #4=#:G1879 #5=#:G1877 #6=#:G1878
             |tt| #7=#:G1881 |ltt| #8=#:G1887 #9=#:G1884)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |u| (SPADCALL |uu| (QREFELT $ 32))
                            . #10=(|PRIMELT;primitiveElement;LLSR;8|))
                      (LETT |vv|
                            (PROGN
                              (LETT #0# NIL . #10#)
                              (SEQ (LETT |v| NIL . #10#)
                                   (LETT #1# |vars| . #10#) G190
                                   (COND
                                     ((OR (ATOM #1#)
                                       (PROGN
                                         (LETT |v| (CAR #1#) . #10#)
                                         NIL))
                                      #11=(GO G191)))
                                   (SEQ
                                    (EXIT
                                     (LETT #0#
                                      (CONS
                                       (SPADCALL |v| (QREFELT $ 32))
                                       #0#) . #10#)))
                                   (LETT #1# (CDR #1#) . #10#)
                                   #12=(GO G190) G191
                                   (EXIT (NREVERSE0 #0#)))) . #10#)
                      (LETT |elim|
                            (SPADCALL |vars| |uu| (QREFELT $ 57)) . #10#)
                      (LETT |w| (SPADCALL |uu| (QREFELT $ 32)) . #10#)
                      (LETT |n| (LENGTH |l|) . #10#)
                      (EXIT (SEQ (LETT |i| 10 . #10#) G190 NIL
                                 (SEQ (EXIT
                                       (SEQ
                                        (LETT |cf|
                                         (|PRIMELT;randomInts| |n| |i|
                                          $) . #10#)
                                        (EXIT
                                         (COND
                                           ((QEQCAR
                                             (LETT |tt|
                                              (|PRIMELT;triangularLinearIfCan|
                                               (SPADCALL
                                                (CONS
                                                 (SPADCALL |w|
                                                  (PROGN
                                                    (LETT #6#
                                                     NIL . #10#)
                                                    (SEQ
                                                     (LETT |t|
                                                      NIL . #10#)
                                                     (LETT #2#
                                                      |vv| . #10#)
                                                     (LETT |c|
                                                      NIL . #10#)
                                                     (LETT #3#
                                                      |cf| . #10#)
                                                     G190
                                                     (COND
                                                       ((OR (ATOM #3#)
                                                         (PROGN
                                                           (LETT |c|
                                                            (CAR #3#) . #10#)
                                                           NIL)
                                                         (ATOM #2#)
                                                         (PROGN
                                                           (LETT |t|
                                                            (CAR #2#) . #10#)
                                                           NIL))
                                                        #11#))
                                                     (SEQ
                                                      (EXIT
                                                       (PROGN
                                                         (LETT #4#
                                                          (SPADCALL |c|
                                                           |t|
                                                           (QREFELT $
                                                            33)) . #10#)
                                                         (COND
                                                           (#6#
                                                            (LETT #5#
                                                             (SPADCALL
                                                              #5# #4#
                                                              (QREFELT
                                                               $ 58)) . #10#))
                                                           ('T
                                                            (PROGN
                                                              (LETT #5#
                                                               #4# . #10#)
                                                              (LETT #6#
                                                               'T . #10#)))))))
                                                     (LETT #3#
                                                      (PROG1 (CDR #3#)
                                                        (LETT #2#
                                                         (CDR #2#) . #10#)) . #10#)
                                                     #12# G191
                                                     (EXIT NIL))
                                                    (COND
                                                      (#6# #5#)
                                                      ('T
                                                       (|spadConstant|
                                                        $ 29))))
                                                  (QREFELT $ 34))
                                                 |l|)
                                                |elim| (QREFELT $ 60))
                                               |vars| |uu| $) . #10#)
                                             0)
                                            (PROGN
                                              (LETT #9#
                                               (SEQ
                                                (LETT |ltt|
                                                 (PROG2
                                                  (LETT #7#
                                                   |tt| . #10#)
                                                  (QCDR #7#)
                                                   (|check-union|
                                                    (QEQCAR #7# 0)
                                                    (|List|
                                                     (|SparseUnivariatePolynomial|
                                                      (QREFELT $ 6)))
                                                    #7#)) . #10#)
                                                (EXIT
                                                 (PROGN
                                                   (LETT #8#
                                                    (VECTOR |cf|
                                                     (CDR |ltt|)
                                                     (|SPADfirst|
                                                      |ltt|)) . #10#)
                                                   (GO #8#)))) . #10#)
                                              (GO #9#)))))))
                                      #9# (EXIT #9#))
                                 (LETT |i| (+ |i| 1) . #10#) #12# G191
                                 (EXIT NIL)))))
           #8# (EXIT #8#))))) 

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

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

(MAKEPROP '|PrimitiveElement| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|Mapping| 6 6)
             (|SparseUnivariatePolynomial| 6) (0 . |map|) (|Symbol|)
             (|Polynomial| 6) (6 . |multivariate|) (|Integer|)
             (12 . |symmetricRemainder|) (|Boolean|) (|List| 10)
             (18 . |member?|) (|Mapping| 15 10) (24 . |every?|)
             (30 . |new|)
             (|Record| (|:| |coef| (|List| 13)) (|:| |poly| (|List| 8))
                 (|:| |prim| 8))
             (|List| 11) |PRIMELT;primitiveElement;LLSR;8|
             |PRIMELT;primitiveElement;LLR;4| (|NonNegativeInteger|)
             (34 . |degree|) (40 . |One|) (44 . |Zero|) (48 . |Zero|)
             (52 . |resultant|) (59 . |univariate|) (64 . |coerce|)
             (69 . *) (75 . -) (81 . |eval|) (88 . |zero?|)
             (93 . |squareFreePart|) (98 . =) (104 . |One|)
             (|Record| (|:| |coef1| 13) (|:| |coef2| 13)
                 (|:| |prim| 8))
             |PRIMELT;primitiveElement;PSPSR;5| (108 . |variables|)
             (|SparseUnivariatePolynomial| $) (113 . |univariate|)
             (|SparseUnivariatePolynomial| 11) (119 . |degree|)
             (124 . |leadingCoefficient|) (129 . |One|)
             (|Record| (|:| |coef1| $) (|:| |coef2| $))
             (|Union| 49 '"failed") (133 . |extendedEuclidean|)
             (140 . |Zero|) (144 . |coefficient|) (150 . *) (156 . -)
             (161 . |rem|) (167 . |concat|) (173 . +)
             (|PolyGroebner| 6) (179 . |lexGroebner|))
          '#(|primitiveElement| 185) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 60
                                '(2 8 0 7 0 9 2 11 0 8 10 12 2 13 0 0 0
                                  14 2 16 15 10 0 17 2 16 15 18 0 19 0
                                  10 0 20 2 11 25 0 10 26 0 6 0 27 0 6
                                  0 28 0 11 0 29 3 11 0 0 0 10 30 1 11
                                  8 0 31 1 11 0 10 32 2 11 0 13 0 33 2
                                  11 0 0 0 34 3 11 0 0 10 0 35 1 8 15 0
                                  36 1 8 0 0 37 2 8 15 0 0 38 0 11 0 39
                                  1 11 16 0 42 2 11 43 0 10 44 1 45 25
                                  0 46 1 45 11 0 47 0 8 0 48 3 8 50 0 0
                                  0 51 0 8 0 52 2 45 11 0 25 53 2 8 0 0
                                  0 54 1 8 0 0 55 2 8 0 0 0 56 2 16 0 0
                                  10 57 2 11 0 0 0 58 2 59 22 22 16 60
                                  4 0 40 11 10 11 10 41 3 0 21 22 16 10
                                  23 2 0 21 22 16 24)))))
          '|lookupComplete|)) 
