Colimit-Based Composition of High-Level Computing Devices Damian Arellanes Abstract Models of High-level Computation (MHCs) provide effective means to describe complex real-world computing systems because they offer formal foundations for the specification of interacting computing devices, as opposed to describing individual ones, which has been the focus of classical models such as Turing machines or the lambda calculus. Despite numerous proposals over the past half century, there is still no canonical MHC akin to Turing machines for (compositionally) reasoning about computation in the large. One of the major drawbacks of current MHCs is that they extensively neglect control flow, a well-know semantic property that defines computation order. Only a few MHCs treat control explicitly at the expense of assuming that data follows control. Mixing such dimensions within the same framework leads to inefficient methods for formal analysis and verification. To address this, the computon model has recently emerged as a category-theoretic MHC that separates data and control and makes control explicit by supporting composition operators characterised as finite colimit constructions. Such constructions allow the formation of sequential, parallel, branching and iterative computing devices. Unfortunately, the computon model is still a generic reference rather than a concrete realisation. In this paper, we provide a variation of it to enable functional computing devices, introduce a new branching operator, discuss how to define synchronous parallelising out of sequencing and asynchronous parallelising, describe concrete operational semantics for computon execution and provide the first implementation of the model. The implementation yields an open-source programming environment that realises the underlying categorical semantics. This tool is publicly available and ready to build complex computing devices that are structurally correct by construction. 1 Introduction The Church-Turing thesis states that a function is computable if there is an effective procedure able to produce its values. Such a thesis has been successful for reasoning about computation in the small, i.e., for studying the behaviour of computing devices capable of solving “small-scale” problems. Over the last half century, there has been a collective attempt to move from the small to the large by defining models of computation capable of describing not the behaviour of isolated computing devices, but interactions among a collection of them. This paradigm shift, known as Models of High-Level Computation (MHCs) [ 4 ] , has become increasingly relevant due to the need of describing complex computations in real-world domains (e.g., distributed systems). To date, there is no standard MHC akin to Turing machines for constructing or reasoning about computation in the large, despite the wide variety of MHCs that have emerged over time, e.g., Kahn Process Networks [ 15 ] , Hierarchical State Machines (HSMs) [ 13 ] , ONets [ 6 ] and, more recently, algebras over operads of wiring diagrams [ 26 ] . In the context of MHCs, interaction is the causal effect of composition, an inductive mechanism for gluing together computing devices into more complex ones known as composites. For example, HSMs compose state machines by nesting, ONets compose Petri nets by identifying outputs with inputs via pushout constructions and Kahn networks combine processes by connecting them through (possibly unbounded) FIFO channels. In general, composition can be realised through the combination of states, control flow, data flow or any combination thereof. Although control lies at the heart of computation, because it is ever present in any (low- or even high-level) computing device, it is striking that such a dimension has traditionally been treated implicitly [ 4 ] . For example, in both HFSMs and ONets, control is implicit in the activation of state transitions and, in Kahn networks, in data exchanges. Making control explicit in an MHC leads to formal reasoning of computation order, facilitating the verification of common computational properties such as reachability or termination [ 23 ] . The computon model [ 2 , 3 ] provides categorical semantics to formally compose high-level computing devices by control flow in an incremental and bottom-up manner. For this, it provides composition operators, with behaviour characterised as finite colimit constructions, that define explicit control flow for the activation of computing devices in some specific order. Data flow is considered, albeit it is a second-class dimension governed by control. Particularly, there are separate operators for forming sequential, (synchronous and asynchronous) parallel, branching and iterative computing devices. As their internal structure is only accessible through an interface, devices are modular black boxes with explicit separation of concerns. Separating data from control has proven relevant for reasoning about such dimensions independently [ 8 ] . For example, one can verify termination by analysing control flow only, or data reachability without inspecting control flow at all [ 23 ] . Beyond verification, separating concerns has been effective for model transformation purposes [ 2 ] . Unfortunately, the computon model is still a generic formalism that serves as a reference rather than a concrete realisation dictating how devices should compute. Accordingly, it leaves the interpretation of computing devices open by avoiding concrete implementations and giving operational semantics at a higher-level of abstraction via P/T Petri nets. Moreover, the operators it provides do not offer sufficient flexibility for modelling expressive decision-making structures. In this paper, we move from the abstract to the particular by endowing computons with structural relations between inputs and outputs to enable functional computing devices, and introduce a new operator for branching. We also show that the original operator for forming synchronous parallel composites can be defined out of sequencing and asynchronous parallelising, and study additional algebraic properties in terms of identity, a law that was not originally analysed. The original definition of the sequential operator is modified to satisfy this law. Our ultimate goal is to offer a universal framework to formally reason about high-level computing devices in a compositional manner via categorical semantics. As the proposed framework is sufficiently general, we envision multiple theoretical extensions and tools built out of it. In this paper, we take the first step towards a tool that bridges theory and practice by implementing the computon model in a functional programming language with dependent types. The implementation yields an open-source programming environment, intended for describing high-level computations via colimit constructions. To the best of our knowledge, this is the first implementation of the computon model. The rest of the paper is structured as follows. Section 2 presents the category of computons and their morphisms. Section 3 describes colimit constructions that capture the behaviour of control-driven composition operators for sequencing, parallelising and branching. Section 4 defines concrete operational semantics for computon execution. Section 5 , and appendices 0.A and 0.B , present an implementation of the computon model. Section 6 discusses related work. Section 7 outlines the conclusions and future work. 2 The Category of Computons and Computon Morphisms A computon is intuitively a bipartite graph where nodes are ports or computation units, connected through edges that represent information flow. A port is a buffer for storing a datum or a control signal so it has a type associated to it. To abstract away from concrete types, natural numbers are used, with the property that zero is always present. As zero-typed ports buffer control signals, computation is driven by control. Ports associated with natural numbers greater than zero store data and are optional. Both data and control values are consumed by computation units. In this paper, we treat a unit as a collection of computable functions, called computing devices, which receive a number of inputs and produce exactly one output. The inputs of a device d in a unit u are taken from a subset of ports connected to u , whereas the output of d is deposited in a port connected from u . Our proposed definition of a computon is presented below. Definition 1 A computon \lambda is a 13-tuple (U,P,I,O,\Sigma,B,\sigma,t,\tau,s,c,r,f) where: • U is a finite set of computation units, • P is a finite nonempty set of ports, • I is a finite set of inflows, • O is a finite set of outflows, • \Sigma is a finite nonempty set of natural numbers representing types, • B is a finite set of strings (i.e., computing devices) over a finite alphabet, • {\sigma\colon O\twoheadrightarrow U} is a surjective function that defines the source unit of each outflow, • {t\colon O\to P} is a function that specifies the target port of each outflow, • {\tau\colon I\twoheadrightarrow U} is a surjective function that specifies the target unit of each inflow, • {s\colon I\to P} is a function that specifies the source port of each inflow, • {c\colon P\to\Sigma} is a function that assigns a type to each port, • {r\colon I\twoheadrightarrow O} is a surjective function relating inflows with outflows, and • {f\colon O\to B} is a function that attaches each outflow to a computing device such that (i) {0\in\Sigma} , (ii) {\tau\restriction_{(c\circ s)^{-1}(0)}} and {\sigma\restriction_{(c\circ t)^{-1}(0)}} are surjective, (iii) {\sigma\circ r=\tau} , and (iv) there are ports {p\in P\setminus t(O)} and {q\in P\setminus s(I)} with {c(p)=0=c(q)} . Notation 1 A computon \lambda with {u\in U} and {p\in P} has sets {s(\tau^{-1}(u))} , {t(\sigma^{-1}(u))} , {\tau(s^{-1}(p))} and {\sigma(t^{-1}(p))} written {\bullet u} , {u\bullet} , {p\bullet} and {\bullet p} , respectively. To distinguish between distinct computons, we use natural numbers to index their components. If a computon symbol has no subindex, its components have no subindex either. Rather than directly specifying a function {U\to B} , Definition 1 relies on a span {U\overset{\sigma}{\twoheadleftarrow}O\xrightarrow{f}B} to generalise the functional relation given by the former, i.e., a unit can be related not to just one device, but to multiple ones. Having {U\to B} alone is not sufficient to allow units produce different outputs consistently, as such a function does not encode any means to determine which values go to which outflows without imposing certain order, i.e., the only way of enabling multiple outputs is through a product type. By equipping computons with a function chain {I\overset{\text{r}}{\twoheadrightarrow}O\xrightarrow{f}B} , we abstract away from particular orderings by offering a direct relationship between inflows and outflows that makes it possible to extract information flows coming from/into computing devices. Concretely, an outflow {o\in O} takes data from the result of a device {f(o)} which, in turn, operates on the input values from {r^{-1}(o)} . By the totality of f , it is guaranteed that each outflow reads information from exclusively one device. 1 1 1 Representing a computing device as a finite sequence of symbols over a finite alphabet is valid as it is known that every computable function can be encoded thereby [ 21 ] . To encapsulate behaviour within units, Restriction (iii) in Definition 1 enforces devices to read/produce data from/into ports attached to the unit they belong to. Restriction (ii) enforces units to have control ports connected to and from it, and Restriction (i) specifies that the control type is ever present. Restriction (iv) simply ensures the existence of ports where control flow starts and terminates, called control inports and control outports, respectively. The set {P^{+}} of all control and data inports defines the input interface of a computon \lambda , whilst the set {P^{-}} of all control and data outports give rise to the output interface. Definition 2 (Computon Interface) The interface of a computon \lambda is a tuple {(P^{+},P^{-})} where {P^{+}} and {P^{-}} are the sets {P\setminus t(O)} and {P\setminus s(I)} , respectively. When there is a sequence of flows from every inport (or from any port with outflows) to some outport, we say that the computon is connected (see Definition 3 ). By Proposition 1 , connected computons always have at least one computation unit. Definition 3 (Connected Computon) Let {(U\sqcup P,I\sqcup O,s^{\prime},t^{\prime})} be the bipartite graph G of a computon \lambda with {s^{\prime},t^{\prime}\colon I\sqcup O\to U\sqcup P} given as follows: \displaystyle s^{\prime}(e) \displaystyle=\begin{cases}s(e)&\text{if }e\in I\\ \sigma(e)&\text{if }e\in O\end{cases}\qquad\qquad\qquad t^{\prime}(e) \displaystyle=\begin{cases}\tau(e)&\text{if }e\in I\\ t(e)&\text{if }e\in O\end{cases} We say that a computon is connected if, for every port {p\in P^{+}\cup s(I)} , there is a path {(e_{1},e_{2},\ldots,e_{n})} in G of length {n\geq 2} with {s^{\prime}(e_{1})=p} and {t^{\prime}(e_{n})\in P^{-}} . Proposition 1 If \lambda is a connected computon, then {U\neq\emptyset} . Proof Let {p\in P^{+}\cup s(I)} be a port of a connected computon \lambda so there is a path {(e_{1},e_{2},\ldots,e_{n})} in the bipartite graph of \lambda where {s^{\prime}(e_{1})=p} . As {e_{1}\in O} would contradict {s^{\prime}(e_{1})=p\in P} , {e_{1}\in I} must hold. Hence, by the totality of \tau , {\tau(e_{1})\in U} . A computon possessing only interface ports, with no units or flows at all, is called a trivial computon . That is: Definition 4 A computon \lambda is trivial if it satisfies {U=I=O=\emptyset} . When a computon has exactly one computation unit to which all typed ports are attached, we say it is primitive . Like trivials, a primitive one has all ports at the interface, with the restriction that each inport is connected to the unique unit via a single inflow and that each outport is linked to the unit through a single outflow. This restriction is given by the injectivity condition of the functions s and t , prescribed by Definition 5 . Definition 5 A computon \lambda is primitive if {|U|=1} , {P\cong I\sqcup O} and s and t are injective. Note that Definition 1 enforces primitive computons to always have inflows and outflows due to the surjectivity of \tau and \sigma . As s and t are not necessarily onto in that definition, it is possible to have ports with no flows attached. To prevent this, {P\cong I\sqcup O} and injectivity over s and t are required, with the former condition implying that all ports lie at the interface (see Proposition 2 ). Proposition 2 If \lambda is a primitive computon, P\cong P^{+}\triangle P^{-} . Proof Assume {|I|=m} and {|O|=n} so {|s(I)|=m} and {|t(O)|=n} because s and t are total. Now, if we assume for contradiction that {|P^{-}\cap P^{+}|>0} , we know there must be some port {p\in P^{-}\cap P^{+}} , i.e., {p\notin s(I)\cup t(O)} which implies {|P|>|s(I)|+|t(O)|} . As {|P|>m+n} clearly contradicts the property |P|=|I|+|O|=m+n from Definition 5 , we have {|P^{-}\cap P^{+}|=0} . Considering {|P^{+}|=|P\setminus t(O)|=m+n-n=m} and |P^{-}|=|P\setminus s(I)|=m+n-m=n , we deduce: {|P^{+}\triangle P^{-}|=|P^{+}|+|P^{-}|-2|P^{-}\cap P^{+}|=m+n=|I|+|O|=|P|} Having {|P^{+}\triangle P^{-}|=|P|} allow us to conclude {P^{+}\triangle P^{-}\cong P} , as required. 2.1 Computon Morphisms A computon morphism is intuitively an embedding of a computon into another. More precisely, it is a collection of six total functions that map units to units, ports to ports, inflows to inflows, outflows to outflows, types to types and devices to devices such that the two last mappings are inclusions to guarantee consistency in terms of port typing and computational behaviour (see Definition 6 ). Definition 6 (Computon Morphism) A computon morphism {\alpha\colon\lambda_{1}\rightarrow\lambda_{2}} is a 6-tuple (\alpha_{U},\alpha_{P},\alpha_{I},\alpha_{O},\alpha_{\Sigma},\alpha_{B}) of total functions {\alpha_{U}\colon U_{1}\rightarrow U_{2}} , {\alpha_{P}\colon P_{1}\rightarrow P_{2}} , {\alpha_{I}\colon I_{1}\rightarrow I_{2}} , \alpha_{O}\colon O_{1}\rightarrow O_{2} , {\alpha_{\Sigma}\colon\Sigma_{1}\hookrightarrow\Sigma_{2}} and {\alpha_{B}\colon B_{1}\hookrightarrow B_{2}} such that the following diagrams commute: {\lx@inpgf@ignorespaces I_{1}} {\lx@inpgf@ignorespaces U_{1}} {\lx@inpgf@ignorespaces O_{1}} {\lx@inpgf@ignorespaces I_{2}} {\lx@inpgf@ignorespaces U_{2}} {\lx@inpgf@ignorespaces O_{2}} \scriptstyle{\lx@inpgf@ignorespaces\tau_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{I}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{U}} \scriptstyle{\lx@inpgf@ignorespaces\sigma_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{O}} \scriptstyle{\lx@inpgf@ignorespaces\tau_{2}} \scriptstyle{\lx@inpgf@ignorespaces\sigma_{2}} {\lx@inpgf@ignorespaces I_{1}} {\lx@inpgf@ignorespaces P_{1}} {\lx@inpgf@ignorespaces O_{1}} {\lx@inpgf@ignorespaces I_{2}} {\lx@inpgf@ignorespaces P_{2}} {\lx@inpgf@ignorespaces O_{2}} \scriptstyle{\lx@inpgf@ignorespaces s_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{I}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{P}} \scriptstyle{\lx@inpgf@ignorespaces t_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{O}} \scriptstyle{\lx@inpgf@ignorespaces s_{2}} \scriptstyle{\lx@inpgf@ignorespaces t_{2}} {\lx@inpgf@ignorespaces B_{1}} {\lx@inpgf@ignorespaces O_{1}} {\lx@inpgf@ignorespaces I_{1}} {\lx@inpgf@ignorespaces B_{2}} {\lx@inpgf@ignorespaces O_{2}} {\lx@inpgf@ignorespaces I_{2}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{B}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{O}} \scriptstyle{\lx@inpgf@ignorespaces f_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{I}} \scriptstyle{\lx@inpgf@ignorespaces r_{1}} \scriptstyle{\lx@inpgf@ignorespaces f_{2}} \scriptstyle{\lx@inpgf@ignorespaces r_{2}} {\lx@inpgf@ignorespaces P_{1}} {\lx@inpgf@ignorespaces\Sigma_{1}} {\lx@inpgf@ignorespaces P_{2}} {\lx@inpgf@ignorespaces\Sigma_{2}} \scriptstyle{\lx@inpgf@ignorespaces c_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{P}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{\Sigma}} \scriptstyle{\lx@inpgf@ignorespaces c_{2}} and {\vec{i}(\alpha)\cup\vec{o}(\alpha)\subseteq P_{1}^{+}\cup P_{1}^{-}} with {\vec{i}(\alpha)} given by {\{p\in P_{1}\mid\bullet\alpha_{P}(p)\setminus\alpha_{P}(\bullet p)\neq\emptyset\}} and {\vec{o}(\alpha)} given by {\{p\in P_{1}\mid\alpha_{P}(p)\bullet\setminus\alpha_{P}(p\bullet)\neq\emptyset\}} . From now on, we use natural numbers as subindices to distinguish between distinct morphisms and abuse notation by omitting components, e.g., we write {\alpha(p)} for {\alpha_{P}(p)} when the context is clear. The first diagram in Definition 6 preserves adjacency of inflows and outflows with respect to computation units. The immediate diagram on the right preserves adjacency between ports and their information flows. The isolated square retains port typing, and the remaining one keeps the relationship between inflows, outflows and devices. The last two restrictions from Definition 6 ensure that a computon can be embedded into another only at its interface, i.e., only inports or outports of the source computon can be attached to new computation units in the target computon. As a consequence, we have the following lemma. Lemma 1 ( [ 2 ] ) For any computon morphism {\alpha\colon\lambda_{1}\rightarrow\lambda_{2}} , {\alpha^{-1}(P_{2}^{+})\subseteq P_{1}^{+}} and {\alpha^{-1}(P_{2}^{-})\subseteq P_{1}^{-}} . There is a special class of morphisms, called markers, which allow embedding a trivial computon into a computon interface (see Definition 7 ). When the embedding covers all the inports, it is called an in-marker and, when it covers all the outports, it is called an out-marker . In [ 2 ] , it has been shown that markers are unique up to unique isomorphism and always exist. Definition 7 (Computon Markers) A marker {\lambda^{\square}} of a computon \lambda is a computon monomorphism {\lambda_{0}\rightarrow\lambda} where \lambda_{0} is a trivial computon and {\lambda^{\square}(P_{0})=P^{\square}} with {\square\in\{+,-\}} . If {\square=+} , it is called an in-marker ; otherwise, an out-marker . 2.2 Colimit Constructions In the theory of computons, complex embeddings can be built out of “elementary” colimits, namely coproduct and pushout. Coproduct is simply the disjoint union of computon components, which gives rise to a composite structure that puts two computons side-by-side (see Definition 8 ). Pushout is the square complement of a span of computon morphisms, which merges two computons into a composite according to the instructions given by the span (see Definition 9 ). In [ 2 ] , we showed that pushouts can only be formed if a span satisfies the restrictions from Definition 10 and that the category of computons has all coproducts (see Theorem 2.1 ). Definition 8 (Coproduct) The coproduct {\lambda_{1}+\lambda_{2}} of computons \lambda_{1} and \lambda_{2} is given by the following diagram of finite sets and total functions: {\lx@inpgf@ignorespaces O_{1}\sqcup O_{2}} {\lx@inpgf@ignorespaces B_{1}\cup B_{2}} {\lx@inpgf@ignorespaces U_{1}\sqcup U_{2}} {\lx@inpgf@ignorespaces I_{1}\sqcup I_{2}} {\lx@inpgf@ignorespaces P_{1}\sqcup P_{2}} {\lx@inpgf@ignorespaces\Sigma_{1}\cup\Sigma_{2}} \scriptstyle{\lx@inpgf@ignorespaces\sigma} \scriptstyle{\lx@inpgf@ignorespaces t} \scriptstyle{\lx@inpgf@ignorespaces f} \scriptstyle{\lx@inpgf@ignorespaces\tau} \scriptstyle{\lx@inpgf@ignorespaces s} \scriptstyle{\lx@inpgf@ignorespaces r} \scriptstyle{\lx@inpgf@ignorespaces c} Supposing {\beta_{1}\colon\lambda_{1}\to\lambda_{1}+\lambda_{2}} and {\beta_{2}\colon\lambda_{2}\to\lambda_{1}+\lambda_{2}} are the canonical coproduct monomorphisms, the functions \sigma , t , \tau , s , c , r and f are computed sourcewise. For example, \sigma is given as follows for all {o\in O_{1}\sqcup O_{2}} : \sigma(o)=\begin{cases}\beta_{1}(\sigma_{1}(o_{1}))&\text{if }o=\beta_{1}(o_{1})\text{ for some }o_{1}\in O_{1}\\ \beta_{2}(\sigma_{2}(o_{2}))&\text{if }o=\beta_{2}(o_{2})\text{ for some }o_{2}\in O_{2}\end{cases} Definition 9 (Pushout) The pushout {\lambda_{1}+_{\lambda_{0}}\lambda_{2}} of a span {\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} of morphisms is given by the following diagram of finite sets and total functions: {\lx@inpgf@ignorespaces O_{1}\sqcup_{O_{0}}O_{2}} {\lx@inpgf@ignorespaces B_{1}\sqcup_{B_{0}}B_{2}} {\lx@inpgf@ignorespaces U_{1}\sqcup_{U_{0}}U_{2}} {\lx@inpgf@ignorespaces I_{1}\sqcup_{I_{0}}I_{2}} {\lx@inpgf@ignorespaces P_{1}\sqcup_{P_{0}}P_{2}} {\lx@inpgf@ignorespaces\Sigma_{1}\sqcup_{\Sigma_{0}}\Sigma_{2}} \scriptstyle{\lx@inpgf@ignorespaces\sigma} \scriptstyle{\lx@inpgf@ignorespaces t} \scriptstyle{\lx@inpgf@ignorespaces f} \scriptstyle{\lx@inpgf@ignorespaces\tau} \scriptstyle{\lx@inpgf@ignorespaces s} \scriptstyle{\lx@inpgf@ignorespaces r} \scriptstyle{\lx@inpgf@ignorespaces c} Supposing {\beta_{1}\colon\lambda_{1}\to\lambda_{1}+_{\lambda_{0}}\lambda_{2}} and {\beta_{2}\colon\lambda_{2}\to\lambda_{1}+_{\lambda_{0}}\lambda_{2}} are the pushout-induced computon morphisms, the functions \sigma , t , \tau , s , c , r and f are computed sourcewise. For example, \tau is given as follows for all {i\in I_{1}\sqcup_{I_{0}}I_{2}} : \tau(i)=\begin{cases}\beta_{1}(\tau_{1}(i_{1}))&\text{if }i=\beta_{1}(i_{1})\text{ for some }i_{1}\in I_{1}\\ \beta_{2}(\tau_{2}(i_{2}))&\text{if }i=\beta_{2}(i_{2})\text{ for some }i_{2}\in I_{2}\end{cases} Definition 10 (Pushable Span) A pushable span {\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} satisfies {\alpha_{1}(\vec{i}(\alpha_{2}))\cup\alpha_{1}(\vec{o}(\alpha_{2}))\subseteq P_{1}^{+}\cup P_{1}^{-}} , {\alpha_{2}(\vec{i}(\alpha_{1}))\cup\alpha_{2}(\vec{o}(\alpha_{1}))\subseteq P_{2}^{+}\cup P_{2}^{-}} , \Sigma_{0}\subseteq\Sigma_{1}\cap\Sigma_{2} and {B_{0}\subseteq B_{1}\cap B_{2}} . Remark 1 Considering that the B - and \Sigma -components of computon morphisms are inclusions (as per Definition 6 ) as well as {\Sigma_{0}\subseteq\Sigma_{1}\cap\Sigma_{2}} and {B_{0}\subseteq B_{1}\cap B_{2}} (as per Definition 10 ), {B_{1}\sqcup_{B_{0}}B_{2}\cong B_{1}\cup B_{2}} and {\Sigma_{1}\sqcup_{\Sigma_{0}}\Sigma_{2}\cong\Sigma_{1}\cup\Sigma_{2}} . Also, note that when {i\in I_{1}\sqcup_{I_{0}}I_{2}} is identified with an element of both {I_{1}} and {I_{2}} , it is sufficient for \tau to choose either {\beta_{1}(\tau_{1}(i_{1}))} or {\beta_{2}(\tau_{2}(i_{2}))} due to the commutativity equations from Definition 6 . This evidently applies to \sigma , t , s , c , r and f . Theorem 2.1 ( [ 2 ] ) Let \lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}} be a span \rho of computon morphisms. The pushout of \rho exists if and only if \rho is pushable. 3 Composition Operators Pushout and coproduct constructions form the basis of the composition operators the theory of computons builds on. In this section, we describe separate operators to form sequential, parallel and branching composites, which define explicit control flow for the invocation of computons in some precise order. Before describing the operators, we introduce the notion of parsing trees which are syntactic constructs that define the hierarchical structure of composites in a precise manner. This notion, formalised in Definition 11 , entails that composite computons are syntactically parsing trees of height {\geq 1} . As per Definition 12 , a computon is sound when it is formed out of trivial and primitive computons only. Definition 11 (Parsing Tree) A parsing tree is a right-labelled tree where every node has arity 2 or 0 . Nodes of arity 0 correspond to the tree leaves and are labelled by a symbol {\lambda_{j}} with {j\geq 0} . Nodes of arity 2 are labelled by {\square_{\rho_{k}}} with {\square\in\{\unrhd,\rhd,?,??,+\}} and {k\geq 0} . As every leaf has height 0 and every node n with children {m_{1},\ldots,m_{n}} has height {max(height(m_{1}),\ldots,height(m_{n}))+1} , the height of a tree is the height of its root. Definition 12 (Sound Computon) A computon is sound if each leaf of its parsing tree represents a trivial computon or a primitive computon. 3.1 Sequential Computons A sequential computon defines a control flow structure for the invocation of two computons in a pipeline. Such a composite is obtained by computing the pushout of a sequentiable span of computon morphisms (see Definition 13 ). It is total when all the outports of the “first-executed” computon are connected to all the inports of the “secondly-executed” computon, and partial otherwise (see Definition 14 ). Definition 13 (Sequentiable Span) A span {\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} is sequentiable if \lambda_{0} is a trivial computon, and \alpha_{1} and \alpha_{2} are monomorphisms with {\alpha_{1}(P_{0})\subseteq P_{1}^{-}} , {\alpha_{2}(P_{0})\subseteq P_{2}^{+}} , {\Sigma_{0}\subseteq\Sigma_{1}\cap\Sigma_{2}} and {B_{0}\subseteq B_{1}\cap B_{2}} . Definition 14 (Sequential Computon) The pushout of a sequentiable span {\rho:=\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} yields a total sequential computon {\lambda_{1}\unrhd_{\rho}\lambda_{2}} if {\alpha_{1}(P_{0})=P_{1}^{-}} and {\alpha_{2}(P_{0})=P_{2}^{+}} ; otherwise, it yields a partial sequential computon {\lambda_{1}\rhd_{\rho}\lambda_{2}} . Example 1 Suppose we have primitive computons \lambda_{1} , \lambda_{2} and \lambda_{3} with units that encapsulate devices for binary multiplication ( \odot ), binary addition ( \oplus ) and unary successor ( \mathcal{S} ), respectively, each also having a device \epsilon that echoes a control signal. With these primitives, we can form composites in diverse ways. For example, Figure 1 (a) shows the construction of a partial sequential computon {\lambda_{1}\rhd_{\rho_{1}}\lambda_{2}} , intended for computing {(a\cdot b)+c} . Partiality occurs because this composite is formed from a sequentiable span {\rho_{2}:=(\alpha_{1},\alpha_{2})} that omits the 2 -coloured data inport of \lambda_{2} . An example for the formation of a total sequential computon {\lambda_{1}\unrhd_{\rho_{2}}\lambda_{3}} is shown in Figure 1 (b), in which there is a sequentiable span {\rho_{2}:=(\alpha_{3},\alpha_{4})} that identifies all the \lambda_{1} -outports with all the \lambda_{3} -inports, yielding a composite intended to compute the successor of {(a\cdot b)} . If 1 and 2 are the respective types of nonnegative integers and float numbers, then {a,b\geq 0} , and c would be a float. The computon model abstracts away from concrete types in order to provide a general implementation-independent framework. In Sec. 4 , we describe operational semantics to map natural numbers to concrete types from a fixed type system. \alpha_{1} \alpha_{2} 1 1 1 \odot \epsilon \lambda_{1} 1 1 2 2 \oplus \epsilon \lambda_{2} 1 1 \odot \epsilon 1 2 \oplus \epsilon 2 (a) Constructing {\lambda_{1}\rhd_{\rho_{1}}\lambda_{2}} . \alpha_{3} \alpha_{4} 1 1 1 \odot \epsilon \lambda_{1} 1 1 1 \mathcal{S} \epsilon \lambda_{3} 1 1 \odot \epsilon 1 1 \mathcal{S} \epsilon (b) Constructing {\lambda_{1}\unrhd_{\rho_{2}}\lambda_{3}} . Comp. unit Control flow Control inport Control outport Control inoutport Data flow Data inport Data outport Data inoutport Composite computon Figure 1 : Partial and total sequencing. Control ports are not 0 -labelled for clarity. As every computon always possesses control ports, it is always possible to connect at least one computon’s control outport with the control inport of another, i.e., every two computons are always sequentiable (see Theorem 3.1 ). Lemmas 2 and 3 specify how interfaces are formed for sequential computons. Lemma 4 specifies that the morphisms induced by the pushout of a sequentiable span are monic. By Theorem 3.2 both total and partial sequencing are not commutative, and only total sequencing is associative. Theorem 3.3 says that a trivial computon with exactly one control port can be used as the left- and right-identity for both classes of sequencing. Theorem 3.1 If \lambda_{1} and \lambda_{2} are computons, there exists a sequentiable span \rho whose pushout is either \lambda_{1}\rhd_{\rho}\lambda_{2} or \lambda_{1}\unrhd_{\rho}\lambda_{2} . Proof Definition 1 states that every computon has at least one inport and at least one outport. So, for any two computons \lambda_{1} and \lambda_{2} , we can always form a sequentiable span {\rho:=\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} where \lambda_{0} is a trivial computon with {\alpha_{1}(P_{0})\subseteq P_{1}^{-}} , {\alpha_{2}(P_{0})\subseteq P_{2}^{+}} , {\Sigma_{0}\subseteq\Sigma_{1}\cap\Sigma_{2}} and {B_{0}\subseteq B_{1}\cap B_{2}} . As the pushability conditions from Definition 10 follow trivially, the pushout of \rho exists which, by Definition 14 , must be either {\lambda_{1}\rhd_{\rho}\lambda_{2}} or {\lambda_{1}\unrhd_{\rho}\lambda_{2}} . Lemma 2 Assume that {\rho:=\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} is a sequentiable span of computon morphisms. If {\lambda_{1}\xrightarrow{\beta_{1}}\lambda_{3}\xleftarrow{\beta_{2}}\lambda_{2}} is the cospan induced by the pushout of \rho , then {\beta_{1}(P_{1}^{+})\subseteq P_{3}^{+}} and {\beta_{2}(P_{2}^{-})\subseteq P_{3}^{-}} . Proof We just show {\beta_{1}(P_{1}^{+})\subseteq P_{3}^{+}} since the proof of {\beta_{2}(P_{2}^{-})\subseteq P_{3}^{-}} is completely analogous. For this, assume for contrapositive {p_{3}\notin P_{3}^{+}} so there is some {o_{3}\in O_{3}} with {t_{3}(o_{3})=p_{3}} . As {O_{3}=O_{1}\sqcup_{O_{0}}O_{2}} according to Definition 9 , we have three possible cases: 1. There exclusively is some {o_{1}\in O_{1}} with {\beta_{1}(o_{1})=o_{3}} so, by the commutativity squares of \beta_{1} , {\beta_{1}(t_{1}(o_{1}))=t_{3}(\beta_{1}(o_{1}))=t_{3}(o_{3})=p_{3}} . As {t_{1}(o_{1})\notin P_{1}^{+}} as per Definition 2 , {p_{3}\notin\beta_{1}(P_{1}^{+})} . 2. There exclusively is some {o_{2}\in O_{2}} with {\beta_{2}(o_{2})=o_{3}} . In this case, the proof is analogous to that of 1 . 3. There are {o_{1}\in O_{1}} and {o_{2}\in O_{2}} for which {\beta_{1}(o_{1})=o_{3}=\beta_{2}(o_{2})} . This case never holds since the apex of \rho is a trivial computon with no flows at all. Proving that 3 does not hold and that {p_{3}\notin P_{3}^{+}\implies p_{3}\notin\beta_{1}(P_{1}^{+})} for 1 and 2 entail {\beta_{1}(P_{1}^{+})\subseteq P_{3}^{+}} , as required.∎ Lemma 3 Assume that the pushout of {\rho:=\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} is a total sequential computon \lambda_{3} . If {\lambda_{1}\xrightarrow{\beta_{1}}\lambda_{3}\xleftarrow{\beta_{2}}\lambda_{2}} is the cospan induced by the pushout of \rho , then {\beta_{1}(P_{1}^{+})=P_{3}^{+}} and {\beta_{2}(P_{2}^{-})=P_{3}^{-}} . Proof We only prove {\beta_{1}(P_{1}^{+})=P_{3}^{+}} since the other is completely analogous. For this, let {p_{3}\in P_{3}^{+}} . Using Lemma 1 and the fact that P_{3} is given by {P_{1}\sqcup_{P_{0}}P_{2}} (see Definition 9 ), we have three cases: 1. p_{3} is exclusively identified with \lambda_{1} -ports so {p_{3}\in\beta_{1}(P_{1}^{+})} . 2. p_{3} is exclusively identified with \lambda_{2} -ports. Here, let {p_{2}\in P_{2}^{+}} with {\beta_{2}(p_{2})=p_{3}} . As \rho satisfies {\alpha_{2}(P_{0})=P_{2}^{+}} (by Definition 14 ), {p_{2}\in P_{2}^{+}\iff p_{2}\in\alpha_{2}(P_{0})} . Clearly, a contradiction to the fact that p_{3} is not identified with any \lambda_{1} -port. 3. there exist {p_{1}\in P_{1}^{+}} and {p_{2}\in P_{2}^{+}} where {\beta_{1}(p_{1})=p_{3}=\beta_{2}(p_{2})} . As {p_{1}\in P_{1}^{+}} , {p_{3}\in\beta_{1}(P_{1}^{+})} holds directly. Disproving 2 and proving that {p_{3}\in P_{3}^{+}\implies p_{3}\in\beta_{1}(P_{1}^{+})} for 1 and 3 imply {P_{3}^{+}\subseteq\beta_{1}(P_{1}^{+})} . Thus, we simply use Lemma 2 to conclude {\beta_{1}(P_{1}^{+})=P_{3}^{+}} .∎ Lemma 4 If {\lambda_{1}\xrightarrow{\beta_{1}}\lambda_{3}\xleftarrow{\beta_{2}}\lambda_{2}} is the cospan induced by the pushout of a sequentiable span {\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} , then \beta_{1} and \beta_{2} are computon monomorphisms. Proof We prove only for \beta_{1} , since the other is analogous. For this, first note that the \Sigma - and B -components of {\beta_{1}} are always injective because Definition 6 says they are inclusion functions. For the I -component, I_{1} -elements are never identified with I_{2} -elements by the fact that {\lambda_{0}} is a trivial computon with no flows at all, i.e., {I_{0}=\emptyset} . Thus, by Definition 9 , {I_{3}=I_{1}\sqcup_{I_{0}}I_{2}} has an equivalence class for each I_{1} -element, i.e., the I -component of \beta_{1} is injective. The same reasoning holds for the O - and U -components of {\beta_{1}} considering {O_{0}=\emptyset=U_{0}} . Now, assume for contradiction that the P -component of \beta_{1} is not injective so there are ports {p_{1},q_{1}\in P_{1}} with {\beta_{1}(p_{1})=\beta_{1}(q_{1})} . As {P_{3}=P_{1}\sqcup_{P_{0}}P_{2}} , we have two possible scenarios: 1. There is no {p_{2}\in P_{2}} with {\beta_{2}(p_{2})=\beta_{1}(p_{1})=\beta_{1}(q_{1})} . In this case, p_{1} and q_{1} form individual equivalence classes in P_{3} for satisfying the reflexivity of the equivalence relation for {P_{1}\sqcup_{P_{0}}P_{2}} . Thus, contradicting our assumption that {\beta_{1}(p_{1})=\beta_{1}(q_{1})} . 2. There is some {p_{2}\in P_{2}} where {\beta_{2}(p_{2})=\beta_{1}(p_{1})=\beta_{1}(q_{1})} . In this case, the commutativity property of pushouts entails there are {p_{0},q_{0}\in P_{0}} with {\alpha_{1}(p_{0})=p_{1}} , {\alpha_{1}(q_{0})=q_{1}} and {\alpha_{2}(p_{0})=p_{2}=\alpha_{2}(q_{0})} . Clearly contradicting that {\alpha_{2}} is injective (see Definition 13 ). As all their components are injective functions, we conclude that \beta_{1} is a computon monomorphism, as required.∎ Theorem 3.2 Total sequencing is associative up to isomorphism, but partial sequencing is not. Both total and partial sequencing are not commutative. Proof Disproving the commutativity of both total and partial sequencing can be done through the counterexamples presented in [ 2 ] . In the same paper, there is a counterexample that can be used to disprove the associativity of partial sequencing. Here, we just prove that total sequencing is associative up to isomorphism. For this, assume that {\lambda_{1}\unrhd_{\rho_{1}}\lambda_{2}} and {\lambda_{2}\unrhd_{\rho_{2}}\lambda_{3}} are total sequential computons with {\rho_{1}:=\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{2}}\lambda_{2}} and {\rho_{2}:=\lambda_{2}\xleftarrow{\alpha_{3}}\lambda_{4}\xrightarrow{\alpha_{4}}\lambda_{3}} . So, we have the following commutative diagram: {\lx@inpgf@ignorespaces\lambda_{4}} {\lx@inpgf@ignorespaces\lambda_{3}} {\lx@inpgf@ignorespaces\lambda_{0}} {\lx@inpgf@ignorespaces\lambda_{2}} {\lx@inpgf@ignorespaces\lambda_{2}\unrhd_{\rho_{2}}\lambda_{3}} {\lx@inpgf@ignorespaces\lambda_{1}} {\lx@inpgf@ignorespaces\lambda_{1}\unrhd_{\rho_{1}}\lambda_{2}} {\lx@inpgf@ignorespaces\lambda_{5}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{3}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{4}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{8}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{2}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{6}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{7}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{10}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{5}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{9}} where the cospans (\alpha_{5},\alpha_{6}) and (\alpha_{7},\alpha_{8}) are induced by the pushout of \rho_{1} and \rho_{2} , respectively. Composing computon morphisms horizontally and vertically, we obtain the following commutative diagrams: {\lx@inpgf@ignorespaces\lambda_{0}} {\lx@inpgf@ignorespaces\lambda_{2}\unrhd_{\rho_{2}}\lambda_{3}} {\lx@inpgf@ignorespaces\lambda_{4}} {\lx@inpgf@ignorespaces\lambda_{3}} {\lx@inpgf@ignorespaces\lambda_{1}} {\lx@inpgf@ignorespaces\lambda_{5}} {\lx@inpgf@ignorespaces\lambda_{1}\unrhd_{\rho_{1}}\lambda_{2}} {\lx@inpgf@ignorespaces\lambda_{5}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{1}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{7}\circ\alpha_{2}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{10}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{6}\circ\alpha_{3}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{4}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{10}\circ\alpha_{8}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{9}\circ\alpha_{5}} \scriptstyle{\lx@inpgf@ignorespaces\alpha_{9}} Now, by Definition 6 we know that the \Sigma - and B -components of \alpha_{1} , \alpha_{2} and \alpha_{7} are inclusions so {\Sigma_{0}\subseteq\Sigma_{1}} , {\Sigma_{0}\subseteq\Sigma_{2}\subseteq\Sigma_{2}\cup\Sigma_{3}} , {B_{0}\subseteq B_{1}} and {B_{0}\subseteq B_{2}\subseteq B_{2}\cup B_{3}} (recall that the sets of types and devices of a pushout object are identified with set union - see Remark 1 ). Thus, {\Sigma_{0}\subseteq\Sigma_{1}\cap(\Sigma_{2}\cup\Sigma_{3})} and {B_{0}\subseteq B_{1}\cap(B_{2}\cup B_{3})} . To show that every \lambda_{0} -port is mapped to an inport of \lambda_{2}\unrhd_{\rho_{2}}\lambda_{3} , consider the following chain of equivalences: p\in\alpha_{7}(\alpha_{2}(P_{0}))\iff p\in\alpha_{7}(P_{2}^{+}) (because \alpha_{2}(P_{0})=P_{2}^{+} by the fact that the pushout of \rho_{1} is a total sequential computon) \iff p is an inport of \lambda_{2}\unrhd_{\rho_{2}}\lambda_{3} (as per Lemma 3 ). Using Lemma 4 and the fact that the pushout of \rho_{1} is total sequential, we have that \alpha_{2} and \alpha_{7} are monic. Consequently, {\alpha_{7}\circ\alpha_{2}} is also a mono. Having {\alpha_{1}(P_{0})=P_{1}^{-}} , because the pushout of \rho_{1} is total sequential, we use Definition 13 to deduce that {\rho_{3}:=\lambda_{1}\xleftarrow{\alpha_{1}}\lambda_{0}\xrightarrow{\alpha_{7}\circ\alpha_{2}}\lambda_{2}\unrhd_{\rho_{2}}\lambda_{3}} is sequentiable. In this construction, \lambda_{0} is the apex computon whilst \lambda_{1} and \lambda_{2}\unrhd_{\rho_{2}}\lambda_{3} are the left and right operands, respectively. Using Definition 14 , we determine that the pushout of \rho_{3} is {\lambda_{1}\unrhd_{\rho_{3}}(\lambda_{2}\unrhd_{\rho_{2}}\lambda_{3})} . A similar reasoning can be used to establish that {(\lambda_{1}\unrhd_{\rho_{1}}\lambda_{2})\unrhd_{\rho_{4}}\lambda_{3}} is the pushout of the span {\rho_{4}:=\lambda_{1}\unrhd_{\rho_{1}}\lambda_{2}\xleftarrow{\alpha_{6}\circ\alpha_{3}}\lambda_{4}\xrightarrow{\alpha_{4}}\lambda_{3}} . Therefore, {\lambda_{1}\unrhd_{\rho_{3}}(\lambda_{2}\unrhd_{\rho_{2}}\lambda_{3})\cong\lambda_{5}\cong(\lambda_{1}\unrhd_{\rho_{1}}\lambda_{2})\unrhd_{\rho_{4}}\lambda_{3}} , i.e., total sequencing is associative up to isomorphism.∎ Theorem 3.3 Total and partial sequencing satisfy identity up to isomorphism. Proof It suffices to prove for partial sequencing since the proof of the other is similar. To do this, we use a trivial computon \lambda with {|P|=1} , {\Sigma=\{0\}} and {B=\emptyset} , as the left- and right-identity. Accordingly, we need to show {\lambda\rhd_{\rho_{1}}\lambda_{1}\cong\lambda_{1}} and {\lambda_{1}\rhd_{\rho_{2}}\lambda\cong\lambda_{1}} for some arbitrary computon \lambda_{1} . We just prove {\lambda\rhd_{\rho_{1}}\lambda_{1}\cong\lambda_{1}} since the other is symmetric. By Definition 13 , we know {\rho_{1}} is a sequentiable span of the form {\lambda\xleftarrow{\alpha}\lambda_{0}\xrightarrow{\alpha_{1}}\lambda_{1}} . Since \lambda_{0} must be a trivial computon, the functions {\alpha_{U}} , {\alpha_{I}} and {\alpha_{O}} are necessarily empty. The function {\alpha_{B}} has to be empty too because {B=\emptyset} so that {B_{0}\cong B} . Given that \alpha must be a monomorphism in addition to satisfy Definition 13 , we have {P_{0}\cong P} and {\Sigma_{0}\cong\Sigma} . Consequently, {\lambda_{0}\cong\lambda} holds which directly implies {\lambda\rhd_{\rho_{1}}\lambda_{1}\cong\lambda+_{\lambda_{0}}\lambda_{1}\cong\lambda_{1}} , as required. 3.2 Parallel Computons In the theory of computons, it is possible to form a composite to encapsulate control flow for the asynchronous invocation of two computons (see Definition 15 ). Definition 15 (Async) An async {\lambda_{1}+\lambda_{2}} is the coproduct of \lambda_{1} and \lambda_{2} . Given that the computon category has all coproducts [ 2 ] , an async can always be formed (see Theorem 3.4 ). By Theorems 3.5 and 3.6 , asynchronous parallelising (i.e., the operation to form an async) is associative and commutative, but has no identity. Theorem 3.4 An async computon {\lambda_{1}+\lambda_{2}} can always be constructed. Proof It is trivial to check that coproduct can always be computed in the category of computons because it is computed componentwise in the category of finite sets (which has all coproducts). Theorem 3.5 Asynchronous parallelising is associative and commutative up to isomorphism. Proof The proof follows directly from the well-known fact that coproduct in the category of finite sets is both associative and commutative up to isomorphism. Theorem 3.6 Asynchronous parallelising does not satisfy the identity law. Proof Suppose for contradiction that \lambda is the left- and right-identity of asynchronous parallelising so {\lambda+\lambda_{1}\cong\lambda_{1}\cong\lambda_{1}+\lambda} for some computon \lambda_{1} . As {\lambda+\lambda_{1}} is the coproduct of \lambda and \lambda_{1} (see Definition 15 ), Definition 8 entails {P\sqcup P_{1}\cong P_{1}} , which is only true if P=\emptyset . But Definition 1 says that the set of ports cannot be empty so that \lambda cannot be a left-identity. Disproving the existence of a right-identity can be done analogously. In [ 2 ] , an operator for synchronous parallelising was described, relying on a special class of computons referred to as joins, which are primitives with exactly two control inports and one control outport. In this paper, we generalise such a notion in the form of a so-called glue . Definition 16 (Glue) A glue is a primitive computon \lambda with {c(p)=0} for all {p\in P} . As a join is just a special glue, glues can be used to build sync composites that synchronise the execution of multiple computons (see Definition 17 ). By Theorem 3.7 , such structures can always be formed. Definition 17 (Sync) Given computons \lambda_{1} and \lambda_{2} , a sync computon {\lambda_{1}|\lambda_{2}} is given by {(\lambda_{1}+\lambda_{2})\square\lambda_{3}} where \lambda_{3} is a glue, {\square\in\{\rhd_{\rho},\unrhd_{\rho}\}} and \rho is a sequentiable span that identifies all the control outports of {\lambda_{1}+\lambda_{2}} with all the inports of \lambda_{3} . Theorem 3.7 A sync computon {\lambda_{1}|\lambda_{2}} always exist. Proof Given computons \lambda_{1} and \lambda_{2} , we define {C_{1}^{-}:=\{p\in P_{1}^{-}\mid c_{1}(p)=0\}} and {C_{2}^{-}:=\{p\in P_{2}^{-}\mid c_{2}(p)=0\}} to construct a glue primitive \lambda_{3} as follows: {U_{3}=\{u\}} , {P_{3}\cong C_{1}^{-}\sqcup C_{2}^{-}\sqcup\{o\}} , {I_{3}\cong C_{1}^{-}\sqcup C_{2}^{-}} , {O_{3}=\{o\}} , {\Sigma_{3}=\{0\}} and {B_{3}=\{\epsilon\}} where \epsilon is the computing device echoing a control signal. If {\phi\colon P_{3}\to C_{1}^{-}\sqcup C_{2}^{-}\sqcup\{o\}} and {\gamma\colon I_{3}\to C_{1}^{-}\sqcup C_{2}^{-}} are the corresponding isomorphisms, the functions of \lambda_{3} are given as follows: {s_{3}=\phi^{-1}\restriction_{C_{1}^{-}\sqcup C_{2}^{-}}\circ\gamma} , {t_{3}(o)=q} with {\phi(q)\notin C_{1}^{-}\sqcup C_{2}^{-}} , {\sigma_{3}(o)=u=\tau_{3}(i)} , {c_{3}(p)=0} , {f_{3}(o)=\epsilon} and {r_{3}(i)=o} for all {i\in I_{3}} and all {p\in P_{3}} . Since |O_{3}|=1 , t_{3} is necessarily injective. Similarly, s_{3} also is because \gamma is iso and {\phi^{-1}\restriction_{C_{1}^{-}\sqcup C_{2}^{-}}} is a restriction of the injective function {\phi^{-1}} . The functions \sigma_{3} and \tau_{3} are surjective because they map flows to the unique {u\in U_{3}} . The function r_{3} is surjective too because it maps all inflows to the single outflow o . Since {|U_{3}|=1} and {P_{3}\cong C_{1}^{-}\sqcup C_{2}^{-}\sqcup\{o\}\cong I_{3}\sqcup O_{3}} , \lambda_{3} is primitive as per Definition 5 . It also is a glue because all its ports are zero-coloured through c_{3} . Now, consider the trivial computon \lambda_{4} given by {P_{4}\cong I_{3}} with {c_{4}(p)=0} for all {p\in P_{4}} , {\Sigma_{4}=\{0\}} and {B_{4}=(B_{1}\cup B_{2})\cap B_{3}} . Assuming {\psi\colon P_{4}\to I_{3}} is the corresponding isomorphism, we construct the computon morphism {\alpha_{1}\colon\lambda_{4}\to\lambda_{1}+\lambda_{2}} by taking {\gamma\circ\psi} as the P -component, and the canonical inclusions {0\mapsto 0} and {B_{4}\hookrightarrow B_{1}\cup B_{2}} as the \Sigma - and B -components, respectively. Here, the function {\gamma\circ\psi\colon P_{4}\to C_{1}^{-}\sqcup C_{2}^{-}} is well-defined because {C_{1}^{-}\sqcup C_{2}^{-}\subseteq P_{1}\sqcup P_{2}} . Having the inclusions {\vec{i}(\alpha_{1})\cup\vec{o}(\alpha_{1})\subseteq P_{4}=P_{4}^{+}\cap P_{4}^{-}\subseteq P_{4}^{+}\cup P_{4}^{-}} , \alpha_{1} must be a valid computon morphism as per Definition 6 . In fact, it is a monomorphism because all its components, including {\gamma\circ\psi} , are injective. Now, construct {\alpha_{2}\colon\lambda_{4}\to\lambda_{3}} by taking {s_{3}\circ\psi} , {0\mapsto 0} and {B_{4}\hookrightarrow B_{3}} as its corresponding P -, \Sigma - and B -components. Checking that \alpha_{2} satisfies the conditions from Definition 6 is analogous to \alpha_{1} , so \alpha_{2} is also a computon morphism. Given that all the \alpha_{2} -components are injective, including {s_{3}\circ\psi} , \alpha_{2} is monic. As Definition 2 entails {\alpha_{1}(p)=s_{3}(\psi(p))\notin P_{3}^{-}} for all {p\in P_{4}} , we simply apply Proposition 2 to deduce {\alpha_{1}(p)\in P_{3}^{+}} , i.e., {\alpha_{1}(P_{4})\subseteq P_{3}^{+}} . Having the fact {(\gamma\circ\psi)(P_{4})\subseteq C_{1}^{-}\sqcup C_{2}^{-}\subseteq P_{1}^{-}\sqcup P_{2}^{-}} in addition and considering that \alpha_{1} and \alpha_{2} are monic, the span {\rho:=(\lambda_{1}+\lambda_{2})\xleftarrow{\alpha_{1}}\lambda_{4}\xrightarrow{\alpha_{2}}\lambda_{3}} must be sequentiable (see Definition 13 ). Therefore, {(\lambda_{1}+\lambda_{2})\rhd_{\rho}\lambda_{3}} or {(\lambda_{1}+\lambda_{2})\unrhd_{\rho}\lambda_{3}} can be formed, i.e., {\lambda_{1}|\lambda_{2}} exists. Basically, the proof of Theorem 3.7 yields a 2-stage construction to form a sync {\lambda_{1}|\lambda_{2}} . The idea is to first define {\lambda_{1}+\lambda_{2}} (for parallel execution) and then use sequencing to connect all the control outports of {\lambda_{1}+\lambda_{2}} with all the inports of a glue (which waits for the async’s termination). Evidently, the apex of the sequentiable span must be a trivial computon with control ports only. By Theorems 3.8 and 3.9 , the operation to form {\lambda_{1}|\lambda_{2}} (i.e., synchronous parallelising) is commutative, but it does not satisfy identity or associativity. Theorem 3.8 Synchronous parallelising is not associative and has no identity. Proof The counterexample shown in [ 2 ] is sufficient to disprove associativity. Having no right- or left-identity follows immediately from Theorem 3.6 . Theorem 3.9 Synchronous parallelising is commutative up to isomorphism. Proof The proof follows directly from the commutativity property of computon coproduct which, in turn, comes from the fact that coproduct in the category of finite sets and total functions is commutative up to isomorphism. As we have been discussing composition semantics only, it might not seem entirely obvious how a sync behaves. To elucidate this, we now provide an example. Example 2 Figures 2 (a) and 2 (b) use the same primitive computons as Figure 1 to form {\lambda_{1}+\lambda_{2}} and {(\lambda_{1}+\lambda_{2})\rhd_{\rho}\lambda} , respectively, in order to perform binary product and binary addition in parallel. The only difference is that 2 (b) awaits termination via the glue \lambda . Although the span \rho is not shown due to space constraints, it should be clear that it meets Definition 17 as it identifies all the control outports of {\lambda_{1}+\lambda_{2}} with all the \lambda -inports. In this case, the identification corresponds to partial sequencing because data ports are omitted. Consequently, there is an effect in which data ports traverse several composite layers. 1 1 1 \odot \epsilon \lambda_{1} 1 2 2 \oplus \epsilon \lambda_{2} (a) {\lambda_{1}+\lambda_{2}} . \odot \epsilon \lambda_{1} \oplus \epsilon \lambda_{2} 1 1 1 2 \epsilon 1 2 \lambda (b) {(\lambda_{1}+\lambda_{2})\rhd_{\rho}\lambda} . Comp. unit Control flow Control inport Control outport Control inoutport Data flow Data inport Data outport Data inoutport Composite computon Figure 2 : Examples of asynchronous and synchronous parallelising. 3.3 Branching Computons A branching computon embodies an essential structure for non-deterministic decision-making, allowing to choose a computon out of two alternative ones. Such class of composites can be either open or closed. The former is simply the pushout of a span of in-markers of the operands (see Definition 18 ), whereas the latter is the colimit of a so-called b-diagram which basically is a span of in-markers together with a span of out-markers (see Definition 19 ). In both cases, the in-markers are embedded into every operand inport so a branching structure can only be formed when inports fully match. In the case of open branching, the outports of the operands remain untouched because there are no out-markers; thus, contrasting with the full outport identification enforced by closed branching. Definition 18 (Open Branching Computon) An open branching computon {\lambda_{2}?_{\rho}\lambda_{3}} is the pushout of a span {\rho:=\lambda_{2}\xleftarrow{\lambda_{2}^{+}}\lambda_{0}\xrightarrow{\lambda_{3}^{+}}\lambda_{3}} . Definition 19 (Closed Branching Computon) A b-diagram \rho is a pair of spans, {\lambda_{2}\xleftarrow{\lambda_{2}^{+}}\lambda_{0}\xrightarrow{\lambda_{3}^{+}}\lambda_{3}} and {\lambda_{2}\xleftarrow{\lambda_{2}^{-}}\lambda_{1}\xrightarrow{\lambda_{3}^{-}}\lambda_{3}} , where \lambda_{2} and \lambda_{3} are connected computons. A closed branching computon \lambda_{2}??_{\rho}\lambda_{3} is the colimit of \rho , computed as {\lambda_{2}+_{\lambda_{0}+\lambda_{1}}\lambda_{3}} . Example 3 To elucidate Definitions 18 and 19 , suppose that in addition to the computon \lambda_{3} from Figure 1 , we have primitives \lambda_{4} and \lambda_{5} for computing the predecessor of a natural number ( \mathcal{P} ) and the factorial function ( \mathcal{F} ), respectively. Figure 3 (a) shows an example of an open branching composite able to choose between the successor and predecessor primitives in a non-deterministic manner, whereas Figure 3 (b) displays a closed branching structure for choosing either the successor or the factorial function. Figure 3 (a) particularly unfolds the flexibility unleashed by the operator described in Definition 18 , i.e., the operand outports do not have to fully match as it occurs in the case of closed branching. \lambda_{3}^{+} \lambda_{4}^{+} 1 \mathcal{S} \epsilon 1 1 \lambda_{3} \mathcal{P} \epsilon 1 2 \lambda_{4} \mathcal{S} \epsilon 1 \mathcal{P} \epsilon 2 1 (a) Constructing {\lambda_{3}?_{\rho_{1}}\lambda_{4}} . \lambda_{3}^{+} \lambda_{5}^{+} \lambda_{3}^{-} \lambda_{5}^{-} {\lambda_{3}+_{\lambda_{0}+\lambda_{1}}\lambda_{5}} \lambda_{0} 1 \lambda_{1} 1 \mathcal{S} \epsilon 1 1 \lambda_{3} \mathcal{F} \epsilon 1 1 \lambda_{5} \mathcal{S} \epsilon \mathcal{F} \epsilon 1 1 (b) Constructing {\lambda_{3}??_{\rho_{2}}\lambda_{5}} . Comp. unit Control flow Control inport Control outport Control inoutport Data flow Data inport Data outport Data inoutport Composite computon Figure 3 : Open and closed branching. Here, the wavy arrow is not a morphism, but it expresses the operation {\lambda_{3}+_{\lambda_{0}+\lambda_{1}}\lambda_{5}} to form the closed branching computon {\lambda_{3}??_{\rho_{2}}\lambda_{5}} from the b-diagram \rho_{2} shown on the left of (b). The open branching computon {\lambda_{3}?_{\rho_{1}}\lambda_{4}} is just the pushout of the span \rho_{1} of in-markers {\lambda_{3}^{+}} and {\lambda_{4}^{+}} . By Theorems 3.10 , 3.11 and 3.12 , both operators satisfy associativity and commutativity, but only open branching has left- and right-identity. Theorem 3.10 Up to isomorphism, open branching is associative, commutative and has identity. Proof Associativity and commutativity follow from the fact that pushout of finite sets satisfies those properties up to isomorphism. For identity, let us consider the span {\rho:=\lambda_{2}\xleftarrow{\lambda_{2}^{+}}\lambda_{0}\xrightarrow{\lambda_{3}^{+}}\lambda_{3}} of in-markers with {\lambda_{0}\cong\lambda_{2}} . As \lambda_{2} must evidently be a trivial computon, we use Definition 9 to deduce that {\lambda_{2}?_{\rho}\lambda_{3}} has {|U_{3}|} units, {|P_{2}|+|P_{3}|-|P_{0}|} ports, {|I_{3}|} inflows, {|O_{3}|} outflows, {|\Sigma_{2}|+|\Sigma_{3}|-|\Sigma_{0}|} types and {|B_{2}|+|B_{3}|-|B_{0}|} computing devices. Particularly, {\lambda_{2}?_{\rho}\lambda_{3}} has {|P_{3}|} ports, {|B_{3}|} devices and {|\Sigma_{3}|} types because {|P_{0}|=|P_{2}|} , {|B_{0}|=|B_{2}|} and {|\Sigma_{0}|=|\Sigma_{2}|} by the fact {\lambda_{0}\cong\lambda_{2}} . Therefore, {\lambda_{2}?_{\rho}\lambda_{3}\cong\lambda_{2}+_{\lambda_{0}}\lambda_{3}\cong\lambda_{3}} . Theorem 3.11 ( [ 3 ] ) Up to isomorphism, closed branching is associative and commutative. Theorem 3.12 Closed branching does not satisfy the identity law. Proof Suppose for contradiction that a computon \lambda_{2} is the left-identity of closed branching so {\lambda_{2}??_{\rho}\lambda_{3}\cong\lambda_{3}} holds for some computon \lambda_{3} and some b-diagram \rho formed by spans {\lambda_{2}\xleftarrow{\lambda_{2}^{+}}\lambda_{0}\xrightarrow{\lambda_{3}^{+}}\lambda_{3}} and {\lambda_{2}\xleftarrow{\lambda_{2}^{-}}\lambda_{1}\xrightarrow{\lambda_{3}^{-}}\lambda_{3}} . As \lambda_{2} and \lambda_{3} must be connected as per Definition 19 , Proposition 1 says that units {u_{2}\in U_{2}} and {u_{3}\in U_{3}} must exist. If we assume that {\beta_{1}\colon\lambda_{2}\to\lambda_{2}??_{\rho}\lambda_{3}} and {\beta_{2}\colon\lambda_{3}\to\lambda_{2}??_{\rho}\lambda_{3}} are the pushout-induced morphisms by {\lambda_{2}+_{\lambda_{0}+\lambda_{1}}\lambda_{3}} , we have two possible scenarios: 1. There is some unit u in {\lambda_{2}??_{\rho}\lambda_{3}} where {\beta_{1}(u_{2})=u=\beta_{2}(u_{3})} . So, there must also be a unit in {\lambda_{0}+\lambda_{1}} identified with u . Thus, contradicting that {\lambda_{0}+\lambda_{1}} has no units because {U_{0}\sqcup U_{1}=\emptyset\sqcup\emptyset=\emptyset} by the fact that \lambda_{0} and \lambda_{1} are trivial computons (see Definitions 7 and 8 ). 2. There is no unit in \lambda_{3} identified with \beta_{1}(u_{2}) through \beta_{2} . In this case, {\lambda_{2}+_{\lambda_{0}+\lambda_{1}}\lambda_{3}} has {|U_{2}|+|U_{3}|} units because {|U_{0}|+|U_{1}|=0} . As {|U_{2}|\geq 1} because \lambda_{2} is connected, {|U_{2}|+|U_{3}|>|U_{3}|} so {\lambda_{2}+_{\lambda_{0}+\lambda_{1}}\lambda_{3}\cong\lambda_{2}??_{\rho}\lambda_{3}\cong\lambda_{3}} cannot hold. Proving that there is no right-identity is completely symmetric. Hence, this theorem holds. 4 Operational Semantics In this paper, we are exclusively concerned with the execution semantics of sound computons which are entities built from trivial and primitive computons only (see Definition 12 ). For the sake of simplicity, we assume that a type is just a set of values, as in the formalisation of the operational semantics of coloured Petri nets [ 14 ] . As we are dealing with natural numbers to represent types, we require a deterministic way of mapping them to concrete types. This is done through the typing function described in Definition 20 . Definition 20 (Typing Function) The typing function T for a computon \lambda has the signature {\Sigma\to\mathcal{U}} where {\mathcal{U}} is the universe of types of some fixed type system. We assume {\mathcal{C}} is in \mathcal{U} , which is the control type containing the single value * that represents a control signal. A typing function specifies the type of values a port can buffer. Definition 21 states that the collection of values associated to each port at time j gives the state of a computon at j . Definition 21 (Computon State) The state of a computon \lambda at time j is a total function {\delta^{j}\colon P\to(\bigcup_{n\colon\Sigma}T(n))\cup\{\bot\}} where, for all {p\in P} , {\delta^{j}(p)} is of type {T(c(p))} . We say {\delta^{j}} is initial if {j=0} , {\delta^{j}(p)\neq\bot} for every {p\in P^{+}} and {\delta^{j}(q)=\bot} for all {q\notin P^{+}} . Here, we use \bot to express value absence. In each state, units can be enabled or idle. Definition 22 states that a unit is enabled at j if all the ports connected to it have values assigned by {\delta^{j}} ; otherwise, it is idle. When all units are idle, a final state has been reached (see Definition 23 ). Definition 22 (Computation Unit Status) A unit {u\in U} of a computon \lambda is enabled at time j if {\delta^{j}(p)\neq\bot} for all {p\in\bullet u} ; otherwise, u is idle under {\delta^{j}} . Definition 23 (Termination) A state {\delta^{j}} of a computon \lambda is final if each unit {u\in U} is idle under {\delta^{j}} . When a parallel or a branching composite are in an initial state, multiple units can be enabled simultaneously. Particularly, in parallel computons, all enabled units are triggered. However, in branching computons, only one unit is chosen for activation at a time. To deal with such non-determinism, units are partitioned according to the source ports they share. For example, if u_{1} and u_{2} are two units with {\bullet u_{1}=\bullet u_{2}} , then they belong to the same partition. To select a concrete unit from each partition, we simply invoke the axiom of choice which non-deterministically chooses a representative unit. The collection of representatives yields the set of units ready for evaluation (see Definition 24 ). Definition 24 (Ready Computation Units) Given a computon \lambda , let {E^{j}} be the finite set of computation units enabled under {\delta^{j}} and \sim be the equivalence relation \sim on {E^{j}} given by {u_{1}\sim u_{2}\iff\bullet u_{1}=\bullet u_{2}} for all {u_{1},u_{2}\in E^{j}} . If A is the partition induced by \sim and h is the random choice function on A , {\{h(E)\mid E\in A\}} is the set {R^{j}} of computation units that are ready to be evaluated under {\delta^{j}} . After forming the set {R^{j}} under a state {\delta^{j}} , the computing devices of each {R^{j}} -unit are invoked to yield a new state at time {j+1} (see Definitions 25 and 26 ). Definition 25 (Computation Unit Evaluation) Given an outflow {o\in O} of a computon \lambda and a state {\delta^{j}} , the result {\llbracket f(o)\rrbracket^{j}} of evaluating a computing device {f(o)} under {\delta^{j}} is given by: \llbracket f(o)\rrbracket^{j}=f(o)(\delta^{j}(p_{1}),\ldots,\delta^{j}(p_{n})) where {p_{1},\ldots,p_{n}\in s(r^{-1}(o))} with {\bigcup_{k=1}^{n}\{p_{k}\}=s(r^{-1}(o))} . We say that the value {\llbracket f(o)\rrbracket^{j}} is well-typed if and only if it is an element of {(T\circ c\circ t)(o)} . Definition 26 (State Transition) Given the state {\delta^{j}} of a computon \lambda at time {j\geq 0} , {\delta^{j+1}} is given as follows for all {p\in P} : \delta^{j+1}(p)=\begin{cases}\ast&(\exists u\in R^{j})[p\in u\bullet\text{ and }T(c(p))=\mathcal{C}]\\ \llbracket f(o)\rrbracket^{j}&(\exists u\in R^{j})(\exists o\in O)[\sigma(o)=u\text{ and }t(o)=p]\\ \delta^{j}(p)&(\nexists u\in R^{j})[p\in\bullet u\cup u\bullet]\\ \bot&\text{otherwise}\end{cases} Remark 2 As Definition 26 applies to sound computons only, the case of having outflows {o_{1},\ldots,o_{k}\in O} with {\sigma(o_{1})=\cdots=\sigma(o_{k})=u} and {t(o_{1})=\cdots=t(o_{k})=p} for {k\geq 2} , {u\in U} and {p\in P} never holds since this would contradict the injectivity condition of primitive computons (see Definition 5 ). When {t(o_{1})=\cdots=t(o_{k})=p} , the only possibility is then {\sigma(o_{1})\neq\cdots\neq\sigma(o_{k})} which only occurs in closed branching. By Definition 24 , when all the units of a closed branching composite are enabled, it is guaranteed that exactly one of them will be chosen for evaluation. At time {j+1} , a new state is constructed from {\delta^{j}} according to the four cases considered by Definition 26 . The first case serves to store a control signal in each control port connected from each computation unit in {R^{j}} . The second one assigns the result of each computing device from each {R^{j}} -unit. The third case serves the role of a memory to keep untouched the values of those ports attached to idle units under {\delta^{j}} . The last case simply assigns the value \bot to the ports connected to each unit in {R^{j}} , indicating that those (input) values have been consumed by ready units. These four cases collectively define a state transition during a computon’s execution, a process that continues until reaching a state in which all units are idle. In other words, termination occurs when there is a finite orbit of states from the computon’s initial state to a computon’s final state. 5 Implementation We implemented the semantics of the computon model in Idris 2 [ 7 ] which, as a functional programming language treating (dependent) types as first-class entities, allows an almost direct realisation of the key semantic constructs. The first step in this process was to select a suitable representation for finite sets and total functions. For this, we found Fin n adequate, which is a type with exactly n inhabitants corresponding to the natural numbers {0,\ldots,n-1} . Totality of Fin functions is a built-in property enforced by the Idris compiler. After deciding such representations, we implemented a suite of Idris functions to perform basic set operations such as fiber and image. With this, we subsequently implemented functions to compute disjoint union, union and pushout over Fin types. Our purpose is to support automated composition via control-driven composition operators, so we are interested in the computational angle of colimit constructions. Accordingly, both union and disjoint union are characterised as records with four fields each: the cardinality of two operands and two canonical injections from operands to the colimit construction being built. Cardinalities play an important role in our implementation since they define actual finite sets. 2 2 2 This simplification comes from the fact that the isomorphism class of a finite set A can be identified with |A| . Accordingly, considering that Fin n has exactly n monotonically increasing inhabitants, the disjoint union and union of Fin m with Fin n is simply m+n and maximum(m,n) , correspondingly. The pushout of Fin functions is a record that contains the cardinality of the pushout object as well as the two pushout-induced functions into the pushout object. Automatically constructing such functions is done through Algorithm 1 (presented in Appendix 0.A ). The implementation of pushout and coproduct over Fin forms the basis on which the category of computons is implemented upon. A computon object \lambda is particularly a record with 15 fields, holding the cardinalities of U , P , I , O and \Sigma as well as the total functions s , t , \sigma , \tau , c , r and f (see Appendix 0.B ). The cardinality of B is not needed since we use the String type to represent computing devices. Accordingly, {f\colon O\to B} is an Idris function {\texttt{Fin o}\to\texttt{String}} , where o is the cardinality of O . In addition to the components from Definition 1 , the Computon record includes fields to prove the non-emptiness of P and \Sigma . By the definition of Fin n types, having {n>0} entails that the number 0 is always included. Proofs of surjectivity for \sigma , \tau and r are not required within the Computon record since we only deal with the leaves of sound computons (i.e., primitives and trivials). Such proofs are just needed for the record representing primitive computons, which in addition requires proofs of injectivity for s and t and proofs that |U|=1 and {P\cong I\sqcup O} . 3 3 3 If Fin p , Fin i and Fin o are the types representing the finite sets P , I and O of a primitive computon \lambda , P\cong I\sqcup O reduces to verifying p=i+o . The record representing trivial computons does not require surjectivity proofs at all, since such a property holds directly from Definition 4 . In this case, it is sufficient to keep fields for the proofs of {|U|=|I|=|O|=0} . Unlike computons, a computon morphism is specified as a record with two arguments for delimiting domain and codomain (see Appendix 0.B ). Apart from the six components from Definition 6 , a Morphism record requires a proof that the function between computing devices is an inclusion as well as a proof that both boundary conditions from Definition 6 are met. 4 4 4 The proof of inclusion for the \Sigma -component is constructed dynamically to reduce proof tasks for developers. This record forms the basis of a computon monomorphism which also is a record but with proofs that all the components from Definition 6 are injective. A monomorphism serves in turn as the basis for specifying in- and out-markers. The former requires a mono from a trivial computon embedded into all the inports of the codomain computon. The latter is similar but requires a proof that the trivial computon can be inserted into all the outports of the codomain. Both in- and out-markers require a proof that the cardinality of the types from the trivial computon is less or equal to the cardinality of the set of types of the codomain computon. To assist developers in forming trivial computons, primitive computons, morphisms, monomorphisms and markers, we provide Idris functions that facilitate the construction of such objects. To specify colimits, we also define records for spans, coproducts and pushouts. Coproduct and pushout are simply computed as in Definitions 8 and 9 through Algorithm 2 (discussed in Appendix 0.A ). By offering functions to compute coproducts and pushouts, we provide a basis for the implementation of the elementary composition operators described in Sec. 3 . The signatures of the operators for total/partial sequencing, asynchronous parallelising and closed/open branching, along with all the computon constructions presented in this section, are described in Appendix 0.B . The operator for synchronous parallelising is not implemented since this is built out of partial sequencing and asynchronous parallelising. The source code of the implemented programming environment, together with examples, are publicly available at https://github.com/damianarellanes/computons-idris . As the environment was implemented in Idris, the universe of data types for the operational semantics correspond to it. To avoid parsing the static structure of a computon at run-time, we defined a data type that embodies a structural simplification, using vectors for direct access. For a computon \lambda , such a simplification stores P^{-} , a vector that specifies which ports buffer control, vectors for mapping each unit {u\in U} to {\bullet u} and to {u\bullet} , a vector from each {p\in t(O)} to the unit-indexed computing devices that p reads from and a vector that specifies which units are enabled at a particular point in time. A state is simply a vector of size {|P|} where each index represents the value of each port. Such values are of IO type because they have side effects, as a result of treating each computing device as a string that represents the network endpoint of a behaviour given in the form of a web service. That is, computing devices are implemented as web services. We treat devices in this way to enable interoperability while avoiding colimit computations over large strings or source code compilation. 5 5 5 By supporting interoperability through web services, one computing device can be written in Java, another in Haskell and another in Python, just to give a few examples. That is, our implementation enables a practical hybrid model of computation. Instead, B -elements are simply IP addresses contacted upon evaluation as per Definition 25 . Evaluating a computation unit yields a new vector/state to be processed in the next time step, as prescribed by Definitions 24 and 26 . This process continues until reaching a final state of the computon being executed. 6 Related Work The computon model, originally introduced in [ 2 ] , describes composition operators for total and partial sequencing, synchronous and asynchronous parallelising, closed branching, head-iteration and tail-iteration. Unfortunately, such an original formulation is a generic reference rather a concrete realisation that dictates how to compute at the low-level. Accordingly, the original computon definition neither defines functional relations between inflows and outflows nor imposes particular flow order within computation units, leading to a situation in which a unit u has to either replicate the same value to all the data ports in {u\bullet} or enforce {u\bullet} to have only one data port (for holding a single datum or a product type value). To remediate this structural inflexibility with operational consequences, Definition 1 equips computons with a set B of computing devices, together with a function chain {I\overset{\text{r}}{\twoheadrightarrow}O\xrightarrow{f}B} that satisfies {\sigma\circ r=\tau} to encapsulate flows within units. Unlike [ 2 ] , Sec. 4 describes operational semantics to dictate how devices are triggered within units. In [ 2 ] , there is no concrete implementation or programming environment, and execution is described generically at a higher-level of abstraction via P/T Petri nets. Although similar operational semantics to ours have been proposed in [ 3 ] , such a work handles units homogeneously in the form of families of NAND operators to show that the computon model is able to perform any Boolean function when treated as a non-uniform model of computation. In our work, a computation unit is a collection of computing devices each represented as a finite sequence of symbols over a finite alphabet. A crucial difference with respect to [ 2 ] and [ 3 ] is that they do not provide any operator for open branching, needed to enhance flexibility towards more expressive decision-making composites. In the present work, we found that there is no need to provide an explicit operator for synchronous parallelising since such a behaviour can be constructed compositionally out of partial sequencing and asynchronous parallelising (see Sec. 3.2 ). Although we do not offer operators for looping due to the lack of space, they can be easily integrated and implemented within our framework. Unlike [ 2 ] , our work studies identity laws for composition operators and replaces the original formulation of sequencing to enable this property. In particular, connectivity in the sense of Definition 3 is not further required. Beyond the original computon model, there have been other MHCs that treat control flow explicitly. Process algebras [ 5 , 18 ] form perhaps the most prominent family of MHCs which provide concrete operators to compose processes by control flow. Although data flow can separately be observable and analysable, there is no explicit support for partial sequencing. Unlike many process calculi, the computon model emphasises functional computations in which computing devices are stateless constructs which are activated only when all their inputs become available. So, termination always destroys input streams. String diagrams [ 19 ] are becoming increasingly popular to specify high-level processes formally since they are grounded in categorical semantics for reasoning about computation in a compositional manner. As syntax, they provide a graphical notation for monoidal categories by visually encoding composition rules: wires denote data flows coming into/from boxes which, in turn, represent processes. Although there are no special wires for representing control flow, string diagrams support sequential, asynchronous parallel and iterative composition through morphism composition, tensor product and traces [ 20 ] . Sequencing is only total and there is no support for synchronous parallelising. Recently, (probabilistic) branching has been introduced [ 24 ] and there has been an effort to colouring wires not for separating concerns, but for expressing parallel execution threads [ 12 ] . In any case, string diagrams assume that data follow control. Workflow nets [ 23 ] allow the formal specification of control-driven computing devices, but do not offer any separation of concerns and, unlike process algebras and string diagrams, they do not provide any formal operators to compositionally form control-driven composites. The X-MAN component model [ 17 ] and Behaviour Trees [ 10 ] alleviate this composition issue by providing separate operators for sequencing, branching, parallelising and looping but, unfortunately, the data dimension is left implicit. In the case of [ 17 ] , there have been attempts to separate data from control, albeit without any formal semantics [ 1 , 16 ] . Prosave [ 25 ] and SCADE [ 9 ] offer such a separation, but also in an informal manner. 7 Conclusions and Future Work In this paper, we introduced and extended a novel MHC, referred to as the computon model, in which (trivial and primitive) computons are the fundamental building blocks. A trivial computon is intuitively a group of typed ports, whereas a primitive one has a unique computation unit that encapsulates a collection of (potentially interrelated) computing devices, only accessible through a well-defined port-based interface. Computon interfaces have ports to buffer control signals, whereas data ports are optional. This deliberate design facilitates inductive composition for forming explicit control flow structures for the invocation of computing devices is some order. In Sec. 3 , we described finite colimit constructions for composition operators to allow the formation of total/partial sequential computons, synchronous/asynchronous parallel computons and open/closed branching ones. In that section, we showed that total sequencing satisfies associativity and identity, whereas partial sequencing only fulfils identity. Synchronous parallelising is only commutative, whilst asynchronous parallelising and closed branching are both associative and commutative. Only open branching satisfies all the three properties. In the future, we plan to study further algebraic laws (e.g., inversibility) and provide extra colimit constructions to support other forms of composition such as conditional looping. Offering more complex forms of (compositional) concurrency is also a future direction. In any theoretical extension, control flow must still be a first-class composition dimension because it is what gives rise to the notion of computation. Although control is always present in any low- or even high-level computing device [ 4 ] , data flow must not be neglected but it must be treated as a secondary dimension always governed by control [ 22 ] . Governance does not imply that data follows control as, in some high-level devices, control signals may arrive before data values, leading to constituent computing devices waiting until receiving all the input data they need. This situation can particularly arise in partial sequencing or asynchronous parallelising. Despite that data does not necessarily follow control, computation order is still predictable in our proposal due to the synchronous evaluation of computation units, as described in Sec. 4 . More precisely, Sec. 4 stipulates that a computation unit remains idle until receiving information in all the ports connected to it. When all input information becomes available, an idle unit transitions to an enabled state. Given that non-determinism is introduced by branching composites, multiple units can be enabled simultaneously in which case only one is chosen for evaluation arbitrarily. In the future, we would like to extend the computon model with support for probabilistic choice to enhance its expressivity through conditional evaluation. Enabled units are currently evaluated by triggering their encapsulated computing devices on the inputs they receive from the external environment or from other computons. Upon evaluation, new values are stored in the ports connected to those units, in order to reach a new state. This process continues until reaching a state in which all units become idle. The operational semantics described in Sec. 4 can be interpreted in a categorical setting for a more rigorous study of computon execution. Operational semantics is not the focus of this paper but colimit-based composition is. In the future, we plan to formalise operational semantics in the language of symmetric monoidal categories by defining ports and computing devices as objects and morphisms of a category, respectively. Although we use categorical semantics to formalise our proposed model, it is important to mention that other formal languages can be used instead. That is, the proposed MHC is independent of its specification, just as it occurs with any other foundational model. To bridge theory and practice, we implemented the categorical semantics of the computon model in Idris 2, including the formalisation of computons, computon morphisms and colimit constructions. The implementation yields a programming environment for the formation of control-driven composite computons which are structurally correct by construction. We envision that primitives and composites could populate a repository of computational behaviours to be reused across several domains. For example, in a real e-commerce scenario, there could be primitive computons for payment processing and email delivery which can altogether be reused in both travel and healthcare applications. The computon model is general enough to be used not only in software engineering but in any domain requiring computable objects. For example, it has already been applied in Artificial Intelligence for compositionally forming a Long Short-Term Memory [ 2 ] , in biomedicine for modelling the oscillatory dynamics of a mdm2-p53 regulatory pathway [ 3 ] and in electronic engineering for compositional circuit design [ 3 ] . Given the generality of the computon model, several other application domains could benefit from it, e.g., quantum mechanics and linguistics for compositionally describing quantum teleportation and sentence meaning, respectively. The implemented programming environment currently provides the basis to support cross-domain applications. In our short-term vision, end-users just have to select computons from a global repository to compose more complex computons via the control-driven composition operators we present in Sec. 3 . Although our proposal enforces computons to be semantically correct by construction, this is not sufficient to achieve correct reusability. For this, we need guarantees of behaviour correctness with respect to some specification, so one can equip computons with correcteness proofs before storing them in a global repository. Full computon certification is an aspect we would to investigate in the future. We particularly believe that the bottom-up composition approach enforced by the computon model could facilitate a priori certification [ 11 ] . That is, if a computon is guaranteed to meet its specification, it will remain correct even if it ever becomes part of a composite. For example, if computons \lambda_{1} and \lambda_{2} are certified, the specification of \lambda_{1}\unrhd_{\rho}\lambda_{2} will be predictable prior composition, leading to predictable system assembly. Appendix 0.A Addendum to Section 5 : Coproduct and Pushout Algorithms In this appendix, we describe the two main algorithms for the construction of pushout-induced functions and coproduct equalities over finite sets, which form the basis for the implementation of colimit constructions in the category of computons. The first is Algorithm 1 which receives a span {Y\xleftarrow{g}X\xrightarrow{h}Z} of total functions and incrementally constructs functions {i_{Y}\colon Y\to Y\sqcup_{X}Z} and {i_{Z}\colon Z\to Y\sqcup_{X}Z} by initially treating them as partial and updating them at every step. To update such functions, the algorithm first obtains the fiber {g^{-1}(y)} of each {y\in Y} and, for each {x\in g^{-1}(y)} , it checks whether {h(x)} is in the domain of the current (partial) function {i_{Z}} . If {h(x)} is in the domain, then y and every element in {g^{-1}(y)} are mapped to {i_{Z}(h(x))} ; thus, imposing equality. Otherwise, y and its fiber elements are all mapped to the current pushout element ( 0 initially) which is then increased by one. After analysing all the Y -elements, Algorithm 1 finalises the construction of the total function i_{Y} , but i_{Z} might still be partial because some Z -elements might not fall under the image of h . To make i_{Z} total, those previously ignored elements are monotonically assigned to natural numbers in an increasing manner, starting with the latest pushout element. After completing this, Algorithm 1 simply returns the total functions i_{Y} and i_{Z} together with the pushout size (i.e., the latest pushout element). Algorithm 1 BuildPushoutFunctions a span Y\xleftarrow{g}X\xrightarrow{h}Z of total functions where X=[0,m]\cap\mathbb{Z} , Y=[0,n]\cap\mathbb{Z} and Z=[0,o]\cap\mathbb{Z} . (i_{Y},i_{Z},p) where {i_{Y}\colon Y\to Y\sqcup_{X}Z} and {i_{Z}\colon Y\to Y\sqcup_{X}Z} are total functions and p\in\mathbb{N} . i_{Y}\leftarrow\emptyset i_{Z}\leftarrow\emptyset currentpEl\leftarrow 0 for y\in Y do eq\leftarrow currentpEl for x\in g^{-1}(y) do if i_{Z}(h(x)) exists then eq\leftarrow i_{Z}(h(x)) break end if end for for x\in g^{-1}(y) do i_{Z}\leftarrow i_{Z}[h(x)\mapsto eq] end for i_{Y}\leftarrow i_{Y}[y\mapsto eq] if eq=currentpEl then currentpEl\leftarrow currentpEl+1 end if end for for z\in Z\setminus Dom(i_{Z}) do i_{Z}\leftarrow i_{Z}[z\mapsto currentpEl] currentpEl\leftarrow currentpEl+1 end for return (i_{Y},i_{Z},currentpEl) The second is Algorithm 2 which simply adheres to Definition 8 to compute the functions of a coproduct object in the category of finite sets, while considering practical issues related to efficiency. In particular, we avoid backtracking elements to their source by resorting to dynamic programming through which we define Idris vectors that store values for the actual mappings of coproduct functions. The components of a vector are values obtained through Algorithm 2 . For example, the source function {s\colon I_{1}\sqcup I_{2}\to P_{1}\sqcup P_{2}} of a coproduct object {\lambda_{1}+\lambda_{2}} is specified as a vector of size {|I_{1}|+|I_{2}|} where s(i) is given by \texttt{FindEq}(I_{1}\sqcup I_{2},P_{1}\sqcup P_{2},i,s_{1},s_{2}) . Algorithm 2 FindEq disjoint union {(A_{1},A_{2},inj^{A}_{1}\colon A_{1}\to A_{1}+A_{2},inj^{A}_{2}\colon A_{2}\to A_{1}+A_{2})} , disjoint union {(B_{1},B_{2},inj^{B}_{1}\colon B_{1}\to B_{1}+B_{2},inj^{B}_{2}\colon B_{2}\to B_{1}+B_{2})} , an element {a\in A_{1}+A_{2}} , and total functions {g_{1}\colon A_{1}\to B_{1}} and {g_{2}\colon A_{2}\to B_{2}} . an element {b\in B_{1}+B_{2}} . if {a=inj^{A}_{1}(a_{1})} for some {a_{1}\in A_{1}} then return {inj^{B}_{1}(g_{1}(a_{1}))} else if {a=inj^{A}_{2}(a_{2})} for some {a_{2}\in A_{2}} then return {inj^{B}_{2}(g_{2}(a_{2}))} end if For convention, for a coproduct Fin m+n , the injection {\texttt{Fin m}\to\texttt{Fin m+n}} assigns all the m -elements to themselves, whereas {\texttt{Fin n}\to\texttt{Fin m+n}} maps all the n -elements from m to m+(n-1) . Thus, yielding a deterministic procedure akin to tagging elements in canonical coproducts. We do not tag explicitly since this would unnecesarily complicate the type of finite sets. Tagging information can be retrieved from the canonical injective morphisms when needed, as shown in Algorithm 2 . Computon pushouts are computed in a similar manner but using Algorithm 2 over pushout constructions, e.g., the source function {s\colon I_{1}\sqcup_{I_{0}}I_{2}\to P_{1}\sqcup_{P_{0}}P_{2}} of a pushout object {\lambda_{1}+_{\lambda_{0}}\lambda_{2}} is an Idris vector of size {|I_{1}\sqcup_{I_{0}}I_{2}|} where s(i) is given by \texttt{FindEqPush}(I_{1}\sqcup_{I_{0}}I_{2},P_{1}\sqcup_{P_{0}}P_{2},i,s_{1},s_{2}) . Appendix 0.B Addendum to Section 5 : Key Constructs of the Programming Environment Implemented in Idris 2 In this section, we describe the key constructs we implemented in Idris for the realisation of the categorical semantics of the computon model. The complete source code of our implementation is publicly available at https://github.com/damianarellanes/computons-idris , and it is ready to be used for building complex computing devices that are structurally correct by construction. The idea is that end-users (e.g., software developers) just define spans of computon morphisms built out of trivial and primitive computons, before using the environment’s support to automatically construct composite computons. Such a support is provided in the form of Idris functions that realise the colimit behaviour of the elementary composition operators presented in Section 3 . To differentiate between builtin and implemented types, we use different colours: green and orange, respectively. Keywords are just displayed in blue. The first important construct, displayed in Listing 1 , is the record that captures the essence of Definition 1 , which relies on builtin types to represent vectors, lists and strings. Such a record uses the integerLessThanNat function, provided by the Data.Fin module, to express proofs of inequality between natural numbers. As such a function returns a boolean value rather than an actual proof, we resort to the dependent type So from the Data.So module, in order to turn a Bool value (known to be true) into an explicit proof object. Listing 1: Data type for computons. ⬇ record Computon where constructor MkComputon u : Nat p : Nat i : Nat o : Nat n : Nat s : Fin i -> Fin p t : Fin o -> Fin p sigma : Fin o -> Fin u tau : Fin i -> Fin u c : Fin p -> Fin n r : Fin i -> Fin o f : Fin o -> String inLabels : Vect u ( List ( Fin p , String )) pNotEmpty : So ( integerLessThanNat 0 p ) nNotEmpty : So ( integerLessThanNat 0 n ) As colimits may rename ports by introducing equalities, port identifiers can change upon composition. To avoid the inefficient process of backtracking over colimit-induced morphisms until finding original port identifiers, Listing 1 reveals that computons are equipped with the inLabels field which is updated with corresponding equalities, i.e., inLabels is used to keep track of port identifiers. Port identifiers are needed to tell computing devices where to read data from. Both trivial and primitive computons are specified on top of Listing 1 . That is, they correspond to the records shown in Listings 2 and 3 , which adhere to Definitions 4 and 5 , correspondingly. In particular, primitive computons require proofs of injectivity for which we use the Injective interface from the Control.Function module. For proofs of surjectivity, we provide the Surjective function shown in Listing 3 . Listing 2: Data type for trivial computons. ⬇ record Trivial where constructor MkTrivial obj : Computon { auto uEmpty : obj . u = 0} { auto iEmpty : obj . i = 0} { auto oEmpty : obj . o = 0} Listing 3: Data type for primitive computons. ⬇ record Primitive where constructor MkPrimitive obj : Computon sInjective : Injective obj . s tInjective : Injective obj . t sigmaSurjective : Surjective obj . sigma tauSurjective : Surjective obj . tau rSurjective : Surjective obj . r onlyInterfacePorts : obj . i + obj . o = obj . p { auto unity : obj . u = 1} Surjective : { a , b : Type } -> ( a -> b ) -> Type Surjective f = ( b : b ) -> ( a : a ** f a = b ) Listing 4: Data type for computon morphisms. ⬇ record Morphism ( comp1 , comp2 : Computon ) where constructor MkMorphism mu : Fin comp1 . u -> Fin comp2 . u mp : Fin comp1 . p -> Fin comp2 . p mi : Fin comp1 . i -> Fin comp2 . i mo : Fin comp1 . o -> Fin comp2 . o mn : Fin comp1 . n -> Fin comp2 . n mf : String -> String mfIncl : ( str : String ) -> mf str = str boundaryCond : Subset ( union ( vecI comp1 comp2 mu mp ) ( vecO comp1 comp2 mu mp )) ( union ( inports comp1 ) ( outports comp1 )) Subset : List a -> List a -> Type Subset [] ys = () Subset ( x :: xs ) ys = ( Elem x ys , Subset xs ys ) With Listing 1 , we specify a record to capture the notion of a computon morphism, as prescribed by Definition 6 . Listing 4 shows that this data type relies on Subset , a function we implemented to express proofs of finite set inclusion. This function relies on the builtin Elem type from the Data.List module. For specifying boundary conditions, we implemented the functions inports and outports which respectively construct the sets P^{+} and P^{-} of a computon \lambda . We also implemented vecI and vecO to compute the sets \vec{i}(\alpha) and \vec{o}(\alpha) from the U - and P -components of some computon morphism \alpha . Listing 5 shows that the notion of a monomorphism is also a record that is built on top of Listing 4 . This record requires proofs of injectivity for all the components of a computon morphism, excluding the morphism.mf field which already is injective as per the field morphism.mfIncl . Listing 5: Data type for computon monomorphisms. ⬇ record Monomorphism ( comp1 , comp2 : Computon ) where constructor MkMonomorphism morphism : Morphism comp1 comp2 muInj : Injective morphism . mu mpInj : Injective morphism . mp miInj : Injective morphism . mi moInj : Injective morphism . mo mnInj : Injective morphism . mn Marker morphisms are built upon the data type shown in Listing 5 since they have to be mono according to Definition 7 . Their notion is captured by the records displayed in Listing 6 which, in addition to the proofs of boundary equality, require a proof that the types of the domain computon (i.e., the trivial computon) is less or equal to the number of types in the codomain computon. For this purpose, we use the LTE type from the Data.Nat module. Listing 6: Data type for marker morphisms. ⬇ record InMarker ( comp1 : Trivial ) ( comp2 : Computon ) where constructor MkInMarker mono : Monomorphism comp1 . obj comp2 inportsPf : image ( mono . morphism . mp ) = inports comp2 nPf : LTE comp1 . obj . n comp2 . n record OutMarker ( comp1 : Trivial ) ( comp2 : Computon ) where constructor MkOutMarker mono : Monomorphism comp1 . obj comp2 outportsPf : image ( mono . morphism . mp ) = outports comp2 nPf : LTE comp1 . obj . n comp2 . n With the constructs shown in Listings 1 - 6 , we implemented factories that abstract away complex details to allow developers focus on composition tasks. Such factories, shown in Listing 7 , leverage Idris’s capabilities of proof search as well as the integerLessThanNat function to minimise the amount of explicit proofs that developers need to provide explicitly. The factories mkPrimitive , mkComputonMorphism , mkComputonMonomorphism , mkInMarker and mkOutMarker may fail since their implementation automatically decides some properties (e.g., the boundary conditions from Definition 6 ) in order to further minimise proof tasks for developers. Listing 7: Signatures of the factories provided by our implemented environment. ⬇ mkTrivial : { p , n : Nat } -> { auto pPf : So ( integerLessThanNat 0 p )} -> { auto nPf : So ( integerLessThanNat 0 n )} -> ( Fin p -> Fin n ) -> Trivial mkPrimitive : { p1 , i1 , o1 , n1 : Nat } -> { auto onlyInterfacePorts : i1 + o1 = p1 } -> { auto pPf : So ( integerLessThanNat 0 p1 )} -> { auto nPf : So ( integerLessThanNat 0 n1 )} -> ( s : Fin i1 -> Fin p1 ) -> ( t : Fin o1 -> Fin p1 ) -> ( sigma : Fin o1 -> Fin 1) -> ( tau : Fin i1 -> Fin 1) -> ( c : Fin p1 -> Fin n1 ) -> ( r : Fin i1 -> Fin o1 ) -> ( f : Fin o1 -> String ) -> Injective s -> Injective t -> Surjective sigma -> Surjective tau -> Surjective r -> Either String Primitive mkComputonMorphism : ( comp1 , comp2 : Computon ) -> ( mu : Fin comp1 . u -> Fin comp2 . u ) -> ( mp : Fin comp1 . p -> Fin comp2 . p ) -> ( mi : Fin comp1 . i -> Fin comp2 . i ) -> ( mo : Fin comp1 . o -> Fin comp2 . o ) -> ( mn : Fin comp1 . n -> Fin comp2 . n ) -> Maybe ( Morphism comp1 comp2 ) mkComputonMonomorphism : ( comp1 , comp2 : Computon ) -> ( mu : ( Fin comp1 . u -> Fin comp2 . u )) -> ( mp : ( Fin comp1 . p -> Fin comp2 . p )) -> ( mi : ( Fin comp1 . i -> Fin comp2 . i )) -> ( mo : ( Fin comp1 . o -> Fin comp2 . o )) -> ( mn : ( Fin comp1 . n -> Fin comp2 . n )) -> Injective mu -> Injective mp -> Injective mi -> Injective mo -> Injective mn -> Maybe ( Monomorphism comp1 comp2 ) mkInMarker : ( comp1 : Trivial ) -> ( comp2 : Computon ) -> ( mp : ( Fin comp1 . obj . p -> Fin comp2 . p )) -> ( mn : ( Fin comp1 . obj . n -> Fin comp2 . n )) -> Injective mp -> Injective mn -> image mp = inports comp2 -> Maybe ( InMarker comp1 comp2 ) mkOutMarker : ( comp1 : Trivial ) -> ( comp2 : Computon ) -> ( mp : ( Fin comp1 . obj . p -> Fin comp2 . p )) -> ( mn : ( Fin comp1 . obj . n -> Fin comp2 . n )) -> Injective mp -> Injective mn -> image mp = outports comp2 -> Maybe ( OutMarker comp1 comp2 ) To abstract away details related to the computation of colimits in the category of computons, we implemented the notions of span, coproduct and pushout in the form of the records shown in Listing 8 . These constructions form the basis for the implementation of Idris functions that enable the actual computation of pushouts, coproducts and the universal property of coproducts. Listing 8: Data types for colimit constructions in the category of computons. ⬇ record Span where constructor MkSpan apex : Computon base1 : Computon base2 : Computon leg1 : Morphism apex base1 leg2 : Morphism apex base2 record Coproduct ( u , p , i , o , n : Nat ) where constructor MkCoproduct coapex : Computon cobase1 : Computon cobase2 : Computon coleg1 : Morphism cobase1 coapex coleg2 : Morphism cobase2 coapex uPf : u = coapex . u pPf : p = coapex . p iPf : i = coapex . i oPf : o = coapex . o nPf : n = coapex . n record Pushout where constructor MkPushout coapex : Computon cobase1 : Computon cobase2 : Computon coleg1 : Morphism cobase1 coapex coleg2 : Morphism cobase2 coapex Listing 8 particularly shows that Span has fields for the apex computon as well as the two computon bases and the two legs from the apex. Pushout is similar, with the difference that legs go from the cobases to the coapex. The Coproduct record requires arguments for the size of computation units, ports, inflows, outflows and types, in addition to the coapex, the two colegs and the two cobases. It also carries a proof that the arguments are definitionally equal to the corresponding components of the coapex. These proofs are necessary for computing unique morphisms derived from the universal property of coproducts for which we provide the uniqueFromCoproduct function displayed in Listing 9 . Listing 9 shows the signatures of the functions to compute coproducts and pushouts in the category of computons. Particularly, computeCoproduct relies on the function maximum , provided by the Data.Nat module, for determining the cardinality of the set of types of a coproduct object, whereas computePushout just requires a span for its operation. Listing 9: Signatures of the Idris functions to compute coproducts, the universal property of coproducts and pushouts in the category of computons. ⬇ computeCoproduct : ( comp1 , comp2 : Computon ) -> Coproduct ( comp1 . u + comp2 . u ) ( comp1 . p + comp2 . p ) ( comp1 . i + comp2 . i ) ( comp1 . o + comp2 . o ) ( maximum comp1 . n comp2 . n ) uniqueFromCoproduct : ( comp1 , comp2 , comp3 : Computon ) -> Coproduct ( comp1 . u + comp2 . u ) ( comp1 . p + comp2 . p ) ( comp1 . i + comp2 . i ) ( comp1 . o + comp2 . o ) ( maximum comp1 . n comp2 . n ) -> Morphism comp1 comp3 -> Morphism comp2 comp3 -> LTE ( maximum comp1 . n comp2 . n ) comp3 . n -> Morphism copr . coapex comp3 computePushout : Span -> Pushout To finalise this section, Listing 10 shows the signatures of the Idris functions that capture the behaviour of the elementary composition operators described in Section 3 , namely partial or total sequencing ( SEQ ), asynchronous parallelising ( P_ASYNC ), closed branching ( BRA_CLOSED ) and open branching ( BRA_OPEN ). The synchronous parallelising operator was not explicitly implemented since this can be built out of P_ASYNC and SEQ (as discussed in Section 3.2 ), i.e., it is not elementary. A glance at Listing 10 shows that BRA_CLOSED requires a proof that the operands are connected in the sense of Definition 3 . For this, we provide the function isConnected which algorithmically returns a boolean value whenever such a property is satisfied. Connectivity is raised to the level of proof types by the use of the So data type. Listing 10: Signatures of the colimit-based, control-driven composition operators described in Section 3 . ⬇ SEQ : ( comp0 : Trivial ) -> ( comp1 , comp2 : Computon ) -> ( alpha1 : Monomorphism comp0 . obj comp1 ) -> ( alpha2 : Monomorphism comp0 . obj comp2 ) -> Subset ( image alpha1 . morphism . mp ) ( outports comp1 ) -> Subset ( image alpha2 . morphism . mp ) ( inports comp2 ) -> Computon P_ASYNC : Computon -> Computon -> Computon BRA_CLOSED : ( comp0 , comp1 : Trivial ) -> ( comp2 , comp3 : Computon ) -> InMarker comp0 comp2 -> InMarker comp0 comp3 -> OutMarker comp1 comp2 -> OutMarker comp1 comp3 -> So ( isConnected comp2 ) -> So ( isConnected comp3 ) -> Computon BRA_OPEN : ( comp0 : Trivial ) -> ( comp1 , comp2 : Computon ) -> InMarker comp0 comp1 -> InMarker comp0 comp2 -> Computon