Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow structure in mutual blocks #6125

Merged
merged 3 commits into from
Nov 22, 2024
Merged

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Nov 19, 2024

This PR adds support for structure in mutual blocks, allowing inductive types defined by inductive and structure to be mutually recursive. The limitations are (1) that the parents in the extends clause must be defined before the mutual block and (2) mutually recursive classes are not allowed (a limitation shared by class inductive). There are also improvements to universe level inference for inductive types and structures. Breaking change: structure parents now elaborate with the structure in scope (fix: use qualified names or rename the structure to avoid shadowing), and structure parents no longer elaborate with autoimplicits enabled.

Internally, this is a large refactor of both the inductive and structure commands. Common material is now in Lean.Elab.MutualInductive, and each command plugs into this mutual inductive elaboration framework with the logic specific to the respective command. For example, structure has code to add projections after the inductive types are added to the environment.

Closes #4182

@kmill kmill added the changelog-language Language features, tactics, and metaprograms label Nov 19, 2024
@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 Nov 19, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 19, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 19, 2024
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Nov 19, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 19, 2024

Mathlib CI status (docs):

  • 💥 Mathlib branch lean-pr-testing-6125 build failed against this PR. (2024-11-19 08:28:26) View Log
  • 💥 Mathlib branch lean-pr-testing-6125 build failed against this PR. (2024-11-22 00:14:02) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 6202461a21d2636129cb8950cd9b6549ccf4b185 --onto 72e952eadc6a171310f1d8e9d6e78acf98421494. (2024-11-22 06:06:49)

kmill added a commit to kmill/lean4 that referenced this pull request Nov 22, 2024
github-merge-queue bot pushed a commit that referenced this pull request Nov 22, 2024
mutual inductive framework

later: deal with staging for attribute

structure parents: no autobound implicits

mutual structure worked, default values buggy

mutual defaults

passed test suite

combine cases

add test

more sophisticated metavariable solving in checkResultingUniverses

refinements to universe inference, better errors

recover structure-field-specific universe error messages

cleanup

refinements, another improvement to collectUniverses error
@kmill kmill marked this pull request as ready for review November 22, 2024 06:18
@kmill kmill added this pull request to the merge queue Nov 22, 2024
Merged via the queue into leanprover:master with commit a19ff61 Nov 22, 2024
25 checks passed
kmill added a commit to kmill/lean4 that referenced this pull request Nov 22, 2024
kmill added a commit to kmill/lean4 that referenced this pull request Nov 22, 2024
github-merge-queue bot pushed a commit that referenced this pull request Nov 22, 2024
github-merge-queue bot pushed a commit that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan changelog-language Language features, tactics, and metaprograms 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.

RFC: mutual structures
2 participants