Almost uniform domains and Poincar\'e inequalities

Here we show existence of numerous subsets of Euclidean and metric spaces that, despite having empty interior, still support Poincar\'e inequalities. Most importantly, our methods do not depend on any rectilinear or self-similar structure of the underlying space. We instead employ the notion of uniform domain of Martio and Sarvas. Our condition relies on the measure density of such subsets, as well as the regularity and relative separation of their boundary components. In doing so, our results hold true for metric spaces equipped with doubling measures and Poincar\'e inequalities in general, and for the Heisenberg groups in particular. To our knowledge, these are the first examples of such subsets on any step-2 Carnot group. Such subsets also give, in general, new examples of Sobolev extension domains on doubling metric measure spaces. When specialized to the plane, we give general sufficient conditions for planar subsets, possibly with empty interior, to be Ahlfors 2-regular and to satisfy a (1,2)-Poincar\'e inequality. In the Euclidean case, our construction also covers the non-self-similar Sierpi\'nski carpets of Mackay, Tyson, and Wildrick, as well as higher dimensional analogues not treated in the literature. The analysis of the Poincar\'e inequality with exponent p=1, for these carpets and their higher dimensional analogues, includes a new way of proving an isoperimetric inequality on a space without constructing Semmes families of curves.

1. Introduction 1.1. Poincaré inequalities and Sierpiński sponges. Let (X, d) be a complete metric space that supports a doubling measure µ. We wish to understand the following question: If X supports a (1, p)-Poincaré inequality, then when does a subset Y of X, equipped with its restricted measure and metric, support a (1, q)-Poincaré inequality, and for which exponents q ∈ [1, ∞)? This question is motivated by the desire to construct a new, general class of examples that include so-called uniform domains and more generally, Sobolev extension domains. Below, our main results will give criteria to guarantee such examples, in both the Euclidean and the general metric space setting. To this end, we begin with some definitions. Definition 1.1. Let r 0 > 0. A proper metric measure space (X, d, µ) with a Radon measure µ is said to be D-doubling at scale r 0 -or (D, r 0 )-doubling for short -if for all r ∈ (0, r 0 ) and any x ∈ X we have 0 < µ(B(x, 2r)) ≤ Dµ(B(x, r)).
If (X, d, µ) is D-doubling at scale r 0 for all r 0 > 0, then X is said to be D-doubling.
We will assume that the support of the measure equals the space, supp(µ) = X. Definition 1.2. Let r 0 > 0 and 1 ≤ p < ∞. A proper metric measure space (X, d, µ) with a Radon measure µ is said to satisfy a (1, p)-Poincaré inequality at scale r 0 (with constant C ≥ 1) if for all Lipschitz functions f : X → R and all x ∈ X and r ∈ (0, r 0 ) we have for B := B(x, r) and CB := B(x, Cr) If r 0 = ∞, then say that X satisfies a (global) (1, p)-Poincaré inequality (with the same constants).
A space satisfying a Poincaré inequality and the doubling property is called a PI-space.
Here, for any measurable and locally integrable f : X → R its average value on a ball is In the literature, there are different definitions of Poincaré inequalities, all of which coincide with our definition in the case of complete metric spaces. For a detailed discussion of these issues we refer to [27,20,23].
Poincaré inequalities play a profound role in analysis and the regularity of functions. In the general setting of metric measure spaces, they are crucial hypotheses for nontrivial definitions of generalized Sobolev spaces [19,10,40] and differentiability of Lipschitz functions [10]. Moreover, open subsets Ω ⊂ X supporting a (1, p)-Poincaré inequality and with a lower bound on their measure density are important examples of sets admitting extensions of Sobolev spaces. See [26,21,7] and below for more related historical discussion and references. We remark, that applying our work there requires some care, as our constructions lead to closed sets. However, one can also consider Sobolev extension problems with other gradients which make sense also for closed sets.
Poincaré inequalities also play a profound role in the study of geometry of metric spaces, specifically in regards to quasiconformal mappings between them [24]. Planar metric spaces that are Ahlfors 2-regular and that support a (1, 2)-Poincaré inequality are examples of sets which admit uniformization by slit carpets, see [32,Section §7]. Such inequalities are also important in determining the so-called conformal dimension of a space [31]. In general, conformal dimension measures the extent to which Hausdorff dimension can be lowered by quasisymmetric maps, and it is known that any Ahlfors regular space satisfying a Poincaré inequality has conformal dimension equal to its Hausdorff dimension.
However, a good understanding of the geometric conditions that guarantee such inequalities, in particular for subsets, has remained a challenge. Particular examples of subsets in the plane satisfying Poincaré inequalities were given by Mackay, Tyson and Wildrick [32]. We briefly discuss a construction here that includes theirs.
Let n = (n i ) ∞ i=1 be a sequence of odd positive integers with n i ≥ 3. As a convention, put Fix a dimension d ≥ 2. We define the Sierpiński sponge associated to n in R d as follows: (1) At the first stage, put S 0,n = [0, 1] d and T 1 0,n = [0, 1] d and T 0,n = {T 1 0,n }.
(2) Assuming that we have defined sets S k,n and T j k,n and collections of cubes T k,n at the kth stage, for k ∈ N, • Subdivide each T ∈ T k,n into (n k+1 ) d equal subcubes; • Excluding the central subcube in T , index the remaining subcubes in any fashion as T j k+1,n and let T k+1,n = {T j k+1,n } be the collection of all such subcubes. We note that for k ∈ N, the side length of each subcube T j k,n is therefore (For consistency, let s 0 = 1.) • Define the k + 1'th order pre-sponge as the set S k+1,n = T ∈T k+1,n T.
(3) For technical purposes later, let k ≥ 1 and define R n,k to be the sub-collection of central cubes removed from cubes T ∈ T k−1,n at the k'th stage and put The Sierpiński sponge associated to the sequence n is then defined as When d = 2 we also refer to these sets as Sierpiński carpets, and the constant sequence n = (3, 3, 3 . . .) yields the usual "middle-thirds" Sierpiński carpet, which is denoted by S 3 .
The main result by Mackay, Tyson and Wildrick [32] states that Sierpiński carpets with positive Lebesgue measure satisfy Poincaré inequalities. Their proof was a tour de force in constructing so-called Semmes families of (rectifiable) curves and then applying a characterization of Poincaré inequalities from Keith [27]. (For precise definitions and a further discussion, see [41].) However, even slight variations of their construction, such as removing a "nearly central" square instead of a central one, would require a new construction of a curve family with new, equally technical details to check. Our motivation was therefore to find more general and robust methods that apply to all dimensions, as well as to non-euclidean geometries too.
First of all, our methods lead to the following higher dimensional analogue of their result.
The borderline case of p = 1 can also be fully characterized in terms of n. The case of d = 2 appeared before in [32]. The general borderline case for all d ≥ 2 is presented in a separate paper by the authors [16], and the approach involves substantially different methods.
(3) There exists N ∈ N such that lim sup r→0 sup x∈Y s N (x, r) = 0.
Indeed, Condition (3) requires the density of R at any x ∈ Y to vanish, but allowing at each scale r for the N largest "obstacles" in R to be excluded. A slightly stronger statement, which allows for the density only becoming sufficiently small, is given in Theorem 4.46.
Theorem 1.8 is new even when the collection of obstacles R and Ω have simple geometry, such as when Ω and every R are disks. It is known from [32,Corollary 1.9] that there exist subsets of this form with empty interior and which satisfy a (1, 2)-Poincaré inequality. Such sets, called circle carpets, are constructed implicitly via uniformization and can therefore only be approximated numerically. In contrast, here we give a procedure that yields explicit circle carpets satisfying Poincaré inequalities, with a sharp characterization of the range of exponents. This flexibility extends to other shapes and higher dimensions, as described in Corollary 4.31 below.
To reiterate, the conditions for the sets R ∈ R come in three forms: the regularity of their boundaries, their separation, and their density. The first two conditions in the statement are necessary for a subset to be Loewner, as given in Theorem 4.40 below. These conditions also appear elsewhere in the literature; for instance, they are the relevant conditions in Bonk's work on uniformization of planar subsets [8]. Moreover, the conditions on summability also bear close resemblance to the summability conditions arising in other work on uniformizing planar metric spaces [35,22]. 1.3. Metric spaces and Carnot groups. In the proof of Theorem 1.8, the most crucial feature about the collection R is that R 2 \ R is a uniform domain, for each R ∈ R. Such sets were first studied in [33,43]; see Definition 4.12. Roughly speaking, these correspond to domains Ω without "outer cusps." Domains in Euclidean space with Lipschitz boundaries are uniform domains, for example, in all dimensions.
In fact, uniformity is a purely metric property. A crucial result of Björn and Shanmugalingam asserts that uniform domains Ω in a doubling metric measure space X inherit a Poincaré inequality from X; see [7]. Motivated by this, we therefore formulate a more general theorem for metric spaces.
To this end, call a domain co-uniform if its complement is uniform and its boundary is connected. The uniform sparseness condition, mentioned below, combines Conditions (2) and (3) in Theorem 1.8 above; for precise statements, see Definitions 4.21 and 4.20. Note that the sequence n plays an analogous role as the one in Theorem 1.5, in that it handles the density of the omitted subsets. Theorem 1.9. Let X be an Ahlfors Q-regular complete metric measure space admitting a (1, p)-Poincaré inequality, and let n be a sequence of positive integers with n −1 ∈ Q (N).
If Ω is a bounded, A-uniform subset of X and if {R n,k } ∞ k=1 is a uniformly n−sparse collection of co-uniform subsets of Ω, then the set S n = Ω \ k R∈R n,k R, with its restricted measure and metric, is Ahlfors Q-regular and satisfies a (1, q)-Poincaré inequality for each q > p. Moreover, • if p > 1, then it also satisfies a (1, p)-Poincaré inequality; • if the union of all sets from R n,k , over all k ∈ N, is dense in Ω, then S n has empty interior.
The ranges of the exponents in Theorem 1.9 are sharp. In particular, only for p = 1 do such removals of sets lead to a loss in range, namely the loss of the (1, 1)-Poincaré inequality; see [32] for an example. For p > 1 no such loss occurs, due to the seminal self-improvement result of Keith and Zhong [29].
For some spaces, such as the Heisenberg group in particular and step-2 Carnot groups in general, the existence of uniform domains is well-known, at all scales and locations within these spaces. In such cases, Theorem 1.9 can be used to give new examples of subsets with Poincaré inequalities and empty interior; see Subsection §4.3 for these examples, as well as some of the definitions relevant to these geometries. Due to a recent result by T. Rajala [39], it is likely that the result applies to any Carnot group.
1.4. Sobolev extension domains. As a corollary of our theorems, we obtain many new examples of Sobolev extension domains, both in Euclidean and non-Euclidean spaces. To wit, an open subset Ω ⊂ X is called a (Sobolev) extension domain if there exists a bounded extension operator E : N 1,p (Ω) → N 1,p (X); in the case where Ω is open in X = R d the Newtonian Sobolev space N 1,p (Ω), as introduced in [40], coincides with the classical Sobolev space W 1,p (Ω). This definition, when employing N 1,p (Ω), makes sense even for closed subsets Ω, while classically the interest has been mostly for open domains. However, the case of closed sets, as well as the relationship between open and closed extension domains is subtle.
The first examples of extension domains were given by Jones [26]. In general, a sufficient condition for Ω to be an extension domain is if Ω supports a (1, q)-Poincaré inequality for q < p. This condition, however, is not necessary unless p is sufficiently large, as discussed in [7].
It remains a difficult problem to give both necessary and sufficient conditions for a domain to be an extension domain. In fact, this has essentially been solved only for simply connected domains in the plane [47]. Our examples give flexible constructions of infinitely connected domains in R d for d ≥ 2, as well as in step-2 Carnot groups and in general metric spaces, that are Sobolev extension domains. These examples are new even in the planar setting. See [7,21] for more related discussion and references, as well as the Ph.D. thesis [47].
1.5. Methodology: removing subsets vs. "fillings" of spaces. Thus far, the results in this article apply to subsets Y obtained by removing, from an initial set, infinite collections R of well-behaved subsets at all locations and scales. As we will see later, these results are special cases of Theorem 2.7 and Corollary 4.19, where such sets Y are viewed from a different perspective. In particular, we view the intermediate sets Ω r , each obtained by removing a finite sub-collection of subsets in R up to a given scale r > 0, as good approximations (or "fillings") of Y ; in particular, each Ω r is doubling and supports a Poincaré inequality, both at scale r, and Ω r also contains Y with small complement.
In fact, these three properties alone are sufficient for Y to support a Poincaré inequality, provided that the associated constants are uniform in r. No explicit removals of sets are actually needed for our proofs; the fillings Ω r only need to satisfy these properties axiomatically, and they need not be defined, a priori, in terms of any removed set. Similarly as for Sobolev extension domains [21], it is the measure density of the sets Ω r that is crucial. (In fact, the small-ness of Ω r \ Y is given in terms of measure density; see Definition 2.6.) The sufficiency of these properties in turn relies crucially on a new characterization of Poincaré inequalities, as studied by the first author [14,15]. Roughly speaking, spaces supporting a Poincaré inequality cannot "see" sets of small density: points that have small measure density, relative to a given set, can be connected by a quasi-geodesic that meets that set in correspondingly small length. This correspondence, moreover, depends quantitatively but nontrivially on the exponent p. Since we formulate density in terms of maximal functions, we refer to this characterization as "maximal p-connectivity." Intuitively, Ω r provides improved behavior for Y without adding much density. Once such fillings are available, pairs of points in Y that are at most a distance r apart can be joined by rectifiable curves inside Ω r . Such curves may not lie entirely in Y , but as the measure density of Ω r \ Y is small, by maximal connectivity there must be curves which spend little time in this set. The "bad" portions of these curves can then be removed and replaced by "good" portions, via a delicate iteration argument.
This filling process is subtle, and the dependence of the exponent p on the quality of the filling is nontrivial. This will be illustrated in the examples below in Subsection §2.2.
Interestingly, we avoid throughout this paper any discussion about the modulus of curve families, and we do not construct any curve families to estimate such moduli. However, in recent work it is shown that such curve families always exist on spaces satisfying Poincaré inequalities. Thus, our tools can be considered to implicitly construct Semmes families of curves. See [1,13].
1.6. General structure of paper. In Section §2 we first recall basic notions and relevant notation, and then give precise definitions for fillings of subsets. The section concludes with the statement of our main result, Theorem 2.7, as well as auxiliary results and the strategy of the proof.
In Section §3 we prove Theorem 2.7; it states that subsets admitting such fillings, or "fillable subsets," must also satisfy Poincaré inequalities. The proof requires Theorems 2.18 and 2.19, which are characterizations of (1, p)-Poincaré inequalities and will be proven later.
In Section §4 we apply Theorem 2.7 first to Sierpiński sponges, and then to general metric measure spaces with co-uniform domains removed. We conclude this section with new examples of subsets of the Heisenberg group that satisfy Poincaré inequalities, as well as a discussion of our sufficient condition for planar Loewner subsets. All of these applications use the results in §2, but readers may choose to see how these results are applied first, before reading those technical proofs. (To preserve the flow of discussion the proofs of certain technical results, such as Theorem 4.22, are postponed to Appendix A.) Lastly, in Section §5 we prove Theorems 2.18 and 2.19 by introducing a certain "pathconnectivity" function associated to metric measure spaces. (Readers who are primarily interested in the classification of Poincaré inequalities may opt to read Section §5 independently of the other sections.) In Appendix A, we prove Theorem 4.22, as well as other auxiliary results about uniform domains.

