1
$\begingroup$

The other day I was playing around with some equations I wanted to combine and came across this problem : Let's say I have two mathematical quantities $A,B \in \mathbb{R}$. Both can be either $= 0$ or $\neq 0$. Let's define the value $\textsf{true}$ to be "$\neq 0$" and $\textsf{false}$ to be "$=0$". So $A$ and $B$ now represent boolean value.

It is easy to mathematically simulate the AND operator by multiplying $A \cdot B$ since $A\cdot B\neq 0 = \textsf{true}$ iff $A \neq 0 = \textsf{true}$ and $B \neq 0 = \textsf{true}$

But how can we simulate the OR operator using only standard functions. (Typically not "case"-functions or piecewise-function) ?

I was thinking about using DeMorgan's Law and writing $A\vee B = \neg(\neg A \wedge \neg B)$, but now we need to mathematically write "$\neg$". The hard part here is that $\textsf{true}$ can be any number except $0$, not a fixed one. I also tried to "normalize" the variable, for example by dividing it by itself but this then raises the problem of $0/0$ for $\textsf{false}$ variable. Ideally we would need an operation $F$ such that $$ F(A) = \begin{cases} C & \text{if } A \neq 0 \\ 0 & \text{else} \end{cases} $$ (for some constant $C$).

Then $\neg A$ would simply be $C-F(A)$.

Thanks :)

$\endgroup$
  • $\begingroup$ Do you actually need every nonzero value to be recognized as "true"? That's going to make it difficult to find a natural arithmetic representation of negation because negation would need to be discontinuous at $0$, which probably won't be possible in a way that will satisfy your ambition of avoiding definitions by cases. On the other hand, representing truth by $1$ always (and falsehoods by $0$) would allow all the boolean operations to be simple polynomials. $\endgroup$ – hmakholm left over Monica Apr 3 '17 at 9:47
  • 1
    $\begingroup$ You can write things like $$ \mathit{Neg}(A) = \left\lfloor \frac{1}{1+A^2} \right\rfloor $$ where $\lfloor \cdots\rfloor$ is the integer-part function -- but that doesn't really seem to have any real advantages over an honest definition by cases. $\endgroup$ – hmakholm left over Monica Apr 3 '17 at 9:49
  • $\begingroup$ Or even $$ \mathit{Neg}(A) = \lim_{n\to \infty} e^{-nA^2} $$ which is better at avoiding definition by cases, but even worse at conveying understanding of what you do. $\endgroup$ – hmakholm left over Monica Apr 3 '17 at 9:53
  • $\begingroup$ @HenningMakholm Yes, you're right, negation might be really hard to achieve using "standard" functions. So we are stuck with AND and OR :| $\endgroup$ – Zubzub Apr 3 '17 at 10:15
4
$\begingroup$

Note that the problem disappears when you consider only non-negative real numbers instead of all real numbers: in that case you could just use '$+$' for OR.

So one way of reducing your situation to this one is by squaring the variables before adding them: $x \vee y := x^2 + y^2$.

(Perhaps you heard about the polynomial in 26 variables whose only output (if you feed it 26 integers) are prime numbers? It was produced by translating the concept of 'being a prime number' to relations between polynomials in pretty much the same way we are discussing here.)

EDITTED IN: a bit more about the prime polynomial can be found here: https://mathoverflow.net/q/132954/41139. Apparently I misremembered and the output (on integer inputs) may be either a negative number or a prime number but it is still pretty amazing that whenever the outcome is positive it is prime (and every prime appears in this way).

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ You are a second faster than I. Very good ;) $\endgroup$ – Lieuwe Vinkhuijzen Apr 3 '17 at 9:05
  • 1
    $\begingroup$ Of course... I feel dumb now... Thanks for your answer and thanks even more for the anecdote ! $\endgroup$ – Zubzub Apr 3 '17 at 10:09
1
$\begingroup$

Extra answer:

Use $ X \vee Y = |X|+|Y| $ where $ |X| $ is the absolute value of X

Simulating logical NOT can be done like this:

$ \neg A = 1 -sign(|A|)$

hope that helps.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Try to simply add "\$" before and after mathematical statement, use "\vee" for the logical disjunction and "\neg" for the NOT operator :) $\endgroup$ – Zubzub Apr 3 '17 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.