forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeprecatedSyntaxLinter.lean
More file actions
253 lines (209 loc) · 7.84 KB
/
DeprecatedSyntaxLinter.lean
File metadata and controls
253 lines (209 loc) · 7.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
import Mathlib.Tactic.Cases
import Mathlib.Tactic.Linter.DeprecatedSyntaxLinter
set_option linter.style.refine true
/--
warning:
The `refine'` tactic is discouraged: please strongly consider using `refine` or `apply` instead.
Note: This linter can be disabled with `set_option linter.style.refine false`
---
warning:
The `refine'` tactic is discouraged: please strongly consider using `refine` or `apply` instead.
Note: This linter can be disabled with `set_option linter.style.refine false`
-/
#guard_msgs in
example : True := by
refine' (by refine' .intro)
set_option linter.style.refine false
-- This is quiet because `linter.style.refine` is now false
example : True := by
refine' (by refine' .intro)
set_option linter.style.refine false in
-- This is quiet because `linter.style.refine` is now false, even using `in`.
example : True := by
refine' (by refine' .intro)
set_option linter.style.cases true
/--
warning: The `cases'` tactic is discouraged: please strongly consider using `obtain`, `rcases` or `cases` instead.
Note: This linter can be disabled with `set_option linter.style.cases false`
---
warning: The `cases'` tactic is discouraged: please strongly consider using `obtain`, `rcases` or `cases` instead.
Note: This linter can be disabled with `set_option linter.style.cases false`
-/
#guard_msgs in
example (a : (True ∨ True) ∨ (True ∨ True)): True := by
cases' a with b b <;> cases' b <;> trivial
set_option linter.style.cases false
-- This is quiet because `linter.style.cases` is now false
example (a : (True ∨ True) ∨ (True ∨ True)): True := by
cases' a with b b <;> cases' b <;> trivial
set_option linter.style.induction true
/--
warning: The `induction'` tactic is discouraged: please strongly consider using `induction` instead.
Note: This linter can be disabled with `set_option linter.style.induction false`
-/
#guard_msgs in
example {n : Nat} : n < 2 ^ n := by
induction' n with n ih
· simp
· grind
set_option linter.style.induction false
-- This is quiet because `linter.style.induction` is now false
example {n : Nat} : n < 2 ^ n := by
induction' n with n ih
· simp
· grind
set_option linter.style.admit true
/--
warning: declaration uses `sorry`
---
warning: The `admit` tactic is discouraged: please strongly consider using the synonymous `sorry` instead.
Note: This linter can be disabled with `set_option linter.style.admit false`
-/
#guard_msgs in
example : False := by admit
/--
warning: declaration uses `sorry`
---
warning: The `admit` tactic is discouraged: please strongly consider using the synonymous `sorry` instead.
Note: This linter can be disabled with `set_option linter.style.admit false`
---
warning: The `admit` tactic is discouraged: please strongly consider using the synonymous `sorry` instead.
Note: This linter can be disabled with `set_option linter.style.admit false`
---
warning: The `admit` tactic is discouraged: please strongly consider using the synonymous `sorry` instead.
Note: This linter can be disabled with `set_option linter.style.admit false`
---
warning: The `admit` tactic is discouraged: please strongly consider using the synonymous `sorry` instead.
Note: This linter can be disabled with `set_option linter.style.admit false`
-/
#guard_msgs in
example : True ∧ True := by
have : True := by
· admit
let foo : Nat := by admit
refine ⟨?_, ?_⟩
· admit
· admit
set_option linter.style.admit false
/--
warning: declaration uses `sorry`
-/
#guard_msgs in
example : False := by admit
set_option linter.style.nativeDecide true
/--
warning: Using `native_decide` is not allowed in mathlib: because it trusts the entire Lean compiler
(not just the Lean kernel), it could quite possibly be used to prove false.
Note: This linter can be disabled with `set_option linter.style.nativeDecide false`
-/
#guard_msgs in
example : 1 + 1 = 2 := by native_decide
/--
warning: Using `decide +native` is not allowed in mathlib:
because it trusts the entire Lean compiler (not just the Lean kernel),
it could quite possibly be used to prove false.
Note: This linter can be disabled with `set_option linter.style.nativeDecide false`
-/
#guard_msgs in
example : 1 + 1 = 2 := by decide +native
#guard_msgs in
example : 1 + 1 = 2 := by decide -native
/--
warning: Using `decide +native` is not allowed in mathlib:
because it trusts the entire Lean compiler (not just the Lean kernel),
it could quite possibly be used to prove false.
Note: This linter can be disabled with `set_option linter.style.nativeDecide false`
-/
#guard_msgs in
theorem foo : 1 + 1 = 2 := by decide -native +native
#guard_msgs in
example : 1 + 1 = 2 := by decide +native -native
/--
warning: Using `decide +native` is not allowed in mathlib:
because it trusts the entire Lean compiler (not just the Lean kernel),
it could quite possibly be used to prove false.
Note: This linter can be disabled with `set_option linter.style.nativeDecide false`
-/
#guard_msgs in
example : 1 + 1 = 2 := by decide +native -native +native +native
#guard_msgs in
example : 1 + 1 = 2 := by decide +native -native +kernel +native -kernel +native -native
/--
warning: Using `decide +native` is not allowed in mathlib:
because it trusts the entire Lean compiler (not just the Lean kernel),
it could quite possibly be used to prove false.
Note: This linter can be disabled with `set_option linter.style.nativeDecide false`
-/
#guard_msgs in
example : 1 + 1 = 2 := by decide (config := { native := true })
example : 1 + 1 = 2 := by decide (config := { native := false })
-- Not handled yet: since mathlib hardly uses the old config syntax and this linter is purely
-- for user information (and not hard guarantees), we deem this acceptable.
example : 1 + 1 = 2 := by decide (config := { native := true, kernel := false })
set_option linter.style.nativeDecide false
set_option linter.style.maxHeartbeats true
/--
warning: Please, add a comment explaining the need for modifying the maxHeartbeat limit, as in
set_option maxHeartbeats 10 in
-- reason for change
...
Note: This linter can be disabled with `set_option linter.style.maxHeartbeats false`
-/
#guard_msgs in
set_option maxHeartbeats 10 in
section
/--
warning: Please, add a comment explaining the need for modifying the maxHeartbeat limit, as in
set_option maxHeartbeats 10 in
-- reason for change
...
Note: This linter can be disabled with `set_option linter.style.maxHeartbeats false`
-/
#guard_msgs in
set_option maxHeartbeats 10 in
set_option maxHeartbeats 10 in
section
/--
warning: Please, add a comment explaining the need for modifying the maxHeartbeat limit, as in
set_option synthInstance.maxHeartbeats 10 in
-- reason for change
...
Note: This linter can be disabled with `set_option linter.style.maxHeartbeats false`
-/
#guard_msgs in
set_option synthInstance.maxHeartbeats 10 in
section
/--
warning: Please, add a comment explaining the need for modifying the maxHeartbeat limit, as in
set_option maxHeartbeats 10 in
-- reason for change
...
Note: This linter can be disabled with `set_option linter.style.maxHeartbeats false`
-/
#guard_msgs in
set_option maxHeartbeats 10 in
set_option synthInstance.maxHeartbeats 10 in
/- The comment here is not enough to silence the linter:
the *first* `maxHeartbeats` option should have a comment. -/
section
#guard_msgs in
set_option maxHeartbeats 10 in
/- The comment here is enough to silence the linter:
the *first* `maxHeartbeats` has a comment, to remaining ones are free to be commentless. -/
set_option synthInstance.maxHeartbeats 10 in
section
#guard_msgs in
set_option maxHeartbeats 10 in
-- no reason, but has a comment
section
/--
warning: Please, add a comment explaining the need for modifying the maxHeartbeat limit, as in
set_option maxHeartbeats 10 in
-- reason for change
...
Note: This linter can be disabled with `set_option linter.style.maxHeartbeats false`
-/
#guard_msgs in
set_option maxHeartbeats 10 in
/-- Doc-strings for the following command do not silence the linter. -/
example : True := trivial