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: structural recursion over nested datatypes #4733

Merged
merged 62 commits into from
Jul 15, 2024

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Jul 12, 2024

This now works:

inductive Tree where | node : List Tree → Tree

mutual
def Tree.size : Tree → Nat
  | node ts => list_size ts

def Tree.list_size : List Tree → Nat
  | [] => 0
  | t::ts => t.size + list_size ts
end

It is still out of scope to expect to be able to use nested recursion (e.g. through List.map or List.foldl) here.

Depends on #4718.

@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 12, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

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

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2024-07-12 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. (2024-07-12 13:34:32)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 891824bc51726cb99e6229be078d6757111b9b57 --onto 5f70c1ca64a2c05a5866c47b9eb80a92034433ec. (2024-07-12 22:26:44)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase a6ae49c3abaade6f2f4420665b4a67d93069fd81 --onto 5f70c1ca64a2c05a5866c47b9eb80a92034433ec. (2024-07-13 06:55:02)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 1118978cbb344e6570729a70c74cd0d3121e8c35 --onto 5f70c1ca64a2c05a5866c47b9eb80a92034433ec. (2024-07-13 09:03:22)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 3ab2c714ec03550bf67f8fadb5344419fb40a748 --onto 5f70c1ca64a2c05a5866c47b9eb80a92034433ec. (2024-07-15 10:29:12)

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 13, 2024 07:40 Inactive
This adds the types
* `IndGroupInfo`, a variant of `InductiveVal` with information that
   applies to a whole group of mutual inductives and
* `IndGroupInst` which extends `IndGroupInfo` with levels and parameters
   to indicate a instantiation of the group.

One purpose of this abstraction is to make it clear when a fuction
operates on a group as a whole, rather than a specific inductive within
the group.

This is extracted from #4718 and #4733 to reduce PR size and improve
bisectability.
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 13, 2024 08:03 Inactive
github-merge-queue bot pushed a commit that referenced this pull request Jul 13, 2024
This adds the types
* `IndGroupInfo`, a variant of `InductiveVal` with information that
   applies to a whole group of mutual inductives and
* `IndGroupInst` which extends `IndGroupInfo` with levels and parameters
   to indicate a instantiation of the group.

One purpose of this abstraction is to make it clear when a fuction
operates on a group as a whole, rather than a specific inductive within
the group.

This is extracted from #4718 and #4733 to reduce PR size and improve
bisectability.
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 13, 2024 09:07 Inactive
@nomeata nomeata marked this pull request as ready for review July 15, 2024 10:15
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 15, 2024 10:18 Inactive
@nomeata nomeata added this pull request to the merge queue Jul 15, 2024
Merged via the queue into master with commit de96b6d Jul 15, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants