Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

urkud
Copy link
Member

@urkud urkud commented Apr 8, 2020

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.

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

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`.
@urkud
Copy link
Member Author

urkud commented Apr 8, 2020

@gebner @digama0 This is supposed to be a version of #2292 that allows us to visually tell * in multiplicative nat from * in nat while not breaking existing code.

@urkud urkud added the awaiting-review The author would like community review of the PR label Apr 8, 2020
@jcommelin jcommelin requested review from gebner and digama0 April 9, 2020 13:15
rfl

@[simp] lemma to_add_mul [has_add α] (x y : multiplicative α) :
(x * y).to_add = x.to_add + y.to_add :=
Copy link
Member

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?

Copy link
Member

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.

@@ -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
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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].

Copy link
Member Author

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.

@urkud urkud added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Apr 9, 2020
@gebner
Copy link
Member

gebner commented Apr 18, 2020

I've changed the pow_of_add and gpow_of_add into the commonly used direction.

bors r+

@bors
Copy link

bors bot commented Apr 18, 2020

👎 Rejected by label

@gebner gebner removed the awaiting-author A reviewer has asked the author a question or requested changes label Apr 18, 2020
@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Apr 18, 2020
@gebner
Copy link
Member

gebner commented Apr 18, 2020

Ooops.

bors r+

bors bot pushed a commit that referenced this pull request Apr 18, 2020
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>
@bors
Copy link

bors bot commented Apr 18, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title chore(algebra/group/type_tags): add additive.to_mul etc [Merged by Bors] - chore(algebra/group/type_tags): add additive.to_mul etc Apr 18, 2020
@bors bors bot closed this Apr 18, 2020
@bors bors bot deleted the multiplicative-to-of branch April 18, 2020 15:15
bors bot pushed a commit that referenced this pull request May 2, 2020
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
anrddh pushed a commit to anrddh/mathlib that referenced this pull request May 15, 2020
…-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>
anrddh pushed a commit to anrddh/mathlib that referenced this pull request May 15, 2020
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
anrddh pushed a commit to anrddh/mathlib that referenced this pull request May 16, 2020
…-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>
anrddh pushed a commit to anrddh/mathlib that referenced this pull request May 16, 2020
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
cipher1024 pushed a commit to cipher1024/mathlib that referenced this pull request Mar 15, 2022
…-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>
cipher1024 pushed a commit to cipher1024/mathlib that referenced this pull request Mar 15, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants