Some time ago I spent a lot of effort trying to show that the semimartingale property is preserved by certain functions. Specifically, that a convex function of a semimartingale and decreasing function of time is itself a semimartingale. This was needed for a result which I was trying to prove (more details below) and eventually managed to work around this issue, but it was not easy. For twice continuously differentiable functions this is an immediate consequence of Ito's lemma, but this cannot be applied in the general case. After failing at this task, I also spent a considerable amount of time trying to construct a counterexample, also with no success. So, my question is as follows.

1) Let $f\colon\mathbb{R}^+\times\mathbb{R}\to\mathbb{R}$ be such that $f(t,x)$ is convex in $x$ and continuous and decreasing in $t$. Then, for any semimartingale $X$, is $f(t,X_t)$ necessarily a semimartingale?

Actually, it can be assumed here that $X$ is both continuous and a martingale which, with some work, would imply the general case. As it turns out, this can be phrased purely as a real-analysis question.

2) Let $f\colon\mathbb{R}^+\times\mathbb{R}\to\mathbb{R}$ be such that $f(t,x)$ is convex in $x$ and decreasing in $t$. Can we write $f=g-h$ where $g(t,x)$ and $h(t,x)$ are both convex in $x$ and

increasingin $t$?

Stated like this, maybe someone with a good knowledge of convex functions would be able to answer the question one way or the other.

For $f(t,x)$ convex in $x$ and increasing in $t$ then approximation by smooth functions and applying Ito's lemma allows us to express $f(t,X_t)$ as the sum of a stochastic integral and an increasing process
$$
f(t,X_t)=\int_0^t\frac{\partial f}{\partial x}(s,X_s)\,dX_s+V_t,\qquad{\rm(*)}
$$
so it is a semimartingale. If, instead, $f$ is *decreasing* in $t$, then an affirmative answer to question 2 will reduce it to the easier case where it is increasing in $t$, also giving a positive answer to the first question.
Explaining why question 1 implies 2 is a bit trickier. If 2 was false, then it would be possible to construct martingales $X$ such that the decomposition (*) holds where the variation of $V$ explodes at some positive time.

This problem arose while I was trying to prove the following: is a continuous martingale uniquely determined by its one dimensional marginals? For arbitrary continuous martingales this is false, but is known to be true for diffusions $dX_t=\sigma(t,X_t)\,dW$ for Brownian motion $W$ and smooth parameter $\sigma$. The idea is to back out $\sigma$ from the Kolmogorov forward equation. This is well-known in finance as the local volatility model. However, I was trying to show rather more than this. All continuous and strong Markov martingales are uniquely determined by the one dimensional marginals. I was able to prove this, and the relation between the marginals and joint distributions of the martingale has many nice properties (I wrote a paper on this, submitted to the arXiv, but not published as I am still working on changes asked for by the referees). The method was to reformulate the Kolmogorov backward equation in terms of the marginals. This does use Ito's lemma, requiring twice differentiability, but can be circumvented with a bit of integration by parts as long as $f(t,X_t)$ is a semimartingale for the kinds of functions mentioned above. The question above arose from trying, and failing, to prove this. Without an answer to this question, the problem becomes much much harder, as many of the techniques from stochastic calculus can no longer be applied (and, approximating by semimartingales didn't seem to help either). The work around was very involved, part of which I published as a standalone paper here and the rest forms most of a paper I submitted to the arXiv here. Adding together those papers, it comes to maybe 50 pages of maths and a lot of effort to work around the question above.

**Update:** I posted more details on the various equivalent forms of this question here. I also posted a possible counterexample, without proof but with some numerical evidence suggesting that it may indeed be a counterexample.