Local times and Tanaka–Meyer formulae for càdlàg paths*

Three concepts of local times for deterministic càdlàg paths are developed and the corresponding pathwise Tanaka–Meyer formulae are provided. For semimartingales, it is shown that their sample paths a.s. satisfy all three pathwise definitions of local times and that all coincide with the classical semimartingale local time. In particular, this demonstrates that each definition constitutes a legit pathwise counterpart of probabilistic local times. The last pathwise construction presented in the paper expresses local times in terms of normalized numbers of interval crossings and does not depend on the choice of the sequence of grids. This is a new result also for càdlàg semimartingales, which may be related to previous results of Nicole El Karoui [11] and Marc Lemieux [23].


Introduction
Stochastic calculus, with its foundational notions developed by Kyiosi Itô in the 1940s, is a par excellence probabilistic endeavour. The stochastic integral, the integration by parts formula -these basic building blocks are to be understood almost surely, and so is the edifice they span. This thinking has proved to be exceedingly powerful and fruitful, and underpins many beautiful developments in probability theory since then. Nevertheless, for decades now, mathematicians have been trying to develop a more analytic, pathwise understanding of these probabilistic objects. On one hand, this was, and is, driven by mathematical curiosity. The classical calculus remains an irresistible reference point and, e.g., in developing a notion of an integral it is important to understand when and how it can be seen as a limit of its Riemann sums. On the other hand, this was, and is, driven by applications. Stochastic differential equations have became a ubiquitous tool for mathematical modelling from physics, through biology to finance. Yet, they do not offer the same level of path-by-path description of the system's evolution as the classical differential equations do. This becomes particularly problematic if one needs to work simultaneously with many probability measures, possibly mutually singular. One field where this proves important, and which has driven renewed interest in pathwise stochastic calculus, is robust mathematical finance, see for example [8] and the references therein. Both of the above reasons -mathematical curiosity and possible applications -are important for us. We add to this literature and develop a pathwise approach to stochastic calculus for càdlàg paths using local times.
In his seminal paper [14], Föllmer introduced, for twice continuously differentiable f : R → R, a non-probabilistic version of the Itô formula where x : [0, T ] → R is càdlàg and possesses a suitably defined quadratic variation [x] such that, for 0 ≤ t ≤ T , In particular, this leads to a pathwise definition of the "stochastic" integral t 0 f (x s− ) dx s , assuming [x] exists. Soon after, Stricker [35], showed that one could not extend the above to all continuous functions f . This could only be done adopting a much more bespoke discretisation and probabilistic methods, see for example [3,19]. Accordingly, the main remaining challenge was to understand the case of functions f which are not twice continuously differentiable but are weakly differentiable, in some sense. In probabilistic terms, this realm is covered by the Tanaka-Meyer formula.
For continuous paths Föllmer's pathwise Itô formula was generalized to a pathwise Tanaka-Meyer formulae in the early work of [36] and more recently in [29] and in [9], who offered a comprehensive study. Furthermore, we refer to [16] and [2,8] for related work in a pathwise spirit. Our contribution here is to study this problem for càdlàg paths. Jump processes, e.g., Lévy processes, are of both theoretical and practical importance and, as stressed above, our study is motivated by both mathematical curiosity as well as applications. Already in the classical, probabilistic, setting stochastic calculus for jump processes requires novel insights over and above the continuous case. This was also observed in recent works focusing on Föllmer's Itô calculus for càdlàg paths, see [5] and [17]. We face the same difficulty, which of course makes our study all the more interesting. In particular, we need more information and new ideas to handle jumps. This is consistent with the definition of quadratic variation for càdlàg paths, cf. [5].
Our non-probabilistic versions of Tanaka-Meyer formula, extend the above Itô formula allowing for functions f with weaker regularity assumptions than C 2 . More precisely, EJP 26 (2021), paper 77.
Local times and Tanaka-Meyer formulae for càdlàg paths we derive pathwise formulae for twice weakly differentiable functions f , supposing that the càdlàg path x possesses a suitable pathwise local time L(x). As in the case of the Itô formula, there exists no unique pathwise sense to understand such a formula, see also Remark 2.14 below. We develop three natural pathwise approaches to local times and, consequently, to their stochastic calculus. First, we start with the key property relating local times and quadratic variation: the time-space occupation formula, and use it to define pathwise local times. Second, in the spirit of [14,36], we discretise the path along a sequence of partitions and obtain local times as limits of discrete level crossings and stochastic integrals as limits of their Riemann sums. Finally, we discretise the integrand via the Skorokhod map which provides a natural approximation of the "stochastic" integral and links to the concept of truncated variation. In all of the three cases we show that a pathwise variant of the Tanaka-Meyer formula holds. Further, we prove that for a càdlàg semimartingale, all three constructions coincide a.s. with classical local times. This shows that all three approaches are legitimate extensions of the classical stochastic results to pathwise analysis. Each has its merits and limitations which we explore in detail. Our aim is to provide a comprehensive understanding of how to deal with jumps in the context of pathwise Tanaka-Meyer formulae. We thus do not seek further extensions of the setup, e.g., to cover time-dependent functions f , cf. [12], path-dependent functions, cf. [6,18,34], nor to develop higher order local times in the spirit of [7] for càdlàg paths. These, while interesting, would distract from the main focus of the paper and are left as avenues for future research.
Outline: In Section 2 we propose three notions of local times for càdlàg paths and establish the corresponding Tanaka-Meyer formulae. Then, in Section 3, we show that sample paths of semimartingales almost surely possess such local times and all three definitions agree a.s. in the classical stochastic world.

Pathwise local times and Tanaka-Meyer formulae
The first non-probabilistic version of Itô's formula and the corresponding notion of pathwise quadratic variation of càdlàg paths was introduced by H. Föllmer in the seminal paper [14]. Before providing non-probabilistic versions of Tanaka-Meyer formulae and introducing the corresponding pathwise local times, we recall in the next subsection some results from [14].

Quadratic variation and the Föllmer-Itô formula
In order to define the summation over the jumps of a càdlàg function, we need the concept of summation over general sets, see for example [21, p.77-78]. Let I be a set, let b : I → R be a real valued function and let I be the family of all finite subsets of I. Since I is directed when endowed with the order of inclusion ⊆, the summation over I can be defined by EJP 26 (2021), paper 77.
as limit of a net, i.e., lim Γ∈I i∈Γ b i =: l ∈ [−∞, ∞] exists if, for any neighbourhood 1 V l of l, there is Γ ∈ I such that for allΓ ∈ I such thatΓ ≥ Γ (i.e.,Γ ⊇ Γ) one has i∈Γ b i ∈ V l . If b i ≥ 0 for all i ∈ I, then it is easy to see that We say that the series i∈I b i is absolutely summable if the limit i∈I |b i | (which always exists, by (2.2)) is finite, in which case also the limit (2.1) exists and satisfies For a continuous function f : R → R possessing a left-derivative f , we now set provided the sum exists. Furthermore, the space of continuous functions f : R → R is denoted by C(R) := C(R; R), the space of twice continuously differentiable functions by C 2 (R) := C 2 (R; R) and the space of smooth functions by C ∞ (R) := C ∞ (R; R). A partition π = (t j ) N j=0 is a finite sequence such that 0 = t 0 < t 1 < · · · < t N = T (for some N ∈ N). We write |π| := max j∈N |t j − t j−1 | for its mesh size and define π(t) := π ∩ [0, t] the restriction of π to [0, t]. A sequence of partitions (π n ) n∈N is said to be refining if for all t j ∈ π n we also have t j ∈ π n+1 and a refining sequence (π n ) n∈N is said to exhaust the jumps of x if for all t ∈ [0, T ] with ∆x t = 0, t ∈ π n for n large enough. The Dirac measure at t ∈ [0, T ] is denoted by δ t . Definition 2.1. Let (π n ) n be a sequence of partitions such that lim n→∞ |π n | = 0. A function x ∈ D([0, T ]; R) has quadratic variation [x] along (π n ) n if the sequence of discrete measures µ n := tj ∈π n (x tj+1 − x tj ) 2 δ tj converges weakly 3 to a finite 4 measure µ such that the jumps of the (increasing, càdlàg) function [x] t := µ([0, t]) are given by ∆[x] t = (∆x t ) 2 for all t ∈ [0, T ]. Q((π n ) n ) denotes the set of functions in D([0, T ]; R) having a quadratic variation along (π n ) n . For x ∈ Q((π n ) n ), we write [x] c and [x] d for the continuous and purely discontinuous parts of the càdlàg function [x] and note that by the above definition we have We now recall Föllmer's pathwise version of Itô's formula for paths in Q((π n ) n ). Here and throughout, t 0 stands for (0,t] and increasing is understood as non-decreasing.
holds with J f t (x) as in (2.3), and with (2.5) where the series in (2.3) is absolutely convergent and the limit in (2.5) exists.
We note that, to define t 0 f (x s− ) dx s , Föllmer [14] takes limits of sums of the form This however has no consequences, since the difference between these two sums is g(x tc(π n ,t) )(x t c(π n ,t)+1 − x t ), where c(π, t) := max{j : π t j ≤ t}, which goes to zero as |π n | → 0 since g is bounded on x is càdlàg and t < t c(π,t)+1 ≤ t + |π|. In consequence, Föllmer's pathwise Itô formula (2.4) holds also with our definition of t 0 f (x s− ) dx s and we shall exploit it in our proofs. Notice that analogously π n tj ≤t which goes to zero as |π n | → 0.

