A polynomial function representing Logical OR

165 Views Asked by At

Is there a way to represent logical OR function of two or more variables as a polynomial/value function.

So that the $f(x,y)>0$ if $\text{OR}(x,y)>0$.

Additional Edit: Considering $\geqslant 0$ means TRUE, and $<0$ means FALSE. For both the variables and the function. i.e in case $x>0$ and $y<0$, $\text{OR}(x,y)>0$ but $f(x,y)$ might depend on the relative magnitudes of $x$ and $y$.

3

There are 3 best solutions below

0
On BEST ANSWER

The function \begin{equation} f(x,y)=\frac{x}{|x|}+\frac{y}{|y|}, \end{equation}

  • Is greater than or equal to $0$ when $x<0$ is and $y\geq0$.
  • It is also negative when both of $x<0$ and $y<0$.
  • It is positive when $x\geq0$ and $y\geq0$.

This satisfies the requirements of logic OR where $f(x,y)\geq 0$ corresponds to true, and $f(x,y)<0$ corresponds to false.

0
On

Yes: $OR(x,y)=1-(1-x)(1-y)$. Assuming $0$ is false and $1$ is true.

1
On

The polynomial $f(x,y) = x + xy + y \mod 2$ works.