l3lab/ntp-mathlib huggingface dataset:
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    

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

Next tactic:
exact Set.subset_union_left _ _
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    exact Set.subset_union_left _ _
  · 

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

Next tactic:
rw [← Set.biUnion_preimage_singleton]
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    exact Set.subset_union_left _ _
  · rw [← Set.biUnion_preimage_singleton]
    

Proof state:
case refine'_2
s : Set ℂ
hs : Set.Countable s
⊢ Set.Countable (⋃ y ∈ s, cexp ⁻¹' {y})

Next tactic:
refine' hs.biUnion fun z hz => _
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    exact Set.subset_union_left _ _
  · rw [← Set.biUnion_preimage_singleton]
    refine' hs.biUnion fun z hz => _
    

Proof state:
case refine'_2
s : Set ℂ
hs : Set.Countable s
z : ℂ
hz : z ∈ s
⊢ Set.Countable (cexp ⁻¹' {z})

Next tactic:
rcases em (∃ w, exp w = z) with (⟨w, rfl⟩ | hne)
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    exact Set.subset_union_left _ _
  · rw [← Set.biUnion_preimage_singleton]
    refine' hs.biUnion fun z hz => _
    rcases em (∃ w, exp w = z) with (⟨w, rfl⟩ | hne)
    · 

Proof state:
case refine'_2.inl.intro
s : Set ℂ
hs : Set.Countable s
w : ℂ
hz : cexp w ∈ s
⊢ Set.Countable (cexp ⁻¹' {cexp w})

Next tactic:
simp only [Set.preimage, Set.mem_singleton_iff, exp_eq_exp_iff_exists_int, Set.setOf_exists]
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    exact Set.subset_union_left _ _
  · rw [← Set.biUnion_preimage_singleton]
    refine' hs.biUnion fun z hz => _
    rcases em (∃ w, exp w = z) with (⟨w, rfl⟩ | hne)
    · simp only [Set.preimage, Set.mem_singleton_iff, exp_eq_exp_iff_exists_int, Set.setOf_exists]
      

Proof state:
case refine'_2.inl.intro
s : Set ℂ
hs : Set.Countable s
w : ℂ
hz : cexp w ∈ s
⊢ Set.Countable (⋃ i, {x | x = w + ↑i * (2 * ↑π * I)})

Next tactic:
exact Set.countable_iUnion fun m => Set.countable_singleton _
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    exact Set.subset_union_left _ _
  · rw [← Set.biUnion_preimage_singleton]
    refine' hs.biUnion fun z hz => _
    rcases em (∃ w, exp w = z) with (⟨w, rfl⟩ | hne)
    · simp only [Set.preimage, Set.mem_singleton_iff, exp_eq_exp_iff_exists_int, Set.setOf_exists]
      exact Set.countable_iUnion fun m => Set.countable_singleton _
    · 

Proof state:
case refine'_2.inr
s : Set ℂ
hs : Set.Countable s
z : ℂ
hz : z ∈ s
hne : ¬∃ w, cexp w = z
⊢ Set.Countable (cexp ⁻¹' {z})

Next tactic:
push_neg at hne
@[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 _
    rw [Set.image_preimage_eq_inter_range, range_exp, ← Set.diff_eq, ← Set.union_singleton,
        Set.diff_union_self]
    exact Set.subset_union_left _ _
  · rw [← Set.biUnion_preimage_singleton]
    refine' hs.biUnion fun z hz => _
    rcases em (∃ w, exp w = z) with (⟨w, rfl⟩ | hne)
    · simp only [Set.preimage, Set.mem_singleton_iff, exp_eq_exp_iff_exists_int, Set.setOf_exists]
      exact Set.countable_iUnion fun m => Set.countable_singleton _
    · push_neg at hne
      

Proof state:
case refine'_2.inr
s : Set ℂ
hs : Set.Countable s
z : ℂ
hz : z ∈ s
hne : ∀ (w : ℂ), cexp w ≠ z
⊢ Set.Countable (cexp ⁻¹' {z})

Next tactic:
simp [Set.preimage, hne]
theorem tendsto_log_nhdsWithin_im_neg_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0)
    (him : z.im = 0) : Tendsto log (𝓝[{ z : ℂ | z.im < 0 }] z) (𝓝 <| Real.log (abs z) - π * I) := by
  

Proof state:
z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ Tendsto log (𝓝[{z | z.im < 0}] z) (𝓝 (↑(Real.log (abs z)) - ↑π * I))

Next tactic:
convert
    (continuous_ofReal.continuousAt.comp_continuousWithinAt
            (continuous_abs.continuousWithinAt.log _)).tendsto.add
      (((continuous_ofReal.tendsto _).comp <|
            tendsto_arg_nhdsWithin_im_neg_of_re_neg_of_im_zero hre him).mul
        tendsto_const_nhds) using 1
theorem tendsto_log_nhdsWithin_im_neg_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0)
    (him : z.im = 0) : Tendsto log (𝓝[{ z : ℂ | z.im < 0 }] z) (𝓝 <| Real.log (abs z) - π * I) := by
  convert
    (continuous_ofReal.continuousAt.comp_continuousWithinAt
            (continuous_abs.continuousWithinAt.log _)).tendsto.add
      (((continuous_ofReal.tendsto _).comp <|
            tendsto_arg_nhdsWithin_im_neg_of_re_neg_of_im_zero hre him).mul
        tendsto_const_nhds) using 1
  · 

Proof state:
case h.e'_5
z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ 𝓝 (↑(Real.log (abs z)) - ↑π * I) = 𝓝 ((ofReal' ∘ fun x => Real.log (abs x)) z + ↑(-π) * I)

Next tactic:
simp [sub_eq_add_neg]
theorem tendsto_log_nhdsWithin_im_neg_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0)
    (him : z.im = 0) : Tendsto log (𝓝[{ z : ℂ | z.im < 0 }] z) (𝓝 <| Real.log (abs z) - π * I) := by
  convert
    (continuous_ofReal.continuousAt.comp_continuousWithinAt
            (continuous_abs.continuousWithinAt.log _)).tendsto.add
      (((continuous_ofReal.tendsto _).comp <|
            tendsto_arg_nhdsWithin_im_neg_of_re_neg_of_im_zero hre him).mul
        tendsto_const_nhds) using 1
  · simp [sub_eq_add_neg]
  · 

Proof state:
case convert_1
z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ abs z ≠ 0

Next tactic:
lift z to ℝ using him
theorem tendsto_log_nhdsWithin_im_neg_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0)
    (him : z.im = 0) : Tendsto log (𝓝[{ z : ℂ | z.im < 0 }] z) (𝓝 <| Real.log (abs z) - π * I) := by
  convert
    (continuous_ofReal.continuousAt.comp_continuousWithinAt
            (continuous_abs.continuousWithinAt.log _)).tendsto.add
      (((continuous_ofReal.tendsto _).comp <|
            tendsto_arg_nhdsWithin_im_neg_of_re_neg_of_im_zero hre him).mul
        tendsto_const_nhds) using 1
  · simp [sub_eq_add_neg]
  · lift z to ℝ using him
    

Proof state:
case convert_1.intro
z : ℝ
hre : (↑z).re < 0
⊢ abs ↑z ≠ 0

Next tactic:
simpa using hre.ne
theorem continuousWithinAt_log_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0) (him : z.im = 0) :
    ContinuousWithinAt log { z : ℂ | 0 ≤ z.im } z := by
  

Proof state:
z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ ContinuousWithinAt log {z | 0 ≤ z.im} z

Next tactic:
convert
    (continuous_ofReal.continuousAt.comp_continuousWithinAt
            (continuous_abs.continuousWithinAt.log _)).tendsto.add
      ((continuous_ofReal.continuousAt.comp_continuousWithinAt <|
            continuousWithinAt_arg_of_re_neg_of_im_zero hre him).mul
        tendsto_const_nhds) using 1
theorem continuousWithinAt_log_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0) (him : z.im = 0) :
    ContinuousWithinAt log { z : ℂ | 0 ≤ z.im } z := by
  convert
    (continuous_ofReal.continuousAt.comp_continuousWithinAt
            (continuous_abs.continuousWithinAt.log _)).tendsto.add
      ((continuous_ofReal.continuousAt.comp_continuousWithinAt <|
            continuousWithinAt_arg_of_re_neg_of_im_zero hre him).mul
        tendsto_const_nhds) using 1
  · 

Proof state:
case convert_1
z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ abs z ≠ 0

Next tactic:
lift z to ℝ using him
theorem continuousWithinAt_log_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0) (him : z.im = 0) :
    ContinuousWithinAt log { z : ℂ | 0 ≤ z.im } z := by
  convert
    (continuous_ofReal.continuousAt.comp_continuousWithinAt
            (continuous_abs.continuousWithinAt.log _)).tendsto.add
      ((continuous_ofReal.continuousAt.comp_continuousWithinAt <|
            continuousWithinAt_arg_of_re_neg_of_im_zero hre him).mul
        tendsto_const_nhds) using 1
  · lift z to ℝ using him
    

Proof state:
case convert_1.intro
z : ℝ
hre : (↑z).re < 0
⊢ abs ↑z ≠ 0

Next tactic:
simpa using hre.ne
theorem tendsto_log_nhdsWithin_im_nonneg_of_re_neg_of_im_zero {z : ℂ} (hre : z.re < 0)
    (him : z.im = 0) : Tendsto log (𝓝[{ z : ℂ | 0 ≤ z.im }] z) (𝓝 <| Real.log (abs z) + π * I) := by
  

Proof state:
z : ℂ
hre : z.re < 0
him : z.im = 0
⊢ Tendsto log (𝓝[{z | 0 ≤ z.im}] z) (𝓝 (↑(Real.log (abs z)) + ↑π * I))

Next tactic:
simpa only [log, arg_eq_pi_iff.2 ⟨hre, him⟩] using
    (continuousWithinAt_log_of_re_neg_of_im_zero hre him).tendsto
@[simp]
theorem map_exp_comap_re_atBot : map exp (comap re atBot) = 𝓝[≠] 0 := by
  

Proof state:
⊢ map cexp (comap re atBot) = 𝓝[≠] 0

Next tactic:
rw [← comap_exp_nhds_zero, map_comap, range_exp, nhdsWithin]
@[simp]
theorem map_exp_comap_re_atTop : map exp (comap re atTop) = cobounded ℂ := by
  

Proof state:
⊢ map cexp (comap re atTop) = cobounded ℂ

Next tactic:
rw [← comap_exp_cobounded, map_comap, range_exp, inf_eq_left, le_principal_iff]
@[simp]
theorem map_exp_comap_re_atTop : map exp (comap re atTop) = cobounded ℂ := by
  rw [← comap_exp_cobounded, map_comap, range_exp, inf_eq_left, le_principal_iff]
  

Proof state:
⊢ {0}ᶜ ∈ cobounded ℂ

Next tactic:
exact eventually_ne_cobounded _
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  

Proof state:
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ ContinuousAt log x

Next tactic:
refine' ContinuousAt.add _ _
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · 

Proof state:
case refine'_1
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ ContinuousAt (fun x => ↑(Real.log (Complex.abs x))) x

Next tactic:
refine' continuous_ofReal.continuousAt.comp _
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · refine' continuous_ofReal.continuousAt.comp _
    

Proof state:
case refine'_1
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ ContinuousAt (fun x => Real.log (Complex.abs x)) x

Next tactic:
refine' (Real.continuousAt_log _).comp Complex.continuous_abs.continuousAt
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · refine' continuous_ofReal.continuousAt.comp _
    refine' (Real.continuousAt_log _).comp Complex.continuous_abs.continuousAt
    

Proof state:
case refine'_1
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ Complex.abs x ≠ 0

Next tactic:
rw [Complex.abs.ne_zero_iff]
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · refine' continuous_ofReal.continuousAt.comp _
    refine' (Real.continuousAt_log _).comp Complex.continuous_abs.continuousAt
    rw [Complex.abs.ne_zero_iff]
    

Proof state:
case refine'_1
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ x ≠ 0

Next tactic:
rintro rfl
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · refine' continuous_ofReal.continuousAt.comp _
    refine' (Real.continuousAt_log _).comp Complex.continuous_abs.continuousAt
    rw [Complex.abs.ne_zero_iff]
    rintro rfl
    

Proof state:
case refine'_1
α : Type u_1
h : 0 < 0.re ∨ 0.im ≠ 0
⊢ False

Next tactic:
simp at h
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · refine' continuous_ofReal.continuousAt.comp _
    refine' (Real.continuousAt_log _).comp Complex.continuous_abs.continuousAt
    rw [Complex.abs.ne_zero_iff]
    rintro rfl
    simp at h
  · 

Proof state:
case refine'_2
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
⊢ ContinuousAt (fun x => ↑(arg x) * I) x

Next tactic:
have h_cont_mul : Continuous fun x : ℂ => x * I := continuous_id'.mul continuous_const
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · refine' continuous_ofReal.continuousAt.comp _
    refine' (Real.continuousAt_log _).comp Complex.continuous_abs.continuousAt
    rw [Complex.abs.ne_zero_iff]
    rintro rfl
    simp at h
  · have h_cont_mul : Continuous fun x : ℂ => x * I := continuous_id'.mul continuous_const
    

Proof state:
case refine'_2
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
h_cont_mul : Continuous fun x => x * I
⊢ ContinuousAt (fun x => ↑(arg x) * I) x

Next tactic:
refine' h_cont_mul.continuousAt.comp (continuous_ofReal.continuousAt.comp _)
theorem continuousAt_clog {x : ℂ} (h : 0 < x.re ∨ x.im ≠ 0) : ContinuousAt log x := by
  refine' ContinuousAt.add _ _
  · refine' continuous_ofReal.continuousAt.comp _
    refine' (Real.continuousAt_log _).comp Complex.continuous_abs.continuousAt
    rw [Complex.abs.ne_zero_iff]
    rintro rfl
    simp at h
  · have h_cont_mul : Continuous fun x : ℂ => x * I := continuous_id'.mul continuous_const
    refine' h_cont_mul.continuousAt.comp (continuous_ofReal.continuousAt.comp _)
    

Proof state:
case refine'_2
α : Type u_1
x : ℂ
h : 0 < x.re ∨ x.im ≠ 0
h_cont_mul : Continuous fun x => x * I
⊢ ContinuousAt (fun x => arg x) x

Next tactic:
exact continuousAt_arg h
instance : DilationEquivClass (X ≃ᵈ Y) X Y where
  coe f := f.1
  inv f := f.1.symm
  left_inv f := f.left_inv'
  right_inv f := f.right_inv'
  coe_injective' := by 

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
⊢ ∀ (e g : X ≃ᵈ Y),
    (fun f => ⇑f.toEquiv) e = (fun f => ⇑f.toEquiv) g → (fun f => ⇑f.symm) e = (fun f => ⇑f.symm) g → e = g

Next tactic:
rintro ⟨⟩ ⟨⟩ h -
instance : DilationEquivClass (X ≃ᵈ Y) X Y where
  coe f := f.1
  inv f := f.1.symm
  left_inv f := f.left_inv'
  right_inv f := f.right_inv'
  coe_injective' := by rintro ⟨⟩ ⟨⟩ h -; 

Proof state:
case mk.mk
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
toEquiv✝¹ : X ≃ Y
edist_eq'✝¹ : ∃ r, r ≠ 0 ∧ ∀ (x y : X), edist (Equiv.toFun toEquiv✝¹ x) (Equiv.toFun toEquiv✝¹ y) = ↑r * edist x y
toEquiv✝ : X ≃ Y
edist_eq'✝ : ∃ r, r ≠ 0 ∧ ∀ (x y : X), edist (Equiv.toFun toEquiv✝ x) (Equiv.toFun toEquiv✝ y) = ↑r * edist x y
h :
  (fun f => ⇑f.toEquiv) { toEquiv := toEquiv✝¹, edist_eq' := edist_eq'✝¹ } =
    (fun f => ⇑f.toEquiv) { toEquiv := toEquiv✝, edist_eq' := edist_eq'✝ }
⊢ { toEquiv := toEquiv✝¹, edist_eq' := edist_eq'✝¹ } = { toEquiv := toEquiv✝, edist_eq' := edist_eq'✝ }

Next tactic:
congr
instance : DilationEquivClass (X ≃ᵈ Y) X Y where
  coe f := f.1
  inv f := f.1.symm
  left_inv f := f.left_inv'
  right_inv f := f.right_inv'
  coe_injective' := by rintro ⟨⟩ ⟨⟩ h -; congr; 

Proof state:
case mk.mk.e_toEquiv
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
toEquiv✝¹ : X ≃ Y
edist_eq'✝¹ : ∃ r, r ≠ 0 ∧ ∀ (x y : X), edist (Equiv.toFun toEquiv✝¹ x) (Equiv.toFun toEquiv✝¹ y) = ↑r * edist x y
toEquiv✝ : X ≃ Y
edist_eq'✝ : ∃ r, r ≠ 0 ∧ ∀ (x y : X), edist (Equiv.toFun toEquiv✝ x) (Equiv.toFun toEquiv✝ y) = ↑r * edist x y
h :
  (fun f => ⇑f.toEquiv) { toEquiv := toEquiv✝¹, edist_eq' := edist_eq'✝¹ } =
    (fun f => ⇑f.toEquiv) { toEquiv := toEquiv✝, edist_eq' := edist_eq'✝ }
⊢ toEquiv✝¹ = toEquiv✝

Next tactic:
exact FunLike.ext' h
/-- Inverse `DilationEquiv`. -/
def symm (e : X ≃ᵈ Y) : Y ≃ᵈ X where
  toEquiv := e.1.symm
  edist_eq' := by
    

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
⊢ ∃ r, r ≠ 0 ∧ ∀ (x y : Y), edist (Equiv.toFun e.symm x) (Equiv.toFun e.symm y) = ↑r * edist x y

Next tactic:
refine ⟨(ratio e)⁻¹, inv_ne_zero <| ratio_ne_zero e, e.surjective.forall₂.2 fun x y ↦ ?_⟩
/-- Inverse `DilationEquiv`. -/
def symm (e : X ≃ᵈ Y) : Y ≃ᵈ X where
  toEquiv := e.1.symm
  edist_eq' := by
    refine ⟨(ratio e)⁻¹, inv_ne_zero <| ratio_ne_zero e, e.surjective.forall₂.2 fun x y ↦ ?_⟩
    

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
x y : X
⊢ edist (Equiv.toFun e.symm (e.toEquiv x)) (Equiv.toFun e.symm (e.toEquiv y)) =
    ↑(ratio e)⁻¹ * edist (e.toEquiv x) (e.toEquiv y)

Next tactic:
simp_rw [Equiv.toFun_as_coe, Equiv.symm_apply_apply, coe_toEquiv, edist_eq]
/-- Inverse `DilationEquiv`. -/
def symm (e : X ≃ᵈ Y) : Y ≃ᵈ X where
  toEquiv := e.1.symm
  edist_eq' := by
    refine ⟨(ratio e)⁻¹, inv_ne_zero <| ratio_ne_zero e, e.surjective.forall₂.2 fun x y ↦ ?_⟩
    simp_rw [Equiv.toFun_as_coe, Equiv.symm_apply_apply, coe_toEquiv, edist_eq]
    

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
x y : X
⊢ edist x y = ↑(ratio e)⁻¹ * (↑(ratio e) * edist x y)

Next tactic:
rw [← mul_assoc, ← ENNReal.coe_mul, inv_mul_cancel (ratio_ne_zero e),
      ENNReal.coe_one, one_mul]
/-- Identity map as a `DilationEquiv`. -/
@[simps! (config := .asFn) apply]
def refl (X : Type*) [PseudoEMetricSpace X] : X ≃ᵈ X where
  toEquiv := .refl X
  edist_eq' := ⟨1, one_ne_zero, fun _ _ ↦ by 

Proof state:
X✝ : Type u_1
Y : Type u_2
Z : Type u_3
inst✝³ : PseudoEMetricSpace X✝
inst✝² : PseudoEMetricSpace Y
inst✝¹ : PseudoEMetricSpace Z
X : Type u_4
inst✝ : PseudoEMetricSpace X
x✝¹ x✝ : X
⊢ edist (Equiv.toFun (Equiv.refl X) x✝¹) (Equiv.toFun (Equiv.refl X) x✝) = ↑1 * edist x✝¹ x✝

Next tactic:
simp
@[simp]
theorem ratio_trans (e : X ≃ᵈ Y) (e' : Y ≃ᵈ Z) : ratio (e.trans e') = ratio e * ratio e' := by
  -- If `X` is trivial, then so is `Y`, otherwise we apply `Dilation.ratio_comp'`
  

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
e' : Y ≃ᵈ Z
⊢ ratio (trans e e') = ratio e * ratio e'

Next tactic:
by_cases hX : ∀ x y : X, edist x y = 0 ∨ edist x y = ∞
@[simp]
theorem ratio_trans (e : X ≃ᵈ Y) (e' : Y ≃ᵈ Z) : ratio (e.trans e') = ratio e * ratio e' := by
  -- If `X` is trivial, then so is `Y`, otherwise we apply `Dilation.ratio_comp'`
  by_cases hX : ∀ x y : X, edist x y = 0 ∨ edist x y = ∞
  · 

Proof state:
case pos
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
e' : Y ≃ᵈ Z
hX : ∀ (x y : X), edist x y = 0 ∨ edist x y = ⊤
⊢ ratio (trans e e') = ratio e * ratio e'

Next tactic:
have hY : ∀ x y : Y, edist x y = 0 ∨ edist x y = ∞ := e.surjective.forall₂.2 fun x y ↦ by
      refine (hX x y).imp (fun h ↦ ?_) fun h ↦ ?_ <;> simp [*, Dilation.ratio_ne_zero]
@[simp]
theorem ratio_trans (e : X ≃ᵈ Y) (e' : Y ≃ᵈ Z) : ratio (e.trans e') = ratio e * ratio e' := by
  -- If `X` is trivial, then so is `Y`, otherwise we apply `Dilation.ratio_comp'`
  by_cases hX : ∀ x y : X, edist x y = 0 ∨ edist x y = ∞
  · have hY : ∀ x y : Y, edist x y = 0 ∨ edist x y = ∞ := e.surjective.forall₂.2 fun x y ↦ by
      

Proof state:
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
e' : Y ≃ᵈ Z
hX : ∀ (x y : X), edist x y = 0 ∨ edist x y = ⊤
x y : X
⊢ edist (e x) (e y) = 0 ∨ edist (e x) (e y) = ⊤

Next tactic:
refine (hX x y).imp (fun h ↦ ?_) fun h ↦ ?_
@[simp]
theorem ratio_trans (e : X ≃ᵈ Y) (e' : Y ≃ᵈ Z) : ratio (e.trans e') = ratio e * ratio e' := by
  -- If `X` is trivial, then so is `Y`, otherwise we apply `Dilation.ratio_comp'`
  by_cases hX : ∀ x y : X, edist x y = 0 ∨ edist x y = ∞
  · have hY : ∀ x y : Y, edist x y = 0 ∨ edist x y = ∞ := e.surjective.forall₂.2 fun x y ↦ by
      refine (hX x y).imp (fun h ↦ ?_) fun h ↦ ?_ <;> 

Proof state:
case refine_1
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
e' : Y ≃ᵈ Z
hX : ∀ (x y : X), edist x y = 0 ∨ edist x y = ⊤
x y : X
h : edist x y = 0
⊢ edist (e x) (e y) = 0

Next tactic:
simp [*, Dilation.ratio_ne_zero]
@[simp]
theorem ratio_trans (e : X ≃ᵈ Y) (e' : Y ≃ᵈ Z) : ratio (e.trans e') = ratio e * ratio e' := by
  -- If `X` is trivial, then so is `Y`, otherwise we apply `Dilation.ratio_comp'`
  by_cases hX : ∀ x y : X, edist x y = 0 ∨ edist x y = ∞
  · have hY : ∀ x y : Y, edist x y = 0 ∨ edist x y = ∞ := e.surjective.forall₂.2 fun x y ↦ by
      refine (hX x y).imp (fun h ↦ ?_) fun h ↦ ?_ <;> 

Proof state:
case refine_2
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
e' : Y ≃ᵈ Z
hX : ∀ (x y : X), edist x y = 0 ∨ edist x y = ⊤
x y : X
h : edist x y = ⊤
⊢ edist (e x) (e y) = ⊤

Next tactic:
simp [*, Dilation.ratio_ne_zero]
@[simp]
theorem ratio_trans (e : X ≃ᵈ Y) (e' : Y ≃ᵈ Z) : ratio (e.trans e') = ratio e * ratio e' := by
  -- If `X` is trivial, then so is `Y`, otherwise we apply `Dilation.ratio_comp'`
  by_cases hX : ∀ x y : X, edist x y = 0 ∨ edist x y = ∞
  · have hY : ∀ x y : Y, edist x y = 0 ∨ edist x y = ∞ := e.surjective.forall₂.2 fun x y ↦ by
      refine (hX x y).imp (fun h ↦ ?_) fun h ↦ ?_ <;> simp [*, Dilation.ratio_ne_zero]
    

Proof state:
case pos
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
e' : Y ≃ᵈ Z
hX : ∀ (x y : X), edist x y = 0 ∨ edist x y = ⊤
hY : ∀ (x y : Y), edist x y = 0 ∨ edist x y = ⊤
⊢ ratio (trans e e') = ratio e * ratio e'

Next tactic:
simp [Dilation.ratio_of_trivial, *]
@[simp]
theorem ratio_trans (e : X ≃ᵈ Y) (e' : Y ≃ᵈ Z) : ratio (e.trans e') = ratio e * ratio e' := by
  -- If `X` is trivial, then so is `Y`, otherwise we apply `Dilation.ratio_comp'`
  by_cases hX : ∀ x y : X, edist x y = 0 ∨ edist x y = ∞
  · have hY : ∀ x y : Y, edist x y = 0 ∨ edist x y = ∞ := e.surjective.forall₂.2 fun x y ↦ by
      refine (hX x y).imp (fun h ↦ ?_) fun h ↦ ?_ <;> simp [*, Dilation.ratio_ne_zero]
    simp [Dilation.ratio_of_trivial, *]
  

Proof state:
case neg
X : Type u_1
Y : Type u_2
Z : Type u_3
inst✝² : PseudoEMetricSpace X
inst✝¹ : PseudoEMetricSpace Y
inst✝ : PseudoEMetricSpace Z
e : X ≃ᵈ Y
e' : Y ≃ᵈ Z
hX : ¬∀ (x y : X), edist x y = 0 ∨ edist x y = ⊤
⊢ ratio (trans e e') = ratio e * ratio e'

Next tactic:
push_neg at hX