1 Introduction

Euclidean line segments are one of the most fundamental objects of geometry. Although often loosely referred to as the shortest path connecting the endpoints, segments have a clear and unique axiomatic definition out of which many interesting properties follow. For example, it is well known that the intersection of two segments is always a segment (that could possibly degenerate to a point or even become empty). The definition of other mathematical concepts heavily depends on the definition of segments (e.g., we say that a certain region P of the space is convex if for any two points \(p,q\in P\), the line segment defined by p and q is in P).

The definition of segment works very well in a Euclidean or similar spaces with infinite precision. Digital representation (such as pixels in a screen) introduces imprecision. The most common approach used in practice is to somehow round the Euclidean segment into the digital space. The digital segments will look very similar to the Euclidean counterparts (that is, the error is very small). However, we cannot guarantee the useful properties and concepts that follow from the axiomatic definition of Euclidean segment (see Fig. 1).

In the aspect of the consistency of digital segments, we look for a deterministic method to construct digital segments in a way that (i) the analogous of Euclidean axioms are satisfied and (ii) the digital segments resemble the Euclidean ones as much as possible.

Fig. 1
figure 1

(Left) Two Euclidean line segments that intersect in a point. (Right) Rounding produces polylines that intersect in three disconnected components

1.1 Preliminaries

Our aim is to construct a digital path \(dig (p,q)\) for any two points \(p,q \in \mathbb {Z}^d\). Ideally, we want dig to be defined for any pairs of points in \(\mathbb {Z}^d\) (full list of requirements is described below), but sometimes we consider the case in which dig is only defined for a subset of \(\mathbb {Z}^d \times \mathbb {Z}^d\).

Definition 1.1

For any \(S\subseteq \mathbb {Z}^d \times \mathbb {Z}^d\), let \(DS (S)\) be a set of digital segments such that \(dig (p,q)\in DS (S)\) for all \((p,q)\in S\). We say that \(DS (S)\) forms a partial set of consistent digital segments on S (partial CDS for short) if for every pair \((p,q)\in S\) it satisfies the following five axioms:

  1. (S1)

    Grid path property: \(dig (p,q)\) is a path between p and q under the 2d-neighbor topology.Footnote 1

  2. (S2)

    Symmetry property: if \((q,p) \in S\), \(dig (p,q)=dig (q,p)\).

  3. (S3)

    Subsegment property: for any \(r\in dig (p,q)\), \(dig (p,r) \in DS (S)\) and \(dig (p,r) \subseteq dig (p,q)\).

  4. (S4)

    Prolongation property: \(\exists \, r \in \mathbb {Z}^d\) such that \(dig (p,r)\in DS (S)\) and \(dig (p,q) \subset dig (p,r)\).

  5. (S5)

    Monotonicity property: for all \(i\le d\) such that \(p_i = q_i\), it holds that every point \(r\in dig (p,q)\) satisfies \(r_i = p_i = q_i\).

These axioms give nice properties of digital segments analogous to Euclidean line segments. For example, (S1) and (S3) imply that the intersection of two digital segments is another segment (that could degenerate to a single point or an empty set). (S5) implies that the intersection of a segment with an axis-aligned halfspace is a segment [and connected by (S1)], and so on.

A partial CDS for \(S = \mathbb {Z}^d\times \mathbb {Z}^d\) is called a set of consistent digital segments (CDS for short). Although our final goal is to have such a construction that works for the case in which \(S=\mathbb {Z}^d\times \mathbb {Z}^d\), in this paper we consider subsets of the form \(S = \{o\}\times \mathbb {Z}^d\) (where o is the origin or any fixed point in \(\mathbb {Z}^d\)). We say that a partial CDS on such a set is a consistent digital ray system (CDR for short), as it contains all segments (or rays) from o to \(\mathbb {Z}^d\). Note that the five axioms would imply that CDR is a tree connecting a fixed point o to any other point of \(\mathbb {Z}^d\) (see Fig. 2). If we have a consistent construction for such a tree rooted at every grid point, then we have a CDS (see Fig. 2).

Fig. 2
figure 2

Left: An example of a CDR at o in one quadrant. Right: An example of putting two CDRs (only show in one quadrant) together such that they satisfy the five axioms

Another property that we want from partial CDS is that they visually resemble the Euclidean segments. The resemblance between the digital segment \(dig (p,q)\) and the Euclidean counterpart \(\overline{pq}\) is measured using the Hausdorff distance. The Hausdorff distance H(AB) of two objects A and B is defined by \( H(A, B) = \max { \{ h(A,B), h(B, A) \}}\), where \(h (A,B)= \max _{a \in A} \min _{b \in B} \delta (a,b)\), and \(\delta (a,b)\) is the \(\Vert \,{ \cdot }\,\Vert _{\infty }\) L-infinity norm.Footnote 2

The resemblance of a partial CDS on S is defined as

$$\begin{aligned} \max _{(p,q)\in S} H(dig (p,q),\overline{pq}) \end{aligned}$$

(that is, the largest error created between a digital segment and its Euclidean counterpart). This value is simply referred to as the error of the partial CDS construction. We are interested to see how the error grows as we enlarge our focus of interest. Thus, we limit the domain to the case in which both points are in the \(L_1\) ball of radius N centered at the origin [i.e., \(\mathcal {G}_N=\mathbb {Z}^{d} \cap B_1(o, N)\)]. Rather than looking for the exact function, we are interested in the asymptotic behavior of the error as a function of N. For simplicity, we will actually restrict ourselves to the positive orthant \(\mathcal {G}^+_N=\mathcal {G}_N\cap _i H_i\), where \(H_i=\{p\in \mathbb {Z}^d:p_i \ge 0\}\) and \(p_i\) is the ith coordinate of p (the results extend to other orthants by symmetry).

1.2 Previous Work

Research on the digital representation of line segments has been an active area of research for over half a century [13]. Many different approaches have been considered. Most common techniques look for methods that implicitly encode the properties we desire. For example, a popular approach is to consider a dynamic method to digitize line segments. In this setting, the way we transform a Euclidean segment into a digital one will depend on which other segments are present (and their specific coordinates). It is known that a grid of exponential size is needed if we want to preserve the combinatorial types [12]. Another workaround is known as snap rounding that represents line segments by polygonal chains: each segment is carefully rounded to avoid inconsistencies. Note that both of these ideas implicitly keep the error small while making sure that the intersection of two digital segments is a connected component. Although they work well in practice, they have the drawback that they cannot be used to define objects that are based on digital segments (such as digital starshapes or convex regions).

The first paper to explicitly look for an axiomatic approach was in 1987 by Luby [14]: in his work he introduced the concept of CDS (under the name of smooth geometries) and gave a method to construct CDSs in \(\mathbb {Z}^2\) based on a characterization of CDRs in \(\mathbb {Z}^2\): any CDR can be uniquely identified by four total orders of the integers (and vice versa). By choosing a proper total order and using it for all points of \(\mathbb {Z}^2\) we obtain a CDS with \(O(\log N)\) error. HåstadFootnote 3 gave a matching lower bound for any such construction.

These results were rediscovered by Chun et al. [9] and Christ et al. [7]. They renewed interest in the topic and sparked other related research: Chowdhury and Gibson [5] gave necessary and sufficient conditions for a collection of CDRs to form a CDS. In a companion paper, the same authors [6] afterwards provided an alternative characterization together with a constructive algorithm; specifically, they gave an algorithm that, given a collection of segments in an \(N \times N\) grid that satisfies the five axioms, computes a CDS that contains those segments. The algorithm runs in polynomial time of N.

Unfortunately, most of these results only work on the digital plane. Out of the previously mentioned results, only the CDR construction of Chun et al. [9] extends to three and higher dimensions. The construction has \(O(\log N)\) error regardless of the dimension. Chun et al. [9] also considered the case in which the monotonicity property (S5) is not preserved. They showed that if we remove (S5), we can obtain a CDR with O(1) error in any dimension. Although the error is small, the resulting segments are far from what we would consider similar to the Euclidean segments (because they loop around many times). Recently, Chiu and Korman [4] showed that the problem in higher dimensions behaves very differently from the two dimensional case. Specifically, they studied how to extend the CDS construction of Christ et al. [7] and showed that it is very limiting in three (and higher) dimensions. Their method can construct arbitrarily many CDRs [with \(\varOmega (\log N)\) error] and some of them could admit a CDS. However, whenever the construction yields a CDS, it will have \(\varOmega (N)\) error.

Our interest in higher dimensions comes motivated by an application in image segmentation. Image segmentation is the act of separating an object from its background in an image (that is, determining which pixels are part of the background and which ones not). Chun et al. [9] showed how to combine their CDR construction with the framework of Asano et al. [1] to segment two dimensional images. This idea has been extended to consider other shapes (see [8] for a detailed list), but always two dimensional. The hope is that a high dimensional CDR with low error will produce more accurate segmentation algorithms. Although traditional images taken with a camera are two dimensional, images from a medical equipment such as those taken with an MRI machine can have three or even higher dimensions (say, when we want to track changes of a particular object along time).

The concept of consistency has also been investigated in more general graphs than \(\mathbb {Z}^d\). A system of paths in a real-weighted graphs is a collection of paths defined between any two vertices in the graph. Similar to our setting, a system of paths is said to be consistent when the intersection of any two paths in the system is also a connected path in the system. The characterization of such system has been studied, see [3, 10] for more details.

1.3 Differences Between Two and Higher Dimensions

When approximating some geometric object, it often happens that higher dimensions create a larger error than in a lower dimension setting. Since the high dimensional setting contains a two dimensional subspace, it is common for lower bounds to extend to higher dimensions. However, this is not true for the case of CDRs: although a three dimensional CDR contains two dimensional subspaces, those subspaces need not exactly be CDRs [and thus the \(\varOmega (\log N)\) lower bound does not directly hold]. In this paper, we further explain the reason and investigate the lower bound for the higher dimensional case.

The main reason why a subspace is not a CDR is because of the prolongation property (S4): we require that every segment is extendable, but has no constraints on the dimension in which it does so. In particular, a subspace of a high dimensional CDR need not be a CDR (see an example in Fig. 3). Subspaces of CDRs are what we call weak CDR: it is a construction that almost always behaves like a CDR but some vertices may not satisfy the prolongation property (S4). Each vertex that does not extend is called an inner leaf. In this paper we study weak CDRs in two dimensions and the implications that they have for (proper) CDRs in higher dimensions.

Fig. 3
figure 3

(Left) A drawing of a CDR in \(\mathcal {G}^+_N\subset \mathbb {Z}^3\) for \(N=4\). Notice that the CDR is a tree whose leaves are at the plane \(x+y+z=N\). (Middle) A cross section on the xy-plane of the same CDR. Observe that vertices A and B do not extend within the xy-plane. Thus, the subspace is a weak CDR (rather than a proper CDR). (Right) A map of the weak CDR into a two-colored pointset. Regions with many blue points and few red correspond to portions of the CDR with high error

The lower bound argument for \(\mathbb {Z}^2\) is heavily based on discrepancy theory [15]. Any split vertex (branch point) of the CDR tree is mapped to an x-coordinate in \([0,1)\subset \mathbb {R}\) (see Fig. 4). Then, a CDR contains many split vertices, and thus it is mapped to a sequence of real numbers in [0, 1). Håstad showed that the discrepancy of the sequence gives a lower bound for the Hausdorff error of the CDR in \(\mathbb {Z}^2\). Afterwards, Christ et al. showed that there is a bijection between the two objects showing that sequences in [0, 1) with discrepancy d can be transformed into CDRs whose error is \(\varTheta (d)\).

1.4 Need of Bichromatic Discrepancy

A key property for Håstad’s lower bound argument is that the intersection of a CDR in two dimensions with line \(x+y=c\) (for any \(c\in \mathbb {Z}\)) contains a single split vertex.Footnote 4 Then, he maps the relative position of the split vertex into the [0, 1) interval and links the error of the CDR to the discrepancy of the transformed pointset. Unfortunately, the key property does not hold when we look at two dimensional subspaces of a CDR in three or more dimensions. Since subspaces can be weak, we can have inner leaves that in turn allow for more than one split vertex to exist in the same diagonal. Thus, we need to map both split and inner leaves into a two dimensional unit square. Similar to Håstad’s argument, we can link the error of the CDR with the discrepancy of the generated pointset. However, because we have two types of points we must instead look at a two colored pointset and study the difference in size of the two groups.

This naturally brings the idea of bichromatic discrepancy: let R and B be a set of red and blue points in the unit square, respectively. Let \(m=|B|-|R|\) and assume \(m>0\). For any set P of points in the unit square and \(x,y\in [0,1]\) let P[xy] be the number of points in \(P\cap [0,x]\times [0,y]\). For any two real numbers \(0 \le x,y\le 1\) we define the discrepancy of R and B at (xy) as \(D_{R,B}(x,y)=mxy- (B[x,y]-R[x,y])\). The discrepancy of R and B is simply defined as \(D^*_{R,B}=\max _{(x,y)\in [0,1]^2} | D_{R,B}(x,y) |\) (i.e., the highest discrepancy we can achieve among all possible rectangles). The discrepancy \(D_{R,B}^*\) of a two-colored pointset is high if and only if there is an axis-aligned rectangle with the origin as corner in which the difference of the cardinalities is far from the expected difference.

