Debian Codegraph @

test-suite/output/PrintNotation.v

raw
1 Set Printing All.
2 Module NoDefinedAssoc.
3 Reserved Notation "x $ y" (at level 123).
4 Print Notation "x $ x".
5 Axiom foo : Type.
6 Axiom bar : forall _ : foo, forall _ : foo, foo.
7 Notation "x $ y" := (bar x y) (only parsing).
8 Check (_ $ _ $ _).
9 End NoDefinedAssoc.
10
11 Module NoAssoc.
12 Reserved Notation "x $ y" (at level 123, no associativity).
13 Print Notation "x $ x".
14 Axiom foo : Type.
15 Axiom bar : forall _ : foo, forall _ : foo, foo.
16 Notation "x $ y" := (bar x y) (only parsing).
17 Check (_ $ _ $ _).
18 End NoAssoc.
19
20 Module LeftAssoc.
21 Reserved Notation "x $ y" (at level 123, left associativity).
22 Print Notation "x $ x".
23 Axiom foo : Type.
24 Axiom bar : forall _ : foo, forall _ : foo, foo.
25 Notation "x $ y" := (bar x y) (only parsing).
26 Check (_ $ _ $ _).
27 End LeftAssoc.
28
29 Module RightAssoc.
30 Reserved Notation "x $ y" (at level 123, right associativity).
31 Print Notation "x $ x".
32 Axiom foo : Type.
33 Axiom bar : forall _ : foo, forall _ : foo, foo.
34 Notation "x $ y" := (bar x y) (only parsing).
35 Check (_ $ _ $ _).
36 Fail Print Notation "_ $ x".
37 Fail Print Notation "_ $".
38 Fail Print Notation "$ x".
39 Fail Print Notation "x$y".
40 Fail Print Notation "_$_".
41 Print Notation "y $ x".
42 Print Notation "_ $ _".
43 End RightAssoc.
44
45 (** Stdlib notations *)
46 Module StdlibNotations.
47 Import IfNotations.
48 Print Notation "x -> y".
49 Print Notation "x <-> y".
50 Print Notation "x /\ y".
51 Print Notation "x \/ y".
52 Print Notation "~ x".
53 Print Notation "x = y :> T".
54 Print Notation "x = y".
55 Print Notation "x = y = z".
56 Print Notation "x <> y :> T".
57 Print Notation "x <> y".
58 Print Notation "x <= y".
59 Print Notation "x < y".
60 Print Notation "x >= y".
61 Print Notation "x > y".
62 Print Notation "x <= y <= z".
63 Print Notation "x <= y < z".
64 Print Notation "x < y < z".
65 Print Notation "x < y <= z".
66 Print Notation "x + y".
67 Print Notation "x - y".
68 Print Notation "x * y".
69 Print Notation "x / y".
70 Print Notation "- x".
71 Print Notation "/ x".
72 Print Notation "x ^ y".
73 Print Notation "x || y".
74 Print Notation "x && y".
75 Print Notation "( x , y , .. , z )".
76 Print Notation "{ x }".
77 Print Notation "{ A } + { B }".
78 Print Notation "A + { B }".
79 Print Notation "{ x | P }".
80 Print Notation "{ x | P & Q }".
81 Print Notation "{ x : A | P }".
82 Print Notation "{ x : A | P & Q }".
83 Print Notation "{ x & P }".
84 Print Notation "{ x & P & Q }".
85 Print Notation "{ x : A & P }".
86 Print Notation "{ x : A & P & Q }".
87 Print Notation "{ ' pat | P }".
88 Print Notation "{ ' pat | P & Q }".
89 Print Notation "{ ' pat : A | P }".
90 Print Notation "{ ' pat : A | P & Q }".
91 Print Notation "{ ' pat & P }".
92 Print Notation "{ ' pat & P & Q }".
93 Print Notation "{ ' pat : A & P }".
94 Print Notation "{ ' pat : A & P & Q }".
95 Print Notation "'if' c 'is' p 'then' u 'else' v".
96 End StdlibNotations.
97
98 Module StdlibNotationsUnderscored.
99 Import IfNotations.
100 Print Notation "_ -> _".
101 Print Notation "_ <-> _".
102 Print Notation "_ /\ _".
103 Print Notation "_ \/ _".
104 Print Notation "~ _".
105 Print Notation "_ = _ :> _".
106 Print Notation "_ = _".
107 Print Notation "_ = _ = _".
108 Print Notation "_ <> _ :> _".
109 Print Notation "_ <> _".
110 Print Notation "_ <= _".
111 Print Notation "_ < _".
112 Print Notation "_ >= _".
113 Print Notation "_ > _".
114 Print Notation "_ <= _ <= _".
115 Print Notation "_ <= _ < _".
116 Print Notation "_ < _ < _".
117 Print Notation "_ < _ <= _".
118 Print Notation "_ + _".
119 Print Notation "_ - _".
120 Print Notation "_ * _".
121 Print Notation "_ / _".
122 Print Notation "- _".
123 Print Notation "/ _".
124 Print Notation "_ ^ _".
125 Print Notation "_ || _".
126 Print Notation "_ && _".
127 Print Notation "( _ , _ , .. , _ )".
128 Print Notation "{ _ }".
129 Print Notation "{ _ } + { _ }".
130 Print Notation "_ + { _ }".
131 Print Notation "{ _ | _ }".
132 Print Notation "{ _ | _ & _ }".
133 Print Notation "{ _ : _ | _ }".
134 Print Notation "{ _ : _ | _ & _ }".
135 Print Notation "{ _ & _ }".
136 Print Notation "{ _ & _ & _ }".
137 Print Notation "{ _ : _ & _ }".
138 Print Notation "{ _ : _ & _ & _ }".
139 Print Notation "{ ' _ | _ }".
140 Print Notation "{ ' _ | _ & _ }".
141 Print Notation "{ ' _ : _ | _ }".
142 Print Notation "{ ' _ : _ | _ & _ }".
143 Print Notation "{ ' _ & _ }".
144 Print Notation "{ ' _ & _ & _ }".
145 Print Notation "{ ' _ : _ & _ }".
146 Print Notation "{ ' _ : _ & _ & _ }".
147 Print Notation "if _ is _ then _ else _".
148 End StdlibNotationsUnderscored.
149
150 (* Print Notatation doesn't work with custom notations *)
151 Module Custom.
152 Declare Custom Entry Foo.
153 Reserved Notation "{{ x }}" (in custom Foo at level 0).
154 Print Notation "{{ x }}" in custom Foo.
155 Print Notation "{{ _ }}" in custom Foo.
156 Fail Print Notation "{{ x }}" in custom Bar.
157 Fail Print Notation "{{ _ }}" in custom Bar.
158 Fail Print Notation "[[ x ]]" in custom Foo.
159 Fail Print Notation "[[ _ ]]" in custom Foo.
160 End Custom.
161
162 Module OnlyLetters.
163 Reserved Infix "mod" (at level 40, no associativity).
164 Fail Print Notation "x mod y".
165 Print Notation "x 'mod' y".
166 Print Notation "_ mod _".
167 Print Notation "_ 'mod' _".
168 Axiom foo : Type.
169 Axiom bar : forall _ : foo, forall _ : foo, foo.
170 Infix "mod" := bar (only parsing).
171 Check (_ mod _ mod _).
172 End OnlyLetters.
173
174 Module SingleQuotes.
175 Reserved Infix "'mod'" (at level 40, no associativity).
176 Fail Print Notation "x 'mod' y".
177 Print Notation "x ''mod'' y".
178 Fail Print Notation "_ 'mod' _". (* FIXME I expected this to work *)
179 Print Notation "_ ''mod'' _".
180 Axiom foo : Type.
181 Axiom bar : forall _ : foo, forall _ : foo, foo.
182 Infix "'mod'" := bar (only parsing).
183 Check (_ 'mod' _ 'mod' _).
184 End SingleQuotes.
185
186 Module Recursive.
187 Reserved Notation "'exists' x .. y , p"
188 (at level 200, x binder, right associativity,
189 format "'[' 'exists' '/ ' x .. y , '/ ' p ']'").
190 Fail Print Notation "exists x .. y , p".
191 Print Notation "'exists' x .. y , p".
192 Print Notation "exists _ .. _ , _".
193 Fail Print Notation "exists _ , _".
194 Fail Print Notation "exists _ _ , _".
195 End Recursive.