Everything is true to Degrees.
The chief but superficial similarity is that both describe uncertainty with the numbers in the unit interval $[0,1]$
Why does that even matter?
Because everything in the world that isn't classical mathematics is Fuzzy. Fuzzy veganism, fuzzy politics.
Remember the yoga teacher paradox: In a village there is ONE yoga teacher rules are:
Question: Who teaches the Yoga Teacher? or Does the Yoga Teacher Teach Themselves?
Let's assume True -> False
Lets assume False -> True
$ T \rightarrow F$ and $F \rightarrow T$
So. $T = F$
And classical logic says $F = 1 - T$
Thus $T = 1 - T$
or $2T = 1$
Finally $T = \frac{1}{2}$
The truthiness is one-half.
IF temperature IS very cold THEN stop fan
IF temperature IS cold THEN turn down fan
IF temperature IS normal THEN maintain fan
IF temperature IS hot THEN speed up fan
How to add a hobbit an apple.
True & False
False
True | False
True
not True
False
int(True), int(False)
if '':
print "'' is False"
if ' ':
print "' ' is True"
'a' & 'b'
class fuzzy:
value = 0
def __init__(self, value):
if (value >= 0) and (value <= 1):
self.value = value
else:
raise ValueError('{} not in range [0,1]'.format(value))
def __and__(self, other):
if isinstance(other, fuzzy):
return min(self.value, other.value)
if isinstance(other, float):
return min(self.value, other)
def __or__(self, other):
return max(self.value, other.value)
def __neg__(self):
return 1-self.value
pretty_warm = fuzzy(0.1)
ice_cold = fuzzy(0.8)
absolute_zero = fuzzy(1)
pretty_warm | ice_cold
0.8
absolute_zero & ice_cold
0.8
-pretty_warm
0.9
temp = 0.2 and pretty_warm
isinstance(temp, fuzzy)
True
isinstance(pretty_warm, fuzzy)
class FuzzyObj:
def __init__(self, value):
self.value = value
def fuzzy_and(self, fo):
return min(self.value, fo.value)
a = FuzzyObj(1)
b = FuzzyObj(0.5)
a.fuzzy_and(b)
0.5
a & b
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-77-ed983a5ba089> in <module>() ----> 1 a & b TypeError: unsupported operand type(s) for &: 'instance' and 'instance'