Weakly porous sets and Muckenhoupt $A_p$ distance functions

We examine the class of weakly porous sets in Euclidean spaces. As our first main result we show that the distance weight $w(x)=\operatorname{dist}(x,E)^{-\alpha}$ belongs to the Muckenhoupt class $A_1$, for some $\alpha>0$, if and only if $E\subset\mathbb{R}^n$ is weakly porous. We also give a precise quantitative version of this characterization in terms of the so-called Muckenhoupt exponent of $E$. When $E$ is weakly porous, we obtain a similar quantitative characterization of $w\in A_p$, for $1<p<\infty$, as well. At the end of the paper, we give an example of a set $E\subset\mathbb{R}$ which is not weakly porous but for which $w\in A_p\setminus A_1$ for every $0<\alpha<1$ and $1<p<\infty$.


Let E
R n , n ∈ N, be a nonempty set.We are interested in the Muckenhoupt A p properties of the weights where α ∈ R. Previously, these properties have been studied, for instance, in [1,2,3,4,8,12].It is known, by [4,Corollary 3.8(b)], that if the set E is porous, then w α,E belongs to the Muckenhoupt class A 1 if and only if 0 ≤ α < n − dim A (E); here dim A (E) is the Assouad dimension of E. Since dim A (E) < n if and only if E ⊂ R n is porous (see e.g.[11,Section 5]), it follows in particular that for each porous set E ⊂ R n there exists some α > 0 such that w α,E is an A 1 weight.The results in [4] do not apply for nonporous sets, but the bound 0 ≤ α < n − dim A (E) for admissible α might suggest that w α,E cannot be an A 1 weight for any α > 0 if E ⊂ R n is not porous, since then dim A (E) = n.However, Vasin showed in [13] that if E is a subset of the unit circle T ⊂ R 2 , then the weight w α,E belongs to the class A 1 (T), for some α > 0, if and only if E is weakly porous; see Section 3 for the definition and commentary concerning this condition.
The definition of weak porosity in [13] is rather specific to the one-dimensional case.Our first goal in this paper is to extend both this condition and the related characterization of the A 1 property of the weight dist(•, E) −α .The underlying ideas are in principle similar to those in Vasin [13], but the higher dimensional case requires several nontrivial modifications.In particular, we use dyadic definitions and tools, including a type of dyadic iteration, that lead to efficient and natural proofs.
Our first main result can be stated as follows.
Theorem 1.1.Let E R n be a nonempty set.Then dist(•, E) −α ∈ A 1 , for some α > 0, if and only if E is weakly porous.
One consequence of Theorem 1.1 is that if E R n is weakly porous, then dist(•, E) −α is locally integrable for some α > 0. This implies that the upper Minkowski dimension of E ∩ B(x, r) is strictly less than n for every x ∈ R n and r > 0; see Remark 6.8 for more details.
Theorem 1.1 is quantitative in the sense that α and the constants in the A 1 and weak porosity conditions only depend on each other and n.More precise dependencies are given in Lemma 4.1 and Lemma 5.3, which prove the necessity and sufficiency in Theorem 1.1, respectively.
A closely related question is to quantify the precise range of exponents α ∈ R for which the weight w α,E (x) = dist(x, E) −α belongs to the Muckenhoupt class A p for a given 1 ≤ p < ∞.If E ⊂ R n is porous, it follows from [4,Corollary 3.8] that w α,E ∈ A 1 if and only if 0 ≤ α < n − dim A (E), and w α,E ∈ A p , for 1 < p < ∞, if and only if In this paper we obtain the following extension of [4,Corollary 3.8] for weakly porous sets, given in terms of the Muckenhoupt exponent Mu(E) that we introduce in Definition 6.1.For a porous set E ⊂ R n it holds that Mu(E) = n − dim A (E), see Section 6 for details.
Theorem 1.2.Assume that E ⊂ R n is a weakly porous set.Let α ∈ R and define w(x) = dist(x, E) −α for every x ∈ R n .Then (i) w ∈ A 1 if and only if 0 ≤ α < Mu(E).
(ii) w ∈ A p , for 1 < p < ∞, if and only if If we omit the special case α = 0, in which the connection to the geometry of E is lost, then in part (i) of Theorem 1.2 the assumption that E is weakly porous is actually superfluous, and we have the following full characterization.Theorem 1.3.Assume that E ⊂ R n is a nonempty set.Let α ∈ R \ {0} and define w(x) = dist(x, E) −α for every x ∈ R n .Then w ∈ A 1 if and only if 0 < α < Mu(E).
By combining Theorems 1.1 and 1.3, we see that E is weakly porous if and only if Mu(E) > 0; cf.Corollary 6.6 and Remark 6.7 for related comments.
Theorem 1.3 raises the question whether also (1) could provide a full characterization of w α,E ∈ A p when α = 0 and 1 < p < ∞.In Section 8 we show that this is not the case, by giving a nontrivial construction of a set E ⊂ R n which is not weakly porous (whence Mu(E) = 0) but still w α,E ∈ A p for all 0 < α < 1 and all 1 < p < ∞.This set illustrates the delicate interplay between the Muckenhoupt conditions and the distance functions, and also gives a novel type of an example of weights which are in A p for all 1 < p < ∞ but not in A 1 .Nevertheless, a full characterization of sets E ⊂ R n for which w α,E ∈ A p for some (or all) 1 < p < ∞ remains an open question.
Another interesting consequence of Theorem 1.2 is the following strong self-improvement property of A p -distance weights for weakly porous sets: if α ≥ 0 and E is weakly porous, then w α,E ∈ A p for some 1 < p < ∞ (i.e.w α,E ∈ A ∞ ) if and only if w α,E ∈ A 1 .The example in Section 8 shows that this is not true for general sets.
The outline for the rest of the paper is as follows.In Section 2 we introduce notation and recall some definitions and properties of dyadic decompositions and Muckenhoupt weights.Weakly porous sets are defined in Section 3, where we also examine some of their basic properties.Theorem 1.1 is proved in Sections 4 and 5. Section 6 contains the definition of the Muckenhoupt exponent and the proofs of Theorems 1.2 and 1.3, together with some related results.In Section 7, we give an example of a weakly porous set E ⊂ R n which is not porous and compute explicitly the Muckenhoupt exponent of E. Finally, in Section 8 we construct the set E ⊂ R which is not weakly porous, but still w α,E ∈ A p for all 0 < α < 1 and 1 < p < ∞.