This is a natural extension of the concept of discrepancy. Indeed, the classic definition of (monochromatic) discrepancy is the particular case in which \(R=\emptyset \) (see [15] for a detailed survey of this concept and its many applications). To the best of our knowledge, the extension of discrepancy to chromatic settings is largely unexplored. Beck [2] considered coloring an uncolored pointset so as to minimize the chromatic discrepancy [obtaining \(O(\log ^4\! n)\) upper and \(\varOmega (\log ^4\!n)\) lower bounds for the definition given above, or \(O(n^{1/2+\varepsilon })\) upper and \(\varOmega (n^{1/4-\varepsilon })\) lower when rectangles can have arbitrary orientation]. Dobkin et al. [11] introduce algorithms to find the maximum discrepancy for a given pointset (under different definitions of bichromatic discrepancy).

Fig. 4
figure 4

(Left) Each split vertex is mapped to a leaf (small letter to capital letter). Their x-coordinate values give a sequence: 0, 4, 2, 7, 1, 6, 3, 5. (Right) This sequence is visualized in a unit square. The red rectangle is corresponding to vertex v on the left hand side. The discrepancy of the red rectangle is roughly \(|8\times 0.75^2-4|=0.5\), which is related to the distance from v to the red Euclidean segment

1.5 Results and Paper Organization

As mentioned above, the lower bound argument for two dimensions maps CDR into a pointset and studied the dependency between the two objects. Our lower bound arguments need to use an additional intermediate space: from (a) any CDR in \(\mathbb {Z}^d\) we consider (b) the weak CDR it generates in the \(x_1x_2\)-plane, and (c) map the weak CDR into a set of points in the unit square. Along the paper we will analyze properties of each of the spaces, and see what implications it has for the other two. Specifically, we show the following:

(i) First, in Sect. 2, we detail how to map weak CDRs into a two-colored pointset in \([0,1)\times [0,1)\).

(ii) As mentioned above, we must also extend the discrepancy results [15] to a (bi)chromatic setting. For the purposes of this paper, the main result we need is the following one:

Theorem 1.2

(bichromatic discrepancy) For any set R and B of points such that \(|B|>|R|,\) there exists a constant \(c > 0\) such that

$$\begin{aligned}D_{R,B}^* \ge c\cdot \frac{(|B|-|R|)\log {(|B|+|R|)}}{|B|+|R|}.\end{aligned}$$

Proof of the chromatic extension can be done by making minor changes to Schmidt’s original proof [16] for monochromatic discrepancy. As such, we defer the additional details needed to the appendix.

(iii) With this new discrepancy result we obtain a tradeoff between the error of any weak CDR and the number of inner leaves [i.e., vertices that do not satisfy (S4)]. When the weak CDR has zero inner leaves (and thus is a proper CDR) our bound matches the lower bound of Håstad. As the number of inner leaves increases, the lower bound decreases. In Sect. 3 we prove the following relationship.

Theorem 1.3

For any \(N \in \mathbb {N},\) any weak CDR defined on \(\mathcal {G}^+_N\subset \mathbb {Z}^2\) with \(\kappa _2\) inner leaves between lines \(x_1+x_2=\lceil N/2 \rceil \) and \(x_1+x_2 = N\) has \(\varOmega ({N \log N}/({N+\kappa _2}))\) error.

This shows an important relationship between \((\mathrm{b})\) and \((\mathrm{c})\) spaces mentioned above. In short, the CDR will have \(\varOmega (\log N)\) error unless there are \(\omega (N)\) many inner leaves.

(iv) Intuitively speaking Theorem 1.3 says that a CDR with few inner leaves [say, \(o(N\log N)\)] in the \(x_1x_2\)-plane induces \(\omega (1)\) error in that plane. On the other hand, we also prove that many inner leaves [say, \(\omega (N)\)] in that plane cause too many points to extend to one of the remaining dimensions, and create \(\omega (1)\) error as well.

Lemma 1.4

Any CDR defined on \(\mathcal {G}^+_N\subset \mathbb {Z}^d\) with \(\kappa _2\) inner leaves in \(x_1x_2\)-plane between lines \(x_1+x_2=\lceil N/2 \rceil \) and \(x_1+x_2 = N\) has \(\varOmega ((\kappa _2/N)^{{1}/({d-2})})\) error.

Balancing these two error sources leads to our main result, i.e., a lower bound of \(\varOmega (\log ^{1/(d-1)}\!N)\) for any CDR construction in d dimensions (see Sect. 4):

Theorem 1.5

Any CDR in \(\mathbb {Z}^d\) has \(\varOmega ( \log ^{1/(d-1)}\! N)\) error.

Recall that Luby [14]’s CDR works in any dimension and has \(O(\log N)\) error, so the gap between upper and lower bounds grows with d. Although we believe our analysis to be loose (especially in Theorem 1.5), we have no reason to believe that \(O(\log N)\) is the correct bound either.

In Sects. 5 and 6, we explore the possibility of having a CDR in high dimensions with \(o(\log N)\) error (rather than directly looking at CDRs in high dimensions, we see what properties it would imply in the other two subspaces). Although we cannot explicitly find a construction with \(o(\log N)\) error, we provide interesting insight on how further research can solve this question.

(v) Our lower bound argument shows that for a CDR in \(\mathbb {Z}^3\) with \(o(\log N)\) error to exist we must be able to construct a weak CDR in \(\mathbb {Z}^2\) with \(O(N\log N)\) inner leaves and \(o(\log N)\) error. We show how to create a weak CDR with at most 5/2 error and \(\varTheta (N^2)\) inner leaves. Although the construction follows the spirit of the method of Chun et al. [9] (for the case in which the monotonicity property is not preserved), we believe our resulting CDR to be much more aesthetically pleasing and it resembles more the Euclidean segments.

Theorem 1.6

For any \(N>0\) we can create a weak CDR in \(\mathbb {Z}^2\) with at most 5/2 error and at most \(N^2/12\) inner leaves.

Although the number of inner leaves is large (roughly speaking, one in six vertices will be an inner leaf), this construction has other interesting properties that would make it suit for practical purposes. Moreover, we extend this construction to have a tradeoff construction with O(c) error and \(O(N^2/c)\) inner leaves for any \(c \ge 1\).

Theorem 1.7

For any \(N>0\) and \(1 \le c \le N\) we can create a weak CDR in \(\mathbb {Z}^2\) with O(c) error and \(O(N^2/c)\) inner leaves.

Discussion of this construction and other variations is given in Sect. 5.

(vi) In order to reduce the number of inner leaves we instead look at how the mapping of any weak CDR with constant error to points would look. Discrepancy results give us a condition on any such CDR with \(o(N^2)\) many inner leaves. Specifically, in Sect. 6 we show the following result.

Theorem 1.8

Let B and R be two sets of points whose discrepancy satisfies \(D_{R,B}^*<1\). Then \(|B|= \varOmega (m^2),\) where \(m =|B|-|R|\).

Note that the constant 1 is crucial for our proof: although we would like the statement to hold when \(D_{R,B}^*=O(1)\), it is unlikely that our approach can be extended. We believe that this result could be the first step towards proving that the construction in (v) is asymptotically tight. Further discussion of this result is given in Sect. 5 (after the statement’s proof).

Further discussion on the implication of these results is given in Sect. 7.

2 Mapping a Weak CDR into a Pointset

We start by showing how to transform a weak CDR in two dimensions into a two-colored pointset in \([0,1)^2\). Given any weak CDR, its restriction to \(\mathcal {G}^+_N\) forms a spanning tree T of \(\mathcal {G}^+_N\) because of axioms (S1) and (S3). Although the tree is undirected, we see it as a directed graph (rooted tree) whose edges are oriented away from the origin (root). Then, (S5) implies that the parent of each vertex (xy) (except the root) is either \((x-1,y)\) or \((x,y-1)\). For any edge \(e=uv\) of T, where u is the parent of v, we define T(e) as the subtree of T that is rooted at the child node v of e. We slightly abuse the notation and use T(v) to denote the subtree that is emanating from v towards the leaves [that is, \(T(v)=T(e)\)].

For any \(n\le N\) let \(L_n\) be the points of \(\mathcal {G}^+_N\) whose sum of coordinates is n [i.e., \(L_n=\{(x,y)\in \mathcal {G}^+_N:x+y=n\}\)]. We follow the usual terminology that we call a vertex of degree one a leaf. We further consider two subcategories: we say that a leaf v of T is an inner leaf if it is not in \(L_N\). All the vertices in \(L_N\) are called boundary leaves. Note that, by properties of CDR, all vertices of \(L_N\) are proper leaves (since any children should be in \(L_{N+1}\), which is outside \(\mathcal {G}^+_N\)). Further note that in a proper CDR there will be no inner leaves. A vertex v of T is a split vertex if it has degree three or it is the origin. Let \(\mathcal {S}\) be the set of split vertices and \(\mathcal {D}\) the set of inner leaves.

2.1 Auxiliary Function

Before giving the transformation from a tree to a point set we first define an auxiliary function \(M:\mathcal {G}^+_N\rightarrow [0,1]\). For any \(p \in L_N\) we set \(M(p)={p_x}/({p_x+p_y})\). For any subtree \(T'(v)\) of T we define two more functions inductively for \(v \in L_{n}\) from \(n = N\) to 0 as follows:

$$\begin{aligned} \max T'(v)= \max _{p\in T'(v) \cap (\mathcal {D}\cup L_N)} M(p),\quad \min T'(v)= \min _{p\in T'(v) \cap (\mathcal {D}\cup L_N)} M(p), \end{aligned}$$

where M(p) for \(p \in \mathcal {D}\) is defined in the next paragraph.

For any inner leaf \(\ell \in \mathcal {D}\), we know that the edges \(e_1=(\ell _x-1,\ell _y+1)(\ell _x,\ell _y+1)\) and \(e_2=(\ell _x+1,\ell _y-1)(\ell _x+1,\ell _y)\) must be present in T. Thus, we define \(M(\ell )\) as \(M(\ell )=({\max T(e_1)+\min T(e_2)})/{2}\). Intuitively speaking, we look at the leaves above and to the right of \(\ell \), and assign a value that is in between the two of them (see Fig. 5, left). The following statement shows that these values are sorted along \(L_n\).

Lemma 2.1

Let \(T(u), T(v) \subset T\) be two subtrees of T rooted at the vertices \(u, v \in L_n\) (respectively) for some \(n\le N\) such that \(u_x < v_x\). Then, it holds that \(\max T(u)<\min T(v)\).

Proof

We prove this statement by induction on n from N to 1. If both \(u,v\in L_N\) then both T(u) and T(v) consist of a single vertex and the proof trivially follows. Now, assume that the statement is true for any two vertices \(u', v' \in L_i\) for \(i > n\). We need to show that the statement holds for any two vertices \(u, v \in L_n\) such that \(u_x < v_x\).

First observe that if we have two descendants \(u'\) and \(v'\) from u and v respectively such that \(u',v'\in L_{n'}\) for some \(n'>n\), then it holds that \(u'_x < v'_x\). Indeed, this follows from the fact that when we embed T in the natural way with edges drawn as straight segments, the result is a tree with no crossings. Thus, if \(v'_x < u'_x\) happened for some descendants, then the two paths in T from u to \(u'\) and from v to \(v'\) would either cross or form a cycle. Any of those two situations would contradict with the fact that T is a weak CDR.

Back to our original proof, consider the case in which neither u nor v are inner leaves. By the above argument we have that the x-coordinate of any child \(u'\in L_{n+1}\) of u must be smaller than any child \(v'\in L_{n+1}\) of v. By induction, this implies that \(\max T(u') < \min T(v')\) and thus \(\max T(u)< \min T(v)\).

The cases in which u or v are inner leaves are similar: if u is an inner leaf, we have \(\max T(u)= M(u) =({\max T(u_1)+\min T(u_2)})/{2}\), where \(u_1=(u_x,u_y+1)\in L_{n+1}\) and \(u_2=(u_x+1,u_y)\in L_{n+1}\). By induction on \(u_1\) and \(u_2\) we have \(\max T(u_1)< \min T(u_2)\) and \(\max T(u)< \min T(u_2)\), thus we need to compare \(\min T(u_2)\) with any children of v. If v is also an inner leaf, we can do a similar argument and have that \(\max T(v_1)< \min T(v)\) where \(v_1=(v_x,v_y+1)\).

In general, given u, let \(u'\in L_{n+1}\) be the child of u with the largest x-coordinate (or \(u'=u_2\) if u is an inner leaf). Similarly, we define \(v'\) as the child of v with the smallest x-coordinate (or \(v'=v_1\) if v is an inner leaf). Again, by planarity of the natural embedding, we have that \(u'_x \le v'_x\) if at least one of uv is an inner leaf. In either case, we can use induction and get that \(\max T(u')\le \min T(v')\) which implies \(\max T(u)<\max T(u')\le \min T(v') \le \min T(v)\) (if u is an inner leaf) or \(\max T(u)\le \max T(u')\le \min T(v') < \min T(v)\) (if v is an inner leaf) completing the proof. \(\square \)

