# Expert Systems/Fuzzy Logic

A Wikibookian has nominated this page for cleanup because:recently imported from wikipedia, needs to be formatted |

## Contents

## About Fuzzy Logic[edit]

**Fuzzy logic** is derived from fuzzy set theory dealing with reasoning that is approximate rather than precisely deduced from classical predicate logic. It can be thought of as the application side of fuzzy set theory dealing with well thought out real world expert values for a complex problem (Klir 1997).

Degrees of truth are often confused with probabilities. However, they are conceptually distinct; fuzzy truth represents membership in vaguely defined sets, not likelihood of some event or condition. For example, if a 100-ml glass contains 30 ml of water, then, for two fuzzy sets, Empty and Full, one might define the glass as being 0.7 empty and 0.3 full. Note that the concept of emptiness would be subjective and thus would depend on the observer or designer. Another designer might equally well design a set membership function where the glass would be considered full for all values down to 50 ml. A probabilistic setting would first define a scalar variable for the fullness of the glass, and second, conditional distributions describing the probability that someone would call the glass full given a specific fullness level. Note that the conditioning can be achieved by having a specific observer that randomly selects the label for the glass, a distribution over deterministic observers, or both. While fuzzy logic avoids talking about randomness in this context, this simplification at the same time obscures what is exactly meant by the statement the 'glass is 0.3 full'.

Fuzzy logic allows for set membership values to range (inclusively) between 0 and 1, and in its linguistic form, imprecise concepts like "slightly", "quite" and "very". Specifically, it allows partial membership in a set. It is related to fuzzy sets and possibility theory. It was introduced in 1965 by Lotfi Zadeh at the University of California, Berkeley.

Fuzzy logic is controversial in some circles and is rejected by some control engineers and by most statisticians who hold that probability is the only rigorous mathematical description of uncertainty. Critics also argue that it cannot be a superset of ordinary set theory since membership functions are defined in terms of conventional sets.

## Applications[edit]

Fuzzy logic can be used to control household appliances such as washing machines (which sense load size and detergent concentration and adjust their wash cycles accordingly) and refrigerators.

A basic application might characterize subranges of a continuous variable. For instance, a temperature measurement for anti-lock brakes might have several separate membership functions defining particular temperature ranges needed to control the brakes properly. Each function maps the same temperature value to a truth value in the 0 to 1 range. These truth values can then be used to determine how the brakes should be controlled.

In this image, *cold*, *warm*, and *hot* are functions mapping a temperature scale. A point on that scale has three "truth values" — one for each of the three functions. For the particular temperature illustrated with the vertical line, the three truth values could be interpreted as describing the temperature as, say, "fairly cold" (blue arrow), "slightly warm" (yellow arrow), and "not hot" (red arrow).

## Misconceptions and controversies[edit]

- Fuzzy logic is the same as "imprecise logic".
- Fuzzy logic is not any less precise than any other form of logic: it is an organized and mathematical method of handling
*inherently*imprecise concepts. The concept of "coldness" cannot be expressed in an equation, because although temperature is a quantity, "coldness" is not. However, people have an idea of what "cold" is, and agree that there is no sharp cutoff between "cold" and "not cold", where something is "cold" at N degrees but "not cold" at N+1 degrees — a concept classical logic cannot easily handle due to the principle of bivalence. The result has no set answer so it is believed to be a 'fuzzy' answer.

- Fuzzy logic is a new way of expressing probability.
- Fuzzy logic and probability are different ways of expressing uncertainty. While both fuzzy logic and probability theory can be used to represent subjective belief, fuzzy set theory uses the concept of fuzzy set membership (i.e.
*how much*a variable is in a set), probability theory uses the concept of subjective probability (i.e.*how probable*do I think that a variable is in a set). While this distinction is mostly philosophical, the fuzzy-logic-derived possibility measure is inherently different from the probability measure, hence they are not*directly*equivalent. However, many statisticians are persuaded by the work of Bruno de Finetti that only one kind of mathematical uncertainty is needed and thus fuzzy logic is unnecessary. On the other hand, Bart Kosko argues that probability is a subtheory of fuzzy logic, as probability only handles one kind of uncertainty. He also claims to have proven a derivation of Bayes' theorem from the concept of fuzzy subsethood. Lotfi Zadeh, the creator of fuzzy logic, argues that fuzzy logic is different in character from probability, and is not a replacement for it. He has created a fuzzy alternative to probability, which he calls possibility theory. Other controversial approaches to uncertainty include Dempster-Shafer theory and rough sets.

