Set Logic Extended
Fuzzy approaches are primarily based on fuzzy set theory. As such, its foundations lie in formal definitions, which are explained in this section using parallels with classical logic. Indeed, fuzziness can be seen as an extension to Boolean set theory, used daily in programming.
In classical logic, all sets are crisp. True and false are crisply defined (for instance, 1 and 0). A value either belongs to a set, or it doesn't. Numbers are crisp, too, meaning each concept is perfectly known and expressed as such (for instance, health = 68, armor = 41).
As the saying goes, some things in life aren't just black and white. With crisp values, there's no way to express a value close to a set but not quite inside it. We can't have something that's mostly true, or not entirely false. With classical set logic, it's not possible to create a set that is not precisely defined, or a number that's relatively close to a value. We want to express part membership.
Fuzzy set theory can get around these limitations. Essentially, each set is defined by a membership function—with smooth variations rather than crisp borders. For each value in the universe of discourse X, the membership function defines a real number in the range [0,1]. This is the degree of membership; a value of 1 indicates the item is fully in the set, whereas 0 means the item is not in the set. Intermediate values indicate part membership:
A membership function, as shown in Figure 30.1, is generally denoted with the Greek letter mu (m). The preceding equation explains that membership function mA—for a given set A—maps the universe X onto the interval [0,1]. Implicitly, this transforms every item x onto its degree of membership to set A, written mA(x). For the sake of simplicity, however, we often use the notation mA(x) = A(x).
Figure 30.1. Example of different fuzzy membership functions: triangle (A), curve (B) and crisp singleton (C).
Strictly speaking, a fuzzy set is a collection of ordered pairs with items from the universe and their corresponding degree of membership (x,mA(x)). A pair can be referred to as a fuzzy singleton [Jantzen98]. The following expression describes A as a set of such singletons:
In practice, it's often easier just to represent set A with vector a, rather than a collection of singletons. The vector contains the grades of membership for elements in the universe. For this to be possible, we need to know the correspondence between membership values in the vector and items from the universe. The correspondence can be achieved by using the same order for declarations. Let's say A is the set of hostile objects, defined for all objects in X:
So, explicitly, the vector definition would correspond to the following definition of A:
This definition associates each object with its degree of hostility. So let's move on to manipulating these vectors. It's possible to combine such fuzzy sets, using similar definitions for classical logic.
Relationships between sets can also be expressed, such as containment (strict subset, denoted ). This can be combined with the definition of equality for subset or equal. A set is a subset of another if and only if the membership value is lower for all x:
Operations on fuzzy sets such as AND (set intersection, denoted ) and OR (set union, denoted ) are defined as follows:
If we want to define a membership function that includes two sets, we use the maximum of the two functions (OR). If we need to find the common parts, we use the minimum (AND). This makes more sense graphically, as depicted in Figure 30.2.
Figure 30.2. Operations on fuzzy sets. OR is the maximum of the two values; AND is the minimum of two values.
The complement of a set A is defined as follows (logical NOT):
A set is empty if and only if the membership value is always 0:
In the expression "very dangerous," the adjective "dangerous" would be a fuzzy set; players can belong to it with a degree of membership. The adverb "very" is a linguistic modifier that alters the meaning of such terms. Therefore, a fuzzy modifier can be seen as an operation on a set:
From this example, we can see that an item that is not dangerous (0) is not very dangerous (0). At the other end, an element with membership of 1 to dangerous will also be very dangerous. For items in between, their membership is diminished, as shown in Figure 30.3.
Figure 30.3. Example of modified sets based on a primary fuzzy set. One is a restrictive modifier (very), and the other is an offset modifier.
In practice, how do we determine how "very dangerous" an object is based on its danger? It's a direct mapping that can be applied to individual items and the entire set:
Both these examples are known as restrictive modifiers, because the modified fuzzy set is a subset of the original: Am(A), so all the modified membership values are lower. Conversely, there are also expansive modifiers verifying m(A)A, where the membership values are higher or equal—as in the following example:
It's important to remember that membership values are within the range [0..1], so values of x above 1 will make ax smaller, and values of x below 1 will make ax bigger. With x = +, the modifier would be called "exactly"; and for x = 0, the closest linguistic term seems to be "always" (as a0 = 1).
There are also offsetting modifiers that "shift" a fuzzy set by a constant amount: A(x) = m(A(x + k)). Such modifiers are sometimes closer to the intuitive meaning of adverbs, as used in human communication.