l3lab/ntp-mathlib huggingface dataset:
theorem map_prod_map_mk_nhds (x : X) (y : Y) :
    map (Prod.map mk mk) (𝓝 (x, y)) = 𝓝 (mk x, mk y) := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y✝ z : X
s : Set X
f g : X → Y
t : Set (SeparationQuotient X)
x : X
y : Y
⊢ Filter.map (Prod.map mk mk) (𝓝 (x, y)) = 𝓝 (mk x, mk y)

Next tactic:
rw [nhds_prod_eq, ← prod_map_map_eq', map_mk_nhds, map_mk_nhds, nhds_prod_eq]
theorem map_mk_nhdsWithin_preimage (s : Set (SeparationQuotient X)) (x : X) :
    map mk (𝓝[mk ⁻¹' s] x) = 𝓝[s] mk x := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y z : X
s✝ : Set X
f g : X → Y
t s : Set (SeparationQuotient X)
x : X
⊢ Filter.map mk (𝓝[mk ⁻¹' s] x) = 𝓝[s] mk x

Next tactic:
rw [nhdsWithin, ← comap_principal, Filter.push_pull, nhdsWithin, map_mk_nhds]
@[simp]
theorem tendsto_lift_nhds_mk {f : X → α} {hf : ∀ x y, (x ~ᵢ y) → f x = f y} {x : X} {l : Filter α} :
    Tendsto (lift f hf) (𝓝 <| mk x) l ↔ Tendsto f (𝓝 x) l := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y z : X
s : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → α
hf : ∀ (x y : X), (x ~ᵢ y) → f x = f y
x : X
l : Filter α
⊢ Tendsto (lift f hf) (𝓝 (mk x)) l ↔ Tendsto f (𝓝 x) l

Next tactic:
simp only [← map_mk_nhds, tendsto_map'_iff, lift_comp_mk]
@[simp]
theorem tendsto_lift_nhdsWithin_mk {f : X → α} {hf : ∀ x y, (x ~ᵢ y) → f x = f y} {x : X}
    {s : Set (SeparationQuotient X)} {l : Filter α} :
    Tendsto (lift f hf) (𝓝[s] mk x) l ↔ Tendsto f (𝓝[mk ⁻¹' s] x) l := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y z : X
s✝ : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → α
hf : ∀ (x y : X), (x ~ᵢ y) → f x = f y
x : X
s : Set (SeparationQuotient X)
l : Filter α
⊢ Tendsto (lift f hf) (𝓝[s] mk x) l ↔ Tendsto f (𝓝[mk ⁻¹' s] x) l

Next tactic:
simp only [← map_mk_nhdsWithin_preimage, tendsto_map'_iff, lift_comp_mk]
@[simp]
theorem continuousOn_lift {f : X → Y} {hf : ∀ x y, (x ~ᵢ y) → f x = f y}
    {s : Set (SeparationQuotient X)} : ContinuousOn (lift f hf) s ↔ ContinuousOn f (mk ⁻¹' s) := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x y z : X
s✝ : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y
hf : ∀ (x y : X), (x ~ᵢ y) → f x = f y
s : Set (SeparationQuotient X)
⊢ ContinuousOn (lift f hf) s ↔ ContinuousOn f (mk ⁻¹' s)

Next tactic:
simp only [ContinuousOn, surjective_mk.forall, continuousWithinAt_lift, mem_preimage]
@[simp]
theorem continuous_lift {f : X → Y} {hf : ∀ x y, (x ~ᵢ y) → f x = f y} :
    Continuous (lift f hf) ↔ Continuous f := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x y z : X
s : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y
hf : ∀ (x y : X), (x ~ᵢ y) → f x = f y
⊢ Continuous (lift f hf) ↔ Continuous f

Next tactic:
simp only [continuous_iff_continuousOn_univ, continuousOn_lift, preimage_univ]
@[simp]
theorem tendsto_lift₂_nhds {f : X → Y → α} {hf : ∀ a b c d, (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d}
    {x : X} {y : Y} {l : Filter α} :
    Tendsto (uncurry <| lift₂ f hf) (𝓝 (mk x, mk y)) l ↔ Tendsto (uncurry f) (𝓝 (x, y)) l := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y✝ z : X
s : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y → α
hf : ∀ (a : X) (b : Y) (c : X) (d : Y), (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d
x : X
y : Y
l : Filter α
⊢ Tendsto (uncurry (lift₂ f hf)) (𝓝 (mk x, mk y)) l ↔ Tendsto (uncurry f) (𝓝 (x, y)) l

Next tactic:
rw [← map_prod_map_mk_nhds, tendsto_map'_iff]
@[simp]
theorem tendsto_lift₂_nhds {f : X → Y → α} {hf : ∀ a b c d, (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d}
    {x : X} {y : Y} {l : Filter α} :
    Tendsto (uncurry <| lift₂ f hf) (𝓝 (mk x, mk y)) l ↔ Tendsto (uncurry f) (𝓝 (x, y)) l := by
  rw [← map_prod_map_mk_nhds, tendsto_map'_iff]
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y✝ z : X
s : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y → α
hf : ∀ (a : X) (b : Y) (c : X) (d : Y), (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d
x : X
y : Y
l : Filter α
⊢ Tendsto (uncurry (lift₂ f hf) ∘ Prod.map mk mk) (𝓝 (x, y)) l ↔ Tendsto (uncurry f) (𝓝 (x, y)) l

Next tactic:
rfl
@[simp] theorem tendsto_lift₂_nhdsWithin {f : X → Y → α}
    {hf : ∀ a b c d, (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d} {x : X} {y : Y}
    {s : Set (SeparationQuotient X × SeparationQuotient Y)} {l : Filter α} :
    Tendsto (uncurry <| lift₂ f hf) (𝓝[s] (mk x, mk y)) l ↔
      Tendsto (uncurry f) (𝓝[Prod.map mk mk ⁻¹' s] (x, y)) l := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y✝ z : X
s✝ : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y → α
hf : ∀ (a : X) (b : Y) (c : X) (d : Y), (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d
x : X
y : Y
s : Set (SeparationQuotient X × SeparationQuotient Y)
l : Filter α
⊢ Tendsto (uncurry (lift₂ f hf)) (𝓝[s] (mk x, mk y)) l ↔ Tendsto (uncurry f) (𝓝[Prod.map mk mk ⁻¹' s] (x, y)) l

Next tactic:
rw [nhdsWithin, ← map_prod_map_mk_nhds, ← Filter.push_pull, comap_principal]
@[simp] theorem tendsto_lift₂_nhdsWithin {f : X → Y → α}
    {hf : ∀ a b c d, (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d} {x : X} {y : Y}
    {s : Set (SeparationQuotient X × SeparationQuotient Y)} {l : Filter α} :
    Tendsto (uncurry <| lift₂ f hf) (𝓝[s] (mk x, mk y)) l ↔
      Tendsto (uncurry f) (𝓝[Prod.map mk mk ⁻¹' s] (x, y)) l := by
  rw [nhdsWithin, ← map_prod_map_mk_nhds, ← Filter.push_pull, comap_principal]
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x✝ y✝ z : X
s✝ : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y → α
hf : ∀ (a : X) (b : Y) (c : X) (d : Y), (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d
x : X
y : Y
s : Set (SeparationQuotient X × SeparationQuotient Y)
l : Filter α
⊢ Tendsto (uncurry (lift₂ f hf)) (Filter.map (Prod.map mk mk) (𝓝 (x, y) ⊓ 𝓟 (Prod.map mk mk ⁻¹' s))) l ↔
    Tendsto (uncurry f) (𝓝[Prod.map mk mk ⁻¹' s] (x, y)) l

Next tactic:
rfl
@[simp]
theorem continuousOn_lift₂ {f : X → Y → Z} {hf : ∀ a b c d, (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d}
    {s : Set (SeparationQuotient X × SeparationQuotient Y)} :
    ContinuousOn (uncurry <| lift₂ f hf) s ↔ ContinuousOn (uncurry f) (Prod.map mk mk ⁻¹' s) := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x y z : X
s✝ : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y → Z
hf : ∀ (a : X) (b : Y) (c : X) (d : Y), (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d
s : Set (SeparationQuotient X × SeparationQuotient Y)
⊢ ContinuousOn (uncurry (lift₂ f hf)) s ↔ ContinuousOn (uncurry f) (Prod.map mk mk ⁻¹' s)

Next tactic:
simp_rw [ContinuousOn, (surjective_mk.Prod_map surjective_mk).forall, Prod.forall, Prod.map,
    continuousWithinAt_lift₂]
@[simp]
theorem continuousOn_lift₂ {f : X → Y → Z} {hf : ∀ a b c d, (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d}
    {s : Set (SeparationQuotient X × SeparationQuotient Y)} :
    ContinuousOn (uncurry <| lift₂ f hf) s ↔ ContinuousOn (uncurry f) (Prod.map mk mk ⁻¹' s) := by
  simp_rw [ContinuousOn, (surjective_mk.Prod_map surjective_mk).forall, Prod.forall, Prod.map,
    continuousWithinAt_lift₂]
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x y z : X
s✝ : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y → Z
hf : ∀ (a : X) (b : Y) (c : X) (d : Y), (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d
s : Set (SeparationQuotient X × SeparationQuotient Y)
⊢ (∀ (a : X) (b : Y), (mk a, mk b) ∈ s → ContinuousWithinAt (uncurry f) (Prod.map mk mk ⁻¹' s) (a, b)) ↔
    ∀ (a : X) (b : Y), (a, b) ∈ Prod.map mk mk ⁻¹' s → ContinuousWithinAt (uncurry f) (Prod.map mk mk ⁻¹' s) (a, b)

Next tactic:
rfl
@[simp]
theorem continuous_lift₂ {f : X → Y → Z} {hf : ∀ a b c d, (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d} :
    Continuous (uncurry <| lift₂ f hf) ↔ Continuous (uncurry f) := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x y z : X
s : Set X
f✝ g : X → Y
t : Set (SeparationQuotient X)
f : X → Y → Z
hf : ∀ (a : X) (b : Y) (c : X) (d : Y), (a ~ᵢ c) → (b ~ᵢ d) → f a b = f c d
⊢ Continuous (uncurry (lift₂ f hf)) ↔ Continuous (uncurry f)

Next tactic:
simp only [continuous_iff_continuousOn_univ, continuousOn_lift₂, preimage_univ]
theorem continuous_congr_of_inseparable (h : ∀ x, f x ~ᵢ g x) :
    Continuous f ↔ Continuous g := by
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x y z : X
s : Set X
f g : X → Y
t : Set (SeparationQuotient X)
h : ∀ (x : X), f x ~ᵢ g x
⊢ Continuous f ↔ Continuous g

Next tactic:
simp_rw [SeparationQuotient.inducing_mk.continuous_iff (β := Y)]
theorem continuous_congr_of_inseparable (h : ∀ x, f x ~ᵢ g x) :
    Continuous f ↔ Continuous g := by
  simp_rw [SeparationQuotient.inducing_mk.continuous_iff (β := Y)]
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
α : Type u_4
ι : Type u_5
π : ι → Type u_6
inst✝³ : TopologicalSpace X
inst✝² : TopologicalSpace Y
inst✝¹ : TopologicalSpace Z
inst✝ : (i : ι) → TopologicalSpace (π i)
x y z : X
s : Set X
f g : X → Y
t : Set (SeparationQuotient X)
h : ∀ (x : X), f x ~ᵢ g x
⊢ Continuous (SeparationQuotient.mk ∘ f) ↔ Continuous (SeparationQuotient.mk ∘ g)

Next tactic:
exact continuous_congr fun x ↦ SeparationQuotient.mk_eq_mk.mpr (h x)
theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by
  

Proof state:
x : ℂ
⊢ Real.sin (arg x) = x.im / abs x

Next tactic:
unfold arg
theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by
  unfold arg; 

Proof state:
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

Next tactic:
split_ifs
theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by
  unfold arg; split_ifs <;>
    

Proof state:
case pos
x : ℂ
h✝ : 0 ≤ x.re
⊢ Real.sin (arcsin (x.im / abs x)) = x.im / abs x

Next tactic:
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]
theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by
  unfold arg; split_ifs <;>
    

Proof state:
case pos
x : ℂ
h✝¹ : ¬0 ≤ x.re
h✝ : 0 ≤ x.im
⊢ Real.sin (arcsin ((-x).im / abs x) + π) = x.im / abs x

Next tactic:
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]
theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by
  unfold arg; split_ifs <;>
    

Proof state:
case neg
x : ℂ
h✝¹ : ¬0 ≤ x.re
h✝ : ¬0 ≤ x.im
⊢ Real.sin (arcsin ((-x).im / abs x) - π) = x.im / abs x

Next tactic:
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]
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  

Proof state:
x : ℂ
hx : x ≠ 0
⊢ Real.cos (arg x) = x.re / abs x

Next tactic:
rw [arg]
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  rw [arg]
  

Proof state:
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

Next tactic:
split_ifs with h₁ h₂
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  rw [arg]
  split_ifs with h₁ h₂
  · 

Proof state:
case pos
x : ℂ
hx : x ≠ 0
h₁ : 0 ≤ x.re
⊢ Real.cos (arcsin (x.im / abs x)) = x.re / abs x

Next tactic:
rw [Real.cos_arcsin]
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  rw [arg]
  split_ifs with h₁ h₂
  · rw [Real.cos_arcsin]
    

Proof state:
case pos
x : ℂ
hx : x ≠ 0
h₁ : 0 ≤ x.re
⊢ sqrt (1 - (x.im / abs x) ^ 2) = x.re / abs x

Next tactic:
field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  rw [arg]
  split_ifs with h₁ h₂
  · rw [Real.cos_arcsin]
    field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
  · 

Proof state:
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

Next tactic:
rw [Real.cos_add_pi, Real.cos_arcsin]
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  rw [arg]
  split_ifs with h₁ h₂
  · rw [Real.cos_arcsin]
    field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
  · rw [Real.cos_add_pi, Real.cos_arcsin]
    

Proof state:
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

Next tactic:
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
      _root_.abs_of_neg (not_le.1 h₁), *]
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  rw [arg]
  split_ifs with h₁ h₂
  · rw [Real.cos_arcsin]
    field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
  · rw [Real.cos_add_pi, Real.cos_arcsin]
    field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
      _root_.abs_of_neg (not_le.1 h₁), *]
  · 

Proof state:
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

Next tactic:
rw [Real.cos_sub_pi, Real.cos_arcsin]
theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by
  rw [arg]
  split_ifs with h₁ h₂
  · rw [Real.cos_arcsin]
    field_simp [Real.sqrt_sq, (abs.pos hx).le, *]
  · rw [Real.cos_add_pi, Real.cos_arcsin]
    field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
      _root_.abs_of_neg (not_le.1 h₁), *]
  · rw [Real.cos_sub_pi, Real.cos_arcsin]
    

Proof state:
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

Next tactic:
field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs,
      _root_.abs_of_neg (not_le.1 h₁), *]
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
  

Proof state:
x : ℂ
⊢ ↑(abs x) * cexp (↑(arg x) * I) = x

Next tactic:
rcases eq_or_ne x 0 with (rfl | hx)
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · 

Proof state:
case inl
⊢ ↑(abs 0) * cexp (↑(arg 0) * I) = 0

Next tactic:
simp
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · simp
  · 

Proof state:
case inr
x : ℂ
hx : x ≠ 0
⊢ ↑(abs x) * cexp (↑(arg x) * I) = x

Next tactic:
have : abs x ≠ 0 := abs.ne_zero hx
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · simp
  · have : abs x ≠ 0 := abs.ne_zero hx
    

Proof state:
case inr
x : ℂ
hx : x ≠ 0
this : abs x ≠ 0
⊢ ↑(abs x) * cexp (↑(arg x) * I) = x

Next tactic:
apply Complex.ext
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · simp
  · have : abs x ≠ 0 := abs.ne_zero hx
    apply Complex.ext <;> 

Proof state:
case inr.a
x : ℂ
hx : x ≠ 0
this : abs x ≠ 0
⊢ (↑(abs x) * cexp (↑(arg x) * I)).re = x.re

Next tactic:
field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
@[simp]
theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · simp
  · have : abs x ≠ 0 := abs.ne_zero hx
    apply Complex.ext <;> 

Proof state:
case inr.a
x : ℂ
hx : x ≠ 0
this : abs x ≠ 0
⊢ (↑(abs x) * cexp (↑(arg x) * I)).im = x.im

Next tactic:
field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)]
@[simp]
theorem abs_mul_cos_add_sin_mul_I (x : ℂ) : (abs x * (cos (arg x) + sin (arg x) * I) : ℂ) = x := by
  

Proof state:
x : ℂ
⊢ ↑(abs x) * (cos ↑(arg x) + sin ↑(arg x) * I) = x

Next tactic:
rw [← exp_mul_I, abs_mul_exp_arg_mul_I]
@[simp]
lemma abs_mul_cos_arg (x : ℂ) : abs x * Real.cos (arg x) = x.re := by
  

Proof state:
x : ℂ
⊢ abs x * Real.cos (arg x) = x.re

Next tactic:
simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg re (abs_mul_cos_add_sin_mul_I x)
@[simp]
lemma abs_mul_sin_arg (x : ℂ) : abs x * Real.sin (arg x) = x.im := by
  

Proof state:
x : ℂ
⊢ abs x * Real.sin (arg x) = x.im

Next tactic:
simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg im (abs_mul_cos_add_sin_mul_I x)
theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by
  

Proof state:
z : ℂ
⊢ abs z = 1 ↔ ∃ θ, cexp (↑θ * I) = z

Next tactic:
refine' ⟨fun hz => ⟨arg z, _⟩, _⟩
theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by
  refine' ⟨fun hz => ⟨arg z, _⟩, _⟩
  · 

Proof state:
case refine'_1
z : ℂ
hz : abs z = 1
⊢ cexp (↑(arg z) * I) = z

Next tactic:
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
theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by
  refine' ⟨fun hz => ⟨arg z, _⟩, _⟩
  · calc
      exp (arg z * I) = abs z * exp (arg z * I) := by 

Proof state:
z : ℂ
hz : abs z = 1
⊢ cexp (↑(arg z) * I) = ↑(abs z) * cexp (↑(arg z) * I)

Next tactic:
rw [hz, ofReal_one, one_mul]
theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by
  refine' ⟨fun hz => ⟨arg z, _⟩, _⟩
  · 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

  · 

Proof state:
case refine'_2
z : ℂ
⊢ (∃ θ, cexp (↑θ * I) = z) → abs z = 1

Next tactic:
rintro ⟨θ, rfl⟩
theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by
  refine' ⟨fun hz => ⟨arg z, _⟩, _⟩
  · 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

  · rintro ⟨θ, rfl⟩
    

Proof state:
case refine'_2.intro
θ : ℝ
⊢ abs (cexp (↑θ * I)) = 1

Next tactic:
exact Complex.abs_exp_ofReal_mul_I θ
@[simp]
theorem range_exp_mul_I : (Set.range fun x : ℝ => exp (x * I)) = Metric.sphere 0 1 := by
  

Proof state:
⊢ (Set.range fun x => cexp (↑x * I)) = Metric.sphere 0 1

Next tactic:
ext x
@[simp]
theorem range_exp_mul_I : (Set.range fun x : ℝ => exp (x * I)) = Metric.sphere 0 1 := by
  ext x
  

Proof state:
case h
x : ℂ
⊢ (x ∈ Set.range fun x => cexp (↑x * I)) ↔ x ∈ Metric.sphere 0 1

Next tactic:
simp only [mem_sphere_zero_iff_norm, norm_eq_abs, abs_eq_one_iff, Set.mem_range]
theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) :
    arg (r * (cos θ + sin θ * I)) = θ := by
  

Proof state:
r : ℝ
hr : 0 < r
θ : ℝ
hθ : θ ∈ Set.Ioc (-π) π
⊢ arg (↑r * (cos ↑θ + sin ↑θ * I)) = θ

Next tactic:
simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) :
    arg (r * (cos θ + sin θ * I)) = θ := by
  simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
  

Proof state:
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) - π) =
    θ

Next tactic:
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]
theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) :
    arg (r * (cos θ + sin θ * I)) = θ := by
  simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
  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]
  

Proof state:
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 θ) - π) =
    θ

Next tactic:
by_cases h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2)
theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) :
    arg (r * (cos θ + sin θ * I)) = θ := by
  simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
  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]
  by_cases h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2)
  · 

Proof state:
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 θ) - π) =
    θ

Next tactic:
rw [if_pos]
theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) :
    arg (r * (cos θ + sin θ * I)) = θ := by
  simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one]
  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]
  by_cases h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2)
  · rw [if_pos]
    

Proof state:
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 θ

Next tactic:
exacts [Real.arcsin_sin' h₁, Real.cos_nonneg_of_mem_Icc h₁]