diff options
author | Jason Gross <jgross@mit.edu> | 2016-09-17 18:43:54 -0400 |
---|---|---|
committer | Jason Gross <jgross@mit.edu> | 2016-09-17 18:54:45 -0400 |
commit | 05f30d597443a6709d8df916e962f977a553c8ca (patch) | |
tree | 19b2b2aacb9dc3cb3ddd6c1b147a730890966025 /src/Util | |
parent | 1bacc083da890d7289f1ee54a41996db7a787a92 (diff) |
Add reserved notation for Let, change #
We reserve [a # b] in Notations.v, and make it's level compatible with
the notation declared in the std lib for Q.
Diffstat (limited to 'src/Util')
-rw-r--r-- | src/Util/LetIn.v | 9 | ||||
-rw-r--r-- | src/Util/Notations.v | 9 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/Util/LetIn.v b/src/Util/LetIn.v index 479d3a454..a15204c96 100644 --- a/src/Util/LetIn.v +++ b/src/Util/LetIn.v @@ -1,10 +1,9 @@ Require Import Coq.Classes.Morphisms Coq.Relations.Relation_Definitions. Require Import Crypto.Util.Tactics. +Require Import Crypto.Util.Notations. Definition Let_In {A P} (x : A) (f : forall a : A, P a) : P x := let y := x in f y. -Notation "'Let' x := y 'in' f" := (Let_In y (fun x => f)) - (format "'[' 'Let' x := y 'in' ']' '/' '[' f ']'", - at level 200, f at level 200). +Notation "'Let' x := y 'in' f" := (Let_In y (fun x => f)). Global Instance Proper_Let_In_nd_changebody {A P R} {Reflexive_R:@Reflexive P R} : Proper (eq ==> pointwise_relation _ R ==> R) (@Let_In A (fun _ => P)). @@ -22,7 +21,7 @@ Proof. intros. cbv [Let_In]. reflexivity. Qed. Class _call_let_in_to_Let_In {T} (e:T) := _let_in_to_Let_In_return : T. (* : forall T, gallina T -> gallina T, structurally recursive in the argument *) -Ltac let_in_to_Let_In e := +Ltac let_in_to_Let_In e := lazymatch e with | let x := ?ex in @?eC x => let ex := let_in_to_Let_In ex in @@ -44,4 +43,4 @@ Hint Extern 0 (_call_let_in_to_Let_In ?e) => ( Ltac change_let_in_with_Let_In := let g := get_goal in let g' := let_in_to_Let_In g in - change g'.
\ No newline at end of file + change g'. diff --git a/src/Util/Notations.v b/src/Util/Notations.v index 166130824..e0215061f 100644 --- a/src/Util/Notations.v +++ b/src/Util/Notations.v @@ -55,12 +55,17 @@ Reserved Notation "$$ v" (at level 40). Reserved Notation "& x" (at level 30). Reserved Notation "** x" (at level 30). Reserved Notation "A <- X ; B" (at level 70, right associativity). -Reserved Notation "'plet' x := y 'in' z" (at level 60). Reserved Notation "u [ i ]" (at level 30). Reserved Notation "v [[ i ]]" (at level 30). Reserved Notation "u {{ i }}" (at level 30). +Reserved Notation "a # b" (at level 55, no associativity). (* match with theories/QArith/QArith_base.v *) +Reserved Notation "'plet' x := y 'in' z" + (at level 200, z at level 200, format "'plet' x := y 'in' '//' z"). Reserved Notation "'slet' x := A 'in' b" (at level 200, b at level 200, format "'slet' x := A 'in' '//' b"). +(* TODO(@andres-erbsen): Add a comment about why the syntax below is + different from [slet] and [plet], or make it match. *) +Reserved Notation "'Let' x := y 'in' f" + (at level 200, f at level 200, format "'[' 'Let' x := y 'in' ']' '/' '[' f ']'"). Reserved Notation "'λ' x .. y , t" (at level 200, x binder, y binder, right associativity). Reserved Notation "'λn' x .. y , t" (at level 200, right associativity). -(* FIXME: breaks Reflection.Syntax: Reserved Notation "'Let' x := y 'in' f" (at level 200, f at level 200). *)
\ No newline at end of file |