Merged
Conversation
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 10, 2024
|
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 10, 2024
Collaborator
|
I've added Next steps when that is ready:
|
kim-em
added a commit
to leanprover-community/ProofWidgets4
that referenced
this pull request
Jan 11, 2024
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 11, 2024
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 12, 2024
Kha
requested changes
Jan 19, 2024
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 19, 2024
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 19, 2024
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 19, 2024
Kha
approved these changes
Jan 22, 2024
mhuisi
added a commit
to mhuisi/lean4
that referenced
this pull request
Jan 22, 2024
kim-em
added a commit
to leanprover-community/batteries
that referenced
this pull request
Jan 23, 2024
kim-em
added a commit
to leanprover-community/batteries
that referenced
this pull request
Jan 23, 2024
antonkov
added a commit
to Paper-Proof/paperproof
that referenced
this pull request
Jan 25, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 25, 2024
This PR adds support for the "call hierarchy" feature of LSP that allows quickly navigating both inbound and outbound call sites of functions. In this PR, "call" is taken to mean "usage", so inbound and outbound references of all kinds of identifiers (e.g. functions or types) can be navigated. To implement the call hierarchy feature, this PR implements the LSP requests `textDocument/prepareCallHierarchy`, `callHierarchy/incomingCalls` and `callHierarchy/outgoingCalls`. <details> <summary>Showing the call hierarchy (click to show image)</summary>  </details> <details> <summary>Incoming calls (click to show image)</summary>  </details> <details> <summary>Outgoing calls (click to show image)</summary>  </details> It is based on #3159, which should be merged before this PR. To route the parent declaration name through to the language server, the `.ilean` format is adjusted, breaking backwards compatibility with version 1 of the ILean format and yielding version 2. This PR also makes the following more minor adjustments: - `Lean.Server.findModuleRefs` now also combines the identifiers of constants and FVars and prefers constant over FVars for the combined identifier. This is necessary because e.g. declarations declared using `where` yield both a constant (for usage outside of the function) and an FVar (for usage inside of the function) with the same range, whereas we would typically like all references to refer to the former. This also fixes a bug introduced in #2462 where renaming a declaration declared using `where` would not rename usages outside of the function, as well as a bug in the unused variable linter where `where` declarations would be reported as unused even if they were being used outside of the function. - The function converting `Lean.Server.RefInfo` to `Lean.Lsp.RefInfo` now also computes the `Lean.DeclarationRanges` for parent declaration names via `MetaM` and must hence be in `IO` now. - Add a utility function `Array.groupByKey` to `HashMap.lean`. - Stylistic refactoring of `Watchdog.lean` and `LanguageFeatures.lean`.
kim-em
added a commit
to leanprover-community/batteries
that referenced
this pull request
Feb 1, 2024
* feat: hover info for `rcases h : ...` (#486) * feat: hover info for `rcases h : ...` * fix * chore: adaptations for leanprover/lean4#3123 (#502) * chore: adaptations for leanprover/lean4#3123 * update toolchain * chore: remove unnecessary `have` (#516) After leanprover/lean4#3132 the linter will complain about this. * chore: simproc PR changes (#496) See leanprover/lean4#3124 Co-authored-by: Scott Morrison <scott.morrison@gmail.com> * chore: adaptions for nightly-2023-01-11 (#524) * advance toolchain to nightly-2024-01-12, no updates required * chore: updates to DiscrTree for changes in nightly (#536) * doc: extend docstrings for `ext` and `ext1` (#525) Makes sure to mention that the patterns are processed using `rintro`, and makes sure `ext` mentions `ext1`. * docs(Data/List): typo (#529) * feat: Eq.rec lemma (#385) * chore: Add empty collection instance to BinomialHeap (#532) * Incremental Library Search (#421) This ports library_search from Mathlib to Std. It preserves the ability to do caching, but is designed to support a cacheless mode. The exact and apply tactics are named `std_exact?` and `std_apply?`, but will eventually be renamed. Co-authored-by: Scott Morrison <scott.morrison@gmail.com> * fix termination_by clauses in LazyDiscrTree fix LibrarySearch * bump toolchain --------- Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz> Co-authored-by: François G. Dorais <fgdorais@gmail.com> Co-authored-by: Joe Hendrix <joe@lean-fro.org> * feat: adaptations for leanprover/lean4#3159 (#557) * merge origin/main * chore: fixes for `simp` refactor (#571) * move to v4.6.0-rc1 * fix proofs --------- Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Leonardo de Moura <leonardo@microsoft.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz> Co-authored-by: François G. Dorais <fgdorais@gmail.com> Co-authored-by: Joe Hendrix <joe@lean-fro.org>
fgdorais
added a commit
to fgdorais/batteries
that referenced
this pull request
Feb 18, 2024
) * feat: hover info for `rcases h : ...` (leanprover-community#486) * feat: hover info for `rcases h : ...` * fix * chore: adaptations for leanprover/lean4#3123 (leanprover-community#502) * chore: adaptations for leanprover/lean4#3123 * update toolchain * chore: remove unnecessary `have` (leanprover-community#516) After leanprover/lean4#3132 the linter will complain about this. * chore: simproc PR changes (leanprover-community#496) See leanprover/lean4#3124 Co-authored-by: Scott Morrison <scott.morrison@gmail.com> * chore: adaptions for nightly-2023-01-11 (leanprover-community#524) * advance toolchain to nightly-2024-01-12, no updates required * chore: updates to DiscrTree for changes in nightly (leanprover-community#536) * doc: extend docstrings for `ext` and `ext1` (leanprover-community#525) Makes sure to mention that the patterns are processed using `rintro`, and makes sure `ext` mentions `ext1`. * docs(Data/List): typo (leanprover-community#529) * feat: Eq.rec lemma (leanprover-community#385) * chore: Add empty collection instance to BinomialHeap (leanprover-community#532) * Incremental Library Search (leanprover-community#421) This ports library_search from Mathlib to Std. It preserves the ability to do caching, but is designed to support a cacheless mode. The exact and apply tactics are named `std_exact?` and `std_apply?`, but will eventually be renamed. Co-authored-by: Scott Morrison <scott.morrison@gmail.com> * fix termination_by clauses in LazyDiscrTree fix LibrarySearch * bump toolchain --------- Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz> Co-authored-by: François G. Dorais <fgdorais@gmail.com> Co-authored-by: Joe Hendrix <joe@lean-fro.org> * feat: adaptations for leanprover/lean4#3159 (leanprover-community#557) * merge origin/main * chore: fixes for `simp` refactor (leanprover-community#571) * move to v4.6.0-rc1 * fix proofs --------- Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Leonardo de Moura <leonardo@microsoft.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Martin Dvořák <martin.dvorak@matfyz.cz> Co-authored-by: François G. Dorais <fgdorais@gmail.com> Co-authored-by: Joe Hendrix <joe@lean-fro.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR facilitates augmenting the context of an
InfoTreewith partial contexts while elaborating a command. Using partial contexts, this PR also adds support for tracking the parent declaration name of a term in theInfoTree. The parent declaration name is needed to compute the call hierarchy in #3082.Specifically, the
Lean.Elab.InfoTree.contextconstructor is refactored to take a value of the new typeLean.Elab.PartialContextInfoinstead of aLean.Elab.ContextInfo, which now refers to a fullInfoTreecontext. ThePartialContextInfois then merged into aContextInfowhile traversing the tree usingLean.Elab.PartialContextInfo.mergeIntoOuter?. The partial context after executingliftTermElabMis stored in values of a new typeLean.Elab.CommandContextInfo.As a result of this,
Lean.Elab.ContextInfo.savemoves toLean.Elab.CommandContextInfo.save.For obtaining the parent declaration for a term, a new typeclass
MonadParentDeclis introduced to save the parent declaration inLean.Elab.withSaveParentDeclInfoContext.Lean.Elab.Term.withDeclName xnow callswithSaveParentDeclInfoContext xto save the declaration name.Migration
The changes to the
InfoTree.contextconstructor break backwards compatibility with all downstream users that traverse theInfoTreemanually instead of going through the functions inInfoUtils.lean.To fix this, you can merge the outer
ContextInfoin a traversal with thePartialContextInfoof anInfoTree.contextnode usingPartialContextInfo.mergeIntoOuter?. See e.g.Lean.Elab.InfoTree.foldInfofor an example:Downstream users that manually save
InfoTrees may need to adjust calls toContextInfo.saveto useCommandContextInfo.saveinstead and potentially wrap theirCommandContextInfoin aPartialContextInfo.commandCtxconstructor when storing it in anInfoTreeorContextInfo.mkwhen creating a full context.Motivation
As of now,
ContextInfos are always full contexts, constructed as if they were always created inliftTermElabMafter running theTermElabMaction. This is not strictly true; we already createContextInfos in several places other thanliftTermElabMand work around the limitation thatContextInfos are always full contexts in certain places (e.g.Info.updateContext?is a crux that we need because we can't always create partial contexts at the term-level), but it has mostly worked out so far. Note that one must be very careful when saving aContextInfoin places other thanliftTermElabMbecause the context may not be as complete as we would like (e.g. it may lack meta-variable assignments, potentially leading to a language server panic).Unfortunately, the parent declaration of a term is another example of a context that cannot be provided in
liftTermElabM: The parent declaration is usually set viawithDeclName, which itself lives inTermElabM. So by the time we are trying to save the fullContextInfo, the declaration name is already gone. There is no easy fix for this like in the other cases where we would really just like to augment the context with an extra field.The refactor that we decided on to resolve the issue is to refactor the
InfoTreeto take aPartialContextInfoinstead of aContextInfoand have code that traverses theInfoTreemerge inner contexts with outer contexts to produce a fullContextInfovalue.Bumps for downstream projects
lean-pr-testing-3159branch at Std, not yet opened as a PRlean-pr-testing-3159branch at Mathlib, not yet opened as a PR