[GOAL]
x : ℂ
⊢ Real.sin (arg x) = x.im / ↑abs x
[PROOFSTEP]
unfold arg
[GOAL]
x : ℂ
⊢ Real.sin
      (if 0 ≤ x.re then arcsin (x.im / ↑abs x)
      else if 0 ≤ x.im then arcsin ((-x).im / ↑abs x) + π else arcsin ((-x).im / ↑abs x) - π) =
    x.im / ↑abs x
[PROOFSTEP]
split_ifs
[GOAL]
case pos
x : ℂ
h✝ : 0 ≤ x.re
⊢ Real.sin (arcsin (x.im / ↑abs x)) = x.im / ↑abs x
[PROOFSTEP]
simp [sub_eq_add_neg, arg,
  Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2, Real.sin_add, neg_div,
  Real.arcsin_neg, Real.sin_neg]
[GOAL]
case pos
x : ℂ
h✝¹ : ¬0 ≤ x.re
h✝ : 0 ≤ x.im
⊢ Real.sin (arcsin ((-x).im / ↑abs x) + π) = x.im / ↑abs x
[PROOFSTEP]
simp [sub_eq_add_neg, arg,
  Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2, Real.sin_add, neg_div,
  Real.arcsin_neg, Real.sin_neg]
[GOAL]
case neg
x : ℂ
h✝¹ : ¬0 ≤ x.re
h✝ : ¬0 ≤ x.im
⊢ Real.sin (arcsin ((-x).im / ↑abs x) - π) = x.im / ↑abs x
[PROOFSTEP]
simp [sub_eq_add_neg, arg,
  Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2, Real.sin_add, neg_div,
  Real.arcsin_neg, Real.sin_neg]
[GOAL]
x : ℂ
hx : x ≠ 0
⊢ Real.cos (arg x) = x.re / ↑abs x
[PROOFSTEP]
rw [arg]
[GOAL]
x : ℂ
hx : x ≠ 0
⊢ Real.cos
      (if 0 ≤ x.re then arcsin (x.im / ↑abs x)
      else if 0 ≤ x.im then arcsin ((-x).im / ↑abs x) + π else arcsin ((-x).im / ↑abs x) - π) =
    x.re / ↑abs x
[PROOFSTEP]
split_ifs with h₁ h₂
[GOAL]
case pos
x : ℂ
hx : x ≠ 0
h₁ : 0 ≤ x.re
⊢ Real.cos (arcsin (x.im / ↑abs x)) = x.re / ↑abs x
[PROOFSTEP]
rw [Real.cos_arcsin]
[GOAL]
case pos
x : ℂ
hx : x ≠ 0
h₁ : 0 ≤ x.re
⊢ sqrt (1 - (x.im / ↑abs x) ^ 2) = x.re / ↑abs x
[PROOFSTEP]
field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
[GOAL]
case pos
x : ℂ
hx : x ≠ 0
h₁ : ¬0 ≤ x.re
h₂ : 0 ≤ x.im
⊢ Real.cos (arcsin ((-x).im / ↑abs x) + π) = x.re / ↑abs x
[PROOFSTEP]
rw [Real.cos_add_pi, Real.cos_arcsin]
[GOAL]
case pos
x : ℂ
hx : x ≠ 0
h₁ : ¬0 ≤ x.re
h₂ : 0 ≤ x.im
⊢ -sqrt (1 - ((-x).im / ↑abs x) ^ 2) = x.re / ↑abs x
[PROOFSTEP]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *]
[GOAL]
case neg
x : ℂ
hx : x ≠ 0
h₁ : ¬0 ≤ x.re
h₂ : ¬0 ≤ x.im
⊢ Real.cos (arcsin ((-x).im / ↑abs x) - π) = x.re / ↑abs x
[PROOFSTEP]
rw [Real.cos_sub_pi, Real.cos_arcsin]
[GOAL]
case neg
x : ℂ
hx : x ≠ 0
h₁ : ¬0 ≤ x.re
h₂ : ¬0 ≤ x.im
⊢ -sqrt (1 - ((-x).im / ↑abs x) ^ 2) = x.re / ↑abs x
[PROOFSTEP]
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *]
[GOAL]
x : ℂ
⊢ ↑(↑abs x) * exp (↑(arg x) * I) = x
[PROOFSTEP]
rcases eq_or_ne x 0 with (rfl | hx)
[GOAL]
case inl
⊢ ↑(↑abs 0) * exp (↑(arg 0) * I) = 0
[PROOFSTEP]
simp
[GOAL]
case inr
x : ℂ
hx : x ≠ 0
⊢ ↑(↑abs x) * exp (↑(arg x) * I) = x
[PROOFSTEP]
have : abs x ≠ 0 := abs.ne_zero hx
[GOAL]
case inr
x : ℂ
hx : x ≠ 0
this : ↑abs x ≠ 0
⊢ ↑(↑abs x) * exp (↑(arg x) * I) = x
[PROOFSTEP]
ext
[GOAL]
case inr.a
x : ℂ
hx : x ≠ 0
this : ↑abs x ≠ 0
⊢ (↑(↑abs x) * exp (↑(arg x) * I)).re = x.re
[PROOFSTEP]
field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
[GOAL]
case inr.a
x : ℂ
hx : x ≠ 0
this : ↑abs x ≠ 0
⊢ (↑(↑abs x) * exp (↑(arg x) * I)).im = x.im
[PROOFSTEP]
field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
[GOAL]
x : ℂ
⊢ ↑(↑abs x) * (cos ↑(arg x) + sin ↑(arg x) * I) = x
[PROOFSTEP]
rw [← exp_mul_I, abs_mul_exp_arg_mul_I]
[GOAL]
z : ℂ
⊢ ↑abs z = 1 ↔ ∃ θ, exp (↑θ * I) = z
[PROOFSTEP]
refine' ⟨fun hz => ⟨arg z, _⟩, _⟩
[GOAL]
case refine'_1
z : ℂ
hz : ↑abs z = 1
⊢ exp (↑(arg z) * I) = z
[PROOFSTEP]
calc
  exp (arg z * I) = abs z * exp (arg z * I) := by rw [hz, ofReal_one, one_mul]
  _ = z := abs_mul_exp_arg_mul_I z
[GOAL]
z : ℂ
hz : ↑abs z = 1
⊢ exp (↑(arg z) * I) = ↑(↑abs z) * exp (↑(arg z) * I)
[PROOFSTEP]
rw [hz, ofReal_one, one_mul]
[GOAL]
case refine'_2
z : ℂ
⊢ (∃ θ, exp (↑θ * I) = z) → ↑abs z = 1
[PROOFSTEP]
rintro ⟨θ, rfl⟩
[GOAL]
case refine'_2.intro
θ : ℝ
⊢ ↑abs (exp (↑θ * I)) = 1
[PROOFSTEP]
exact Complex.abs_exp_ofReal_mul_I θ
[GOAL]
⊢ (Set.range fun x => exp (↑x * I)) = Metric.sphere 0 1
[PROOFSTEP]
ext x
[GOAL]
case h
x : ℂ
⊢ (x ∈ Set.range fun x => exp (↑x * I)) ↔ x ∈ Metric.sphere 0 1
[PROOFSTEP]
simp only [mem_sphere_zero_iff_norm, norm_eq_abs, abs_eq_one_iff, Set.mem_range]
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
⊢ arg (↑r * (cos ↑θ + sin ↑θ * I)) = θ
[PROOFSTEP]
simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
⊢ (if 0 ≤ (↑r * (cos ↑θ + sin ↑θ * I)).re then arcsin ((↑r * (cos ↑θ + sin ↑θ * I)).im / r)
    else
      if 0 ≤ (↑r * (cos ↑θ + sin ↑θ * I)).im then arcsin ((-(↑r * (cos ↑θ + sin ↑θ * I))).im / r) + π
      else arcsin ((-(↑r * (cos ↑θ + sin ↑θ * I))).im / r) - π) =
    θ
[PROOFSTEP]
simp only [ofReal_mul_re, ofReal_mul_im, neg_im, ← ofReal_cos, ← ofReal_sin, ← mk_eq_add_mul_I, neg_div,
  mul_div_cancel_left _ hr.ne', mul_nonneg_iff_right_nonneg_of_pos hr]
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
by_cases h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2)
[GOAL]
case pos
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2)
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
rw [if_pos]
[GOAL]
case pos
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2)
⊢ arcsin (Real.sin θ) = θ
case pos.hc r : ℝ hr : 0 < r θ : ℝ hθ : θ ∈ Set.Ioc (-π) π h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2) ⊢ 0 ≤ Real.cos θ
[PROOFSTEP]
exacts [Real.arcsin_sin' h₁, Real.cos_nonneg_of_mem_Icc h₁]
[GOAL]
case neg
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
h₁ : ¬θ ∈ Set.Icc (-(π / 2)) (π / 2)
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
rw [Set.mem_Icc, not_and_or, not_le, not_le] at h₁
[GOAL]
case neg
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
h₁ : θ < -(π / 2) ∨ π / 2 < θ
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
cases' h₁ with h₁ h₁
[GOAL]
case neg.inl
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
h₁ : θ < -(π / 2)
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
replace hθ := hθ.1
[GOAL]
case neg.inl
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
have hcos : Real.cos θ < 0 := by
  rw [← neg_pos, ← Real.cos_add_pi]
  refine' Real.cos_pos_of_mem_Ioo ⟨_, _⟩ <;> linarith
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
⊢ Real.cos θ < 0
[PROOFSTEP]
rw [← neg_pos, ← Real.cos_add_pi]
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
⊢ 0 < Real.cos (θ + π)
[PROOFSTEP]
refine' Real.cos_pos_of_mem_Ioo ⟨_, _⟩
[GOAL]
case refine'_1
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
⊢ -(π / 2) < θ + π
[PROOFSTEP]
linarith
[GOAL]
case refine'_2
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
⊢ θ + π < π / 2
[PROOFSTEP]
linarith
[GOAL]
case neg.inl
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
have hsin : Real.sin θ < 0 := Real.sin_neg_of_neg_of_neg_pi_lt (by linarith) hθ
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
⊢ θ < 0
[PROOFSTEP]
linarith
[GOAL]
case neg.inl
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
hsin : Real.sin θ < 0
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
rw [if_neg, if_neg, ← Real.sin_add_pi, Real.arcsin_sin, add_sub_cancel] <;> [linarith; linarith; exact hsin.not_le;
  exact hcos.not_le]
[GOAL]
case neg.inl
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
hsin : Real.sin θ < 0
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
rw [if_neg, if_neg, ← Real.sin_add_pi, Real.arcsin_sin, add_sub_cancel]
[GOAL]
case neg.inl.hx₁
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
hsin : Real.sin θ < 0
⊢ -(π / 2) ≤ θ + π
[PROOFSTEP]
linarith
[GOAL]
case neg.inl.hx₂
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
hsin : Real.sin θ < 0
⊢ θ + π ≤ π / 2
[PROOFSTEP]
linarith
[GOAL]
case neg.inl.hnc
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
hsin : Real.sin θ < 0
⊢ ¬0 ≤ Real.sin θ
[PROOFSTEP]
exact hsin.not_le
[GOAL]
case neg.inl.hnc
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : θ < -(π / 2)
hθ : -π < θ
hcos : Real.cos θ < 0
hsin : Real.sin θ < 0
⊢ ¬0 ≤ Real.cos θ
[PROOFSTEP]
exact hcos.not_le
[GOAL]
case neg.inr
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
h₁ : π / 2 < θ
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
replace hθ := hθ.2
[GOAL]
case neg.inr
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
have hcos : Real.cos θ < 0 := Real.cos_neg_of_pi_div_two_lt_of_lt h₁ (by linarith)
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
⊢ θ < π + π / 2
[PROOFSTEP]
linarith
[GOAL]
case neg.inr
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
have hsin : 0 ≤ Real.sin θ := Real.sin_nonneg_of_mem_Icc ⟨by linarith, hθ⟩
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
⊢ 0 ≤ θ
[PROOFSTEP]
linarith
[GOAL]
case neg.inr
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
hsin : 0 ≤ Real.sin θ
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
rw [if_neg, if_pos, ← Real.sin_sub_pi, Real.arcsin_sin, sub_add_cancel] <;> [linarith; linarith; exact hsin;
  exact hcos.not_le]
[GOAL]
case neg.inr
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
hsin : 0 ≤ Real.sin θ
⊢ (if 0 ≤ Real.cos θ then arcsin (Real.sin θ)
    else if 0 ≤ Real.sin θ then arcsin (-Real.sin θ) + π else arcsin (-Real.sin θ) - π) =
    θ
[PROOFSTEP]
rw [if_neg, if_pos, ← Real.sin_sub_pi, Real.arcsin_sin, sub_add_cancel]
[GOAL]
case neg.inr.hx₁
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
hsin : 0 ≤ Real.sin θ
⊢ -(π / 2) ≤ θ - π
[PROOFSTEP]
linarith
[GOAL]
case neg.inr.hx₂
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
hsin : 0 ≤ Real.sin θ
⊢ θ - π ≤ π / 2
[PROOFSTEP]
linarith
[GOAL]
case neg.inr.hc
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
hsin : 0 ≤ Real.sin θ
⊢ 0 ≤ Real.sin θ
[PROOFSTEP]
exact hsin
[GOAL]
case neg.inr.hnc
r : ℝ
hr : 0 < r
θ : ℝ
h₁ : π / 2 < θ
hθ : θ ≤ π
hcos : Real.cos θ < 0
hsin : 0 ≤ Real.sin θ
⊢ ¬0 ≤ Real.cos θ
[PROOFSTEP]
exact hcos.not_le
[GOAL]
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
⊢ arg (cos ↑θ + sin ↑θ * I) = θ
[PROOFSTEP]
rw [← one_mul (_ + _), ← ofReal_one, arg_mul_cos_add_sin_mul_I zero_lt_one hθ]
[GOAL]
⊢ arg 0 = 0
[PROOFSTEP]
simp [arg, le_refl]
[GOAL]
x y : ℂ
h₁ : ↑abs x = ↑abs y
h₂ : arg x = arg y
⊢ x = y
[PROOFSTEP]
rw [← abs_mul_exp_arg_mul_I x, ← abs_mul_exp_arg_mul_I y, h₁, h₂]
[GOAL]
z : ℂ
⊢ arg z ∈ Set.Ioc (-π) π
[PROOFSTEP]
have hπ : 0 < π := Real.pi_pos
[GOAL]
z : ℂ
hπ : 0 < π
⊢ arg z ∈ Set.Ioc (-π) π
[PROOFSTEP]
rcases eq_or_ne z 0 with (rfl | hz)
[GOAL]
case inl
hπ : 0 < π
⊢ arg 0 ∈ Set.Ioc (-π) π
case inr z : ℂ hπ : 0 < π hz : z ≠ 0 ⊢ arg z ∈ Set.Ioc (-π) π
[PROOFSTEP]
simp [hπ, hπ.le]
[GOAL]
case inr
z : ℂ
hπ : 0 < π
hz : z ≠ 0
⊢ arg z ∈ Set.Ioc (-π) π
[PROOFSTEP]
rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos (arg z) (-π) with ⟨N, hN, -⟩
[GOAL]
case inr.intro.intro
z : ℂ
hπ : 0 < π
hz : z ≠ 0
N : ℤ
hN : arg z + N • (2 * π) ∈ Set.Ioc (-π) (-π + 2 * π)
⊢ arg z ∈ Set.Ioc (-π) π
[PROOFSTEP]
rw [two_mul, neg_add_cancel_left, ← two_mul, zsmul_eq_mul] at hN
[GOAL]
case inr.intro.intro
z : ℂ
hπ : 0 < π
hz : z ≠ 0
N : ℤ
hN : arg z + ↑N * (2 * π) ∈ Set.Ioc (-π) π
⊢ arg z ∈ Set.Ioc (-π) π
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I z, ← cos_add_int_mul_two_pi _ N, ← sin_add_int_mul_two_pi _ N]
[GOAL]
case inr.intro.intro
z : ℂ
hπ : 0 < π
hz : z ≠ 0
N : ℤ
hN : arg z + ↑N * (2 * π) ∈ Set.Ioc (-π) π
⊢ arg (↑(↑abs z) * (cos (↑(arg z) + ↑N * (2 * ↑π)) + sin (↑(arg z) + ↑N * (2 * ↑π)) * I)) ∈ Set.Ioc (-π) π
[PROOFSTEP]
simp only [← ofReal_one, ← ofReal_bit0, ← ofReal_mul, ← ofReal_add, ofReal_int_cast]
[GOAL]
case inr.intro.intro
z : ℂ
hπ : 0 < π
hz : z ≠ 0
N : ℤ
hN : arg z + ↑N * (2 * π) ∈ Set.Ioc (-π) π
⊢ arg (↑(↑abs z) * (cos (↑(arg z) + ↑N * (2 * ↑π)) + sin (↑(arg z) + ↑N * (2 * ↑π)) * I)) ∈ Set.Ioc (-π) π
[PROOFSTEP]
have := arg_mul_cos_add_sin_mul_I (abs.pos hz) hN
[GOAL]
case inr.intro.intro
z : ℂ
hπ : 0 < π
hz : z ≠ 0
N : ℤ
hN : arg z + ↑N * (2 * π) ∈ Set.Ioc (-π) π
this : arg (↑(↑abs z) * (cos ↑(arg z + ↑N * (2 * π)) + sin ↑(arg z + ↑N * (2 * π)) * I)) = arg z + ↑N * (2 * π)
⊢ arg (↑(↑abs z) * (cos (↑(arg z) + ↑N * (2 * ↑π)) + sin (↑(arg z) + ↑N * (2 * ↑π)) * I)) ∈ Set.Ioc (-π) π
[PROOFSTEP]
push_cast at this
[GOAL]
case inr.intro.intro
z : ℂ
hπ : 0 < π
hz : z ≠ 0
N : ℤ
hN : arg z + ↑N * (2 * π) ∈ Set.Ioc (-π) π
this : arg (↑(↑abs z) * (cos (↑(arg z) + ↑N * (2 * ↑π)) + sin (↑(arg z) + ↑N * (2 * ↑π)) * I)) = arg z + ↑N * (2 * π)
⊢ arg (↑(↑abs z) * (cos (↑(arg z) + ↑N * (2 * ↑π)) + sin (↑(arg z) + ↑N * (2 * ↑π)) * I)) ∈ Set.Ioc (-π) π
[PROOFSTEP]
rwa [this]
[GOAL]
z : ℂ
⊢ 0 ≤ arg z ↔ 0 ≤ z.im
[PROOFSTEP]
rcases eq_or_ne z 0 with (rfl | h₀)
[GOAL]
case inl
⊢ 0 ≤ arg 0 ↔ 0 ≤ 0.im
[PROOFSTEP]
simp
[GOAL]
case inr
z : ℂ
h₀ : z ≠ 0
⊢ 0 ≤ arg z ↔ 0 ≤ z.im
[PROOFSTEP]
calc
  0 ≤ arg z ↔ 0 ≤ Real.sin (arg z) :=
    ⟨fun h => Real.sin_nonneg_of_mem_Icc ⟨h, arg_le_pi z⟩,
      by
      contrapose!
      intro h
      exact Real.sin_neg_of_neg_of_neg_pi_lt h (neg_pi_lt_arg _)⟩
  _ ↔ _ := by rw [sin_arg, le_div_iff (abs.pos h₀), zero_mul]
[GOAL]
z : ℂ
h₀ : z ≠ 0
⊢ 0 ≤ Real.sin (arg z) → 0 ≤ arg z
[PROOFSTEP]
contrapose!
[GOAL]
z : ℂ
h₀ : z ≠ 0
⊢ arg z < 0 → Real.sin (arg z) < 0
[PROOFSTEP]
intro h
[GOAL]
z : ℂ
h₀ : z ≠ 0
h : arg z < 0
⊢ Real.sin (arg z) < 0
[PROOFSTEP]
exact Real.sin_neg_of_neg_of_neg_pi_lt h (neg_pi_lt_arg _)
[GOAL]
z : ℂ
h₀ : z ≠ 0
⊢ 0 ≤ Real.sin (arg z) ↔ 0 ≤ z.im
[PROOFSTEP]
rw [sin_arg, le_div_iff (abs.pos h₀), zero_mul]
[GOAL]
x : ℂ
r : ℝ
hr : 0 < r
⊢ arg (↑r * x) = arg x
[PROOFSTEP]
rcases eq_or_ne x 0 with (rfl | hx)
[GOAL]
case inl
r : ℝ
hr : 0 < r
⊢ arg (↑r * 0) = arg 0
[PROOFSTEP]
rw [mul_zero]
[GOAL]
case inr
x : ℂ
r : ℝ
hr : 0 < r
hx : x ≠ 0
⊢ arg (↑r * x) = arg x
[PROOFSTEP]
conv_lhs =>
  rw [← abs_mul_cos_add_sin_mul_I x, ← mul_assoc, ← ofReal_mul,
    arg_mul_cos_add_sin_mul_I (mul_pos hr (abs.pos hx)) x.arg_mem_Ioc]
[GOAL]
x : ℂ
r : ℝ
hr : 0 < r
hx : x ≠ 0
| arg (↑r * x)
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I x, ← mul_assoc, ← ofReal_mul,
    arg_mul_cos_add_sin_mul_I (mul_pos hr (abs.pos hx)) x.arg_mem_Ioc]
[GOAL]
x : ℂ
r : ℝ
hr : 0 < r
hx : x ≠ 0
| arg (↑r * x)
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I x, ← mul_assoc, ← ofReal_mul,
    arg_mul_cos_add_sin_mul_I (mul_pos hr (abs.pos hx)) x.arg_mem_Ioc]
[GOAL]
x : ℂ
r : ℝ
hr : 0 < r
hx : x ≠ 0
| arg (↑r * x)
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I x, ← mul_assoc, ← ofReal_mul,
  arg_mul_cos_add_sin_mul_I (mul_pos hr (abs.pos hx)) x.arg_mem_Ioc]
[GOAL]
x y : ℂ
hx : x ≠ 0
hy : y ≠ 0
⊢ arg x = arg y ↔ ↑(↑abs y) / ↑(↑abs x) * x = y
[PROOFSTEP]
simp only [ext_abs_arg_iff, map_mul, map_div₀, abs_ofReal, abs_abs, div_mul_cancel _ (abs.ne_zero hx), eq_self_iff_true,
  true_and_iff]
[GOAL]
x y : ℂ
hx : x ≠ 0
hy : y ≠ 0
⊢ arg x = arg y ↔ arg (↑(↑abs y) / ↑(↑abs x) * x) = arg y
[PROOFSTEP]
rw [← ofReal_div, arg_real_mul]
[GOAL]
case hr
x y : ℂ
hx : x ≠ 0
hy : y ≠ 0
⊢ 0 < ↑abs y / ↑abs x
[PROOFSTEP]
exact div_pos (abs.pos hy) (abs.pos hx)
[GOAL]
⊢ arg 1 = 0
[PROOFSTEP]
simp [arg, zero_le_one]
[GOAL]
⊢ arg (-1) = π
[PROOFSTEP]
simp [arg, le_refl, not_le.2 (zero_lt_one' ℝ)]
[GOAL]
⊢ arg I = π / 2
[PROOFSTEP]
simp [arg, le_refl]
[GOAL]
⊢ arg (-I) = -(π / 2)
[PROOFSTEP]
simp [arg, le_refl]
[GOAL]
x : ℂ
⊢ Real.tan (arg x) = x.im / x.re
[PROOFSTEP]
by_cases h : x = 0
[GOAL]
case pos
x : ℂ
h : x = 0
⊢ Real.tan (arg x) = x.im / x.re
[PROOFSTEP]
simp only [h, zero_div, Complex.zero_im, Complex.arg_zero, Real.tan_zero, Complex.zero_re]
[GOAL]
case neg
x : ℂ
h : ¬x = 0
⊢ Real.tan (arg x) = x.im / x.re
[PROOFSTEP]
rw [Real.tan_eq_sin_div_cos, sin_arg, cos_arg h, div_div_div_cancel_right _ (abs.ne_zero h)]
[GOAL]
x : ℝ
hx : 0 ≤ x
⊢ arg ↑x = 0
[PROOFSTEP]
simp [arg, hx]
[GOAL]
z : ℂ
⊢ arg z = 0 ↔ 0 ≤ z.re ∧ z.im = 0
[PROOFSTEP]
refine' ⟨fun h => _, _⟩
[GOAL]
case refine'_1
z : ℂ
h : arg z = 0
⊢ 0 ≤ z.re ∧ z.im = 0
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I z, h]
[GOAL]
case refine'_1
z : ℂ
h : arg z = 0
⊢ 0 ≤ (↑(↑abs z) * (cos ↑0 + sin ↑0 * I)).re ∧ (↑(↑abs z) * (cos ↑0 + sin ↑0 * I)).im = 0
[PROOFSTEP]
simp [abs.nonneg]
[GOAL]
case refine'_2
z : ℂ
⊢ 0 ≤ z.re ∧ z.im = 0 → arg z = 0
[PROOFSTEP]
cases' z with x y
[GOAL]
case refine'_2.mk
x y : ℝ
⊢ 0 ≤ { re := x, im := y }.re ∧ { re := x, im := y }.im = 0 → arg { re := x, im := y } = 0
[PROOFSTEP]
rintro ⟨h, rfl : y = 0⟩
[GOAL]
case refine'_2.mk.intro
x : ℝ
h : 0 ≤ { re := x, im := 0 }.re
⊢ arg { re := x, im := 0 } = 0
[PROOFSTEP]
exact arg_ofReal_of_nonneg h
[GOAL]
z : ℂ
⊢ arg z = π ↔ z.re < 0 ∧ z.im = 0
[PROOFSTEP]
by_cases h₀ : z = 0
[GOAL]
case pos
z : ℂ
h₀ : z = 0
⊢ arg z = π ↔ z.re < 0 ∧ z.im = 0
case neg z : ℂ h₀ : ¬z = 0 ⊢ arg z = π ↔ z.re < 0 ∧ z.im = 0
[PROOFSTEP]
simp [h₀, lt_irrefl, Real.pi_ne_zero.symm]
[GOAL]
case neg
z : ℂ
h₀ : ¬z = 0
⊢ arg z = π ↔ z.re < 0 ∧ z.im = 0
[PROOFSTEP]
constructor
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
⊢ arg z = π → z.re < 0 ∧ z.im = 0
[PROOFSTEP]
intro h
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
h : arg z = π
⊢ z.re < 0 ∧ z.im = 0
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I z, h]
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
h : arg z = π
⊢ (↑(↑abs z) * (cos ↑π + sin ↑π * I)).re < 0 ∧ (↑(↑abs z) * (cos ↑π + sin ↑π * I)).im = 0
[PROOFSTEP]
simp [h₀]
[GOAL]
case neg.mpr
z : ℂ
h₀ : ¬z = 0
⊢ z.re < 0 ∧ z.im = 0 → arg z = π
[PROOFSTEP]
cases' z with x y
[GOAL]
case neg.mpr.mk
x y : ℝ
h₀ : ¬{ re := x, im := y } = 0
⊢ { re := x, im := y }.re < 0 ∧ { re := x, im := y }.im = 0 → arg { re := x, im := y } = π
[PROOFSTEP]
rintro ⟨h : x < 0, rfl : y = 0⟩
[GOAL]
case neg.mpr.mk.intro
x : ℝ
h : x < 0
h₀ : ¬{ re := x, im := 0 } = 0
⊢ arg { re := x, im := 0 } = π
[PROOFSTEP]
rw [← arg_neg_one, ← arg_real_mul (-1) (neg_pos.2 h)]
[GOAL]
case neg.mpr.mk.intro
x : ℝ
h : x < 0
h₀ : ¬{ re := x, im := 0 } = 0
⊢ arg { re := x, im := 0 } = arg (↑(-x) * -1)
[PROOFSTEP]
simp [← ofReal_def]
[GOAL]
z : ℂ
⊢ arg z < π ↔ 0 ≤ z.re ∨ z.im ≠ 0
[PROOFSTEP]
rw [(arg_le_pi z).lt_iff_ne, not_iff_comm, not_or, not_le, Classical.not_not, arg_eq_pi_iff]
[GOAL]
z : ℂ
⊢ arg z = π / 2 ↔ z.re = 0 ∧ 0 < z.im
[PROOFSTEP]
by_cases h₀ : z = 0
[GOAL]
case pos
z : ℂ
h₀ : z = 0
⊢ arg z = π / 2 ↔ z.re = 0 ∧ 0 < z.im
[PROOFSTEP]
simp [h₀, lt_irrefl, Real.pi_div_two_pos.ne]
[GOAL]
case neg
z : ℂ
h₀ : ¬z = 0
⊢ arg z = π / 2 ↔ z.re = 0 ∧ 0 < z.im
[PROOFSTEP]
constructor
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
⊢ arg z = π / 2 → z.re = 0 ∧ 0 < z.im
[PROOFSTEP]
intro h
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
h : arg z = π / 2
⊢ z.re = 0 ∧ 0 < z.im
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I z, h]
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
h : arg z = π / 2
⊢ (↑(↑abs z) * (cos ↑(π / 2) + sin ↑(π / 2) * I)).re = 0 ∧ 0 < (↑(↑abs z) * (cos ↑(π / 2) + sin ↑(π / 2) * I)).im
[PROOFSTEP]
simp [h₀]
[GOAL]
case neg.mpr
z : ℂ
h₀ : ¬z = 0
⊢ z.re = 0 ∧ 0 < z.im → arg z = π / 2
[PROOFSTEP]
cases' z with x y
[GOAL]
case neg.mpr.mk
x y : ℝ
h₀ : ¬{ re := x, im := y } = 0
⊢ { re := x, im := y }.re = 0 ∧ 0 < { re := x, im := y }.im → arg { re := x, im := y } = π / 2
[PROOFSTEP]
rintro ⟨rfl : x = 0, hy : 0 < y⟩
[GOAL]
case neg.mpr.mk.intro
y : ℝ
h₀ : ¬{ re := 0, im := y } = 0
hy : 0 < y
⊢ arg { re := 0, im := y } = π / 2
[PROOFSTEP]
rw [← arg_I, ← arg_real_mul I hy, ofReal_mul', I_re, I_im, mul_zero, mul_one]
[GOAL]
z : ℂ
⊢ arg z = -(π / 2) ↔ z.re = 0 ∧ z.im < 0
[PROOFSTEP]
by_cases h₀ : z = 0
[GOAL]
case pos
z : ℂ
h₀ : z = 0
⊢ arg z = -(π / 2) ↔ z.re = 0 ∧ z.im < 0
[PROOFSTEP]
simp [h₀, lt_irrefl, Real.pi_ne_zero]
[GOAL]
case neg
z : ℂ
h₀ : ¬z = 0
⊢ arg z = -(π / 2) ↔ z.re = 0 ∧ z.im < 0
[PROOFSTEP]
constructor
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
⊢ arg z = -(π / 2) → z.re = 0 ∧ z.im < 0
[PROOFSTEP]
intro h
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
h : arg z = -(π / 2)
⊢ z.re = 0 ∧ z.im < 0
[PROOFSTEP]
rw [← abs_mul_cos_add_sin_mul_I z, h]
[GOAL]
case neg.mp
z : ℂ
h₀ : ¬z = 0
h : arg z = -(π / 2)
⊢ (↑(↑abs z) * (cos ↑(-(π / 2)) + sin ↑(-(π / 2)) * I)).re = 0 ∧
    (↑(↑abs z) * (cos ↑(-(π / 2)) + sin ↑(-(π / 2)) * I)).im < 0
[PROOFSTEP]
simp [h₀]
[GOAL]
case neg.mpr
z : ℂ
h₀ : ¬z = 0
⊢ z.re = 0 ∧ z.im < 0 → arg z = -(π / 2)
[PROOFSTEP]
cases' z with x y
[GOAL]
case neg.mpr.mk
x y : ℝ
h₀ : ¬{ re := x, im := y } = 0
⊢ { re := x, im := y }.re = 0 ∧ { re := x, im := y }.im < 0 → arg { re := x, im := y } = -(π / 2)
[PROOFSTEP]
rintro ⟨rfl : x = 0, hy : y < 0⟩
[GOAL]
case neg.mpr.mk.intro
y : ℝ
h₀ : ¬{ re := 0, im := y } = 0
hy : y < 0
⊢ arg { re := 0, im := y } = -(π / 2)
[PROOFSTEP]
rw [← arg_neg_I, ← arg_real_mul (-I) (neg_pos.2 hy), mk_eq_add_mul_I]
[GOAL]
case neg.mpr.mk.intro
y : ℝ
h₀ : ¬{ re := 0, im := y } = 0
hy : y < 0
⊢ arg (↑0 + ↑y * I) = arg (↑(-y) * -I)
[PROOFSTEP]
simp
[GOAL]
x : ℂ
hx_re : x.re < 0
hx_im : 0 ≤ x.im
⊢ arg x = arcsin ((-x).im / ↑abs x) + π
[PROOFSTEP]
simp only [arg, hx_re.not_le, hx_im, if_true, if_false]
[GOAL]
x : ℂ
hx_re : x.re < 0
hx_im : x.im < 0
⊢ arg x = arcsin ((-x).im / ↑abs x) - π
[PROOFSTEP]
simp only [arg, hx_re.not_le, hx_im.not_le, if_false]
[GOAL]
z : ℂ
h₁ : 0 ≤ z.im
h₂ : z ≠ 0
⊢ arg z = arccos (z.re / ↑abs z)
[PROOFSTEP]
rw [← cos_arg h₂, Real.arccos_cos (arg_nonneg_iff.2 h₁) (arg_le_pi _)]
[GOAL]
z : ℂ
hz : z.im < 0
⊢ arg z = -arccos (z.re / ↑abs z)
[PROOFSTEP]
have h₀ : z ≠ 0 := mt (congr_arg im) hz.ne
[GOAL]
z : ℂ
hz : z.im < 0
h₀ : z ≠ 0
⊢ arg z = -arccos (z.re / ↑abs z)
[PROOFSTEP]
rw [← cos_arg h₀, ← Real.cos_neg, Real.arccos_cos, neg_neg]
[GOAL]
case hx₁
z : ℂ
hz : z.im < 0
h₀ : z ≠ 0
⊢ 0 ≤ -arg z
case hx₂ z : ℂ hz : z.im < 0 h₀ : z ≠ 0 ⊢ -arg z ≤ π
[PROOFSTEP]
exacts [neg_nonneg.2 (arg_neg_iff.2 hz).le, neg_le.2 (neg_pi_lt_arg z).le]
[GOAL]
x : ℂ
⊢ arg (↑(starRingEnd ℂ) x) = if arg x = π then π else -arg x
[PROOFSTEP]
simp_rw [arg_eq_pi_iff, arg, neg_im, conj_im, conj_re, abs_conj, neg_div, neg_neg, Real.arcsin_neg]
[GOAL]
x : ℂ
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
rcases lt_trichotomy x.re 0 with (hr | hr | hr)
[GOAL]
case inl
x : ℂ
hr : x.re < 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
rcases lt_trichotomy x.im 0 with (hi | hi | hi)
[GOAL]
case inr.inl
x : ℂ
hr : x.re = 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
rcases lt_trichotomy x.im 0 with (hi | hi | hi)
[GOAL]
case inr.inr
x : ℂ
hr : 0 < x.re
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
rcases lt_trichotomy x.im 0 with (hi | hi | hi)
[GOAL]
case inl.inl
x : ℂ
hr : x.re < 0
hi : x.im < 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr, hr.not_le, hi.le, hi.ne, not_le.2 hi, add_comm]
[GOAL]
case inl.inr.inl
x : ℂ
hr : x.re < 0
hi : x.im = 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr, hr.not_le, hi]
[GOAL]
case inl.inr.inr
x : ℂ
hr : x.re < 0
hi : 0 < x.im
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr, hr.not_le, hi.ne.symm, hi.le, not_le.2 hi, sub_eq_neg_add]
[GOAL]
case inr.inl.inl
x : ℂ
hr : x.re = 0
hi : x.im < 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr]
[GOAL]
case inr.inl.inr.inl
x : ℂ
hr : x.re = 0
hi : x.im = 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr]
[GOAL]
case inr.inl.inr.inr
x : ℂ
hr : x.re = 0
hi : 0 < x.im
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr]
[GOAL]
case inr.inr.inl
x : ℂ
hr : 0 < x.re
hi : x.im < 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr, hr.le, hi.ne]
[GOAL]
case inr.inr.inr.inl
x : ℂ
hr : 0 < x.re
hi : x.im = 0
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr, hr.le, hr.le.not_lt]
[GOAL]
case inr.inr.inr.inr
x : ℂ
hr : 0 < x.re
hi : 0 < x.im
⊢ (if 0 ≤ x.re then -arcsin (x.im / ↑abs x)
    else if 0 ≤ -x.im then arcsin (x.im / ↑abs x) + π else arcsin (x.im / ↑abs x) - π) =
    if x.re < 0 ∧ x.im = 0 then π
    else
      -if 0 ≤ x.re then arcsin (x.im / ↑abs x)
        else if 0 ≤ x.im then -arcsin (x.im / ↑abs x) + π else -arcsin (x.im / ↑abs x) - π
[PROOFSTEP]
simp [hr, hr.le, hr.le.not_lt]
[GOAL]
x : ℂ
⊢ arg x⁻¹ = if arg x = π then π else -arg x
[PROOFSTEP]
rw [← arg_conj, inv_def, mul_comm]
[GOAL]
x : ℂ
⊢ arg (↑(↑normSq x)⁻¹ * ↑(starRingEnd ℂ) x) = arg (↑(starRingEnd ℂ) x)
[PROOFSTEP]
by_cases hx : x = 0
[GOAL]
case pos
x : ℂ
hx : x = 0
⊢ arg (↑(↑normSq x)⁻¹ * ↑(starRingEnd ℂ) x) = arg (↑(starRingEnd ℂ) x)
[PROOFSTEP]
simp [hx]
[GOAL]
case neg
x : ℂ
hx : ¬x = 0
⊢ arg (↑(↑normSq x)⁻¹ * ↑(starRingEnd ℂ) x) = arg (↑(starRingEnd ℂ) x)
[PROOFSTEP]
exact arg_real_mul (conj x) (by simp [hx])
[GOAL]
x : ℂ
hx : ¬x = 0
⊢ 0 < (↑normSq x)⁻¹
[PROOFSTEP]
simp [hx]
[GOAL]
z : ℂ
⊢ arg z ≤ π / 2 ↔ 0 ≤ z.re ∨ z.im < 0
[PROOFSTEP]
cases' le_or_lt 0 (re z) with hre hre
[GOAL]
case inl
z : ℂ
hre : 0 ≤ z.re
⊢ arg z ≤ π / 2 ↔ 0 ≤ z.re ∨ z.im < 0
[PROOFSTEP]
simp only [hre, arg_of_re_nonneg hre, Real.arcsin_le_pi_div_two, true_or_iff]
[GOAL]
case inr
z : ℂ
hre : z.re < 0
⊢ arg z ≤ π / 2 ↔ 0 ≤ z.re ∨ z.im < 0
[PROOFSTEP]
simp only [hre.not_le, false_or_iff]
[GOAL]
case inr
z : ℂ
hre : z.re < 0
⊢ arg z ≤ π / 2 ↔ z.im < 0
[PROOFSTEP]
cases' le_or_lt 0 (im z) with him him
[GOAL]
case inr.inl
z : ℂ
hre : z.re < 0
him : 0 ≤ z.im
⊢ arg z ≤ π / 2 ↔ z.im < 0
[PROOFSTEP]
simp only [him.not_lt]
[GOAL]
case inr.inl
z : ℂ
hre : z.re < 0
him : 0 ≤ z.im
⊢ arg z ≤ π / 2 ↔ False
[PROOFSTEP]
rw [iff_false_iff, not_le, arg_of_re_neg_of_im_nonneg hre him, ← sub_lt_iff_lt_add, half_sub,
  Real.neg_pi_div_two_lt_arcsin, neg_im, neg_div, neg_lt_neg_iff, div_lt_one, ← _root_.abs_of_nonneg him, abs_im_lt_abs]
[GOAL]
case inr.inl
z : ℂ
hre : z.re < 0
him : 0 ≤ z.im
⊢ z.re ≠ 0
case inr.inl z : ℂ hre : z.re < 0 him : 0 ≤ z.im ⊢ 0 < ↑abs z
[PROOFSTEP]
exacts [hre.ne, abs.pos <| ne_of_apply_ne re hre.ne]
[GOAL]
case inr.inr
z : ℂ
hre : z.re < 0
him : z.im < 0
⊢ arg z ≤ π / 2 ↔ z.im < 0
[PROOFSTEP]
simp only [him]
[GOAL]
case inr.inr
z : ℂ
hre : z.re < 0
him : z.im < 0
⊢ arg z ≤ π / 2 ↔ True
[PROOFSTEP]
rw [iff_true_iff, arg_of_re_neg_of_im_neg hre him]
[GOAL]
case inr.inr
z : ℂ
hre : z.re < 0
him : z.im < 0
⊢ arcsin ((-z).im / ↑abs z) - π ≤ π / 2
[PROOFSTEP]
exact (sub_le_self _ Real.pi_pos.le).trans (Real.arcsin_le_pi_div_two _)
[GOAL]
z : ℂ
⊢ -(π / 2) ≤ arg z ↔ 0 ≤ z.re ∨ 0 ≤ z.im
[PROOFSTEP]
cases' le_or_lt 0 (re z) with hre hre
[GOAL]
case inl
z : ℂ
hre : 0 ≤ z.re
⊢ -(π / 2) ≤ arg z ↔ 0 ≤ z.re ∨ 0 ≤ z.im
[PROOFSTEP]
simp only [hre, arg_of_re_nonneg hre, Real.neg_pi_div_two_le_arcsin, true_or_iff]
[GOAL]
case inr
z : ℂ
hre : z.re < 0
⊢ -(π / 2) ≤ arg z ↔ 0 ≤ z.re ∨ 0 ≤ z.im
[PROOFSTEP]
simp only [hre.not_le, false_or_iff]
[GOAL]
case inr
z : ℂ
hre : z.re < 0
⊢ -(π / 2) ≤ arg z ↔ 0 ≤ z.im
[PROOFSTEP]
cases' le_or_lt 0 (im z) with him him
[GOAL]
case inr.inl
z : ℂ
hre : z.re < 0
him : 0 ≤ z.im
⊢ -(π / 2) ≤ arg z ↔ 0 ≤ z.im
[PROOFSTEP]
simp only [him]
[GOAL]
case inr.inl
z : ℂ
hre : z.re < 0
him : 0 ≤ z.im
⊢ -(π / 2) ≤ arg z ↔ True
[PROOFSTEP]
rw [iff_true_iff, arg_of_re_neg_of_im_nonneg hre him]
[GOAL]
case inr.inl
z : ℂ
hre : z.re < 0
him : 0 ≤ z.im
⊢ -(π / 2) ≤ arcsin ((-z).im / ↑abs z) + π
[PROOFSTEP]
exact (Real.neg_pi_div_two_le_arcsin _).trans (le_add_of_nonneg_right Real.pi_pos.le)
[GOAL]
case inr.inr
z : ℂ
hre : z.re < 0
him : z.im < 0
⊢ -(π / 2) ≤ arg z ↔ 0 ≤ z.im
[PROOFSTEP]
simp only [him.not_le]
[GOAL]
case inr.inr
z : ℂ
hre : z.re < 0
him : z.im < 0
⊢ -(π / 2) ≤ arg z ↔ False
[PROOFSTEP]
rw [iff_false_iff, not_le, arg_of_re_neg_of_im_neg hre him, sub_lt_iff_lt_add', ← sub_eq_add_neg, sub_half,
  Real.arcsin_lt_pi_div_two, div_lt_one, neg_im, ← abs_of_neg him, abs_im_lt_abs]
[GOAL]
case inr.inr
z : ℂ
hre : z.re < 0
him : z.im < 0
⊢ z.re ≠ 0
case inr.inr z : ℂ hre : z.re < 0 him : z.im < 0 ⊢ 0 < ↑abs z
[PROOFSTEP]
exacts [hre.ne, abs.pos <| ne_of_apply_ne re hre.ne]
[GOAL]
z : ℂ
⊢ |arg z| ≤ π / 2 ↔ 0 ≤ z.re
[PROOFSTEP]
rw [abs_le, arg_le_pi_div_two_iff, neg_pi_div_two_le_arg_iff, ← or_and_left, ← not_le, and_not_self_iff, or_false_iff]
[GOAL]
x : ℂ
⊢ ↑(arg (↑(starRingEnd ℂ) x)) = -↑(arg x)
[PROOFSTEP]
by_cases h : arg x = π
[GOAL]
case pos
x : ℂ
h : arg x = π
⊢ ↑(arg (↑(starRingEnd ℂ) x)) = -↑(arg x)
[PROOFSTEP]
simp [arg_conj, h]
[GOAL]
case neg
x : ℂ
h : ¬arg x = π
⊢ ↑(arg (↑(starRingEnd ℂ) x)) = -↑(arg x)
[PROOFSTEP]
simp [arg_conj, h]
[GOAL]
x : ℂ
⊢ ↑(arg x⁻¹) = -↑(arg x)
[PROOFSTEP]
by_cases h : arg x = π
[GOAL]
case pos
x : ℂ
h : arg x = π
⊢ ↑(arg x⁻¹) = -↑(arg x)
[PROOFSTEP]
simp [arg_inv, h]
[GOAL]
case neg
x : ℂ
h : ¬arg x = π
⊢ ↑(arg x⁻¹) = -↑(arg x)
[PROOFSTEP]
simp [arg_inv, h]
[GOAL]
x : ℂ
hi : 0 < x.im
⊢ arg (-x) = arg x - π
[PROOFSTEP]
rw [arg_of_im_pos hi, arg_of_im_neg (show (-x).im < 0 from Left.neg_neg_iff.2 hi)]
[GOAL]
x : ℂ
hi : 0 < x.im
⊢ -arccos ((-x).re / ↑abs (-x)) = arccos (x.re / ↑abs x) - π
[PROOFSTEP]
simp [neg_div, Real.arccos_neg]
[GOAL]
x : ℂ
hi : x.im < 0
⊢ arg (-x) = arg x + π
[PROOFSTEP]
rw [arg_of_im_neg hi, arg_of_im_pos (show 0 < (-x).im from Left.neg_pos_iff.2 hi)]
[GOAL]
x : ℂ
hi : x.im < 0
⊢ arccos ((-x).re / ↑abs (-x)) = -arccos (x.re / ↑abs x) + π
[PROOFSTEP]
simp [neg_div, Real.arccos_neg, add_comm, ← sub_eq_add_neg]
[GOAL]
x : ℂ
⊢ arg (-x) = arg x - π ↔ 0 < x.im ∨ x.im = 0 ∧ x.re < 0
[PROOFSTEP]
rcases lt_trichotomy x.im 0 with (hi | hi | hi)
[GOAL]
case inl
x : ℂ
hi : x.im < 0
⊢ arg (-x) = arg x - π ↔ 0 < x.im ∨ x.im = 0 ∧ x.re < 0
[PROOFSTEP]
simp [hi, hi.ne, hi.not_lt, arg_neg_eq_arg_add_pi_of_im_neg, sub_eq_add_neg, ← add_eq_zero_iff_eq_neg, Real.pi_ne_zero]
[GOAL]
case inr.inl
x : ℂ
hi : x.im = 0
⊢ arg (-x) = arg x - π ↔ 0 < x.im ∨ x.im = 0 ∧ x.re < 0
[PROOFSTEP]
rw [(ext rfl hi : x = x.re)]
[GOAL]
case inr.inl
x : ℂ
hi : x.im = 0
⊢ arg (-↑x.re) = arg ↑x.re - π ↔ 0 < (↑x.re).im ∨ (↑x.re).im = 0 ∧ (↑x.re).re < 0
[PROOFSTEP]
rcases lt_trichotomy x.re 0 with (hr | hr | hr)
[GOAL]
case inr.inl.inl
x : ℂ
hi : x.im = 0
hr : x.re < 0
⊢ arg (-↑x.re) = arg ↑x.re - π ↔ 0 < (↑x.re).im ∨ (↑x.re).im = 0 ∧ (↑x.re).re < 0
[PROOFSTEP]
rw [arg_ofReal_of_neg hr, ← ofReal_neg, arg_ofReal_of_nonneg (Left.neg_pos_iff.2 hr).le]
[GOAL]
case inr.inl.inl
x : ℂ
hi : x.im = 0
hr : x.re < 0
⊢ 0 = π - π ↔ 0 < (↑x.re).im ∨ (↑x.re).im = 0 ∧ (↑x.re).re < 0
[PROOFSTEP]
simp [hr]
[GOAL]
case inr.inl.inr.inl
x : ℂ
hi : x.im = 0
hr : x.re = 0
⊢ arg (-↑x.re) = arg ↑x.re - π ↔ 0 < (↑x.re).im ∨ (↑x.re).im = 0 ∧ (↑x.re).re < 0
[PROOFSTEP]
simp [hr, hi, Real.pi_ne_zero]
[GOAL]
case inr.inl.inr.inr
x : ℂ
hi : x.im = 0
hr : 0 < x.re
⊢ arg (-↑x.re) = arg ↑x.re - π ↔ 0 < (↑x.re).im ∨ (↑x.re).im = 0 ∧ (↑x.re).re < 0
[PROOFSTEP]
rw [arg_ofReal_of_nonneg hr.le, ← ofReal_neg, arg_ofReal_of_neg (Left.neg_neg_iff.2 hr)]
[GOAL]
case inr.inl.inr.inr
x : ℂ
hi : x.im = 0
hr : 0 < x.re
⊢ π = 0 - π ↔ 0 < (↑x.re).im ∨ (↑x.re).im = 0 ∧ (↑x.re).re < 0
[PROOFSTEP]
simp [hr.not_lt, ← add_eq_zero_iff_eq_neg, Real.pi_ne_zero]
[GOAL]
case inr.inr
x : ℂ
hi : 0 < x.im
⊢ arg (-x) = arg x - π ↔ 0 < x.im ∨ x.im = 0 ∧ x.re < 0
[PROOFSTEP]
simp [hi, arg_neg_eq_arg_sub_pi_of_im_pos]
[GOAL]
x : ℂ
⊢ arg (-x) = arg x + π ↔ x.im < 0 ∨ x.im = 0 ∧ 0 < x.re
[PROOFSTEP]
rcases lt_trichotomy x.im 0 with (hi | hi | hi)
[GOAL]
case inl
x : ℂ
hi : x.im < 0
⊢ arg (-x) = arg x + π ↔ x.im < 0 ∨ x.im = 0 ∧ 0 < x.re
[PROOFSTEP]
simp [hi, arg_neg_eq_arg_add_pi_of_im_neg]
[GOAL]
case inr.inl
x : ℂ
hi : x.im = 0
⊢ arg (-x) = arg x + π ↔ x.im < 0 ∨ x.im = 0 ∧ 0 < x.re
[PROOFSTEP]
rw [(ext rfl hi : x = x.re)]
[GOAL]
case inr.inl
x : ℂ
hi : x.im = 0
⊢ arg (-↑x.re) = arg ↑x.re + π ↔ (↑x.re).im < 0 ∨ (↑x.re).im = 0 ∧ 0 < (↑x.re).re
[PROOFSTEP]
rcases lt_trichotomy x.re 0 with (hr | hr | hr)
[GOAL]
case inr.inl.inl
x : ℂ
hi : x.im = 0
hr : x.re < 0
⊢ arg (-↑x.re) = arg ↑x.re + π ↔ (↑x.re).im < 0 ∨ (↑x.re).im = 0 ∧ 0 < (↑x.re).re
[PROOFSTEP]
rw [arg_ofReal_of_neg hr, ← ofReal_neg, arg_ofReal_of_nonneg (Left.neg_pos_iff.2 hr).le]
[GOAL]
case inr.inl.inl
x : ℂ
hi : x.im = 0
hr : x.re < 0
⊢ 0 = π + π ↔ (↑x.re).im < 0 ∨ (↑x.re).im = 0 ∧ 0 < (↑x.re).re
[PROOFSTEP]
simp [hr.not_lt, ← two_mul, Real.pi_ne_zero]
[GOAL]
case inr.inl.inr.inl
x : ℂ
hi : x.im = 0
hr : x.re = 0
⊢ arg (-↑x.re) = arg ↑x.re + π ↔ (↑x.re).im < 0 ∨ (↑x.re).im = 0 ∧ 0 < (↑x.re).re
[PROOFSTEP]
simp [hr, hi, Real.pi_ne_zero.symm]
[GOAL]
case inr.inl.inr.inr
x : ℂ
hi : x.im = 0
hr : 0 < x.re
⊢ arg (-↑x.re) = arg ↑x.re + π ↔ (↑x.re).im < 0 ∨ (↑x.re).im = 0 ∧ 0 < (↑x.re).re
[PROOFSTEP]
rw [arg_ofReal_of_nonneg hr.le, ← ofReal_neg, arg_ofReal_of_neg (Left.neg_neg_iff.2 hr)]
[GOAL]
case inr.inl.inr.inr
x : ℂ
hi : x.im = 0
hr : 0 < x.re
⊢ π = 0 + π ↔ (↑x.re).im < 0 ∨ (↑x.re).im = 0 ∧ 0 < (↑x.re).re
[PROOFSTEP]
simp [hr]
[GOAL]
case inr.inr
x : ℂ
hi : 0 < x.im
⊢ arg (-x) = arg x + π ↔ x.im < 0 ∨ x.im = 0 ∧ 0 < x.re
[PROOFSTEP]
simp [hi, hi.ne.symm, hi.not_lt, arg_neg_eq_arg_sub_pi_of_im_pos, sub_eq_add_neg, ← add_eq_zero_iff_neg_eq,
  Real.pi_ne_zero]
[GOAL]
x : ℂ
hx : x ≠ 0
⊢ ↑(arg (-x)) = ↑(arg x) + ↑π
[PROOFSTEP]
rcases lt_trichotomy x.im 0 with (hi | hi | hi)
[GOAL]
case inl
x : ℂ
hx : x ≠ 0
hi : x.im < 0
⊢ ↑(arg (-x)) = ↑(arg x) + ↑π
[PROOFSTEP]
rw [arg_neg_eq_arg_add_pi_of_im_neg hi, Real.Angle.coe_add]
[GOAL]
case inr.inl
x : ℂ
hx : x ≠ 0
hi : x.im = 0
⊢ ↑(arg (-x)) = ↑(arg x) + ↑π
[PROOFSTEP]
rw [(ext rfl hi : x = x.re)]
[GOAL]
case inr.inl
x : ℂ
hx : x ≠ 0
hi : x.im = 0
⊢ ↑(arg (-↑x.re)) = ↑(arg ↑x.re) + ↑π
[PROOFSTEP]
rcases lt_trichotomy x.re 0 with (hr | hr | hr)
[GOAL]
case inr.inl.inl
x : ℂ
hx : x ≠ 0
hi : x.im = 0
hr : x.re < 0
⊢ ↑(arg (-↑x.re)) = ↑(arg ↑x.re) + ↑π
[PROOFSTEP]
rw [arg_ofReal_of_neg hr, ← ofReal_neg, arg_ofReal_of_nonneg (Left.neg_pos_iff.2 hr).le, ← Real.Angle.coe_add, ←
  two_mul, Real.Angle.coe_two_pi, Real.Angle.coe_zero]
[GOAL]
case inr.inl.inr.inl
x : ℂ
hx : x ≠ 0
hi : x.im = 0
hr : x.re = 0
⊢ ↑(arg (-↑x.re)) = ↑(arg ↑x.re) + ↑π
[PROOFSTEP]
exact False.elim (hx (ext hr hi))
[GOAL]
case inr.inl.inr.inr
x : ℂ
hx : x ≠ 0
hi : x.im = 0
hr : 0 < x.re
⊢ ↑(arg (-↑x.re)) = ↑(arg ↑x.re) + ↑π
[PROOFSTEP]
rw [arg_ofReal_of_nonneg hr.le, ← ofReal_neg, arg_ofReal_of_neg (Left.neg_neg_iff.2 hr), Real.Angle.coe_zero, zero_add]
[GOAL]
case inr.inr
x : ℂ
hx : x ≠ 0
hi : 0 < x.im
⊢ ↑(arg (-x)) = ↑(arg x) + ↑π
[PROOFSTEP]
rw [arg_neg_eq_arg_sub_pi_of_im_pos hi, Real.Angle.coe_sub, Real.Angle.sub_coe_pi_eq_add_coe_pi]
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
⊢ arg (↑r * (cos ↑θ + sin ↑θ * I)) = toIocMod two_pi_pos (-π) θ
[PROOFSTEP]
have hi : toIocMod Real.two_pi_pos (-π) θ ∈ Set.Ioc (-π) π :=
  by
  convert toIocMod_mem_Ioc _ _ θ
  ring
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
⊢ toIocMod two_pi_pos (-π) θ ∈ Set.Ioc (-π) π
[PROOFSTEP]
convert toIocMod_mem_Ioc _ _ θ
[GOAL]
case h.e'_5.h.e'_4
r : ℝ
hr : 0 < r
θ : ℝ
⊢ π = -π + 2 * π
[PROOFSTEP]
ring
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
hi : toIocMod two_pi_pos (-π) θ ∈ Set.Ioc (-π) π
⊢ arg (↑r * (cos ↑θ + sin ↑θ * I)) = toIocMod two_pi_pos (-π) θ
[PROOFSTEP]
convert arg_mul_cos_add_sin_mul_I hr hi using 3
[GOAL]
case h.e'_2.h.e'_1.h.e'_6
r : ℝ
hr : 0 < r
θ : ℝ
hi : toIocMod two_pi_pos (-π) θ ∈ Set.Ioc (-π) π
⊢ cos ↑θ + sin ↑θ * I = cos ↑(toIocMod two_pi_pos (-π) θ) + sin ↑(toIocMod two_pi_pos (-π) θ) * I
[PROOFSTEP]
simp [toIocMod, cos_sub_int_mul_two_pi, sin_sub_int_mul_two_pi]
[GOAL]
θ : ℝ
⊢ arg (cos ↑θ + sin ↑θ * I) = toIocMod two_pi_pos (-π) θ
[PROOFSTEP]
rw [← one_mul (_ + _), ← ofReal_one, arg_mul_cos_add_sin_mul_I_eq_toIocMod zero_lt_one]
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
⊢ arg (↑r * (cos ↑θ + sin ↑θ * I)) - θ = 2 * π * ↑⌊(π - θ) / (2 * π)⌋
[PROOFSTEP]
rw [arg_mul_cos_add_sin_mul_I_eq_toIocMod hr, toIocMod_sub_self, toIocDiv_eq_neg_floor, zsmul_eq_mul]
[GOAL]
r : ℝ
hr : 0 < r
θ : ℝ
⊢ ↑(- -⌊(-π + 2 * π - θ) / (2 * π)⌋) * (2 * π) = 2 * π * ↑⌊(π - θ) / (2 * π)⌋
[PROOFSTEP]
ring_nf
[GOAL]
θ : ℝ
⊢ arg (cos ↑θ + sin ↑θ * I) - θ = 2 * π * ↑⌊(π - θ) / (2 * π)⌋
[PROOFSTEP]
rw [← one_mul (_ + _), ← ofReal_one, arg_mul_cos_add_sin_mul_I_sub zero_lt_one]
[GOAL]
r : ℝ
hr : 0 < r
θ : Angle
⊢ ↑(arg (↑r * (↑(Angle.cos θ) + ↑(Angle.sin θ) * I))) = θ
[PROOFSTEP]
induction' θ using Real.Angle.induction_on with θ
[GOAL]
case h
r : ℝ
hr : 0 < r
θ : ℝ
⊢ ↑(arg (↑r * (↑(Angle.cos ↑θ) + ↑(Angle.sin ↑θ) * I))) = ↑θ
[PROOFSTEP]
rw [Real.Angle.cos_coe, Real.Angle.sin_coe, Real.Angle.angle_eq_iff_two_pi_dvd_sub]
[GOAL]
case h
r : ℝ
hr : 0 < r
θ : ℝ
⊢ ∃ k, arg (↑r * (↑(Real.cos θ) + ↑(Real.sin θ) * I)) - θ = 2 * π * ↑k
[PROOFSTEP]
use⌊(π - θ) / (2 * π)⌋
[GOAL]
case h
r : ℝ
hr : 0 < r
θ : ℝ
⊢ arg (↑r * (↑(Real.cos θ) + ↑(Real.sin θ) * I)) - θ = 2 * π * ↑⌊(π - θ) / (2 * π)⌋
[PROOFSTEP]
exact_mod_cast arg_mul_cos_add_sin_mul_I_sub hr θ
[GOAL]
θ : Angle
⊢ ↑(arg (↑(Angle.cos θ) + ↑(Angle.sin θ) * I)) = θ
[PROOFSTEP]
rw [← one_mul (_ + _), ← ofReal_one, arg_mul_cos_add_sin_mul_I_coe_angle zero_lt_one]
[GOAL]
x y : ℂ
hx : x ≠ 0
hy : y ≠ 0
⊢ ↑(arg (x * y)) = ↑(arg x) + ↑(arg y)
[PROOFSTEP]
convert arg_mul_cos_add_sin_mul_I_coe_angle (mul_pos (abs.pos hx) (abs.pos hy)) (arg x + arg y : Real.Angle) using 3
[GOAL]
case h.e'_2.h.e'_1.h.e'_1
x y : ℂ
hx : x ≠ 0
hy : y ≠ 0
⊢ x * y = ↑(↑abs x * ↑abs y) * (↑(Angle.cos (↑(arg x) + ↑(arg y))) + ↑(Angle.sin (↑(arg x) + ↑(arg y))) * I)
[PROOFSTEP]
simp_rw [← Real.Angle.coe_add, Real.Angle.sin_coe, Real.Angle.cos_coe, ofReal_cos, ofReal_sin, cos_add_sin_I,
  ofReal_add, add_mul, exp_add, ofReal_mul]
[GOAL]
case h.e'_2.h.e'_1.h.e'_1
x y : ℂ
hx : x ≠ 0
hy : y ≠ 0
⊢ x * y = ↑(↑abs x) * ↑(↑abs y) * (exp (↑(arg x) * I) * exp (↑(arg y) * I))
[PROOFSTEP]
rw [mul_assoc, mul_comm (exp _), ← mul_assoc (abs y : ℂ), abs_mul_exp_arg_mul_I, mul_comm y, ← mul_assoc,
  abs_mul_exp_arg_mul_I]
[GOAL]
x y : ℂ
hx : x ≠ 0
hy : y ≠ 0
⊢ ↑(arg (x / y)) = ↑(arg x) - ↑(arg y)
[PROOFSTEP]
rw [div_eq_mul_inv, arg_mul_coe_angle hx (inv_ne_zero hy), arg_inv_coe_angle, sub_eq_add_neg]
[GOAL]
z : ℂ
⊢ Angle.toReal ↑(arg z) = arg z
[PROOFSTEP]
rw [Real.Angle.toReal_coe_eq_self_iff_mem_Ioc]
[GOAL]
z : ℂ
⊢ arg z ∈ Set.Ioc (-π) π
[PROOFSTEP]
exact arg_mem_Ioc _
[GOAL]
z : ℂ
θ : Angle
⊢ ↑(arg z) = θ ↔ arg z = Angle.toReal θ
[PROOFSTEP]
rw [← Real.Angle.toReal_inj, arg_coe_angle_toReal_eq_arg]
[GOAL]
x y : ℂ
⊢ ↑(arg x) = ↑(arg y) ↔ arg x = arg y
[PROOFSTEP]
simp_rw [← Real.Angle.toReal_inj, arg_coe_angle_toReal_eq_arg]
[GOAL]
x z : ℂ
hx_re : x.re < 0
hx_im : 0 < x.im
⊢ arg =ᶠ[𝓝 x] fun x => arcsin ((-x).im / ↑abs x) + π
[PROOFSTEP]
suffices h_forall_nhds : ∀ᶠ y : ℂ in 𝓝 x, y.re < 0 ∧ 0 < y.im
[GOAL]
x z : ℂ
hx_re : x.re < 0
hx_im : 0 < x.im
h_forall_nhds : ∀ᶠ (y : ℂ) in 𝓝 x, y.re < 0 ∧ 0 < y.im
⊢ arg =ᶠ[𝓝 x] fun x => arcsin ((-x).im / ↑abs x) + π
case h_forall_nhds x z : ℂ hx_re : x.re < 0 hx_im : 0 < x.im ⊢ ∀ᶠ (y : ℂ) in 𝓝 x, y.re < 0 ∧ 0 < y.im
[PROOFSTEP]
exact h_forall_nhds.mono fun y hy => arg_of_re_neg_of_im_nonneg hy.1 hy.2.le
[GOAL]
case h_forall_nhds
x z : ℂ
hx_re : x.re < 0
hx_im : 0 < x.im
⊢ ∀ᶠ (y : ℂ) in 𝓝 x, y.re < 0 ∧ 0 < y.im
[PROOFSTEP]
refine' IsOpen.eventually_mem _ (⟨hx_re, hx_im⟩ : x.re < 0 ∧ 0 < x.im)
[GOAL]
case h_forall_nhds
x z : ℂ
hx_re : x.re < 0
hx_im : 0 < x.im
⊢ IsOpen fun y => y.re < 0 ∧ 0 < y.im
[PROOFSTEP]
exact IsOpen.and (isOpen_lt continuous_re continuous_zero) (isOpen_lt continuous_zero continuous_im)
[GOAL]
x z : ℂ
hx_re : x.re < 0
hx_im : x.im < 0
⊢ arg =ᶠ[𝓝 x] fun x => arcsin ((-x).im / ↑abs x) - π
[PROOFSTEP]
suffices h_forall_nhds : ∀ᶠ y : ℂ in 𝓝 x, y.re < 0 ∧ y.im < 0
[GOAL]
x z : ℂ
hx_re : x.re < 0
hx_im : x.im < 0
h_forall_nhds : ∀ᶠ (y : ℂ) in 𝓝 x, y.re < 0 ∧ y.im < 0
⊢ arg =ᶠ[𝓝 x] fun x => arcsin ((-x).im / ↑abs x) - π
case h_forall_nhds x z : ℂ hx_re : x.re < 0 hx_im : x.im < 0 ⊢ ∀ᶠ (y : ℂ) in 𝓝 x, y.re < 0 ∧ y.im < 0
[PROOFSTEP]
exact h_forall_nhds.mono fun y hy => arg_of_re_neg_of_im_neg hy.1 hy.2
[GOAL]
case h_forall_nhds
x z : ℂ
hx_re : x.re < 0
hx_im : x.im < 0
⊢ ∀ᶠ (y : ℂ) in 𝓝 x, y.re < 0 ∧ y.im < 0
[PROOFSTEP]
refine' IsOpen.eventually_mem _ (⟨hx_re, hx_im⟩ : x.re < 0 ∧ x.im < 0)
[GOAL]
case h_forall_nhds
x z : ℂ
hx_re : x.re < 0
hx_im : x.im < 0
⊢ IsOpen fun y => y.re < 0 ∧ y.im < 0
[PROOFSTEP]
exact IsOpen.and (isOpen_lt continuous_re continuous_zero) (isOpen_lt continuous_im continuous_zero)
[GOAL]
x z : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ ContinuousAt arg x
[PROOFSTEP]
have h₀ : abs x ≠ 0 := by
  rw [abs.ne_zero_iff]
  rintro rfl
  simp at h