Preliminaries
Throughout this paper, we consider R n equipped with the Euclidean distance and the n-dimensional Lebesgue (outer) measure.The diameter of a set E ⊂ R n is denoted by diam(E) and |E| is the Lebesgue (outer) measure of E. If x ∈ R n , then d E (x) = dist(x, E) denotes the distance from x to the set E, and dist(E, F ) is the distance between the sets E and The open ball with center x ∈ R n and radius r > 0 is In this paper, we only consider cubes which are half-open and have sides parallel to the coordinate axes.That is, a cube in R n is a set of the form and r > 0, the cube with center x and side length 2r is Clearly, Q for every j = 0, 1, 2, . ... The cubes in D(Q 0 ) are called dyadic cubes (with respect to Q 0 ) and they satisfy following properties: (D1) Let j ≥ 1 and Q ∈ D j (Q 0 ).Then there exists a unique dyadic cube πQ for every cube Q ⊂ R n .The smallest possible constant C in (3) is called the A 1 constant of w, and it is denoted by [w] A 1 .
Above, we have used the notation for the mean value integral over a measurable set A ⊂ R n with 0 < |A| < ∞.For 1 < p < ∞, the class A p is defined as follows.
Definition 2.2.A weight w in R n belongs to the Muckenhoupt class A p , for 1 < p < ∞, if there exists a constant C such that for every cube Q ⊂ R n .The smallest possible constant C in ( 4) is called the A p constant of w, and it is denoted by [w] Ap .
We recall that the inclusions A 1 ⊂ A p ⊂ A q hold for 1 ≤ p ≤ q.Also, it is immediate that w ∈ A p , for 1 < p < ∞, if and only if w 1−p ′ ∈ A p ′ , and then [w Chapter IV] for an introduction to the theory of Muckenhoupt weights.
The following elementary property will be useful in Section 6.
Proof.Let q ≥ p be large enough so that s = 1 q−1 ≤ β and w ∈ A q .Then we have w s ∈ A 1 as well, thanks to Jensen's inequality.The A q condition on a cube Q ⊂ R n for w yields and thus w ∈ A 1 .