Local time via occupation measure
In order to extend the Itô formula for twice continuously differentiable functions f to twice weakly differentiable functions f , the notion of quadratic variation is not sufficient and the concept of local time is required. In probability theory there exist various classical approaches to define local times of stochastic processes. In the present deterministic setting, we first introduce a pathwise local time corresponding to the notation of local time as an occupation measure with respect to the quadratic variation.
The space of q-integrable (equivalence classes of) functions g : R → R is denoted by L q (R) := L q (R; R) with corresponding norm · L q for q ∈ [1, ∞] and W k,q (R) := W k,q (R; R) stands for the Sobolev space of functions g : R → R which are k-times weakly differentiable in L q (R), for k ∈ N. Moreover, L q (K; R) is the space of q-integrable functions f : K → R for a Borel set K ⊂ R and we recall the left-continuous sign-function We define, for a, b ∈ R,  Naturally, this approach to local time is not new, see for example [1]. To extend Itô's formula to a Tanaka-Meyer formula, as, e.g., in [31], we will consider the quantity J t (x, ·) := J fu t (x), where f u := | · −u|/2.
We will, at times, drop x from the notation, and simply write L t (u) and J t (u). It is straightforward to verify 5 that which yields the useful compact expression J t (x, u) = 0<s≤t |x s − u|1 xs−,xs (u), u ∈ R, (2.8) which readily implies that J is a positive and increasing function. In particular, see Remark 2.7 below, L t (·)/2 + J t (·) ∈ L p (R) if and only if L t (·), J t (·) ∈ L p (R). Notice that x is bounded, since it is càdlàg, and L t (u) and J t (u) equal 0 if u does not belong to the Definition 2.4. We let L p ((π n ) n ) denote the set of all paths x ∈ Q((π n ) n ) having an occupation local time L and such that K t (x, ·) : There is no common agreement in the related literature in probability theory as to whether L or L/2 is to be called local time, cf. [20, Remark 6.4]; here we decided to follow the convention made in the standard textbook [31]. A classical approach to extend Itô's formula and, in particular, the "stochastic" integral t 0 f (x s− ) dx s to twice weakly differentiable functions f , is to approximate the function f by smooth functions, cf. [20, Theorem 3.6.22] for the case of Brownian motion. For this purpose we consider a "mollifier" ρ, i.e., a positive function ρ ∈ C ∞ (R) and such that ∞ −∞ ρ(u) du = 1, and set ρ n (u) := nρ(nu) for n ∈ N. Given a function f ∈ W 2,q (R) we approximate it via the convolution f n := ρ n * f . In this way, which does not depend on the choice of ρ, and the pathwise Tanaka-Meyer formula Because of Proposition 2.5, it is of interest to ask under which assumptions one can get that L t (x, ·) and J t (x, ·) are in L p (R). First, remark that, since both quantities are equal to 0 outside a compact, the p-integrability requirement in Definition 2.4 is a local one. Then, notice that if x ∈ Q((π n ) n ) has an occupation local time then L t , J t ∈ L 1 (R) (i.e., x ∈ L 1 ((π n ) n )), since This can be seen as a consequence of Minkowski's integral inequality and of the identity A similar bound for L can be given under the stronger assumption x ∈ L W p ((π n ) n ), see Definition 2.17 and equation (2.22) in the next subsection. Alternatively, if x ∈ L 1 ((π n ) n ), then p-summability for L, for p ∈ (1, ∞), is equivalent to: Notice that an occupation local time L is only unique up to equality a.e. 6 u for each t; in particular, L could be thought of as an equivalence class, and one is then led to look for good representatives. In particular, it is often of interest to have a version L which is càdlàg in t. This can be ensured along the same lines as standard results on càdlàg version of supermartingales since L s ≤ L t a.e. for any 0 Similarly, existence of a càdlàg version for J follows from the fact that J T (u) < ∞ for a.e. u, that x is càdlàg and that J t (x, ·), see (2.8), is defined using jumps of x up to and including time t. Remark 2.7. If x has an occupation local time L, then one can choose for each t ∈ [0, T ] a versionL t (·) of L t such thatL · (u) is positive, finite, càdlàg and increasing for each u ∈ R. Moreover, J · (u) is positive, finite and càdlàg increasing for a.e. u. In particular, it follows that L t (·), J t (·) ∈ L p (R) holds for every t ∈ [0, T ] if and only if L T (·), J T (·) ∈ L p (R).
It can also be useful to have right-continuity of L, J in the variable u. For J here is a simple criterion; for L, it has to be assumed: cf. Remark 2.15 below.
and so if 0<s≤t |∆x s | < ∞ for all t, then J t (x, ·) is càdlàg and of finite variation for all t ∈ [0, T ].
As an application of having a versionL of L which is càdlàg in t, notice that the occupation time formula (2.6) then extends to all positive Borel h = h(s, u) as follows Moreover, since J is càdlàg in t it also satisfies a restricted occupation time formula: and this observation seems to be new. 6 Here, and elsewhere unless otherwise specified, a.e. u is with respect to the Lebesgue measure.
Local times and Tanaka-Meyer formulae for càdlàg paths To facilitate the proof of Proposition 2.5, as well as for later use, let us recall some well known facts. A function g : R → R is convex iff its second distributional derivative g is a positive Radon measure. Thus f : R → R equals to the difference of two convex functions iff f is a signed Radon measure. We may then write f = g − h with g, h convex and |f | = g + h being the measure associated with the total variation of f , . Given such f , f denotes the left-derivative of f , which is left-continuous and of locally bounded variation and where we used integration by parts. For b < a, we get instead which can often be used in proofs in lieu of the following representation (2.14) Proof. From (2.12) we get consists only of positive terms, and the thesis follows from (2.15), summing over s ≤ t and applying Fubini's theorem. If instead f = g− h with g, h convex then |f | = g + h and, by assumption, R J t (x, u) |f |(du) < ∞. (2.14) follows again from Fubini's theorem. The absolute convergence of the series (2.3) follows writing summing the latter over s ≤ t and applying (2.14) to g and h. Remark 2.10. It follows from Lemma 2.9 and Hölder's inequality that, if J t (x, ·) ∈ L p (R) and f (du) = f (u) du with f ∈ L q (R), where p, q ≥ 1 are conjugate exponents, that is satisfy 1/p + 1/q = 1, then the series (2.3) defining J f t (x) is absolutely convergent. Moreover, if J t (x, ·) is bounded 8 then the series (2.3) is absolutely convergent for every f which is a difference of convex functions: indeed, J t (x, ·) = 0 outside a compact, and |f |(C) < ∞ for every compact C ⊆ R.
An alternative, possibly more intuitive but also more cumbersome, way of getting (2.15) is to define which is in L 1 (R), equals zero outside a compact, and has distributional derivatives (2.4), the definition of occupation local time L and of K := L/2 + J, and Lemma 2.9, it follows that and taking limit as n → ∞, the right-hand side converges to ). It follows that the LHS converges as well.
Remark 2.12. One can recover a continuous in time, for a.e. level u, versionL of the occupation time L from knowing just a jointly measurable function K t (u) such that K · (u) is càdlàg increasing for a.e. u, (2.5). Indeed,L · (u) (resp. J · (u)) is the continuous (resp. purely discontinuous) part of the increasing càdlàg function K · (u). To show this, consider that for f ∈ C 2 (R) Föllmer's formula (2.4), (2.16) and Lemma 2.9 give that where K c (resp. K d ) denotes the continuous (resp. purely discontinuous) part of K · (u). In each of the two above representations of the càdlàg increasing function K f t the first term is continuous and the second purely discontinuous, so by uniqueness of such decomposition holds for any g of the form f , i.e., for any continuous g; but then it also automatically holds for any Borel g, so 2K c is an occupation local time of x and J t = K d t a.e. u for each t; since J t and K d t are càdlàg in t, J t = K d t a.e. u for all t. Remark 2.13. For continuous paths x the above approximation argument can be used to obtain space-time Tanaka-Meyer formulae without relying on the representation (2.13), see [12]. Although elaborated in a probabilistic framework, the proofs in [12] are (primarily) of pathwise nature. Remark 2.15. If x has an occupation local time L, then one can give explicit formulae for L. Indeed, since L t (·) ∈ L 1 (R), taking lim ε↓0 of (2.6) applied to g : s , for a.e. u, meaning that the limit on the right-hand side exists for a.e. u ∈ R and is a version of L t (·). Analogously, if we can apply Tanaka-Meyer's formula to the convex function | · −u| we get the following expression for L: It is thus desirable to establish if (a version of) Proposition 2.5 holds in the case where f : R → R equals to the difference of two convex functions. This is the case under the additional assumptions that the mollifier ρ has compact support in [0, ∞), that J t (u) is càdlàg in u for all t (see Remark 2.8), and that there exists a versionL t of the pathwise local time L t which is càdlàg in u for all t (in particular, unlike in the stochastic setting, one cannot use (2.18) to prove that L has a version which is càdlàg in u for all t without running into circular arguments). Indeed, under these assumptions the proof of [9, Theorem 5.2] shows that R g(u) f n (du) → R g(u) f (du) for any càdlàg g, and if we apply this to g = K t the rest of the proof of Proposition 2.5 goes through. of times at which x jumps across 12 level u.

