|
| 1 | +/- |
| 2 | +Copyright (c) 2022 Eric Rodriguez. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Eric Rodriguez |
| 5 | +
|
| 6 | +! This file was ported from Lean 3 source module analysis.complex.arg |
| 7 | +! leanprover-community/mathlib commit 45a46f4f03f8ae41491bf3605e8e0e363ba192fd |
| 8 | +! Please do not edit these lines, except to modify the commit id |
| 9 | +! if you have ported upstream changes. |
| 10 | +-/ |
| 11 | +import Mathlib.Analysis.InnerProductSpace.Basic |
| 12 | +import Mathlib.Analysis.SpecialFunctions.Complex.Arg |
| 13 | + |
| 14 | +/-! |
| 15 | +# Rays in the complex numbers |
| 16 | +
|
| 17 | +This file links the definition `SameRay ℝ x y` with the equality of arguments of complex numbers, |
| 18 | +the usual way this is considered. |
| 19 | +
|
| 20 | +## Main statements |
| 21 | +
|
| 22 | +* `Complex.sameRay_iff` : Two complex numbers are on the same ray iff one of them is zero, or they |
| 23 | + have the same argument. |
| 24 | +* `Complex.abs_add_eq/Complex.abs_sub_eq`: If two non zero complex numbers have the same argument, |
| 25 | + then the triangle inequality is an equality. |
| 26 | +
|
| 27 | +-/ |
| 28 | + |
| 29 | + |
| 30 | +variable {x y : ℂ} |
| 31 | + |
| 32 | +namespace Complex |
| 33 | + |
| 34 | +theorem sameRay_iff : SameRay ℝ x y ↔ x = 0 ∨ y = 0 ∨ x.arg = y.arg := by |
| 35 | + rcases eq_or_ne x 0 with (rfl | hx) |
| 36 | + · simp |
| 37 | + rcases eq_or_ne y 0 with (rfl | hy) |
| 38 | + · simp |
| 39 | + simp only [hx, hy, false_or_iff, sameRay_iff_norm_smul_eq, arg_eq_arg_iff hx hy] |
| 40 | + field_simp [hx, hy] |
| 41 | + rw [mul_comm, eq_comm] |
| 42 | +#align complex.same_ray_iff Complex.sameRay_iff |
| 43 | + |
| 44 | +theorem sameRay_iff_arg_div_eq_zero : SameRay ℝ x y ↔ arg (x / y) = 0 := by |
| 45 | + rw [← Real.Angle.toReal_zero, ← arg_coe_angle_eq_iff_eq_toReal, sameRay_iff] |
| 46 | + by_cases hx : x = 0; · simp [hx] |
| 47 | + by_cases hy : y = 0; · simp [hy] |
| 48 | + simp [hx, hy, arg_div_coe_angle, sub_eq_zero] |
| 49 | +#align complex.same_ray_iff_arg_div_eq_zero Complex.sameRay_iff_arg_div_eq_zero |
| 50 | + |
| 51 | +-- Porting note: `(x + y).abs` stopped working. |
| 52 | +theorem abs_add_eq_iff : abs (x + y) = abs x + abs y ↔ x = 0 ∨ y = 0 ∨ x.arg = y.arg := |
| 53 | + sameRay_iff_norm_add.symm.trans sameRay_iff |
| 54 | +#align complex.abs_add_eq_iff Complex.abs_add_eq_iff |
| 55 | + |
| 56 | +theorem abs_sub_eq_iff : abs (x - y) = |abs x - abs y| ↔ x = 0 ∨ y = 0 ∨ x.arg = y.arg := |
| 57 | + sameRay_iff_norm_sub.symm.trans sameRay_iff |
| 58 | +#align complex.abs_sub_eq_iff Complex.abs_sub_eq_iff |
| 59 | + |
| 60 | +theorem sameRay_of_arg_eq (h : x.arg = y.arg) : SameRay ℝ x y := |
| 61 | + sameRay_iff.mpr <| Or.inr <| Or.inr h |
| 62 | +#align complex.same_ray_of_arg_eq Complex.sameRay_of_arg_eq |
| 63 | + |
| 64 | +theorem abs_add_eq (h : x.arg = y.arg) : abs (x + y) = abs x + abs y := |
| 65 | + (sameRay_of_arg_eq h).norm_add |
| 66 | +#align complex.abs_add_eq Complex.abs_add_eq |
| 67 | + |
| 68 | +theorem abs_sub_eq (h : x.arg = y.arg) : abs (x - y) = ‖abs x - abs y‖ := |
| 69 | + (sameRay_of_arg_eq h).norm_sub |
| 70 | +#align complex.abs_sub_eq Complex.abs_sub_eq |
| 71 | + |
| 72 | +end Complex |
0 commit comments