For any subtree \(T'\) of T, its depth is the longest possible length of a path from its root to any of its leaves. Any split vertex \(s\in \mathcal {S}\) has two branching edges \(e_1\) and \(e_2\), each defining a subtree. The subtree of higher depth is the preferred subtree of s [in case of tie, we choose the tree emanating from \((s_x+1,s_y)\)]. For any point \(p\in \mathcal {G}^+_N\) we define a walk from p to some leaf of T. If \(p\in L_n\) has degree two, we follow the single edge to \(L_{n+1}\). If \(p \in \mathcal {S}\), we follow the edge to the preferred subtree. This process is continued until we reach a leaf \(\gamma (p)\).

With this virtual walk we can define the function M to all points \(p\in \mathcal {G}^+_N\) (not only leaves) of the domain as follows. If p is neither a split nor a leaf, we define M(p) as \(M(p)=M(\gamma (p))\). For a split vertex s, let \(s'\) be the child of s that is not on the preferred subtree of s. Then, we define M(s) as \(M(s)=M(\gamma (s'))\).

Intuitively speaking, from any vertex we always follow its only edge away from the root (if it has degree 2) or the preferred edge (if it has degree 3) until we reach a leaf. The only exception is if we start on a split vertex, in which case we do not follow the preferred edge at the first step. This exception is needed to make sure that the end points of the walk starting from split vertices are distinct.

Lemma 2.2

For any split vertex \(s\in \mathcal {S},\) there exists a unique leaf \(\ell \in \mathcal {D}\cup L_N\) such that \(M(s)=M(\ell )\). And for any leaf \(\ell \in \mathcal {D}\cup L_N \setminus \{(N,0)\},\) there exists a unique split vertex \(s \in \mathcal {S}\) such that \(M(s)= M(\ell )\).

Proof

By definition of the auxiliary function, two leaves do not have the same mapping. Thus, it remains to show that the walk of two different split vertices cannot end at the same leaf. Imagine doing the walk backwards: start at any leaf, walk towards the origin and stop as soon as you reach a split vertex by traversing its non-preferred edge. Since each split vertex has exactly two children, it follows that exactly one leaf will stop at each split vertex. The exceptional case is the leaf (N, 0), from which walking backwards to the origin is a horizontal path and the path does not contain any non-preferred edge. That is, in the inverse walk we follow preferred edges until we reach a non-preferred edge. This is equivalent to starting at a split vertex and follow the non-preferred edge once and continue with the preferred edges, which is the exact definition of our auxiliary function. \(\square \)

Fig. 5
figure 5

(Left) A tree of a weak CDR and the value of the auxiliary function M applied to all leaves of the tree. (Right) The tree transformed into blue and red point sets. Two vertices of the same layer are mapped to points with the same y-coordinate and an inner leaf and its corresponding split vertex are mapped to points with the same x-coordinate (see the highlighted orange circles) (for Theorem 2.4). The x-coordinate of \(v=(6,2)\) (green circle) can be bounded in terms of the difference between blue and red point in the axis-aligned rectangle with corners (0, 0) and \(\pi (v)=(M(v),({v_x+v_y})/{N}) =({10}/{12},{8}/{12})\). The rectangle contains eleven blue points and three red ones

2.2 Transforming the Tree into a Pointset

With the auxiliary function M we can define the mapping between a weak CDR into a bicolored pointset in the unit square. For any vertex \(v=(v_x,v_y) \in \mathcal {G}^+_N\) we define its transformation as \(\pi (v)=(M(v), ({v_x+v_y})/{N})\). Given any weak CDR, we look at the tree T it defines in \(\mathcal {G}^+_N\). Each vertex \(v \in \mathcal {D}\) creates a red point \(\pi (v)\) and each split vertex \(w\in \mathcal {S}\) creates a blue point \(\pi (w)\) (note that we do not transform the boundary leaves in \(L_N\) into points). We define the mapping of T as the union of the sets \(R=\{\pi (v):v\in \mathcal {D}\}\) and \(B=\{\pi (v):v\in \mathcal {S}\}\) (see Fig. 5, right). Note that the two sets depend on the tree T [and thus \(R=R(T)\) and \(B=B(T)\)]. From now on we assume that T is fixed, and thus we simplify the notation for ease of reading. For any set P of points in the unit square and \(x,y \in [0,1]\) let P[xy] be the number of points in \(P \cap [0,x] \times [0,y]\).

Lemma 2.3

For any weak CDR T in \(\mathcal {G}^+_N\subset \mathbb {Z}^2\) and \(n <N,\) the red and blue points on the line \(y=n/N\) alternate in color starting and ending with a blue point. In particular, we have \(B[1,n/N]-R[1,n/N]=n+1\).

Proof

For the first statement we observe that only points that lie in \(L_n\) will have y-coordinates equal to n/N. Moreover, since \(L_{n+1}\) has one more vertex than \(L_n\), each diagonal must have exactly one more split vertex than inner leaves. Indeed, Chun et al. showed that in proper CDRs each diagonal has exactly one split vertex (and of course, zero inner leaves).

Now we need to show that split vertices and inner leaves appear alternatingly on the diagonal line. Consider two consecutive split vertices \(u, v \in L_n\) such that \(u_x < v_x\). By definition of split, the edges \(e_u =(u_x, u_y)(u_x+1,u_y)\) and \(e_v = (v_x, v_y)(v_x, v_y+1)\) are all in T. Observe that there are \(v_x - u_x - 1\) vertices in \(L_n\) and \(v_x - u_x - 2\) vertices in \(L_{n+1}\) between \(e_u\) and \(e_v\). Since two different vertices of \(L_n\) cannot connect to the same vertex of \(L_{n+1}\), one of them will not reach \(L_{n+1}\). That vertex will be an inner leaf and will be between u and v as claimed.

That is, the blue pointset has one more point than the red pointset in each horizontal line \(y = i/N\). Summing up the differences from \(i=0\) to n, we get that in total there are \(n+1\) additional blue points \(p=(x,y)\) with \(y\le n/N\). \(\square \)

With the above observations we can now state the main relationship between the weak CDR and its mapped pointset. For any vertex \(v\in L_n\), its path to the origin splits the tree into two portions. Consider the portion of the tree up to \(L_n\) that is above the path from v to the origin. In \(L_0\), the subtree contains a single vertex (the root) whereas at the diagonal \(L_n\) contains \(v_x+1\) vertices. Since the number of leaves grows with split vertices and shrinks with inner leaves, this means that in the portion of the tree that we are looking at, the difference between split vertices and inner leaves must be \(v_x\), see Fig. 5. Note that if the two children of a split vertex [e.g., (5, 0) in Fig. 5] are not in the same portion, the number of leaves does not grow with that split vertex. However, these split vertices may be still contained in the rectangle that we consider in the mapped pointset. This is the reason why we do not have an equality in Theorem 2.4.

Theorem 2.4

For any vertex \(v \in \mathcal {G}^+_N\) it holds that

$$\begin{aligned}&B\biggl [M(v),\frac{v_x+v_y}{N}\biggr ] - R\biggl [M(v),\frac{v_x+v_y}{N}\biggr ] - 2\nonumber \\&\quad \le v_x\le B\biggl [M(v),\frac{v_x+v_y}{N}\biggr ] - R\biggl [M(v),\frac{v_x+v_y}{N}\biggr ].\end{aligned}$$

Proof

We split the proof into two auxiliary lemmas.

Lemma 2.5

Let \(v \in L_n\) be a split vertex such that \(v_x < n\). If \(M(v) < M(\gamma (v))\) the rectangle \([M(v),M(\gamma (v))] \times [0,({n-1})/{N}]\) contains exactly one point, which is blue and has \(M(\gamma (v))\) as x-coordinate. If \(M(\gamma (v)) < M(v)\) the rectangle \([M(\gamma (v)),M(v)] \times [0,({n-1})/{N}]\) contains exactly one point, which is blue and has \(M(\gamma (v))\) as x-coordinate. When \(v=(n,0) \in L_n\) the rectangle \([M(v),M(\gamma (v))] \times [0,({n-1})/{N}]\) is empty.

Proof

We first consider the case of \(M(v) < M(\gamma (v))\). When we keep following from v to the preferred subtree, we end up in a leaf, called \(\ell \). By definition of M we have \(M(\ell ) = M(\gamma (v))\). Since \(v_x < n\) we have \(M(\gamma (v)) \ne 1\). By Lemma 2.2 there is a unique split vertex \(s \in \mathcal {S}\) such that \(M(s)= M(\ell )\). This split vertex is below layer \(L_n\) (indeed, we reach \(L_n\) from \(\ell \) by following only preferred edges and the inverse walk has to stop when we traverse a non-preferred edge of s) and therefore s is transformed to a blue point in the rectangle. Now let \(s'\) be a split vertex which is mapped to a blue point in the rectangle. We will show that \(s' = s\). Let \(\ell '\) be the unique leaf such that \(M(\ell ')= M(s')\). Consider first the case in which \(\ell '\) is below layer \(L_n\) (that is, \(\ell '_x+\ell '_y < n\)). Then let \(v'\) be the vertex on \(dig (o,v)\) and \(L_{\ell '_x+\ell '_y}\). If \(\ell '_x < v'_x\) (resp. \(v'_x < \ell '_x\)) then Lemma 2.1 implies that \(M(\ell ') < \min T_{v'}\le M(v)\) [resp. \(M(\gamma (v)) \le \max T_{v'} < M(\ell ')\)]. This would be a contradiction to \(s'\) being mapped to a blue point in the rectangle.

