Skip to content

fix: deriving Inhabited for structures should inherit Inhabited instances#13395

Merged
kmill merged 1 commit intomasterfrom
kmill_fix_13372
Apr 14, 2026
Merged

fix: deriving Inhabited for structures should inherit Inhabited instances#13395
kmill merged 1 commit intomasterfrom
kmill_fix_13372

Conversation

@kmill
Copy link
Copy Markdown
Collaborator

@kmill kmill commented Apr 13, 2026

This PR makes the deriving Inhabited handler for structures be able to inherit Inhabited instances from structure parents, using the same mechanism as for class parents. This fixes a regression introduced by #9815, which lost the ability to apply Inhabited instances for parents represented as subobject fields. With this PR, now it works for all parents in the hierarchy.

Implementation detail: adds struct_inst_default% for synthesizing a structure default value using Inhabited instances for parents and fields.

Closes #13372

…nstances

This PR makes the `deriving Inhabited` handler for `structure`s be able to inherit `Inhabited` instances from structure parents, using the same mechanism as for class parents. This fixes a regression introduced by #9815, which lost the ability to apply `Inhabited` instances for parents represented as subobject fields. With this PR, now it works for all parents.

Implementation detail: adds `struct_inst_default%` for synthesizing a structure default value using `Inhabited` instances for parents and fields.

Closes #13372
@kmill kmill requested a review from kim-em as a code owner April 13, 2026 16:06
@kmill kmill added the changelog-language Language features and metaprograms label Apr 13, 2026
@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-13 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 21:25:02)

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-nightly-testing bot pushed a commit to leanprover-community/batteries that referenced this pull request 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
Copy link
Copy Markdown

Mathlib CI status (docs):

@mathlib-lean-pr-testing mathlib-lean-pr-testing bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Apr 13, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

@kmill kmill added this pull request to the merge queue Apr 14, 2026
Merged via the queue into master with commit eee2909 Apr 14, 2026
46 of 58 checks passed
kmill added a commit to kmill/lean4-unicode-basic that referenced this pull request Apr 14, 2026
volodeyka pushed a commit that referenced this pull request Apr 16, 2026
…nstances (#13395)

This PR makes the `deriving Inhabited` handler for `structure`s be able
to inherit `Inhabited` instances from structure parents, using the same
mechanism as for class parents. This fixes a regression introduced by
#9815, which lost the ability to apply `Inhabited` instances for parents
represented as subobject fields. With this PR, now it works for all
parents in the hierarchy.

Implementation detail: adds `struct_inst_default%` for synthesizing a
structure default value using `Inhabited` instances for parents and
fields.

Closes #13372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms 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.

deriving Inhabited fails for structure extending a type with proof fields

2 participants