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
Conversation
urkud
commented
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 := |
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.
Is this lemma somewhere in monoid_with_zero_hom
too?
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.
Yes but the proof of complex.field
depends on complex.norm_sq_eq_zero
, so we can't reuse the proof.
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.
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
.
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.
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 := |
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.
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
.
Pull request successfully merged into master. Build succeeded! And happy new year! 🎉 |
complex.norm_sq
to a monoid_with_zero_hom
complex.norm_sq
to a monoid_with_zero_hom