Weakly porous sets
Recall that a set E ⊂ R n is porous if there exists a constant c > 0 such that for every x ∈ R n and r > 0 there exists y ∈ R n satisfying B(y, cr) ⊂ B(x, r) \ E. Equivalently, E is porous if and only if there is a constant c > 0 such that for all cubes In [13] Vasin defined weak porosity in the unit circle T ⊂ R 2 as follows: a set E ⊂ T is weakly porous, if there are constants c, δ > 0 such that if I ⊂ T is an arbitrary arc, then where the sum is taken over all (pairwise disjoint) subarcs J k ⊂ I that contain no points of E and satisfy |J k | ≥ δ|J|, where J ⊂ I is a lengthwise largest subarc without points of E. The subarcs that do not intersect E are called free arcs.
We consider an extension of the above definition to R n .
We denote by M(P ) ∈ D(P ) a largest E-free dyadic subcube of P , that is, ℓ(M(P )) ≥ ℓ(R) if R ∈ D(P ) is an E-free dyadic subcube of P .Such a cube need not be unique, but we fix one of them.(ii) The set E ⊂ R n is weakly porous, if there are constants 0 < c, δ < 1 such that for all cubes P ⊂ R n there exist N ∈ N and pairwise disjoint E-free cubes Q k ∈ D(P ), k = 1, . . ., N, such that |Q k | ≥ δ|M(P )| for all k = 1, . . ., N and Instead of dyadic cubes, also general subcubes of P could be used in the definition of weak porosity.However, the dyadic formulation is convenient from the point of view of our proofs.Notice also that inequality (5) can be written as since the cubes Q 1 , . . ., Q N are pairwise disjoint.Hence, the weak porosity of a set E can roughly be described as follows: for every cube P , the union of those disjoint E-free subcubes that are not too small (compared to the largest E-free cube in P ) has measure comparable to that of P .
The following properties are easy to verify using the definition of weak porosity: • If E ⊂ R n is porous, then E is weakly porous.
• E ⊂ R n is weakly porous if and only if the closure E is weakly porous.
• If E ⊂ R n is weakly porous, then |E| = 0.This is a consequence of the Lebesgue differentiation theorem.• Weak porosity implicitly implies that for every cube P ⊂ R n there exists an E-free dyadic subcube Q ∈ D(P ).Let E ⊂ R n be a nonempty set.Given a cube P ⊂ R n and δ > 0, we write We denote by F δ (P ) the maximal subfamily of the cubes in F δ (P ).That is, each R ∈ F δ (P ) is contained in some cube Q ∈ F δ (P ) and if Q ∈ F δ (P ), then Q is not strictly contained in another cube in F δ (P ).Observe that the cubes in F δ (P ) are pairwise disjoint, since two dyadic cubes are either disjoint, or one of them is strictly contained in the other one.The weak porosity of E can now be formulated in terms of the sets F δ , since E is weakly porous if and only if there are constants 0 < c, δ < 1 such that Indeed, it is clear that (6) implies weak porosity of E. Conversely, |Q|, whenever c, δ, P and Q k , k = 1, . . ., N, are as in Definition 3.1 (ii).Part (ii) of the next lemma will be important when proving that weak porosity implies the A 1 -property for dist(•, E) −α , for some α > 0; see the proof of Lemma 5.2.Lemma 3.2.Assume that E ⊂ R n is weakly porous set, with constants 0 < c, δ < 1.Then the following statements hold.
(iii) Assume that Q ⊂ R are two cubes.Then there exist constants C = C(n, c, δ) and σ = σ(n, c, δ) > 0 such that Proof.We first remark that the dyadic grids D(Q) and D(R) need not be compatible, and this is taken into account in the arguments below.First we show (i).Fix S ∈ F δ (R).We claim that the center x S ∈ R of S belongs to R \ Q. Assume the contrary, namely, that x S ∈ Q.Since S is E-free and Q intersects E, there exists an E-free dyadic cube T ∈ D(Q) such that ℓ(T ) ≥ ℓ(S)/4.It follows that This is a contradiction, since |M(Q)| < 4 −n δ|M(R)| by assumption.We have shown that x S ∈ R \ Q, and therefore there exists a cube By weak porosity, the last term above is bounded below by 2 −n c|R|, and reorganizing the terms gives (1 − 2 −n c)|R| ≥ |Q| as claimed in (i).
Next we show (ii).
In this case, we may take k = 1.In the sequel we assume that . Then there exists a finite sequence and therefore the contrapositive of part (i) implies that for all i = 1, 2, . . ., k.This allows us to conclude that The desired conclusion follows, since Finally, we prove (iii).An easy computation shows that R ⊂ λQ, for λ = 3ℓ(R)/ℓ(Q).Here λQ denotes the cube with the same center as Q and side-length equal to λℓ(Q).Then, for Then, by iterating (ii) we obtain where σ = σ(n, c, δ).The claim (iii) follows by combining the above estimates.
Example 3.3.Unlike for porous sets, inclusions do not preserve weak porosity: there are sets F ⊂ E such that E is weakly porous but F is not.For instance, Z is clearly a weakly porous subset of R, but N ⊂ Z is not a weakly porous subset of R. Indeed, assume for the contrary that N is weakly porous in R with constants 0 < c, δ < 1.Consider cubes . By choosing j large enough, we get a contradiction.

A 1 implies weak porosity
This section and the following Section 5 contain the proof of Theorem 1.1.We begin by proving the necessity part of the equivalence in the theorem, that is, if dist(•, E) −α is an A 1 weight, then E is a weakly porous set.The straight-forward proof illustrates in a nice way the connection between the A 1 condition and the definition of weak porosity.Lemma 4.1.Let E ⊂ R n be a nonempty set, let α > 0, and write w E) and E is weakly porous if and only if E is weakly porous, quantitatively, we may assume that E is closed.Assume that w ∈ A 1 and fix 0 < δ < 1 to be chosen later.Let P ⊂ R n be a cube and write ℓ = ℓ(M(P )) for the sidelength of M(P ).
Observe that the set E is of measure zero, since w is locally integrable and w(x) = ∞ in E. Since E is closed, for every x ∈ P \ E we have dist(x, E) > 0 and therefore there exists an E-free dyadic cube Q ∈ D(P ) such that x ∈ Q.As a consequence, we can write P \ E as a disjoint union of maximal E-free dyadic cubes for every x ∈ (P \ E) \ Q∈F δ (P ) Q.By integrating, and using the fact that E is of measure zero, we obtain Denote by y the center of M(P ) ⊂ P .Then Simplifying, we get It remains to choose δ = δ(n, α, [w] A 1 ) > 0 so small that C(n, α)δ α/n [w] A 1 < 1, and condition (6) follows.

