/usr/share/axiom-20170501/src/algebra/PFOQ.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | )abbrev package PFOQ PointsOfFiniteOrderRational
++ Author: Manuel Bronstein
++ Date Created: 25 Aug 1988
++ Date Last Updated: 3 August 1993
++ Description:
++ This package provides function for testing whether a divisor on a
++ curve is a torsion divisor.
PointsOfFiniteOrderRational(UP, UPUP, R) : SIG == CODE where
UP : UnivariatePolynomialCategory Fraction Integer
UPUP : UnivariatePolynomialCategory Fraction UP
R : FunctionFieldCategory(Fraction Integer, UP, UPUP)
PI ==> PositiveInteger
N ==> NonNegativeInteger
Z ==> Integer
Q ==> Fraction Integer
FD ==> FiniteDivisor(Q, UP, UPUP, R)
SIG ==> with
order : FD -> Union(N, "failed")
++ order(f) \undocumented
torsion? : FD -> Boolean
++ torsion?(f) \undocumented
torsionIfCan : FD -> Union(Record(order:N, function:R), "failed")
++ torsionIfCan(f) \undocumented
CODE ==> add
import PointsOfFiniteOrderTools(UP, UPUP)
possibleOrder: FD -> N
ratcurve : (FD, UPUP, Z) -> N
rat : (UPUP, FD, PI) -> N
torsion? d == order(d) case N
-- returns the potential order of d, 0 if d is of infinite order
ratcurve(d, modulus, disc) ==
mn := minIndex(nm := numer(i := ideal d))
h := lift(hh := nm(mn + 1))
s := separate(retract(norm hh)@UP,
b := retract(retract(nm.mn)@Fraction(UP))@UP).primePart
bd := badNum denom i
r := resultant(s, b)
bad := lcm [disc, numer r, denom r, bd.den * bd.gcdnum, badNum h]$List(Z)
n := rat(modulus, d, p := getGoodPrime bad)
-- if n > 1 then it's cheaper to compute the order modulo a second prime,
-- since computing n * d could be very expensive
(n = 1) => n
m := rat(modulus, d, getGoodPrime(p * bad))
n = m => n
0
rat(pp, d, p) ==
gf := InnerPrimeField p
order(d, pp,
(z1:Q):gf +->
numer(z1)::gf / denom(z1)::gf)$ReducedDivisor(Q, UP, UPUP, R, gf)
-- returns the potential order of d, 0 if d is of infinite order
possibleOrder d ==
zero?(genus()) or (#(numer ideal d) = 1) => 1
r := polyred definingPolynomial()$R
ratcurve(d, r, doubleDisc r)
order d ==
zero?(n := possibleOrder(d := reduce d)) => "failed"
principal? reduce(n::Z * d) => n
"failed"
torsionIfCan d ==
zero?(n := possibleOrder(d := reduce d)) => "failed"
(g := generator reduce(n::Z * d)) case "failed" => "failed"
[n, g::R]
|