This PR modifies `rewrite`/`rw` to abort rewriting if the elaborated lemma has any immediate elaboration errors (detected by presence of synthetic sorries). Rewriting still proceeds if there are elaboration issues arising from pending synthetic metavariables, like instance synthesis failures. The purpose of the change is to avoid obscure "tactic 'rewrite' failed, equality or iff proof expected ?m.5" errors when for example a lemma does not exist. This helps error reporting for the natural number game. https://leanprover.zulipchat.com/#narrow/channel/113489-new-members/topic/Why.20doesn't.20add_left_comm.20work.20here.3F/near/497060022
22 lines
395 B
Text
22 lines
395 B
Text
/-!
|
|
# Test for error reporting when `rw`/`rewrite` has an elaboration error
|
|
-/
|
|
|
|
/-!
|
|
Elaboration failures abort tactic evaluation.
|
|
Before, the second error was
|
|
```
|
|
error: tactic 'rewrite' failed, equality or iff proof expected
|
|
?m.5
|
|
⊢ True
|
|
```
|
|
-/
|
|
/--
|
|
error: unknown identifier 'not_a_theorem'
|
|
---
|
|
error: unsolved goals
|
|
⊢ True
|
|
-/
|
|
#guard_msgs in
|
|
example : True := by
|
|
rewrite [not_a_theorem]
|