[GOAL]
x z : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ ↑abs x ≠ 0
[PROOFSTEP]
rw [abs.ne_zero_iff]
[GOAL]
x z : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ x ≠ 0
[PROOFSTEP]
rintro rfl
[GOAL]
z : ℂ
h : 0 < 0.re ∨ 0.im ≠ 0
⊢ False
[PROOFSTEP]
simp at h
[GOAL]
x z : ℂ
h : 0 < x.re ∨ x.im ≠ 0
h₀ : ↑abs x ≠ 0
⊢ ContinuousAt arg x
[PROOFSTEP]
rw [← lt_or_lt_iff_ne] at h
[GOAL]
x z : ℂ
h✝ : 0 < x.re ∨ x.im ≠ 0
h : 0 < x.re ∨ x.im < 0 ∨ 0 < x.im
h₀ : ↑abs x ≠ 0
⊢ ContinuousAt arg x
[PROOFSTEP]
rcases h with (hx_re | hx_im | hx_im)
[GOAL]
case inl
x z : ℂ
h : 0 < x.re ∨ x.im ≠ 0
h₀ : ↑abs x ≠ 0
hx_re : 0 < x.re
⊢ ContinuousAt arg x
case inr.inl
x z : ℂ
h : 0 < x.re ∨ x.im ≠ 0
h₀ : ↑abs x ≠ 0
hx_im : x.im < 0
⊢ ContinuousAt arg x
case inr.inr x z : ℂ h : 0 < x.re ∨ x.im ≠ 0 h₀ : ↑abs x ≠ 0 hx_im : 0 < x.im ⊢ ContinuousAt arg x
[PROOFSTEP]
exacts
  [(Real.continuousAt_arcsin.comp (continuous_im.continuousAt.div continuous_abs.continuousAt h₀)).congr
    (arg_eq_nhds_of_re_pos hx_re).symm,
  (Real.continuous_arccos.continuousAt.comp (continuous_re.continuousAt.div continuous_abs.continuousAt h₀)).neg.congr
    (arg_eq_nhds_of_im_neg hx_im).symm,
  (Real.continuous_arccos.continuousAt.comp (continuous_re.continuousAt.div continuous_abs.continuousAt h₀)).congr
    (arg_eq_nhds_of_im_pos hx_im).symm]
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ Tendsto arg (𝓝[{z | z.im < 0}] z) (𝓝 (-π))
[PROOFSTEP]
suffices H : Tendsto (fun x : ℂ => Real.arcsin ((-x).im / abs x) - π) (𝓝[{z : ℂ | z.im < 0}] z) (𝓝 (-π))
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
H : Tendsto (fun x => arcsin ((-x).im / ↑abs x) - π) (𝓝[{z | z.im < 0}] z) (𝓝 (-π))
⊢ Tendsto arg (𝓝[{z | z.im < 0}] z) (𝓝 (-π))
[PROOFSTEP]
refine' H.congr' _
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
H : Tendsto (fun x => arcsin ((-x).im / ↑abs x) - π) (𝓝[{z | z.im < 0}] z) (𝓝 (-π))
⊢ (fun x => arcsin ((-x).im / ↑abs x) - π) =ᶠ[𝓝[{z | z.im < 0}] z] arg
[PROOFSTEP]
have : ∀ᶠ x : ℂ in 𝓝 z, x.re < 0 :=
  continuous_re.tendsto z
    (gt_mem_nhds hre)
      -- Porting note: need to specify the `nhdsWithin` set
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
H : Tendsto (fun x => arcsin ((-x).im / ↑abs x) - π) (𝓝[{z | z.im < 0}] z) (𝓝 (-π))
this : ∀ᶠ (x : ℂ) in 𝓝 z, x.re < 0
⊢ (fun x => arcsin ((-x).im / ↑abs x) - π) =ᶠ[𝓝[{z | z.im < 0}] z] arg
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin (s := {z : ℂ | z.im < 0}), mem_nhdsWithin_of_mem_nhds this] with _ him hre
[GOAL]
case h
x z✝ z : ℂ
hre✝ : z.re < 0
him✝ : z.im = 0
H : Tendsto (fun x => arcsin ((-x).im / ↑abs x) - π) (𝓝[{z | z.im < 0}] z) (𝓝 (-π))
this : ∀ᶠ (x : ℂ) in 𝓝 z, x.re < 0
a✝ : ℂ
him : a✝.im < 0
hre : a✝.re < 0
⊢ arcsin ((-a✝).im / ↑abs a✝) - π = arg a✝
[PROOFSTEP]
rw [arg, if_neg hre.not_le, if_neg him.not_le]
[GOAL]
case H
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ Tendsto (fun x => arcsin ((-x).im / ↑abs x) - π) (𝓝[{z | z.im < 0}] z) (𝓝 (-π))
[PROOFSTEP]
convert
  (Real.continuousAt_arcsin.comp_continuousWithinAt
        ((continuous_im.continuousAt.comp_continuousWithinAt continuousWithinAt_neg).div
          continuous_abs.continuousWithinAt (s := {z : ℂ | z.im < 0}) (_ : abs z ≠ 0))
          -- Porting note: specify constant precisely to assist in goal below).sub_const
    π using
  1
[GOAL]
case h.e'_5
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ 𝓝 (-π) = 𝓝 ((arcsin ∘ (im ∘ Neg.neg / ↑abs)) z - π)
[PROOFSTEP]
simp [him]
[GOAL]
case H
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ ↑abs z ≠ 0
[PROOFSTEP]
lift z to ℝ using him
[GOAL]
case H.intro
x z✝ : ℂ
z : ℝ
hre : (↑z).re < 0
⊢ ↑abs ↑z ≠ 0
[PROOFSTEP]
simpa using hre.ne
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ ContinuousWithinAt arg {z | 0 ≤ z.im} z
[PROOFSTEP]
have : arg =ᶠ[𝓝[{z : ℂ | 0 ≤ z.im}] z] fun x => Real.arcsin ((-x).im / abs x) + π :=
  by
  have : ∀ᶠ x : ℂ in 𝓝 z, x.re < 0 := continuous_re.tendsto z (gt_mem_nhds hre)
  filter_upwards [self_mem_nhdsWithin (s := {z : ℂ | 0 ≤ z.im}), mem_nhdsWithin_of_mem_nhds this] with _ him hre
  rw [arg, if_neg hre.not_le, if_pos him]
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ arg =ᶠ[𝓝[{z | 0 ≤ z.im}] z] fun x => arcsin ((-x).im / ↑abs x) + π
[PROOFSTEP]
have : ∀ᶠ x : ℂ in 𝓝 z, x.re < 0 := continuous_re.tendsto z (gt_mem_nhds hre)
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
this : ∀ᶠ (x : ℂ) in 𝓝 z, x.re < 0
⊢ arg =ᶠ[𝓝[{z | 0 ≤ z.im}] z] fun x => arcsin ((-x).im / ↑abs x) + π
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin (s := {z : ℂ | 0 ≤ z.im}), mem_nhdsWithin_of_mem_nhds this] with _ him hre
[GOAL]
case h
x z✝ z : ℂ
hre✝ : z.re < 0
him✝ : z.im = 0
this : ∀ᶠ (x : ℂ) in 𝓝 z, x.re < 0
a✝ : ℂ
him : 0 ≤ a✝.im
hre : a✝.re < 0
⊢ arg a✝ = arcsin ((-a✝).im / ↑abs a✝) + π
[PROOFSTEP]
rw [arg, if_neg hre.not_le, if_pos him]
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
this : arg =ᶠ[𝓝[{z | 0 ≤ z.im}] z] fun x => arcsin ((-x).im / ↑abs x) + π
⊢ ContinuousWithinAt arg {z | 0 ≤ z.im} z
[PROOFSTEP]
refine' ContinuousWithinAt.congr_of_eventuallyEq _ this _
[GOAL]
case refine'_1
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
this : arg =ᶠ[𝓝[{z | 0 ≤ z.im}] z] fun x => arcsin ((-x).im / ↑abs x) + π
⊢ ContinuousWithinAt (fun x => arcsin ((-x).im / ↑abs x) + π) {z | 0 ≤ z.im} z
[PROOFSTEP]
refine'
  (Real.continuousAt_arcsin.comp_continuousWithinAt
        ((continuous_im.continuousAt.comp_continuousWithinAt continuousWithinAt_neg).div
          continuous_abs.continuousWithinAt _)).add
    tendsto_const_nhds
[GOAL]
case refine'_1
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
this : arg =ᶠ[𝓝[{z | 0 ≤ z.im}] z] fun x => arcsin ((-x).im / ↑abs x) + π
⊢ ↑abs z ≠ 0
[PROOFSTEP]
lift z to ℝ using him
[GOAL]
case refine'_1.intro
x z✝ : ℂ
z : ℝ
hre : (↑z).re < 0
this : arg =ᶠ[𝓝[{z | 0 ≤ z.im}] ↑z] fun x => arcsin ((-x).im / ↑abs x) + π
⊢ ↑abs ↑z ≠ 0
[PROOFSTEP]
simpa using hre.ne
[GOAL]
case refine'_2
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
this : arg =ᶠ[𝓝[{z | 0 ≤ z.im}] z] fun x => arcsin ((-x).im / ↑abs x) + π
⊢ arg z = arcsin ((-z).im / ↑abs z) + π
[PROOFSTEP]
rw [arg, if_neg hre.not_le, if_pos him.ge]
[GOAL]
x z✝ z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ Tendsto arg (𝓝[{z | 0 ≤ z.im}] z) (𝓝 π)
[PROOFSTEP]
simpa only [arg_eq_pi_iff.2 ⟨hre, him⟩] using (continuousWithinAt_arg_of_re_neg_of_im_zero hre him).tendsto
[GOAL]
x z : ℂ
h : x ≠ 0
⊢ ContinuousAt (Angle.coe ∘ arg) x
[PROOFSTEP]
by_cases hs : 0 < x.re ∨ x.im ≠ 0
[GOAL]
case pos
x z : ℂ
h : x ≠ 0
hs : 0 < x.re ∨ x.im ≠ 0
⊢ ContinuousAt (Angle.coe ∘ arg) x
[PROOFSTEP]
exact Real.Angle.continuous_coe.continuousAt.comp (continuousAt_arg hs)
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt (Angle.coe ∘ arg) x
[PROOFSTEP]
rw [← Function.comp.right_id (((↑) : ℝ → Real.Angle) ∘ arg),
  (Function.funext_iff.2 fun _ => (neg_neg _).symm : (id : ℂ → ℂ) = Neg.neg ∘ Neg.neg), ← Function.comp.assoc]
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt (((Angle.coe ∘ arg) ∘ Neg.neg) ∘ Neg.neg) x
[PROOFSTEP]
refine' ContinuousAt.comp _ continuous_neg.continuousAt
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt ((Angle.coe ∘ arg) ∘ Neg.neg) (-x)
[PROOFSTEP]
suffices ContinuousAt (Function.update (((↑) ∘ arg) ∘ Neg.neg : ℂ → Real.Angle) 0 π) (-x) by
  rwa [continuousAt_update_of_ne (neg_ne_zero.2 h)] at this
[GOAL]
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
this : ContinuousAt (Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π) (-x)
⊢ ContinuousAt ((Angle.coe ∘ arg) ∘ Neg.neg) (-x)
[PROOFSTEP]
rwa [continuousAt_update_of_ne (neg_ne_zero.2 h)] at this
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt (Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π) (-x)
[PROOFSTEP]
have ha : Function.update (((↑) ∘ arg) ∘ Neg.neg : ℂ → Real.Angle) 0 π = fun z => (arg z : Real.Angle) + π :=
  by
  rw [Function.update_eq_iff]
  exact ⟨by simp, fun z hz => arg_neg_coe_angle hz⟩
[GOAL]
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π = fun z => ↑(arg z) + ↑π
[PROOFSTEP]
rw [Function.update_eq_iff]
[GOAL]
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ↑π = ↑(arg 0) + ↑π ∧ ∀ (x : ℂ), x ≠ 0 → ((Angle.coe ∘ arg) ∘ Neg.neg) x = ↑(arg x) + ↑π
[PROOFSTEP]
exact ⟨by simp, fun z hz => arg_neg_coe_angle hz⟩
[GOAL]
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ↑π = ↑(arg 0) + ↑π
[PROOFSTEP]
simp
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
ha : Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π = fun z => ↑(arg z) + ↑π
⊢ ContinuousAt (Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π) (-x)
[PROOFSTEP]
rw [ha]
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
ha : Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π = fun z => ↑(arg z) + ↑π
⊢ ContinuousAt (fun z => ↑(arg z) + ↑π) (-x)
[PROOFSTEP]
push_neg at hs
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
ha : Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π = fun z => ↑(arg z) + ↑π
hs : x.re ≤ 0 ∧ x.im = 0
⊢ ContinuousAt (fun z => ↑(arg z) + ↑π) (-x)
[PROOFSTEP]
refine' (Real.Angle.continuous_coe.continuousAt.comp (continuousAt_arg (Or.inl _))).add continuousAt_const
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
ha : Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π = fun z => ↑(arg z) + ↑π
hs : x.re ≤ 0 ∧ x.im = 0
⊢ 0 < (-x).re
[PROOFSTEP]
rw [neg_re, neg_pos]
[GOAL]
case neg
x z : ℂ
h : x ≠ 0
ha : Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π = fun z => ↑(arg z) + ↑π
hs : x.re ≤ 0 ∧ x.im = 0
⊢ x.re < 0
[PROOFSTEP]
exact hs.1.lt_of_ne fun h0 => h (ext_iff.2 ⟨h0, hs.2⟩)


[GOAL]
α : Type u_1
s : Finset α
f : α → ℕ
⊢ ∏ i in s, (f i)! ∣ (∑ i in s, f i)!
[PROOFSTEP]
classical
induction' s using Finset.induction with a' s' has ih
· simp only [Finset.sum_empty, Finset.prod_empty, factorial]
· simp only [Finset.prod_insert has, Finset.sum_insert has]
  refine' dvd_trans (mul_dvd_mul_left (f a')! ih) _
  apply Nat.factorial_mul_factorial_dvd_factorial_add
[GOAL]
α : Type u_1
s : Finset α
f : α → ℕ
⊢ ∏ i in s, (f i)! ∣ (∑ i in s, f i)!
[PROOFSTEP]
induction' s using Finset.induction with a' s' has ih
[GOAL]
case empty
α : Type u_1
s : Finset α
f : α → ℕ
⊢ ∏ i in ∅, (f i)! ∣ (∑ i in ∅, f i)!
[PROOFSTEP]
simp only [Finset.sum_empty, Finset.prod_empty, factorial]
[GOAL]
case insert
α : Type u_1
s : Finset α
f : α → ℕ
a' : α
s' : Finset α
has : ¬a' ∈ s'
ih : ∏ i in s', (f i)! ∣ (∑ i in s', f i)!
⊢ ∏ i in insert a' s', (f i)! ∣ (∑ i in insert a' s', f i)!
[PROOFSTEP]
simp only [Finset.prod_insert has, Finset.sum_insert has]
[GOAL]
case insert
α : Type u_1
s : Finset α
f : α → ℕ
a' : α
s' : Finset α
has : ¬a' ∈ s'
ih : ∏ i in s', (f i)! ∣ (∑ i in s', f i)!
⊢ (f a')! * ∏ i in s', (f i)! ∣ (f a' + ∑ i in s', f i)!
[PROOFSTEP]
refine' dvd_trans (mul_dvd_mul_left (f a')! ih) _
[GOAL]
case insert
α : Type u_1
s : Finset α
f : α → ℕ
a' : α
s' : Finset α
has : ¬a' ∈ s'
ih : ∏ i in s', (f i)! ∣ (∑ i in s', f i)!
⊢ (f a')! * (∑ i in s', f i)! ∣ (f a' + ∑ i in s', f i)!
[PROOFSTEP]
apply Nat.factorial_mul_factorial_dvd_factorial_add


[GOAL]
R : Type u_1
S : Type u_2
M : Type u_3
N : Type u_4
r : Semiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : Module R M
inst✝² : Module R N
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : NoZeroSMulDivisors R N
⊢ ∀ {c : R} {x : M × N}, c • x = 0 → c = 0 ∨ x = 0
[PROOFSTEP]
intro c ⟨x, y⟩ h
[GOAL]
R : Type u_1
S : Type u_2
M : Type u_3
N : Type u_4
r : Semiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid N
inst✝³ : Module R M
inst✝² : Module R N
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : NoZeroSMulDivisors R N
c : R
x : M
y : N
h : c • (x, y) = 0
⊢ c = 0 ∨ (x, y) = 0
[PROOFSTEP]
exact
  or_iff_not_imp_left.mpr fun hc =>
    mk.inj_iff.mpr
      ⟨(smul_eq_zero.mp (congr_arg fst h)).resolve_left hc, (smul_eq_zero.mp (congr_arg snd h)).resolve_left hc⟩


