Skip to content

fix: normalize instance argument in getStuckMVar? for class projections#12778

Merged
leodemoura merged 1 commit intomasterfrom
defEq_issue
Mar 3, 2026
Merged

fix: normalize instance argument in getStuckMVar? for class projections#12778
leodemoura merged 1 commit intomasterfrom
defEq_issue

Conversation

@leodemoura
Copy link
Copy Markdown
Member

@leodemoura leodemoura commented Mar 3, 2026

This PR fixes an inconsistency in getStuckMVar? where the instance argument to class projection functions and auxiliary parent projections was not whnf-normalized before checking for stuck metavariables. Every other case in getStuckMVar? (recursors, quotient recursors, .proj nodes) normalizes the major argument via whnf before recursing — class projection functions and aux parent projections were the exception.

This bug was identified by Matthew Jasper. When the instance parameter to a class projection is not normalized, getStuckMVar? may fail to detect stuck metavariables that would be revealed by whnf, or conversely may report stuckness for expressions that would reduce to constructors. This caused issues with OfNat and Zero at with_reducible_and_instances transparency.

Note: PR #12701 (already merged) is also required to fix the original Mathlib examples.

@leodemoura leodemoura added the changelog-language Language features and metaprograms label Mar 3, 2026
@leodemoura leodemoura enabled auto-merge March 3, 2026 18:26
@leodemoura leodemoura added this pull request to the merge queue Mar 3, 2026
Merged via the queue into master with commit df61abb Mar 3, 2026
21 of 23 checks passed
kim-em pushed a commit that referenced this pull request Mar 4, 2026
…ns (#12778)

This PR fixes an inconsistency in `getStuckMVar?` where the instance
argument to class projection functions and auxiliary parent projections
was not whnf-normalized before checking for stuck metavariables. Every
other case in `getStuckMVar?` (recursors, quotient recursors, `.proj`
nodes) normalizes the major argument via `whnf` before recursing — class
projection functions and aux parent projections were the exception.

This bug was identified by Matthew Jasper. When the instance parameter
to a class projection is not normalized, `getStuckMVar?` may fail to
detect stuck metavariables that would be revealed by whnf, or conversely
may report stuckness for expressions that would reduce to constructors.
This caused issues with `OfNat` and `Zero` at
`with_reducible_and_instances` transparency.

Note: PR #12701 (already merged) is also required to fix the original
Mathlib examples.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant