#### Abstract

We use relational algebra to define a refinement fuzzy order called *demonic fuzzy refinement* and also the associated fuzzy operators which are fuzzy demonic join , fuzzy demonic meet , and fuzzy demonic composition . Our definitions and properties are illustrated by some examples using mathematica software (fuzzy logic).

#### 1. Introduction

##### 1.1. Motivation

Fuzzy set theory provides a major newer paradigm in modeling and reasoning with uncertainty. Zadeh, a professor at University of California at Berkeley was the first to propose a theory of fuzzy sets and an associated logic, namely, fuzzy logic in [1]. Essentially, a fuzzy set is a set whose members may have degrees of membership between 0 and 1, as opposed to classical sets where each element must have either 0 or 1 as the membership degree; if 0, the element is completely outside the set; if 1, the element is completely in the set. As classical logic is based on classical set theory, fuzzy logic is based on fuzzy set theory. Since Zadeh’s invention the concept of fuzzy sets has been extensively investigated in mathematics, science, and engineering. The notion of fuzzy relations is also a basic one in processing fuzzy information in relational structures; see, for example, Pedrycz [2]. Goguen [3] generalized the concepts of fuzzy sets and relations taking values on partially ordered sets. Fuzzy relations were initiated and applied to medical models of diagnosis by Sanchez [4]. Fuzzy set theory is now applied to problems in engineering, business, medical and related health sciences, and the natural sciences. Fuzzy relations play an important role in fuzzy modeling, fuzzy diagnosis, and fuzzy control. They also have applications in fields such as psychology, medicine, economics, and sociology.

There are countless applications for fuzzy logic. In fact, some claim that fuzzy logic is the encompassing theory over all types of logic. The items in this list are more common applications that one may encounter in everyday life.

*(a) Temperature Control (Heating/Cooling) [5–7]*. I do not think the university has figured this one out yet. The trick in temperature control is to keep the room at the same temperature consistently. Well, that seems pretty easy, right? But how much does a room have to cool off before the heat kicks in again? There must be some standard; so the heat (or air conditioning) is not in a constant state of turning on and off. Therein lies the fuzzy logic. The set is determined by what the temperature is actually set to. Membership in that set weakens as the room temperature varies from the set temperature. Once membership weakens to a certain point, temperature control kicks in to get the room back to the temperature it should be.

*(b) Medical Diagnosis [8]*. How many of what kinds of symptoms will yield a diagnosis? How often are doctors in error? Surely everyone has seen those lists of symptoms for a horrible disease that say “if you have at least 5 of these symptoms, you are at risk.” It is a hypochondriac’s haven. The question is as follows: how do doctors go from that list of symptoms to a diagnosis? Fuzzy logic. There is no guaranteed system to reach a diagnosis. If there was, we would not hear about cases of medical misdiagnosis. The diagnosis can only be some degree within the fuzzy set.

Fuzzy set theory appeared in 1965 [1]. Since then, it has received increasing attention by the scientific community and applied in almost all the general disciplines [9–11]. Fuzzy set theory provides a strict mathematical framework (there is nothing fuzzy about fuzzy set theory) in which vague conceptual phenomena can be precisely and rigorously studied. It can also be considered as a modeling language well suited for situations in which fuzzy relations, criteria, and phenomena exist. It will mean different things, depending on the application area and the way it is measured. In the meantime, numerous authors have contributed to this theory. In 1984 as many as 4000 publications may already exist. The first publications in fuzzy set theory by Zadeh [1] and Goguen [3, 12] show the intention of the authors to generalize the classical notion of a set. Zadeh [1] writes “The notion of a fuzzy set provides a convenient point of departure for the construction of a conceptual framework which parallels in many respects the framework used in the case of ordinary sets, but is more general than the latter and, potentially, may prove to have a much wider scope of applicability, particularly in the fields of mathematics and computer science (pattern classification and information processing). Fuzzy logic is a superset of conventional logic that has been extended to handle the concept of partial truth-truth values between “completely true” and “completely false”. As its name suggests, it is the logic underlying modes of reasoning which are approximate rather than exact. The importance of fuzzy theory derives from the fact that most modes of human reasoning and especially common sense reasoning are approximate in nature.”

The calculus of relations has been an important component of the development of logic and algebra since the middle of the nineteenth century [13–15]. The main advantages of the relational formalization are uniformity and modularity. Actually, once problems in these fields are formalized in terms of relational calculus, these problems can be considered by using formulae of relations; that is, we need only calculus of relations in order to solve the problems. In the context of software development, one important approach is that of developing programs from specifications by stepwise refinement; see, for example, [16–20]. One point of view is that a specification is a relation constraining the input-output (resp., argument-result) behaviour of programs.

The demonic calculus of relations [21, 22] views any relation from a set to another set as specifying those programs that terminate for all wherever associates any values from with , and then the program may only return values for which . Consequently, a relation refines another relation if specifies a larger domain of termination and fewer possibilities for return values. The demonic calculus of relations has the advantage that the demonic operations are defined on top of the conventional relation algebraic operations and can easily and usefully be mixed with the latter, allowing the application of numerous algebraic properties.

In Section 2, we present our mathematical tool, namely, relational algebra. First, we will give certain notions about elementary theory on relations and ordered structures. There, a concept of type can be defined that allows an abstract treatment of the domain (of definedness) of an element and also of assertions. After some auxiliary results (Section 3 on relational calculus and Section 4 on fuzzy calculus), we present, in Section 5, notions and properties of demonic fuzzy operators. Finally we conclude our work in Section 6.

#### 2. Elementary Theory on Relations

Using Tarski [15] approach, we distinguish two levels of abstraction in the study of binary relations:* the elementary theory of relations* and* relational calculus*. First level defines the relations as sets of (pairs) and second level defines the relations as elementary objects on which the operations are defined and studied in an algebraic point of view.

In this paper, we need both levels of abstraction. The first one will give us our examples and the second one is useful for our proofs and formulas. So, in this section we will present both levels. A relation from a set to a set is a subset of pairs , where and . Formally,
If , then is* homogeneous* on . The relations on finite sets can be represented by matrices. For example, the relation can be represented by

The graphs and relations are closely linked.

Every finite relation can be interpreted as a representation graph and vice versa. Graph (1) which corresponds to the relation is shown in Figure 1.

In matrix notation, an entry corresponds to the absence of an edge between two vertices of the graph (the absence of the pair in the relation) and an entry means the opposite.

As relations are sets, they are ordered by inclusion. The least relation between sets and is the* empty* (also called zero), noted , and the greatest one, called* universal* relation, and noted . A particular relation defined for every set is the* identity* relation, noted . The set of elements of whose images by is called* domain* of , noted , and the set of images is noted . Formally,

As relations are particular sets, we can apply the usual sets operations, which are union (), intersection (), and complementation . Relations are ordered by inclusion. More, their structure helps us to define other operations which are as follows.(a)Inverse of a relation , denoted : (b) For and , we define the composition of and , noted , as follows: We remark that . The composition operator symbol () will be omitted (i.e., we write () for ()).

We can now define the abstract algebraic structures having many properties of the relations. They are based on boolean algebras and other operators which are the composition and the inverse and also a particular element (identity relation).

#### 3. Relational Calculus

The origin of relational calculus goes back to last century with the work of de Morgan [23, 24] and Ströhlein [14], also in the beginning of present century with the work of Peirce [25, 26]. Their study has been revived by the work of Chin and Tarski [15, 27]. For more details on the algebra of relations see [27–33]. In what follows, we will give a definition of the algebra of relations and some important models of axioms characterizing this algebra. Most of our definitions are from [34].

*Definition 1. *An* abstract heterogeneous relational algebra* is an algebraic structure on a nonempty set of elements called* relations*, such that the next conditions are satisfied. (a)Every structure is a complete atomic boolean algebra, with zero element Ø, universal element , and order .(b)Every relation has an inverse .(c) is a semigroup with precisely one unit element .(d)Schröder rule is valid.(e)Tarski rule is valid: if and if only .

