if you're asking if negative input is legal, yes it is.
To simplify it, it's similar to how modulo operates in C.
If you do:
int x = (1-3) % 5; // -2 % 5
you'll get "-2" as a result, but what you're actually
interested in is:
int x = (1-3 + group_order) % 5; // (-2 + 5) % 5 = 3 % 5 == 5
group_order == 5, and you'll get 3 as a result...
Yes, I know.
So, the problem is that -2 or 3 is processed further and we are not certain if
-2 behaves differently than 3 does. That is certainly a problem.
EDIT: we are not certain if the 3 resulting from a -2 is process the same way as we would give it another try.
"-2" is passed as input to verify() which was expecting to see "3" not "-2"...
But it is not sure, if -2 in form as a 3 would result in the same outcome as it would be a 'real' 3 from the beginning.
In math -2 mod 5 equals 3. Is that the result, which is wanted? ... in that case C implementation is wrong there and should not use % with negative numbers. (change to positive by adding 5)
I think that's not the point here. Consider this:
b = f(a)
c = g(b)
d = h(a, c)
Let's assume c results in -2 with a certain b.
Even if c=-2 and c=3 are interchangeable mathematically, h might not work as expected as the pair (a, c) belong together.
So, it could be the case that h(a, -2) != h(a, 3) for the very same a. This must be avoided at any cost.