
(/VERSIONCHECK 2) 

(DEFUN |SUBRESP;primitivePart;UPRUP;1| (|p| |q| $)
  (PROG (#0=#:G1831 |rec|)
    (RETURN
      (SEQ (LETT |rec|
                 (PROG2 (LETT #0#
                              (SPADCALL (SPADCALL |p| (QREFELT $ 8))
                                  |q| (|spadConstant| $ 9)
                                  (QREFELT $ 12))
                              . #1=(|SUBRESP;primitivePart;UPRUP;1|))
                        (QCDR #0#)
                   (|check-union| (QEQCAR #0# 0)
                       (|Record| (|:| |coef1| (QREFELT $ 6))
                           (|:| |coef2| (QREFELT $ 6)))
                       #0#)) . #1#)
           (EXIT (SPADCALL
                     (SPADCALL
                         (SPADCALL
                             (CONS #'|SUBRESP;primitivePart;UPRUP;1!0|
                                   (VECTOR |q| $ |rec|))
                             |p| (QREFELT $ 16))
                         (QREFELT $ 17))
                     (QREFELT $ 18))))))) 

(DEFUN |SUBRESP;primitivePart;UPRUP;1!0| (|#1| $$)
  (PROG ($)
    (LETT $ (QREFELT $$ 1) |SUBRESP;primitivePart;UPRUP;1|)
    (RETURN
      (PROGN
        (SPADCALL (SPADCALL (QCAR (QREFELT $$ 2)) |#1| (QREFELT $ 13))
            (QREFELT $$ 0) (QREFELT $ 14)))))) 

(DEFUN |SUBRESP;subresultantVector;2UPPa;2| (|p1| |p2| $)
  (PROG (|res| #0=#:G1837 #1=#:G1842 F |l| #2=#:G1849 |Sn| |n|)
    (RETURN
      (SEQ (LETT |res|
                 (SPADCALL
                     (+ 2
                        (MAX (SPADCALL |p1| (QREFELT $ 21))
                             (SPADCALL |p2| (QREFELT $ 21))))
                     (|spadConstant| $ 22) (QREFELT $ 24))
                 . #3=(|SUBRESP;subresultantVector;2UPPa;2|))
           (LETT |l| (SPADCALL |p1| |p2| (QREFELT $ 27)) . #3#)
           (EXIT (COND
                   ((NULL |l|)
                    (COND
                      ((ZEROP (SPADCALL |p1| (QREFELT $ 21)))
                       (SEQ (SETELT |res|
                                    (SPADCALL |p2| (QREFELT $ 21))
                                    |p2|)
                            (COND
                              ((< 0 (SPADCALL |p2| (QREFELT $ 21)))
                               (SEQ (SETELT |res|
                                     (PROG1
                                      (LETT #0#
                                       (-
                                        (SPADCALL |p2| (QREFELT $ 21))
                                        1) . #3#)
                                       (|check-subtype| (>= #0# 0)
                                        '(|NonNegativeInteger|) #0#))
                                     |p1|)
                                    (EXIT
                                     (SETELT |res| 0
                                      (SPADCALL
                                       (SPADCALL
                                        (SPADCALL |p1| (QREFELT $ 8))
                                        (SPADCALL |p2| (QREFELT $ 21))
                                        (QREFELT $ 29))
                                       (QREFELT $ 30))))))
                              ('T
                               (SETELT |res| 0 (|spadConstant| $ 31))))
                            (EXIT |res|)))
                      ((ZEROP (SPADCALL |p2| (QREFELT $ 21)))
                       (SEQ (COND
                              ((< 0 (SPADCALL |p1| (QREFELT $ 21)))
                               (SEQ (SETELT |res|
                                     (PROG1
                                      (LETT #1#
                                       (-
                                        (SPADCALL |p1| (QREFELT $ 21))
                                        1) . #3#)
                                       (|check-subtype| (>= #1# 0)
                                        '(|NonNegativeInteger|) #1#))
                                     |p2|)
                                    (EXIT
                                     (SETELT |res| 0
                                      (SPADCALL
                                       (SPADCALL
                                        (SPADCALL |p2| (QREFELT $ 8))
                                        (SPADCALL |p1| (QREFELT $ 21))
                                        (QREFELT $ 29))
                                       (QREFELT $ 30))))))
                              ('T
                               (SETELT |res| 0 (|spadConstant| $ 31))))
                            (EXIT |res|)))
                      ('T
                       (|error| "SUBRESP: strange Subresultant chain from PRS"))))
                   ('T
                    (SEQ (LETT |Sn| (|SPADfirst| |l|) . #3#)
                         (LETT |l| (CDR |l|) . #3#)
                         (LETT |n|
                               (SPADCALL |Sn| (QREFELT $ 21)) . #3#)
                         (LETT F |Sn| . #3#)
                         (EXIT (COND
                                 ((OR (NULL |l|)
                                      (SPADCALL |Sn| (QREFELT $ 33)))
                                  (|error| "SUBRESP: strange Subresultant chain from PRS"))
                                 ('T
                                  (SEQ (SEQ G190
                                        (COND
                                          ((NULL
                                            (COND
                                              ((SPADCALL |l| NIL
                                                (QREFELT $ 34))
                                               'NIL)
                                              ('T 'T)))
                                           (GO G191)))
                                        (SEQ (SETELT |res| |n| |Sn|)
                                         (LETT F
                                          (|SPADfirst| |l|) . #3#)
                                         (LETT |l| (CDR |l|) . #3#)
                                         (EXIT
                                          (COND
                                            ((EQL
                                              (SPADCALL F
                                               (QREFELT $ 21))
                                              |n|)
                                             (COND
                                               ((NULL |l|)
                                                (|error|
                                                 "SUBRESP: strange Subresultant chain from PRS"))
                                               ('T
                                                (SEQ
                                                 (LETT |Sn|
                                                  (|SPADfirst| |l|) . #3#)
                                                 (LETT |l|
                                                  (CDR |l|) . #3#)
                                                 (LETT |n|
                                                  (SPADCALL |Sn|
                                                   (QREFELT $ 21)) . #3#)
                                                 (EXIT
                                                  (SETELT |res|
                                                   (PROG1
                                                    (LETT #2#
                                                     (- |n| 1) . #3#)
                                                     (|check-subtype|
                                                      (>= #2# 0)
                                                      '(|NonNegativeInteger|)
                                                      #2#))
                                                   F))))))
                                            ((<
                                              (SPADCALL F
                                               (QREFELT $ 21))
                                              |n|)
                                             (|error|
                                              "strange result !"))
                                            ('T
                                             (SEQ (LETT |Sn| F . #3#)
                                              (EXIT
                                               (LETT |n|
                                                (SPADCALL |Sn|
                                                 (QREFELT $ 21)) . #3#)))))))
                                        NIL (GO G190) G191 (EXIT NIL))
                                       (SETELT |res| |n| |Sn|)
                                       (COND
                                         ((EQL
                                           (SPADCALL |p1|
                                            (QREFELT $ 21))
                                           (SPADCALL |p2|
                                            (QREFELT $ 21)))
                                          (SETELT |res|
                                           (+
                                            (SPADCALL |p1|
                                             (QREFELT $ 21))
                                            1)
                                           |p1|))
                                         ((<
                                           (SPADCALL |p2|
                                            (QREFELT $ 21))
                                           (SPADCALL |p1|
                                            (QREFELT $ 21)))
                                          (SETELT |res|
                                           (SPADCALL |p1|
                                            (QREFELT $ 21))
                                           |p1|))
                                         ('T
                                          (SETELT |res|
                                           (SPADCALL |p2|
                                            (QREFELT $ 21))
                                           |p2|)))
                                       (EXIT |res|))))))))))))) 

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

(DEFUN |SubResultantPackage;| (|#1| |#2|)
  (PROG (DV$1 DV$2 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|SubResultantPackage|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT |dv$| (LIST '|SubResultantPackage| DV$1 DV$2) . #0#)
        (LETT $ (GETREFV 36) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3
            (LETT |pv$|
                  (|buildPredVector| 0 0
                      (LIST (|HasCategory| |#1| '(|EuclideanDomain|)))) . #0#))
        (|haddProp| |$ConstructorCache| '|SubResultantPackage|
            (LIST DV$1 DV$2) (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 |#1|)
        (QSETREFV $ 7 |#2|)
        (COND
          ((|testBitVector| |pv$| 1)
           (QSETREFV $ 19
               (CONS (|dispatchFunction|
                         |SUBRESP;primitivePart;UPRUP;1|)
                     $))))
        $)))) 

(MAKEPROP '|SubResultantPackage| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (0 . |leadingCoefficient|) (5 . |One|)
             (|Record| (|:| |coef1| $) (|:| |coef2| $))
             (|Union| 10 '"failed") (9 . |extendedEuclidean|) (16 . *)
             (22 . |rem|) (|Mapping| 6 6) (28 . |map|)
             (34 . |primitivePart|) (39 . |unitCanonical|)
             (44 . |primitivePart|) (|NonNegativeInteger|)
             (50 . |degree|) (55 . |Zero|) (|PrimitiveArray| 7)
             (59 . |new|) (|List| 7) (|PseudoRemainderSequence| 6 7)
             (65 . |chainSubResultants|) (71 . |Zero|) (75 . **)
             (81 . |coerce|) (86 . |One|) (|Boolean|) (90 . |zero?|)
             (95 . =) |SUBRESP;subresultantVector;2UPPa;2|)
          '#(|subresultantVector| 101 |primitivePart| 107) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 35
                                '(1 7 6 0 8 0 6 0 9 3 6 11 0 0 0 12 2 6
                                  0 0 0 13 2 6 0 0 0 14 2 7 0 15 0 16 1
                                  7 0 0 17 1 7 0 0 18 2 0 7 7 6 19 1 7
                                  20 0 21 0 7 0 22 2 23 0 20 7 24 2 26
                                  25 7 7 27 0 6 0 28 2 6 0 0 20 29 1 7
                                  0 6 30 0 7 0 31 1 7 32 0 33 2 25 32 0
                                  0 34 2 0 23 7 7 35 2 1 7 7 6 19)))))
          '|lookupComplete|)) 
