Skip to content

refactor: rename instance_reducible to implicit_reducible#12567

Merged
leodemoura merged 2 commits intomasterfrom
implicit_reducible
Feb 18, 2026
Merged

refactor: rename instance_reducible to implicit_reducible#12567
leodemoura merged 2 commits intomasterfrom
implicit_reducible

Conversation

@leodemoura
Copy link
Member

This PR renames instance_reducible to implicit_reducible and adds a new
backward.isDefEq.implicitBump option to prepare for treating all implicit
arguments uniformly during definitional equality checking.

Changes

Rename instance_reducibleimplicit_reducible:

  • Rename ReducibilityStatus.instanceReducible constructor to implicitReducible
  • Register new [implicit_reducible] attribute, keep [instance_reducible] as alias
  • Rename isInstanceReducibleisImplicitReducible (with deprecated aliases)
  • Update all references across src/ and tests/

The rename reflects that this reducibility level is used not just for instances
but for any definition that needs unfolding during implicit argument resolution
(e.g., Nat.add, Array.size).

Add backward.isDefEq.implicitBump option:

  • When true (+ respectTransparency), bumps transparency to .instances for
    ALL implicit arguments in isDefEqArgs, not just instance-implicit ones
  • Defaults to false for staging compatibility — will be flipped to true after
    stage0 update
  • Adds // update me! to stage0/src/stdlib_flags.h to trigger CI stage0 update

Follow-up (after stage0 update)

  • Flip backward.isDefEq.implicitBump default to true
  • Fix resulting test/module failures

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

leodemoura and others added 2 commits February 18, 2026 12:35
This PR renames the `ReducibilityStatus.instanceReducible` constructor to
`implicitReducible` and adds a new `[implicit_reducible]` attribute.
The old `[instance_reducible]` attribute is kept as an alias for backward
compatibility. The rename reflects the broader role of this transparency
level: it covers not just type class instances but any definition that
needs to be unfolded when checking implicit arguments (e.g., `Nat.add`,
`Array.size`).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This PR adds the `backward.isDefEq.implicitBump` option (default: `false`)
that controls whether all implicit arguments get their transparency bumped
to `TransparencyMode.instances` during `isDefEq`, not just instance-implicit
ones. When enabled, `[implicit_reducible]` definitions like `Nat.add` and
`Array.size` are unfolded when checking implicit arguments, closing the gap
between instance-implicit and regular implicit argument handling.

The default is `false` for staging purposes. After stage0 is updated, the
default will be flipped to `true`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@leodemoura leodemoura added the changelog-language Language features and metaprograms label Feb 18, 2026
@leodemoura leodemoura added this pull request to the merge queue Feb 18, 2026
@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 Feb 18, 2026
@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase f1934c8d5288d42c218e0fe3e162188278d8a805 --onto 91bd6e19a7b7aca769f9720e1127c768df0cd2a7. You can force Mathlib CI using the force-mathlib-ci label. (2026-02-18 23:00:17)

@leanprover-bot
Copy link
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase f1934c8d5288d42c218e0fe3e162188278d8a805 --onto 5c7a508e21c5ebc710b0dfe65648d5beba4e34e0. You can force reference manual CI using the force-manual-ci label. (2026-02-18 23:00:18)

Merged via the queue into master with commit b668a18 Feb 18, 2026
23 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2026
This PR is part 2 of the `implicit_reducible` refactoring (part 1:
#12567).

**Background.** When Lean checks definitional equality of function
applications
`f a₁ ... aₙ =?= f b₁ ... bₙ`, it compares arguments `aᵢ =?= bᵢ` at a
transparency level determined by the binder type. Previously, only
instance-implicit (`[C]`) arguments received a transparency bump to
`.instances`. With `backward.isDefEq.implicitBump` enabled, ALL implicit
arguments (`{x}`, `⦃x⦄`, and `[x]`) are bumped to `.instances`, so that
definitions marked `[implicit_reducible]` unfold when comparing implicit
arguments. This is important because implicit arguments often carry type
information (e.g., `P (i + 0)` vs `P i`) where the mismatch is in
non-proof positions (Sort arguments to `cast`) — proof irrelevance does
not
help here, so the relevant definitions must actually unfold.

**`[implicit_reducible]`** (renamed from `[instance_reducible]` in part
1) marks
definitions that should unfold at `TransparencyMode.instances` — between
`[reducible]` (unfolds at `.reducible` and above) and the default
`[semireducible]` (unfolds only at `.default` and above). This is the
right
level for core arithmetic operations that appear in type indices.

## Changes

- **Enable `backward.isDefEq.implicitBump` by default** and set it in
  `stage0/src/stdlib_flags.h` so stage0 also compiles with it
- **Mark `Nat.add`, `Nat.mul`, `Nat.sub`, `Array.size` as
`[implicit_reducible]`**
so they unfold when comparing implicit arguments at `.instances`
transparency
- **Remove redundant unification hints** (`n + 0 =?= n`, `n - 0 =?= n`,
  `n * 0 =?= 0`) that are now handled by `[implicit_reducible]`
- **Rename all remaining `[instance_reducible]` attribute usages** to
`[implicit_reducible]` across the codebase (the old name remains as an
alias)
- **Remove 28 `set_option backward.isDefEq.respectTransparency false
in`**
  workarounds that are no longer needed

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

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
kim-em added a commit to leanprover/doc-gen4 that referenced this pull request Feb 21, 2026
Adapts to leanprover/lean4#12567 which renamed
`ReducibilityStatus.instanceReducible` to `implicitReducible`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants