Skip to content

Conversation

@Kha
Copy link
Member

@Kha Kha commented Jun 6, 2025

This PR extends the experimental module system with a phase distinction between meta and regular declarations. This distinction will be used in follow-up PRs to avoid importing IR that is not needed for compile-time execution.

The phase distinction system deliberately is the weakest one to implement this goal:

  • meta declarations may use any local declaration, imported meta declarations, and any meta imported declarations.
  • non-meta declarations may use a non-meta declaration reachable only through non-meta imports.

Thus it is allowed and can be necessary to import the same module into both the meta and regular phase via two separate import statements. meta import is transitive in the sense that importing a meta import is the same as writing the meta import inline.

Based on #8653

@Kha Kha requested a review from nomeata June 6, 2025 14:46
@Kha Kha requested review from kim-em, leodemoura and zwarich as code owners June 6, 2025 14:46
@Kha Kha force-pushed the push-ntxkqmszrtul branch 2 times, most recently from 33e3215 to 5a360d7 Compare June 6, 2025 15:14
@Kha Kha changed the base branch from master to nightly-with-mathlib June 6, 2025 15:24
@Kha Kha added the changelog-language Language features and metaprograms label Jun 6, 2025
@Kha Kha closed this Jun 6, 2025
@Kha Kha reopened this Jun 6, 2025
@Kha Kha mentioned this pull request Jun 6, 2025
@Kha Kha force-pushed the push-ntxkqmszrtul branch 2 times, most recently from dcfc9a1 to 8c096fb Compare June 7, 2025 11:12
@Kha Kha requested review from TwoFX, hargoniX, mhuisi and tydeu as code owners June 7, 2025 11:12
@Kha Kha changed the base branch from nightly-with-mathlib to master June 7, 2025 11:34
@Kha Kha force-pushed the push-ntxkqmszrtul branch 2 times, most recently from 900e277 to 88ee8dd Compare June 7, 2025 12:28
@Kha Kha force-pushed the push-ntxkqmszrtul branch from 88ee8dd to b32e48b Compare June 7, 2025 15:10
@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 Jun 7, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Jun 7, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase d46188de54f86c64cef85aaba800f4171ccffcd5 --onto 9b9dd8546a123d746580649b239f26c26d370d20. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-07 15:35:55)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 54c12df9509d639ad78fb1343b13c60370a9481d --onto 0a9c24649767dea857a388e5385b7ae94bfd0185. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-11 14:32:30)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 0002ea8a3702a0c2191b03e1274aefc05b53ca8c --onto 0a9c24649767dea857a388e5385b7ae94bfd0185. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-11 15:54:54)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase d10a85539a911ea2b76eb91b0d47957c35d22587 --onto 0a9c24649767dea857a388e5385b7ae94bfd0185. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-12 13:32:08)

@Kha
Copy link
Member Author

Kha commented Jun 8, 2025

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit b32e48b.
There were significant changes against commit d46188d:

  Benchmark                            Metric          Change
  =====================================================================
+ Init.Data.BitVec.Lemmas re-elab      branch-misses    -1.6% (-34.3 σ)
- Init.Data.List.Sublist re-elab -j4   task-clock        1.3%  (27.3 σ)
- Init.Data.List.Sublist re-elab -j4   wall-clock        2.0% (105.4 σ)
+ workspaceSymbols                     task-clock       -3.3% (-48.7 σ)
+ workspaceSymbols                     wall-clock       -3.3% (-51.4 σ)

@Kha Kha force-pushed the push-ntxkqmszrtul branch 3 times, most recently from bc602e3 to 9f5e6e0 Compare June 11, 2025 13:55
@Kha
Copy link
Member Author

Kha commented Jun 11, 2025

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 9f5e6e0.
There were significant changes against commit 54c12df:

  Benchmark                            Metric       Change
  ==================================================================
- Init.Data.List.Sublist re-elab -j4   branches       1.2%  (20.3 σ)
+ stdlib                               wall-clock    -1.0% (-37.4 σ)

@Kha Kha force-pushed the push-ntxkqmszrtul branch 2 times, most recently from e1b047d to 350909b Compare June 11, 2025 16:44
@Kha Kha added this pull request to the merge queue Jun 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 11, 2025
@Kha Kha force-pushed the push-ntxkqmszrtul branch from 350909b to 2829d3a Compare June 12, 2025 11:40
@Kha Kha enabled auto-merge June 12, 2025 11:46
@Kha Kha force-pushed the push-ntxkqmszrtul branch from 2829d3a to 362f20a Compare June 12, 2025 12:15
@Kha Kha force-pushed the push-ntxkqmszrtul branch from 362f20a to a679b1d Compare June 12, 2025 12:59
@Kha Kha disabled auto-merge June 12, 2025 13:20
@nomeata nomeata merged commit 7026424 into leanprover:master Jun 12, 2025
15 checks passed
@Kha Kha deleted the push-ntxkqmszrtul branch June 12, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms 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.

4 participants