aboutsummaryrefslogtreecommitdiff
path: root/src/WeierstrassCurve
diff options
context:
space:
mode:
authorGravatar Andres Erbsen <andreser@mit.edu>2016-07-28 18:40:28 -0400
committerGravatar Andres Erbsen <andreser@mit.edu>2016-08-04 11:47:51 -0400
commit4964f1ff2d40ba08573deddca56140c4ac4b19eb (patch)
tree61b24623e414dfa3e09a32cf62e8acd1909dae37 /src/WeierstrassCurve
parentfbb0f64892560322ed9dcd0f664e730e74de9b4e (diff)
Refactor ModularArithmetic into Zmod, expand Decidable
ModularArithmetic now uses Algebra lemmas in various places instead of custom manual proofs. Similarly, Util.Decidable is used to state and prove the relevant decidability results. Backwards-incompatible changes: F_some_lemma -> Zmod.some_lemma Arguments ZToField _%Z _%Z : clear implicits. inv_spec says inv x * x = 1, not x * inv x = 1
Diffstat (limited to 'src/WeierstrassCurve')
-rw-r--r--src/WeierstrassCurve/Pre.v5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/WeierstrassCurve/Pre.v b/src/WeierstrassCurve/Pre.v
index c51c82e89..aeffc3a2b 100644
--- a/src/WeierstrassCurve/Pre.v
+++ b/src/WeierstrassCurve/Pre.v
@@ -2,6 +2,7 @@ Require Import Coq.Classes.Morphisms. Require Coq.Setoids.Setoid.
Require Import Crypto.Algebra.
Require Import Crypto.Util.Tactics.
Require Import Crypto.Util.Notations.
+Require Import Crypto.Util.Decidable.
Local Open Scope core_scope.
@@ -34,8 +35,8 @@ Section Pre.
Definition unifiedAdd' (P1' P2':F*F + ∞) : F*F + ∞ :=
match P1', P2' with
| (x1, y1), (x2, y2)
- => if x1 =? x2 then
- if y2 =? -y1 then
+ => if dec (x1 = x2) then
+ if dec (y2 = -y1) then
else ((3*x1^2+a)^2 / (2*y1)^2 - x1 - x1,
(2*x1+x1)*(3*x1^2+a) / (2*y1) - (3*x1^2+a)^3/(2*y1)^3-y1)