# fuzzy logic reasoning with uncertain information IT Magazine Jan 2002

## Full text

(1)

### Uncertain Information

By: GIRISH KESHAV PALSHIKAR

—The author is an M.Sc. (Physics) from IIT, Mumbai and an M.S. (Computer Science and Engineering) from IIT, Chennai. He is a scientist at the Tata Research Development and Design Centre (TRDDC), the R&D division of Tata Consultancy Services, in Pune. His areas of research include theoretical computer science and artificial intelligence.

## 4

easoning is an innate human ability and a critical part of many human endeavours, e.g., medicine and law. An aim of mathematical logic is to formalise natural processes of reasoning. Mathematical logic provides a precise

representa-tion for informarepresenta-tion and models the reasoning processes used to correctly draw conclusions from the available information. We begin with an overview of the standard propositional logic, continue with fuzzy propositional logic and illustrate it with

some examples.

In propositional logic (PL), developed in the last century by the English logician George Boole, a proposition is the basic unit to represent information. A proposition is just an atomic symbol (without any structure)

and it stands for a declarative statement which is either true or false. Each such proposition may be assigned a valuetrue

or false. For example, the propositions r and p may stand for the statements It is raining and I go to a picnic respectively. In any particular situation, r may be true

or false, and the same is true for p.

You may represent further information by combining the propositions in well-defined ways. For this purpose, PL provides 5 logical connectives:

(2)

OR (OR), IMPLIES

(IMPLIES) also called IF-THEN, IFF ( IF-AND-ONLY-IF). For example, the rule If it is raining then I do not go to a picnic is represented by the formula IF r THEN (NOT p) or alternatively r IMPLIES

(NOT p). We shall not discuss the exact syntax for forming the formulae, except to note that NOT is a unary connective, which can be applied to only one formula, and the remaining four are binary connectives and are applied to two formulae.

A number of formal deduction systems can be defined for PL. Each such deduction system contains inference rules, each of which models a reasoning process used to automatically infer conclusions from given

premises. One example is the

modus ponens rule, which says that given any two formulae of the form X and X IMPLIES

Y, conclude Y. Given the above rule r IMPLIES (NOT p) and if given the fact that r is true

(i.e., it is raining), most people will conclude that p is false

(i.e., I will not go to a picnic). This conclusion can be inferred using the modus ponens rule by substituting X = r and Y = NOT p. Inference rules are syntactic in nature i.e., they operate on the

form of formulae and do not consider their meaning. But what is the meaning of a formula? Can the meaning of a formula be defined mathematically? The answer, due to a great logician Tarski, is yes.

According to Tarski, the meaning of a formula is intimately related to its truth-value true or false and is constructed from the meanings of the components of the formula. Given a set P of propositional symbols, an

interpretation I is an assignment of the truth-value

true or false to each symbol in P. Given a formula X and an interpretation I, the truth-value of X in I can be found out by recursively using the

truth table shown in Table 1. The basic idea is to find the truth-value of the components of X and then combine them according to the truth table to find the truth-value of X. For the above example, P = {r, p} and one possible interpretation is I = {r = true, p = true}. Using the truth table, it is easy to see that the formula r

IMPLIES (NOT p) has the truth-value false in this interpretation. A tautology is a formula, which always has the truth-value true in every interpretation; e.g., p OR

(NOT p) and p IMPLIES p. A

contradiction is a formula which always has the truth-value false in every interpretation; e.g., p AND

(NOT p).

Tarski also characterised the process of deduction as follows. According to the celebrated Tarskis Theorem, given a set of formulae S = {F1, F2, , Fn} and a conclusion C (given as another formula), C is a logical consequence of S if and only if the formula (F1

AND F2 AND  AND Fn)

IMPLIES C is a tautology. To continue our reasoning example, we can conclude

NOT p from {r, r IMPLIES

(NOT p)} by easily checking, using the truth table, that the formula r AND (r IMPLIES

(NOT p)) IMPLIES (NOT

p) is a tautology (since it has the truth-value true in all interpretations).

A lot of subtle reasoning can also be performed using the truth table. Consider another rule If it is not raining then I go to a picnic which is represented by the formula (NOT r) IMPLIES p. It is an interesting question to see whether this rule is equivalent to the earlier rule r IMPLIES

(NOT p). This question is precisely formulated by asking whether the formula (r

IMPLIES (NOT p)) IFF

((NOT r) IMPLIES p) is a tautology. Using the truth table, it is easy to verify that these two formulae are

