Skip to content

feat: backward.isDefEq.respectTransparency#12179

Draft
leodemoura wants to merge 28 commits intomasterfrom
defEqRespectTransparency
Draft

feat: backward.isDefEq.respectTransparency#12179
leodemoura wants to merge 28 commits intomasterfrom
defEqRespectTransparency

Conversation

@leodemoura
Copy link
Member

No description provided.

@leodemoura leodemoura added the changelog-language Language features and metaprograms label Jan 27, 2026
@leodemoura leodemoura marked this pull request as draft January 27, 2026 04:28
@leodemoura leodemoura force-pushed the defEqRespectTransparency branch from 3233869 to ea9b705 Compare February 4, 2026 23:45
@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 5, 2026
leodemoura added a commit that referenced this pull request Feb 5, 2026
This PR leverages the fact that expressions are type correct in
`grind` and the conclusion of extensionality theorems is of the form
`?a = ?b`.

This PR is relevant for #12179 because it enables us to use a weaker
`isDefEq` that does not bump the transparency level when processing
implicit arguments.
github-merge-queue bot pushed a commit that referenced this pull request Feb 5, 2026
This PR leverages the fact that expressions are type correct in `grind`
and the conclusion of extensionality theorems is of the form `?a = ?b`.

This PR is relevant for #12179 because it enables us to use a weaker
`isDefEq` that does not bump the transparency level when processing
implicit arguments.
@leodemoura leodemoura force-pushed the defEqRespectTransparency branch from ea9b705 to ef7e7c7 Compare February 5, 2026 03:25
@kim-em kim-em force-pushed the defEqRespectTransparency branch from 90bb387 to b09b7cb Compare February 5, 2026 05:39
@mathlib-lean-pr-testing
Copy link

mathlib-lean-pr-testing bot commented Feb 5, 2026

Mathlib CI status (docs):

  • 🟡 Mathlib branch lean-pr-testing-12179 build this PR didn't complete normally. (2026-02-05 06:09:44) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b4d4e371d263c827659efeaeb0f09d03e4fcfe19 --onto 5ec3b8c9d2fed98e6d78782664dd545785e868d4. You can force Mathlib CI using the force-mathlib-ci label. (2026-02-05 11:00:00)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 8e5655516ed966585f51ba2f8da88ac23b4620b7 --onto 5ec3b8c9d2fed98e6d78782664dd545785e868d4. You can force Mathlib CI using the force-mathlib-ci label. (2026-02-06 03:31:58)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 8e5655516ed966585f51ba2f8da88ac23b4620b7 --onto 75d7f7eb227bc54dc6ea3d8ead090ee4180debaf. You can force Mathlib CI using the force-mathlib-ci label. (2026-02-06 06:28:04)

kim-em added a commit to leanprover-community/batteries that referenced this pull request Feb 5, 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 Feb 5, 2026
@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

@leanprover-bot
Copy link
Collaborator

leanprover-bot commented Feb 5, 2026

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase b4d4e371d263c827659efeaeb0f09d03e4fcfe19 --onto 42a0e9245300da6b3d971fa0033d726bb8e11cc3. You can force reference manual CI using the force-manual-ci label. (2026-02-05 11:00:02)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase b4d4e371d263c827659efeaeb0f09d03e4fcfe19 --onto 75d7f7eb227bc54dc6ea3d8ead090ee4180debaf. You can force reference manual CI using the force-manual-ci label. (2026-02-06 01:51:17)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 8e5655516ed966585f51ba2f8da88ac23b4620b7 --onto 75d7f7eb227bc54dc6ea3d8ead090ee4180debaf. You can force reference manual CI using the force-manual-ci label. (2026-02-06 03:32:00)

It is needed for some bitvector problems. Example:
```
theorem msb_extractLsb' {start len : Nat} {x : BitVec w} :
    (extractLsb' start len x).msb =
      (decide (0 < len) &&
      (decide (start + len ≤ w) &&
      x.getMsbD (w - (start + len)))) := by
  simp [BitVec.msb]
```

After the simplifier we get
```
w start len : Nat
x : BitVec w
⊢ (decide (0 < len) && (decide (start + len ≤ w) && x.getMsbD (w - (start + len)))) =
  (decide (0 < len) && (decide (start + len ≤ w) && x.getMsbD (w - (start + len))))
```
The implicit terms are off because a `_ - 0` term occurring in an
implicit argument.
unification hint
@leodemoura leodemoura force-pushed the defEqRespectTransparency branch from dde32d6 to 1f27ba3 Compare February 6, 2026 02:40
@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

github-merge-queue bot pushed a commit that referenced this pull request Feb 6, 2026
This PR implements preparatory work for #12179. It implements a new
feature in `isDefEq` to ensure it does not increase the transparency
level to `.default` when checking definitionally equality of implicit
arguments. This transparency level bump was introduced in Lean 3, but it
is not a performance issue and is affecting Mathlib. This PR adds the
new feature, but it is disabled by default.
@mathlib-lean-pr-testing
Copy link

Mathlib CI status (docs):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan 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