openvm_ecc_guest/
group.rs1use core::{
2 fmt::Debug,
3 ops::{Add, AddAssign, Neg, Sub, SubAssign},
4};
5
6pub trait Group:
7 Clone
8 + Debug
9 + Eq
10 + Sized
11 + Add<Output = Self>
12 + Sub<Output = Self>
13 + Neg<Output = Self>
14 + for<'a> Add<&'a Self, Output = Self>
15 + for<'a> Sub<&'a Self, Output = Self>
16 + AddAssign
17 + SubAssign
18 + for<'a> AddAssign<&'a Self>
19 + for<'a> SubAssign<&'a Self>
20{
21 type SelfRef<'a>: Add<&'a Self, Output = Self> + Sub<&'a Self, Output = Self>
22 where
23 Self: 'a;
24
25 const IDENTITY: Self;
26
27 fn is_identity(&self) -> bool;
28
29 fn double(&self) -> Self;
30 fn double_assign(&mut self);
31}
32
33pub trait CyclicGroup: Group {
34 const GENERATOR: Self;
35 const NEG_GENERATOR: Self;
36}