Local time via discretization
An alternative approach to achieve a pathwise Tanaka-Meyer formula goes back to Würlmi [36] and is based on a discrete version of the Tanaka-Meyer formula. For continuous paths x this approach is well-understood and led to several extensions, see [29,9,7]. One feature of this discretization argument is that the "stochastic" integral t 0 f (x s− ) dx s is still given as a limit of left-point Riemann sums, see also [8]. In the present subsection we generalize Würlmi's approach to the case of càdlàg paths x. Given a partition π = (t j ) n j=0 of [0, T ], we define the discrete level crossing time of x at u (along π) as the function Then, applying (2.12) to a = x ti∧t , b = x ti+1∧t and summing over i, we obtain the discrete version of Tanaka-Meyer formula (2.20) Taking limits along a sequence of partitions (π n ) n , with |π n | → 0, we obtain the following definition of L p -level crossing time. We note that it extends the previous works for continuous paths, e.g., [8,Definition B.3]. We also note that using the same notation K t as before will be justified by Proposition 2.19.
Definition 2.17. Let x ∈ D([0, T ]; R) and let (π n ) n be a sequence of partitions such converges weakly in L p (R) to K t for each t ∈ [0, T ] as n → ∞, and t → R K t (u) du is right-continuous. The set L W p ((π n ) n ) denotes all paths x ∈ D([0, T ]; R) having an L p -level crossing time along (π n ) n . Lemma 2.18. The level crossing time K in Definition 2.17 is increasing in t ∈ [0, T ], i.e., K s (·) ≤ K t (·) a.e. for each s ≤ t.
If s < t, analogously write Thus K π t − K π s − R π s,t = a m(π,s) (u) − |x s − u|1 xt m(π,s) ,xs (u) =: S s (π, u), and since R π s,t ≥ 0 the thesis follows once we prove that S s (π n , u) → 0 for every u when |π n | → 0. This holds since if m(n) := m(π n , s) then t m(n) and t m(n)+1 converge to s, and t m(n) < s ≤ t m(n)+1 , so a m(n) (u) and |x s − u|1 xt m(n) ,xs (u) both converge to |x s − u|1 xs−,xs (u) as n → ∞, since x is càdlàg. 12 More precisely, if the jump is downward, then x is allowed to jump from x s− = u. Notice that K t is only defined as an equivalence class. Using the same arguments as in the discussion preceding Remark 2.7, for each t we can take the version of K t such that the resulting process is càdlàg increasing in t for each u. From now on, we will always work with such a version and we let K c (resp. K d ) denote the continuous (resp. purely discontinuous) part of the increasing càdlàg function K · (u).

