Skip to content

Commit

Permalink
chore: Turn Complex.int_cast_abs around (#10543)
Browse files Browse the repository at this point in the history
A goal about real numbers should not suddenly turn into a goal about complex numbers!
  • Loading branch information
YaelDillies committed Feb 14, 2024
1 parent 20a3319 commit 6fc8434
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Mathlib/Analysis/Complex/Basic.lean
Expand Up @@ -171,7 +171,7 @@ theorem norm_nat (n : ℕ) : ‖(n : ℂ)‖ = n :=
#align complex.norm_nat Complex.norm_nat

@[simp 1100]
theorem norm_int {n : ℤ} : ‖(n : ℂ)‖ = |(n : ℝ)| := (int_cast_abs n).symm
lemma norm_int {n : ℤ} : ‖(n : ℂ)‖ = |(n : ℝ)| := abs_intCast n
#align complex.norm_int Complex.norm_int

theorem norm_int_of_nonneg {n : ℤ} (hn : 0 ≤ n) : ‖(n : ℂ)‖ = n := by
Expand Down
9 changes: 5 additions & 4 deletions Mathlib/Data/Complex/Abs.lean
Expand Up @@ -237,10 +237,11 @@ theorem abs_im_div_abs_le_one (z : ℂ) : |z.im / Complex.abs z| ≤ 1 :=
div_le_iff (AbsoluteValue.pos Complex.abs hz), one_mul, abs_im_le_abs]
#align complex.abs_im_div_abs_le_one Complex.abs_im_div_abs_le_one

@[simp, norm_cast]
theorem int_cast_abs (n : ℤ) : |↑n| = Complex.abs n := by
rw [← ofReal_int_cast, abs_ofReal]
#align complex.int_cast_abs Complex.int_cast_abs
@[simp, norm_cast] lemma abs_intCast (n : ℤ) : abs n = |↑n| := by rw [← ofReal_int_cast, abs_ofReal]
#align complex.int_cast_abs Complex.abs_intCast

-- 2024-02-14
@[deprecated] lemma int_cast_abs (n : ℤ) : |↑n| = Complex.abs n := (abs_intCast _).symm

theorem normSq_eq_abs (x : ℂ) : normSq x = (Complex.abs x) ^ 2 := by
simp [abs, sq, abs_def, Real.mul_self_sqrt (normSq_nonneg _)]
Expand Down

0 comments on commit 6fc8434

Please sign in to comment.