The areas / V34. The tactics of Mathlib
Mathlib.Tactic.Linter.UnusedInstancesInType
4 declarations and 1 deprecated aliases. Mathlib docs · Source
Linters for Unused Instances in Types
This file declares linters which detect certain instance hypotheses in declarations that are unused
in the remainder of the type. They are registered as linters in Mathlib.Tactic.Linter.DeclType.
Currently, these linters only handle theorems. (This also includes lemmas and instances of
Prop classes.)
unusedDecidableInTypelinter (currently off by default): suggests replacing type-unusedDecidable*instance hypotheses, and could therefore be replaced byclassicalin the proof.
TODO: log on type signature instead of whole command TODO: add more linters! TODO: create Try This suggestions
opaque Mathlib.Linter.UnusedInstancesInType.linter.unusedDecidableInType E1 #
Lean.Option Bool
The unusedDecidableInType linter checks if a theorem's hypotheses include Decidable* instances
which are not used in the remainder of the type. If so, it suggests removing the instances and using
classical or open scoped Classical in, as appropriate, in the theorem's proof instead.
This linter fires only on theorems. (This includes lemmas and instances of Prop classes.)
Note: set_option linter.unusedDecidableInType _ in <command> currently only works at the
outermost level of a command due to working around lean4#11313.
def Mathlib.Linter.UnusedInstancesInType.unusedDecidableInType E1 #
Lean.ConstantVal → Lean.Syntax → Lean.CoreM Unit
Detect Decidable* instance hypotheses in the type of thm which are not used in the
remainder of the type, and suggest replacing them with a use of classical in the proof or
open scoped Classical in at the term level.
opaque Mathlib.Linter.UnusedInstancesInType.linter.unusedFintypeInType E1 #
Lean.Option Bool
The unusedFintypeInType linter checks if a theorem's hypotheses include Fintype instances
which are not used in the remainder of the type. If so, it suggests modifying the instances to
Finite _ and using Fintype.ofFinite in the proof, or removing them entirely.
This linter fires only on theorems. (This includes lemmas and instances of Prop classes.)
def Mathlib.Linter.UnusedInstancesInType.unusedFintypeInType E1 #
Lean.ConstantVal → Lean.Syntax → Lean.CoreM Unit
Detect Fintype instance hypotheses in the type of thm which are not used in the
remainder of the type, and suggest replacing them with the corresponding hypothesis of Finite
and the use of Fintype.ofFinite in the proof.
Deprecated aliases
| Name | New name | Since |
|---|---|---|
Mathlib.Linter.UnusedInstancesInType.withSetBoolOptionIn | Lean.withSetOptionIn | 2026-10-05 |