I’m working on this problem: Explain how to express $p$ using the boolean connectives AND, OR, and NOT so that the resulting expression has length polynomial in $n$.
$$p(x_1\cdots x_n) = x_1 \oplus x_2 \oplus\cdots \oplus x_n$$
where $\oplus$ is the exclusive-or operator.
I’ve created expressions for $n=3, n=4, n=5$ and $n=6$ in disjunctive normal form (DNF – so using only AND, OR, NOT) and see that the number of terms separated by an OR equals $2^{n-1}$.
Thus, I can see this general pattern in the growth of terms and in the composition of the terms themselves, especially with odd $n$’s and even $n$’s. I’m struggling though to create a generalized expression the XOR with multiple arguments and am slightly confused by the statement that is should have “length polynomial in $n$”.
If this refers to the number of OR separated terms once I reduce it as much as possible, this number will be much greater than $n$, namely $2^{n-1}$, so I don’t think that can be the correct interpretation.
Any guidance on how to think through this problem is greatly appreciated!
It seems the following.
Let $p(n; x_1,\dots, x_n)$ be XOR operator for $x_1,\dots, x_n$, $q(n; x_1, \dots, x_n)$ be XNOR operator for $x_1,\dots, x_n$. Then the required expressions of polynomial length follows from the recurrent formulas:
$$p(2^{n+1}; x_1, \dots, x_{2^{n+1}})=p(2^n; x_1,\dots, x_{2^n})\wedge q(2^n; x_{2^n+1},\dots, x_{2^{n+1}})\vee$$ $$q(2^n; x_1,\dots,x_{2^n})\wedge p(2^n; x_{2^n+1},\dots,x_{2^{n+1}}),$$
$$q(2^{n+1}; x_1,\dots,x_{2^{n+1}})=p(2^n; x_1,\dots,x_{2^n})\wedge p(2^n; x_{2^n+1},\dots, x_{2^{n+1}})\vee$$ $$q(2^n; x_1,\dots,x_{2^n})\wedge q(2^n; x_{2^n+1},\dots,x_{2^{n+1}}).$$
and $$ p(n; x_1\dots x_n)=p(2^k; x_1\dots x_n,0,\dots, 0),$$ where $k$ is the smallest integer such that $2^k\ge n$.