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(data/complex/basic): upgrade complex.norm_sq to a monoid_with_zero_hom #5553

Closed
wants to merge 3 commits into from

Conversation

urkud
Copy link
Member

@urkud urkud commented Jan 1, 2021


@urkud urkud added the awaiting-review The author would like community review of the PR label Jan 1, 2021
@[simp] lemma norm_sq_I : norm_sq I = 1 := by simp [norm_sq]

lemma norm_sq_nonneg (z : ℂ) : 0 ≤ norm_sq z :=
add_nonneg (mul_self_nonneg _) (mul_self_nonneg _)

@[simp] lemma norm_sq_eq_zero {z : ℂ} : norm_sq z = 0 ↔ z = 0 :=
lemma norm_sq_eq_zero {z : ℂ} : norm_sq z = 0 ↔ z = 0 :=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this lemma somewhere in monoid_with_zero_hom too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but the proof of complex.field depends on complex.norm_sq_eq_zero, so we can't reuse the proof.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just giving a more explicit explanation for my own benefit: monoid_with_zero_hom.map_eq_zero requires the domain of the monoid_with_zero_hom to be a group_with_zero, but that instance for requires this result about norm_sq.

The proof used here relies instead on the fact that is a linear_ordered_ring.

src/analysis/special_functions/trigonometric.lean Outdated Show resolved Hide resolved
src/data/complex/basic.lean Outdated Show resolved Hide resolved
src/data/complex/is_R_or_C.lean Outdated Show resolved Hide resolved
src/data/zsqrtd/gaussian_int.lean Outdated Show resolved Hide resolved
Copy link
Collaborator

@bryangingechen bryangingechen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice observation, thanks!
bors r+

@[simp] lemma norm_sq_I : norm_sq I = 1 := by simp [norm_sq]

lemma norm_sq_nonneg (z : ℂ) : 0 ≤ norm_sq z :=
add_nonneg (mul_self_nonneg _) (mul_self_nonneg _)

@[simp] lemma norm_sq_eq_zero {z : ℂ} : norm_sq z = 0 ↔ z = 0 :=
lemma norm_sq_eq_zero {z : ℂ} : norm_sq z = 0 ↔ z = 0 :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just giving a more explicit explanation for my own benefit: monoid_with_zero_hom.map_eq_zero requires the domain of the monoid_with_zero_hom to be a group_with_zero, but that instance for requires this result about norm_sq.

The proof used here relies instead on the fact that is a linear_ordered_ring.

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Jan 2, 2021
bors bot pushed a commit that referenced this pull request Jan 2, 2021
@bors
Copy link

bors bot commented Jan 2, 2021

Pull request successfully merged into master.

Build succeeded!

And happy new year! 🎉

@bors bors bot changed the title chore(data/complex/basic): upgrade complex.norm_sq to a monoid_with_zero_hom [Merged by Bors] - chore(data/complex/basic): upgrade complex.norm_sq to a monoid_with_zero_hom Jan 2, 2021
@bors bors bot closed this Jan 2, 2021
@bors bors bot deleted the norm-sq-hom branch January 2, 2021 13:30
pglutz pushed a commit that referenced this pull request Jan 6, 2021
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