стр. 16 |

in 1 Zand = (min(<A>, <B>)) Zor = (max(<A>, <B>))

This command will modify attributes in the п¬Ѓrst data element in the antecedent

(in 1). Attribute Zand will be set to the minimum of variable ,A. and variable

,B. by FLOPSвЂ™ calculator, called by the open parenthesis after вЂњZand Вј вЂќ, and

closed by the corresponding close parenthesis. min() and max() are among the func-

tions supplied by the calculator.

Rule r3 sets all the truth values in Data to zero by the simple expedient of deleting

the old instance and creating a new instance in which no attri-

butes have been assigned values.

:Exercise AndOrNot.fps

message "Compiling AndOrNot.fps";

declare Data

a flt :truth value a

b flt :truth value b

Nota flt :truth value of NOT a

Zand flt :a AND b using Zadeh logic

Zor flt :a OR b using Zadeh logic

Pand flt :a AND b using probabilistic logic and

independence

Por flt :a OR b using probabilistic logic

Band flt :a AND b using bounded logic

Bor flt; :a OR b using bounded logic

:rule r0

rule (goal Input a and b truth values)

IF (in Data a.cf = 0)

THEN

write "Input a",

read 1 a,

write "Input b (negative to quit)",

read 1 b;

:rule r1

rule (goal Quit if b negative)

IF (in Data b < 0)

THEN exit;

:rule r2

rule (goal Calculate Nota, aANDb, aORb by various

multi-valued logics)

TEAM LinG - Live, Informative, Non-cost and Genuine !

34 FUZZY LOGIC, FUZZY SETS, AND FUZZY NUMBERS: I

IF (in Data a = <A> AND b = <B> AND Nota.cf = 0 AND b > = 0)

THEN

in 1 Nota = (1 - <A>),

in 1 Zand = (min(<A>, <B>)) Zor = (max(<A>, <B>)),

in 1 Pand = (<A> * <B>) Por = (<A> + <B> - <A> * <B>),

in 1 Band = (max(0, <A> + <B> - 1)) Bor =

(min(<A> + <B>, 1));

:rule r3

rule (goal Print results and try again)

IF (in Data Nota = <NOTA> AND Zand = <ZAND> AND Zor = <ZOR>

AND Pand = <PAND> AND Por = <POR> AND Band = <BAND> AND

Bor = <BOR> AND a = <A> AND b = <B>)

THEN

write "a <A> b <B>\n",

write "Min-max Zadehian logic\n",

write "a AND b <ZAND> a OR b <ZOR> NOT a <NOTA>\n",

write "Probabilistic logic\n",

write "a AND b <PAND> a OR b <POR> NOT a <NOTA>\n",

write "Bounded sum logic\n",

write "a AND b <BAND> a OR b <BOR> NOT a <NOTA>\n\n",

delete 1,

make Data;

message "Ready to run";

run;

It is easy to see that rule-based systems may not be optimal for efп¬Ѓcient numerical

computation. By using the advanced feature of recursion, we can solve differential

equations, compute factorials, and the like. (Recursion here means computation

when one or more rules or rule blocks makes itself reп¬Ѓreable until some goal is

reached.) But if heavy numerical computation is needed, it is often better to do

this in a more numerically oriented language like C or FORTRAN, and to use a

blackboard system for inter-program communication and control.

3.1.2 The Implication Operator

Another basic truth-functional operator used in fuzzy logic is logical implication,

written P implies Q, P ! Q or IF P, then Q. Table 3.2 is the truth table for

P ! Q. Three different methods for determining tv(P ! Q), among many other

methods listed in Klir and Yuan (1995, p. 309), are

tv(P ! Q) Вј 1 if tv(P) tv(Q), else tv(P ! Q) Вј 0 (3:9)

tv(P ! Q) Вј min(1, 1 ГЂ tv(P) Гѕ tv(Q)) (3:10)

tv(P ! Q) Вј max(1 ГЂ tv(P), min(tv(P), tv(Q))) (3:11)

TEAM LinG - Live, Informative, Non-cost and Genuine !

35

3.1 CLASSICAL LOGIC

TABLE 3.2 Truth Table for Logical Operator P

Implies Q

P Q P implies Q

0 0 1

0 1 1

1 0 0

1 1 1

Equation (3.11) may also be expressed in terms of OR and NOT as

P ! Q Вј (NOT P) OR Q (3:12)

The classical truth table for P ! Q is shown in Table 3.2.

The reader will probably п¬Ѓnd it difп¬Ѓcult to accept that if P is false, P ! Q is true

whether Q is true or false. Note that formal logic is not concerned with objective

truth in the ordinary sense of the word, but with consistency between premises

and conclusions. P being false is consistent with Q being true or false, since if P

is false we have no idea what Q might be. P ! Q does not only mean that if P is

true, then Q is true; it is a measure of the consistency of the truth value of P with

the truth value of Q. (Logicians have had no trouble with this for a very long time!)

Note that the implication operator, of its very nature, returns a possibility, not a

necessity. This is clear when we look at truth table 3.2 for the classical implication

operator P ! Q, where 0 ! 1 is true. Clearly, if the truth value of P is zero, we

cannot conclude that this requires the truth value of Q to be one, as would be the

case with necessity; on the other hand, if P is false, the truth value of Q might be

one for all we know, as is the case with possibility. For this reason, the implication

operator is of little or no use in a fuzzy reasoning system based on necessity; it is

included here because texts of fuzzy theory pay considerable attention to it.

Classical logic now continues using NOT, AND, OR and ! to derive other con-

nectives and prove theorems about disjunctive normal forms, various sets of primi-

tives, and so on. An important tool in classical logic for deriving new propositions

from old is the modus ponens, which can be written

if P AND (P ! Q) then Q (3:13)

which can be read вЂњIf P is true and P implies Q then Q is trueвЂќ. Note that the classical

modus ponens employs the implication operator.

The formulation of the modus ponens in (3.13) can be (and has been) misleading,

because of its strong resemblance to a rule in a rule-based language. However, note

that in the modus ponens and its counterpart, the fuzzy modus ponens, discussed in

Chapter 4, Section 4.3, both the antecedent (if . . .) and the consequent (then . . .) are

TEAM LinG - Live, Informative, Non-cost and Genuine !

36 FUZZY LOGIC, FUZZY SETS, AND FUZZY NUMBERS: I

стр. 16 |