- Fuzzy logic will be difficult to scale to larger problems.
- This criticism is mainly due to the fact that there exist problems with conditional possibility, the fuzzy set theory equivalent of conditional probability (see Halpen (2003), section 3.8). This makes it difficult to perform inference. However there have not been many studies comparing fuzzy-based systems with probabilistic ones.

## Examples where fuzzy logic is used[edit]

- Automobile and other vehicle subsystems, such as automatic transmissions, ABS and cruise control (e.g. Tokyo monorail)
- Air conditioners
- The Massive engine used in the
*Lord of the Rings*films, which helped show huge scale armies create random, yet orderly movements - Cameras
- Digital image processing, such as edge detection
- Rice cookers
- Dishwashers
- Elevators
- Washing machines and other home appliances
- Video game artificial intelligence
- Language filters on message boards and chat rooms for filtering out offensive text
- Pattern recognition in Remote Sensing
- Fuzzy logic has also been incorporated into some microcontrollers and microprocessors, for instance, the Freescale 68HC12.

## How fuzzy logic is applied[edit]

Fuzzy Set Theory defines Fuzzy Operators on Fuzzy Sets. The problem in applying this is that the appropriate Fuzzy Operator may not be known. For this reason, Fuzzy logic usually uses IF/THEN rules, or constructs that are equivalent, such as fuzzy associative matrices.

Rules are usually expressed in the form:

IF *variable* IS *set* THEN *action*

For example, an extremely simple temperature regulator that uses a fan might look like this:

IF temperature IS very cold THEN stop fan

IF temperature IS cold THEN turn down fan

IF temperature IS normal THEN maintain level

IF temperature IS hot THEN speed up fan

Notice there is no "ELSE". All of the rules are evaluated, because the temperature might be "cold" and "normal" at the same time to differing degrees.

The AND, OR, and NOT operators of boolean logic exist in fuzzy logic, usually defined as the minimum, maximum, and complement; when they are defined this way, they are called the *Zadeh operators*, because they were first defined as such in Zadeh's original papers. So for the fuzzy variables x and y:

NOT x = (1 - truth(x))

x AND y = minimum(truth(x), truth(y))

x OR y = maximum(truth(x), truth(y))

There are also other operators, more linguistic in nature, called *hedges* that can be applied. These are generally adverbs such as "very", or "somewhat", which modify the meaning of a set using a mathematical formula.

In application, the programming language Prolog is well geared to implementing fuzzy logic with its facilities to set up a database of "rules" which are queried to deduct logic. This sort of programming is known as logic programming.

Once fuzzy relations are defined, it is possible to develop fuzzy relational databases. The first fuzzy relational database, FRDB, appeared in Maria Zemankova's dissertation. After, some other models arose like the Buckles-Petry model, the Prade-Testemale Model, the Umano-Fukami model or the GEFRED model by J.M. Medina, M.A. Vila et al. In the context of fuzzy databases, some fuzzy querying languages have been defined, highlighting the SQLf by P. Bosc et al. and the FSQL by J. Galindo et al. These languages define some structures in order to include fuzzy aspects in the SQL statements, like fuzzy conditions, fuzzy comparators, fuzzy constants, fuzzy constraints, fuzzy thresholds, linguistic labels and so on.

### Other examples[edit]

- If a man is 1.8 meters, consider him as tall:

IF male IS true AND height >= 1.8 THEN is_tall IS true; is_short IS false

- The fuzzy rules do not make the sharp distinction between tall and short, that is not so realistic:

IF height <= medium male THEN is_short IS agree somewhat

IF height >= medium male THEN is_tall IS agree somewhat

In the fuzzy case, there are no such heights like 1.83 meters, but there are fuzzy values, like the following assignments:

dwarf male = [0, 1.3] m

short male = (1.3, 1.5]

medium male = (1.5, 1.8]

tall male = (1.8, 2.0]

giant male > 2.0 m

For the consequent, there are also not only two values, but five, say:

agree not = 0

agree little = 1

agree somewhat = 2

agree a lot = 3

agree fully = 4

In the binary, or "crisp", case, a person of 1.79 meters of height is considered short. If another person is 1.8 meters or 2.25 meters, these persons are considered tall.

The crisp example differs deliberately from the fuzzy one. We did not put in the antecedent

IF male >= agree somewhat AND ...

as gender is often considered as a binary information. So, it is not so complex as being tall.

## Formal fuzzy logic[edit]

In mathematical logic, there are several formal systems that model the above notions of "fuzzy logic"; most of them belong among so-called t-norm fuzzy logics. Note that they use a different set of operations than above mentioned Zadeh operators.

### Propositional fuzzy logics[edit]

The most important propositional fuzzy logics are:

