Say that a function $f$ defined on $\mathbb{Q}^n$ is *midpoint convex* if $f((x+y)/2) \le (f(x) + f(y))/2$. Say that it is *rationally convex* if, for $\lambda \in \mathbb{Q} \cap [0,1]$ and $\bar \lambda = 1-\lambda$, we have $f(\lambda x + \bar\lambda y) \le \lambda f(x) + \bar\lambda f(y)$.

Clearly every rationally-convex function is midpoint-convex.

**Question:** Is a midpoint-convex function on $\mathbb{Q}^n$ necessarily rationally-convex?

**Background:** I'm looking for sufficient conditions for a function on $\mathbb{Q}^n$ to extend to a continuous function on $\mathbb{R}^n$. The following results are known and/or easy:

Rationally-convex functions on $\mathbb{Q}^n$ are continuous; similarly real-convex functions on $\mathbb{R}^n$ are continuous. (I'm sticking to "proper" functions, with real values, for convenience.)

Using the axiom of choice, there are rationally-convex functions on $\mathbb{R}$. (Take a $\mathbb{Q}$-basis of $\mathbb{R}^n$ and go from there.)

Every rationally-convex function $f$ on $\mathbb{Q}^n$ extends continuously to a real-convex function. (Define the extension to be the $\liminf$ of the nearby rational values, and check the result is convex.) As a result, every rationally-convex function on $\mathbb{Q}^n$ extends to a continuous function on $\mathbb{R}^n$.

Every measurable, midpoint-convex function on $\mathbb{R}^n$ is continuous. (Attributed by Wikipedia to Sierpinski, I have not read the reference. There are many prior questions on MathOverflow that are answered by this theorem.)

These all seem like it should be implying midpoint-convex implies rationally-convex, but I couldn't quite close the loop.

In the case I'm actually interested in, this is a side issue, since my function $f$ is additionally (rationally)-homogeneous, and homogeneous and midpoint-convex implies rationally-convex. But I was curious and could not find it in the literature.