Principal divisor criterion on an elliptic curve (source code)

= Principal divisor criterion on an elliptic curve

For an elliptic curve with identity $O$, a divisor $D=\sum_Pn_P(P)$ is principal exactly when
$$
\sum_Pn_P=0
\qquad\text{and}\qquad
\sum_P[n_P]P=O.
$$
This is the identification of the degree-zero divisor class group with the elliptic curve.