-
Notifications
You must be signed in to change notification settings - Fork 298
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] - chore(linear_algebra/tensor_product): remove @[ext]
tag from tensor_product.mk_compr₂_inj
#8868
Conversation
@[ext]
tag from tensor_product.mk_compr₂_inj
@[ext]
tag from tensor_product.mk_compr₂_inj
@[ext]
tag from tensor_product.mk_compr₂_inj
Can we fix this by adjusting the priority instead? Or perhaps by locally removing the attribute where it causes timeouts? I don't really like the idea of removing this ext lemma (which for reference was added in #6105), because the chance of someone who needs it finding it is very small. |
I guess that could be another option, but my concern is that it seems to cause performance problems in fairly generic situations (i.e. calling ext on a linear map) -- this might also be hard to debug for someone who is not aware of the issue. Maybe we could rename the lemma to |
I wonder if replacing theorem tensor_product.mk_compr₂_inj {R : Type u_1} [comm_semiring R] {M : Type u_4} {N : Type u_5} {P : Type u_6}
[add_comm_monoid M] [add_comm_monoid N] [add_comm_monoid P] [module R M] [module R N] [module R P]
{g h : M ⊗ N →ₗ[R] P} (H : (tensor_product.mk R M N).compr₂ g = (tensor_product.mk R M N).compr₂ h) :
g = h but perhaps it would be faster as theorem tensor_product.mk_compr₂_inj {R : Type u_1} {_ : comm_semiring R} {M : Type u_4} {N : Type u_5} {P : Type u_6}
{add_comm_monoid M : _} {add_comm_monoid N : _} {add_comm_monoid P : _} {_ : module R M} {_ : module R N} {_ : module R P}
{g h : M ⊗ N →ₗ[R] P} (H : (tensor_product.mk R M N).compr₂ g = (tensor_product.mk R M N).compr₂ h) :
g = h
|
I actually tried that first :-) It made no difference on the compile time. |
I have now renamed |
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.
Thanks 🎉
bors merge
…r_product.mk_compr₂_inj` (#8868) This PR removes the `@[ext]` tag from `tensor_product.mk_compr₂_inj` and readds it locally only where it is needed. This is a workaround for the issue discussed [in this Zulip thread](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/odd.20repeated.20type.20class.20search): basically, when `ext` tries to apply this lemma to linear maps, it fails only after a very long typeclass search. While this problem is already present to some extent in current mathlib, it is exacerbated by the [upcoming generalization of linear maps to semilinear maps](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Semilinear.20maps). In addition to this change, a few individual uses of `ext` have been replaced by a manual application of the relevant ext lemma(s) for performance reasons. For discoverability, the lemma `tensor_product.mk_compr₂_inj` is renamed to `tensor_product.ext` and the former `tensor_product.ext` to `tensor_product.ext'`.
Pull request successfully merged into master. Build succeeded: |
@[ext]
tag from tensor_product.mk_compr₂_inj
@[ext]
tag from tensor_product.mk_compr₂_inj
This PR removes the
@[ext]
tag fromtensor_product.mk_compr₂_inj
and readds it locally only where it is needed. This is a workaround for the issue discussed in this Zulip thread: basically, whenext
tries to apply this lemma to linear maps, it fails only after a very long typeclass search. While this problem is already present to some extent in current mathlib, it is exacerbated by the upcoming generalization of linear maps to semilinear maps.In addition to this change, a few individual uses of
ext
have been replaced by a manual application of the relevant ext lemma(s) for performance reasons.For discoverability, the lemma
tensor_product.mk_compr₂_inj
is renamed totensor_product.ext
and the formertensor_product.ext
totensor_product.ext'
.