[GOAL]
m k : ℕ
⊢ hyperoperation 0 m k = Nat.succ k
[PROOFSTEP]
rw [hyperoperation, Nat.succ_eq_add_one]
[GOAL]
n m : ℕ
⊢ hyperoperation (n + 3) m 0 = 1
[PROOFSTEP]
rw [hyperoperation]
[GOAL]
n m k : ℕ
⊢ hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k)
[PROOFSTEP]
rw [hyperoperation]
[GOAL]
⊢ hyperoperation 1 = fun x x_1 => x + x_1
[PROOFSTEP]
ext m k
[GOAL]
case h.h
m k : ℕ
⊢ hyperoperation 1 m k = m + k
[PROOFSTEP]
induction' k with bn bih
[GOAL]
case h.h.zero
m : ℕ
⊢ hyperoperation 1 m Nat.zero = m + Nat.zero
[PROOFSTEP]
rw [Nat.add_zero m, hyperoperation]
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 1 m bn = m + bn
⊢ hyperoperation 1 m (Nat.succ bn) = m + Nat.succ bn
[PROOFSTEP]
rw [hyperoperation_recursion, bih, hyperoperation_zero]
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 1 m bn = m + bn
⊢ Nat.succ (m + bn) = m + Nat.succ bn
[PROOFSTEP]
exact Nat.add_assoc m bn 1
[GOAL]
⊢ hyperoperation 2 = fun x x_1 => x * x_1
[PROOFSTEP]
ext m k
[GOAL]
case h.h
m k : ℕ
⊢ hyperoperation 2 m k = m * k
[PROOFSTEP]
induction' k with bn bih
[GOAL]
case h.h.zero
m : ℕ
⊢ hyperoperation 2 m Nat.zero = m * Nat.zero
[PROOFSTEP]
rw [hyperoperation]
[GOAL]
case h.h.zero
m : ℕ
⊢ 0 = m * Nat.zero
[PROOFSTEP]
exact (Nat.mul_zero m).symm
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 2 m bn = m * bn
⊢ hyperoperation 2 m (Nat.succ bn) = m * Nat.succ bn
[PROOFSTEP]
rw [hyperoperation_recursion, hyperoperation_one, bih]
  -- porting note: was `ring`
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 2 m bn = m * bn
⊢ (fun x x_1 => x + x_1) m (m * bn) = m * Nat.succ bn
[PROOFSTEP]
dsimp only
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 2 m bn = m * bn
⊢ m + m * bn = m * Nat.succ bn
[PROOFSTEP]
nth_rewrite 1 [← mul_one m]
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 2 m bn = m * bn
⊢ m * 1 + m * bn = m * Nat.succ bn
[PROOFSTEP]
rw [← mul_add, add_comm, Nat.succ_eq_add_one]
[GOAL]
⊢ hyperoperation 3 = fun x x_1 => x ^ x_1
[PROOFSTEP]
ext m k
[GOAL]
case h.h
m k : ℕ
⊢ hyperoperation 3 m k = m ^ k
[PROOFSTEP]
induction' k with bn bih
[GOAL]
case h.h.zero
m : ℕ
⊢ hyperoperation 3 m Nat.zero = m ^ Nat.zero
[PROOFSTEP]
rw [hyperoperation_ge_three_eq_one]
[GOAL]
case h.h.zero
m : ℕ
⊢ 1 = m ^ Nat.zero
[PROOFSTEP]
exact (pow_zero m).symm
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 3 m bn = m ^ bn
⊢ hyperoperation 3 m (Nat.succ bn) = m ^ Nat.succ bn
[PROOFSTEP]
rw [hyperoperation_recursion, hyperoperation_two, bih]
[GOAL]
case h.h.succ
m bn : ℕ
bih : hyperoperation 3 m bn = m ^ bn
⊢ (fun x x_1 => x * x_1) m (m ^ bn) = m ^ Nat.succ bn
[PROOFSTEP]
exact (pow_succ m bn).symm
[GOAL]
n m : ℕ
⊢ hyperoperation (n + 2) m 1 = m
[PROOFSTEP]
induction' n with nn nih
[GOAL]
case zero
m : ℕ
⊢ hyperoperation (Nat.zero + 2) m 1 = m
[PROOFSTEP]
rw [hyperoperation_two]
[GOAL]
case zero
m : ℕ
⊢ (fun x x_1 => x * x_1) m 1 = m
[PROOFSTEP]
ring
[GOAL]
case succ
m nn : ℕ
nih : hyperoperation (nn + 2) m 1 = m
⊢ hyperoperation (Nat.succ nn + 2) m 1 = m
[PROOFSTEP]
rw [hyperoperation_recursion, hyperoperation_ge_three_eq_one, nih]
[GOAL]
n : ℕ
⊢ hyperoperation (n + 1) 2 2 = 4
[PROOFSTEP]
induction' n with nn nih
[GOAL]
case zero
⊢ hyperoperation (Nat.zero + 1) 2 2 = 4
[PROOFSTEP]
rw [hyperoperation_one]
[GOAL]
case succ
nn : ℕ
nih : hyperoperation (nn + 1) 2 2 = 4
⊢ hyperoperation (Nat.succ nn + 1) 2 2 = 4
[PROOFSTEP]
rw [hyperoperation_recursion, hyperoperation_ge_two_eq_self, nih]
[GOAL]
n : ℕ
⊢ ∀ (k : ℕ), hyperoperation (n + 3) 1 k = 1
[PROOFSTEP]
induction' n with nn nih
[GOAL]
case zero
⊢ ∀ (k : ℕ), hyperoperation (Nat.zero + 3) 1 k = 1
[PROOFSTEP]
intro k
[GOAL]
case zero
k : ℕ
⊢ hyperoperation (Nat.zero + 3) 1 k = 1
[PROOFSTEP]
rw [hyperoperation_three]
[GOAL]
case zero
k : ℕ
⊢ (fun x x_1 => x ^ x_1) 1 k = 1
[PROOFSTEP]
dsimp
[GOAL]
case zero
k : ℕ
⊢ 1 ^ k = 1
[PROOFSTEP]
rw [one_pow]
[GOAL]
case succ
nn : ℕ
nih : ∀ (k : ℕ), hyperoperation (nn + 3) 1 k = 1
⊢ ∀ (k : ℕ), hyperoperation (Nat.succ nn + 3) 1 k = 1
[PROOFSTEP]
intro k
[GOAL]
case succ
nn : ℕ
nih : ∀ (k : ℕ), hyperoperation (nn + 3) 1 k = 1
k : ℕ
⊢ hyperoperation (Nat.succ nn + 3) 1 k = 1
[PROOFSTEP]
cases k
[GOAL]
case succ.zero
nn : ℕ
nih : ∀ (k : ℕ), hyperoperation (nn + 3) 1 k = 1
⊢ hyperoperation (Nat.succ nn + 3) 1 Nat.zero = 1
[PROOFSTEP]
rw [hyperoperation_ge_three_eq_one]
[GOAL]
case succ.succ
nn : ℕ
nih : ∀ (k : ℕ), hyperoperation (nn + 3) 1 k = 1
n✝ : ℕ
⊢ hyperoperation (Nat.succ nn + 3) 1 (Nat.succ n✝) = 1
[PROOFSTEP]
rw [hyperoperation_recursion, nih]
[GOAL]
n k : ℕ
⊢ hyperoperation (n + 4) 0 k = if Even k then 1 else 0
[PROOFSTEP]
induction' k with kk kih
[GOAL]
case zero
n : ℕ
⊢ hyperoperation (n + 4) 0 Nat.zero = if Even Nat.zero then 1 else 0
[PROOFSTEP]
rw [hyperoperation_ge_three_eq_one]
[GOAL]
case zero
n : ℕ
⊢ 1 = if Even Nat.zero then 1 else 0
[PROOFSTEP]
simp only [even_zero, if_true]
[GOAL]
case succ
n kk : ℕ
kih : hyperoperation (n + 4) 0 kk = if Even kk then 1 else 0
⊢ hyperoperation (n + 4) 0 (Nat.succ kk) = if Even (Nat.succ kk) then 1 else 0
[PROOFSTEP]
rw [hyperoperation_recursion]
[GOAL]
case succ
n kk : ℕ
kih : hyperoperation (n + 4) 0 kk = if Even kk then 1 else 0
⊢ hyperoperation (n + 3) 0 (hyperoperation (n + 3 + 1) 0 kk) = if Even (Nat.succ kk) then 1 else 0
[PROOFSTEP]
rw [kih]
[GOAL]
case succ
n kk : ℕ
kih : hyperoperation (n + 4) 0 kk = if Even kk then 1 else 0
⊢ hyperoperation (n + 3) 0 (if Even kk then 1 else 0) = if Even (Nat.succ kk) then 1 else 0
[PROOFSTEP]
simp_rw [Nat.even_add_one]
[GOAL]
case succ
n kk : ℕ
kih : hyperoperation (n + 4) 0 kk = if Even kk then 1 else 0
⊢ hyperoperation (n + 3) 0 (if Even kk then 1 else 0) = if ¬Even kk then 1 else 0
[PROOFSTEP]
split_ifs
[GOAL]
case pos
n kk : ℕ
kih : hyperoperation (n + 4) 0 kk = if Even kk then 1 else 0
h✝ : Even kk
⊢ hyperoperation (n + 3) 0 1 = 0
[PROOFSTEP]
exact hyperoperation_ge_two_eq_self (n + 1) 0
[GOAL]
case neg
n kk : ℕ
kih : hyperoperation (n + 4) 0 kk = if Even kk then 1 else 0
h✝ : ¬Even kk
⊢ hyperoperation (n + 3) 0 0 = 1
[PROOFSTEP]
exact hyperoperation_ge_three_eq_one n 0


[GOAL]
a : ℕ
⊢ Periodic (gcd a) a
[PROOFSTEP]
simp only [forall_const, gcd_add_self_right, eq_self_iff_true, Periodic]
[GOAL]
a : ℕ
⊢ Periodic (coprime a) a
[PROOFSTEP]
simp only [coprime_add_self_right, forall_const, iff_self_iff, eq_iff_iff, Periodic]
[GOAL]
a : ℕ
⊢ Periodic (fun n => n % a) a
[PROOFSTEP]
simp only [forall_const, eq_self_iff_true, add_mod_right, Periodic]
[GOAL]
α : Type u_1
f : ℕ → α
a : ℕ
hf : Periodic f a
n : ℕ
⊢ f (n % a) = f n
[PROOFSTEP]
conv_rhs => rw [← Nat.mod_add_div n a, mul_comm, ← Nat.nsmul_eq_mul, hf.nsmul]
[GOAL]
α : Type u_1
f : ℕ → α
a : ℕ
hf : Periodic f a
n : ℕ
| f n
[PROOFSTEP]
rw [← Nat.mod_add_div n a, mul_comm, ← Nat.nsmul_eq_mul, hf.nsmul]
[GOAL]
α : Type u_1
f : ℕ → α
a : ℕ
hf : Periodic f a
n : ℕ
| f n
[PROOFSTEP]
rw [← Nat.mod_add_div n a, mul_comm, ← Nat.nsmul_eq_mul, hf.nsmul]
[GOAL]
α : Type u_1
f : ℕ → α
a : ℕ
hf : Periodic f a
n : ℕ
| f n
[PROOFSTEP]
rw [← Nat.mod_add_div n a, mul_comm, ← Nat.nsmul_eq_mul, hf.nsmul]
[GOAL]
n a : ℕ
p : ℕ → Prop
inst✝ : DecidablePred p
pp : Periodic p a
⊢ ↑card (filter p (Ico n (n + a))) = count p a
[PROOFSTEP]
rw [count_eq_card_filter_range, Finset.card, Finset.filter_val, Finset.range_val, ← multiset_Ico_map_mod n, ←
  map_count_True_eq_filter_card, ← map_count_True_eq_filter_card, map_map]
[GOAL]
n a : ℕ
p : ℕ → Prop
inst✝ : DecidablePred p
pp : Periodic p a
⊢ Multiset.count True (map p (Ico n (n + a))) = Multiset.count True (map (p ∘ fun x => x % a) (Ico n (n + a)))
[PROOFSTEP]
congr
[GOAL]
case e_a.e_f
n a : ℕ
p : ℕ → Prop
inst✝ : DecidablePred p
pp : Periodic p a
⊢ p = p ∘ fun x => x % a
[PROOFSTEP]
funext n
[GOAL]
case e_a.e_f.h
n✝ a : ℕ
p : ℕ → Prop
inst✝ : DecidablePred p
pp : Periodic p a
n : ℕ
⊢ p n = (p ∘ fun x => x % a) n
[PROOFSTEP]
exact (Function.Periodic.map_mod_nat pp n).symm


