My PhD thesis was on this topic, focusing mostly on a combinatorial approach (rather than topological). So what I write below is directed toward Question 1.

I call a structure $\mathcal{R}=(R,+,\leq,0)$ a *distance magma* if $(R,\leq,0)$ is a total order with least element $0$, and $+$ is a commutative binary operation on $R$ which preserves the order ($a\leq b\Rightarrow a+c\leq b+c$). I call $\mathcal{R}$ a *distance monoid* if the operation is associative. The last axiom you mention about "solving inequalities" didn't play a special role. (Also, I use $\mathcal{R}$ instead of $L$ since eventually there will be a first order language.)

My own interest started with the special case of fixing a countable set $R\subseteq\mathbb{R}_{\geq 0}$ such that $0\in R$ and $R$ is closed under $x+_R y:=\sup\{z\in R:x\leq y+z\}$, which determines a distance magma $\mathcal{R}=(R,+_R,\leq,0)$. The first main question was:

**Question.** When is there a countable, universal and ultrahomogeneous $\mathcal{R}$-metric space (so, in other words, a Urysohn-like space relative to the distance set $R$)?

For example if $R=\mathbb{Q}_{\geq0}$ then then the answer is yes, witnessed by the classical rational Urysohn space. Another example is $R=\{0,1,2\}$ which yields the random graph (where $1$ designates an edge and $2$ designates no edge).

It turned out that this question was answered by Delhomme, LaFlamme, Pouzet, and Sauer. There is a more technical general characterization, but, in the special case above, there is a really nice fact:

**Fact.** There is an $\mathcal{R}$-Urysohn space if and only if the operation $+_R$ is associative.

The idea is that associativity of $+_R$ is combinatorially capturing the ability to amalgamate three-point $\mathcal{R}$-metric spaces, which leads to amalgamation for the class of all finite $\mathcal{R}$-metric spaces.

The "smallest" example of a set $R$ as above for which there is no $\mathcal{R}$-metric spaces is $\{0,1,2,4\}$.

In any case, it became more natural to work in a more general axiomatic framework. Given a countable distance magma $\mathcal{R}$, there is a natural notion of an $\mathcal{R}$-metric space, and a countable $\mathcal{R}$-Urysohn space exists if and only if $\mathcal{R}$ is a distance monoid. So assume $\mathcal{R}$ is a distance monoid and let $\mathcal{U}_{\mathcal{R}}$ denote the $\mathcal{R}$-Ursyosn space. In other words, $\mathcal{U}_{\mathcal{R}}$ is the unique (up to isometry) countable $\mathcal{R}$-metric space such that every finite $\mathcal{R}$-metric space embeds as a subspace of $\mathcal{U}_{\mathcal{R}}$, and any partial isometry between two finite subspaces of $\mathcal{U}_{\mathcal{R}}$ extends to a (total) isometry $\mathcal{U}_{\mathcal{R}}$.

I consider $\mathcal{U}_{\mathcal{R}}$ as a first-order structure in a relational language $L_{\mathcal{R}}$ containing binary relations $d_r(x,y)$ for $r\in R$, which are interpreted as "$d(x,y)\leq r$". Let $T_{\mathcal{R}}$ be the complete theory of $\mathcal{U}_{\mathcal{R}}$ in this language.

If $\mathcal{R}$ is finite then $T_{\mathcal{R}}$ is $\aleph_0$-categorical, but for infinite distance monoids this fails. For example, if $\mathcal{R}=(\mathbb{Q}_{\geq 0},+,\leq,0)$ (so $\mathcal{U}_{\mathcal{R}}$ is the rational Urysohn space), then there are plenty of non-isolated $2$-types over $\emptyset$, which describe "new distances" from irrationals and infinitesimal cuts. For example, $\{\neg d_0(x,y)\}\cup\{d_r(x,y)\leq r:r>0\}$ is a finitely satisfiable $2$-type, which describes two elements at nonzero infinitesimal distance.

In general, any distance $r\in R$ can be viewed as a quantifier-free $2$-type: $\{\neg d_s(x,y):s<r\}\cup\{d_s(x,y):r\leq s\}$. This produces a canonical embedding of $R$ in the set of quantifier-free $2$-types over $\emptyset$, and the ordering on $R$ extends naturally to this space (in a way very similar to a Dedekind-MacNeille completion). A more interesting fact is that the monoid operation also extends to the (quantifier-free) $2$-types. Specifically, given $2$-types $p,q$, define $p+q$ to be the supremum (which exists) of the set of $2$-types $r$ such that the $3$-type $p(x,y)\cup p(y,z)\cup r(x,z)$ is finitely satisfiable. (So $p+q$ is the largest distance that you can consistently put on a triangle with distances $p$ and $q$.)

So altogether, we have a new distance monoid $\mathcal{R}^*$, built from the quantifier-free $2$-types, which extends $\mathcal{R}$. $\mathcal{R}^*$ behaves a little like a "nonstandard" or saturated extension of $\mathcal{R}$ (but it is not exactly this).

In my thesis I proved a characterization of quantifier elimination for $T_{\mathcal{R}}$ in terms of the behavior of $\mathcal{R}^*$.

**Theorem.** $T_{\mathcal{R}}$ has QE if and only if for any standard element $r\in R$, the operation $x\mapsto x+r$ is continuous on $\mathcal{R}^*$ (where here continuity is with respect to the order topology on $\mathcal{R}^*$).

So QE does happen in most "nice" situations, for example if $\mathcal{R}$ is finite (in which case $\mathcal{R}^*=\mathcal{R}$), or if $\mathcal{R}=(\mathbb{Q}_{\geq 0},+,\leq,0)$. But it can fail by "poking holes" in nice monoid. An example is $\mathcal{R}=(R,+_R,\leq,0)$ where $R=\mathbb{Q}\cap (\{0\}\cup[2,3)\cup (3,\infty))$.

The QE result was really only the starting point, since I was mainly interested in model-theoretic neostability properties of $T_{\mathcal{R}}$ under the assumption of QE. The rest of the thesis was about characterizing such properties (stability, simplicity, SOP$_n$, forking, elimination of imaginaries, etc.) via algebraic/combinatorial properties of $\mathcal{R}$. It turned out to be quite successful: most model-theoretic properties of $T_{\mathcal{R}}$ are controlled by $\mathcal{R}$.

The model-theoretic results became two papers: arXiv 1502.05002 and arXiv 1504.02427. I wrote another paper (arXiv 1509.04950) about extending partial isometries (i.e., the "Hrushovksi property"), which built on results of Solecki about rational-valued metric spaces. What I did was generalized further by Hubička, Konečný, and Nešetřil arXiv 1902.03855. They also proved the Ramsey property for these classes (arXiv 1710.04690).

Question #2 is definitely interesting, but nothing I did was in that direction since I effectively viewed my spaces as discrete. But there might be something in these two older articles:

- Alsina & Trillas,
*On natural metrics*, Stochastica 2 (1977).
- Narens,
*Field embeddings of generalized metric spaces*, Victoria Symposium on Nonstandard Analysis, Springer, Berlin (1974).

There is also some more recent work by Etedadialiabadi, Gao, Le Maître, and Melleray, which I haven't read closely, but looks related.