Proof of Negative Negabinary addition formula

647 Views Asked by At

I'm trying to understand why the following is true:

Given the following $n$-bit negabinary number $x_{n-1}x_{n-2}...x_1x_0$ where $x_i \in \text{{0, 1}}$.

A negabinary number's decimal value is equal to $\sum\limits_{i=0}^n x_i(-2)^i$ and a binary number's decimal value is equal to $\sum\limits_{i=0}^n x_i2^i$

We are given the functions $f$ and $g$, where $f(x) = \overline{x_{n-1}}x_{n-2}...\overline{x_1}x_0$ and $g(x) = x_{n-1}\overline{x_{n-2}}...x_1\overline{x_0}$

And:

$\overline{x_i} = 1 - x_i$ (the logical NOT operator)
'$+$' is binary addition, giving a binary number.

Now the following is true:

$-(a+b) = g(f(a) + f(b) + 1)$

Note: both the inputs $a$ and $b$ and the output $-(a+b)$ are in negabinary.

How to proof that this identity holds?