- Basic propositional fuzzy logic BL is an axiomatization of logic where conjunction is defined by a continuous |t-norm, and implication is defined as the residuum of the t-norm. Its models correspond to BL-algebras.
- Łukasiewicz fuzzy logic is a special case of basic fuzzy logic where conjunction is Łukasiewicz t-norm. It has the axioms of basic logic plus an axiom of double negation (so it is not intuitionistic logic), and its models correspond to MV-algebras.
- Gödel fuzzy logic is a special case of basic fuzzy logic where conjunction is Gödel t-norm. It has the axioms of basic logic plus an axiom of idempotence of conjunction, and its models are called G-algebras.
- Product fuzzy logic is a special case of basic fuzzy logic where conjunction is product t-norm. It has the axioms of basic logic plus another axiom, and its models are called product algebras.
- Monoidal t-norm logic MTL is a generalization of basic fuzzy logic BL where conjunction is realized by a
*left*-continuous t-norm. Its models (MTL-algebras) are prelinear commutative bounded integral residuated lattices. - Rational Pavelka logic is a generalization of multi-valued logic. It is an extension of Łukasziewicz fuzzy logic with additional constants.

All these logics encompass the traditional propositional logic (whose models correspond to Boolean algebras).

### Predicate fuzzy logics[edit]

These extend the above-mentioned fuzzy logics by adding universal and existential quantifiers in a manner similar to the way that predicate logic is created from propositional logic. The semantics of the universal resp. existential quantifier in t-norm fuzzy logics is the infimum resp. supremum of the truth degrees of the instances of the quantified subformula.

### Effectiveness for fuzzy logics[edit]

The notions of a "decidable subset" and "recursively enumerable subset" are basic ones for classical mathematics and classical logic. Then, the question of a suitable extension of such concepts to fuzzy set theory arises. A first proposal in such a direction was made by E.S. Santos by the notions of *fuzzy Turing machine*, *Markov normal fuzzy algorithm* and *fuzzy program*. Successively, L. Biacino and G. Gerla proposed the following definition where *Ü* denotes the set of rational numbers in [0,1]. A fuzzy subset μ : *S* [0,1] of a set *S* is *recursively enumerable* if a recursive map *h* : *S*×*N* *Ü* exists such that, for every *x* in *S*, the function *h*(*x*,*n*) is increasing with respect to *n* and μ(*x*) = lim *h*(*x*,*n*). We say that μ is *decidable* if both μ and its complement –μ are recursively enumerable. An extension of such a theory to the general case of the L-subsets is proposed in a paper by G. Gerla. The proposed definitions are well related with fuzzy logic. Indeed, the following theorem holds true (provided that the deduction apparatus of the fuzzy logic satisfies some obvious effectiveness property).

**Theorem.** Any axiomatizable fuzzy theory is recursively enumerable. In particular, the fuzzy set of logically true formulas is recursively enumerable in spite of the fact that the crisp set of valid formulas is not recursively enumerable, in general. Moreover, any axiomatizable and complete theory is decidable.

