Manuscript Offprint
arXiv:2611.26535Complete Test Suites for Effectful Automata
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Institute for Computing and Information Sciences, Radboud University, The Netherlands and https://balintkocsis.site mail@balintkocsis.site https://orcid.org/0000-0003-0570-3031 Department of Computer Science, Open University, The Netherlands and https://research.ou.nl/en/persons/rick-koenders rick.koenders@ou.nl Department of Computer Science, Open University, The Netherlands and https://joshuamoerman.nl joshua.moerman@ou.nl https://orcid.org/0000-0001-9819-8374 Institute for Computing and Information Sciences, Radboud University, The Netherlands and http://jurriaan.me jrot@cs.ru.nl https://orcid.org/0000-0002-1404-6232 {CCSXML}¡ccs2012¿ ¡concept¿ ¡concept_id¿10003752.10003766.10003767¡/concept_id¿ ¡concept_desc¿Theory of computation Formalisms¡/concept_desc¿ ¡concept_significance¿500¡/concept_significance¿ ¡/concept¿ ¡concept¿ ¡concept_id¿10003752.10003766.10003773.10003775¡/concept_id¿ ¡concept_desc¿Theory of computation Quantitative automata¡/concept_desc¿ ¡concept_significance¿300¡/concept_significance¿ ¡/concept¿ ¡/ccs2012¿
We want to thank Henning Urbat and Fabian Lenke for discussions about join-semilattices, tensor products, and join-irreducible elements. We are also very grateful to the anonymous reviewers for their time and useful comments, which improved the paper.
\newaliascnt
assumptiontheorem \aliascntresettheassumption
Complete Test Suites for Effectful Automata
Abstract
Complete test suites for automata are (finite) sets of words that enable testing an implementation against a specification: when a (black-box) automaton passes the test suite, completeness guarantees that it is equivalent to the specification on all (infinitely many) words. A well-known method for constructing complete test suites for deterministic automata is the W-method, used in conformance testing and automata learning.
Based on a recent categorical generalisation of the W-method, we propose a framework for the construction and analysis of test suites for a certain class of effectful automata defined by commutative monads. By working in the Eilenberg-Moore category of the associated monad at hand, we obtain a generic notion of effectful W-method, together with a completeness theorem. We show how to apply the framework and derive complete test suites for non-deterministic and weighted automata.
ccs
Theory of computation Quantitative automata
keywords
Automata, conformance testing, categorical methods, weighted automata
1 Introduction
The W-method is a celebrated result in conformance testing of deterministic finite state machines (FSMs) by Chow [16] and Vasilevskii [61]. The W-method generates a finite test suite based on a specification FSM. Crucially, this test suite is complete, meaning that any (black-box) implementation that passes the test suite and has no more states than the specification is necessarily behaviourally equivalent. Behavioural equivalence is a strong property: it means that the two systems give equal outputs on any of the infinitely many inputs. On top of that, the test suite generated by the W-method is only polynomial in size.
One area where conformance testing is used is active automata learning. Algorithms such as L* [4] and its descendants assume access to an equivalence oracle, that is, a way of deciding whether a hypothesis is correct with respect to the system under learning (SUL). In active automata learning, the SUL is typically assumed to be black-box. A common way to realise the equivalence oracle is through conformance testing, where the hypothesis is viewed as the specification and the SUL as the implementation. Libraries such as LearnLib [22] and AALpy [48] have implemented the W-method and its extensions.
Active automata learning has been generalised to various types of automata, such as non-deterministic automata [13], weighted automata [11], stochastic systems with observable non-determinism [58], and many others, including categorical frameworks that generalise and extend some of these algorithms [9, 59, 30, 17, 7]. This motivates us to also extend the W-method to a broader class of automata, since these algorithms all rely on equivalence queries. In particular, the main challenge that we address in this paper is to develop a framework for the W-method and its completeness that applies to types of automata beyond deterministic ones, such as non-deterministic automata and weighted automata.
The aim of constructing test suites for non-deterministic FSMs is not new. Petrenko and Yevtushenko describe a complete test suite in [52] with many references to prior work; we discuss more related work in Section 7. In this line of research, the fault domain, i.e. the class of models for which the test suite is complete, is fixed: it is the class of automata of a certain size. Our aim instead is to generalise the W-method specifically without fixing our fault domain a priori. This idea of taking a more liberal fault domain follows [39] and is strongly connected to the notion of --completeness by Vaandrager and Melse [60].
To this end, we build on the generalised W-method developed in [39] at the level of automata in monoidal closed categories, which includes instances such as deterministic automata, Mealy and Moore machines, and deterministic nominal automata [12]. Weighted automata over a field are also described in [39], but the examples there require additional analysis beyond what the framework offers, and a systematic theory is missing. In particular, non-deterministic automata and weighted automata over are not covered in op. cit.
Our approach is to develop a categorical framework for conformance testing based on effectful automata, i.e. automata that have an effectful transition structure modelled using a monad. Formally, these are automata in the Kleisli category of a monad, as already studied by Arbib and Manes [6], and they naturally cover automata with non-deterministic, weighted, or stochastic transition structure. To obtain a general framework, we aim to instantiate the theory in [39]. However, this leads to a technical challenge: the assumptions are not met for automata in Kleisli categories, as these categories do not have enough structure to construct the test suites required by the W-method. Therefore, we exploit the algebraic structure of effectful automata by working in Eilenberg-Moore categories of commutative monads (Section 4). Showing that the framework applies to these categories is non-trivial, and it is one of the main contributions of this paper.
Based on this development, we reach our key contributions: the notions of effectful state cover and effectful state characteriser that are used to construct the effectful W-method (Section 5). We derive the completeness of the effectful W-method from the general theory. Furthermore, we illustrate the effectful W-method by deriving complete test suites for non-deterministic automata and weighted automata over the ring (Section 6).
We assume familiarity with basic category theory, such as categories, functors, natural transformations, limits, colimits, adjunctions, and monads. These notions are covered by standard textbooks (e.g. [43, 3, 8, 54]). We also rely heavily on symmetric monoidal closed categories and some further categorical notions, which are recalled in Appendix A.
2 Automata in categories
We recall the basics of automata in a category (see e.g. [5, 2, 24]). Throughout the paper, we fix a base category , a functor , an initial state object , and an output object .
Definition 1.
A -automaton in consists of a state space , a transition morphism , an input morphism , and an output morphism .
If the functor is clear from context, we simply use the term automaton.
Example 2.
Let be the category of sets and functions, let be defined as for some finite alphabet , let be the singleton set , and let be the two-element set . Then a -automaton is given by a set of states , a transition function , an initial state , and an acceptance condition . Thus, a -automaton with a finite state space is a deterministic finite automaton (DFA) [53].
Example 3.
The previous example can be generalised by replacing the base category with an arbitrary monoidal category (see Definition 40). For such a category and any alphabet object , we can set . Letting while leaving the output object arbitrary, we obtain the notion of sequential automata as defined by Adámek and Trnková [2], also called machines by Goguen [24]. This notion encompasses many instances such as weighted automata [56], semilattice automata [49], and nominal automata [12].
The transition morphism of a -automaton is an algebra for the functor . In general, a -algebra (or simply algebra) is a pair with and . A -algebra homomorphism is a map such that . Together, these form a category . Moreover, the notion of algebra homomorphism extends to automata. A homomorphism of -automata from to is a -algebra map such that and . -automata and their homomorphisms form a category .
Given an object , a free -algebra over consists of an object and morphisms and such that for every , , and , there exists a unique -algebra morphism with . We refer to as the free -extension of . For an algebra , we write for . If free -algebras exist over all objects of , we say that is a varietor [2]. If has and preserves colimits of -chains, then is a varietor [1, 35].
In the context of automata theory, generalises the set of words: it is an object describing all possible inputs to an automaton. This motivates the following definitions.
Definition 4.
Let be a varietor, and a -automaton.
- A behaviour (or language) is a morphism .
- The reachability map of is the free -extension of the input morphism .
- The behaviour of is the composite .
Intuitively, the reachability map sends an input word to the state reached after processing that word. The behaviour, then, is defined by observing the output of the corresponding state.
Example 5.
The functor corresponding to DFAs (Example 2) is a varietor, and is isomorphic to , the set of words over . Therefore, a behaviour is precisely a language in the classical sense, i.e. a set of words.
The reachability and behaviour maps in Definition 4 instantiate to the standard notions in the case of DFAs. Recall that, for a given DFA , the generalised transition function is defined inductively by and . Then the reachability map is , and the behaviour coincides with the usual accepted language of : iff .
An important automata-theoretic notion that is missing from Definition 4 is the observability map. For a DFA , the observability map sends a state to the accepted language of , defined as .
To define this generally, we use a categorical analogue of the set of languages . We assume that our base category is monoidal closed (Definition 40); we use the notation for the internal hom. Then we may construct the object , thought of as the behaviour object, and define the observability map as a morphism . This approach to behaviours was introduced by Goguen [24] in the case of sequential automata (Example 3).
To be able to define the observability map this way for an arbitrary functor , we need a left strength for (see Definition 41). If we assume, besides closedness, that is a symmetric monoidal category (Definition 40), then any left strength for induces a canonical left strength for [44, Proposition 6.7].
Definition 6.
Suppose is symmetric monoidal closed and is a varietor with left strength . Denote the induced strength for by , and let be an automaton.
- The run map of is the composite , where is the right unitor of .
- The observability map of is the currying of .
3 Generalised W-method
In this section, we present a categorical version of the W-method for -automata, following closely the testing framework introduced in [39]. The categorical W-method and the proof of its completeness presented in op. cit. is a direct generalisation of the completeness proof in [45] (also the appendix of [40]), which ultimately goes back to [61, 16]. We first give an overview of the W-method for DFAs, then present our categorical generalisation.
Conformance testing aims to decide the equivalence of two automata, a known specification and a black-box implementation, by checking their behaviour on a well-chosen, finite set of inputs, called a test suite. The W-method [61, 16] is a classical way to construct such test suites for deterministic finite (Mealy-)automata. It relies on two special sets of words: a state cover is used to reach all (reachable) states, and a characterisation set is used to distinguish all pairs of (inequivalent) states.
More precisely, given a specification DFA over an alphabet , a set of words is a called a state cover for if and for every reachable state , there exists a word (called an access sequence for ) such that . Moreover, a set of words is called a characterisation set for if and for any pair of states with , there exists a word (called a distinguishing sequence for and ) such that and or vice versa.
Given such sets and and a natural number , we define a test suite , where denotes the concatenation of languages and is the set of words of length at most . That is, is obtained by concatenating words from the state cover with words from the characerisation set, with at most letters inserted in the middle. This test suite, which we call the W-suite, has the property that it is -complete, meaning that for any inequivalent automaton with at most more states than , we can find a test case that witnesses the difference (i.e. one accepts and the other rejects it).
q_{0}$$q_{1}$$q_{2}$$q_{3}$$a$$b$$a$$b$$a$$b$$a$$b
Figure 1: Deterministic automaton for the language with .
Example 7.
Consider the automaton over the alphabet , depicted in Figure 1. In , the states , , , and are reached by the words , , , and , respectively. Hence, is a state cover for . Furthermore, is a characterisation set for : the word distinguishes the rejecting states ( and ) from the accepting states ( and ), and the word distinguishes both from and from .
The W-suite with is then given by . Performing the calculations, we see that . Since the test suite is -complete, every automaton with at most states which agrees with on the acceptance of the words in accepts exactly the language of .
We now turn to the categorical generalisation of the W-method.
Assumption 3.1.
Throughout this section, we assume that is a symmetric monoidal closed category with binary coproducts, that is a strong functor, and that is a varietor.
Categorically speaking, a subset of a set corresponds to an equivalence class of monomorphisms (injective functions) with codomain . To simplify the theory, we instead work with generalised elements, i.e. arbitrary morphisms into . Intuitively, the subset represented by a morphism is the image of . In particular, collections of inputs, such as test suites, can be represented as morphisms into . Although finiteness of test suites is crucial for testing in practice, it is not required for the theory.
Definition 8.
A test suite is a morphism in with codomain .
Let us fix a specification automaton . An intuitive way to categorify state covers is as a morphism such that is an epimorphism. However, to prove completeness, we need an ‘internal’ way to assign states to access sequences. This suggests to demand that be a split epi, i.e. that it have a right inverse . Unfortunately, as explained in [39], this condition is too strong in many categories. Following op. cit., we use an alternative definition that equips with an algebra structure.
To state the definition, we need some notation. Given maps with common codomain , a morphism is a map such that (i.e. a map in the slice category ). Regarding and as subsets of , such a morphism expresses that is a subset of . In particular, for DFAs (Example 2), where (Example 5), if is thought of as a collection of words, then the existence of a map intuitively means that ‘ contains the empty word’.
Definition 9.
A state cover for is a morphism together with maps and such that is a -algebra morphism .
The condition that be an algebra map is equivalent to the following commuting diagram:
The idea is that is a set of representative access sequences for the reachable states of , and imitates the transition structure of on . For , the intuitive reading of diagram 1 is the following: for each and , the word is an access sequence for the state . The map is part of the structure because it is required to be a morphism in . In general, there may be many such maps, but the choice does not matter as far as completeness is concerned. In , some can always be defined if is a state cover in the original sense of the word (cf. Proposition 31).
The condition for a set containing to be a characterisation set can be stated in the following form: for all , implies . That is, if two states are equivalent on words in , then they are equivalent on all words. The definition of abstract characterisation sets (which we call state characterisers) is obtained from this by replacing with generalised elements .
Definition 10.
A state characteriser for is a pair of maps and s.t. for any , if equalises and , then so does .
We often omit the , , and components of state covers and state characterisers, in which case they are understood to be existentially quantified.
Before defining the W-suite, we introduce auxiliary operations related to concatenation. Intuitively, the map below is a generalisation of word concatenation, the operation extends concatenation to sets of words, and consists of words that are obtained by appending an arbitrary sequence of at most letters to the end of some word in .
Definition 11.
- The morphism is defined as the composite
- Given and , we define the map as .
- Given , we define the map as . Furthermore, we write for the -fold iteration of and denote the domain of by .
The W-suite can now be constructed by concatenating words from the state cover with words from the state characteriser, with at most arbitrary letters inserted in between.
Definition 12.
Given a state cover for , a state characteriser for , and a natural number , we define the W-suite as .
Test coverage may be expressed using a collection of automata called a fault domain. A test suite is then called complete if for any inequivalent implementation from the given fault domain, we can find a failing test case witnessing the error. This is formally expressed as follows, using the behaviour maps and from Definition 4.
Definition 13.
- A fault domain is a class of automata, i.e. a subclass of .
- Let be a test suite and let be a fault domain. We say that is complete for w.r.t. if for all , implies .
The fault domain corresponding to -completeness for DFAs is , where denotes the number of states of . We instead consider the fault domain that, intuitively, consists of those automata each of whose states can be reached by a word from followed by at most letters. In the case of Mealy machines, completeness with respect to a similar fault domain has been studied by Vaandrager and Melse [60] (see also [42]).
Definition 14.
Let and let . The fault domain is defined as \mathcal{U}_{c}^{k}:=\{\mathcal{M}\in\operatorname{\mathbf{Aut}}_{I}^{O}\left(F\right)\mid c^{\uparrow k}~\text{is a state cover for~\mathcal{M}}\}.
The theorem below states the completeness of the W-method. An automaton is called observable if is a monomorphism. Observability is a sort of minimality condition: it means all states have different behaviour.
Theorem 15.
Let be a state cover for , let be a state characteriser for , let , and suppose is observable. Then the W-suite is complete for w.r.t. .
Instantiating the theory to DFAs, we recover the original W-method.
Example 16.
The setting of deterministic automata (Example 2) satisfies Assumption 3.1: the category is cocomplete and Cartesian closed. Since preserves colimits, it is a varietor (Section 2). The strength is given by .
As explained above, the notions of state cover and state characteriser reduce to the classical notions for DFAs (after taking images). In particular, given a (traditional) state cover , we can define simply by choosing any satisfying .
Returning to the automaton in Figure 1, we have the state cover and the state characteriser constructed in Example 7. The maps and are simply the inclusions into . Instantiating Definition 12 with , the W-suite is then . Concretely, we have , and is given by . The corresponding set of words is precisely the set from Example 7.
Completeness of the test suite now follows from Theorem 15. Note that compared to Example 7, where we used -completeness, the fault domain in this case is different: it consists of automata for which is a state cover, which does not include all automata with at most states. However, as increases, can contain DFAs with exponentially more states than . (See [60] for a comparison.)
4 Effectful automata
The automaton model defined in Section 2 is an abstraction of deterministic automata. However, as observed by Arbib and Manes [6], it also covers instances such as non-deterministic, weighted, or stochastic automata if we choose appropriate Kleisli categories as base categories. Towards developing a theory of conformance testing covering such examples, we therefore consider automata in Kleisli categories of commutative monads, and refer to these as effectful.
We wish to apply the abstract framework from Section 3 to effectful automata. Unfortunately, Kleisli categories in general are not closed, so they do not satisfy Assumption 3.1, preventing us to construct the W-suite (Definition 12) and apply the associated completeness result (Theorem 15) directly. We therefore move from the Kleisli category to the richer Eilenberg-Moore category (as in [6]), which is monoidal closed under certain conditions [57]. Thus, automata in the Kleisli category provide a ‘syntactic’ presentation, whereas the actual computations happen in the Eilenberg-Moore category.
This section aims to provide the technical apparatus for studying conformance testing of effectful automata in this way. We first illustrate our high-level approach in Section 4.1. Then, in Section 4.2, we describe the technical ingredients precisely and verify that the assumptions of the testing framework (Assumption 3.1) hold in the Eilenberg-Moore category.
4.1 Overview: automata in Kleisli and Eilenberg-Moore categories
Let be a monad describing an effect type, and consider the left triangle in the diagram below:
Here, is the Kleisli adjunction, is the Eilenberg-Moore adjunction, and is the comparison functor that exhibits as the full subcategory of free algebras in . Our idea is to start with a base functor that describes the transition structure of ‘plain’, non-effectful automata, and then ‘extend’ it to functors and that commute with the left adjoints. The functors and can then be used for modelling effectful generalisations of -automata. (This idea for Kleisli categories occurred already in [6] and also in [27].)
These constructions can be lifted to the respective categories of automata, obtaining the triangle on the right of 2. Here, the functors that are overlined are induced by the respective functors in the first diagram. In particular, the functors and are embeddings from non-effectful automata into effectful ones, and the functor provides a generalised determinisation construction that also endows the automaton with algebraic structure, similar to coalgebraic determinisation [32].
Example 17.
We recall the notion of a non-deterministic finite automaton (NFA) [53] to be used as a running example. Fixing some finite alphabet , an NFA consists of a finite set of states, a transition function , a set of initial states, and a set of accepting states. In the next section, we will show that this data is exactly captured by an object of for suitable choices of , , and . For the effect , we take the (finite) powerset monad, which is generally associated with non-determinism. Then -automata will turn out to be equivalent to JSL-automata [49], and the functor will coincide with the determinisation of NFAs via the powerset construction.
4.2 From deterministic to effectful automata
In the remainder of the section, we give the necessary technical ingredients for carrying out the idea outlined above. The main goal is to verify the assumptions of the testing theory of Section 3 for automata in (Theorem 27). To achieve this, we make stronger assumptions on the base category compared to those in Assumption 3.1, which are however sufficient for the purposes of the present paper.
Assumption 4.1.
For the rest of the section, we assume that is a complete and cocomplete symmetric monoidal closed category, and that is strong and preserves colimits of -chains.
Throughout this section, we fix a monad and use the notation introduced in diagram 2 for the associated categories and functors. To make symmetric monoidal closed, we need to assume that is a commutative monad (Definition 42); we denote its structure map by . Moreover, we need some additional technical assumptions on to guarantee the existence of colimits and free algebras in .
Assumption 4.2.
We assume that the monad is commutative, that has reflexive coequalisers, and that preserves colimits of -chains.
We first consider the problem of extending to . As discussed above, we need a functor such that -automata are effectful generalisations of -automata. This can be achieved by demanding that and commute with the embedding of into the Kleisli category , that is, . We call a satisfying this equation a Kleisli extension of . Kleisli extensions are easily obtained using distributive laws (also called -laws in [32]; see ).
Theorem 18 ([6, 46]).
There is a bijective correspondence between Kleisli extensions of and distributive laws of over . Given , the Kleisli extension is defined as for and for f\colon A\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}B.
Assumption 4.3.
We assume a distributive law of over , inducing a Kleisli extension of .
Thus, is the category of effectful automata. A -automaton is like an ordinary -automaton, but whose transition map returns -structured collections of states.
Example 19 (continuing Example 17).
The finitary powerset monad is defined on sets as . The unit is given by and the multiplication by . The Kleisli category models finitely branching non-determinism: a Kleisli map A\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}B maps an input in to a finite set of possible outputs in .
Since NFAs are the non-deterministic extension of DFAs, we continue Example 2 and add the monad . We set , for some finite alphabet , , and . However, instead of , we take (since ). The argument given in Example 16, combined with the completeness of , shows that Assumption 4.1 holds in this example. Assumption 4.2 is also satisfied: commutativity is shown by the maps given by . Lastly, for Assumption 4.3, we use the distributive law given by (as in [6, 25]).
Hence, we obtain a Kleisli extension with . Spelling out Definition 1, we get that a finite -automaton consists of: a finite set of states; a non-deterministic transition function \delta\colon Q\times\Sigma\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}Q; a function i\colon\mathbf{1}\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}Q, corresponding to a set of initial states; and a function o\colon Q\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}\mathbf{1}, corresponding to a set of accepting states. Thus, we see that finite -automata are equivalent to NFAs as defined in Example 17.
Similarly to the Kleisli extension, we would also like some sort of extension of to . Since the objects of are not (necessarily) in bijection with those of , it is unrealistic to expect a strict extension, i.e. one that commutes with up to equality. Instead, we are after a functor such that there is a natural isomorphism . We call such a an Eilenberg-Moore extension of .
Mulry [47] provided a sufficient condition for the existence of Eilenberg-Moore extensions. Below, in Theorem 20, we recall this result and extend it with a uniqueness argument. For this, we use that any -algebra arises as the coequaliser {\lx@inpgf@ignorespaces{STA}}$${\lx@inpgf@ignorespaces{SA}}$${\lx@inpgf@ignorespaces{(A,a)},}$$\scriptstyle{\lx@inpgf@ignorespaces Sa}$$\scriptstyle{\lx@inpgf@ignorespaces\mu_{A}}$$\scriptstyle{\lx@inpgf@ignorespaces a} called the canonical presentation of [43].
Theorem 20.
Given a distributive law of over , there exist a functor and a natural isomorphism such that
- [(1)]
- preserves canonical presentations, and
- the following diagram commutes:
Further, for any functor preserving canonical presentations and any natural isomorphism making 3 commute, there is a unique natural transformation with , and this is a natural isomorphism.
Since we already assumed a distributive law , we can apply Theorem 20 to obtain a functor and a natural isomorphism as above. Then -automata can be seen as algebraic versions of -automata whose state spaces are equipped with algebraic structure preserved by the transition maps.
Example 21 (continuing Example 19).
We describe the Eilenberg-Moore extension in the case of NFAs. An algebra for is precisely a join-semilattice (JSL), i.e. a set equipped with an associative, commutative, and idempotent binary operation and a unit for . A JSL-homomorphism is a function that preserves and .
The direct sum of JSLs and is the Cartesian product equipped with pointwise join and unit operations. It is the categorical coproduct in the category of join-semilattices and their homomorphisms. The Eilenberg-Moore extension can then be written as . We write for the coprojection corresponding to the component at . Moreover, the map is the cotupling of the maps given by , and its inverse sends a set to the tuple where .
Spelling out Definition 1 with (ordered by ), a -automaton is given by: a join-semilattice ; a JSL-homomorphism , corresponding to a family of JSL-homomorphisms for ; a JSL-homomorphism , corresponding to an initial state ; and a JSL-homomorphism , corresponding to a set of accepting states satisfying and iff or . Thus, -automata are equivalent to JSL-automata [49].
Remark 22.
-algebras are equivalent to the -algebras of Arbib and Manes [6]. The latter are defined as objects equipped with both a -algebra (qua functor) and a -algebra (qua monad) structure satisfying a compatibility axiom involving the distributive law .
The following lemma expresses that the family is also natural w.r.t. Kleisli maps.
Lemma 23.
The family extends to a natural isomorphism .
Putting everything so far together, we are now in the situation on the left of diagram 2. The next step is to lift all these functors and adjunctions to the respective categories of automata. Hermida and Jacobs [31, Theorem 2.14] showed how to lift adjunctions to categories of algebras. A straightforward adaptation of their proof to include initial state and output morphisms gives us the adjunctions in the right triangle of diagram 2.
Theorem 24.
The triangle on the left in 2 lifts to the triangle on the right in 2.
Here, the adjunction is induced by the identity natural transformation on , the adjunction is induced by , and the functor is induced by from Lemma 23.
Intuitively, the map turns a plain automaton into an effectful automaton without any real effects. It is analogous to how every DFA is also an NFA. Conversely, the map provides a generalisation of the usual powerset construction for NFAs: it turns an effectful automaton with state space into an equivalent plain automaton with state space . The map acts like , but it additionally endows the resulting automaton with algebraic structure. Finally, is simply the composition , and the map forgets the -algebra structure.
Example 25 (continuing Example 21).
Using the definitions given so far, we see that in our running example, sends an NFA to the JSL-automaton , where is the composite . Unfolding definitions, we get that is given by . Moreover, identifying and with sets of states and , respectively, corresponds to the state of , and corresponds to the set . Hence, the automaton is precisely the determinisation of the NFA in the classical sense [53].
As our final step, we need to extend the given strength for to . Since is defined in terms of the distributive law , and the monoidal structure on relies on the double strength of the commutative monad , it is natural that we need a compatibility condition between , , and to achieve this.
Assumption 4.4.
We assume that the following diagram commutes:
Remark 26.
If , then Assumption 4.4 holds for any commutative monad .
Under Assumption 4.4, it can be shown that is a strong functor. Furthermore, our assumptions on and ensure that preserves -colimits; thus, it is a varietor (Section 2). The following theorem summarises these results.
Theorem 27.
If Assumptions 4.1, 4.2, 4.3 and 4.4 hold, then Assumption 3.1 holds for and .
We conclude this section with a closer look at behaviours in and . Recall from Section 2 that the free -algebra over is denoted by .
Proposition 28.
For all , the triple is a free -algebra over . Moreover, for any automaton , we have and .
The first part of the above proposition shows that is a varietor; hence, it makes sense to talk about the behaviour of -automata. In particular, a behaviour in is a morphism . The second part shows how to compute the reachability map and the behaviour of -automata: they coincide with those of the determinisation.
We already argued that is a varietor; we denote the free -algebra functor by . Since is essentially the full subcategory of on the free -algebras, it is not surprising that we have an analogous proposition for . Let us write for the free -extension of a map into a -algebra , given by .
Proposition 29.
For all , the triple is a free -algebra over . Hence, there is a natural isomorphism such that for any automaton , we have and .
5 Effectful test suites
As explained in Section 4, we wish to test effectful automata in as automata in . In this section, we accomplish this program and derive a special form of the W-method for -automata, which we call the effectful W-method. The effectful W-suite is constructed from effectful versions of state covers and state characterisers. We obtain the completeness of the effectful W-method by applying the completeness theorem of the ‘ordinary’ categorical W-method (Theorem 15) to . We continue to work under Assumptions 4.1, 4.2, 4.3 and 4.4 and employ the notation of Sections 2, 3 and 4. We also fix a specification automaton and write for its state space (which is a -algebra).
The effectful W-method
Whereas the general categorical definitions of state covers and state characterisers in Section 3 are stated in the category in which the specification lives, the notions of effectful state cover and effectul state characteriser introduced below are presented as structure in the base category instead of the category of .
Definition 30.
An effectful state cover for is a map in together with maps and such that the following diagram in commutes:
Definition 30 is formally quite similar to Definition 9 stated for . The main difference is that now returns a -structured collection of elements of instead of a single element. In other words, we are allowed to use the algebraic structure of to reach states.
As explained in Section 3, the map is included in the definition because it is required to be a morphism in . In , however, there is an an equivalent characterisation of state covers without that is analogous to the classical definition of state covers in terms of access sequences (albeit in the more general context of effectful -automata).
Proposition 31.
Suppose and write for the set of reachable states of . A subset is an effectful state cover for iff for all and for all , there exists such that .
In contrast to effectful state covers, the algebraic structure of is not used for the definition of effectful state characterisers. Instead, we simply return to the base category via the functor and treat as a plain deterministic automaton.
Definition 32.
An effectful state characteriser for is a state characteriser for .
Definition 33.
Given an effectful state cover for , an effectful state characteriser for , and a natural number , we define the effectful W-suite as .
Note that the construction in the definition above is the same as in Definition 12. However, the inputs are different; in particular, an effectful state cover for is not the same as a state cover for . (The analogous statement for state characterisers is true by definition.)
On the other hand, effectful state covers and state characterisers are equivalent to freely generated state covers and state characterisers in , which justifies the correctness of our definitions. For , let us write , where is the map from Proposition 29. We then call a morphism freely generated if it is of the form . Intuitively, if is a test suite, viewed as a subset of , then is the subalgebra of freely generated by the elements of .
Theorem 34.
Let , , , , and . Then:
- [(1)]
- is an effectful state cover for iff is a state cover for .
- is an effectful state characteriser for iff is a state characteriser for .
The following result states that under the correspondences of Theorem 34, the W-suite (Definition 12) constructed in is essentially the same as the effectful W-suite.
Lemma 35.
Let be an effectful state cover for , let be an effectful state characteriser for , and let us write \mathbin{\scalebox{0.75}{\boxtimes}} for the monoidal product in . Then for any , there is an isomorphism making the following diagram commute:
{\lx@inpgf@ignorespaces{\left(SC\right)^{\uparrow k+1}\mathbin{\scalebox{0.75}{$\boxtimes$}}SW}} {\lx@inpgf@ignorespaces\cong} {\lx@inpgf@ignorespaces{S\left(C^{\uparrow k+1}\otimes W\right)}} {\lx@inpgf@ignorespaces{F_{\operatorname{EM}}^{\ast}SI}} \scriptstyle{\lx@inpgf@ignorespaces\left(\tilde{S}c\right)^{\uparrow k+1}\cdot\tilde{S}w} \scriptstyle{\lx@inpgf@ignorespaces\tilde{S}\left(c^{\uparrow k+1}\cdot w\right)}Completeness of the effectful W-method
Theorem 27 shows that the testing theory of Section 3 is applicable to -automata. Combining our results on the effectful W-method with Theorem 15, we obtain the following completeness theorem for -automata. To state the theorem, we introduce the effectful version of the fault domain from Definition 14: for , we write \mathcal{U}_{c,\operatorname{EM}}^{k}:=\{\mathcal{M}\in\operatorname{\mathbf{Aut}}_{SI}^{SO}\left(F_{\operatorname{EM}}\right)\mid c^{\uparrow k}~\text{is an effectful state cover for~\mathcal{M}}\}.
Theorem 36.
Let be an effectful state cover for , let be an effectful state characteriser for , let , and suppose is observable. Then the test suite is complete for w.r.t. .
Finally, we consider the special case when the specification originates from the Kleisli category . For , we overload the term ‘effectful state cover for ’ to mean ‘effectful state cover for ’, and similarly for effectful state characteriser. Note that in this case, the automaton used in Definitions 30 and 32 coincides with . Furthermore, we write \mathcal{U}_{c,\operatorname{Kl}}^{k}:=\{\mathcal{M}\in\operatorname{\mathbf{Aut}}_{I}^{O}\left(F_{\operatorname{Kl}}\right)\mid c^{\uparrow k}~\text{is an effectful state cover for~\mathcal{M}}\}.
Corollary 37.
Let be an automaton. Let be an effectful state cover for , let be an effectful state characteriser for , let , and suppose is observable. Then the test suite is complete for w.r.t. .
6 Applications
We instantiate the effectful W-method to non-deterministic automata and weighted automata over the integers. In both cases, we give example automata and a complete test suite.
6.1 Nondeterministic automata
q_{0}$$q_{1}$$q_{2}$$q_{3}$$a,b$$a$$a,b$$a,b
Figure 2: The non-deterministic automaton for the language with .
Consider the family of regular languages over for . These are typical examples of languages accepted by a small NFA (with states) whose determinisation is exponentially large (with states). The NFA accepting is depicted in Figure 2. The automata for arbitrary look similar but with a longer chain of states. We construct the effectful W-suite for as follows.
State cover
Specialising Proposition 31 to NFAs (Example 19), we get:
Proposition 38.
Let be an NFA and write for the set of reachable states of . A set of words is an effectful state cover for iff and for all , there exist words such that .
Note that we can use unions (the algebraic structure of ) to cover states, meaning that the size of an effectful state cover for an NFA may be smaller than a state cover for its determinised DFA. In this example, one can check that the set with just four elements is an effectful state cover for , even though .
In general, constructing a minimal effectful state cover is equivalent to finding access sequences for the reachable states that cannot be expressed as a union of other reachable states. These are precisely the join-irreducible elements of the subsemilattice of generated by . This is similar to the construction of the canonical residual finite state automaton of a language [19] (also called jiromaton in [49]).
A (not necessarily minimal) effectful state cover for an NFA can be computed incrementally, as follows. Start with , and perform a traversal on the determinisation of . For each new state, check if it can be expressed as a union of states reached by . If not, add its access sequence to ; otherwise, discard the current branch. Incidentally, this procedure also produces the map (Definition 30). Here, is given by:
State characteriser
For an effectful state characteriser, we need to distinguish all pairs of inequivalent states in (and not just the reachable ones). We can take e.g. the set : the element distinguishes all sets containing from those not containing , the element does the same for , and so on.
Test suite
We conclude the example by constructing the effectful W-suite for . As in Example 16, it is the map with and . The resulting test suite has words (after removing duplicates).
When considering the effectful W-suite for the entire family , we observe that the sizes of effectful state covers and state characterisers are linear in : both contain exactly elements. This makes the resulting test suite quadratic in (for a fixed ). This is more efficient than constructing a W-suite for the determinised automata. In particular, the automaton has states, which is thus the size of the minimal state cover. This leads to a test suite of exponential size. (The state characteriser is still linear with elements.)
We should remark that completeness means something different in these two testing scenarios. In the non-deterministic case, the test suite is complete for the class of NFAs for which is an effectful state cover. This also includes DFAs, but only those with at most states. The deterministic W-suite is similar but the state cover contains more elements, and hence the associated fault domain contains larger DFAs (but no NFAs).
6.2 Weighted automata
We instantiate the automata-theoretic definitions of Section 4 to obtain weighted finite automata (WFA), using weights from the ring . As semirings, rings are quite special since they have additive inverses; this greatly simplifies the computation of state covers and state characterisers. However, even though we work with in this example, our theory in Section 4 applies in principle to arbitrary commutative semirings, such as the tropical semiring.
Similar to NFAs (Example 19), we use the data , and choose the monad TX:=\operatorname{Lin}_{\mathbb{Z}}\left(X\right):=\{v\colon X\to\mathbb{Z}\mid v(x)\neq 0\text{ for finitely many~x}\} to capture weighted transitions. The set consists of all formal linear combinations of elements in .
Morphisms A\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}B in the Kleisli category are functions ; these assign to every input in a linear combination of elements in . The Eilenberg-Moore category is the category of -modules (i.e. Abelian groups) and linear maps.
We already saw that Assumption 4.1 holds, and one can also verify that Assumptions 4.2 and 4.3 are satisfied. By Theorems 18 and 20, we obtain both a Kleisli extension and an Eilenberg-Moore extension . Unfolding these definitions, a finite -automaton consists of: a finite set of states; a weighted transition function \delta\colon Q\times\Sigma\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}Q, assigning to each state and letter a linear combination of successor states; a morphism i\colon\mathbf{1}\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}Q, given by an initial vector in ; and a morphism o\colon Q\mathrel{\vtop{\halign{#\cr\xrightarrow{\phantom{m}}\hbox{\hbox to3.6pt{\vbox to3.6pt{\pgfpicture\makeatletter\hbox{\hskip 1.8pt\lower-1.8pt\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{stroke=#000000} \lxSVG@begingroup@{fill=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces\nullfont\hbox to0.0pt{\lxSVG@begingroup@{_scopebegin=1} {{{}}{\ignorespaces}{}{\ignorespaces}{}{}{}{}{}}\lxSVG@begingroup@{_scopebegin=1} \lxSVG@begingroup@{fill=#FFFFFF} \lxSVG@begingroup@{stroke=#000000} \lxSVG@setlinewidth{\the\pgflinewidth}\lxSVG@begingroup@{stroke-width=0.4pt} \ignorespaces{}\lxSVG@fillstroke\lxSVG@drawpath@unclipped{M 2.21 0 C 2.21 1.22 1.22 2.21 0 2.21 C -1.22 2.21 -2.21 1.22 -2.21 0 C -2.21 -1.22 -1.22 -2.21 0 -2.21 C 1.22 -2.21 2.21 -1.22 2.21 0 Z M 0 0}{} \ignorespaces \lxSVG@closescope \lxSVG@closescope {\ignorespaces}{\ignorespaces}{\ignorespaces}\hss}\lxSVG@discardpath\lxSVG@closescope \hss}}\lxSVG@closescope\endpgfpicture}}}\hfil\crcr}}}\mathbf{1}, given by a final vector in .
Many variations of weighted automata appear in the literature (see e.g. [50, 20, 14, 26, 21]), mostly differing in the way transitions are defined (e.g. using matrices). These are equivalent to our definition (provided and are finite sets), which is in line with the work of Arbib and Manes [5, 6]. We note that -automata closely resemble the linear weighted automata of [14], and the functor coincides with their ‘weighted powerset construction’ that maps a WFA to a deterministic automaton whose states are formal linear combinations of states of the original WFA. We refer to such formal linear combinations of states as configurations.
Example WFA
q_{0}$$1$$q_{1}$$q_{2}$$q_{3}$$1$$a/2$$b/1$$a/1$$a/1$$b/1$$a/1$$b/1
Figure 3: The weighted automaton for the weighted language .
We consider a modification of the NFA from Section 6.1 to weighted automata , obtained by assigning weight to the -loop on and weight to all other transitions. The initial weight is for initial states and for the others, and similarly, the final weight is for accepting states and for the rest. The case is depicted in Figure 3.
State cover
In the case of WFAs, Proposition 31 specialises to the following:
Proposition 39.
Let be a WFA and write for the set of reachable configurations of . A set of words is an effectful state cover for iff and for all , there exist and such that .
Instead of unions, we are now allowed to use linear combinations of configurations to cover additional configurations. In particular, we can use subtraction and multiplication by a scalar, which allows for much greater flexibility and thus leads to smaller state covers.
Analogously to the case of NFAs, an effectful state cover can be constructed incrementally by performing a traversal on the configuration space and extending the state cover any time we encounter a configuration that is linearly independent. In this example, is an effectful state cover. Again, we obtain and we highlight one equation to show the linear structure: .
State characteriser
We can show that, for a WFA with state space , the observability map of the automaton is a linear map from the configuration space to the space of weighted languages (equipped with the pointwise structure induced by ). Thus, to distinguish configurations, we can use the module structure of the configuration space: two states are equivalent on a set if and only if the language of their difference assigns to all words in . Hence, for the state characteriser, we need to pick a set of words such that, for all configurations , if for all , then .
As an example, given the configuration , we have . Therefore, the condition that the output be yields the requirement . Similarly, the input yields the requirement , yields , and yields . Hence, we can take : if a configuration outputs zero on all these words, then we know that (and in particular).
Test suite
Like before, the effectful W-suite is given by , and it again has words. For arbitrary , the minimal state cover and state characteriser for will both contain words, and the resulting test suite will be quadratic in .
7 Related work
Conformance testing of non-deterministic systems has been considered before by Petrenko and Yevtushenko [52]. A big difference between our work and theirs is how non-determinism is observed. In their setting, non-determinism means that each run may produce a different output, even for a single test. Hence, it may be necessary to run the same test multiple times. In our case, a non-deterministic automaton always accepts a word if there is some accepting run. In short, we assume the observable behaviour is a deterministic function .
Another difference is the overall approach. We try to generalise the known W-method and then describe the fault domain; they fix the fault domain upfront (all models of a certain size) and then construct a complete test suite. The work of Petrenko and Yevtushenko has lead to complete test suites for other conformance relations, such as ioco [15]. Moreover, it has been formalised by Sachtleben in Isabelle/HOL [55].
Our framework in Section 3 is a mild generalisation of the one in [39]: the present generalisation works with an arbitrary strong endofunctor for describing the transition structure. This level of abstraction simplifies many definitions and proofs. Moreover, it applies to deterministic tree automata, but the details are left for future work. The main extension of the current paper is a systematic framework for effectful automata.
In van Heerdt’s thesis [26], the L* learning algorithm is generalised to a categorical framework. An earlier article [29, Section 6] also includes an outline of a general approach to conformance testing, based on cofree algebras and factorisation systems instead of the monoidal closed structure in the current paper and [39]. However, the completeness theorem of [29] has different conditions on the (implicit) fault domain: notably, the implementations are assumed to be observable and to have no more states than the specification. Again, another key difference with the current paper is that we focus explicitly on effectful automata.
Distributive laws of functors over monads (and monads over functors) also play a key role in coalgebraic determinisation and trace semantics (e.g. [32, 25]). We follow an algebraic approach to automata in the style of Arbib and Manes instead of a coalgebraic one. Determinisation and minimisation for these types of automata was studied in [27].
8 Conclusion
We introduced a general categorical framework for testing effectful automata, which are Arbib and Manes style algebraic automata in the Kleisli category of a monad. The key step underlying our approach is to develop the theory of the W-method and its completeness instead in the Eilenberg-Moore category of the monad at hand, resulting in the notion of effectful W-method and its completeness. We instantiated the theory to obtain test suites for non-deterministic automata and weighted automata over the integers.
Future work
Besides word automata, the framework in Section 3 also covers deterministic bottom-up tree automata [18]. Although our categorical testing framework in Section 3 does apply to this case, we did not pursue tree automata in the present paper because Assumption 4.4 is not satisfied for the given strength and distributive law. One possible approach to solve this issue is to involve contexts, as done also e.g. in [28].
Probabilistic automata can be modelled as effectful automata for the finite-support distribution monad; hence, our W-method applies here as well. However, we think such stochastic models need additional analysis: our test suite expects an exact output distribution for each test, but probabilistic systems in practice often cannot guarantee exact measurements and instead need to approximate the output distribution via sampling.
Our definition of state characteriser is as a map with a property of the induced map on languages. This means that more refined test suites such as the Wp-method [23] and the HSI-method [51] cannot be captured, as they may require this set to depend on the state (or rather, the behaviour of the state). A possible generalisation is to consider a map as the required data, similar to the notion of wrapper in [26].
In the examples that we considered, we did not have to minimise when moving from the Kleisli category to the Eilenberg-Moore category. In general, doing so might be useful to obtain smaller test suites. We leave an integration of the current framework with algorithms for minimising automata for future work.
References
[1] Jiří Adámek. Free algebras and automata realizations in the language of categories. Commentationes Mathematicae Universitatis Carolinae, 015(4):589–602, 1974. URL: https://dml.cz/handle/10338.dmlcz/105583.
[2] Jiří Adámek and Věra Trnková. Automata and Algebras in Categories, volume 37 of Mathematics and its Applications. Springer Dordrecht, 1990.
[3] Jirří Adámek, Horst Herrlich, and George E. Strecker. Abstract and Concrete Categories: The Joy of Cats. TAC Reprints, 2006. URL: https://tac.mta.ca/tac/reprints/articles/17/tr17abs.html.
[4] Dana Angluin. Learning regular sets from queries and counterexamples. Information and Computation, 75(2):87–106, 1987. doi:10.1016/0890-5401(87)90052-6.
[5] Michael A. Arbib and Ernest G. Manes. Adjoint machines, state-behavior machines, and duality. Journal of Pure and Applied Algebra, 6(3):313–344, 1975. doi:10.1016/0022-4049(75)90028-6.
[6] Michael A. Arbib and Ernest G. Manes. Fuzzy machines in a category. Bulletin of the Australian Mathematical Society, 13(2):169–210, 1975. doi:10.1017/S0004972700024412.
[7] Quentin Aristote and Daniela Petrişan. Learning bottom-up tree automata valued in monoidal categories. In Nathalie Bertrand and Stefan Milius, editors, 29th International Conference on Foundations of Software Science and Computation Structures (FoSSaCS 2026), volume 16503 of Lecture Notes in Computer Science, pages 21–42, 2026. doi:10.1007/978-3-032-22730-0_2.
[8] Steve Awodey. Category Theory. Oxford Logic Guides. Oxford University Press, 2010.
[9] Simone Barlocco, Clemens Kupke, and Jurriaan Rot. Coalgebra learning via duality. In Mikołaj Bojańczyk and Alex Simpson, editors, 22nd International Conference on Foundations of Software Science and Computation Structures (FoSSaCS 2019), volume 11425 of Lecture Notes in Computer Science, pages 62–79, 2019. doi:10.1007/978-3-030-17127-8_4.
[10] Jon Beck. Distributive laws. In H. Appelgate, M. Barr, J. Beck, F. W. Lawvere, F. E. J. Linton, E. Manes, M. Tierney, F. Ulmer, and B. Eckmann, editors, Seminar on Triples and Categorical Homology Theory, volume 80 of Lecture Notes in Mathematics, pages 119–140, 1969. doi:10.1007/BFb0083084.
[11] Francesco Bergadano and Stefano Varricchio. Learning behaviors of automata from multiplicity and equivalence queries. SIAM Journal on Computing, 25(6):1268–1280, 1996. doi:10.1137/S009753979326091X.
[12] Mikołaj Bojańczyk, Bartek Klin, and Sławomir Lasota. Automata with group actions. In 26th Annual Symposium on Logic in Computer Science (LICS 2011), pages 355–364, 2011. doi:10.1109/LICS.2011.48.
[13] Benedikt Bollig, Peter Habermehl, Carsten Kern, and Martin Leucker. Angluin-style learning of NFA. In Craig Boutilier, editor, 21st International Joint Conference on Artificial Intelligence (IJCAI 2009), pages 1004–1009, 2009. URL: https://www.ijcai.org/proceedings/2009/.
[14] Filippo Bonchi, Marcello M. Bonsangue, Michele Boreale, Jan J. M. M. Rutten, and Alexandra Silva. A coalgebraic perspective on linear weighted automata. Information and Computation, 211:77–105, 2012. doi:10.1016/J.IC.2011.12.002.
[15] Petra van den Bos, Ramon Janssen, and Joshua Moerman. n-complete test suites for IOCO. Software Quality Journal, 27(2):563–588, 2019. doi:10.1007/S11219-018-9422-X.
[16] Tsun S. Chow. Testing software design modeled by finite-state machines. IEEE Transactions on Software Engineering, 4(3):178–187, 1978. doi:10.1109/TSE.1978.231496.
[17] Thomas Colcombet, Daniela Petrişan, and Riccardo Stabile. Learning automata and transducers: A categorical approach. In Christel Baier and Jean Goubault-Larrecq, editors, 29th Annual Conference on Computer Science Logic (CSL 2021), volume 183 of Leibniz International Proceedings in Informatics, pages 15:1–15:17, 2021. doi:10.4230/LIPIcs.CSL.2021.15.
[18] Hubert Comon, Max Dauchet, Rémi Gilleron, Florent Jacquemard, Denis Lugiez, Christof Löding, Sophie Tison, and Marc Tommasi. Tree automata techniques and applications, 2008. URL: https://inria.hal.science/hal-03367725.
[19] François Denis, Aurélien Lemay, and Alain Terlutte. Residual finite state automata. Fundamenta Informaticae, 51(4):339–368, 2002. doi:10.1007/3-540-44693-1_13.
[20] Manfred Droste, Werner Kuich, and Heiko Vogler, editors. Handbook of Weighted Automata. Monographs in Theoretical Computer Science. An EATCS Series. Springer, 2009. doi:10.1007/978-3-642-01492-5.
[21] Manfred Droste and Dietrich Kuske. Weighted automata. In Jean-Éric Pin, editor, Handbook of Automata Theory, pages 113–150. EMS Press, 2021. doi:10.4171/automata-1/4.
[22] Markus Frohme, Falk Howar, and Bernhard Steffen. LearnLib: 10 years later. In Ruzica Piskac and Zvonimir Rakamarić, editors, 37th International Conference on Computer Aided Verification (CAV 2025), volume 15934 of Lecture Notes in Computer Science, pages 141–160, 2025. doi:10.1007/978-3-031-98685-7_7.
[23] Susumu Fujiwara, Gregor von Bochmann, Ferhat Khendek, Mokhtar Amalou, and Abderrazak Ghedamsi. Test selection based on finite state models. IEEE Transactions on Software Engineering, 17(6):591–603, 1991. doi:10.1109/32.87284.
[24] Joseph A. Goguen. Discrete-time machines in closed monoidal categories I. Journal of Computer and System Sciences, 10(1):1–43, 1975. doi:10.1016/S0022-0000(75)80012-2.
[25] Ichiro Hasuo, Bart Jacobs, and Ana Sokolova. Generic trace semantics via coinduction. Logical Methods in Computer Science, 3(4:11):1–36, 2007. doi:10.2168/LMCS-3(4:11)2007.
[26] Gerco van Heerdt. CALF: Categorical Automata Learning Framework. PhD thesis, University College London, 2020. URL: https://discovery.ucl.ac.uk/id/eprint/10110356/.
[27] Gerco van Heerdt, Tobias Kappé, Jurriaan Rot, Matteo Sammartino, and Alexandra Silva. Tree automata as algebras: Minimisation and determinisation. In Markus Roggenbach and Ana Sokolova, editors, 8th Conference on Algebra and Coalgebra in Computer Science (CALCO 2019), volume 139 of Leibniz International Proceedings in Informatics, pages 6:1–6:22, 2019. doi:10.4230/LIPIcs.CALCO.2019.6.
[28] Gerco van Heerdt, Tobias Kappé, Jurriaan Rot, Matteo Sammartino, and Alexandra Silva. A categorical framework for learning generalised tree automata. In Helle Hvid Hansen and Fabio Zanasi, editors, 16th International Workshop on Coalgebraic Methods in Computer Science (CMCS 2022), volume 13225 of Lecture Notes in Computer Science, pages 67–87, 2022. doi:10.1007/978-3-031-10736-8_4.
[29] Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva. CALF: Categorical automata learning framework. In Valentin Goranko and Mads Dam, editors, 26th Annual Conference on Computer Science Logic (CSL 2017), volume 82 of Leibniz International Proceedings in Informatics, pages 29:1–29:24, 2017. doi:10.4230/LIPIcs.CSL.2017.29.
[30] Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva. Learning automata with side-effects. In Daniela Petrişan and Jurriaan Rot, editors, 15th International Workshop on Coalgebraic Methods in Computer Science (CMCS 2020), volume 12094 of Lecture Notes in Computer Science, pages 68–89, 2020. doi:10.1007/978-3-030-57201-3_5.
[31] Claudio Hermida and Bart Jacobs. Structural induction and coinduction in a fibrational setting. Information and Computation, 145(2):107–152, 1998. doi:10.1006/inco.1998.2725.
[32] Bart Jacobs, Alexandra Silva, and Ana Sokolova. Trace semantics via determinization. Journal of Computer and System Sciences, 81(5):859–879, 2015. doi:10.1016/j.jcss.2014.12.005.
[33] P. T. Johnstone. Adjoint lifting theorems for categories of algebras. Bulletin of the London Mathematical Society, 7(3):294–297, 1975. doi:10.1112/blms/7.3.294.
[34] Peter T. Johnstone. Sketches of an Elephant: A Topos Theory Compendium, Vol. 1. Oxford University Press, 2002. doi:10.1093/oso/9780198534259.001.0001.
[35] G. Max Kelly. A unified treatment of transfinite constructions for free algebras, free monoids, colimits, associated sheaves, and so on. Bulletin of the Australian Mathematical Society, 22(1):1–83, 1980. doi:10.1017/S0004972700006353.
[36] Anders Kock. Monads on symmetric monoidal closed categories. Archiv der Mathematik, 21(1):1–10, 1970. doi:10.1007/BF01220868.
[37] Anders Kock. Closed categories generated by commutative monads. Journal of the Australian Mathematical Society, 12(4):405–424, 1971. doi:10.1017/S1446788700010272.
[38] Anders Kock. Strong functors and monoidal monads. Archiv der Mathematik, 23(1):113–120, 1972. doi:10.1007/BF01304852.
[39] Bálint Kocsis and Jurriaan Rot. Complete test suites for automata in monoidal closed categories. In Parosh Aziz Abdulla and Delia Kesner, editors, 28th International Conference on Foundations of Software Science and Computation Structures (FoSSaCS 2025), volume 15691 of Lecture Notes in Computer Science, pages 198–219, 2025. doi:10.1007/978-3-031-90897-2_10.
[40] Loes Kruger, Sebastian Junges, and Jurriaan Rot. Small test suites for active automata learning. In Bernd Finkbeiner and Laura Kovács, editors, 30th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2024), volume 14571 of Lecture Notes in Computer Science, pages 109–129, 2024. doi:10.1007/978-3-031-57249-4_6.
[41] Fred E. J. Linton. Coequalizers in categories of algebras. In H. Appelgate, M. Barr, J. Beck, F. W. Lawvere, F. E. J. Linton, E. Manes, M. Tierney, F. Ulmer, and B. Eckmann, editors, Seminar on Triples and Categorical Homology Theory, volume 80 of Lecture Notes in Mathematics, pages 75–90, 1969. doi:10.1007/BFb0083082.
[42] Timo Maarse. Active Mealy machine learning using action refinements. Master’s thesis, Radboud University Nijmegen, The Netherlands, 2020. URL: https://www.cs.ru.nl/F.Vaandrager/thesis-2019_NWI-IMC048_s4416295.pdf.
[43] Saunders Mac Lane. Categories for the Working Mathematician, volume 5 of Graduate Texts in Mathematics. Springer, 1978. doi:10.1007/978-1-4757-4721-8.
[44] Dylan McDermott and Tarmo Uustalu. What makes a strong monad? Electronic Proceedings in Theoretical Computer Science, 360:113–133, 2022. doi:10.4204/EPTCS.360.6.
[45] Joshua Moerman. Nominal Techniques and Black Box Testing for Automata Learning. PhD thesis, Radboud University, 2019. URL: https://joshuamoerman.nl/thesis/.
[46] Philip S. Mulry. Lifting theorems for Kleisli categories. In Stephen Brookes, Michael Main, Austin Melton, Michael Mislove, and David Schmidt, editors, 9th International Conference on Mathematical Foundations of Programming Semantics (MFPS 1993), volume 802 of Lecture Notes in Computer Science, pages 304–319, 1994. doi:10.1007/3-540-58027-1_15.
[47] Philip S. Mulry. Lifting results for categories of algebras. Theoretical Computer Science, 278(1):257–269, 2002. doi:10.1016/S0304-3975(00)00338-8.
[48] Edi Muskardin, Bernhard K. Aichernig, Ingo Pill, Andrea Pferscher, and Martin Tappler. AALpy: An active automata learning library. Innovations in Systems and Software Engineering, 18(3):417–426, 2022. doi:10.1007/S11334-022-00449-3.
[49] Robert S. R. Myers, Jiří Adámek, Stefan Milius, and Henning Urbat. Canonical nondeterministic automata. In Marcello M. Bonsangue, editor, 12th International Workshop on Coalgebraic Methods in Computer Science (CMCS 2014), volume 8446 of Lecture Notes in Computer Science, pages 189–210, 2014. doi:10.1007/978-3-662-44124-4_11.
[50] Carl V. Page. Equivalences between probabilistic and deterministic sequential machines. Information and Control, 9(5):469–520, 1966. doi:10.1016/S0019-9958(66)80012-8.
[51] Alexandre Petrenko, Gregor von Bochmann, and Ming Yu Yao. On fault coverage of tests for finite state specifications. Computer Networks and ISDN Systems, 29(1):81–106, 1996. doi:10.1016/S0169-7552(96)00019-0.
[52] Alexandre Petrenko and Nina Yevtushenko. Adaptive testing of nondeterministic systems with FSM. In 15th International Symposium on High-Assurance Systems Engineering (HASE 2014), pages 224–228, 2014. doi:10.1109/HASE.2014.39.
[53] Michael O. Rabin and Dana S. Scott. Finite automata and their decision problems. IBM Journal of Research and Development, 3(2):114–125, 1959. doi:10.1147/rd.32.0114.
[54] Emily Riehl. Category theory in context. Aurora: Dover modern math originals. Dover Publications, 2016.
[55] Robert Sachtleben. An Approach for the Verification and Synthesis of Complete Test Generation Algorithms for Finite State Machines. PhD thesis, Bremen University, Germany, 2022. doi:10.26092/ELIB/1665.
[56] Marcel-Paul Schützenberger. On the definition of a family of automata. Information and Control, 4(2-3):245–270, 1961. doi:10.1016/S0019-9958(61)80020-X.
[57] Gavin J. Seal. Tensors, monads and actions. Theory and Applications of Categories, 28(15):403–433, 2013. doi:10.70930/tac/euyoegw2.
[58] Martin Tappler, Bernhard K. Aichernig, Giovanni Bacci, Maria Eichlseder, and Kim G. Larsen. L*-based learning of Markov decision processes (extended version). Formal Aspects of Computing, 33(4–5):575–615, 2021. doi:10.1007/S00165-021-00536-5.
[59] Henning Urbat and Lutz Schröder. Automata learning: An algebraic approach. In Holger Hermanns, Lijun Zhang, Naoki Kobayashi, and Dale Miller, editors, 35th Annual Symposium on Logic in Computer Science (LICS 2020), pages 900–914, 2020. doi:10.1145/3373718.3394775.
[60] Frits W. Vaandrager and Ivo Melse. New fault domains for conformance testing of finite state machines. In Patricia Bouyer and Jaco van de Pol, editors, 36th International Conference on Concurrency Theory (CONCUR 2025), volume 348 of Leibniz International Proceedings in Informatics, pages 34:1–34:22, 2025. doi:10.4230/LIPIcs.CONCUR.2025.34.
[61] M. P. Vasilevskii. Failure diagnosis of automata. Cybernetics and Systems Analysis, 9(4):653–665, 1973. doi:10.1007/BF01068590.
Appendix A Categorical preliminaries
We recall some standard categorical definitions that are used throughout the paper.
Definition 40 ([43]).
- [(1)]
- A monoidal category is a category equipped with • a functor (called the tensor product), • an object (called the tensor unit), • a natural isomorphism (called the associator), • a natural isomorphism (called the left unitor), and • a natural isomorphism (called the right unitor) such that the following diagrams commute: {\lx@inpgf@ignorespaces{(A\otimes B)\otimes(C\otimes D)}}$${\lx@inpgf@ignorespaces{((A\otimes B)\otimes C)\otimes D}}$${\lx@inpgf@ignorespaces{A\otimes(B\otimes(C\otimes D))}}$${\lx@inpgf@ignorespaces{(A\otimes(B\otimes C))\otimes D}}$${\lx@inpgf@ignorespaces{A\otimes((B\otimes C)\otimes D)}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{A,B,C\otimes D}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{A\otimes B,C,D}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{A,B,C}\otimes 1_{D}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{A,B\otimes C,D}}$$\scriptstyle{\lx@inpgf@ignorespaces 1_{A}\otimes\alpha_{B,C,D}}$${\lx@inpgf@ignorespaces{(A\otimes\mathbbold{1})\otimes B}}$${\lx@inpgf@ignorespaces{A\otimes(\mathbbold{1}\otimes B)}}$${\lx@inpgf@ignorespaces{A\otimes B}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{A,\mathbbold{1},B}}$$\scriptstyle{\lx@inpgf@ignorespaces\rho_{A}\otimes 1_{B}}$$\scriptstyle{\lx@inpgf@ignorespaces 1_{A}\otimes\lambda_{B}}
- A symmetric monoidal category is a monoidal category equipped with an additional natural isomorphism (called the braiding) such that and the following diagram commutes: {\lx@inpgf@ignorespaces{(A\otimes B)\otimes C}}$${\lx@inpgf@ignorespaces{A\otimes(B\otimes C)}}$${\lx@inpgf@ignorespaces{(B\otimes C)\otimes A}}$${\lx@inpgf@ignorespaces{(B\otimes A)\otimes C}}$${\lx@inpgf@ignorespaces{B\otimes(A\otimes C)}}$${\lx@inpgf@ignorespaces{B\otimes(C\otimes A)}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{A,B,C}}$$\scriptstyle{\lx@inpgf@ignorespaces\beta_{A,B}\otimes 1_{C}}$$\scriptstyle{\lx@inpgf@ignorespaces\beta_{A,B\otimes C}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{B,C,A}}$$\scriptstyle{\lx@inpgf@ignorespaces\alpha_{B,A,C}}$$\scriptstyle{\lx@inpgf@ignorespaces 1_{B}\otimes\beta_{A,C}}
- A monoidal category is closed if for all , the functor has a right adjoint , called the internal hom. A (symmetric) monoidal closed category is a (symmetric) monoidal category that is closed.
Definition 41 ([38]).
Let be a monoidal category and let be an endofunctor. A left strength for is a natural transformation making the following diagrams commute:
A (left) strong functor on is an endofunctor equipped with a left strength .
We also have the notion of right strength, which is defined symmetrically and involves a natural transformation . In a symmetric monoidal category, the two notions are interdefinable using the braiding .
Commutative monads on symmetric monoidal closed categories were originally defined by Kock [36] as strong monads satisfying a certain condition. It was shown in [36, 38] that commutative monads on symmetric monoidal (closed) categories are equivalent to symmetric monoidal monads. In this paper, we mainly rely on the ‘double strength’ of monoidal monads, so we state the definition in monoidal form. We chose to use the term ‘commutative’ in the paper since that is slightly more common in a theoretical computer science context.
Definition 42 ([36, 38]).
Let be a monoidal category. A monoidal monad on is a monad equipped with a natural transformation making the following diagrams commute: