Closed mark-schultz-wu closed 4 years ago
I've tried looking into this a bit further, and it seems like the issue is within alga_derive
. In particular, in get_dependencies
monoid currently depends on quasigroup, when it should (mathematically) depend on semigroup. This is where the two_sided_inverse
requirement seems to be coming from.
I'm very unfamiliar with procedural macros though, so don't know if I am misunderstanding something.
I've implemented some (reasonable in terms of the underlying mathematics) changes to alga_derive
here which fix my issue.
I am trying to implement the ring of integers mod n for n non-prime (so this is a ring, not a field). Here is a link to the relevant code.
The section which errors has the following form:
The rest of the code is implementing various traits. The particular error is below:
It seems that the issue is that I have not provided a TwoSidedInverse implementation. But I want to implement an integral domain for which not every element has a multiplicative inverse, so this seems like the "right" thing to be doing.
Is this behavior expected? Is there some other way that I can use
alga
to implement the modular arithmetic mod n for n composite?