From Logic To Fuzzy Logic
From Logic To Fuzzy Logic
John L. Gordon
Abstract:
Fuzzy logic enables a computer to make decisions which care more in line with the sort of decisions which a human would make. Computer logic is rigorous and deterministic and relates to finite states and numbering systems. Computer logic marks distinct boundaries between any states. For instance, given various weather conditions to process such as, stormy, rainy, cloudy, sunny, ordinary logic would assign one of these values to any weather condition being observed. People however would recognise all sorts of shades in between theses states such as dull or drizzle etc. This is exactly what fuzzy logic can do. What is more impressive is that fuzzy logic offers a way of processing these decisions so that a final result is still correct. This text provides an overview of the general subject of logic, taking a multi-perspective view. Fuzzy logic is considered following a background description of other logics. Concluding statements present fuzzy logic as an element in the set of logic types.
functions. These functions have also been implemented in electronic, hydraulic and pneumatic gates. There are more functions than those mentioned above. Some people may be familiar with 'NAND' and 'NOR' gates. A complete list of logic functions for two inputs is shown below.
A B 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Table 1
Some of the 16 functions (0..15) are not useful ones such as function (0) which is always zero. Most of the functions perform a useful operation.
Function num. Function 0 Function 1 Function 2 Function 3 Function 4 Function 5 Function 6 Same as B Exclusive OR B Same as A A Operation Always zero AND Symbol 0
Function 7
OR
Function 8
Equivalent Not B B
Function 13
Function 14 Function 15
Table 2
Some texts use different symbols than those shown above but these are fairly standard. Many type written texts use the following symbols to make type setting easier and avoid unusual symbols.
A.B -> A AND B A + B -> A OR B ~A -> NOT A ~(A .B) -> NOT (A AND B)
Electrical, electronic, pneumatic and hydraulic circuits can be described with the aid of logical expression. An example of such an expression:
Figure 1
Logic also involves the use of various theorems/ axioms and methods which permit manipulation of logic expressions. Such theorems/axioms include:
Figure 2
Theorems such as these can be applied to a logic (often switching) circuit to reduce the cumber of active devices in a circuit operate faster when implemented in a hardware configuration. The last theorem listed above, de Morgan's theorem, is often used to convert circuits made from 'AND'. 'OR' and 'Not functions into all 'NAND' or all 'NOR' functions. This was necessary because 'NAND' and 'Nor' functions were much easier to implement on integrated circuits and only one type of circuit function was needed.
Each of these signs are used when the programmer wishes to manipulate numbers in the same way as logic expressions are manipulated above. There is however, another form of logic which is also used in programming. This type of logic is termed Boolean logic, although Boolean algebra is also a term used to describe the logic manipulations used in engineering. The term us used here because the logic only deals with TRUTH values (true of false) and not with the specific numbers which result from combining logic expressions and numbers. Any expression can be wither TRUE or FALSE and the logic is used to make decisions based on these states. For instance:
If (the room is occupied) AND ( the_light is low) then turn on the light
In the above example, 'the_room', occupied', 'the_light' and 'low' would all be variables in the computer language and would equate to some value. In this case the word 'is' means to compare a variable with a value. In this case, the logic will only be concerned with the fact that,
(the_room is occupied) is TRUE AND (the_light is low) is also TRUE
in order to establish that the action 'turn on the light' should be performed. The value of the variables is not considered in the result. In the language 'C', this expression may be written as:
If ((the_room == occupied) && ( the_light == low)) operate(light);
Note that when testing for equality in 'C' the '==' is used instead of '='. Also note that '&&' is used to test a Boolean AND function which is only dealing with TRUTH and not with values. If the Boolean TRUTH test for OR is required the sign would be '||'. The computer programmer must therefore be able to distinguish between the sorts of logic which are required in each case. In the language of 'C' for instance, using an incorrect logic operator may not cause an error as the programme is compile, but the programme will fail to work correctly.
AI makes much greater use of the implication operator ( function 13 in table 2). Logic in AI begins with the 'Propositional Calculus'. A 'proposition' will have a TRUTH value only, it will either be TRUE or FALSE. A typical proposition may be:
My car is grey
One of the most useful relationships which is used to manipulate expressions in Propositional Logic is the Modus Ponen. The modus ponen expression states that:
If you know X to be TRUE and X implies Y, then Y is also TRUE.
Figure 3
Propositional Calculus is formed from logic sentences using the connectives (AND, OR,NOT etc) in the same way as has been described for the logic used in Engineering. The theorems shown in figure 2 also apply to prepositional calculus, it is only the symbolism which separates the two. Predicate Calculus provides an extension to Propositional Calculus. A predicate is similar to a function which returns TRUE or FALSE when supplied with certain arguments. Typical examples of predicates may be:
Is_red(my_car) : One place predicate: is_red() Is_greater_than ( 7,4 ) : Two place predicate: is_greater_than(,)
Two quantifiers are also added to the list of logical operators. These are the 'universal quantifier' and the 'existential quantifier'. The 'universal quantifier' can also be read as 'for every', and the existential quantifier can be read as 'there exits'.
Figure 4
Figure 5
Along with the new operators, there also exists a number of additional theorems and functions. Some of these are aimed at converting expressions which contain existential quantifiers to those which do not. For example, 'Skolemisation employs an extra function (skolem function) to remove an existential quantifier from the scope of a universal quantifier. Example:
Figure 6
requirements and goals of each discipline tend to favour the use of certain aspects of logic over other aspects. The goals of Engineering are usually to design and describe a system or circuit in a logical way and then to reduce the circuit so that it performs the same function as intended but at a lower cost. Computer scientists and software engineers aim to produce programmes which are logical , dependable and predictable and will use the syntax of the preferred computer language to implement these properties. Scientists in Artificial Intelligence may be using logic to express a particular thought process or implement a theory concerned with reasoning or learning. The goals here are often much more complex and extensions to basic logic are often required.
Figure 7
Note the use of the '~' symbol for NOT. Modal operators in logic provide additional flexibility in expressing natural events and activities.
Temporal logic operators allow the logic expression to indicate time or order to events and activities. Temporal operators allow the logic to talk about the future and the past.
Figure 8
Set Theory
This may seem like an unusual place in a document about logic, to begin talking about sets. Set theory is felt by many to be the foundation of mathematics. It is started here so that it may be compared with fuzzy set theory to follow.
Is the set of positive, odd integers which have a value less than 10. The same set may be described by its characteristics instead of its separate elements. The following set is identical to the one shown above.
{ x | x is a positive integer, x<10, x is an odd number}
The'|' reads as 'such that' and the set description above may be read as:
X is an element of this set, such that, x is a positive integer, x<10 and x is an odd number.
Each in a set is called an 'element' of that set. Sets can be manipulated using basic operators.
Figure 9
The standard theorems from logic (figure 2) may also be used with sets although the precise implementation will look different. Sets can be useful for making further inference about known facts. For example:
The 68000 is an element of the set of microprocessors. Microprocessors are a sub set of the set of digital devices.
It can be reasoned therefore that the 68000 is a digital device because it must be part of the set of digital devices. Returning to the first words in this document concerning states of weather; states were defined as stormy, raining, cloudy and sunny. Therefore a set of weather state 'W' could be defined as:
W={stormy, raining, cloudy, sunny }
The set may also be separated into sub sets of good weather and bad weather as follows.
GW={cloudy, sunny} and BW ={stormy, raining}
(depending on your point of view of course) In this case, the distinction between good weather (GW) and bad weather (BW) is clear. However this may not be what is required.
Fuzzy Sets
Fuzzy sets do not have distinct boundaries in the same way as normal sets. Membership of a normal set is either TRUE or FALSE. Each element of a fuzzy set has a value associated with it indicating the degree of membership. Degree of membership for any element of a fuzzy set is considered as a value which lies between '0' for not a number, to '1' which represents complete or full membership. Every element of a fuzzy set will therefore have a number between 0..1 associated with it. The following fuzzy set provides an example.
A = { M1/ e1, M2/ e2, M3/ e3, M4/ e4 }
Where :
e1, e2, e3, e4, are fuzzy elements of the set A.
M1, M2, M3, M4, are membership values associated with each element.
For instance, consider the two sets called 'BLACK' and 'WHITE'. Each set contains many elements which may be either by pure black or perfect white and many of the shades of grey in between. So the elements of the set, labelled 'g' for grey in the this case, may be:
g1,g2,g3,g4,g5,g6,g7
From this description, it can be seen that 'g1' is pure white and 'g7' is pure black.
Figure 10
Figure 10 shows the graded membership of the set 'W'. It is also clear from the figure that elements can belong to more than one conflicting set and that set boundaries may overlap.
Figure 11
Fuzzy Logic
Fuzzy sets can be manipulated with logic expressions which are similar to those used with ordinary sets and logic. For instance, it is possible for one set to be a sub set of another, for the union of intersection of two sets to be considered and for and inverse set to be constructed. For the discussion which follows, consider the following set of people.
People = { Anna, John, Sue, Peter, Jim, David, Mary, Jane, Mike, Sally }
From the basic set of people, two non fuzzy sets, male people and female people could be derived. Alternatively, these sets could be described in a fuzzy was by assigning each person to one set only with a membership value of '1'. We could consider the following statistics about the set of people described. Table 3 and figure 12 shows the age profile of the set of people defined above. Later we will look at new fuzzy sets, those of YOUNG and OLD people. As a guide to this task, the average age of the entire set of people can be seen to be 39.2 years. Figure 13 and Table 4 show the heights of the set of people under consideration. Again, the set of TALL people and the set of SMALL people will be difficult to obtain, even with the average height shown. Figure 14, the last in the series, shows the weight of the members of the set of people. Again the average weight helps but it is still difficult to classify people as being either HEAVY or LIGHT.
Table 3
1 Person Age 2 3 4 5 6 7 8 9 10 11 Anna John Sue Peter Jim David Mary Jane Mike Sally 36 44 43 21 46 52 56 18 60 16
12 Average 39.2
Figure 12
Table 4 A B
1 Person Height 2 3 4 5 6 7 8 9 10 11 Anna John Sue Peter Jim David Mary Jane Mike Sally 1.72 1.8 1.68 1.7 1.85 1.74 1.79 1.63 1.81 1.6
12 Average 1.732
Figure 13 Table 5 A 1 Person 2 3 4 5 6 7 8 9 10 11 Anna John Sue Peter Jim David Mary Jane Mike Sally B Age 168 174 120 185 210 178 145 116 190 98
12 Average 158.4
Figure 14
From the data given about the set of people defined, several new sets can be derived. It will be more natural to derive these sets as fuzzy sets since the words used to describe them are open to human interpretation and boundaries are not fixed. The following sets may de defined along with their membership quantities.
Tall People = { 1/Jim, 0.9/Mike, 0.86/John, 0.8/Mary, 0.7/David, 0.5/Anna, 0.3/Peter} Small People = { 1/Sally, 0.8/Jane, 0.2/Sue } Heavy People = { 1/Jim, 0.9/Mike, 0.88/Peter, 0.8/David, 0.7/John, 0.76/Anna} Light People = { 1/Sally, 0.8/Jane, 0.75/Sue, 0.3/Mary } Old People = { 0.9/Maike, 0.8/Mary, 0.7/ David, 0.5/Jim } Young People = { 1/Sally, 0.95/Jane, 0.75/Peter }
NOTE : There is no need to include everyone in these sets since there may be intermediate sets such as 'Middle Aged' or 'Average Height' etc. It is now possible to start asking questions about the set of people given their membership of the fuzzy sub-sets shown above. The sort of questions which may be asked could be useful to marketing company who wish to target particular groups for exposure to information about certain products. For example, an advertising company wishing to sell slimming products may wish to select young OR heavy people from the global set.
Young_heavy = Young People U Heavy People = { 1/Jim, 0.9/Mike, 0.88/Peter, 0.8/David, 0.7/John, 0.76/Anna, 1/Sally, 0.95/Jane }
NOTE: Maximum values selected. So this fuzzy set includes all members from either set. If we wished to target only those people who were Tall AND Elderly (old) as part of out marketing campaign we would select.
Tall_old= Tall People Old People = {0.5/Jim, 0.9/Mike, 0/John, 0.8/Mary, 0.7/David, 0/Anna, 0/Peter } = { 0.9/Mike, 0.8/Mary, 0.7/David, 0.5/Jim}
NOTE : Minimum Values selected. When fuzzy logic has identified a solution such as the set of Tall_old people it will probably be necessary to take some action from the result. If action required is to use the resulting set from this example as the source for a mail shot, it would not be helpful to send 0.9 of a letter to Mike, 0.8 of a letter to Mary etc.
Defuzzification
The process of moving from a fuzzy set to a point where a control decision can be made is called ' defuzzification'. The process of defuzzification will depend on the fuzzy data being processed and may involve linguistic approximation or an arithmetic method. The most common arithmetic methods involve either the mean of maximum values or a method which calculates the 'centre of gravity' of moments method. These methods will obviously different control results. The choice of method is likely to rely on the type of data being processed. The maximum method will yield relatively few discrete control points whilst the moments method will provide an output with greater continuity. In the example shown above, we wish to know, for each of the elements of the resultant fuzzy set:
{ 0.9/Mike, 0.8/Mary, 0.7/David, 0.5/Jim }
Whether to send the advertising mail, or not to send the advertising mail. Since in this case, the decision is of a Boolean type ( send or dont send), then it would be a decision made by the marketing department to select a value of set membership, above which mail would be sent and below which, no mail would be sent. In a situation where the decision would be applied in an analogue or applied in varying degrees, the defuzzification methods would require application of one of the methods discussed. For instance, we may consider the set of Old AND Heavy people who should be advised to eat less. How much less they should eat may be on a sliding scale. The set of Old Heavy people will be:
Old_Heavy = { 0.9/Mike, 0.7/David, 0.5/Jim } NOTE: Minimum values (&)
We may also consult dietary experts and derive a proportion for how much less people should eat, depending on their membership of the set of Old_Heavy people. Strictly for the sake of continuing this discussion, table 6 and figure 14 represent some fictitious data about proportional reduction of dietary intake for members of the set of Old_Heavy people.
If there was some need to give general advice to members of this set rather than specify dietary information to each person it would be necessary to deduce a specific value representing dietary reduction to all members of the set. For this example, one of the methods of defuzzification would be necessary. ( Please NOTE: This data is strictly fictitious and should under no circumstances be treated as dietary advice.)
A B
1 Membership %less to eat 2 3 4 5 6 7 8 9 10 11 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 65 62 56 50 42 30 16 2 0 0
Figure 15
If the maximum value were to be used, we may advise all members of the set to eat 65% less food. However, if the centre of gravity is calculated (a simple average for the curve shown) the set of Old_Heavy people would be advised to eat 50% less food. This is because the average value for the three members is 0.7 and from the curve, this equates to a dietary reduction of 50%. This example is not intended to show precisely how to derive decisions from fuzzy logic. However, it should be clear that in order to take decisions from the results of fuzzy logic, some additional processing is required. Fuzzy logic is able to represent the shades of particular attributes rather than requiring their classification as either one thing or another. It also allows these shades or fuzzy values to be processed in a similar way to ordinary logic and a result to be derived. For industrial control problems, where the eventual outcome is to perform specific action, some defuzzification will usually be required.
Conclusions:
In discussing logic in a variety of forms, it has been possible to demonstrate the importance of the subject. Logic can be applied by people in everyday decisions. One of the many definitions of logic can be stated as: 'reasoned thought or argument, as distinguished from irrationality'. Most people can identify arguments as logical or irrational and many of us have been frustrated by the latter. This text shows that logic can be used in many disciplines. The use of digital logic in electronics, Hydraulics and Pneumatics has a specific aim, to reduce the complexity and cost of a function without prejudice to the functions effectiveness. Logic used in computer programming must be able to deliver the goals stated for Electronics but must also be able to deal with the sort of logical decision making required by humans. Artificial intelligence has a greater need for logic
but the logic used must offer far more if it is to be able to implement theories of human knowledge, decision making and learning. However, even with these additional requirements, the basic rules defined for the logic used in Electronics are not broken in Artificial Intelligence. It should be noted that Fuzzy Logic is only a small part of the logics available to science. In artificial Intelligence for instance, many researchers find modal and Temporal logics much more relevant to their work. Fuzzy Logic is not the only way of processing information which is uncertain. Probability theory, including Bayes Theorem, provides additional and effective ways of processing uncertain information for many types of application. Fuzzy logic is however very effective for certain types of application. In control where it is desirable to effect control actions based on varying input data as opposed to discretely banded data, fuzzy logic can offer a solution. Many products now boast the use of fuzzy logic in their electronic control circuitry. Winding a focusing camera lens in and out in discrete steps following the processing of discrete levels of input data would produce and image which may not be as sharp as that processed by fuzzy logic. The fuzzy logic example chosen in this text demonstrates that the logic may have applications in business and the commercial world as well as in electronic components. People should guard against the current popularisation of fuzzy logic making the subject appear to be an all embracing solution. However, its current popularity is causing scientists and engineers to think more carefully about making machines behave in a more human like manner. This complements the goals of artificial intelligence and adds to the armoury of tools and techniques which will build more 'User Friendly' equipment. We can move away from devices that necessarily come with weighty manuals requiring humans to learn machine languages rather than machines being able to understand humans.
Reference Texts
Frederick J. Hill & Gerald R. Peterson. (1981) - Switching Theory & Logical Design Wiley.J.R. Gibson. (1979)- Electronic logic Circuits. Arnold.Ian Graham &Peter Llewelyn Jones. (1988) - Expert Systems, Knowledge Uncertainty and Decision, Chapman and Hall.Moris W. Firebaugh. (1988)- Artificial Intelligence, A knowledge Based Approach. PWS Kent. Anna Hart. (1989) - Knowledge Acquisition for Expert Systems. Chapman and Hall. Antony Galton. (1990) - LOGIC for information Technology. Wiley. J.F. Sowa. (1984) - Conceptual Structures, Information Processing in Mind and Machine. Addision Wesley. Stuart C. Shoprio (editor) (1992)- Encyclopedia of Artificial Intelligence. Wiley Interscience. Artificial Intelligence
Definitions Technologies Machine Intelligence Prize
From Logic to Fuzzy Logic Intelligent Homes Steve Grand:"Machines Like Us" Online Voting Expert System Intelligent Databases "Real World" Systems
2005 AKRI Ltd. Applied Knowledge Research & Innovation Website by funzig web design : Ribble Valley, Blackburn & Lancashire
SOURCE: http://www.akri.org/ai/flogic.htm