Weak porosity implies A 1
Next, we turn to the sufficiency part of the equivalence in Theorem 1.1, that is, the weak porosity of E implies that dist(•, E) −α is an A 1 weight; see Lemma 5.3.The proof applies an iteration scheme, which is built on an efficient use of the dyadic definition of weak porosity; see the proof of Lemma 5.2.The following sets F k δ and G k δ will be important in the iteration.Fix a weakly porous closed set E ⊂ R n with constants 0 < c, δ < 1 and a cube P 0 ⊂ R n .Recall that F δ (P 0 ) is the maximal subfamily of the collection We will need also the complementary family G δ (P 0 ), which is defined to be the maximal subfamily of the collection Due to the lattice properties of dyadic cubes, we have |Q| ≥ δ|M(P 0 )| for all Q ∈ G δ (P 0 ).Indeed, such a cube Q ∈ G δ (P 0 ) cannot be contained in any cube belonging to F δ (P 0 ), but, on the other hand, the dyadic parent πQ ∈ D(P 0 ) of Q must intersect some R ∈ F δ (P 0 ).Consequently R πQ, and and in general, for k = 3, 4, . .., we define Lemma 5.1.Assume that E ⊂ R n is a weakly porous closed set with constants 0 < c, δ < 1.
Let P 0 ⊂ R n be a cube, and let sets F k δ , for k = 1, 2, . .., be as above.Then . Repeating this argument, for every k we obtain cubes Letting k → ∞, we derive a contradiction.Lemma 5.2.Assume that E ⊂ R n is a weakly porous closed set with constants 0 < c, δ < 1.Let P 0 ⊂ R n be a cube and let sets F k δ , for k = 1, 2, . .., be as above.Then there are constants Proof.Let 0 < γ < 1 n , whose exact value will be fixed later; we remark that both inequalities γ > 0 and γ < 1 n are needed in Lemma 5.3 below.By the definition of F k δ , we obtain for every k = 1, 2, . ... Next, we show by induction that Since πP, Q ∈ D(R), we have πP ⊂ Q or Q ⊂ πP by the nestedness property (D3) of dyadic cubes.Clearly πP ⊂ Q is not possible, as this would lead to the contradiction Using also the definition of F δ (R), we get On the other hand, since E is weakly porous, we have by (6) that Applying the two estimates above and the induction hypothesis (8) for k, we obtain This proves (8) for k + 1, and thus the claim holds for every k ∈ N, by the principle of induction.
Hence, by using also (7) and ( 8), we have Lemma 5.3.Assume that E ⊂ R n is a weakly porous set with constants 0 < c, δ < 1.Then there are constants Proof.Observe that the closure E is also weakly porous.Since dist(•, E) = dist(•, E), we may assume in the sequel that E is a weakly porous closed set.Throughout this proof C denotes a constant that can depend on n, c and δ.Let 0 < γ = γ(n, c, δ) < 1 n be as in Lemma 5.2.Fix a cube P 0 ⊂ R n , and assume first that P 0 is not an E-free cube.Let sets F k δ , for P 0 and k = 1, 2, . .., be defined as above.
Since γn < 1, we have for every E-free cube Q the estimate In particular, the upper bound γn < 1 implies that the second integral in ( 9) is finite.
Bearing in mind that |E| = 0, using Lemma 5.1 and combining (9) with Lemma 5.2, we obtain Let x ∈ P 0 \ E. Since E is closed, the point x is contained in a maximal E-free dyadic cube Q ∈ D(P 0 ).Recall that P 0 is not E-free, and so Q is a strict subcube of P 0 .Furthermore πQ is not E-free due to maximality of Q.This implies that Hence, ess inf and we conclude that It remains to consider the case where P 0 is an E-free cube.We study two situations separately.If dist(P 0 , E) < 2 diam(P 0 ), then we have dist(x, E) ≤ 3 diam(P 0 ) for every x ∈ P 0 , and so ess inf Using ( 9), together with this observation, we obtain Finally, we consider the case dist(P 0 , E) ≥ 2 diam(P 0 ).If x, y ∈ P 0 , then for all x ∈ P 0 , and so By combining estimates (10), (11), and ( 12), we see that dist(•, E) −γn ∈ A 1 (R n ), and this proves the theorem with α = γn.

Muckenhoupt exponent
In this section, we introduce the concept of Muckenhoupt exponent and explore its connections to weak porosity and the A p properties of distance weights, for 1 ≤ p < ∞.In particular, we prove Theorems 1.2 and 1.3 at the end of this section.
For a bounded set A ⊂ R n and r > 0, we let N(A, r) denote the minimal number of open balls of radius r that are needed to cover the set A. Recall that the Assouad dimension , where the Assouad codimension codim A (E) is the supremum of α ≥ 0 such that for every x ∈ E and 0 < r < R.Here is the open r-neighborhood of E. See e.g.[9, (3.11)] for more details concerning this equivalence, which also follows from Lemma 6.2.
It is well-known that a set E ⊂ R n is porous if and only if dim A (E) < n, or equivalently codim A (E) > 0, as was already pointed out in the introduction.See e.g.[11,Section 5] or [10,Theorem 10.25] for details.The following Muckenhoupt exponent can be seen as a refinement of the Assouad codimension: for porous sets these two agree but the Muckenhoupt exponent can be nonzero also for nonporous sets; see the comment after Definition 6.1.
) is a ball in R n , we denote by h E (B(x, r)) the supremum of all t > 0 such that B(y, t) ⊂ B(x, r) \ E for some y ∈ B(x, r).If there is no such number t > 0, then we set h E (B(x, r)) = 0. (ii) If h E (B(x, R)) > 0 for every x ∈ E and R > 0, then the Muckenhoupt exponent Mu(E) is the supremum of the numbers α ∈ R for which there exists a constant C such that for every x ∈ E and 0 It is clear from the definition that Mu(E) ≥ 0 for all sets E ⊂ R n , since (14) On the other hand, if E ⊂ R n is not porous, then codim A (E) = 0 ≤ Mu(E), and thus always codim A (E) ≤ Mu(E).This inequality is strict if and only if E is weakly porous but not porous since the weak porosity of E is characterized by Mu(E) > 0, see Corollary 6.6.
As an example, it is straightforward to see that codim A (Z) = 0 and Mu(Z) = 1.See also Section 7 for other examples of such sets.
In Lemma 6.3 below we give for the Muckenhoupt exponent an alternative characterization, which resembles the definition of the Assouad dimension.The following estimate will be applied in the proof of Lemma 6.3.
and thus ), r .This proves the second inequality in the claim.
Conversely, let {B(x i , r)} N i=1 be a cover of E ∩ B(x, R/2) such that x i ∈ E ∩ B(x, R/2) for all i = 1, . . ., N and the balls B(x i , r/2) are pairwise disjoint (such a cover can be found by choosing {x i } N i=1 to be a maximal r-net in E ∩ B(x, R/2), see [7, p. 101]).Then and thus 2), r .This proves the first inequality in the claim.Lemma 6.3.Let E ⊂ R n be such that h E (B(x, R)) > 0 for every x ∈ E and R > 0. Then Mu(E) is the supremum of the numbers α ≥ 0 for which there exists a constant C such that for every x ∈ E and 0 < r < h E (B(x, R)) ≤ R.
Proof.Assume first that α ≥ 0 is such that (15) holds for every x ∈ E and 0 )) ≤ R < 2R, and by Lemma 6.2 and (15) we have Thus α ≤ Mu(E).By the definition of Muckenhoupt exponent, we always have Mu(E) ≥ 0. If Mu(E) = 0 and (15) holds for α ≥ 0, the preceding computation shows that α = 0 as well, and the result follows.Then assume that 0 ≤ α < Mu(E) and let x ∈ E and 0 < r < h E (B(x, R)) ≤ R. By Lemma 6.2 and ( 14), for α and a constant C α , we have Since this holds for every 0 ≤ α < Mu(E), we conclude that Mu(E) is indeed the supremum of α for which (15) holds for all x ∈ E and 0 < r < h E (B(x, R)) ≤ R.
Next, we turn to the relations between the Muckenhoupt exponent and A 1 weights.Lemma 6.4 and Theorem 6.5 together characterize the property dist(•, E) −α ∈ A 1 , for α = 0, in terms of the Muckenhoupt exponent of E; see the proof of Theorem 1.3 after the proof of Theorem 6.5.Lemma 6.4.Let E ⊂ R n be a nonempty set and let α ∈ R be such that dist( Proof.Assume first that α < 0. Let x ∈ E and r > 0. Then here the cube Q(x, r) is as in (2).Thus dist(y, E) −α = 0 for almost every y ∈ Q(x, r), which is a contradiction since dist(•, E) −α is a weight.Hence α ≥ 0.
The claim holds if α = 0, and so we may assume that α > 0. Then h E (B(x, R)) > 0 for every x ∈ E and R > 0. Indeed, otherwise there exists a ball B(x, R) such that dist(y, E) = 0 for every y ∈ B(x, R), and therefore dist(•, E) −α is not locally integrable.This is again a contradiction since dist(•, E) −α is a weight.
Let x ∈ E and 0 < r < h E (B(x, R)) ≤ R, and write and hence ess inf Since dist(y, E) < r for every y ∈ F and F ⊂ B(x, R) ⊂ Q(x, R), using the A 1 condition (3) we obtain and the claim Mu(E) ≥ α follows.
Theorem 6.5.Let E ⊂ R n be a nonempty set and assume that 0 Proof.It suffices to show that there exists a constant C > 0 such that for all x ∈ E and r > 0. Indeed, if dist(Q, E) < 2 diam(Q) for a cube Q ⊂ R n , then the desired A 1 property (3) for w = dist(•, E) −α follows easily from ( 16) by considering a ball B = B(x, r) such that x ∈ E, Q ⊂ B and |B| ≤ C(n)|Q|.On the other hand, if dist(Q, E) ≥ 2 diam(Q), then an argument similar to the one leading to (12) shows that (3) holds, and thus dist(•, E) −α ∈ A 1 .

Define
F j = {y ∈ B(x, r) : dist(y, E) ≤ 2 1−j r} and A j = F j \ F j+1 , for j ≥ j 0 .Since λ < Mu(E), there is a constant Since λ > 0 and E ∩ B(x, r) ⊂ F j for every j ≥ j 0 , by letting j → ∞ we see in particular that |E ∩ B(x, r)| = 0.Here r > 0 is arbitrary, and thus and therefore 0 < dist(y, E) ≤ h E (B(x, 2r)) ≤ 2 1−j 0 r.It follows that the union of sets A j with j ≥ j 0 covers B(x, r) up to the set E ∩ B(x, r), which has measure zero.If y ∈ A j , then 2 −j r < dist(y, E) ≤ 2 1−j r.In addition, A j ⊂ F j for every j ≥ j 0 .By combining the above observations and using (17) we obtain This shows that (16) holds, and the claim follows.
Recall that Theorem 1.3 states, for a nonempty set E ⊂ R n and α = 0, that dist(•, E) −α ∈ A 1 if and only if 0 < α < Mu(E).We are now ready to prove this.
Since dist(•, E) 0 ∈ A 1 holds for all (nonempty) sets E ⊂ R n (under the interpretation that 0 0 = 1), Theorem 1.3 implies that for all nonempty sets E ⊂ R n .On the other hand, by Theorem 1.1 we have dist(•, E) −α ∈ A 1 , for some α > 0, if and only if E is weakly porous.This, together with Theorem 1.3, gives the following corollary.Corollary 6.6.A nonempty set E ⊂ R n is weakly porous if and only if Mu(E) > 0.
Using Theorem 1.3 and Corollary 6.6, we can prove Theorem 1.2, as follows.
Proof of Theorem 1.2.Since E is weakly porous, we have Mu(E) > 0 by Corollary 6.6.Therefore, the equivalences in both (i) and (ii) hold if α = 0, and so we may assume from now on that α = 0.In this case the claim in (i) follows directly from Theorem 1.3.
In part (ii), let 1 < p < ∞ and assume first that w ∈ A p .Because E is weakly porous, Lemma 5.3 provides us with some σ > 0 for which dist(•, E) −σ ∈ A 1 (R n ).If α > 0, we can use Lemma 2.3 with β = σ/α to deduce that w = dist(•, E) −α ∈ A 1 .Then Theorem 1.3 implies Mu(E) > α, and so (1) holds.On the other hand, if α < 0, then we have Hence the previous case, for a positive power and the class A p ′ , shows that which is equivalent to (1).Conversely, assume that (1) holds for some α = 0.If α > 0, then w = dist(•, E) −α ∈ A 1 ⊂ A p by Theorem 1.3.Finally, if α < 0, we observe that (1) is equivalent to (18), where −α p−1 > 0. Thus we may apply the preceding case for the exponent −α p−1 > 0 and the class A p ′ to conclude that dist(•, E) α/(p−1) ∈ A p ′ .Hence w = dist(•, E) −α ∈ A p , proving part (ii).Remark 6.7.Note that in part (i) of Theorem 1.2 the explicit assumption that E is weakly porous is needed in the necessity part, since for α = 0 the claim w ∈ A 1 holds for all (nonempty) sets E ⊂ R n .However, if α > 0, then we know by Theorem 1.1 that w ∈ A 1 can only hold if E is weakly porous, which in turn is equivalent to Mu(E) > 0.
In part (ii) the case α = 0 again shows that (1) is not necessary for w ∈ A p , for general sets E ⊂ R n .Moreover, if we do not assume weak porosity of E, then even in the case α = 0 the requirement (1) is not necessary for w ∈ A p .This follows from Theorem 8.1, which gives a set E ⊂ R with Mu(E) = 0, i.e.E is not weakly porous, such that dist(•, E) −α ∈ A p for all 0 < α < 1 and all 1 < p < ∞.Remark 6.8.When E ⊂ R n is a bounded set, the upper Minkowski (or box ) dimension dim M (E) is the infimum of all λ ≥ 0 for which there is a constant C such that for every 0 < r < diam(E).Note that ( 19) is equivalent to the condition that there is a constant C such that |E r | ≤ Cr n−λ for every 0 < r < diam(E); this follows from Lemma 6.2.If a set E ⊂ R n is weakly porous and 0 < α < Mu(E), then dist(•, E) −α ∈ A 1 by Theorem 1.3, and so B(x,R) dist(y, E) −α dy < ∞ for every x ∈ E and R > 0. Hence, if x ∈ E and R > 0, then it holds for all 0 < r < diam(E ∩ B(x, R)) ≤ 2R that On the other hand, the condition that dim M (E ∩ B(x, R)) ≤ c < n for every x ∈ E and R > 0 is not sufficient for the weak porosity of E. For instance, if E ⊂ Z ⊂ R is not weakly porous (e.g.E = N), then we have dim See also [14] and the references therein for much more elaborate connections between Minkowski dimensions and the integrability of distance functions.

Example of a weakly porous set
The notions of weak porosity and Muckenhoupt exponent are interesting only if there are (plenty of) weakly porous sets which are not porous.Below we construct a family of such sets in R n and determine the Muckenhoupt exponents for different values of the parameter γ > 0. These sets are inspired by the often used one-dimensional example {j −γ : j ∈ N} ∪ {0} ⊂ R. For instance, in [5, Section 6] such sets were applied to illustrate the so-called Assouad spectrum.
Theorem 7.1.Let n ∈ N and γ > 0. Then the set The origin is included in E in order to have a compact set, but for our purposes this does not make any essential difference.See Figure 1 for an illustration of the set E. By considering the balls B(0, j −γ ) as j → ∞, it is straightforward to verify that E is not porous, and hence dim A (E) = n.Moreover, special cases of the computations in the proof of Theorem 7.1 below can be used to show that dim M (E) = max{n − 1, n 1+γ }, and so in combination with Theorem 7.1 we obtain for the set E the identity Mu(E) = n − dim M (E); compare to Remark 6.8.
For the proof of Theorem 7.1, we define S t = ∂B(0, t) and A t s = B (0, t)\ B (0, s) for every 0 ≤ s ≤ t, where we use the notation B(0, 0) = ∅.We begin with the following lemma.Lemma 7.2.Let B = B(x, R) ⊂ R n be a ball such that x ∈ S t , with t = j −γ for some j ∈ N, and B ∩ E = B ∩ S t .Then (14) holds for B if and only if α ≤ 1.Moreover, if α ≤ 1, then the constant in (14) for B can be chosen to depend on n, γ and α only.
Proof.We have h E (B) = R/2, and given 0 < r < h E (B), the set where H n−1 is the normalized Hausdorff measure in R n .For each b ∈ [t − r, t + r], the set S b ∩ B is a hyperspherical cap within the sphere S b , whose angle α b satisfies, by virtue of the law of cosines, that cos For a sufficiently small constant c(γ), we have that for every b ∈ [t−r, t+r].The sets Bearing in mind this observation and ( 20) and ( 21), we obtain If α ≤ 1, the last term is bounded by C(n, γ, α).On the other hand, if α > 1, then (20) and (21) yield and the last term tends to infinity as r → 0.
Proof of Theorem 7.1.First we show that ( 14) holds for every α with 0 < α < min{1, nγ 1+γ }.This implies that Mu(E) ≥ min{1, nγ 1+γ } > 0, and thus E is weakly porous, by Corollary 6.6.Fix 0 < α < min{1, nγ 1+γ } and let B = B(x, R) ⊂ R n be a ball with x ∈ E, and let 0 < r < h E (B).We suppose first that B is contained in B(0, 1).Let k be the largest number in N and N be the smallest number in since the center x of B belongs to E. In the case N = k + 2 we have x ∈ S (k+1) −γ , and ( 14) follows immediately from Lemma 7.2.Hence we may assume that N ≥ k + 3. Also, observe that (23) Now we study two cases.

A p -distance set that is not weakly porous
In this section we construct a set E ⊂ R such that dist(•, E) −α ∈ A p \ A 1 for all 0 < α < 1 and all 1 < p < ∞; see Theorem 8.1.Recall that we abbreviate d E = dist(•, E).
Let E 0 = {0, 1} and write t n = 1 − 1 2n for every n ∈ N.Then, for every n ∈ N, the set E n is defined as n−1 is a translation of E n−1 dilated by the factor t n and whose first point is the last point of Here −E + is the reflection of E + with respect to the origin.We let Q n , Q 1 n , and Q 2 n denote the smallest intervals containing E n , E 1 n , and E 2 n respectively, for every n ∈ N ∪ {0}.See Figure 2 for an illustration of the first steps of the construction.
During the rest of this section, we prove the following theorem for the set E.
First steps of the construction of the set E Theorem 8.1.Let E ⊂ R be as constructed above.Then it holds for all 0 < α < 1 and all In particular, the set E is not weakly porous and Mu(E) = 0.
We say that a closed interval I is an edge of E if the endpoints of I are two consecutive points of E. For every n ∈ N ∪ {0}, the following properties hold: • Each of the intervals Q n , Q 1 n , and Q 2 n has 3 n edges of E, of which the middle ones for n ≥ 1 have lengths equal to n contains translated copies of the intervals Q 0 , . . ., Q n distributed in a palindromic manner: both Q n and Q 2 n contain from left to right as well as from right to left intervals n contains from left to right as well as from right to left intervals Lemma 8.2.For every n ∈ N and every β > −1, we have Proof.Let n ∈ N and β > −1.By the construction of E and the definition of Q n , we obtain The claim follows by combining the above identity with the fact Lemma 8.3.For every 0 < α < 1 and 1 < p < ∞, there exists N 0 ∈ N, only depending on α and p, for which for every n ≥ N 0 .
Proof.Consider the functions Taking N 0 ∈ N large enough so that N 0 ≥ 1/(2ε) it follows that |1 − t n | ≤ ε for every n ≥ N 0 , and so the above estimates yield Lemma 8.4.For every 0 < α < 1, the weight d −α E does not belong to A 1 .Proof.Let N 0 be the constant in Lemma 8.3 with, say, p = 2; the value of p is irrelevant here.Applying repeatedly Lemma 8.2, we obtain, for every n ∈ N, By the first inequality of Lemma 8.3, we have and it follows that Since the harmonic series diverges, we see that lim n→∞ Qn d −α E = ∞.On the other hand, each Q n contains edges of E of length equal to 1, and thus ess inf Qn d Lemma 8.5.For every 0 < α < 1 and 1 < p < ∞, there exists a constant C = C(α, p) > 0 such that Proof.For N = 0 the claim is clear.Assume that N ≥ 1.By Lemma 8.2, where the right-hand side is bounded from above by a constant C 1 = C 1 (α, p) independent of N. Hence, and the claim follows.
Proof.Observe that Q ⊂ Q N for some N ∈ N. When Q contains at most 4 points of E, it is straightforward to see that the distance d E satisfies (24) for Q and with some constant C 1 only depending on α and p.This includes the case where Q is contained in Q 1 .
We prove by induction on N that d E satisfies (24) for every interval Q ⊂ Q N with the constant C = max{12 p C, C 1 }, where C is the constant in Lemma 8.5.The case N = 1 has already been proved since C ≥ C 1 .Hence, we assume that the claim holds for all n = 1, . . ., N − 1, and we need to verify the claim for all intervals Q contained in Q N .
The case where Q ⊂ Q N −1 follows from the induction hypothesis.Thus we may and do assume that Q is not contained in Q N −1 .We do a case study.
(i): Q is contained in one of the intervals In the first case, the interval Q ⊂ Q 1 N −1 can be written as where the last inequality holds by the induction hypothesis.In the second case we have Q ⊂ Q 2 N −1 , and inequality (24) follows from the induction hypothesis since Q is now translation of an interval Q contained in Q N −1 .
(ii): Q intersects both Q N −1 and Q 2 N −1 .This implies that Q contains Q 1 N −1 , and so Using this estimate together with Lemma 8.5, we obtain (iii): Q contains one of the intervals Using that Q ⊂ Q N , the desired estimate follows as in the case (ii). (iv): By the construction of Q N −1 , we can find m ∈ {−1, 0, . . ., N − 2} so that , and so for every β > −1.On the other hand, This leads us to where the last inequality follows from Lemma 8.5.
is a translation of Q N −1 that contains, from left to right, translated copies for every interval Q ⊂ R, and so d −α E ∈ A p .Proof.Given an interval Q ⊂ R, we write Q + = Q ∩ [0, +∞) and Here −Q − denotes the reflection of Q − with respect to the origin.Because E is symmetric with respect to the origin, we can write The same argument shows that Q d

Figure 1 .
Figure 1.The set E, with n = 2 and γ = 0.7 2t for every b ∈ [t − r, t + r]; here and below a ≃ C( * )b means that C( * ) −1 b ≤ a ≤ C( * )b.This leads us to where Q * m and Q * m+1 are translations of Q m and Q m+1 respectively, and we use the notationQ * −1 = ∅.This implies |Q ∩ Q N −1 | ≥ |Q m |.Similarly, by the construction of Q 1 N −1 , there exists n ∈ {−1, 0, . . ., N − 2} so that t N Q * n ⊂ Q ∩ Q 1 N −1 ⊂ t N Q * n+1 , where Q * n and Q * n+1are translations of Q n and Q n+1 , respectively, and so |Q ∩Q 1 N −1 | ≥ t N |Q n |.Now define M = max{m, n}.If M = −1,then Q intersects at most 2 edges of E, and the desired estimate follows with the constant C 1 from the beginning of the proof.If M ≥ 0, then we have