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

perf: globally cache intermediate type class results #4152

Closed
wants to merge 101 commits into from

Conversation

JovanGerb
Copy link
Contributor

See Zulip discussion here

This is a PR to determine whether this idea indeed results in faster type class search.

@JovanGerb JovanGerb marked this pull request as draft May 13, 2024 16:06
@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 May 13, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented May 13, 2024

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase a17c3f424cb5f2390e645d8a2cf84e69a1b96a37 --onto 7db8e6482e1dc46fd1070b3bf549112f02a4c05e. (2024-05-13 16:25:08)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase f3538dbdfa5595e361141986fc35daf23e225832 --onto 91244b2dd9d223006227648659203373f5a46b0b. (2024-05-14 22:02:27)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase f3538dbdfa5595e361141986fc35daf23e225832 --onto 3035d2f8f689b52963f49b2414414913ca296953. (2024-05-15 11:47:15)
  • 💥 Mathlib branch lean-pr-testing-4152 build failed against this PR. (2024-05-16 01:18:24) View Log
  • 💥 Mathlib branch lean-pr-testing-4152 build failed against this PR. (2024-05-17 03:36:36) View Log
  • ❌ Mathlib branch lean-pr-testing-4152 built against this PR, but testing failed. (2024-05-21 03:28:12) View Log
  • ❌ Mathlib branch lean-pr-testing-4152 built against this PR, but testing failed. (2024-05-21 16:22:50) View Log
  • 💥 Mathlib branch lean-pr-testing-4152 build failed against this PR. (2024-05-21 22:46:48) View Log
  • 💥 Mathlib branch lean-pr-testing-4152 build failed against this PR. (2024-05-22 00:35:13) View Log
  • ❌ Mathlib branch lean-pr-testing-4152 built against this PR, but testing failed. (2024-05-22 03:22:06) View Log
  • ❌ Mathlib branch lean-pr-testing-4152 built against this PR, but testing failed. (2024-05-22 13:33:04) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase f97a7d4234bd76bc0f61e43b8c6a78117c1376df --onto ff37e5d512efcd3981290270a2fc3ecb100bbd0c. (2024-05-22 19:51:59)
  • 🟡 Mathlib branch lean-pr-testing-4152 build this PR didn't complete normally. (2024-05-22 20:27:40) View Log
  • 💥 Mathlib branch lean-pr-testing-4152 build failed against this PR. (2024-05-23 17:33:01) View Log
  • 💥 Mathlib branch lean-pr-testing-4152 build failed against this PR. (2024-05-23 18:38:54) View Log

@JovanGerb
Copy link
Contributor Author

Can anyone explain why the output on two of the tests doesn't match the expectation? These tests have nothing to do with type classes...

@nomeata
Copy link
Collaborator

nomeata commented May 13, 2024

For the reader’s convenience, the errors are

[00:11 (00.000835)] lean-test-stage1> --- 1616.lean.expected.out    1970-01-01 00:00:01.000000000 +0000
[00:11 (00.000537)] lean-test-stage1> +++ 1616.lean.produced.out    2024-05-13 16:12:18.608808504 +0000
[00:11 (00.000532)] lean-test-stage1> @@ -2,6 +2,16 @@
[00:11 (00.000473)] lean-test-stage1>    @Linear ?m ?m (?m :: ?m) (?m :: ?m) c.right
[00:11 (00.004419)] lean-test-stage1>  context:
[00:11 (00.000027)] lean-test-stage1>  c : Cover ?m ?m ?m
[00:11 (00.000011)] lean-test-stage1> +⊢ List ?m
…

and

 [00:46 (00.000798)] lean-test-stage1> --- omega-failure.lean.expected.out   1970-01-01 00:00:01.000000000 +0000
[00:46 (00.000555)] lean-test-stage1> +++ omega-failure.lean.produced.out   2024-05-13 16:12:52.997271237 +0000
[00:46 (00.000522)] lean-test-stage1> @@ -57,8 +57,8 @@
[00:46 (00.000507)] lean-test-stage1>    d_1 ≥ 0
[00:46 (00.000434)] lean-test-stage1>    u ≥ 0
[00:46 (00.000424)] lean-test-stage1>    t ≥ 0
[00:46 (00.000669)] lean-test-stage1> -  w ≥ 0
[00:46 (00.000428)] lean-test-stage1>    q + r + s + t + u + v + w + x + y + z + a_1 + b_1 + c_1 + d_1 + e_1 ≥ 100
[00:46 (00.000516)] lean-test-stage1> +  w ≥ 0
[00:46 (00.000425)] lean-test-stage1>    r ≥ 0
[00:46 (00.000420)] lean-test-stage1>    y ≥ 0

No idea, though :-)

JovanGerb and others added 27 commits May 22, 2024 21:50
…r#4200)

This PR extracts `msb_eq_false_iff_two_mul_lt` and
`msb_eq_true_iff_two_mul_ge` from leanprover#4179, and uses them to prove a
theorem that characterizes `BitVec.toInt` in terms of `BitVec.msb`. This
lemma will be useful to prove a bit-blasting theorem for `BitVec.slt`
and `BitVec.sle`.

Also cleans up an existing proof (`toInt_eq_toNat_cond `), which turns
out to be provable by `rfl`.

---------

Co-authored-by: Kim Morrison <[email protected]>
…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]>
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.

6 participants