16 ms·
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.
by fallingfrog 7y ago
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.
- twic 7y agoThis sounds like the limit of many-valued logic: https://news.ycombinator.com/item?id=20180599 https://news.ycombinator.com/item?id=20180599
- abdullahkhalids 7y agoThe 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 https://en.wikipedia.org/wiki/Cox%27s_theorem
- fallingfrog 7y agoThe 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.