Question? Leave a message!




Fuzzy logic and intelligent systems

fuzzy sets fuzzy logic and fuzzy systems and fuzzy sets fuzzy logic and fuzzy control systems andfuzzy logic and expert systems applications
Dr.NaveenBansal Profile Pic
Dr.NaveenBansal,India,Teacher
Published Date:25-10-2017
Website URL
Comment
CHAPTER 5 LOGIC AND FUZZY SYSTEMS PARTI LOGIC ‘‘I know what you’re thinking about,’’ said Tweedledum; ‘‘but it isn’t so, nohow.’’ ‘‘Contrari- wise,’’ continued Tweedledee, ‘‘if it was so, it might be; and if it were so, it would be; but as it isn’t, it ain’t. That’s logic.’’ LewisCarroll Through the Looking Glass,1871 Logic is but a small part of the human capacity to reason. Logic can be a means to compel us to infer correct answers, but it cannot by itself be responsible for our creativity or for our ability to remember. In other words, logic can assist us in organizing words to make clear sentences, but it cannot help us determine what sentences to use in various contexts. Consider the passage above from the nineteenth-century mathematician Lewis Carroll in his classic Through the Looking Glass. How many of us can see the logical context in the discourseofthesefictionalcharacters?Logicforhumansisawayquantitatively todevelop a reasoning process that can be replicated and manipulated with mathematical precepts. The interest in logic is the study of truth in logical propositions; in classical logic this truth is binary – a proposition is either true or false. From this perspective, fuzzy logic is a method to formalize the human capacity of imprecise reasoning, or – later in this chapter – approximate reasoning. Such reasoning representsthehumanability to reasonapproximately andjudge underuncertainty.Infuzzy logic all truths are partial or approximate. In this sense this reasoning has also been termed interpolative reasoning, where the process of interpolating between the binary extremes of true and false is represented by the ability of fuzzy logic to encapsulate partial truths. Fuzzy Logic with Engineering Applications, Second Edition T. J. Ross  2004 John Wiley & Sons, Ltd ISBNs: 0-470-86074-X (HB); 0-470-86075-8 (PB) www.MatlabSite.comCLASSICAL LOGIC 121 Part-I of this chapter introduces the reader to fuzzy logic with a review of classical logic and its operations, logical implications, and certain classical inference mechanisms such as tautologies. The concept of a proposition is introduced as are associated concepts of truth sets, tautologies, and contradictions. The operations of disjunction, conjunction, and negation are introduced as well as classical implication and equivalence; all of these are useful tools to construct compound propositions from single propositions. Operations on propositions are shown to be isomorphic with operations on sets; hence an algebra of propositionsisdevelopedbyusingthealgebraofsetsdiscussedinChapter 2.Fuzzylogicis then shown to be an extension of classical logic when partial truths are included to extend bivalued logic (true or false) to a multivalued logic (degrees of truth between true and not true). In Part-II of this chapter we introduce the use of fuzzy sets as a calculus for the interpretationofnaturallanguage.Naturallanguage,despiteitsvaguenessandambiguity,is the vehicle for human communication, and it seems appropriate that a mathematical theory that deals with fuzziness and ambiguity is also the same tool used to express and interpret the linguistic character of our language. The chapter continues with the use of natural language in the expression of a knowledge form known as rule-based systems, which shall be referred to generally as fuzzy systems. The chapter concludes with a simple graphical interpretation of inference,which is illustrated with some examples. CLASSICALLOGIC In classical logic, a simple proposition P is a linguistic, or declarative, statement contained withinauniverseofelements,sayX,thatcanbeidentifiedasbeingacollectionofelements inXthatarestrictly trueorstrictlyfalse.Hence,aproposition Pisacollectionofelements, i.e., a set, where the truth values for all elements in the set are either all true or all false. The veracity(truth)of anelement in theproposition Pcanbeassigned abinary truth value, called T(P), just as an element in a universe is assigned a binary quantity to measure its membership in a particular set. For binary (Boolean) classical logic, T(P) is assigned a value of 1 (truth) or 0 (false). If U is the universe of all propositions, then T is a mapping of the elements, u, in these propositions (sets) to the binary quantities (0, 1), or T : u ∈ U −→ (0,1) All elements u in the universe U that are true for proposition P are called the truth set of P, denotedT(P).Thoseelements uintheuniverseUthatarefalseforproposition Parecalled the falsity set of P. In logic we need to postulate the boundary conditions of truth values just as we do for sets; that is, in function-theoretic terms we need to define the truth value of a universe of discourse. For a universe Y and the null set ∅, we define the following truth values: T(Y) = 1 and T(∅) = 0 Now let P and Q be two simple propositions on the same universe of discourse that can be combined using the following five logical connectives www.MatlabSite.com122 LOGIC AND FUZZY SYSTEMS Disjunction (∨) Conjunction (∧) Negation (−) Implication (→) Equivalence (↔) to form logical expressions involving the two simple propositions. These connectives can be used to form new propositions from simple propositions. The disjunction connective, the logical or, is the term used to represent what is commonly referred to as the inclusive or. The natural language term or and the logical or differ in that the former implies exclusion (denoted in the literature as the exclusive or; further details are given in this chapter). For example, ‘‘soup or salad’’ on a restaurant menu implies the choice of one or the other option, but not both. The inclusive or is the one most often employed in logic; the inclusive or (logical or as used here) implies that a compound proposition is true if either of the simple propositions is true or both are true. Theequivalenceconnectivearisesfromdualimplication;thatis,forsomepropositions PandQ,if P → Q and Q → P,then P ↔ Q. Now define sets A and B from universe X (universe X is isomorphic with universe U), where these sets might represent linguistic ideas or thoughts. A propositional calculus (sometimes called the algebra of propositions) will exist for the case where proposition P measures the truth of the statement that an element, x, from the universe X is contained in set A and the truth of the statement Q that this element, x, is contained in set B, or more conventionally, P: truth that x ∈ A Q: truth that x ∈ B where truth is measured in terms of the truth value, i.e., ifx ∈ A,T(P) = 1; otherwise,T(P) = 0 ifx ∈ B,T(Q) = 1; otherwise,T(Q) = 0 or, using the characteristic function to represent truth (1) and falsity (0), the following notation results:  1,x ∈ A χ (x) = A 0,x ∈/ A A notion of mutual exclusivity arises in this calculus. For the situation involving two propositions P and Q, where T(P) ∩T(Q)=∅, we have that the truth of P always implies the falsity of Q and vice versa; hence, P and Q are mutually exclusive propositions. Example5.1. Let P be the proposition ‘‘The structural beam is an 18WF45’’ and let Q be the proposition ‘‘The structural beam is made of steel.’’ Let X be the universe of structural members comprisedof girders,beams,and columns; x isanelement (beam), Aistheset ofall wide-flange (WF) beams, and B is the set of all steel beams. Hence, P: x is in A Q: x is in B www.MatlabSite.comCLASSICAL LOGIC 123 The five logical connectives already defined can be used to create compound propositions, where a compound proposition is defined as a logical proposition formed by logically connecting two or more simple propositions. Just as we are interested in the truth of a simple proposition, classical logic also involves the assessment of the truth of compound propositions. For the case of two simple propositions, the resulting compound propositions are defined next in terms of their binary truth values. Given a proposition P: x ∈ A, P:x/ ∈ A, we have the following for the logical connectives: Disjunction P ∨Q: x ∈Aor x ∈ B (5.1a) Hence, T(P ∨Q) = max(T(P), T(Q)) Conjunction P ∧Q: x ∈Aand x ∈ B (5.1b) Hence, T(P ∧Q) = min(T(P), T(Q)) Negation If T(P) = 1, then T(P) = 0; if T(P) = 0, then T(P) = 1.(5.1c) Implication (P −→ Q) : x ∈Aor x ∈ B (5.1d) Hence, T(P −→ Q) = T(P ∪Q) Equivalence  1, forT(P) = T(Q) (P ←→ Q) : T(P ←→ Q) = (5.1e) 0, forT(P) = T(Q) The logical connective implication, i.e., P → Q (P implies Q), presented here is also known as the classical implication, to distinguish it from an alternative form devised in the 1930sbyLukasiewicz,aPolishmathematician,whowasfirstcreditedwithexploringlogics other than Aristotelian (classical or binary logic) Rescher, 1969, and from several other forms (see end of this chapter). In this implication the proposition P is also referred to as the hypothesis or the antecedent,and the proposition Q is also referredto as the conclusion or the consequent. The compound proposition P → Q is true in all cases except where a true antecedent P appears with a false consequent, Q, i.e., a true hypothesis cannot imply a false conclusion. Example5.2 SimilartoGill,1976. Consider the following four propositions: 1. If 1 +1 = 2, then 4 0. 2. If 1 +1 = 3, then 4 0. 3. If 1 +1 = 3, then 4 0. 4. If 1 +1 = 2, then 4 0. Thefirstthreepropositionsarealltrue;thefourthisfalse.Inthefirsttwo,theconclusion4 0 is true regardless of the truth of the hypothesis; in the third case both propositions are false, www.MatlabSite.com124 LOGIC AND FUZZY SYSTEMS but this does not disprove the implication; finally, in the fourth case, a true hypothesis cannot produce a false conclusion. Hence, the classical form of the implication is true for all propositions of P and Q except for those propositions that are in both the truth set of P and the false set of Q, i.e., T(P −→ Q) = T(P) ∩ T(Q)(5.2) This classical form of the implication operation requires some explanation. For a proposition P defined on set A and a proposition Q defined on set B, the implication ‘‘P implies Q’’ is equivalent to taking the union of elements in the complement of set A with the elements in the set B (this result can also be derived by using De Morgan’s principles on Eq. (5.2)). That is, the logical implication is analogous to the set-theoretic form (P −→ Q) ≡ (A ∪Bistrue) ≡ (either ‘‘not in A’’ or ‘‘in B’’) so that T(P −→ Q) = T(P ∨Q) = max(T(P), T(Q)) (5.3) This expression is linguistically equivalent to the statement, ‘‘P → Q is true’’ when either ‘‘not A’’ or ‘‘B’’ is true (logical or). Graphically, this implication and the analogous set operation are represented by the Venn diagram in Fig. 5.1. As noted in the diagram, the region representedby the differenceA B is the set region wherethe implication P → Q is false (the implication ‘‘fails’’). The shaded region in Fig. 5.1 represents the collection of elements in the universe where the implication is true; that is, the set A B = A ∪ B = A ∩ B If x is in A and x is not in B, then A −→ B fails ≡ A B (difference) Now, with two propositions (P and Q) each being able to take on one of two truth 2 values (true or false, 1 or 0), there will be a total of 2 = 4 propositional situations. These situations are illustrated, along with the appropriate truth values, for the propositions P and A A B B FIGURE5.1 Graphical analog of the classical implication operation; gray area is where implication holds. www.MatlabSite.comCLASSICAL LOGIC 125 TABLE5.1 Truth table for various compound propositions PQ PP∨QP∧QP→QP↔ Q T (1) T (1) F (0) T (1) T (1) T (1) T (1) T (1) F (0) F (0) T (1) F (0) F (0) F (0) F (0) T (1) T (1) T (1) F (0) T (1) F (0) F (0) F (0) T (1) F (0) F (0) T (1) T (1) Q and the various logical connectives between them in Table 5.1. The values in the last five columns of the table are calculated using the expressions in Eqs. (5.1) and (5.3). In Table 5.1 T (or 1) denotes true and F (or 0) denotes false. Suppose the implication operation involves two different universes of discourse; P is a proposition described by set A, which is defined on universe X, and Q is a proposition described by set B, which is defined on universe Y. Then the implication P → Q can be represented in set-theoretic terms by the relation R, where R is defined by R = (A ×B) ∪ (A ×Y) ≡ IF A, THEN B IF x ∈Awhere x ∈XandA ⊂ X (5.4) THEN y ∈Bwhere y ∈YandB ⊂ Y This implication, Eq. (5.4), is also equivalent to the linguistic rule form, IF A, THEN B. ThegraphicshowninFig. 5.2representsthespaceoftheCartesianproductX ×Y,showing typical sets A and B; and superposed on this space is the set-theoretic equivalent of the implication. That is, P −→Q: IF x ∈ A, THEN y ∈ B, or P −→ Q ≡ A ∪B The shaded regions of the compound Venn diagram in Fig. 5.2 represent the truth domain of the implication, IF A, THEN B (P → Q). Another compound proposition in linguistic rule form is the expression IF A, THEN B, ELSE C X A B Y FIGURE5.2 The Cartesian space showing the implication IF A, THEN B. www.MatlabSite.com126 LOGIC AND FUZZY SYSTEMS X A B C Y FIGURE5.3 Truth domain for IF A, THEN B, ELSE C. Linguistically, this compound proposition could be expressed as IF A, THEN B, and IF A, THEN C In classical logic this rule has the form (P −→ Q) ∧ (P −→ S) (5.5) P: x ∈ A,A ⊂ X Q: y ∈ B,B ⊂ Y S: y ∈ C,C ⊂ Y The set-theoretic equivalent of this compound proposition is given by IF A, THEN B, ELSE C ≡ (A ×B) ∪ (A ×C) = R = relation on X ×Y (5.6) The graphic in Fig. 5.3 illustrates the shaded region representing the truth domain for this compound proposition for the particular case where B ∩C=∅. Tautologies In classical logic it is useful to consider compound propositions that are always true, irrespective of the truth values of the individual simple propositions. Classical logical compound propositions with this property are called tautologies. Tautologies are useful for deductive reasoning, for proving theorems, and for making deductive inferences. So, if a compound proposition can be expressed in the form of a tautology, the truth value of that compound proposition is known to be true. Inference schemes in expert systems often employ tautologies becausetautologies areformulas that aretrue on logical grounds alone. For example, if A is the set of all prime numbers (A = 1, A = 2, A = 3, A = 5,...)on 1 2 3 4 the real line universe, X, then the proposition ‘‘A is not divisible by 6’’ is a tautology. i One tautology, known as modus ponens deduction, is a very common inference scheme used in forward-chaining rule-based expert systems. It is an operation whose task www.MatlabSite.comCLASSICAL LOGIC 127 is to find the truth value of a consequent in a production rule, given the truth value of the antecedent in the rule. Modus ponens deduction concludes that, given two propositions, Pand P → Q, both of which are true, then the truth of the simple proposition Q is automatically inferred. Another useful tautology is the modus tollens inference, which is used in backward-chaining expert systems. In modus tollens an implication between two propositions is combined with a second proposition and both are used to imply a third proposition. Some common tautologies follow: B ∪B ←→ X A ∪X; A ∪X ←→ X (A ∧ (A −→ B)) −→ B (modus ponens) (5.7) (B ∧ (A −→ B)) −→ A (modus tollens) (5.8) A simple proof of the truth value of the modus ponens deduction is provided here, along with the various properties for each step of the proof, for purposes of illustrating the utility of a tautology in classical reasoning. Proof (A ∧ (A −→ B)) −→ B (A ∧ (A ∪B)) −→ B Implication ((A ∧A) ∪ (A ∧B)) −→ B Distributivity (∅∪ (A ∧B)) −→ B Excluded middle axioms (A ∧B) −→ B Identity (A ∧B) ∪B Implication (A ∨B) ∪B De Morgan s principles A ∨ (B ∪B) Associativity A ∪X Excluded middle axioms X ⇒ T(X) = 1 Identity; QED A simpler manifestation of the truth value of this tautology is shown in Table 5.2 in truth table form, where a column of all ones for the result shows a tautology. TABLE5.2 Truth table (modus ponens) ABA→ B (A∧ (A→ B)) (A∧ (A→ B))→ B 00 1 0 1 0 1 1 0 1 Tautology 10 0 0 1 11 1 1 1 www.MatlabSite.com128 LOGIC AND FUZZY SYSTEMS TABLE5.3 Truth table (modus tollens) AB A BA→ B (B∧ (A→ B)) (B∧ (A→ B))→ A 0 011 1 1 1 0 110 1 0 1 Tautology 1 001 0 0 1 1 100 1 0 1 Similarly,asimpleproofofthetruthvalueofthe modus tollensinferenceislisted here. Proof (B ∧ (A −→ B)) −→ A (B ∧ (A ∪B)) −→ A ((B ∧A) ∪ (B ∧B)) −→ A ((B ∧A)∪∅) −→ A (B ∧A) −→ A (B ∧A) ∪A (B ∨A) ∪A B ∪ (A ∪A) B ∪X = X ⇒ T(X) = 1 QED The truth table form of this result is shown in Table 5.3. Contradictions Compoundpropositions thatarealwaysfalse,regardlessofthetruthvalueoftheindividual simple propositions constituting the compound proposition, are called contradictions. For example, if A is the set of all prime numbers (A = 1, A = 2, A = 3, A = 5,...)onthe 1 2 3 4 real line universe, X, then the proposition ‘‘A is a multiple of 4’’ is a contradiction. Some i simple contradictions are listed here: B ∩B A∩∅; A∩∅ Equivalence As mentioned, propositions P and Q are equivalent, i.e., P ↔ Q, is true only when both P and Q are true or when both P and Q are false. For example, the propositions P: ‘‘triangle www.MatlabSite.comCLASSICAL LOGIC 129 T(A) T(B) FIGURE5.4 Venn diagram for equivalence (darkened areas), i.e., forT(A ↔ B). isequilateral’’andQ:‘‘triangleisequiangular’’areequivalentbecausetheyareeitherboth true or both false for some triangle. This condition of equivalence is shown in Fig. 5.4, where the shaded region is the region of equivalence. It can be easily proved that the statement P ↔ Q is a tautology if P is identical to Q, i.e., if and only if T(P) = T(Q). Example5.3. Suppose we consider the universe of positive integers, X=1 ≤ n ≤ 8.Let P = ‘‘n is an even number’’ and let Q = ‘‘(3 ≤ n ≤ 7) ∧ (n = 6).’’ Then T(P)=2,4,6,8 and T(Q)=3,4,5,7. The equivalence P ↔ Q has the truth set T(P ←→ Q) = (T(P) ∩ T(Q)) ∪ (T(P) ∩ T(Q))=4∪1=1,4 One can see that ‘‘1 is an even number’’ and ‘‘(3 ≤ 1 ≤ 7) ∧ (1 = 6)’’ are both false, and ‘‘4 is an even number’’ and ‘‘(3 ≤ 4 ≤ 7) ∧ (4 = 6)’’ are both true. Example5.4. Prove that P ↔QifP = ‘‘n is an integer power of 2 less than 7 and greater 2 than zero’’ and Q = ‘‘n −6n +8 = 0.’’ Since T(P)=2,4 and T(Q)=2,4, it follows that P ↔ Q is an equivalence. Suppose a proposition R has the form P → Q. Then the proposition Q → P is called the contrapositive of R; the proposition Q → P is called the converse of R; and the proposition P → Q is called the inverse of R. Interesting properties of these propositions can be shown (see Problem 5.3 at the end of this chapter). The dual of a compound proposition that does not involve implication is the same proposition with false (0) replacing true (1) (i.e., a set being replaced by its complement), true replacing false, conjunction (∧) replacing disjunction (∨), and disjunction replacing conjunction. If a proposition is true, then its dual is also true (see Problems 5.4 and 5.5). ExclusiveOrandExclusiveNor Two more interesting compound propositions are worthy of discussion. These are the exclusive or and the exclusive nor. The exclusive or is of interest because it arises in many situations involving natural language and human reasoning. For example, when you are going to travel by plane or boat to some destination, the implication is that you can travel by air or sea, but not both, i.e., one or the other. This situation involves the exclusive or; it www.MatlabSite.com130 LOGIC AND FUZZY SYSTEMS TABLE5.4 Truth table for exclusive or, XOR PQPXORQ 11 0 10 1 01 1 00 0 T(P) T(Q) FIGURE5.5 Exclusive orshowningrayareas. TABLE5.5 Truthtableforexclusivenor PQ PXORQ 11 1 10 0 01 0 00 1 does not involve the intersection, as does the logical or (union in Eq. (2.1) and Fig. 2.2 and disjunction in Eq. (5.1a)). For two propositions, P and Q, the exclusive or, denoted here as XOR, is given in Table 5.4 and Fig. 5.5. The exclusive nor is the complement of the exclusive or Mano, 1988. A look at its truth table, Table 5.5, shows that it is an equivalence operation, i.e., P XORQ ←→ (P ←→ Q) and, hence, it is graphically equivalent to the Venn diagram in Fig. 5.4. LogicalProofs Logicinvolvestheuseofinferenceineverydaylife,aswellasinmathematics.Inthelatter, we often want to prove theorems to form foundations for solution procedures. In natural www.MatlabSite.comCLASSICAL LOGIC 131 language, if we are given some hypotheses it is often useful to make certain conclusions from them – the so-called process of inference (inferring new facts from established facts). In the terminology we have been using, we want to know if the proposition (P ∧P ∧···∧P ) → Q is true. That is, is the statement a tautology? 1 2 n The process works as follows. First, the linguistic statement (compound proposition) ismade.Second,thestatementisdecomposedintoitsrespectivesinglepropositions.Third, the statement is expressed algebraically with all pertinent logical connectives in place. Fourth, a truth table is used to establish the veracity of the statement. Example5.5. Hypotheses: Engineers are mathematicians. Logical thinkers do not believe in magic. Mathe- maticians are logical thinkers. Conclusion: Engineers do not believe in magic. Let us decompose this information into individualpropositions. P : a person is an engineer Q : a person is a mathematician R : a person is a logical thinker S : a person believes in magic The statements can now be expressed as algebraic propositionsas ((P −→ Q) ∧ (R −→ S) ∧ (Q −→ R)) −→ (P −→ S) It can be shown that this compound propositionis a tautology (see Problem 5.6). Sometimes it might be difficult to prove a proposition by a direct proof (i.e., verify that it is true), so an alternative is to use an indirect proof. For example, the popular proof by contradiction (reductio ad absurdum) exploits the fact that P → Q is true if and only if P ∧Q is false. Hence, if we want to prove that the compound statement (P ∧P ∧···∧P ) → Q is a tautology, we can alternatively show that the alternative 1 2 n statement P ∧P ∧···∧P ∧Q is a contradiction. 1 2 n Example5.6. Hypotheses: If an arch-dam fails, the failure is due to a poor subgrade. An arch-dam fails. Conclusion: The arch-dam failed because of a poor subgrade. This information can be shown to be algebraically equivalent to the expression ((P −→ Q) ∧P) −→ Q To prove this by contradiction, we need to show that the algebraic expression ((P −→ Q) ∧P ∧Q) is a contradiction. We can do this by constructing the truth table in Table 5.6. Recall that a contradiction is indicated when the last column of a truth table is filled with zeros. www.MatlabSite.com132 LOGIC AND FUZZY SYSTEMS TABLE5.6 Truth table for dam failure problem PQ P Q P∨Q (P∨Q)∧P∧Q 0 011 1 0 0 110 1 0 1 001 0 0 1 100 1 0 DeductiveInferences The modus ponens deduction is used as a tool formaking inferencesin rule-basedsystems. A typical if–then rule is used to determine whether an antecedent(causeor action) infers a consequent (effect or reaction). Suppose we have a rule of the form IF A, THEN B, where A is a set defined on universe X and B is a set defined on universe Y. As discussed before, this rule can be translated into a relation between sets A and B; that is, recalling Eq. (5.4), R = (A ×B) ∪ (A ×Y). Now suppose a new antecedent, say A, is known. Can we use modus ponens deduction, Eq. (5.7), to infer a new consequent, say B, resulting from the new antecedent? That is, can we deduce, in rule form, IF A,THEN B? The answer, of course,is yes,through theuseofthecomposition operation(definedinitially in Chapter 3). Since‘‘Aimplies B’’is definedon theCartesianspace X ×Y, B canbe foundthrough the following set-theoretic formulation, again from Eq. (5.4): ◦ ◦ B = A R = A ((A ×B) ∪ (A ×Y)) ◦ wherethesymbol denotesthecompositionoperation. Modus ponensdeductioncanalsobe usedforthecompoundruleIFA,THENB,ELSEC,wherethiscompoundruleisequivalent to the relation defined in Eq. (5.6) as R = (A ×B) ∪ (A ×C). For this compound rule, if wedefineanotherantecedentA,thefollowingpossibilitiesexist,dependingon(1) whether A is fully contained in the original antecedent A, (2) whether A is contained only in the complement of A, or (3) whether A and A overlap to some extent as described next: IF A ⊂ A, THEN y = B IF A ⊂ A, THEN y = C IF A ∩A =∅, A ∩A =∅, THEN y = B ∪C TheruleIFA,THENB(proposition Pis definedon setAinuniverseX,andproposition Q isdefinedon setBin universeY),i.e., (P → Q) = R = (A ×B) ∪ (A ×Y),isthen defined in function-theoretic terms as χ (x, y) = max(χ (x) ∧ χ (y)), ((1 − χ (x)) ∧1) (5.9) R A B A where χ( ) is the characteristic function as defined before. Example5.7. Suppose we have two universes of discourse for a heat exchanger problem described by the following collection of elements, X=1,2,3,4 and Y=1,2,3,4,5,6. www.MatlabSite.comCLASSICAL LOGIC 133 Suppose X is a universe of normalized temperatures and Y is a universe of normalized pressures.DefinecrispsetAonuniverseXandcrispsetBonuniverseYasfollows:A=2,3 and B=3,4. The deductive inference IF A, THEN B (i.e., IF temperature is A, THEN pressure is B) will yield a matrix describing the membership values of the relation R, i.e., χ (x, y) through the use of Eq. (5.9). That is, the matrix R represents the rule IF A, THEN B R as a matrix of characteristic (crisp membership) values. Crisp sets A and B can be written using Zadeh’s notation,   0 1 1 0 A = + + + 1 2 3 4   0 0 1 1 0 0 B = + + + + + 1 2 3 4 5 6 If we treat set A as a column vector and set B as a row vector, the following matrix results from the Cartesian product of A ×B, using Eq. (3.16):   0 000 00 0 011 00 A ×B =   0 011 00 0 000 00 The Cartesian product A ×Y can be determined using Eq. (3.16) by arrangingAasacolumn vectorandtheuniverseYasarowvector(setsAandYcanbewrittenusingZadeh’snotation),   1 0 0 1 A = + + + 1 2 3 4   1 1 1 1 1 1 Y = + + + + + 1 2 3 4 5 6   111 11 1 000 00 0 A ×Y =   000 00 0 111 11 1 Then the full relation R describing the implication IF A, THEN B is the maximum of the two matrices A ×Band A ×Y, or, using Eq. (5.9), 123 45 6   1 111 11 1 2001 10 0 R =   3 001 10 0 4 111 11 1 The compound rule IF A, THEN B, ELSE C can also be defined in terms of a matrix relation as R = (A ×B) ∪ (A ×C) ⇒ (P → Q) ∧ (P → S),asgivenbyEqs.(5.5) and (5.6), where the membership function is determined as χ (x, y) = max(χ (x) ∧ χ (y)), ((1 − χ (x)) ∧ χ (y)) (5.10) R A B A C Example5.8. Continuing with the previous heat exchanger example, suppose we define a crisp set C on the universe of normalized temperatures Y as C=5,6, or, using Zadeh’s notation,   0 0 0 0 1 1 C = + + + + + 1 2 3 4 5 6 The deductive inference IF A, THEN B, ELSE C (i.e., IF pressure is A, THEN temperature is B, ELSE temperature is C) will yielda relational matrix R, withcharacteristic values χ (x, y) R www.MatlabSite.com134 LOGIC AND FUZZY SYSTEMS obtainedusingEq. (5.10).ThefirsthalfoftheexpressioninEq. (5.10) (i.e.,A ×B)hasalready been determined in the previous example. The Cartesian product A ×C can be determined using Eq. (3.16) by arranging the set A as a column vector and the set C as a row vector (see set A in Example 5.7), or   000 01 1 000 00 0 A ×C =   000 00 0 000 01 1 ThenthefullrelationRdescribingtheimplicationIFA,THENB,ELSECisthemaximum of the two matrices A ×Band A ×C (see Eq. (5.10)), 12 34 56   1 0 00 01 1 2 0 01 10 0   R =   3 0 01 10 0 4 0 00 01 1 FUZZYLOGIC The restriction of classical propositional calculus to a two-valued logic has created many interesting paradoxesover the ages.For example, the Barberof Seville is a classic paradox (also termed Russell’s barber). In the small Spanish town of Seville, there is a rule that all andonlythosemenwhodonotshavethemselvesareshavedbythebarber.Whoshavesthe barber?AnotherexamplecomesfromancientGreece.Does theliar fromCretelie whenhe claims, ‘‘All Cretians are liars?’’ If he is telling the truth, his statement is false. But if his statementisfalse,heisnottellingthetruth.Asimplerformofthisparadoxisthetwo-word proposition, ‘‘I lie.’’ The statement can not be both true and false. Returning to the Barber of Seville, we conclude that the only way for this paradox (or any classic paradox for that matter) to work is if the statement is both true and false simultaneously. This can be shown, using set notation Kosko, 1992. Let S be the proposition that the barber shaves himself and S (not S) that he does not. Then since S → S (S implies not S), and S → S, the two propositions are logically equivalent: S ↔ S. Equivalent propositions have the same truth value; hence, T(S) = T(S) = 1 −T(S) which yields the expression 1 T(S) = 2 As seen, paradoxes reduce to half-truths (or half-falsities) mathematically. In classical binary (bivalued) logic, however, such conditions are not allowed, i.e., only T(S) = 1 or 0 is valid; this is a manifestation of the constraints placed on classical logic by the excluded middle axioms. Amoresubtleformofparadoxcanalsobeaddressedbyamultivaluedlogic.Consider the paradoxes represented by the classical sorites (literally, a heap of syllogisms); for example, the case of a liter-full glass of water. Often this example is called the Optimist’s conclusion(istheglasshalf-fullorhalf-emptywhenthevolumeisat500milliliters?).Isthe liter-fullglassstill fullifweremove1milliliter ofwater?Istheglassstill fullifweremove www.MatlabSite.comFUZZY LOGIC 135 2 milliliters of water, 3, 4, or 100 milliliters? If we continue to answer yes, then eventually we will have removed all the water, and an empty glass will still be characterized as full At what point did the liter-full glass of water become empty? Perhaps at 500 milliliters full? Unfortunately no single milliliter of liquid provides for a transition between full and empty. This transition is gradual, so that as each milliliter of water is removed, the truth value of the glass being full gradually diminishes from a value of 1 at 1000 milliliters to 0 at 0 milliliters. Hence, for many problems we have need for a multivalued logic other than the classic binary logic that is so prevalent today. A relatively recent debate involving similar ideas to those in paradoxes stems from a paper by psychologists Osherson and Smith 1981, in which they claim (incorrectly) that fuzzy set theory is not expressive enough to represent strong intuitionistic concepts. This idea can be described as the logically empty and logically universal concepts. The authors argued that the concept apple that is not an apple is logically empty,andthat the concept fruit that either is or is not an apple is logically universal. These concepts are correct for classical logic; the logically empty idea and the logically universal idea are the axiom of contradiction and the axiom of the excluded middle, respectively. The authors argued that fuzzy logic also should adhere to these axioms to correctly represent concepts in natural language but, of course, there is a compelling reason why they should not. Several authorities have disputed this argument (see Belohlavek et al., 2002). While the standard fuzzy operations do not obey the excluded middle axioms, there are other fuzzy operations for intersection, union, and complement that do conform to these axioms if such confirmation is required by empirical evidence. More to the point, however, is that the concepts of apple and fruit are fuzzy and, as fruit geneticists will point out, there are some fruits that can appear to be an apple that genetically are not an apple. A fuzzy logic proposition, P, is a statement involving some concept without clearly ∼ definedboundaries.Linguisticstatementsthattendtoexpresssubjectiveideasandthatcanbe interpreted slightly differently by various individuals typically involve fuzzy propositions. Most natural language is fuzzy, in that it involves vague and imprecise terms. Statements describing a person’s height or weight or assessments of people’s preferencesabout colors or menus can be used as examples of fuzzy propositions. The truth value assigned to P can ∼ be any value on the interval 0,1. The assignment of the truth value to a proposition is actuallyamappingfromtheinterval 0,1totheuniverseUoftruth values, T,asindicated in Eq. (5.11), T : u ∈ U −→ (0,1)(5.11) As in classical binary logic, we assign a logical proposition to a set in the universe of discourse.Fuzzypropositions areassignedto fuzzysets.Supposeproposition Pis assigned ∼ to fuzzy set A; then the truth value of a proposition, denotedT(P),isgivenby ∼ ∼ T(P) = µ (x) where 0 ≤ µ ≤ 1 (5.12) A A ∼ ∼ ∼ Equation (5.12) indicates that the degree of truth for the proposition P : x ∈ A is equal to ∼ ∼ the membership grade of x in the fuzzy set A. ∼ The logical connectives of negation, disjunction, conjunction, and implication are also defined for a fuzzy logic. These connectives are given in Eqs. (5.13)–(5.16) for two simple propositions: proposition P defined on fuzzy set A and proposition Q defined on ∼ ∼ ∼ fuzzy set B. ∼ www.MatlabSite.com136 LOGIC AND FUZZY SYSTEMS Negation T(P) = 1 −T(P)(5.13) ∼ ∼ Disjunction P ∨Q : x is A or B T(P ∨Q) = max(T(P), T(Q)) (5.14) ∼ ∼ ∼ ∼ ∼ ∼ ∼ ∼ Conjunction P ∧Q : x is A and B T(P ∧Q) = min(T(P), T(Q)) (5.15) ∼ ∼ ∼ ∼ ∼ ∼ ∼ ∼ Implication Zadeh, 1973 P −→ Q : x is A, then x is B ∼ ∼ ∼ ∼ T(P −→ Q) = T(P ∨Q) = max(T(P), T(Q)) (5.16) ∼ ∼ ∼ ∼ ∼ ∼ As before in binary logic, the implication connective can be modeled in rule-based form; P → Q is, IF x is A,THEN y is B and it is equivalent to the following fuzzy relation, ∼ ∼ ∼ ∼ R = (A ×B) ∪ (A ×Y) (recall Eq. (5.4)), just as it is in classical logic. The membership ∼ ∼ ∼ ∼ function of R is expressed by the following formula: ∼ µ (x, y) = max(µ (x) ∧ µ (y)), (1 − µ (x)) (5.17) R A B A ∼ ∼ ∼ ∼ Example5.9. Suppose we are evaluating a new invention to determine its commercial potential. We will use two metrics to make our decisions regarding the innovation of the idea. Our metrics are the ‘‘uniqueness’’ of the invention, denoted by a universe of novelty scales, X=1,2,3,4, and the ‘‘market size’’ of the invention’s commercial market, denoted on a universe of scaled market sizes, Y=1,2,3,4,5,6. In both universes the lowest numbers are the ‘‘highest uniqueness’’ and the ‘‘largest market,’’ respectively. A new invention in your group, say a compressible liquid of very useful temperature and viscosityconditions,has just received scores of ‘‘medium uniqueness,’’ denoted by fuzzy set A, and ‘‘medium market ∼ size,’’ denoted fuzzy set B. We wish to determine the implication of such a result, i.e., IF A, ∼ ∼ THEN B. We assign the invention the following fuzzy sets to represent its ratings: ∼  0.6 1 0.2 A = medium uniqueness = + + ∼ 2 3 4  0.4 1 0.8 0.3 B = medium market size = + + + ∼ 2 3 4 5  0.3 0.5 0.6 0.6 0.5 0.3 C = diffuse market size = + + + + + ∼ 1 2 3 4 5 6 The following matrices are then determined in developing the membership function of the implication, µ (x, y), illustrated in Eq. (5.17), R ∼ 12 3 4 56   1 0 00 00 0 20 0.40.60.60.30   A ×B =   ∼ ∼ 30 0.410.80.30 40 0.20.20.20.20 www.MatlabSite.comAPPROXIMATE REASONING 137 12 34 5 6   1 1 11 111 20.40.40.40.40.40.4   A ×Y =   ∼ 3 0 00 000 40.80.80.80.80.80.8 and finally, R = max(A ×B,A ×Y) ∼ ∼ ∼ ∼ 1 234 56   1 1 111 11 20  .40.40.60.60.40.4 R =   ∼ 30 0.410.80.30 40.80.80.80.80.80.8 When the logical conditional implication is of the compound form IF x is A, THEN y is B, ELSE y is C ∼ ∼ ∼ then the equivalent fuzzy relation, R, is expressed as R = (A ×B) ∪ (A ×C), in a form ∼ ∼ ∼ ∼ ∼ ∼ just as Eq. (5.6), whose membership function is expressed by the following formula: µ (x, y) = max (µ (x) ∧ µ (y)), ((1 − µ (x)) ∧ µ (y)) (5.18) R A B A C ∼ ∼ ∼ ∼ ∼ Hence, using the result of Eq. 5.18, the new relation is 123456   10.30.50.60.60.50.3   20.30.40.40.40.40.3   R = (A ×B) ∪ (A ×C)(A ×C): A ×C = ∼ ∼ ∼ ∼ ∼ ∼ ∼ ∼ ∼   3 000000 40.30.50.60.60.50.3 and finally, 123 456   10.30.50.60.60.50.3   20.30.40.60.60.40.3   R =   ∼ 30 0.41 0.80.30 40.30.50.60.60.50.3 APPROXIMATEREASONING The ultimate goal of fuzzy logic is to form the theoretical foundation for reasoning about imprecise propositions; such reasoning has been referred to as approximate reasoning Zadeh, 1976, 1979. Approximate reasoning is analogous to classical logic for reasoning www.MatlabSite.com138 LOGIC AND FUZZY SYSTEMS with precise propositions, and hence is an extension of classical propositional calculus that deals with partial truths. Suppose we have a rule-based format to represent fuzzy information. These rules are expressed in conventional antecedent-consequent form, such as Rule 1: IF x is A,THEN y is B,whereA and B represent fuzzy propositions (sets). ∼ ∼ ∼ ∼ Now suppose we introduce a new antecedent, say A , and we consider the following rule: ∼ Rule 2: IF x is A,THEN y is B. ∼ ∼ From information derived from Rule 1, is it possible to derive the consequent in Rule 2, B? The answer is yes, and the procedure is fuzzy composition. The consequent B can be ∼ ∼ ◦ found from the composition operation, B = A R. ∼ ∼ ∼ The two most common forms of the composition operator are the max–min and the max–product compositions, as initially defined in Chapter 3. Example5.10. Continuing with the invention example, Example 5.9, suppose that the fuzzy relationjustdeveloped,i.e.,R,describestheinvention’scommercialpotential.Wewishtoknow ∼ what market size would be associated with a uniqueness score of ‘‘almost high uniqueness.’’ That is, with a new antecedent, A , the following consequent, B , can be determined using ∼ ∼ composition. Let  0.5 1 0.3 0 A = almost high uniqueness = + + + ∼ 1 2 3 4 Then, using the following max–min composition,  0.5 0.5 0.6 0.6 0.5 0.5 ◦ B = A R = + + + + + ∼ ∼ ∼ 1 2 3 4 5 6 we get the fuzzy set describing the associated market size. In other words, the consequent is fairly diffuse, where there is no strong (or weak) membership value for any of the market size scores (i.e., no membership values near 0 or 1). Thispoweroffuzzylogicandapproximatereasoningtoassessqualitativeknowledge canbeillustratedinmorefamiliartermstoengineersinthecontextofthefollowingexample in the field of biophysics. Example5.11. For research on the human visual system, it is sometimes necessary to characterizethestrengthofresponsetoavisualstimulusbasedonamagneticfieldmeasurement or on an electrical potential measurement. When usingmagnetic field measurements, a typical experimentwillrequirenearly100off/onpresentationsofthestimulusatonelocationtoobtain usefuldata.Iftheresearcherisattemptingtomapthevisualcortexofthebrain,severalstimulus locationsmustbeusedintheexperiments.Whenworkingwithanewsubject,aresearcherwill makepreliminarymeasurementstodetermineifthetypeofstimulusbeingusedevokesagood −15 response in the subject. The magnetic measurements are in units of femtotesla (10 tesla). Therefore, the inputs and outputsare both measured in terms of magnetic units. WewilldefineinputsontheuniverseX = 0,50,100,150,200femtotesla,andoutputs on the universe Y = 0,50,100,150,200 femtotesla. We will define two fuzzy sets, two different stimuli,on universe X:  1 0.9 0.3 0 0 W = ‘‘weak stimulus’’ = + + + + ⊂ X ∼ 0 50 100 150 200  0 0.4 1 0.4 0 M = ‘‘medium stimulus’’ = + + + + ⊂ X ∼ 0 50 100 150 200 www.MatlabSite.comAPPROXIMATE REASONING 139 and one fuzzy set on the output universe Y,  0 0 0.5 0.9 1 S = ‘‘severe response’’ = + + + + ⊂ Y ∼ 0 50 100 150 200 The complement of S will then be ∼  1 1 0.5 0.1 0 S = + + + + ∼ 0 50 100 150 200 We will construct the proposition: IF ‘‘weak stimulus’’ THEN not ‘‘severe response,’’ using classical implication. IF W THEN S = W −→ S = (W ×S) ∪ (W ×Y) ∼ ∼ ∼ ∼ ∼ ∼ ∼ 0 50 100 150 200     01 10.50.10 1   50 0.90.90.50.10  0.9     100 0.30.30.30.10 W ×S = 0.3 1 1 0.50.10 =     ∼ ∼     150 0 0 0 0 0 0 200 0 0 0 0 0 0 0 50 100 150 200     0 00 0 0 0 0  .1 50 0.10.10.10.10.1     .7 100 0.70.70.70.70.7 W ×Y = 11111 =   ∼     1 150 1 1 1 1 1 1 200 1 1 1 1 1 0 50 100 150 200   01 10.50.10 50 0.90.90.50.10.1     100 0.70.70.70.70.7 R = (W ×S) ∪ (W ×Y) =   ∼ ∼ ∼ ∼   150 1 1 1 1 1 200 1 1 1 1 1 This relation R, then, expresses the knowledge embedded in the rule: IF ‘‘weak stimuli’’ ∼ THEN not ‘‘severe response.’’ Now, using a new antecedent (IF part) for the input, M = ∼ ‘‘medium stimuli,’’ and a max–min composition we can find another response on the Y ◦ universe to relate approximately to the new stimulus M, i.e., to find M R: ∼ ∼ ∼ 0 50 100 150 200   11 0.50.10 0.90.90.50.10.1   ◦ M R = 0 0.41 0.40 0.70.70.70.70.7 = 0.70.70.70.70.7   ∼ ∼   1 1 111 1 1 111 This result might be labeled linguisticallyas ‘‘no measurable response.’’ An interesting issue in approximate reasoning is the idea of an inverse relationship betweenfuzzyantecedentsandfuzzyconsequencesarisingfromthecompositionoperation. www.MatlabSite.com