Theorem: Complex.continuousAt_arg_coe_angle
File: Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean

tactic: by_cases hs : 0 < x.re ∨ x.im ≠ 0
state_before: x z : ℂ
h : x ≠ 0
⊢ ContinuousAt (Angle.coe ∘ arg) x

tactic: exact Real.Angle.continuous_coe.continuousAt.comp (continuousAt_arg hs)
state_before: case pos
x z : ℂ
h : x ≠ 0
hs : 0 < x.re ∨ x.im ≠ 0
⊢ ContinuousAt (Angle.coe ∘ arg) x

tactic: rw [← Function.comp.right_id (((↑) : ℝ → Real.Angle) ∘ arg),
  (Function.funext_iff.2 fun _ => (neg_neg _).symm : (id : ℂ → ℂ) = Neg.neg ∘ Neg.neg), ←
  Function.comp.assoc]
state_before: case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt (Angle.coe ∘ arg) x

tactic: refine' ContinuousAt.comp _ continuous_neg.continuousAt
state_before: case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt (((Angle.coe ∘ arg) ∘ Neg.neg) ∘ Neg.neg) x

tactic: suffices ContinuousAt (Function.update (((↑) ∘ arg) ∘ Neg.neg : ℂ → Real.Angle) 0 π) (-x) by
  rwa [continuousAt_update_of_ne (neg_ne_zero.2 h)] at this
state_before: case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt ((Angle.coe ∘ arg) ∘ Neg.neg) (-x)

tactic: 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⟩
state_before: case neg
x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ContinuousAt (Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π) (-x)

tactic: rw [ha]
state_before: 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)

tactic: push_neg  at hs
state_before: 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)

tactic: refine'
  (Real.Angle.continuous_coe.continuousAt.comp (continuousAt_arg (Or.inl _))).add
    continuousAt_const
state_before: 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)

tactic: rw [neg_re, neg_pos]
state_before: 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

tactic: exact hs.1.lt_of_ne fun h0 => h (ext_iff.2 ⟨h0, hs.2⟩)
state_before: 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

tactic: rwa [continuousAt_update_of_ne (neg_ne_zero.2 h)] at this
state_before: 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)

tactic: rw [Function.update_eq_iff]
state_before: x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ Function.update ((Angle.coe ∘ arg) ∘ Neg.neg) 0 ↑π = fun z => ↑(arg z) + ↑π

tactic: exact ⟨by simp, fun z hz => arg_neg_coe_angle hz⟩
state_before: 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) + ↑π

tactic: simp
state_before: x z : ℂ
h : x ≠ 0
hs : ¬(0 < x.re ∨ x.im ≠ 0)
⊢ ↑π = ↑(arg 0) + ↑π