Intelligence :
From Logic to Fuzzy Logic

John L. Gordon


From Logic to
              Fuzzy Logic

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.

The Nature of Logic

What you know about logic will often depend on what subjects you have studied. If you have not studied logic you may still be familiar with the philosophy of the Vulcan race from the TV show 'Star Trek'. This popularised view of logic is nevertheless a valuable one. It implies that Vulcans makes decisions in a strictly deductive way, ignoring emotions and having the ability to place events into well defined categories. The deductive power of the Vulcans, and in particular, Mr Spock, produces verifiable decisions based on available evidence or recognises that a decision cannot be made due to lack of information.

Logic as used in Engineering.

If you have studied an engineering discipline, you will probably have come across various logic functions which process binary information. The most familiar functions are 'AND','OR' and 'NOT'. It has been proven that any electronic logic process can be derived from these basic 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. Operation Symbol
Function 0 Always zero 0
Function 1 AND AND symbol
Function 2

Function 3 Same as A A
Function 4

Function 5 Same as B B
Function 6 Exclusive OR OR symbol
Function 7 OR OR symbol
Function 8 NOR (not OR) NOR (not
Function 9 Equivalent Equivalent
Function 10 Not B B
Function 11

Function 12 Not A A
Function 13 Implication (If A then B) Implication
Function 14 NAND (not AND) NAND
Function 15 Always 1 1

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:

A Logical

Figure 1

Logic also involves the use of various theorems/ axioms and methods which permit manipulation of logic expressions. Such theorems/axioms include:

                Theorems and Axioms

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.

The logic of computer programming

Computer programmers will use logic in a slightly different way. Programming languages such as 'C' and 'PASCAL' contain logic expressions which perform 'bitwise' actions on binary numbers as shown above. For instance:

9+3 (read as 9 OR 3) = 11

The reason for this is that the binary representation for 9 is 10001 and the binary value of 3 is 0011. Therefore, using the OR function:

Binary for 9 is 1001

Binary for 3 is 11

Result of OR is 1011 (decimal 11)

This would be written 'C' as :- 9 | 3;

Where yet another sign for OR is used, the '|' sign.

In 'C' the following logic signs are used:

X | Y  ;  X OR Y
X & Y  ;  X AND Y
X ^ Y  ;  X Exclusive OR Y
~X  ;  NOT X

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))

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.

The logic of Artificial intelligence

Logic is also used extensively in Artificial Intelligence. Indeed a whole branch of the subject is devoted to 'Logic Programming'. The programming language 'PROLOG' was developed to address the need in Artificial Intelligence (AI) and is still a very popular language. The logic used in AI is the same as that used in Engineering, although the symbols usually differ and tend towards those shown in table 1.

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.

This expression would usually be written as follows.

Modus Ponen

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(…,…)

Use is also made of variables,

is_greater_than ( x,y)

An important two place predicate is equal(…,…)

equal ( x,y )

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

Logical expressions may be written using these new operators, or quantifiers.


Figure 5

This sentence states:

For every (x) which is a satellite, there exists a (y) such that (y) is closest to earth AND (y) is on the satellite (x).

Or in more plain English:

On all earth satellites, there is a point on the satellite which is closest to Earth.

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

All one logic

In most cases the logics used in engineering, in computer science and in artificial intelligence are all based on the same operations and theories. The symbolism is often different and the precise 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.

Extensions to basic logic

Logic in AI may also be defined as 'First Order' or 'Second Order'. This refers to the capability of the logic to apply reasoning to functions or simply expressions. First order logic permits quantification over individuals but not over predicates and functions. So the statement. 'All predicates have only one argument' is not permitted in the first order of logic.

Logics usually employ 'Monotonic Reasoning'. In this sort of logic expression manipulation., once a fact is derived or a value given to a variable, it cannot be retracted or altered subsequently. Non Monotonic reasoning is more complex and implements procedures to keep track of the dependency which expressions have on each variable so that changes in value can be propagated through the decision space.

Modal logic employs further symbols which represent additional operators. The standard modal operators are those of 'possibility' and 'inevitability'.

Modal Logic

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.

The Elements of Set Theory

A set is a collection of objects which for some reason, been grouped together. Sets are usually surrounded by curly brackets, for instance:

{ 1, 3, 5, 7, 9 }

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.

Set Theory

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:


membership of the set White (W) may look like this.

W = { 1/g1, 0.96/g2, 0.8/g3, 0.5/g4, 0.2/g5, 0.04/g6, 0/g7}

Membership of the set Black (B) may look like this.

B = { 0/g1, 0.04/g2, 0.2/g3, 0.5/g4, 0.8/g5, 0.04/g5, 0.96/g6, 1/g7 }

From this description, it can be seen that 'g1' is pure white and 'g7' is pure black.

 Graph :
                graded membership of the set 'W'

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.

Basic Fuzzy Set operators

Fuzzy sets may also be manipulated using basic logic operators such as AND, OR, NOT or in their set equivalents INTERSECTION, UNION, and INVERSE. The union (OR) of two sets will contain all elements in both (figure 8). However, with a fuzzy set, the membership must be taken into account. Therefore, the union of two fuzzy sets contains all elements in both sets and will select the MAXIMUM value given for each element. Likewise the intersection (AND) of the two sets contains only elements common to both sets since the membership values chosen are the MINIMUM values from the two elements. If one set does not contain an element, the minimum value will therefore be zero.

Figure 11 shows the basic fuzzy set of operators which may be used in fuzzy logic.

Basic Fuzzy
                Set of Operators

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 Anna 36
3 John 44
4 Sue 43
5 Peter 21
6 Jim 46
7 David 52
8 Mary 56
9 Jane 18
10 Mike 60
11 Sally 16
12 Average 39.2
Graph : Age
                profile of the set of people defined above

Figure 12

Table 4

1 Person Height
2 Anna 1.72
3 John 1.8
4 Sue 1.68
5 Peter 1.7
6 Jim 1.85
7 David 1.74
8 Mary 1.79
9 Jane 1.63
10 Mike 1.81
11 Sally 1.6
12 Average 1.732
Graph :
                heights of the set

Figure 13

Table 5

1 Person Age
2 Anna 168
3 John 174
4 Sue 120
5 Peter 185
6 Jim 210
7 David 178
8 Mary 145
9 Jane 116
10 Mike 190
11 Sally 98
12 Average 158.4
Graph : weight
                of the members of the set

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 Maths symbol 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.


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 don’t 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 1 65
3 0.9 62
4 0.8 56
5 0.7 50
6 0.6 42
7 0.5 30
8 0.4 16
9 0.3 2
10 0.2 0
11 0.1 0
                Intake Reduction Graph

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.


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.