Prerequisites
Description
The delta-deriving handler always makes instances defs even when their types are Props. This is inconsistent with the behavior of a handwritten instance.
For example:
def Foo (α : Type u) := List α
deriving instance Nonempty for Foo
/--
info: @[implicit_reducible] def instNonemptyFoo.{u_1} : ∀ (α : Type u_1), Nonempty (Foo α) :=
-/
#guard_msgs (substring := true) in
#print instNonemptyFoo
Context
This was observed in leanprover-community/batteries#1727, which updates the defLemma linter (identifying definitions which are Props and so should be theorems) to remove workarounds for #2575 now that #2575 has been fixed.
Steps to Reproduce
- Create a type synonym
Foo.
- Invoke
deriving instance MyProp for Foo where MyProp is a Prop class.
Expected behavior: The created instance is a theorem/.thmInfo.
Actual behavior: The created instance is a def/.defnInfo
Versions
Lean 4.31.0-nightly-2026-04-06
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Prerequisites
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
The delta-deriving handler always makes instances
defs even when their types areProps. This is inconsistent with the behavior of a handwritteninstance.For example:
Context
This was observed in leanprover-community/batteries#1727, which updates the
defLemmalinter (identifying definitions which areProps and so should betheorems) to remove workarounds for #2575 now that #2575 has been fixed.Steps to Reproduce
Foo.deriving instance MyProp for FoowhereMyPropis aPropclass.Expected behavior: The created instance is a
theorem/.thmInfo.Actual behavior: The created instance is a
def/.defnInfoVersions
Lean 4.31.0-nightly-2026-04-06
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.