Zulip Chat Archive
Stream: mathlib4
Topic: Field names collision for type class inheritance
Qi Ge (Dec 01 2023 at 19:21):
Suppose I want to
class Foo (A: Type*) extends Class1 A, Class2 A where
  -- ...
but both Class1.bar and Class2.bar are defined for different type, what should I do?
Qi Ge (Dec 01 2023 at 19:22):
This arises in practice for LinearMap and MulActionHom where both define map_smul' field for compatibility with respect to different actions.
Adam Topaz (Dec 01 2023 at 19:30):
in lean3 it was possible to write ... extends Class1 A, Class2 A renaming foo -> bar ... but I don't think this has been introduced in Lean4.
Qi Ge (Dec 01 2023 at 19:35):
MulActionHom is relatively simple I will try hardcoding it and see how far I can go for now...
Eric Rodriguez (Dec 01 2023 at 21:04):
Does it matter in lean4? I thought extends is just sugar for generating projections
Eric Wieser (Dec 01 2023 at 21:16):
It also affects dot notation
Eric Wieser (Dec 01 2023 at 21:16):
But I guess for class that's irrelevant anyway
Last updated: May 02 2025 at 03:31 UTC