aboutsummaryrefslogtreecommitdiff
path: root/src/Assembly/Pseudo.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jagro@google.com>2016-07-27 17:18:30 -0700
committerGravatar Jason Gross <jagro@google.com>2016-07-27 17:25:08 -0700
commit6dc1781b13e14c64a6e209a0981c03203fdd9e70 (patch)
tree1f8d21aae565caa22251d185ecf47ed7366cae3b /src/Assembly/Pseudo.v
parentd763f699ae49e60cfadd0e334f4f20e65aa494b4 (diff)
Move most notation level declarations into Util
This reveals and prevents notation clashes. Notable breakage: - `x {{ y }}` breaks `Context {forall x, {P x} + {~P x}}.` (@jadephilipoom) - `x [[ y ]]` breaks `destruct x as [[a]|[b]].` (@jadephilipoom) - `O :( A , B ): :?: L ::: R` breaks `((1):nat)` and `constr:(nat)` (@varomodt) After | File Name | Before || Change ------------------------------------------------------------------------------------ 3m16.07s | Total | 3m23.63s || -0m07.55s ------------------------------------------------------------------------------------ 0m16.90s | ModularArithmetic/ModularBaseSystemProofs | 0m19.02s || -0m02.12s 0m03.29s | ModularArithmetic/ModularBaseSystemOpt | 0m05.30s || -0m02.00s 0m12.04s | Experiments/SpecEd25519 | 0m13.89s || -0m01.85s 0m36.02s | CompleteEdwardsCurve/ExtendedCoordinates | 0m36.12s || -0m00.09s 0m34.48s | Specific/GF25519 | 0m34.27s || +0m00.20s 0m15.62s | CompleteEdwardsCurve/CompleteEdwardsCurveTheorems | 0m15.76s || -0m00.14s 0m07.36s | Specific/GF1305 | 0m07.34s || +0m00.02s 0m06.64s | Algebra | 0m06.14s || +0m00.50s 0m05.12s | WeierstrassCurve/Pre | 0m05.09s || +0m00.03s 0m04.58s | ModularArithmetic/Tutorial | 0m03.83s || +0m00.75s 0m04.46s | BaseSystemProofs | 0m04.33s || +0m00.12s 0m04.26s | ModularArithmetic/Pow2BaseProofs | 0m05.16s || -0m00.90s 0m03.91s | CompleteEdwardsCurve/Pre | 0m04.62s || -0m00.71s 0m02.75s | Assembly/State | 0m03.12s || -0m00.37s 0m02.55s | Experiments/EdDSARefinement | 0m01.85s || +0m00.69s 0m02.46s | Util/ZUtil | 0m02.45s || +0m00.00s 0m01.86s | Assembly/Wordize | 0m02.02s || -0m00.15s 0m01.68s | ModularArithmetic/ModularArithmeticTheorems | 0m01.68s || +0m00.00s 0m01.67s | ModularArithmetic/PrimeFieldTheorems | 0m01.96s || -0m00.29s 0m01.50s | Encoding/PointEncodingPre | 0m02.20s || -0m00.70s 0m01.46s | ModularArithmetic/BarrettReduction/Z | 0m01.02s || +0m00.43s 0m01.26s | BaseSystem | 0m01.21s || +0m00.05s 0m01.24s | Assembly/Pseudize | 0m01.22s || +0m00.02s 0m01.20s | ModularArithmetic/ExtendedBaseVector | 0m01.86s || -0m00.66s 0m01.04s | Util/IterAssocOp | 0m00.74s || +0m00.30s 0m00.96s | ModularArithmetic/ExtPow2BaseMulProofs | 0m00.67s || +0m00.28s 0m00.96s | Assembly/Pipeline | 0m00.65s || +0m00.30s 0m00.93s | Experiments/DerivationsOptionRectLetInEncoding | 0m00.98s || -0m00.04s 0m00.93s | ModularArithmetic/ModularBaseSystemField | 0m00.95s || -0m00.01s 0m00.92s | Util/NumTheoryUtil | 0m01.19s || -0m00.26s 0m00.90s | ModularArithmetic/ModularBaseSystemListProofs | 0m00.89s || +0m00.01s 0m00.82s | ModularArithmetic/PseudoMersenneBaseParamProofs | 0m00.95s || -0m00.13s 0m00.81s | Assembly/QhasmEvalCommon | 0m00.86s || -0m00.04s 0m00.80s | Assembly/StringConversion | 0m00.60s || +0m00.20s 0m00.79s | Assembly/Qhasm | 0m00.54s || +0m00.25s 0m00.73s | Assembly/Pseudo | 0m00.98s || -0m00.25s 0m00.72s | Util/AdditionChainExponentiation | 0m00.92s || -0m00.20s 0m00.69s | Experiments/SpecificCurve25519 | 0m00.72s || -0m00.03s 0m00.65s | Spec/ModularWordEncoding | 0m00.85s || -0m00.19s 0m00.65s | ModularArithmetic/ModularBaseSystemList | 0m00.68s || -0m00.03s 0m00.65s | Assembly/PseudoConversion | 0m00.67s || -0m00.02s 0m00.64s | Encoding/ModularWordEncodingPre | 0m00.62s || +0m00.02s 0m00.64s | Spec/EdDSA | 0m00.93s || -0m00.29s 0m00.64s | Testbit | 0m00.94s || -0m00.29s 0m00.63s | Encoding/ModularWordEncodingTheorems | 0m00.66s || -0m00.03s 0m00.62s | Assembly/AlmostQhasm | 0m00.49s || +0m00.13s 0m00.59s | ModularArithmetic/ModularBaseSystem | 0m00.61s || -0m00.02s 0m00.49s | Spec/WeierstrassCurve | 0m00.43s || +0m00.06s 0m00.49s | Assembly/QhasmUtil | 0m00.51s || -0m00.02s 0m00.49s | ModularArithmetic/Pre | 0m00.47s || +0m00.02s 0m00.47s | Assembly/Vectorize | 0m00.51s || -0m00.04s 0m00.46s | Assembly/AlmostConversion | 0m00.44s || +0m00.02s 0m00.42s | ModularArithmetic/Pow2Base | 0m00.42s || +0m00.00s 0m00.41s | ModularArithmetic/PseudoMersenneBaseParams | 0m00.45s || -0m00.04s 0m00.41s | Spec/ModularArithmetic | 0m00.41s || +0m00.00s 0m00.39s | Spec/CompleteEdwardsCurve | 0m00.41s || -0m00.01s 0m00.03s | Util/Notations | 0m00.03s || +0m00.00s
Diffstat (limited to 'src/Assembly/Pseudo.v')
-rw-r--r--src/Assembly/Pseudo.v48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/Assembly/Pseudo.v b/src/Assembly/Pseudo.v
index b8aae4521..ca4700a7f 100644
--- a/src/Assembly/Pseudo.v
+++ b/src/Assembly/Pseudo.v
@@ -1,6 +1,7 @@
Require Import Crypto.Assembly.QhasmCommon Crypto.Assembly.QhasmUtil Crypto.Assembly.State.
Require Import Crypto.Assembly.Language Crypto.Assembly.QhasmEvalCommon.
Require Import Coq.Lists.List Coq.Arith.Compare_dec Coq.omega.Omega.
+Require Import Crypto.Util.Notations.
Require Export Crypto.Util.FixCoqMistakes.
Module Pseudo <: Language.
@@ -31,8 +32,8 @@ Module Pseudo <: Language.
}.
Definition Params := Params'.
- Definition State (p: Params): Type := ListState (width p).
- Definition Program (p: Params): Type :=
+ Definition State (p: Params) : Type := ListState (width p).
+ Definition Program (p: Params) : Type :=
@Pseudo (width p) (spec p) (inputs p) (outputs p).
Definition Unary32: Params := mkParams 32 W32 1 1.
@@ -40,7 +41,7 @@ Module Pseudo <: Language.
(* Evaluation *)
- Fixpoint pseudoEval {n m w s} (prog: @Pseudo w s n m) (st: ListState w): option (ListState w) :=
+ Fixpoint pseudoEval {n m w s} (prog: @Pseudo w s n m) (st: ListState w) : option (ListState w) :=
match prog with
| PVar n _ i => omap (getVar i st) (fun x => Some (setList [x] st))
| PMem n m v i => omap (getMem v i st) (fun x => Some (setList [x] st))
@@ -114,7 +115,7 @@ Module Pseudo <: Language.
Delimit Scope pseudo_notations with p.
Local Open Scope pseudo_notations.
- Definition indexize {n: nat} (x: nat): Index n.
+ Definition indexize {n: nat} (x: nat) : Index n.
intros; destruct (le_dec n 0).
- exists 0; abstract intuition auto with zarith.
@@ -123,60 +124,65 @@ Module Pseudo <: Language.
Defined.
Notation "% A" := (PVar _ (Some false) (indexize A))
- (at level 20, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "$ A" := (PVar _ (Some true) (indexize A))
- (at level 20, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :[ B ]:" := (PMem _ _ (indexize A) (indexize B))
- (at level 20, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "# A" := (PConst _ (natToWord _ A))
- (at level 20, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :+: B" := (PBin _ IAdd (PComb _ _ _ A B))
- (at level 60, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :+c: B" := (PCarry _ AddWithCarry (PComb _ _ _ A B))
- (at level 60, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :-: B" := (PBin _ ISub (PComb _ _ _ A B))
- (at level 60, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :&: B" := (PBin _ IAnd (PComb _ _ _ A B))
- (at level 45, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :^: B" := (PBin _ IXor (PComb _ _ _ A B))
- (at level 45, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :>>: B" := (PShift _ Shr (indexize B) A)
- (at level 60, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :<<: B" := (PShift _ Shl (indexize B) A)
- (at level 60, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :*: B" := (PDual _ Mult (PComb _ _ _ A B))
- (at level 55, right associativity) : pseudo_notations.
+ : pseudo_notations.
+ (* TODO(rsloan, from jgross): This notation is not okay. It breaks
+ [constr:(nat)] and [((1):nat)]. Please remove all frowny faces
+ from notations, and then move [Reserved Notation] line to
+ Fiat.Crypto.Util.Notations. *)
+ Reserved Notation "O :( A , B ): :?: L ::: R" (at level 70, right associativity).
Notation "O :( A , B ): :?: L ::: R" :=
(PIf _ _ O (indexize A) (indexize B) L R)
- (at level 70, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "F :**: e" :=
(PFunExp _ F e)
- (at level 70, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "E :->: F" :=
(PLet _ _ _ E F)
- (at level 70, right associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "A :|: B" :=
(PComb _ _ _ A B)
- (at level 65, left associativity) : pseudo_notations.
+ : pseudo_notations.
Notation "n ::: A :():" :=
(PCall _ _ n A)
- (at level 65, left associativity) : pseudo_notations.
+ : pseudo_notations.
Close Scope pseudo_notations.
End Pseudo.