Fuzzy Automata as Coalgebras

: The coalgebraic method is of great signiﬁcance to research in process algebra, modal logic, object-oriented design and component-based software engineering. In recent years, fuzzy control has been widely used in many ﬁelds, such as handwriting recognition and the control of robots or air conditioners. It is then an interesting topic to analyze the behavior of fuzzy automata from a coalgebraic point of view. This paper models different types of fuzzy automata as coalgebras with a monad structure capturing fuzzy behavior. Based on the coalgebraic models, we can deﬁne a notion of fuzzy language and consider several versions of bisimulation for fuzzy automata. A group of combinators is deﬁned to compose fuzzy automata of two branches: state transition and output function. A case study illustrates the coalgebraic models proposed and their composition.


Introduction
Control logic plays an important role in component-based programming in deciding a run-time mechanisms and rules of composition. Precise control needs meticulous implementation so that many applications may be expensive and inefficient. To tackle this problem, there is an increasing interest in using fuzzy logic in many new areas. As a very efficient method for handling imprecise properties, fuzzy logic then provides a systematic approach to incorporating approximate reasoning into such systems so that fuzzy implementations are not only cheaper and faster than precise ones, but also more understandable for users [1,2]. Therefore, some devices that profit from the use of vagueness in their overall operation have emerged and the related theory is described in [3]. For instance, the fuzzy principal component analysis method, based on the variance contribution rate of the principal component combined with the fuzzy theory to obtain a reasonable correction weight, is used to refine quantitative and qualitative index data of innovation service capability [4]. Moreover, this approach makes sense not only at the control level, but also at the test level [5].
Fuzzy control systems incorporate a number of components driven by fuzzy logic [6]. Most of them are rule-based systems that exchange information through interfaces. Technically, the modeling approach of fuzzy control systems contains three aspects: an input stage, a processing stage and an output stage, whose details are as follows.

•
The input stage transforms an input into a value. The method is to abstract the relation of an input and its corresponding vague value into a point in a coordinate system, where the horizontal axis stands for the input domain and the vertical axis stands for the vagueness domain. • The processing stage involves inference rules and generates a result for each input, and then combines the results of the rule. In this stage, logical inference rules are used to describe the connection between cause and effect. The rules are of the form If condition then conclusion .
Such rules provide information for the decision of control variables. • The output stage processes the combined results from the processing stage and converts them to a specific control value. For instance, common techniques for conversion process includes max-min inference, max-membership principle and mean-max membership.
Automata theory has a long history in modeling systems and applications which can be realized as a set of states and transitions between them depending on some inputs. Fuzzy finite-state automata (FFA) incorporate fuzziness into the internal state representation and output of these computational systems [7]. Depending on the non-fuzzy output labels associated with (final) states or transitions, there are different classes of FFA: FFA with final states, FFA without final states, Fuzzy Moore FA and Fuzzy Mealy FA [8]. There are also works considering fuzzy output maps, such as fuzzy Mealy machines and fuzzy Moore machines [9,10]. Fuzzy automata have been studied from different aspects. In order to study behavior control, a novel method to compute the membership values of the next states of a fuzzy automaton with an averaging function between the membership value of the input, and the membership value of the current state is proposed in [11]; the behaviors of lattice-valued nondeterministic fuzzy automata are compared through two language equivalence relations which have different discriminating power in [12]. Categories of deterministic fuzzy automata and fuzzy languages based on a complete residuated lattice with zero divisors are introduced in [13], a common framework for fuzzy type automata is developed in relationships with morphisms of monads in [14], and the concept of fuzzy regular language accepted by fuzzy finite automata is purposed in [15]. Describing systems that behave in the same way in the sense that one system simulates the other and vice versa, several notions of (approximate) bismulation relations are investigated in [16][17][18].
Along the past two decades, coalgebra has emerged as a well established general framework for the study of the behavior of various kinds of automata [19][20][21]. There is in particular a generalized determinization construction from automata to coalgebras, including partial Mealy machines, (structured) Moore automata, Rabin probabilistic automata, and pushdown automata [22]. A survey and hierarchy of probabilistic systems as coalgebras is discussed in [23]. It connects probabilistic verification with coalgebraic modeling and compares expressiveness of system types by natural transformations between functors. Hybrid automata specifying both discrete and continuous behavior can also be modeled as coalgebras [24]. A coalgebraic perspective supporting a generic theory of hybrid automata with a rich palette of definitions and results is studied in [25]. In addition, a coalgebraic semantics framework for quantum systems is developed in [26]. One obvious advantage of the coalgebraic view is that it induces a simple and intuitive notion of bisimulation between coalgebras, a notion originally stemming from the world of labeled transition systems and process algebra [27][28][29]. Witnessed by the notion of coalgebra homomorphism, bisimulation on coalgebras can be defined by commutative diagrams and shown to be formally dual to congruence on algebra [30,31]. Moreover, there is a general framework for the study of components as concrete coalgebras and the development of the corresponding calculi [32].
A recent thesis [33] proposes a coalgebraic approach to fuzzy automata, which obtains the following results: (a) a coalgebraic definition of the fuzzy language recognized by a fuzzy automaton, (b) the definition of a functor describing the determinization process of a fuzzy automata via a generalization of the powerset construction, (c) a coalgebraic definition of bisimulation on fuzzy automata allowing the construction of a quotient fuzzy automaton. However, it only considers the output as the current membership value for the current state. Moreover, a coalgebraic theory of fuzzy transition systems and their concrete fuzzy bisimulation is studied in [34]. The authors resort to relational lifting that is one of the most used methods in bisimulation research, leading to an algorithm for testing bisimulation in [35], and group-by-group fuzzy bisimulation and its corresponding modal logic in [36]. Nevertheless, the output stage is omitted. To consider different types of fuzzy automata, our main contributions are as follows: • Explore the fuzzy-set monad to serve as the basis to a coalgebraic approach; • Provide a coalgebraic framework for different types of fuzzy automata, where the notions of fuzzy language and bisimulation can be addressed; • Define appropriate combinators for composing fuzzy automata from two branches:state transition and output function.
Thus, we not only consider fuzzy language respecting the controlling behavior and bisimulation relations for fuzzy automata, but also study the composition mechanism in our coalgebraic framework. This paper is structured as follows. Section 2 introduces different types of fuzzy automata. Section 3 recalls the definition of the fuzzy-set monad and studies its properties. Section 4 defines the coalgebraic models for fuzzy automata, the notion of fuzzy language and considers several versions of bisimulation. Section 5 develops a series of combinators for composing fuzzy automata. Section 6 discusses a case study. Section 7 concludes and raises some topics for future work.

Fuzzy Automata
In a complex controlled system driven by fuzzy logic, a fuzzy automaton is the basic unit which contains fuzzy processors and input/output interfaces. Considering fuzzy output maps, we focus on three types of fuzzy automata: Fuzzy Moore Automata (FMrA), Fuzzy Mealy Automata (FMlA) and Fuzzy Unified Automata (FUA). FMrA and FMlA are obtained by modifying the definitions of fuzzy Moore machine and fuzzy Mealy machine in [8]. Unlike the definition of fuzzy Mealy machine in [8] requiring two functions, one to describe the next state and the other to describe the output, a fuzzy Mealy machine is equipped with one fuzzy function to characterize completely the next state and the output produced in [9]. For distinction between them, we name the latter one as FUA. For simplicity, initial and final states are ignored for the moment. Note that each non-fuzzy output map e : X → O corresponds to a function e : X → [0, 1] O such that e(x) = δ e (x) , where δ k (t) = δ(t − k) and δ is the Dirac function.   1] should be defined to to define the language accepted by an automaton [7]. Instead, we intend to define the notion of fuzzy language with the aid of the fuzzy-set monad.

Fuzzy Set
The fuzzy set theory [37] was developed by Lotfi A. Zadeh in 1965. The main purpose of using fuzzy sets is to deal with vague data under some given properties. For example, consider a finite set of real numbers S ⊆ R and the property "close to 0". This property seems ambiguous because there is not an explicit criterion to judge whether objects are closed to 0. We want to ask within what distance we can say "one real number is close to 0". To make it precise, the one should figure out a function which fits the property. For example, where m = max s∈S |s|. This function is called the membership function and indicates that the closer the data s ∈ S is to 0, the closer the membership value ψ S (s) is to 0. Obviouly, data from which the distance to 0 are equal have the same membership value, i.e., ψ S (s) = ψ S (−s). However, the selection of membership function is not unique and usually depends on the goal of application.
Residuated lattices are the algebraic structure that characterizes fuzzy components.
Definition 5 (Fuzzy Subset [33]). Given a set X, a fuzzy subset over K of X is a function φ : X → K that assigns to each object x ∈ X a membership value. The set of all fuzzy subsets of X is denoted by Z K (X) and obviously Z K (X) = K X . In the sequel, we use the shorthand notation Z(X) to represent Z K (X).
Note that Z can be interpreted as an endofunctor on Set where

Properties of Fuzzy-Set Monad
The fuzzy-set monad on Set is defined in [33]. In this section, we will firstly recall the definition and then prove this monad is strong and commutative. Although every monad in Set is strong, we include the explicit contribution to build up intuitions.
Definition 6 (The fuzzy-set Monad [33]). Fuzzy-set monad Z = (Z, η, µ) over K = (K, ∧, ∨, ⊗, →, 0, 1) satisfies for a set X that commutes with the unit and multiplication of the monad: Proof. Firstly, define a left tensorial strength with components σ X,Y : that commute appropriately with trivial projection and associativity isomorphisms for f : X → Z and g : Y → W: For the multiplication, we have to show that For the right side of the equation, In the proof of Theorem 1, we defined a left tensorial strength σ with components σ X,Y : can be obtained by applying swapping operation from the left tensorial strength: where s = π 2 , π 1 is product communicating. Formally, With both σ X,Y and σ X,Y , there are two ways to obtain Z(X) × Z(Y) → Z(X × Y), as depicted in the following diagram. If the diagram commutes, then Z is commutative with left and right strength natural transformations σ X,Y , σ X,Y . We use γ : Proof. To show the diagram is commutative, select a pair of membership functions For the right side of the equation, Hence the diagram commutes.
Then, ([0, 1], min, max, ⊗, →, 0, 1) is a complete residuated lattice corresponding to the standard Gödel algebra. : for f ∈ Z(X) I , g ∈ Z(O) I and i ∈ I. In the sequel, F I,O -coalgebras provide a universal framework for defining fuzzy language and bisimulation for different fuzzy automata while T I,O -coalgebras serve as a basis for composition calculi of fuzzy Mealy automata.

Fuzzy Language
In [33], fuzzy automata with initial fuzzy subsets and final fuzzy subsets are equipped with the notion of fuzzy language over a set of input symbols. Due to the type of their initial/final fuzzy subsets, that notion can not be naturally extended to the case involving output. Here we consider the notion of fuzzy language over a set of input symbols and a set of output symbols based on F I,O -coalgebras.
Note that ∅ represents the empty input/output.

Lemma 1. Given an
Proof. First, we prove the result for |w| > |v| by induction on |w| = n. Let x, y ∈ X, w ∈ I * , v ∈ O * . If n = 0, there exists no v such that |v| < 0 and hence the result holds. If n = 1, then v = ∅ and the result holds by the Definition 8. Assume that the result is true for all |w| ∈ I * such that |w| = n − 1, n > 1. Now there are two cases: |v| = ∅ and |v| = ∅. For the case |v| = ∅, let |w| = w i, where |w| = n, i ∈ I, and then By the induction hypothesis, f * (x)(w )(z, ∅) = f * (z)(i)(y, ∅) = 0 and thus the result holds. For the case |v| = ∅,

By the induction hypothesis
Second, by a similar proof, we can prove the result holds for |w| < |v| by induction on |y| = n.

Lemma 2. Given an
Proof. The results can be proved by induction on |w 2 | = n. If n = 0, then w 2 = v 2 = ∅ and holds, which completes the proof of the base case. Now assume that the result is true for all |w 2 | = n − 1, n > 0. Let Now we consider a generic fuzzy language for F I,O -coalgebras and naturally obtain the definition for the fuzzy language accepted by a fuzzy automaton. Definition 9 (Fuzzy language). A fuzzy language over an input set I and an output set O (with membership values over K), is a fuzzy subset of (IO) * , that is a function φ : (IO) * → [0, 1].
Given an initial fuzzy state ∈ Z(X) and a final fuzzy state τ ∈ Z(X), the fuzzy language L f recognized by (X, f ) is defined by Naturally, the fuzzy language recognized by a FUA (X, I, O, β) is the one recognized by its corresponding F I,O -coalgebra (X, β).
When considering the language recognized by an FMlA, the membership values of the next state and the output must be integrated, which can be captured by the natural transformation θ. Definition 11. The fuzzy language recognized by a FMlA (X, I, O, α, e) is the one recognized by the corresponding F I,O -coalgebra (X, θ( α, e )).

Bisimulation
Let us now discuss the notion of bisimulation for fuzzy automata. In fact, coalgebra theory provides a generic notion of bisimulation on H-coalgebras for any functor H [20].

