Skip to content

Commit e044fac

Browse files
Merge branch 'master' into J-Simplicity
2 parents 1f6da86 + b43655d commit e044fac

File tree

9 files changed

+84
-94
lines changed

9 files changed

+84
-94
lines changed

Cache/Requests.lean

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ namespace Cache.Requests
1313

1414
open System (FilePath)
1515

16+
/-- The full name of the main Mathlib GitHub repository. -/
17+
def MATHLIBREPO := "leanprover-community/mathlib4"
18+
1619
/--
1720
Structure to hold repository information with priority ordering
1821
-/
@@ -37,7 +40,7 @@ def isRemoteURL (url : String) : Bool :=
3740
/--
3841
Helper function to get repository from a remote name
3942
-/
40-
def getRepoFromRemote (mathlibDepPath : FilePath) (remoteName : String) (errorContext : String) : IO String := do
43+
def getRepoFromRemote (mathlibDepPath : FilePath) (remoteName : String) (errorContext : String) : IO (Option String) := do
4144
-- If the remote is already a valid URL, attempt to extract the repo from it. This happens with `gh pr checkout`
4245
if isRemoteURL remoteName then
4346
repoFromURL remoteName
@@ -46,23 +49,25 @@ def getRepoFromRemote (mathlibDepPath : FilePath) (remoteName : String) (errorCo
4649
-- standard name like `origin` or `upstream` or it errors out.
4750
let out ← IO.Process.output
4851
{cmd := "git", args := #["remote", "get-url", remoteName], cwd := mathlibDepPath}
49-
-- If `git remote get-url` fails then bail out with an error to help debug
52+
-- If `git remote get-url` fails then return none.
5053
let output := out.stdout.trimAscii
5154
unless out.exitCode == 0 do
52-
throw <| IO.userError s!"\
53-
Failed to run Git to determine Mathlib's repository from {remoteName} remote (exit code: {out.exitCode}).\n\
55+
IO.println s!"\
56+
Warning: failed to run Git to determine Mathlib's repository from {remoteName} remote\n\
5457
{errorContext}\n\
55-
Stdout:\n{output}\nStderr:\n{out.stderr.trimAscii}\n"
58+
Continuing to fetch the cache from {MATHLIBREPO}."
59+
return none
5660
-- Finally attempt to extract the repository from the remote URL returned by `git remote get-url`
5761
repoFromURL output.copy
58-
where repoFromURL (url : String) : IO String := do
62+
where repoFromURL (url : String) : IO (Option String) := do
5963
if let some repo := extractRepoFromUrl url then
60-
return repo
64+
return some repo
6165
else
62-
throw <| IO.userError s!"\
63-
Failed to extract repository from remote URL: {url}.\n\
66+
IO.println s!"\
67+
Warning: Failed to extract repository from remote URL: {url}.\n\
6468
{errorContext}\n\
65-
Please ensure the remote URL is valid and points to a GitHub repository."
69+
Continuing to fetch the cache from {MATHLIBREPO}."
70+
return none
6671

6772
/--
6873
Finds the remote name that points to `leanprover-community/mathlib4` repository.
@@ -146,7 +151,7 @@ Attempts to determine the GitHub repository of a version of Mathlib from its Git
146151
If the current commit coincides with a PR ref, it will determine the source fork
147152
of that PR rather than just using the origin remote.
148153
-/
149-
def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
154+
def getRemoteRepo (mathlibDepPath : FilePath) : IO (Option RepoInfo) := do
150155

151156
-- Since currently we need to push a PR to `leanprover-community/mathlib` build a user cache,
152157
-- we check if we are a special branch or a branch with PR. This leaves out non-PRed fork
@@ -176,7 +181,7 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
176181
let repo := "leanprover-community/mathlib4-nightly-testing"
177182
let cacheService := if useCloudflareCache then "Cloudflare" else "Azure"
178183
IO.println s!"Using cache ({cacheService}) from nightly-testing remote: {repo}"
179-
return {repo := repo, useFirst := true}
184+
return some {repo := repo, useFirst := true}
180185

181186
-- Only search for PR refs if we're not on a regular branch like master, bump/*, or nightly-testing*
182187
-- let isSpecialBranch := branchName == "master" || branchName.startsWith "bump/" ||
@@ -234,11 +239,16 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
234239
-- If no tracking remote is configured, fall back to origin
235240
"origin"
236241

237-
let repo ← getRepoFromRemote mathlibDepPath remoteName
242+
let repo? ← getRepoFromRemote mathlibDepPath remoteName
238243
s!"Ensure Git is installed and the '{remoteName}' remote points to its GitHub repository."
239244
let cacheService := if useCloudflareCache then "Cloudflare" else "Azure"
240-
IO.println s!"Using cache ({cacheService}) from {remoteName}: {repo}"
241-
return {repo := repo, useFirst := false}
245+
match repo? with
246+
| some repo =>
247+
IO.println s!"Using cache ({cacheService}) from {remoteName}: {repo?}"
248+
return some {repo := repo, useFirst := false}
249+
| none =>
250+
IO.println s!"Using cache ({cacheService}) from {MATHLIBREPO}."
251+
return none
242252

243253
/-- Public URL for mathlib cache -/
244254
initialize URL : String ← do
@@ -275,9 +285,6 @@ def getUploadAuth : IO UploadAuth := do
275285
throw <| IO.userError
276286
"environment variable MATHLIB_CACHE_AZURE_BEARER_TOKEN or MATHLIB_CACHE_SAS must be set to upload caches"
277287

278-
/-- The full name of the main Mathlib GitHub repository. -/
279-
def MATHLIBREPO := "leanprover-community/mathlib4"
280-
281288
/--
282289
Given a file name like `"1234.tar.gz"`, makes the URL to that file on the server.
283290
@@ -663,16 +670,19 @@ def getFiles
663670
isMathlibRoot mathlibDepPath
664671
if failed > 0 then IO.Process.exit 1
665672
else
666-
let repoInfo ← getRemoteRepo (← read).mathlibDepPath
673+
let repoInfo? ← getRemoteRepo (← read).mathlibDepPath
667674

668675
-- Build list of repositories to download from in order
669676
let repos : List String :=
670-
if repoInfo.repo == MATHLIBREPO then
671-
[repoInfo.repo]
672-
else if repoInfo.useFirst then
673-
[repoInfo.repo, MATHLIBREPO]
677+
if let some repoInfo := repoInfo? then
678+
if repoInfo.repo == MATHLIBREPO then
679+
[MATHLIBREPO]
680+
else if repoInfo.useFirst then
681+
[repoInfo.repo, MATHLIBREPO]
682+
else
683+
[MATHLIBREPO, repoInfo.repo]
674684
else
675-
[MATHLIBREPO, repoInfo.repo]
685+
[MATHLIBREPO]
676686

677687
let mut failed : Nat := 0
678688
for h : i in [0:repos.length] do

Mathlib/Algebra/Exact.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ lemma iff_rangeFactorization [One P] (hg : 1 ∈ Set.range g) :
9292
MulExact f g ↔ MulExact ((↑) : Set.range f → N) (Set.rangeFactorization g) := by
9393
letI : One (Set.range g) := ⟨⟨1, hg⟩⟩
9494
have : ((1 : Set.range g) : P) = 1 := rfl
95-
simp [MulExact, Set.rangeFactorization, Subtype.ext_iff, this]
95+
simp [MulExact, Subtype.ext_iff, this]
9696

9797
/-- If two maps `f : M → N` and `g : N → P` are exact, then the induced maps
9898
`Set.range f → N → Set.range g` are exact.
@@ -430,8 +430,7 @@ def Exact.splitInjectiveEquiv
430430
· intro x y e
431431
simp only [prod_apply, Pi.prod, Prod.mk.injEq] at e
432432
obtain ⟨z, hz⟩ := (h (x - y)).mp (by simpa [sub_eq_zero] using e.2)
433-
suffices z = 0 by rw [← sub_eq_zero, ← hz, this, map_zero]
434-
rw [← h₁ z, hz, map_sub, e.1, sub_self]
433+
rw [← sub_eq_zero, ← hz, ← h₁ z, hz, map_sub, e.1, sub_self, map_zero]
435434
· rintro ⟨x, y⟩
436435
obtain ⟨y, rfl⟩ := hg y
437436
refine ⟨f x + y - f (l.1 y), by ext <;> simp [h₁, h₂]⟩

Mathlib/Algebra/Star/Basic.lean

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,8 @@ protected instance Invertible.star {R : Type*} [MulOneClass R] [StarMul R] (r :
485485

486486
theorem star_invOf {R : Type*} [Monoid R] [StarMul R] (r : R) [Invertible r]
487487
[Invertible (star r)] : star (⅟r) = ⅟(star r) := by
488-
have : star (⅟r) = star (⅟r) * ((star r) * ⅟(star r)) := by
489-
simp only [mul_invOf_self, mul_one]
490-
rw [this, ← mul_assoc]
491-
have : (star (⅟r)) * (star r) = star 1 := by rw [← star_mul, mul_invOf_self]
492-
rw [this, star_one, one_mul]
488+
rw [← mul_one (star (⅟r)), ← mul_invOf_self (star r), ← mul_assoc, ← star_mul]
489+
simp
493490

494491
section Regular
495492

Mathlib/CategoryTheory/Sites/Grothendieck.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ theorem isGLB_sInf (s : Set (GrothendieckTopology C)) : IsGLB s (sInf s) := by
306306
definitionally equal to the bottom and top respectively.
307307
-/
308308
instance : CompleteLattice (GrothendieckTopology C) :=
309-
CompleteLattice.copy (completeLatticeOfInf _ isGLB_sInf) _ rfl (discrete C)
309+
fast_instance% CompleteLattice.copy (completeLatticeOfInf _ isGLB_sInf) _ rfl (discrete C)
310310
(by
311311
apply le_antisymm
312312
· exact (completeLatticeOfInf _ isGLB_sInf).le_top (discrete C)

Mathlib/Init.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ register_linter_set linter.nightlyRegressionSet :=
123123
register_linter_set linter.weeklyLintSet :=
124124
linter.tacticAnalysis.mergeWithGrind
125125
linter.style.docStringVerso
126+
linter.tacticAnalysis.verifyGrindOnly
126127

127128
-- Check that all linter options mentioned in the mathlib standard linter set exist.
128129
open Lean Elab.Command Linter Mathlib.Linter Style UnusedInstancesInType

Mathlib/Order/Copy.lean

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,35 @@ universe u
2424

2525
variable {α : Type u}
2626

27-
-- adding `@[implicit_reducible]` causes downstream breakage
28-
set_option warn.classDefReducibility false in
2927
/-- A function to create a provable equal copy of a top order
3028
with possibly different definitional equalities. -/
29+
@[implicit_reducible]
3130
def OrderTop.copy {h : LE α} {h' : LE α} (c : @OrderTop α h')
3231
(top : α) (eq_top : top = (by infer_instance : Top α).top)
3332
(le_eq : ∀ x y : α, (@LE.le α h) x y ↔ x ≤ y) : @OrderTop α h :=
3433
@OrderTop.mk α h { top := top } fun _ ↦ by simp [eq_top, le_eq]
3534

36-
-- adding `@[implicit_reducible]` causes downstream breakage
37-
set_option warn.classDefReducibility false in
3835
/-- A function to create a provable equal copy of a bottom order
3936
with possibly different definitional equalities. -/
37+
@[implicit_reducible]
4038
def OrderBot.copy {h : LE α} {h' : LE α} (c : @OrderBot α h')
4139
(bot : α) (eq_bot : bot = (by infer_instance : Bot α).bot)
4240
(le_eq : ∀ x y : α, (@LE.le α h) x y ↔ x ≤ y) : @OrderBot α h :=
4341
@OrderBot.mk α h { bot := bot } fun _ ↦ by simp [eq_bot, le_eq]
4442

45-
-- adding `@[implicit_reducible]` causes downstream breakage
46-
set_option warn.classDefReducibility false in
4743
/-- A function to create a provable equal copy of a bounded order
4844
with possibly different definitional equalities. -/
45+
@[implicit_reducible]
4946
def BoundedOrder.copy {h : LE α} {h' : LE α} (c : @BoundedOrder α h')
5047
(top : α) (eq_top : top = (by infer_instance : Top α).top)
5148
(bot : α) (eq_bot : bot = (by infer_instance : Bot α).bot)
5249
(le_eq : ∀ x y : α, (@LE.le α h) x y ↔ x ≤ y) : @BoundedOrder α h :=
5350
@BoundedOrder.mk α h (@OrderTop.mk α h { top := top } (fun _ ↦ by simp [eq_top, le_eq]))
5451
(@OrderBot.mk α h { bot := bot } (fun _ ↦ by simp [eq_bot, le_eq]))
5552

56-
-- adding `@[implicit_reducible]` causes downstream breakage
57-
set_option warn.classDefReducibility false in
5853
/-- A function to create a provable equal copy of a lattice
5954
with possibly different definitional equalities. -/
55+
@[implicit_reducible]
6056
def Lattice.copy (c : Lattice α)
6157
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
6258
(sup : α → α → α) (eq_sup : sup = (by infer_instance : Max α).max)
@@ -75,23 +71,19 @@ def Lattice.copy (c : Lattice α)
7571
inf_le_right := by intros; simp [eq_le, eq_inf]
7672
le_inf := by intro _ _ _ hac hbc; simp_rw [eq_le] at hac hbc ⊢; simp [eq_inf, hac, hbc]
7773

78-
-- adding `@[implicit_reducible]` causes downstream breakage
79-
set_option warn.classDefReducibility false in
80-
set_option backward.isDefEq.respectTransparency false in
8174
/-- A function to create a provable equal copy of a distributive lattice
8275
with possibly different definitional equalities. -/
76+
@[implicit_reducible]
8377
def DistribLattice.copy (c : DistribLattice α)
8478
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
8579
(sup : α → α → α) (eq_sup : sup = (by infer_instance : Max α).max)
8680
(inf : α → α → α) (eq_inf : inf = (by infer_instance : Min α).min) : DistribLattice α where
8781
toLattice := Lattice.copy (@DistribLattice.toLattice α c) le eq_le sup eq_sup inf eq_inf
8882
le_sup_inf := by intros; simp +instances [eq_le, eq_sup, eq_inf, le_sup_inf]
8983

90-
-- adding `@[implicit_reducible]` causes downstream breakage
91-
set_option warn.classDefReducibility false in
92-
set_option backward.isDefEq.respectTransparency false in
9384
/-- A function to create a provable equal copy of a generalised heyting algebra
9485
with possibly different definitional equalities. -/
86+
@[implicit_reducible]
9587
def GeneralizedHeytingAlgebra.copy (c : GeneralizedHeytingAlgebra α)
9688
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
9789
(top : α) (eq_top : top = (by infer_instance : Top α).top)
@@ -105,11 +97,9 @@ def GeneralizedHeytingAlgebra.copy (c : GeneralizedHeytingAlgebra α)
10597
himp := himp
10698
le_himp_iff _ _ _ := by simp +instances [eq_le, eq_himp, eq_inf]
10799

108-
-- adding `@[implicit_reducible]` causes downstream breakage
109-
set_option warn.classDefReducibility false in
110-
set_option backward.isDefEq.respectTransparency false in
111100
/-- A function to create a provable equal copy of a generalised co-Heyting algebra
112101
with possibly different definitional equalities. -/
102+
@[implicit_reducible]
113103
def GeneralizedCoheytingAlgebra.copy (c : GeneralizedCoheytingAlgebra α)
114104
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
115105
(bot : α) (eq_bot : bot = (by infer_instance : Bot α).bot)
@@ -123,11 +113,9 @@ def GeneralizedCoheytingAlgebra.copy (c : GeneralizedCoheytingAlgebra α)
123113
sdiff := sdiff
124114
sdiff_le_iff := by simp +instances [eq_le, eq_sdiff, eq_sup]
125115

126-
-- adding `@[implicit_reducible]` causes downstream breakage
127-
set_option warn.classDefReducibility false in
128-
set_option backward.isDefEq.respectTransparency false in
129116
/-- A function to create a provable equal copy of a heyting algebra
130117
with possibly different definitional equalities. -/
118+
@[implicit_reducible]
131119
def HeytingAlgebra.copy (c : HeytingAlgebra α)
132120
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
133121
(top : α) (eq_top : top = (by infer_instance : Top α).top)
@@ -145,11 +133,9 @@ def HeytingAlgebra.copy (c : HeytingAlgebra α)
145133
compl := compl
146134
himp_bot := by simp +instances [eq_le, eq_himp, eq_bot, eq_compl]
147135

148-
-- adding `@[implicit_reducible]` causes downstream breakage
149-
set_option warn.classDefReducibility false in
150-
set_option backward.isDefEq.respectTransparency false in
151136
/-- A function to create a provable equal copy of a co-Heyting algebra
152137
with possibly different definitional equalities. -/
138+
@[implicit_reducible]
153139
def CoheytingAlgebra.copy (c : CoheytingAlgebra α)
154140
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
155141
(top : α) (eq_top : top = (by infer_instance : Top α).top)
@@ -167,10 +153,9 @@ def CoheytingAlgebra.copy (c : CoheytingAlgebra α)
167153
hnot := hnot
168154
top_sdiff := by simp +instances [eq_le, eq_sdiff, eq_top, eq_hnot]
169155

170-
-- adding `@[implicit_reducible]` causes downstream breakage
171-
set_option warn.classDefReducibility false in
172156
/-- A function to create a provable equal copy of a bi-Heyting algebra
173157
with possibly different definitional equalities. -/
158+
@[implicit_reducible]
174159
def BiheytingAlgebra.copy (c : BiheytingAlgebra α)
175160
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
176161
(top : α) (eq_top : top = (by infer_instance : Top α).top)
@@ -187,11 +172,9 @@ def BiheytingAlgebra.copy (c : BiheytingAlgebra α)
187172
__ := CoheytingAlgebra.copy (@BiheytingAlgebra.toCoheytingAlgebra α c) le eq_le top eq_top bot
188173
eq_bot sup eq_sup inf eq_inf sdiff eq_sdiff hnot eq_hnot
189174

190-
-- adding `@[implicit_reducible]` causes downstream breakage
191-
set_option warn.classDefReducibility false in
192-
set_option backward.isDefEq.respectTransparency false in
193175
/-- A function to create a provable equal copy of a complete lattice
194176
with possibly different definitional equalities. -/
177+
@[implicit_reducible]
195178
def CompleteLattice.copy (c : CompleteLattice α)
196179
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
197180
(top : α) (eq_top : top = (by infer_instance : Top α).top)
@@ -211,10 +194,9 @@ def CompleteLattice.copy (c : CompleteLattice α)
211194
le_top := by intros; simp +instances [eq_le, eq_top]
212195
bot_le := by intros; simp +instances [eq_le, eq_bot]
213196

214-
-- adding `@[implicit_reducible]` causes downstream breakage
215-
set_option warn.classDefReducibility false in
216197
/-- A function to create a provable equal copy of a frame with possibly different definitional
217198
equalities. -/
199+
@[implicit_reducible]
218200
def Frame.copy (c : Frame α) (le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
219201
(top : α) (eq_top : top = (by infer_instance : Top α).top)
220202
(bot : α) (eq_bot : bot = (by infer_instance : Bot α).bot)
@@ -229,10 +211,9 @@ def Frame.copy (c : Frame α) (le : α → α → Prop) (eq_le : le = (by infer_
229211
__ := HeytingAlgebra.copy (@Frame.toHeytingAlgebra α c)
230212
le eq_le top eq_top bot eq_bot sup eq_sup inf eq_inf himp eq_himp compl eq_compl
231213

232-
-- adding `@[implicit_reducible]` causes downstream breakage
233-
set_option warn.classDefReducibility false in
234214
/-- A function to create a provable equal copy of a coframe with possibly different definitional
235215
equalities. -/
216+
@[implicit_reducible]
236217
def Coframe.copy (c : Coframe α) (le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
237218
(top : α) (eq_top : top = (by infer_instance : Top α).top)
238219
(bot : α) (eq_bot : bot = (by infer_instance : Bot α).bot)
@@ -247,10 +228,9 @@ def Coframe.copy (c : Coframe α) (le : α → α → Prop) (eq_le : le = (by in
247228
__ := CoheytingAlgebra.copy (@Coframe.toCoheytingAlgebra α c)
248229
le eq_le top eq_top bot eq_bot sup eq_sup inf eq_inf sdiff eq_sdiff hnot eq_hnot
249230

250-
-- adding `@[implicit_reducible]` causes downstream breakage
251-
set_option warn.classDefReducibility false in
252231
/-- A function to create a provable equal copy of a complete distributive lattice
253232
with possibly different definitional equalities. -/
233+
@[implicit_reducible]
254234
def CompleteDistribLattice.copy (c : CompleteDistribLattice α)
255235
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
256236
(top : α) (eq_top : top = (by infer_instance : Top α).top)
@@ -269,10 +249,9 @@ def CompleteDistribLattice.copy (c : CompleteDistribLattice α)
269249
__ := Coframe.copy (@CompleteDistribLattice.toCoframe α c) le eq_le top eq_top bot eq_bot sup
270250
eq_sup inf eq_inf sdiff eq_sdiff hnot eq_hnot sSup eq_sSup sInf eq_sInf
271251

272-
-- adding `@[implicit_reducible]` causes downstream breakage
273-
set_option warn.classDefReducibility false in
274252
/-- A function to create a provable equal copy of a conditionally complete lattice
275253
with possibly different definitional equalities. -/
254+
@[implicit_reducible]
276255
def ConditionallyCompleteLattice.copy (c : ConditionallyCompleteLattice α)
277256
(le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le)
278257
(sup : α → α → α) (eq_sup : sup = (by infer_instance : Max α).max)

Mathlib/Tactic/TacticAnalysis/Declarations.lean

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ Runs the given tactic at each proof step, captures any "Try this:" suggestions,
596596
then re-runs the suggested tactic to verify it succeeds.
597597
Only reports failures (where the suggestion doesn't close the goal). -/
598598
def Mathlib.TacticAnalysis.verifyTryThisSuggestions
599-
(tac : Syntax → MVarId → CommandElabM (TSyntax `tactic))
599+
(tac : Syntax → MVarId → CommandElabM (Option (TSyntax `tactic)))
600600
(label : String) : TacticAnalysis.Config where
601601
run seq := do
602602
let opts ← getOptions
@@ -608,7 +608,7 @@ def Mathlib.TacticAnalysis.verifyTryThisSuggestions
608608
withOptions (·.setBool `pp.mvars.anonymous false) do
609609
return toString (← Meta.ppGoal goal)
610610
if (hash goalPP) % fraction = 0 then
611-
let tac ← tac i.tacI.stx goal
611+
if let some tac ← tac i.tacI.stx goal then
612612
-- Save message state to suppress "Try this:" info messages from grind?
613613
let savedMessages := (← get).messages
614614
-- Run tactic and capture InfoTree
@@ -693,3 +693,18 @@ register_option linter.tacticAnalysis.verifyGrindSuggestions : Bool := {
693693
def verifyGrindSuggestions := verifyTryThisSuggestions
694694
(fun _ _ => `(tactic| grind? +suggestions))
695695
"grind? +suggestions"
696+
697+
/-- Verify that replacing `grind` with `grind?` produces a valid `grind only` suggestion. -/
698+
register_option linter.tacticAnalysis.verifyGrindOnly : Bool := {
699+
defValue := false
700+
}
701+
702+
@[tacticAnalysis linter.tacticAnalysis.verifyGrindOnly,
703+
inherit_doc linter.tacticAnalysis.verifyGrindOnly]
704+
def verifyGrindOnly := verifyTryThisSuggestions
705+
(fun stx _ =>
706+
return match stx with
707+
| .node info ``Lean.Parser.Tactic.grind args => some ⟨.node info ``Lean.Parser.Tactic.grindTrace args⟩
708+
| _ => none
709+
)
710+
"grind?"

0 commit comments

Comments
 (0)