Harmonic functions on metric measure spaces

We introduce and study strongly and weakly harmonic functions on metric measure spaces defined via the mean value property holding for all and, respectively, for some radii of balls at every point of the underlying domain. Among properties of such functions we investigate various types of Harnack estimates on balls and compact sets, weak and strong maximum principles, comparison principles, the H\"older and the Lipshitz estimates and some differentiability properties. The latter one is based on the notion of a weak upper gradient. The Dirichlet problem for functions satisfying the mean value property is studied via the dynamical programming method related to stochastic games. We employ the Perron method to construct a harmonic function with continuous boundary data. Finally, we discuss and prove the Liouville type theorems. Our results are obtained for various types of measures: continuous with respect to a metric, doubling, uniform, measures satisfying the annular decay condition. Relations between such measures are presented as well. The presentation is illustrated by examples.


Introduction
Harmonic functions and the related Dirichlet problem are one of the most classical and fundamental subjects of studies in mathematical analysis and theory of PDEs. One studies harmonic functions and their generalizations in various settings and contexts, for instance in the Euclidean domains, on manifolds, in the setting of trees, also in Banach spaces. Recent two decades have been the period of an intensive development of yet another area of mathematics, the analysis on metric measure spaces. Its studies bring new approaches and sheds new light also on the theory of harmonic functions. The results due to Cheeger [4], Haj lasz [11], Heinonen-Koskela [18] and Shanmugalingam [30], to mention just few mathematicians contributing to the growth of the analysis on metric spaces, laid foundations for the first order Calculus and notions of gradient in metric spaces. See, for instance, a survey by Heinonen [17] for the panorama of the area and further references. Basing on the notion of the weak upper gradient one can study the minima of the Dirichlet energy obtaining counterparts of pharmonic functions and mappings in the metric setting with the harmonic case corresponding to p = 2, see e.g. Shanmugalingam [31]. Related is an approach based on the Cheeger derivative and a metric counterpart of the tangent space, see [4].
In this work we present another approach to harmonicity on metric measure spaces based on functions which satisfy the mean value property for all balls centered at the points of the given open set and contained in this set. Harmonic functions of such kind were introduced by Gaczkowski and Górka in [8]. Namely, in [8] the authors study locally integrable real-valued functions defined on an open subset Ω ⊂ X of a metric measure space (X, d, µ) requiring that the mean value property for f holds at every x ∈ Ω and for all balls B(x, r) ⋐ Ω: f (x) = 1 µ(B(x, r)) B(x,r) f (z)dµ(z).
In this work we call such functions strongly harmonic, see Definition 3.1. We continue investigations of their properties, as well as introduce the so-called weakly harmonic functions which are required to satisfy the mean value property only for at least one admissible radius at every point of an open set. Our definition is motivated by the classical and subtle investigations in the Euclidean setting due to e.g. Koebe, Volterra and Kellogg, Hansen and Nadirashvili, and Blaschke, Privaloff and Zaremba. We refer to Section 3 for a brief historical sketch of the studies on the size of the set of admissible radii sufficient to imply the harmonicity. In Preliminaries we introduce and recall some basic definitions of the metric analysis. In particular, we define continuity of a measure with respect to a metric, see Definition 2.1. Such a property has been important in the previous studies of harmonic functions, see [8] (also [10]). Moreover, we study some properties of a measure implying its continuity with respect to the given metric and notice that this condition gives us wide class of metric measure spaces. It turns out, for instance, that doubling measures in geodesic spaces have this property, see Proposition 2.1. Our studies involve various other types of measures, e.g. uniform measures and measures satisfying δ-annular decay condition for some δ ∈ (0, 1]. However, measures continuous with respect to a distance appear to be the most general among the aforementioned measures (see the discussion and the diagram following Proposition 2.1 in Preliminaries).
In Section 3 we bring on stage main characters of the paper, i.e. strongly and weakly harmonic functions, motivate their definitions and introduce some of their basic properties and natural relatives such as sub-and superharmonic functions. The latter two notions will play a vital role in the studies of the Dirichlet problem and the Perron method in Section 6. Furthermore, we study how to generate new sub-and superharmonic functions from the existing ones.
The key geometric and regularity properties of harmonic functions are presented and studied in Sections 4 and 5. We identify conditions implying continuity of strongly and weakly harmonic functions as well as we discuss various Harnack inequalities on balls and compact sets. This allows us to obtain important tools of the potential and geometric function theories, namely the weak and strong maximum principles, and the comparison principle. While for strongly harmonic functions such properties could be expected, the fact that they are also available in the setting of weakly harmonic functions might be surprising. Having established the aforementioned properties of harmonic functions, we show one of the main results of Section 4, namely the local Hölder continuity of strongly and weakly harmonic functions (i.e. Hölder continuity on compact subsets of an underlying domain), see Theorem 4.1. For strongly harmonic functions we prove this result for geodesic doubling measure spaces with the Hölder exponent depending on the doubling constant only, whereas for weakly harmonic functions we, additionally, require that a compact set K remains enough away from the boundary of the domain and the admissible radii for points in K are uniformly separated from zero and uniformly bounded from the above. The final topic studied in Section 4 is the Hölder and Lipschitz regularity of harmonic functions in spaces satisfying the so-called δ-annular decay property for some δ ∈ (0, 1] with the Lipschitz case corresponding to δ = 1, see e.g. Buckley [3]. Roughly speaking, such a property relates the measure of an annular ring to its thinness, cf. Definition 4.1. Moreover, it turns out that length doubling metric spaces have an annular decay property for some δ while a space with measure continuous with respect to a distance possesses 1-annular decay property. In Theorem 4.2 we provide the Hölder and Lipschitz estimates on balls and compact sets. By imposing stronger assumptions on measure than in Theorem 4.1 we are able to obtain finer estimates on balls already in the Hölder case, while on compact subsets we not only show the Hölder regularity as in Theorem 4.1 but also provide estimates with explicit constants and exponent δ. In the Lipschitz case not covered by Theorem 4.1 we also have explicit constants, however our estimates depend additionally on a Lebesgue number of a choosen covering. We continue studies of the regularity properties of harmonic functions in Section 5. There, we prove Lipschitz estimates in large scale, i.e. under assumptions that points are enough far away from each other. Then, we study uniform measures, i.e. such measures µ that every ball B of radius r > 0 satisfies µ(B) = C r Q , for given C > 0 and Q ≥ 1.
Uniform measures appear in geometric measure theory, for example in relation to the Marstrand theorem, in the studies of rectifiable measures and in the theory of incompressible flows in PDEs, see the discussion following Definition 5.1. Proposition 5.2 shows that in spaces with uniform measures strongly and weakly harmonic functions are locally Lipschitz. Moreover, we compute Lipschitz constants more accurately than in Theorem 4.2. In particular we avoid using a Lebesgue number of a covering. These observations allow us to complete the presentation in Sections 4 and 5 with differentiability results based on Cheeger's work [4]. In Corollaries 5.1 and 5.2 we describe conditions on metric measure spaces implying that strongly and weakly harmonic functions have weak upper gradients. The (1, p)-Poincaré inequality plays a crucial role for such results to hold. Section 6 is entirely devoted to studying the Dirichlet problem for harmonic functions and related Perron method. We address the following fundamental problems: whether there exists a function with given boundary data satisfying the mean value property inside the domain and whether it is unique, and if so how to construct such a function? In order to solve the first problem we take an approach based on the dynamical programming principle. The idea of this method originates from the stochastic games, especially tug-of-war games and related p-harmonious functions (see e.g. Manfredi, Parviainen and Rossi [24]), and is based on setting up an integral operator, iterating it and proving that such an iteration process converges to a function. We adapt method by Luiro, Parviainen and Saksman [23], recently developed for the Euclidean domains, in the metric setting. According to our best knowledge such an approach to the Dirichlet problem on metric spaces is new in the literature. In Theorem 6.1 we show that given a domain and a measurable boundary data one obtains a function which satisfies the mean value property with respect to exactly one radius at every point of the domain, provided that this point is enough far away from the boundary. Moreover, such a solution satisfies the boundary data condition. Furthermore, Theorem 6.2 extends the previous result to the setting of continuous boundary data. We also prove that if a Dirichlet problem has a continuous subharmonic solution, then it has the weakly harmonic solution with the same continuous boundary data, see Theorem 6.3. The Dirichlet problem for strongly harmonic functions is solved via Perron method in Theorems 6.4 and 6.5. There, we not only solve the boundary value problem for continuous data, but also show the relation between existence of barriers and regularity of boundary points. Similar relations are well-known e.g. in the setting of Newtonian harmonic functions, see the discussion following Definition 6.4.
In the final section of the paper we discuss another fundamental geometric properties of harmonic functions, namely the Liouville type theorems. In Theorem 7.2 we provide a fairly general condition for a measure which implies that a strongly(weakly) bounded harmonic function defined in the whole space must be constant. Furthermore, we discuss some sufficient conditions on measure to guarantee that the hypotheses of Theorem 7.2 is satisfied. In particular, this is the case if the measure of the space is finite or in the length spaces with a doubling measure. Our discussion is illustrated with examples. We, for instance, show that even in a simple case of R there exist non-Lebesgue measures for which bounded entire harmonic functions need not be constant.

Preliminaries
Let (X, d, µ) be a metric measure space equipped with a metric d and measure µ. A ball in space X is denoted by B := B(x, r) for x ∈ X and a radius r > 0. In what follows we will assume that µ is a Borel regular measure with 0 < µ(B) < ∞ for any ball B ⊂ X. Moreover, we assume that X is proper, that is closed bounded subsets of X are compact.
We say that a measure µ is doubling if there is a constant C µ > 0 such that for all balls where 2B(x, r) = B(x, 2r). If µ is doubling, then X is complete if and only if it is proper (i.e. every closed bounded set is compact), see Proposition 3.1 in Björn-Björn [1]. One of the consequences of doubling property of µ is that there exist C, Q > 0 such that for all x ∈ X, 0 < r ≤ R and y ∈ B(x, R), µ(B(y, r)) µ(B(x, R)) In fact, Q = log 2 C µ and C = C 2 µ will do, see Lemma 3.3 in Björn-Björn [1], but there may exist a better, that is smaller, exponent Q. Moreover, we note that (1) implies that µ is doubling, i.e. µ is doubling if and only if there is an exponent Q such that (1) holds.
Furthermore, in what follows we will often appeal, without mentioning it explicitly, to the following property of doubling measures. If (X, d, µ) is a doubling metric measure space and Ω ⊂ X is bounded with µ(Ω) > 0 (e.g. Ω is a domain), then for any x ∈ Ω and 0 < r < diam Ω it holds that We say that X is Ahlfors Q-regular if there is a constant C such that for all balls B(x, r) ⊂ X with r < 2 diam X. (In this case, the optimal choice for q in (1) is to let q = Q). If we only require the left hand side of the inequality to hold, then we say that X is lower Q-Ahlfors regular.
One of the important properties of the metric spaces considered in the paper is the following relation between the metric and the measure.
Recall that A∆B stands for a symmetric difference of sets A, B ⊂ X and is defined as follows: Definition 2.1 (cf. Definition 2.2 in [8]). Let (X, d, µ) be a metric measure space. We say that a measure µ is continuous with respect to metric d if for all x ∈ X and all r > 0 it holds that The measure µ is called metrically continuous.
According to our best knowledge the above notion appeared for the first time in the literature in Górka [10].
The following lemma collects some basic facts about continuity of a measure with respect to the metric (see [8] for the proofs). In the presentation below we will appeal to these properties a number of times and, therefore, for the sake of convenience we present them here.
Lemma 2.1. Let (X, d, µ) be a metric space with a Borel regular measure µ. Then the following hold: 1. If µ is continuous with respect to the metric d, then the map x → µ(B(x, r)) is continuous in d.
2. If for every x ∈ X and every r > 0 it holds that µ(∂B(x, r)) = 0, then µ is continuous with respect to the metric d.
3. If for every x ∈ X the function r → µ(B(x, r)) is continuous, then µ is continuous with respect to the metric d.
Proof. For the proof of Property 1, see Corollary 2.1 in [8]. Property 2 is proved in Lemma 2.1 in [8], while Property 3 is proved in Theorem 2.1 in [8].
Following [8], we recall that a metric space (X, d) has the segment property if for any x, y ∈ X there exists a continuous curve γ : [0, 1] → X joining x and y and such that for all t ∈ [0, 1] we have that Recall further, that a metric space (X, d) is geodesic if any two points x, y ∈ X can be joint by a curve γ whose length equals distance d(x, y). For a large class of metric spaces we can easily show their bi-Lipschitz equivalence to geodesic spaces. Namely, let X be a Loewner Ahlfors regular space (see Definition 3.1 in Heinonen-Koskela [18]). Then X is quasiconvex, see Theorem 8.23 in Heinonen [16]. If X is additionally proper, then one can introduce a new metric in X by taking the infimum of lengths of all rectifiable curves joining two points, see Remark 9.11 and Chapter 8 in [16], also [18] for further discussion on Loewner spaces. According to Theorem 2.2 in [8], if (X, d, µ) is a doubling measure space with the segment property, then µ is continuous with respect to metric d. In a consequence we get the following result. Proposition 2.1. Let (X, d, µ) be a geodesic doubling metric measure space. Then µ is continuous with respect to metric d.
In the paper we investigate other types of measures, for instance uniform measures (Definition 5.1) and measures satisfying δ-annular decay condition for some δ ∈ (0, 1] (Definition 4.1). As mentioned in the Introduction, it turns out that measures continuous with respect to a metric seem to be most general among the aforementioned measures. We present the following list of relations between measures studied below.
Then, the following inclusions hold: (1) =⇒ (4) (Proposition 2.1) (1 ′ ) =⇒ (2) =⇒ (4) (Definition 4.1 and the discussion following it, Remark 2) We close the preliminary part of our presentation with recalling some basic definitions and facts about the first order Calculus on metric spaces. The presented results will be employed in Section 5 in the studies of differentiability properties of harmonic functions in metric spaces. For foundations of the analysis on metric spaces we refer e.g. to a book and a survey article by Heinonen [16], [17], see also Heinonen-Koskela [18] and Haj lasz-Koskela [12].
We say that a property holds for p-a.e. rectifiable curve, if it fails only for a curve family Γ with zero p-modulus, see e.g. Väisälä [34] and Section 2 in [18] for definitions and properties of the modulus of curve families in Euclidean and metric settings, respectively. Definition 2.2. Let (X, d, , µ) be a metric measure space and f : X → [−∞, ∞]. We say that a nonnegative Borel function g f on X is an upper gradient if for all nonconstant rectifiable curves γ : [0, l(γ)] → X, parameterized by arc length ds, we have whenever both f (γ(0)) and f (γ(l(γ))) are finite, and γ g f ds = ∞ otherwise. If g f is a nonnegative measurable function on X and if (3) holds for p-a.e. nonconstant rectifiable curve, then g f is called a p-weak upper gradient of f .
Upper gradients were introduced in [18], whereas p-weak upper gradients were first defined in Koskela-MacManus [20]. A relation between those two notions follows from a result in [20], where it is also shown that a p-weak upper gradient of f can be approximated by a sequence of upper gradients of f in L p (X). Moreover, if f has an upper gradient in L p (X), then it has a minimal p-weak upper gradient in L p (X), see Corollary 3.7 in Shanmugalingam [31].
Let p ≥ 1. We say that X supports a (1, p)-Poincaré inequality if there exist constants C P I > 0 and λ ≥ 1 such that for all balls B ⊂ X and all integrable function f on X and all upper gradients g f of f , where

