-
Notifications
You must be signed in to change notification settings - Fork 447
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: improve error messages and docstring for decide
tactic
#3422
Conversation
@david-christiansen The There was recent Zulip discussion about |
Mathlib CI status (docs):
|
This looks like a nice improvement! I think we should look into adding reasons as optional arguments. If we do it right, we might not even break anything :-) |
33a50fc
to
195b074
Compare
a9628f2
to
9372c34
Compare
The `decide` tactic produces error messages that users find to be obscure. Now: 1. If the `Decidable` instance reduces to `isFalse`, it reports that `decide` failed because the proposition is false. 2. If the `Decidable` instance fails to reduce, it explains what proposition it failed for, and it shows the reduced `Decidable` instance rather than the `Decidable.decide` expression, which tends to be less useful since it shows the unreduced `Decidable` argument (plus it's a lot longer!) Examples: ```lean example : 1 ≠ 1 := by decide /- tactic 'decide' proved that the proposition 1 ≠ 1 is false -/ opaque unknownProp : Prop open scoped Classical in example : unknownProp := by decide /- tactic 'decide' failed for proposition unknownProp since its 'Decidable' instance did not reduce to the 'isTrue' constructor: Classical.choice ⋯ -/ ``` In the future, it would be useful if `decide` would locate and report what `Decidable` instance inside the reported term is not being fully reduced.
9372c34
to
4224d41
Compare
Rebased |
The
decide
tactic produces error messages that users find to be obscure. Now:Decidable
instance reduces toisFalse
, it reports thatdecide
failed because the proposition is false.Decidable
instance fails to reduce, it explains what proposition it failed for, and it shows the reducedDecidable
instance rather than theDecidable.decide
expression. That expression tends to be less useful since it shows the unreducedDecidable
argument (plus it's a lot longer!)Examples:
When reporting the error,
decide
only shows the whnf of theDecidable
instance. In the future we could consider having it reduce all decidable instances present in the term, which can help with determining the cause of failure (this was explored in 8cede58).