A metric space is a set which comes equipped with a function which measures distance between points, called a metric. The metric can be used to generate a topology on the set, and a topological space whose topology comes from some metric is said to be metrizable.
Traditionally, a metric space is defined to be a set $X$ equipped with a distance function
(valued in nonnegative real numbers) satisfying the following axioms:
Triangle inequality: $d(x, y) + d(y, z) \geq d(x, z)$;
Point inequality: $0 \geq d(x, x)$ (so $0 = d(x,x)$);
Separation: $x = y$ if $d(x, y) = 0$ (so $x = y$ iff $d(x,y) = 0$);
Symmetry: $d(x, y) = d(y, x)$.
Given a metric space $(X, d)$ and a point $x \in X$, the open ball centered at $x$ of radius $r$ is
and it may be shown that the open balls form a basis for a topology on $X$, the metric topology. In fact, metric spaces are examples of uniform spaces, and much of the general theory of metric spaces, including for example the notion of completion of a metric space, can be extrapolated to uniform spaces and even Cauchy spaces.
A metrizable space is a topological space $X$ which admits a metric such that the metric topology agrees with the topology on $X$. In general, many different metrics (even ones giving different uniform structures) may give rise to the same topology; nevertheless, metrizability is manifestly a topological notion.
Metrizable spaces enjoy a number of separation properties: they are Hausdorff, regular, and even normal. They are also paracompact.
Metrizable spaces are closed under topological coproducts and of course subspaces (and therefore equalizers); they are closed under countable products but not general products (for instance, a product of uncountably many copies of the real line $\mathbb{R}$ is not a normal space).
Fundamental early work in point-set topology established a number of metrization theorems, i.e., theorems which give sufficient conditions for a space to be metrizable. One of the more useful theorems is due to Urysohn:
(Urysohn metrization) A regular, Hausdorff second-countable space is metrizable.
So, for instance, a compact Hausdorff space that is second-countable is metrizable.
A compact Hausdorff space that is merely separable need not be metrizable; one example is the Stone-Cech compactification $\beta(\mathbb{N})$, in which $\mathbb{N}$ is dense but no non-principal ultrafilter $U$ is the limit of a sequence $X = \{x_n\} \subseteq \mathbb{N}$ of principal ultrafilters. (Supposing it were, choose complementary subsets $A, B \subseteq \mathbb{N}$ such that $A \cap X$ and $B \cap X$ are infinite. By the decomposition $\beta(\mathbb{N}) = \beta(A + B) = \beta(A) + \beta(B)$, we have $U$ belonging to exactly one of $\beta(A), \beta(B)$, say $\beta(B)$. But since the subsequence $A \cap X$ converges to $U$, the basic open neighborhood $\beta(B) = \{V \in \beta(\mathbb{N}): B \in V\}$ of $U$ intersects $A \cap X$ non-trivially, i.e., $B$ is contained in some principal ultrafilter $prin(a)$ with $a \in A \cap X$. Then $a$ lies in disjoint sets $B$ and $A \cap X$, contradiction.)
If we allow $d$ to take values in $[0,\infty]$ (the nonnegative lower reals) instead of just in $[0,\infty)$, then we get extended metric spaces. If we drop separation, then we get pseudometric spaces. If we drop the symmetry condition, then we get quasimetric spaces. Thus the most general notion is that of an extended quasipseudometric space, which are also called Lawvere metric spaces for the reasons below.
On the other hand, if we strengthen the triangle inequality to
then we get ultrametric spaces, a more restricted concept. (This include for example $p$-adic completions of number fields.) Extended quasipseudoultrametric spaces can also be called Lawvere ultrametric spaces.
In Lawvere, 1973, Bill Lawvere has pointed out that Lawvere metric spaces are precisely categories enriched in the monoidal poset $([0, \infty], \geq)$, where the monoidal product is taken to be addition. Taking the monoidal product to be supremum instead, enriched categories amount to Lawvere ultrametric spaces.
Thus generalized, many constructions and results on metric spaces turn out to be special cases of yet more general constructions and results of enriched category theory. This includes for example the notion of Cauchy completion, which in general enriched category theory is related to Karoubi envelopes and Morita equivalence.
Imposing the symmetry axiom then gives us enriched $\dagger$-categories. Note that when enriching over a cartesian monoidal poset, there is no difference between a $\dagger$-category and a groupoid, so ultrametric spaces can also be regarded as enriched groupoids, which is perhaps a more familiar concept.
(The requisite axioms for an enriched groupoid do not make sense when the enriching category is not cartesian, but one might argue that since in a poset “they would commute automatically anyway”, it makes sense to call any poset-enriched $\dagger$-category also an “enriched groupoid”. However, perhaps it makes more sense just to speak about enriched $\dagger$-categories.)
The category of metric spaces and categories of random maps as generalised metric spaces were studied in the thesis of Lawvere’s student Xiao-qing Meng.
The triangle axiom is the fundamental idea behind a metric space; it goes back (at least) to Euclid and captures the idea that we are discussing the shortest distance between two points. Given the triangle inequality, we have the polygon inequality
for all $n \gt 0$; the point inequality extends this to $n = 0$.
Besides extended metric spaces (where distances may be infinite), one might consider spaces where distances may be negative. But in fact this gives us nothing new, at least if we have symmetry. First,
forces $d(x,x) \geq 0$, so $d(x,x) = 0$; then
forces $d(x,y) \geq 0$. A generalisation to negative distances is possible for quasimetric spaces, however; the simplest example has $2$ elements, with $d(x,y) = -d(y,x)$ (but necessarily $d(x,x) = 0$ still).
We can define a preorder $\leq$ on the points of a Lawvere metric space:
Then the symmetry axiom implies that this relation is symmetric and hence an equivalence relation. The quotient set under this equivalence relation satisfies separation; in this way, every pseudometric space is equivalent (as an enriched category) to a metric space. Even for quasimetric spaces, we can still define an equivalence relation:
In constructive mathematics, it works better to use $\lneq$:
then the symmetry axiom implies that this is an apartness relation, which (for quasimetric spaces) we can also define directly:
Every set carries the discrete metric given by
For certain purposes, it makes more sense to make most the non-zero distance $\infty$ instead of $1$; then one has an extended metric space.
Every normed vector space is a metric space by $d(x,y) \coloneqq {\|x - y\|}$; a pseudonormed vector space is a pseudometric space.
Every connected Riemannian manifold becomes a pseudometric space (or a metric space if, as is often assumed, the manifold is Hausdorff) by taking the distance between two points to be infimum of the Riemannian lengths of all continuously differentiable paths connecting them:
If the manifold might not be connected, then it still becomes an extended metric space.
metric jet – a notion of “tangency” for maps of metric spaces
Generalized uniform structures
Bill Lawvere (1973). Metric spaces, generalized logic and closed categories. Reprinted in TAC, 1986. Web.
Xiao-qing Meng?, Categories of convex sets and of metric spaces with applications to stochastic programming and related areas, PhD thesis (djvu)