<p>For a function $f:\{0,1\}^n \rightarrow \{0,1\}^m$, let $C(f)$ be the circuit complexity (for concreteness, constants and NOT gates are free, while 2-input AND gates cost 1).</p>

<p>Let $k{\times}f : \{0,1\}^{kn} \rightarrow \{0,1\}^{km}$ be the function which computes $k$ copies of $f$ on independent inputs, so $k{\times}f(x_1, ..., x_{kn}) = (f(x_1, ..., x_n), ..., f(x_{(k-1)n+1}, ..., x_{kn}))$. For instance, $2{\times}{\oplus}(x,y,z,w) = (x\oplus y, z\oplus w)$.</p>

<p>Define the <em>asymptotic mass production complexity</em> of $f$ to be $C_a(f) = \lim_{k\rightarrow\infty} \frac{C(k{\times}f)}{k}$ (since $C(k{\times}f)$ is a subadditive function of $k$, the limit always exists and is equal to the $\inf$). For example, it's possible to show that $C_a(\oplus) = C(\oplus) = 3$. A less trivial example is given by random linear functions: if $f : \mathbb{F}_2^n \rightarrow \mathbb{F}_2^n$ is a random linear function, then $C(f) = \Omega(\frac{n^2}{\log(n)})$ by a standard counting argument, while $C_a(f) \le \frac{C(n{\times}f)}{n} = O(n^{\omega_2-1})$, where $\omega_2 \le \log_2(7)$ is the matrix multiplication constant for $\mathbb{F}_2$.</p>

<p><strong>My question:</strong> Can we prove that for any $f : \{0,1\}^n \rightarrow \{0,1\}^m$, we always have $C_a(f) = O(n+m)$?</p>

<p>There is an easy construction based on sorting networks that shows that $C_a(f) = O(n(n+m))$ - this is off by a factor of $n$ from what I want. In fact, I'll show that $C(2^n{\times}f) = O(n(n+m)2^n)$:</p>

<p>Given $2^n$ input strings $v_0, ..., v_{2^n-1}$ each of length $n$, for each $i &lt; 2^n$ we make a string $X_i$ of length $n+m+1$ by putting $m+1$ $0$s at the end of each $v_i$, and we make a string $Y_i$ of the same length by first encoding $i$ with $n$ binary bits, following this with a $1$, and filling the last $m$ bits with $f(i)$ ($i$ considered as a string of $n$ bits). Then we sort the combined list of $X_i$s and $Y_i$s using a sorting network, keeping track of the result of each comparison - this requires $O(n2^n)$ comparisons, and $O(n+m)$ gates per comparison. After sorting, each $X_i$ is either next to an identical $X_{i'}$ or to some $Y_j$ with $v_i = j$ and with last $m$ bits $f(j) = f(v_i)$, and we can use the $n+1$st bit of each string to tell whether we are looking at an $X_i$ or a $Y_j$. So now we propagate the values $f(v_i)$ to the left with $O(m2^n)$ gates (or if we prefer low-depth circuits, with $n$ layers of $O(m2^n)$ gates using power-of-2 shenanigans). Finally, we unsort, using our record of the comparisons we kept track of during the sorting process, to route each answer to the relevant output gate.</p>

<p>It's plausible that this construction could be improved by using a sorting method which is not based on comparisons, but then I don't see how to unsort at the end. <strong>Edit:</strong> To unsort at the end, we just need to modify the beginning of the strategy by appending $i$ to the end of each $X_i$, making all the strings have length $2n+m+1$, and then finish by sorting based on the last $n$ bits. I tried searching the literature, and eventually found <a href="https://eprint.iacr.org/2018/227.pdf" rel="nofollow noreferrer">this paper</a> which says in the abstract that improving the circuit complexity of sorting to $o(n(n+m)2^n)$ is an open problem.</p>

CC BY-SA 4.0
2018-09-15T04:11:42.330Z
See section 10.2 in Wegener's book:
https://eccc.weizmann.ac.il/resources/pdf/cobf.pdf
Or Meir
CC BY-SA 4.0
2018-09-15T06:40:41.593Z
@OrMeir If you are referring to Uhlig's bound (Theorem 2.3 of that book), as stated there it isn't strong enough to even prove that C_a(f) is at most 2^{n/2}. The issue is that the number of repetitions considered there is subexponential, so the per-copy savings are subexponential as well.
zeb
<cc.complexity-theory><circuit-complexity><sorting>
Asymptotic complexity of mass production
zeb
# Asymptotic complexity of mass production

(Asked by: username_0 on 2018-09-13)

For a function $f:\{0,1\}^n \rightarrow \{0,1\}^m$, let $C(f)$ be the circuit complexity (for concreteness, constants and NOT gates are free, while 2-input AND gates cost 1).

Let $k{\times}f : \{0,1\}^{kn} \rightarrow \{0,1\}^{km}$ be the function which computes $k$ copies of $f$ on independent inputs, so $k{\times}f(x\_1, ..., x\_{kn}) = (f(x\_1, ..., x\_n), ..., f(x\_{(k-1)n+1}, ..., x\_{kn}))$. For instance, $2{\times}{\oplus}(x,y,z,w) = (x\oplus y, z\oplus w)$.

Define the *asymptotic mass production complexity* of $f$ to be $C\_a(f) = \lim\_{k\rightarrow\infty} \frac{C(k{\times}f)}{k}$ (since $C(k{\times}f)$ is a subadditive function of $k$, the limit always exists and is equal to the $\inf$). For example, it's possible to show that $C\_a(\oplus) = C(\oplus) = 3$. A less trivial example is given by random linear functions: if $f : \mathbb{F}\_2^n \rightarrow \mathbb{F}\_2^n$ is a random linear function, then $C(f) = \Omega(\frac{n^2}{\log(n)})$ by a standard counting argument, while $C\_a(f) \le \frac{C(n{\times}f)}{n} = O(n^{\omega\_2-1})$, where $\omega\_2 \le \log\_2(7)$ is the matrix multiplication constant for $\mathbb{F}\_2$.

**My question:** Can we prove that for any $f : \{0,1\}^n \rightarrow \{0,1\}^m$, we always have $C\_a(f) = O(n+m)$?

There is an easy construction based on sorting networks that shows that $C\_a(f) = O(n(n+m))$ - this is off by a factor of $n$ from what I want. In fact, I'll show that $C(2^n{\times}f) = O(n(n+m)2^n)$:

Given $2^n$ input strings $v\_0, ..., v\_{2^n-1}$ each of length $n$, for each $i < 2^n$ we make a string $X\_i$ of length $n+m+1$ by putting $m+1$ $0$s at the end of each $v\_i$, and we make a string $Y\_i$ of the same length by first encoding $i$ with $n$ binary bits, following this with a $1$, and filling the last $m$ bits with $f(i)$ ($i$ considered as a string of $n$ bits). Then we sort the combined list of $X\_i$s and $Y\_i$s using a sorting network, keeping track of the result of each comparison - this requires $O(n2^n)$ comparisons, and $O(n+m)$ gates per comparison. After sorting, each $X\_i$ is either next to an identical $X\_{i'}$ or to some $Y\_j$ with $v\_i = j$ and with last $m$ bits $f(j) = f(v\_i)$, and we can use the $n+1$st bit of each string to tell whether we are looking at an $X\_i$ or a $Y\_j$. So now we propagate the values $f(v\_i)$ to the left with $O(m2^n)$ gates (or if we prefer low-depth circuits, with $n$ layers of $O(m2^n)$ gates using power-of-2 shenanigans). Finally, we unsort, using our record of the comparisons we kept track of during the sorting process, to route each answer to the relevant output gate.

It's plausible that this construction could be improved by using a sorting method which is not based on comparisons, but then I don't see how to unsort at the end. **Edit:** To unsort at the end, we just need to modify the beginning of the strategy by appending $i$ to the end of each $X\_i$, making all the strings have length $2n+m+1$, and then finish by sorting based on the last $n$ bits. I tried searching the literature, and eventually found [this paper](https://eprint.iacr.org/2018/227.pdf) which says in the abstract that improving the circuit complexity of sorting to $o(n(n+m)2^n)$ is an open problem.

**Tags:** cc.complexity-theory, circuit-complexity, sorting

> **Comments:**
> **username_1**: See section 10.2 in Wegener's book: https://eccc.weizmann.ac.il/resources/pdf/cobf.pdf  
> **username_0**: @OrMeir If you are referring to Uhlig's bound (Theorem 2.3 of that book), as stated there it isn't strong enough to even prove that C_a(f) is at most 2^{n/2}. The issue is that the number of repetitions considered there is subexponential, so the per-copy savings are subexponential as well.  

---

## 0 answers

