---
abstract: |
    We construct a bi-Lipschitz bijection from the Boolean cube to the Hamming ball of equal volume. More precisely, we show that for all even $n \in {{\mathbb N}}$ there exists an explicit bijection ${\psi}\colon \{0,1\}^n \to \left\{ x \in \{0,1\}^{n+1} \colon |x| > n/2 \right\}$ such that for every $x \neq y \in {\{0,1\}^{n}}$ it holds that $$\frac{1}{5}\leq \frac{{{\sf distance}}({\psi}(x),{\psi}(y))}{{{\sf distance}}(x,y)} \leq 4,$$ where ${{\sf distance}}(\cdot,\cdot)$ denotes the Hamming distance. In particular, this implies that the Hamming ball is bi-Lipschitz transitive.

    This result gives a strong negative answer to an open problem of Lovett and Viola \[CC 2012\], who raised the question in the context of sampling distributions in low-level complexity classes. The conceptual implication is that the problem of proving lower bounds in the context of sampling distributions will require some new ideas beyond the sensitivity-based structural results of Boppana \[IPL 97\].

    We study the mapping ${\psi}$ further and show that it (and its inverse) are computable in DLOGTIME-uniform ${\mathbf{TC^{0}}}$, but not in ${\mathbf{AC^{0}}}$. Moreover, we prove that ${\psi}$ is “approximately local” in the sense that all but the last output bit of ${\psi}$ are essentially determined by a single input bit.
author:
- 'Itai Benjamini[^1]'
- Gil Cohen
- Igor Shinkar
bibliography:
- 'bibliography.bib'
title: |
    Bi-Lipschitz Bijection between the Boolean Cube\
    and the Hamming Ball
---

