use crate::elliptic_curve::traits::IsEllipticCurve;
use crate::field::element::FieldElement;
use core::fmt::Debug;
/// Trait to add elliptic curves behaviour to a struct.
pub trait IsMontgomery: IsEllipticCurve + Clone + Debug {
fn a() -> FieldElement<Self::BaseField>;
fn b() -> FieldElement<Self::BaseField>;
/// Evaluates the short Weierstrass equation at (x, y z).
/// Used for checking if [x: y: z] belongs to the elliptic curve.
fn defining_equation(
x: &FieldElement<Self::BaseField>,
y: &FieldElement<Self::BaseField>,
) -> FieldElement<Self::BaseField> {
(Self::b() * y.pow(2_u16)) - (x.pow(3_u16) + Self::a() * x.pow(2_u16) + x)
}
}