A maximal function approach to two-measure Poincar\'e inequalities

This paper extends the self-improvement result of Keith and Zhong in [16] to the two-measure case. Our main result shows that a two-measure $(p,p)$-Poincar\'e inequality for $1<p<\infty$ improves to a $(p,p-\varepsilon)$-Poincar\'e inequality for some $\varepsilon>0$ under a balance condition on the measures. The corresponding result for a maximal Poincar\'e inequality is also considered. In this case the left-hand side in the Poincar\'e inequality is replaced with an integral of a sharp maximal function and the results hold without a balance condition. Moreover, validity of maximal Poincar\'e inequalities is used to characterize the self-improvement of two-measure Poincar\'e inequalities. Examples are constructed to illustrate the role of the assumptions. Harmonic analysis and PDE techniques are used extensively in the arguments.


Introduction
Let X = (X, d, ν, µ) be a metric space equipped with two Borel measures µ and ν, and let 1 ≤ q, p < ∞. In this work we are interested in properties of the two-measure (q, p)-Poincaré inequalities We say that the space X supports a two-measure (q, p)-Poincaré inequality, if there is a constant C > 0 such that inequality (1) holds for all balls B in X whenever u is a Lipschitz function in X and g is a p-weak upper gradient of u; see Sections 2 and 4 for the relevant definitions. An interesting feature of these inequalities is that they are often self-improving: a (q, p)-Poincaré inequality implies a similar inequality for other values of the parameters p and q. By Hölder's inequality, we can increase p and decrease q. Thus the actual self-improvement concerns the opposite directions. Next we recall some of the known results.
In the one-measure case µ = ν, Haj lasz and Koskela showed in [13] that if µ is doubling and X supports a (1, p)-Poincaré inequality, then there exists q 0 > p such that X supports a (q, p)-Poincaré inequality for every 1 ≤ q ≤ q 0 . The other direction, which is more delicate, was settled by Keith and Zhong in [16], where they proved that if X is complete, µ is doubling, and X supports a (1, p)-Poincaré inequality for some 1 < p < ∞, then there exists ε 0 > 0 such that X supports a (1, p − ε)-Poincaré inequality for 0 < ε ≤ ε 0 . In the scale of Lipschitz functions, the proof of [16] also works in non-complete geodesic spaces. Recently, new proofs and extensions for the Keith-Zhong result have been given in [6,8,17]. In many respects this paper is a continuation of the work initiated in [17].
In the two-measure case, the improvement on the left-hand side of (1) follows from the results that have been established in various settings in a series of papers by Franchi, Mac-Manus, Pérez, and Wheeden [10,19,11]. These works also discuss the question how to obtain weighted Poincaré inequalities from non-weighted inequalities. A particular consequence of the results in [19] is that if µ and ν are doubling measures and X supports a two-measure (1, p)-Poincaré inequality, and moreover for some q ≥ p the measures µ and ν satisfy the balance condition whenever the balls B and B ′ = B(x ′ , r ′ ) are such that x ′ ∈ B and 0 < r ′ ≤ diam(B), then X supports also a two-measure (q, p)-Poincaré inequality, but possibly with slightly larger balls on the right-hand side of (1). The above balance condition was introduced and applied by Chanillo and Wheeden [4] in connection with two-weight Poincaré and Sobolev inequalities in the Euclidean space R n . Subsequently, this condition has appeared, for instance, in [3,9,5,2]. Our purpose in this paper is to study the self-improvement with respect to the right-hand side of (1) in a geodesic metric space X equipped with two measures µ and ν. More precisely, we start with a two-measure (p, p)-Poincaré inequality for 1 < p < ∞, and improve this into a (p, p − ε)-Poincaré inequality for some ε > 0, under certain additional conditions. To some extent, results in this direction could be obtained by combining the Keith-Zhong result on one-measure inequalities with the abstract weighted machinery in [10,19,11], but such a combination of two extensive theories easily distracts from the essential mechanisms behind the self-improvement, and it is also difficult to analyze dependencies of the relevant parameters. We propose a direct approach, where we use the assumed (p, p)-Poincaré inequality only once, and therefore our proof can be, for instance, used to track down a reasonable estimate for the constant in the resulting (p, p − ε)-Poincaré inequality. Moreover, the direct examination of the two-measure setting reveals several interesting new phenomena that are not clearly visible in the one-measure case.
The first new feature is that the balance condition (2), which is necessary for the validity of the two-measure (q, p)-Poincaré inequality (1) by Lemma 4.5, does not self-improve; see Example 3.6. This poses an additional restriction for the self-improvement of two-measure Poincaré inequalities, and in Example 4.6 we describe a situation where our other assumptions are satisfied, but a two-measure (p, p)-Poincaré inequality does not improve to a (p, p − ε)-Poincaré inequality for any ε > 0, since the (p, p − ε)-balance condition does not hold for any ε > 0. To obtain a better two-measure Poincaré inequality we thus need to assume an a priori stronger balance condition. As it turns out, a slight improvement given by a suitable bumbed balance condition, introduced by Lerner and Pérez in [18] for the Muckenhoupt weights, is sufficient for the improvement of two-measure Poincaré inequalities; see Definition 3.4, Theorem 3.5, and Theorem 6.1. In fact, many of our results have counterparts for Muckenhoupt weights; see Lerner and Pérez [18].
Another new feature in our approach is the introduction of the so-called maximal Poincaré inequalities, in which the left-hand side of (1) is replaced with an integral of a sharp maximal function. In the one-measure case, the corresponding maximal Poincaré inequalities are essentially equivalent to the usual Poincaré inequalities; in fact, the maximal Poincaré inequalities have been used as a tool in the proofs of the self-improvement results, for instance, in [16,17]. However, there is a difference between the usual and maximal Poincaré inequalities in the two-measure case. More precisely, the maximal Poincaré inequalities often enjoy certain self-improvement independent of the balance conditions; see Theorems 6.4 and 9.1 for details. This shows that the maximal Poincaré inequalities are strictly stronger than the usual two-measure Poincaré inequalities; cf. Example 6.5. Moreover, the validity of maximal Poincaré inequalities can be used to characterize the self-improvement of two-measure Poincaré inequalities; see Corollary 6.3 and Theorem 6.4.
The outline of the paper is as follows. In Section 2 we recall preliminaries related to (geodesic) metric two-measure spaces and Muckenhoupt weights. In Section 3 we introduce the (q, p)-balance condition and the bumped version of the (p, p)-balance condition. We also establish some basic relations between the balance conditions for different values of the parameters q and p (Proposition 3.3) and show that, under mild conditions, the bumped (p, p)-balance condition is equivalent to a (p − ε, p − ε)-balance condition for some ε > 0 (Theorem 3.5). This section is concluded with an example showing that the balance conditions do not always self-improve.
Usual two-measure Poincaré inequalities are introduced in Section 4, where we also prove the necessity of the (q, p)-balance condition for the two-measure (q, p)-Poincaré inequality. In Section 5 we define both the sharp maximal functions related to families of balls and the associated maximal Poincaré inequalities, and we also study the relation between usual and maximal Poincaré inequalities (Lemma 5.3). Section 6 then contains the statements of our main results: first Theorem 6.1 and Corollary 6.3 concerning the self-improvement of the two-measure (p, p)-Poincaré inequality, and then Theorem 6.4, which shows that maximal Poincaré inequalities with respect to a certain global maximal function always self-improve. The latter theorem also creates a link between the self-improvement of usual and maximal Poincaré inequalities. Besides the assumptions that X is geodesic and the measures µ and ν satisfy relevant balance conditions, in the main results of Section 6 we assume that ν is an A ∞ (µ) weighted measure (Definition 2.3) and the space X satisfies an independence property for the upper gradients (Definition 4.2).
The outlines of the proofs of our main results are given in Section 6, but these proofs rely on technical tools that are postponed to the final sections of the paper. First, in Section 7, we establish Theorem 7.1, which plays an important role in the proof of Theorem 6.1. This part is based on two-measure adaptations of the ideas from [17], but due to the subtle modifications that are needed we present most of the details. Finally, in Sections 8 and 9 we conclude the proof of Theorem 6.4. The main result needed for Theorem 6.4 is Theorem 9.1. In the proof of the latter theorem we need a somewhat curious Lipschitz extension, which does not decrease the global maximal function too much. Such an extension is constructed in Section 8. The idea is to first take the usual Whitney extention, and then modify it by adding suitable bumb functions which guarantee that the sharp maximal function of the modified extension is large enough. Theorem 9.1, which actually contains a stronger version of the most important implication in Theorem 6.4, is then stated and proved in the final Section 9.
Remark 1.1 (Tracking constants). The letter C is used to denote positive constants, whose dependencies can vary and whose value can change from one occurrence to another. Some of our self-improvement results are based on quantitative estimates and absorption arguments, where it is often crucial to track the dependencies of constants more carefully. For this purpose, we will use the following notational convention: C( * , · · · , * ) denotes a positive constant which depends at most on the parameters indicated by the * 's but whose actual value can change from one occurrence to another, even within a single line.

