I'd like to formulate an abstract definition of convex sets: a set $K$ is *convex* if it is endowed with a ternary operation $K\times[0,1]\times K\to K$, written $(x:t:y)$, satisfying axioms

- $(x:0:y)=(x:t:x)=x$
- $(x:t:y)=(y:1-t:x)$
- $(x:t:(y:\frac ut:z))=((x:\frac{t-u}{1-u}:y):u:z)$

The axioms imply that, for every $x_1,\dots,x_n\in K$ and $t_i\ge0$ with $\sum t_i=1$ the convex combination $\sum t_i x_i\in K$ is well defined.

Examples are the usual convex subsets of real vector spaces, with $(x:t:y)=(1-t)x+ty$, but also trees with $(x:t:y)$ the unique point at ratio $t$ on the geodesic from $x$ to $y$, and more generally $\mathbb R$-trees (geodesic metric spaces in which all triangles are isometric to tripods).

I'm sure this has already been explored, and I'd rather not reinvent the wheel (and I possibly missed some useful axioms), but I couldn't find any reference to such notions.

Natural questions that come to mind are:

- define an affine map between convex sets $K,L$ as a map $f\colon K\to L$ with $f(x:t:y)=(f(x):t:f(y))$. Topologize then convex sets by making all affine maps to $\mathbb R$ continuous. What can be said of these topological spaces?
- can every convex set be represented in a vector space? I have in mind the map $K\to\ell^1(K)/\{\delta_{(x:t:y)}=(1-t)\delta_x+t\delta_y\forall x,t,y\}$, though the topologies will probably not match (and I'm not sure I want to close the space I quotient $\ell^1$ by).

Thanks to all! Any kinds of references or comments are welcome.