Repository navigation
fix: skip data-valued constructions for small-eliminating inductives - #14909
Merged
Merged
Conversation
This PR fixes elaboration of sort-polymorphic inductive types such as `inductive T : Sort u | a | b`, which previously failed with `Unknown constant `T.ctorIdx``. It also fixes the same failure for `set_option genCtorIdx false`. Such a type only eliminates into `Prop`, so it has no `T.ctorIdx` and no `SizeOf` instance. `mkNoConfusionCore` guarded against this, but `mkNoConfusionEnum` did not: `isEnumType` only rejects syntactic `Prop`, so the type was treated as an enum and `noConfusionEnum` was applied to the non-existent `T.ctorIdx`. `mkSizeOfInstances` had the same gap, and `mkSizeOfFn` then dropped a universe parameter via `recInfo.levelParams.tail!`. The recurring `recInfo.levelParams.length > indVal.levelParams.length` test is extracted as `Lean.isLargeEliminating`, resolving the `TODO: Extract to util` in `mkNoConfusionCore`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013tynPcTkcxEhbHRCtSLoh5
nomeata
marked this pull request as ready for review
August 24, 2026 11:49
Collaborator
|
Reference manual CI status:
|
Collaborator
Author
|
Just lake tests failing due to CI changes, will be resolved once mathlib reports green and I can update the branch. |
|
Mathlib CI status (docs):
|
nomeata
added a commit
that referenced
this pull request
Aug 25, 2026
Replaces the inline level-parameter comparison with the predicate from #14909, which documents the extra-motive-universe encoding at its own definition. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GSbnoYQjyFAGmX75t7snrX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes elaboration of sort-polymorphic inductive types such as
inductive T : Sort u | a | b, which previously failed withUnknown constant `T.ctorIdx`. It also fixes the same failure forset_option genCtorIdx false.Such a type only eliminates into
Prop, so it has noT.ctorIdxand noSizeOfinstance.mkNoConfusionCoreguarded against this, butmkNoConfusionEnumdid not:isEnumTypeonly rejects syntacticProp, so the type was treated as an enum andnoConfusionEnumwas applied to the non-existentT.ctorIdx.mkSizeOfInstanceshad the same gap, andmkSizeOfFnthen dropped a universe parameter viarecInfo.levelParams.tail!.The recurring
recInfo.levelParams.length > indVal.levelParams.lengthtest is extracted asLean.isLargeEliminating, resolving theTODO: Extract to utilinmkNoConfusionCore.Fixes #14904
Co-Authored-By: Claude Opus 5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_013tynPcTkcxEhbHRCtSLoh5