lean4
lean4 copied to clipboard
Instance creates defs regardless of whether the typeclass is Prop- or Type-valued
Prerequisites
Please put an X between the brackets as you perform the following steps:
- [x] Check that your issue is not already filed: https://github.com/leanprover/lean4/issues
- [x] Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to Mathlib or Batteries.
- [x] Test your test case against the latest nightly release, for example on https://live.lean-lang.org/#project=lean-nightly (You can also use the settings there to switch to “Lean nightly”)
Description
Instance always creates defs instead of theorems regardless of whether the typeclass is Prop- or Type-valued.
Context
Given a type class class A : Prop, the instances of this typeclass should be theorems. However, currently, all instances are defs.
MWE from the zulip discussion:
import Lean.Elab.Command
open Lean
class A : Prop
instance a : A where
/-- info: it's a definition -/
#guard_msgs in
run_meta do
if let .defnInfo _ ← getConstInfo `a then
logInfo "it's a definition"
Versions
4.12.0-nightly-2024-10-10 (using live.lean-lang.org)
Impact
Add :+1: to issues you consider important. If others are impacted by this issue, please ask them to add :+1: to it.