chore: use terminology "non-recursive structure" instead of "struct-like"#12749
Merged
chore: use terminology "non-recursive structure" instead of "struct-like"#12749
Conversation
…ke". This PR addresses RFC #5891, changing occurrences of "structure-like" to "non-recursive structure" in documentation, the metaprogramming API, and the kernel; there are no functional changes. (Recall: A *structure* is a one-constructor inductive type with no indices. One-constructor inductive types can make use of `Expr.proj` projections, even if they have indices or are recursive. Non-recursive structures have an eta rule.) Changes: - Kernel: `is_structure_like()` -> `is_non_rec_structure()` - `Lean.Expr.proj`, extended and corrected documentation (note: despite the fact that not every projection can be written as a recursor application, I left in this claim since it seems good to document a more-restrictive specification, and some users have requested the kernel be more restrictive) - `Lean.isStructureLike` -> `Lean.isNonRecStructure` - `Lean.matchConstStructLike` -> `Lean.matchConstNonRecStructure` - `Lean.getStructureLikeCtor?` -> `Lean.getNonRecStructureCtor?` - `Lean.getStructureLikeNumFields` -> `Lean.getNonRecStructureNumFields` Closes #5891
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
Contributor
|
Terminology question: Is |
Collaborator
Author
|
@Rob23oba Yes, Exists is a non-recursive structure. The eta rule applies for non-recursive structures, if the projections all exist, but they don't exist for Exists since it doesn't have large elimination. |
sgraf812
pushed a commit
that referenced
this pull request
Mar 9, 2026
…ike" (#12749) This PR changes "structure-like" terminology to "non-recursive structure" across internal documentation, error messages, the metaprogramming API, and the kernel, to clarify Lean's type theory. A *structure* is a one-constructor inductive type with no indices — these can be created by either the `structure` or `inductive` commands — and are supported by the primitive `Expr.proj` projections. Only *non-recursive* structures have an eta conversion rule. The PR description contains the APIs that were renamed. Addresses RFC #5891, which proposed this rename. The change is motivated by the need to distinguish between `structure`-defined structures, structures, and non-recursive structures. Especially since #5783, which enabled the `structure` command to define recursive structures, "structure-like" has been easy to misunderstand. Changes: - Kernel: `is_structure_like()` -> `is_non_rec_structure()` - `Lean.isStructureLike` -> `Lean.isNonRecStructure` - `Lean.matchConstStructLike` -> `Lean.matchConstNonRecStructure` - `Lean.getStructureLikeCtor?` -> `Lean.getNonRecStructureCtor?` - `Lean.getStructureLikeNumFields` -> `Lean.getNonRecStructureNumFields` - `Lean.Expr.proj`: extended and corrected documentation (note: despite the fact that not every projection can be written as a recursor application, I left in this claim since it seems good to document a more-restrictive specification, and some users have requested the kernel be more restrictive in this way) Closes #5891
kim-em
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 10, 2026
Adapts to leanprover/lean4#12749 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 changes "structure-like" terminology to "non-recursive structure" across internal documentation, error messages, the metaprogramming API, and the kernel, to clarify Lean's type theory. A structure is a one-constructor inductive type with no indices — these can be created by either the
structureorinductivecommands — and are supported by the primitiveExpr.projprojections. Only non-recursive structures have an eta conversion rule. The PR description contains the APIs that were renamed.Addresses RFC #5891, which proposed this rename. The change is motivated by the need to distinguish between
structure-defined structures, structures, and non-recursive structures. Especially since #5783, which enabled thestructurecommand to define recursive structures, "structure-like" has been easy to misunderstand.Changes:
is_structure_like()->is_non_rec_structure()Lean.isStructureLike->Lean.isNonRecStructureLean.matchConstStructLike->Lean.matchConstNonRecStructureLean.getStructureLikeCtor?->Lean.getNonRecStructureCtor?Lean.getStructureLikeNumFields->Lean.getNonRecStructureNumFieldsLean.Expr.proj: extended and corrected documentation (note: despite the fact that not every projection can be written as a recursor application, I left in this claim since it seems good to document a more-restrictive specification, and some users have requested the kernel be more restrictive in this way)Closes #5891