not equivalent.

Apart from deduction systems and the truth table, a third way to perform reasoning in PL involves syntactic manipulation of the formulae using equivalence laws. An

equivalence law is a transformation of a formula into another, in which the resultant formula has the same

meaning as the original formula.Table 2 shows some of the equivalence laws, which hold in PL. It is easy to prove these laws, especially if you use the truth table. For our reasoning example, we need to prove that the formula (r

AND (r IMPLIES NOT p))

IMPLIES (NOT p) is a tautology. Figure 1 proves this using the laws in Table 2. Notice that these laws look similar to the laws in set theory; e.g., AND, OR

and NOT behave like ∩ (intersection), ∪ (union) and complement. This similarity is not accidental; there is a deep connection between set theory and logic.

PL is nice! It has a neat notation for representing information and a number of very efficient ways to perform reasoning. It has been widely used in the design of digital systems. Unfortunately, it is too limited to deal with the rest of the real world. In the real world we have very complex kinds of information, and very intricate and specialised patterns of reasoning over particular kinds of information. So there have been a number of attempts to extend PL, to add more expressive power to its representation and reasoning processes. For example, it has been extended to handle

### Truth table for propositional logic

X Y NOT X X AND Y X OR Y X IMPLIES Y X IFF Y

true true false true true true true true false false false true false false false true true false true true false false false true false false true true

Table 1

(r AND (r IMPLIES NOT p)) IMPLIES (NOT p)

= NOT(r AND (r IMPLIES NOT p)) OR (NOT p) law (xiv) = NOT( (r AND (r IMPLIES NOT p)) AND p) law (xiii) = NOT( (r AND (NOT r OR NOT p)) AND p ) law (xiv) = NOT( ((r AND NOT r) OR (r AND NOT p)) AND p) law (x) = NOT( (false OR (r AND NOT p)) AND p) law (xx) = NOT( (r AND NOT p) AND p ) law (ix) = NOT(r AND (NOT p AND p) ) law (iii) = NOT(r AND false) law (xx) = NOT false law (vii) = true law (xxiii)

(3)

quantification (predicate logic), time-dependent reasoning (temporal logic), reasoning with multiple worlds of information (modal logic) etc. Adding fuzziness to it is one such attempt.

### Motivation

The appropriateness of the laws of excluded middle and contradiction has been challenged since the time of Aristotle. The requirement that a proposition must be either

true or false, not both and not neither, is too restrictive in practice. Consider declarative statements like the temperature is low, the capacitor is not working or this song is melodious. It is difficult to represent these statements by the usual Boolean (crisp) propositions, which are either true or false.

Fuzzy propositional logic (FPL)

allows fuzzy propositions, which have a more general degree of truth associated with them. It also extends the meanings of the standard logical quantifiers and inference rules.

Fuzzy logic began with the work of Lofti Zadeh in 1965 and has roots in multi-valued logics developed by Godel, Lukasiewicz and Kleene, among others. Out of the many possible formulations of FPL, the particular formulation chosen here aims at remaining as close to the classical PL (in syntax, semantics and reasoning methods) as possible. We do not emphasise connections with fuzzy set theory. FPL and its various extensions have been used to represent and reason about many practical situations; e.g., decision making, diagnosis, process control systems, consumer equipment (cameras, washing machines,

ovens), image processing etc.

### Logic

In PL, a crisp proposition p can have only two truth-values i.e., p is either true or false. In FPL, a fuzzy propositional symbol can take any truth-value from the closed set [0,1] of real numbers, thus generalising the notions of crisp propositions and their Boolean truth-values. The truth-value of a fuzzy proposition is called its degree of truth. For example, consider a fuzzy proposition c which stands for the statement the weather is cold. The degrees of truth of 0.6, 0.8 and 0.3 for c may indicate that it is fairly cold, very cold and not much cold respectively. A fuzzy proposition typically models a

linguistic variable, which describes an inherently vague concept, which is nevertheless

well understood by humans. For example, infant, young, adult and old are linguistic variables, each of which can be modelled by a fuzzy proposition. The degree of truth of these propositions would depend on the persons age; e.g., for 19 years, infant = 0.0, young = 0.8, old = 0.5.

The degree of truth of a proposition is not a probability; it is not necessary that the degrees of truths add up to 1. It need not indicate uncertainty due to lack of data or errors in instruments. It is simply a measure of how true a proposition is. The question of assigning a degree of truth to a fuzzy proposition is outside FPL. Usually, there is a function f, which maps the value of some variable V (e.g., outside temperature) to the degree of truth of the corresponding fuzzy proposition (e.g., c).

