Skip to content

Incremental tactics leading to errors disappearing in proof #4623

Closed

Description

@ymherklotz

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

With incremental tactic evaluation, error reporting seems to have become brittle. There are situations where one thinks no errors are being reported, but one is able to prove anything using invalid tactics, because errors are not being reported for that line.

Even when one fixes the error, because the tactics are incremental they don't display errors until one actually modified tactics above them. If one only modifies tactics below, one can get very random behaviour where tactics should fail but seem to solve goals instead.

Context

We were working in a fairly large proof and kept non-deterministically getting into situations where Lean wouldn't report errors any more, and would seem to solve goals when it shouldn't, because we had a malformed statement very low down in the proof. Even after fixing that, we still got erratic behaviour until we finally restarted lean a few times and fixing errors that arose incrementally with every restart.

Steps to Reproduce

Live coding environment of the bug

  1. Open up the live coding environment above with a lemma from the builtin List library, with an invalid focus at the end that swallows other errors in the file. Observe that lines 25 and 22 do not report errors.
  2. Comment line 28: see no other error appear except that the lemma now states it uses sorry for the definition.
  3. Observe that line 25 and line 22 still do not report errors. Also observe that after putting the cursor on line 25, it seems like the invalid exact tactic is solving the goal.
  4. Press enter on line 22 to make the errors come back on line 22 (and now line 26).
  5. Press enter on line 27 (after the simp) and see the error on line 22 disappear again.

Expected behavior: Errors should always be displayed and should not disappear after making edits. Invalid tactics should also not appear to be modifying the goal (and look like they're solving it).

Actual behavior: Errors disappear when making edits throughout a file, and invalid tactics may seem like they are solving a goal even though they are actually encountering an error.

Versions

5.11.0-nightly-2024-07-01

Additional Information

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Activity

  1. added
    bug
    on Jul 2, 2024
  2. Kha commented on Jul 2, 2024

    @Kha
    Member

    Thank you for the detailed report. I can reproduce step 4 but not 1 in the sandbox.
    Recording 2024-07-02 at 13 55 30

  3. ymherklotz commented on Jul 2, 2024

    @ymherklotz
    ContributorAuthor

    Indeed, thanks for trying to reproduce it. I didn't know that this actually worked if you comment close to the .. If you try and comment the line by putting the cursor at the very start of the line 28, instead of glued to the ., then it should be possible to reproduce step 1 too. It does for me in the sandbox.

  4. added a commit that references this issue on Jul 8, 2024
    4d2f2d7
  5. added 4 commits that reference this issue on Jul 9, 2024
    f2e4dbd
    800fdcf
    400ef29
    702c31b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions