I apologize if this is a simple question or if this is not the right forum for it. Some background: the subadditivity of Shannon's entropy is credited to the concavity of $-x\log(x)$. So this got me thinking about the inverse: 



> 
> Let $f:\mathbb{R}\to\mathbb{R}$ be such that for any $h>0$ and $y>x$ we have $$f(x+h)-f(x)\le f(y+h)-f(y)$$ Does this imply that $f$ is convex? 
> 
> 
> 


The statement is true if $f$ is continuous, but I have no idea about the general case. My gut feeling is that it's not and probably a counterexample would be some sort of a "hairy" function. I am looking for suggestions...



Does the following statement imply convexity?
Your proposed inequality is certainly true, and indeed an equality, whenever $f$ is additive, but one can build almost-arbitrarily-bad additive functions by considering a Hamel basis for $\mathbb R$ as a $\mathbb Q$-vector space. Such functions (if not continuous) are bounded neither above nor below on any interval, hence not convex.


EDIT with more details: As [@LiviuNicolaescu](https://mathoverflow.net/a/282778) points out, every convex function is continuous, so it suffices to produce an example of a discontinuous such function. These exist (given choice, at least) in abundance, but here's one example. Let $\mathcal B$ be a Hamel basis of $\mathbb R$ (i.e., a basis for $\mathbb R$ as a $\mathbb Q$-vector space) containing $1$, and let $x$ be any element of $\mathcal B \setminus \{1\}$. Let $f$ be the unique $\mathbb Q$-linear extension to $\mathbb R$ of the characteristic function of $\{x\}$, viewed as a function $\mathcal B \to \mathbb R$. Since $f$ satisfies $f(a + b) = f(a) + f(b)$ for all $a, b \in \mathbb R$ (by $\mathbb Q$-linearity), it satisfies your proposed inequality, and indeed makes it an equality. Since $f$ vanishes on $\mathbb Q$ (because it vanishes at $1$ and is $\mathbb Q$-linear), if continuous, it would have to vanish everywhere; but it takes the value $1$ at $x$.


