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. That expression 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 reduced to Classical.choice ⋯ rather than to the 'isTrue' constructor. -/ ``` When reporting the error, `decide` only shows the whnf of the `Decidable` 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 8cede580690faa5ce18683f168838b08b372bacb).
8 lines
298 B
Text
8 lines
298 B
Text
decideTactic.lean:13:22-13:28: error: tactic 'decide' proved that the proposition
|
|
1 ≠ 1
|
|
is false
|
|
decideTactic.lean:21:28-21:34: error: tactic 'decide' failed for proposition
|
|
unknownProp
|
|
since its 'Decidable' instance reduced to
|
|
Classical.choice ⋯
|
|
rather than to the 'isTrue' constructor.
|