[GOAL]
E : Type u_1
F : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : InnerProductSpace ℝ E
inst✝ : InnerProductSpace ℝ F
f : E → F
x : E
⊢ ConformalAt f x ↔ ∃ c, 0 < c ∧ ∀ (u v : E), inner (↑(fderiv ℝ f x) u) (↑(fderiv ℝ f x) v) = c * inner u v
[PROOFSTEP]
rw [conformalAt_iff_isConformalMap_fderiv, isConformalMap_iff]
[GOAL]
E : Type u_1
F : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : InnerProductSpace ℝ E
inst✝ : InnerProductSpace ℝ F
f : E → F
x : E
f' : E →L[ℝ] F
h : HasFDerivAt f f' x
⊢ ConformalAt f x ↔ ∃ c, 0 < c ∧ ∀ (u v : E), inner (↑f' u) (↑f' v) = c * inner u v
[PROOFSTEP]
simp only [conformalAt_iff', h.fderiv]


[GOAL]
x : ℚ
⊢ 0 ≤ x ↔ x ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
[PROOFSTEP]
refine'
  ⟨fun hx => _, fun hx =>
    AddSubmonoid.closure_induction hx (by rintro - ⟨s, rfl⟩; exact mul_self_nonneg s) le_rfl fun _ _ => add_nonneg⟩
    /- If `x = p / q`, then, since `0 ≤ x`, we have `p q : ℕ`, and `p / q` is the sum of `p * q`
          copies of `(1 / q) ^ 2`, and so `x` lies in the `AddSubmonoid` generated by square elements.

          Note: it's possible to rephrase this argument as `x = (p * q) • (1 / q) ^ 2`, but this would
          be somewhat challenging without increasing import requirements. -/
        -- Porting note: rewrote proof to avoid removed constructor rat.mk_pnat
[GOAL]
x : ℚ
hx : x ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
⊢ ∀ (x : ℚ), (x ∈ Set.range fun s => star s * s) → 0 ≤ x
[PROOFSTEP]
rintro - ⟨s, rfl⟩
[GOAL]
case intro
x : ℚ
hx : x ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
s : ℚ
⊢ 0 ≤ (fun s => star s * s) s
[PROOFSTEP]
exact mul_self_nonneg s
[GOAL]
x : ℚ
hx : 0 ≤ x
⊢ x ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
[PROOFSTEP]
suffices (Finset.range (x.num.natAbs * x.den)).sum (Function.const ℕ ((1 : ℚ) / x.den * ((1 : ℚ) / x.den))) = x by
  exact this ▸ sum_mem fun n _ => AddSubmonoid.subset_closure ⟨_, rfl⟩
[GOAL]
x : ℚ
hx : 0 ≤ x
this : Finset.sum (Finset.range (Int.natAbs x.num * x.den)) (Function.const ℕ (1 / ↑x.den * (1 / ↑x.den))) = x
⊢ x ∈ AddSubmonoid.closure (Set.range fun s => star s * s)
[PROOFSTEP]
exact this ▸ sum_mem fun n _ => AddSubmonoid.subset_closure ⟨_, rfl⟩
[GOAL]
x : ℚ
hx : 0 ≤ x
⊢ Finset.sum (Finset.range (Int.natAbs x.num * x.den)) (Function.const ℕ (1 / ↑x.den * (1 / ↑x.den))) = x
[PROOFSTEP]
simp only [Function.const_apply, Finset.sum_const, Finset.card_range, nsmul_eq_mul]
[GOAL]
x : ℚ
hx : 0 ≤ x
⊢ ↑(Int.natAbs x.num * x.den) * (1 / ↑x.den * (1 / ↑x.den)) = x
[PROOFSTEP]
rw [← Int.cast_ofNat, Int.ofNat_mul, Int.coe_natAbs, abs_of_nonneg (num_nonneg_iff_zero_le.mpr hx), Int.cast_mul,
  Int.cast_ofNat]
[GOAL]
x : ℚ
hx : 0 ≤ x
⊢ ↑x.num * ↑x.den * (1 / ↑x.den * (1 / ↑x.den)) = x
[PROOFSTEP]
rw [← mul_assoc, mul_assoc (x.num : ℚ), mul_one_div_cancel (Nat.cast_ne_zero.mpr x.pos.ne'), mul_one, mul_one_div,
  Rat.num_div_den]


[GOAL]
R : Type u_1
α : Type u_2
M : Type u_3
inst✝² : DivisionSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : α → α
g : α → M
x : α
⊢ birkhoffAverage R f g 0 x = 0
[PROOFSTEP]
simp [birkhoffAverage]
[GOAL]
R : Type u_1
α : Type u_2
M : Type u_3
inst✝² : DivisionSemiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
f : α → α
g : α → M
x : α
⊢ birkhoffAverage R f g 1 x = g x
[PROOFSTEP]
simp [birkhoffAverage]
[GOAL]
R : Type u_1
α : Type u_2
M : Type u_3
inst✝⁶ : DivisionSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
S : Type u_4
F : Type u_5
N : Type u_6
inst✝³ : DivisionSemiring S
inst✝² : AddCommMonoid N
inst✝¹ : Module S N
inst✝ : AddMonoidHomClass F M N
g' : F
f : α → α
g : α → M
n : ℕ
x : α
⊢ ↑g' (birkhoffAverage R f g n x) = birkhoffAverage S f (↑g' ∘ g) n x
[PROOFSTEP]
simp only [birkhoffAverage, map_inv_nat_cast_smul g' R S, map_birkhoffSum]
[GOAL]
R : Type u_1
α : Type u_2
M : Type u_3
inst✝⁴ : DivisionSemiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
S : Type u_4
inst✝¹ : DivisionSemiring S
inst✝ : Module S M
⊢ birkhoffAverage R = birkhoffAverage S
[PROOFSTEP]
ext
[GOAL]
case h.h.h.h
R : Type u_1
α : Type u_2
M : Type u_3
inst✝⁴ : DivisionSemiring R
inst✝³ : AddCommMonoid M
inst✝² : Module R M
S : Type u_4
inst✝¹ : DivisionSemiring S
inst✝ : Module S M
x✝³ : α → α
x✝² : α → M
x✝¹ : ℕ
x✝ : α
⊢ birkhoffAverage R x✝³ x✝² x✝¹ x✝ = birkhoffAverage S x✝³ x✝² x✝¹ x✝
[PROOFSTEP]
apply birkhoffAverage_congr_ring
[GOAL]
R : Type u_1
α : Type u_2
M : Type u_3
inst✝³ : DivisionSemiring R
inst✝² : AddCommMonoid M
inst✝¹ : Module R M
inst✝ : CharZero R
f : α → α
x : α
h : IsFixedPt f x
g : α → M
n : ℕ
hn : n ≠ 0
⊢ birkhoffAverage R f g n x = g x
[PROOFSTEP]
rw [birkhoffAverage, h.birkhoffSum_eq, nsmul_eq_smul_cast R, inv_smul_smul₀]
[GOAL]
case hc
R : Type u_1
α : Type u_2
M : Type u_3
inst✝³ : DivisionSemiring R
inst✝² : AddCommMonoid M
inst✝¹ : Module R M
inst✝ : CharZero R
f : α → α
x : α
h : IsFixedPt f x
g : α → M
n : ℕ
hn : n ≠ 0
⊢ ↑n ≠ 0
[PROOFSTEP]
rwa [Nat.cast_ne_zero]
[GOAL]
M : Type u_2
α : Type u_3
R : Type u_1
inst✝² : DivisionRing R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
f : α → α
g : α → M
n : ℕ
x : α
⊢ birkhoffAverage R f g n (f x) - birkhoffAverage R f g n x = (↑n)⁻¹ • (g (f^[n] x) - g x)
[PROOFSTEP]
simp only [birkhoffAverage, birkhoffSum_apply_sub_birkhoffSum, ← smul_sub]


[GOAL]
a b : ℕ+
⊢ card (Icc a b) = ↑b + 1 - ↑a
[PROOFSTEP]
rw [← Nat.card_Icc]
  -- porting note: I had to change this to `erw` *and* provide the proof, yuck.
    -- https://github.com/leanprover-community/mathlib4/issues/5164
[GOAL]
a b : ℕ+
⊢ card (Icc a b) = card (Icc ↑a ↑b)
[PROOFSTEP]
erw [← Finset.map_subtype_embedding_Icc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
[GOAL]
a b : ℕ+
⊢ card (Icc a b) = card (map (Embedding.subtype fun n => 0 < n) (Icc a b))
[PROOFSTEP]
rw [card_map]
[GOAL]
a b : ℕ+
⊢ card (Ico a b) = ↑b - ↑a
[PROOFSTEP]
rw [← Nat.card_Ico]
  -- porting note: I had to change this to `erw` *and* provide the proof, yuck.
    -- https://github.com/leanprover-community/mathlib4/issues/5164
[GOAL]
a b : ℕ+
⊢ card (Ico a b) = card (Ico ↑a ↑b)
[PROOFSTEP]
erw [← Finset.map_subtype_embedding_Ico _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
[GOAL]
a b : ℕ+
⊢ card (Ico a b) = card (map (Embedding.subtype fun n => 0 < n) (Ico a b))
[PROOFSTEP]
rw [card_map]
[GOAL]
a b : ℕ+
⊢ card (Ioc a b) = ↑b - ↑a
[PROOFSTEP]
rw [← Nat.card_Ioc]
  -- porting note: I had to change this to `erw` *and* provide the proof, yuck.
    -- https://github.com/leanprover-community/mathlib4/issues/5164
[GOAL]
a b : ℕ+
⊢ card (Ioc a b) = card (Ioc ↑a ↑b)
[PROOFSTEP]
erw [← Finset.map_subtype_embedding_Ioc _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
[GOAL]
a b : ℕ+
⊢ card (Ioc a b) = card (map (Embedding.subtype fun n => 0 < n) (Ioc a b))
[PROOFSTEP]
rw [card_map]
[GOAL]
a b : ℕ+
⊢ card (Ioo a b) = ↑b - ↑a - 1
[PROOFSTEP]
rw [← Nat.card_Ioo]
  -- porting note: I had to change this to `erw` *and* provide the proof, yuck.
    -- https://github.com/leanprover-community/mathlib4/issues/5164
[GOAL]
a b : ℕ+
⊢ card (Ioo a b) = card (Ioo ↑a ↑b)
[PROOFSTEP]
erw [← Finset.map_subtype_embedding_Ioo _ a b (fun c x _ hx _ hc _ => hc.trans_le hx)]
[GOAL]
a b : ℕ+
⊢ card (Ioo a b) = card (map (Embedding.subtype fun n => 0 < n) (Ioo a b))
[PROOFSTEP]
rw [card_map]
[GOAL]
a b : ℕ+
⊢ card (uIcc a b) = Int.natAbs (↑↑b - ↑↑a) + 1
[PROOFSTEP]
rw [← Nat.card_uIcc, ← map_subtype_embedding_uIcc, card_map]
[GOAL]
a b : ℕ+
⊢ Fintype.card ↑(Set.Icc a b) = ↑b + 1 - ↑a
[PROOFSTEP]
rw [← card_Icc, Fintype.card_ofFinset]
[GOAL]
a b : ℕ+
⊢ Fintype.card ↑(Set.Ico a b) = ↑b - ↑a
[PROOFSTEP]
rw [← card_Ico, Fintype.card_ofFinset]
[GOAL]
a b : ℕ+
⊢ Fintype.card ↑(Set.Ioc a b) = ↑b - ↑a
[PROOFSTEP]
rw [← card_Ioc, Fintype.card_ofFinset]
[GOAL]
a b : ℕ+
⊢ Fintype.card ↑(Set.Ioo a b) = ↑b - ↑a - 1
[PROOFSTEP]
rw [← card_Ioo, Fintype.card_ofFinset]
[GOAL]
a b : ℕ+
⊢ Fintype.card ↑(Set.uIcc a b) = Int.natAbs (↑↑b - ↑↑a) + 1
[PROOFSTEP]
rw [← card_uIcc, Fintype.card_ofFinset]


[GOAL]
x : ℝ
h₁ : -π < x
h₂ : x ≤ π
⊢ arg ↑(↑expMapCircle x) = x
[PROOFSTEP]
rw [expMapCircle_apply, exp_mul_I, arg_cos_add_sin_mul_I ⟨h₁, h₂⟩]
[GOAL]
x y : ℝ
⊢ ↑expMapCircle x = ↑expMapCircle y ↔ ∃ m, x = y + ↑m * (2 * π)
[PROOFSTEP]
rw [Subtype.ext_iff, expMapCircle_apply, expMapCircle_apply, exp_eq_exp_iff_exists_int]
[GOAL]
x y : ℝ
⊢ (∃ n, ↑x * I = ↑y * I + ↑n * (2 * ↑π * I)) ↔ ∃ m, x = y + ↑m * (2 * π)
[PROOFSTEP]
refine' exists_congr fun n => _
[GOAL]
x y : ℝ
n : ℤ
⊢ ↑x * I = ↑y * I + ↑n * (2 * ↑π * I) ↔ x = y + ↑n * (2 * π)
[PROOFSTEP]
rw [← mul_assoc, ← add_mul, mul_left_inj' I_ne_zero]
[GOAL]
x y : ℝ
n : ℤ
⊢ ↑x = ↑y + ↑n * (2 * ↑π) ↔ x = y + ↑n * (2 * π)
[PROOFSTEP]
norm_cast
[GOAL]
z : ℝ
⊢ z + 2 * π = z + ↑1 * (2 * π)
[PROOFSTEP]
rw [Int.cast_one, one_mul]
[GOAL]
θ : Angle
⊢ ↑(expMapCircle θ) = ↑(cos θ) + ↑(sin θ) * I
[PROOFSTEP]
induction θ using Real.Angle.induction_on
[GOAL]
case h
x✝ : ℝ
⊢ ↑(expMapCircle ↑x✝) = ↑(cos ↑x✝) + ↑(sin ↑x✝) * I
[PROOFSTEP]
simp [Complex.exp_mul_I]
[GOAL]
⊢ expMapCircle 0 = 1
[PROOFSTEP]
rw [← Real.Angle.coe_zero, Real.Angle.expMapCircle_coe, _root_.expMapCircle_zero]
[GOAL]
θ : Angle
⊢ expMapCircle (-θ) = (expMapCircle θ)⁻¹
[PROOFSTEP]
induction θ using Real.Angle.induction_on
[GOAL]
case h
x✝ : ℝ
⊢ expMapCircle (-↑x✝) = (expMapCircle ↑x✝)⁻¹
[PROOFSTEP]
simp_rw [← Real.Angle.coe_neg, Real.Angle.expMapCircle_coe, _root_.expMapCircle_neg]
[GOAL]
θ₁ θ₂ : Angle
⊢ expMapCircle (θ₁ + θ₂) = expMapCircle θ₁ * expMapCircle θ₂
[PROOFSTEP]
induction θ₁ using Real.Angle.induction_on
[GOAL]
case h
θ₂ : Angle
x✝ : ℝ
⊢ expMapCircle (↑x✝ + θ₂) = expMapCircle ↑x✝ * expMapCircle θ₂
[PROOFSTEP]
induction θ₂ using Real.Angle.induction_on
[GOAL]
case h.h
x✝¹ x✝ : ℝ
⊢ expMapCircle (↑x✝¹ + ↑x✝) = expMapCircle ↑x✝¹ * expMapCircle ↑x✝
[PROOFSTEP]
exact _root_.expMapCircle_add _ _
[GOAL]
θ : Angle
⊢ ↑(arg ↑(expMapCircle θ)) = θ
[PROOFSTEP]
induction θ using Real.Angle.induction_on
[GOAL]
case h
x✝ : ℝ
⊢ ↑(arg ↑(expMapCircle ↑x✝)) = ↑x✝
[PROOFSTEP]
rw [Real.Angle.expMapCircle_coe, expMapCircle_apply, exp_mul_I, ← ofReal_cos, ← ofReal_sin, ← Real.Angle.cos_coe, ←
  Real.Angle.sin_coe, arg_cos_add_sin_mul_I_coe_angle]


[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
⊢ IsEquipartition P ↔
    ∀ (a : Finset α),
      a ∈ P.parts →
        Finset.card a = Finset.card s / Finset.card P.parts ∨ Finset.card a = Finset.card s / Finset.card P.parts + 1
[PROOFSTEP]
simp_rw [IsEquipartition, Finset.equitableOn_iff, P.sum_card_parts]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
hP : IsEquipartition P
ht : t ∈ P.parts
⊢ Finset.card s / Finset.card P.parts ≤ Finset.card t
[PROOFSTEP]
rw [← P.sum_card_parts]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
hP : IsEquipartition P
ht : t ∈ P.parts
⊢ (Finset.sum P.parts fun i => Finset.card i) / Finset.card P.parts ≤ Finset.card t
[PROOFSTEP]
exact Finset.EquitableOn.le hP ht
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
hP : IsEquipartition P
ht : t ∈ P.parts
⊢ Finset.card t ≤ Finset.card s / Finset.card P.parts + 1
[PROOFSTEP]
rw [← P.sum_card_parts]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
hP : IsEquipartition P
ht : t ∈ P.parts
⊢ Finset.card t ≤ (Finset.sum P.parts fun i => Finset.card i) / Finset.card P.parts + 1
[PROOFSTEP]
exact Finset.EquitableOn.le_add_one hP ht
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
⊢ ∀ (a : Finset α), a ∈ ↑⊥.parts → Finset.card a = 1 ∨ Finset.card a = 1 + 1
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
hs : s ≠ ∅
⊢ IsEquipartition (indiscrete hs)
[PROOFSTEP]
rw [IsEquipartition, indiscrete_parts, coe_singleton]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
hs : s ≠ ∅
⊢ Set.EquitableOn {s} Finset.card
[PROOFSTEP]
exact Set.equitableOn_singleton s _


[GOAL]
⊢ CommSemigroup 𝔻
[PROOFSTEP]
unfold UnitDisc
[GOAL]
⊢ CommSemigroup ↑(ball 0 1)
[PROOFSTEP]
infer_instance
[GOAL]
⊢ HasDistribNeg 𝔻
[PROOFSTEP]
unfold UnitDisc
[GOAL]
⊢ HasDistribNeg ↑(ball 0 1)
[PROOFSTEP]
infer_instance
[GOAL]
z : 𝔻
⊢ ↑normSq ↑z < 1
[PROOFSTEP]
convert (Real.sqrt_lt' one_pos).1 z.abs_lt_one
[GOAL]
case h.e'_4
z : 𝔻
⊢ 1 = 1 ^ 2
[PROOFSTEP]
exact (one_pow 2).symm
[GOAL]
z : 𝔻
⊢ ↑abs ↑z ≠ ↑abs (-1)
[PROOFSTEP]
rw [abs.map_neg, map_one]
[GOAL]
z : 𝔻
⊢ ↑abs ↑z ≠ 1
[PROOFSTEP]
exact z.abs_ne_one


[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ q = p / (p - 1)
[PROOFSTEP]
have := h.inv_add_inv_conj
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
this : 1 / p + 1 / q = 1
⊢ q = p / (p - 1)
[PROOFSTEP]
rw [← eq_sub_iff_add_eq', one_div, inv_eq_iff_eq_inv] at this
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
this : q = (1 - 1 / p)⁻¹
⊢ q = p / (p - 1)
[PROOFSTEP]
field_simp [this, h.ne_zero]
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ p * q = p + q
[PROOFSTEP]
simpa only [sub_mul, sub_eq_iff_eq_add, one_mul] using h.sub_one_mul_conj
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ 1 < q
[PROOFSTEP]
rw [h.conj_eq]
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ 1 < p / (p - 1)
[PROOFSTEP]
exact (one_lt_div h.sub_one_pos).mpr (sub_one_lt p)
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ 1 / q + 1 / p = 1
[PROOFSTEP]
simpa [add_comm] using h.inv_add_inv_conj
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ p / q = p - 1
[PROOFSTEP]
field_simp [h.symm.ne_zero]
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ p = (p - 1) * q
[PROOFSTEP]
rw [h.sub_one_mul_conj]
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ 1 < toNNReal p
[PROOFSTEP]
rw [← Real.toNNReal_one, Real.toNNReal_lt_toNNReal_iff h.pos]
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ 1 < p
[PROOFSTEP]
exact h.one_lt
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ 1 / toNNReal p + 1 / toNNReal q = 1
[PROOFSTEP]
rw [← Real.toNNReal_one, ← Real.toNNReal_div' h.nonneg, ← Real.toNNReal_div' h.symm.nonneg, ←
  Real.toNNReal_add h.one_div_nonneg h.symm.one_div_nonneg, h.inv_add_inv_conj]
[GOAL]
p q : ℝ
h : IsConjugateExponent p q
⊢ 1 / ENNReal.ofReal p + 1 / ENNReal.ofReal q = 1
[PROOFSTEP]
rw [← ENNReal.ofReal_one, ← ENNReal.ofReal_div_of_pos h.pos, ← ENNReal.ofReal_div_of_pos h.symm.pos, ←
  ENNReal.ofReal_add h.one_div_nonneg h.symm.one_div_nonneg, h.inv_add_inv_conj]
[GOAL]
p q : ℝ
h : 1 < p
H : q = p / (p - 1)
⊢ 1 / p + 1 / q = 1
[PROOFSTEP]
field_simp [H, ne_of_gt (lt_trans zero_lt_one h)]
[GOAL]
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
⊢ 1 < 1 / a
[PROOFSTEP]
rw [lt_div_iff ha, one_mul]
[GOAL]
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
⊢ a < 1
[PROOFSTEP]
linarith
[GOAL]
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
⊢ 1 / (1 / a) + 1 / (1 / b) = 1
[PROOFSTEP]
simp_rw [one_div_one_div]
[GOAL]
a b : ℝ
ha : 0 < a
hb : 0 < b
hab : a + b = 1
⊢ a + b = 1
[PROOFSTEP]
exact hab


[GOAL]
n : ℕ
pn : NormNum.IsNat n 0
⊢ List.range n = []
[PROOFSTEP]
rw [pn.out, Nat.cast_zero, List.range_zero]
[GOAL]
n nn n' : ℕ
pn : NormNum.IsNat n nn
pn' : nn = Nat.succ n'
⊢ List.range n = 0 :: List.map Nat.succ (List.range n')
[PROOFSTEP]
rw [pn.out, Nat.cast_id, pn', List.range_succ_eq_map]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
a : α
s : Multiset α
⊢ insert a s = a ::ₘ s
[PROOFSTEP]
ext
[GOAL]
case a
α : Type u_1
inst✝ : DecidableEq α
a : α
s : Multiset α
a✝ : α
⊢ Multiset.count a✝ (insert a s) = Multiset.count a✝ (a ::ₘ s)
[PROOFSTEP]
simp
[GOAL]
n : ℕ
pn : NormNum.IsNat n 0
⊢ Multiset.range n = 0
[PROOFSTEP]
rw [pn.out, Nat.cast_zero, Multiset.range_zero]
[GOAL]
n nn n' : ℕ
pn : NormNum.IsNat n nn
pn' : nn = Nat.succ n'
⊢ Multiset.range n = n' ::ₘ Multiset.range n'
[PROOFSTEP]
rw [pn.out, Nat.cast_id, pn', Multiset.range_succ]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
a : α
s : Finset α
h : ¬a ∈ s
⊢ insert a s = Finset.cons a s h
[PROOFSTEP]
ext
[GOAL]
case a
α : Type u_1
inst✝ : DecidableEq α
a : α
s : Finset α
h : ¬a ∈ s
a✝ : α
⊢ a✝ ∈ insert a s ↔ a✝ ∈ Finset.cons a s h
[PROOFSTEP]
simp
[GOAL]
n : ℕ
pn : NormNum.IsNat n 0
⊢ Finset.range n = ∅
[PROOFSTEP]
rw [pn.out, Nat.cast_zero, Finset.range_zero]
[GOAL]
n nn n' : ℕ
pn : NormNum.IsNat n nn
pn' : nn = Nat.succ n'
⊢ Finset.range n = Finset.cons n' (Finset.range n') (_ : ¬n' ∈ Finset.range n')
[PROOFSTEP]
rw [pn.out, Nat.cast_id, pn', Finset.range_succ, Finset.insert_eq_cons]
[GOAL]
α : Type u_1
inst✝ : Fintype α
elems : Finset α
complete : ∀ (x : α), x ∈ elems
⊢ Finset.univ = elems
[PROOFSTEP]
ext x
[GOAL]
case a
α : Type u_1
inst✝ : Fintype α
elems : Finset α
complete : ∀ (x : α), x ∈ elems
x : α
⊢ x ∈ Finset.univ ↔ x ∈ elems
[PROOFSTEP]
simpa using complete x
[GOAL]
β : Type u_1
α : Type u_2
inst✝ : CommSemiring β
f : α → β
⊢ Finset.sum ∅ f = ↑0
[PROOFSTEP]
simp
[GOAL]
β : Type u_1
α : Type u_2
inst✝ : CommSemiring β
f : α → β
⊢ Finset.prod ∅ f = ↑1
[PROOFSTEP]
simp


[GOAL]
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m n : ℕ
h : ↑m = ↑n
⊢ m = n
[PROOFSTEP]
induction' m with m ih generalizing n
[GOAL]
case zero
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m n✝ : ℕ
h✝ : ↑m = ↑n✝
n : ℕ
h : ↑Nat.zero = ↑n
⊢ Nat.zero = n
[PROOFSTEP]
rw [H n]
[GOAL]
case zero
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m n✝ : ℕ
h✝ : ↑m = ↑n✝
n : ℕ
h : ↑Nat.zero = ↑n
⊢ ↑n = 0
[PROOFSTEP]
rw [← h, Nat.cast_zero]
[GOAL]
case succ
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m✝ n✝ : ℕ
h✝ : ↑m✝ = ↑n✝
m : ℕ
ih : ∀ (n : ℕ), ↑m = ↑n → m = n
n : ℕ
h : ↑(Nat.succ m) = ↑n
⊢ Nat.succ m = n
[PROOFSTEP]
cases' n with n
[GOAL]
case succ.zero
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m✝ n : ℕ
h✝ : ↑m✝ = ↑n
m : ℕ
ih : ∀ (n : ℕ), ↑m = ↑n → m = n
h : ↑(Nat.succ m) = ↑Nat.zero
⊢ Nat.succ m = Nat.zero
[PROOFSTEP]
apply H
[GOAL]
case succ.zero.a
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m✝ n : ℕ
h✝ : ↑m✝ = ↑n
m : ℕ
ih : ∀ (n : ℕ), ↑m = ↑n → m = n
h : ↑(Nat.succ m) = ↑Nat.zero
⊢ ↑(Nat.succ m) = 0
[PROOFSTEP]
rw [h, Nat.cast_zero]
[GOAL]
case succ.succ
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m✝ n✝ : ℕ
h✝ : ↑m✝ = ↑n✝
m : ℕ
ih : ∀ (n : ℕ), ↑m = ↑n → m = n
n : ℕ
h : ↑(Nat.succ m) = ↑(Nat.succ n)
⊢ Nat.succ m = Nat.succ n
[PROOFSTEP]
simp only [Nat.cast_succ, add_right_cancel_iff] at h
[GOAL]
case succ.succ
R : Type u_1
inst✝ : AddGroupWithOne R
H : ∀ (n : ℕ), ↑n = 0 → n = 0
m✝ n✝ : ℕ
h✝ : ↑m✝ = ↑n✝
m : ℕ
ih : ∀ (n : ℕ), ↑m = ↑n → m = n
n : ℕ
h : ↑m = ↑n
⊢ Nat.succ m = Nat.succ n
[PROOFSTEP]
rwa [ih]
[GOAL]
R : Type u_1
inst✝¹ : AddMonoidWithOne R
inst✝ : CharZero R
n : ℕ
⊢ ↑n = 0 ↔ n = 0
[PROOFSTEP]
rw [← cast_zero, cast_inj]
[GOAL]
R : Type u_1
inst✝¹ : AddMonoidWithOne R
inst✝ : CharZero R
n : ℕ
⊢ ↑n + 1 ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
R : Type u_1
inst✝¹ : AddMonoidWithOne R
inst✝ : CharZero R
n : ℕ
⊢ ¬n + 1 = 0
[PROOFSTEP]
exact n.succ_ne_zero
[GOAL]
R : Type u_1
inst✝¹ : AddMonoidWithOne R
inst✝ : CharZero R
n : ℕ
⊢ ↑n = 1 ↔ n = 1
[PROOFSTEP]
rw [← cast_one, cast_inj]
[GOAL]
R : Type u_1
inst✝¹ : AddMonoidWithOne R
inst✝ : CharZero R
n : ℕ
h : Nat.AtLeastTwo n
⊢ ofNat n ≠ 1
[PROOFSTEP]
rw [← Nat.cast_eq_ofNat, ← @Nat.cast_one R, Ne.def, Nat.cast_inj]
[GOAL]
R : Type u_1
inst✝¹ : AddMonoidWithOne R
inst✝ : CharZero R
n : ℕ
h : Nat.AtLeastTwo n
⊢ ¬n = 1
[PROOFSTEP]
exact ne_of_gt h.prop


[GOAL]
m n r : ℤ
⊢ r ∈ range m n ↔ m ≤ r ∧ r < n
[PROOFSTEP]
simp only [range, List.mem_map, List.mem_range, lt_toNat, lt_sub_iff_add_lt, add_comm]
[GOAL]
m n r : ℤ
⊢ (∃ a, m + ↑a < n ∧ m + ↑a = r) ↔ m ≤ r ∧ r < n
[PROOFSTEP]
exact
  ⟨fun ⟨a, ha⟩ => ha.2 ▸ ⟨le_add_of_nonneg_right (Int.coe_nat_nonneg _), ha.1⟩, fun h =>
    ⟨toNat (r - m), by simp [toNat_of_nonneg (sub_nonneg.2 h.1), h.2]⟩⟩
[GOAL]
m n r : ℤ
h : m ≤ r ∧ r < n
⊢ m + ↑(toNat (r - m)) < n ∧ m + ↑(toNat (r - m)) = r
[PROOFSTEP]
simp [toNat_of_nonneg (sub_nonneg.2 h.1), h.2]
[GOAL]
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
⊢ (∀ (r : ℤ), r ∈ range m n → P r) ↔ ∀ (r : ℤ), m ≤ r → r < n → P r
[PROOFSTEP]
simp only [mem_range_iff, and_imp]
[GOAL]
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
⊢ Decidable (∀ (r : ℤ), m ≤ r → r ≤ n → P r)
[PROOFSTEP]
apply decidable_of_iff (∀ r ∈ range m (n + 1), P r)
[GOAL]
case h
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
⊢ (∀ (r : ℤ), r ∈ range m (n + 1) → P r) ↔ ∀ (r : ℤ), m ≤ r → r ≤ n → P r
[PROOFSTEP]
apply Iff.intro
[GOAL]
case h.mp
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
⊢ (∀ (r : ℤ), r ∈ range m (n + 1) → P r) → ∀ (r : ℤ), m ≤ r → r ≤ n → P r
[PROOFSTEP]
intros h _ _
[GOAL]
case h.mpr
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
⊢ (∀ (r : ℤ), m ≤ r → r ≤ n → P r) → ∀ (r : ℤ), r ∈ range m (n + 1) → P r
[PROOFSTEP]
intros h _ _
[GOAL]
case h.mp
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
h : ∀ (r : ℤ), r ∈ range m (n + 1) → P r
r✝ : ℤ
a✝ : m ≤ r✝
⊢ r✝ ≤ n → P r✝
[PROOFSTEP]
intro _
[GOAL]
case h.mp
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
h : ∀ (r : ℤ), r ∈ range m (n + 1) → P r
r✝ : ℤ
a✝¹ : m ≤ r✝
a✝ : r✝ ≤ n
⊢ P r✝
[PROOFSTEP]
apply h
[GOAL]
case h.mp.a
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
h : ∀ (r : ℤ), r ∈ range m (n + 1) → P r
r✝ : ℤ
a✝¹ : m ≤ r✝
a✝ : r✝ ≤ n
⊢ r✝ ∈ range m (n + 1)
[PROOFSTEP]
simp_all only [mem_range_iff, and_imp, lt_add_one_iff]
[GOAL]
case h.mpr
P : ℤ → Prop
inst✝ : DecidablePred P
m n : ℤ
h : ∀ (r : ℤ), m ≤ r → r ≤ n → P r
r✝ : ℤ
a✝ : r✝ ∈ range m (n + 1)
⊢ P r✝
[PROOFSTEP]
simp_all only [mem_range_iff, and_imp, lt_add_one_iff]


[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s✝ t✝ s t x : Multiset α
⊢ x ∈ (fun s t => Finset.map (Equiv.toEmbedding equivDFinsupp.symm) (Finset.Icc (↑toDFinsupp s) (↑toDFinsupp t))) s t ↔
    s ≤ x ∧ x ≤ t
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Multiset α
⊢ Finset.map (Equiv.toEmbedding equivDFinsupp.symm) (Finset.Icc (↑toDFinsupp (s ⊓ t)) (↑toDFinsupp (s ⊔ t))) =
    Finset.map (Equiv.toEmbedding equivDFinsupp.symm) (uIcc (↑toDFinsupp s) (↑toDFinsupp t))
[PROOFSTEP]
simp [uIcc]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Multiset α
⊢ Finset.card (Finset.Icc s t) = ∏ i in toFinset s ∪ toFinset t, (count i t + 1 - count i s)
[PROOFSTEP]
simp_rw [Icc_eq, Finset.card_map, DFinsupp.card_Icc, Nat.card_Icc, Multiset.toDFinsupp_apply, toDFinsupp_support]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Multiset α
⊢ Finset.card (Finset.Ico s t) = ∏ i in toFinset s ∪ toFinset t, (count i t + 1 - count i s) - 1
[PROOFSTEP]
rw [card_Ico_eq_card_Icc_sub_one, card_Icc]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Multiset α
⊢ Finset.card (Finset.Ioc s t) = ∏ i in toFinset s ∪ toFinset t, (count i t + 1 - count i s) - 1
[PROOFSTEP]
rw [card_Ioc_eq_card_Icc_sub_one, card_Icc]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Multiset α
⊢ Finset.card (Finset.Ioo s t) = ∏ i in toFinset s ∪ toFinset t, (count i t + 1 - count i s) - 2
[PROOFSTEP]
rw [card_Ioo_eq_card_Icc_sub_two, card_Icc]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Multiset α
⊢ Finset.card (uIcc s t) = ∏ i in toFinset s ∪ toFinset t, (Int.natAbs (↑(count i t) - ↑(count i s)) + 1)
[PROOFSTEP]
simp_rw [uIcc_eq, Finset.card_map, DFinsupp.card_uIcc, Nat.card_uIcc, Multiset.toDFinsupp_apply, toDFinsupp_support]
[GOAL]
α : Type u_1
inst✝ : DecidableEq α
s t : Multiset α
⊢ Finset.card (Finset.Iic s) = ∏ i in toFinset s, (count i s + 1)
[PROOFSTEP]
simp_rw [Iic_eq_Icc, card_Icc, bot_eq_zero, toFinset_zero, empty_union, count_zero, tsub_zero]


[GOAL]
R : Type u
M : Type v
N : Type w
inst✝³ : SMul R M
inst✝² : SMul M N
inst✝¹ : SMul R N
inst✝ : IsScalarTower R M N
x : R
y : M
z : ULift N
⊢ { down := (x • y) • z.down } = { down := x • y • z.down }
[PROOFSTEP]
rw [smul_assoc]
[GOAL]
R : Type u
M : Type v
N : Type w
inst✝¹ : Zero M
inst✝ : SMulZeroClass R M
c : R
⊢ c • 0 = 0
[PROOFSTEP]
{ext; simp [smul_zero]
}
[GOAL]
R : Type u
M : Type v
N : Type w
inst✝¹ : Zero M
inst✝ : SMulZeroClass R M
c : R
⊢ c • 0 = 0
[PROOFSTEP]
ext
[GOAL]
case h
R : Type u
M : Type v
N : Type w
inst✝¹ : Zero M
inst✝ : SMulZeroClass R M
c : R
⊢ (c • 0).down = 0.down
[PROOFSTEP]
simp [smul_zero]
[GOAL]
R : Type u
M : Type v
N : Type w
inst✝¹ : AddZeroClass M
inst✝ : DistribSMul R M
c : R
f g : ULift M
⊢ c • (f + g) = c • f + c • g
[PROOFSTEP]
ext
[GOAL]
case h
R : Type u
M : Type v
N : Type w
inst✝¹ : AddZeroClass M
inst✝ : DistribSMul R M
c : R
f g : ULift M
⊢ (c • (f + g)).down = (c • f + c • g).down
[PROOFSTEP]
simp [smul_add]
[GOAL]
R : Type u
M : Type v
N : Type w
inst✝² : Monoid R
inst✝¹ : Monoid M
inst✝ : MulDistribMulAction R M
src✝ : MulAction R (ULift M) := mulAction'
x✝² : R
x✝¹ x✝ : ULift M
⊢ x✝² • (x✝¹ * x✝) = x✝² • x✝¹ * x✝² • x✝
[PROOFSTEP]
ext
[GOAL]
case h
R : Type u
M : Type v
N : Type w
inst✝² : Monoid R
inst✝¹ : Monoid M
inst✝ : MulDistribMulAction R M
src✝ : MulAction R (ULift M) := mulAction'
x✝² : R
x✝¹ x✝ : ULift M
⊢ (x✝² • (x✝¹ * x✝)).down = (x✝² • x✝¹ * x✝² • x✝).down
[PROOFSTEP]
simp [smul_mul']
[GOAL]
R : Type u
M : Type v
N : Type w
inst✝² : Monoid R
inst✝¹ : Monoid M
inst✝ : MulDistribMulAction R M
src✝ : MulAction R (ULift M) := mulAction'
x✝ : R
⊢ x✝ • 1 = 1
[PROOFSTEP]
ext
[GOAL]
case h
R : Type u
M : Type v
N : Type w
inst✝² : Monoid R
inst✝¹ : Monoid M
inst✝ : MulDistribMulAction R M
src✝ : MulAction R (ULift M) := mulAction'
x✝ : R
⊢ (x✝ • 1).down = 1.down
[PROOFSTEP]
simp [smul_one]


[GOAL]
K : Type u_1
ι : Type u_2
R : ι → Type u_3
inst✝ : (i : ι) → SMul K (R i)
r : K
s : Set ι
t : (i : ι) → Set (R i)
⊢ r • pi s t ⊆ pi s (r • t)
[PROOFSTEP]
rintro x ⟨y, h, rfl⟩ i hi
[GOAL]
case intro.intro
K : Type u_1
ι : Type u_2
R : ι → Type u_3
inst✝ : (i : ι) → SMul K (R i)
r : K
s : Set ι
t : (i : ι) → Set (R i)
y : (i : ι) → R i
h : y ∈ pi s t
i : ι
hi : i ∈ s
⊢ (fun x => r • x) y i ∈ (r • t) i
[PROOFSTEP]
exact smul_mem_smul_set (h i hi)
[GOAL]
K : Type u_1
ι : Type u_2
R : ι → Type u_3
inst✝ : (i : ι) → SMul K (R i)
r : K
t : (i : ι) → Set (R i)
x : (i : ι) → R i
h : x ∈ pi univ (r • t)
⊢ x ∈ r • pi univ t
[PROOFSTEP]
refine' ⟨fun i ↦ Classical.choose (h i <| Set.mem_univ _), fun i _ ↦ _, funext fun i ↦ _⟩
[GOAL]
case refine'_1
K : Type u_1
ι : Type u_2
R : ι → Type u_3
inst✝ : (i : ι) → SMul K (R i)
r : K
t : (i : ι) → Set (R i)
x : (i : ι) → R i
h : x ∈ pi univ (r • t)
i : ι
x✝ : i ∈ univ
⊢ (fun i => Classical.choose (_ : x i ∈ (r • t) i)) i ∈ t i
[PROOFSTEP]
exact (Classical.choose_spec (h i <| Set.mem_univ i)).left
[GOAL]
case refine'_2
K : Type u_1
ι : Type u_2
R : ι → Type u_3
inst✝ : (i : ι) → SMul K (R i)
r : K
t : (i : ι) → Set (R i)
x : (i : ι) → R i
h : x ∈ pi univ (r • t)
i : ι
⊢ (fun x => r • x) (fun i => Classical.choose (_ : x i ∈ (r • t) i)) i = x i
[PROOFSTEP]
exact (Classical.choose_spec (h i <| Set.mem_univ i)).right