Skip to content

Commit

Permalink
sage: Ensure that constraints are always fastfracs
Browse files Browse the repository at this point in the history
Even if they are constants created in the formula functions. We now
lift integer constants to fastfracs.
  • Loading branch information
real-or-random committed Feb 4, 2022
1 parent d8d5485 commit ebb1bee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sage/group_prover.sage
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions sage/weierstrass_prover.sage
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ebb1bee

Please sign in to comment.