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

feat: incremental elaboration of definition headers, bodies, and tactics #3940

Merged
merged 60 commits into from
May 22, 2024

Conversation

Kha
Copy link
Member

@Kha Kha commented Apr 18, 2024

Extends Lean's incremental reporting and reuse between commands into various steps inside declarations:

  • headers and bodies of each (mutual) definition/theorem
  • theorem ... := by for each contained tactic step, including recursively inside supported combinators currently consisting of
    • · (cdot), case, next
    • induction, cases
    • macros such as next unfolding to the above

Recording 2024-05-10 at 11 07 32

Incremental reuse means not recomputing any such steps if they are not affected by a document change. Incremental reporting includes the parts seen in the recording above: the progress bar and messages. Other language server features such as hover etc. are not yet supported incrementally, i.e. they are shown only when the declaration has been fully processed as before.

@Kha
Copy link
Member Author

Kha commented Apr 18, 2024

#3636 was accidentally closed without merging

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Apr 18, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Apr 18, 2024

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase df1e6ba7fefdce90f8c655cb2c1bf5ea8640d1a5 --onto d3e004932c1f5ac3946850692940512d381c7634. (2024-04-18 09:41:27)
  • ❌ Mathlib branch lean-pr-testing-3940 built against this PR, but linting failed. (2024-04-20 11:35:18) View Log
  • ❌ Mathlib branch lean-pr-testing-3940 built against this PR, but linting failed. (2024-04-20 11:55:51) View Log
  • ❌ Mathlib branch lean-pr-testing-3940 built against this PR, but linting failed. (2024-04-20 12:43:25) View Log
  • ❌ Mathlib branch lean-pr-testing-3940 built against this PR, but linting failed. (2024-04-25 12:11:49) View Log
  • 💥 Mathlib branch lean-pr-testing-3940 build failed against this PR. (2024-04-25 13:18:52) View Log
  • 💥 Mathlib branch lean-pr-testing-3940 build failed against this PR. (2024-04-26 13:20:58) View Log
  • ❗ Std CI can not be attempted yet, as the nightly-testing-2024-05-07 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Std CI should run now. (2024-05-07 10:25:31)
  • 💥 Mathlib branch lean-pr-testing-3940 build failed against this PR. (2024-05-08 15:26:50) View Log

src/Lean/Elab/MutualDef.lean Outdated Show resolved Hide resolved
@Kha Kha force-pushed the incr-tactic branch 3 times, most recently from 285aef6 to a50a2d0 Compare April 20, 2024 11:04
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Apr 20, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Apr 20, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Apr 20, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Apr 20, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Apr 20, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Apr 20, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Apr 20, 2024
@Kha Kha marked this pull request as ready for review April 22, 2024 07:28
@Kha Kha requested a review from semorrison as a code owner April 22, 2024 07:28
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc May 11, 2024 15:32 Inactive
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request May 11, 2024
apnelson1 pushed a commit to leanprover-community/mathlib4 that referenced this pull request May 12, 2024
Backward-compatible fixes for leanprover/lean4#3940. In particular, gets rid of two `open private` (out of six in all of Mathlib) which in my opinion really were not necessary and just invited breakage.

Somehow the unused variables and unnecessary `have` linters became *more* complete, which might be due to earlier mvar instantiation in `Elab.MutualDef` but I haven't investigated deeply.
callesonne pushed a commit to leanprover-community/mathlib4 that referenced this pull request May 16, 2024
Backward-compatible fixes for leanprover/lean4#3940. In particular, gets rid of two `open private` (out of six in all of Mathlib) which in my opinion really were not necessary and just invited breakage.

Somehow the unused variables and unnecessary `have` linters became *more* complete, which might be due to earlier mvar instantiation in `Elab.MutualDef` but I haven't investigated deeply.
@Kha Kha removed the full-ci label May 22, 2024
@Kha Kha changed the base branch from releases/v4.8.0 to master May 22, 2024 11:10
@Kha Kha marked this pull request as ready for review May 22, 2024 11:11
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request May 22, 2024
@Kha Kha enabled auto-merge May 22, 2024 12:19
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request May 22, 2024
@Kha Kha added this pull request to the merge queue May 22, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request May 22, 2024
Merged via the queue into leanprover:master with commit f97a7d4 May 22, 2024
12 checks passed
JovanGerb pushed a commit to JovanGerb/lean4 that referenced this pull request May 22, 2024
…ics (leanprover#3940)

Extends Lean's incremental reporting and reuse between commands into
various steps inside declarations:
* headers and bodies of each (mutual) definition/theorem
* `theorem ... := by` for each contained tactic step, including
recursively inside supported combinators currently consisting of
  * `·` (cdot), `case`, `next`
  * `induction`, `cases`
  * macros such as `next` unfolding to the above

![Recording 2024-05-10 at 11 07
32](https://github.com/leanprover/lean4/assets/109126/c9d67b6f-c131-4bc3-a0de-7d63eaf1bfc9)

*Incremental reuse* means not recomputing any such steps if they are not
affected by a document change. *Incremental reporting* includes the
parts seen in the recording above: the progress bar and messages. Other
language server features such as hover etc. are *not yet* supported
incrementally, i.e. they are shown only when the declaration has been
fully processed as before.

---------

Co-authored-by: Scott Morrison <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Jun 27, 2024
…es (#4569)

This appears to have been a semantic merge conflict between #3940 and
#4129. The effect on the language server is that if two edits are
sufficiently close in time to create an interrupt, some elaboration
steps like `simp` may accidentally catch the exception when it is
triggered during their execution, which makes incrementality assume that
elaboration of the body was successful, which can lead to incorrect
reuse, presenting the interrupted state to the user with symptoms such
as "uses sorry" without accompanying errors and incorrect lints.
github-actions bot pushed a commit that referenced this pull request Jun 27, 2024
…es (#4569)

This appears to have been a semantic merge conflict between #3940 and
#4129. The effect on the language server is that if two edits are
sufficiently close in time to create an interrupt, some elaboration
steps like `simp` may accidentally catch the exception when it is
triggered during their execution, which makes incrementality assume that
elaboration of the body was successful, which can lead to incorrect
reuse, presenting the interrupted state to the user with symptoms such
as "uses sorry" without accompanying errors and incorrect lints.

(cherry picked from commit f3cb8a6)
semorrison pushed a commit that referenced this pull request Jun 28, 2024
…es (#4569)

This appears to have been a semantic merge conflict between #3940 and
#4129. The effect on the language server is that if two edits are
sufficiently close in time to create an interrupt, some elaboration
steps like `simp` may accidentally catch the exception when it is
triggered during their execution, which makes incrementality assume that
elaboration of the body was successful, which can lead to incorrect
reuse, presenting the interrupted state to the user with symptoms such
as "uses sorry" without accompanying errors and incorrect lints.

(cherry picked from commit f3cb8a6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants