Now that this conditional has been moved, the constraints are off. In the first return
, we do not know that b
is not infinity (but in the second, we know that a
is not infinity, though that shouldn’t be required to prove the formula.) And then the prover finds a bug in the formula because there is no equivalent in the sage code for
0 if (a->infinity) {
1 [...]
2 r->infinity = b->infinity;
Here’s fixed sage code: https://github.com/real-or-random/secp256k1/commits/group_var
I assume the reason for checking b->infinity first was that this is faster if true, and I guess the likelihood of a or b being infinity is comparable. It’s probably not measurable but was there a performance reason for the reordering, or did you just change it because then it looks cleaner? If the latter, we may just leave it as it was.