The precedence of the relational operators, from highest to lowest, is the following: bind equally, followed by followed by and finally by . The scope of and goes to the right as far as possible. The relation is called the* converse* of . From Definition 1, the usual rules of the calculus of relations can be derived (see, e.g., [27, 34–36]). We assume these rules to be known and simply recall a few of them. We will present certain examples of models satisfying these axioms.

*Example 2. *(a) The algebra of binary relations on different sets is an important relation algebra, because it is very useful. Let be sets. Then
with relation operators, is a relation algebra. The operations and between relations and are defined if and if only and have the same type. A relation is homogeneous if and if only for a certain . The composition is defined if and if only and for certain .

(b) The set of all homogeneous binary relations on a set , denoted Rel, is a relation algebra.

(c) The algebra of boolean matrices is another important relation algebra.

We recall by the next examples how some of the operators are applied to boolean matrices. To respect the usual convention, we will use the boolean values instead of the values . Consider

(d) We will give another example. The set of matrices whose entries are relations constitutes a relation algebra [34], with the operators defined as follows:

The constant relations are defined as follows:
where denotes entry of matrix . Of course, and exist only if matrices and have the same dimension; the composition exists only if the number of columns of is the same as the number of rows of . The entries of the identity matrix (which is square) are , except those of the diagonal which are . The entries of the zero matrix are and those of the universal matrix are .

From Definition 1, the usual rules of the calculus of relations can be derived (see, e.g., [27, 34–38]). We assume these rules to be known and simply recall a few of them.

Theorem 3. *Let be relations and let be an arbitrary index set. Consider the following:*(1)*,*(2)*,*(3)*,*(4)*,*(5)*,*(6)*,*(7)*,*(8)*,*(9)*,*(10)*,*(11)*,*(12)*,*(13)*,*(14)*,*(15)*,*(16)*,*(17)*,*(18)*,*(19)*,*(20)*,*(21)*,*(22)*,
*(23)*,
*(24)*,*(25)*,*(26)*,*(27)*,*(28)*.*

Sometimes, instead of refering to laws 6, 7, 8, and 9, we refer to the operation () as distributive. Then, we have () which is monotonic instead of refering to laws 12 and 13.

In the following, we will give the definitions of certain properties.

*Definition 4. *A relation is as follows: (a)*deterministic* if and if only ,(b)*total* if and if only (equivalent to ),(c)an* application* if and if only it is total and deterministic,(d)*injective* if and if only is deterministic (i.e., ),(e)*surjective* if and if only is total (i.e., or also ),(f)a* partial identity* if and if only (subidentity),(g)a* vector* if and if only (the vectors are usually denoted by the letter ),(h)a* point* if and if only , , and .

A* function* is a deterministic relation. The vectors and are particular vectors characterizing, respectively, the domain and codomain of . The set of vectors of a certain type is a complete boolean algebra [34, 36, 38].

In an algebra of boolean matrices, a vector is a matrix in which the rows are constant and a point is a vector with a nonzero row.

*Example 5. *Let and . Then
is a vector that corresponds to a set of points . The partial identity which corresponds to is .

Let and let and be the vector and the partial identity given before.(i)Prerestriction of to (or to ) is as follows:
(ii) Postrestriction of to (or to ) is as follows:
(iii) Domain of is
The vector represents the subset .(iv) The relation is the vector characterizing the subset , which is the codomain of .

#### 4. Fuzzy Relational Calculus

Fuzzy set theory has been studied extensively over the past 30 years. Most of the early interest in fuzzy set theory pertained to representing uncertainty in human cognitive processes [1].

The concept of a fuzzy relation on a set was defined by Zadeh [1, 39] and other authors like Rosenfeld [40], Tamura et. al. [41], and Yeh and Bang [5] considered it further. Fuzzy relations are of fundamental importance in fuzzy logic and fuzzy set theory, including particularly fuzzy preference modeling, fuzzy mathematics, fuzzy inference, and many more.