Introduction {#sec:intro}
============

The Boolean cube ${\{0,1\}^{n}}$ and the Hamming ball ${\mathcal{B}_{n}}= \{x \in {\{0,1\}^{n+1}} \colon |x|>n/2\}$, equipped with the Hamming distance, are two fundamental combinatorial structures that exhibit, in some aspects, different geometric properties. As a simple illustrative example, for an even integer $n \in {{\mathbb N}}$, consider the vertex and edge boundaries[^2] of ${\{0,1\}^{n}}$ and ${\mathcal{B}_{n}}$, when viewed as subsets of ${\{0,1\}^{n+1}}$ of equal density $1/2$. The Boolean cube is easily seen to maximize vertex boundary among all subsets of equal density (since all its vertices lie on the boundary), whereas Harper’s vertex-isoperimetric inequality [@Harper66] implies that the Hamming ball is in fact the unique minimizer. The same phenomena occurs for edge boundary, though interestingly, the roles are reversed: among all monotone sets[^3] of density $1/2$, the Poincaré inequality implies that the Boolean cube is the unique minimizer of edge boundary, whereas a classical result of Hart shows that the Hamming ball is the unique maximizer [@Hart76]. From the Boolean functions perspective, the indicator of ${\{0,1\}^{n}}$ embedded in ${\{0,1\}^{n+1}}$ is commonly referred to as the *dictator* function, and the indicator of ${\mathcal{B}_{n}}\subset {\{0,1\}^{n+1}}$ is the *majority* function, and it is a recurring theme in the analysis of Boolean functions that they are, in some senses, opposites of one another.

Lovett and Viola [@LV11] suggested to utilize the opposite structure of the Boolean cube and the Hamming ball for proving lower bounds on sampling by low-level complexity classes such as ${\mathbf{AC^{0}}}$ and ${\mathbf{TC^{0}}}$. In particular, Lovett and Viola were interested in proving that for any even $n$, any bijection $f \colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ has a large average stretch, where $${{\sf avgStretch}}(f) = {\mathop{{\bf E}\/}}_{\substack{x \sim {\{0,1\}^{n}}\\ i \sim  [n]}} \left[ {{\sf distance}}(f(x),f(x+e_i)) \right],$$ and ${{\sf distance}}(\cdot,\cdot)$ denotes the Hamming distance. To be more precise, Lovett and Viola raised the following open problem.

\[prob:dict to maj\] Let $n \in {{\mathbb N}}$ be an even integer. Prove that for any bijection $f \colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$, it holds that $$\label{eq:superpolylog stretch}
{{\sf avgStretch}}(f) = (\log{n})^{\omega(1)}.$$

A positive answer to Problem \[prob:dict to maj\] would demonstrate yet another scenario in which the Boolean cube and the Hamming ball have a different geometric structure – any bijection from the former to the latter does not respect distances. Furthermore, a positive answer to Problem \[prob:dict to maj\] would have applications to lower bounds for sampling in ${\mathbf{AC^{0}}}$; even a weaker claim, where the right hand side in Equation  is replaced with $\omega(1)$, would have implications for sampling in the lower class ${\mathbf{NC^{0}}}$. We discuss this further in Section \[sec:motivation\].

Arguably, the simplest and most natural bijection $\varphi \colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ to consider is the following. $$\varphi(x) = \left\{
\begin{array}{ll}
 {\sf flip}(x) \circ 1 & \text{\quad if $|x| \le n/2$}  \\
 x \circ 0 & \text{\quad otherwise},
\end{array}
\right.$$ where ${\sf flip}(x)$ denotes the bit-wise complement of $x$. It is straightforward to verify that ${{\sf avgStretch}}(\varphi) = \Theta(\sqrt{n})$. To see this, note that any edge $(x,y)$ in ${\{0,1\}^{n}}$, where $|x| = n/2$ and $|y| = n/2+1$, contributes $n$ to the average stretch, whereas all other edges contribute $1$. The assertion then follows since $\Theta(1/\sqrt{n})$ fraction of the edges are of the first type. In fact, the maximum stretch of $\varphi$ is $n$, where $${{\sf maxStretch}}(\varphi) = \max_{\substack{x \in {\{0,1\}^{n}}\\ i \in  [n]}} {{\sf distance}}(\varphi(x),\varphi(x+e_i)).$$ As far as we know, prior to our work this simple bijection achieved the best-known upper bound on the average stretch between ${\{0,1\}^{n}}$ and ${\mathcal{B}_{n}}$, and no non-trivial upper bounds ([*i.e.*]{} sublinear) on maximum stretch were known. For a survey on metric embeddings of finite spaces see [@Li02]. In particular, a lot of research has been done on the question of embedding into the Boolean cube. For example, see [@AB07; @HLN87] for some work on embeddings between random subsets of the Boolean cube, and [@G88] for isometric embeddings of arbitrary graphs into the Boolean cube.

Our Results
-----------

The main result of this paper is a strong *negative* answer to Problem \[prob:dict to maj\].

\[thm:main\] For all even integers $n$, there exists a bijection ${\psi}\colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ with $${{\sf maxStretch}}({\psi}) \le 4$$ and $${{\sf maxStretch}}({\psi}^{-1}) \le 5.$$

Theorem \[thm:main\] highlights a surprising geometric resemblance between the Boolean cube and the Hamming ball. In the language of metric geometry, Theorem \[thm:main\] says that there is a bi-Lipschitz bijection between the two spaces.

For all even integers $n$, there exists a bijection ${\psi}\colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$, such that for every $x \neq y \in {\{0,1\}^{n}}$ it holds that $$\frac{1}{5}\leq \frac{{{\sf distance}}({\psi}(x),{\psi}(y))}{{{\sf distance}}(x,y)} \leq 4.$$

As a corollary from Theorem \[thm:main\], we obtain that the subgraph of $\{0,1\}^{n+1}$ induced by the vertices of ${\mathcal{B}_{n}}$ is *bi-Lipschitz transitive*. Informally speaking, this says that any two points in ${\mathcal{B}_{n}}$ have roughly the same “view” – even the unique point with Hamming weight $n+1$ and the boundary points which have weight $n/2+1$. More formally,

\[cor:coarse transitivity\] For all even integers $n$, and for every two vertices $x,y \in {\mathcal{B}_{n}}$ there is a bijection $f \colon {\mathcal{B}_{n}}\to {\mathcal{B}_{n}}$ such that $f(x)=y$, $f(y) = x$, and for every $z \neq w \in {\mathcal{B}_{n}}$, it holds that $$\frac{1}{20} \leq \frac{{{\sf distance}}(f(z),f(w))}{{{\sf distance}}(z,w)} \leq 20.$$

To see this, first note that ${\mathcal{B}_{n}}$ is a convex subset of ${\{0,1\}^{n+1}}$, and thus, the distances between vertices in ${\mathcal{B}_{n}}$ are the same as their distances as a subset of the cube. Now, for a given pair $x,y \in {\mathcal{B}_{n}}$, let $x' = {\psi}^{-1}(x)$ and $y' = {\psi}^{-1}(y)$, where ${\psi}$ is the function from Theorem \[thm:main\]. Define $f \colon {\mathcal{B}_{n}}\to {\mathcal{B}_{n}}$ as $f(z) = {\psi}( {\psi}^{-1}(z) \oplus x' \oplus y')$. It is easy to see that $f$ indeed satisfies the requirements of Corollary \[cor:coarse transitivity\].

#### Approximating $\boldsymbol{{\psi}}_\mathbf{i}$

We highlight another consequence of our main theorem that is perhaps somewhat surprising – the bijection ${\psi}$ of Theorem \[thm:main\] is “approximately local” in the sense that almost *all* of its output bits are essentially determined by only a *constant* number of inputs bits. To see this, we view the bijection ${\psi}\colon{\{0,1\}^{n}}\to{\mathcal{B}_{n}}$ as a vector of Boolean functions $\langle {\psi}_1,\ldots, {\psi}_{n+1}\rangle$, where ${\psi}_i(x)$ is the $i^{\text{th}}$ output bit of ${\psi}$ on input $x\in{\{0,1\}^{n}}$. Recall that the *total influence* of a Boolean function ${\psi}_i \colon {\{0,1\}^{n}}\to\{0,1\}$ is the quantity $${\mathbf{Inf}}[{\psi}_i] =  {\mathop{{\bf E}\/}}_{x\sim {\{0,1\}^{n}}}\left[\#\{j\in [n] \colon {\psi}_i(x) \ne {\psi}_i(x+e_j)\}\right].$$ By linearity of expectation, Theorem \[thm:main\] implies that a typical ${\psi}_i$ has bounded total influence. $${\mathop{{\bf E}\/}}_{i \sim [n+1]} [{\mathbf{Inf}}[{\psi}_i]] = {{\sf avgStretch}}({\psi}) \le {{\sf maxStretch}}({\psi}) \le 4. \label{small-total-influence}$$ Next we recall Friedgut’s Junta Theorem, which states that a Boolean function with bounded total influence is well-approximated by another Boolean function that only depends on a *constant* number of input bits. More precisely,

Let $f \colon {\{0,1\}^{n}}\to\{0,1\}$ be a Boolean function. For every ${\varepsilon}> 0$ there exists a Boolean function $g \colon \{0,1\}^n \to\{0,1\}$ such that $g$ is a $2^{O({\mathbf{Inf}}[f]/{\varepsilon})}$-junta[^4] and ${\mathop{\bf Pr\/}}[f(x) \ne g(x)] \le {\varepsilon}$.

Combining Equation  with Friedgut’s Junta Theorem, we see that for any constants $\delta,{\varepsilon}> 0$, all but a $\delta$-fraction of the ${\psi}_i$’s are ${\varepsilon}$-approximated by $O(1)$-juntas. In fact, we give a direct proof that the function ${\psi}$ in Theorem \[thm:main\] satisfies the following stronger property.

\[prop:f\_i = x\_i\] For all $i \in [n]$ it holds that $${\mathop{\bf Pr\/}}_{x}[{\psi}_i(x) = x_i] > 1 - O(1/\sqrt{n}).$$

That is, all but the last output bit of ${\psi}$ are essentially determined by a *single* input bit.

#### The complexity of $\boldsymbol{{\psi}}$.

Since the original motivation for constructing ${\psi}$ comes from efficient sampling of distributions, Theorem \[thm:main\] is of larger interest if the bijection ${\psi}$ (and ${\psi}^{-1}$) can be computed by low-level circuits.

\[prop:TC0\] The bijections ${\psi}$ and ${\psi}^{-1}$ are computable in DLOGTIME-uniform ${\mathbf{TC^{0}}}$.

In fact, we show that for all $i \in [n+1]$ there is an ${\mathbf{NC^{0}}}$-reduction from ${{\sf majority}}$ to ${\psi}_i$. That is, ${\mathbf{TC^{0}}}$ is the “correct” complexity of ${\psi}$, and in particular, ${\psi}$ is not in ${\mathbf{AC^{0}}}$. See Proposition \[prop:maj leq f\_1\] and Remark \[rem:maj leq f\_i\] for details.

The Complexity of Distributions {#sec:motivation}
-------------------------------

Lower bounds in circuit complexity are usually concerned with showing that a family of functions $\{f_n \colon {\{0,1\}^{n}}\to \{0,1\}\}_{n \in {{\mathbb N}}}$ cannot be computed by a family of circuits $\{C_n\}_{n \in {{\mathbb N}}}$ belonging to some natural class of circuits such as ${\mathbf{AC^{0}}}$ or ${\mathbf{TC^{0}}}$. Taking a broader interpretation of computation, it is often interesting to show that a class of circuits cannot perform a certain natural task beyond just computing a function.

One such natural task, introduced by Viola [@Vi12], is that of sampling distributions. In this problem, for a given distribution ${{\mathcal D}}$ supported on ${\{0,1\}^{n}}$, we are looking for a function $f \colon {\{0,1\}^{m}} \to {\{0,1\}^{n}}$ that samples (or approximates) ${{\mathcal D}}$, that is, for a uniformly random $x\!~\sim~\!{\{0,1\}^{m}}$, the distribution $f(x)$ is equal (or close to) ${{\mathcal D}}$, and furthermore, each output bit $f_i$ of the function $f$ belongs to some low-level complexity class, such as ${\mathbf{AC^{0}}}$ or ${\mathbf{TC^{0}}}$.

As a concrete example, let $U_{\oplus}$ be the uniform distribution over the set $\{ (x,{{\sf parity}}(x)) \colon x \in {\{0,1\}^{n-1}} \} {\subseteq}{\{0,1\}^{n}}$. Note that although the ${{\sf parity}}$ function is not computable in ${\mathbf{AC^{0}}}$ (see [@H86] and references therein) there is a function $f \colon {\{0,1\}^{n-1}} \to {\{0,1\}^{n}}$ that samples $U_{\oplus}$, such that each output bit depends on only two input bits: $$f(x_1,\dots,x_{n-1}) = (x_1, x_1 + x_2, x_2 + x_3,\dots, x_{n-2} + x_{n-1},x_{n-1}).$$ Motivated by the foregoing somewhat surprising example, Viola [@Vi12] raised the following question.

\[challenge:main\] Exhibit an explicit map $b \colon {\{0,1\}^{n}}\to \{0,1\}$ such that for a uniformly sampled $x \sim {\{0,1\}^{n}}$, the distribution $(x,b(x)) \in {\{0,1\}^{n+1}}$ cannot be generated by ${{\rm poly}}(n)$-size ${\mathbf{AC^{0}}}$ circuits given random bits as input.

Note that the challenge does not specify the input length. Obviously, the input length should be at least $n$, since this is the entropy of $(x,b(x))$, and the challenge becomes harder as the input length increases. In this paper we only consider distributions ${{\mathcal D}}$ that are uniform over subsets $A {\subseteq}{\{0,1\}^{n}}$ of size $|A| = 2^m$ for some $m \in {{\mathbb N}}$, and functions with input length $m$ sampling ${{\mathcal D}}$ (rather than approximating ${{\mathcal D}}$). Therefore, in this setting, the question of sampling a distribution ${{\mathcal D}}$ reduces to finding a bijection from ${\{0,1\}^{m}}$ to $A$ such that each bit of the bijection is efficiently computable.

As a concrete candidate for the map $b \colon {\{0,1\}^{n}}\to \{0,1\}$ in Challenge \[challenge:main\], Viola suggested to use ${{\sf majority}}$ – the other notoriously hard function for ${\mathbf{AC^{0}}}$ other than ${{\sf parity}}$. The following two problems have been stated in [@LV11].

\[problem:embedding into majset\] Let $n \in {{\mathbb N}}$ be even. Does there exist a bijection $g \colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ such that each output bit of $g$ is computable in ${\mathbf{AC^{0}}}$?

\[problem:embedding into (x,maj(x))\] Let $n \in {{\mathbb N}}$ be odd. Does there exist a bijection $h \colon {\{0,1\}^{n}}\to \{ (x,{{\sf majority}}(x)) \colon x \in {\{0,1\}^{n}}\}$ such that each output bit of $h$ is computable in ${\mathbf{AC^{0}}}$?

Note that a positive answer to Problem \[problem:embedding into majset\] implies a positive answer to Problem \[problem:embedding into (x,maj(x))\]. Indeed, if $g \colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ is an embedding from Problem \[problem:embedding into majset\], then the function $h \colon {\{0,1\}^{n+1}} \to {\{0,1\}^{n+2}}$ defined as $$h(x_1, \dots, x_n,x_{n+1}) =
                    \begin{cases}
                        g(x_1,\dots,x_n) \circ 1 & \text{\quad $x_{n+1} = 1$} \\
                        {\sf flip}(g(x_1,\dots,x_n)) \circ 0 & \text{\quad $x_{n+1} = 0$} \\
                    \end{cases}$$ gives an embedding for Problem \[problem:embedding into (x,maj(x))\]. Therefore, a negative answer to Problem \[problem:embedding into (x,maj(x))\] implies a negative answer to Problem \[problem:embedding into majset\]. In the other direction, if a function $h \colon {\{0,1\}^{n}}\to \{ (x,{{\sf majority}}(x)) \colon x \in {\{0,1\}^{n}}\}$ gives a positive answer to Problem \[problem:embedding into (x,maj(x))\], then the function $g \colon {\{0,1\}^{n}}\to {\{0,1\}^{n}}$ defined as[^5] $$g(x_1, \dots, x_n) =
                    \begin{cases}
                        (h(x_1,\dots,x_n))_{[1,\dots,n]}            & \text{\quad} (h(x_1,\dots,x_n))_{n+1} = 1 \\
                        {\sf flip}(h(x_1,\dots,x_n))_{[1,\dots,n]}  & \text{\quad otherwise} \\
                    \end{cases}$$ samples ${\mathcal{B}_{n-1}}$ using input of length $n$, which almost[^6] answers Problem \[problem:embedding into (x,maj(x))\].

On the positive side, Viola [@Vi12] showed an explicit ${\mathbf{AC^{0}}}$ circuit $C \colon \{0,1\}^{{{\rm poly}}(n)} \to \{0,1\}^n$ of size ${{\rm poly}}(n)$ whose output distribution has statistical distance $2^{-n}$ from the uniform distribution on $\{ (x,{{\sf majority}}(x)) \colon x \in {\{0,1\}^{n}}\}$.

Problem \[prob:dict to maj\] was raised by Lovett and Viola [@LV11] in an attempt to prove a lower bound for Problem \[problem:embedding into majset\]. A positive answer to Problem \[prob:dict to maj\] would imply a lower bound for Problem \[problem:embedding into majset\], since by the result of [@Bop], any function $f \colon {\{0,1\}^{n}} \to {\{0,1\}^{n+1}}$ computable by a polynomial size Boolean circuit of constant depth has average stretch at most $\log^{O(1)}(n)$.

As we resolved Problem \[prob:dict to maj\] negatively in a strong sense, it seems that new ideas beyond the sensitivity-based structural results of [@Bop] will be required in order to resolve Problems \[problem:embedding into majset\] and \[problem:embedding into (x,maj(x))\].

Proof Overview {#sec:proof overview for main theorem}
--------------

In this section we describe in high-level the proof of Theorem \[thm:main\]. A full proof is given in Section \[sec:proof of main theorem\]. Let $n \in {{\mathbb N}}$ be an even integer. Our goal is to map ${\{0,1\}^{n}}$ to ${\mathcal{B}_{n}}$ in a way that the two endpoints of every edge in ${\{0,1\}^{n}}$ are mapped to close vertices in ${\mathcal{B}_{n}}$. The key building block we use is a classical partition of the vertices of ${\{0,1\}^{n}}$ to symmetric chains, due to De Bruijn, Tengbergen, and Kruyswijk [@BTK51], where a symmetric chain is a path $\{c_k, c_{k+1}, \ldots, c_{n-k}\}$ in ${\{0,1\}^{n}}$, such that each $c_i$ has Hamming weight $i$ (see Figure \[fig:the partition\]).

As a first step, we study the chains in the partition of De Bruijn [et al.]{}  Roughly speaking, we show[^7] that adjacent chains move closely to each other. More precisely, if two adjacent vertices $x$ and $y$ belong to different chains, then $x$ and $y$ have the same distance from the top of their respective chains, up to some additive constant. Moreover, the lengths of the two chains differ by at most some additive constant, and the $i^{\text{th}}$ vertex in one chain, when counting from the top, is $O(1)$-close to the $i^{\text{th}}$ vertex in the other chain (if such exists).

We now describe how to map ${\{0,1\}^{n}}$ to ${\mathcal{B}_{n}}$ based on the partition of De Bruijn [et al.]{} Consider a chain $c_k, c_{k+1}, \ldots, c_{n-k}$. Our mapping will “squeeze” the vertices to the top half of the cube while exploiting the extra dimension. In particular, every vertex will climb up its chain half the distance it has from the top, and then, the collision between two vertices is resolved by setting the extra last bit to 1 for the first vertex and to 0 for the second vertex. More precisely, the vertex $c_{n-k}$, which is at the top of its chain, is mapped to $c_{n-k} \circ 1$, while $c_{n-k-1}$ is mapped to $c_{n-k} \circ 0$. The third vertex from the top $c_{n-k-2}$ is mapped to $c_{n-k-1} \circ 1$ while $c_{n-k-3}$ is mapped to $c_{n-k-1} \circ 0$ and so on. The vertex $c_k$ at the bottom of the chain is mapped to $c_{n/2} \circ 1$, which is indeed in ${\mathcal{B}_{n}}$.

Consider now two adjacent vertices $x,y$ in ${\{0,1\}^{n}}$. By the above, these vertices reside in “close” chains with roughly the same length and have roughly the same distance from the top of their respective chains. Thus, in the climbing process, both $x$ and $y$ will be mapped to vertices that have roughly the same distance from the top of their respective chains, and hence, from the discussion above, their images will be $O(1)$-close.

Proof of the Main Theorem {#sec:proof of main theorem}
=========================

In this section we prove the main theorem. In Section \[sec:the partition\] we describe the De Bruijn-Tengbergen-Kruyswijk partition. In Section \[sec:f\] we define the mapping ${\psi}$ and prove basic facts about it. In Section \[sec:finally the proof\] we give the proof for Theorem \[thm:main\], omitting some technical details that can be found in Section \[sec:missing claims\].

The De Bruijn-Tengbergen-Kruyswijk Partition {#sec:the partition}
--------------------------------------------

Let $n$ be an even integer. A *symmetric chain* in ${\{0,1\}^{n}}$ is a sequence of vertices $C = \{ c_k, c_{k+1}, \dots, c_{n-k} \}$ such that $|c_i| = i$ for $i=k,k+1,\ldots,n-k$, and ${{\sf distance}}(c_i,c_{i+1}) = 1$ for $i=k,k+1,\ldots,n-k-1$. We say that a symmetric chain is *monotone* if it satisfies the following property: if $c_{i-1}$ and $c_i$ differ in the $j^{\text{th}}$ coordinate, and $c_i$ and $c_{i+1}$ differ in the $(j')^{\text{th}}$ coordinate, then $j < j'$.

We shall represent a monotone symmetric chain as follows. Let $y \in {\{0,1,{\sqcup}\}^{n}}$ be such that $m = |\{ i \colon y_i = {\sqcup}\}|$ satisfies $m \equiv n \pmod 2$, and let $k = (n-m)/2$. The monotone symmetric chain $C_y = \{ c_k, c_{k+1}, \ldots, c_{n-k} \}$ is specified by $y$ as follows. For $i = k,k+1,\ldots,n-k$, the string $c_i$ is obtained by replacing the $m-(i-k)$ leftmost symbols ${\sqcup}$ of $y$ by $0$ and the remaining $i-k$ symbols ${\sqcup}$ by $1$. Note that $C_y$ is indeed a monotone symmetric chain.

De Bruijn, Tengbergen, and Kruyswijk [@BTK51] suggested a recursive algorithm that partitions ${\{0,1\}^{n}}$ to monotone symmetric chains. We will follow the presentation of the algorithm described in [@LW2001] (see Problem 6E in Chapter 6). The algorithm gets as input a string $x \in {\{0,1\}^{n}}$, and computes a string $y \in {\{0,1,{\sqcup}\}^{n}}$ which encodes the monotone symmetric chain $C_y$ that contains $x$.

The algorithm is iterative. During the running of the algorithm, every coordinate of $x$ is either marked or unmarked, where we denote a marked $0$ by $\hat{0}$ and a marked $1$ by $\hat{1}$. In each step, the algorithm chooses a consecutive pair $10$, marks it by $\hat{1}\hat{0}$, temporarily deletes it, and repeats the process. The algorithm halts once there is no such pair, that is the remaining string is of the form $00\dots01\dots11$. We call this stage of the algorithm the *marking stage*, and denote the marked string by ${{\sf mark}}(x) \in \{0,1,\hat{0},\hat{1}\}^n$. The string $y$ is then defined as follows: if the $i^{\text{th}}$ bit of $x$ was marked then $y_i = x_i$. Otherwise, $y_i = {\sqcup}$.

For example, consider the string $x = 01100110$. At the first iteration, the algorithm may mark the third and fourth bits to obtain $01\hat{1}\hat{0}0110$. Then, the second and fifth bits are marked 01100110. Lastly, the rightmost two bits are marked, and we obtain the marked string ${{\sf mark}}(x) = 0\hat{1}\hat{1}\hat{0}\hat{0}1\hat{1}\hat{0}$. Hence $y = {\sqcup}1100 {\sqcup}10$ and $C_y = \{ {\underline}{0}1100{\underline}{0}10, {\underline}{0}1100{\underline}{1}10, {\underline}{1}11100{\underline}{1}10 \}$.

(-5,1.7) node [$\hat{1}\hat{0}00$]{}; (-8+28/5,3.4) node [$\hat{1}\hat{0}01$]{}; (-5,5.1) node [$\hat{1}\hat{0}11$]{};

(-5+0.5,1.9) – (-8+28/5-0.3,3.1); (-8+28/5-0.3,3.7) – (-5+0.4,4.8);

(-5+8/3,1.7) node [$0\hat{1}\hat{0}0$]{}; (-8+42/5,3.4) node [$0\hat{1}\hat{0}1$]{}; (-5+8/3,5.1) node [$1\hat{1}\hat{0}1$]{};

(-5+8/3+0.5,1.9) – (-8+42/5-0.3,3.1); (-8+42/5-0.3,3.7) – (-5+8/3+0.4,4.8);

(-5+16/3,1.7) node [$00\hat{1}\hat{0}$]{}; (-8+56/5,3.4) node [$01\hat{1}\hat{0}$]{}; (-5+16/3,5.1) node [$11\hat{1}\hat{0}$]{};

(-5+16/3+0.5,1.9) – (-8+56/5-0.3,3.1); (-8+56/5-0.3,3.7) – (-5+16/3+0.4,4.8);

(-1,0) node [$0000$]{}; (3,1.7) node [$0001$]{}; (6,3.4) node [$0011$]{}; (3,5.1) node [$0111$]{}; (-1,6.8) node [$1111$]{};

(-0.5,0.1) – (2.4,1.4); (3.5,1.9) – (5.8,3.1); (5.8,3.7) – (3.6,4.8); (2.5,5.4) – (-0.5,6.7);

(-8+14/5,3.4) node [$\hat{1}\hat{0}\hat{1}\hat{0}$]{}; (-8,3.4) node [$\hat{1}\hat{1}\hat{0}\hat{0}$]{};

Readily, the algorithm induces a partition of ${\{0,1\}^{n}}$ to monotone symmetric chains. We stress that although the algorithm has some degree of freedom when choosing a $10$ pair out of, possibly, many pairs in a given iteration, the output of the algorithm, $y$, is independent of the specific choices that were made. That is, $y$ is a function of $x$, and does not depend on the specific order in which the algorithm performs the marking. This assertion can be proven easily by induction on $n$. As a consequence, we may choose the ordering of the $10$ pairs as we wish. We will use this fact in the proof of Theorem \[thm:main\].

The Bijection $\boldsymbol{{\psi}}$ {#sec:f}
-----------------------------------

We define the mapping ${\psi}$ as follows. Let $n \in {{\mathbb N}}$ be an even integer. For an input $x \in {\{0,1\}^{n}}$, let $C = \{ c_k, c_{k+1}, \ldots, c_{n-k}\}$ be the symmetric chain from the partition of De Bruijn [et al.]{}, that contains $x$. Let $j$ be the index such that $x = c_j$. Define $$\label{eq:definition of f}
    {\psi}(x) {\stackrel{\rm{def}}{=}}\begin{cases}
                    c_{\frac{(n-k)+j}{2}} \circ 1    & j \equiv (n-k) \pmod{2}; \\
                    c_{\frac{(n-k)+j+1}{2}} \circ 0    & j \not\equiv (n-k) \pmod{2}.
                \end{cases}$$

\[claim:f is a bijection\] The mapping ${\psi}$ is a bijection from ${\{0,1\}^{n}}$ to ${\mathcal{B}_{n}}$.

We first show that the range of ${\psi}$ is ${\mathcal{B}_{n}}$. Consider $x \in {\{0,1\}^{n}}$ and let $C = \{ c_k, c_{k+1}, \ldots, c_{n-k}\}$ be the symmetric chain that contains $x$. Suppose that $x = c_j$ for some $k \leq j \leq n-k$. If $j \equiv (n-k) \pmod 2$, then using the fact that $j \geq k$, $$|{\psi}(x)| = \left| c_\frac{n-k+j}{2}  \circ 1 \right| = \frac{n-k+j}{2} + 1 > \frac{n}{2}.$$ Otherwise, $j \not\equiv (n-k) \pmod 2$. Since $n$ is even, it follows that $j \not \equiv k \pmod2$, and thus $j \geq k+1$. Hence, $$|{\psi}(x)| = \left| c_\frac{n-k+j+1}{2} \circ 0 \right| > \frac{n}{2}.$$ In both cases ${\psi}(x) \in {\mathcal{B}_{n}}$.

We conclude the proof by describing the inverse mapping ${\psi}^{-1} \colon {\mathcal{B}_{n}}\to {\{0,1\}^{n}}$. For $z \in {\mathcal{B}_{n}}$, write $z = x \circ z_{n+1}$, where $x \in {\{0,1\}^{n}}$ and $z_{n+1}$ is the $(n+1)^{\text{st}}$ bit of $z$. Let $C = \{ c_k, c_{k+1}, \ldots, c_{n-k}\}$ be the symmetric chain that contains $x$, and let $j$ be the index such that $x = c_j$ (note that $j \ge n/2$). Then, $$\label{eq:f inverse}
    {\psi}^{-1}(z) = \begin{cases}
                    c_{2j-(n-k)}    & \text{ if } z_{n+1} = 1; \\
                    c_{2j-(n-k)-1}    & \text{ if } z_{n+1} = 0.
                \end{cases}$$ It is straightforward to verify that this is indeed the inverse mapping of ${\psi}$.

In order to understand the mapping ${\psi}$ better, consider $x \in {\{0,1\}^{n}}$ and let $y \in {\{0,1,{\sqcup}\}^{n}}$ be the encoding of the chain that contains $x$. Note that if $1 \le i_1 < i_2 < \cdots < i_t \le n$ are the coordinates in which $y$ contains ${\sqcup}$, then there exists some $0 \le \ell \le t$ such that $x_{i_1} = \cdots = x_{i_\ell} = 0$ and $x_{i_{\ell+1}} = \cdots = x_{i_t} = 1$. That is, $x$ is located at the $(\ell+1)^{\text{st}}$ position of the chain $C_y$, when counting from the top. The function ${\psi}$ outputs the vertex located at the $({{\lfloor\ell/2\rfloor}}+1)^{\text{st}}$ position in the chain, concatenated with 1 or 0, depending on the parity of $\ell$. In other words, we obtain ${\psi}(x)$ by keeping intact all the bits of $x$ in the coordinates other than $i_{{{\lfloor\ell/2\rfloor}}+1}, \ldots, i_\ell$, and by setting ${\psi}(x)_{i_{{{\lfloor\ell/2\rfloor}}+1}} = \cdots = {\psi}(x)_{i_{\ell}} = 1$. Then, we append 1 to the obtained string if $\ell$ is even, and append 0 otherwise.

For example, let us consider the Boolean cube ${\{0,1\}^{4}}$, whose partition is presented in Figure \[fig:the partition\], and write explicitly where each vertex in the chain of length 5 is mapped under ${\psi}$. $$\begin{aligned}
&{\psi}(1111) = 1111 \circ 1,\\
&{\psi}(0111) = 1111 \circ 0,\\
&{\psi}(0011) = 0111 \circ 1,\\
&{\psi}(0001) = 0111 \circ 0,\\
&{\psi}(0000) = 0011 \circ 1,\end{aligned}$$ where we write the concatenation mark $\circ$ only for the sake readability.

The following claim is immediate from the definition of ${\psi}$.

\[claim:mark to infl\] Fix a string $x \in {\{0,1\}^{n}}$. Let $M {\subseteq}[n]$ be the set of marked coordinates in ${{\sf mark}}(x)$. Then,

-   For every $i \in  M$ it holds that ${\psi}(x)_i = x_i$.

-   For every $j \in [n] \setminus M$, the $j^{\text{th}}$ coordinate of ${\psi}(x)$ does not depend on any of the bits $\{x_i\}_{i \in M}$.

We are now ready to prove Theorem \[thm:main\].

Proof of Theorem \[thm:main\] {#sec:finally the proof}
-----------------------------

We first show that ${{\sf maxStretch}}({\psi}) \le 4$. Fix an edge in ${\{0,1\}^{n}}$, that is, take $x \in {\{0,1\}^{n}}$ and $i \in [n]$ such that $x_i = 0$. Our goal is to show that ${{\sf distance}}({\psi}(x), {\psi}(x+e_i)) \leq 4$. Let $y,y' \in {\{0,1,{\sqcup}\}^{n}}$ be the encodings of the chains $C_y, C_{y'}$ that contain $x,x+e_i$ respectively. As mentioned in Section \[sec:the partition\], the output of the algorithm on input $x$ is independent of the order in which the algorithm marks the $10$ pairs. Therefore, given an input $x$, we may perform the marking stage in three steps:

1.  Perform the marking stage on the prefix of $x$ of length $i-1$.

2.  Perform the marking stage on the suffix of $x$ of length $n-i$.

3.  Perform the marking stage on the resulting, partially marked, string.

Since $x$ and $x+e_i$ agree on all but the $i^{\text{th}}$ coordinate, the running of the marking stage in steps 1 and 2 yield the same marking. That is, prior to the third step, the strings $x$ and $x+e_i$ have the same bits marked. Denote by $s \in {\{0,1,\hat{0}, \hat{1}\}^{i-1}}$ and $t \in {\{0,1,\hat{0}, \hat{1}\}^{n-i}}$ the two partially marked strings such that the resulted strings after the second step on inputs $x$ and $x+e_i$ are $s \circ 0 \circ t$ and $s \circ 1 \circ t$ respectively. Let us suppose for concreteness that the string $s$ contains $a$ unmarked zeros and $b$ unmarked ones, and the string $t$ contains $c$ unmarked zeros and $d$ unmarked ones. Recall that at the end of the marking stage, all unmarked zeros are to the left of all unmarked ones in both $s$ and $t$.

By Claim \[claim:mark to infl\], the only coordinates that may contribute to ${{\sf distance}}({\psi}(x),{\psi}(x+e_i))$ are the unmarked coordinates prior to the third step, and so $${{\sf distance}}({\psi}(x),{\psi}(x+e_i)) = {{\sf distance}}({\psi}(0^a 1^b \circ 0 \circ 0^c 1^d),{\psi}(0^a 1^b \circ 1 \circ 0^c 1^d)).    \footnote{Note that ${\psi}$ on the right hand side is applied to inputs of length not necessarily $n$.
    However, for the sake of readability, we do not indicate the input length when applying ${\psi}$.
    In other words, ${\psi}$ is a shorthand for a family of functions $\{ {\psi}_n \}_{n \in {{\mathbb N}}}$.}$$ Therefore, it is enough to bound from above the right hand side by $4$. At this point, it is fairly easy to be convinced that the right hand side is bounded by *some* constant. Proving that the constant is $4$ is done by a somewhat tedious case analysis, according to the relations between $a,b,c$ and $d$. We defer the proof of the following claim to Section \[sec:missing claims\].

\[claim:case analysis1\] For every $a,b,c,d \in {{\mathbb N}}$, we have $${{\sf distance}}({\psi}(0^a 1^b \circ 0 \circ 0^c 1^d),{\psi}(0^a 1^b \circ 1 \circ 0^c 1^d)) \leq 4.$$

This completes the proof for ${{\sf maxStretch}}({\psi}) \le 4$.

We now prove that ${{\sf maxStretch}}({\psi}^{-1}) \le 5$, where we use the description of ${\psi}^{-1}$ given in Equation . In order to bound ${{\sf maxStretch}}({\psi}^{-1})$, let us fix an edge in ${\mathcal{B}_{n}}$, that is, take $z \in {\mathcal{B}_{n}}$ and $i \in [n+1]$ such that $z_i = 0$ and show that ${{\sf distance}}({\psi}^{-1}(z), {\psi}^{-1}(z+e_i)) \leq 5$. By the proof of Claim \[claim:f is a bijection\], if $i=n+1$ then ${\psi}^{-1}(z)$ and ${\psi}^{-1}(z+e_i)$ are consecutive vertices in some monotone symmetric chain, and thus ${{\sf distance}}({\psi}^{-1}(z), {\psi}^{-1}(z+e_i)) = 1$.

Therefore, we shall assume henceforth that $i \neq n+1$. Let $z = x \circ z_{n+1}$ and $z+e_i = (x+e_i) \circ z_{n+1}$ for some $x \in {\{0,1\}^{n}}$ and $z_{n+1} \in \{0,1\}$. Let $y,y' \in {\{0,1,{\sqcup}\}^{n}}$ be the encodings of the chains $C_y, C_{y'}$ that contain $x,x+e_i$ respectively. Similarly to the proof for ${{\sf maxStretch}}({\psi}) \le 4$, we perform the marking stage by first performing the marking stage on the prefix of $x$ of length $i-1$, then perform the marking stage on the suffix of $x$ of length $n-i$, and finally, perform the marking stage on the resulting, partially marked string. Denote by $s \in {\{0,1,\hat{0}, \hat{1}\}^{i-1}}$ and $t \in {\{0,1,\hat{0}, \hat{1}\}^{n-i}}$ the two partially marked strings such that the resulted strings after the second step on inputs $x$ and $x+e_i$ are $s \circ 0 \circ t$ and $s \circ 1 \circ t$ respectively. Suppose again for concreteness that the string $s$ contains $a$ unmarked zeros and $b$ unmarked ones, and the string $t$ contains $c$ unmarked zeros and $d$ unmarked ones.

By Claim \[claim:mark to infl\], the only coordinates that may contribute to ${{\sf distance}}({\psi}^{-1}(z),{\psi}^{-1}(z+e_i))$ are the unmarked coordinates in $s$ and $t$, and so $${{\sf distance}}({\psi}^{-1}(z),{\psi}^{-1}(z+e_i))
    =
    {{\sf distance}}({\psi}^{-1}(0^a 1^b \circ 0 \circ 0^c 1^d \circ z_{n+1}),{\psi}^{-1}(0^a 1^b \circ 1 \circ 0^c 1^d \circ z_{n+1})).$$ Therefore, it is enough to upper bound the right hand side by $5$. We first note that $a+c+1 \le b+d$. To see this recall that $|z| > n/2$ and $0^a 1^b \circ 0 \circ 0^c 1^d$ was obtain from $x = z_1\ldots z_n$ (that is, $z$ without its last bit $z_{n+1}$) by deleting the same number of zeros and ones.

\[claim:case analysis2\] For every $a,b,c,d \in {{\mathbb N}}$ such that $a+c+1 \leq b+d$, and for every $z_{n+1} \in \{0,1\}$ it holds that $${{\sf distance}}({\psi}^{-1}(0^a 1^b \circ 0 \circ 0^c 1^d \circ z_{n+1}),
    {\psi}^{-1}(0^a 1^b \circ 1 \circ 0^c 1^d \circ z_{n+1})) \leq 5.$$

Therefore, by Claim \[claim:case analysis2\] we have ${{\sf maxStretch}}({\psi}^{-1}) \leq 5$. This completes the proof of Theorem \[thm:main\].

Proof of Missing Claims {#sec:missing claims}
-----------------------

We now return to the proofs of Claim \[claim:case analysis1\] and Claim \[claim:case analysis2\].

Let $w = 0^a 1^b \circ 0 \circ 0^c 1^d$ and $w' = 0^a 1^b \circ 1 \circ 0^c 1^d$. We prove the claim using the following case analysis. It will be convenient to introduce the function ${{\sf even}}\colon {{\mathbb N}}\to \{0,1\}$ defined as ${{\sf even}}(n) = 1$ if $n$ is even, and ${{\sf even}}(n) = 0$ otherwise.

#### Case 1 ($\boldsymbol{b = c}$).

In this case we have $w = 0^a \circ 1^{b} 0^{b} \circ 0 1^d$ and $w' = 0^a 1 \circ 1^{b} 0^{b} \circ 1^d$. After the marking stage we get ${{\sf mark}}(w) = {\underline}{0}^a \circ \hat{1}^{b} \hat{0}^{b} \circ {\underline}{0} {\underline}{1}^d$ and ${{\sf mark}}(w') = {\underline}{0}^a {\underline}{1} \circ \hat{1}^{b} \hat{0}^{b} \circ {\underline}{1}^d$. Therefore, $${\psi}(w) = 0^{{{\lfloor\frac{a+1}{2}\rfloor}}} 1^{a-{{\lfloor\frac{a+1}{2}\rfloor}}} \circ 1^{b} 0^{b} \circ 1^{d+1} \circ {{\sf even}}(a+1)$$ and $${\psi}(w') = 0^{{{\lfloor\frac{a}{2}\rfloor}}} 1^{{{\lceil\frac{a}{2}\rceil}}+1} \circ 1^{b} 0^{b} \circ 1^d \circ {{\sf even}}(a).$$ By inspection, one can now easily verify that ${{\sf distance}}({\psi}(w),{\psi}(w')) \le 4$ in this case.

#### Case 2 ($\boldsymbol{b > c}$).

In this case we have $w = 0^a \circ 1^{b-c-1} \circ 1^{c+1} 0^{c+1} \circ 1^d$ and $w' = 0^a \circ 1^{b-c+1} \circ 1^{c} 0^{c} \circ 1^d$. After the marking stage we get ${{\sf mark}}(w) = {\underline}{0}^a {\underline}{1}^{b-c-1} \circ \hat{1}^{c+1} \hat{0}^{c+1} \circ {\underline}{1}^d$ and ${{\sf mark}}(w') = {\underline}{0}^a {\underline}{1}^{b-c+1} \circ \hat{1}^{c} \hat{0}^{c} \circ {\underline}{1}^d$. Therefore, $${\psi}(w) = 0^{{{\lfloor\frac{a}{2}\rfloor}}} 1^{{{\lceil\frac{a}{2}\rceil}} + b-c-1} \circ 1^{c+1} 0^{c+1} \circ 1^d \circ {{\sf even}}(a)$$ and $${\psi}(w') = 0^{{{\lfloor\frac{a}{2}\rfloor}}} 1^{{{\lceil\frac{a}{2}\rceil}} + b-c+1} \circ 1^{c} 0^{c} \circ 1^d \circ {{\sf even}}(a).$$ Therefore, in this case, ${{\sf distance}}({\psi}(w),{\psi}(w')) \leq 1$.

#### Case 3 ($\boldsymbol{b < c}$ and $\boldsymbol{a \geq c-b}$).

In this case we have $w = 0^a \circ 1^b 0^b \circ 0^{c-b+1} \circ 1^d$ and $w' = 0^a \circ 1^{b+1} 1^{b+1} \circ 0^{c-b-1} \circ 1^d$. After the marking stage we get ${{\sf mark}}(w) = {\underline}{0}^a \circ \hat{1}^b \hat{0}^b \circ {\underline}{0}^{c-b+1} {\underline}{1}^d$ and ${{\sf mark}}(w') = {\underline}{0}^a \circ \hat{1}^{b+1} \hat{0}^{b+1} \circ {\underline}{0}^{c-b-1} {\underline}{1}^d$. By the assumption that $a \geq c-b$ we have $a \geq {{\lfloor\frac{a+c-b+1}{2}\rfloor}}$, and so $${\psi}(w) = 0^{{{\lfloor\frac{a+c-b+1}{2}\rfloor}}} 1^{a-{{\lfloor\frac{a+c-b+1}{2}\rfloor}}}
    \circ 1^b 0^b \circ 1^{d+c-b+1} \circ {{\sf even}}(a+c-b+1)$$ and $${\psi}(w') = 0^{{{\lfloor\frac{a+c-b-1}{2}\rfloor}}} 1^{a-{{\lfloor\frac{a+c-b-1}{2}\rfloor}}}
    \circ 1^{b+1} 0^{b+1} \circ 1^{d+c-b-1} \circ {{\sf even}}(a+c-b-1).$$ Therefore, by inspection we have ${{\sf distance}}({\psi}(w),{\psi}(w')) \leq 4$ for this case.

#### Case 4 ($\boldsymbol{b < c}$ and $\boldsymbol{a < c-b}$).

Just like in the previous case, we have ${{\sf mark}}(w) = {\underline}{0}^a \circ \hat{1}^b \hat{0}^b \circ {\underline}{0}^{c-b+1} {\underline}{1}^d$ and ${{\sf mark}}(w') = {\underline}{0}^a \circ \hat{1}^{b+1} \hat{0}^{b+1} \circ {\underline}{0}^{c-b-1} {\underline}{1}^d$. By the assumption that $a < c-b$, we have $a \leq {{\lfloor\frac{a+c-b-1}{2}\rfloor}}$, and so $${\psi}(w) = 0^{a}
    \circ 1^b 0^b \circ 0^{{{\lfloor\frac{a+c-b+1}{2}\rfloor}}-a} 1^{c-b+1+d-{{\lfloor\frac{a+c-b+1}{2}\rfloor}}+a} \circ {{\sf even}}(a+c-b+1)$$ and $${\psi}(w') = 0^{a}
    \circ 1^{b+1} 0^{b+1} \circ 0^{{{\lfloor\frac{a+c-b-1}{2}\rfloor}}-a} 1^{c-b-1+d-{{\lfloor\frac{a+c-b-1}{2}\rfloor}}+a} \circ {{\sf even}}(a+c-b-1).$$ Therefore, in this case, ${{\sf distance}}({\psi}(w),{\psi}(w')) \le 2$.

This completes the proof of Claim \[claim:case analysis1\].

We now turn to the proof of Claim \[claim:case analysis2\].

Let $w = 0^a 1^b \circ 0 \circ 0^c 1^d$ and $w' = 0^a 1^b \circ 1 \circ 0^c 1^d$. Our goal is to show that ${{\sf distance}}({\psi}^{-1}(w \circ z_{n+1}),{\psi}^{-1}(w' \circ z_{n+1})) \leq 5$. Let us suppose for simplicity that $z_{n+1}=1$. The case $z_{n+1}=0$ is handled similarly, and the same bound is achieved. We prove the claim using the following case analysis.

#### Case 1 ($\boldsymbol{b = c}$).

In this case we have $w = 0^a \circ 1^{b} 0^{b} \circ 0 1^d$ and $w' = 0^a 1 \circ 1^{b} 0^{b} \circ 1^d$. After the marking stage we get ${{\sf mark}}(w) = {\underline}{0}^a \circ \hat{1}^{b} \hat{0}^{b} \circ {\underline}{0} {\underline}{1}^d$ and ${{\sf mark}}(w') = {\underline}{0}^a {\underline}{1} \circ \hat{1}^{b} \hat{0}^{b} \circ {\underline}{1}^d$. The assumption $a+c+1 \leq b+d$ implies that in this case we have $d-a-1 \geq 0$. Therefore, $${\psi}^{-1}(w \circ 1) = 0^{a} \circ 1^{b} 0^{b} \circ 0^{a+2} 1^{d-a-1}
$$ and $${\psi}^{-1}(w' \circ 1) = 0^{a+1} \circ 1^{b} 0^{b} \circ 0^{a-1} 1^{d-a+1}.
$$ Therefore, ${{\sf distance}}({\psi}^{-1}(w \circ 1),{\psi}^{-1}(w' \circ 1)) \leq 4$.

#### Case 2 ($\boldsymbol{b < c}$).

In this case we have $w = 0^a \circ 1^{b} 0^{b} \circ 0^{c-b+1} 1^d$ and $w' = 0^a \circ 1^{b+1} 0^{b+1} \circ 0^{c-b-1} 1^d$. After the marking stage we get ${{\sf mark}}(w) = {\underline}{0}^a \circ \hat{1}^{b} \hat{0}^{b} \circ {\underline}{0}^{c-b+1} {\underline}{1}^d$ and ${{\sf mark}}(w') = {\underline}{0}^a \circ \hat{1}^{b+1} \hat{0}^{b+1} \circ {\underline}{0}^{c-b-1} {\underline}{1}^d$. Therefore, $${\psi}^{-1}(w \circ 1) = 0^{a} \circ 1^{b} 0^{b} \circ 0^{a+2(c-b+1)} 1^{d-(a+c-b+1)}
$$ and $${\psi}^{-1}(w' \circ 1) = 0^{a} \circ 1^{b+1} 0^{b+1} \circ 0^{a+2(c-b-1)} 1^{d-(a+c-b-1)}.
$$ Therefore, ${{\sf distance}}({\psi}^{-1}(w \circ 1),{\psi}^{-1}(w' \circ 1)) \le 3$.

#### Case 3 ($\boldsymbol{b > c}$).

In this case, $w = 0^a 1^{b-c-1} \circ 1^{c+1} 0^{c+1} \circ 1^d$ and $w' = 0^a 1^{b-c+1} \circ 1^{c} 0^{c} \circ 1^d$. After the marking stage we get ${{\sf mark}}(w) = {\underline}{0}^a {\underline}{1}^{b-c-1} \circ \hat{1}^{c+1} \hat{0}^{c+1} \circ {\underline}{1}^d$ and ${{\sf mark}}(w') = {\underline}{0}^a {\underline}{1}^{b-c+1} \circ \hat{1}^{c} \hat{0}^{c} \circ {\underline}{1}^d$.

#### Subcase 3.1 ($\boldsymbol{a < b-c}$)

$${\psi}^{-1}(w \circ 1) = 0^{2a} 1^{b-c-a-1} \circ 1^{c+1} 0^{c+1} \circ 1^d$$ and $${\psi}^{-1}(w' \circ 1) = 0^{2a} 1^{b-c-a+1} \circ 1^{c} 0^{c} \circ 1^d.$$ Thus, ${{\sf distance}}({\psi}^{-1}(w \circ 1),{\psi}^{-1}(w' \circ 1)) \le 1$.

#### Subcase 3.2 ($\boldsymbol{a = b-c}$)

$${\psi}^{-1}(w \circ 1) = 0^{2a-1} \circ 1^{c+1} 0^{c+1} \circ 0 1^{d-1}$$ and $${\psi}^{-1}(w' \circ 1) = 0^{2a} 1 \circ 1^{c} 0^{c} \circ 1^{d}.$$ Therefore, in this case, ${{\sf distance}}({\psi}^{-1}(w \circ 1),{\psi}^{-1}(w' \circ 1)) \le 3$.

#### Subcase 3.3 ($\boldsymbol{a > b-c}$)

$${\psi}^{-1}(w \circ 1) = 0^{a+b-c-1} \circ 1^{c+1} 0^{c+1} \circ 0^{a-b+c+1} 1^{d-(a-b+c+1)}$$ and $${\psi}^{-1}(w' \circ 1) = 0^{a+b-c+1} \circ 1^{c} 0^{c} \circ 0^{a-b+c-1} 1^{d-(a-b+c-1)}.$$ Thus, ${{\sf distance}}({\psi}^{-1}(w \circ 1),{\psi}^{-1}(w' \circ 1)) \leq 5$. This completes the proof of Claim \[claim:case analysis2\].

The Mapping $\boldsymbol{{\psi}}$ is Computable in DLOGTIME-uniform ${\mathbf{TC^{0}}}$ {#sec:complexity}
=======================================================================================

In this section we analyze the complexity of the bijection ${\psi}$ described in the proof of Theorem \[thm:main\]. We first claim that each output bit of ${\psi}$ (and of ${\psi}^{-1}$) can be computed in DLOGTIME-uniform ${\mathbf{TC^{0}}}$. In Proposition \[prop:maj leq f\_1\] and in the remark following it, we show that indeed ${\mathbf{TC^{0}}}$ is the “correct” class for ${\psi}$.

#### Proposition \[prop:TC0\] (restated).

[ *The bijections ${\psi}$ and ${\psi}^{-1}$ are computable in DLOGTIME-uniform ${\mathbf{TC^{0}}}$.* ]{}

We prove the proposition only for ${\psi}$. The proof for ${\psi}^{-1}$ is very similar, and we omit it.

We divide the proof into two steps. First we show that the marking stage can be implemented in ${\mathbf{TC^{0}}}$. Then, given the marking of an input, we show how to compute ${\psi}$ in ${\mathbf{TC^{0}}}$. Both steps can be easily seen to be DLOGTIME-uniform.

Throughout the proof, the output of the marking stage is represented by two bits for each coordinate, encoding a symbol in $\{0,1,\hat{0}, \hat{1}\}$, where one bit represents the Boolean symbol, and the other indicates whether the coordinate is marked or not.

#### Implementing the marking stage.

Let $x \in {\{0,1\}^{n}}$. In order to implement the marking stage in ${\mathbf{TC^{0}}}$, we observe that the $i^{\text{th}}$ coordinate in $x$ is marked if and only if there are coordinates $s_i \leq i \leq e_i$ such that

1.  The number of ones in $x_{[s_i,\dots,e_i]}$ is equal to the number of zeros in $x_{[s_i,,\dots,e_i]}$.

2.  For every $k \in \{s_i,,\ldots,e_i\}$, the number of ones in the prefix $x_{[s_i,\dots,k]}$ is greater or equal to the number of zeros in $x_{[s_i,\dots,k]}$.

Fix $i \in [n]$ and fix $s_i, e_i \in [n]$ such that $s_i \le i \le e_i$. Thinking of the bit 1 as ’(’ and 0 as ’)’, the above two conditions are equivalent to checking whether the string $x_{[s_i,\ldots,e_i]}$ of parentheses is balanced, or in other words, deciding whether $x_{[s_i,\ldots,e_i]}$ is in Dyck language. It is well-known that Dyck language can be recognized in ${\mathbf{TC^{0}}}$ [@L77]. In fact, it is not hard to show that deciding whether a string of length $m$ is in Dyck language can be carried out by a DLOGTIME-uniform ${\mathbf{TC^{0}}}$ circuit with size $O(m)$.

Now, for each $i \in [n]$, we go over all choices for $s_i,e_i$ in parallel, and take the $\OR$ of the $O(n^2)$ results. Thus, for each $i \in [n]$, there is a DLOGTIME-uniform ${\mathbf{TC^{0}}}$ circuit with size $O(n^3)$ that decides whether the $i^{\text{th}}$ coordinate is marked or not.

#### Computing $\boldsymbol{{\psi}}(x)$ from ${{\sf mark}}(x)$:

In order to compute ${\psi}(x)$, let ${{\sf mark}}(x) \in {\{0,1,\hat{0}, \hat{1}\}^{n}}$ be the marking of $x$. Since every marked coordinate will remain unchanged, we need to consider only of the unmarked coordinates. Recall also that the unmarked bits form a sequence of zeros followed by a sequence of ones. That is, if we ignore the marked coordinates, then we get a string of the form $0^a1^b$ for some $a=a(x), b=b(x)$, and the output should be $0^{{{\lfloor\frac{a}{2}\rfloor}}}1^{{{\lceil\frac{a}{2}\rceil}}+b} \circ {{\sf even}}(a)$ (recall that ${{\sf even}}(a) = 1$ if $a$ is even, and ${{\sf even}}(a) = 0$ otherwise). This can be implemented as follows.

1.  Let $a$ be the number of unmarked zeros in ${{\sf mark}}(x)$.

2.  For each $i \in [n]$, let $u_i = u_i(x)$ be the number of unmarked coordinates among $\{1,\dots,i\}$.

3.  For all unmarked coordinates $i\in [n]$, if $2u_i<a$, then set the $i^{\text{th}}$ bit of the output to 0. Otherwise, set the $i^{\text{th}}$ bit to $1$.

4.  Set the $(n+1)^{\text{st}}$ bit of the output to ${{\sf even}}(a)$.

It is easy to verify that given ${{\sf mark}}(x)$, checking whether the inequality $2u_i<a$ holds can be done in ${\mathbf{TC^{0}}}$, and so the entire second step can be carried out by a ${\mathbf{TC^{0}}}$ circuit.

We remark that the bijection ${\psi}$ cannot be computed in ${\mathbf{AC^{0}}}$. For example, we prove that the first output bit of ${\psi}$ cannot be computed in ${\mathbf{AC^{0}}}$.

\[prop:maj leq f\_1\] The function ${{\sf majority}}$ is ${\mathbf{NC^{0}}}$-reducible to ${\psi}_1$, i.e., ${{\sf majority}}\leq_{{\mathbf{NC^{0}}}} {\psi}_1$. In particular ${\psi}_1 \notin {\mathbf{AC^{0}}}$.

We first note that ${\psi}_1(x)=0$ if and only if $x_1 = 0$ and ${{\sf mark}}(x)$ contains at least two unmarked zeros. For odd $n$, we construct a reduction $r \colon {\{0,1\}^{n}}\to {\{0,1\}^{3n+1}}$ that for input $x \in {\{0,1\}^{n}}$ outputs a string $r(x) \in {\{0,1\}^{3n+1}}$ as follows. Let $x' \in {\{0,1\}^{2n}}$ be the string obtained from $x$ by replacing each 0 of $x$ with $10$, and by replacing each 1 of $x$ with $00$. Define $r(x) = 0 \circ 1^{n}\circ x'$. For example, if $x = 01101$, then $x' = 10 \circ 00 \circ 00 \circ 10 \circ 00$, and $r(x) = 0 \circ 1^{5} \circ 10 \circ 00 \circ 00 \circ 10 \circ 00$. By the definition of $r$, it is clear that each bit of $r(x)$ depends on at most one bit of $x$. It is straightforward to check that ${{\sf majority}}(x) = {\psi}_1(r(x))$, and the assertion, then, follows.

\[rem:maj leq f\_i\] Note that the redution above also gives ${{\sf majority}}\leq_{{\mathbf{NC^{0}}}} {\psi}_{n+1}$. A similar proof also shows that ${{\sf majority}}\leq_{{\mathbf{NC^{0}}}} {\psi}_i$ for all $i \in [n+1]$.

All But the Last Output Bit Depend Essentially on a Single Input Bit {#sec:f_i = n_i}
====================================================================

In this section we prove Proposition \[prop:f\_i = x\_i\]. We recall it here for convenience.

#### Proposition \[prop:f\_i = x\_i\] (restated).

[ *For all $i \in [n]$ it holds that $${\mathop{\bf Pr\/}}_{x}[{\psi}_i(x) = x_i] > 1 - O(1/\sqrt{n}).$$* ]{}

Before proving the proposition, we need to further study the structure of the De Bruijn-Tengbergen-Kruyswijk partition described in Section \[sec:the partition\]. We start with the following claim.

Let $n$ be an integer, and let ${\ensuremath{\mathcal{P}}}$ be a partition of ${\{0,1\}^{n}}$ into symmetric chains. For every $1 \leq t \leq n+1$, let $M_t$ be the number of symmetric chains of length $t$ in ${\ensuremath{\mathcal{P}}}$. Then, $$M_t = \left\{
      \begin{array}{ll}
        {n \choose \frac{n-t+1}{2}} - {n \choose \frac{n-t-1}{2}} & \hbox{\quad $t \not\equiv n \pmod 2$;} \\
        0 & \hbox{\quad otherwise.}
      \end{array}
    \right.$$

Note first that if $C = \{ c_k, c_{k+1}, \ldots, c_{n-k} \}$ is a symmetric chain, then its length is $n-2k+1$. In particular, this implies that there are no symmetric chains of length $t$ where $t \equiv n \pmod 2$, and hence $M_t=0$ for such $t$.

Next, we prove the claim for $t \not\equiv n \pmod 2$. This is done by backward induction on $t$. For $t=n+1$ we clearly have a unique symmetric chain starting at $0^n$ and ending at $1^n$, and hence $M_{n+1} = 1$, as claimed.

Before actually doing the induction step, let us consider the next case, namely, $t = n-1$. Note that only one of the vertices of Hamming weight $1$ is contained in the unique chain of length $n+1$, and so, since distinct vertices with equal weight are contained in distinct symmetric chains, there are $n-1$ chains with bottom vertex of Hamming weight $1$. Therefore $M_{n-1} = n-1$, as claimed.

For the general induction step, suppose that the claim holds for all $t'$ larger than $t$. We prove the assertion for $t \not\equiv n \pmod 2$. Every symmetric chain of length $t$ must be of the form $C = \{ c_k, c_{k+1}, \ldots, c_{n-k} \}$, where $k = \frac{n-t+1}{2}$. Since the chains of length greater than $t$ are disjoint, and each contains a vertex with Hamming weight $k$, it follows that the number of vertices with Hamming weight $k$ that are contained in chains of length greater than $t$ is $\sum_{t'>t} M_{t'} = {n \choose k-1}$. The remaining ${n \choose k} - {n \choose k-1}$ vertices must be contained in chains of length $t$, and so, since distinct vertices of Hamming weight $k$ are contained in distinct symmetric chains, it follows that there are ${n \choose k} - {n \choose k-1}$ chains of length $t$.

The following corollary is immediate from the observation that any $x \in {\{0,1\}^{n}}$ such that ${{\sf mark}}(x)$ contains exactly $a$ unmarked zeros and $b$ unmarked ones is contained in a unique chain of length $a+b+1$ in the De Bruijn-Tengbergen-Kruyswijk partition.

\[cor:counting 0\^a1\^b\] Let $n,a,b \in {{\mathbb N}}$ such that $a+b \equiv n \pmod 2$, and $a+b \leq n$. Then,

1.  The number of $x \in {\{0,1\}^{n}}$ such that ${{\sf mark}}(x)$ contains exactly $a$ unmarked zeros and $b$ unmarked ones is ${n \choose \frac{n-a-b}{2}} - {n \choose \frac{n-a-b-2}{2}}$.

2.  The number of $x \in {\{0,1\}^{n}}$ such that ${{\sf mark}}(x)$ contains exactly $a$ unmarked zeros (and any number of unmarked ones) is ${n \choose {{\lfloor\frac{n-a}{2}\rfloor}}}$.

We are now ready to prove Proposition \[prop:f\_i = x\_i\].

Let $x \in {\{0,1\}^{n}}$, and let ${{\sf mark}}(x)$ be its marking. Suppose that the unmarked coordinates in ${{\sf mark}}(x)$ are $i_1 < i_2 < \cdots < i_t$, and let $0 \le \ell \le t$ be such that $x_{i_1} = \cdots = x_{i_\ell} = 0$ and $x_{i_{\ell+1}} = \cdots = x_{i_t} = 1$. Note that ${\psi}_i(x) \neq x_i$ if and only if the $i^{\text{th}}$ coordinate is unmarked in ${{\sf mark}}(x)$ and $i = i_j$ for some $j \in \{{{\lfloor\frac{\ell}{2}\rfloor}}+1, \dots, \ell\}$.

As in the proof of Theorem \[thm:main\], it will be convenient to perform the following partial marking of $x$. Let us first perform the marking stage on the prefix of $x$ of length $i-1$, and denote the resulting string by $s \in {\{0,1,\hat{0}, \hat{1}\}^{i-1}}$. Then, perform the marking stage on the suffix of $x$ of length $n-i$ and denote the result string by $t \in {\{0,1,\hat{0}, \hat{1}\}^{n-i}}$. Suppose for concreteness that the string $s$ contains $a$ unmarked zeros and $b$ unmarked ones, and the string $t$ contains $c$ unmarked zeros and $d$ unmarked ones. By the definition of ${\psi}$ we have ${\psi}_i(x) \neq x_i$ if and only if $x_i = 0$, $b = 0$ and $a \ge c$. Therefore, since each bit of $x$ is chosen independently, the resulting partially marked strings $s,t$ and the bit $x_i$ are also independent, and so $${\mathop{\bf Pr\/}}[{\psi}_i(x) \neq x_i] = {\mathop{\bf Pr\/}}[x_i = 0] \cdot {\mathop{\bf Pr\/}}[b = 0,a \geq c]
        = {\frac{1}{2}}\cdot \sum_{k=0}^{n-i} \sum_{j=k}^{i} {\mathop{\bf Pr\/}}[a = j,b=0] {\mathop{\bf Pr\/}}[c = k].$$ By Corollary \[cor:counting 0\^a1\^b\], for $j \not\equiv i \pmod 2$ we have $${\mathop{\bf Pr\/}}[a = j,b=0] = \frac1{2^{i-1}} \cdot \left( {i-1 \choose \frac{i-j-1}{2}} - {i-1 \choose \frac{i-j-3}{2}}\right),$$ and $${\mathop{\bf Pr\/}}[c = k]
        =
        \frac1{2^{n-i}} \cdot {n-i \choose {{\lfloor\frac{n-i-k}{2}\rfloor}}}.$$ Therefore, for every $k \leq i$ we have $$\sum_{j=k}^{i} {\mathop{\bf Pr\/}}[a = j,b=0] =
        \frac1{2^{i-1}} \cdot    \!\!\!\! \sum_{\substack{k \leq j \leq i \\ j \not\equiv i\!\!\!\!\pmod 2}}
                \!\!\left({i-1 \choose \frac{i-j-1}{2}} - {i-1 \choose \frac{i-j-3}{2}}\right)
                = \frac1{2^{i-1}} \cdot {i-1 \choose {{\lfloor\frac{i-k-1}{2}\rfloor}}},$$ and so $${\mathop{\bf Pr\/}}[{\psi}_i(x) \neq x_i]
        \leq
        \frac{1}{2^{n+1}} \cdot \!\!\sum_{k=0}^{\min(i,n-i)}
                    {n-i \choose {{\lfloor\frac{n-i-k}{2}\rfloor}}} {i-1 \choose {{\lfloor\frac{i-k-1}{2}\rfloor}}}.$$ Let us assume that $i \geq n/2$ (the case of $i < n/2$ is handled similarly). Then, using the fact that ${i-1 \choose {{\lfloor\frac{i-k-1}{2}\rfloor}}} \leq O(2^i/\sqrt{i})$ for all $k$, we have $${\mathop{\bf Pr\/}}[{\psi}_i(x) \neq x_i] = O\left(\frac{1}{\sqrt{i}}\right) \cdot
            \frac{1}{2^{n-i}} \cdot \sum_{k=0}^{n-i} {n-i \choose {{\lfloor\frac{n-i-k}{2}\rfloor}}}.$$ By the identity $$\sum_{k=0}^{n-i} {n-i \choose {{\lfloor\frac{n-i-k}{2}\rfloor}}} =
    \sum_{j=0}^{n-i} {n-i \choose j} = 2^{n-i},$$ we get ${\mathop{\bf Pr\/}}[{\psi}_i(x) \neq x_i] = O(1/\sqrt{i})$, and so, since we assumed that $i \geq n/2$ we get that ${\mathop{\bf Pr\/}}[{\psi}_i(x) \neq x_i] = O(1/\sqrt{n})$, as required.

Concluding Remarks and Open Problems
====================================

### Bi-Lipschitz bijection between balanced halfspaces. {#bi-lipschitz-bijection-between-balanced-halfspaces. .unnumbered}

Let $a_0, \ldots, a_n \in {{\mathbb R}}$. The halfspace determined by the $a_i$’s is the set of all points $(x_1, \ldots, x_n) \in \{-1,1\}^n$ such that $a_0 + a_1 x_1 + \cdots + a_n x_n \ge 0$.[^8] A balanced halfspace is a halfspace with $a_0 = 0$. The Boolean cube $\{-1,1\}^n$ embedded in the natural way in $\{-1,1\}^{n+1}$ and the Hamming ball $\{ x \in \{-1,1\}^{n+1} : x_1 + \cdots + x_{n+1} \ge 0 \}$ are two examples of balanced halfspaces. We showed a bi-Lipschitz bijection between them. It is therefore natural to ask the following question.

\[prob:half spaces\] Is there a bi-Lipschitz bijection between *any* two balanced halfspaces? Or even a bijection with constant average stretch from the Boolean cube $\{-1,1\}^n$ to any balanced halfspace in $\{-1,1\}^{n+1}$?

In functions terminology, the Boolean cube $\{-1,1\}^n$ embedded in $\{-1,1\}^{n+1}$ is indicated by the dictator function, while the Hamming ball is indicated by the majority function. Problem \[prob:half spaces\] refers more generally to linear threshold functions. One attempt at solving Problem \[prob:half spaces\] positively, would be to generalize the partition of De Bruijn [et al.]{} to general halfspaces.

Besides being a natural problem, a positive solution to Problem \[prob:half spaces\] may have implications to fully polynomial approximation scheme for counting solutions of the $0$-$1$ knapsack problem [@MS04].

Another interseting problem, inspired by Corollary \[cor:coarse transitivity\], is the following.

\[prob:half spaces coarsely transitive\] Is it true that any halfspace is bi-Lipschitz transitive?

### Tightness of the stretch from the Boolean cube to the Hamming ball. {#tightness-of-the-stretch-from-the-boolean-cube-to-the-hamming-ball. .unnumbered}

One may ask whether the constants $4$ and $5$ in Theorem \[thm:main\] are tight. By a slight variation on the proof of Theorem \[thm:main\], we can show that there exists a bijection ${\phi}\colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ with ${{\sf maxStretch}}({\phi}) \le 3$, improving on Theorem \[thm:main\] in this respect. However, the maximum stretch of ${\phi}^{-1}$ is unbounded.

\[thm:maxstretch 3\] For all even integers $n$, define the bijection ${\phi}\colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ as follows. Let $x \in {\{0,1\}^{n}}$, and let $C = \{ c_k, c_{k+1}, \ldots, c_{n-k}\}$ be the symmetric chain from the partition of De Bruijn [et al.]{}, that contains $x$. Let $j$ be the index such that $x = c_j$. Define, $${\phi}(x) {\stackrel{\rm{def}}{=}}\begin{cases}
                    c_{n-j} \circ 1    & j \le n/2; \\
                    c_{j} \circ 0    &  \text{otherwise}.
                \end{cases}$$ Then, ${{\sf maxStretch}}({\phi}) = 3$ and ${{\sf avgStretch}}({\phi}^{-1}) = 2+o(1)$.

The proof of Theorem \[thm:maxstretch 3\] is similar to the proof of Theorem \[thm:main\], and thus we omit it. One can easily see that any bijection $f \colon {\{0,1\}^{n}}\to {\mathcal{B}_{n}}$ has maximum stretch at least $2$. Indeed, let $y = f(x) \in {\mathcal{B}_{n}}$ be a point with Hamming weight $n/2+1$. Then $y$ has only $n/2$ neighbors in ${\mathcal{B}_{n}}$, which cannot accommodate all $n$ neighbors of $x \in {\{0,1\}^{n}}$. We do not know whether the stretch $3$ of ${\phi}$ in Theorem \[thm:maxstretch 3\] is tight or not, and leave it as an open problem. What is the smallest possible stretch of a bijection from ${\mathcal{B}_{n}}$ to ${\{0,1\}^{n}}$? Are the constants $4$ and $5$ optimal if one considers only bi-Lipschitz bijections? Is the constant $20$ in Corollary \[cor:coarse transitivity\] optimal?

### Lower bounds on average and maximum stretch {#lower-bounds-on-average-and-maximum-stretch .unnumbered}

\[problem:unbounded stretch\] Exhibit an explicit subset $A \subset {\{0,1\}^{n+1}}$ of density $1/2$ such that any bijection $f \colon {\{0,1\}^{n}}\to A$ has ${{\sf avgStretch}}(f) = \omega(1)$, or prove that no such subset exists.

As a concrete candidate, we suggest to consider sets $A = \{x \colon f(x)=1 \}$, where $f$ is a monotone noise-sensitive function (e.g., [Tribes]{}[^9] or [Recursive-Majority-of-Three]{}). A sufficiently strong positive answer to this question would imply a lower bound for sampling the uniform distribution on $A$ by low-level complexity classes.

For maximum stretch, we remark that it is easy to prove a lower bound of $\Omega(\sqrt{n})$. Let $$\begin{aligned}
\mathcal{B}_0 &=& \{ x \in {\{0,1\}^{n+1}} \colon |x| \le (n/2)-c\sqrt{n} \}, \\
\mathcal{B}_1 &=& \{ x \in {\{0,1\}^{n+1}} \colon |x| \ge (n/2)+c\sqrt{n} \}\end{aligned}$$ be two diametrically opposed Hamming balls ($\mathcal{B}_0$ is centered at $0^{n+1}$ and $\mathcal{B}_1$ at $1^{n+1}$), where $c > 0$ is a universal constant chosen so that each set will have density $1/4$ in ${\{0,1\}^{n+1}}$. Let $A = \mathcal{B}_0 \cup \mathcal{B}_1$ be their disjoint union. It is easy to see that any bijection $f \colon {\{0,1\}^{n}} \to A$ must have ${{\sf maxStretch}}(f) = \Omega(\sqrt{n})$. Indeed, since $f^{-1}(\mathcal{B}_0)$ and $f^{-1}(\mathcal{B}_1)$ partition ${\{0,1\}^{n}}$, we may pick an arbitrary edge $(x,y) \in {\{0,1\}^{n}}$ with $x\in f^{-1}(\mathcal{B}_0)$ and $y \in f^{-1}(\mathcal{B}_1)$, and observe that ${{\sf distance}}(f(x),f(y)) \ge 2c\sqrt{n}$. We leave the question of improving this lower bound, or showing that $O(\sqrt{n})$ is tight, as an open problem.

### Bijections from the Gale-Shapley algorithm for the stable marriage problem {#bijections-from-the-gale-shapley-algorithm-for-the-stable-marriage-problem .unnumbered}

Let $A,B$ be two subsets of ${\{0,1\}^{n+1}}$ with density $1/2$. Consider the Gale-Shapley algorithm for the stable marriage problem, where each vertex $v \in A$ ranks all the vertices in $B$ according to their distance to $v$ (breaking ties according some rule). What can be said about the average stretch of the bijection obtained from this algorithm? Two interesting settings are (1) $A = {\{0,1\}^{n}}, B={\mathcal{B}_{n}}$ and (2) $A,B$ are random subsets of ${\{0,1\}^{n}}$ of density $1/2$. For related work in this direction see Holroyd [@Hol]. Another natural bijection to consider, suggested to us by Avishay Tal, is the one induced by the Hungarian method for the assignment problem [@K55].

Acknowledgement {#sec:ack .unnumbered}
===============

We thank Li-Yang Tan for introducing us Problem \[prob:dict to maj\], and for helpful discussions. We also thank Ehud Friedgut for suggesting to use the De Bruijn–Tengbergen–Kruyswijk partition, which turned out to be the key step in the proof of Theorem \[thm:main\]. Itai Benjamini would also like to thank Microsoft Research New England, where this research was started.

[^1]: Faculty of Mathematics and Computer Science, Weizmann Institute of Science, Rehovot, [Israel]{}. [{itai.benjamini,gil.cohen,igor.shinkar}@weizmann.ac.il.]{}

[^2]: The edge boundary of a subset $A\subset {\{0,1\}^{n+1}}$ is set of edges with one endpoint in $A$ and one outside $A$. The vertex boundary of $A$ is the set of vertices outside $A$ that are endpoints of boundary edges.

[^3]: Recall that a subset $A\subset {\{0,1\}^{n+1}}$ is *monotone* if $x \in A$ implies $y \in A$ for all $y\succeq x$.

[^4]: Recall that a $k$-junta is a Boolean function that only depends on at most $k$ of its input bits.

[^5]: We use the following notation: for a string $s \in {\{0,1\}^{n}}$ and integers $i \le j$ in $[n]$, the string $s_{[i,\ldots,j]}$ denotes the substring $s_i s_{i+1} \cdots s_j$.

[^6]: Problem \[problem:embedding into (x,maj(x))\] asks for a function that takes $n-1$ bits as input.

[^7]: This is somewhat implicit in our proofs, and is mentioned here mainly in order to build an intuition.

[^8]: The $\{-1,1\}^n$ representation of the Boolean cube is more natural in the context of halfspaces.

[^9]: We note that [Tribes]{} has density close to $1/2$.
