From ebb1beea7832207e5c8c5112d250fd216259ef41 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Fri, 4 Feb 2022 15:06:58 +0100 Subject: [PATCH] sage: Ensure that constraints are always fastfracs Even if they are constants created in the formula functions. We now lift integer constants to fastfracs. --- sage/group_prover.sage | 3 +++ sage/weierstrass_prover.sage | 2 ++ 2 files changed, 5 insertions(+) diff --git a/sage/group_prover.sage b/sage/group_prover.sage index 706b859b278a1..9305c215d5928 100644 --- a/sage/group_prover.sage +++ b/sage/group_prover.sage @@ -164,6 +164,9 @@ class constraints: def negate(self): return constraints(zero=self.nonzero, nonzero=self.zero) + def map(self, fun): + return constraints(zero={fun(k): v for k, v in self.zero.items()}, nonzero={fun(k): v for k, v in self.nonzero.items()}) + def __add__(self, other): zero = self.zero.copy() zero.update(other.zero) diff --git a/sage/weierstrass_prover.sage b/sage/weierstrass_prover.sage index 21e69b3acb4ed..be9cfd4c76d87 100644 --- a/sage/weierstrass_prover.sage +++ b/sage/weierstrass_prover.sage @@ -251,6 +251,8 @@ def check_symbolic_jacobian_weierstrass(name, A, B, branches, formula): ret = True for branch in range(branches): assumeFormula, assumeBranch, pC = formula(branch, pA, pB) + assumeBranch = assumeBranch.map(lift) + assumeFormula = assumeFormula.map(lift) pC.X = lift(pC.X) pC.Y = lift(pC.Y) pC.Z = lift(pC.Z)