Skip to content

feat: replace List.lt with List.Lex#6379

Merged
kim-em merged 6 commits intomasterfrom
lex_prime
Dec 15, 2024
Merged

feat: replace List.lt with List.Lex#6379
kim-em merged 6 commits intomasterfrom
lex_prime

Conversation

@kim-em
Copy link
Copy Markdown
Collaborator

@kim-em kim-em commented Dec 14, 2024

This PR replaces List.lt with List.Lex, from Mathlib, and adds the new Bool valued lexicographic comparatory function List.lex. This subtly changes the definition of < on Lists in some situations.

List.lt was a weaker relation: in particular if l₁ < l₂, then
a :: l₁ < b :: l₂ may hold according to List.lt even if a and b are merely incomparable
(either neither a < b nor b < a), whereas according to List.Lex this would require a = b.

When < is total, in the sense that ¬ · < · is antisymmetric, then the two relations coincide.

Mathlib was already overriding the order instances for List α,
so this change should not be noticed by anyone already using Mathlib.

We simultaneously add the boolean valued List.lex function, parameterised by a BEq typeclass
and an arbitrary lt function. This will support the flexibility previously provided for List.lt,
via a == function which is weaker than strict equality.

@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 Dec 14, 2024
ghost pushed a commit to leanprover-community/batteries that referenced this pull request Dec 14, 2024
ghost pushed a commit to leanprover-community/mathlib4 that referenced this pull request Dec 14, 2024
@ghost
Copy link
Copy Markdown

ghost commented Dec 14, 2024

Mathlib CI status (docs):

@ghost ghost added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Dec 14, 2024
kim-em added a commit to leanprover-community/batteries that referenced this pull request Dec 14, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 14, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 14, 2024
@ghost ghost added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Dec 14, 2024
ghost pushed a commit to leanprover-community/batteries that referenced this pull request Dec 14, 2024
ghost pushed a commit to leanprover-community/mathlib4 that referenced this pull request Dec 14, 2024
@ghost ghost added breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan and removed builds-mathlib CI has verified that Mathlib builds against this PR labels Dec 14, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 14, 2024
@ghost ghost added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Dec 14, 2024
@kim-em kim-em changed the title feat: move List.lt to List.Lex', and replace with Mathlib compatible definition feat: replace List.lt with List.Lex Dec 15, 2024
@kim-em kim-em marked this pull request as ready for review December 15, 2024 05:22
@kim-em kim-em added the changelog-library Library label Dec 15, 2024
ghost pushed a commit to leanprover-community/batteries that referenced this pull request Dec 15, 2024
ghost pushed a commit to leanprover-community/mathlib4 that referenced this pull request Dec 15, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc December 15, 2024 07:42 Inactive
ghost pushed a commit to leanprover-community/batteries that referenced this pull request Dec 15, 2024
ghost pushed a commit to leanprover-community/mathlib4 that referenced this pull request Dec 15, 2024
@kim-em kim-em added this pull request to the merge queue Dec 15, 2024
Merged via the queue into master with commit 6893913 Dec 15, 2024
luisacicolini pushed a commit to opencompl/lean4 that referenced this pull request Jan 21, 2025
This PR replaces `List.lt` with `List.Lex`, from Mathlib, and adds the
new `Bool` valued lexicographic comparatory function `List.lex`. This
subtly changes the definition of `<` on Lists in some situations.

`List.lt` was a weaker relation: in particular if `l₁ < l₂`, then
`a :: l₁ < b :: l₂` may hold according to `List.lt` even if `a` and `b`
are merely incomparable
(either neither `a < b` nor `b < a`), whereas according to `List.Lex`
this would require `a = b`.

When `<` is total, in the sense that `¬ · < ·` is antisymmetric, then
the two relations coincide.

Mathlib was already overriding the order instances for `List α`,
so this change should not be noticed by anyone already using Mathlib.

We simultaneously add the boolean valued `List.lex` function,
parameterised by a `BEq` typeclass
and an arbitrary `lt` function. This will support the flexibility
previously provided for `List.lt`,
via a `==` function which is weaker than strict equality.
JovanGerb pushed a commit to JovanGerb/lean4 that referenced this pull request Jan 21, 2025
This PR replaces `List.lt` with `List.Lex`, from Mathlib, and adds the
new `Bool` valued lexicographic comparatory function `List.lex`. This
subtly changes the definition of `<` on Lists in some situations.

`List.lt` was a weaker relation: in particular if `l₁ < l₂`, then
`a :: l₁ < b :: l₂` may hold according to `List.lt` even if `a` and `b`
are merely incomparable
(either neither `a < b` nor `b < a`), whereas according to `List.Lex`
this would require `a = b`.

When `<` is total, in the sense that `¬ · < ·` is antisymmetric, then
the two relations coincide.

Mathlib was already overriding the order instances for `List α`,
so this change should not be noticed by anyone already using Mathlib.

We simultaneously add the boolean valued `List.lex` function,
parameterised by a `BEq` typeclass
and an arbitrary `lt` function. This will support the flexibility
previously provided for `List.lt`,
via a `==` function which is weaker than strict equality.
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 changelog-library Library 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.

1 participant