Boolean expression for a problem

56 Views Asked by At

I want to express problems like this in boolean expression with say $XOR$, or operations etc.

$HD$ = Hamming distance

Say for $HD(2^4, 0000)\geq2\;$ the boolean expression is $$x1 (x2+x3+x4) + x2 (x3+x4) + x3 (x4).$$

For $HD(2^4, 0000)\geq3 \;$ the expression is $$x3 (x1x4+ x1x2+ x2x4).$$

If $n$ and $p$ in $HD(2^n, 0000)\geq p$ vary, is there any general way to express this in a boolean expression like above?

1

There are 1 best solutions below

0
On

The hamming distance ($d_H$) of a bitstring is the total amount(distance) of differences between the bit-states (the addition modulo $2$ sum of all the digits). So if for example we take the $d_H$ of $A=0100_2$ and $B=1010$ we get $3$ as result, because there are three bits that differ between the strings.

To compute the hamming distance using Exclusive-OR (XOR), we do it this way:

$$d_H(a, b) = a \oplus b$$ where $\oplus$ is the XOR-operator. Its the same as addition modulo $2$ of the bits: $(a+b) \bmod 2$.

In regards to $a$ and $b\in\mathbb{Z^+}$, where $a$ lies in the interval between $0$ and $2^n-1$, and $b=0000_2$, $d_H(a, b) > p$ turns us into a problem; The problem is that since $n$ can vary, it could be infinite in theory, and afaik there is no way to express that as a boolean expression. Such an expression would have an infinite amount of variables. You could probably express it as a mathematical function however. I havent done this.

May be worth checking out Zhegalkin polynomial or Galois representation . But I am not sure if those help or will get you somewhere.