What is the algorithm to add up two binary numbers using only boolean operations (negation, conjunction, disjunction) in linear time? Also the program flow needs to be "linear" as well, meaning there can only be assignments involved (no branching).
One example of such program would be Karatsuba's algorithm for multiplying two numbers. Here's the algorithm:
x = a * 2^(n/2) + b
y = c * 2^(n/2) + d
z = x * y = (a * 2^(n/2) + b) * (c * 2^(n/2) + d) = ac * 2^n + (ad + bc) * 2^(n/2) + bc
u = (a + b) (c + d)
v = a * c
w = w * d
z = v * 2^n + (u - v - w) * 2^(n/2) + w // result
Example:
x = 1011, y = 1101
u = (a+b)(c+d) = 101 * 100
v = 10 * 11 = 110
w = b * d = 11 * 01 = 11
z = 110 * 2^4 + (10100 - 110 - 11) * 2^2 + 11 = 10001111
Converting to base ten we would have $z = 143$, which agrees with $x\cdot y = 11\cdot 13$.
With addition we can just XOR everything but I have no idea what to do with the carry, because the 1's won't be contiguously going one after another.
As an example:
x = 101, y = 111
z = (x & ~y) OR (~x & y) = 101 XOR 111 = 010
We can try to get the carry by doing x & y. Then we would get 101 but need to get 11.
That sounds like a simple adder with carry.
If $x = (x_{N-1} \cdots x_0)_2$, $y = (y_{N-1} \cdots y_0)_2$ then $z = x + y = (z_p \cdots z_0)$ via
\begin{align} z_0 &= (x_0 + y_0) \bmod 2 \\ &= X_0 \dot{\vee} Y_0 = (X_0 \wedge \neg Y_0) \vee (\neg X_0 \wedge Y_0) \\ c_0 &= X_0 \wedge Y_0 \\ z_{k+1} &= (x_k + y_k + c_k) \bmod 2 \\ &= (X_k \wedge \neg Y_k \wedge \neg C_k) \vee (\neg X_k \wedge Y_k \wedge \neg C_k) \vee (\neg X_k \wedge \neg Y_k \wedge C_k) \vee (X_k \wedge Y_k \wedge C_k) \\ c_{k+1} &= (X_k \wedge Y_k \wedge \neg C_k) \vee (X_k \wedge \neg Y_k \wedge C_k) \vee (\neg X_k \wedge Y_k \wedge C_k) \vee (X_k \wedge Y_k \wedge C_k) \end{align}