-
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] - chore(algebra/group/type_tags): add additive.to_mul
etc
#2363
Conversation
Don't make `additive` and `multiplicative` irreducible (yet?) because it breaks compilation here and there. Also prove that homomorphisms from `ℕ`, `ℤ` and their `multiplicative` versionsare defined by the image of `1`.
rfl | ||
|
||
@[simp] lemma to_add_mul [has_add α] (x y : multiplicative α) : | ||
(x * y).to_add = x.to_add + y.to_add := |
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.
@robertylewis Can we hook this up to norm_cast
even though it's not (and should not be) coe
?
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.
Not really. It might work with the current norm_cast
, but in the open PR (that will be finished eventually), we classify lemmas according to the position of coe
. It's not really designed to work with arbitrary coercion operators.
src/algebra/group_power.lean
Outdated
@@ -647,3 +649,41 @@ end int | |||
|
|||
@[simp] lemma neg_square {α} [ring α] (z : α) : (-z)^2 = z^2 := | |||
by simp [pow, monoid.pow] | |||
|
|||
@[simp] lemma pow_of_add [add_monoid A] (x : A) (n : ℕ) : | |||
(multiplicative.of_add x)^n = multiplicative.of_add (n • x) := rfl |
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.
Most of the time the simp-lemmas go the other way, that is, they move the of_add
into the operation. I don't know which direction is best.
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.
Oh, I missed this comment before. Yes, this definitely goes against the grain of the usual simp normal form.
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.
You can think that you move of_add
outside or pow
inside. I'm not sure which point of view is more appropriate here. In all my use cases I want to rewrite this lemma left to right but it's OK with me to remove it from simp
completely and use simp [pow_of_add]
.
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.
OTOH, I move to_add
inside of *
in another lemma. I'll see if rewriting in the other direction closes the goals.
I've changed the bors r+ |
👎 Rejected by label |
Ooops. bors r+ |
Don't make `additive` and `multiplicative` irreducible (yet?) because it breaks compilation here and there. Also prove that homomorphisms from `ℕ`, `ℤ` and their `multiplicative` versions are defined by the image of `1`. Co-authored-by: Gabriel Ebner <gebner@gebner.org>
Pull request successfully merged into master. Build succeeded: |
additive.to_mul
etcadditive.to_mul
etc
Also add an explicit instance for `submodule.has_coe_to_sort`. This way `rintro ⟨x, hx⟩` results in `(hx : x ∈ p)`. Also fixes some timeouts introduced by #2363. See Zulip: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/partrec_code
…-community#2363) Don't make `additive` and `multiplicative` irreducible (yet?) because it breaks compilation here and there. Also prove that homomorphisms from `ℕ`, `ℤ` and their `multiplicative` versions are defined by the image of `1`. Co-authored-by: Gabriel Ebner <gebner@gebner.org>
Also add an explicit instance for `submodule.has_coe_to_sort`. This way `rintro ⟨x, hx⟩` results in `(hx : x ∈ p)`. Also fixes some timeouts introduced by leanprover-community#2363. See Zulip: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/partrec_code
…-community#2363) Don't make `additive` and `multiplicative` irreducible (yet?) because it breaks compilation here and there. Also prove that homomorphisms from `ℕ`, `ℤ` and their `multiplicative` versions are defined by the image of `1`. Co-authored-by: Gabriel Ebner <gebner@gebner.org>
Also add an explicit instance for `submodule.has_coe_to_sort`. This way `rintro ⟨x, hx⟩` results in `(hx : x ∈ p)`. Also fixes some timeouts introduced by leanprover-community#2363. See Zulip: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/partrec_code
…-community#2363) Don't make `additive` and `multiplicative` irreducible (yet?) because it breaks compilation here and there. Also prove that homomorphisms from `ℕ`, `ℤ` and their `multiplicative` versions are defined by the image of `1`. Co-authored-by: Gabriel Ebner <gebner@gebner.org>
Also add an explicit instance for `submodule.has_coe_to_sort`. This way `rintro ⟨x, hx⟩` results in `(hx : x ∈ p)`. Also fixes some timeouts introduced by leanprover-community#2363. See Zulip: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/partrec_code
Don't make
additive
andmultiplicative
irreducible (yet?) becauseit breaks compilation here and there.
Also prove that homomorphisms from
ℕ
,ℤ
and theirmultiplicative
versions are defined by the image of
1
.TO CONTRIBUTORS:
Make sure you have:
If this PR is related to a discussion on Zulip, please include a link in the discussion.
For reviewers: code review check list