Skip to content

Commit

Permalink
feat (Topology/EMetricSpace): ext lemmas for Extended metric classes (#…
Browse files Browse the repository at this point in the history
…10813)


previously the `ext` tactic would fail for these classes. now it won't.
  • Loading branch information
blizzard_inc authored and callesonne committed Apr 22, 2024
1 parent 8ec9e3e commit dc36926
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Mathlib/Topology/EMetricSpace/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ theorem uniformity_dist_of_mem_uniformity [LinearOrder β] {U : Filter (α × α
#align uniformity_dist_of_mem_uniformity uniformity_dist_of_mem_uniformity

/-- `EDist α` means that `α` is equipped with an extended distance. -/
@[ext]
class EDist (α : Type*) where
edist : α → α → ℝ≥0
#align has_edist EDist
Expand Down Expand Up @@ -89,6 +90,16 @@ attribute [instance] PseudoEMetricSpace.toUniformSpace

/- Pseudoemetric spaces are less common than metric spaces. Therefore, we work in a dedicated
namespace, while notions associated to metric spaces are mostly in the root namespace. -/

/-- Two pseudo emetric space structures with the same edistance function coincide. -/
@[ext]
protected theorem PseudoEMetricSpace.ext {α : Type*} {m m' : PseudoEMetricSpace α}
(h : m.toEDist = m'.toEDist) : m = m' := by
cases' m with ed _ _ _ U hU
cases' m' with ed' _ _ _ U' hU'
congr 1
exact UniformSpace.ext (((show ed = ed' from h) ▸ hU).trans hU'.symm)

variable [PseudoEMetricSpace α]

export PseudoEMetricSpace (edist_self edist_comm edist_triangle)
Expand Down Expand Up @@ -1015,6 +1026,15 @@ class EMetricSpace (α : Type u) extends PseudoEMetricSpace α : Type u where
eq_of_edist_eq_zero : ∀ {x y : α}, edist x y = 0 → x = y
#align emetric_space EMetricSpace

@[ext]
protected theorem EMetricSpace.ext
{α : Type*} {m m' : EMetricSpace α} (h : m.toEDist = m'.toEDist) : m = m' := by
cases m
cases m'
congr
ext1
assumption

variable {γ : Type w} [EMetricSpace γ]

export EMetricSpace (eq_of_edist_eq_zero)
Expand Down

0 comments on commit dc36926

Please sign in to comment.