Notation and Basic
Notions. Throughout the paper, we will work on complete and proper metric measure spaces X equipped with some Radon measure µ. Consistently, Y refers to a closed subset of X which will be shown to support Poincaré inequalities. In the Euclidean case X = R n we will also denote such subsets by S, suggestively for "sponge".
Remark 2.1 (Types of constants). As a convention, we refer to certain constants as structural constants if they describe fixed parameters for standard hypotheses or conditions. These include the doubling constant D ≥ 1, the constant C ≥ 1 in the Poincaré inequality (as well as uniformity constants A > 0 that imply such inequalities), the choice of exponent p ≥ 1, and the scale parameter r 0 > 0.
Moreover, conditions on a metric space X that depend on the scale parameter -i.e. an upper (distance) bound between points on X -are referred to as local conditions. In particular, a locally D-doubling metric measure space refers to a (D, r 0 )-doubling metric measure space for some r 0 > 0 and a local (1, p)-Poincaré inequality refers to a (1, p)-Poincaré inequality that is valid at scale r 0 , for some r 0 > 0.
The same convention will apply to other conditions in the sequel. Note, in this convention, the scale r 0 is assumed to be uniform throughout the space. Our convention is therefore slightly different from others, such as in [6], where the scale can vary with the point.
Open balls in a metric space are denoted by B = B(x, r), and their inflations by CB = B(x, Cr), despite the ambiguity that balls may not be uniquely defined by their radii. If multiple metrics are used, we indicate the one used with a subscript, e.g. B d (x, r) to mean the ball with respect to the metric d.
By a curve γ in a metric space X we mean a Lipschitz map γ : I → X, where I ⊂ R is a bounded closed interval. As a convention, we assume that all rectifiable curves are parametrised by arc-length unless otherwise specified, in which case it satisfies Lip (γ)(t) := lim sup s→t d(γ(t),γ(s)) |s−t| ≤ 1, t ∈ I. A metric space X is called Λ-quasiconvex if for every x, y ∈ X there exists a curve γ connecting x to y with Len(γ) ≤ Λd(x, y). Such a curve γ, when it exists, is called a Λ-quasi-geodesic. A space X is called Λ-quasiconvex at scale r 0 > 0, if the same holds for every x, y ∈ X with d(x, y) ≤ r 0 .
Frequently, we restrict the metric and measure onto some subset A ⊂ X. On A the measure is denoted µ| A , and d| A×A , but we will often avoid this cumbersome notation. Also, metric balls in A are simply intersections B d| A×A (x, r) = B(x, r) ∩ A, and they are denoted occasionally by B A (x, r).
Related to Definition 1.1, a metric space X is said to be N -metric doubling, for some N ∈ N, if for every ball B(x, r) there exist x 1 , . . . , x m ∈ X for some m ≤ N such that Clearly, every metric space equipped with a D-doubling measure is D 4 -metric doubling. Later we will specialize to doubling measures with certain quantitative growth, as below.
Definition 2.2. A proper metric measure space (X, d, µ) is said to be Ahlfors Q-regular with constant C > 0 if for all 0 < r < diam(X) and any x ∈ X we have The space is said to be Ahlfors Q-regular up to scale r 0 if the same holds for r ∈ (0, r 0 ).
We define the centered Hardy-Littlewood maximal functions as Here and in what follows, we will use a localized version of the Maximal Function Theorem, see [34,Theorem 2.19]. The proof below, given for completeness, is a slight modification of the classical argument.
Proof. Put E λ := {M R f > λ} ∩ B(x, r). For each y ∈ E λ there exists r y ∈ (0, R) so that (2.5) B(y,ry) |f | dµ > λµ(B(y, r y )), so {B(y, r y )} y∈E λ clearly covers E λ . A standard 5-covering theorem [34, Theorem 2.1] (or alternatively [18,) then asserts that there is a countable, pairwisedisjoint subcollection of balls B i := B(y i , r y i ) for i ∈ I with each y i ∈ E λ and so that Using the fact that i∈I B i ⊂ B(x, r + R) we then obtain as desired.

Poincaré inequalities via fillings.
In this subsection, we make precise the notion of filling and "fillable set," the main tools in proving our results. One useful property of fillings Ω r is that they satisfy a Poincaré inequality a priori only at scales comparable to r. For our applications, this property will be easy to check, in that the geometry of the filling at scale r will be kept simple.
Definition 2.6. Let ∈ (0, 1), p ∈ [1, ∞), and C, D ≥ 1. Given a closed subset Y of a complete space X, a closed subset Ω r ⊆ X is called an -filling of Y at scale r > 0 with constants (D, C, p) if the following conditions hold: for every x ∈ Y , the density condition µ(Ω r ∩ B(x, r) \ Y ) µ(Ω r ∩ B(x, r)) < holds, (3) the restricted space (Ω r , d| Ωr×Ωr , µ| Ωr ) is D-doubling and satisfies a (1, p)-Poincaré inequality at scale 2r, is any ball in Ω r with s ≤ 2r. Then, Y is called p-Poincaré -fillable up to scale r 0 , with constants (D, C) -or ( , D, C, p)-PI fillable up to scale r 0 , for short -if there exists an -filling at scale r of Y with constants (D, C, p) and any r ∈ (0, r 0 ).
We say that Y is asymptotically p-Poincaré fillable if for some fixed constants (D, C) and for any > 0 there exists r 0 > 0 such that Y is ( , D, C, p)-PI fillable up to scale r 0 .
In terms of these sets, we can now give sufficient conditions for a subset to satisfy a Poincaré inequality.
Theorem 2.7. Fix structural constants (p, D, C, r 0 ) and let X be a D-doubling metric measure space. Then, for every q > p there exist q , C q , C r > 0 with the following properties: (a) If Y is a p-Poincaré, q -fillable subset of X up to scale r 0 with constants (D, C), then it satisfies a (1, q)-Poincaré inequality with constant C q at scale r 0 /C r . (b) Further, if Y is an asymptotically p-Poincaré fillable subset of X, then it satisfies a local (1, q)-Poincaré inequality for every q > p. Here the constants q and C q , C are independent of the original scale r 0 , but depend on the other structural constants and on the exponent q.
Remark 2.8. Note that X is not assumed, a priori, to support a Poincaré inequality; only the fillings Ω r from Definition 2.6 do. In many cases, including our applications in Section §4, we will assume that X is a p-PI space, in which case good choices of Ω r will inherit Poincaré inequalities from X.
Note that the local Poincaré inequality could be improved to a semi-local one [6] (that is, (1.3) holds at every scale, with constant depending on the scale and location only), if the space is proper and connected. In the case of bounded metric spaces, like non-self-similar Sierpiński carpets, this semi-local property further improves to the usual global type.
Remark 2.9. It is crucial in Part (a) of the previous theorem that the density parameter q be allowed to depend on the structural constants D, C, p.
Here we give some examples involving fillings of subsets and how the exponent of the Poincaré inequality can depend subtly on how the set is filled. In each case we construct a filling with arbitrarily good Poincaré inequalities, namely local (1, 1)-Poincaré inequalities. The subset, however, only inherits the Poincaré inequality if the density parameter is sufficiently small, relative to a controlled constant in the Poincaré inequality of the filling. Example 2.10. Let X = [−1, 1] 2 , which is a (1, 1)-PI-space, while the subset is a (1, p)-PI-space only for p > 2. However, if we "thicken" Y at the origin, then the filling and where C h q can be bounded independent of h for q > 2. Here, the ratio implied in ≈ q depends on q, but not on h, and could be made explicit.
For every r > 0, we can set Ω r = Y h r , and see that Y is q-Poincaré h 2 -fillable up to scale 1 with constants (D, C h q ), for some uniform doubling constant D. By Theorem 2.7 then Y satisfies a (1, q)-Poincaré inequality for q > 2, as expected. However, for q ∈ [1, 2], the Poincaré constant C h q blows up as h → 0, so the subset Y need not, and does not, satisfy a (1, q)-Poincaré inequality for q ∈ [1, 2].
The following example is closely related to the discussion of fat Sierpiński carpets and sponges in Section §4.1.
and denote the complement of their union as Unlike the standard "middle-ninths" Sierpiński carpet, only the squares intersecting the line y = are uniform domains (see Definition 4.12) and therefore satisfy (1, 1)-Poincaré inequalities (see Theorem 4.14). Moreover, we have so Y arises from gluing Y ± along a α-dimensional set and by [ Lip (u) q dλ 1/q which contradicts the (1, q)-Poincaré inequality as h → 0. The case q = 2 − α is similar, but we consider the function Again Y has certain good fillings that consist of At scale r, only finitely many sets R with diameters larger than r/9 are near points in Ω r . It follows that Ω r satisfies (1, 1)-Poincaré inequalities at scales comparable to r with constants (D, C) independent of r.
However, for balls centered on y = 1/2 the density of Ω r \Y is bounded from below, say by some constant δ > 0. Thus, these are only (δ, D, C, 1)-PI-fillable and not asymptotically 1-Poincaré fillable. This corresponds to the fact that we obtain only a (1, p)-Poincaré inequality for p > 2 − λ, instead of for all p > 1. 2.3. Poincaré inequalities via "maximal" connectivity. The proof of Theorem 2.7 is based on general techniques that reduce the Poincaré inequality to a certain connectivity property at all scales and with sets (or 'obstacles') of prescribed densities. These densities are in turn measured in terms of maximal functions.
The starting point is this very notion of connectivity: roughly speaking, "if a set E has small measure density (in a scale invariant way) then there are curves of unit speed that spend only a short time within E." Definition 2.12. Let δ > 0 and C, p ≥ 1. We say that a pair of points x, y ∈ X for a metric measure space (X, d, µ) is (C, δ, p)-max connected, if for every τ > 0 with r := d(x, y), and every Borel-measurable set E such that there exists a 1-Lipschitz curve γ : [0, L] → X, for some L > 0, such that (1) γ(0) = x (2) γ(L) = y (3) Len(γ) ≤ Cr (4) the following integral inequality holds: (2.14) We say that a space (X, d, µ) is p-maximally connected at scale r 0 with constants (C, δ) -or (C, δ, p)-max connected at scale r 0 , for short -if every pair x, y ∈ X with d(x, y) < r 0 is (C, δ, p)-max connected.
One then finds a sequence of curves γ k for each E k , and since E k−1 ⊂ int(E k ), then after passing to a subsequence and using monotone convergence, we can find a curve γ which satisfies (1)-(4) for E.
A technical issue with checking for maximal connectivity is that the desired maximal function estimates for X are not directly related to those for the filling Ω r . Furthermore, it can be challenging to prove the property for all density "levels" τ > 0. This is dealt with the following variants of this connectivity. Definition 2. 16. We say that a metric measure space (X, d, µ) is p-maximally connected at level τ 0 and scale r 0 (with constants (C, δ)) -or (C, δ, τ 0 , p)-max connected at scale r 0 , for short -if the p-maximal connectivity conditions of Definition 2.12 hold for only τ = τ 0 , instead of for all τ .
This condition may seem technical at first. The core point, however, is that it allows for characterizing Poincaré inequalities in terms of sufficiently good avoidance of obstacles of a fixed level, so one need not consider obstacles of every level. Further, this "fixed-level" property is inherited by sufficiently dense subsets.
Lemma 2.17. Suppose X is D-doubling and (C, δ, τ 0 , p)-max connected at scale r 0 and that Y is a closed, Λ-quasiconvex subset of X. If x, y ∈ Y satisfy d(x, y) < r 0 , as well as then the pair (x, y) is (ΛC, Λδ, τ 0 2 , p)-max connected relative to Y with its restricted measure and distance.
We will only sketch the main form of the argument, since the lemma will not be used directly and a variant appears later. The main idea, however, is replacing bad portions of an initial curve with better ones, as depicted in Figure 2. Cr 1 E (z) < τ 0 /2 for z = x, y but where the maximal function is computed relative to Y ; for F = E ∪ (X \ Y ) it then follows that M Cr 1 F (z) < τ 0 , where the maximal function is once again relative to X.
Thus the definition of max-connectivity gives a curve γ that spends at most δτ This produces a new curve γ which lies entirely in Y , is at most ΛCd(x, y) long, and spends at most Λδτ 1/p 0 r time in E, as desired. Our connectivity property is related to the (1, p)-Poincaré inequality via the following two theorems. We discuss their applications first in the next section, and their proofs will appear later in Section §5.
Theorem 2.18. Fix structural constants (p, D, C, r 0 ). If X is D-doubling at scale r 0 and satisfies a (1, p)-Poincaré inequality at scale r 0 with constant C, then X is (C 0 , ∆, p)-max connected at scale r 0 /2, where C 0 and ∆ depend solely on the structural constants.
The converse also holds true, but requires a sufficiently small value for δ. Theorem 2.19. Fix structural constants (p, D, C, r 0 ). There exists δ p,D > 0 such that if X is D-doubling at scale r 0 and (C, δ, τ 0 , p)-max connected at scale r 0 for some τ 0 ∈ (0, 1) and some δ ∈ (0, δ p,D ), then it also satisfies a (1, p)-Poincaré inequality at scale r 0 /C r with constant C p , where C p , C r are independent of scale r 0 but depends quantitatively on all the other structural constants, as well as δ and τ 0 . As emphasized in the notation, the above constant δ p,D depends only on p and D and no other structural constants.
However, a small parameter value for δ is not serious; the next result assures that such values for δ always occur at some density level τ but for slightly larger exponents than p. Figure 2. Proof of Lemma 2.17. Connectivity involves constructing a curve in the gray subset Y between a pair of points x, y while avoiding the dark gray subset E as well as possible. The connectivity of X is used to give a "proto-curve", whose portions γ| (a i ,b i ) in the complement X \ Y are replaced by detours γ i constructed using quasiconvexity (the dash-dotted line segment).
To reiterate, to prove that a p-fillable subset Y satisfies a (1, p)-Poincaré inequality, by Theorem 2.19 it is sufficient to prove the maximal connectivity property for Y at a certain level and for fixed choices C and δ < δ p,D . Similarly as in Lemma 2.17, this property will be 'inherited' from a filling Ω r at a comparable scale.
With these general statements at hand, we will employ the following strategy for the proof of Theorem 2.7: (1) Theorem 2.18 guarantees that any filling Ω r of Y will satisfy maximal connectivity properties with exponent p and some initial parameter ∆. (2) From Lemma 2.20 we obtain (C, δ, τ 0 , q)-maximal connectivity for Ω r at scale r for arbitrarily small parameters δ, but at the expense of a slightly larger exponent q. (3) Similarly to Lemma 2.17, due to quasi-convexity (see Lemma 3.2 below) Y inherits the maximal connectivity property from its filling Ω r , but with δ slightly larger than δ. This parameter δ can be ensured to be less than the given threshold δ p,D , however, by an initially small choice of δ in the previous step. (4) Using maximal connectivity and quasiconvexity (again), we show Y satisfies a (1, q)-Poincaré inequality via Theorem 2.19. Here q > p is needed to apply the argument from Lemma 2.20. If p > 1, this could be avoided via Keith-Zhong [29], since we could first improve the Poincaré inequality for each Ω r to an exponent p < p.
3. Proof that "fillable" sets satisfy Poincaré inequalities 3.1. Initial geometric considerations. Now, we show that the underlying (restricted) measure of a fillable subset is well-behaved. More precisely, we show that a fillable subset Y inherits the doubling property from its fillings Ω r . Recall that throughout this paper, Y ⊂ Ω r ⊂ X, where Ω r will be the relevant fillings.
Since Ω r is assumed D-doubling with respect to the restricted measure µ| Ωr and since Y is a subset of Ω r , it follows that So the claim follows with doubling constant D 1− .
We next show that PI-fillable subsets Y are quasiconvex. This connectivity property is derived from stronger ones, i.e. the Poincaré inequalities of the fillings Ω r . For clarity later, given f ∈ L 1 (X) and R > 0 we specify the choice of metric space for maximal functions by using the shorthand where Ω r is as in Definition 2.12.
Lemma 3.2. Fix structural constants (p, D, C, r 0 ). There exist 0 , Λ, r 1 > 0, depending solely on the structural constants, so that if Y is a ( , D, C, p)-PI fillable subset of a metric space X at scale r 0 , for some ∈ (0, 0 ), then it is Λ-quasiconvex at scale r 1 .
Proof. By hypothesis, Y is ( , D, C, p)-fillable up to scale r 0 , for some ∈ (0, 0 ), so there exist fillings Ω r for every r ∈ (0, r 0 ) with Y ⊂ Ω r ⊂ X that are D-doubling at scale 2r, that support a (1, p)-Poincaré inequality at scale r with constant C, and so that holds for all z ∈ Y . From Theorem 2.18 we conclude that the fillings Ω r are (C 0 , ∆, p)-max connected for some C 0 and ∆ at scale r/2. Choose τ 0 = 1 ∆ p 4 p so that ∆τ 1/p 0 r ≤ r/4 and fix 0 = D −(10+ log 2 (C 0 )) ) τ 0 and Λ = 2C 0 and r 1 = Since C 0 and ∆ depend only on the structural constants, by Theorem 2.18, the same is true of 0 , Λ, and r 1 . We now show that Y is Λ-quasiconvex at scale r 1 . For every x, y ∈ Y with r = d(x, y) < r 1 . we will construct a Λ-quasi-geodesic joining x and y, using a recursive argument.
Base case(s). Fix R = 2 5 C 0 r. The initial curve will be constructed in Ω R and will lie almost entirely in Y . To begin, define an obstacle

In particular, this implies for
For future consistency of notation, put x 1,1 := x and y 1,1 := y and x i,1 := y i,1 := y for i ≥ 2.
, joining x and y in Ω R ⊂ X, and so that

Consider the exit times
apart, also lie in Y . (If the union is finite, then there exists N ∈ N so that a n = b n for n ≥ N .) Also, Since γ 1 is parametrized by length, and Len(γ 1 ) ≤ Λr = Λr 1,1 , it trivially holds that Recursive step. Let k ∈ N be given, with k ≥ 2, and suppose the sequence (x j,k , y j,k ) ∞ j=1 in Y × Y has already been defined, with r j,k := d(x j,k , y j,k ) < r 0 and with the property that Assume further that a C k -quasi-geodesic γ k−1 : [0, L k−1 ] → X joining x and y has already been defined for some and r j,k = d(x j,k , y j,k ) and which satisfies the avoidance properties By applying the same argument as in the base case, with x j,k and y j,k and r j,k in place of x and y and r, take fillings Ω j,k := Ω 2 5 C 0 r j,k of Y that are (C 0 , ∆, p)-max connected at scales 2 4 C 0 r j,k . Using obstacles and estimating similarly as (3.3), there exist C 0 -quasigeodesics γ j,k : [0, L j,k ] → Ω j,k ⊂ X joining x j,k to y j,k in Ω j,k , so that and whose lengths L j,k ≤ C 0 r j,k satisfy As before, for each j ∈ N set exit times Based on (3.7) and (3.11) and our choice of t j,k and T j,k , it holds that Towards a new curve, consider sub-curve lengths for all j and k. We further define a parametrization for a curve of length L * k , and where each i.e where the images of γ j,k and γ k agree. With the same reindexing i = i(j, l), this gives the avoidance property and since the γ j,k have length at most Λr j,k , the other avoidance property follows: From (3.7) and (3.8) it follows that By construction, for each k ∈ N there exists j 1 , j 2 ∈ N so that x = a j 1 k−1 and y = b j 2 k−1 , so γ k therefore joins x and y. By the previous estimate, it is therefore a C k -quasigeodesic with is a family of 1-Lipschitz functions on [0, Λr], each joining x to y. By the Arzelá-Ascoli theorem, there therefore exists a sublimit function γ : [0, Λr] → X that is 1-Lipschitz and joins x and y. Since γ is 1-Lipschitz we obtain and γ is the desired Λ-quasigeodesic connecting x to y.
We lastly claim that γ([0, L]) ⊂ Y . From the inclusion (3.10) and the estimate (3.7), the Hausdorff 1-content of γ k \ Y satisfies B(x j,k , Λr j,k )) ≤ 2 1−k Λr and therefore vanishes, as k → ∞; we therefore conclude H 1 (γ \ Y ) = 0 since γ is continuous and Y is closed. Indeed, if γ spent any time in the complement of Y , then by continuity, the Hausdorff content of γ k \ Y would have a definite lower bound for large k, contradicting the previous limit calculation.
Remark 3.17 (Dependence on parameters). Here r 1 is the only constant that depends on the original scale r 0 . In fact, it suffices that r 1 = r 0 /(20C ); see the end of Step 1 of the proof. As for q , τ , and C , they all depend on the remaining structural constants but q and τ depend additionally on δ and q.
x y y x Figure 3. Connectivity involves constructing a curve γ that almost avoids a prescribed obstacle E with small density. In the proof of Theorem 3.16, this requires first finding a curve in the filling Ω R from nearby points x , y , and then patching the curve with "detours" γ i to fully avoid Ω R \ Y , and γ x , γ y to connect x and y. In the figure, the solid black curve indicates γ in the filling Ω R , with the dotted parts indicating the parts replaced by the dash-dotted detours.
Proof. We proceed in three steps: (1) fixing parameters for definiteness, (2) passing the density conditions (2.13) from points in Y to points in the fillings Ω r , and then (3) constructing the quasi-geodesics explicitly.
Step 2: Finding nearby dense points. To verify (C , δ, τ, q)-max connectivity at scale 1 20C r 0 , take an arbitrary pair x, y ∈ Y satisfying r := d(x, y) ∈ (0, 1 20C r 0 ) and an arbitrary Borel set E such that Our goal is to construct a curve γ in Y with length at most C r which connects x and y with γ 1 E ds ≤ δτ 1/q r.
Let Ω 2C r be a filling of Y from Definition 2.6, so and as a shorthand, for ρ > 0 put Computing first with (3.24) and the D-doubling property of Ω 2C r yields as well as the estimate below, where B Y is the ball in Y : Putting R := (1 + 2δ τ 1/q )r, for l = 4D n+m+5 consider the set and note that C 0 (1 + 3δ τ 1/q )r ≤ C r, so Lemma 2.4 implies that .
A similar argument with l = (2D) 4 τ yields As a result of the previous estimates, there exist as well as With R as before, note that any s ∈ (δ τ 1/q r, C 0 R) and x ∈ B(x, δ τ 1/q r) satisfy Then, doubling and our previous assumption (3.23) on x yield As for s ∈ (0, δ τ 1/q r) and for x satisfying (3.27), we have so the previous two estimates combine to yield Subadditivity of the maximal function and Equations (3.26) and (3.28) further yield there thus exists L > 0 and a rectifiable curve γ 1 : [0, L] → Ω 2C r of length at most C 0 R and so that γ 1 (0) = x and γ 1 (L) = y and We now modify γ 1 so that it lies entirely in Y and joins x and y. This is done by replacing portions of the curve with curves in Y , and appending two segments on each end. (See Figure 3.) This uses the Λ-quasiconvexity of Y at scale is open and can be expressed as a (possibly finite) union of countably many open disjoint intervals: Similarly as in the proof of Lemma 3.2, define a curve by patching the intervals ( otherwise, and let γ 2 be its arclength parametrisation. Now, and Len(γ 2 ) ≤ Len(γ 1 ) + i L i ≤ C 0 R + 4Λδ (2D) 4/q τ 1/q r.
We now apply the previous theorem to obtain Poincaré inequalities for fillable sets.
Since δ q,2D was chosen as in Theorem 2.19, the space Y satisfies a (1, q)-Poincaré inequality with constant C q = C q (q, D, C , τ ) at scale r 1 /C r = r 0 /C r for some constants C r and C r .
Proof of Theorem 2.7, Part (b). By Part (a) there is a density parameter q such that the (1, q)-Poincaré inequality holds. Now, if Y is asymptotically p-Poincaré fillable, then there exists for any > 0 a scale r > 0 where Y is ( , D, C, p)-PI fillable. Choosing ∈ (0, q ) for any fixed q > p, the local (1, q)-Poincaré inequality follows.

Application: Generalized Sierpiński sponges and uniform domains
Here we apply the general filling theorem to prove Poincaré inequalities in various new contexts.

Sierpiński sponges.
In this subsection we prove Theorem 1.5 for sponges S n . A crucial property is the following separation condition, given below, for sub-cubes R ∈ R n,k removed through stages 1 through k in the construction of S n . In particular, the removed sub-cubes are uniformly 1 3 √ d -separated. Proof. Without loss of generality let R ∈ R n,l and R ∈ R n,l with k ≥ l ≥ l . Let T be the unique cube in T l−1,n that contains R. Clearly R ∩ T ⊂ ∂T and n l ≥ 3, so and moreover 1 3 The same argument works for ∂[0, 1] d .
To clarify the relationship between Case (4) in Theorem 1.5 and the other cases below, we note that the set S n has positive Lebesgue measure if and only if n −1 ∈ d (N), that is and this follows directly from Lemma 4.3 below.
The proof of Theorem 1.5 will be given in separate lemmas. First, Case (4) is proven directly from certain consequences of Poincaré inequalities, namely Cheeger's Rademacher Theorem [10]. To keep the discussion self-contained, we introduce the relevant notions in context, below.
Proof of Case (4) of Theorem 1.5. If S n supports a (1, p)-Poincaré inequality for some p ≥ 1 with respect to some doubling measure µ, then Cheeger's theorem [10] holds. In particular, there exist a partition {S j n } of S n and Lipschitz maps ϕ j : S j n → R m j so that for every Lipschitz function f : S n → R there exists a unique L ∞ -vectorfield D j f : S j n → R m j so that, for µ-a.e. x ∈ S j n , it holds that By a result of Keith [28,Theorem 2.7], the components ϕ j k of each ϕ j can be chosen to be distance functions of the form where ∇ϕ j is the d×m j matrix whose columns are the gradients of the components. In other words, each f is µ-a.e. differentiable with respect to the linear coordinate functions x j as well as the generalized "coordinates" ϕ j . Thus, for every U i the chart φ j can be chosen using a subset of the coordinates. Since on every positive µ-measured subset of S n the coordinates x j are linearly independent on S n , then we need all the coordinates and we can chooose the charts as φ j (x) = x. The result of De Philippis, Rindler and Marchese [12], which proves a conjecture of Cheeger, ensures that φ j (S j n ) = S j n has positive Lebesgue measure. As we will see, the equivalence of Conditions (1)-(3) is a special case of Theorem 2.7. We begin with checking properties of the Lebesgue measure λ restricted to S n . Lemma 4.2 (Basic volume estimate). Let T ∈ T n,k , then Proof. It is easy to show inductively that from which the estimate follows, since Lemma 4.3. If n is a sequence of odd positive integers with n −1 ∈ d (N), then S n is Ahlfors d-regular for some constant C AR = C AR (n, d). In particular S n is 2 d C AR -doubling.
Proof. Given x ∈ S n , r ∈ (0, diam(S n )) = (0, √ d), and ρ ∈ (0, r], let Q(x, ρ) be the cube with center x and edges parallel to the coordinate axes and of length ρ/ √ d, so Q(x, r) ⊂ B(x, r). Choose k ≥ 1 so that and let T x,r ∈ T k−1,n be such that x ∈ T x,r and define Thus, since |T x,r | ≥ 2, and λ(R) = s d k . The estimate follows easily from (4.4), because Q(x, r 2 ) ∩ T x,r is a rectangle with side lengths at least min{r/(2 √ d), s k−1 /2}. Thus, using the fact that for any k and any T ∈ T n,k , The result then follows with constant C AR = 2(2 4 √ d) d c n,0 . Note that the upper bound for Ahlfors regularity is trivial.
Lemma 4.7. The set S n is an asymptotically 1-Poincaré fillable subset of R d .
Proof. Let D = 2 d C AR be the doubling constant from Lemma 4.3. Now, consider the domains Y 1 = R d and Y 2 = [0, 1] d and Y 3 = R d \ R, for R ∈ R n,k . Each of these satisfies a Poincaré inequality with inflation factor 1, that is, CB ∩ Y i = B ∩ Y i ; see Equation (4.8); this follows, for example, from [20] and the chained ball condition which is easy to verify in this case. In particular, for each i = 1, 2, 3 and for any ball B := B(x, s) and any Lipschitz function f on Y i we have where the constant C P I is independent of i, B and f . This holds, a priori, for any Lipschitz function in R d and taking extensions as necessary, for any Lipschitz function defined on For each ∈ (0, 1), choose δ ∈ (0, /4) so that in which case it holds, for all r > 0, that We now claim that S n is 1-Poincaré -fillable (Definition 2.6) at scale with the above constants (C P I , D).
To see why, let r ∈ (0, r 0 ) and x ∈ S n be given. Since d, n j 0 +1 ∈ N, it follows that Now let Ω r := S k,n . To show fillability, we need to show (i) doubling, (ii) a local Poincaré inequality and (iii) an -density bound. By Lemma 4.3 the set Ω r , which contains S n and is contained in [0, 1] 2 , is Ahlfors 2-regular when equipped with the (restricted) Lebesgue measure and hence doubling.
With (i) now settled, we show the local Poincaré inequality (ii). Based on our choice of j 0 and k, we have for all R, R ∈ R n,k with R = R . Thus for each x ∈ S n there is at most one R ∈ R n,k that meets B(x, 2r). Also, if such a cube R exists, then similarly from Lemma 4.1 it follows that Now, for arbitrary x ∈ S n , fix a ball B(x, s) ∩ Ω r with s ≤ 2r. As before, at most one R can meet B(x, s), so holds for some i = 1, 2, 3 as above, and Equation (4.8) is precisely the local Poincaré inequality for Ω r at scale s, as desired.
Finally, we show the density bound (iii); that is, condition (2) in Definition 2.6. First observe that B(x, r) ∩ Ω r contains a cube with side length r/(4 √ d), in which case it holds that Now, consider all remaining (k + 1)'th order subcubes that are sufficiently near x, i.e.
From our previous choice of k, we have for all T ∈ T x,r that diam(T ) ≤ 2 √ ds k+1 < δr, and thus T ⊂ B(x, r). The cubes in T k+1,n that are contained in Ω r ∩ B(x, r) thus cover Ω r ∩B(x, r) except for a portion of the annulus B(x, r)\B(x, (1−δ)r) as well as the removed cubes in R k+1,n which intersect B(x, r). Let R be the union of such removed cubes. These extra portions have small volume, as we will see. Each cube in R k+1,n that intersects B(x, r) is contained in a cube in T k,n of side length s k , and such larger cubes have pairwise-disjoint interiors. If r ≤ s k then there are at most 3 d such cubes, so for dimensions d ≥ 2 we have If r ≥ s k then there are at most ( 2r s k + 2) d such cubes. Recalling that s k = n k+1 s k+1 , our previous choices of j 0 and k now yield Note that δ < 4 < 1 4 from before implies that 2 − δ > √ 2 as well as so the previous paragraph, the choice of δ from before, and (4.9)-(4.11) imply Also, from Lemma 4.2 for every T ∈ T x,r we get and as a result, Thus subtracting λ(B(x, r) ∩ Ω r ) from both sides yields the result.
The equivalence of Conditions (1) through (3) in Theorem 1.5 is now easy to see.
Proof of (1) ⇔ (2) ⇔ (3) in Theorem 1.5 . The statement (2) ⇒ (3) is trivial. Note that the contrapositive of (4) also proves that (3) ⇒ (1). As for (1) ⇒ (2), Lemma 4.3 shows that S n is in fact Ahlfors d-regular. Then Lemma 4.7 shows that S n is asymptotically 1-Poincaré fillable, and thus by Theorem 2.7 it satisfies a local (1, p)-Poincaré inequality at scale r 0 = r 0 (p, d, n) for any p > 1. However, since S n is connected and uniformly doubling, then as a consequence of [6, Theorem 1.3] the entire space S n satisfies a (global) (1, p)-Poincaré inequality. Note that, while the reference [6] deals with so called "semi-local" inequalities, in our case of bounded diameter these suffice for a global inequality.

4.2.
General metric carpets. In this section, we extend the proof of the previous section to give examples of Sierpiński sponges in general metric spaces. In particular, we prove Theorem 1.9.
The crucial role here is played by uniform domains. We note that conventionally, uniform domains are assumed to be open sets. Our definition, however, will allow for closed sets as well. Indeed, one can show that if a closed set Ω is uniform then its interior int(Ω) is uniform. The converse holds, at least in doubling metric spaces, if Ω is the closure of its interior. It is worth noting that, on the other hand, a closure of a non-uniform domain may be uniform, such as in the case of a slit disk. However, our starting point will always be closed sets.  We say that Ω is A-uniform up to scale r if for all x, y ∈ Ω with d(x, y) < r there exists an A-uniform curve with respect to x, y, and Ω. Lastly, Ω is A-uniform if it is A-uniform up to scale r, for all r > 0.
Alternative definitions, and their mutual equivalence, are discussed in [43,33]. For example, if the space is doubling and quasi-convex, then γ could be assumed to be a rectifiable curve and diameter could be replaced with length in the definition. So in the context of uniformity (and only in this context), by a "curve" we allow for curves to be continuous only, and not necessarily Lipschitz.
We remark, that in the case Ω = X, the condition is vacuously satisfied if X is quasiconvex, as the distance to an empty set is interpreted to be infinity.
For us, uniform domains are quite flexible to construct, and they inherit good geometric properties from the spaces containing them. In particular, there is the following version of [7,Theorem 4.4].  . Since ∂Ω has measure zero, andΩ is dense in Ω, the Poincaré inequality and doubling also hold for Ω. Following their proof, these properties hold initially at some scale r 0 /C with a constant C.
However, following the proof of [6,Theorem 4.4] and under the additional hypothesis that Ω is metric doubling and A-uniform up to scale r 0 , we may upgrade the scale to r 0 with a uniform constant. In [6], the proof uses properness and connectivity to get non-quantitative bounds on the number of balls involved and that need to be chained. However, the only modification needed is a quantitative bound on the number of such balls needed, which follows here from doubling and uniformity. We refer the reader to the proof of [6, Theorem 4.4] for more details.  [38]. Here, C 1,1 -regularity is with respect to the Euclidean smooth structure.
For an introduction to Carnot groups, we refer the reader to [38]. See also Section §4.3 for a discussion of the Heisenberg group (from a purely metric space perspective). (4) Let f : X → Y be a quasisymmetric map between metric spaces (X, d) and (Y, d ), i.e. that there is a homeomorphism η : [0, ∞) → [0, ∞) with necessarily η(0) = 0 and for all x, y, z ∈ X.
If Ω is a uniform domain in X then f (Ω) is also uniform in Y . The constants are quantitative with respect to the uniformity of Ω and the distortion function η.
In particular, if f : R d → R d is a K-quasiconformal map, then it is η-quasisymmetric [44], and so f (B(0, 1)) and f (R d \ B(0, 1)) are uniform. (5) Recently, T. Rajala [39] has proven that in any quasiconvex doubling space there exists an abundance of uniform domains. In fact, every bounded domain can be approximated by uniform domains in the Hausdorff metric. (The dependence on constants is not given explicitly there, but can likely be made explicit in some cases.) Our main theorem has an immediate consequence for uniform domains, or more generally, what we call "almost-uniform" domains.
Definition 4.17. A subset Y of X is called ( , A)-almost uniform at scale r 0 if for every r ∈ (0, r 0 ) there is a connected, closed subset Ω r of X that is A-uniform up to scale 4r, and so that Y ⊂ Ω r and for every x ∈ Y it holds that Corollary 4.19. Let (p, D, C, A) be structural constants and r 0 > 0.
If (X, d, µ) is a D-doubling space that satisfies a (1, p)-Poincaré inequality with constant C, then for any q > p there exists > 0, depending on the structural constants, such that if Y ⊂ X is ( , A)-almost uniform at scale r 0 > 0, then Y with its restricted metric and measure satisfies a (1, q)-Poincaré inequality at scale r 1 = r 1 (D, C, A, r 0 ).
Proof. By applying Definition 4.17 and Theorem 4.14 to Y , for each r ∈ (0, r 0 ) the filling Ω r with its restricted measure is D-doubling at scale 2r and satisfies a (1, p)-Poincaré inequality at scale 2r with constant C = C(D, C, A, p) independent of r. Thus, together with Y ⊂ Ω r we see that for each r > 0 the filling Ω r satisfies Definition 2.6 and thus the claim follows from Theorem 2.7.
Instead of prescribing a priori "fillings" to subsets in the sense of Theorem 2.7, we now return to the perspective in the Introduction ( §1.3) and consider constructions on general PIspaces akin to Sierpiński sponges. In this original but opposite viewpoint, we first consider complements of certain domains. Definition 4.20. Let A > 0. An open, bounded subset Ω of a metric space X is called A-co-uniform if X \ Ω is A-uniform and ∂Ω is connected.
To define "metric sponges" in terms of dyadic decompositions is nontrivial, as compared with Sierpiński sponges in R d . In general, metric measure spaces need not admit dyadic decompositions; even in the case of doubling measures, the cells of a Christ dyadic decomposition do not necessarily form a collection of uniform domains with a uniform constant.
We therefore define a construction in terms of removed sets (or "obstacles") instead. As there is no guarantee of self-similarity in an arbitrary metric space, these sets are given in terms of a strengthening of item (2) of Theorem 1.8, the uniform relative separation property applied to co-uniform domains instead of quasidisks; see item (5) below. for k ∈ N. A sequence of collections of domains {R n,k } ∞ k=1 in Ω forms a uniformly nsparse collection of co-uniform sets in Ω if there exist constants δ, L > 0 and A ≥ 1 so that for each R ∈ R n,k : (1) R ⊂ Ω; (2) R is A-co-uniform and Ω is A-uniform; . Moreover, {R n,k } is called dense in Ω whenever k∈N R∈R n,k R is dense in Ω. We lastly define S n := Ω \ k R∈R n,k

R.
It is worth mentioning here that Condition (5) appears as Equation (4.10) and was crucial in the proof for Sierpiński sponges. It will be similarly useful in the sequel.
Recall that Theorem 1.9 asserts that: On an Ahlfors-regular p-PI space, the complement of a uniformly sparse collection of co-uniform sets is also an Ahlfors-regular p-PI space. As an initial, geometric idea of the proof, we now state our main technical tool.
Theorem 4.22. Fix structural constants A 1 , A 2 , C, D ≥ 1. Let X be a C-quasiconvex, Dmetric doubling metric space, let Ω be an A 1 -uniform subset of X, and let S be a bounded, then Ω \ S is A -uniform in X, with dependence A = A (A 1 , A 2 , C, D, d(S,Ω c ) diam(S) ). For clarity, we postpone its proof to Appendix A. Applying it to an induction argument, however, yields the following useful result: cutting out a finite collection of co-uniform domains preserves uniformity. For simplicity, it is formulated in terms of the relative distance, from item (2) of Theorem 1.8: Corollary 4.23. Fix structural constants A 1 , A 2 , C, D ≥ 1. Let X be a D-metric doubling, C-quasiconvex metric space, let Ω be a A 1 -uniform domain in X and for i = 1, Then Ω \ N i=1 S i is also uniform in X. Proof. Order the elements S i so that diam(S i ) ≤ diam(S j ) for i ≥ j and define recursively where A is now treated as a function of the given parameters.
Proceed by induction and assume now that Ω n is A n -uniform with dependence A n = A (A n−1 , A 2 , C, D, ). By the separation condition, we know that d(S n+1 , Ω c n ) ≥ diam(S n+1 ). Therefore, again by Theorem 4.22 we have that Ω n+1 is A n+1 -uniform with dependence A n+1 = A (A n , A 2 , C, D, ).
As in the proof of Theorem 1.5, we need analogues of Lemmas 4.2 and 4.3, but for uniformly sparse collections of co-uniform sets instead of Sierpiński sponges. Their proofs being similarly straightforward, we postpone them to Appendix A and focus on how they imply Theorem 1.9 instead.

Lemma 4.24.
Let Ω ⊂ X be an A-uniform subset, and assume that (X, d, µ) is Ahlfors Q-regular with constant C AR . Then Ω is Ahlfors Q-regular with constant C AR,Ω = (4A) Q C AR when equipped with the restricted measure and metric.
holds for each x ∈ S n , where C δ depends quantitatively on C AR and Q, as well as on δ and L from Definition 4.21.
We are now ready to verify the Poincaré inequality, for metric space sponges formed from uniformly sparse collections of co-uniform sets.
Proof of Theorem 1.9. Scale the statement so that diam(Ω) = 1. The domains Y 1 = X and Y 2 = Ω and Y 3 = X \ R are uniform domains with some constant A by definition, for any R ∈ ∞ k=1 R n,k . So, each Y i is uniformly Ahlfors Q-regular with constant C AR,Y by Lemma 4.24. Let C be the constant of the Poincaré inequality of X, and D be the doubling constant of X. These fix the structural constants (p, D, C, A) in Corollary 4.19. Applying this corollary yields an > 0.
Local doubling and Poincaré inequalities will follow once we show that S n is almost uniform.
Let C δ be the constant from Lemma 4.25. Choose first K ∈ N so large that and so that n i ≥ 2 5 A δ for every i ≥ K . Then, define r 0 = δs K +1 /(2 4 AL). Now, we show that S n is ( , A)-almost uniform at level r 0 , with the aforementioned fixed structural constants.
To that avail, let x ∈ S n and r ∈ (0, r 0 ) be arbitrary. Choose k ≥ K so that Analogously as for Sierpiński sponges, put R n,l and S n,l = Ω \ R∈R n,l R and just as in the proof of Lemma 4.7, define the filling Ω r := S n,l . Since 8Ar ≤ δs k−1 /2, there is at most one R ∈ R n,k which intersects B(x, 8Ar), so for some i = 1, 2, 3. Since Y i is A-uniform, any y ∈ B(x, 4r) can be connected to x with an A-uniform curve with respect to Y i , so by (4.26) that same curve is an A-uniform curve with respect to Ω r . That is, Ω r is A-uniform at scale 4r. So to satisfy Definition 4.17 we only need to check the density condition (4.18). But, by the choice of K , we have s k+1 ≤ r, and thus by Lemma 4.25 Since Ω r \ S n lies in ∞ l=k+1 R∈R n,l R, we estimate its density in B(x, r) to be Here, we again used (4.26) and that Y i are Ahlfors C AR,Y -regular, for some i = 1, 2, 3.
This verifies all the conditions in Definition 4.17, in which case the conclusion of the Theorem follows by Corollary 4.19. Finally, the remark on density is trivial, and the remark on the exponent p follows from Keith-Zhong [29], since our spaces are complete. To be more specific, Keith-Zhong is applied first to X to improve its Poincaré inequality, and then the first part is applied to obtain a better inequality for the fillable set Y . The density is also explained in more detail in the context of the Heisenberg group below.
Finally, an estimate as above using Lemma 4.25 gives the Ahlfors regularity of S n for balls of size r < r 0 . Since Ω is bounded, the Ahlfors regularity then follows immediately. Indeed, the upper bound in Ahlfors regularity follows from that of X, and the lower bound from µ(B(x, r)) ≥ µ(B(x, r 0 )) if r ≥ r 0 . Further, the local Poincaré inequality upgrades to a Poincaré inequality (since Ω is bounded) from [6, Theorem 7.3] once we see that S n is connected. To see this let x, y ∈ S n be arbitrary, and let γ be any continuous curve in Ω connecting x, y. Let The set E is easily seen to be a connected compact subset of S n (since ∂R are connected by assumption), and thus S n is connected.

Non-Euclidean examples: Heisenberg meets Sierpiński.
We briefly discuss the (first) Heisenberg group H, which is a nilpotent Lie group of step 2 and in particular, a topological 3-manifold. Though the same results apply to all step-2 Carnot groups, we restrict our discussion to this case, for ease of exposition.
When equipped with the so-called Carnot-Carathéodory metric d CC induced from its Lie algebra of vector fields, H becomes a highly non-Euclidean metric space. In particular, recent theorems of Cheeger and Kleiner [11] imply that (H, d CC ) admits no isometric (or even bi-Lipschitz) embedding into any Hilbert space. Their proof uses the fact that H satisfies a (1, 1)-Poincaré inequality and therefore a Rademacher-type theorem for Lipschitz functions.
As for specific properties, topologically we have H = R 3 but the group law (x, y, t) × (u, v, w) = (x + u, y + v, t + w + 1 2 (xv − uy)) induces a Lie group structure on H with an associated nilpotent Lie algebra. For simplicity, instead of the Carnot-Carathéodory distance d CC on H, as discussed say in Montgomery's book [36], we introduce the Koranyí norm N (x, y, t) = (x 2 + y 2 ) 2 + t 2 1 4 , which induces another distance d(p, q) = N (q −1 p), between points p, q ∈ H, that is bi-Lipschitz equivalent to d CC . Moreover, N (x, y, t) ≤ (x, y, t) 2 if (x, y, t) 2 ≤ 1. It is known that the Haar measure on H is the usual Lebesgue measure λ on R 3 and that H is Ahlfors 4-regular with respect to it. Somewhat surprisingly, (H, d CC , λ) satisfies a (1, p)-Poincaré inequality. The p = 2 case was first observed by Jerison [25]; for the optimal exponent p = 1, see the proof of Lanconelli and Morbidelli [30]. (For more discussion about the geometry of these spaces, as well as the general theory of Carnot groups, we refer the reader to [4], [36], or [45].) In the spirit of the prior subsection, we now show the existence of metric sponges in the Heisenberg group, so it suffices to show the existence and uniform sparsity of co-uniform domains in H. To this end, we proceed in two steps: (1) Geometric preliminaries. Recall that on H there are natural dilations δ s (x, y, t) = (s −1 x, s −1 y, s −2 t) that are also Lie group automorphisms. Moreover, for any g ∈ H, the left-translation is an isometry in both the Lie group and the metric space senses, so consider the "conformal mappings" A λ,g = L g • δ λ . Now if E, Ω are fixed, bounded subsets of H with C 1,1 -boundary, then a result of Morbidelli [38] implies that Ω and H \ E are A-uniform domains for some A > 0. (As an example, the Euclidean unit ball B eucl (0, 1) as a subset of H has boundary ∂E = ∂B eucl (0, 1) with this regularity.) Further, since A λ,g act by an isometry and a scaling map, the domains remain A-uniform as λ ∈ (0, ∞) and g ∈ H vary. (2) The iterative construction. Fix a sequence n = {n i } ∞ i=1 in N such that n −1 ∈ 4 (N) and n i ≥ 3 for all i ∈ N, and define scales {s k } ∞ k=0 exactly as in Definition 4.21. We will define inductively our obstacles by first choosing center points at every scale, and then choosing collections of scaled and translated copies of the Euclidean unit ball with these centers as the obstacles. (In what follows, all the metric notions will be with respect to the distance on H defined above.) First, let Ω = B eucl (0, 1), so diam(Ω) ≤ 2. Now define G 1 = {0} and R 1,n = {A s 1 ,0 (B eucl (0, 1))} and let S 1,n = Ω \ B eucl (0, s 1 ) be the "pre-sponge" at the first stage. Assuming G k , R k,n , S k,n have already been defined at some stage k ∈ N, we next define G k+1 , R k+1,n , S k+1,n at the next stage as follows. Let G k+1 be a collection of points such that each g ∈ G k+1 satisfies d(g, ∂S k,n ) ≥ s k and d(g, g ) ≥ s k (4.27) for each g ∈ G k+1 . (Such a collection could be empty.) Moreover, call G k+1 maximal if no other collection of points G satisfying (4.27) strictly contains G k+1 . Putting Finally, define Lemma 4.28. Let n, G k , R k,n , S n , A be as above. Then, the sets {R n,k } ∞ k=1 in Ω form a uniformly n-sparse collection of co-uniform subsets in Ω.
Moreover, if each G k+1 is chosen to be maximal, relative to {G i } k i=1 , then {R n,k } ∞ k=1 is dense in Ω and S n has empty interior.
Proof. First, let R k ∈ R k,n and R l ∈ R l,n be arbitrary with k ≥ l, so R k = A s k ,g k (B eucl (0, 1)) and R l = A s l ,g l (B eucl (0, 1)) for some g k ∈ G k and g l ∈ G l .
To show the separation property, as a first case let k > l, so (4.27) implies that (4.29) in which case the Triangle inequality further implies As for k = l, applying (4.29) with l − 1 = k − 1 in place of k, as well as (4.27), yields Similarly if k ≥ l then (4.27) implies that so δ = 1 6 yields the desired separation. Moreover, diam(R k ) ≤ 2s k follows from construction, so the diameter bound follows with L = 2.
As in (1) before the statement of the Lemma, each R k has C 1,1 -boundary, so each X \ R k is A-uniform with A independent of k; the same is true of Ω. It follows that the collection {R n,k } ∞ k=1 is uniformly n-sparse. As for density, let x ∈ Ω be arbitrary, let r ∈ (0, 1 3 s 1 ), and choose k ≥ 1 so that s k+1 < r ≤ s k . Now, B eucl (x, s k+1 ) and hence B eucl (x, r) must intersect some R l ∈ R l,n for some l ≤ k + 2, otherwise G k+2 ∪{x} would form a larger collection of points satisfying the desired separation bounds; this, however, would contradict maximality of G k+2 .
Finally, we can apply Lemma 4.28 and Theorem 1.9 to conclude the following result.
Corollary 4.30. Let G k , n k , R k,n , S n , Ω, A be defined as above. Then S n is a compact subset of H which has empty interior, is Ahlfors 4-regular and satisfies a (1, p)-Poincaré inequality for any p > 1.
In conclusion, we note that the above construction applies to all step-2 Carnot groups, such as higher-dimensional Heisenberg groups, or for that matter, any Carnot group where uniform domains exist at all scales and locations. Moreover, replacing the left-translations L g with Euclidean translations x → x + g and the anisotropic dilations δ s with Euclidean dilations, the analogous construction still works for Euclidean spaces R d . In this case, this gives new examples of Sierpiński carpets and sponges supporting Poincaré inequalities, where the complementary domains are self-similar copies of E, with R d \ E uniform.
let Ω be a uniform domain in R d , and let E be a bounded open subset of Ω that is co-uniform in R d with 0 ∈ E and diam(E) ≤ 1. Given a sequence n = (n i ) ∞ i=1 in N with each n i ≥ 3 and with n −1 ∈ d (N), if {G k } ∞ k=1 is a sequence of uniformly n-sparse collections of points in Ω, defined analogously as above, then the set is Ahlfors d-regular and satisfies a (1, p)-Poincaré inequality for each p > 1. Moreover, S can be chosen to have empty interior.

4.4.
The problem of classifying Loewner carpets. The previous subsections gave a general construction for "sponges" that satisfy Poincaré inequalities, including on Euclidean spaces.
By varying the choice for subsets E in Corollary 4.31, we obtain many new possibilities beyond those in [32]. Instead of symmetry considerations, it is enough to impose regularity and sparsity conditions on E. For example, permissible subsets include E convex, E with connected and smooth boundary, or E any quasi-ball -that is, E = f (B(0, 1)) where f : R d → R d is any quasiconformal map. Moreover, rescaled translates s k E + g of a single subset E can be replaced by collections of uniformly co-uniform subsets {E gk }, provided that each E gk contains the origin and has at most unit diameter.
Motivated by Corollary 4.31, we return to the planar case and study whether such examples of carpets are generic. In this context, we can make stronger conclusions.
We begin with the following theorem from [46], which gives topological criteria for carpets. Recall that a point x on a connected metric space X is called a cut point if X \ {x} is disconnected and it is called a local cut point if there exists r > 0 so that x is a cut point of B(x, r). Also, S 3 will be the usual 1/3-Sierpiński carpet, which in our notation from the introduction corresponds with S n with n = (1/3, 1/3, . . . ).
Theorem 4.32 (Whyburn). Let S be a compact, connected, and locally connected subset of R 2 with empty interior. If S has no cut points, then it is homeomorphic to S 3 .
In what follows we refer to such sets S as topological carpets, which must satisfy   Heinonen-Koskela). Let S be a Ahlfors Q-regular metric measure space that satisfies a (1, Q)-Poincaré inequality. Then, there is a constant C ≥ 1 such that it is C-quasiconvex as well as C-annularly quasiconvex, that is for every z ∈ S and any r > 0, if x, y ∈ S \ B(z, r), then there exists a curve γ in X \ B(z, r/C) connecting x to y with Len(γ) ≤ Cd(x, y).
Corollary 4.34. If a compact subset S of R 2 is Loewner -that is, it satisfies a (1, 2)-Poincaré inequality and is Ahlfors 2-regular -and has empty interior then S is a topological carpet.
Proof. It is well-known from [41,10] that p-PI spaces are quasi-convex, and are therefore both connected and locally connected. Moreover, Loewner spaces lack local cut points, by Theorem 4.33. Thus the conditions of Theorem 4.32 are met, and we know that S is a topological carpet.
This motivates the following definition. Definition 4.35. A compact subset S ⊂ R n is called a p-Poincaré sponge if it has empty interior, is Ahlfors n-regular, and satisfies a (1, p)-Poincaré inequality. If n = 2 then S is also called a p-Poincaré carpet.
In particular, if n ≥ 3 and p ≤ n, then S is called a Loewner sponge. Also, if instead p ≤ n = 2 then S is called a Loewner carpet.
It is now natural to reformulate the Planar Loewner problem (Question 1.6): Question 4.36. Can one classify Loewner carpets, or even p-Poincaré carpets, in terms of the construction from Corollary 4.31?
There are few techniques available to treat the case of sponges in dimensions d ≥ 3, but for d = 2 techniques such as uniformization (see e.g. [8]) provide more possibilities for carpets.
In this subsection we give a partial answer to Question 4.36. In particular, we give sufficient conditions for a topological carpet to be a p-Poincaré carpet, or even Loewner. In fact, two of these conditions are also necessary.
A Jordan curve γ : S 1 → R 2 is called a η-quasicircle, if there exists γ : S 1 → R 2 with the same image as γ, and which is η-quasisymmetric, as given in Item (4) of Remark 4.16. A quasidisk is a domain of the form D = f (B(0, 1)), where f : R 2 → R 2 is quasisymmetric.