Definition 12 (H-bisimulation).
Given two H-coalgebras (X, f : X → H(X)) and (Y, g : Y → H(Y)), an H-bisimulation between them is a relation R ⊆ X × Y such that there exists an H-coalgebra (R, h : R → H(R)) making the following diagram to commute.
Theorem 3. Given two T I,O -coalgebras (X, f ) and (Y, g), if R ⊆ X × Y is a T I,O -bisimulation, then R is an F I,O -bisimulation between (X, θ • f ) and (X, θ • g).

Proof. The proof of the result is immediate from the definition.
We now consider concrete bisimulations for different types of fuzzy automata. Since FMrA can be easily transformed to FMlA, we only focus on bisimulation for FMlA and FUA.
Given a FMlA (X, I, O, α, e), denote a transition x • x , there exists y ∈ Y, such that y x and (x , y ) ∈ R.  Proof. The proof of the result is immediate from the definition.
Since the core idea of fuzzy automata is fuzzing, the concrete bisimulation induced by coalgebraic bisimulation seems to be too strict. To find a more suitable characterization of bisimulation of fuzzy automata, we introduce the notion of approximate -bisimulation, which requires that membership values for states in an approximate -bisimulation of two transition branches should have a difference less than . Definition 15 ( -Bisimulation for FMlA). Given two FMlA (X, I, O, α, e) and (Y, I, O, α , e ), a relation R ⊆ X × Y is an approximate -bisimulation ( > 0) if for all (x, y) ∈ R: x , there exists y ∈ Y, such that y R is an approximate -bisimulation if and only if R −1 is an approximate -bisimulation.

3.
If R i is an approximate i -bisimulation, then ∪ i R i is an approximate max i { i }-bisimulation.
Proof. The proof of the result is immediate from the definition.

