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: universe constraint approximations #3981

Merged
merged 1 commit into from
Apr 24, 2024
Merged

feat: universe constraint approximations #3981

merged 1 commit into from
Apr 24, 2024

Conversation

leodemoura
Copy link
Member

We add a new configuration flag for isDefEq:
Meta.Config.univApprox.
When it is true, we approximate the solution for universe constraints such as

  • u =?= max u ?v, we use ?v := u, and ignore the solution ?v := 0.
  • max u v =?= max u ?w, we use ?w := v, and ignore the solution ?w := max u v.

We only apply these approximations when there the contraints cannot be postponed anymore. These approximations prevent error messages such as

error: stuck at solving universe constraint
  max u ?u.3430 =?= u

This kind of error seems to appear in several Mathlib files.

We currently do not use these approximations while synthesizing type class instances.

We add a new configuration flag for `isDefEq`:
`Meta.Config.univApprox`.
When it is true, we approximate the solution for universe constraints such as
- `u =?= max u ?v`, we use `?v := u`, and ignore the solution `?v := 0`.
- `max u v =?= max u ?w`, we use `?w := v`, and ignore the solution `?w := max u v`.

We only apply these approximations when there the contraints cannot be
postponed anymore. These approximations prevent error messages such as
```
error: stuck at solving universe constraint
  max u ?u.3430 =?= u
```
This kind of error seems to appear in several Mathlib files.

We currently do not use these approximations while synthesizing type
class instances.
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc April 24, 2024 01:04 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 Apr 24, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 94360a72b378525626afe72d0d50963208cc4c26 --onto 62cdb51ed5b9d8487877d5a4adbcd4659d81fc6a. (2024-04-24 01:07:43)

@leodemoura leodemoura added this pull request to the merge queue Apr 24, 2024
Merged via the queue into master with commit 1630d9b Apr 24, 2024
12 checks passed
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request May 2, 2024
apnelson1 pushed a commit to leanprover-community/mathlib4 that referenced this pull request May 12, 2024
callesonne pushed a commit to leanprover-community/mathlib4 that referenced this pull request May 16, 2024
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