Proof. As S is closed, we decompose the complement into open components
where at most one component, say D 0 , is unbounded. Define Ω = R 2 \ D 0 . Since S is Loewner, by [24,Theorem 3.3], it lacks local cut points. Further, by Theorem 4.33 we obtain that S is C-quasiconvex and C-annularly quasiconvex, with C ≥ 1. It then follows from Theorems 4.32 and 4.33 that the D i are Jordan domains with pairwise disjoint closures.
Put C b = 2C 2 + 1. We now show that each ∂D i is of C b −bounded turning, for all i ∈ N. (For i = 0 the argument is similar and we omit it here.) Let γ : S 1 → ∂D i be a parametrization of the boundary as a Jordan curve. Let s, t ∈ S 1 be arbitrary and distinct and let J 1 , J 2 be the arcs in S 1 defined by these points. Now, if then (4.37) clearly follows. So assume instead that for both j = 1, 2, so there are points x j ∈ γ(J j ) \ B(γ(s), 2C 2 R s,t ) for both j = 1, 2.
Since S is C-quasiconvex, there is a rectifiable curve σ S joining γ(s) and γ(t) of length at most CR s,t within S. It is well-known, say by C. B. Moore's work [37,Theorem 1], that there exists a simple subcurve σ L in σ S that also joins γ(s) and γ(t). Also, since D i is a Jordan domain, there is a simple curve σ D joining γ(s) and γ(t) while intersecting ∂D i only at those two points. Form the Jordan curve σ by concatenating the two simple arcs σ L and σ D . Since σ ⊂ D i ∪ B(γ(s), CR st ), we know that x 1 , x 2 ∈ σ.
The curve σ divides R 2 into two components U, V so that ∂U = σ = ∂V . Since D i is an open set containing a point of ∂U and ∂V , we must have that D i intersects both U and V . However, since D i is Jordan, every point in D i \ σ can be connected either to x 1 or x 2 while avoiding σ. Now, if x 1 , x 2 ∈ U , then every point of D i \ σ would belong to U , which is not possible. Similarly for V , and thus x i must lie in separate components of R 2 \ σ, i.e. one belongs to U and another to V . In particular σ separates the points x 1 , x 2 .
However, x j ∈ S, and by annular quasiconvexity there exists a curve connecting x 1 and x 2 , within S and contained in R 2 \ B(γ(s), 2CR s,t ) and thus avoiding σ. Thus x 1 and x 2 belong to the same component of R 2 \ σ, which is a contradiction.
We now show uniform s-separation for s = 1 Supposing otherwise, there would exist a pair, say D i , D j , where (4.41) fails. Choose a pair of points a ∈ ∂D i , b ∈ ∂D j with |a − b| = d(D i , D j ). Next, let be the line segment joining a and b, which is contained in The points x 1 , a divide ∂D i into two arcs J 1 , J 2 . Next, since J i are connected, we can find points s i ∈ J i with d(s i , a) = 2Cd(D i , D j ). Thus d(s 1 , s 2 ) ≤ 4Cd(D i , D j ) By the annular quasiconvexity condition, and combined with [37, Theorem 1], we can find a curve σ L connecting s 1 to s 2 within B(a, 4C 2 d(D i , D j )) \ B(a, 2d(D j , D j )). Again find a curve σ D within D i connecting s i , and form the Jordan curve σ by concatenation of σ L and σ D . As above, this curve will separate x 1 and a. However, since σ can not intersect , and x 2 can be connected to while lying strictly within D j , we see that x 2 lies in the same component defined by σ as a. Hence, x 2 lies in a different component of R 2 \ σ than x 1 . But this contradicts the annular quasiconvexity condition, just as before.
The assumptions of uniform separation and uniform quasidisks have appeared before in [8, Theorem 1.1].
Theorem 4.42 (Bonk). If S = Ω \ i∈I D i , where D i and Ω, for i ∈ I are an at most countable collection of uniformly η-quasidisks, with {∂Ω} ∪ {∂D i } i uniformly relatively separated, then there exists a quasisymmetry f : In other words, every such set S is quasisymmetric to a similar set with circle boundaries. One can also find quasisymmetric maps with images with square boundaries, or any other self-similar shapes. The proof follows from identical arguments to [8,Theorem 1.6].
As a corollary we obtain a result, which is known to many specialists. Note that if D i are uniform quasidisks, then diam(D i ) 2 ∼ λ(D i ).
The following is a more quantitative version of Theorem 1.8, which can be considered its corollary. Proof. It is sufficient to show the first claim.
Firstly, as a consequence of Theorem 4.38, the set R 2 \ D i is a quasisymmetric image of R 2 \ B(0, 1). Then, since uniformity is preserved under quasisymmetries [33], we see that the With A, C λ , and C d now fixed, let > 0 be the constant from Corollary 4.19 such that any ( , A)-almost uniform subset of R 2 necessarily satisfies a (1, p)-Poincaré inequality. Define (4.47) p In particular, if D j is such that D j ∩ B(x i , 2Ar) = ∅ and diam(D j ) ≥ r, then j ∈ J i . Now let J = x i ∈N J i , and define Ω r := Ω J = Ω \ i∈J D i . We will show that Ω r is our desired filling.
We first show the local uniformity at scale 4r. Take x, y ∈ Ω r with d(x, y) ≤ 4r. Define Since |N x,r | ≤ D 8 , we have |J| ≤ D 8 N . Consider now some j ∈ J with D j ∩ B(x, 8Ar) = ∅. If diam(D j ) ≥ r, then we have an i so that B(x i , 2Ar) ∩ D j ∩ B(x, 2 4 Ar) = ∅ and we must have i ∈ J i ⊂ J by the choice of p,N and the previous two paragraphs. If instead diam(D j ) ≤ r we can take any B(x i , 2Ar) which intersects D j and thus B(x, 2 4 Ar) with j ∈ J i ⊂ J. Either way, any j ∈ J such that D j ∩ B(x, 8Ar) = ∅ will satisfy j ∈ J. It follows that, for each ρ ∈ (0, 8Ar], Since Ω J is A-uniform, we have that x, y can be connected by an A-uniform curve within Ω J , which will also automatically be an A-uniform curve within Ω r . Similarly, we obtain that Ω r is Ahlfors 2-regular with constant C λ up to scale 2r.
Next, we show the desired density bound. We have that Then the choice in Equation (4.47), Inclusion (4.48) and Ahlfors regularity of Ω J lead to which is the desired density condition; the Poincaré inequality follows.

