Theorem: Complex.tan_arctan
File: Mathlib/Analysis/SpecialFunctions/Complex/Arctan.lean

tactic: unfold tan sin cos
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
⊢ tan z.arctan = z
state_after: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
⊢ (cexp (-z.arctan * I) - cexp (z.arctan * I)) * I / 2 / ((cexp (z.arctan * I) + cexp (-z.arctan * I)) / 2) = z

tactic: rw [div_div_eq_mul_div, div_mul_cancel₀ _ two_ne_zero, ← div_mul_eq_mul_div,
  ← mul_div_mul_right _ _ (exp_ne_zero (arctan z * I)), sub_mul, add_mul,
  ← exp_add, neg_mul, add_left_neg, exp_zero, ← exp_add, ← two_mul]
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
⊢ (cexp (-z.arctan * I) - cexp (z.arctan * I)) * I / 2 / ((cexp (z.arctan * I) + cexp (-z.arctan * I)) / 2) = z
state_after: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
⊢ (1 - cexp (2 * (z.arctan * I))) / (cexp (2 * (z.arctan * I)) + 1) * I = z

tactic: have z₁ : 1 + z * I ≠ 0 := by
  contrapose! h₁
  rw [add_eq_zero_iff_neg_eq, ← div_eq_iff I_ne_zero, div_I, neg_one_mul, neg_neg] at h₁
  exact h₁.symm
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
⊢ (1 - cexp (2 * (z.arctan * I))) / (cexp (2 * (z.arctan * I)) + 1) * I = z
state_after: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
⊢ (1 - cexp (2 * (z.arctan * I))) / (cexp (2 * (z.arctan * I)) + 1) * I = z

tactic: have z₂ : 1 - z * I ≠ 0 := by
  contrapose! h₂
  rw [sub_eq_zero, ← div_eq_iff I_ne_zero, div_I, one_mul] at h₂
  exact h₂.symm
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
⊢ (1 - cexp (2 * (z.arctan * I))) / (cexp (2 * (z.arctan * I)) + 1) * I = z
state_after: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
z₂ : 1 - z * I ≠ 0
⊢ (1 - cexp (2 * (z.arctan * I))) / (cexp (2 * (z.arctan * I)) + 1) * I = z

tactic: rw [key, ← mul_div_mul_right _ _ z₂, sub_mul, add_mul, div_mul_cancel₀ _ z₂, one_mul,
  show _ / _ * I = -(I * I) * z by ring, I_mul_I, neg_neg, one_mul]
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
z₂ : 1 - z * I ≠ 0
key : cexp (2 * (z.arctan * I)) = (1 + z * I) / (1 - z * I)
⊢ (1 - cexp (2 * (z.arctan * I))) / (cexp (2 * (z.arctan * I)) + 1) * I = z
state_after: no goals

tactic: contrapose! h₁
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
⊢ 1 + z * I ≠ 0
state_after: z : ℂ
h₂ : z ≠ -I
h₁ : 1 + z * I = 0
⊢ z = I

tactic: rw [add_eq_zero_iff_neg_eq, ← div_eq_iff I_ne_zero, div_I, neg_one_mul, neg_neg] at h₁
state_before: z : ℂ
h₂ : z ≠ -I
h₁ : 1 + z * I = 0
⊢ z = I
state_after: z : ℂ
h₂ : z ≠ -I
h₁ : I = z
⊢ z = I

tactic: exact h₁.symm
state_before: z : ℂ
h₂ : z ≠ -I
h₁ : I = z
⊢ z = I
state_after: no goals

tactic: contrapose! h₂
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
⊢ 1 - z * I ≠ 0
state_after: z : ℂ
h₁ : z ≠ I
z₁ : 1 + z * I ≠ 0
h₂ : 1 - z * I = 0
⊢ z = -I

tactic: rw [sub_eq_zero, ← div_eq_iff I_ne_zero, div_I, one_mul] at h₂
state_before: z : ℂ
h₁ : z ≠ I
z₁ : 1 + z * I ≠ 0
h₂ : 1 - z * I = 0
⊢ z = -I
state_after: z : ℂ
h₁ : z ≠ I
z₁ : 1 + z * I ≠ 0
h₂ : -I = z
⊢ z = -I

tactic: exact h₂.symm
state_before: z : ℂ
h₁ : z ≠ I
z₁ : 1 + z * I ≠ 0
h₂ : -I = z
⊢ z = -I
state_after: no goals

tactic: rw [arctan, ← mul_rotate, ← mul_assoc,
  show 2 * (I * (-I / 2)) = 1 by field_simp, one_mul, exp_log]
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
z₂ : 1 - z * I ≠ 0
⊢ cexp (2 * (z.arctan * I)) = (1 + z * I) / (1 - z * I)
state_after: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
z₂ : 1 - z * I ≠ 0
⊢ (1 + z * I) / (1 - z * I) ≠ 0

tactic: field_simp
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
z₂ : 1 - z * I ≠ 0
⊢ 2 * (I * (-I / 2)) = 1
state_after: no goals

tactic: exact div_ne_zero z₁ z₂
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
z₂ : 1 - z * I ≠ 0
⊢ (1 + z * I) / (1 - z * I) ≠ 0
state_after: no goals

tactic: ring
state_before: z : ℂ
h₁ : z ≠ I
h₂ : z ≠ -I
z₁ : 1 + z * I ≠ 0
z₂ : 1 - z * I ≠ 0
key : cexp (2 * (z.arctan * I)) = (1 + z * I) / (1 - z * I)
⊢ (1 - z * I - (1 + z * I)) / (1 + z * I + (1 - z * I)) * I = -(I * I) * z
state_after: no goals