Debian Codegraph @

src/Util/Notations.v

raw
1 (** * Reserved Notations *)
2 Require Export Crypto.Util.FixCoqMistakes.
3 Require Export Crypto.Util.GlobalSettings.
4
5 (** Putting them all together in one file prevents conflicts. Coq's
6 parser (camlpX) is really bad at conflicting notation levels and
7 is sometimes really bad at backtracking, too. Not having level
8 declarations in other files makes it harder for us to confuse
9 Coq's parser. *)
10
11 Reserved Notation "x -> y" (at level 99, right associativity, y at level 200).
12 Reserved Notation "()" (at level 0).
13 Reserved Infix "∘" (at level 40, left associativity).
14 Reserved Infix "∘ᶠ" (at level 40, left associativity).
15 Reserved Infix "∘f" (at level 40, left associativity).
16 Reserved Infix "'o'" (at level 40, left associativity).
17 Reserved Infix "==" (at level 70, no associativity).
18 Reserved Infix "===" (at level 70, no associativity).
19 Reserved Infix "====" (at level 70, no associativity).
20 Reserved Infix "=====" (at level 70, no associativity).
21 Reserved Infix "======" (at level 70, no associativity).
22 Reserved Infix "~=" (at level 70, no associativity).
23 Reserved Infix "=?" (at level 70, no associativity).
24 Reserved Infix "<?" (at level 70, no associativity).
25 Reserved Infix "<=?" (at level 70, no associativity).
26 Reserved Infix "!=?" (at level 70, no associativity).
27 Reserved Infix "?=" (at level 70, no associativity).
28 Reserved Infix "?<" (at level 70, no associativity).
29 Reserved Infix "=n?" (at level 70, no associativity).
30 Reserved Infix "=Z?" (at level 70, no associativity).
31 Reserved Infix "=ₙ?" (at level 70, no associativity).
32 Reserved Infix "=ℤ?" (at level 70, no associativity).
33 Reserved Infix "=ᶻ?" (at level 70, no associativity).
34 Reserved Infix "=ⁿ?" (at level 70, no associativity).
35 Reserved Notation "f ?" (at level 11, format "f ?", left associativity).
36 Reserved Notation "f [ ? ]" (at level 9, format "f [ ? ]").
37 Reserved Notation "f +" (at level 50, format "f +").
38 Reserved Notation "f *" (at level 40, format "f *").
39 (* to match with ssreflect *)
40 Reserved Notation "x \in A"
41 (at level 70, format "'[hv' x '/ ' \in A ']'", no associativity).
42 Reserved Notation "x \notin A"
43 (at level 70, format "'[hv' x '/ ' \notin A ']'", no associativity).
44 Reserved Notation "x ∈ A"
45 (at level 70, format "'[hv' x '/ ' ∈ A ']'", no associativity).
46 Reserved Notation "x ∉ A"
47 (at level 70, format "'[hv' x '/ ' ∉ A ']'", no associativity).
48 Reserved Notation "x +' y" (at level 50, left associativity).
49 Reserved Notation "x -' y" (at level 50, left associativity).
50 Reserved Notation "x *' y" (at level 40, left associativity).
51 Reserved Notation "x /' y" (at level 40, left associativity).
52 Reserved Notation "-' x" (at level 35, right associativity).
53 Reserved Notation "/' x" (at level 35, right associativity).
54 Reserved Notation "x ^' y" (at level 30, right associativity).
55 Reserved Infix ".+" (at level 50).
56 Reserved Infix ".*" (at level 50).
57 Reserved Notation "' x" (at level 20, no associativity, format "' x").
58 Reserved Notation "x ^ 2" (at level 30, format "x ^ 2").
59 Reserved Notation "x ^ 3" (at level 30, format "x ^ 3").
60 Reserved Notation "2 ^ e" (at level 30, format "2 ^ e", only printing).
61 Reserved Infix "mod" (at level 40, no associativity).
62 Reserved Infix "mod'" (at level 40, no associativity).
63 Reserved Notation "'canonical' 'encoding' 'of' T 'as' B" (at level 50).
64 Reserved Notation "@ 'is_eq_dec' T R" (at level 10, T at level 8, R at level 8).
65 Reserved Infix "@" (left associativity, at level 11).
66 Reserved Infix "@1" (left associativity, at level 11).
67 Reserved Infix "@₁" (left associativity, at level 11).
68 Reserved Infix "@@@" (left associativity, at level 11).
69 Reserved Infix "<<'" (at level 30, no associativity).
70 Reserved Infix ">>'" (at level 30, no associativity).
71 Reserved Infix "<<" (at level 30, no associativity).
72 Reserved Infix ">>" (at level 30, no associativity).
73 Reserved Infix ">>>" (at level 30, no associativity).
74 Reserved Infix "&'" (at level 50). (* N.B. If we used '&', it would conflict with [{ a : T & P}] for [sigT] *)
75 Reserved Infix "&''" (at level 50).
76 Reserved Infix "|'" (at level 50).
77 Reserved Infix "∣" (at level 50).
78 Reserved Infix "∣'" (at level 50).
79 Reserved Infix "~=" (at level 70).
80 Reserved Infix "==" (at level 70, no associativity).
81 Reserved Notation "x == y :> T"
82 (at level 70, y at next level, no associativity).
83 Reserved Infix "=~>" (at level 70, no associativity).
84 Reserved Infix "<~=" (at level 70, no associativity).
85 Reserved Infix "<~=~>" (at level 70, no associativity).
86 Reserved Infix "≡" (at level 70, no associativity).
87 Reserved Infix "≢" (at level 70, no associativity).
88 Reserved Infix "≡_n" (at level 70, no associativity).
89 Reserved Infix "≢_n" (at level 70, no associativity).
90 Reserved Infix "≡_r" (at level 70, no associativity).
91 Reserved Infix "≢_r" (at level 70, no associativity).
92 Reserved Infix "≡ᵣ" (at level 70, no associativity).
93 Reserved Infix "≢ᵣ" (at level 70, no associativity).
94 Reserved Infix "≡_p" (at level 70, no associativity).
95 Reserved Infix "≢_p" (at level 70, no associativity).
96 Reserved Infix "≡ₚ" (at level 70, no associativity).
97 Reserved Infix "≢ₚ" (at level 70, no associativity).
98 Reserved Infix "≡₃₂" (at level 70, no associativity).
99 Reserved Infix "≢₃₂" (at level 70, no associativity).
100 Reserved Infix "≡₆₄" (at level 70, no associativity).
101 Reserved Infix "≢₆₄" (at level 70, no associativity).
102 Reserved Infix "≡₁₂₈" (at level 70, no associativity).
103 Reserved Infix "≢₁₂₈" (at level 70, no associativity).
104 Reserved Infix "≡₂₅₆" (at level 70, no associativity).
105 Reserved Infix "≢₂₅₆" (at level 70, no associativity).
106 Reserved Infix "≡₅₁₂" (at level 70, no associativity).
107 Reserved Infix "≢₅₁₂" (at level 70, no associativity).
108 Reserved Infix "|||" (at level 50, left associativity).
109 Reserved Notation "A ||->{ f } B" (at level 50, left associativity). (* would be nice to make these Reserved Infix, but but it doesn't work; cf COQBUG(https://github.com/coq/coq/issues/11402) *)
110 Reserved Notation "A |||->{ f } B" (at level 50, left associativity). (* would be nice to make these Reserved Infix, but but it doesn't work; cf COQBUG(https://github.com/coq/coq/issues/11402) *)
111 (* Put these at level 71 so they don't conflict with the infix notations at level 70 *)
112 Reserved Notation "<" (at level 71).
113 Reserved Notation ">" (at level 71).
114 Reserved Notation "<=" (at level 71).
115 Reserved Notation ">=" (at level 71).
116 Reserved Notation "≤" (at level 71).
117 Reserved Notation "≥" (at level 71).
118 Reserved Notation "a !== b" (at level 70, no associativity).
119 Reserved Notation "a ≢ b" (at level 70, no associativity).
120 Reserved Notation "& x" (at level 30).
121 Reserved Notation "** x" (at level 30).
122 Reserved Notation "A <- X ; B" (at level 70, X at next level, right associativity, format "'[v' A <- X ; '/' B ']'").
123 Reserved Notation "A <-- X ; B" (at level 70, X at next level, right associativity, format "'[v' A <-- X ; '/' B ']'").
124 Reserved Notation "A <--- X ; B" (at level 70, X at next level, right associativity, format "'[v' A <--- X ; '/' B ']'").
125 Reserved Notation "A <---- X ; B" (at level 70, X at next level, right associativity, format "'[v' A <---- X ; '/' B ']'").
126 Reserved Notation "A <----- X ; B" (at level 70, X at next level, right associativity, format "'[v' A <----- X ; '/' B ']'").
127 (*
128 Reserved Notation "A , A' <- X , X' ; B" (at level 70, A' at next level, X at next level, X' at next level, right associativity, format "'[v' A , A' <- X , X' ; '/' B ']'").
129 Reserved Notation "A , A' <-- X , X' ; B" (at level 70, A' at next level, X at next level, X' at next level, right associativity, format "'[v' A , A' <-- X , X' ; '/' B ']'").
130 Reserved Notation "A , A' <--- X , X' ; B" (at level 70, A' at next level, X at next level, X' at next level, right associativity, format "'[v' A , A' <--- X , X' ; '/' B ']'").
131 Reserved Notation "A , A' <---- X , X' ; B" (at level 70, A' at next level, X at next level, X' at next level, right associativity, format "'[v' A , A' <---- X , X' ; '/' B ']'").
132 Reserved Notation "A , A' <----- X , X' ; B" (at level 70, A' at next level, X at next level, X' at next level, right associativity, format "'[v' A , A' <----- X , X' ; '/' B ']'").
133 *)
134 Reserved Notation "A ;; B" (at level 70, right associativity, format "'[v' A ;; '/' B ']'").
135 Reserved Notation "A ';;L' B" (at level 70, right associativity, format "'[v' A ';;L' '/' B ']'").
136 Reserved Notation "A ';;R' B" (at level 70, right associativity, format "'[v' A ';;R' '/' B ']'").
137 Reserved Notation "A ;;->{ f } B" (at level 70, right associativity, format "'[v' A ;;->{ f } '/' B ']'").
138 Reserved Notation "A ;;; B" (at level 70, right associativity, format "'[v' A ;;; '/' B ']'").
139 Reserved Notation "u [ i ]" (at level 30).
140 Reserved Notation "v [[ i ]]" (at level 30).
141 Reserved Notation "u {{ i }}" (at level 30).
142 Reserved Notation "a # b" (at level 55, no associativity). (* match with theories/QArith/QArith_base.v *)
143 Reserved Notation "'olet' x .. y <- X ; Y"
144 (at level 70, X at next level, x binder, y binder, right associativity, format "'[v' 'olet' x .. y <- X ; '/' Y ']'").
145 Reserved Notation "'slet' x .. y <- X ; Y"
146 (at level 70, X at next level, x binder, y binder, right associativity, format "'[v' 'slet' x .. y <- X ; '/' Y ']'").
147 Reserved Notation "'plet' x := y 'in' z"
148 (at level 200, z at level 200, format "'plet' x := y 'in' '//' z").
149 Reserved Notation "'subst_let' x := y 'in' z"
150 (at level 200, z at level 200, format "'subst_let' x := y 'in' '//' z").
151 Reserved Notation "'nlet' x := A 'in' b"
152 (at level 200, b at level 200, x at level 99, format "'nlet' x := A 'in' '//' b").
153 Reserved Notation "'nlet' x : tx := A 'in' b"
154 (at level 200, b at level 200, x at level 99, format "'nlet' x : tx := A 'in' '//' b").
155 Reserved Notation "'slet' x .. y := A 'in' b"
156 (at level 200, x binder, y binder, b at level 200, format "'slet' x .. y := A 'in' '//' b").
157 Reserved Notation "'llet' x := A 'in' b"
158 (at level 200, b at level 200, format "'llet' x := A 'in' '//' b").
159 Reserved Notation "'expr_let' x := A 'in' b"
160 (at level 200, b at level 200, format "'expr_let' x := A 'in' '//' b").
161 Reserved Notation "'mlet' x := A 'in' b"
162 (at level 200, b at level 200, format "'mlet' x := A 'in' '//' b").
163 (* Note that making [Let] a keyword breaks the vernacular [Let] in Coq 8.4 *)
164 Reserved Notation "'dlet_nd' x .. y := v 'in' f"
165 (at level 200, x binder, y binder, f at level 200, format "'dlet_nd' x .. y := v 'in' '//' f").
166 Reserved Notation "'dlet' x .. y := v 'in' f"
167 (at level 200, x binder, y binder, f at level 200, format "'dlet' x .. y := v 'in' '//' f").
168 Reserved Notation "'pflet' x , pf := y 'in' f"
169 (at level 200, f at level 200, format "'pflet' x , pf := y 'in' '//' f").
170
171 Notation "'subst_let' x := y 'in' z" := (match y return _ with x => z end) (only parsing).
172
173 Reserved Notation "'λ' x .. y , t" (at level 200, x binder, y binder, right associativity, format "'λ' x .. y , '//' t").
174 Reserved Notation "'λn' x .. y , t" (at level 200, right associativity).
175 Reserved Notation "x ::> ( max_bitwidth = v )"
176 (at level 70, no associativity, format "x ::> ( max_bitwidth = v )").
177 Reserved Notation "r[ l ~> u ]" (l at level 69, format "r[ l ~> u ]").
178 Reserved Notation "b[ l ~> u ]" (l at level 69, format "b[ l ~> u ]").
179 Reserved Notation "m[ l ~> u ]" (l at level 69, format "m[ l ~> u ]").
180 Reserved Notation "kv[ l ~> u ]" (l at level 69, format "kv[ l ~> u ]").
181 Reserved Notation "t[ l ~> u ]" (l at level 69, format "t[ l ~> u ]").
182 Reserved Notation "l[ l' ~> u ]" (l' at level 69, format "l[ l' ~> u ]").
183 Reserved Notation "'for' i (:= i0 ; += step ; < finish ) 'updating' ( state := initial ) {{ body }}"
184 (at level 70, format "'[v ' 'for' i (:= i0 ; += step ; < finish ) 'updating' ( state := initial ) {{ '//' body ']' '//' }}").
185 Reserved Notation "'for' ( 'int' i = i0 ; step_expr ; finish_expr ) 'updating' ( state1 .. staten = initial ) {{ body }}"
186 (at level 70, i at level 10, state1 binder, staten binder, format "'[v ' 'for' ( 'int' i = i0 ; step_expr ; finish_expr ) 'updating' ( state1 .. staten = initial ) {{ '//' body ']' '//' }}").
187 Reserved Notation "x += y" (at level 70, no associativity).
188 Reserved Notation "x -= y" (at level 70, no associativity).
189 Reserved Notation "x ++" (at level 60, format "x ++").
190 Reserved Notation "x --" (at level 60, format "x --").
191 Reserved Notation "++ x" (at level 60, format "++ x").
192 Reserved Notation "-- x" (at level 60, format "-- x").
193 Reserved Notation "~> R" (at level 70).
194 Reserved Notation "A ~> R" (at level 99).
195 Reserved Notation "A --->" (left associativity, at level 65).
196 Reserved Notation "'return' x" (at level 70, format "'return' x").
197 Reserved Notation "f x" (only printing, at level 10, left associativity).
198 (* N.B. $ x conflicts with Ltac2's antiquotations, cf https://coq.inria.fr/refman/proof-engine/ltac2.html#dynamic-semantics *)
199 Reserved Notation "$$ x" (at level 9, x at level 9, format "$$ x").
200 Reserved Notation "# x" (at level 9, x at level 9, format "# x").
201 Reserved Notation "## x" (at level 9, x at level 9, format "## x").
202 Reserved Notation "### x" (at level 9, x at level 9, format "### x").
203 Reserved Notation "#### x" (at level 9, x at level 9, format "#### x").
204 Reserved Notation "##### x" (at level 9, x at level 9, format "##### x").
205 Reserved Notation "\ x .. y , t" (at level 200, x binder, y binder, right associativity, format "\ x .. y , '//' t").
206 (** If we use "( x |? y )", it conflicts with things like [destruct x as [?|?]; ...] *)
207 Reserved Notation "( x | ? y )" (format "( x | ? y )").
208
209 Notation "'typeof!' x" := (match x with y => ltac:(let T := type of y in exact T) end) (at level 10, only parsing).
210
211 Notation "'compute!' x" := (match x with y => ltac:(let z := (eval compute in y) in exact z) end) (at level 10, only parsing).
212 Notation "'cbv!' x" := (match x with y => ltac:(let z := (eval cbv in y) in exact z) end) (at level 10, only parsing).
213 Notation "'lazy!' x" := (match x with y => ltac:(let z := (eval lazy in y) in exact z) end) (at level 10, only parsing).
214 Notation "'cbn!' x" := (match x with y => ltac:(let z := (eval cbn in y) in exact z) end) (at level 10, only parsing).
215 Notation "'simpl!' x" := (match x with y => ltac:(let z := (eval simpl in y) in exact z) end) (at level 10, only parsing).
216 Notation "'native_compute!' x" := (match x with y => ltac:(let z := (eval native_compute in y) in exact z) end) (at level 10, only parsing).
217 Notation "'vm_compute!' x" := (match x with y => ltac:(let z := (eval vm_compute in y) in exact z) end) (at level 10, only parsing).