It remains to consider the case in which \(\ell '\) is above layer \(L_n\). Define \(\ell ''\) to be the vertex on \(dig (o, \ell ')\) and \(L_n\). Lemma 2.1 implies that \(\ell '' = v\) [otherwise we have either \(M(\ell ') < M(v)\) or \(M(\gamma (v))< M(\ell ')\) which would again be a contradiction]. Recall that there is only one split vertex whose walk to its corresponding leaf through preferred subtrees passes through v. Hence \(s' = s\) and there is exactly one blue point in the rectangle.

We now show that there cannot be any red point either. Indeed, recall that for every red point there is a blue point with the same x-coordinate and smaller y-coordinate because for each inner leaf \(\ell \) there is a unique split vertex s defined by the walk from s to \(\ell \) such that \(M(\ell ) = M(s)\). From the previous argument, we know that s with \(M(s) = M(\gamma (v))\) is mapped to the only one blue point in the rectangle and its corresponding leaf \(\ell \) defined by the walk is above \(L_n\). Hence, even if \(\ell \) is an inner leaf, the mapped red point is not in the rectangle. Moreover, there cannot be any other red point in the rectangle (since it would imply that the corresponding blue point would also be in and we already ruled out this case).

In the same way we can also prove that if \(M(\gamma (v)) < M(v)\) the rectangle \([M(\gamma (v)),M(v)] \times [0,({n-1})/{N}]\) contains exactly one point, which is blue and has \(M(\gamma (v))\) as x-coordinate. If \(v_x = n\) then \(\ell \) as defined above is the leaf (N, 0) and \(M(\ell ) = 1\). Lemma 2.2 implies that there is no split vertex s with \(M(s) = 1\). \(\square \)

Lemma 2.6

For any vertex \(v \in \mathcal {G}^+_N\) it holds that

$$\begin{aligned} v_x - B\biggl [M(v),\frac{v_x+v_y-1}{N}\biggr ] + R\biggl [M(v),\frac{v_x+v_y-1}{N}\biggr ] + 1 \in \{0,1\}. \end{aligned}$$
(1)

Proof

We first prove by induction over n that for all \(n \in \{0,1,\ldots ,N\}\) the following statement holds:

$$\begin{aligned}&\{M(\gamma (p)) : p \in L_n\}\nonumber \\&\quad =\biggl \{x \in [0,1]: \biggl |B \cap \{x\} \times \biggl [0,\frac{n-1}{N}\biggr ]\biggr | - \biggl |R \cap \{x\} \times \biggl [0,\frac{n-1}{N}\biggr ]= 1 \biggr \} \cup \{1\} . \end{aligned}$$
(2)

The quantity \(|B \cap \{x\} \times [0,({n-1})/{N}]| - |R \cap \{x\} \times [0,({n-1})/{N}]|\) counts the difference between the number of blue points and red points on the vertical segment with x-coordinate x and length \(({n-1})/{N}\). Because of Lemma 2.2 we know that each split vertex shares the same value with a leaf in the auxiliary function M. If the leaf is an inner leaf, both blue (split) and red (inner) points lie on the same unit segment \(\{x\} \times [0,1]\). Otherwise, there is only one blue point on \(\{x\} \times [0,1]\) because M(p) for \(p \in L_N\) are all different. Hence the quantity \(|B \cap \{x\} \times [0,({n-1})/{N}]| - |R \cap \{x\} \times [0,({n-1})/{N}]|\) can either be 0 or 1.

The base case \(n=0\) trivially holds. We have \( \{M(\gamma (p)) : p \in L_0\} = \{1\}\) and

$$\begin{aligned} B \cap \{x\} \times \biggl [0,\frac{n-1}{N}\biggr ] = R \cap \{x\} \times \biggl [0,\frac{n-1}{N}\biggr ] = \emptyset . \end{aligned}$$

We assume that (2) holds for layer \(L_n\) and we prove that it also holds for \(L_{n+1}\). We distinguish three cases for any vertex q in layer \(L_n\).

  • If q has degree 2 then q and its child \(r \in L_{n+1}\) are mapped by \(M \circ \gamma \) to the same value. Moreover q does not create any vertex in the set B nor R.

  • If q is an inner leaf, then the value \(M(\gamma (q))\) will not appear in \(\{M(\gamma (p)) :p \in L_{n+1}\}\) any more. The value \(M(\gamma (q))\) also disappears in

    $$\begin{aligned} \biggl \{x \in [0,1]: \biggl |B \cap \{x\} \times \biggl [0,\frac{n}{N}\biggr ]\biggr | - \biggl |R \cap \{x\} \times \biggl [0,\frac{n}{N}\biggr ]\biggr | = 1 \biggr \} \cup \{1\}, \end{aligned}$$

    because q created a red point in R with the coordinates \((M(\gamma (q)),{n}/{N}) = (M(q),{n}/{N})\).

  • If q is a split vertex, then the value \(M(\gamma (q))\) will stay in \(\{M(\gamma (p)) :p \in L_{n+1}\}\). Moreover, \(\{M(\gamma (p)) :p \in L_{n+1}\}\) contains the additional value M(q). The value M(q) also appears in

    $$\begin{aligned} \biggl \{x \in [0,1]: \biggl |B \cap \{x\} \times \biggl [0,\frac{n}{N}\biggr ]\biggr | - \biggl |R \cap \{x\} \times \biggl [0,\frac{n}{N}\biggr ]\biggr | = 1 \biggr \} \cup \{1\}, \end{aligned}$$

    because q creates a blue point in B with the coordinates (M(q), n/N).

Hence (2) holds.

Let v be a vertex in layer \(L_n\), i.e., \(n = v_x + v_y\). By Lemma 2.1 we know that a vertex \(u \in L_n\) with \(u_x < v_x\) satisfies \(M(\gamma (u)) < M(\gamma (v))\). By Lemma 2.1 we also know that a vertex \(w \in L_n\) with \(v_x < w_x\) satisfies \(M(\gamma (v)) < M(\gamma (w))\). Hence the number of vertices in layer \(L_n\) with smaller x-coordinate than that of v is exactly the number of vertices which are mapped by \(M \circ \gamma \) to a smaller value than that of v. If \(v_x < n\):

$$\begin{aligned} v_x= & {} |\{u \in L_n:u_x< v_x\}| {\mathop {=}\limits ^{\text {Lemma}~(2)}} |\{u \in L_n: M(\gamma (u))< M(\gamma (v))\}| \\= & {} |\{u \in L_n: M(\gamma (u)) \le M(\gamma (v))\}| -1 \\&{\mathop {=}\limits ^{(2)}}&B\biggl [M(\gamma (v)),\frac{n-1}{N}\biggr ] - R\biggl [M(\gamma (v)),\frac{n-1}{N}\biggr ] - 1 \\&\quad {\mathop {=}\limits ^{\text {Lemma}~5}} {\left\{ \begin{array}{ll} \displaystyle B\biggl [M(v),\frac{n-1}{N}\biggr ] - R\biggl [M(v),\frac{n-1}{N}\biggr ] -1 &{}\text {if } M(\gamma (v)) \le M(v), \\ \displaystyle B\biggl [M(v),\frac{n-1}{N}\biggr ] - R\biggl [M(v),\frac{n-1}{N}\biggr ] &{} \text{ if } M(v) < M(\gamma (v)). \end{array}\right. } \end{aligned}$$

If \(v_x = n\) then

$$\begin{aligned} v_x= & {} |\{u \in L_n: M(\gamma (u)) \le M(\gamma (v))\}| -1\\&{\mathop {=}\limits ^{(2)}}&B\biggl [M(\gamma (v)),\frac{n-1}{N}\biggr ] - R\biggl [M(\gamma (v)),\frac{n-1}{N}\biggr ] \\&{\mathop {=}\limits ^{\text {Lemma}~5}}&B\biggl [M(v),\frac{n-1}{N}\biggr ] - R\biggl [M(v),\frac{n-1}{N}\biggr ]. \end{aligned}$$

By Lemma 2.3, the red and blue points on the line \(y= v_x+v_y\) alternate in color starting and ending with a blue point. Hence, any interval [0, x] on the line \(y=v_x+v_y\) contains at most one more blue points. Therefore,

$$\begin{aligned}&B\biggl [M(v),\frac{v_x+v_y}{N}\biggr ] - R\biggl [M(v),\frac{v_x+v_y}{N}\biggr ]\\&\quad - \biggl ( B\biggl [M(v),\frac{v_x+v_y-1}{N}\biggr ] - R\biggl [M(v),\frac{v_x+v_y-1}{N}\biggr ] \biggr ) \end{aligned}$$

is at most one. Lemmas 2.6 and 2.3 directly imply Theorem 2.4. \(\square \)

3 Lower Bound for Two Dimensional Weak CDRs

Before giving the proof of Theorem 1.3, we recall that a proof for a proper CDR (i.e., one without inner leaves) was given in [9]. Our proof follows the same spirit, so we first give an overview of their proof and describe what changes when we introduce inner leaves.

Lemma 3.1

Given a CDR, a point \(p=(x,y)\in L_N,\) and an integer \(n<N,\) let \(p'=(x',y')\in L_n\) be the unique point of \(L_n\) that is in \(dig (o,p)\). The Hausdorff error of the CDR is at least \(|x'-x{n}/{N}|\).

Proof

This result was shown by Chun et al. [9, Lemma 3.5, in Cases 1 and 2]. We give the proof for completeness. Consider the L-infinity ball of radius \(|x'-x{n}/{N}|\) centered at p n/N. By construction, this ball contains \(p'\) in its boundary. Because of the monotonicity axiom, no vertex of \(dig (o,p)\) can be in the interior of the ball. In particular, when measuring the Hausdorff distance of point \(p{n}/{N}\in \overline{op}\) we get an error of at least \(|x'-x{n}/{N}|\). \(\square \)

Consider any point \(p\in L_N\) and virtually sweep a line of slope \(-1\) from the origin all the way to \(L_N\). During the sweep, the intersection between the diagonal line and either the Euclidean segment \(\overline{op}\) or the digital one \(dig (o,p)\) will be a point. Lemma 3.1 says that if we can find an instant of time for which two intersection points are at distance \(\partial \) from each other, then the Hausdorff error of the whole CDR must be \(\varOmega (\partial )\) (see Fig. 6).

In order to find this instant of time we see how much the subtrees grow. Consider a consecutive set of I vertices in some intermediate layer \(L_n\). Let \(\mathcal {L}(I)\) be the vertices of \(L_N\) whose digital path to the origin passes through some vertex of I. If the CDR has small error, we need \(\mathcal {L}(I)\) to have roughly N|I|/n many points. The difference between the expected number of vertices and \(|\mathcal {L}(I)|\) combined with Lemma 3.1 will give a lower bound on the Hausdorff error.

Fig. 6
figure 6

Illustration of why the two sets I (purple disks) and \(\mathcal {L}(I)\) (green squares) should have proportional sizes. If the size of \(\mathcal {L}(I)\) grows drastically (as shown in the figure), the point of the highest x-coordinate in \(\mathcal {L}(I)\) must make a significant detour to pass through I, causing a large error. A similar effect happens if the size of \(\mathcal {L}(I)\) is comparatively small

Our proof follows the same spirit (transform the tree into a pointset, use discrepancy to find a subset with too many/too few children and use Lemma 3.1 to find a large error). Although all three steps follow the same spirit, they need major changes to account for the possibility of inner leaves.

The biggest change is how we map the tree. In proper CDRs each line has a unique split vertex and always extends to \(L_N\). Thus, a region with a large number of split vertices directly implies a large error. In our setting, we could potentially have a region with many split vertices followed by a large number of inner leaves to cancel out the growth. This is why we need two major changes: first we now color the points red and blue depending on whether they are split vertices or inner leaves. We also introduce a second dimension to track when the children of a split vertex stop extending. Intuitively speaking, the x-coordinate of our mapping will be similar to the mapping done by Chun et al. [9] whereas the y-coordinate represents time. Thus, the difference in y-coordinates between red and blue points can be used to determine for how long are the two children of a split vertex alive (the longer the difference in y-coordinates, the further away that the two children extend).

We now use the mapping of Sect. 2 together with the two colors discrepancy (Theorems 1.2 and A.4) to show a lower bound on the error of weak CDRs. The discrepancy result in Theorem 1.2 considers the points in the whole unit square. Due to some technical reasons, in Sect. 4 we will need a discrepancy result for the points in the upper half of the unit square instead (Theorem A.4). The difference between the two theorems is just a constant factor and thus would have little implication. Here we use Theorem A.4 and prove the result in terms of the number of inner leaves in the upper half. Specifically, we show the following result.

Theorem 1.3

For any \(N \in \mathbb {N},\) any weak CDR defined on \(\mathcal {G}^+_N\subset \mathbb {Z}^2\) with \(\kappa _2\) inner leaves between lines \(x_1+x_2=\lceil N/2 \rceil \) and \(x_1+x_2 = N\) has \(\varOmega ({N \log N}/({N+\kappa _2}))\) error.

Proof

Given a weak CDR and its associated tree T, consider its transformation into the sets R and B of red and blue points defined by \(\pi \). Let \(b_2\) and \(r_2\) be the numbers of blue and red points in the rectangle \([0,1] \times [1/2,1]\) respectively. By Lemma 2.3, we have \(b_2 - r_2 = \lfloor N/2 \rfloor \). We apply the discrepancy result (Theorem A.4) with \(b_2-r_2 = \lfloor N/2 \rfloor \) and \(r_2 = \kappa _2\), and obtain that there exist \(\alpha , \beta \in [0,1]\) and \(c' > 0\) such that \(|B[\alpha ,\beta ] - R[\alpha ,\beta ] - N \alpha \beta | > c' \cdot N \cdot \log N/({N+\kappa _2})\).

We want to use Theorem 2.4 on the vertex of T whose image is \((\alpha ,\beta )\). Naturally, such a vertex need not exist, but we will find one nearby whose associated discrepancy is also high. Let \(n= \lfloor N\beta \rfloor \) and observe that \(B[\alpha ,\beta ]=B[\alpha ,{n}/{N}]\); indeed, by the way we transform points, their y-coordinates are of the form i/N. However, by definition of n we know that \(\beta \) is between n/N and \((n+1)/N\) and thus no point can lie in the horizontal strip \(y\in (n/N, \beta ]\) (by the same argument we also have \(R[\alpha ,\beta ]=R[\alpha ,{n}/{N}]\)).

If we substitute \(\beta \) in the previous equation we get

$$\begin{aligned} \biggl |B\biggl [\alpha ,\frac{n}{N}\biggr ] - R\biggl [\alpha ,\frac{n}{N}\biggr ]-\alpha n\biggr | > c' \cdot \frac{N \log N}{N+\kappa _2} -1 \ge c'' \cdot \frac{N\log N}{N+\kappa _2} \end{aligned}$$

for a large enough N, \(\kappa _2 \in O(N \log N)\) and for some \(c''>0\). We get the additional 1 term because of the rounding in the definition of n.

Now we need to do a similar operation for \(\alpha \). Let \(q_i=(i,n-i)\) be a vertex of \(L_n\). By Lemma 2.1 the image of the auxiliary function \(M(q_i)\) monotonically increases as i grows. Let \(Q=\{q_i: M(q_i) \le \alpha \}\) and \(\alpha '=\max _{q_i\in Q} M(q_i)\). Note that, by definition of the set Q, it trivially holds that \(\alpha '\le \alpha \).

Lemma 3.2

$$\begin{aligned} B\biggl [\alpha ,\frac{n}{N}\biggr ] - R\biggl [\alpha ,\frac{n}{N}\biggr ]=B\biggl [\alpha ',\frac{n}{N}\biggr ] - R\biggl [\alpha ',\frac{n}{N}\biggr ]. \end{aligned}$$

Proof

The difference between the two rectangles is the rectangle \(\varDelta \) whose opposite corners are \((\alpha ',0)\) and \((\alpha ,n/N)\), and one of the boundary \(\overline{(\alpha ',0)(\alpha ',{n}/{N})}\) is open. We claim that red and blue points are paired (sharing the same x-coordinate) in \(\varDelta \) (and thus, for each red point that we remove we are also removing a blue one). By Lemma 2.2, we know that all the blue points have different x-coordinates, so do red points. Hence, if there are red and blue points on the same vertical line, they must be the only pair in that vertical line. First notice that if there is a red point in \(\varDelta \), there also exists a blue point in \(\varDelta \) with the same x-coordinate and below the red point. By the virtual walk that we define the auxiliary function, every split vertex is closer to the origin than the corresponding leaf. Hence, after the transformation \(\pi \), if there is a red point, then there must exist a blue point with the same x-coordinate (by Lemma 2.2) and smaller y-coordinate. Then, we will show that if there is a blue point in \(\varDelta \), there also exists a red point in \(\varDelta \) with the same x-coordinate.

Assume, for the sake of contradiction that there exists a blue point p in \(\varDelta \) such that there does not exist a red point q with the same x-coordinate as p in \(\varDelta \). Let s be the split vertex whose image is p. By definition of the transformation \(\pi \), the x-coordinate of p is M(s), which is between \(\alpha '\) and \(\alpha \). We apply Lemma 2.2 to find the unique leaf \(\ell \) such that \(M(s)=M(\ell )\). Since \(\pi (\ell )\notin \varDelta \), we have that \(\ell _x+\ell _y>n\). Let m be the unique vertex of \(L_n\) that is in the path from s to \(\ell \). It follows that \(\pi (m)=(M(\ell ), {n}/{N})\in \varDelta \). This gives a contradiction with the definition of \(\alpha '\), and thus implies that if there exists a blue point in \(\varDelta \), then there also exists a red point in \(\varDelta \) with the same x-coordinate. \(\square \)

Thus, given a pair \((\alpha ,\beta )\) whose associated rectangle has high discrepancy, we have snapped it to the pair \((\alpha ', {n}/{N})\) that defines another rectangle with high discrepancy. More importantly, by definition of Q, we know that \(\pi (q_{|Q|-1})=(\alpha ', {n}/{N})\). Note that \(q_{|Q|-1}\) need not be a split vertex or an inner leaf (and thus, \((\alpha ', {n}/{N})\) may not be a point of \(R \cup B\)).

Let \(b'=B[\alpha ',{n}/{N}]\) and \(r'=R[\alpha ',{n}/{N}]\). If we apply Theorem 2.4 to point \(q_{|Q|-1}\) we get that \(b'-r'-2\le |Q|-1 \le b'-r'\). This set Q is the one that makes the role of I in the proof overview: we know that vertices of Q are the ones that extend to cover all the vertices of \(L_N\) whose image is \(\alpha '\) or less. As such, we would expect |Q| to contain roughly \(n\alpha '\) elements. However, the discrepancy result tells us that the size of Q is \(c''{N\log N}/({N+\kappa _2})\) units away from that value. We say that p is productive if some point of T(p) is in \(L_N\) (this is equivalent to the fact that p can be extended to reach the boundary). Let \(k \le b'-r'-2\) be the biggest integer such that \(q_k\) is productive. Note that k is well defined because \(q_0\) is always productive [(0, n) always extends to (0, N)]. The proof now considers a few cases depending on whether k is small or large (specifically, we say that k is small if

$$\begin{aligned} |Q|-1-k \ge (b'-r'-2)-k> \frac{c''}{2} \cdot \frac{N \log N}{N+\kappa _2}, \end{aligned}$$

large otherwise) and if Q contains too few or too many points.

Fig. 7
figure 7

(Left) When k is small we have \(\varOmega ((N \hbox {log} N)/ ({N+\kappa _2}))\) consecutive vertices in \(L_n\) that are not productive (shown as squares). In particular, the ray \(\gamma \) through the middle point must make a large detour. (Right) When k is large, there is a digital path through \(q_k\) with a big detour

\(\underline{{k}\,\mathrm{is}\,\mathrm{small}}\)   Recall that we looked for the largest possible k (such that \(q_k\) is productive). Thus, if k is small, we have many points in layer \(L_n\) that are consecutive and not productive. In particular, none of the vertices in

$$\begin{aligned} q_{b'-r'-\Big \lfloor \frac{c''}{2} \cdot \frac{N\log N}{N+\kappa _2}\Big \rfloor },\ldots ,q_{b'-r'-2} \end{aligned}$$

are productive. Let

$$\begin{aligned} q_m=q_{b'-r'-\Big \lfloor \frac{c''}{4} \cdot \frac{N\log N}{N+\kappa _2}\Big \rfloor } \end{aligned}$$

(note that this point is surrounded by non-productive points in both sides along \(L_n\)). Shoot a ray \(\gamma \) from o towards \(q_m\). Let p be the vertex on \(L_N\) that is closest to \(\gamma \). Observe that the \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance between \(\gamma \) and p is at most 1/2. Let \(\gamma '\) be the ray shooting from o towards p. Similarly, the \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance between \(\gamma '\) and \(q_m\) is at most 1/2 (see Fig. 7, left). We now apply Lemma 3.1 to \(dig (o,p)\). We know that the Euclidean segment \(\overline{op}\) is close to \(q_m\). The digital segment must cross \(L_n\) and is far from \(q_m\); the closest it can pass is either

$$\begin{aligned} q_{b'-r'-\Big \lfloor \frac{c''}{2}\cdot \frac{N \log N}{N+\kappa _2}\Big \rfloor -1}\quad \text {or}\quad q_{b'-r'-1}. \end{aligned}$$

That is, we know that the intersection of \(\overline{op}\) with the line \(x+y=n\) is at most half a unit away from \(q_m\). Similarly, the intersection with \(dig (o,p)\) is at least

$$\begin{aligned} \biggl \lfloor \frac{c''}{4} \cdot \frac{N \log N}{N+\kappa _2}\biggr \rfloor \end{aligned}$$

from \(q_m\). Thus, by triangle inequality the \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance between \(dig (o,p)\) and \(\overline{op}\) is at least

$$\begin{aligned} \biggl \lfloor \frac{c''}{4} \cdot \frac{N \log N}{N+\kappa _2}\biggr \rfloor -3/2 \in \varOmega \biggl (\frac{N\log N}{N+\kappa _2}\biggr ). \end{aligned}$$

\(\underline{k\,\mathrm{is}\,\mathrm{large}\,\mathrm{and}\,b'-r'\ge n\alpha +c''\cdot {(N \log N)}/({N+\kappa _2})}\)   Look at the x-coordinate of \(q_k\). We know that Q has at least

$$\begin{aligned} b'-r'-1\ge n\alpha +c''\cdot \frac{N \log N}{N+\kappa _2}-1 \end{aligned}$$

many elements, and k is among the productive vertices with the largest x-coordinate. In particular, the x-coordinate of \(q_k\) is at least

$$\begin{aligned} b'-r' -2 \ge n\alpha + \frac{c''}{2}\cdot \frac{N \log N}{N+\kappa _2}-2. \end{aligned}$$

Let p be the unique leaf of \(L_N\) such that \(M(p)=M(q_k)\). We now apply Lemma 3.1 to \(dig (o,p)\) at the line \(x+y=n\). By definition of p, we have that \(dig (o,p)\) passes through \(q_k\). Now, by definition of Q, we know that \(M(q_k) \le \alpha \) and in particular the x-coordinate of p is at most \(\alpha N\) (see Fig. 7, right). Thus, the Euclidean segment \(\overline{op}\) must intersect at a point whose x-coordinate is at most \(\alpha n\). That is, when we look at the Euclidean and the digital segments along line \(x+y=n\), the Euclidean crossing happens at x-coordinate at most \(\alpha n\). However, the x-coordinate of the digital crossing is at least

$$\begin{aligned} \alpha n + \frac{c''}{2}\cdot \frac{N \log N}{N+\kappa _2} -1. \end{aligned}$$

By Lemma 3.1 we conclude that the error must be \(\varOmega ({N \log N}/({N+\kappa _2}))\) as claimed.

\(\underline{{b'-r'< n\alpha - c''\cdot {(N \log N)}/({N+\kappa _2})}}\)   This proof is very similar to the previous case. Consider the vertex \(p=(\lfloor \alpha N \rfloor , N-\lfloor \alpha N \rfloor )\in L_N\) and apply Lemma 3.1 to \(dig (o,p)\) and \(\overline{op}\). At line \(x+y=n\) the Euclidean segment \(\overline{op}\) passes through a point whose x-coordinate is \(\lfloor \alpha N \rfloor \cdot {n}/{N} \ge \lfloor \alpha n \rfloor -1\). By definition, \(M(p)\le \alpha \) and thus \(dig (o,p)\) must pass through some vertex q of Q. In particular, the x-coordinate of q is at most \(b'-r' < n\alpha - c''\cdot {N\log N}/({N+\kappa _2})\), giving the \(\varOmega ({N \log N}/({N+\kappa _2}))\) error and completing the proof of Theorem 1.3.

\(\square \)

Note that if we use Theorem 1.2 instead, the same argument follows and we would get the following result.

Theorem 3.3

For any \(N \in \mathbb {N},\) any weak CDR defined on \(\mathcal {G}^+_N\subset \mathbb {Z}^2\) with \(\kappa _1\) inner leaves has \(\varOmega (({N \log N})/({N+\kappa _1}))\) error.

4 Lower Bound for CDRs in High Dimensions

We now use the lower bound of weak CDRs to obtain a lower bound for CDRs in three or higher dimensions. Consider the restriction of any d-dimensional CDR T to the \(x_1x_2\)-plane (we call this restriction the \(x_1x_2\)-restriction of T and denote it by \(T_{x_1x_2}\)). Recall that the key observation is that \(T_{x_1x_2}\) is a (possibly weak) CDR and that any inner leaf in \(T_{x_1x_2}\) must extend in some \(x_i\)-direction in T for some \(i \in [3..d]\). We have seen that \(T_{x_1x_2}\) needs to have a large number of inner leaves to have \(o(\log N)\) error. In the following, we will show that a large number of inner leaves will cause constraints for \(\mathbb {Z}^d\) and have an impact in the overall error of T.

We do a slight abuse of notation and use the same terms as in two dimensions. For simplicity of the notation, we assume that N is a positive even number. For any \(n \le N\), let \(L_n = \bigl \{(x_1,x_2,\ldots ,x_d) \in \mathcal {G}^+_N: \sum _{i=1}^{d} x_i = n\bigr \}\). Given any CDR in \(\mathcal {G}^+_N\), we consider the CDR as a tree rooted at the origin. Let T(v) be the subtree rooted at v.

From Theorem 1.3, we already know that in order for \(T_{x_1x_2}\) to have sublogarithmic error we must have \(\kappa _2\in \omega (N)\) inner leaves. However, each inner leaf ties to a boundary leaf in \(L_N\) in d dimensions. In other words, the subtrees rooted at the vertices in \(L_{N/2-1} \cap T_{x_1x_2}\) must cover all these boundary vertices. We now observe that a weak CDR with inner leaves in the \(x_1x_2\)-plane induces subtrees which are too big for the high dimensional proper CDR (see Fig. 8).

Lemma 4.1

Given any CDR in \(\mathcal {G}^+_N,\) let \(\kappa _2\) be the number of inner leaves in \(T_{x_1x_2}\) between lines \(x_1+x_2=N/2\) and \(x_1+x_2 = N\). There exists a vertex \(v \in L_{N/2-1}\) such that \(v_i=0\) for \(i=3,\ldots ,d\) and some boundary leaf \(u \in T(v) \cap L_N\) has \(u_j \ge (\kappa _2/N)^{{1}/({d-2})}-1\) for some \(j \in [3..d]\).

Fig. 8
figure 8

Illustration of Lemmas 4.1 and 1.4: the red region represents the region of \(B_N\). If we have lots of inner leaves in \(T_{xy}\), it will have many descendants in the three dimensional CDR at layer \(L_N\) so that the height of the red region attempting to contain them is large. In particular, we can find a vertex v on the xy-plane such that v is on the \(dig (o,u)\) and u is far away from the xy-plane. For simplicity, we show the Euclidean error between v and \(u'\), but we note that the proof argues under the \(\Vert \,{ \cdot }\,\Vert _{\infty }\) metric

Proof

The proof follows from a packing argument. Consider the set \(V=\{(0,N/2-1,0,\ldots ,0), (1,N/2-2,0,\ldots ,0), \ldots , (N/2-1,0,0,\ldots ,0)\}\). Note that these vertices lie in the \(x_1x_2\)-plane and thus are in \(T_{x_1x_2}\). Because they are the two dimensional equivalent of \(L_{N/2-1}\), the union of their subtrees covers \(T_{x_1x_2}\) between \(L_{N/2}\) and \(L_{N}\). In this region we know that we have \(\kappa _2\) many inner leaves, which will extend to \(L_N\) with the first step in the \(x_i\)-direction for some \(i \in [3..d]\). Let \(Y_N\) be the extended vertices on \(L_N\) from these \(\kappa _2\) inner leaves, i.e., \(|Y_N| \ge \kappa _2\).

Let \(B_N =\bigl \{(x_1,x_2,\ldots ,x_d)\in \mathcal {G}^+_N: \sum _{i=1}^{d} x_i = N, \,x_1+x_2<N, \,\forall \,i \in [3..d]\; x_i < (\kappa _2/N)^{{1}/({d-2})}-1\bigr \}\), see Fig. 8. Since we have less than \((\kappa _2/N)^{{1}/({d-2})}\) choices for \(x_3,\ldots ,x_d\), at most N choices for \(x_1\) and the value of \(x_2\) is adjusted to satisfy the constraint \(\sum _{i=1}^{d} x_i = N\), the size of \(B_N\) is less than \(\kappa _2\). Hence, \(B_N\) cannot contain all vertices of \(Y_N\). Moreover, no vertices of \(Y_N\) lie on \(x_1x_2\)-plane, so there exists some vertex \(u \in Y_N\) such that \(u_j \ge (\kappa _2/N)^{{1}/({d-2})}-1\) for some \(j \in [3..d]\), which is in \(T(v) \cap L_N\) for some \(v \in V\). \(\square \)

The existence of this vertex v is the root of the problem. We conclude with the following statement.

Lemma 1.4

Any CDR defined on \(\mathcal {G}^+_N\subset \mathbb {Z}^d\) with \(\kappa _2\) inner leaves in \(x_1x_2\)-plane between lines \(x_1+x_2=\lceil N/2 \rceil \) and \(x_1+x_2 = N\) has \(\varOmega ((\kappa _2/N)^{{1}/({d-2})})\) error.

Proof

Apply Lemma 4.1 to obtain a vertex \(v\in L_{N/2-1} \cap T_{x_1x_2}\) that satisfies some \(u \in T(v) \cap L_N\) with \(u_j \ge (\kappa _2/N)^{{1}/({d-2})}-1\) for some \(j \in [3..d]\). Let \(u'\) be the intersection of \(\overline{ou}\) and the affine plane containing \(L_{N/2-1}\), see Fig. 8. As \(L_N\) and \(L_{N/2-1}\) are parallel, \(({u_j'-o_j})/({u_j-o_j}) \ge {1}/{3}\) for \(N\ge 6\), this implies that \(u'_j= \varOmega ((\kappa _2/N)^{{1}/({d-2})})\). By construction, we have that v is on the \(dig (o,u)\) and \(v_j= 0\), hence \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance between \(dig (o,u)\) and \(\overline{ou}\) is \(\varOmega ((\kappa _2/N)^{{1}/({d-2})})\). \(\square \)

Combining with Theorem 1.3 gives us a lower bound for CDRs in d dimensions.

Theorem 1.5

Any CDR in \(\mathbb {Z}^d\) has \(\varOmega ( \log ^{1/(d-1)}\! N)\) error.

Proof

By Theorem 1.3 and Lemma 1.4, the error is \(\varOmega (({N\log N})/({N+\kappa _2}))\) and \(\varOmega ((\kappa _2/N)^{{1}/({d-2})})\), where \(\kappa _2\) is the number of inner leaves in \(T_{x_1x_2}\) between \(L_{N/2}\) and \(L_{N}\). The balance between the two is obtained by choosing \(\kappa _2 = \varTheta (N \log ^{({d-2})/({d-1})}\! N)\), giving the \(\varOmega ( \log ^{1/(d-1)}\! N)\) lower bound. \(\square \)

5 A Construction of a Weak CDR with Constant Error

In this section we describe how to construct a weak CDR in two dimensions with constant error. Specifically, we show that the weak CDR has at most 5/2 error and at most \(N^2/12\) inner leaves, which is about 1/6 of the total number of grid points in \(\mathcal {G}^+_N\).

Assume that N is a power of 2. We partition \(\mathcal {G}^+_N\) into \(\log _2 N\) diagonal slices by a set of lines \(x+y=2^i\) for \(i=1,\ldots , \log _2 N-1\). We use \(S_i\) to denote the ith slice between \(x+y=2^{i-1}\) and \(x+y=2^i\) for \(i=2,\ldots , \log _2 N\). The first slice \(S_1\) is \(\mathcal {G}^+_2\), which only has six points. There are two proper CDRs for this small set and both have the same error. So we can use either of the two. For each other slice \(S_i\), we draw a greedy digital path from each point \(p=(p_x,p_y) \in L_{2^{i-1}}\) to \(2p=(2p_x, 2p_y)\). The greedy digital path simply tries to approximate the Euclidean segment as much as possible. More formally, the path between p and 2p is defined by picking a point in each \(L_j\) that has the smallest \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance to the line segment \(\overline{p,2p}\) for \(j=2^{i-1}, \ldots , 2^{i}\) (in case of tie, we pick the point with smaller y-coordinate). Lemma 5.1 shows that the way we picked the points would give a digital path following the 4-neighbor grid topology.

The last step of the construction is as follows: for those points \((p_x,p_y) \in \mathcal {G}^+_N/\{(0,0)\}\) not having an edge to \((p_x-1,p_y)\) or \((p_x,p_y-1)\), we connect \((p_x,p_y)\) to \((p_x-1,p_y)\) if \(p_x \ge p_y\), otherwise to \((p_x, p_y-1)\). We call this construction GREEDY, see Fig. 9.

Fig. 9
figure 9

Outline of GREEDY. In the example, \(N = 32\). \(\mathcal {G}^+_N\) is partitioned into five slices by the red dash lines. The green solid lines indicate where the greedy paths are constructed between (xy) and (2x, 2y). A digital path \(dig (o,v)\) is shown through the concatenation of some greedy paths as well as the notation used in the proof of the Hausdorff error for \(dig (o,v)\)

The following lemma shows that every two consecutive points we picked in \(L_j\) and \(L_{j+1}\) to form the greedy digital path is connected under the 4-neighbor topology.

Lemma 5.1

For \(i=2,\ldots , \log _2 N,\) any greedy digital path from \(p \in L_{2^{i-1}}\) to \(2p\in L_{2^i}\) is connected under the 4-neighbor topology and it is xy-monotone.

Proof

It is trivial for \(p=(0,2^{i-1})\) and \(p=(2^{i-1},0)\), so we ignore these two cases in the following. Suppose that there exists two consecutive points we picked in the greedy path \(u \in L_j\) and \(v \in L_{j+1}\) for some \(2^{i-1} \le j \le 2^i-1\) such that u and v are not connected in the 4-neighbor topology, i.e., \(u_x \ne v_x\) and \(u_y \ne v_y\). Since u and v are grid points, this implies that \(\Vert u-v\Vert _{\infty } \ge 2\). Let \(u'\) and \(v'\) be the points on the line segment \(\overline{p,2p}\) with the smallest \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance to u and v respectively, i.e., \(u'\) (resp. \(v'\)) is the intersection of \(\overline{p,2p}\) and \(x+y=j\) (resp. \(x+y=j+1\)). Since the slope of \(\overline{p,2p}\) is between 0 and \(\infty \) exclusively, \(\Vert u'-v'\Vert _{\infty } < 1\). Furthermore, we know that the \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance between any two consecutive points on \(L_j\) is 1, so \(\Vert u-u'\Vert _{\infty } \le 0.5\) and the same holds for \(\Vert v-v' \Vert _{\infty }\). By triangle inequality, we have \(\Vert u-v\Vert _{\infty } \le \Vert u-u'\Vert _{\infty } + \Vert u'-v'\Vert _{\infty } + \Vert v'-v\Vert _{\infty } <2\), which gives a contradiction. It is easy to see that the greedy digital path is xy-monotone because we only pick one grid point per each \(L_j\). \(\square \)

Next, we show that any two greedy digital paths in the same slice \(S_i\) are disjoint so that when we concatenate all the greedy digital paths slice by slice, it is easy to see that they form a tree rooted at the origin in Lemma 5.5.

Lemma 5.2

For \(i=2,\ldots , \log _2 N,\) any two greedy digital paths in \(S_i\) are disjoint.

Proof

By the way we picked the grid points on the greedy digital paths, we can see that any grid point on the greedy digital path has at most 0.5 L-infinity distance to the corresponding line segment. Given any two consecutive line segments \(\overline{p,2p}\) and \(\overline{q,2q}\) in \(S_i\) where \(q_x = p_x +1\), for any point \(v \in \overline{{p,2p}}/\{p\}\), the \(\Vert \,{ \cdot }\,\Vert _{\infty }\) distance from v to \(\overline{q,2q}\) is larger than 1. Hence, one grid point cannot be assigned to more than one greedy digital path. \(\square \)

Then, we show how the greedy digital paths in \(S_i\) connect to the greedy digital paths in \(S_{i-1}\), which gives us the structure of \(\mathrm{dig}(o,p)\) how it passes through some intermediate points.

Lemma 5.3

For \(i=3,\ldots , \log _2 N\) and any \(p = (p_x, p_y) \in L_{2^{i-1}},\) \(dig (p, 2p) \subset dig (q, 2p),\) where \(q\, {=} \,(\lfloor p_x/2\rfloor , \lceil p_y/2\rceil )\) if \(p_x \ge p_y,\) \((\lceil p_x/2\rceil , \lfloor p_y/2\rfloor )\) otherwise.

Proof

When \(p_x\) is even, \(q = (p_x/2, p_y/2) \in L_{2^{i-2}}\), so \(dig (q,p)\) is a greedy digital path. \(dig (q,2p)\) is the concatenation of \(dig (q,p)\) and \(dig (p,2p)\). Hence, \(dig (p, 2p) \subset dig (q, 2p)\).

When \(p_x\) is odd, let \(p_x = 2k + 1\) for some \(k = 0,1,\ldots , 2^{i-2}-1\). Then, \(p_y = (2^{i-1} - 2k - 1)\). Assume that \(p_x \ge p_y\) (another case can be proved by the same approach). By the last step of GREEDY construction, p will connect horizontally to \((p_x-1, p_y)\) and so on, so we follow the digital path from p horizontally until we hit some greedy path. Since p is between \(p' = (2k,2^{i-1} - 2k)\) and \((2k+2,2^{i-1} - 2k - 2)\) on \(L_{2^{i-1}}\), the greedy path we hit is \(dig (p'/2,p')\) and then we follow \(dig (p'/2,p')\) and reach \(p'/2 = (k, 2^{i-2} - k) = (\lfloor p_x/2\rfloor , \lceil p_y/2\rceil )\). Therefore, \(dig (p,2p) \subset dig (q,2p)\), where \(q = p'/2\). \(\square \)

By repeatedly applying Lemma 5.3 for all \(i=3,\ldots , \log _2 N\), we have the following corollary.

Corollary 5.4

For \(i=3,\ldots , \log _2 N\) and any \(p = (p_x, p_y) \in L_{2^{i-1}},\) \(dig (o,p)\) passes through all the points \((\lfloor p_x/2^j\rfloor , \lceil p_y/2^j\rceil )\) if \(p_x \ge p_y,\) otherwise \((\lceil p_x/2^j\rceil , \lfloor p_y/2^j\rfloor )\) for \(j=1,\ldots , i-2\).

Now we have all the tools to show that GREEDY is a rooted tree at the origin so that GREEDY is a weak CDR.

Lemma 5.5

GREEDY is a rooted tree at the origin with xy-monotone paths to all the vertices.

Proof

If we can show that every grid point \(v \in \mathcal {G}^+_N\) except the origin has exactly one edge to either \((v_x-1,v_y)\) or \((v_x,v_y-1)\), then GREEDY is a tree with xy-monotone paths connecting to all the grid points from the origin because the graph is connected in \(\mathcal {G}^+_N\) and there are \(|\mathcal {G}^+_N|-1\) edges. The xy-monotonicity comes from the fact that all the grid points are connected towards the origin. Clearly, this holds in \(S_1\) because this part is a CDR with \(N=2\). Hence, we consider \(S_i\) for \(i=2,\ldots ,\log _2 N\).

By Lemmas 5.1 and 5.2, we know that all the greedy digital paths in \(S_i\) are xy-monotone and disjoint. Hence, for any point \(v \in dig (p,2p)/\{p\}\) with \(p \in L_{2^{i-1}}\), there is only one edge to either \((v_x-1,v_y)\) or \((v_x,v_y-1)\).

Furthermore, the last step of GREEDY only applies to the grid points \(p \in \mathcal {G}^+_N/\{(0,0)\}\) not having an edge to \((p_x-1, p_y)\) or \((p_x,p_y-1)\). Hence, there is only one edge to \((p_x-1, p_y)\) or \((p_x,p_y-1)\) assigned to those points. \(\square \)

Then, we can talk about the quality of GREEDY in term of the number of inner leaves and the Hausdorff error in the next two lemmas.

Lemma 5.6

There are at most \(N^2/12\) inner leaves in GREEDY.

Proof

By Corollary 5.4, every grid point on the greedy digital paths can be extended to \(L_N\). Thus, in each \(S_i\), the inner leaves are created between two greedy digital paths \(dig (p,2p)\) and \(dig (q,2q)\) exclusively, where \(p_x+p_y = 2^{i-1}\), \(q_x = p_x + 1\) and \(q_y = p_y -1\). We only consider the grid points below the line \(x=y\). The other case is symmetric. By GREEDY construction, all the grid points between \(dig (p,2p)\) and \(dig (q,2q)\) exclusively are connected to their left hand side neighbors. Hence, there is at most one inner leaf per each horizontal line between \(dig (p,2p)\) and \(dig (q,2q)\), except the line \(y=2p_y-1\) because \((2p_x+1,2p_y-1)\) can be extended to \(S_{i+1}\). Therefore, there are at most \(\sum _{y=p_y}^{2p_y-2} 1 = p_y-1\) inner leaves between \(dig (p,2p)\) and \(dig (q,2q)\). By considering all \(dig (p,2p)\) for \(p_y = 1,\ldots , 2^{i-2}\) and the symmetric case, we have \(2\bigl (\sum _{p_y=1}^{2^{i-2}} p_y -1 \bigr )= 2^{i-2}(2^{i-2}-1)\) inner leaves in \(S_i\). We sum up for all the slices, we get

$$\begin{aligned} \sum _{i=2}^{\log _2 N}\! 2^{i-2}(2^{i-2}-1) = \frac{4^{\log _2 N-1}-1}{4-1} - \frac{2^{\log _2 N -1}-1}{2-1} = \frac{N^2}{12} - \frac{1}{3} -\frac{N}{2} +1 < \frac{N^2}{12} \end{aligned}$$

inner leaves. \(\square \)

Lemma 5.7

The Hausdorff error in GREEDY is at most 5/2.

Proof

Given any point \(v \in \mathcal {G}^+_N\), there exists some \(n \le N\) such that \(2^{n-1} < v_x + v_y \le 2^n\). Based on our slice partition, we partition \(\overline{o,v}\) into n line segments such that each line segment lies in some slice \(S_i\). Then, we bound the Hausdorff error between each line segment and the corresponding piece of digital segment within each slice, which implies the overall Hausdorff error. Recall that H(AB) is the Hausdorff distance between A and B under \(\Vert \,{ \cdot }\,\Vert _{\infty }\) metric.

We first show how to partition \(\overline{o,v}\) and \(dig (o,v)\). For the sake of simplicity, we assume that \(v_x \ge v_y\). Let \(k= v_x + v_y\) and let \(v_i\) be the intersection of \(\overline{o,v}\) and \(x+y= 2^i\) for \(i \le n-1\), i.e., \(v_{i,x} = 2^{i}v_x/k\) and \(v_{i,y} = 2^{i} v_y/k \). Let \(v' = (\lfloor 2^{n-1}v_x/k \rfloor , \lceil 2^{n-1} v_y/k \rceil )\) and \(v'' = (\lfloor 2^{n-1}v_x/k \rfloor + 1, \lceil 2^{n-1} v_y/k \rceil - 1)\) so that \(v_{n-1}\) is between \(v'\) and \(v''\) on line \(x+y=2^{n-1}\). Therefore, v is between \(\overline{v',2v'}\) and \(\overline{v'',2v''}\). Based on the GREEDY construction, v is also between \(dig (v',2v')\) and \(dig (v'', 2v'')\). Suppose that v is not in \(dig (v'', 2v'')\), then \(dig (o,v)\) is constructed by a horizontal path from v to \(dig (v',2v')\) and then following \(dig (o,2v')\) to the origin. Let \(v'_i = (\lfloor 2^{i}v_x/k\rfloor , \lceil 2^{i}v_y/k\rceil )\) for \(i = 2, \ldots , n-1\). Since \(dig (o,v)\) passes through \(v'=v'_{n-1}\), by Corollary 5.4, \(dig (o,v)\) also passes through all \(v'_i\). Then, we need to consider \(H(\overline{v_{n-1}, v},dig (v',v))\) and \(H(\overline{v_{i-1}^{},v_i},dig (v'_{i-1},v'_i))\), whose maximum gives the bound on \(H(\overline{o,v},dig (o,v))\).

Now we are going to bound \(H(\overline{v_{n-1}, v},dig (v',v))\). Let p (resp. \(p'\)) be the intersection of \(\overline{v',2v'}\) [resp. \(dig (v',2v')\)] and \(x+y=k\) and q (resp. \(q'\)) be the intersection of \(\overline{v'',2v''}\) [resp. \(dig (v'',2v'')\)] and \(x+y=k\) so that \(dig (v',v)\) is between \(dig (v',p')\) and \(dig (v'',q')\) (see Fig. 9). Then, \(H(\overline{v_{n-1}, v},dig (v',v))\) is bounded by the maximum of \(H(\overline{v_{n-1}, v},dig (v',p'))\) and \(H(\overline{v_{n-1}, v}, dig (v'',q'))\). Furthermore,

$$\begin{aligned}&H(\overline{v_{n-1}, v},dig (v',p')) \le H(\overline{v_{n-1}, v}, \overline{v', p}) + H(\overline{v',p},dig (v',p'))\quad \text {and}\\&H(\overline{v_{n-1}, v},dig (v'',q')) \le H(\overline{v_{n-1}, v}, \overline{v'', q}) + H(\overline{v'',q},dig (v'',q')). \end{aligned}$$

Because of the GREEDY construction, both \(H(\overline{v',p},dig (v',p'))\) and \(H(\overline{v'',q},dig (v'',q'))\) are at most 0.5. Since \(H(\overline{v', p}, \overline{v'', q}) < 2\), we have \(H(\overline{v_{n-1}, v},dig (v',v)) < 5/2\).

For the second part, \(H(\overline{v_{i-1}^{},v_i},dig (v'_{i-1},v'_i))\) is bounded by \(H(\overline{v_{i-1},v_i},\overline{v'_{i-1},v'_i}) + H(\overline{v'_{i-1},v'_i},dig (v'_{i-1},v'_i))\). Since \(\Vert v_{i-1} - v'_{i-1}\Vert _\infty \) and \({\Vert v_{i} - v'_{i}\Vert _\infty }\) are at most 1, \(H(\overline{v_{i-1},v_i}, \overline{v'_{i-1},v'_i})\) is also at most 1. Based on the GREEDY construction, we know that \(H(\overline{p,2p},dig (p,2p)) \le 0.5\) for any \(p\in L_{2^i}\). If \(v'_{i} = 2v'_{i-1}\), we are done. Otherwise, \(v'_i = (2v'_{i-1,x}+1, 2v'_{i-1,y}-1 ) \), then \(dig (v'_{i-1},v'_i)\) is constructed by a horizontal path from \(v'_i\) to \(dig (v'_{i-1},2v'_{i-1})\), and then following \(dig (v'_{i-1},2v'_{i-1})\) to \(v'_{i-1}\). Using the similar argument, we can show that \(H(\overline{v'_{i-1},v'_i}, dig (v'_{i-1},v'_i)) \le 1.5\). Overall, it gives \(H(\overline{o,v},dig (o,v)) \le 5/2\) when \(dig (o,v)\) passes through \(v'\).

We go back to another case when \(v \in dig (v'',2v'')\). Let \(v''_i = (\lfloor 2^{i}v_x/k + 1/2^{n-1-i}\rfloor , \lceil 2^iv_y/k - 1/2^{n-1-i} \rceil )\) for \(i=2,\ldots , n-1\). Since \(dig (o,v)\) passes through \(v''=v''_{n-1}\), by Corollary 5.4, \(dig (o,v)\) also passes through all \(v''_i\). Since \(\Vert v_{i} - v''_{i}\Vert _\infty \) is at most 1 for \(i=2,\ldots ,n-1\), we can apply the same argument as above to show that \(H(\overline{o,v},dig (o,v)) \le 5/2\) when \(dig (o,v)\) passes through \(v''\). \(\square \)

Combining all these lemmas, we have our main theorem.

Theorem 1.6

For any \(N>0\) we can create a weak CDR in \(\mathbb {Z}^2\) with at most 5/2 error and at most \(N^2/12\) inner leaves.

Proof

Lemma 5.5 guarantees that GREEDY satisfies axioms 1, 2, 3, and 5. Lemmas 5.6 and 5.7 give the two qualities of the weak CDR. \(\square \)

From the above theorem, we can also extend it to have a tradeoff construction with O(c) error and \(O(N^2/c)\) inner leaves by scaling the tree.

Theorem 1.7

For any \(N>0\) and \(1 \le c \le N\) we can create a weak CDR in \(\mathbb {Z}^2\) with O(c) error and \(O(N^2/c)\) inner leaves.

Fig. 10
figure 10

Example of a weak CDR with O(c) error and \(\varTheta (N^2/c)\) inner leaves for \(N=24\) and \(c=3\). The thick black line segments represent the GREEDY construction for \(N/c=8\). The blue segments cover the remaining refined grid vertices

Proof

We first apply the GREEDY construction in \(\mathcal {G}^+_{\lceil N/c \rceil }\), in which we have O(1) error and \(O(N^2/c^2)\) inner leaves. Then, we scale up the tree by a factor of c so that the original grid edges have length c. Therefore, the error of the tree in \(\mathcal {G}^+_{\lceil N/c \rceil \cdot c}\) becomes O(c), but the tree does not cover all the refined grid vertices. Then, we draw some vertical or horizontal line segments that branch from the tree as shown in Fig. 10. This will increase the number of inner leaves by a factor of c, i.e., \(O(N^2/c)\). Each new branch is a copy of some sub-path of the original GREEDY tree and is shifted by at most c steps. Hence, their errors are still O(c). \(\square \)

In addition to the GREEDY construction for a weak CDR, we can also observe some nice properties in GREEDY. If we remove all the branches which end up at some inner leaves, we have an infinite tree which covers 2/3 of the grid points of \(\mathcal {G}^+_N\). In particular, for each grid point not in the tree, there must exist a vertex in the tree within one unit distance. Hence, given any point p in \(\mathcal {G}^+_N\), we can snap p to some vertex q in the tree with distance at most 1. Then, \(dig (o,p)\) can be approximated by \(dig (o,q)\) with a very small distortion at the end point, but the Hausdorff error \(H(\overline{o,p},dig (o,q))\) is O(1). Let \(T_G\) be the tree created by GREEDY after removing all the inner branches. We give a formal statement as follows:

Theorem 5.8

Let V be the vertices in \(T_G\). Then, \(DS (\{o\} \times V)\) realized by \(T_G\) is a partial CDS with O(1) error. Moreover, for any vertex \(p \in \mathbb {Z}^2,\) there exists a vertex \(q \in V\) such that \(\Vert p-q\Vert _\infty \le 1\).

Proof

By Lemma 5.5, we know that every path from any vertex in \(T_G\) to the origin is xy-monotone. And by Corollary 5.4, we know that all the greedy digital paths can be extended to infinity. Hence, \(DS (\{o\} \times V)\) realized by \(T_G\) satisfies all the five axioms. Lemma 5.7 gives the O(1) error.

By definition of greedy digital path, in each \(L_j\) between two consecutive greedy digital paths there is at most one point not on these two paths. Hence, the distance between those points and greedy paths is at most one. \(\square \)

6 Point Sets with Constant Discrepancy

In this section we construct red R and blue B point sets such that the absolute value of their discrepancy is 1. Let \(m > 0\) be the difference between the number of blue and red points as defined in Appendix. Our construction has \(\varTheta (m^2)\) many points. Afterwards we also prove that a discrepancy of 1 cannot be achieved with \(o(m^2)\) many points. We first describe a specific configuration of points, called staircase.

Definition 6.1

A staircase is a sequence of alternating blue and red points \((p_1, \ldots , p_n)\) in the unit square. It starts and ends with a blue point. Moreover for every red point \(p_i\), the blue point \(p_{i-1}\) has smaller x-coordinate and the same y-coordinate. The blue point \(p_{i+1}\) has the same x-coordinate and smaller y-coordinate.

Fig. 11
figure 11

A staircase

Given a staircase, we can define a curve by connecting consecutive points on the staircase. Additionally we add a vertical segment at the beginning and a horizontal segment at the end, in order to connect the curve to the boundary of the unit square, see Fig. 11. We will also use the term “staircase” for this curve.

Observation 6.2

The transformation in Sect. 2 maps a CDR to blue and red points in the unit square, which can be decomposed into a set of staircases.

Proof

Below every red point there is a corresponding blue point. Moreover, by Lemma 2.3, in each row the set of blue and red points is alternating, i.e., to the left of every red point there is a corresponding blue point.\(\square \)

Assume that a set of blue and red points forms one staircase. Then the curve induced by the staircase splits the unit square into two parts. The set of points (xy) to the bottom-left of the staircase satisfies \(B[x,y]-R[x,y] = 0\) whereas the set of points to the top-right of the staircase satisfies \(B[x,y]-R[x,y] = 1\), see Fig. 11. When the set of blue and red points can be decomposed into many staircases, then we can easily compute the value \(B[x,y]-R[x,y]\) by counting how many staircases are to the bottom-left of point (xy).

Recall the definition of discrepancy of R and B at point (xy):

$$\begin{aligned} D_{R,B}(x,y) = m x y - (B[x,y]-R[x,y]). \end{aligned}$$

The first term mxy represents the expected difference between the numbers of blue and red points in the axis-aligned rectangle with corner points (0, 0) and (xy). Every point (xy) along the curves \(C_i := \{(x,y) \in [0,1]^2:x\cdot y = {i}/{m}\}\), where \(i \in \{0,\ldots ,m\}\), describes a rectangle \([0,x] \times [0,y]\) in which we expect i many blue points more than red points. Figure 12 illustrates the curves \(C_i\) in black for \(m=7\).

The idea of our construction is to approximate the level curves \(C_{i-0.5}\) by staircases, where \(i \in \{1,\ldots ,m\}\). We will construct m staircases such that the staircase approximating \(C_{i-0.5}\) is between \(C_{i-1}\) and \(C_{i}\). This guarantees that the discrepancy \(D^*_{R,B}\) is at most 1.

We describe how we construct the staircase which approximates \(C_{i-0.5}\). We start with a blue point at the intersection of the two curves \(C_{i-1}\) and \(x = y\). This is the blue point

$$\begin{aligned} \biggl (\frac{\sqrt{i-1}}{\sqrt{m}},\frac{\sqrt{i-1}}{\sqrt{m}}\biggr ). \end{aligned}$$

Starting from there we move horizontally to the right until we hit the curve \(C_i\) at the point

$$\begin{aligned} \biggl (\frac{i}{\sqrt{i-1} \sqrt{m}}, \frac{\sqrt{i-1}}{\sqrt{m}}\biggr ). \end{aligned}$$

We add a red point here. Then we move vertically down until we hit \(C_{i-1}\) and put a blue point. We continue in this fashion, i.e., from a blue point on \(C_{i-1}\) we move horizontally to the right and put a red point on \(C_i\). From a red point on \(C_i\) we move vertically down and put a blue point on \(C_{i-1}\). The blue points will have the coordinates

$$\begin{aligned} \biggl (\frac{i^k}{(i-1)^{k-0.5} \cdot \sqrt{m}}, \frac{(i-1)^{k+0.5}}{i^k \cdot \sqrt{m}}\biggr ) \end{aligned}$$
(3)

and the red points have the coordinates

$$\begin{aligned} \biggl (\frac{i^{k+1}}{(i-1)^{k+0.5} \cdot \sqrt{m}}, \frac{(i-1)^{k+0.5}}{i^k \cdot \sqrt{m}}\biggr ), \end{aligned}$$

where \(k \in \{0,1,2,\ldots \}\). We stop this construction when we leave the unit square, i.e., we look for the largest k such that the blue point (3) is still contained in \([0,1]^2\). The maximum value for k is

$$\begin{aligned} k = \Big \lfloor \frac{\log {({\sqrt{m}}/{\sqrt{i-1}})}}{\log {({i}/({i-1}))}} \Big \rfloor \end{aligned}$$

for \(i \ge 2\) and \(k=0\) for \(i=1\). So far we described how we construct the staircases on the side \(y \le x\). We add red and blue points on the side \(y > x\) to make the construction symmetric to the line \(y = x\). Figure 12 illustrates our construction, which we call the symmetric greedy staircase construction.

Fig. 12
figure 12

Staircase approximation for \(m=7\). The curves \(C_i\) are drawn in black. The brightness of the green color encodes the value of the discrepancy \(D_{R,B}(x,y)\) at each point (xy). The discrepancy values range between \(-1\) and 1 as shown on the right hand side. The staircases can be seen at the discontinuity of the discrepancy function. At each staircase the discrepancy function changes its value by 1

Observation 6.3

The points of the symmetric greedy staircase construction with m stairs are

$$\begin{aligned} B&= \biggl \{\biggl (\frac{i^k}{(i-1)^{k-0.5} \cdot \sqrt{m}}, \frac{(i-1)^{k+0.5}}{i^k \cdot \sqrt{m}} \biggr ) \,:\, i \in [1,m],\; -k^*(i) \le k \le k^*(i) \biggr \}, \\ R&= \biggl \{\biggl (\frac{i^{k+1}}{(i-1)^{k+0.5} \cdot \sqrt{m}}, \frac{(i-1)^{k+0.5}}{i^k \cdot \sqrt{m}} \biggr ) \,:\, i \in [1,m],\; -k^*(i) \le k \le k^*(i)-1 \biggr \}, \end{aligned}$$

where \([1,m] = \{1,2,\ldots ,m\}\) and

$$\begin{aligned} k^*(i) = {\left\{ \begin{array}{ll} 0 &{} \text {if } i = 1, \\ \displaystyle \biggl \lfloor \frac{\log {({\sqrt{m}}/{\sqrt{i-1}})}}{\log {(i/({i-1}))}} \biggr \rfloor &{} \text {if } i \ne 1. \end{array}\right. } \end{aligned}$$

There are \(2 k^*(i)+1\) [resp. \(2k^*(i)\)] many blue (resp. red) points in the ith staircase.

Theorem 6.4

The symmetric greedy staircase construction has discrepancy 1.

Proof

Consider any point (xy) between the ith and \((i+1)\)th staircase. It holds that \(B[x,y]-R[x,y] = i\). Moreover both staircases are bounded from below by the level curve \(C_{i-1}\) and from above by \(C_{i+1}\), which means that \(({i-1})/{m} \le x \cdot y \le ({i+1})/{m}\). Summarizing, we can bound the discrepancy

$$\begin{aligned} -1 \le \underbrace{m x y - (B[x,y]-R[x,y])}_{= D_{R,B}(x,y)} \le 1. \end{aligned}$$

\(\square \)

Theorem 6.5

The symmetric greedy staircase construction with m staircases has \(O(m^2)\) many points.

Proof

The number of blue points, which are used in our construction, is

$$\begin{aligned} |B|&= \sum _{i = 1}^{m} 1+2\cdot k^*(i) = m + \sum _{i = 2}^{m} 2\cdot \Big \lfloor \frac{\log {({\sqrt{m}}/{\sqrt{i-1}})}}{\log {({i}/({i-1}))}}\Big \rfloor \nonumber \\&\le O(m) + \sum _{i = 2}^{m-1} \frac{\log {({m}/{i})}}{\log {((i+1)/{i})}}. \end{aligned}$$

We now bound the denominator from below by

$$\begin{aligned} \log \frac{i+1}{i}=\log {\biggl (1+\frac{1}{i}\biggr )} \ge \frac{1}{i} - \frac{1}{i^2} = \frac{i-1}{i^2}. \end{aligned}$$

Putting the inequalities together, we get

$$\begin{aligned} |B|\le O(m) + \sum _{i = 2}^{m-1} \frac{i^2}{i-1} \log \frac{m}{i}\le O(m) + 2 \sum _{i = 2}^{m-1} i \log \frac{m}{i}. \end{aligned}$$

The continuous function \(f(i) = i \log {({m}/{i})}\) has exactly one maximum in the interval [2, m] with a value bounded by \(m \log m\) and is monotone on both sides of it. Therefore we can replace the sum by an integral.

$$\begin{aligned} |B|&\le O(m \log m) + 2 \int _{2}^{m-1} i \log \frac{m}{i}\, di \\&= O(m \log m) + 2 \biggl [ \frac{i^2}{4} \cdot \biggl (1+2 \log \frac{m}{i}\biggr ) \biggr ]_{i=2}^{i=m-1} = O(m^2). \end{aligned}$$

\(\square \)

Note that point sets RB with constant discrepancy and \(O(m^2)\) many points can also be constructed by applying the transformation of Sect. 2 on the weak CDR, constructed in Sect. 5. We now show that our construction is tight.

Theorem 6.6

Let B and R be point sets, which can be decomposed into m non-intersecting staircases, and have a discrepancy bounded by a constant \(\xi \). Then \(|B| = \varOmega (m^2)\).

Proof

The ith staircase is bounded from below by the level curve \(C_{i-\xi }\) and from above by \(C_{i+\xi -1}\) because of the discrepancy constraint. We count how many points are necessary to create the ith stair. The minimum number can be realized by constructing a stair in a greedy manner between \(C_{i-\xi }\) and \(C_{i+\xi -1}\) because both curves are convex.

$$\begin{aligned} B&= \biggl \{\biggl (\frac{(i+\xi -1)^k}{m (i-\xi )^{k-1} }, \frac{(i-\xi )^k}{(i+\xi -1)^k} \biggr ) \,:\, i \in \{1,2,\ldots ,m\},\; 1 \le k \le k^*(i) \biggr \}, \\ R&= \biggl \{\biggl (\frac{(i+\xi -1)^{k+1}}{m (i-\xi )^k }, \frac{(i-\xi )^k}{(i+\xi -1)^k} \biggr ) \,:\, i \in \{1,2,\ldots ,m\},\; 1 \le k \le k^*(i)-1 \biggr \}, \end{aligned}$$

where

$$\begin{aligned} k^*(i) = {\left\{ \begin{array}{ll} 0 &{} \text {if } i \le \xi ,\\ \displaystyle \biggl \lfloor \frac{\log {({m}/({i-\xi }))}}{\log {(({i+\xi -1})/({i-\xi }))}} \biggr \rfloor &{} \text {if } i > \xi . \end{array}\right. } \end{aligned}$$

The number of blue points can therefore be bounded by

$$\begin{aligned} |B|&\ge \sum _{i = 1}^{m} k^*(i)\ge \xi + \sum _{i = \xi +1}^{m} \biggl \lfloor \frac{\log {({m}/({i-\xi }))}}{\log {(({i+\xi -1})/({i-1}))}} \biggr \rfloor \\&\ge -O(m) + \sum _{i = 1}^{m-\xi } \frac{\log {({m}/{i})}}{\log {(({i+2\xi -1})/{i})}}. \end{aligned}$$

Using the inequality

$$\begin{aligned} \log \frac{i+2\xi -1}{i}=\log {\biggl (1+\frac{2\xi -1}{i}\biggr )} \le \frac{2\xi -1}{i}, \end{aligned}$$

and comparing the sum with an integral, as done in the proof of Theorem 6.5,

$$\begin{aligned} \frac{1}{2\xi -1} \sum _{i = 1}^{m-\xi } i \log \frac{m}{i}\ge \frac{1}{2\xi -1} \Big (-O(m \log m) + \int _{1}^{m-\xi } i \log \frac{m}{i}\,di \Big ) \end{aligned}$$

we can conclude \(|{B}| \ge \varOmega (m^2)\). \(\square \)

Theorem 1.8

Let B and R be two sets of points whose discrepancy satisfies \(D_{R,B}^*<1\). Then \(|B|= \varOmega (m^2),\) where \(m =|B|-|R|\).

Proof

Consider the sets \(S_i := \{(x,y) \in [0,1]^2:B[x,y]-R[x,y] = i\}\) for \(i \in \{0,1,\ldots ,m\}\). Because the discrepancy of the point set B and R is less than 1 we can conclude that

  1. (1)

    the curves \(C_i\) are contained in \(S_i\), and

  2. (2)

    the points between \(C_i\) and \(C_{i+1}\) are either contained in \(S_i\) or \(S_{i+1}\).

Therefore there exists a curve between \(C_i\) and \(C_{i+1}\) which is only neighboring \(S_i\) to its bottom-left and \(S_{i+1}\) to its top-right for each \(i \in \{0,1,\ldots ,m-1\}\). This curve is a staircase. Hence there exists a staircase between \(C_i\) and \(C_{i+1}\) for each \(i \in \{0,1,\ldots ,m-1\}\). Those staircases are non-intersecting because \(D_{R,B}^*<1\). Therefore they consist of at least \(\varOmega (m^2)\) many points, as shown in Theorem 6.6. \(\square \)

Theorem 1.8 is open if the upper bound \(D_{R,B}^*<1\) is replaced by O(1).

Discussion. As mentioned in the introduction, this result could be the first step towards showing that GREEDY construction is tight (in the sense that the number of inner leaves cannot be drastically decreased without increasing the error): we want to create a weak CDR with O(1) error and few inner leaves. Theorem 1.3 states that \(\varOmega (n\log n)\) many inner leaves will be necessary. Theorem 1.8 strengthens the result by saying \(\varOmega (n^2)\) many inner leaves are necessary. However, this claim only holds if we are going to use a CDR whose mapping decomposes into staircases that do not cross.

This non-crossing requirement is key and follows from the fact that we require \(D_{R,B}^*<1\). In particular, it is unlikely that our proof extends for any larger constant \(D_{R,B}^*=O(1)\). Doing so would most likely bring an improvement on the bichromatic discrepancy bound (and thus the non-chromatic as well). However, we could go a different route to improve the result: in general, weak CDRs could map to points whose staircases intersect (and then Theorem 1.8 does not apply). Intersecting staircases can again be decomposed into non-intersecting (only touching) staircases, where there does not need to be a blue or red point at every turn. Thus, rather than looking at higher discrepancy, it would make sense to study if we can extend the quadratic lower bound to colored pointsets that form such touching staircases.

7 Final Remarks

Common intuition would say that the \(\varOmega (\log N)\) lower bound for the error of two-dimensional CDR and CDS automatically extends to higher dimensions. The observation that this is not true opens up new ways in which research can continue. By the time of writing this, we know several ways to construct CDRs with \(O(\log n)\) Hausdorff error in any dimension, but only know of \(\varOmega (\log ^{1/(d-1)}\!N)\) lower bound. If we had to guess, the upper bound seems closer to the truth, but this is a hunch based on the fact that our analysis is a bit loose. Regardless of which bound is tight, further study in the relationship between the three spaces (CDR in high dimensions, 2-D weak CDR and the two-colored pointset) could lead to either designing tighter lower bounds or possibly lead to better CDR constructions [or even better, obtain a CDS construction with o(N) error in arbitrary dimensions].

We also find that weak CDRs are an interesting research topic on their own. In particular, we would like to find the relationship between the number of inner leaves and the error of the construction. That is, say that we want a CDR with O(e) error (for some \(e\le \log n\)). What is the minimum number of leaves \(\ell =\ell (e)\) that such a CDR must have? Can we find such a construction? Theorem 1.3 seems to indicate a linear relationship between the two, and it is not hard to obtain one (see, for example, Theorem 1.7 and Fig. 10). However, this construction is most likely not the best possible one. Indeed, even if we are interested in \(O(\log N)\) error, this construction creates a large number of inner leaves, but we know of CDRs with the same error and no inner leaves. Thus, the question becomes, can we significantly improve upon the greedy construction in Sect. 5? Or is there some exponential dependency between the number of inner leaves and the error of the weak CDR?