l3lab/ntp-mathlib huggingface dataset:
lemma erase_inf_Ici (ha : a ∈ s) (has : ∀ b ∈ s, b ≤ a → b = a) : s.erase a ⊓ Ici a = s := by
  rw [← upperClosure_singleton, ← sdiff_singleton, sdiff_inf_upperClosure] <;> 

Proof state:
case hts
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, b ≤ a → b = a
⊢ {a} ⊆ ↑s

Next tactic:
simpa
lemma erase_inf_Ici (ha : a ∈ s) (has : ∀ b ∈ s, b ≤ a → b = a) : s.erase a ⊓ Ici a = s := by
  rw [← upperClosure_singleton, ← sdiff_singleton, sdiff_inf_upperClosure] <;> 

Proof state:
case hst
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, b ≤ a → b = a
⊢ ∀ b ∈ s, ∀ c ∈ {a}, b ≤ c → b ∈ {a}

Next tactic:
simpa
lemma Ici_inf_erase (ha : a ∈ s) (has : ∀ b ∈ s, b ≤ a → b = a) : Ici a ⊓ s.erase a = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝ : Preorder α
s : UpperSet α
t : Set α
a : α
ha : a ∈ s
has : ∀ b ∈ s, b ≤ a → b = a
⊢ Ici a ⊓ erase s a = s

Next tactic:
rw [inf_comm, erase_inf_Ici ha has]
theorem prod_le_prod_iff : s₁ ×ˢ t₁ ≤ s₂ ×ˢ t₂ ↔ s₁ ≤ s₂ ∧ t₁ ≤ t₂ ∨ s₂ = ⊤ ∨ t₂ = ⊤ :=
  prod_subset_prod_iff.trans <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : UpperSet α
t t₁ t₂ : UpperSet β
x : α × β
⊢ ↑s₂ ⊆ ↑s₁ ∧ ↑t₂ ⊆ ↑t₁ ∨ ↑s₂ = ∅ ∨ ↑t₂ = ∅ ↔ s₁ ≤ s₂ ∧ t₁ ≤ t₂ ∨ s₂ = ⊤ ∨ t₂ = ⊤

Next tactic:
simp
@[simp]
theorem prod_eq_top : s ×ˢ t = ⊤ ↔ s = ⊤ ∨ t = ⊤ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : UpperSet α
t t₁ t₂ : UpperSet β
x : α × β
⊢ s ×ˢ t = ⊤ ↔ s = ⊤ ∨ t = ⊤

