Skip to content

Commit a6885a1

Browse files
feat: port Analysis.Complex.Arg (#4355)
Co-authored-by: Eric Rodriguez <37984851+ericrbg@users.noreply.github.com>
1 parent fa76ef0 commit a6885a1

File tree

4 files changed

+75
-2
lines changed

4 files changed

+75
-2
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
413413
import Mathlib.Analysis.Calculus.FDeriv.Star
414414
import Mathlib.Analysis.Calculus.FormalMultilinearSeries
415415
import Mathlib.Analysis.Calculus.TangentCone
416+
import Mathlib.Analysis.Complex.Arg
416417
import Mathlib.Analysis.Complex.Basic
417418
import Mathlib.Analysis.Complex.Circle
418419
import Mathlib.Analysis.Complex.Conformal

Mathlib/Analysis/Complex/Arg.lean

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

Mathlib/Analysis/Convex/StrictConvexSpace.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ theorem not_sameRay_iff_norm_add_lt : ¬SameRay ℝ x y ↔ ‖x + y‖ < ‖x
224224
#align not_same_ray_iff_norm_add_lt not_sameRay_iff_norm_add_lt
225225

226226
theorem sameRay_iff_norm_sub : SameRay ℝ x y ↔ ‖x - y‖ = |‖x‖ - ‖y‖| :=
227-
⟨SameRay.norm_sub (F := E), fun h =>
227+
⟨SameRay.norm_sub, fun h =>
228228
Classical.not_not.1 fun h' => (abs_lt_norm_sub_of_not_sameRay h').ne' h⟩
229229
#align same_ray_iff_norm_sub sameRay_iff_norm_sub
230230

Mathlib/Analysis/NormedSpace/Ray.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ theorem norm_sub (h : SameRay ℝ x y) : ‖x - y‖ = |‖x‖ - ‖y‖| := by
4343
wlog hab : b ≤ a with H
4444
· rw [SameRay.sameRay_comm] at h
4545
rw [norm_sub_rev, abs_sub_comm]
46-
have := @H E _ _ F
46+
have := @H E _ _
4747
exact this u b a hb ha h (le_of_not_le hab)
4848
rw [← sub_nonneg] at hab
4949
rw [← sub_smul, norm_smul_of_nonneg hab, norm_smul_of_nonneg ha, norm_smul_of_nonneg hb, ←

0 commit comments

Comments
 (0)