Harmonic functions
In this section we introduce and present some elementary properties of the two fundamental notions of our work, namely weakly harmonic and (strongly) harmonic functions for subsets of metric measure spaces, both based on the mean value property. Our first definition corresponds to the most classical mean value property required to hold at every point of the underlying domain. Functions with such property will be called strongly harmonic. However, in what follows we will often drop term strongly and write, harmonic functions.
Let Ω ⊂ X be an open set. A locally integrable function f : Ω → R is called (strongly) harmonic in Ω if the following inequality holds for all balls B(x, r) ⋐ Ω with x ∈ Ω and r > 0: The set of all harmonic functions in Ω will be denoted H(Ω, µ) and H(Ω) in case the measure is fixed.
The studies of relations between the harmonicity and the mean value property in the Euclidean setting have long history. It was Gauss who, perhaps first, observed that harmonic functions posses the mean value property. The opposite question, whether one need to require mean value property to hold for all radii of balls centered at the given point has also been investigated by several mathematicians, to mention results due to Koebe, Volterra and Kellogg, Hansen and Nadirashvili, and Blaschke, Privaloff and Zaremba. We refer to Section 2 in Llorente [22] for an interesting historical account on the mean value property and harmonicity; also to Heath [14] for further studies on to what extent the restricted mean value property is sufficient for harmonicity in the Euclidean setting. In order to motivate Definition 3.2 below more thoroughly, let us just mention that Koebe, for instance, showed that in order for a continuous function in a domain Ω ⊂ R n to be harmonic it is enough to satisfy the mean value property at every x ∈ Ω with respect to some family of radii r x with inf r x = 0. If we strengthen the assumption on function and require it to be continuous on the closure of a domain, then Volterra and Kellogg proved that one radius at every point is enough for the mean value property to imply the harmonicity. Hansen and Nadirashvili improved the previous results by substituting continuity of a function up to the boundary by its boundedness. Blaschke, Privaloff and Zaremba independently observed that an asymptotic mean value property is enough to imply the harmonicity. Their results facilitated the discovery of p-harmonious functions, see Manfredi-Parviainen-Rossi [24] for the definitions and relations between p-harmonious functions and stochastic tug-of-war games.
In order to provide examples of studies beyond the Euclidean framework, let us mention that the mean value property appears in the setting of differential geometry, e.g. in the studies of the so-called harmonic manifolds and related notions of horospheres and the Lichnerowicz Conjecture. Recall, that a complete Riemannian manifold M is called harmonic if harmonic functions on M satisfy the mean value property, see Willmore [35], Ranjan-Shah [29], also Todjihounde [33] for further definitions and references. Furthermore, see e.g. Picardello-Woess [27] and Zucca [36] for the studies of mean value property in the context of harmonic functions on trees.
Motivated by the above considerations and the literature, we introduce the following more general variant of harmonic functions on metric measure spaces.
Let Ω ⊂ X be an open set. A locally integrable function f : Ω → R is called weakly harmonic in Ω if for every x ∈ Ω there exists a non-empty set of positive radii r x α for α ∈ I such that the following inequality holds for all balls B(x, r x α ) ⋐ Ω: The set of all weakly harmonic functions in Ω will be denoted wH(Ω, µ) and wH(Ω) in case the measure is fixed.
A priori we allow set of indexes I to be any non-empty set, e.g. I can be uncountable. However, in what follows we will study weakly harmonic functions under minimal assumptions, namely that at every point there is at least one admissible radii and that I is at most countable.
We denote by r In what follows also the minimal radius at the point will play a role. Namely, for any x ∈ Ω we denote by We will often require r x m > 0 or r m > 0.
Example 1. Let (R, | · |, |x|dx) be a metric measure space equipped with the Euclidean distance and a measure µ such that dµ := dµ(x) = |x|dx. Define a function f : R → R as follows Then f is weakly harmonic but not harmonic. Indeed, f is locally integrable and by letting y = 0 and r < |y|, we find that Moreover, for any r > 0 we have On the other hand, if we take y > 0 and r > y, then and thus Similarly we define super-and subharmonic functions.
Let Ω ⊂ X be an open set. A locally integrable function f : Ω → R is called a subharmonic(superharmonic) in Ω if the following inequality holds for all balls B(x, r) ⋐ Ω with x ∈ Ω and r > 0: We denote S − H(Ω, µ) the set of all subharmonic functions in Ω with respect to the measure µ while the set of all superharmonic functions in Ω will be denoted S + H(Ω, µ). For the sake of simplicity when the measure is fixed, we will often write S − H(Ω) (S + H(Ω)).
We present now further properties of harmonic functions.
Proposition 3.1. The following properties hold: The analogous properties hold for weakly harmonic (sub-, and superharmonic) functions.
Proof. Denote B := B(x, r) ⋐ Ω a ball centered at x ∈ Ω with r > 0. In order to show Property 1 we note that Similarly, we show that The Young inequality gives us Property 2.
If f ∈ H(Ω), then the first inequality above becomes equality giving us the second part of Property 2. The proof of Property 3 follows the same lines as the one for Property 2. In this case inequalities in (5) are reversed due to convexity of F .
For the proofs of Properties 1-3 for weakly sub/super/harmonic functions one proceeds as above restricting the discussion only to balls with admissible radii.