2.A. Metric two-measure spaces
We assume that X = (X, d, ν, µ) is a metric two-measure space equipped with a metric d and two positive complete Borel measures ν and µ, and satisfying #X ≥ 2. We also assume throughout this paper that 0 < ν(B) < ∞ and 0 < µ(B) < ∞ for all (open) balls B = B(x, r) = {y ∈ X : d(y, x) < r} ⊂ X with x ∈ X and r > 0, and that the measures ν and µ are doubling, that is, there are constants c ν , c µ > 1 such that for all balls B = B(x, r) in X. Here we use for 0 < t < ∞ the notation tB = B(x, tr). We remark that X is separable under these assumptions, see [1,Proposition 1.6]. Iteration of the doubling condition (4) for the measure ν shows that whenever B and B ′ = B(x ′ , r ′ ) are balls in X such that x ′ ∈ B and r ′ ≤ diam(B); see for instance [14, p. 31] and [1,Lemma 3.3]. The corresponding estimate holds for µ, as well. When A ⊂ X, we let 1 A denote the characteristic function of A; that is, 1 A (x) = 1 if x ∈ A and 1 A (x) = 0 if x ∈ X \ A. We use the notation for the integral average of u ∈ L 1 (A; dν) in a Borel set A ⊂ X with 0 < ν(A) < ∞. If 1 ≤ p < ∞ and u : X → R is a µ-measurable function, then u ∈ L p loc (X; dµ) means that for each x ∈ X there exists r x > 0 such that u ∈ L p (B(x, r x ); dµ), i.e., B(x,rx) |u(y)| p dµ(y) < ∞.

2.B. Geodesic two-measure spaces
Let X = (X, d, ν, µ) be a metric two-measure space, satisfying the assumptions in Section 2.A. By a curve we mean a nonconstant, rectifiable, and continuous mapping from a compact interval of R to X; we tacitly assume that all curves are parametrized by their arc-length. We say that X is a geodesic two-measure space, if any two distinct points in X can be joined by a curve whose length is equal to the distance between the two points.
A geodesic two-measure space X is connected, and therefore it holds for all balls B in X that Moreover, by the connectedness, there are constants C > 0 and σ > 0 such that whenever B and B ′ = B(x ′ , r ′ ) are balls in X such that x ′ ∈ B and r ′ ≤ diam(B). Again, a corresponding inequality holds for the measure µ as well. For the proof of inequality (7) we refer to [1,Corollary 3.8].
Lemma 2.1. Assume that X is a geodesic two-measure space and that A ⊂ X is a νmeasurable set. Then the function The following lemma, in turn, is [17,Lemma 2.5].

2.C. Muckenhoupt weights and weighted measures
Assume that X = (X, d, ν, µ) is a geodesic two-measure space. Let s ′ > 0 and σ ′ = σ > 0 be the exponents as in (5) and (7) for the measures µ and ν, respectively. It follows that there is a constant C > 0 such that whenever B and B ′ = B(x ′ , r ′ ) are balls in X such that x ′ ∈ B and 0 < r ′ ≤ diam(B). In our main results, we also need the following stronger version of this estimate. Definition 2.3. We say that ν is an A ∞ (µ)-weighted measure if there exist constants c ν,µ > 0 and δ > 0 such that inequality holds whenever B ⊂ X is a ball and A ⊂ B is a Borel set.
Let us justify the terminology that is used in Definition 2.3. If ν is an A ∞ (µ)-weighted measure, then ν is absolutely continuous with respect to µ and both of these measures are σ-finite by (3). By the Radon-Nikodym Theorem, there exists a non-negative Borel function w : for all Borel sets A ⊂ X, and so w belongs to the so-called Muckenhoupt class A ∞ (µ) in the sense of the following standard Definition 2.4. A Borel function w : X → R satisfying w(x) > 0 for µ-almost every x ∈ X and B w dµ < ∞ for all balls B ⊂ X is called a weight. We write w(A) = A w dµ if A ⊂ X is a Borel set and w is a weight.
We also need the corresponding classes for exponents 1 ≤ p < ∞.
Definition 2.5. Let 1 ≤ p < ∞. A weight w belongs to the Muckenhoupt class A p (µ), denoted w ∈ A p (µ), if there is a constant A > 0 such that, for every ball B in X, and B w dµ ess sup By [20, Chapter I, Theorem 15], it holds for every 1 < p < q < ∞ that Furthermore, the equality A ∞ (µ) = 1≤p<∞ A p (µ) is valid under our standing assumptions since the measure µ is doubling and µ(B(x, r)) increases continuously with r for each x ∈ X. The latter property follows from the assumption that X is geodesic; we refer to [20, Chapter I, Theorem 18] and [15,Proposition 11.5.3] for details.

2.D. Lipschitz functions
Let A ⊂ X and 0 ≤ κ < ∞. We say that a function u : for all x, y ∈ A .
The set of all Lipschitz functions u : A → R is denoted by Lip(A). That is, we have u ∈ Lip(A) if, and only if, u : A → R is κ-Lipschitz for some 0 ≤ κ < ∞.
We also say that a function u : X → R has bounded support, if the set {x ∈ X : u(x) = 0} is contained in some ball B in X.

Balance conditions
The following balance condition for measures was introduced in [4]. It is closely related to the two-measure Poincaré inequalities that are discussed in Section 4.
Definition 3.1. Let 1 ≤ q, p < ∞. We say that a metric (or a geodesic) two-measure space (X, d, ν, µ) satisfies a (q, p)-balance condition, if there is a constant C > 0 such that whenever B and B ′ = B(x ′ , r ′ ) are balls in X such that x ′ ∈ B and 0 < r ′ ≤ diam(B).
We call the (p, p)-balance condition simply p-balance condition; in this case inequality (13) is more conveniently written as where B and B ′ are as in Definition 3.1.
In the following example we consider the special case ν = µ.
Example 3.2. If X = R n is equipped with the standard Euclidean metric and two copies of the Lebesgue measure ν = L n = µ, then (X, d, ν, µ) satisfies a (q, p)-balance condition with q = np/(n − p) > p for all 1 ≤ p < n. More generally, let 1 ≤ p < ∞ and let X = (X, d, ν, µ) be a metric two-measure space such that ν = µ. Then, by inequality (5), there exists q > p such that X satisfies a (q, p)-balance condition. Furthermore, if 1 < p < ∞, then by Proposition 3.3(D) below we find that X satisfies a (p, p − ε)-balance condition for some ε > 0. This fact explains why the balance condition does not play a visible role in the Keith-Zhong self-improvement results for one measure Poincaré inequalities; cf. [16,8,17].
Next we establish some basic relations between different balance conditions. Below, the statement (q, p)-balance condition (or p-balance condition, resp.) means that X satisfies the respective balance condition. Proposition 3.3. Let 1 ≤ p, q < ∞, and assume that X = (X, d, ν, µ) is a connected metric two-measure space. Then the following statements hold: (A) A (q, p)-balance condition implies (λq, λp)-balance conditions for every λ ≥ 1.
Proof. During the proof of the proposition, we assume that B and B ′ = B(x ′ , r ′ ) are balls in X such that x ′ ∈ B and 0 < r ′ ≤ diam(B). (A) Taking inequality (13) to power 1/λ yields where C > 0 is the constant in the (q, p)-balance condition. Now the claim follows from the fact that diam(B ′ )/ diam(B) ≤ 2.
(C) This follows from the facts that B ′ ⊂ 4B and that both µ and ν are doubling measures, and thus satisfy inequalities (4).
(D) Let s ′ > 0 and σ ′ > 0 be the exponents as in (5) and (7) for µ and ν, respectively. We remark that such a σ ′ > 0 exists, since X is connected. Then we have, as in (8), that where the constants are independent of B ′ and B. Fix 0 < δ ≤ q − 1 and then choose 0 < ε ≤ p − 1 such that By the assumed (q, p)-balance condition and the fact that µ(B ′ ) ≤ c 2 µ µ(B), we thus obtain .
In some of our self-improvement results we need to assume a priori that X satisfies a slightly better balance condition than a p-balance condition. To this end, we define the notion of a bumped p-balance condition as follows.
The following result shows that under mild assumptions, a Ψ-bumped p-balance condition is equivalent to a (p − ε)-balance condition for some ε > 0.
The following example shows that a mere p-balance condition does not imply a (p − ε)balance condition. We will return to this example later in connection with Poincaré inequalities; cf. Example 4.6.
Example 3.6. Consider X = R n equipped with the standard Euclidean metric d and let µ be the n-dimensional Lebesgue measure L n on R n . Fix 1 < p < n and let w(x) = |x| −p if x ∈ R n \ {0}. Then the weight w belongs to the Muckenhoupt class A 1 (µ) ⊂ A ∞ (µ); see e.g. [21, p. 229]. We let ν be the w-weighted Lebesgue measure, that is, Then X = (X, d, ν, µ) is a geodesic two-measure space that satisfies the p-balance condition. Indeed, the p-balance condition can be established by considering the cases 0 ∈ 8B and 0 ∈ 8B separately and applying the A 1 (µ)-property of w in the former case; here the ball B ⊂ R n is as in Definition 3.1 with q = p.
On the other hand, by the A 1 (µ)-property of w, there is a constant c > 1 such that for all r > 0. Hence, if 0 < ε ≤ p − 1 and 0 < r ′ < r, it holds for balls B = B(0, r) and with constants independent of both B and B ′ . Keeping r fixed and letting r ′ → 0 shows that X = (X, d, ν, µ) does not satisfy a (p − ε)-balance condition for any 0 < ε ≤ p − 1.

Poincaré inequalities
Let 1 ≤ p < ∞ and let X = (X, d, ν, µ) be a metric two-measure space; recall Section 2.A. We say that a µ-measurable function g : holds for p-almost every curve γ : [0, ℓ γ ] → X; that is, there exists a non-negative Borel function ρ ∈ L p loc (X; dµ) such that γ ρ ds = ∞ whenever inequality (17) does not hold or is not defined. We refer to [1,14,15] for further information on p-weak upper gradients. The family D p (u) has the following minimality property: if u ∈ Lip(X), then there exists a p-weak upper gradient g u ∈ D p (u) such that g u ≤ g pointwise µ-almost everywhere if g ∈ D p (u); we refer to [1,Theorem 2.25]. This function g u is called the minimal p-weak upper gradient of u, and it is unique up to sets of µ-measure zero in X.
Let 1 < q ≤ p < ∞. If u ∈ Lip(X), then it is clear that D p (u) ⊂ D q (u). However, in general, it is not true that D p (u) ⊃ D q (u); see [7]. Therefore, in some of our results we need to explicitly assume that the following indepdence property is valid for a suitable exponent.
Definition 4.2. Let 1 < p < ∞. A metric two-measure space X has the p-independence property, if for all q ≥ p and for all u ∈ Lip(X) the minimal q-weak upper gradient h u ∈ D q (u) of u coincides µ-almost everywhere with the minimal p-weak upper gradient g u ∈ D p (u).
In other words, the p-independence property means that the minimal q-weak upper gradient of u ∈ Lip(X) is independent of q ≥ p. We emphasize that this property does not depend on the measure ν at all.
Let us provide some examples when a p-independence property holds.
is a complete metric two-measure space and the space Y = (X, d, µ, µ) supports a (1, p)-Poincaré inequality in the sense of the following Definition 4.4, then X has the p-independence property. This follows from [1, Corollary A.8, Theorem 4.15] and the fact that µ is doubling.
Definition 4.4. Let 1 ≤ q, p < ∞. We say that a metric two-measure space X = (X, d, ν, µ) supports a (q, p)-Poincaré inequality, if there exists a constant K q,p > 0 such that whenever B is a ball in X, and u ∈ Lip(X) and g ∈ D p (u).
If a connected metric two-measure space X supports a (q, p)-Poincaré inequality, then X also satisfies a (q, p)-balance condition. This follows from Lemma 4.5 below. The proof of this lemma follows the argument given in [4] for the special case X = R n . Note that the integration on the right-hand side of inequality (18) is taken over the whole space X.
holds whenever B is a ball in X, u ∈ Lip(X) has a bounded support, and g ∈ D p (u). Then X satisfies a (q, p)-balance condition.
Proof. We need to show that inequality (13) holds for all balls B and . By using inequalities (4) and (6), and [1, Lemma 3.7], we can furthermore assume that for some constant C(c ν ) > 0 only depending on c ν . (This reduction is straightforward but slightly tedious to establish, and hence we leave the details to the interested reader.) Let ϕ : X → R be the 1/r ′ -Lipschitz function that is defined for all y ∈ X by . Define a Lipschitz function u : X → [0, ∞) with bounded support by setting u(y) = d(y, x ′ )ϕ(y) for every y ∈ X. By the product rule [1, Theorem 2.15], On the other hand, by the assumed inequality (18), By combining the estimates above, we see that which is the desired inequality (13) with a constant C = C(q, p, c ν , c µ , C 1 ) > 0 independent of the balls B and B ′ .

