Fuzzy Logic

There is a precise date in which we can set fuzzy logic born. It is the
publication of the article Fuzzy Sets written by Lofti A. Zadeh on the
Information and Control Journal in the 1965.
"fuzzy" term state for not clear, smoothed and vague. In this sense
that could seem in contradiction with the classical meaning of logic.
But this isn't true. In fact fuzzy logic is a superset of Boolean logic
with its own detailed and rigorous algebra.
Just as there is a strong relationship between Boolean logic and the
concept of a subset, there is a similar strong relationship between
fuzzy logic and fuzzy subset theory.


In classical set theory, a subset U of a set S can be defined as a
mapping from the elements of S to the elements of the set {0, 1},


  U: S --> {0, 1}


This mapping may be represented as a set of ordered pairs, with exactly
one ordered pair present for each element of S. The first element of
the ordered pair is an element of the set S, and the second element is an
element of the set {0, 1}.  The value zero is used to represent
non-membership, and the value one is used to represent membership.


The truth or falsity of the statement


   x is in U


is determined by finding the ordered pair whose first element is x.
The statement is true if the second element of the ordered pair is 1, and
the statement is false if it is 0.


Similarly, a fuzzy subset F of a set S can be defined as a set of
ordered pairs, each with the first element from S, and the second element from
the interval [0,1], with exactly one ordered pair present for each
element of S. This defines a mapping between elements of the set S and
values in the interval [0,1].  The value zero is used to represent
complete non-membership, the value one is used to represent complete
membership, and values in between are used to represent intermediate
DEGREES OF MEMBERSHIP.  The set S is referred to as the UNIVERSE OF
DISCOURSE for the fuzzy subset F.  Frequently, the mapping is described
as a function, the MEMBERSHIP FUNCTION of F.


The degree to which the statement


   x is in F


is true is determined by finding the ordered pair whose first element
is x.  The DEGREE OF TRUTH of the statement is the second element of the
ordered pair.


In practice, the terms "membership function" and fuzzy subset get used
interchangeably.


That's a lot of mathematical baggage, so here's an example.  Let's
talk about people and "tallness".  In this case the set S (the
universe of discourse) is the set of people.  Let's define a fuzzy
subset TALL, which will answer the question "to what degree is person
x tall?" Zadeh describes TALL as a LINGUISTIC VARIABLE, which
represents our cognitive category of "tallness". To each person in the
universe of discourse, we have to assign a degree of membership in the
fuzzy subset TALL.  The easiest way to do this is with a membership
function based on the person's height.


   tall(x) = { 0,                     if height(x) < 5 ft.,
               (height(x)-5ft.)/2ft., if 5 ft. <= height (x) <= 7 ft.,
               1,                     if height(x) > 7 ft. }


A graph of this looks like:


1.0 +                   +-------------------
   |                     /
   |                   /
0.5 +              /
   |                /
   |              /
0.0 +---------------+-----+-------------------
                 |         |
                5.0     7.0


               height, ft. ->


Given this definition, here are some example values:


Person    Height    degree of tallness
--------------------------------------
Billy     3' 2"     0.00 [I think]
Yoke      5' 5"     0.21
Drew      5' 9"     0.38
Erik      5' 10"    0.42
Mark      6' 1"     0.54
Kareem    7' 2"     1.00 [depends on who you ask]


Expressions like "A is X" can be interpreted as degrees of truth,
e.g., "Drew is TALL" = 0.38.


Note: Membership functions used in most applications almost never have
as simple a shape as tall(x). At minimum, they tend to be triangles
pointing up, and they can be much more complex than that.  Also, the discussion characterizes membership functions as if they always are based on a single criterion, but this isn't always the case, although it is quite
common.  One could, for example, want to have the membership function
for TALL depend on both a person's height and their age (he's tall for his
age). This is perfectly legitimate, and occasionally used in practice.
It's referred to as a two-dimensional membership function, or a "fuzzy
relation".  It's also possible to have even more criteria, or to have
the membership function depend on elements from two completely different
universes of discourse.


In AKIRA fuzzy logic is provided through FLIP++ (see Links). FLIP++ is
a powerful fuzzy engine able to construct complex fuzzy set and fuzzy
rules. It also integrates inference methods to obtain crisp values of
unknown variables basing the calculus on known variables values and on
rules correlating each of them with the others.