Commit 2022-11-20 00:17 4ee6f3d8
View on Github →feat: port data.{nat, int}.cast.defs (#641)
mathlib3 SHA: bb168510ef455e9280a152e7f31673cabd3d7496
Porting notes for Mathlib.Data.Nat.Cast.Defs
- I have moved
AddMonoidWithOne
and related lemmas fromMathlib.Algebra.GroupWithZero.Defs
into this file. All but 3 of these were in this file in mathlib3, so this is the correct place. The extra 3 are new lemmas in Mathlib4, and I made a note to this effect. - mathport marked some translations as dubious because they used
AddMonoidWithOne
instead ofNatCast
because the latter didn't exist until this PR, so I just fixed them to useNatCast
and#align
ed (with noₓ
). - I need someone (e.g., @gebner) to rewrite the library note about coercions because I don't know enough.
- I reimplemented
Nat.binCast
from scratch because we don't haveNat.binaryRec
. The proof ofNat.binCast_eq
can likely be improved quite a bit. - I marked
Nat.cast_bit0
andNat.cast_bit1
as deprecated sincebit0
andbit1
are deprecated. - I added an instance of
OfNat R n
forn : ℕ
whenR
has anAddMonoidWithOne
instance. I think we want this in order to talk about literals as terms inR
(e.g.,37 : R
). This instance does not appear in mathlib3 and is new. I kept the (lack of)Per Gabriel's suggestion, I have kept these assimp
attributes from mathlib3 for certain lemmas which were already ported to mathlib4. This caused some breakage which I fixed. I thought it was better to be consistent with the mathlib3simp
set.simp
lemmas. Porting notes forMathlib.Data.Int.Cast.Defs
- This file already existed in Mathlib4, but it's contents corresponded to things in mathlib3's
data.int.cast.basic
, so I have moved the previous contents toMathlib.Data.Int.Cast.Basic
, hence the reason for the weird diff. - I have moved
AddGroupWithOne
and the rest of that material out ofMathlib.Algebra.GroupWithZero.Defs
so these files are now independent andMathlib.Data.Int.Cast.Defs
I think is a faithful and complete translation of the mathlib3 file.