Skip to content

Commit 3d04a0d

Browse files
committed
feat: register mathlib finishing tactics with try?
Register a selection of mathlib finishing tactics with the `try?` tactic: - Common finishing tactics: tauto, aesop, fun_prop - Domain-specific finishing tactics: norm_num, noncomm_ring, field, bound, finiteness, compute_degree, positivity, field_simp These tactics are registered alongside the existing `hint` registrations to make them available to the built-in `try?` tactic in Lean 4.27.0+. 🤖 Prepared with Claude Code
1 parent 74b6087 commit 3d04a0d

9 files changed

Lines changed: 20 additions & 0 deletions

File tree

Mathlib/Tactic/Bound.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,4 @@ We register `bound` with the `hint` tactic.
258258
-/
259259

260260
register_hint 70 bound
261+
register_try?_tactic (priority := 70) bound

Mathlib/Tactic/Common.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,15 @@ register_hint 200 omega
151151
register_hint 200 fun_prop
152152

153153
end Hint
154+
155+
/-!
156+
# Register tactics with `try?`. Tactics with larger priority run first.
157+
-/
158+
159+
section Try
160+
161+
register_try?_tactic (priority := 500) tauto
162+
register_try?_tactic (priority := 80) aesop
163+
register_try?_tactic (priority := 200) fun_prop
164+
165+
end Try

Mathlib/Tactic/ComputeDegree.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,3 +529,4 @@ end Mathlib.Tactic.ComputeDegree
529529
We register `compute_degree` with the `hint` tactic.
530530
-/
531531
register_hint 1000 compute_degree
532+
register_try?_tactic (priority := 1000) compute_degree

Mathlib/Tactic/Field.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ end Mathlib.Tactic.FieldSimp
8282

8383
/-! We register `field` with the `hint` tactic. -/
8484
register_hint 850 field
85+
register_try?_tactic (priority := 850) field

Mathlib/Tactic/FieldSimp.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,3 +792,4 @@ attribute [field, inherit_doc FieldSimp.proc] fieldEq fieldLe fieldLt
792792
We register `field_simp` with the `hint` tactic.
793793
-/
794794
register_hint 1000 field_simp
795+
register_try?_tactic (priority := 1000) field_simp

Mathlib/Tactic/Finiteness.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ macro (name := finiteness_nonterminal) "finiteness_nonterminal" c:Aesop.tactic_c
7676
We register `finiteness` with the `hint` tactic.
7777
-/
7878
register_hint 1000 finiteness
79+
register_try?_tactic (priority := 1000) finiteness

Mathlib/Tactic/NoncommRing.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ We register `noncomm_ring` with the `hint` tactic.
8181
-/
8282

8383
register_hint 1000 noncomm_ring
84+
register_try?_tactic (priority := 1000) noncomm_ring

Mathlib/Tactic/NormNum/Core.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,4 @@ We register `norm_num` with the `hint` tactic.
313313
-/
314314

315315
register_hint 1000 norm_num
316+
register_try?_tactic (priority := 1000) norm_num

Mathlib/Tactic/Positivity/Core.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,3 +536,4 @@ We register `positivity` with the `hint` tactic.
536536
-/
537537

538538
register_hint 1000 positivity
539+
register_try?_tactic (priority := 1000) positivity

0 commit comments

Comments
 (0)