Let be two sets; a* fuzzy relation* on is defined by , where the map is called* membership function* and the value is called the degree of membership of in [40, 41].

As fuzzy relations are sets, they are ordered by inclusion. The least fuzzy relation between sets and is the* empty* (also called zero), noted , and the greatest one, called* universal* fuzzy relation, and noted . A particular fuzzy relation defined for every set is the* identity* fuzzy relation, noted , where if and 0 otherwise. The domain of , denoted by dom(), is defined as follows:
and the codomain of , denoted by codom(), is expressed by finding the maximal value of a long :
The domain and codomain are regarded as the height of row and columns of the fuzzy relation [42].

##### 4.1. Operations on Fuzzy Relations

As fuzzy relations are particular fuzzy sets, we can apply the usual fuzzy sets operations, which are union (), intersection (), and complementation , given in [43]. More, their structure helps us to define other operations which are as follows.

*Definition 6 (see [1, 5, 39]). *Let , , and be sets and let and be fuzzy relations defined, respectively, on and . One has
(a)Inverse of a fuzzy relation , denoted :
such that
(b) The max-min composition is the fuzzy relation
(i) From now on, the composition operator symbol () will be omitted (i.e., we write () for ()).(c) The semiscalars multiplication of a fuzzy relation by a scalar is a fuzzy relation such that

*Example 7. *(i) Let and be two fuzzy relations given as follows and ,

(ii) Let , , = “ considerably larger than ,” and = “ very close to ”; then

We have

These operations are illustrated, respectively, by Figures 2, 3, 4, 5, and 6.

*Remark 8. *Different versions of “composition” have been suggested which differ in their results and also with respect to their mathematical properties. The max-min composition has become the best known and the most frequently used. However, often the so-called* max-product* or* max-average* compositions lead to results that are more appealing; see [40]. (a)The max-prod composition () is defined as follows:
(b)The max-av composition () is defined as follows:

*Example 9. *Let and be defined by the following matrices [44]:

We will first compute the max-min composition . We will show in details the determination for , ; Let , , and , : (i) (ii) (iii) (iv) (v) In analogy to the above computation we now determine the grades of membership for all pairs , , and finally we have
For the max-prod we obtain , , and , :(vi) (vii) (viii) (ix) (x) ;
then
After performing the remaining computations we obtain
The max-av composition finally yields:

i | |

1 | 1 |

2 | 0.4 |

3 | 0.8 |

4 | 1.4 |

5 | 0.7; |

*Remark 10. *The vectors and are particular vectors characterizing, respectively, the domain and codomain of , which are defined in (14) and (15).

##### 4.2. Properties of Fuzzy Relations

Just as for relations, the properties of commutativity, associativity, distributivity, involution, and idempotency all hold for fuzzy relations. Moreover, De Morgan’s principles hold for fuzzy relations just as they do for relations, and the empty relation and the universal relation are analogous to the empty set and the whole set in set-theoretic form, respectively. Fuzzy relations are not constrained, as is the case for fuzzy sets in general, by the excluded middle axioms. Since a fuzzy relation is also a fuzzy set, there is overlap between a relation and its complement [45]; hence,

*Example 11. *
Let
Then

In the following, we will give some properties of fuzzy relations.

*Definition 12. *Let and be fuzzy relations on , one have , . Then, one has the following.(a)Equality
(b)Inclusion(i)If , the relation is included in or is larger , denoted by .(ii)If and in addition if for at least one pair ,
Then one has the proper inclusion .The following properties in Theorem 13 and Proposition 14 have been proved to hold for fuzzy relations (see [11, 46]).

Theorem 13. *Let , , and be fuzzy relations. Then *(a)*associativity of composition: ;*(b)*distributivity over union: ;*(c)*weak distributivity over intersection: ;*(d)*commutativity: , ;*(e)*associativity: , ;*(f)*distributivity: , ;*(g)*idempotency: , ;*(h)*identity: , , , ;*(i)*involution: ;*(j)*De Morgans law: , .*

Proposition 14. *A fuzzy relation is as follows: *(a)*reflexive if and if only ; that is, ;*(b)*transitive if and if only ; that is, ;*(c)*symmetric if and if only ; that is, ;*(d)*antisymmetric if and if only ; that is,
*(e)*equivalence if and if only verifies properties (a), (b), and (c);*(f)*order if and if only verifies properties (a), (b), and (d);*(g)*preorder if and if only verifies properties (a) and (b).*

*Example 15. *Let , , , and be fuzzy relations:
is a reflexive fuzzy relation, is a transitive fuzzy relation, is a symmetric fuzzy relation, is an antisymmetric fuzzy relation, and is an equivalence fuzzy relation.

#### 5. Demonic Fuzzy Order and Fuzzy Demonic Operators

First, we will give the rationale behind the definition of refinement called the* refinement ordering*. If we consider a relation as a specification of the input-output behavior of a program , then * refines * (or that is correct with respect to ) if,(i)for any input in the domain of , is a possible output of only if ;(ii) always terminates for any input belonging to the domain of [47]. For an input that does not belong to the domain of specification , program may return any result or return no result; that is, the specifier does not care what happens following the submission of such an input.

In the following, we will define the refinement fuzzy ordering (*demonic fuzzy inclusion*). The associated fuzzy operators are fuzzy demonic join (), fuzzy demonic meet (), and fuzzy demonic composition (). We will give the definitions and needed properties of these operators. We will illustrate them with simple examples using mathematica (*fuzzy logic*).

*Definition 16. *One says that a fuzzy relation * fuzzy refines* a fuzzy relation , denoted by , if and if only
where and are, respectively, the membership functions of and .

In other words, fuzzy refines if and only if the prerestriction of to the domain of is included in : this means that must not produce results not allowed by for those states that are in the domain of .

It is easy to show that this definition is equivalent to definition (given [43]). In other words, if and only if

*Example 17. *Let

We have

Then

Let

We have

Then

Let
because

Let
because

Theorem 18. *The fuzzy relation is a partial order.*

##### 5.1. Fuzzy Demonic Operators and Illustration with Mathematica

In this subsection, we will present fuzzy demonic operators and some of their properties.

*Definition 19. *Let and be fuzzy relations. (a)Their supremum is and their membership is
and satisfies
The operator () is called* fuzzy demonic union*. This definition is equivalent to the definition ([43]). In other words,
if and only if
(b) Their infimum, if it exists, is and their membership is
and it satisfies
The operator () is called* fuzzy demonic intersection*. This definition is equivalent to the definition given in ([18, 19, 36, 43, 48–50]). In other words,
if and only if
For to exist, one has to verify
This condition is equivalent to
which can be interpreted as follows: the existence condition simply means that, on the intersection of their domains, and have to agree for at least one value.

*Example 20. *We know that and .(a)Let and (i) but (ii) but .(b)Let and (i) but (ii) but . These demonic operations are illustrated, respectively, by Figures 23 and 24.

Now we need to define the relative fuzzy implication.

In what follows, we will give our definition of the relative fuzzy implication and some examples.

*Definition 21. *The binary operator () is called* relative fuzzy implication*, and its a membership function is defined as follows:
This definition is equivalent to definition ([18, 19, 36, 48–50]) which is
if and only if

*Example 22. *(a) Let and (i). (b) Let and (i).In what follows, we will give the definition of the fuzzy demonic composition.

*Definition 23. *The* fuzzy demonic composition* of relations and is (), and its membership function is given by

In other words,

if and only if

*Example 24. *Consider the following:(a)(b).

Figures 23 and 24 represent fuzzy demonic composition of two relations.

#### 6. Conclusion

In this paper, we have presented the notion of relational fuzzy calculus specially a fuzzy refinement order () also the definitions of the operators associated to this order which are (), fuzzy demonic operators (), and fuzzy composition () and give some of their properties. These operators have been illustrated by mathematica (*fuzzy logic*).

#### Conflict of Interests

The author declares that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgments

This research project was supported by a grant from the Research Center of the Center for Female Scientific and Medical Colleges, Deanship of Scientific Research, King Saud University.