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

refactor: InductiveVal.numNested instead of .isNested #4684

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Jul 8, 2024

Before, in order to find out how many auxilary datatype are in a
mutual group of inductive with nested data type, one had to jump
through hoops like this:

private def numNestedInducts (indName : Name) : MetaM Nat := do
  let .inductInfo indVal ← getConstInfo indName | panic! "{indName} is an inductive"
  let .recInfo recVal ← getConstInfo (mkRecName indName) | panic! "{indName} has a recursor"
  return recVal.numMotives - indVal.all.length

The InductiveVal data structure already has .isNested : Bool, so it
seems to be a natural extension to beef that up to .numNested: Nat.

This touched kernel code.

@nomeata nomeata added awaiting-review Waiting for someone to review the PR merge-ci Enable merge queue CI checks for PR. In particular, produce artifacts for all major platforms. labels Jul 8, 2024
@nomeata nomeata changed the title joachim/indval numnested refactor: InductiveVal.numNested instead of .isNested Jul 8, 2024
@github-actions github-actions bot added the changes-stage0 Contains stage0 changes, merge manually using rebase label Jul 8, 2024
@nomeata
Copy link
Collaborator Author

nomeata commented Jul 8, 2024

(This includes #4683, diff will be prettier once that’s merged.)

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 8, 2024 12:02 Inactive
@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 Jul 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jul 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jul 8, 2024
@nomeata nomeata force-pushed the joachim/indval-numnested branch from d080014 to 2f02c30 Compare July 8, 2024 12:44
@nomeata nomeata marked this pull request as ready for review July 8, 2024 12:44
@nomeata nomeata requested a review from leodemoura as a code owner July 8, 2024 12:44
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 8, 2024 12:50 Inactive
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jul 8, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jul 8, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Jul 8, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Jul 8, 2024

Mathlib CI status (docs):

  • ✅ Mathlib branch lean-pr-testing-4684 has successfully built against this PR. (2024-07-08 14:12:36) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase db7a01d126e3f8f1b327228fe00f247381337648 --onto 4ed79472af1f85b13c51e9ed77d15d3b4c40e3cc. (2024-07-08 16:04:30)

@nomeata nomeata added will-merge-soon …unless someone speaks up and removed awaiting-review Waiting for someone to review the PR labels Jul 8, 2024
right now, in order to find out how many auxilary datatype are in a
mutual group of inductive with nested data type, one has to jump
through hoops like this:

```
private def numNestedInducts (indName : Name) : MetaM Nat := do
  let .inductInfo indVal ← getConstInfo indName | panic! "{indName} is an inductive"
  let .recInfo recVal ← getConstInfo (mkRecName indName) | panic! "{indName} has a recursor"
  return recVal.numMotives - indVal.all.lengt
```

The `InductiveVal` data structure already has `.isNested : Bool`, so it
seems to be a natural extension to beef that up to `.numNested: Nat`.

This touched kernel code.
@nomeata nomeata force-pushed the joachim/indval-numnested branch from 2f02c30 to 51f799e Compare July 8, 2024 15:02
@github-actions github-actions bot removed the changes-stage0 Contains stage0 changes, merge manually using rebase label Jul 8, 2024
@github-actions github-actions bot added the changes-stage0 Contains stage0 changes, merge manually using rebase label Jul 8, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 8, 2024 15:55 Inactive
@Kha Kha merged commit 6ba5704 into master Jul 8, 2024
15 checks passed
nomeata added a commit that referenced this pull request Jul 12, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 12, 2024
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 changes-stage0 Contains stage0 changes, merge manually using rebase merge-ci Enable merge queue CI checks for PR. In particular, produce artifacts for all major platforms. toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN will-merge-soon …unless someone speaks up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants