4. For a given positive integer $n$. Try to find the smallest positive integer $d_{n}$ that cannot be expressed in the form $\sum_{i=1}^{n}(-1)^{a_{i}} \times 2^{b_{i}}$, where $a_{i} 、 b_{i}(i=1,2, \cdots, n)$ are all non-negative integers.
4. For any positive integer $p$, let $t(p)$ denote the smallest value of the positive integer $n$ when $p$ can be expressed in the form given in the problem, and call this representation the "minimal representation" of $p$.
(1) If $p$ is even.
Then in any representation that yields $p$, the number of 0s in $b_{i}(i=1,2, \cdots, n)$ should be even. If the number of 0s in $b_{i}(i=1,2, \cdots, n)$ is not 0, then there must be at least two $b_{i}=0$. By removing these two terms (when the corresponding $a_{i}$ have opposite parity) or replacing these two terms with one term where $b_{i}=1$ (when the corresponding $a_{i}$ have the same parity), the number of terms in the expression can be reduced. Therefore, the minimal representation of $p$ cannot contain terms where $b_{i}=0$. At this point, dividing all terms in the sum by 2, we get $t(2 m)=t(m)$.
(2) If $p$ is odd.
In the sum, there must be at least one term where $b_{i}=0$. Removing this term yields a representation of $p-1$ or $p+1$, thus,
$$
\begin{array}{l}
t(2 m-1)=1+\min (t(2 m-2), t(2 m)) \\
=1+\min (t(m-1), t(m)) . \\
\text { Let } d_{n}=\frac{2^{2 n+1}+1}{3}, c_{n}=\frac{2^{2 n}-1}{3} \text {. Then } \\
d_{0}=c_{1}=1 . \\
\text { Hence } t\left(d_{0}\right)=t\left(c_{1}\right)=1, \text { and } \\
t\left(d_{n}\right)=1+\min \left(t\left(d_{n-1}\right), t\left(c_{n}\right)\right), \\
t\left(c_{n}\right)=1+\min \left(t\left(d_{n-1}\right), t\left(c_{n-1}\right)\right) .
\end{array}
$$

Thus, by mathematical induction,
$$
t\left(c_{n}\right)=n, t\left(d_{n}\right)=n+1 \text {. }
$$

This shows that $d_{n}$ cannot be represented with $n$ terms.
Next, we use mathematical induction on $n$ to prove that any number less than $d_{n}$ can be represented with no more than $n$ terms.
When $n=1$, the conclusion is obviously true.
Assume that any number less than $d_{n}$ can be represented with no more than $n$ terms.

By the induction hypothesis, we only need to prove that adding a summand to some integer $q \in\left(-d_{n-1}, d_{n-1}\right)$ yields any integer $p$ in the interval $\left[d_{n-1}, d_{n}\right)$.
If $c_{n}+1 \leqslant p \leqslant d_{n-1}$, consider the summand $2^{2 n-1}$ to get
$$
\begin{array}{l}
\iota(p) \leqslant 1+t\left(1 p-2^{2 n-1} \mid\right) . \\
\text { Also, } d_{n}-1-2^{2 n-1}:=2^{2 n-1}-\left(c_{n}+1\right)=d_{n-1}-1,
\end{array}
$$

Combining the induction hypothesis, we know $t(p) \leqslant n$.
If $d_{n-1} \leqslant p \leqslant c_{n}$, consider the summand $2^{2 n-2}$ to get
$$
\begin{array}{l}
t(p) \leqslant 1+t\left(\left|p-2^{2 n-2}\right|\right) . \\
\text { Also, } c_{n}-2^{2 n-2}=2^{2 n-2}-d_{n-1}=c_{n-1}<d_{n-1},
\end{array}
$$

Similarly, $t(p) \leqslant n$.
In summary, the smallest positive integer $d_{n}=\frac{2^{2 n+1}+1}{3}$.