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

RFC: Show elaboration error of tactics even if a later tactic contains a parse error #6580

Open
fpvandoorn opened this issue Jan 8, 2025 · 1 comment
Labels
P-medium We may work on this issue if we find the time RFC accepted RFC is waiting for a corresponding PR (external or internal) RFC Request for comments

Comments

@fpvandoorn
Copy link
Contributor

fpvandoorn commented Jan 8, 2025

Proposal

This is a follow-up of #3556. For new users it can be confusing that parse errors in tactics will prevent any elaboration errors in previous tactics from showing.

Proposal if a tactic t raises a parse error, Lean should still execute other tactics and raise their errors using the same behavior as when t would have raised an execution error.

Example:

example /- 1 -/ : False := by
  apply True.intro -- error is shown

example /- 2 -/ : False := by
  apply True.intro -- no error
  simp [

example /- 3 -/ : False := by
  apply True.intro -- no error
  sim

example /- 4 -/ : False := by
  apply True.intro -- no error
  all_goals {

example /- 5 -/  : False := by
  · apply True.intro -- error is shown
    sim

example /- 6 -/ : False ∧ False := by
  constructor
  · apply True.intro  -- error is shown
    sim
  · apply True.intro -- no error

Example 1 raises an expected error, which is not shown in examples 2-4 because of parse errors in later tactics. Thee tactics should also raise elaboration errors for the apply tactic.
Interestingly, when indented with ·, the elaboration error is shown (example 5).
Example 6 is trickier: if there is only an elaboration error on branch 1, branch 2 still raises elaboration errors. If there is a parse error on branch 1, branch 2 is silent.
Ideally apply True.intro raises an error in all these examples.

  • User Experience: Should inform new users that their code contains errors more quickly.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

@fpvandoorn fpvandoorn added the RFC Request for comments label Jan 8, 2025
@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Jan 10, 2025
@Kha Kha added the RFC accepted RFC is waiting for a corresponding PR (external or internal) label Jan 10, 2025
@Kha
Copy link
Member

Kha commented Jan 10, 2025

RFC accepted! We should be able to reuse the infrastructure of #3556 for this but some new subtleties are bound to arise during that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-medium We may work on this issue if we find the time RFC accepted RFC is waiting for a corresponding PR (external or internal) RFC Request for comments
Projects
None yet
Development

No branches or pull requests

3 participants