Maximal Poincaré inequalities
In the light of Example 4.6, it is clear that Poincaré inequalities in metric two-measure spaces are not always self-improving. In this section we introduce slightly stronger variants of Poincaré inequalities, which turn out to be more amenable to self-improvement. These maximal Poincaré inequalities are defined in terms of the following sharp maximal functions.
Definition 5.1. Let 1 ≤ q < ∞. If B = ∅ is a family of balls in a metric two-measure space X = (X, d, ν, µ) and u : X → R is a Lipschitz function, then we define a sharp maximal function x ∈ X .
The supremum above is defined to be zero, if there is no ball B in B such that x ∈ B.
We remark that if u : X → R is a κ-Lipschitz function, then M ν,q B u(x) ≤ κ for every x ∈ X. This fact follows from the estimate When B 0 ⊂ X is a fixed ball, we will often use the sharp maximal function M ν,q which we call the family of balls associated with B 0 . This family is needed, for instance, in the following definition of the so-called maximal Poincaré inequalities.
Definition 5.2. Let 1 ≤ q, p < ∞. We say that a metric two-measure space X = (X, d, ν, µ) supports a maximal (q, p)-Poincaré inequality, with a constant C > 0, if for every ball B 0 ⊂ X it holds that whenever u ∈ Lip(X) and g ∈ D p (u), where B 0 is the family (19) of balls associated with B 0 .
The following lemma yields basic relations between Poincaré type inequalities and their maximal analogues. Lemma 5.3. Let 1 < p, q < ∞ and assume that X = (X, d, ν, µ) is a metric two-measure space. If X supports a maximal (q, p)-Poincaré inequality, then there is a constant C > 0 such that whenever B is a ball in X and whenever u ∈ Lip(X) and g ∈ D p (u).
Proof. Assume first that X supports a maximal (q, p)-Poincaré inequality with a constant Inequality (20) follows from the above estimate, the doubling property (4) for µ, and the fact that B 0 = 2B. For the converse implication, we assume that X supports a (q, p − ε)-Poincaré inequality for some 0 < ε < p − 1 and with a constant K q,p−ε > 0. Fix a ball B 0 ⊂ X and let B 0 be again the associated family of balls, as above. Fix u ∈ Lip(X) and g ∈ D p (u) ⊂ D p−ε (u), and let x ∈ X be such that x ∈ B ∈ B 0 . Then, by the assumed (q, p − ε)-Poincaré inequality, Here M µ is the noncentered Hardy-Littlewood maximal operator with respect to measure µ; see e.g. [1, Section 3.2]. Hence, by using the definition of M ν,q B 0 u, we see that for all x ∈ X .
By the boundedness of the Hardy-Littlewood maximal operator in L p/(p−ε) (X; dµ), we find that From this estimate it follows that X supports a maximal (q, p)-Poincaré inequality.
Remark 5.4. Lemma 5.3 is sharp in the sense that a (p, p)-Poincaré inequality does not always imply a maximal (p, p)-Poincaré inequality; Example 6.5 below provides a concrete example of such a situation. We will use our main results to provide this example, and therefore the construction is postponed to the end of Section 6.

Main results
This section contains the main results of this work. First, in Section 6.A, we provide sufficient conditions for the self-improvement of (p, p)-Poincaré inequalities. The self-improvement properties of maximal Poincaré inequalities and their variants are presented in Section 6.B. The main lines of the proofs are also given in this section, but here we rely on some technical results whose statements and proofs are postponed to the final sections of this work.
Recall that we have as a standing assumption that µ and ν are doubling Borel measures in X; cf. Section 2.A. All other assumptions concerning the space X = (X, d, ν, µ) are stated separately in each of the following results.

6.A. Results for Poincaré inequalities
Under certain assumptions, a (p, p)-Poincaré inequality and a (p − τ )-balance condition, for some 0 < τ < p − 1, together imply a maximal (p, p − ε)-Poincaré inequality for some ε > 0. By Lemma 5.3, this can be viewed as a self-improvement result for Poincaré inequalities in geodesic two-measure spaces.
We begin with Theorem 6.1 below. It is a consequence of Lemma 6.2 and Theorem 7.1, whose rather technical formulation and lengthy proof are given in Section 7.
For the proof of Theorem 6.1, we need the following lemma.
Lemma 6.2. Let 1 < p < ∞ and assume that X = (X, d, ν, µ) is a geodesic two-measure space. Let B 0 ⊂ X be a ball and let B 0 be the family (19) of balls associated with B 0 . If u : X → R is a Lipschitz function and g u ∈ L p loc (X; dµ) is the minimal p-weak upper gradient of u, then inequality holds for µ-almost every x ∈ B 0 .
Proof. The proof of [17,Lemma 5.3] can be easily adapted to the present setting of two measures, yielding a proof of the claim; the main difference is that here ν is used to define M ν,p B 0 u, whereas µ is used to define p-weak upper gradients. That is, in [17, Lemma 5.3] we would have ν = µ.
We sketch the proof in the light of this difference. The first step is to write g = CM ν,p B 0 u for a suitable constant C = C(c ν ) > 0 in such a way that inequality |u(γ(0)) − u(γ(ℓ γ ))| ≤ γ g ds holds for every curve γ : [0, ℓ γ ] → B 0 . The doubling condition (4) for ν and chaining arguments are used here. It follows that g| B 0 is a p-weak upper gradient of u| B 0 with respect to B 0 . Since u : X → R is a Lipschitz function, we also see that g| B 0 ∈ L p (B 0 ; dµ). Inequality (21) follows from the fact that the restriction g u | B 0 is the minimal p-weak upper gradient of u| B 0 with respect to the ball B 0 ; we refer to [1, Lemma 2.23] for further details on this localization property.
Proof of Theorem 6.1. We define Ψ(t) = C b min{2 τ , t τ } if t > 0. Then Ψ : (0, ∞) → (0, ∞) is a bounded non-decreasing function. Moreover, by the (p − τ )-balance condition assumption, the space X satisfies the Ψ-bumped p-balance condition as in Definition 3.4. Fix a ball B 0 ⊂ X and let B 0 be the family (19) of balls associated with B 0 . Let u ∈ Lip(X) and let g u ∈ D p (u) be the minimal p-weak upper gradient of u. Since X has the (p − ϑ)-independence property, it will be enough to establish the maximal Poincaré inequality with respect to g u . Let k ∈ N, 0 ≤ ε < p − 1, and α = p/(2(s + p)) > 0 with s = log 2 c ν . By Theorem 7.1 in Section 7, Here the constant C 1 > 0 depends only on δ, p, c µ , c ν , c ν,µ and Ψ ∞ . We also remark that the left-hand side of (22) is finite, due to the fact that u is a Lipschitz function in X.
We now choose k ∈ N and 0 < ε 0 < min{ϑ, 1/k, p − 1} such that This allows us to absorb the first term on the right-hand side of (22) to the left-hand side; recall that this term is finite. By absorption and Lemma 6.2, we obtain that Here the constant C 3 > 0 is independent of the parameters B 0 , u and g u . Since X has the (p − ϑ)-independence property and ε 0 < ϑ, we conclude that X supports a maximal (p, p − ε)-Poincaré inequality for every 0 ≤ ε ≤ ε 0 .
Under certain conditions, we can now essentially characterize when a (p, p)-Poincaré inequality improves to a (p, p − ε)-Poincaré inequality. This characterization will be given in terms of balance conditions. Indeed, recalling Lemma 5.3, this is essentially the content of the following corollary, which is among our main results. Corollary 6.3. Let 1 < p < ∞ and let 0 < ϑ < p − 1. Assume that a geodesic twomeasure space X = (X, d, ν, µ) supports a (p, p)-Poincaré inequality 4.4 and has the (p − ϑ)independence property 4.2, and that ν is an A ∞ (µ)-weighted measure (Definition 2.3). Then the following conditions (A)-(C) are equivalent: (A) X satisfies a (p, p − τ )-balance condition for some 0 < τ < p − 1.
Proof. The two implications (A) =⇒ (B) and (B) =⇒ (C) follow from Proposition 3.3(C) and Theorem 6.1, respectively. Hence, it remains to prove the implication (C) =⇒ (A). By condition (C) with 0 < ε = ε 0 < p − 1 and Lemma 5.3, we see that there is a constant C > 0 such that inequality holds whenever B is a ball in X and whenever u ∈ Lip(X) and g ∈ D p−ε (u). By Lemma 4.5, we find that X satisfies a (p, p − ε)-balance condition. Condition (A) follows with τ = ε.

