Skip to content

feat: remove deprecated in-kernel native reduction - #14953

Merged
Kha merged 2 commits into
masterfrom
push-oznsxrytpzso
Aug 28, 2026
Merged

feat: remove deprecated in-kernel native reduction#14953
Kha merged 2 commits into
masterfrom
push-oznsxrytpzso

Conversation

@Kha

@Kha Kha commented Aug 28, 2026

Copy link
Copy Markdown
Member

This PR removes Lean.reduceBool, Lean.reduceNat, Lean.ofReduceBool, Lean.ofReduceNat and Lean.trustCompiler, along with the kernel's support for reducing applications of the first two by running the compiler. They have been deprecated since 2026-02-01 in favour of asserting native evaluations with axioms, which is what native_decide and bv_decide already do through Lean.Meta.nativeEqTrue. Nothing in the toolchain used them any more.

Removing the axioms makes #print axioms, and the upcoming lake check, mean what it says for the whole environment. Lean.trustCompiler was referenced unconditionally from the bodies of reduceBool and reduceNat so that it would be reported for anything reducing through them, which left it looking used in every environment that merely imported them.

This PR removes `Lean.reduceBool`, `Lean.reduceNat`, `Lean.ofReduceBool`, `Lean.ofReduceNat` and `Lean.trustCompiler`, along with the kernel's support for reducing applications of the first two by running the compiler. They have been deprecated since 2026-02-01 in favour of asserting native evaluations with axioms, which is what `native_decide` and `bv_decide` already do through `Lean.Meta.nativeEqTrue`. Nothing in the toolchain used them any more.

`Lean.Meta.reduceNative?`, `Lean.Meta.reduceBoolNative`, `Lean.Meta.reduceNatNative` and `Lean.Meta.isDefEqNative` go with them, since they exist only to reduce those two constants. Downstream callers of `reduceNative?` should drop the call: with the constants gone it could only ever return `none`.

`test_extern` wrapped its comparison in `Lean.reduceBool` before handing it to `evalExpr`, where the wrapper was the identity; it now evaluates the decision directly.

Removing the axioms also makes `#print axioms` mean what it says for the whole environment. `Lean.trustCompiler` was referenced unconditionally from the bodies of `reduceBool` and `reduceNat` so that it would be reported for anything reducing through them, which left it looking used in every environment that merely imported them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Kha
Kha requested a review from nomeata August 28, 2026 13:08
@Kha
Kha requested a review from leodemoura as a code owner August 28, 2026 13:08
@Kha Kha added the changelog-library Library label Aug 28, 2026
This PR removes `run_boxed_kernel` and `elab_environment_of_kernel_env`, which existed only so the kernel could run a compiled declaration while reducing `Lean.reduceBool` and `Lean.reduceNat`. With in-kernel native reduction gone, they have no callers, and `src/kernel/` no longer refers to the interpreter or to `ir` at all. `Environment.ofKernelEnv` loses its `@[export]` with them; the function itself stays, since `Lean.Message` and `Lean.Replay` use it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN labels Aug 28, 2026
@leanprover-bot leanprover-bot added the breaks-manual This is not necessarily a blocker for merging, but there needs to be a plan. label Aug 28, 2026
@leanprover-bot

leanprover-bot commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

@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 Aug 28, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Aug 28, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

@Kha Kha added the downstream Request a downstream-lean4 adaptation PR. label Aug 28, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Aug 28, 2026
@downstream-lean4

Copy link
Copy Markdown

The adaptation PR for this PR is leanprover/downstream-lean4#27.

mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Aug 28, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Aug 28, 2026
@Kha
Kha added this pull request to the merge queue Aug 28, 2026
Merged via the queue into master with commit 2a7175c Aug 28, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-manual This is not necessarily a blocker for merging, but there needs to be a plan. breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan changelog-library Library downstream Request a downstream-lean4 adaptation PR. 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.

3 participants