General Poincaré results
We begin with some basic definitions. In what follows, X = (X, d) always refers to a metric space.
Definition 5.1. A Lipschitz map γ : K → X from a compact subset K of R is called a curve fragment in X. The domain K is also denoted by Dom(γ).
Length for curve fragments is defined analogously as for curves, that is where we further assume t i ≤ t j for i ≤ j. Furthermore, the set Undef(γ) = min(K), max(K) \ K, is always a countable union of disjoint open intervals, called gaps, as follows: From this, we define the total gap size as The path integral of a Lipschitz function f : X → R over a curve fragment γ is canonically defined as which exists for almost every t ∈ K. This coincides with the definition of Ambrosio [2] for curves, when first embedding the metric space X into a Banach space, such as L ∞ , and filling in the gaps of γ with line segments to construct a curve. This enlarged curve has a well-defined metric derivative and integral, and the ones for curve fragments are obtained by restriction. For a similar discussion see [14,3]. We will employ the proof of the characterization of (global) Poincaré inequalities from [24,Lemma 5.1], in order to prove new characterizations. Definition 5.3. Let 1 ≤ p < ∞. A proper metric measure space (X, d, µ) is said to satisfy a pointwise (1, p)-Poincaré inequality at scale r 0 > 0 with constant C ≥ 1, if for all locally Lipschitz functions f : X → R and all x, y ∈ X with r := d(x, y) ∈ (0, r 0 ) we have By [24,Lemma 5.15] this is equivalent to a Poincaré inequality. The proof in [24] covers global Poincaré inequalities, but the same argument applies to the local version as well. For completeness, we state the result and show the modifications, which only involve tracking the scales of the balls/pairs of points used.
Proof. Assume throughout that f is an arbitrary Lipschitz function. We first prove (1) ⇒ (2). Choose r 2 = r 0 /2 and let x, y ∈ X satisfy r := d(x, y) < r 2 . Consider balls B i = B(x, 2 1+i r) for i ≤ 0 and B i = B(y, 2 1−i r) for i > 0, all of which have radius less than r 0 and thus the local Poincaré inequality can be applied to them. Then for i ≤ −1, we obtain B i+1 = 2B i , as well as Thus, we get by a telescoping sum argument that Next, we prove (2) ⇒ (1). Let r 0 = r 2 /(2C 2 ) and fix B = B(x, r) with r < r 0 . By subtracting the median from f we can assume that We first prove a weak type bound using a covering argument. Now if z ∈ E ± k and y ∈ {±f ≤ 0} ∩ B, then d(z, y) ≤ 2r < 2r 0 < r 2 , so by the pointwise Poincaré inequality, there exist w ∈ X and r w ≤ C 2 r such that and either z ∈ B(w, r w ) or y ∈ B(w, r w ). Suppose first that r w ≤ r 0 /8 for each w so arising. Now by an easy argument such as in [24, Lemma 5.1] the collection of balls B(w, r w ) cover either E ± k or {±f ≤ 0} ∩ B. In the latter case then we get a cover of {±f ≤ 0} ∩ B, and thus using the 5B-Covering Lemma [34] (since we have doubling at scale 2r 0 ) we get In the case that they cover E ± k , we obtain the same estimate by covering E ± k directly. If instead r w > r 0 2 −3 for some w, then the claim follows easily from doubling and using a single ball. By applying Maz'ya's trick, i.e. applying the above argument with the truncated function u ± k (x) = ±(min(max(±f, 2 k−1 ), 2 k ) − 2 k−1 ) in place of f and at level 2 k−1 in place of 2 k , and since almost everywhere (see e.g. [3, Lemma 2.6]), then analogously as (5.7) we obtain which when multiplied by 2 kp and summed over k gives Then, via Hölder's inequality, doubling and the triangle inequality, we obtain which concludes the proof.
The proofs of Theorems 2.18 and 2.19 can be more succinctly formulated with a certain function that measures the connectivity of a space by rectifiable curves. Let p ∈ [1, ∞) be fixed. Since we consider a local notion of connectivity, we include the scale r 0 > 0 used.
First define Γ x,y (L) to be the set of Lipschitz curve fragments connecting x to y and with length at most Ld(x, y), let LSC 0,1 (X) be the collection of lower semi-continuous functions from X to [0, 1], and let E p x,y,C (τ ) be the class of τ -admissible functions E p x,y,C (τ ) := {g ∈ LSC 0,1 (X) | M Cd(x,y) g p (x) 1 p < τ, M Cd(x,y) g p (y) The crucial part of the proof of Theorem 2.19 is the following estimate.
Lemma 5.12. Let 1 ≤ p < ∞, let D ≥ 1, and let X be a (D, r 0 )-doubling metric measure space. If τ 0 ∈ (0, 1) and δ ∈ (0, 1 2 D −5/p ) are such that X is (C, δ, τ 0 , p)-max connected at scale r 0 , then (5.13) α p r 1 ,2C (L, τ ) ≤ C τ for every τ ∈ (0, 1) and for the choice of parameters . Let x, y be arbitrary with r := d(x, y) ∈ (0, r 1 ), and let g ∈ E p x,y,2C (τ ). Define We first prove that E has a desired maximal function bound at x and y. Let s ∈ (0, Cr) be arbitrary. We first show that, for every z ∈ E ∩ B(x, s) we have This is trivial when 2s ≥ Cr. Then consider 2s < Cr; for the same reasons, the averages of g at scales R ∈ (2s, Cr) are strictly smaller than the left hand side of Equation (5.15). Since g ∈ E p x,y,2C (τ ), for such R our choice of Λ implies Thus the supremum of M Cr g p (z) must already be attained for radii R ∈ (0, 2s).
slightly unfortunate restriction of C ≤ 2C . However, as C can always be made larger, this is not significant for us.
In this application of Lemma 2.4 we need the doubling at a larger scale. Taking the supremum over s we get M Cr 1 E (x) < τ 0 and symmetrically M Cr 1 E (y) < τ 0 . Let > 0 be arbitrary. By Definition 2.16, there exists a curve γ : I → X, with γ 1 E ds ≤ δτ  .2) and note that for every gap (a i , b i ) of γ , we have γ((a i , b i )) ⊂ E and Thus summing over i gives Now, clearly γ avoids E except possibly at x, y. Thus, by the lower semi-continuity of g we also have g(γ (t)) ≤ Λτ for every t ∈ K. In particular, (5.16) γ g ds ≤ Λτ Len(γ ) ≤ Λτ Cr.
By the assumption, δτ 1/p 0 < 1 2 , so each of these gaps is of size less than r 1 . By our prior estimates, we obtain Now let > 0 be given. We have M 2Cd i (g p (γ (t)) 1/p < Λτ for t = a i , b i , so by the definition of α p r 1 ,2C (L, Λτ ) there are curve fragments γ i of length at most Ld i connecting γ (a i ) and γ (b i ) and We now have all the tools to prove Theorems 2.18 and 2.19. The argument for the first result is similar to the one presented in [14], so we only sketch the details.
Proof of Theorem 2.18. Assume that the space satisfies a (1, p)-Poincaré inequality at scale r 0 with constant C 1 = C, so by Theorem 5.5 it also satisfies a pointwise (1, p)-Poincaré inequality at scale r 0 /2 with constant C 2 . To prove the maximal connectivity condition, fix x, y ∈ X, put r = d(x, y), fix τ ∈ (0, 1), and fix a Borel set E with M C 2 r 1 E (z) < τ for z = x, y. By Remark 2.15 it is sufficient to assume E open. We will construct a curve γ with controlled length and which almost avoids the set E. Define The infimum is taken over rectifiable curves γ connecting x to y.
Appendix A. On preserving uniformity by removal processes Here we give a proof of Theorem 4.22, our main technical tool in the construction of metric sponges. This requires some preliminary lemmas for uniform domains.
A.1. Initial properties of the measure. One useful property of a uniform domain Ω corresponds roughly to the boundary ∂Ω being porous (see e.g. [9] for a definition). We recall a variant of [7,Lemma 4.2] first, and sketch the proof.
Proof. Let x ∈ Ω and r ∈ (0, diam(Ω)) be arbitrary. Choose y ∈ Ω so that Then, let γ be the A-uniform curve connecting x to y. By continuity, there is a t such that d(γ(t), x) = r/4, and thus also d(γ(t), y) ≥ r/4. Therefore, and thus B(γ(t), r 4A ) ⊂ Ω and which completes the proof.
From this we conclude useful properties of the restricted measure on Ω, such as Ahlfors regularity and a basic volume (or measure) estimate for removed "obstacles." Proof of Lemma 4.24. Let x ∈ X, r ∈ (0, diam(Ω)) and let C AR,Ω = (4A) Q C AR . Firstly, the upper bound in the Ahlfors Q-regularity condition is trivial: A.1 there is a y ∈ B(x, r) ∩ Ω such that B(y, r 4A ) ⊂ Ω, in which case

Now, by Lemma
and the result follows.
Proof of Lemma 4.25. Scale the statement so that diam(Ω) = 1. Fix C δ = C 3 AR (2L(1 + δ)) Q δ −Q and, for l > k, let R l x,r be the set of all R ∈ R n,l so that R ∩ B(x, r) = ∅. It is sufficient to prove that for every l > k; the desired estimate follows from summation over l.
as desired.
A.2. Preserving uniformity. One of the forthcoming technical issues in removing a set R is that an arbitrary uniform curve relative to a pair of points in X \ R may travel "too far away" from R. To resolve this, we verify the following result, in whose proof we use the argument from [43, Theorem 4.1].
To fix notation, for a metric space X = (X, d) and for > 0 we denote -neighborhoods of subsets Y of X by N (Y ) := x∈Y B(x, ).
Lemma A.2. Fix D, C, A ≥ 1. Let X be a C-quasiconvex, D-metric doubling metric space. If S is a bounded, A-co-uniform domain in X, then for every > 0 there is a constant L = L (C, D, A) such that for every x, y ∈ N diam(S) (S) \ S, there exists a L -uniform curve γ with respect to x, y, and X \ S with γ ⊂ N 4(C+A 2 ) diam(S) (S).
Proof. The statement is scale invariant, so assume diam(S) = 1. Fix > 0. Let x, y ∈ N (S) \ S be arbitrary. If d(x, y) ≤ , the result follows simply by choosing the A-uniform curve with respect to x, y, and X \ S. Thus assume d(x, y) > , in which case d(x, y) ≤ 2 + diam(S) ≤ 2 + 1.
Let S be a maximally -separated subset of N C (S) \ S, that is for each distinct a, b ∈ S we have d(a, b) ≥ . The union s∈S B(s, 2 ) covers N C (S) \ S, so by quasiconvexity, connectivity of ∂S, and doubling, there exists M 0 ∈ N with dependence M 0 = M 0 ( , C, D) as well as a chain of points Note, quasiconvexity is used simply to ensure that the points x, y can be connected to ∂S. Then for i = 1, . . . , M − 2, let γ i be the A-uniform curve with respect to γ i (t i ), γ i+1 (t i+1 ), and X \ S. Define γ to be the concatenation of γ 1 | [0,t 1 ] with γ M | [t M −1 ,1] and all the γ i . Direct calculation and Definition 4.12 imply that  As for the cases when γ(t) coincides with a point on γ 1 (s) or γ M (s), the estimate follows from the A-uniformity of γ 1 and γ M . To clarify, this involves some case checking. We expand only the case of γ(t) coinciding with γ 1 (s), when we have d(γ(t), Ω c ) = d(γ 1 (s), Ω c ) ≥ 1 A min{diam(γ 1 | [0,s] ), diam(γ 1 | [s,1] )}. We also have diam(γ 1 | [0,s] ) = diam(γ| [0,t] ), so if the minimum is attained with diam(γ 1 | [0,s] ) the inequality is immediate. If the minimum is attained by the second option, then we have diam(γ 1 | [s,1] ) ≥ /4 ≥ 1 4A diam(γ| [0,t] ) by the choice of t 1 . In combination, we get that γ is an 32M A 4 -uniform curve contained in N 2(C+A) diam(S) (S). The containment follows since γ i ⊂ N 2(C+A) diam(S) (S).
We will need the following simple lemma on uniform domains. which, with A ≥ 1, is the desired result.
We are now ready to show that for co-uniform subsets S of uniform domains Ω, their relative complements Ω \ S are also uniform.
Proof of Theorem 4.22. Let A Ω = A 1 > 0 and A S = A 2 > 0 be the uniformity constants of Ω and X \ S, respectively. Fix = d(S,Ω c ) diam(S) . Without loss of generality assume diam(S) = 1. Letting δ 0 ∈ (0, min{1/A Ω , 1/A S }) to be determined later, we show that Ω \ S is A -uniform for some A ≥ 1/δ 0 , i.e. that for each x, y ∈ Ω \ S there is a curve γ so that . Let x, y ∈ Ω \ S be arbitrary. If d(x, y) < 3(A S +A Ω ) , the claim follows by either using the uniformity of X \ S or the uniformity of Ω, depending on which of S or Ω c is closer to x or y.
Thus, without loss of generality assume d(x, y) ≥ 3(A S +A Ω ) . Also, without loss of generality, assume x, y / ∈ ∂S. The case of either x, y ∈ ∂S can be obtained by using the uniformity of Ω to connect points x , y ∈ Ω \S to x, y, respectively, with max{d(x, x ), d(y, y )} ≤ If (A.8) is false then instead by co-uniformity, there is a A S -uniform curve γ i with respect to γ 0 (a i ), γ 0 (b i ), and X \ S. We now claim that the distance estimates (A.6), (A.7) hold for these curves γ i . To this end, by symmetry we may assume that d(γ 0 (a i ), S) ≥ max 3C , d(γ 0 (b i ), S) .
Introduce the short-hand notation x i := γ 0 (a i ), y i := γ 0 (b i ). Assume now that δ 0 < 32A Ω A S C , which with (A.5) implies that Then combining the previous estimates and the choice of δ 0 yields We have (A.7) and therefore In particular, (A.6) holds in both cases for the γ i as constructed.
In either case, C -uniformity of γ i with respect to X \ S and Lemma A. . This concatenated curve is the desired uniform curve and we will proceed to estimate its diameter and distance to S ∪ Ω c . The diameter bounds for γ i in (A.7) give rather directly that γ is continuous. By (A.7) each γ i has diameter at most diam(γ i ) ≤ C d(x i , y i ) ≤ C diam(γ 0 ), so it follows that the concatenation γ has diameter at most diam(γ) ≤ diam(γ 0 ) + 2 max i diam(γ i ) ≤ (1 + 2C ) diam(γ 0 ) ≤ A Ω (1 + 2C )d(x, y).
To check the uniformity condition (4.13), we again proceed by cases. Supposing first that t / ∈ I i for any index i, put U 0 = [0, t] and U 1 = [t, 1]. For k = 0, 1 we have from (A.7) Then, we get and (from the definition of B) Now consider the remaining case where t ∈ I i for some i ∈ J, in which case U k ∪ I i and U k ∩ I i and U k \ I i are all intervals for k = 0, 1. Similarly as above, Taking a minimum over k = 0, 1 in (A.13) gives min k=0,1 diam(γ| U k ) ≤ (1 + 2C )( min k=0,1 diam(γ 0 | U k \I i ) + d(x i , y i )). (A.14) Combining our work with 12C ≥ δ 0 gives the following.
In the ultimate inequality, we bound each of the terms in the minimum first, and then combine the bound. Now, the previous two estimates give for t ∈ (a i , b i ) that