6.B. Results for maximal Poincaré inequalities
Let X = (X, d, ν, µ) be a geodesic two-measure space and let 1 < p < ∞. In addition to maximal Poincaré inequalities, we will also consider properties of the global maximal function M ν,p u = M ν,p X u with respect to the family of all balls in X. The novelty of the following result is the implication (C) =⇒ (D) which, in a certain sense, gives the self-improvement of global maximal Poincaré inequalities without assuming any a priori balance conditions. The proof of this implication is based on Theorem 9.1 from Section 9. In fact, Theorem 9.1 yields this particular implication under significantly weaker assumptions than those in Theorem 6.4. On the other hand, the following Theorem 6.4 has the advantage that it provides yet further conditions that -under the provided stronger assumptions -are all equivalent to any of the conditions (A)-(C) in Corollary 6.3. Hence, Theorem 6.4 both extends and complements Corollary 6.3; indeed, the assumptions of these results are identical. whenever u ∈ Lip(X) and g ∈ D p (u). (D) There are constants 0 < ε < p − 1 and C > 0 such that whenever u ∈ Lip(X) has a bounded support and g ∈ D p−ε (u).

Proof. The implication (A) =⇒ (B) is a consequence of Corollary 6.3.
Consider then the implication (B) =⇒ (C). Fix a point x 0 ∈ X. For every j ∈ N, we denote B j = B(x 0 , j) and that is, B j is the family of balls associated with B j . Fix u ∈ Lip(X) and g ∈ D p (u). Observe that M ν,p u(x) = lim whenever x ∈ X. By Fatou's lemma and condition (B), there is a constant C > 0, independent of u and g, such that Hence, we see that condition (C) is valid.
The implication (C) =⇒ (D) is a consequence of Theorem 9.1 and the assumption that X has the (p − ϑ)-independence property. Notice that we may require in Theorem 9.1 that ε 0 is such that 0 < ε 0 < ϑ. Theorem 9.1 then yields the claim (D) for all g ∈ D p (u), and by the independence property we conclude that the claim holds also for all g ∈ D p−ε (u).
It remains to prove the implication (D) =⇒ (A). Let 0 < ε < p − 1 and C > 0 be constants as in condition (D). Fix u ∈ Lip(X) with a bounded support and g ∈ D p−ε (u), and let B ⊂ X be a ball. By Definition 5.1 of M ν,p u = M ν,p X u and condition (D), we then obtain that By Lemma 4.5, we see that X satisfies a (p, p − ε)-balance condition, and thus X satisfies a (p − ε)-balance condition, by Proposition 3.3(C). That is, condition (A) holds with τ = ε.
We can now provide the example showing that a (p, p)-Poincaré inequality does not always imply a maximal (p, p)-Poincaré inequality.

Norm estimates for the sharp maximal function
Let X = (X, d, ν, µ) be a geodesic two-measure space and let 1 < p < ∞. In this section we are primarily interested in the localized sharp maximal function M ν,p B 0 u that is associated with the ball family Here and in the statement of Theorem 7.1, the set B 0 ⊂ X of localization is a fixed ball, and the case X = B 0 is allowed but then X is of course necessarily bounded. Let k ∈ N, 0 ≤ ε < p − 1, and α = p/(2(s + p)) > 0 with s = log 2 c ν . In addition, let B 0 ⊂ X be a fixed ball and let B 0 be the family (24) of balls associated with B 0 . Then inequality holds whenever u ∈ Lip(X) and g ∈ D p (u). Here we denote C(k, ε) = (4 kε − 1)/ε if ε > 0 and C(k, 0) = k. Moreover, the constant C 1 > 0 depends only on δ, p, c µ , c ν , c ν,µ and Ψ ∞ .
The proof of Theorem 7.1 is an adaptation of a corresponding proof in [17] for the case of a single measure µ = ν. However, many of the changes needed for the present setting of two measures are somewhat technical. For this reason, and also in order to make this work relatively self-contained, we provide most of the details below.
The proof of Theorem 7.1 is completed in Section 7.E. For the proof, we need preparations that are treated in Sections 7.A -7.D. At this stage, we already fix X = (X, d, ν, µ), p, K p,p , c ν,µ , δ, Ψ, k, ε, α, s, B 0 X, B 0 , and u as in the statement of Theorem 7.1. We refer to these objects throughout Section 7 without further notice. However, the p-weak upper gradient g ∈ D p (u) is not yet fixed at this stage.
Let us emphasize that the ball B 0 in the arguments below is further assumed to be a strict subset of X. That is, we will only focus on the case B 0 = X. However, if B 0 = X, then X is bounded and the following Whitney cover W 0 can be replaced with the singleton {Q = B 0 }. The other modifications in this easier special case are straightforward and we omit the details.

7.A. Whitney ball cover
We will need a Whitney ball cover W 0 = W(B 0 ) of B 0 X. This countable family with good covering properties is comprised of the so-called Whitney balls that are of the form Q = B(x Q , r Q ) ∈ W 0 , with center x Q ∈ B 0 and radius The 4-dilated Whitney ball is denoted by Q * = 4Q = B(x Q , 4r Q ) whenever Q ∈ W 0 . Even though the Whitney balls need not be pairwise disjoint, they nevertheless have the following standard covering properties with bounded overlap; cf. [1, pp. 77-78]: The facts (W3)-(W6) below for any Whitney ball Q = B(x Q , r Q ) ∈ W 0 are straightforward to verify by using inequality (6) and the assumption B 0 X; we omit the simple proofs. Here B 0 is the family (24) of balls associated with the fixed ball B 0 .
Observe that there is some overlap between the conditions (W4)-(W6). The slightly different formulations will conveniently guide the reader in the sequel.

7.B. Auxiliary maximal functions
We abbreviate M ν u = M ν,p B 0 u and denote The sets U λ are open in X. If E ⊂ X is a Borel set and λ > 0, we write U λ E = U λ ∩ E. The following lemma is [17,Lemma 4.12], which in turn is a variant of [12,Lemma 3.6].
We also need a certain smaller maximal function that is localized to Whitney balls. More specifically, for each Q ∈ W 0 , we first introduce the ball family 1 By using these individual maximal functions, we then define a Whitney ball localized maximal function 2 If λ > 0 and Q ∈ W 0 , we write The following Lemma 7.3 provides a norm estimate between the different maximal functions. Its purpose, roughly speaking, is to create space for the stopping balls in Section 7.C to expand, without losing their control in terms of M ν u. Controlling this expansion is the only purpose for introducing the different maximal function aside from The two measures ν and µ do not significantly interact in the proof of Lemma 7.3, and hence we omit the straightforward but tedious modifications that are needed for the proof.

