In the paper Homomorphic Encryption from Learning with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based Gentry introduces the following identity $\mathbf{a} \in \mathbb Z^n,\mathbf{b} \in \mathbb Z_q^n$
$$\langle \mathbf{a}, \text{PowersOfTwo}(\mathbf{b})\rangle =\langle \text{BitDecomp}^{-1}(\mathbf{a}), \mathbf{b}\rangle = \langle \text{Flatten}(\mathbf{a}), \text{PowersOfTwo}(\mathbf{b})\rangle$$
The given functions are defined as follows using Brakerski (2012) complementary
Let $l = \lfloor \log_{2} q \rfloor +1$
PowersOfTwo Let $\mathbf{b} \in \mathbb{Z}_{q}^n$ and $l \in \mathbb{Z}$, then $$\text{PowersOfTwo}(\mathbf{b}):=\Big(\mathbf{b}, 2 \cdot \mathbf{b}, \dots, 2^{l-1}\cdot \mathbf{b}\Big)$$
BitDecomp For $\mathbf{a} \in \mathbb{Z}^n$ let $\mathbf{w}_{i}\in\{ 0,1 \}^n$ such that $$\mathbf{a}= \sum_{i=0}^{l-1} 2^i \cdot \mathbf{w}_{i} \;\;(\text{mod } q)$$ and outputting the determined coefficients $\mathbf{w}_{i}$ with $0 \leq i \leq l-1$ $$\text{BitDecomp}(\mathbf{a}) := (\mathbf{w}_{0}, \dots, \mathbf{w}_{l-1})$$
Flatten
Let $\mathbf{b} \in \mathbb{Z}^n$, then $$\text{Flatten}(\mathbf{b}):= \text{BitDecomp}\Big(\text{BitDecomp}^{-1}(\mathbf{b})\Big)$$
Using information from this math.stackexchange answer on the extension of the codomain of BitDecomp on $\mathbf w_i \in \mathbb Z^n$, I try to see how these identities hold. So far I got the following
$$\begin{alignat}{2} \left\langle \mathbf{a}\,,\, \text{PowersOfTwo}(\mathbf{b}) \right\rangle &= \sum_{i=0}^{n-1} a_{i} \cdot 2^{i} b_{i} &&\;\;(\text{mod } q) \\ &= \sum_{i=0}^{n-1} 2^ia_{i} \cdot b_{i} &&\;\;(\text{mod } q) \\ &= \left\langle \text{BitDecomp}^{-1}(\mathbf{a})\,,\, \mathbf{b}\right\rangle &&\;\;(\text{mod } q) \end{alignat}$$
Now somehow the $a_i$ must be reduced by the binary transformation, but I don't see how to justify this mathematically. I would be greatful for a bump into the right direction. More specifically, how to finish this proof to get the second part of the identity?