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`
19 lines
575 B
Text
19 lines
575 B
Text
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
|
||
]
|