-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prop
instance
yields theorems (#5856)
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
- Loading branch information
Showing
5 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/-! | ||
# `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 |