Skip to content

fix: recognize opaque constants of unit-like types as definitionally equal - #14550

Open
kernelpanic888 wants to merge 5 commits into
leanprover:masterfrom
kernelpanic888:codex/fix-opaque-unit-defeq-14348
Open

fix: recognize opaque constants of unit-like types as definitionally equal#14550
kernelpanic888 wants to merge 5 commits into
leanprover:masterfrom
kernelpanic888:codex/fix-opaque-unit-defeq-14348

Conversation

@kernelpanic888

@kernelpanic888 kernelpanic888 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This PR allows rfl to prove equality between distinct opaque constants whose common type is unit-like, fixing #14348.

The definitional equality checker now falls back to its existing unit-like check only when two constant names differ, preserving the fast path for identical constants. A regression test covers two opaque Unit constants.

Tests

  • Clean stage1 build
  • tests/with_stage1_test_env.sh tests/elab/run_test.sh 14348.lean

Changelog

  • changelog-language

AI assistance

AI assistance was used to locate the diagnosed control-flow branch and draft the minimal patch and regression test. I manually reviewed the change and verified the clean build and focused test.

@kernelpanic888

Copy link
Copy Markdown
Contributor Author

The syntax error is fixed in commit 0ebf6be; distinct constants now fall through to the existing unit-like check while identical constants keep the universe-level fast path. The PR body check also requires a changelog label, but fork contributors cannot add upstream labels. Maintainers: please add changelog-language (or the category you prefer).

@kernelpanic888

kernelpanic888 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

The focused 14348 regression passed in the refreshed CI. The remaining failure was trace-only: distinct non-unit constants were falling through the general expensive path and adding isDefEq.onFailure trace entries. Commit 2fdb446267 now sends distinct constants directly to isDefEqUnitLike; non-unit-like types return false immediately, preserving the previous trace/control-flow boundary.

@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 Jul 30, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Jul 30, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2026-07-25 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-30 20:43:39)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 58774429865502f05c63239266aac30ef1e91ef7 --onto c632a0a0e434a951cdcf61bb4da3344abadd5587. You can force Mathlib CI using the force-mathlib-ci label. (2026-09-04 00:36:05)

@leanprover-bot

leanprover-bot commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • 🟡 Reference manual branch lean-pr-testing-14550 build against this PR didn't complete normally. (2026-07-30 20:50:39) View Log
  • ✅ Reference manual branch lean-pr-testing-14550 has successfully built against this PR. (2026-07-30 20:51:05) View Log
  • ✅ Reference manual branch lean-pr-testing-14550 has successfully built against this PR. (2026-07-30 21:16:55) View Log
  • 🟡 Reference manual branch lean-pr-testing-14550 build against this PR didn't complete normally. (2026-07-30 21:17:13) View Log
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 58774429865502f05c63239266aac30ef1e91ef7 --onto 19c79593c47bb8dd3371327c08fc80775d8488af. You can force reference manual CI using the force-manual-ci label. (2026-09-04 00:36:06)

@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label Jul 30, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Jul 30, 2026
@kernelpanic888

Copy link
Copy Markdown
Contributor Author

changelog-language

@github-actions github-actions Bot added the changelog-language Language features and metaprograms label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR 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.

3 participants