This PR adds a feature to the the mutual def elaborator where the `instance` command yields theorems instead of definitions when the class is a `Prop`. Closes #5672
27 lines
382 B
Text
27 lines
382 B
Text
/-!
|
|
# `instance` creates a theorem if the class is a `Prop`
|
|
|
|
https://github.com/leanprover/lean4/issues/5672
|
|
-/
|
|
|
|
class A : Prop
|
|
|
|
instance a : A where
|
|
|
|
/--
|
|
info: theorem a : A :=
|
|
{ }
|
|
-/
|
|
#guard_msgs in #print a
|
|
|
|
|
|
/-!
|
|
Uses `def` variable inclusion rules
|
|
-/
|
|
section
|
|
variable (x : Nat)
|
|
instance b : A := by
|
|
cases x <;> exact {}
|
|
/-- info: b (x : Nat) : A -/
|
|
#guard_msgs in #check b
|
|
end
|