PL includes only two constant symbols true and false. In FPL, the constants take the form of a real number in [0,1]; e.g., 0, 1, 0.5, 0.333 are constants. Constants are numerical symbols and not represented in any other fashion (e.g., as an algebraic expression). A constant c can be thought of as a proposition symbol that always has the truth-value c. The FPL includes all the standard logical connectivesNOT, AND, OR,

IMPLIES and IFF. The rules for constructing formulae are the same as in PL.

In addition, we allow a number of user-specified fuzzy connectives, each of which is a

modifier of the truth-value of a formula. We work with the fuzzy connectives having the arity 1 or 2 only. A unary user-defined fuzzy logical connective α can be thought of as a function α:[0,1]→[0,1]

### Equivalence laws in propositional logic

commutativity: (i) X AND Y = Y AND X (ii) X OR Y = Y OR X associativity: (iii) X AND (Y AND Z) = (X AND Y) AND Z

(iv) X OR (Y OR Z) = (X OR Y) OR Z involution: (v) NOT (NOT X) = X

some simplifications: (vi) true AND X = X (vii) false AND X = false more simplifications: (viii) true OR X = true (ix) false OR X = X distribution: (x) X AND (Y OR Z) = (X AND Y) OR (X AND Z)

(xi) X OR (Y AND Z) = (X OR Y) AND (X OR Z) De Morgans laws: (xii) NOT (X OR Y) = (NOT X) AND (NOT Y)

(xiii) NOT(X AND Y) = (NOT X) OR (NOT Y) elimination : (xiv) X IMPLIES Y = (NOT X) OR Y

(xv) X IFF Y=(X IMPLIES Y) AND (Y IMPLIES X)

idempotence: (xvi) X OR X = X (xvii) X AND X = X absorption: (xviii) X OR (X AND Y) = X (xix) X AND (X OR Y) = X contradiction: (xx) X AND (NOT X) = false

excluded middle: (xxi) X OR (NOT X) = true

negation of truth-values: (xxii) (NOT true) = false (xxiii) (NOT false) = true

Table 2

### Truth table for fuzzy propositional logic

X Y NOT X X AND Y X OR Y X IMPLIES Y αX XβY c1 c2 1  c1 min(c1,c2) max(c1,c2) max(1c1,c2) α(c1) β(c1,c2)

(4)

and a binary user-defined fuzzy logical connective β can be thought of as a binary function β:[0,1]x[0,1]→[0,1]. For example, the linguistic hedge or truth qualifier very is a unary fuzzy connective applied as in very p. If c ε[0,1] is such that a fuzzy proposition p has the truth-value c, then

very c may be defined to have the truth-value c * c. Linguistic hedge fairly may be similarly defined as fairly (x) = x1/2. The fuzzy equality≈ is another

example of a binary fuzzy logical connective. If c1 and c2 are any two real numbers in [0,1], then c1≈c2 has the truth value 1  |c1  c2|; so truth-value of 0.5≈0.7 is 0.8.

Standard relational operators for comparing numbers can be considered as fuzzy logical connectives. For example, if c1, c2 ε[0,1], the crisp equality

c1 = c2 holds (i.e., has a truth-value of 1) iff if c1 and c2 stand for the same number;

otherwise it does not hold (i.e., has a truth-value of 0).

Example 1: Consider the following statements.

(a)If it is sunny and not very hot then it is good.

(b)If it is not raining and not very cold then it is good.

(c)If it is raining and not very cold and not very hot then it is good.

(d)I picnic only if the weather is fairly good and it is not raining.

Let the fuzzy propositions h, r, c, s, g and p respectively stand for the statements it is hot, it is raining, it is cold, it is sunny, it is good and I go to picnic. Then the given statements are represented by the following fuzzy formulae: (a) (s AND (NOT very h))

IMPLIES g (b) ((NOT r)

AND (NOTvery c)) IMPLIES

g (c) (r AND (NOTvery c)

AND (NOTvery h)) IMPLIES

g (d) (fairly g ANDNOT r)

IMPLIES p.

Given a set P of proposition symbols, a fuzzy interpretation