It is an open question to give supports for a *Church thesis* for fuzzy logic claiming that the proposed notion of recursive enumerability for fuzzy subsets is the adequate one. To this aim, further investigations on the notions of fuzzy grammar and fuzzy Turing machine should be necessary (see for example Wiedermann's paper). Another open question is to start from this notion to find an extension of Gödel’s theorems to fuzzy logic.

## Bibliography[edit]

- Von Altrock, Constantin (1995).
*Fuzzy logic and NeuroFuzzy applications explained*. Upper Saddle River, NJ: Prentice Hall PTR. ISBN 0-13-368465-2. - Biacino, L.; Gerla, G. (2002). "Fuzzy logic, continuity and effectiveness".
*Archive for Mathematical Logic***41**(7): 643-667. doi:10.1007/s001530100128. ISSN 0933-5846. - Cox, Earl (1994).
*The fuzzy systems handbook: a practitioner's guide to building, using, maintaining fuzzy systems*. Boston: AP Professional. ISBN 0-12-194270-8. - Elkan, C. (1994). "The Paradoxical Success of Fuzzy Logic".
*IEEE Expert***9**(4): 3-8. doi:10.1109/64.336150. ISSN 0885-9000.. Available from Elkan's home page. - Gerla, Giangiacomo (2006). "Effectiveness and Multivalued Logics".
*Journal of Symbolic Logic***71**(1): 137-162. ISSN 0022-4812. - Hájek, Petr (1998).
*Metamathematics of fuzzy logic*. Dordrecht: Kluwer. ISBN 0792352386. - Hájek, Petr (1995). "Fuzzy logic and arithmetical hierarchy".
*Fuzzy Sets and Systems***3**(8): 359-363. doi:10.1016/0165-0114(94)00299-M. ISSN 0165-0114. - Halpern, Joseph Y. (2003).
*Reasoning about uncertainty*. Cambridge, Mass: MIT Press. ISBN 0-262-08320-5. - Höppner, Frank; Klawonn, F.; Kruse, R.; Runkler, T. (1999).
*Fuzzy cluster analysis: methods for classification, data analysis and image recognition*. New York: John Wiley. ISBN 0-471-98864-2. - Ibrahim, Ahmad M. (1997).
*Introduction to Applied Fuzzy Electronics*. Englewood Cliffs, N.J: Prentice Hall. ISBN 0-13-206400-6. - Klir, George J.; Folger, Tina A. (1988).
*Fuzzy sets, uncertainty, and information*. Englewood Cliffs, N.J: Prentice Hall. ISBN 0-13-345984-5. - Klir, George J.; St Clair, Ute H.; Yuan, Bo (1997).
*Fuzzy set theory: foundations and applications*. Englewood Cliffs, NJ: Prentice Hall. ISBN 0133410587. - Klir, George J.; Yuan, Bo (1995).
*Fuzzy sets and fuzzy logic: theory and applications*. Upper Saddle River, NJ: Prentice Hall PTR. ISBN 0-13-101171-5. - Kosko, Bart (1993).
*Fuzzy thinking: the new science of fuzzy logic*. New York: Hyperion. ISBN 0-7868-8021-X. - Montagna, F. (2001). "Three complexity problems in quantified fuzzy logic".
*Studia Logica***68**(1): 143-152. doi:10.1023/A:1011958407631. ISSN 0039-3215. - Mundici, Daniele; Cignoli, Roberto; D'Ottaviano, Itala M. L. (1999).
*Algebraic foundations of many-valued reasoning*. Dodre: Kluwer Academic. ISBN 0-7923-6009-5. - Novák, Vilém (1999).
*Mathematical principles of fuzzy logic*. Dodrecht: Kluwer Academic. ISBN 0-7923-8595-0. - Passino, Kevin M.; Yurkovich, Stephen (1998).
*Fuzzy control*. Boston: Addison-Wesley. ISBN 020118074X. - Scarpellini, Bruno (1962). "Die Nichaxiomatisierbarkeit des unendlichwertigen Prädikatenkalküls von Łukasiewicz".
*Journal of Symbolic Logic***27**(2): 159-170. doi:10.2307/2964111. ISSN 0022-4812. - Wiedermann, J. (2004). "Characterizing the super-Turing computing power and efficiency of classical fuzzy Turing machines".
*Theor. Comput. Sci.***317**: 61-69. - Yager, Ronald R.; Filev, Dimitar P. (1994).
*Essentials of fuzzy modeling and control*. New York: Wiley. ISBN 0-471-01761-2. - Zadeh, L.A. (1968). "Fuzzy algorithms".
*Information and Control***12**(2): 94-102. doi:10.1016/S0019-9958(68)90211-8. ISSN 0019-9958. - Zadeh, L.A. (1965). "Fuzzy sets".
*Information and Control***8**(3): 338-353. doi:10.1016/S0019-9958(65)90241-X. ISSN 0019-9958. - Zemankova-Leech, M. (1983).
*Fuzzy Relational Data Bases*. Ph. D. Dissertation. Florida State University. - Zimmermann, H. (2001).
*Fuzzy set theory and its applications*. Boston: Kluwer Academic Publishers. ISBN 0-7923-7435-5.

## External links[edit]

**Additional articles**

- Formal fuzzy logic - detailed article at Citizendium
- Fuzzy Logic - article at Scholarpedia
- Fuzzy logic - article at Stanford Encyclopedia of Philosophy
- Fuzzy Logic for "Just Plain Folks"
- Putting Fuzzy Logic To Work
*PC AI*Mar/Apr, 2002 An Introduction to Fuzzy Rules - Fuzzy Math - Beginner level introduction to Fuzzy Logic.

**Links pages**

- Web page about FSQL: References and links about FSQL

**Software & tools**

- Free Educational Software and Application Notes
- InrecoLAN FuzzyMath, Fuzzy logic add-in for OpenOffice.org Calc
- JFuzzyLogic: Open Source Fuzzy Logic Package + FCL (sourceforge, java)
- Open fuzzy logic based inference engine and data mining web service based on Metarule
- Open Source Software "mbFuzzIT" (Java)

**Tutorials**

- Fuzzy Logic Tutorial
- Fuzzy logic in your game - tutorial aimed towards game programming.
- Simple test to check how well you understand it
- Fuzzy Logic - Video tutorial