lean4-htt/tests/lean/run/grind_11130.lean
Leonardo de Moura ff9c35d6ef
feat: #grind_lint command (#11157)
This PR implements the `#grind_lint` command, a diagnostic tool for
analyzing the behavior of theorems annotated for theorem instantiation.
The command helps identify problematic theorems that produce excessive
or unbounded instance generation during E-matching, which can lead to
performance issues.
The main entry point is:
```
#grind_lint check
```
which analyzes all theorems marked with the `@[grind]` attribute.
For each theorem, it creates an artificial goal and runs `grind`,
collecting statistics about the number of instances produced.
Results are summarized using info messages, and detailed breakdowns are
shown for lemmas exceeding a configurable threshold.
Additional subcommands are provided for targeted inspection and control:

* `#grind_lint inspect thm`: analyzes one or more specific theorems in
detail
* `#grind_lint mute thm`: excludes a theorem from instantiation during
analysis
* `#grind_lint skip thm`: omits a theorem from being analyzed by
`#grind_lint check`
2025-11-13 00:42:18 +00:00

19 lines
575 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

section Mathlib.Order.Monotone.Defs
variable {α β : Type} [LT α] [LE α] [LE β] {f : α → β} {a b : α}
def Monotone (f : α → β) : Prop := ∀ ⦃a b⦄, a ≤ b → f a ≤ f b
theorem Monotone.imp (hf : Monotone f) (h : a ≤ b) : f a ≤ f b := sorry
theorem monotone_iff_forall_lt : Monotone f ↔ ∀ ⦃a b⦄, a < b → f a ≤ f b := sorry
end Mathlib.Order.Monotone.Defs
#guard_msgs (drop error) in
theorem pow_self_mono : Monotone fun n : Nat ↦ n ^ n := by
grind -verbose [
monotone_iff_forall_lt,
Monotone.imp,
Nat.lt_pow_self
]