Skip to content

fix: extend sym canonicalizer reductions to value positions#13272

Merged
leodemoura merged 1 commit into
masterfrom
grind_canon_issues_2
Apr 4, 2026
Merged

fix: extend sym canonicalizer reductions to value positions#13272
leodemoura merged 1 commit into
masterfrom
grind_canon_issues_2

Conversation

@leodemoura
Copy link
Copy Markdown
Member

This PR extends the sym canonicalizer to apply reductions (projection, match/ite/cond, Nat
arithmetic) in all positions, not just inside types. Previously, a value v appearing in a
type T(v) could remain unreduced while T(v) was normalized, breaking the invariant that
definitionally equal types are structurally identical after canonicalization.

Changes:

  • Remove insideType guards from canonApp and canonProj, so reductions apply unconditionally
    (eta reduction remains type-only, to preserve lambda structure for grind)
  • Add canonInstDecCore to handle Decidable instances in if-then-else expressions, dispatching
    Grind.nestedDecidable to canonInstDec and falling back silently for other instances
  • Add report parameter to canonInstCore/canonInst'/canonInst to allow suppressing issue
    reporting for propositional and decidable instances that cannot be resynthesized (common with
    haveI-provided instances that propagate into types through forward dependencies)
  • Update module documentation to reflect the new reduction scope and the haveI reporting tradeoff

This PR extends the sym canonicalizer to apply reductions (projection,
match/ite/cond, Nat arithmetic) in all positions, not just inside types.
Previously, a value `v` appearing in a type `T(v)` could remain unreduced
while `T(v)` was normalized, breaking the invariant that definitionally
equal types are structurally identical after canonicalization. This also
adds `canonInstDecCore` to properly handle `Decidable` instances in
`if-then-else` expressions, and suppresses issue reporting for
propositional and decidable instances that cannot be resynthesized (common
with `haveI`-provided instances).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@leodemoura leodemoura added the changelog-tactics User facing tactics label Apr 4, 2026
@leodemoura leodemoura enabled auto-merge April 4, 2026 01:40
@leodemoura leodemoura added this pull request to the merge queue Apr 4, 2026
Merged via the queue into master with commit 608e0d0 Apr 4, 2026
23 checks passed
volodeyka pushed a commit that referenced this pull request Apr 16, 2026
This PR extends the sym canonicalizer to apply reductions (projection,
match/ite/cond, Nat
arithmetic) in all positions, not just inside types. Previously, a value
`v` appearing in a
type `T(v)` could remain unreduced while `T(v)` was normalized, breaking
the invariant that
definitionally equal types are structurally identical after
canonicalization.

Changes:
- Remove `insideType` guards from `canonApp` and `canonProj`, so
reductions apply unconditionally
(eta reduction remains type-only, to preserve lambda structure for
`grind`)
- Add `canonInstDecCore` to handle `Decidable` instances in
`if-then-else` expressions, dispatching
`Grind.nestedDecidable` to `canonInstDec` and falling back silently for
other instances
- Add `report` parameter to `canonInstCore`/`canonInst'`/`canonInst` to
allow suppressing issue
reporting for propositional and decidable instances that cannot be
resynthesized (common with
`haveI`-provided instances that propagate into types through forward
dependencies)
- Update module documentation to reflect the new reduction scope and the
`haveI` reporting tradeoff

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-tactics User facing tactics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant