This PR improves the error messages produced by the `decide_cbv` tactic by only reducing the left-hand side of the equality introduced by `of_decide_eq_true`, rather than attempting to reduce both sides via `cbvGoal`. Previously, `evalDecideCbv` called `cbvGoalCore` which would try to reduce both sides of `decide P = true` and leave a remaining goal on failure, resulting in a generic error showing the mvar ID. Now, a dedicated `cbvDecideGoal` function in `Cbv/Main.lean`: - closes the goal immediately when the LHS reduces to `Bool.true` - reports a clear error when the LHS reduces to `Bool.false`, telling the user the proposition is false - reports a clear error with the stuck expression when reduction cannot complete Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
22 lines
680 B
Text
22 lines
680 B
Text
-- Success: proposition reduces to `Bool.true`
|
|
example : 1 + 1 = 2 := by decide_cbv
|
|
|
|
example : 1 ∈ [1, 2, 3] := by decide_cbv
|
|
|
|
/-- error: `decide_cbv` failed: the proposition evaluates to `false` -/
|
|
#guard_msgs (error) in
|
|
example : 1 + 1 = 3 := by decide_cbv
|
|
|
|
opaque myOpaqueBool : Bool
|
|
|
|
/--
|
|
error: `decide_cbv` failed: could not reduce the expression to a boolean value; got stuck at: ⏎
|
|
Decidable.rec (fun h => false) (fun h => true)
|
|
(match myOpaqueBool, true with
|
|
| false, false => isTrue ⋯
|
|
| false, true => isFalse ⋯
|
|
| true, false => isFalse ⋯
|
|
| true, true => isTrue ⋯)
|
|
-/
|
|
#guard_msgs (error) in
|
|
example : myOpaqueBool = true := by decide_cbv
|