# Fuzzy Logic

The digital computing world is built on a structure of Boolean logic applied to binary values -- one or zero, yes or no, in or out. But this powerful structure is a gross oversimplification of the real world, where many shades of gray exist between black and white. In everyday life, we use quasimetric notions that are clearly related to numerical concepts or values but lack precision or demarcation.

What time is it? If I'm a server time-stamping thousands of files, digital certificates or transactions, I need very fine distinctions. But if I'm asking a co-worker what time it is, do I really care that it's 11:49:54 a.m. Eastern Daylight Time? Or do I just want to know if it's time for lunch yet?

More

Computerworld
QuickStudies

Or take the weather. If it's 90 degrees Fahrenheit on a July day, that's hot for Massachusetts but mild for Arizona. A total of several inches of rain that month might constitute a drought in Massachusetts but a welcome relief from one in Arizona.

Get Fuzzy

The real world simply doesn't map well to binary distinctions, and numerical precision is often unhelpful in making qualitative statements. Fuzzy logic gives us a way to deal with such situations.

In fuzzy systems, values are indicated by a number (called a truth value) in the range from 0 to 1, where 0.0 represents absolute falseness and 1.0 represents absolute truth. While this range evokes the idea of probability, fuzzy logic and fuzzy sets operate quite differently from probability.

If I tell you that my height is 5 ft. 6 in. (or 168 cm), you may have to think a bit before deciding whether you consider me short or not short (i.e., tall). Moreover, you might reckon me short for a man but tall for a woman. So let's make the statement "Russell is short," and give that a truth value of 0.70.

If 0.70 represented a probability value, we would read it as "There is a 70% chance that Russell is short," meaning that we still believe that Russell is either short or not short, and we have a 70% chance of knowing which group he belongs to. But fuzzy terminology really translates to "Russell's degree of membership in the set of short people is 0.70," by which we mean that if we take all the (fuzzy set of) short people and line them up, Russell is positioned 70% of the way to the shortest. In conversation, we would say Russell is "kind of" short and recognize that there is no definite demarcation between short and tall. We can state this mathematically as mSHORT(Russell) = 0.70, where m is the membership function.

Another difference becomes visible when we look at some logical operations, particularly or and and. In probability, we calculate the and (intersection) of two independent events by multiplying their individual probabilities together and the or (or union) as the sum of individual probabilities less their product. For fuzzy logic, we evaluate or as the maximum of individual truth values, while and is the minimum of those values. As we incorporate more factors into the mix, even those with high values -- the overall probability continues to drop, eventually approaching 0.0. For fuzzy logic, however, the truth value remains high. Similarly for the or operator, incorporating more factors increases probability to near 1.0, while adding more fuzzy sets doesn't raise the combined value at all, and the limit will be the largest of the individual membership values.

One thing that makes fuzzy systems useful is the ability to define "hedges," or descriptive modifiers, to represent fuzzy values. This keeps the operations of fuzzy logic closer to natural language and allows us to generate fuzzy statements through mathematical calculations.

Defining hedges and the operations that use them is a subjective process, and it can vary from project to project. But the system lets us use operators and produce compound results using the same formal methods as classic logic.

For example, let's change the statement "Bob is old" to "Bob is very old." Here we're using "very" as a hedge or descriptor, and this particular hedge is often defined as equivalent to the square of the base value. Therefore if mOLD(Bob) = 0.80, then mVERYOLD(Bob) = 0.64.

Other hedges include "more or less," "somewhat," "rather" and "sort of." All have subjective definitions but transform membership/truth values in a systematic, reliable manner.

Kay is a Computerworld contributing writer in Worcester, Mass. You can contact him at russkay@charter.net.

``` ```