The fuzzy response

The problem of managing the situations described in the previous paragraph in a formal way have been addressed by several scholars and generally we now to talk about fuzzy logic, or in this case fuzzy sets, thanks to the work of the Iranian mathematician Lotfi Asker Zadeh who described them for the first time in 1964.
The goal of fuzzy logic is to overcome the limitation of the classical logic of only referring to the two extremes of reality, true or false, ignoring that the actual variables are generally quantities that can assume infinite values in a range of variation.
These quantities are the vague ones.
I wore a big hat; Maria is a bit chatty; today I have little luck.
In all these examples we made use of modifiers (big, a bit, little) that are red flags for the presence of vagueness.
If it can be clearly identified the fact that the hat is being worn or not, that Mary is able to speak or that I can win at poker, it is very difficult to define how big my hat is, or the entity of the words flow that comes out of Mary’s mouth or worse yet if three aces in a poker hand is a winning score or not!

This problem of identifying vague concepts is not exclusive to cases of daily life, since even in the most exact science we are forced to deal with it. For example, all theories of classical mechanics are strictly wrong because they do not take into account the corrections brought by relativistic mechanics. But we also know that at small speeds compared to the speed of light, these effects are not noticeable. And then we can happily continue to use classical mechanics as if were nothing. But how small? Once again a vague concept, for which, strictly speaking, we should give a definition.

The fuzzy logic provides the means to operate with quantities that may have any values within a scale. Let’s find out what this is about with an example. We want to build a smart thermostat and provide it with a operative logic that allows it to distinguish three levels of temperature: high, medium, and low. A traditional logic approach defines these sets precisely. For example: low temperature below 15°C, average temperature between 15°C and 25°C and high temperature above 25°C. So, how should the thermostat behave if the temperature is only 25.1°C? Surely doesn’t make sense to consider “high” this temperature and yet it is just what our thermostat would do, according to the given definitions.
To overcome this obstacle we must abandon the idea that a temperature value belongs exclusively to one of the three sets, but may have a “degree of membership“, ranging from 0 to 1, different for each set. This expressly violates the “principle of the excluded middle” of traditional logic. In the example above, the temperature of a room at 19°C might belong with a degree of truth of 0.8 to “average temperature” and 0.2 to “hot temperature”. We can easily represent the situation as follows:

The set of low temperatures will contain in its definition the membership function, which above we represented with a graph. So it is the for other sets, which in this way are no longer sets in the traditional sense, but become “fuzzy” sets.
Even in the logic you need to make adjustments to handle these new blurred objects.

Traditional operators AND, OR and NOT are redefined as follows:

NOT x = (1-v(x))
x AND y = min (v(x), v(y))
x OR y = max (v(x), v(y))

Where with v(x) we have indicated the membership function, applied to the quantity x.

So the problem of boundary between the bald and the haired person, with which Eubulid crushed Aristotelian logic, is now spread in a fading line by means of the membership function.
Certainly, at the beginning we have some precise temperature values and at the output our thermostat will have to be switched on or off without ambiguity.
These traditional binary values are called “crisp” in the fuzzy logic jargon. Then you need to operate a fuzzification of the input and a defuzzification of the output, allowing the two worlds to talk and transform crisp values into fuzzy values and vice versa.
The real step forward, compared to the traditional approach, is that in defuzzifing the results of a fuzzy processing, you can use functions that consider the entire fuzzy set resulting from the processing.
To give an idea of the various methods used, let’s consider the center of gravity shown in the picture.

With this method, we consider as crisp output, the center of gravity of the total area created by the individual membership functions of the different input variables after being manipulated appropriately by the processing.