Skip to content

feat: add type-correctness note to rewrite tactic error messages#13368

Draft
Kha wants to merge 1 commit intoleanprover:defeq_todo_4from
Kha:push-yomypwxssmpy
Draft

feat: add type-correctness note to rewrite tactic error messages#13368
Kha wants to merge 1 commit intoleanprover:defeq_todo_4from
Kha:push-yomypwxssmpy

Conversation

@Kha
Copy link
Copy Markdown
Member

@Kha Kha commented Apr 10, 2026

No description provided.

@Kha Kha force-pushed the push-yomypwxssmpy branch from c14f18c to 0d1229d Compare April 10, 2026 19:04
check e .instances
return .nil
catch _ =>
return m!"\n\nNote: The target expression is not type-correct \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use the .note or .hint combinator?

This PR adds a `transparency` parameter to `Meta.check` (defaulting to `.all`
for backwards compatibility) and introduces `withRewriteTypeCheck`, which wraps
`rewrite` and lazily checks whether the target expression is type-correct at
`instances` transparency when any error occurs. If not, a note is appended to
the error message explaining that this can prevent pattern matching.
@Kha Kha force-pushed the push-yomypwxssmpy branch from 0d1229d to 99d3297 Compare April 13, 2026 09:58
@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 Apr 13, 2026
@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-04-06 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-04-13 11:28:11)

mathlib-nightly-testing bot pushed a commit to leanprover-community/batteries that referenced this pull request Apr 13, 2026
@github-actions github-actions bot added the mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN label Apr 13, 2026
mathlib-nightly-testing bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Apr 13, 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 Apr 13, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

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 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