This is a question inspired by a programming problem I've been given, so I need to implement an algorithm. Here I am not asking the complete solution, instead I'd like to get some hints about the possible approaches, or maybe some indications on which area of math / standard algorithms I should study to understand the problem.
I have a set of integers $a_1, a_2, ..., a_n$ and I need to determine whether it's possible to construct another integer $x$ by using $a_i$ and bitwise boolean operations AND, OR, NOT and construct such a formula in case it's possible.
To get away from the terminology of the Computer Science, which is also the reason why I post it on Math.SE, the question calls for many ideas from math. We can consider the integers as the elements of a powerset of the $S = \{1, \dots, 32\} $. So we are given a subset $A \subseteq \mathcal{P}(S)$ and we need to determine whether a given $x \in \mathcal{P}(S)$ belongs to the closure of $A$ under the operations of set union, set intersection and set complement relative to $\mathcal{P}(S)$ or not.
I also think there could be similar representations in terms of boolean algebra and boolean vectors (operations on each component behave like boolean multiplication, addition and negation).
I have an intuition that some of those approaches could help in determining whether there is a solution or not, but I don't know whether one of the could produce a formula, and in this case maybe some algorithmic idea should work provided that there are not so many integers given on input.
Let's fill out each $a_i$ number with $0$'s in the front, so all of them have the same length.
So we have the following bit-vectors (for example):
$$a_1 = 01101001 \\ a_2 = 11100011 \\ a_3 = 00010110 \\ \vdots$$
So the question is: "Can we create each number from $00000000$ to $11111111$ using only $\lor,\land,\lnot$ from these numbers, for example $a_{new}= \lnot a_1 \lor (a_2 \land \lnot a_3) \land \dots$?"
The answer is, well... sometimes. But for that I need to define the field we are working in and precisely what the above notations ($\lor, \land, \lnot$) mean in that field.
Definition: Let $\Bbb{F}_n$ be a field such that it contains all $n$-long bit-representaions for the numbers $\{0,1,\dots,2^n\}$, and I'll define three bitwise operations on it:
$\forall a_1 = (a_1^1 a_1^2 \dots a_1^n)_2 \in \Bbb{F}_n \text{ and} \\ \forall a_2 = (a_2^1 a_2^2 \dots a_2^n) _2\in \Bbb{F}_n$
(where $a = (a^1 a^2 \dots a^n)_2$ is the binary representation of $a$):
We could prove that $(\Bbb{F},\lor,\land,\lnot)$ is a well-defined vector field, so the following method will work:
Since if we can generate $e_1, e_2, \dots, e_n$, we can generate anything with $\lor$'s, for example:
$$a = (11001) = (10000)\lor (01000) \lor (00001).$$
Now the question is: Are the given $a_1,a_2,\dots,a_n$ bitvectors transformable to $e_1,e_2,\dots,e_n$?
Modified Gauss-Jordan elimination for $\Bbb{F}_n$:
A matrix $A$ is given, which we want to transform into $I_n = \begin{bmatrix} e_1 & e_2 & \dots & e_n \end{bmatrix}^T$, using the following steps a finite number of times:
Note, that $\lor$ could potentially lessen the rank of the matrix. However, all the previously mentioned steps preserve the rank of the matrix.
I have also found, that instead of steps $(2)$ and $(3)$ it's usually easier to
Because this is actually very similar to the actual Gauss-Jordan elimination's reduction step, where you transform a given value (or values) in the matrix to $0$.
Example:
$$a_1 = (101) \\ a_2 = (110) \\ a_3 = (011)$$
I'll use steps $(1)$ and $(2 + 3)$ to transform it into the $I_n$ matrix:
$$\begin{bmatrix} 1 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 1 & 1 \end{bmatrix} \stackrel{r_2 \rightarrow r_2 \land \lnot r_1}{\longrightarrow} \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 1 & 1 \end{bmatrix} \stackrel{r_3 \rightarrow r_3 \land \lnot r_2}{\longrightarrow} \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \stackrel{r_1 \rightarrow r_1 \land \lnot r_3}{\longrightarrow} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$$
So in this case, all $3$-long vectors could be generated.
Other theorems could also be proven for $\Bbb{F}_n$:
Okay, so what can be generated from the $a_1,\dots,a_n$ vectors if the above matrix has $rank(A) < n$? In other words, what is $span(a_1,\dots,a_n) = ?$
After doing the entire Gauss-Jordan row-reduction, some columns will be entirely $0$. The digits corresponding to those rows will depend on other columns, depending on the linear correspondance between $a_1,\dots,a_n$.
For example,
$$a_1 = (1101100) \\ a_2 = (0111100)$$
The resulting matrix will be
$$\begin{bmatrix} 1 & 1 & 0 & 1 & 1 & 0 & 0 \\ 0 & 1 & 1 & 1 & 1 & 0 & 0 \end{bmatrix} \stackrel{\dots}{\rightarrow} \begin{bmatrix} 1 & 1 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \end{bmatrix}$$
So only the $3$rd digit will be significantly modifyable, and if we choose a digit from $\{1,2,4,5\}$, the chosen digit will determine all the others from the set, and the ones outside of the set will be opposite of the determined ones.
Unfortunately each case is different, and it's not obvious how this $span(a_1,\dots,a_n)$ subspace will look in general, unless of course $rank(A) = n$, in which case it's the entire bitspace, $\Bbb{F}_n$.
Summary: