From 4666ede72bbb35cd889cd62888339791ee7ab3a3 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Fri, 24 Jun 2016 12:30:21 -0700 Subject: Use Decidable machinery for is_eq_dec This allows us to rely entirely on typeclass resolution to resolve these instances, without having to do ad-hoc things for [and]. After | File Name | Before || Change ------------------------------------------------------------------------------------ 2m21.71s | Total | 2m22.59s || -0m00.87s ------------------------------------------------------------------------------------ 0m28.82s | Specific/GF25519 | 0m29.86s || -0m01.03s 0m29.60s | ModularArithmetic/ModularBaseSystemProofs | 0m29.40s || +0m00.20s 0m21.25s | Experiments/SpecEd25519 | 0m21.28s || -0m00.03s 0m18.15s | CompleteEdwardsCurve/ExtendedCoordinates | 0m18.14s || +0m00.00s 0m11.95s | CompleteEdwardsCurve/CompleteEdwardsCurveTheorems | 0m11.94s || +0m00.00s 0m07.26s | Specific/GF1305 | 0m07.28s || -0m00.02s 0m03.77s | ModularArithmetic/Tutorial | 0m03.75s || +0m00.02s 0m03.76s | ModularArithmetic/ModularBaseSystemOpt | 0m03.75s || +0m00.00s 0m03.61s | CompleteEdwardsCurve/Pre | 0m03.63s || -0m00.02s 0m02.15s | ModularArithmetic/ModularArithmeticTheorems | 0m02.12s || +0m00.02s 0m01.88s | ModularArithmetic/PrimeFieldTheorems | 0m01.89s || -0m00.01s 0m01.75s | Algebra | 0m01.73s || +0m00.02s 0m01.21s | Experiments/DerivationsOptionRectLetInEncoding | 0m01.17s || +0m00.04s 0m01.14s | ModularArithmetic/ExtendedBaseVector | 0m01.14s || +0m00.00s 0m01.01s | ModularArithmetic/PseudoMersenneBaseParamProofs | 0m00.98s || +0m00.03s 0m00.62s | Encoding/ModularWordEncodingTheorems | 0m00.63s || -0m00.01s 0m00.60s | Encoding/ModularWordEncodingPre | 0m00.61s || -0m00.01s 0m00.59s | Util/Decidable | 0m00.64s || -0m00.05s 0m00.58s | Spec/EdDSA | 0m00.61s || -0m00.03s 0m00.57s | ModularArithmetic/ModularBaseSystem | 0m00.61s || -0m00.04s 0m00.56s | Spec/ModularWordEncoding | 0m00.56s || +0m00.00s 0m00.51s | ModularArithmetic/PseudoMersenneBaseRep | 0m00.53s || -0m00.02s 0m00.37s | Spec/CompleteEdwardsCurve | 0m00.34s || +0m00.02s --- src/Algebra.v | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Algebra.v') diff --git a/src/Algebra.v b/src/Algebra.v index 15e0bcd38..e45ab8c33 100644 --- a/src/Algebra.v +++ b/src/Algebra.v @@ -1,12 +1,18 @@ Require Import Coq.Classes.Morphisms. Require Coq.Setoids.Setoid. Require Import Crypto.Util.Tactics Crypto.Tactics.Nsatz. +Require Import Crypto.Util.Decidable. Local Close Scope nat_scope. Local Close Scope type_scope. Local Close Scope core_scope. +Notation is_eq_dec := (DecidableRel _) (only parsing). +Notation "@ 'is_eq_dec' T R" := (DecidableRel (R:T->T->Prop)) + (at level 10, T at level 8, R at level 8, only parsing). +Notation eq_dec x y := (@dec (_ x y) _) (only parsing). + Section Algebra. Context {T:Type} {eq:T->T->Prop}. Local Infix "=" := eq : type_scope. Local Notation "a <> b" := (not (a = b)) : type_scope. - Class is_eq_dec := { eq_dec : forall x y : T, {x=y} + {x<>y} }. + Local Notation is_eq_dec := (@is_eq_dec T eq). Section SingleOperation. Context {op:T->T->T}. -- cgit v1.2.3