Function: rnfdedekind
Section: number_fields
C-Name: rnfdedekind
Prototype: GGDGD0,L,
Help: rnfdedekind(nf,pol,{pr},{flag=0}): relative Dedekind criterion over the
 number field K, represented by nf, applied to the order Z_K[X]/(P),
 modulo the prime ideal pr (at all primes if pr omitted, in which case
 flag is automatically set to 1).
 P is assumed to be monic, irreducible, in Z_K[X].
 Returns [max,basis,v], where basis is a pseudo-basis of the
 enlarged order, max is 1 iff this order is pr-maximal, and v is the
 valuation at pr of the order discriminant. If flag is set, just return 1 if
 the order is maximal, and 0 if not.
Doc: given a number field $K$ coded by $\var{nf}$ and a monic
 polynomial $P\in \Z_{K}[X]$, irreducible over $K$ and thus defining a relative
 extension $L$ of $K$, applies \idx{Dedekind}'s criterion to the order
 $\Z_{K}[X]/(P)$, at the prime ideal \var{pr}. It is possible to set \var{pr}
 to a vector of prime ideals (test maximality at all primes in the vector),
 or to omit altogether, in which case maximality at \emph{all} primes is tested;
 in this situation \fl\ is automatically set to $1$.

 The default historic behavior (\fl\ is 0 or omitted and \var{pr} is a
 single prime ideal) is not so useful since
 \kbd{rnfpseudobasis} gives more information and is generally not that
 much slower. It returns a 3-component vector $[\var{max}, \var{basis}, v]$:

 \item \var{basis} is a pseudo-basis of an enlarged order $O$ produced by
 Dedekind's criterion, containing the original order $\Z_{K}[X]/(P)$
 with index a power of \var{pr}. Possibly equal to the original order.

 \item \var{max} is a flag equal to 1 if the enlarged order $O$
 could be proven to be \var{pr}-maximal and to 0 otherwise; it may still be
 maximal in the latter case if \var{pr} is ramified in $L$,

 \item $v$ is the valuation at \var{pr} of the order discriminant.

 If \fl\ is nonzero, on the other hand, we just return $1$ if the order
 $\Z_{K}[X]/(P)$ is \var{pr}-maximal (resp.~maximal at all relevant primes, as
 described above), and $0$ if not. This is much faster than the default,
 since the enlarged order is not computed.
 \bprog
 ? nf = nfinit(y^2-3); P = x^3 - 2*y;
 ? pr3 = idealprimedec(nf,3)[1];
 ? rnfdedekind(nf, P, pr3)
 %3 = [1, [[1, 0, 0; 0, 1, 0; 0, 0, 1], [1, 1, 1]], 8]
 ? rnfdedekind(nf, P, pr3, 1)
 %4 = 1
 @eprog\noindent In this example, \kbd{pr3} is the ramified ideal above $3$,
 and the order generated by the cube roots of $y$ is already
 \kbd{pr3}-maximal. The order-discriminant has valuation $8$. On the other
 hand, the order is not maximal at the prime above 2:
 \bprog
 ? pr2 = idealprimedec(nf,2)[1];
 ? rnfdedekind(nf, P, pr2, 1)
 %6 = 0
 ? rnfdedekind(nf, P, pr2)
 %7 = [0, [[2, 0, 0; 0, 1, 0; 0, 0, 1], [[1, 0; 0, 1], [1, 0; 0, 1],
      [1, 1/2; 0, 1/2]]], 2]
 @eprog
 The enlarged order is not proven to be \kbd{pr2}-maximal yet. In fact, it
 is; it is in fact the maximal order:
 \bprog
 ? B = rnfpseudobasis(nf, P)
 %8 = [[1, 0, 0; 0, 1, 0; 0, 0, 1], [1, 1, [1, 1/2; 0, 1/2]],
      [162, 0; 0, 162], -1]
 ? idealval(nf,B[3], pr2)
 %9 = 2
 @eprog\noindent
 It is possible to use this routine with nonmonic
 $P = \sum_{i\leq n} p_{i} X^{i} \in \Z_{K}[X]$ if $\fl = 1$;
 in this case, we test maximality of Dedekind's order generated by
 $$1, p_{n} \alpha, p_{n}\alpha^{2} + p_{n-1}\alpha, \dots,
 p_{n}\alpha^{n-1} + p_{n-1}\alpha^{n-2} + \cdots + p_{1}\alpha.$$
 The routine will fail if $P$ vanishes on the projective line over the residue
 field $\Z_{K}/\kbd{pr}$ (FIXME).