Harnack estimates, maximum principles, Hölder and Lipschitz continuity
In this section we show several geometric properties of strongly and weakly harmonic functions such as the Harnack inequalities on balls and compact sets, strong and weak maximum principles and comparison principles. One of the main results of this section is the Hölder continuity of harmonic functions as in Definition 3.1 for geodesic metric spaces with doubling measures, Theorem 4.1. Moreover, for spaces satisfying the δ-annular decay condition, see Definition 4.1, we have more accurate estimates, cf. Theorem 4.2. We also discuss relations between measures continuous with respect to the distance and measures in Definition 4.1, see Remark 2 and Example 2. First, we need to refine some results from Gaczkowski-Górka [8].
Proposition 4.1 (Continuity of harmonic functions). Let (X, d, µ) be a metric measure space with measure µ continuous with respect to metric d. If f ∈ H(Ω, µ), then f is continuous in Ω.
The same assertion holds for f ∈ wH(Ω, µ) at points x ∈ Ω with the following property: there exists a neighborhood U of x such that In other words in Proposition 4.1 we require that all points y in every neighborhood U of a point x have at least one common radius with the set of admissible radii at x for a weakly harmonic function f . Then, f is continuous at all points x ∈ Ω where such property holds.
We note that here we do not assume that µ is doubling.
Proof. Suppose that x, y ∈ Ω and fix r > 0. Then, we have Recall that, by definition, function f ∈ H(Ω, µ) belongs to L 1 loc (Ω). Let now y → x in metric d. Then, by the continuity of µ with respect to d we have that µ(B(x, r) △ B(y, r)) → 0. This assumption together with the absolute continuity of the Lebesgue integral with respect to the measure imply that f (y) → f (x).
Let now f ∈ wH(Ω) and x ∈ Ω satisfy the assumptions of proposition. Thus, for any sequence converging to x for k → ∞ in metric d we have that for some i ∈ N and all j, k ∈ N it holds that r x i = r y k j . Denote such a radius by r. This gives us a radius common for points x and all y k for which the mean value property for f holds. Then, estimate (7) holds for all r and, as previously, completing the proof of the proposition.
The following observation is an immediate consequence of Proposition 4.1.
Corollary 4.1. Let (X, d, µ) be a metric measure space with measure µ continuous with respect to metric d. If f ∈ H(Ω, µ), then f is locally bounded in Ω. Furthermore, f ∈ wH(Ω, µ) is locally bounded on sets E ⊂ Ω such that every x ∈ E satisfies assumption (6) of Proposition 4.1.
Next, we show that the fundamental Harnack estimate holds for both weakly and strongly harmonic functions. ⊂ Ω is such that B(x, 6r) ⋐ Ω. Then the following inequality holds where C H = C 3 µ and C µ stands for a doubling constant of µ. Moreover, let f ∈ wH(Ω, µ) be a nonnegative function on a domain Ω ⊂ X. Suppose that a ball B := Then, the Harnack inequality (8) holds with constant Proof. We follow the steps of reasoning in [8] and note that by assumptions on a strongly harmonic function f the following inequality holds for any y, z ∈ B Hence, the harmonicity of f and the doubling property of µ together with the fact that B(y, 3r) ⊂ B(z, 5r) imply Similarly, if f is weakly harmonic, then the above approach gives us for y, z ∈ B that In the last estimate we have also used the assumption that sup y∈B r y m < r, and hence there exists an admissible radius at z such that r z i0 < r. Moreover, it holds that since by assumptions 3r < inf y∈B r y M . By the analogy to the case of f ∈ H(Ω), we obtain since 3r < r y M and, hence, d(y, z) + r y M ≤ 5/3r y M . Here, we also appealed to the doubling property of µ. Since both (9) and (10) hold for any y, z ∈ B they hold for supremum and infimum as well resulting in the assertion of the lemma.
In order to show the Harnack estimate on compact sets for weakly harmonic functions we will need the following variant of Lemma 4.1.
Lemma 4.2. Let X be a metric measure space with doubling measure µ and let f ∈ wH(Ω, µ) be a nonnegative function on a domain Ω ⊂ X. Suppose that a ball B : Proof. We follow the steps of Lemma 4.1 and, upon notation of the lemma, we arrive at the following estimates By combining these inequalities we obtain an analog of (10): where the final constant arises from the doubling property of measure µ. From this the Harnack inequality follows immediately.
As an immediate consequence we obtain the Harnack estimate on compact sets.
Corollary 4.2 (The Harnack inequality on compact sets, cf. Theorem 3.4 in [8]). Let X be a geodesic metric measure space with doubling measure µ, Ω ⊂ X be an open connected set and let f ∈ H(Ω, µ) be a nonnegative function. Then, for every compact connected K ⋐ Ω the following inequality holds where C > 0 is a constant whose value is independent of f , but depends among other parameters on C µ , a doubling constant of µ.
Moreover, for f ∈ wH(Ω, µ) estimate (12) holds provided that and both r Ω m and 3r Ω M are admissible radii for all y ∈ K. In such a case the Harnack constant C = C(C µ , r Ω m , r Ω M ). Remark 1. (1) In [8] the Harnack inequality has been proved for connected sets which are not necessarily pathconnected. Furthermore, here we estimate Harnack constants in terms of the doubling constants and admissible radii.
(2) Note that domain Ω need not be bounded. Therefore, we assume that r Ω M < ∞ in order to ensure that the Harnack constant C in (12) is finite.
Proof of Corollary 4.2. The proof follows the standard reasoning and, therefore, we will present only a sketch of it. For every x ∈ K we find a ball B(x, r x ) such that B(x, 6r x ) ⋐ Ω. The collection of such balls gives us a open cover of K, and by compactness of K we may choose a finite subcover consisting of N balls. Next, take points x, y ∈ K and connect them by a curve γ. Indeed, since the space X is geodesic and Ω , Lemma 4.38 in Björn-Björn [1] implies that any two points in K can be joint by a rectifiable curve. From the collection of previously chosen N balls we choose such that x ∈ B 1 and y ∈ B M and B This, together with continuity of f , Proposition 4.1 imply the assertion of the corollary with C := C 2N µ . The reasoning for weakly harmonic functions is similar. We cover set K with open balls C := {B(x, r x )} x∈K such that we can apply a variant of the Harnack estimate on every B x as in Lemma 4.2. Namely, we assume that r x := r Ω m for all x ∈ K. Moreover, we need to ensure at every x ∈ K that a ball B : ⋐ Ω. This, follows from the condition that dist(K, ∂Ω) > 2r K M . Using compactness of K we choose from the cover C a finite cover of K by balls {B i } for i = 1, . . . , n as in the case of strongly harmonic functions.
The remaining part of the chaining argument stays the same as in the case of strongly harmonic functions. Observe, that for all i = 1, 2, . . . , n r Bi M ≤ r Ω M and r Bi m ≥ r K m . In a consequence we arrive at the following chain of estimates, cf. Lemmas 4.1 and 4.2: Hence, in this case we obtain a constant C := C The Harnack inequality implies, in the usual way, the strong and weak maximum principles as well as the comparison principle. The strong maximum principle for strongly harmonic functions is proved in Gaczkowski-Górka [8,Theorem 3.1] without assumption that Ω is open and µ is doubling. However, their approach is different than below and for this reason as well as for the sake of completeness we present a new proof based on the Harnack inequality.
It is perhaps surprising, but the following four results are valid also for weakly harmonic functions. In fact, in order for Proposition 4.2 and Corollaries 4.3 and 4.4 to hold for f ∈ wH(Ω), it is enough that at every point of a domain Ω there exists one radius r x for which the mean value property is satisfied for f . Let Ω ⊂ X be open connected and µ be a doubling measure on X. Moreover, let f ∈ H(Ω, µ) and continuous in Ω. If f attains its maximum in Ω, then f is constant. Furthermore, the assertion holds for f ∈ wH(Ω, µ) provided that f is continuous (cf. (6) in Proposition 4.1).
Proof. Denote M := sup Ω f and let Ω ′ = {x ∈ Ω : f (x) = M }. By Proposition 4.1 harmonic functions in H(Ω, µ) are continuous, and hence, Ω ′ is relatively closed in Ω. We will show that Ω ′ is an open subset of Ω. Let B ⊂ Ω be a ball such that B ∩ Ω ′ = ∅ and 6B ⋐ Ω. Denote g := M − f ≥ 0 in Ω. Proposition 3.1(1) implies that g ∈ H(Ω, µ). By the Harnack principle, Proposition 4.1 and by continuity of f we have that The connectedness of Ω implies that Ω ′ is the only open and relatively closed subset of Ω and, hence, Ω = Ω ′ . In a consequence, f ≡ M and the proof is completed in the case of strongly harmonic functions. If f ∈ wH(Ω, µ), then the above approach may fail. Indeed, in the previous reasoning we need to know that for a set Ω ′ , there is a ball B ⊂ Ω such that B ∩ Ω ′ = ∅ and 3B ⋐ Ω. For porous sets ensuring existence of a point x ∈ Ω and a radii r x i for some i = 1, 2, . . . may require r x m = 0 which, in turn, is prevented by assumptions of the Harnack inequality, cf. Corollary 4.2. Instead, we follow the approach of Theorem 3.1 in [8].
Let Ω ′ be as in the previous part of the proof. Continuity assumption on f ∈ wH(Ω) imply that Ω ′ is a relatively closed subset of Ω.
Moreover, let us choose any x 0 ∈ Ω ′ with B(x 0 , r x0 i ) ⋐ Ω for some admissible radius r x0 i . By the harmonicity of f we have that Since for all x ∈ Ω it holds that f (x) ≤ M , we obtain that f ≡ M in B(x 0 , r x0 i ). In a consequence Ω ′ is open and, as in the case of strongly harmonic functions, we get that f ≡ M in Ω.
Recall that a metric space X is locally connected if every neighborhood of a point x ∈ X contains a connected neighborhood. Then, the Mazurkiewicz-Moore-Menger theorem stays that X is locally pathconnected provided that it is proper metric space, see Theorem 1, pg. 254, in Kuratowski [21]. In particular, every component of an open set is open and pathconnected, see Theorem 2, pg. 253, in [21].
A connected space need not be locally connected (see e.g. the topologist's sine curve). Therefore, we present two variants of the weak maximum principle, related to different connectivity assumptions on the metric space. Proof.
Since Ω is compact and f is continuous in Ω, there exists x 0 ∈ Ω such that It is enough to consider only the case that x 0 ∈ Ω. Let us denote by Ω(x 0 ) the connected component of Ω containing x 0 . Since X is locally connected, Ω(x 0 ) is open and ∂Ω(x 0 ) ⊂ ∂Ω. Hence, by the strong maximum principle we get that f ≡ f (x 0 ) on Ω(x 0 ).
The weak maximum principle follows immediately from Proposition 4.2 (cf. Theorem 3.2 in [8] proved under stronger assumptions than the one below). and sup Furthermore, the assertion holds also for f ∈ wH(Ω, µ) provided that f ∈ C(Ω), cf. (6) in Proposition 4.1.
Proof. we will show only the second inequality, the first one follows the same steps. Suppose opposite, that sup Ω f > sup ∂Ω f . Then the maximum of f is attained in Ω, giving by Proposition 4.2, that f ≡ sup Ω f contradicting the continuity assumption of f . The proof of the corollary in the case of f ∈ wH(Ω, µ) follows the above lines, since under our assumptions f is continuous in Ω.
Next we show the comparison principle for harmonic functions on domains. The result follows from Proposition 4.2 (cf. Theorem 3.2 in [8] proved under stronger assumptions on the domain).  Let (X, d, µ) be a metric measure space and Ω X be a domain. Let, further, f, g ∈ H(Ω, µ) ∩ C(Ω) be such that f ≥ g on ∂Ω. Then f ≥ g in Ω.
Furthermore, the assertion holds also for f, g ∈ wH(Ω, µ) ∩ C(Ω) provided that at every x ∈ Ω the sets of admissible radii of functions f and g have at least one common radius.
Proof. Since both f and g are harmonic in Ω, then so is also f − g. Since f ≥ g on ∂Ω, then inf ∂Ω (f − g) ≥ 0. By the Corollary 4.3 we obtain that From this, we obtain that sup Ω g ≤ inf Ω f and the comparison principle follows.
The proof of the corollary in the case of f ∈ wH(Ω, µ) follows the above lines. Indeed, f and g are continuous in Ω by assumptions and f − g is weakly harmonic in Ω, as sets of admissible radii of functions f and g have a common radius at every x ∈ Ω.
We are in a position to state and prove the main result of this section, local Hölder continuity of harmonic functions. The proof of this result relies on the Harnack estimate on balls and holds for strongly harmonic functions. The iteration method used below requires that for every ball of radius r one is able to apply the Harnack estimate on a ball with radius r/t for some t > 4. This, however, need not be satisfied for weakly harmonic functions in a domain Ω unless r Ω m = 0, which leads constant C in Lemma 4.1 to be unbounded.
From this we get Let y ∈ B(x, r) be such that r t n+1 ≤ d(x, y) < r t n for some n = 0, 1 . . .. (Such bounds always hold for some n ∈ N depending on y.) We iterate inequality (14) and obtain the following estimate: Indeed, set Then From this, estimate (15) follows immediately. Let now B := B(x 0 , r) and let x, y ∈ B for B such that 4B ⋐ Ω. We distinguish two cases. Case 1: d(x, y) < r. Then, by repeating the above discussion we obtain Therefore, f is locally Hölder continuous with exponent α as in (16). If f ∈ wH(Ω, µ), then the above reasoning can be repeated using second parts of Lemma 4.1 and Corollary 4.2.
We close this section with yet another Hölder and Lipschitz regularity result for harmonic functions. First, we need the following definition, cf. Section 1 in Buckley [3].
If δ = 1, then we say that X satisfies the strong annular decay property. Spaces with annular decay property appear, for instance, in the context of the Hardy-Littlewood and fractional maximal operators, see Buckley [3] and Heikkinen-Lehrbäck-Nuutinen-Tuominen [15] respectively, parabolic De Giorgi classes, see Masson-Siljander [26].
Among examples of spaces with strong annular decay property let us mention geodesic metric spaces with uniform measures, R n with the Lebesgue measure and Heisenberg groups H n equipped with a left-invariant Haar measures. Moreover, Corollary 2.2 in [3] stays that if (X, d, µ) is a length metric measure space with a doubling measure µ, then X has the δ-annular decay property for some δ ∈ (0, 1] with δ depending only on a doubling constant of µ. In fact, Theorem 2.1 in [3] asserts that it is enough for (X, d) to be the so-called (α, β)-chain space in order to conclude that X has the δ-annular decay property. In such a case δ depends additionally on α and β. We refer to the discussion in Section 2 in [3] for relations between (α, β)-chain spaces and the Boman chain condition and C(λ, M )-condition of Haj lasz-Koskela [12].
By letting d(x, y) → 0 we obtain that µ(B(x, r) △ B(y, r)) → 0 and, hence, µ is continuous with respect to d.
The following example shows that the opposite relation need not hold, i.e. a measure continuous with respect to a metric may fail δ-annular decay property for any δ ∈ (0, 1]. Example 2. Let X = R with the Euclidean metric and a measure dµ(x) = e −|x| dx. It is easy to check that µ is continuous with respect do d. Namely, for any ball B(x, r) = (x − r, x + r) one need to consider three cases: (1) x + r ≤ 0, (2) x − r ≥ 0 and (3) −r < x < r, depending on the position of B(x, r) with respect to 0. In all cases one gets that for any fixed x, the function r → µ(B(x, r)) is continuous and hence, by Part (3) of Lemma 2.1 our claim holds true.
We will show that for large enough x, y > 0 and large enough radii r < x, r < y condition (17) fails. By computations we get for any ǫ ∈ (0, 1) that µ(B(x, r)) = Therefore, by letting ǫ = 1/r, we obtain the following equality Hence, for large enough x, y and r we get that condition (17) may not be satisfied with any A > 0 and δ ∈ (0, 1].
In next theorem we show Hölder and Lipschitz estimates on balls and compact sets, thus extending Theorem 4.1. Previous assumptions on measure allow us to establish Hölder estimates for some constant and exponent, whose exact values are not determined. Here, the δ-annular decay property satisfied by a measure enables us to obtain finer estimates on balls already in the Hölder case. Moreover, on compact subsets we obtain the Hölder regularity as in Theorem 4.1 but, additionally, provide estimates with explicit constants and exponent δ. Both for the Hölder case and the new Lipschitz one, we also have explicit constants, however a dependence on a Lebesgue number of a chosen covering comes into play. Such a dependence is removed in one of our next results, see Proposition 5.2.
If δ = 1, then f is locally L-Lipschitz continuous on every ball B ⊂ Ω such that 3B ⋐ Ω.
In both cases we have that for x, y ∈ B(x 0 , r 2 ). Here, C µ stands for a doubling constant of µ and A is as in (17). Let K ⋐ Ω and f be bounded in Ω. Furthermore, suppose that η is a Lebesgue number of any, but fixed, open cover of K. Then, we have the following estimates Remark 3. Suppose that X is additionally geodesic. Since geodesic space is, in particular, a length space, we retrieve from Corollary 2.2 in [3] the above Theorem 4.1 with some δ ∈ (0, 1]. Proof of Theorem 4.2. Let x ∈ Ω and B(x, r) be a ball such that B(x, 2r) ⋐ Ω. Then, dist(B(x, r), X \ Ω) > r.
As a result we have that holds for all x, y ∈ B(x, r/2). Suppose now, that x, y ∈ B(x 0 , r/2) such that 2B(x 0 , r) ⋐ Ω. Let us consider two cases.
Let K be a compact subset of Ω and r = dist(K, ∂Ω). Since K is compact, we can cover it by open balls B(x, r/2) centered at points x ∈ K and choose a finite subcover, denoted by B i := B(x i , r/2) for i = 1, 2, . . . , N for some N . Hence, Let us denote by η a Lebesgue number of covering {B i }. If x, y ∈ K are such that d(x, y) ≤ η, then there exists i 0 ∈ {1, ..., N } such that x, y ∈ B i0 . This allows us to apply (18) and obtain the following inequality Otherwise, if d(x, y) > η, then we get This completes the proof of the second part of Theorem 4.2 and the whole proof is, thus, completed.

The Lipschitz regularity and uniform measures. Weak upper gradients of harmonic functions
In this section we study some differentiability properties of harmonic functions. We begin with showing that harmonic functions are Lipschitz in the large scale, that is assuming that the distance between points is not too small. For the similar result in the setting of maximal operators see Lemma 8 in Haj lasz-Malý [13]. In the previous section, see Theorem 4.2, we show, among other results, the Lipschitz regularity for harmonic functions imposing the 1-annular decay condition on the measure. In Proposition 5.1 we allow measure to be just doubling, however we require harmonic function to be nonnegative. The second main result of this section is Proposition 5.2. We study the Lipschitz regularity of strong and weakly harmonic functions in the case of the uniform measure growth. Such measures play a fundamental role e.g. in the geometric measure theory, see the discussion and references below.
Finally, using the celebrated Cheeger's results on differentiability of Lipschitz functions, in Corollaries 5.1 and 5.2 we study the existence of weak upper gradient for strongly and weakly harmonic functions. Proposition 5.1. Let (X, d, µ) be a metric space with doubling measure µ and let Ω ⊂ X be a domain. Suppose that f ∈ H(Ω, µ) is nonnegative. Then the following estimate holds: for every r > 0 and all x, y ∈ B(x 0 , r) ⊂ B(x 0 , 2r) ⋐ Ω, such that r C where C and Q are constants from estimate (1). One may assume that Q = log 2 C µ and C = C 2 µ (see Lemma 3.3 in Björn-Björn [1]).
We further note that the lower bound condition in the proposition imposed on a distance d(x, y) is equivalent to a condition on the doubling constant of µ. Namely, with the above notation and values of Q and C it holds that C 1 Q(C−1) − 1 < 1 provided that C 2 µ > 1 + 2/ log 2 3. This can be easily satisfied by increasing C µ if necessary.
Proof. Let x, y ∈ B(x 0 , r) for some x 0 ∈ Ω. The doubling property of µ, cf. (1), implies that for balls B(y, r) ⊂ B(x, r + d(x, y)) we have that Upon simple algebraic transformations of the assumption relating the distance d and ǫ, C and Q we get that We now appeal to the Bernoulli inequality, combining it with the estimate in (23), to obtain that 1 C r r + d(x, y) Hence, This observation together with the nonnegativity and harmonicity assumptions on f imply the following estimate: The above inequality holds true if we replace x with y and, therefore, the following inequality holds: We again appeal to property (1) of doubling measures and get In a consequence, This completes the proof of Proposition 5.1.
The next result gives us the Lipschitz regularity in the important case of the uniform measure growth.
Definition 5.1. Let (X, d, µ) be a geodesic metric space equipped with a Borel regular measure µ. We call µ a Q-uniform measure for some Q ≥ 1, if there exists a constant C > 0 such that for any x ∈ X and all r > 0 Uniform measures play an important role in geometric measure theory. For instance, if X = R n , then Marstrand [25] proved that for a non-trivial Q-uniform measure it necessarily holds that Q ∈ N (see also Chousionis-Tyson [5] for a discussion of Marstrand's theorem and uniform measures in the setting of Heisenberg groups). One of results of the celebrated paper by Preiss [28] stays that for Q = 1, 2 uniform measures are flat. Let us also mention that uniform measures have been employed to investigate relations between harmonic measures and non-tangentially accessible domains (NTA-domains), see Kenig-Preiss-Toro [19] and in the studies of rectifiable measures, see Tolsa [32]. Moreover, uniform measure appear in potential and stochastic analysis, see Bogdan-Stós-Sztonyk [2], in the theory of incompressible flows with vorticities, see Cieślak-Szumańska [6]. Furthermore, the assertion holds for f ∈ wH(Ω, µ) on every compact K ⊂ Ω provided that r K m > dist(K, X \ Ω) > 0 and the following condition holds: that is, all points in K must have at least one common radius for which the mean value property holds for f . Moreover, in such a case we have L = Q2 Q+1 M  , r)) B(x,r)△B(y,r) |f (z)|dµ(z) + |µ(B(x, r)) − µ(B(y, r))| µ(B(x, r))µ(B(y, r)) ≤ 2M µ(B(x, r) △ B(y, r)) µ(B(x, r)) .
Hence, by the mean value theorem applied to function s Q , we obtain that where s ≤ 1 + d(x,y) r < 2. Choose x, y ∈ K and let r : If f ∈ wH(Ω, µ), then by assumptions for all x, y ∈ K we are able to find at least one radius, denoted by r, such that (27) and estimates following it hold for r. Then, in the final step we have that and so in this case L = Q2 Q+1 M r K m , as desired. The proof is therefore completed.
One of the consequences of Proposition 5.2 is the differentiability of Lipschitz weakly and strongly harmonic functions on compact sets.
Let f be a locally Lipschitz function in Ω ⊂ X. We define a lower pointwise dilatation of f as follows Similarly, we define an upper pointwise dilatation of f by the formula: We refer to the following result due to Cheeger, see also Preliminaries for a discussion on weak upper gradients and the Poincaré inequalities.  Let (X, d, µ) be a complete geodesic metric space such with a Q-uniform measure µ for some Q ≥ 1 and supporting (1, p)-Poincaré inequality for p > 1. Suppose that f is a strongly harmonic function in a compact set K ⊂ Ω. Then, the minimal p-weak upper gradient g f of f exists and Furthermore, the assertion holds for a weakly harmonic function f in K provided that f satisfies the assumptions of the second part of Proposition 5.2.
Similarly, by combining the Cheeger's theorem with Theorem 4.2 we arrive at the following result.

The Dirichlet problem and Perron solutions
We begin this section with an observation that in general, the Dirichlet boundary value problem need not have a solution even in the simplest one-dimensional case as the following example shows.
Consider the Dirichlet problem of finding a harmonic function g in H((0, 1), | · |, xdx) such that g(0) = g(1). Then, by the above reasoning there is no solution of such problem.
The purpose of this section is to study the following questions: (1) When does a Dirichlet problem for a functions with the mean value property as in Definition 3.1 have a solution and for what type of boundary data?
(2) How to construct a solution to the harmonic Dirichlet problem?
Although these questions are nowadays classical in the Euclidean setting, see e.g. Gilbarg-Trudinger [9], their metric counterparts have been intensively studied mainly in past two decades, see e.g. Section 10 in Björn-Björn [1] and references therein. However, results in [1] apply to harmonic functions defined as minimizers of the 2-Dirichlet energy, whereas we answer the above two questions for harmonic functions defined via the mean value property.
In the first part we study the solvability of the Dirichlet problem by employing the so-called Dynamical programming principle, generalized to the metric setting and based on studies conducted for p-harmonious functions in Euclidean domains by Luiro-Parviainen-Saksman [23] and Manfredi-Parviainen-Rossi [24]. Our results apply to some functions with the mean value property for measurable and continuous boundary data. In the second part we employ the Perron method and solve the Dirichlet boundary problem for strongly harmonic functions with continuous data.

The Dirichlet problem and the Dynamical programming principle
Our approach to the Dirichlet problem for harmonic functions in metric space is the following. First, we extend the dynamical programming principle as presented in [23] to the setting of metric spaces with Borel regular measures. Theorems 6.1 and 6.2 below extend Theorems 2.1 and 4.1 in [23] for measurable and continuous data, respectively. Moreover, Theorem 6.1 provides us with a function u ǫ , the solution to the Dirichlet problem with measurable data, such that it satisfies the mean value property on balls with radii ǫ. In Theorem 6.2 we show that the similar property holds for solutions to the Dirichlet problem with continuous data at points with ǫ-distance from the complement of the domain. Finally, we show that in metric measure spaces with the δ-annular decay property the existence of subharmonic solution of the boundary value problem with continuous data implies existence of the weakly harmonic continuous function with the same continuous boundary data, see Theorem 6.3.
We follow the notation of Section 2.1 in [23] and for ǫ > 0 define the ǫ-boundary strip of a domain Ω ⊂ X: In order to ensure that Γ ǫ = ∅ we need to assume that Ω is such that Γ ǫ ⊂ X. This assumption will not weaken our results, as in fact we apply them only for balls B ǫ compactly contained in the underlying domain with radii ǫ small enough so that B ǫ ∪ Γ ǫ remains a subset of the domain. Denote by Ω ǫ := Ω ∪ Γ ǫ .
Theorem 6.1. Let (X, d, µ) be a metric measure spaces with a measure continuous with respect do d. Moreover, let g : ∂Ω → R be a bounded Borel measurable function and F : Γ ǫ → R be defined as follows: Then, there exists a bounded Borel function u : Ω ǫ → R solving the following Dirichlet problem with the boundary data F : In fact, u is the uniform limit of a sequence {u i } ∞ i=0 defined via the following iteration scheme: while for i = 0, 1, . . . we define Proof. First, notice that T u i is Borel bounded measurable function in Ω ǫ for every i = 0, 1, . . .. In order to verify this observation, first notice that u 0 is measurable. Indeed, from (30) we infer that This, together with Borel measurability of g imply that u 0 is Borel measurable as well. Next we compute The continuity of µ with respect to d gives us that u 1 (x) is continuous for x ∈ Ω, whereas for x ∈ Ω ǫ \ Ω the measurability of u 1 follows the same argument as for u 0 . Indeed, by Lemma 2.1(1) we have that a function x → µ(B(x, ǫ)) is continuous in Ω. Similarly, a function Ω ∋ x → B(x,ǫ) u 0 (y)dµ(y) is measurable as a quotient of two measurable functions. The measurability of u i+1 = T u i for i = 1, 2, . . . follows the same steps by induction and we omit details.
We continue the proof following the reasoning for Theorem 2.1 in [23]. It is immediate to check that u 1 ≥ u 0 in Ω ǫ . In order to give an idea about formulas describing functions u i we compute also

This yields
The same reasoning allows us to conclude that u i ≤ u i+1 in Ω ǫ for all i = 0, 1, . . .. Definitions of u 0 and operator T together with easy argument by induction imply that the sequence {u i } ∞ i=0 is increasing and uniformly bounded from above by sup ∂Ω g < ∞. The latter property is a consequence of a simple induction applied with (31). Namely, since |u 0 | ≤ sup ∂Ω g in Ω ǫ , then so is u 1 . Then, by assuming that |u i | ≤ sup ∂Ω g in Ω ǫ for some i > 1 we trivially obtain that for x ∈ Ω while otherwise, in Ω ǫ \ Ω, the boundedness of u i+1 immediately follows from its definition. Therefore, we are in a position to define the following bounded Borel measurable function u : Ω ǫ → R: Next, one shows that the convergence is uniform and the proof is by contradiction. This proof follows steps of the corresponding proof of Theorem 2.1 in [23] for α = 0 and β = 1 and, therefore, will be omitted. Let us comment, that the uniform convergence implies that u satisfies (29) and, by construction, has the boundary data F .
In the next theorem we prove the solvability of the Dirichlet problem similar to (29) for continuous boundary data.
Using the Tietze extension theorem applied to ∂Ω and a continuous function g : ∂Ω → R we obtain a continuous function F : Let us remark, that if F is an extension of g for some ǫ 1 , then F can be taken also for all ǫ ≤ ǫ 1 .
Theorem 6.2 (cf. Theorem 4.1 in [23]). Let Ω be a locally connected domain in (X, d, µ) with µ continuous with respect to d and let F : Γ ǫ,ǫ → R be a continuous function as above. Then, there exists a unique continuous u ǫ : Ω ǫ → R which solves the following boundary value problem: x ∈ Γ ǫ,ǫ \ Ω.
Proof. Following the idea of the proof of Theorem 6.1 we define a function u 0 : Ω ǫ → R as Moreover, for bounded functions u : Ω ǫ → R we let T be an operator defined as follows: u(y)dµ(y).
By convention, we will interpret that for all x ∈ Ω \ Γ ǫ,ǫ . By an iterative scheme we define u i+1 := T u i for i = 0, 1, . . . and show that {u i } ∞ i=0 is a monotone increasing bounded sequence of continuous functions in Ω ǫ . Furthermore, as in Lemma 6.1, the sequence {u i } ∞ i=0 is uniformly bounded from above by sup ∂Ω g < ∞ and the argument for this to hold follows again from definitions of u 0 , T and induction.
The natural modification of the proof of Theorem 6.1 allows us to conclude that function u ǫ := lim i→∞ u i is continuous and satisfies (32).
In order to show the uniqueness, let us suppose that u 1 and u 2 solve (32) and u 1 ≡ u 2 . Set Furthermore, note that it is enough to consider sup z∈Ω (u 1 (z) − u 2 (z)) instead of the supremum for absolute values of u 1 − u 2 , as the case u 2 − u 1 follows by the symmetric argument. The definition of Ω ′ immediately implies that Ω ′ is non-empty. Moreover, let us notice that Ω ′ contains a ball B(x, ǫ). Indeed, let us consider two cases. Case 1. Ω ′ \ Γ ǫ,ǫ = ∅. Then for x ∈ Ω ′ \ Γ ǫ,ǫ it holds that Hence, u 1 − u 2 ≡ M in B(x, ǫ). Choose a point z ∈ ∂Ω and some point x ′ ∈ Ω close enough to z.
Since Ω is path-connected, there exists a continuous curve γ joining x and x ′ in Ω. By the compactness of |γ| we may find a finite cover C = {B i } N i=1 of γ by balls centered at points x i ∈ γ with radii ǫ/2 such that x 1 = x and x N = x ′ . Let B(x ′′ , ǫ) be a ball in C with x ′′ ∈ γ and x ′′ ∈ B(x, ǫ/2) ∩ B(x 2 , ǫ/2). We apply reasoning at (33) to B(x ′′ , ǫ) using again the mean value property for u 1 and u 2 and obtain that u 1 − u 2 ≡ M in B(x ′′ , ǫ). We continue this procedure along γ till we reach first point Then by the definition of u ǫ in (32) we get Thus, by repeating the last step at most once more, we have approached ∂Ω obtaining a contradiction with the fact that u 1 | ∂Ω = g = u 2 | ∂Ω . Namely, for z ∈ ∂Ω it holds that u 1 (z) − u 2 (z) = 0, even though for points y ∈ U ∩ Ω for an arbitrarily small neighborhood U of z we have that u 1 (y) − u 2 (y) = M > 0, contradicting continuity of u 1 and u 2 . Case 2. Ω ′ \ Γ ǫ,ǫ = ∅. Then, since Ω ′ is non-empty, there exists x ∈ Ω ∩ Γ ǫ,ǫ and the above procedure simplifies. In fact we immediately reach the contradiction, since for z ∈ ∂Ω ∩ B(x, ǫ) on one hand we have that u 1 (z) − u 2 (z) = 0, but on the other hand for points y ∈ U ∩ Ω for an arbitrarily small neighborhood U of z it holds that u 1 (y) − u 2 (y) = M > 0 by (34) applied for x ′′′ := x.
The proof of the uniqueness and the whole proof of the theorem are, therefore, completed.
We close this section with the following result showing that if we know that a Dirichlet problem has a continuous subharmonic solution, then the weakly harmonic solution exists and satisfies the same continuous boundary data. Theorem 6.3. Let (X, d, µ) be a metric measure space satisfying the δ-annular decay condition for some δ ∈ (0, 1]. Let Ω be a bounded domain in X and consider a continuous function g : ∂Ω → R. If there is a continuous subharmonic function v ∈ S − H(Ω) ∩ C(Ω) such that v| ∂Ω = g, then there exists a weakly harmonic function u ∈ H(Ω) ∩ C(Ω) such that u| ∂Ω = g.
We use operator T to construct the following sequence of functions: (2) u n := T u n−1 for n = 1, 2, . . ..
We easily see that all u n ∈ C b (Ω) and u n L ∞ (Ω) ≤ v L ∞ (Ω) . Next, observe that every u n is weakly subharmonic in Ω with admissible radii r x = r x . Indeed, u 0 = v is subharmonic, so by the definition Moreover, note that if v ≤ w, then T v ≤ T w. Hence, by induction we get The above reasoning shows also that sequence {u n } ∞ n=0 is increasing at every x ∈ Ω. We extend sequence {u n } ∞ n=0 to Ω in such a way that u n | ∂Ω = g for all n = 0, 1, . . .. Indeed, this is possible for u 0 because v is continuous up to the boundary and v| ∂Ω = g. In order to see that the same holds true for u n for n ≥ 1 let us first consider any w ∈ C(Ω) with w| ∂Ω = g. Then for all x ∈ ∂Ω and ǫ > 0 there exists δ > 0 such that |w(y) − g(x)| < ǫ, for y ∈ Ω ∩ B(x, δ). Hence, for y ∈ B(x, δ 2 ) ∩ Ω we have In a consequence, T w ∈ C(Ω) and T w| ∂Ω = g. We apply this reasoning with w = u n for n = 0, 1, . . . and obtain that {u n } ∞ n=1 is bounded increasing sequence of continuous functions on compact set, such that all u n | ∂Ω = g. We are now in a position to define the following Borel function: One can show that {u n } ∞ n=1 converges uniformly in Ω and the reasoning is similar to the one in the proof of Theorem 2.1 in [23], cf. presentation in the proof of Theorem 6.1 above. Since u n | ∂Ω = g for all n, the sequence converges uniformly also in Ω. Hence, u ∈ C(Ω) and u| ∂Ω = g. By employing the monotone convergence theorem to the sequence we get that u ∈ wH(Ω).

The Perron method for harmonic functions
In this section we employ the Perron method to show that for metric spaces with metrically continuous measures the Dirichlet problem in a domain Ω with continuous boundary data has a strongly harmonic solution provided solvability of the appropriate Dirichlet problem on all balls whose closures are contained in Ω, see Theorem 6.4. Furthermore, in Theorem 6.5 we prove that if, additionally at every x ∈ ∂Ω there exists a barrier, then solvability on balls is also a necessary condition for solvability of the Dirichlet problem in Ω.
We begin with some auxiliary definitions and results. First, we generalize subharmonic functions, cf. Definition 3.3. For the sake of the readers convenience we decided to present this notion here instead in Section 3. Such a generalization together with the above discussion of the Dirichlet problem will then be applied in the studies of Perron solutions. Definition 6.1. Let f be a continuous function on Ω. We say that f is locally subharmonic in Ω if for every x there exists R x > 0 such that B(x, R x ) ⊂ Ω and for 0 < ρ < R x Proposition 6.1. The strong and weak maximum principles hold for locally subharmonic functions in Ω.
Proof. The proof of the first part of the proposition is similar to the one for the strong maximum principle for harmonic functions, see Theorem 3.1 in Gaczkowski-Górka [8] and Proposition 4.2. Therefore, here we only provide a sketch of the reasoning. Let Set Ω ′ is closed. To see that it is open, let x 0 ∈ Ω ′ and B(x 0 , r) ⊂ Ω for r < R x0 as in Definition 6.1. Then by the definition of locally subharmonic functions we have that Since f ≤ M in Ω, we have that f ≡ M on B(x 0 , r) and Ω ′ is open, hence Ω ′ = Ω. As for the proof of the weak maximum principle, it follows from the strong one in the same way as in the case of harmonic functions, cf. the proof of Corollary 4.3. Proof. Let x ∈ Ω and suppose that max{f (x), g(x)} = f (x). Then provided that ρ < R = min{R f,x , R g,x }, where R f,x and R g,x are radii R x from Definition 6.1 for functions f and g, respectively.
Let Ω ⊂ X and g : ∂Ω → R be a measurable function. In what follows by H Ω [g] we denote a solution to the Dirichlet problem in H(Ω, µ) with a boundary data g, provided that it exists.
Let Ω X be a domain and g : ∂Ω → R be a continuous function. We denote by S g the family of all locally subharmonic functions in Ω such that f ≤ g on ∂Ω. Define a lower Perron solution P Ω [g] in Ω of g as follows: P If the underlying domain Ω is fixed or clear from the context of discussion, then for the sake of simplicity we will write P Ω [g] = P [g]. Note that under our assumption that X is proper, we have that ∂Ω is compact and balls are relatively compact. However, in what follows we need to assume additionally that balls are connected. This assumption will be used in the proof of Theorem 6.4.
Remark 5. Note that by the weak maximum principle in Corollary 4.3 it holds that P Ω [g] ≤ sup x∈∂Ω g(x). Definition 6.3. Let Ω ⊂ X be an open set and f : Ω → R be a continuous function. Suppose that x 0 ∈ Ω, r > 0 are such that B(x 0 , r) ⊂ Ω. Denote by g = f | ∂B(x0,r) . The following function is called a harmonic modification of f in B(x 0 , r):f The harmonic modification appears in the literature also as the Poisson modification and has several variants e.g. for superminimizers and superharmonic functions in the setting of Newtonian spaces, see e.g. Sections 8.7 and 10.9 in Björn-Björn [1].
The following observations easily follow from the weak maximum principle for locally subharmonic functions (Proposition 6.1) and the definition of the harmonic modification. Lemma 6.1. Let f be a locally subharmonic function in Ω, thenf x,r ≥ f for any x ∈ Ω and B(x, r) ⊂ Ω. Lemma 6.2. Let g : ∂Ω → R be a continuous function and f, h ∈ S g be such that f ≥ h in Ω. Thenf x,r ≥h x,r for any x ∈ Ω and B(x, r) ⊂ Ω. Proposition 6.3. Let f be a locally subharmonic function in Ω, then harmonic modificationf x,r is locally subharmonic in Ω for any x ∈ Ω and B(x, r) ⊂ Ω.
Proof. Letf x,r be a harmonic modification of f in B(x, r). If y ∈ B(x, r), then by harmonicity off x,r in B(x, r), we have that inequality (37) holds for ρ < R y , where R y is small enough. Otherwise, if y / ∈ B(x, r), then Lemma 6.1 implies for sufficiently small ρ > 0, that This completes the proof.
Definition 6.4. Let x 0 ∈ ∂Ω. We say that a continuous function f : Ω → R is a barrier for Ω at x 0 if: (1) f is locally subharmonic in Ω, (2) f (x 0 ) = 0, The notion of a barrier plays an important role in the potential analysis, see e.g. Chapter 11 in Björn-Björn [1]. We point out that, upon slight modification of Definition 6.4, one can show that existence of a barrier at a given boundary point x 0 of a domain is equivalent to the fact that x 0 is a regular point, see Theorems 11.2 and 11.11 in [1]. Recall, that a point x 0 is regular if lim Ω∋y→x H Ω g(y) = g(x), for all continuous boundary data g : ∂Ω → R. From that perspective the following result provides, among other results, conditions on the boundary enabling us to conclude that all boundary points are regular. Theorem 6.4. Let (X, d, µ) be a metric space with metrically continuous measure µ and such that balls are connected. Let Ω ⊂ X be a domain and g : ∂Ω → R be a continuous function. If for every ball B in Ω such that B ⊂ Ω there exists a solution of the Dirichlet problem with a boundary data g| ∂B , then P Ω [g] is a harmonic function on Ω. Moreover, if Ω has a barrier at x 0 ∈ ∂Ω, then In order to show the harmonicity of P [g] in B(x, r) let us take a sequence {u k } ∞ k=1 ⊂ S g , such that lim k→∞ u k (x) = P [g](x).
By Proposition 6.2 it holds that v k ∈ S g for every k. Let w k be a harmonic modification of v k on B(x, r), i.e. w k = v k x,r . From Definition 6.3 and Proposition 6.3 we infer that w k ∈ S g . Since {v k } ∞ k=1 is a monotone increasing sequence, we get by Lemma 6.2 that {w k } ∞ k=1 is monotone increasing as well. Moreover, by Remark 5 we have that u k (y) ≤ v k (y) ≤ w k (y) ≤ P [g](y) ≤ sup ∂Ω g < ∞. (40) Thus, the pointwise limit w(y) = lim k→∞ w k (y) exists and from (40) we get that w(x) = P [g](x) and w ≤ P [g] in Ω. Furthermore, since w k is a monotone sequence of harmonic functions in B(x, r), we get by the Lebesgue Convergence Theorem that w(y) = 1 µ(B(y, δ)) B(y,δ) wdµ for any B(y, δ) ⋐ B(x, r). This together with metric continuity of measure µ imply that w is continuous in B(x, r), cf. Proposition 4.1. Hence, we get that w ∈ H(B(x, r)).
In order to complete the proof we need to show that P [g] ≤ w in B(x, r). For this purpose let us consider u ∈ S g . We have that lim k→∞ max{w k , u}(x) = w(x) and max{w k , u} ∈ S g .
Subsequently, from the Lebesgue Convergence Theorem we get In a consequence we obtain that w ≥ u on B(x, r) for any u ∈ S g . Hence, P [g] ≤ w in B(x, r). This ends the proof of harmonicity of P [g]. Now, we shall show the second part of the theorem. Let f be a barrier for Ω at x 0 . Fix ǫ > 0, since g is continuous on ∂Ω, there exists r > 0 such that g(x 0 ) − ǫ < g(y) < g(x 0 ) + ǫ holds for all y ∈ ∂Ω ∩ B(x 0 , r). Hence, for any C > 0 the inequality g(x 0 ) − ǫ + Cf (y) < g(y) < g(x 0 ) + ǫ − Cf (y) (41) holds in ∂Ω ∩ B(x 0 , r). Moreover, since f is negative on ∂Ω \ B(x 0 , r), there exists C, such that inequality (41) holds on ∂Ω. Thus, it holds that g(x 0 ) − ǫ + Cf ∈ S g , and by the definition of the lower Perron solution Let now h ∈ S g . We have that h ≤ g < g(x 0 ) + ǫ − Cf on ∂Ω.
Finally, (42) and (43) result in P [g](y) = g(x 0 ) + ǫ − Cf (y) for all y ∈ Ω. The continuity of f together with the Property (2) of barrier functions (cf. Definition 6.4) imply the second assertion of the theorem, as ǫ > 0 is chosen arbitrarily small. The proof of Theorem 6.4 is, thus, completed.
The following result is one of main theorems of the paper. We establish the equivalence between the solvability of the Dirichlet problem in the underlying domain and the solvability of Dirichlet problems in all balls contained in the domain. Theorem 6.5. Let (X, d, µ) be a metric space with metrically continuous measure such that all balls are connected. Suppose that Ω ⊂ X is a domain and g : ∂Ω → R is a continuous function. Moreover, let us assume that the harmonic Dirichlet problem has a solution on an arbitrary ball B ⊂ Ω with a boundary data g| ∂B .
Then, the Dirichlet problem has a solution in Ω if and only if at every x ∈ ∂Ω there exists a barrier function, and for every ball in Ω there exists a solution of the Dirichlet problem with g.
Proof. The necessity part of the proof of Theorem 6.5 immediately follows from Theorem 6.4.
In order to show the sufficiency part, let us assume that the Dirichlet problem has a solution in Ω for a boundary data g as in assumptions of the theorem. We fix any x ∈ ∂Ω and consider y ∈ ∂Ω, a point distinct from x. By the Urysohn lemma, there exists a continuous function h : ∂Ω → [−1, 0] such that h(x) = 0, h(y) = −1 and h| ∂Ω\{x,y} ∈ (−1, 0). Let G be a unique solution to the Dirichlet problem in Ω with boundary condition g := h. Then G is a barrier in Ω.

The Liouville theorem
The Liouville theorem is a classical result in the theory of harmonic functions in R n . The purpose of this section is to establish similar results for strongly and weakly harmonic functions on metric measure spaces. It turns out that already on R we may choose such a measure, so that the Liouville theorem fails, cf. Example 4. However, below we establish a fairly general condition on a measure resulting in the Liouville theorem, see (45) and (46) in Theorem 7.2. Moreover, we discuss some sufficient conditions on a measure and a metric space to ensure that Theorem 7.2 holds, see Remark 7 and Corollary 7.1. For strongly harmonic functions a variant of the Liouville theorem follows from the Harnack inequality on balls, see Theorem 7.3.
Let us begin with the following simple observation.
Proposition 7.1. Suppose that f ∈ H(Ω, µ) and let f > 0 in Ω, then g ∈ H(Ω, f µ) if and only if gf ∈ H(Ω, µ). Moreover, the assertion remains true for f, g ∈ wH(Ω, µ) and f > 0 provided that f and g have the same sets of admissible radii r x i for i = 1, 2, . . . at every point x ∈ Ω.
Thus, assumption (46) of Theorem 7.2 is satisfied implying that f is constant. The proof of the theorem is, therefore, completed.
The Liouville theorem can also be obtain from the Harnack inequality on balls, see Lemma 4.1. Below we assume that µ is bounded, restricting the set of admissible measures, but on the other hand we require harmonic function to be bounded from below only. Namely, the following result holds. Theorem 7.3. Let X be a geodesic metric measure space with doubling measure µ. Then, every bounded from below harmonic function in H(X, µ) is constant.
Proof. Let f ∈ H(X, µ) and define g = f − inf X f ≥ 0. By Proposition 3.1(1) we have that g ∈ H(X, µ). By the Harnack inequality, see Lemma 4.1, we have that for all x ∈ X and any ball B(x, r) ∈ X g(x) ≤ sup g → 0, as r → ∞.
Hence, g ≡ 0 and, in turn, f is constant.
In the setting of weakly harmonic functions the same type of argument cannot be applied. Indeed, if r B M → ∞, then the Harnack constant C H in Lemma 4.1 grows unbounded.