Skip to content

feat: stricter meta check for temporary programs in native_decide etc#13005

Merged
Kha merged 8 commits intoleanprover:masterfrom
Kha:push-nuxplkxuzlxk
Mar 20, 2026
Merged

feat: stricter meta check for temporary programs in native_decide etc#13005
Kha merged 8 commits intoleanprover:masterfrom
Kha:push-nuxplkxuzlxk

Conversation

@Kha
Copy link
Copy Markdown
Member

@Kha Kha commented Mar 20, 2026

This PR further enforces that all modules used in compile-time execution must be meta imported in preparation for enabling #10291

Breaking changes

Metaprograms that call compileDecl directly may now need to call markMeta first where appropriate, possibly based on the value of isMarkedMeta of existing decls. addAndCompile should be split into addDecl and compileDecl for this in order to insert the call in between.

@Kha Kha added awaiting-mathlib We should not merge this until we have a successful Mathlib build changelog-language Language features and metaprograms labels Mar 20, 2026
@Kha Kha changed the base branch from master to nightly-with-mathlib March 20, 2026 12:47
@Kha Kha force-pushed the push-nuxplkxuzlxk branch from b1d291c to 2df5208 Compare March 20, 2026 12:47
@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 Mar 20, 2026
@leanprover-bot
Copy link
Copy Markdown
Collaborator

leanprover-bot commented Mar 20, 2026

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-03-18 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-03-20 13:41:25)
  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-03-19 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-03-20 14:53:14)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 511be304d72635f63d07d09c402322f84b626f5f --onto cfa8c5a036d6990635c6ec50b02d0e806995cec3. You can force reference manual CI using the force-manual-ci label. (2026-03-20 16:06:54)

mathlib-nightly-testing bot pushed a commit to leanprover-community/batteries that referenced this pull request Mar 20, 2026
@github-actions github-actions bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Mar 20, 2026
mathlib-nightly-testing bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Mar 20, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Mar 20, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

mathlib-lean-pr-testing bot commented Mar 20, 2026

  • 💥 Mathlib branch lean-pr-testing-13005 build failed against this PR. (2026-03-20 13:44:22) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 511be304d72635f63d07d09c402322f84b626f5f --onto 87180a09c49c91577e54284703c73c5ca76be126. You can force Mathlib CI using the force-mathlib-ci label. (2026-03-20 16:06:52)

mathlib-nightly-testing bot pushed a commit to leanprover-community/batteries that referenced this pull request Mar 20, 2026
mathlib-nightly-testing bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Mar 20, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

@Kha Kha changed the base branch from nightly-with-mathlib to master March 20, 2026 15:10
@Kha Kha changed the title [REBASED] feat: stricter meta check for temporary programs in native_decide etc. feat: stricter meta check for temporary programs in native_decide etc. Mar 20, 2026
@Kha Kha removed the awaiting-mathlib We should not merge this until we have a successful Mathlib build label Mar 20, 2026
@Kha Kha enabled auto-merge March 20, 2026 15:13
@Kha Kha changed the title feat: stricter meta check for temporary programs in native_decide etc. feat: stricter meta check for temporary programs in native_decide etc Mar 20, 2026
@Kha Kha added this pull request to the merge queue Mar 20, 2026
@mathlib-lean-pr-testing mathlib-lean-pr-testing bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Mar 20, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

Merged via the queue into leanprover:master with commit 6f98a76 Mar 20, 2026
28 of 29 checks passed
@Kha Kha deleted the push-nuxplkxuzlxk branch March 21, 2026 11:56
kim-em added a commit that referenced this pull request Apr 8, 2026
This PR fixes `include_str` failing with "Invalid `meta` definition `_tmp✝`,
`System.FilePath.mk` is not accessible here" since stricter meta checks were
introduced in #13005. The builtin `include_str` elaborator uses `evalTerm` to
evaluate file path expressions, which internally constructs `System.FilePath`
values. Since #13005 enforces meta accessibility for all constants referenced
by compile-time evaluated definitions, `System.FilePath.mk` needs to be
meta-accessible, requiring users to add `public meta import Init.System.FilePath`.

The fix adds a `checkMeta` parameter to `evalTerm` (threading through to
`evalExprCore`) so that builtin elaborators can opt out of meta checking
when evaluating internal helper expressions. When `checkMeta := false`:
- The temporary evaluation definition is not marked as meta
- The compiler's meta check is fully disabled (not just relaxed)
- The runtime meta check in `evalConst` is skipped

Closes #13310

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN 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.

2 participants