Skip to content

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

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

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) <[email protected]>
@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) <[email protected]>
@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
nomeata pushed a commit to leanprover/lean-kernel-arena that referenced this pull request Nov 22, 2026
Bumps the `lean4lean` checker from `bce3448` (Lean v4.33.0-rc2) to
`932afa1` (Lean v4.36.0), the tip of lean4lean's `arena` branch.

This takes in lean4lean's ports of the kernel changes from v4.33.0
through v4.36.0, including:
- a fix to the inductive adder, which now reads every constructor field
from a single normalization (the issue fixed upstream in
leanprover/lean4#14806). At `bce3448`, lean4lean could be made to accept
a recursor missing an inductive hypothesis, and from that a proof of
`False`.
- bounds on the size of `Nat` literals and on the results of `Nat`
operations (leanprover/lean4#14849).
- removal of native reduction (leanprover/lean4#14953) and of
`etaExpand` (leanprover/lean4#15268).

The old rev stays reachable on lean4lean's `arena-v4.33.0-rc2` branch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to argumentcomputer/lean4lean that referenced this pull request Nov 23, 2026
Port of leanprover/lean4#14953, which removes `Lean.reduceBool`,
`Lean.reduceNat`, `Lean.ofReduceBool`, `Lean.ofReduceNat` and
`Lean.trustCompiler`, together with the kernel's support for reducing
applications of the first two by running the compiler. They had been
deprecated since 2026-02-01; `native_decide` and `bv_decide` assert native
evaluations with axioms instead.

Lean4lean never ran native code: `reduceNative` only recognized the two
applications and threw, which was the first entry in `divergences.md`. It is
removed, with its calls in `whnf` and `lazyDeltaReduction` and its proof
obligations in `whnf.WF` and `lazyDeltaReduction.WF`. On an environment that
still has them, `reduceBool c` and `reduceNat c` are applications of opaque
constants, stuck like any other, so a proof relying on them is rejected as
before, by a failed definitional equality instead of the dedicated error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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