Proposition 2.19.
Suppose that x ∈ L W p ((π n ) n ) for p, q ∈ [1, ∞], with 1/p + 1/q = 1, and let K be the L p -level crossing time of x along (π n ) n . If f ∈ W 2,q (R), then the following limit exists (and is finite)  Remark 2.20. Following the seminal paper [14], we consider the "stochastic" integral as limit of left-point Riemann sums (2.21) and not as limit of In a probabilistic setting, where x is assumed to be a semimartingale, these limits coincide with the classical Itô integral almost surely (see [31, Chapter II.5, Theorem 21]) and so they are equal. In the present pathwise setting however, they could be different.

Remark 2.21.
Applying Minkowski's integral inequality and using the identity (2.11), we obtain that if p ∈ [1, ∞) and C p := 1/(p + 1) 1/p , then In particular, if x ∈ L W p ((π n ) n ), then the occupation local time L equals 2K c and so

Remark 2.22.
Given the definition of J t (u), it seems natural that, if x ∈ L W p ((π n ) n ) and J π t (u) := ti∈π(t) particular, K π n t − J π n t converges weakly in L p (R) to K c t . Indeed, if f ∈ L q (R), (2.12) gives J f,π n t := so by Lemma 2.9 L d t = J t a.e.

Local time via normalized numbers of interval crossings
In Proposition 2.5 above we approximated f with regular functions f n for which the "stochastic" integral A solution to the above Skorokhod problem exists and is unique, see [28, Proposition 2.7], and its properties are well studied in the literature, see, e.g., [22,4]. Let us emphasise that for any ε > 0, x ε is a càdlàg and piecewise monotonic path of bounded variation, which uniformly approximates x with accuracy ε/2. While f • y is of finite variation for all y : [0, T ] → R which are of finite variation if and only if f is locally Lipschitz (see [24]), we can nonetheless assert that f (x ε ) is of finite variation for any f ∈ W 2,q (R), because x ε is a special function of finite variation: it is piecewise monotonic, i.e., there exists a partition 0 = a 0 < a 1 < . . . < a N +1 = T of [0, T ] s.t. x ε is either increasing or decreasing on each I i , where 13 see [28, formula (2.4)], where even a more general Skorokhod problem is considered.
Thus, keeping in mind integration by parts for the Lebesgue-Stieltjes integral, for ε > 0 and f ∈ W 2,q (R), q ≥ 1, we can define  R z → J t (x n , z), n ∈ N, defined by formula (2.8), converges weakly in L p (R) to J t (x, ·) as n → ∞.
The corresponding pathwise Tananka-Meyer formula reads as follows.

