Pseudometrics as bundled functions #
This file defines a pseudometric as a bundled function. This allows one to define a semilattice on them, and to construct families of pseudometrics.
Implementation notes #
The PseudoMetric
definition is made as general as possible without any required axioms
for the codomain. The axioms come into play only in proofs and further constructions
like the SemilatticeSup
instance. This allows one to talk about functions mapping into
something like { fuel: ℕ, time: ℕ }
even though there is no linear order.
In most cases, the codomain will be a linear ordered additive monoid like
ℝ
, ℝ≥0
, ℝ≥0∞
, in which all of the axioms below are satisfied.
A pseudometric as a bundled function.
- toFun : X → X → R
The underlying binary function mapping into a linearly ordered additive monoid.
A pseudometric must take identical elements to 0.
A pseudometric must be symmetric.
A pseudometric must respect the triangle inequality.
Instances For
Equations
- PseudoMetric.instFunLikeForall = { coe := PseudoMetric.toFun, coe_injective' := ⋯ }
Equations
- PseudoMetric.instLE = { le := fun (d d' : PseudoMetric X R) => ⇑d ≤ ⇑d' }
Equations
- PseudoMetric.instPartialOrder = PartialOrder.lift (fun (f : PseudoMetric X R) => ⇑f) ⋯
Equations
- PseudoMetric.instMaxOfAddLeftMonoOfAddRightMono = { max := fun (d d' : PseudoMetric X R) => { toFun := fun (x y : X) => d x y ⊔ d' x y, refl' := ⋯, symm' := ⋯, triangle' := ⋯ } }
Equations
- PseudoMetric.instSemilatticeSupOfAddLeftMonoOfAddRightMono = { toPartialOrder := PseudoMetric.instPartialOrder, sup := max, le_sup_left := ⋯, le_sup_right := ⋯, sup_le := ⋯ }
Equations
- PseudoMetric.instOrderBot = { toBot := PseudoMetric.instBot, bot_le := ⋯ }
A pseudometric can be nonarchimedean (or ultrametric), with a stronger triangle
inequality such that d x z ≤ max (d x y) (d y z)
.
Strong triangle inequality of an ultrametric.