News for hackers. Stuff that matters.
Re:Universal Logic Gates (2015) by fallingfrog on Monday June 17, 2019 @08:38AM (#20202259)
You can almost make a continuous variable version of all the logic gates, for variables A and B which are between 0 and 1, but I couldn't quite get it to work. I tried: (I'm using => to mean "maps to")

!A => 1 - A

A && B => AB

A || B => A + B - AB

If you do this, some of the rules of logic work fine:

!(!A && !B) => 1 - ((1 - A)(1 - B)) = A + B - AB, which is the same as the expression for A || B.

But A && A obviously doesn't work, you get A^2 instead of just A.

And to relate this to the article, the rule to convert NAND into OR doesn't work either, you get

(A NAND A) NAND (B NAND B) => 1 - ((1 - A^2) * (1 - B^2)) = A^2 + B^2 - (AB)^2

Now all of these do evaluate to the right answer when A and B are either 0 or 1 but not when they are some value in between.

You can also try letting A && B => sqrt(AB) but you get similar issues.

Re:Universal Logic Gates (2015) by abdullahkhalids on Monday June 17, 2019 @09:54AM (#20202950)
The generalization of continuous variable version of boolean logic can be achieved in various ways as far as I know. One way is Cox's theorem [1], which forms the basis of Bayesian probability theory, and will give you consistent logic and reduces to the standard rules of boolean logic in the limit of 0/1.

[1] https://en.wikipedia.org/wiki/Cox%27s_theorem

Re:Universal Logic Gates (2015) by fallingfrog on Monday June 17, 2019 @11:12AM (#20203745)
The way I came up with my attempt was just to notice that when you are looking at the probability of two independent events happening together, you multiply them; and if you want the probability of A or B or both, you add them and then subtract the probability of (A and B). I guess the reason the multiplication rule doesn’t work for (A && A) is that those two variables are clearly not independent, since they’re the same variable.
Re:Universal Logic Gates (2015) by twic on Monday June 17, 2019 @08:57AM (#20202422)
This sounds like the limit of many-valued logic:

https://news.ycombinator.com/item?id=20180599