Proposition 2.25.
Suppose that x ∈ L S p ((c n ) n ) for p, q ≥ 1 with 1/p + 1/q = 1. If f ∈ W 2,q (R), then the following limit exists and is finite where the right-hand side is defined using (2.24), and the pathwise Tanaka-Meyer formula  Proof. We can w.l.o.g. assume that I = R, since otherwise we can trivially extend x to R in a way that R \ I has dx mass 0. We have to prove that the dx null set E := R \ F is also a dg(x) null set. Denote with L the Lebesgue measure on R. Let y be càdlàg monotonic, so if I, J ⊆ R are intervals with disjoint interiors, then so are y(I), y(J) (even if I ∩ J = ∅ does not imply y(I) ∩ y(J) = ∅). Set s(y) := 1 (resp. = −1) if y is increasing (resp. decreasing). Since holds (by definition of dy) when A is an interval, it holds whenever A ⊆ R is a countable union of intervals (I n ) n with disjoint interiors (because the interiors of (y(I n )) n are disjoint).
Fix arbitrary ε > 0 and recall that there exists a δ > 0 s.t. L(V ) ≤ δ implies 1 V dg = L(g(V )) ≤ ε whenever V is a finite union of intervals with disjoint interiors (by definition of absolute continuity), and thus whenever V is a countable union of intervals with disjoint interiors.

Now cover E with an open set
is a countable union of intervals with disjoint interiors we get L(g(x(A))) ≤ ε, and so (2.26) with y = g(x) gives | 1 A dg(x)| ≤ ε. Thus | 1 E dg(x)| ≤ ε for any ε > 0, concluding the proof.
As f ∈ W 2,q (R), f can be decomposed as the difference of two increasing AC (Absolutely Continuous) functions; since the result we want to prove is linear in f , we can assume w.l.o.g. that f is increasing and AC. Moreover, since x (as defined on [0, t]) is bounded, and the result only depends on the behaviour of f on [inf x, sup x], we can additionally assume w.l.o.g. that f has compact support. As the proposition holds trivially for affine functions, thanks to (2.13) we may further assume that Let us consider the integral x n s df (x n s ). (2.28) To calculate the first integral we use the properties of f and x n . Recall that the positive (resp. negative) part of dx n is concentrated on {x−x n = c n /2} (resp. {x − x n = −c n /2}). Thus, the identity , I) , (2.29) holds if I is the interior of an interval on which x n is increasing (resp. decreasing), by Lemma 2.26, and if I is a singleton, since in that case it reduces to the identity Since x n is piecewise monotonic, we conclude that (2.29) holds for I = [0, t].
Using (2.27), (2.28) and (2.29), we finally arrive at Let us note that the right side of (2.29) may be also calculated using the following generalisation of the Banach indicatrix theorem: of which we will not make use, and which can be proved similarly to [26,Remark 1.4]. Moreover, the relationship clearly holds for any monotonic h : I → R defined on an open interval I, and thus holds for any completely monotonic h.

Thus, equation (2.30) may be rewritten as
which, thanks to (2.31), (2.32), takes the form (2.33) EJP 26 (2021), paper 77. Now we will compute an alternative expression for t 0 x n s df (x n s ). Since x n and f (x n · ) have finite total variation the rules of the Lebesgue-Stieltjes integral (integration by parts and the substitution rule) apply here and we have (2.36) Finally, equating the RHS of (2.36) and (2.33) we get where the last equality follows from the first assumption in Definition 2.24. Also, by the second assumption in Definition 2.24 and Lemma 2.9 The last two limits together with (2.37) give the thesis.