I is a function which associates a degree of truth with each proposition in P. We let the constants true and false also stand for the degrees of truth 1 and 0 respectively and enforce that in every fuzzy interpretation I, I(true) = 1, I(false) = 0 and I(c) = c for every constant real number c in [0,1]. Given a set of propositional symbols P and a fuzzy formula X over P, we need to define a method to derive the degree of truth of X, denoted I(X), under the given fuzzy interpretation I. This is done by means of a generalised fuzzy truth table as shown in Table 3, where X

and Y are fuzzy formulae over P, c1, c2 ε[0,1] and α, β are any unary and binary user-defined fuzzy connectives respectively. The functions to compute the truth-values of

NOT, AND and OR are called standard Lukasiewicz

functions. The function for

IMPLIES is called Kleene-Dienes implication.

There are many other ways to define these functions, and exploring the relationships and utility of these forms is a research issue. For example, some other, quite reasonable ways to define the truth-value of IMPLIES are: min(1, 1-c1+c2), 1-c1+c1c2 and 1-c1+c12c2. In example 1, the truth-values of the formulae in interpretation I = {(h,0.4),(r,0),(c,0.7),(s,0.8), (g,0.7),(p,0.9)} are: 0.7, 0.7, 1 and 0.9 respectively. The laws of contradiction and excluded middle do not hold in FPL; e.g., if I(X) = 0.7 then I(X AND (NOTX)) = min(0.7, 1  0.7) = min(0.7,0.3) = 0.3 ≠ I(false). Also, I(X OR (NOT

X)) = max(0.7,1-0.7) = max(0.7,0.3) = 0.7 ≠ I(true). However, a number of other laws from Table 2 do hold in FPL.

What about inferences? Given a rule A ripe banana is sweet and a fact This banana is very ripe, a natural inference is This banana is very sweet. A theory exists for reducing fuzzy inferences to solve fuzzy relational equations. Instead of getting into such technicalities, we illustrate a specific fuzzy inference method as used in fuzzy controllers.

### controller

Consider a simple controller for automatically operating a room air-conditioner. The Figure 2: A simple fuzzy controller

Degrees of truth from temperature

(5)

controller receives the current room temperature X (in oF) and then determines the output fan motor speed Y (in rpm). Figure 2(a) shows some rules for such a controller. We introduce fuzzy propositions cold, cool, just_right, warm and hot to deal with the air temperature and stop, slow, medium, fast and blast to deal with the motor speed. Figure 2(b) shows the FPL formulae for the rules. Figure 2(c) and (d) respectively show how the input air temperature and output motor speed are mapped to the truth values of these fuzzy propositions. Note that these functions may have other shapes; e.g., a bell shape.

Given a specific temperature, the degree of truths of the input fuzzy propositions are determined (using Figure 2(c)); e.g., at 68oF, cool = 0.2, just_right = 0.7 and all others are 0. Then all the rules are fired in parallel. At 68oF, only rules 2 and 3 need to be fired. Each rule execution scales the degree of truth for the fuzzy propositions in the THEN part; this means slow = 0.2 and medium = 0.7. Figure 2(e) shows the curves for slow and just_right, scaled at 0.2 and 0.7 respectively. The actual motor speed is then determined by taking a centroid of the area under both these curves; this falls at Y = 47 rpm for X = 68oF. This process is called

defuzzification. Lastly, 47 rpm is fuzzified to medium motor speed. So at 68oF, the motor speed is medium.

### Fuzzy logic for decision-making

Decision-making is the act of picking one alternative from the set of available alternatives. The decision (i.e., selected alternative) is required to satisfy several, perhaps mutually conflicting, constraints to the highest possible degree. FPL can be used to model processes that go into making such multi-criteria decisions. Suppose a car company wishes to decide the market price for a new model. Various managers specify their constraints on the price to be decided. The managing director says the price should be rather high to maximise profits. The marketing manager says the price should be fairly low to promote the new model. The accountant says that the price should be around twice the production cost to cover the cost. The personnel manager says that the price should be close to the market competition price (if it is not very high) to avoid waging a price war. Note that constraints 1 and 2 are conflicting. Suppose the production cost is \$ 12,000. The competition price is highly likely to be \$ 23,000. We can introduce appropriate fuzzy propositions and functions to model the linguistic hedges very, fairly, around etc. We can then state these constraints as fuzzy rules and solve them to decide the price for the new model. Most peoples decision will be around \$24,000, which is also close to the price obtained by firing the fuzzy rules.

Hence, one can conclude that in FPL, truth is not precise and inferences are approximate. Moreover, the notions of completeness and consistency are irrelevant for fuzzy logic! All this has led to some controversy; to some, FPL does not even

Updating...

Updating...