XOR operation inner-product proof Consider the binary power set $\underline{K}$ which contains binary strings of length $N$.
Example: Let $N=3$, we then have $$\underline{K} = \big\{\{000\},\{100\},\{010\},\{001\},\{110\},\{101\},\{011\},\{111\} \big\}.$$ Now consider two vector states defined by the linear combinations of the tensor product of two-level basis vector states (where $k_i \in \{0,1\}$)
\begin{align}
|\psi\rangle:= \sum_{\underline{K} }\prod_{l<j}^{N}e^{i k_l k_j }|k_1\cdot\cdot\cdot k_N \rangle
\end{align}
and
\begin{align}
|\phi_m\rangle:= \sum_{\underline{K} }\prod_{l<j}^{N}e^{i k_l k_j }|\underbrace{k_1 \oplus 1\cdot\cdot\cdot k_m \oplus 1 }_{m}\cdot \cdot \cdot\ k_N \rangle,
\end{align}
where the XOR binary operation denoted $\oplus$ maps $|0\rangle \mapsto |1\rangle$ and $|1\rangle \mapsto |0\rangle$. I am interested in an analytic form of the inner-product $$\langle \phi_m|\psi\rangle$$ for $m \in \{ 1,..., N-1\}$.
For $m=1$, you can arrange the power-set $\underline{K}$ in pairs such that the general form is easy to derive.
Example: Let $N = 3$, we can rearrange $\underline{K} = \big\{\{000\},\{100\},\{010\},\{110\},\{001\},\{101\},\{011\},\{111\} \big\}$ (now the adjacent pairs of $\underline{K}$ transform into each other with the XOR operation) this yields inner-product $\langle \phi_m|\psi\rangle = (1+1)+3(e^{-i}+e^{i}) + 3(e^{-2 i} + e^{2i}) + (e^{-3 i}+e^{3 i})$. Hence when we generalize to $N$ we obtain $$\langle \phi_1|\psi\rangle = \sum_{k=0}^{N-1}\binom{N-1}{k}(e^{ik}+e^{-ik}).$$
It can also be shown that for $m=2$ we obtain the rows of Pascal's triangle which allows us to write $$\langle \phi_2|\psi\rangle = \sum_{k=0}^{N-2}\binom{N-2}{k}(e^{i(2k+1)}+e^{-i(2k+1)}) + 2^{N-2}$$
After this there is no clear pattern, hence I'm having difficulty finding the analytic form of the remaining $m \in \{3,...,N-1\}$ cases (for $N>3$) required to derive the general analytic form of $\langle \phi_m|\psi\rangle $.
Any assistance would be appreciated, thanks.
 A: By definition, $$|\psi\rangle = \sum_{\underline K}\prod_{l<j}e^{ik_lk_j}|k_1\cdots k_N\rangle = \sum_{\underline K}\exp\left(\sum_{l<j}ik_lk_j\right)|k_1\cdots k_N\rangle.$$ Similarly $$|\phi_m\rangle = \sum_{\underline K}\exp\left(\sum_{l<j}ik_lk_j\right)|k_1\oplus1\cdots k_m\oplus1k_{m+1}\cdots k_N\rangle$$.
Let $$q_l = \begin{cases} k_l\oplus1 & 0 \le l \le m \\ k_l & m < l \le N\end{cases},$$ we have $$|\phi_m\rangle = \sum_{\underline K}\exp\left(\sum_{l<j}iq_lq_j\right)|k_1\cdots k_N\rangle.$$  Thus
$$\langle\phi_m|\psi\rangle = \sum_{\underline K} \exp\left(i\sum_{l<j}(k_lk_j - q_lq_j)\right)\qquad(1).$$
Using the fact that $q_l = k_l$ for $l > m$ and $k_l-k_l\oplus1 = -(-1)^{k_l}$, then
$$\sum_{l<j}(k_lk_j - q_lq_j) = \sum_{l=1}^m\sum_{j=l+1}^m(k_lk_j-q_lq_j) - \sum_{l=1}^m(-1)^{k_l}\sum_{j=m+1}^Nk_j.$$
This gives us
$$\langle\phi_m|\psi\rangle = \sum_{\underline K}\exp\left[i\left(\sum_{l=1}^m\sum_{j=l+1}^m(k_lk_j-q_lq_j) - \sum_{l=1}^m(-1)^{k_l}\sum_{j=m+1}^Nk_j\right)\right]\qquad (2)$$
Updated here:
Note that $k_lk_j-q_lq_j = -((-1)^{k_l}+(-1)^{k_j})/2$, we can rewrite Eq. (2) as
$$\langle\phi_m|\psi\rangle
= \sum_{\underline K}\exp\left[-i\left(\frac12\sum_{l=1}^m\sum_{j=l+1}^m\left((-1)^{k_l}+(-1)^{k_j}\right)+\sum_{l=1}^m(-1)^{k_l}\sum_{j=m+1}^Nk_j\right)\right] \\
= \sum_{\underline K}\exp\left[-i\sum_{l=1}^m(-1)^{k_l}\left(\frac{m-1}2+\sum_{j=m+1}^Nk_j\right)\right] \\
= \sum_{a=0}^{N-m}\sum_{b=0}^mC_{N-m}^aC_m^be^{-i(2b-m)\left(\frac{m-1}2+a\right)}\qquad (3)$$
The last equality follows that $\sum_{j=m+1}^Nk_j$ take value $a$ for $C_{N-m}^a$ times, and $\sum_{l=1}^m(-1)^{k_l}$ takes value $2b-m$ for $C_m^b$ times.
Case $m = 1$:
$$\langle\phi_1|\psi\rangle = \sum_{a=0}^{N-1}C_{N-1}^a\left(e^{ia} + e^{-ia}\right)$$
Case $m = 2$:
From Eq. (2), we have
$$\langle\phi_2|\psi\rangle = \sum_{\underline K}\exp\left[i\left(k_1k_2-q_1q_2-((-1)^{k_1}+(-1)^{k_2})\sum_{j=3}^Nk_j\right)\right] \\
 = \sum_{k_3\cdots k_N} \exp\left[-i(1+2\sum_{j=3}^Nk_j)\right] + 2\sum_{k_3\cdots k_N}e^0 + \sum_{k_3\cdots k_N} \exp\left[i(1+2\sum_{j=3}^Nk_j)\right] \\
= 2^{N-1} + \sum_{a=0}^{N-2}C_{N-2}^a\left(e^{(2a+1)i}+e^{-(2a+1)i}\right).$$
From Eq. (3), we arrive the same result
$$\langle\phi_2|\psi\rangle = \sum_{a=0}^{N-2}\sum_{b=0}^2C_{N-2}^aC_2^be^{-i(2b-2)\left(\frac12+a\right)}= 2^{N-1} + \sum_{a=0}^{N-2}C_{N-2}^a\left(e^{(2a+1)i}+e^{-(2a+1)i}\right).$$
Case $m=3$:
$$\langle\phi_3|\psi\rangle =\sum_{a=0}^{N-3}\sum_{b=0}^3C_{N-3}^aC_3^be^{-i(2b-3)(1+a)} \\
= \sum_{a=0}^{N-3}\left(e^{3(a+1)i} + 3e^{(a+1)i}+3e^{-(a+1)i}+e^{-3(a+1)i}\right)$$
