| 1 |
(************************************************************************) |
| 2 |
(* * The Rocq Prover / The Rocq Development Team *) |
| 3 |
(* v * Copyright INRIA, CNRS and contributors *) |
| 4 |
(* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 |
(* \VV/ **************************************************************) |
| 6 |
(* // * This file is distributed under the terms of the *) |
| 7 |
(* * GNU Lesser General Public License Version 2.1 *) |
| 8 |
(* * (see LICENSE file for the text of the license) *) |
| 9 |
(************************************************************************) |
| 10 |
|
| 11 |
(** These are the notations whose level and associativity are imposed by Rocq *) |
| 12 |
|
| 13 |
(** Notations for propositional connectives *) |
| 14 |
|
| 15 |
Reserved Notation "x -> y" (at level 99, right associativity, y at level 200). |
| 16 |
Reserved Notation "x <-> y" (at level 95, no associativity). |
| 17 |
Reserved Notation "x /\ y" (at level 80, right associativity). |
| 18 |
Reserved Notation "x \/ y" (at level 85, right associativity). |
| 19 |
Reserved Notation "~ x" (at level 75, right associativity). |
| 20 |
|
| 21 |
(** Notations for equality and inequalities *) |
| 22 |
|
| 23 |
Reserved Notation "x = y :> T" |
| 24 |
(at level 70, y at next level, no associativity). |
| 25 |
Reserved Notation "x = y" (at level 70, no associativity). |
| 26 |
Reserved Notation "x = y = z" |
| 27 |
(at level 70, no associativity, y at next level). |
| 28 |
|
| 29 |
Reserved Notation "x <> y :> T" |
| 30 |
(at level 70, y at next level, no associativity). |
| 31 |
Reserved Notation "x <> y" (at level 70, no associativity). |
| 32 |
|
| 33 |
Reserved Notation "x <= y" (at level 70, no associativity). |
| 34 |
Reserved Notation "x < y" (at level 70, no associativity). |
| 35 |
Reserved Notation "x >= y" (at level 70, no associativity). |
| 36 |
Reserved Notation "x > y" (at level 70, no associativity). |
| 37 |
|
| 38 |
Reserved Notation "x <= y <= z" (at level 70, y at next level). |
| 39 |
Reserved Notation "x <= y < z" (at level 70, y at next level). |
| 40 |
Reserved Notation "x < y < z" (at level 70, y at next level). |
| 41 |
Reserved Notation "x < y <= z" (at level 70, y at next level). |
| 42 |
|
| 43 |
(** Arithmetical notations (also used for type constructors) *) |
| 44 |
|
| 45 |
Reserved Notation "x + y" (at level 50, left associativity). |
| 46 |
Reserved Notation "x - y" (at level 50, left associativity). |
| 47 |
Reserved Notation "x * y" (at level 40, left associativity). |
| 48 |
Reserved Notation "x / y" (at level 40, left associativity). |
| 49 |
Reserved Notation "- x" (at level 35, right associativity). |
| 50 |
Reserved Notation "/ x" (at level 35, right associativity). |
| 51 |
Reserved Notation "x ^ y" (at level 30, right associativity). |
| 52 |
|
| 53 |
(** Notations for booleans *) |
| 54 |
|
| 55 |
Reserved Notation "x || y" (at level 50, left associativity). |
| 56 |
Reserved Notation "x && y" (at level 40, left associativity). |
| 57 |
|
| 58 |
(** Notations for pairs *) |
| 59 |
|
| 60 |
Reserved Notation "( x , y , .. , z )" |
| 61 |
(at level 0, format "( '[' x , '/' y , '/' .. , '/' z ']' )"). |
| 62 |
|
| 63 |
(** Notation "{ x }" is reserved and has a special status as component |
| 64 |
of other notations such as "{ A } + { B }" and "A + { B }" (which |
| 65 |
are at the same level as "x + y"); |
| 66 |
"{ x }" is at level 0 to factor with "{ x : A | P }" *) |
| 67 |
|
| 68 |
Reserved Notation "{ x }" (at level 0, x at level 99). |
| 69 |
|
| 70 |
(** Notations for sigma-types or subsets *) |
| 71 |
|
| 72 |
#[warning="-closed-notation-not-level-0"] |
| 73 |
Reserved Notation "{ A } + { B }" (at level 50, left associativity). |
| 74 |
#[warning="-postfix-notation-not-level-1"] |
| 75 |
Reserved Notation "A + { B }" (at level 50, left associativity). |
| 76 |
|
| 77 |
Reserved Notation "{ x | P }" (at level 0, x at level 99). |
| 78 |
Reserved Notation "{ x | P & Q }" (at level 0, x at level 99). |
| 79 |
|
| 80 |
Reserved Notation "{ x : A | P }" (at level 0, x at level 99). |
| 81 |
Reserved Notation "{ x : A | P & Q }" (at level 0, x at level 99). |
| 82 |
|
| 83 |
Reserved Notation "{ x & P }" (at level 0, x at level 99). |
| 84 |
Reserved Notation "{ x & P & Q }" (at level 0, x at level 99). |
| 85 |
|
| 86 |
Reserved Notation "{ x : A & P }" (at level 0, x at level 99). |
| 87 |
Reserved Notation "{ x : A & P & Q }" (at level 0, x at level 99). |
| 88 |
|
| 89 |
Reserved Notation "{ ' pat | P }" |
| 90 |
(at level 0, pat strict pattern, format "{ ' pat | P }"). |
| 91 |
Reserved Notation "{ ' pat | P & Q }" |
| 92 |
(at level 0, pat strict pattern, format "{ ' pat | P & Q }"). |
| 93 |
|
| 94 |
Reserved Notation "{ ' pat : A | P }" |
| 95 |
(at level 0, pat strict pattern, format "{ ' pat : A | P }"). |
| 96 |
Reserved Notation "{ ' pat : A | P & Q }" |
| 97 |
(at level 0, pat strict pattern, format "{ ' pat : A | P & Q }"). |
| 98 |
|
| 99 |
Reserved Notation "{ ' pat & P }" |
| 100 |
(at level 0, pat strict pattern, format "{ ' pat & P }"). |
| 101 |
Reserved Notation "{ ' pat & P & Q }" |
| 102 |
(at level 0, pat strict pattern, format "{ ' pat & P & Q }"). |
| 103 |
|
| 104 |
Reserved Notation "{ ' pat : A & P }" |
| 105 |
(at level 0, pat strict pattern, format "{ ' pat : A & P }"). |
| 106 |
Reserved Notation "{ ' pat : A & P & Q }" |
| 107 |
(at level 0, pat strict pattern, format "{ ' pat : A & P & Q }"). |
| 108 |
|
| 109 |
(** Support for Gonthier-Ssreflect's "if c is pat then u else v" *) |
| 110 |
|
| 111 |
Module IfNotations. |
| 112 |
|
| 113 |
Notation "'if' c 'is' p 'then' u 'else' v" := |
| 114 |
(match c with p => u | _ => v end) |
| 115 |
(at level 200, p pattern at level 100). |
| 116 |
|
| 117 |
End IfNotations. |
| 118 |
|
| 119 |
(** Notations for first and second projections *) |
| 120 |
|
| 121 |
Reserved Notation "p .1" (at level 1, left associativity, format "p .1"). |
| 122 |
Reserved Notation "p .2" (at level 1, left associativity, format "p .2"). |
| 123 |
|
| 124 |
(** Scopes *) |
| 125 |
|
| 126 |
Declare Scope core_scope. |
| 127 |
Delimit Scope core_scope with core. |
| 128 |
|
| 129 |
Declare Scope function_scope. |
| 130 |
Delimit Scope function_scope with function. |
| 131 |
Bind Scope function_scope with Funclass. |
| 132 |
|
| 133 |
Declare Scope type_scope. |
| 134 |
Delimit Scope type_scope with type. |
| 135 |
Bind Scope type_scope with Sortclass. |
| 136 |
|
| 137 |
Open Scope core_scope. |
| 138 |
Open Scope function_scope. |
| 139 |
Open Scope type_scope. |
| 140 |
|
| 141 |
|
| 142 |
Notation "A -> B" := (forall (_ : A), B) : type_scope. |
| 143 |
|
| 144 |
Create HintDb typeclass_instances discriminated. |