Zulip Chat Archive
Stream: mathlib4
Topic: naming: `map_int_cast` vs `map_natCast` vs `map_ratCast`
Moritz Firsching (Jan 04 2023 at 19:44):
Just when I thought I had somewhat understood the naming conventions, I stumbled upon these three names:
map_int_cast
map_natCast
map_ratCast
Is this an oversight, or is there a deeper reason why they are not consistent?
Chris Hughes (Jan 04 2023 at 19:57):
Oversight
Moritz Firsching (Jan 04 2023 at 20:07):
ok, I will prepare a fix renaming map_int_cast
to map_intCast
and similar
Moritz Firsching (Jan 04 2023 at 20:32):
Heather Macbeth (Jan 06 2023 at 03:19):
Given that
import Mathlib.Data.Nat.Cast.Basic
example [Ring α] [Ring β] [RingHomClass F α β] (f : F) : f 2 = 2 :=
map_natCast f 2
works and map_natCast
is tagged simp, why doesn't
import Mathlib.Data.Nat.Cast.Basic
example [Ring α] [Ring β] [RingHomClass F α β] (f : F) : f 2 = 2 := by
simp
work?
Heather Macbeth (Jan 06 2023 at 03:19):
(Encountered while debugging something previously proved with map_bit0
.)
Scott Morrison (Jan 06 2023 at 06:27):
The head of the expression is a variable, so there is nothing to index this on. This is the same behaviour as in Lean 3.
Heather Macbeth (Jan 06 2023 at 06:28):
Interesting, should we remove the simp tag then?
Heather Macbeth (Jan 06 2023 at 06:29):
And would it be worth adding simp-lemmas for some small numbers,
lemma map_two [Ring α] [Ring β] [RingHomClass F α β] (f : F) : f 2 = 2 :=
map_natCast f 2
lemma map_three [Ring α] [Ring β] [RingHomClass F α β] (f : F) : f 3 = 3 :=
map_natCast f 3
Scott Morrison (Jan 06 2023 at 07:07):
They aren't going to work any better with simp
, so I'm not sure where we'd be using them.
Heather Macbeth (Jan 06 2023 at 07:12):
Oh ... the problem is RingHomClass
, not Nat.cast
?
Reid Barton (Jan 06 2023 at 07:55):
Is the head really a variable? Maybe this is https://github.com/leanprover/lean4/issues/1937 instead?
Kevin Buzzard (Jan 06 2023 at 07:56):
Which apparently has been fixed :-)
Reid Barton (Jan 06 2023 at 07:58):
Yes but I don't know if mathlib4 is on the new version yet.
Eric Wieser (Jan 06 2023 at 10:54):
The head symbol here is FunLike.coe
Scott Morrison (Jan 07 2023 at 02:11):
mathlib4#1397 bumps to the latest nightly, which should bring in the fix for lean4#1937.
Scott Morrison (Jan 07 2023 at 02:11):
(anagram not intended...?)
Eric Wieser (Jan 07 2023 at 03:13):
That link doesn't work for me?
Last updated: Dec 20 2023 at 11:08 UTC