lean4-htt/tests/lean/run/grind_warn_param.lean
Leonardo de Moura fc718eac88
feat: code action for grind parameters (#10472)
This PR adds a code action for `grind` parameters. We need to use
`set_option grind.param.codeAction true` to enable the option. The PR
also adds a modifier to instruct `grind` to use the "default" pattern
inference strategy.
2025-09-20 07:30:39 +00:00

86 lines
2.3 KiB
Text

module
reset_grind_attrs%
public section
set_option warn.sorry false
attribute [grind =] Array.size_set
opaque P : Nat → Prop
opaque Q : Nat → Prop
opaque f : Nat → Nat → Nat
@[grind→] theorem pqf : Q x → P (f x x) := sorry
opaque h : Nat → Nat
opaque g : Nat → Nat → Nat
@[grind _=_]
theorem hg : h x = g x (g x x) := sorry
/--
warning: this parameter is redundant, environment already contains `Array.size_set` annotated with `@[grind =]`
-/
#guard_msgs (warning) in
example : True := by grind [= Array.size_set]
/--
warning: this parameter is redundant, environment already contains `pqf` annotated with `@[grind →]`
-/
#guard_msgs (warning) in
example : True := by grind [→ pqf]
/--
warning: this parameter is redundant, environment already contains `pqf` annotated with `@[grind →]`
---
warning: this parameter is redundant, environment already contains `Array.size_set` annotated with `@[grind =]`
-/
#guard_msgs (warning) in
example : True := by grind [→ pqf, = Array.size_set]
/--
warning: this parameter is redundant, environment already contains `Array.size_set` annotated with `@[grind =]`
-/
#guard_msgs (warning) in
example : True := by grind [= Array.size_set]
/--
warning: this parameter is redundant, environment already contains `hg` annotated with `@[grind _=_]`
-/
#guard_msgs (warning) in
example : True := by grind [_=_ hg]
/--
warning: this parameter is redundant, environment already contains `hg` annotated with `@[grind _=_]`
-/
#guard_msgs (warning) in
example : True := by grind [=_ hg]
/--
warning: this parameter is redundant, environment already contains `Array.size_set` annotated with `@[grind =]`
-/
#guard_msgs (warning) in
example : True := by grind [= Array.size_set]
#guard_msgs (warning) in
example : True := by grind [pqf]
/--
warning: this parameter is redundant, environment already contains `hg` annotated with `@[grind _=_]`
-/
#guard_msgs (warning) in
example : True := by grind [hg]
@[grind =] theorem mem_range : m ∈ List.range n ↔ m < n :=
sorry
/--
warning: this parameter is redundant, environment already contains `mem_range` annotated with `@[grind =]`
-/
#guard_msgs (warning) in
example : True := by grind [mem_range]
/--
warning: this parameter is redundant, environment already contains `mem_range` annotated with `@[grind =]`
-/
#guard_msgs (warning) in
example : True := by grind [= mem_range]