Repository navigation
fix: add a missing case to Level.geq - #2689
Merged
Merged
Conversation
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Oct 15, 2023
|
Collaborator
|
Just noting there's a conflict here now. Would it be possible to include the |
Collaborator
Author
|
Ping @leodemoura on this since apparently #2750 was missed so probably this long standing bug was too. |
Level.geq
ghost
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 19, 2024
ghost
pushed a commit
to leanprover-community/mathlib4
that referenced
this pull request
Nov 19, 2024
leodemoura
approved these changes
Nov 19, 2024
|
Mathlib CI status (docs):
|
kmill
added a commit
to kmill/lean4
that referenced
this pull request
Nov 19, 2024
This PR adds a case to `Level.geq` that is present in the kernel's level `is_geq` procedure, making them consistent with one another. This came up during testing of `lean4lean`. Currently `Level.geq` differs from `level::is_geq` in the case of `max u v >= imax u v`. The elaborator function is overly pessimistic and yields `false` on this while the kernel function yields true. This comes up concretely in the `Trans` class: ```lean class Trans (r : α → β → Sort u) (s : β → γ → Sort v) (t : outParam (α → γ → Sort w)) where trans : r a b → s b c → t a c ``` The type of this class is `Sort (max (max (max (max (max (max 1 u) u_1) u_2) u_3) v) w)` (where `u_1 u_2 u_3` are the levels of `α β γ`), but if you try writing that type explicitly then the `class` command fails. Omitting the type leaves the `class` to infer the universe level (the command assumes the level is correct, and the kernel agrees it is), but including the type then the elaborator checks the level inequality with `Level.geq` and fails. --------- Co-authored-by: Kyle Miller <[email protected]>
JovanGerb
pushed a commit
to JovanGerb/lean4
that referenced
this pull request
Jan 21, 2025
This PR adds a case to `Level.geq` that is present in the kernel's level `is_geq` procedure, making them consistent with one another. This came up during testing of `lean4lean`. Currently `Level.geq` differs from `level::is_geq` in the case of `max u v >= imax u v`. The elaborator function is overly pessimistic and yields `false` on this while the kernel function yields true. This comes up concretely in the `Trans` class: ```lean class Trans (r : α → β → Sort u) (s : β → γ → Sort v) (t : outParam (α → γ → Sort w)) where trans : r a b → s b c → t a c ``` The type of this class is `Sort (max (max (max (max (max (max 1 u) u_1) u_2) u_3) v) w)` (where `u_1 u_2 u_3` are the levels of `α β γ`), but if you try writing that type explicitly then the `class` command fails. Omitting the type leaves the `class` to infer the universe level (the command assumes the level is correct, and the kernel agrees it is), but including the type then the elaborator checks the level inequality with `Level.geq` and fails. --------- Co-authored-by: Kyle Miller <[email protected]>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a case to
Level.geqthat is present in the kernel's levelis_geqprocedure, making them consistent with one another.This came up during testing of
lean4lean. CurrentlyLevel.geqdiffers fromlevel::is_geqin the case ofmax u v >= imax u v. The elaborator function is overly pessimistic and yieldsfalseon this while the kernel function yields true. This comes up concretely in theTransclass:The type of this class is
Sort (max (max (max (max (max (max 1 u) u_1) u_2) u_3) v) w)(whereu_1 u_2 u_3are the levels ofα β γ), but if you try writing that type explicitly then theclasscommand fails. Omitting the type leaves theclassto infer the universe level (the command assumes the level is correct, and the kernel agrees it is), but including the type then the elaborator checks the level inequality withLevel.geqand fails.