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: explanations for cases applied to non-inductive types #6378

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Dec 13, 2024

This PR adds an explanation to the error message when cases and induction are applied to a term whose type is not an inductive type. For Prop, these tactics now suggest the by_cases tactic. Example:

tactic 'cases' failed, major premise type is not an inductive type
  Prop

Explanation: the 'cases' tactic is for constructor-based reasoning as well as for applying
custom cases principles with a 'using' clause or a registered '@[cases_eliminator]' theorem.
The above type neither is an inductive type nor has a registered theorem.

Consider using the 'by_cases' tactic, which does true/false reasoning for propositions.

Zulip discussion

@kmill kmill added the changelog-language Language features, tactics, and metaprograms label Dec 13, 2024
@kmill kmill requested a review from kim-em as a code owner December 13, 2024 16:47
@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 Dec 13, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Dec 13, 2024

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase fc4305ab15d7137f6bda64a557dc2ca9c6fc460f --onto 48be424eaa2ae06972e9cfec4d355906b532204d. (2024-12-13 17:14:52)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 58ffd15a8f4816473bda4c7b9b41e6c4eb2e00f1 --onto 48be424eaa2ae06972e9cfec4d355906b532204d. (2024-12-13 19:03:35)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 58ffd15a8f4816473bda4c7b9b41e6c4eb2e00f1 --onto a8a160b09147c3225150703ac727eea6ee9a3b0e. (2024-12-16 22:15:22)

This PR adds an explanation to the error message when `cases` and `induction` are applied to a term whose type is not an inductive type. For `Prop`, these tactics now suggest the `by_cases` tactic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-language Language features, tactics, and metaprograms 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.

2 participants