Composition for FMlA
A family of combinators for B(− × O) I -coalgebras where B is a monad, such as sequential composition (; ), parallel ( ), choice ( ) and concurrency ( ) combinators were introduced in [32]. Therefore, the composition of FUA can be naturally instantiated. However, an FMlA assigns different membership values to the next state and the corresponding output, which should be separated for composition. With some abuse of notation, we construct sequential composition (; ), parallel ( ), choice ( ) and concurrency ( ) combinators for FMlA. Consider three fuzzy Mealy automata p, q, r with the corresponding coalgebras ( ) Some standard isomorphisms in Set are used in the definitions of combinators: Furthermore, combinators a + , s + , xr + , m + are the corresponding isomorphisms for sums in Set. Finally, the inverse of an isomorphism i is denoted by i −1 .
The sequential composition combinator ; requires the compatibility of interfaces. The sequential composition of p, r actually shares the data which is sent out from p. From a coalgebraic point of view, it is a T I,R -coalgebra p; r = (X p × X r , α p;r , e p;r ) where α p;r is defined as: and e p;r is defined as: The parallel combinator corresponds to synchronous product and composes two coalgebras into one with their inputs (outputs) merged together. The parallel p q produces an output belonging to O × R after receiving an input belonging to I × J. Coalgebraically, the semantics of the parallel combinator is a T I×J,O×R -coalgebra where α p q is defined as: and e p q is defined as The choice p q allows the environment to choose either to input a value of type I or one of type J, which will trigger the corresponding automata, producing the associated output. A formal definition is where α p q is defined as and e p q is defined as The concurrency combinator combines choice and parallel, in the sense that two fuzzy Mealy automata p and q can be executed depending on the input supplied. Let I J = I + J + I × J and O R = O + R + O × R. The semantics of is given by where α p q is defined as and e p q is defined as In coalgebra theory, it is [20] shown that the graph of a T I,O -homomorphism is a T I,O -bisimulation and the greatest T I,O -bisimulation is an equivalence relationship ∼. Thus for two given FMlA p, q, if there exists a T I,O -homomorphism between their corresponding coalgebras p , q , we denote p ∼ q. Theorem 6. For appropriately typed FMlA p, q, r, p , q , (p; q); r ∼ p; (q; r) (p p ); (q q ) ∼ (p; q) (p , q ) (p p ); (q q ) ∼ (p; q) (p , q ) (p p ); (q q ) ∼ (p; q) (p , q ) Proof. The proof proceeds by pointwise induction. For the first law, if we assume we can obtain α (p;q);r (x 1 , With these equations, it is easy to show a is a T I,O -homomorphism from (p; q); r to p; (q; r) . Other laws can be proved similarly.
Connecting FMlA through isomorphisms leads to a bisimilarity up to an isomorphic rearranging of input types and output types. Let f , g be isomorphic rearrangements of input types and output types respectively. We use p{ f , g} to denote the FMlA after arranging the input and the output types in the FMlA p.

Theorem 7.
For appropriately typed FMlA p, q, r, p q ∼ (q p){s, s} p q ∼ q p{s + , s + } p q ∼ q p{s + + s, s + + s} where a * is a natural isomorphism from (A B) C to A (B C) and its inverse is denoted by a −1 * .
Proof. Similar to Theorem 6.
The two theorems demonstrate that our combinators are well defined. In the sequel, we compare them with the ones in [32] up to the natural transformation θ through a theorem and an example. Theorem 8. Given two FMlA p, q with the corresponding coalgebras in ( ), the following equations holds.
where , , correspond to our combinators in the left side and the ones for composing F I,Ocoalgebras in [32] in the right side.
Proof. The proof proceeds by pointwise induction. For the first law, if we assume Other laws can be proved similarly.
Oppositely, if we consider the standard Gödel algebra, the two values will be both 0.4.

Case Study
In the sequel, we illustrate the use of fuzzy components by means of a concrete example. For simplicity, we consider an non-fuzzy input-output function and compose components with F I,O -coalgebras. Consider the following example of a steam turbine.
The system is composed of two fuzzification components Temp, Press and a defuzzification component Setting with corresponding membership functions illustrated in Figure 1. Note that ∆ represents the copy operation. In practice, the components Temp and Press execute in parallel. Each one will produce a membership value corresponding to the state and membership function after receiving a mode signal. After that, the minimum of the two output values will become the input of Setting. The membership function of the Setting component is determined by the following rules (for simplicity, only whose conditions with temperature COOL are displayed). rule 1 : If temperature is COOL and pressure is WEAK then throttle is P3. rule 2 : If temperature is COOL and pressure is LOW then throttle is P2. rule 3 : If temperature is COOL and pressure is OK then throttle is Z. rule 4 : If temperature is COOL and pressure is STRONG then throttle is N2.
rule 5 : If temperature is COOL and pressure is HIGH then throttle is N3.
· · · The output functions are considered as non-fuzzy in this example.
where eval is an evaluation function. As a concrete example, suppose the fuzzy subset for the NORMAL mode is the function Then the membership value (output) over state T 3 +T 6 2 under the mode NORMAL is e t ( T 3 +T 6 2 , NORMAL) = eval(φ NOR , T 3 +T 6 2 ) = 1. (ii) Press is a component whose state space P is given by the pressure in the steam turbine and inputs are over the set I = {WEAK,LOW,OK,STRONG,HIGH}, which represent the mode triggered by the users. The output of this component is the membership value corresponding to the current fuzzy state. The dynamics of this component is with the transition and output functions defined as α p : P × I → Z(P): for p ∈ P and o p : (iii) The dynamics of Rule and And components are denoted by Ψ 1 and Ψ 2 where In this expression O is the output set determined by the output function, namely, i = COOL ∧ HIGH · · · 1 = { * } is the singleton set. The notation f is the representation of function f : A → B, which is defined as a coalgebra f = ( * ∈ 1, c f ), where c f = Resorting to centroid defuzzification technique, the output stage processes combine areas and produce a control value, which will participate in the control of the system.

Conclusions and Future Work
The present work aims at addressing fuzzy automata from a coalgebraic perspective. Our starting point was studying the fuzzy-set monad further. We defined a left tensorial strength and a right tensorial strength, and proved it is a strong and commutative monad. With these properties, we modeled different types of fuzzy automata as coalgebraic models with the same transition structure. Based on these coalgebraic models, we defined the notions of fuzzy language bisimulation between fuzzy automata. Moreover, we developed some compositional combinators for fuzzy Mealy automata of two kinds: state transition and output function and compared it with the classical component calculi in [32]. Finally, through a case study, we discussed the application of our component calculi.
Besides these fundamental results, there are several topics left to explore. One is to define a notion of refinement [38] of fuzzy automata, to specify an inclusion relation of fuzzy behaviour. Fuzzy automata may involve complex behaviour such as non-deterministic transitions or branched transitions with probability [23,39]. Therefore another topic for future work is to develop more complex versions of fuzzy automata and analyze their behavior and discuss their properties, namely of the suitable notions of bisimulation as in [15,35,36].