Skip to content

Incremental Library Search#421

Merged
joehendrix merged 52 commits intomainfrom
library_search
Jan 16, 2024
Merged

Incremental Library Search#421
joehendrix merged 52 commits intomainfrom
library_search

Conversation

@joehendrix
Copy link
Copy Markdown
Contributor

@joehendrix joehendrix commented Dec 6, 2023

This is a large PR that builds upon #343 to rename the Mathlib specific cache path and improve performance of library initialization when used without a cache. It does this primarily by introducing a lazy discriminator tree that defers population of tree branches from initialization to first lookup.

Testing on OSX is currently showing that initializing the tree using Mathlib takes under 2 seconds and a simply query adds an additional 2-3 seconds. It would be good to get additional information more machines (particularly Windows), but I think the timings are low enough that most users will not need caching.

@digama0
Copy link
Copy Markdown
Member

digama0 commented Dec 7, 2023

the cacheless approach has the advantage that it only selects candidates in the current environment

I'm not sure I would call that an advantage necessarily. For a search tool it is useful to be made aware of theorems from files you haven't imported.

@joehendrix joehendrix added the depends on another PR This is stacked on top of another Batteries PR. label Dec 7, 2023
@joehendrix
Copy link
Copy Markdown
Contributor Author

the cacheless approach has the advantage that it only selects candidates in the current environment

I'm not sure I would call that an advantage necessarily. For a search tool it is useful to be made aware of theorems from files you haven't imported.

That's a good point that may impact operations other than exact? and apply?. I've made a Zulip thread since there might be more discussion on this and other changes.

@joehendrix joehendrix mentioned this pull request Dec 7, 2023
@joehendrix joehendrix force-pushed the library_search branch 2 times, most recently from 5f9ef7e to fb81ec9 Compare December 7, 2023 20:04
@joehendrix joehendrix added the WIP work in progress label Dec 8, 2023
@ghost ghost added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label Dec 15, 2023
@ghost ghost removed the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label Jan 3, 2024
@joehendrix joehendrix force-pushed the library_search branch 2 times, most recently from ad49d69 to c0dc9ff Compare January 3, 2024 02:35
@ghost ghost added the merge-conflict This PR has merge conflicts with the `main` branch which must be resolved by the author. label Jan 4, 2024
@joehendrix joehendrix removed the depends on another PR This is stacked on top of another Batteries PR. label Jan 4, 2024
Joe Hendrix and others added 2 commits January 11, 2024 23:38
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@kim-em
Copy link
Copy Markdown
Collaborator

kim-em commented Jan 12, 2024

I think that's pretty much the last round of comments from me on this; I'm otherwise happy!

Joe Hendrix and others added 3 commits January 12, 2024 00:13
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Joe Hendrix and others added 6 commits January 12, 2024 14:47
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@joehendrix joehendrix added will-merge-soon PR will be merged soon. Any concerns should be raised quickly. and removed awaiting-review This PR is ready for review; the author thinks it is ready to be merged. labels Jan 15, 2024
@joehendrix joehendrix merged commit 1d85fd7 into main Jan 16, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Jan 16, 2024
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Jan 17, 2024
This brings the new implementation of `library_search` to Mathlib. It is temporarily called `std_exact?` and `std_apply?`, but if it tests okay in Mathlib we will remove the old implementation.

There is some change in the ordering of results, so please report on your experiences!



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
digama0 pushed a commit that referenced this pull request Jan 17, 2024
* 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>
@joehendrix joehendrix deleted the library_search branch January 26, 2024 00:18
kim-em added a commit 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 pushed a commit to fgdorais/batteries that referenced this pull request Feb 18, 2024
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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

will-merge-soon PR will be merged soon. Any concerns should be raised quickly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants