There are 2 questions in one. First, how is the idealprimedec
output sorted ? By increasing residue degree (P.f), then by some mathematically meaningless lexicographic ordering of P.gen[2]; in particular, it depends on the minimal polynomial used to define the number field. The exact same ordering is used in idealfactor
, after ordering by increasing underlying rational prime. So, to detect whether a prime ideal given in terms of nf1 = nfinit(T1)
is the same as another one given in terms of nf2 = nfinit(T2)
, you cannot proceed directly besides comparing the underlying primes P.gen[1]
, inertia degree P.e
and residue degree P.f
. If any of these differ, you have a definite answer; else you remain in doubt.
The second question is thus more interesting. How do you check whether P1
(given in terms of nf1
) and P2
(given in terms of nf2
) are the same, knowing that the number fields nf1
and nf2
are isomorphic ? The way I recommend is as follows
if P2.f
is equal to the field degree, then the prime is inert and the above preliminary test is enough.
set [p, pi] = P2.gen
: p
is the underlying rational prime and pi
is a p
-uniformizer (its valuation is 1 at P2
and 0 at all over primes dividing p
), given in terms of the integer basis nf2.zk
. N.B. this is not true when the prime is inert, you will have pi = 0
.
convert pi
to polynomial representation using pi = lift(nfbasistoalg(nf2, pi))
obtain one field isomorphism s
relating nf2
to nf1
using s = nfisincl(nf2, nf1, 1)
(the final '1' avoids computing all isomorphisms, we only need one).
map pi
from nf2
to nf1
using PI = Mod(subst(pi, variable(pi), s), nf1.pol)
. You now have a representation of pi
in nf1
.
You can then check whether idealval(nf1, PI, P1)
is positive (and in fact equal to 1), which will be the case if and only if P1
and P2
are the same.
P.S. Independently, to study the decomposition of a fixed prime from K
in multiple extensions L1
, L2
, etc., you may want to have a look at rnfidealprimedec
.