Next tactic:
simp_rw [SetLike.ext'_iff]
@[simp]
theorem prod_eq_top : s ×ˢ t = ⊤ ↔ s = ⊤ ∨ t = ⊤ := by
  simp_rw [SetLike.ext'_iff]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : UpperSet α
t t₁ t₂ : UpperSet β
x : α × β
⊢ ↑(s ×ˢ t) = ↑⊤ ↔ ↑s = ↑⊤ ∨ ↑t = ↑⊤

Next tactic:
exact prod_eq_empty_iff
@[simp]
theorem codisjoint_prod :
    Codisjoint (s₁ ×ˢ t₁) (s₂ ×ˢ t₂) ↔ Codisjoint s₁ s₂ ∨ Codisjoint t₁ t₂ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : UpperSet α
t t₁ t₂ : UpperSet β
x : α × β
⊢ Codisjoint (s₁ ×ˢ t₁) (s₂ ×ˢ t₂) ↔ Codisjoint s₁ s₂ ∨ Codisjoint t₁ t₂

Next tactic:
simp_rw [codisjoint_iff, prod_sup_prod, prod_eq_top]
theorem prod_le_prod_iff : s₁ ×ˢ t₁ ≤ s₂ ×ˢ t₂ ↔ s₁ ≤ s₂ ∧ t₁ ≤ t₂ ∨ s₁ = ⊥ ∨ t₁ = ⊥ :=
  prod_subset_prod_iff.trans <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : LowerSet α
t t₁ t₂ : LowerSet β
x : α × β
⊢ ↑s₁ ⊆ ↑s₂ ∧ ↑t₁ ⊆ ↑t₂ ∨ ↑s₁ = ∅ ∨ ↑t₁ = ∅ ↔ s₁ ≤ s₂ ∧ t₁ ≤ t₂ ∨ s₁ = ⊥ ∨ t₁ = ⊥

Next tactic:
simp
@[simp]
theorem prod_eq_bot : s ×ˢ t = ⊥ ↔ s = ⊥ ∨ t = ⊥ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : LowerSet α
t t₁ t₂ : LowerSet β
x : α × β
⊢ s ×ˢ t = ⊥ ↔ s = ⊥ ∨ t = ⊥

Next tactic:
simp_rw [SetLike.ext'_iff]
@[simp]
theorem prod_eq_bot : s ×ˢ t = ⊥ ↔ s = ⊥ ∨ t = ⊥ := by
  simp_rw [SetLike.ext'_iff]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : LowerSet α
t t₁ t₂ : LowerSet β
x : α × β
⊢ ↑(s ×ˢ t) = ↑⊥ ↔ ↑s = ↑⊥ ∨ ↑t = ↑⊥

Next tactic:
exact prod_eq_empty_iff
@[simp]
theorem disjoint_prod : Disjoint (s₁ ×ˢ t₁) (s₂ ×ˢ t₂) ↔ Disjoint s₁ s₂ ∨ Disjoint t₁ t₂ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s s₁ s₂ : LowerSet α
t t₁ t₂ : LowerSet β
x : α × β
⊢ Disjoint (s₁ ×ˢ t₁) (s₂ ×ˢ t₂) ↔ Disjoint s₁ s₂ ∨ Disjoint t₁ t₂

Next tactic:
simp_rw [disjoint_iff, prod_inf_prod, prod_eq_bot]
@[simp]
theorem upperClosure_prod (s : Set α) (t : Set β) :
    upperClosure (s ×ˢ t) = upperClosure s ×ˢ upperClosure t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s : Set α
t : Set β
⊢ upperClosure (s ×ˢ t) = upperClosure s ×ˢ upperClosure t

Next tactic:
ext
@[simp]
theorem upperClosure_prod (s : Set α) (t : Set β) :
    upperClosure (s ×ˢ t) = upperClosure s ×ˢ upperClosure t := by
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s : Set α
t : Set β
x✝ : α × β
⊢ x✝ ∈ ↑(upperClosure (s ×ˢ t)) ↔ x✝ ∈ ↑(upperClosure s ×ˢ upperClosure t)

Next tactic:
simp [Prod.le_def, @and_and_and_comm _ (_ ∈ t)]
@[simp]
theorem lowerClosure_prod (s : Set α) (t : Set β) :
    lowerClosure (s ×ˢ t) = lowerClosure s ×ˢ lowerClosure t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s : Set α
t : Set β
⊢ lowerClosure (s ×ˢ t) = lowerClosure s ×ˢ lowerClosure t

Next tactic:
ext
@[simp]
theorem lowerClosure_prod (s : Set α) (t : Set β) :
    lowerClosure (s ×ˢ t) = lowerClosure s ×ˢ lowerClosure t := by
  ext
  

Proof state:
case a.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Sort u_4
κ : ι → Sort u_5
inst✝¹ : Preorder α
inst✝ : Preorder β
s : Set α
t : Set β
x✝ : α × β
⊢ x✝ ∈ ↑(lowerClosure (s ×ˢ t)) ↔ x✝ ∈ ↑(lowerClosure s ×ˢ lowerClosure t)

Next tactic:
simp [Prod.le_def, @and_and_and_comm _ (_ ∈ t)]
theorem log_re (x : ℂ) : x.log.re = x.abs.log := by 

Proof state:
x : ℂ
⊢ (log x).re = Real.log (abs x)

Next tactic:
simp [log]
theorem log_im (x : ℂ) : x.log.im = x.arg := by 

Proof state:
x : ℂ
⊢ (log x).im = arg x

Next tactic:
simp [log]
theorem neg_pi_lt_log_im (x : ℂ) : -π < (log x).im := by 

Proof state:
x : ℂ
⊢ -π < (log x).im

Next tactic:
simp only [log_im, neg_pi_lt_arg]
theorem log_im_le_pi (x : ℂ) : (log x).im ≤ π := by 

Proof state:
x : ℂ
⊢ (log x).im ≤ π

Next tactic:
simp only [log_im, arg_le_pi]
theorem exp_log {x : ℂ} (hx : x ≠ 0) : exp (log x) = x := by
  

Proof state:
x : ℂ
hx : x ≠ 0
⊢ cexp (log x) = x

Next tactic:
rw [log, exp_add_mul_I, ← ofReal_sin, sin_arg, ← ofReal_cos, cos_arg hx, ← ofReal_exp,
    Real.exp_log (abs.pos hx), mul_add, ofReal_div, ofReal_div,
    mul_div_cancel' _ (ofReal_ne_zero.2 <| abs.ne_zero hx), ← mul_assoc,
    mul_div_cancel' _ (ofReal_ne_zero.2 <| abs.ne_zero hx), re_add_im]
@[simp]
theorem range_exp : Set.range exp = {0}ᶜ :=
  Set.ext fun x =>
    ⟨by
      

Proof state:
x : ℂ
⊢ x ∈ Set.range cexp → x ∈ {0}ᶜ

Next tactic:
rintro ⟨x, rfl⟩
@[simp]
theorem range_exp : Set.range exp = {0}ᶜ :=
  Set.ext fun x =>
    ⟨by
      rintro ⟨x, rfl⟩
      

Proof state:
case intro
x : ℂ
⊢ cexp x ∈ {0}ᶜ

Next tactic:
exact exp_ne_zero x
theorem log_exp {x : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) : log (exp x) = x := by
  

Proof state:
x : ℂ
hx₁ : -π < x.im
hx₂ : x.im ≤ π
⊢ log (cexp x) = x

Next tactic:
rw [log, abs_exp, Real.log_exp, exp_eq_exp_re_mul_sin_add_cos, ← ofReal_exp,
    arg_mul_cos_add_sin_mul_I (Real.exp_pos _) ⟨hx₁, hx₂⟩, re_add_im]
theorem exp_inj_of_neg_pi_lt_of_le_pi {x y : ℂ} (hx₁ : -π < x.im) (hx₂ : x.im ≤ π) (hy₁ : -π < y.im)
    (hy₂ : y.im ≤ π) (hxy : exp x = exp y) : x = y := by
  

Proof state:
x y : ℂ
hx₁ : -π < x.im
hx₂ : x.im ≤ π
hy₁ : -π < y.im
hy₂ : y.im ≤ π
hxy : cexp x = cexp y
⊢ x = y

Next tactic:
rw [← log_exp hx₁ hx₂, ← log_exp hy₁ hy₂, hxy]
theorem ofReal_log {x : ℝ} (hx : 0 ≤ x) : (x.log : ℂ) = log x :=
  Complex.ext (by 

Proof state:
x : ℝ
hx : 0 ≤ x
⊢ (↑(Real.log x)).re = (log ↑x).re

Next tactic:
rw [log_re, ofReal_re, abs_of_nonneg hx]
theorem ofReal_log {x : ℝ} (hx : 0 ≤ x) : (x.log : ℂ) = log x :=
  Complex.ext (by rw [log_re, ofReal_re, abs_of_nonneg hx])
    (by 

Proof state:
x : ℝ
hx : 0 ≤ x
⊢ (↑(Real.log x)).im = (log ↑x).im

Next tactic:
rw [ofReal_im, log_im, arg_ofReal_of_nonneg hx]
theorem log_ofReal_re (x : ℝ) : (log (x : ℂ)).re = Real.log x := by 

Proof state:
x : ℝ
⊢ (log ↑x).re = Real.log x

Next tactic:
simp [log_re]
theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : ℂ} (hx : x ≠ 0) :
    log (r * x) = Real.log r + log x := by
  

Proof state:
r : ℝ
hr : 0 < r
x : ℂ
hx : x ≠ 0
⊢ log (↑r * x) = ↑(Real.log r) + log x

Next tactic:
replace hx := Complex.abs.ne_zero_iff.mpr hx
theorem log_ofReal_mul {r : ℝ} (hr : 0 < r) {x : ℂ} (hx : x ≠ 0) :
    log (r * x) = Real.log r + log x := by
  replace hx := Complex.abs.ne_zero_iff.mpr hx
  

Proof state:
r : ℝ
hr : 0 < r
x : ℂ
hx : abs x ≠ 0
⊢ log (↑r * x) = ↑(Real.log r) + log x

Next tactic:
simp_rw [log, map_mul, abs_ofReal, arg_real_mul _ hr, abs_of_pos hr, Real.log_mul hr.ne' hx,
    ofReal_add, add_assoc]
theorem log_mul_ofReal (r : ℝ) (hr : 0 < r) (x : ℂ) (hx : x ≠ 0) :
    log (x * r) = Real.log r + log x := by 

Proof state:
r : ℝ
hr : 0 < r
x : ℂ
hx : x ≠ 0
⊢ log (x * ↑r) = ↑(Real.log r) + log x

Next tactic:
rw [mul_comm, log_ofReal_mul hr hx, add_comm]
lemma log_mul_eq_add_log_iff {x y : ℂ} (hx₀ : x ≠ 0) (hy₀ : y ≠ 0) :
    log (x * y) = log x + log y ↔ arg x + arg y ∈ Set.Ioc (-π) π := by
  

Proof state:
x y : ℂ
hx₀ : x ≠ 0
hy₀ : y ≠ 0
⊢ log (x * y) = log x + log y ↔ arg x + arg y ∈ Set.Ioc (-π) π

Next tactic:
refine ext_iff.trans <| Iff.trans ?_ <| arg_mul_eq_add_arg_iff hx₀ hy₀
lemma log_mul_eq_add_log_iff {x y : ℂ} (hx₀ : x ≠ 0) (hy₀ : y ≠ 0) :
    log (x * y) = log x + log y ↔ arg x + arg y ∈ Set.Ioc (-π) π := by
  refine ext_iff.trans <| Iff.trans ?_ <| arg_mul_eq_add_arg_iff hx₀ hy₀
  

Proof state:
x y : ℂ
hx₀ : x ≠ 0
hy₀ : y ≠ 0
⊢ (log (x * y)).re = (log x + log y).re ∧ (log (x * y)).im = (log x + log y).im ↔ arg (x * y) = arg x + arg y

Next tactic:
simp_rw [add_re, add_im, log_re, log_im, AbsoluteValue.map_mul,
    Real.log_mul (abs.ne_zero hx₀) (abs.ne_zero hy₀), true_and]
@[simp]
theorem log_zero : log 0 = 0 := by 

Proof state:
⊢ log 0 = 0

Next tactic:
simp [log]
@[simp]
theorem log_one : log 1 = 0 := by 

Proof state:
⊢ log 1 = 0

Next tactic:
simp [log]
theorem log_neg_one : log (-1) = π * I := by 

Proof state:
⊢ log (-1) = ↑π * I

Next tactic:
simp [log]
theorem log_I : log I = π / 2 * I := by 

Proof state:
⊢ log I = ↑π / 2 * I

Next tactic:
simp [log]
theorem log_neg_I : log (-I) = -(π / 2) * I := by 

Proof state:
⊢ log (-I) = -(↑π / 2) * I

Next tactic:
simp [log]
theorem log_conj_eq_ite (x : ℂ) : log (conj x) = if x.arg = π then log x else conj (log x) := by
  

Proof state:
x : ℂ
⊢ log ((starRingEnd ℂ) x) = if arg x = π then log x else (starRingEnd ℂ) (log x)

Next tactic:
simp_rw [log, abs_conj, arg_conj, map_add, map_mul, conj_ofReal]
theorem log_conj_eq_ite (x : ℂ) : log (conj x) = if x.arg = π then log x else conj (log x) := by
  simp_rw [log, abs_conj, arg_conj, map_add, map_mul, conj_ofReal]
  

Proof state:
x : ℂ
⊢ ↑(Real.log (abs x)) + ↑(if arg x = π then π else -arg x) * I =
    if arg x = π then ↑(Real.log (abs x)) + ↑(arg x) * I else ↑(Real.log (abs x)) + ↑(arg x) * (starRingEnd ℂ) I

Next tactic:
split_ifs with hx
theorem log_conj_eq_ite (x : ℂ) : log (conj x) = if x.arg = π then log x else conj (log x) := by
  simp_rw [log, abs_conj, arg_conj, map_add, map_mul, conj_ofReal]
  split_ifs with hx
  · 

Proof state:
case pos
x : ℂ
hx : arg x = π
⊢ ↑(Real.log (abs x)) + ↑π * I = ↑(Real.log (abs x)) + ↑(arg x) * I

Next tactic:
rw [hx]
theorem log_conj_eq_ite (x : ℂ) : log (conj x) = if x.arg = π then log x else conj (log x) := by
  simp_rw [log, abs_conj, arg_conj, map_add, map_mul, conj_ofReal]
  split_ifs with hx
  · rw [hx]
  

Proof state:
case neg
x : ℂ
hx : ¬arg x = π
⊢ ↑(Real.log (abs x)) + ↑(-arg x) * I = ↑(Real.log (abs x)) + ↑(arg x) * (starRingEnd ℂ) I

Next tactic:
simp_rw [ofReal_neg, conj_I, mul_neg, neg_mul]
theorem log_conj (x : ℂ) (h : x.arg ≠ π) : log (conj x) = conj (log x) := by
  

Proof state:
x : ℂ
h : arg x ≠ π
⊢ log ((starRingEnd ℂ) x) = (starRingEnd ℂ) (log x)

Next tactic:
rw [log_conj_eq_ite, if_neg h]
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  

Proof state:
x : ℂ
⊢ log x⁻¹ = if arg x = π then -(starRingEnd ℂ) (log x) else -log x

Next tactic:
by_cases hx : x = 0
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · 

Proof state:
case pos
x : ℂ
hx : x = 0
⊢ log x⁻¹ = if arg x = π then -(starRingEnd ℂ) (log x) else -log x

Next tactic:
simp [hx]
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  

Proof state:
case neg
x : ℂ
hx : ¬x = 0
⊢ log x⁻¹ = if arg x = π then -(starRingEnd ℂ) (log x) else -log x

Next tactic:
rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · 

Proof state:
case neg
x : ℂ
hx : ¬x = 0
⊢ (if arg x = π then log x else (starRingEnd ℂ) (log x)) - ↑(Real.log (normSq x)) =
    if arg x = π then -(starRingEnd ℂ) (log x) else -log x

Next tactic:
simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
    

Proof state:
case neg
x : ℂ
hx : ¬x = 0
⊢ (if arg x = π then ↑(Real.log (abs x)) + ↑(arg x) * I else ↑(Real.log (abs x)) + -(↑(arg x) * I)) -
      ↑2 * ↑(Real.log (abs x)) =
    if arg x = π then -↑(Real.log (abs x)) + ↑(arg x) * I else -↑(Real.log (abs x)) + -(↑(arg x) * I)

Next tactic:
norm_num
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
    norm_num; 

Proof state:
case neg
x : ℂ
hx : ¬x = 0
⊢ (if arg x = π then ↑(Real.log (abs x)) + ↑(arg x) * I else ↑(Real.log (abs x)) + -(↑(arg x) * I)) -
      2 * ↑(Real.log (abs x)) =
    if arg x = π then -↑(Real.log (abs x)) + ↑(arg x) * I else -↑(Real.log (abs x)) + -(↑(arg x) * I)

Next tactic:
rw [two_mul]
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
    norm_num; rw [two_mul] -- Porting note: added to simplify `↑2`
    

Proof state:
case neg
x : ℂ
hx : ¬x = 0
⊢ (if arg x = π then ↑(Real.log (abs x)) + ↑(arg x) * I else ↑(Real.log (abs x)) + -(↑(arg x) * I)) -
      (↑(Real.log (abs x)) + ↑(Real.log (abs x))) =
    if arg x = π then -↑(Real.log (abs x)) + ↑(arg x) * I else -↑(Real.log (abs x)) + -(↑(arg x) * I)

Next tactic:
split_ifs
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
    norm_num; rw [two_mul] -- Porting note: added to simplify `↑2`
    split_ifs
    · 

Proof state:
case pos
x : ℂ
hx : ¬x = 0
h✝ : arg x = π
⊢ ↑(Real.log (abs x)) + ↑(arg x) * I - (↑(Real.log (abs x)) + ↑(Real.log (abs x))) = -↑(Real.log (abs x)) + ↑(arg x) * I

Next tactic:
rw [add_sub_right_comm, sub_add_cancel']
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
    norm_num; rw [two_mul] -- Porting note: added to simplify `↑2`
    split_ifs
    · rw [add_sub_right_comm, sub_add_cancel']
    · 

Proof state:
case neg
x : ℂ
hx : ¬x = 0
h✝ : ¬arg x = π
⊢ ↑(Real.log (abs x)) + -(↑(arg x) * I) - (↑(Real.log (abs x)) + ↑(Real.log (abs x))) =
    -↑(Real.log (abs x)) + -(↑(arg x) * I)

Next tactic:
rw [add_sub_right_comm, sub_add_cancel']
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
    norm_num; rw [two_mul] -- Porting note: added to simplify `↑2`
    split_ifs
    · rw [add_sub_right_comm, sub_add_cancel']
    · rw [add_sub_right_comm, sub_add_cancel']
  · 

Proof state:
case neg.hr
x : ℂ
hx : ¬x = 0
⊢ 0 < (normSq x)⁻¹

Next tactic:
rwa [inv_pos, Complex.normSq_pos]
theorem log_inv_eq_ite (x : ℂ) : log x⁻¹ = if x.arg = π then -conj (log x) else -log x := by
  by_cases hx : x = 0
  · simp [hx]
  rw [inv_def, log_mul_ofReal, Real.log_inv, ofReal_neg, ← sub_eq_neg_add, log_conj_eq_ite]
  · simp_rw [log, map_add, map_mul, conj_ofReal, conj_I, normSq_eq_abs, Real.log_pow,
      Nat.cast_two, ofReal_mul, neg_add, mul_neg, neg_neg]
    norm_num; rw [two_mul] -- Porting note: added to simplify `↑2`
    split_ifs
    · rw [add_sub_right_comm, sub_add_cancel']
    · rw [add_sub_right_comm, sub_add_cancel']
  · rwa [inv_pos, Complex.normSq_pos]
  · 

Proof state:
case neg.hx
x : ℂ
hx : ¬x = 0
⊢ (starRingEnd ℂ) x ≠ 0

Next tactic:
rwa [map_ne_zero]
theorem log_inv (x : ℂ) (hx : x.arg ≠ π) : log x⁻¹ = -log x := by 

Proof state:
x : ℂ
hx : arg x ≠ π
⊢ log x⁻¹ = -log x

Next tactic:
rw [log_inv_eq_ite, if_neg hx]
theorem two_pi_I_ne_zero : (2 * π * I : ℂ) ≠ 0 := by 

Proof state:
⊢ 2 * ↑π * I ≠ 0

Next tactic:
norm_num [Real.pi_ne_zero, I_ne_zero]
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  

Proof state:
x : ℂ
⊢ cexp x = 1 ↔ ∃ n, x = ↑n * (2 * ↑π * I)

Next tactic:
constructor
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · 

Proof state:
case mp
x : ℂ
⊢ cexp x = 1 → ∃ n, x = ↑n * (2 * ↑π * I)

Next tactic:
intro h
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    

Proof state:
case mp
x : ℂ
h : cexp x = 1
⊢ ∃ n, x = ↑n * (2 * ↑π * I)

Next tactic:
rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
    

Proof state:
case mp.intro.intro
x : ℂ
h : cexp x = 1
n : ℤ
hn : x.im + n • (2 * π) ∈ Set.Ioc (-π) (-π + 2 * π)
⊢ ∃ n, x = ↑n * (2 * ↑π * I)

Next tactic:
use -n
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
    use -n
    

Proof state:
case h
x : ℂ
h : cexp x = 1
n : ℤ
hn : x.im + n • (2 * π) ∈ Set.Ioc (-π) (-π + 2 * π)
⊢ x = ↑(-n) * (2 * ↑π * I)

Next tactic:
rw [Int.cast_neg, neg_mul, eq_neg_iff_add_eq_zero]
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
    use -n
    rw [Int.cast_neg, neg_mul, eq_neg_iff_add_eq_zero]
    

Proof state:
case h
x : ℂ
h : cexp x = 1
n : ℤ
hn : x.im + n • (2 * π) ∈ Set.Ioc (-π) (-π + 2 * π)
⊢ x + ↑n * (2 * ↑π * I) = 0

Next tactic:
have : (x + n * (2 * π * I)).im ∈ Set.Ioc (-π) π := by simpa [two_mul, mul_add] using hn
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
    use -n
    rw [Int.cast_neg, neg_mul, eq_neg_iff_add_eq_zero]
    have : (x + n * (2 * π * I)).im ∈ Set.Ioc (-π) π := by 

Proof state:
x : ℂ
h : cexp x = 1
n : ℤ
hn : x.im + n • (2 * π) ∈ Set.Ioc (-π) (-π + 2 * π)
⊢ (x + ↑n * (2 * ↑π * I)).im ∈ Set.Ioc (-π) π

Next tactic:
simpa [two_mul, mul_add] using hn
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
    use -n
    rw [Int.cast_neg, neg_mul, eq_neg_iff_add_eq_zero]
    have : (x + n * (2 * π * I)).im ∈ Set.Ioc (-π) π := by simpa [two_mul, mul_add] using hn
    

Proof state:
case h
x : ℂ
h : cexp x = 1
n : ℤ
hn : x.im + n • (2 * π) ∈ Set.Ioc (-π) (-π + 2 * π)
this : (x + ↑n * (2 * ↑π * I)).im ∈ Set.Ioc (-π) π
⊢ x + ↑n * (2 * ↑π * I) = 0

Next tactic:
rw [← log_exp this.1 this.2, exp_periodic.int_mul n, h, log_one]
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
    use -n
    rw [Int.cast_neg, neg_mul, eq_neg_iff_add_eq_zero]
    have : (x + n * (2 * π * I)).im ∈ Set.Ioc (-π) π := by simpa [two_mul, mul_add] using hn
    rw [← log_exp this.1 this.2, exp_periodic.int_mul n, h, log_one]
  · 

Proof state:
case mpr
x : ℂ
⊢ (∃ n, x = ↑n * (2 * ↑π * I)) → cexp x = 1

Next tactic:
rintro ⟨n, rfl⟩
theorem exp_eq_one_iff {x : ℂ} : exp x = 1 ↔ ∃ n : ℤ, x = n * (2 * π * I) := by
  constructor
  · intro h
    rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos x.im (-π) with ⟨n, hn, -⟩
    use -n
    rw [Int.cast_neg, neg_mul, eq_neg_iff_add_eq_zero]
    have : (x + n * (2 * π * I)).im ∈ Set.Ioc (-π) π := by simpa [two_mul, mul_add] using hn
    rw [← log_exp this.1 this.2, exp_periodic.int_mul n, h, log_one]
  · rintro ⟨n, rfl⟩
    

Proof state:
case mpr.intro
n : ℤ
⊢ cexp (↑n * (2 * ↑π * I)) = 1

Next tactic:
exact (exp_periodic.int_mul n).eq.trans exp_zero
theorem exp_eq_exp_iff_exp_sub_eq_one {x y : ℂ} : exp x = exp y ↔ exp (x - y) = 1 := by
  

Proof state:
x y : ℂ
⊢ cexp x = cexp y ↔ cexp (x - y) = 1

Next tactic:
rw [exp_sub, div_eq_one_iff_eq (exp_ne_zero _)]
theorem exp_eq_exp_iff_exists_int {x y : ℂ} : exp x = exp y ↔ ∃ n : ℤ, x = y + n * (2 * π * I) := by
  

Proof state:
x y : ℂ
⊢ cexp x = cexp y ↔ ∃ n, x = y + ↑n * (2 * ↑π * I)

Next tactic:
simp only [exp_eq_exp_iff_exp_sub_eq_one, exp_eq_one_iff, sub_eq_iff_eq_add']
@[simp]
theorem countable_preimage_exp {s : Set ℂ} : (exp ⁻¹' s).Countable ↔ s.Countable := by
  

Proof state:
s : Set ℂ
⊢ Set.Countable (cexp ⁻¹' s) ↔ Set.Countable s

Next tactic:
refine' ⟨fun hs => _, fun hs => _⟩
@[simp]
theorem countable_preimage_exp {s : Set ℂ} : (exp ⁻¹' s).Countable ↔ s.Countable := by
  refine' ⟨fun hs => _, fun hs => _⟩
  · 

Proof state:
case refine'_1
s : Set ℂ
hs : Set.Countable (cexp ⁻¹' s)
⊢ Set.Countable s

Next tactic:
refine' ((hs.image exp).insert 0).mono _
@[simp]
theorem countable_preimage_exp {s : Set ℂ} : (exp ⁻¹' s).Countable ↔ s.Countable := by
  refine' ⟨fun hs => _, fun hs => _⟩
  · refine' ((hs.image exp).insert 0).mono _
    

Proof state:
case refine'_1
s : Set ℂ
hs : Set.Countable (cexp ⁻¹' s)
⊢ s ⊆ insert 0 (cexp '' (cexp ⁻¹' s))

Next tactic:
rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]