7.C. Stopping construction
The following stopping construction is needed for each Whitney ball separately. Fix Q ∈ W 0 . The number serves as a certain treshold value. Fix a level λ > λ Q /2. We will construct a stopping family S λ (Q) of balls whose 5-dilations, in particular, cover the set Q λ ; recall the definition (26). As a first step towards the stopping balls, let B ∈ B Q be such that B ∩ Q = ∅. The parent ball of B is then defined to be π(B) = 2B if 2B ⊂ Q * and π(B) = Q * otherwise. Observe that since B ⊂ π(B) ∈ B Q and π(B) ∩ Q = ∅, the grandparent π(π(B)) is well defined, and so on and so forth. Moreover, by inequalities (4) and (6), and property (W3) if needed, we have ν(π(B)) ≤ c 5 ν ν(B) and diam(π(B)) ≤ 16 diam(B). Now we come to the actual stopping argument. We fix x ∈ Q λ ⊂ Q. If λ Q /2 < λ < λ Q , then we choose B x = Q * ∈ B Q . If λ ≥ λ Q , then by using the condition x ∈ Q λ we first choose a starting ball B, with x ∈ B ∈ B Q , such that We continue by looking at the balls B ⊂ π(B) ⊂ π(π(B)) ⊂ · · · and we stop at the first ball among them, denoted by B x ∈ B Q , that satisfies the following stopping conditions: The inequality λ ≥ λ Q in combination with the assumption B 0 X ensures that there always exists such a stopping ball. In both cases above, the chosen ball B λ x = B x ∈ B Q contains the point x and satisfies the inequalities Now, by using the 5r-covering lemma, we obtain a countable pairwise disjoint family of stopping balls such that Q λ ⊂ B∈S λ (Q) 5B. Let us remark that, by the condition (W4) and stopping inequality (27)

