-
Notifications
You must be signed in to change notification settings - Fork 251
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
[Merged by Bors] - fix: prevent Int.ofNat
being used instead of Nat.cast
#2878
Conversation
Without this override, the coercion is found as `instCoeNatInt : Coe ℕ ℤ` which unfolds to `Int.ofNat`. This only happened when searching for `Coe ℕ ℤ`; `CoeHTCT ℕ ℤ` would already find the correct instance.
@@ -45,6 +45,9 @@ instance [NatCast R] : CoeTail ℕ R where coe := Nat.cast | |||
-- see note [coercion into rings] | |||
instance [NatCast R] : CoeHTCT ℕ R where coe := Nat.cast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are in std4 now. ^^
Right instance, but it should go into std4. |
Are you happy to add the instance in both places, and remove this one next time we bump std4? |
We already have two duplicated instances above it, so it doesn't change much. Please make a PR that adds the instance to std4 and a PR to remove the 2 (3) instances from mathlib4. In the meantime, feel free to |
✌️ eric-wieser can now approve this pull request. To approve and merge a pull request, simply reply with |
bors merge I'll make the Std4 PR shortly |
Without this override, the coercion is found as `instCoeNatInt : Coe ℕ ℤ` which unfolds to `Int.ofNat`. This only happened when searching for `Coe ℕ ℤ`; `CoeHTCT ℕ ℤ` would already find the correct instance.
std4 PR is leanprover-community/batteries#107 |
Pull request successfully merged into master. Build succeeded:
|
Int.ofNat
being used instead of Nat.cast
Int.ofNat
being used instead of Nat.cast
We bump std4 and take care to delete the now-upstreamed (leanprover-community/batteries#107) instances mentioned in #2878.
Without this override, the coercion is found as
instCoeNatInt : Coe ℕ ℤ
which unfolds toInt.ofNat
. This only happened when searching forCoe ℕ ℤ
;CoeHTCT ℕ ℤ
would already find the correct instance.