
(/VERSIONCHECK 2) 

(DEFUN |PFOQ;torsion?;FdB;1| (|d| $)
  (QEQCAR (SPADCALL |d| (QREFELT $ 11)) 0)) 

(DEFUN |PFOQ;ratcurve| (|d| |modulus| |disc| $)
  (PROG (|i| |nm| |mn| |hh| |h| |b| |s| |bd| |r| |bad| |p| |n| |m|)
    (RETURN
      (SEQ (LETT |mn|
                 (SPADCALL
                     (LETT |nm|
                           (SPADCALL
                               (LETT |i| (SPADCALL |d| (QREFELT $ 15))
                                     . #0=(|PFOQ;ratcurve|))
                               (QREFELT $ 17)) . #0#)
                     (QREFELT $ 19)) . #0#)
           (LETT |h|
                 (SPADCALL
                     (LETT |hh|
                           (SPADCALL |nm| (+ |mn| 1) (QREFELT $ 22)) . #0#)
                     (QREFELT $ 23)) . #0#)
           (LETT |s|
                 (QCAR (SPADCALL
                           (SPADCALL (SPADCALL |hh| (QREFELT $ 25))
                               (QREFELT $ 26))
                           (LETT |b|
                                 (SPADCALL
                                     (SPADCALL
                                      (SPADCALL |nm| |mn|
                                       (QREFELT $ 22))
                                      (QREFELT $ 27))
                                     (QREFELT $ 26)) . #0#)
                           (QREFELT $ 29))) . #0#)
           (LETT |bd|
                 (SPADCALL (SPADCALL |i| (QREFELT $ 30))
                     (QREFELT $ 33)) . #0#)
           (LETT |r| (SPADCALL |s| |b| (QREFELT $ 35)) . #0#)
           (LETT |bad|
                 (SPADCALL
                     (LIST |disc| (SPADCALL |r| (QREFELT $ 36))
                           (SPADCALL |r| (QREFELT $ 37))
                           (* (QCAR |bd|) (QCDR |bd|))
                           (SPADCALL |h| (QREFELT $ 38)))
                     (QREFELT $ 40)) . #0#)
           (LETT |n|
                 (|PFOQ;rat| |modulus| |d|
                     (LETT |p| (SPADCALL |bad| (QREFELT $ 42)) . #0#)
                     $) . #0#)
           (EXIT (COND
                   ((EQL |n| 1) |n|)
                   (#1='T
                    (SEQ (LETT |m|
                               (|PFOQ;rat| |modulus| |d|
                                   (SPADCALL
                                    (SPADCALL |p| |bad| (QREFELT $ 43))
                                    (QREFELT $ 42))
                                   $) . #0#)
                         (EXIT (COND ((EQL |n| |m|) |n|) (#1# 0))))))))))) 

(DEFUN |PFOQ;rat| (|pp| |d| |p| $)
  (PROG (|gf|)
    (RETURN
      (SEQ (LETT |gf| (|InnerPrimeField| |p|) |PFOQ;rat|)
           (EXIT (SPADCALL |d| |pp|
                     (CONS #'|PFOQ;rat!0| (VECTOR |gf| $))
                     (|compiledLookupCheck| '|order|
                         (LIST (LIST '|NonNegativeInteger|)
                               (LIST '|FiniteDivisor|
                                     (LIST '|Fraction|
                                      (LIST '|Integer|))
                                     (|devaluate| (ELT $ 6))
                                     (|devaluate| (ELT $ 7))
                                     (|devaluate| (ELT $ 8)))
                               (|devaluate| (ELT $ 7))
                               (LIST '|Mapping| (|devaluate| |gf|)
                                     (LIST '|Fraction|
                                      (LIST '|Integer|))))
                         (|ReducedDivisor| (|Fraction| (|Integer|))
                             (ELT $ 6) (ELT $ 7) (ELT $ 8) |gf|)))))))) 

(DEFUN |PFOQ;rat!0| (|#1| $$)
  (PROG ($ |gf|)
    (LETT $ (QREFELT $$ 1) . #0=(|PFOQ;rat|))
    (LETT |gf| (QREFELT $$ 0) . #0#)
    (RETURN
      (PROGN
        (SPADCALL
            (SPADCALL (SPADCALL |#1| (QREFELT $ 36))
                (|compiledLookupCheck| '|coerce|
                    (LIST '$ (LIST '|Integer|)) |gf|))
            (SPADCALL (SPADCALL |#1| (QREFELT $ 37))
                (|compiledLookupCheck| '|coerce|
                    (LIST '$ (LIST '|Integer|)) |gf|))
            (|compiledLookupCheck| '/ (LIST '$ '$ '$) |gf|)))))) 

(DEFUN |PFOQ;possibleOrder| (|d| $)
  (PROG (|r|)
    (RETURN
      (SEQ (COND
             ((OR (ZEROP (SPADCALL (QREFELT $ 45)))
                  (EQL (QVSIZE (SPADCALL (SPADCALL |d| (QREFELT $ 15))
                                   (QREFELT $ 17)))
                       1))
              1)
             ('T
              (SEQ (LETT |r|
                         (SPADCALL (SPADCALL (QREFELT $ 46))
                             (QREFELT $ 47))
                         |PFOQ;possibleOrder|)
                   (EXIT (|PFOQ;ratcurve| |d| |r|
                             (SPADCALL |r| (QREFELT $ 48)) $))))))))) 

(DEFUN |PFOQ;order;FdU;5| (|d| $)
  (PROG (|n|)
    (RETURN
      (COND
        ((OR (ZEROP (LETT |n|
                          (|PFOQ;possibleOrder|
                              (LETT |d| (SPADCALL |d| (QREFELT $ 49))
                                    . #0=(|PFOQ;order;FdU;5|))
                              $) . #0#))
             (NULL (SPADCALL
                       (SPADCALL (SPADCALL |n| |d| (QREFELT $ 50))
                           (QREFELT $ 49))
                       (QREFELT $ 51))))
         (CONS 1 "failed"))
        ('T (CONS 0 |n|)))))) 

(DEFUN |PFOQ;torsionIfCan;FdU;6| (|d| $)
  (PROG (|n| |g|)
    (RETURN
      (SEQ (COND
             ((ZEROP (LETT |n|
                           (|PFOQ;possibleOrder|
                               (LETT |d| (SPADCALL |d| (QREFELT $ 49))
                                     . #0=(|PFOQ;torsionIfCan;FdU;6|))
                               $) . #0#))
              (CONS 1 "failed"))
             ('T
              (SEQ (LETT |g|
                         (SPADCALL
                             (SPADCALL
                                 (SPADCALL |n| |d| (QREFELT $ 50))
                                 (QREFELT $ 49))
                             (QREFELT $ 53)) . #0#)
                   (EXIT (COND
                           ((QEQCAR |g| 1) (CONS 1 "failed"))
                           ('T (CONS 0 (CONS |n| (QCDR |g|))))))))))))) 

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

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

(MAKEPROP '|PointsOfFiniteOrderRational| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
             (|local| |#3|) (|Union| 44 '"failed")
             (|FiniteDivisor| 34 6 7 8) |PFOQ;order;FdU;5| (|Boolean|)
             |PFOQ;torsion?;FdB;1| (|FractionalIdeal| 6 24 7 8)
             (0 . |ideal|) (|Vector| 8) (5 . |numer|) (|Integer|)
             (10 . |minIndex|) (15 . |One|) (19 . |One|) (23 . |elt|)
             (29 . |lift|) (|Fraction| 6) (34 . |norm|)
             (39 . |retract|) (44 . |retract|)
             (|Record| (|:| |primePart| $) (|:| |commonPart| $))
             (49 . |separate|) (55 . |denom|)
             (|Record| (|:| |den| 18) (|:| |gcdnum| 18))
             (|PointsOfFiniteOrderTools| 6 7) (60 . |badNum|)
             (|Fraction| 18) (65 . |resultant|) (71 . |numer|)
             (76 . |denom|) (81 . |badNum|) (|List| $) (86 . |lcm|)
             (|PositiveInteger|) (91 . |getGoodPrime|) (96 . *)
             (|NonNegativeInteger|) (102 . |genus|)
             (106 . |definingPolynomial|) (110 . |polyred|)
             (115 . |doubleDisc|) (120 . |reduce|) (125 . *)
             (131 . |principal?|) (|Union| 8 '"failed")
             (136 . |generator|)
             (|Record| (|:| |order| 44) (|:| |function| 8))
             (|Union| 54 '"failed") |PFOQ;torsionIfCan;FdU;6|)
          '#(|torsionIfCan| 141 |torsion?| 146 |order| 151) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 56
                                '(1 10 14 0 15 1 14 16 0 17 1 16 18 0
                                  19 0 6 0 20 0 7 0 21 2 16 8 0 18 22 1
                                  8 7 0 23 1 8 24 0 25 1 24 6 0 26 1 8
                                  24 0 27 2 6 28 0 0 29 1 14 6 0 30 1
                                  32 31 6 33 2 6 34 0 0 35 1 34 18 0 36
                                  1 34 18 0 37 1 32 18 7 38 1 18 0 39
                                  40 1 32 41 18 42 2 18 0 41 0 43 0 8
                                  44 45 0 8 7 46 1 32 7 7 47 1 32 18 7
                                  48 1 10 0 0 49 2 10 0 18 0 50 1 10 12
                                  0 51 1 10 52 0 53 1 0 55 10 56 1 0 12
                                  10 13 1 0 9 10 11)))))
          '|lookupComplete|)) 