7.D. Auxiliary local results
This section contains two technical results: Lemma 7.4 and Lemma 7.5. Even though these lemmata are slight variants of their counterparts in [17], we provide all the details here. In particular, we develop novel comparison and balancing arguments which show how the measures ν and µ need to interact. Lemma 7.4 below is the only place in the proof of Theorem 7.1 where the Ψ-bumped pbalance condition is needed. This lemma is a two-measure counterpart of [17,Lemma 4.15]; see also [16,Lemma 3.1.2]. Recall that α = p/(2(s + p)) > 0 , with s = log 2 c ν > 0 .
Lemma 7.4. Let Q ∈ W 0 be a Whitney ball and let λ > λ Q /2. Then there exists a constant By Lemma 2.1 and the fact that B is open, h is continuous. Since h(r) = 1 for small values of r > 0 and h(r) < 1/2 for r > diam(B), there is 0 < r x ≤ diam(B) such that h(r x ) = 1/2.
Let G λ be a countable and pairwise disjoint subfamily of Then (29) and (30) hold for every ball B ′ ∈ G λ ; indeed, by denoting we have the following transition identities: where all the measures are strictly positive. These identities facilitate a transition of the domain of integration on the left-hand side of (28) from U 2 k λ B to B \ U 2 k λ B , and they are used several times in the proof below. Now, we multiply the left-hand side of (28) by diam(B) p and then estimate as follows: By (4) and Lemma 2.2, we find that ν( Hence, by the transition identities (31), This concludes our analysis of the 'easy term' on the right-hand side of (32). In order to treat the remaining term therein, we need some preparations. Fix a ball B ′ ∈ G λ that satisfies 5B ′ ∩B |u − u B ′ O ;ν | p dν = 0. By using Lemma 2.2 and the transition identities (31), we have ν( Hence, from the assumption that ν is an A ∞ (µ)-weighted measure, it follows that We also claim that with a constant C 2 = C(p, c ν , Ψ ∞ ). In order to prove this inequality, we fix a number m ∈ R such that We proceed with a case study. If m < k/2, then m − k < −k/2, and since always α < p/2, inequality (35) is obtained in this case by using inequality (6) and the assumed Ψ-bumped p-balance condition as follows: Next we consider the case k/2 ≤ m. By the transition identities (31) and Lemma 2.2, where the last step follows from condition (W5) and the fact that 5B ′ ⊃ B ′ O = ∅. From the choice of m we conclude that 2 mp ≤ 2 p+1 c 6 ν 2 kp . On the other hand, we have , where the last step follows from the fact that B ∈ S λ (Q) in combination with inequality (27). In particular, since s = log 2 c ν , by inequality (5) and Lemma 2.2 we obtain that ≤ 2 · 64 p 20 s c 14 ν 2 −mp ≤ 2 · 64 p 20 s c 14 ν 2 −kp/2 . This, together with inequality (6) and the Ψ-bumped p-balance condition, implies that here we also used the facts that α = p/(2(s + p)) and that the function Ψ is non-decreasing.
Combining the above estimates, we see that That is, inequality (35) holds also in the present case k/2 ≤ m.
By using Lemma 2.2 followed by inequalities (34) and (35), we can now estimate the second term on the right-hand side of (32) as follows, with a constant C 1 = C(δ, p, c ν , c ν,µ , Ψ ∞ ) > 0: Inequality (28) follows by collecting the above estimates.
Whereas the Ψ-bumped p-balance condition was only needed in the proof of Lemma 7.4, the following lemma is the only place in the proof of Theorem 7.1 where the (p, p)-Poincaré inequality is needed. Moreover, it is invoked one single time.
Lemma 7.5. Let Q ∈ W 0 be a Whitney ball. Then inequality holds for each λ > λ Q /2 and every g ∈ D p (u). Here Proof. Fix λ > λ Q /2 and g ∈ D p (u). By the doubling condition (4), Recall also that B ⊂ U λ Q * = U λ ∩Q * if B ∈ S λ (Q). Hence, by the fact that S λ (Q) is a pairwise disjoint family, it suffices to prove that there is a constant C 2 = C(δ, p, c ν , c ν,µ , Ψ ∞ ) > 0 such that inequality holds for every B ∈ S λ (Q). To this end, let us fix a ball B ∈ S λ (Q).
, which suffices for the required local estimate (37). Let us then consider the more difficult case µ(U 2 k λ B ) < (2c ν,µ ) −1/δ µ(B). The assumption that ν is an A ∞ (µ)-weighted measure implies that ν(U 2 k λ B ) < ν(B)/2. By the stopping inequality (27), Let us emphasize that the measure term on the left-hand side above is ν(B) instead of µ(B). The Ψ-bumped p-balance condition and the (p, p)-Poincaré inequality will be applied in order to transform this term, and thereby we will eventually end up with µ(B) on the left-hand side of (37). Actually, the ψ-bumped p-balance condition was already applied in Lemma 7.4. By that lemma, it clearly suffices to estimate the integral over the set B \ U 2 k λ = B \ U 2 k λ B ; observe that the ν-measure of this set is strictly positive.
Fix a number i ∈ N. Recall that B ⊂ Q * . Hence, it follows from Lemma 7.2 that the restriction u| B\U 2 i λ : B \ U 2 i λ → R is a Lipschitz function with a constant κ i = C(c ν )2 i λ. We use the McShane extension (12) and extend u| B\U 2 i λ to a function u 2 i λ : X → R that is κ i -Lipschitz and satisfies the restriction identity u 2 i λ | B\U 2 i λ = u| B\U 2 i λ .
We now define h(x) = 1 k 2k−1 i=k u 2 i λ (x) whenever x ∈ X. By conditions (D1)-(D3) in Section 4, we obtain that By applying these inclusions it is straightforward to show that the following pointwise estimates are valid in X, Now h ∈ Lip(X) coincides with u on B \ U 2 k λ . Recall also thatĝ ∈ D p (h). Hence, by the assumed (p, p)-Poincaré inequality, The desired local inequality (37) follows by combining the estimates above.
7.E. Completing the proof of Theorem 7.1 Recall that u : X → R is a Lipschitz function and that M ν u = M ν,p B 0 u. Fix a function g ∈ D p (u). Observe that the left-hand side of inequality (25) is finite since u ∈ Lip(X). Without loss of generality, we may further assume that it is nonzero. By Lemma 7.3, Observe also that At this stage, we fix a ball Q ∈ W 0 and write the corresponding integral as follows: Since Q λ = Q = Q 2λ for every λ ∈ (0, λ Q /2), we find that On the other hand, by Lemma 7.5, for each λ > λ Q /2, where C 2 = C(δ, p, c µ , c ν , c ν,µ , Ψ ∞ ) > 0. Since p − ε > 1, it follows that where By (W2) we have Q∈W 0 1 Q * ≤ C(c ν )1 B 0 . Hence, we can now continue to estimate as follows. First, Here the last upper bound is of the required form, since p − ε > 1. Second, Third, by using also Fubini's theorem, Combining the estimates above, we arrive at the desired inequality (25). This concludes the proof of Theorem 7.1, and hence we have now also completed the proof of Theorem 6.1.

Modified Lipschitz extension
We now turn to the proof of Theorem 6.4, related to the self-improvement of maximal Poincaré inequalities. The most important implication in Theorem 6.4, (C) =⇒ (D), is in fact a consequence of the more general Theorem 9.1, which we state and prove in the following Section 9. However, in the proof of the latter result we need to be able to extend Lipschitz functions in such a way that the extension does not decrease the global sharp maximal function too much, and thus we cannot immediately apply the McShane extension (12). The purpose of this rather independent section is to prove the technical Theorem 8.1 by constructing one example of a suitable extension. Nevertheless, we emphasize that the proof of Theorem 9.1 works for any Cλ-Lipschitz extension satisfying the crucial estimate (39) below.
Fix 1 ≤ p < ∞ and let M ν,p u = M ν,p X u be the maximal function of u ∈ Lip(X) with respect to the family X = {B ⊂ X : B is a ball} of all balls in X, as in (23).
Theorem 8.1. Let 1 ≤ p < ∞. Assume that X = (X, d, ν, µ) is a geodesic two-measure space and that u ∈ Lip(X) has a bounded support. Let λ > 0 and denote Then there exists a Cλ-Lipschitz function u λ : X → R such that u| X\U λ = u λ | X\U λ and for all x ∈ X \ U λ . Here the constant C = C(c ν , p) > 0 is independent of u and λ.
The rest of this section is devoted to the proof of Theorem 8.1. In Section 8.A we first construct a standard Whitney type Lipschitz extension v λ of u| X\U λ , which we then modify in Section 8.B in order to ensure that inequality (39) is valid. At the end of Section 8.B we collect all of the required estimates and provide a proof for Theorem 8.1. Most of Section 8.A is standard, but we provide several details -both for the convenience of the reader and as a background for Section 8.B.
At this stage, we fix a function u ∈ Lip(X) with a bounded support, a number λ > 0, and the corresponding level set U λ as in Theorem 8.1. Since the function u has a bounded support, it is straightforward to show that U λ is a bounded set. We will also need the fact that there is a constant C(c ν ) > 0 for which whenever x, y ∈ X. The proof of inequality (40) is based on a standard 'telescoping' argument; cf. [17,Lemma 4.12]. As a consequence of inequality (40), in the sequel we are allowed to assume that ∅ = U λ = X.

8.A. Standard Whitney extension
Since ∅ = U λ = X is an open set in X, it admits a Whitney ball cover; cf. Section 7.A. More specifically, there is a countable family W λ = W λ (U λ ) of Whitney balls Q ∈ W λ . These balls are of the form Q = B(x Q , r Q ) ∈ W λ , with x Q ∈ U λ and The 4-dilated Whitney ball is denoted again by Q * = 4Q = B(x Q , 4r Q ) whenever Q ∈ W λ , and as in Section 7.A, the Whitney balls have the following covering properties with bounded overlap: Moreover, the Whitney ball construction can be done in such a way that { 1 10 Q : Q ∈ W λ } is a pairwise disjoint family.
Next we construct a partition of unity with respect to the above Whitney balls. Fix Q ∈ W λ , and define a functionψ Q : X → [0, 1] by setting for each x ∈ X that Observe thatψ Q is (1/r Q )-Lipschitz,ψ Q = 1 in Q, andψ Q = 0 in X \ Q * . We then define a function ψ Q : The function ψ Q is well-defined, since, by (41), for each x ∈ U λ there is P x ∈ W λ such that x ∈ P x . Thusψ Px (x) = 1, and so we see that Lemma 8.2. There is a constant C = C(c ν ) > 0 such that the function ψ Q : Proof. Fix Q ∈ W λ and x, y ∈ U λ . Let us first consider the case x, y ∈ Q * . If P ∈ W λ and {x, y} ∩ P * = ∅, then it is straightforward to check that r P /2 ≤ r Q ≤ 2r P . Hence, by (41) and inequality 1 U λ ≤ P ∈W λψ P , we obtain that On the other hand, if x ∈ Q * and y ∈ Q * , then The case x ∈ Q * and y ∈ Q * is treated in a similar way. Finally, if x, y ∈ Q * , then the Lipschitz condition is trivially valid since |ψ Q (x) − ψ Q (y)| = 0.
The preliminary extension of u is now defined to be the function v λ : here we recall that u Q;ν = Q u(y) dν(y) for every Q ∈ W λ . By the above definition and the inequality in (41), it is clear that v λ : X → R is a well defined extension of u| X\U λ . In the following lemma we show that this extension is a Lipschitz function.
Proof. If x, y ∈ X \ U λ , then by inequality (40) we have Then we consider the case x ∈ U λ and y ∈ X \ U λ . Assume first that d(x, y) ≤ 2 dist(x, X \ U λ ), and let Q ∈ W λ be any Whitney ball such that ψ Q (x) = 0. Then x ∈ Q * , and so On the other hand, since d(x Q , x) < 4r Q , That is, we have r Q < d(x, y) < 264r Q . Since x ∈ Q * and d(x, y) < 264r Q , we find that y ∈ 268Q. Arguing as in [17,Lemma 4.12], we obtain that |u(y) − u Q;ν | ≤ |u(y) − u 268Q;ν | + |u 268Q;ν − u Q;ν | ≤ C(c ν )r Q M ν,p u(y) ≤ C(c ν )λd(x, y) whenever Q ∈ W λ is such that ψ Q (x) = 0. Hence, This concludes the proof of the lemma in the case when x ∈ U λ and y ∈ X \ U λ are such that d(x, y) ≤ 2 dist(x, X \ U λ ).
Next we treat the case when x ∈ U λ and y ∈ X \ U λ satisfy d(x, y) > 2 dist(x, X \ U λ ). Now there exists a point z ∈ X \ U λ such that d(x, z) ≤ 2 dist(x, X \ U λ ). Since d(x, z) < d(x, y) and d(z, y) ≤ d(x, z) + d(x, y) < 2d(x, y), we can resort to the already established cases as follows: The case x ∈ X \ U λ and y ∈ U λ follows from the preceding arguments via symmetry. It remains to consider the case x, y ∈ U λ . By symmetry, we may clearly assume that Denote d = dist(x, X \ U λ ) > 0. Now, if either one of the following two inequalities fails, then we are essentially done. Namely, if dist(y, X \ U λ ) < d/5, then Moreover, then there exists a point z ∈ X \ U λ such that d(y, z) ≤ 2d/5, and thus d(x, z) + d(z, y) ≤ d(x, y) + 2d(y, z) ≤ d(x, y) + 4d/5 ≤ 2d(x, y) .
On the other hand, if the second inequality in (46) fails, that is, if d(x, y) > d, then we first choose a point z ∈ X \ U λ such that d(x, z) < 2d. In this case we then have d(x, z) + d(z, y) ≤ 2d(x, z) + d(x, y) < 4d + d(x, y) < 5d(x, y) .
Having either inequality (47) or (48) for some z ∈ X \ U λ , we can always resort to the previously established cases in order to see that Therefore, it suffices to establish the Lipschitz property of v λ when both inequalities in (46) are valid. Denote B = B(x, 6d). Fix Q ∈ W λ such that {x, y} ∩ Q * = ∅ and let z ∈ {x, y} ∩ Q * . Then, by (45) and (46), we have In particular, by Lemma 8.2, the function ψ Q is (C/d)-Lipschitz with C = C(c ν ). By the second inequality in (46) we also have that Q ⊂ B. Fix a point w ∈ B \ U λ . Then By the previous estimates and (41), we can now proceed as follows: This concludes our treatment of the last case x, y ∈ U λ .

8.B. Modification of the extension
In Section 8.A we constructed a Cλ-Lipschitz extension v λ : X → R of u| X\U λ . We still need to modify this extension in the set U λ in order to ensure that inequality (39) becomes valid. This modification has to be done carefully, since we want the Lipschitz constant of the modified function u λ to be in control. Therefore, in some of the following arguments, we need to track the Lipschitz constants more quantitatively. For this purpose we introduce a new notation κ = Cλ, where C = C(c ν ) > 0 is the constant from Lemma 8.3. In particular, we then have Whenever such a quantitative tracking is not necessary, we resort to the usual notation Cλ. The number κ > 0 appears in the properties of the following bump functions. For each Q ∈ W λ , we let b Q : X → R be a function satisfying the following conditions (B1)-(B5): . The actual construction of b Q relies on the observation that if B = B(x, r) X is a ball, then there exists two disjoint balls B 1 = B(x 1 , r/4) ⊂ B and B 2 = B(x 2 , r/4) ⊂ B. This follows from the fact that X is a geodesic two-measure space. Now, the above observation with B = 1 10 Q gives us a ball Q ′ ⊂ 1 10 Q of radius r Q /40 such that ν(Q ′ ) ≤ 2 −1 ν( 1 10 Q). By applying the above observation again, but this time with B = Q ′ , we choose two disjoint balls With the aid of 160-Lipschitz functions ϕ Q,1 and ϕ Q,2 , both of which are zero in X \ Q ′ ⊃ X \ 1 10 Q, we then define a C(c ν )-Lipschitz function ϕ Q : X → R by setting Observe that Q ϕ Q dν = X ϕ Q dν = 0. In order to ensure that condition (B5) holds, we need to normalize the above function ϕ Q by defining where the constant C(c ν , p) > 0 is such that inequality X |ϕ Q | p dν ≥ C(c ν , p)r p Q ν(Q) holds. It is a tedious but straightforward task to check that the function b Q : X → R above satisfies all of the required properties (B1)-(B5). We leave further details to the interested reader.
We now define a function b = Q∈W λ b Q : X → R (50) that will be used to modify v λ in the set U λ . First, we record some basic properties of b.
Lemma 8.4. The function b is well defined in X and b = 0 in X \ U λ . Moreover, the function b is Cλ-Lipschitz in X with C = C(c ν , p) > 0.
Proof. The condition (B1) above and the second property in (41) are used several times below. First of all, they imply that b is well defined in X. Moreover, Hence b = 0 in X \ U λ . Finally, if x, y ∈ X, then and so b is Lipschitz in X with a constant C(c ν , p)λ > 0.
Finally, we define u λ : X → R, where v λ is defined by (44) and b is defined by (50). A combination of Lemma 8.3 and Lemma 8.4 shows that u λ : X → R is an C(c ν , p)λ-Lipschitz extension of u| X\U λ . It remains to show that inequality (39) holds for u λ . We begin this task by formulating and proving the following quantitative lemma that is an auxiliary result for Lemma 8.6.
The following lemma ensures that inequality (39) holds for the modified extension u λ .
Lemma 8.6. There is a constant C = C(c ν , p) > 0 such that for all x ∈ X \ U λ .
In the estimates for the other two terms on the left-hand side of (56) we often rely on Lemma 8.5, by which it suffices to establish an upper bound of the form C(c ν , p)λ p r p Q ν(Q); recall that κ = C(c ν )λ. Indeed, the right-hand side of the estimate in Lemma 8.5 is bounded from above by 2 p 1 10 Q |u λ − (u λ ) 2B;ν | p dν. As Q ⊂ B(y Q , 256r Q ) for some y Q ∈ X \ U λ , we easily obtain the desired upper bound for the integral term on the left-hand side of (56): Q |u − u Q;ν | p dν ≤ 2 p Q |u − u B(y Q ,256r Q );ν | p dν ≤ 2 p B(y Q ,256r Q ) |u − u B(y Q ,256r Q );ν | p dν ≤ 2 p M ν,p u(y Q ) p (512r Q ) p ν(B(y Q , 256r Q )) ≤ C(c ν , p)λ p r p Q ν(Q) . We still need to estimate the middle term on the left-hand side of (56). In the sequel we will assume that 1 < p < ∞. When p = 1 the arguments need trivial modifications that are omitted here. We observe that u λ = v λ in R Q = 1 10 Q \ S Q ; cf. the proof of Lemma 8.5. Therefore if p ′ = p/(p − 1), then by Hölder's inequality we obtain that ψ P (y) p ′ p/p ′ P ∈W λ y∈P * ν(Q)|u P ;ν − u Q;ν | p dν(y) .
We are now ready to finish the proof of the lemma. Recall that B \ U λ = ∅. Therefore Q ⊂ 2B if Q ∈ W λ intersects B. Hence, by (55) and (56), Now we choose 0 < ε 0 = ε 0 (C 2 , p) < p − 1 to be so small that εC 2 /(p − ε) < 1/2 for all 0 < ε ≤ ε 0 . Then we fix 0 < ε ≤ ε 0 and absorb the first term on the right-hand side above to the left-hand side. This absorbed term is finite by the assumed inequality (57) and the fact that g ∈ L p (X; dµ). We mention in passing that the integration in (60) is taken with t > 0 as a lower bound in order to ensure the finiteness of the absorbed term.