-
Notifications
You must be signed in to change notification settings - Fork 297
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] - fix(algebra/group/units): splitting out mul_one_class
for group of units
#14923
Conversation
comm_monoid.to_monoid
units.group
(there was some nonsense here) |
units.group
mul_one_class
for group of units
mul_one_class
for group of unitsmul_one_class
for group of units
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.
However, I don't understand 100% why splitting out the mul_one_class from the group αˣ instance improves things.
It doesn't surprise me that adding an intermediate instance helps things along, since Lean is very slow at checking equality of instances (like units.group
) of types (like units
) that appear in instances (like units.mul_one_class
).
Could you add the timeout example as a test case, for example in a new file test/units.lean
?
src/algebra/group/units.lean
Outdated
mul_assoc := λ u₁ u₂ u₃, ext $ mul_assoc u₁ u₂ u₃, | ||
@[to_additive "Additive units of an additive monoid form an additive group."] | ||
instance : group αˣ := | ||
{ mul_assoc := λ u₁ u₂ u₃, ext $ mul_assoc u₁ u₂ u₃, |
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.
We typically copy over data like this, for better unfolding. Or does that reintroduce the timeout?
{ mul_assoc := λ u₁ u₂ u₃, ext $ mul_assoc u₁ u₂ u₃, | |
{ mul := (*), | |
one := 1, | |
mul_assoc := λ u₁ u₂ u₃, ext $ mul_assoc u₁ u₂ u₃, |
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.
ok, made your suggested changes and added the test case, thx.
Out of curiosity, why does this improve unfolding if you specify mul
and one
like this?
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.
IIRC, specifying mul
means the unfolded version of units.group
will give theorems stated using *
instead of mul_one_class.to_has_mul.mul
or something like that.
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.
I'm much happier with this than the previous priority-based solutions. Just a small comment, and Anne's suggestion to go.
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 r+
…units (#14923) Without this proposed change, the following example gives a `(deterministic) timeout`: ```lean import algebra.ring.basic example (R : Type*) [comm_ring R] (a b : Rˣ) : a * (b / a) = b := begin rw mul_div_cancel'_right, -- or: `simp` end ``` Co-authored-by: Jon Eugster <j.eugster@sms.ed.ac.uk>
Pull request successfully merged into master. Build succeeded: |
mul_one_class
for group of unitsmul_one_class
for group of units
…units (#14923) Without this proposed change, the following example gives a `(deterministic) timeout`: ```lean import algebra.ring.basic example (R : Type*) [comm_ring R] (a b : Rˣ) : a * (b / a) = b := begin rw mul_div_cancel'_right, -- or: `simp` end ``` Co-authored-by: Jon Eugster <j.eugster@sms.ed.ac.uk>
Without this proposed change, the following example gives a
(deterministic) timeout
:Note: After a lot of iterations this is now at a short solution that does not change any instance priorities, thus should hopefully not cause future problems. However, I don't understand 100% why splitting out the
mul_one_class
from thegroup αˣ
instance improves things.Zulip