[Merged by Bors] - chore: add lemmas for nat literals corresponding to lemmas for nat casts#8006
Closed
[Merged by Bors] - chore: add lemmas for nat literals corresponding to lemmas for nat casts#8006
Conversation
Collaborator
Author
|
!bench |
Collaborator
|
Here are the benchmark results for commit 925576c. |
Collaborator
Author
|
I've merged master and addressed the review feedback around performance. I think this is ready |
eric-wieser
reviewed
Feb 25, 2024
eric-wieser
reviewed
Feb 25, 2024
eric-wieser
reviewed
Feb 25, 2024
eric-wieser
approved these changes
Feb 25, 2024
Member
eric-wieser
left a comment
There was a problem hiding this comment.
bors d+
Thanks for your patience with this!
Please check the heartbeat bumps are still needed before merging
Contributor
|
✌️ timotree3 can now approve this pull request. To approve and merge a pull request, simply reply with |
Member
|
!bench |
Collaborator
Author
|
bors r+ |
Collaborator
|
Here are the benchmark results for commit f4c32e0.Found no runs to compare against. |
mathlib-bors bot
pushed a commit
that referenced
this pull request
Feb 26, 2024
…sts (#8006) I loogled for every occurrence of `"cast", Nat` and `"natCast"` and where the casted nat was `n`, and made sure there were corresponding `@[simp]` lemmas for `0`, `1`, and `OfNat.ofNat n`. This is necessary in general for simp confluence. Example: ```lean import Mathlib variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo] example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp only [Nat.cast_le] -- this `@[simp]` lemma can apply example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by simp only [Nat.cast_ofNat] -- and so can this one example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue. ``` As far as I know, the only file this PR leaves with `ofNat` gaps is `PartENat.lean`. #8002 is addressing that file in parallel. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Contributor
|
Pull request successfully merged into master. Build succeeded: |
riccardobrasca
pushed a commit
that referenced
this pull request
Mar 1, 2024
…sts (#8006) I loogled for every occurrence of `"cast", Nat` and `"natCast"` and where the casted nat was `n`, and made sure there were corresponding `@[simp]` lemmas for `0`, `1`, and `OfNat.ofNat n`. This is necessary in general for simp confluence. Example: ```lean import Mathlib variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo] example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp only [Nat.cast_le] -- this `@[simp]` lemma can apply example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by simp only [Nat.cast_ofNat] -- and so can this one example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue. ``` As far as I know, the only file this PR leaves with `ofNat` gaps is `PartENat.lean`. #8002 is addressing that file in parallel. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
dagurtomas
pushed a commit
that referenced
this pull request
Mar 22, 2024
…sts (#8006) I loogled for every occurrence of `"cast", Nat` and `"natCast"` and where the casted nat was `n`, and made sure there were corresponding `@[simp]` lemmas for `0`, `1`, and `OfNat.ofNat n`. This is necessary in general for simp confluence. Example: ```lean import Mathlib variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo] example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp only [Nat.cast_le] -- this `@[simp]` lemma can apply example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by simp only [Nat.cast_ofNat] -- and so can this one example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue. ``` As far as I know, the only file this PR leaves with `ofNat` gaps is `PartENat.lean`. #8002 is addressing that file in parallel. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
xgenereux
pushed a commit
that referenced
this pull request
Apr 15, 2024
…sts (#8006) I loogled for every occurrence of `"cast", Nat` and `"natCast"` and where the casted nat was `n`, and made sure there were corresponding `@[simp]` lemmas for `0`, `1`, and `OfNat.ofNat n`. This is necessary in general for simp confluence. Example: ```lean import Mathlib variable {α : Type*} [LinearOrderedRing α] (m n : ℕ) [m.AtLeastTwo] [n.AtLeastTwo] example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp only [Nat.cast_le] -- this `@[simp]` lemma can apply example : ((OfNat.ofNat m : ℕ) : α) ≤ ((OfNat.ofNat n : ℕ) : α) ↔ (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) := by simp only [Nat.cast_ofNat] -- and so can this one example : (OfNat.ofNat m : α) ≤ (OfNat.ofNat n : α) ↔ (OfNat.ofNat m : ℕ) ≤ (OfNat.ofNat n : ℕ) := by simp -- fails! `simp` doesn't have a lemma to bridge their results. confluence issue. ``` As far as I know, the only file this PR leaves with `ofNat` gaps is `PartENat.lean`. #8002 is addressing that file in parallel. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
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.
I loogled for every occurrence of
"cast", Natand"natCast"and where the casted nat wasn, and made sure there were corresponding@[simp]lemmas for0,1, andOfNat.ofNat n. This is necessary in general for simp confluence. Example:As far as I know, the only file this PR leaves with
ofNatgaps isPartENat.lean. #8002 is addressing that file in parallel.no_indexaroundOfNat.ofNat#8317