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: pass Measures around as Expr in GuessLex #3665

Merged
merged 39 commits into from
Mar 16, 2024

Conversation

nomeata
Copy link
Contributor

@nomeata nomeata commented Mar 13, 2024

this refactor prepares GuessLex to be able to infer more complex
termination arguments.

As a side-effect it fixes an (obscure) bug where sizeOf would be
applied to a term of the wrong type and thus a wrong SizeOf instance
could be inferred.

This introduces the `ArgsPacker` module and abstraction, to replace the
exising `PackDomain`/`PackMutual` code. The motivation was that we now
have more uses besides `Fix.lean` (`GuessLex` and `FunInd`), and the
code was spread in various places.

The goals are

 * consistent function naming withing the the `PSigma` handling, the
   `PSum` handling, and the combined interface
 * avoid taking a type apart just based on the `PSigma`/`PSum` nesting,
   to be robust in case the user happens to be using `PSigma`/`PSum`
   somewhere. Therefore, always pass an `arity` or `numFuncs` or
   `varNames` around.
 *  keep all the `PSigma`/`PSum` encoding logic contained within one
    module (`ArgsPacker`), and keep that module independent of its users
    (so no `EqnInfos` visible here).
 * pick good variable names when matching on a packed argument
 * the unary function now is either called `fun1._unary` or
   `fun1._mutual`, never `fun1._unary._mutual`.

This file has less heavy dependencies than `PackMutual` had, so build
parallelism is improved as well.
this refactor prepares GuessLex to be able to infer more complex
termination arguments.

As a side-effect it fixes an (obscure) bug where `sizeOf` would be
applied to a term of the wrong type and thus a wrong `SizeOf` instance
could be inferred.
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 13, 2024 13:55 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 Mar 13, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Mar 13, 2024

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 1388f6bc83b5ea085fe14faa1db213e745c3e398 --onto 32dcc6eb895b58df3d3241a2521963e64995b621. (2024-03-13 13:58:02)
  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 995726f75fd7eed223c2189a54f6df3293185327 --onto 317adf42e92a4dbe07295bc1f0429b61bb8079fe. (2024-03-14 13:59:34)
  • 💥 Mathlib branch lean-pr-testing-3665 build failed against this PR. (2024-03-16 10:44:30) View Log
  • 💥 Mathlib branch lean-pr-testing-3665 build failed against this PR. (2024-03-16 11:02:52) View Log

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 14, 2024 13:53 Inactive
@nomeata nomeata marked this pull request as ready for review March 16, 2024 09:37
@nomeata nomeata changed the base branch from joachim/termination-elab2 to master March 16, 2024 09:37
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 16, 2024 09:52 Inactive
@nomeata nomeata added the will-merge-soon …unless someone speaks up label Mar 16, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 16, 2024 10:01 Inactive
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 16, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 16, 2024
@nomeata nomeata added this pull request to the merge queue Mar 16, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Mar 16, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 16, 2024 10:46 Inactive
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 16, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 16, 2024
Merged via the queue into master with commit f0ff01a Mar 16, 2024
22 of 26 checks passed
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 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.

None yet

2 participants