Remark 2.27.
To apply Proposition 2.25 we need to know when J t (x n , ·) converge weakly in L p (R) to J t (x, ·) ∈ L p (R) and c n · n ·,cn (x, [0, t]) converges weakly in L p (R) to some L t ∈ L p (R). However, in general, it is not even clear when c n · n ·,cn (x, [0, t]) and J t (x n , ·) belong to L p (R) although we now give some sufficient criteria. If for some r > 0, the r-variation is finite, i.e., then c n · n ·,cn (x, [0, t]) is bounded (and is equal 0 outside a compact subset of R) and thus belongs to L p (R) for all t ≤ T . It follows from the easy estimate: for any z ∈ R Unfortunately, this observation does not yield any condition which guarantees L t ∈ L p (R), except in the rather trivial case r ≤ 1.
Similarly as in Remark 2.6 we have that if p ∈ [1, ∞) and 0<s≤t |∆x s | 1+1/p < ∞ then J t (x n , ·), J t (x, ·) ∈ L p (R): this follows from Minkowski's inequality and the fact that for any s > 0, |∆x n s | ≤ |∆x s | (see [28, (2.5)] or [25,Section 2]). Since x n → x uniformly, there exists c ∈ R s.t., for all s ∈ [0, t], Now let q be s.t. 1/p + 1/q = 1, and fix any f ∈ W 2,q (R) and s ∈ [0, t]. Since f is locally integrable, it follows from (2.38) and the dominated convergence theorem that We can then apply again the dominated convergence theorem to obtain weak convergence of J t (x n , ·) to J t (x, ·) in L p (R), using the domination which follows from the estimate |∆x n s | ≤ |∆x s |, Hölder's inequality and (2.11).

Construction of local times for càdlàg semimartingales
The purpose of this section is to give probabilistic constructions of the pathwise local time, as introduced in Definitions 2.4, 2.17 and 2.24, for càdlàg semimartingales. In particular, we show that all three definitions agree a.s. and coincide with the classical probabilistic notion of local times for càdlàg semimartingales.
In the following we denote by L p (µ) the L p -space with respect to a measure µ. If π = (τ k ) k∈N , where τ k are [0, ∞]-valued random variables such that τ 0 = 0, τ k ≤ τ k+1 with τ k < τ k+1 on {τ k+1 < ∞}, and lim k→∞ τ k = ∞, then π is called a random partition. If moreover {τ k ≤ t} ∈ F t for all k, t, then π is called an optional partition. We recall K π s was defined in (2.19). The following is the main theorem of this subsection. Theorem 3.1. Assume that f : R → R is a difference of two convex functions, (π n ) n are optional partitions of [0, ∞) such that |π n ∩ [0, t]| → 0 a.s. for all t and X = (X t ) t∈[0,∞) is a càdlàg semimartingale. Then, there exists a subsequence (n k ) k such that, for ω outside of a P-null set (which may depend on f ), Remark 3.2. Theorem 3.1 says that the pathwise crossing time K π n · (X · , u) sampled along optional partitions (π n ) n (defined applying (2.19) to each path X · (ω) and partition π n (ω)) converges to K(u). Applying Theorem 3.1 with f (x) = x 2 /2 gives in particular that P(dω)-a.e. X(ω) ∈ L W p ((π n k ) k ) ⊂ L p ((π n k ) k ) for all p < ∞ and T > 0, i.e., the L p -level crossing time and the occupation local time exist for a.e. paths of a semimartingale.
Indeed, K π n k t (X, ·) → K t (·) strongly (and thus weakly) in L p (R) for a.e. ω, locally uniformly in t.
To prove the previous theorem we need some preliminaries. Given p ∈ [1, ∞) we denote by S p the set of càdlàg special semimartingales X which satisfy is the quadratic variation of the martingale Y , and |V | t is the variation up to time t of the predictable process (V t ) t∈[0,∞) . We recall the existence of c p < ∞ such that the holds for all local martingales X (this being one side of the Burkholder-Davis-Gundy inequalities), and thus also trivially extends to all X ∈ S p . The core of Theorem 3.1 is the following more technical statement.
, u ∈ R, then, for every u ∈ R, h π n (u) → 0 as n → ∞ and 0 ≤ h π n (u) ≤ c p X S p for all n ∈ N.
14 Recall the identity (2.7) and notice that the notations used in [31]  As discussed in detail in [9] after Theorem 6.2, for a continuous process X and properly chosen (π n ) n the convergence of K π n · (X · , u) is closely related to the number of upcrossings of X from the level u to the level u + ε n > u. While stronger versions of the above theorems have already appeared in the case of continuous semimartingales (the strongest being [23, Theorem II.2.4]), in the càdlàg setting we were only able to locate in the literature a version of Theorem 3.1 where, under the strong assumption that s≤t |∆X s | < ∞ a.s., the L p (|f |(du)) convergence is replaced by pointwise convergence for all but countably many values of u, see [23,Theorem III.3.3]. Thus, compared to the literature, our method provides a novel strong conclusion, with the benefit of a simple proof. Other differences are that we consider the crossing time instead of the number of upcrossings, and we use any optional partitions such that |π n | → 0 instead of "Lebesgue partitions" (in the language of [9]).
Proof of Proposition 3.3. Consider the convex function f (x) := |x − u| and let us take its left-derivative sign(x − u) and its second (distributional) derivative 2δ u . Subtracting from the discrete-time Tanaka-Meyer formula (2.20) its continuous-time stochastic counterpart (3.1) and considering the process K π n t (u)(ω) := K π n t (X · (ω), u) we obtain where for π n = (τ n i ) i by H π n and H(u) we denote the predictable processes To this end fix n and u and notice that from H π n s (u) = sign(X τ n i − u), for i such that τ n i < s ≤ τ n i+1 and |π n ∩ [0, t]| → 0 a.s. for all t it follows that H π n s (u) → H s (u) a.s. for all s. Since |H π n s (u) − H s (u)| ≤ 2, it follows that · 0 H π n s (u) dX s → · 0 H s (u) dX s in S p (by the dominated convergence theorem) and that h π n (u) ≤ c p 2 · 0 (H π n s (u) − H s (u)) dX s S p ≤ c p X S p for all u ∈ R, concluding the proof. (X · (ω), u) − K t (u, ω)| and G m n := 1 {T <τm} G n . Since µ i is a finite measure, Proposition 3.3 implies that, as n → ∞, G m n converges to 0 in L p (P × µ i ) for all m, i ∈ N and T ≥ 0. By Fubini's theorem ||G m n || L p (µi) converges to zero in L p (P), and so passing to a subsequence (without relabelling) we find that, for every ω outside a P-null set N p,T i,m , ||G m n (ω, T, ·)|| L p (µi) → 0. Then along a diagonal subsequence we obtain that G m n (ω, T, ·) converges to 0 in L p (µ i ) EJP 26 (2021), paper 77.
for all i, m, p, T ∈ N\{0} for every ω outside the null set N f := ∪ i,m,T,p∈N\{0} N p,T i,m . Since G n = G m n on {T < τ m }, G n → 0 in L p (µ i ) for all i, p, T ∈ N \ {0} for every ω outside N f . Since outside a compact set G n (ω, T, ·) = 0 for all n, convergence in L p (µ i ) for arbitrarily big i, p implies convergence in L p (|f |(du)) for all p ∈ [1, ∞). Since G n (ω, ·, u) = 0 is increasing, convergence for arbitrarily big T implies convergence for all T ∈ [0, ∞).

