Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prop instance yields theorems #5856

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Oct 26, 2024

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

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 leanprover#5672
@kmill kmill added the awaiting-review Waiting for someone to review the PR label Oct 26, 2024
@kmill
Copy link
Collaborator Author

kmill commented Oct 26, 2024

@Kha The way I got this to work was by adding an extra DefKind for instances that's basically the same as for defs, but when the declaration is finally added to the environment, it checks to see if the type is a Prop to decide whether to use a theorem or a definition.

Instances then follow def variable inclusion rules instead of theorem. I had thought about modifying header processing to see whether the type is a prop and change the kind to def or theorem at that moment, to get theorem inclusion rules, but then if you omit the type it would use def inclusion rules. That seems confusing.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Oct 26, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 26, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 26, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Oct 27, 2024

Mathlib CI status (docs):

@leanprover-community-bot leanprover-community-bot added breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review Waiting for someone to review the PR builds-mathlib CI has verified that Mathlib builds against this PR toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instance creates defs regardless of whether the typeclass is Prop- or Type-valued
2 participants