Zulip Chat Archive
Stream: general
Topic: bad instance?
Yury G. Kudryashov (Dec 03 2021 at 10:09):
It seems that docs#finite_dimensional.proper_is_R_or_C is a bad instance. Since Lean resolves instances right-to-left, it looks for [finite_dimensional ?x F]
, then tries to find [is_R_or_C k]
with k = ?x
.
Yury G. Kudryashov (Dec 03 2021 at 10:09):
Am I right?
Yury G. Kudryashov (Dec 03 2021 at 10:10):
Found while trying to find the reason for linter failures in #10490
Gabriel Ebner (Dec 03 2021 at 10:13):
It's bad because it enumerates all finite_dimension ?x F
instances, i.e., all base fields for the vector space. In this instance it would indeed be better if is_R_or_C ?x
was solved first.
Yury G. Kudryashov (Dec 03 2021 at 10:16):
Should we turn it into a non-instance?
Gabriel Ebner (Dec 03 2021 at 10:20):
Could we replace K by \real in that instance?
Sebastien Gouezel (Dec 03 2021 at 10:27):
We can turn it as a non-instance, and only register it as an instance for . Hopefully this should also apply automatically in the complex situation, as a complex vector space is also registered automatically as a real vector space.
Yury G. Kudryashov (Dec 03 2021 at 11:00):
We already have an instance for . The proof for is_R_or_C
uses it, see src#finite_dimensional.proper_is_R_or_C
Sebastien Gouezel (Dec 03 2021 at 11:22):
Then I would just make this a lemma instead of an instance. Does it break anything?
Yury G. Kudryashov (Dec 03 2021 at 20:30):
Yes, it does. I'll try to fix it tonight.
Last updated: Dec 20 2023 at 11:08 UTC