Local times via interval crossings
Recall the definition of L p -interval crossing local time of a deterministic path along a sequence of positive reals tending to 0 in Definition 2.24. In this subsection we prove the following theorem. Theorem 3.4. Let X = (X t ) t∈[0,∞) be a càdlàg semimartingale and T > 0. There exist a P-null set E such that for any ω ∈ Ω \ E and any sequence of positive reals (c n ) n∈N which converges to 0, x t = X t (ω), t ∈ [0, T ], belongs to L S 1 ((c n ) n∈N ) and for any t ∈ [0, T ] the L 1 -interval crossing local time of x along (c n ) n∈N , L t , coincides (in L 1 (R)) with the classical local time of X, L t .
We note a difference in the above result when compared with Theorem 3.1. In the former, we obtained pathwise convergence on a subsequence and outside a null set which depended on the discretisation, i.e., on the optional partitions (π n ) n of [0, ∞). Here, the method of discretisation is fixed and implicit in the Skorokhod problem, however we are able to obtain pathwise convergence, outside of a common null set E, simultaneously for all sequences (c n ).
As noted already after the statement of Proposition 3.3, a similar result was proven in [23,Theorem III.3.3], namely that for any càdlàg semimartingale X, as c → 0, c · n u,c (X, [0, t]) → L u t a.s. for all but countably many u ∈ R, where n u,c was defined in (2.25). However this was only established for semimartingales whose jumps are a.s. summable, i.e., 0<s≤t |∆X s | < ∞ for any t > 0. L u t du, t ∈ [0, ∞).
Theorem 3.5. Let X = (X t ) t∈[0,∞) be a càdlàg semimartingale and L u t , t ≥ 0, u ∈ R, its local times. If (d k ) k∈N is a sequence of positive reals such that k∈N d k < ∞ then R |Q z,d k t | dz → 0 P(dω)-a.e. as k → ∞, (3.4) and if X ∈ S 2p for p ∈ [1, ∞) and |X| is bounded by a constant then for any t ∈ [0, ∞) Let us now prove Theorem 3.4; the rest of the subsection will be devoted to the proof of Theorem 3.5.