There are a lot of crates online that focus on implementing algebraic structures like groups, rings, and fields. However it seems like these crates are focused on the structures themselves (re: Alga) or on their elements (maybe? re: maths_traits).
I'm looking for a framework that balances both algebraic structures and their elements. For example, I want to be able to both instantiate a ring which I can quotient with an ideal to produce a new algebraic structure, but I also want to be able to work with elements of this ring.
I've given this quite a few attempts but have never found anything that feels like a nice solution. Are there any libraries that do this, or does anyone have ideas as to how to make this work?
To be clear, here are some of the issues I have: say I define a trait for rings. Then elements of this ring should take this ring as a generic. But then the ring itself doesn't know anything about it's elements. As an example:
pub trait Ring {}
pub trait RingElem<T: Ring> {}
pub struct IntegerRing {}
impl Ring for IntegerRing {}
pub struct Integer {}
impl RingElem<IntegerRing> for Integer {}
// now IntegerRing doesn't know about Integer, so how can I do something like IntegerRing::zero()?
I know my concerns are a bit vague but I'm hoping someone can point me to a solution that someone else has used to work around these issues.