Architectures in parametric component-based systems: Qualitative and quantitative modelling

One of the key aspects in component-based design is specifying the software architecture that characterizes the topology and the permissible interactions of the components of a system. To achieve well-founded design there is need to address both the qualitative and non-functional aspects of architectures. In this paper we study the qualitative and quantitative formal modelling of architectures applied on parametric component-based systems, that consist of an unknown number of instances of each component. Specifically, we introduce an extended propositional interaction logic and investigate its first-order level which serves as a formal language for the interactions of parametric systems. Our logics achieve to encode the execution order of interactions, which is a main feature in several important architectures, as well as to model recursive interactions. Moreover, we prove the decidability of equivalence, satisfiability, and validity of first-order extended interaction logic formulas, and provide several examples of formulas describing well-known architectures. We show the robustness of our theory by effectively extending our results for parametric weighted architectures. For this, we study the weighted counterparts of our logics over a commutative semiring, and we apply them for modelling the quantitative aspects of concrete architectures. Finally, we prove that the equivalence problem of weighted first-order extended interaction logic formulas is decidable in a large class of semirings, namely the class (of subsemirings) of skew fields.


Introduction
Well-founded design is a key principle for complex systems in order to guarantee correctness and performance. Rigorous formalisms in systems engineering are mainly componentbased that allow reconfigurability and validation [BS08]. Component-based design lies in constructing multiple components which coordinate through their interfaces in order to generate the global model for a system [GS11]. In such a setting, one of the main issues in the modelling process is defining the communication patterns of systems. Coordination principles among components can be specified by means of architectures, which characterize the permissible interactions and their implementation order, as well as the underlying topology of the systems [MBBS16b,MG16]. Architectures have been proved important in the modelling of systems since they enforce design rules on the components, and hence ensure correctness by construction with respect to basic properties such as mutual exclusion [BHM19,BIS19a,KG06,MBBS16b].
The formal modelling of architectures is a well-known problem of component-based systems and has been investigated with versatile approaches. Some existing frameworks focus on modelling only the components' connections [MBBS16b,PR17], while other integrate the specification of components' behavior and communication in order to express requirements [BIS19a,MG16]. In some cases the proposed formal approaches are further supported by graphical languages for characterizing architectures or tools for the verification of componentbased systems and their architectures (cf. [KG06, KKW + 16, MBBS16a,MT00]). Although, there is several work on the qualitative modelling of architectures, this has not been the case for their quantitative aspects. In this paper we propose a formal approach for the characterization of architectures where components' communication is expressed without incorporating their behavior. Moreover, our framework addresses not only the qualitative but also the weighted setting for specifying architectures, which is the main novelty of our contribution. The consideration of the quantitative properties of architectures is crucial for the efficient design of component-based systems. Cross-cutting concerns involve timing constraints, available resources, energy consumption, probabilities, etc., for implementing the communication among the systems' components. Consequently, in order to model such optimization issues there is need to study architectures in the weighted setup [ADFL19, BF13,PR17].
The current paper introduces a generic framework for the qualitative and quantitative modelling of architectures applied to a wide class of large systems, and specifically to parametric systems. Parametric systems are component-based systems found in several applications including communication protocols, concurrent processes, and distributed algorithms [AD16, BJK + 16, DYBH12]. Parametric systems are constructed by a finite number of component types whose number of instances is unknown, i.e., is a parameter for the system. Hence, specifying the architecture of parametric systems is challenging since their components' number is not known in advance, affecting in turn the interactions that define their communication. On the other hand, efficient characterization of architectures is important in parametric systems' design for identifying decidable classes of their verification problem, that is undecidable in general if unbounded data is exchanged [AKR + 18, BJK + 16, EGLM16].
The formal characterization of parametric architectures proposed in this work is logicbased. In particular, we firstly introduce and investigate a first-order extended interaction logic, namely FOEIL, that models efficiently the qualitative characteristics of parametric architectures. In turn we consider its weighted counterpart, weighted FOEIL over a commutative semiring K, in order to address the corresponding non-functional aspects. In contrast to existing logics for modelling parametric architectures [BIS19a, BIS19b, KKW + 16, MBBS16b], our FOEIL achieves to encode the execution order of the interactions imposed by the corresponding architecture as well as to describe recursive interactions. Specifically, several parametric architectures found in applications, including Publish/Subscribe and Request/Response, impose restrictions on the order of the permissible interactions [Dai12,ZMJ12]. For instance, in a Publish/Subscribe architecture a subscriber cannot receive a message from a topic of its interest if beforehand a publisher has not transferred the message to the particular topic. On the other hand, distinct subscribers may express their interest to the same topic in any order. Our logic is proved sufficient enough to model such order restrictions. Moreover, we allow recursion in the components' interactions which in turn implies that we can characterize the subsequent implementation of an architecture during a parametric system's operation. Then, our weighted FOEIL maintains the qualitative attributes of FOEIL, and also models the quantitative properties of parametric architectures, such as the total cost of the interactions or the probability of the implementation of concrete interactions.
In our setting we model components with the standard formalism of labelled transitions systems (cf. [AP11,APR06,BS08]). Then, communication of components is performed by their associated set of labels, called ports. In turn, architectures are modelled by FOEIL formulas encoding the order and recursion of the respective allowed interactions, which are defined by nonempty sets of ports. The presented logic-based modelling framework of architectures does not require the knowledge of the actual transitions of the components since it is constructed on the corresponding set of ports of the given system. As a result our theory does not consider the components' behavior and can be applied to every component-based framework where the system's interface is described by a set of ports. For the weighted setup we associate each port with a weight that represents the 'cost' of its participation in an interaction. The weights of the ports range over a commutative semiring K and we formalize the quantitative aspects of parametric architectures by weighted FOEIL formulas over K. In particular, the contributions of the current paper are the following: (1) We introduce Extended Propositional Interaction Logic (EPIL for short) over a finite set of ports, which augments PIL from [MBBS16b] with three operators namely the concatenation operator * , the shuffle operator ¡, and the iteration operator + . In contrast to classical PIL, where the satisfaction relation is checked against interactions (nonempty sets of ports), the formulas of EPIL are interpreted over finite words whose letters are interactions over the given set of ports. Intuitively, the semantics of concatenation operator specifies consecutive interactions while the semantics of shuffle operator encodes interleaving, i.e., all possible orders for the execution of permissible interactions in the system. Moreover, the iteration operator serves for modelling recursive interactions in the architecture. We apply EPIL formulas for formalizing the architectures of component-based systems with ordered interactions, and specifically we present three examples with the architectures Blackboard [Cor91], Request/Response [Dai12], and Publish/Subscribe [EFGK03].
(2) We introduce the first-order level of EPIL, namely First-Order Extended Interaction Logic (FOEIL for short), as a modelling language for the architectures of parametric systems. The syntax of FOEIL is equipped with the syntax of EPIL, the common existential and universal quantifiers, and four new quantifiers, namely existential and universal concatenation and shuffle quantifiers. The new quantifiers achieve to encode the partial and whole participation of component instances in sequential and interleaved interactions of parametric architectures. For the semantics of FOEIL we consider triples consisting of a mapping defining the number of component instances in the parametric system, an assignment that attributes a unique identifier to the ports of each component instance, and a finite word of interactions.
(3) We show the expressiveness of FOEIL by providing several examples for architectures of parametric component-based systems. In particular we consider the architectures Blackboard, Request/Response and Publish/Subscribe which impose orders on the implementation of their interactions, as well as Master/Slave [MBBS16b], Star [MBBS16b], Repository [CGB + 10], and Pipes/Filters [GS93] whose interactions may be executed in arbitrary order.
(4) We study decidability results related with FOEIL. For this, we firstly state an effective translation of FOEIL formulas to finite automata. The best case run time of our translation algorithm is polynomial and the worst case is exponential. In turn, we obtain the decidability of equivalence and validity for FOEIL sentences in doubly exponential time, and the decidability of satisfiability for FOEIL sentences in exponential time.
(5) We introduce weighted Extended Propositional Interaction Logic (wEPIL for short) over a finite set of ports and a commutative semiring K for representing the weights. wEPIL extends weighted Propositional Interaction Logic (wPIL for short) from [PR17,PR20a] with three new weighted operators, namely the weighted concatenation operator , the weighted shuffle operator , and the weighted iteration operator ⊕ . Intuitively these operators allow to encode the weight of consecutive, interleaving, and recursive interactions in weighted component-based systems, respectively. We interpret wEPIL formulas as series defined over finite words and K. In turn, we study the first-order level of wEPIL, namely weighted First-Order Extended Interaction Logic (wFOEIL for short) over K for modelling parametric weighted architectures. wFOEIL is equipped with the corresponding operators and quantifiers of FOEIL in the weighted setup, and is interpreted against series over K.
(6) We provide examples which show that wEPIL and wFOEIL serve sufficiently for modelling the quantitative aspects of architectures with ordered and recursive interactions. Then, for different instantiations of the semiring K in our examples we derive alternative interpretations for the resulting cost of the allowed interactions, that corresponds to some quantitative characteristic. Similarly to the unweighted setting, we show that we can also apply wFOEIL, and hence wEPIL, for expressing weighted architectures whose interactions may be executed in arbitrary order.
(7) Finally, we establish a translation of wFOEIL formulas to weighted automata. We show that the worst case run time for our translation algorithm is doubly exponential and the best case run time is exponential. Then, we prove the decidability of equivalence of wFOEIL sentences in doubly exponential time over a large class of semirings, namely (subsemirings of) skew fields. Therefore, the complexity remains the same with the one for the decidability of equivalence of FOEIL sentences, which depicts the robustness of our theory.
A preliminary version of this paper appeared in [PR20b]. The present version extends the work of [PR20b] as follows: -We equip EPIL and FOEIL with the iteration operator + , and hence we model the repetition of the interactions in parametric architectures. Therefore, the overall results in the paper have been modified accordingly to incorporate recursion.
-We present extensive descriptions for the examples considered in [PR20b] and we provide several new examples of architectures modelled by FOEIL sentences. Moreover, we present the detailed proofs for the decidability results of FOEIL.
-We introduce a whole new section that actually comprises half of the current contribution, and addresses the quantitative formal modelling of parametric architectures. In particular, we provide the weighted counterparts of EPIL and FOEIL, we apply them on concrete weighted architectures, and we investigate the corresponding decidability results.
The structure of the paper is as follows. In Section 2 we discuss related work and in Section 3 we recall the basic notions for component-based systems and interactions. Then, in Section 4 we introduce the syntax and semantics of EPIL and present examples of architectures defined by EPIL formulas. In Section 5 we introduce the syntax and semantics of our FOEIL and provide examples of FOEIL sentences describing concrete parametric architectures. Section 6 deals with the decidability results for FOEIL sentences. Then, investigated µHML, i.e., HML with recursive formulas expressing least and greatest fixpoints and focused on a fragment of that logic which can be monitored for runtime verification of programs' execution. That logic succeeded to describe simple client/server type processes but it is far from describing complex architectures. Specifically our shuffle operator cannot be described by means of µHML.
Coordination of distributed systems was also investigated in [GT19] (cf. also [TG18]). Specifically, the authors developed a theoretical framework and a prototype for studying the realizability problem of coordination in terms of pomsets. In that setting the repetition and order of input and output components' actions were considered. Though, due to the imposed orders of pomsets, our shuffle operator cannot be sufficiently described in this framework.
For instance, the subfomula ϕ 1 ¡ϕ 2 of the EPIL formula ϕ describing the Publish/Subscribe architecture (cf. Example 4.8) cannot be described by means of pomsets.
Alternative modelling frameworks for the communication patterns of software components include session types and behavioral contracts (cf. [Hea16]). In [DYBH12] the authors introduced a type theory for multiparty sessions to globally specify parametric communication protocols whose interactions carry data and their topology is specified by the Ring, Star, or Grid architectures. The authors showed that their type-checking algorithm ensured type-safety and deadlock-freedom of parameterised multiparty communication protocols. Moreover, in [CDA16] the authors introduced a novel session type system and a language to describe multi-actor communication in parameterized protocols. The proposed type theory included operators for describing exclusive, sequential, concurrent events as well as their arbitrary reorderings using a shuffling operator. Then the authors applied their type system for static verification of asynchronous communication protocols. In contrast to our setting, the parametric framework of [DYBH12] did not address the sequential and interleaving interactions of processes, while the work of [CDA16] did not consider the modelling problem of architectures in parameterized systems.
Although there has been an abundance of work for parametric systems in the qualitative setting this has not been the case for the quantitative one. Some work for quantitative parametric systems was considered in [ADFL19, BF13, EGLM16, Fou15, KP20, PR17,PR20a]. Specifically, in [EGLM16] the authors studied the model checking problem of population protocols against linear-time specifications. Population protocols form a specific class of parametric systems, in which a set of identical and anonymous finite-state processes interact pairwise through rendezvous synchronization. The authors obtained a decidability result for the qualitative problem i.e., deciding if a linear temporal logic formula holds with probability 1, while undecidability was proved for the quantitative problem that is deciding if the property holds with at least a given probability. Although the work of [EGLM16] studied the quantitative model checking problem in the parameterized setting, it did not actually modelled the quantitative aspects of parametric communication that we address in our framework. Moreover, in contrast to our approach the systems' architecture was not considered in the design process of [EGLM16]. As result, the order restrictions and recursion in parametric communication was not addressed in the modelling of the protocols' topologies.
In [BF13,Fou15] the authors considered broadcast communication and clique's topology for networks of many identical probabilistic timed processes, where the number of processes was a parameter. Then, they investigated the decidability results of several qualitative parameterized verification problems for probabilistic timed protocols. In the subsequent work of [ADFL19] the authors extended broadcast protocols and parametric timed automata and introduced a model of parametric timed broadcast protocols with two different types of parameters, namely the number of identical processes and the timing features. Parametric communication in [ADFL19] was defined by clique's semantics where every message reached every process, and by reconfigurable semantics where the set of receivers was chosen nondeterministically. Then the decidability of reachability problems were studied for parametric timed broadcast protocols in [ADFL19]. The main difference of our contribution and the work of [ADFL19, BF13,Fou15] is that we introduce a logic-based approach for the quantitative modelling of arbitrary parametric architectures. Also, the topologies of the protocols studied in the aforementioned work did not consider recursion. Moreover, we investigate the modelling problem of more complicated parametric architectures such as Publish/Subscribe or Request/Response. On the other hand, the authors of [ADFL19, BF13,Fou15] obtained several nice verification results for concrete parameterized protocols. Applying our framework for the study of parametric verification is left as a future work direction.
Finally, according to our best knowledge the only weighted logic-based approach for the modelling of architectures is found in the recent work of [KP20,PR17,PR20a]. Specifically, in [PR17,PR20a] the authors studied PCL in the weighted setup for modelling the quantitative aspects of architectures. The formulas of the resulting logic, namely weighted PCL (wPCL for short), were interpreted as polynomials with values over a commutative semiring. Soundness was proved for that logic and the authors obtained the decidability for the equivalence problem of its formulas. In [KP20] the authors extended the work of [PR17,PR20a] and studied weighted PCL over a product valuation monoid. That algebraic structure allowed to compute the average cost as well as the maximum cost among all costs occurring most frequently for executing the interactions within architectures. The authors applied that logic to model several weighted software architectures and proved that the equivalence problem of its formulas is decidable. In contrast to our setting, the work of [KP20, PR17, PR20a] described architectures without addressing ordered or recursive interactions. Parametric weighted architectures were considered only in [PR17] using the weighted first-order level of weighted PCL, namely weighted FOCL. Nevertheless, weighted FOCL considered no execution order of the interactions of parametric weighted architectures.

Preliminaries
3.1. Notations. For every natural number n ≥ 1 we denote by [n] the set {1, . . . , n}. Hence, in the sequel, whenever we use the notation [n] we always assume that n ≥ 1. For every set S we denote by P(S) the powerset of S. Let A be an alphabet, i.e., a finite nonempty set. As usual we denote by A * the set of all finite words over A and we let A + = A * \ {ε} where ε denotes the empty word. For every word w ∈ A * we let |w| denote the length of w, i.e., the number of letters comprising w. Given two words w, u ∈ A * , the shuffle product w ¡ u of w and u is a language over A defined by w ¡ u = {w 1 u 1 . . . w m u m | w 1 , . . . , w m , u 1 , . . . , u m ∈ A * and w = w 1 . . . w m , u = u 1 . . . u m }.
Let L 1 , L 2 , L ⊆ A * be languages over A. Then, the Cauchy product L 1 * L 2 of L 1 and L 2 , the shuffle product L 1 ¡ L 2 of L 1 and L 2 , and the iteration L + of L are defined respectively, by: -L 1 * L 2 = {w 1 w 2 | w 1 ∈ L 1 , w 2 ∈ L 2 }, -L + = ν≥1 L ν , where L 1 = L, L ν+1 = L ν * L, and ν is a natural number. Shuffle operation has been widely studied in formal languages and in concurrency theory in order to model parallel composition semantics of concurrent processes [AI07,Res15]. According to the algebraic definition, the shuffle operator returns the set of all possible interleavings of the corresponding objects. Similarly to the work of [CDA16,Hea16], the motivation to introduce a shuffle type of operator and quantifier in our logics lies in encoding any possible order (interleaving) of sequences of interactions within architectures. The study of parametric systems with concurrent semantics is not considered here, though it could be investigated in future work.
3.2. Semirings. A semiring (K, +, ·, 0, 1) consists of a set K, two binary operations + and · and two constant elements 0 and 1 such that (K, +, 0) is a commutative monoid, (K, ·, 1) is a monoid, multiplication · distributes over addition +, and 0 · k = k · 0 = 0 for every k ∈ K. If the monoid (K, ·, 1) is commutative, then the semiring is called commutative. The semiring is denoted simply by K if the operations and the constant elements are understood. The result of the empty product as usual equals to 1. If no confusion arises, we denote sometimes in the sequel the multiplication operation · just by juxtaposition. The following algebraic structures are well-known commutative semirings.
A formal series (or simply series) over A * and K is a mapping s : A * → K. The support of s is the set supp(s) = {w ∈ A * | s(w) = 0}. A series with finite support is called a polynomial. The constant series k (k ∈ K) is defined, for every w ∈ A * , by k(w) = k. We denote by K A * the class of all series over A * and K, and by K A * the class of all polynomials over A * and K. Let s, r ∈ K A * and k ∈ K. The sum s ⊕ r, the products with scalars ks and sk, and the Hadamard product s ⊗ r are series in K A * and are defined elementwise, respectively by s ⊕ r(w) = s(w) + r(w), (ks)(w) = k · s(w), (sk)(w) = s(w) · k, s ⊗ r(w) = s(w) · r(w) for every w ∈ A * . It is a folklore result that the structure K A * , ⊕, ⊗, 0, 1 is a semiring. Moreover, if K is commutative, then K A * ⊕, ⊗, 0, 1 is also commutative. The Cauchy product s r ∈ K A * is determined by s r(w) = w=w 1 w 2 s(w 1 )r(w 2 ) for every w ∈ A * , whereas the shuffle product 26:10

M. Pittou and G. Rahonis
Vol. 17:4 s r ∈ K A * is defined by s r(w) = w∈w 1 ¡w 2 s(w 1 )r(w 2 ) for every w ∈ A * . The ν-th iteration s ν ∈ K A * (ν ≥ 1) is defined inductively by s 1 = s and s ν+1 = s ν s, for every natural number ν ≥ 1. A series s is called proper if s(ε) = 0. Then, the iteration s ⊕ of s is defined by s ⊕ = ν≥1 s ν . If s is proper, then for every w ∈ A + and ν > |w| we have Throughout the paper (K, +, ·, 0, 1) will denote a commutative semiring. Definition 3.1. An atomic component is an LTS B = (Q, P, q 0 , R) where Q is a finite set of states, P is a finite set of ports, q 0 is the initial state and R ⊆ Q × P × Q is the set of transitions.
For simplicity, we assume in the above definition, that every port p ∈ P occurs at most in one transition. Then, we use this condition in the weighted setup in Section 7 in order to associate a unique weight with each port.
In the sequel, we call an atomic component B a component, whenever we deal with several atomic components. For every set B = {B(i) | i ∈ [n]} of components, with B(i) = (Q(i), P (i), q 0 (i), R(i)), i ∈ [n], we consider in the paper, we assume that (Q(i) ∪ P (i)) ∩ (Q(i ) ∪ P (i )) = ∅ for every 1 ≤ i = i ≤ n.
We now recall PIL. Let P be a finite nonempty set of ports. We let I(P ) = P(P ) \ {∅} for the set of interactions over P and Γ(P ) = P(I(P )) \ {∅}. Then, the syntax of PIL formulas φ over P is given by the grammar We set ¬(¬φ) = φ for every PIL formula φ and false = ¬true. As usual the conjunction and the implication of two PIL formulas φ, φ over P are defined respectively, by φ ∧ φ := ¬(¬φ ∨ ¬φ ) and φ → φ := ¬φ ∨ φ . PIL formulas are interpreted over interactions in I(P ). More precisely, for every PIL formula φ and a ∈ I(P ) we define the satisfaction relation a |= PIL φ by induction on the structure of φ as follows: -a |= PIL true, Note that PIL differs from propositional logic, since it is interpreted over interactions, and thus the name "interaction" is assigned to it. Two PIL formulas φ, φ are called equivalent, and we denote it by φ ≡ φ , whenever a |= PIL φ iff a |= PIL φ for every a ∈ I(P ). A PIL formula φ is called a monomial over P if it is of the form p 1 ∧ . . . ∧ p l , where l ≥ 1 and p λ ∈ P or p λ = ¬p λ with p λ ∈ P , for every λ ∈ [l]. For every interaction a = {p 1 , . . . , p l } ∈ I(P ) we consider the monomial φ a = p 1 ∧ . . . ∧ p l . Then, it trivially holds a |= PIL φ a , and for every a, a ∈ I(P ) we get a = a iff φ a ≡ φ a . We can describe a set of interactions as a disjunction of PIL formulas. More precisely, let We can now define component-based systems. For this, let B = {B(i) | i ∈ [n]} be a set of components where B(i) = (Q(i), P (i), q 0 (i), R(i)), for i ∈ [n]. We denote with P B = i∈[n] P (i) the set comprising all ports of the elements of B. Then an interaction of B is an interaction a ∈ I(P B ) such that |a ∩ P (i)| ≤ 1, for every i ∈ [n]. We denote by I B the set of all interactions of B, i.e.,  The set γ of interactions of a component-based system (B, γ) specifies the topology with which the components are connected in the system, i.e., the architecture of the system. Due to discussion before Definition 3.2 we can replace the set of interactions γ by its corresponding PIL formula φ γ , i.e., in a logical directed notation. Expression of software architectures by logics has been considered in several work and gave nice results (cf. for instance [BIS19b, KKW + 16, MBBS16b]).

Extended propositional interaction logic
One of the most important characteristics of component-based systems is the architecture which specifies the coordination primitives of the connected components. Although PIL can describe nicely several architectures, it does not capture an important feature of more complicated ones: the specified order required for the execution of the interactions. Such architectures, with an increased interest in applications, are for instance the Request/Response and Publish/Subscribe. In [PR20b] we introduced a propositional logic that extends PIL by equipping it with two operators, namely the concatenation * and the shuffle operator ¡. With that logic we succeeded to represent architectures of component-based systems where the order of the interactions is involved. Specifically, the concatenation operator * modelled sequential interactions and the shuffle operator ¡ interactions executed with interleaving. Here, we further augment PIL with an iteration operator + that serves to 26:12

M. Pittou and G. Rahonis
Vol. 17:4 encode sequential (at least one) repetition of interactions. This in turn implies, that the resulting logic allows to describe the ongoing implementation of an architecture during the system's operation. Moreover, our propositional logic with its first-order level is proved to be a sufficient modelling language for the symbolic representation of architectures of parametric component-based systems.
Definition 4.1. Let P be a finite set of ports. The syntax of extended propositional interaction logic (EPIL for short) formulas ϕ over P is given by the grammar is a PIL formula over P , * is the concatenation operator, ¡ is the shuffle operator, and + is the iteration operator.
The binding strength, in decreasing order, of the operators in EPIL is the following: negation, iteration, shuffle, concatenation, conjunction, and disjunction. The reader should notice that we consider a restricted use of negation in the syntax of EPIL formulas. Specifically, negation is permitted in PIL formulas and EPIL formulas of type ζ. The latter will ensure exclusion of erroneous interactions in architectures. The restricted use of negation has no impact to description of models characterized by EPIL formulas since most of known architectures can be described by formulas in our EPIL. Furthermore, it contributes to a reasonable complexity of translation of first-order extended interaction logic formulas to finite automata. This in turn implies the decidability of equivalence, satisfiability, and validity of first-order extended interaction logic sentences (cf. Section 6).
For the satisfaction of EPIL formulas we consider finite words w over I(P ). Intuitively, a word w encodes each of the distinct interactions within a system as a letter. Moreover, the position of each letter in w depicts the order in which the corresponding interaction is executed in the system, in case there is an order restriction. For the semantics of EPIL formulas, we introduce the subsequent notation. For every EPIL formula ϕ over P and natural number ν ≥ 1 we define the EPIL formula ϕ ν by induction on ν as follows: Definition 4.2. Let ϕ be an EPIL formula over P and w ∈ I(P ) + . Then we define the satisfaction relation w |= ϕ by induction on the structure of ϕ as follows: -w |= ζ 1 * ζ 2 iff there exist w 1 , w 2 ∈ I(P ) + such that w = w 1 w 2 and w i |= ζ i for i = 1, 2, -w |= ζ 1 ¡ ζ 2 iff there exist w 1 , w 2 ∈ I(P ) + such that w ∈ w 1 ¡ w 2 and w i |= ζ i for -w |= ϕ 1 ∧ ϕ 2 iff w |= ϕ 1 and w |= ϕ 2 , -w |= ϕ 1 * ϕ 2 iff there exist w 1 , w 2 ∈ I(P ) + such that w = w 1 w 2 and w i |= ϕ i for i = 1, 2, -w |= ϕ 1 ¡ ϕ 2 iff there exist w 1 , w 2 ∈ I(P ) + such that w ∈ w 1 ¡ w 2 and w i |= ϕ i for i = 1, 2, The empty word is not included in the semantics of EPIL since in our framework we do not consider architectures with no interactions. If ϕ = φ is a PIL formula, then w |= φ implies that w is a letter in I(P ). Two EPIL formulas ϕ, ϕ are called equivalent, and we denote it by ϕ ≡ ϕ , whenever w |= ϕ iff w |= ϕ for every w ∈ I(P ) + .
It can be easily seen that the concatenation operator is not commutative. The proof of the next proposition is straightforward.
Proposition 4.3. Let ϕ, ϕ 1 , ϕ 2 , ϕ 3 be EPIL formulas over P . Then, Now, we define an updated version of component-based systems where in comparison to the one in Definition 3.2, we replace the set of interactions γ (equivalently its corresponding PIL formula φ γ representing them) by an EPIL formula.
} is a set of components and ϕ is an EPIL formula over P B .
We should note that the EPIL formula ϕ in the above definition is defined over P B . Nevertheless, we will be interested in words w of interactions in I B satisfying ϕ.
Observe that in this work we develop no theory about the computation of the semantics of component-based systems, a problem that will be studied in future work. Though it should be clear that we specify how we model the components of systems in order to formalize the corresponding architectures. 4.1. Examples of architectures described by EPIL formulas. Next we present three examples of component-based models whose architectures have ordered interactions encoded by EPIL formulas. Clearly, there exist several variations of the following architectures and their order restrictions, that EPIL formulas could also model sufficiently by applying relevant modifications. We need to define the following macro EPIL formula. Let P = {p 1 , . . . , p n } be a set of ports. Then, for p i 1 , . . . , p im ∈ P with m < n we let Example 4.5. (Blackboard) We consider a component-based system (B, ϕ) with the Blackboard architecture. Blackboard architecture is applied to multi-agent systems for solving problems with nondeterministic strategies that result from multiple partial solutions (cf. Chapter 2 in [BMR + 96], [Cor91]). Applications based on a Blackboard architecture, include planning and scheduling (cf. [SR14]) as well as artificial intelligence [Nii86]. Blackboard architecture involves three component types, one blackboard component, one controller component and the knowledge sources components [BMR + 96, Cor91,Nii86]. Blackboard is a global data store that presents the state of the problem to be solved. Knowledge sources, simply called sources, are expertised agents that provide partial solutions to the given problem. Knowledge sources are independent and do not know about the existence of other sources. If there is sufficient information for a source to provide its partial solution, then the source is triggered i.e., is keen to write on the blackboard. Since multiple sources are triggered and compete to provide their solutions, a controller component is used to resolve any conflicts. Controller accesses both the blackboard to inspect the available data and the sources to schedule them so that they execute their solutions on blackboard. For our example we consider three knowledge sources components. Therefore, we have , B(4), B(5) refer to blackboard, controller and the three sources components, respectively. The set of ports of each component is Figure 1 depicts an instantiation of the permissible interactions among the five components of our component-based system. Blackboard has two ports p d , p a to declare the state of the problem and add the new data as obtained by a knowledge source, respectively. Knowledge sources have three ports p nκ , p tκ , p wκ , for κ = 1, 2, 3, for being notified about the existing data on blackboard, the trigger of the source, and for writing the partial solution on blackboard, respectively. Controller has three ports, namely p r used to record blackboard data, p l for the log process of triggered sources, and p e for their execution on blackboard. Here we assume that all knowledge sources are triggered, i.e., that all available sources participate in the architecture. The permissible interactions in the architecture range over I B and are obtained as follows: • The sets {p d , p r } and {p d , p nκ }, for κ = 1, 2, 3, capture the interactions of blackboard with controller and the three sources, respectively, for presenting the state of the problem. The corresponding connections are shown in Figure 1 by the four black lines.
• The sets {p l , p tκ }, for κ = 1, 2, 3, refer to the log process of triggered sources in the controller. The orange lines in Figure 1 depict a possible scenario of such connections between the controller and each of the sources B(3) and B(5).
• Finally, the sets {p e , p wκ , p a }, for κ = 1, 2, 3, refer to the connection of the sources with blackboard through its controller for adding the new data. These interactions are shown with the green lines in Figure 1, for the case that sources B(3) and B(5) have been triggered. The EPIL formula ϕ describing the ordered and recursive interactions of Blackboard architecture is for i = 1, 2, 3. The first PIL subformula encodes the connection between blackboard and controller. The EPIL subformula between the two concatenation operators represents the connections of the three knowledge sources with blackboard in order to be informed for existing data. The last part of ϕ captures the connection of some of the three knowledge sources with controller and blackboard for the triggering and the writing process. The use of shuffle operator in ϕ serves for capturing any possible order, among the sources, for implementing the corresponding connections with controller and blackboard. On the other hand, the two concatenation operators in the first line of ϕ ensure respectively that the sources are informed after the controller for the data on blackboard and before the triggering and writing process. The use of the inner iteration operator allows the repetition of the triggering and writing process of some of the sources based on the blackboard's data at one concrete point. Moreover, the outer iteration operator describes the recursive permissible interactions in the architecture at several points. This implies that as new data are added on blackboard, then the controller and the sources are informed anew in each communication 'cycle' for these data, and then the sources decide whether they are able to write on blackboard or not. Therefore, combining the two iteration operators we achieve to describe the subsequent implementation of Blackboard architecture in the given component Sour. 3 B(5) Before our second example we show the expressive difference among EPIL and PCL formulas of [MBBS16b].
Remark 4.6. Consider the Blackboard architecture presented in the previous example. Then the corresponding PCL formula ρ (cf. [MBBS16b]) describing that architecture is

M. Pittou and G. Rahonis
Vol. 17:4 where + denotes the coalescing operator, denotes the union operator, and Then, the PCL formula ρ is interpreted over sets of interactions in P(I(P )) \ {∅} which trivially cannot express the required order for implementing the interactions. For instance the set of interactions p a } satisfies ρ but represents no order of the interactions' execution.
Note that the first-order logics studied in [BIS19a, BIS19b, KKW + 16] were built over PIL. Although PIL served as the basis for developing logics that encode parametric architectures (still without addressing ordering constraints), it is far from describing complex architectures like Blackboard, Request/Response, or Publish/Subscribe.
Example 4.7. (Request/Response) We consider a component-based system (B, ϕ) with the Request/Response architecture. These architectures are classical interaction patterns and widely used for web services [Dai12]. A Request/Response architecture refers to clients and services. In order for a service to be made available it should be enrolled in the service registry. The enrollment of a service in the registry allows service consumers, simply called clients, to search the existing services. Once services are signed up, then clients search the corresponding registry and take the address of the services. Each client that is interested in a service sends a request to the service and waits until the service will respond. No other client can be connected to the service until the response of the service to the client who sent the request will be completed. In [MBBS16b] the authors described this process by adding, for each service, a third component type called coordinator. Coordinator takes care that only one client is connected to a service until the process among them is completed.
The Request/Response architecture of our component-based system consists of four component types namely service registry, service, client, and coordinator ( Figure 2). For our example we consider seven components, and specifically, the service registry, two services with their associated coordinators, and two clients. Therefore, we have that B = {B(i) | i ∈ [7]} where B(1), . . . , B(7) refer to each of the aforementioned components, respectively. The set of ports of each component is Figure 2 depicts the permissible interactions among the service registry, service B(2) and the two clients components of our component-based system. The corresponding interactions for service B(3), which have been omitted for simplicity, are derived similarly. Service registry has three ports denoted by p e , p u , and p t used for connecting with the service for its enrollment, for authorizing the client to search for a service, and for transmitting the address (link) of the service to the client in order for the client to send then its request, respectively. Services have three ports p rκ , p gκ , p sκ , for κ = 1, 2, which establish the connection to the service registry for the signing up of the service, and the connection to a client (via coordinator) for getting a request and responding, respectively. Each client κ has five ports denoted by p lκ , p oκ , p nκ , p qκ and p cκ , for κ = 1, 2. The first two ports are used for connection with the service registry to look up the available services and for obtaining the address of the service. The latter three ports express the connection of the client to coordinator, to service (via coordinator) for sending the request, and to service (via coordinator) for collecting its response, respectively. Coordinators have three ports namely p mκ , p aκ , p dκ , for κ = 1, 2. The first port controls that only one client is connected to a service. The second one is used for acknowledging that the connected client sends a request, and the third one disconnects the client when the service responds to the request. The allowed interactions in the architecture range over I B and are obtained as follows: • The sets {p e , p rκ } refer the enrollment of the two services in registry, while the sets {p lκ , p u } and {p oκ , p t } express the interactions of the two clients with registry, for κ = 1, 2.
The corresponding connections are shown in Figure 2 with black and orange color for the services and clients, respectively.
• The sets {p nκ , p m λ }, {p qκ , p a λ , p g λ }, {p cκ , p d λ , p s λ } capture the interactions of each of the two clients with the two services through their coordinators, for κ, λ = 1, 2. The green lines in Figure 2 depict a possible case for these connections, and specifically between the two client components and service B(2) through its coordinator B(4).
Then, the EPIL formula ϕ describing the Request/Response architecture, with its permissible ordered and recursive interactions, is describe the interactions of the two clients with the service registry and encode the connections of each of the two clients with the two services through their coordinators.
The EPIL formula ϕ is interpreted as follows. The two subformulas at the left of the first two concatenation operators encode the interleaving connections of the two services and the two clients with registry, respectively. Then, each of the three subformulas connected with the big disjunctions express that either one of the two clients or both of them (one at each time) are connected with the first service only, the second service only, or both of the services, respectively. Observe that in these subformulas we make use of the concatenation operator for the connection of the two clients with the same service. This results from the fact that the architecture requires that a unique client should be connected with each service through 26:18

M. Pittou and G. Rahonis
Vol. 17:4 Service 1 B(2) its coordinator. On the other hand, there is no restriction for the connection of a client with multiple services, and hence we use the shuffle operator to connect the corresponding subformulas at the third and fourth line of the EPIL formula ϕ. Then, the first iteration operator in EPIL formula ϕ allows the repetition of the interactions of only first, only second, or both of clients with the first service through its coordinator. Analogously, the next four iteration operators encode the recursive interactions for some of the clients with the second service or with both of the services (applied consecutively) through their coordinators. Finally, the use of last iteration operator describes the repetition of the interactions for any of the aforementioned cases. Publish/Subscribe architecture involves three types of components, namely publishers, subscribers, and topics. Publishers advertise and transmit to topics the type of messages they are able to produce. Then, subscribers are connected with the topics they are interested in, and topics in turn transfer the messages from publishers to corresponding subscribers. Once a subscriber receives the message it has requested, then it is disconnected from the relevant topic. Publishers cannot check the existence of subscribers and vice-versa [EFGK03]. For our example we consider two publisher components, two topic components and three subscriber components. Hence, we have that B = {B(i) | i ∈ [7]} where B(1), . . . , B(7) refer to the aforementioned components, respectively. The set of ports of each component is P (5) = {p e 1 , p g 1 , p d 1 }, P (6) = {p e 2 , p g 2 , p d 2 }, and P (7) = {p e 3 , p g 3 , p d 3 }. Figure 3 depicts one of the possible instantiations for the interactions among the components of our system. The ports p aκ and p tκ , for κ = 1, 2, are used from the publishers for advertising and transferring their messages to topic components, respectively. Each of the two topics is notified from the publishers and receives their messages through ports p nκ and p rκ , for κ = 1, 2, respectively. Ports p cκ , p sκ and p fκ , for κ = 1, 2, are used from topic components for the connection with a subscriber, the sending of a message to a subscriber and for finalizing their connection (disconnection), respectively. Subscribers use the ports p eµ , p gµ , p dµ , for µ = 1, 2, 3, for connecting with the topic (express interest), getting a message from the topic, and disconnecting from the topic, respectively. The permissible interactions in the architecture range over I B which includes the following sets: • The sets {p aκ , p n λ } and {p tκ , p r λ } that refer to the connections of the two publishers with each of the two topics for advertising and transferring their messages, for κ, λ = 1, 2. The black lines in Figure 3 depict a possible case for these interactions, and specifically between publisher B(1) with topic B(3) and publisher B(2) with both topics.
• The sets {p cκ , p eµ }, {p sκ , p gµ } and {p fκ , p dµ } that capture the interactions between topics and subscribers, for κ = 1, 2 and µ = 1, 2, 3. Figure 3 represents with orange lines a possible instantiation of these connections, and in particular for topic B(3) with subscribers B(5) and B(6) as well as for topic B(4) with subscriber B(7).
Then, the EPIL formula ϕ for the Publish/Subscribe architecture is and where we make use of the following auxiliary subformulas: encode that each of the two topics connects only with the first publisher B(1), or with the second publisher B(2) or with both of them, and -ξ 11 = #(p n 1 ∧ p a 1 ) * #(p r 1 ∧ p t 1 ) 26:20

M. Pittou and G. Rahonis
Vol. 17:4 describe the interactions of the two topics with each of the two publishers, and - . describe the connections of the two topics with each of the three subscribers. Each of ϕ 1 and ϕ 2 encode the interactions of first and second topic, respectively, with some of the publisher and subscriber components. The use of the shuffle operator in each of ϕ 1 and ϕ 2 expresses that the interactions among distinct subscribers may be executed with any order. Then, the EPIL formula ϕ captures the participation of only the first, or only the second, or both topics in the implementation of the architecture. Since there are no order restrictions for the interactions among multiple topics, the EPIL subformulas ϕ 1 and ϕ 2 are connected in ϕ with the shuffle operator. Finally, the use of the iteration operator in EPIL formula ϕ permits the repetition of the interactions of one or both of the topics with some of the available publishers and subscribers.
Subs. 3 B(7) The presented examples illustrate that EPIL formulas are expressive enough to encode the execution order of the permissible interactions as well as to specify the subsequent Hence, for every i ∈ [n] and j ≥ 1, the instance B(i, j) is also a component and we call it a parametric component or a component instance. We assume that and j, j ≥ 1. This restriction is needed in order to identify the distinct parametric components. It also permits us to use, without any confusion, the notation P (i, j) = {p(j) | p ∈ P (i)} for every i ∈ [n] and j ≥ 1. We set pB = {B(i, j) | i ∈ [n], j ≥ 1} and call it a set of parametric components. The set of ports of pB is given by P pB = i∈[n],j≥1 P (i, j).
Remark 5.1. Observe that in the parametric setting we use an index "i" in order to specify the type of a component. Specifically, we let B(i, j) denote the j-th instance of a component of type i, for i ∈ [n] and j ≥ 1. On the other hand, for simplicity we avoided such a notation for component-based systems in the non-parametric setting. In particular we presented a sequential enumeration of the several, finite in number, components of the same or different type by B(i), for i ∈ [n]. This explains why in the parametric setting we use the term "component type". For instance in the Request/Response architecture of Example 4.7, we denote by B(2), B(3) the two service components. On the other hand, in a parametric Request/Response architecture we would let B(2, 1) and B(2, 2) refer to two component instances of the service component type. For this, we arbitrarily choose i = 2 to denote the type of service, and in turn we let j = 1, 2 refer to the two instances of that type.
As it is already mentioned, in practical applications we do not know how many instances of each component type are connected at a concrete time. This means that we cannot define interactions of pB in the same way as we did for finite sets of components. Hence, we need a symbolic representation to describe interactions, and in turn architectures, of parametric systems. For this, we introduce the first-order extended interaction logic which is proved sufficient to describe a wide class of architectures of parametric component-based systems. Similarly to EPIL the semantics of our logic encodes the order and iteration of the interactions implemented within a parametric architecture. Formalization of such aspects is important for constructing well-defined architectures, and hence parametric systems which are less error prone and satisfy most of their requirements [AKR + 18, BJK + 16, DYBH12].

M. Pittou and G. Rahonis
Vol. 17:4 5.1. First-order extended interaction logic. In this subsection we introduce the firstorder extended interaction logic as a modelling language for describing the interactions of parametric component-based systems. For this, we need to equip EPIL formulas with variables. Due to the nature of parametric systems we need to distinguish variables referring to different component types. Let pB = {B(i, j) | i ∈ [n], j ≥ 1} be a set of parametric components. We consider pairwise disjoint countable sets of first-order variables X (1) , . . . , X (n) referring to instances of component types B(1), . . . , B(n), respectively. First-order variables in X (i) , for every i ∈ [n], will be denoted by small letters with the corresponding superscript. Hence by , is a first-order variable referring to an instance of component type B(i). We let X = X (1) ∪ . . . ∪ X (n) and set P pB(X ) = p x (i) | i ∈ [n], x (i) ∈ X (i) , and p ∈ P (i) .
, j ≥ 1} be a set of parametric components. Then the syntax of first-order extended interaction logic (FOEIL for short) formulas ψ over pB 1 is given by the grammar where ϕ is an EPIL formula over P pB(X ) , i ∈ [n], x (i) , y (i) are first-order variables in X (i) , ∃ * denotes the existential concatenation quantifier, ∀ * the universal concatenation quantifier, ∃ ¡ is the existential shuffle quantifier, and ∀ ¡ is the universal shuffle quantifier. Furthermore, we assume that whenever ψ contains a subformula of the form ∃ * x (i) .ψ or ∃ ¡ x (i) .ψ , then the application of negation in ψ is permitted only in PIL formulas and formulas of the form x (j) = y (j) .
Let ψ be a FOEIL formula over pB. As usual, we denote by free(ψ) the set of free variables of ψ. If ψ has no free variables, then it is a sentence. We consider a mapping r : [n] → N. The value r(i), for every i ∈ [n], intends to represent the finite number of instances of the component type B(i) in the parametric system, affecting in turn, the corresponding interactions. Hence, for different mappings we obtain a different parametric system. We let pB(r) = {B(i, j) | i ∈ [n], j ∈ [r(i)]} and call it the instantiation of pB w.r.t. r. We denote by P pB(r) the set of all ports of components' instances in pB(r), i.e., P pB(r) = i∈[n],j∈[r(i)] P (i, j). The set I pB(r) of interactions of pB(r) is given by I pB(r) = {a ∈ I(P pB(r) ) | |a ∩ P (i, j)| ≤ 1 for every i ∈ [n] and j ∈ [r(i)]}.
Let V ⊆ X be a finite set of first-order variables. We let P pB(V) = {p(x (i) ) ∈ P pB(X ) | x (i) ∈ V}. To interpret FOEIL formulas over pB we use the notion of an assignment defined with respect to the set of variables V and the mapping r. Formally, a (V, r)-assignment is a mapping σ : V → N such that σ(V ∩X (i) ) ⊆ [r(i)] for every i ∈ [n]. If σ is a (V, r)-assignment, then σ[x (i) → j] is the (V ∪ {x (i) }, r)-assignment which acts as σ on V \ {x (i) } and assigns j to x (i) . If ϕ is an EPIL formula over P pB(V) , then σ(ϕ) is an EPIL formula over P pB(r) which is obtained by ϕ by replacing every port p(x (i) ) in ϕ by p(σ(x (i) )). Intuitively, a (V, r)-assignment σ assigns unique identifiers to each instance in a parametric system, w.r.t. the mapping r.
1 According to our terminology for EPIL formulas, a FOEIL formula should be defined over the set of ports of pB. Nevertheless, we prefer for simplicity to refer to the set pB of parametric components. We interpret FOEIL formulas over triples consisting of a mapping r : [n] → N, a (V, r)-assignment σ, and a word w ∈ I + pB(r) . As for EPIL formulas, we define for every FOEIL formula ψ over pB and natural number ν ≥ 1, the FOEIL formula ψ ν over pB by induction on ν: ψ 1 = ψ and ψ ν+1 = ψ ν * ψ. The semantics of formulas of the form ∃ * x (i) .ψ and ∀ * x (i) .ψ (resp. ∃ ¡ x (i) .ψ and ∀ ¡ x (i) .ψ) refer to satisfaction of ψ by subwords of w. The subwords correspond to component instances which are determined by the application of the assignment σ to x (i) , and w results by the * (resp. ¡) operator among the subwords.
For simplicity sometimes we denote boolean combinations of formulas of the form Note that in [MBBS16b] the authors considered a universe of component types and hence, excluded in their logic formulas the erroneous types for each architecture. Such a restriction is not needed in our setting since we consider a well-defined set [n] of component types for each architecture. Now we are ready to formally define the concept of a parametric component-based system.
, j ≥ 1} is a set of parametric components and ψ is a FOEIL sentence over pB.
In the sequel, for simplicity we refer to parametric component-based systems as parametric systems. We remind that in this work we focus on the architectures of parametric systems. The study of parametric systems' semantics is left for investigation in future work as a part of parametric verification.
For our examples in the next subsection, we shall need the following macro FOEIL formula. Let pB = {B(i, j) | i ∈ [n], j ≥ 1} and 1 ≤ i 1 , . . . , i m ≤ n be pairwise different indices. Then we set In what follows we often refer to a component instance simply by instance. Moreover, whenever is defined a unique instance for a component type we may also consider the corresponding set of variables as a singleton. Example 5.5. (Parametric Master/Slave) We present a FOEIL sentence for the parametric Master/Slave architecture. Master/Slave architecture concerns two types of components, namely masters and slaves [MBBS16b]. We denote by p m the unique port of master component and by p s the unique port of slave component. Every slave must be connected with exactly one master. Interactions among masters (resp. slaves) are not permitted. An instantiation of the architecture for two masters and two slaves with all the possible cases of the allowed interactions is shown in Figure 4. We let X (1) , X (2) denote the sets of variables of master and slave component instances, respectively. Then, the FOEIL sentence ψ representing parametric Master/Slave architecture is ψ = ∀ * x (2) ∃x (1) .#(p m (x (1) ) ∧ p s (x (2) )). In the above sentence, the universal concatenation quantifier accompanied with the existential one encodes that every slave instance should be connected with a master instance through their corresponding ports, and the distinct slave instances may apply these interactions consecutively.
Example 5.6. (Parametric Star) Star architecture has only one component type with a unique port namely p. One instance is considered as the center in the sense that every other instance has to be connected with it. No other interaction is permitted. Figure 5 represents the Star architecture for five instances. The FOEIL sentence ψ for parametric Star architecture is as follows: ).#(p(x (1) ) ∧ p(y (1) )). The universal concatenation quantifier preceded by the existential quantifier in ψ encodes that each of the instances in the architecture should be connected with the center instance consecutively.
Example 5.7. (Parametric Pipes/Filters) Pipes/Filters architecture involves two types of components, namely pipes and filters [GS93]. Pipe (resp. filter) component has an entry port p e and an output port p o (resp. f e , f o ). Every filter F is connected to two separate pipes P and P via interactions {f e , p o } and {f o , p e }, respectively. Every pipe P can be connected to at most one filter F via an interaction {p o , f e }. Any other interaction is not permitted. An instantiation of the architecture for four pipe and three filter components is shown in Figure 6. We denote by X (1) and X (2) the sets of variables corresponding to pipe and filter component instances, respectively. The subsequent FOEIL sentence ψ describes the parametric Pipes/Filters architecture.
In the above sentence, the universal concatenation quantifier (∀ * x (2) ) in conjunction with the two existential ones (∃x (1) , ∃y (1) ) describe that every filter instance is connected with two distinct pipe instances, and these interactions are implemented consecutively. The arguments of # express the connection of a filter entry (resp. output) port with a pipe output (resp. entry) port excluding by definition erroneous port connections. Then, the subformula after the big conjunction ensures that no more than one filter entry port will be connected to the same pipe output port.    Figure 7 shows an instantiation of the architecture with four data accessors. Figure 7: Repository architecture.
The subsequent FOEIL sentence ψ characterizes the parametric Repository architecture.
Variable set X (1) refers to instances of repository component and variable set X (2) to instances of data accessor component. Then, the use of the universal concatenation operator combined with the existential one serves to encode that each of the data accessor instances interact with the repository instance in consecutive order.
Observe that in Examples 5.5-5.8 we use the concatenation quantifier to describe the execution of the interactions for the several component instances. On the other hand, the shuffle quantifier would not provide the encoding of any different implementation of the corresponding architectures. This is because the above parametric architectures do not impose order restrictions on the execution of the permissible interactions. For this reason, we also omit the application of the iteration operator in these examples. Hence, FOEIL can describe sufficiently parametric architectures with no order restrictions in the allowed interactions. Next, we provide three more examples of parametric architectures, namely Blackboard, Request/Response, and Publish/Subscribe, where the order of interactions constitutes a main feature.
Example 5.9. (Parametric Blackboard) The subsequent FOEIL sentence ψ encodes the interactions of Blackboard architecture, described in Example 4.5, in the parametric setting. We consider three sets of variables, namely X (1) , X (2) , X (3) for the instances of blackboard, controller, and knowledge sources components, respectively.
We interpret the above FOEIL sentence as follows: There exists a blackboard and a controller instance (∃x (1) , ∃x (2) ) so that the former informs the latter for the available data. In turn, Example 5.10. (Parametric Request/Response) Next we present a FOEIL sentence ψ for Request/Response architecture, described in Example 4.7, in the parametric setting. We consider the variable sets X (1) , X (2) , X (3) , and X (4) referring to instances of service registry, service, client, and coordinator component, respectively.
The first two lines of FOEIL sentence ψ express the connections of every service and client instance with the service registry instance, respectively. Moreover, the several instances of services as well as of clients interact with the registry instance in arbitrary order and for this, we use the universal shuffle quantifiers ∀ ¡ x (2) and ∀ ¡ x (3) , respectively. Then, the last line of ψ captures that for some of the service instances (∃ ¡ y (2) ) there exist some client instances (∃ * y (3) ) that are interested in the former, and hence are connected consecutively through the services' coordinator instance (∃x (4) ). Recall that only a unique client instance is allowed to interact with a service instance which justifies the use of the concatenation quantifier ∃ * y (3) . On the other hand, the interactions of the distinct service instances with the interested client instances are implemented with interleaving, since there are no order restrictions from the architecture, which is expressed by the shuffle quantifier ∃ ¡ y (2) . Then, the subformula ∀y (4) ∀z (3) ∀z (2) . θ ∨ ∀t (3) ∀t (2) (z (2) = t (2) ).θ in ψ serves as a constraint to ensure that a unique coordinator instance is assigned to each service instance. Finally, the application of the iteration operator allows the repetition of the permissible interactions in the parametric architecture. An instantiation of the parametric architecture for two clients and two services is discussed in Example 4.7 of Subsection 4.1. Example 5.11. (Parametric Publish/Subscribe) We consider Publish/Subscribe architecture, described in Example 4.8, in the parametric setting. In the subsequent FOEIL sentence ψ, we let variable sets X (1) , X (2) , X (3) correspond to publisher, topic, and subscriber component instances, respectively.
The FOEIL sentence ψ is interpreted as follows: The big parenthesis with the existential shuffle quantifier ∃ ¡ x (1) preceded by ∃ ¡ x (2) describes that given some topic instances, some of the publisher instances advertise and in turn transmit their messages to the former with interleaving. For the same topic instances, in turn, the parenthesis at the second line with the existential shuffle quantifier ∃ ¡ x (3) encodes the arbitrary order among some of the subscriber instances for executing three types of consecutive interactions, namely the connection with the interested subscriber instance, the transfer of the message and their disconnection. The communication steps described above are implemented for the distinct topic instances with interleaving (captured by the first existential shuffle quantifier ∃ ¡ x (2) ). Finally, the iteration operator is applied to the whole sentence in order to describe the recursion of the aforementioned interactions, and hence models the subsequent implementation of the architecture within the parametric system. Example 4.8 presented in Subsection 4.1 is an instantiation of the parametric Publish/Subscribe architecture for two publishers, two topics, and three subscribers.
In [MBBS16b] the authors described a simpler version of Request/Response and Blackboard architectures. Though the resulting sets of interactions do not depict the order in which they should be performed (cf. Remark 4.6). Publish/Subscribe architecture has not been considered in the related work [BIS19b, KKW + 16, MBBS16b]. A weighted version of Publish/Subscribe architecture was described by a weighted propositional configuration logic formula in [PR17]. Nevertheless, even if we consider that formula without weights, it is not possible to express the required order of the implementation of the interactions. Moreover, the versions of the parametric architectures studied in [BIS19b, KKW + 16, MBBS16b, PR17] do not allow recursive interactions. Our Examples 5.9, 5.10, and 5.11 show that for a parametric component-based system with any of the aforementioned architectures, the semantics of the corresponding FOEIL formula encodes the required order of recursive interactions.

Decidability results for FOEIL
In this section, we prove decidability results for FOEIL sentences. Specifically, we show that the equivalence and validity problems for FOEIL sentences are decidable in doubly exponential time, whereas the satisfiability problem is decidable in exponential time. For this, we establish an effective translation of every FOEIL formula to an expressive equivalent finite automaton, and hence we take advantage of well-known computational results for finite automata. For the reader's convenience we briefly recall basic notions and results on finite automata.

M. Pittou and G. Rahonis
Vol. 17:4 Let A be an alphabet. A (nondeterministic) finite automaton (NFA for short) over A is a five-tuple A = (Q, A, I, ∆, F ) where Q is the finite state set, I ⊆ Q is the set of initial states, ∆ ⊆ Q × A × Q is the set of transitions, and F is the final state set.
Let w = a 1 . . . a n ∈ A * . A path of A over w is a sequence of transitions ((q i−1 , a i , q i )) 1≤i≤n . The path is called successful if q 0 ∈ I and q n ∈ F . A word w ∈ A * is accepted (or recognized) by A if there a successful path of A over w. The language L(A) of A is the set of all words accepted by A.
The finite automaton A is called deterministic (DFA for short) (resp. complete) if I = {q 0 } and for every q ∈ Q and a ∈ A there is at most (resp. exactly) one state q ∈ Q such that (q, a, q ) ∈ ∆. In this case we write A = (Q, A, q 0 , ∆, F ). Two finite automata A and A over A are called equivalent if L(A) = L(A ). For our translation algorithm of FOEIL formulas to finite automata we shall need folklore results in automata theory. We collect them in the following proposition (cf. for instance [KN01,Sak09a,Sip13]). 2) Let A 1 = (Q 1 , A, I 1 , ∆ 1 , F 1 ) and A 2 = (Q 2 , A, I 2 , ∆ 2 , F 2 ) be two NFA's over A. Then, the intersection L(A 1 ) ∩ L(A 2 ) is accepted by the NFA A = (Q 1 × Q 2 , A, I 1 × I 2 , ∆, F 1 × F 2 ) where ∆ = {((q 1 , q 2 ), a, (q 1 , q 2 )) | (q 1 , a, q 1 ) ∈ ∆ 1 , (q 2 , a, q 2 ) ∈ ∆ 2 }. If A 1 and A 2 are DFA's, then A is also a DFA. The finite automaton A is called the product automaton of A 1 and A 2 . The union L(A 1 )∪L(A 2 ) is accepted by the NFA A = (Q 1 ∪Q 2 , A, I 1 ∪I 2 , ∆ 1 ∪∆ 2 , F 1 ∪F 2 ) where without loss of generality we assume that Q 1 ∩ Q 2 = ∅. The NFA A is called the disjoint union of A 1 and A 2 .
3) If A 1 , A 2 , and A are finite automata over A, then we can construct, from A 1 , A 2 , and A NFA's B, C, and D accepting respectively, the languages L(A 1 ) * L(A 2 ), L(A 1 ) ¡ L(A 2 ), and L(A) + . The run time for all the constructions is polynomial.

5)
Let A = (Q, A, q 0 , ∆, F ) be a DFA over A. Then, we can construct an equivalent complete finite automaton A = (Q∪{q}, A, q 0 , ∆ , F ) whereq is a new state and ∆ = ∆∪{(q, a,q) | there is no state q ∈ Q such that (q, a, q ) ∈ ∆} ∪ {(q, a,q) | a ∈ A}.  Next we present the translation algorithm of FOEIL sentences to finite automata. Our algorithm requires an exponential time at its worst case. Specifically, we state the following theorem.

6) Let
Theorem 6.2. Let ψ be a FOEIL sentence over a set pB = {B(i, j) | i ∈ [n], j ≥ 1} of parametric components and r : [n] → N. Then, we can effectively construct a finite automaton A ψ,r over I pB(r) such that (r, w) |= ψ iff w ∈ L(A ψ,r ) for every w ∈ I + pB(r) . The worst case run time for the translation algorithm is exponential and the best case is polynomial.
We shall prove Theorem 6.2 using the subsequent proposition. For this, we need the following notations. Let V ⊆ X be a finite set of variables. For every i ∈ [n] and x (i) ∈ V, we define the set P (i)(x (i) ) = {p(x (i) ) | p ∈ P (i) and x (i) ∈ V} and let I pB(V) = {a ∈ I(P pB(V) ) | |a ∩ P (i)(x (i) )| ≤ 1 for every i ∈ [n] and x (i) ∈ V}. Next let σ be a (V, r) assignment and L a language over I pB(V) . We shall denote by σ(L) the language over I(P pB(r) ) 2 which is obtained by L by replacing every variable x ∈ V by σ(x). Proposition 6.3. Let ψ be a FOEIL formula over a set pB = {B(i, j) | i ∈ [n], j ≥ 1} of parametric components. Let also V ⊆ X be a finite set of variables containing free(ψ) and r : [n] → N. Then, we can effectively construct a finite automaton A ψ,r over I pB(V) such that for every (V, r)-assignment σ and w ∈ I + pB(r) we have (r, σ, w) |= ψ iff w ∈ σ(L(A ψ,r ))∩I + pB(r) . The worst case run time for the translation algorithm is exponential and the best case is polynomial.
xi) If ψ = ∃x (i) .ψ , then we get A ψ,r as the disjoint union of the finite automata A ψ ,r is obtained by A ψ ,r by replacing x (i) by j in I pB(V) . xii) If ψ = ∀x (i) .ψ , then we get A ψ,r as the product automaton of the finite automata A ψ ,r , j ∈ [r(i)], is obtained by A ψ ,r by replacing x (i) by j in I pB(V) . By our constructions above, we immediately get that for every (V, r)-assignment σ and w ∈ I + pB(r) we have (r, σ, w) |= ψ iff w ∈ σ(L(A ψ,r )) ∩ I + pB(r) . Hence, it remains to deal with the time complexity of our translation algorithm.
Taking into account the above induction steps, we show that the worst case run time for our translation algorithm is exponential. Indeed, if ψ is a PIL formula, then the constructed finite automaton A ψ,r in steps (i)-(iii) is a DFA and its state-size is polynomial in the size of ψ. Specifically, if ψ = p(x (i) ), then the state-size of A ψ,r is the same as the size of ψ. If ψ = ¬ζ, then by step (vi) we need an exponential time since we construct firstly a complete finite automaton equivalent to the one corresponding to ζ. The cases (iv), (v), (vii)-(xii), (xiv), and (xvi) trivially require polynomial time constructions. Finally, the translations in Proof of Theorem 6.2. We apply Proposition 6.3. Since ψ is a sentence it contains no free variables. Hence, we get a finite automaton A ψ,r over I pB(r) such that (r, w) |= ψ iff w ∈ L(A ψ,r ) for every w ∈ I + pB(r) , and this concludes our proof.
We should note that several of the constructions described in the proof of Proposition 6.3 can be simplified according to the form of the FOEIL sentence ψ. For instance consider two ports p, p and the EPIL formula ϕ = #(p ∧ p ). Clearly ϕ is satisfied only by the interaction a = {p, p } which in turns implies that we get in a straightforward way a finite automaton for ϕ. We clarify this in the following example.
Now we are ready to state the decidability result of the equivalence of FOEIL sentences. Specifically, we prove the following theorem.
Theorem 6.5. Let pB = {B(i, j) | i ∈ [n], j ≥ 1} be a set of parametric components and r : [n] → N a mapping. Then, the equivalence problem for FOEIL sentences over pB w.r.t. r is decidable in doubly exponential time. Proof. Let ψ 1 , ψ 2 be FOEIL sentences over pB. Then, by Theorem 6.2 we construct, in exponential time, finite automata A ψ 1 ,r and A ψ 2 ,r such that (r, w) |= ψ i iff w ∈ L(A ψ i ,r ) for every w ∈ I + pB(r) and i = 1, 2. The finite automata A ψ 1 ,r and A ψ 2 ,r are in general nondeterministic, hence by Proposition 6.1(1) we construct complete finite automata A ψ 1 ,r and A ψ 2 ,r equivalent to A ψ 1 ,r and A ψ 2 ,r , respectively. In this construction another exponential blow up occurs. Finally, the decidability of equivalence of the complete finite automata A ψ 1 ,r and A ψ 2 ,r requires a linear time (cf. pages 143-145 in [AHU74]), and we are done.
Next, we deal with the decidability of satisfiability and validity results for FOEIL sentences. For this, we recall firstly these notions. More precisely, a FOEIL sentence ψ over pB is called satisfiable w.r.t. r whenever there exists a w ∈ I + pB(r) such that (r, w) |= ψ, and valid w.r.t. r whenever (r, w) |= ψ for every w ∈ I + pB(r) .
Theorem 6.6. Let pB = {B(i, j) | i ∈ [n], j ≥ 1} be a set of parametric components and r : [n] → N a mapping. Then, the satisfiability problem for FOEIL sentences over pB w.r.t. r is decidable in exponential time.
Proof. Let ψ be a FOEIL sentence over pB. By Theorem 6.2 we construct, in exponential time, an NFA A ψ,r such that (r, w) |= ψ iff w ∈ L(A ψ,r ) for every w ∈ I + pB(r) . Then, ψ is satisfiable iff L(A ψ,r ) = ∅ which is decidable in linear time (Proposition 6.1(7)), and this concludes our proof.
Theorem 6.7. Let pB = {B(i, j) | i ∈ [n], j ≥ 1} be a set of parametric components and r : [n] → N a mapping. Then, the validity problem for FOEIL sentences over pB w.r.t. r is decidable in doubly exponential time.
Proof. Let ψ be a FOEIL sentence over pB. By Theorem 6.2 we construct, in exponential time, an NFA A ψ,r such that (r, w) |= ψ iff w ∈ L(A ψ,r ) for every w ∈ I + pB(r) . Then, ψ is valid iff L(A ψ,r ) = I + pB(r) which is decidable in exponential time (Proposition 6.1(8)). Hence, we can decide whether ψ is valid or not in doubly exponential time. Definition 7.1. Let P be a finite set of ports. Then the syntax of weighted EPIL (wEPIL for short) formulas over P and K is given by the grammar ϕ ::= k | ϕ |φ ⊕φ |φ ⊗φ |φ φ |φ φ |φ ⊕ where k ∈ K, ϕ is an EPIL formula over P , and ⊕, ⊗, , , and ⊕ are the weighted disjunction, conjunction, concatenation, shuffle, and iteration operator, respectively. Ifφ is composed by elements in K and PIL formulas connected with ⊕ and ⊗ operators only, then it is called also a weighted PIL (wPIL for short) formula over P and K [PR17,PR20a] and it will be denoted also byφ. The binding strength, in decreasing order, of the operators in wEPIL is the following: weighted iteration, weighted shuffle, weighted concatenation, weighted conjunction, and weighted disjunction.
For the semantics of wEPIL formulas we consider finite words w over I(P ) and interpret wEPIL formulas as series in K I(P ) + .
Definition 7.2. Letφ be a wEPIL formula over P and K. Then the semantics ofφ is a series φ ∈ K I(P ) + . For every w ∈ I(P ) + the value φ (w) is defined inductively on the structure ofφ as follows: By definition, the series φ is proper for every wEPIL formulaφ over P and K. Two wEPIL formulasφ 1 ,φ 2 over P and K are called equivalent and we writeφ 1 ≡φ 2 if φ 1 = φ 2 . Next we define weighted component-based systems. For this, we introduce the notion of a weighted atomic component. Since every port in P occurs in at most one transition in R, we consider, in the sequel, wt as a mapping wt : P → K. If a port p ∈ P occurs in no transition, then we set wt(p) = 0. We call a weighted atomic component wB over K a weighted component, whenever we deal with several weighted atomic components and the semiring K is understood. Let wB = {wB(i) | i ∈ [n]} be a set of weighted components where wB(i) = (B(i), wt(i)) with B(i) = (Q(i), P (i), q 0 (i), R(i)) for every i ∈ [n]. The set of ports and the set of interactions of wB are the sets P B and I B respectively, of the underlying set of components B = {B(i) | i ∈ [n]}. Let a = {p j 1 , . . . , p jm } be an interaction in I B such that p j l ∈ P (j l ) for every l ∈ [m]. Then, the weighted monomialφ a of a is given by the wPIL formulã where the first equivalence holds since K is commutative and the second one since p⊗p ≡ p∧p for every p, p ∈ P B .

M. Pittou and G. Rahonis
Vol. 17:4 Definition 7.4. A weighted component-based system (over K) is a pair (wB,φ) where wB = {wB(i) | i ∈ [n]} is a set of weighted components andφ is a wEPIL formula over P B and K.
We should note that, as in the unweighted case, the wEPIL formulaφ is defined over the set of ports P B and is interpreted as a series in K I + B .
Next we consider three examples of weighted component-based models whose architectures have ordered interactions encoded by wEPIL formulas. We recall from the Subsection 4.1 the following macro EPIL formula. Let P = {p 1 , . . . , p n } be a set of ports. Then, for p i 1 , . . . , p im ∈ P with m < n we let Let us now assume that we assign a weight k i l ∈ K to p i l for every l ∈ [m]. We define the subsequent macro wEPIL formula Then, we get Clearly the above macro formula # w (p i 1 ⊗ . . . ⊗ p im ) depends on the values k i 1 , . . . , k im . Though, in order to simplify our wEPIL formulas, we make no special notation about this. If the macro formula is defined in a weighted component-based system, then the values k i 1 , . . . , k im are unique in the whole formula.
Example 7.5. (Weighted Blackboard) Consider a weighted component-based system (wB,φ) with the Blackboard architecture described in Example 4.5. We assume the existence of three knowledge source weighted components. Therefore, we have wB = {wB(1), wB(2), wB(3), wB(4), wB(5)} referring to blackboard, controller, and the three source weighted components, respectively. Figure 9 depicts each of the weighted components in the system and a possible execution of the permissible interactions. The weight associated with each port in the system is shown at the outside of the port.
The allowed interactions range over I B , i.e., they are defined as in the corresponding (unweighted) component-based system B with Blackboard architecture. Then, the wEPIL formulaφ for the weighted Blackboard architecture with three source weighted components isφ  1, 2, 3. The first wPIL subformula expresses the cost for the connection of blackboard and controller. The wEPIL subformula between the two weighted concatenation operators represents the cost of the connection of the three sources to blackboard in order to be informed for existing data. The last part ofφ captures the cost of applying the connection of some of the three sources with controller and blackboard for the triggering and writing process. The weighted iteration operators describe the cost of executing recursive interactions inφ. Let w 1 , w 2 ∈ I + B encode two distinct sequences of interactions permitted in the given weighted Blackboard architecture. The values φ (w 1 ) and φ (w 2 ) represent the cost for executing these interactions with the order encoded by w 1 and w 2 , respectively. Then, φ (w 1 ) + φ (w 2 ) is the 'total' cost for implementing w 1 and w 2 . For example, if we consider the max-plus semiring, then the value max{ φ (w 1 ), φ (w 2 )} gives information for the communication with the maximum cost. Such information would be important in systems with restricted resources such as battery capacity for instance, in order for the systems to opt for implementing the least 'expensive' sequence of interactions.  Example 7.6. (Weighted Request/Response) Let (wB, ϕ) be a weighted componentbased system with the Request/Response architecture presented in Example 4.7. Our weighted system, shown in Figure 10, consists of seven weighted components, and specifically, the service registry, two services with their associated coordinators, and two clients. Therefore, we have that wB = {wB(1), . . . , wB(7)} referring to each of the aforementioned weighted components, respectively. The allowed interactions range over I B , and the wEPIL formulaφ describing the weighted Request/Response architecture is capture the cost of the interactions of the two clients with the service registry and describe the connection's cost of each of the two clients with the two services through their coordinators. The two wEPIL subformulas at the left of the first two weighted concatenation operators encode the cost for the connections of the two services and the two clients with registry, respectively. Then, each of the three wEPIL subformulas connected with represent the cost for the connection of either one of the two clients or both of them (one at each time) with the first service only, the second service only, or both of the services, respectively. Also, the weighted iteration operators inφ express the cost of repeating the corresponding permissible interactions in the architecture.
Let w 1 , w 2 ∈ I + B encode two distinct sequences of interactions in the presented weighted Request/Response architecture. Then, the value min{ φ (w 1 ), φ (w 2 )} expresses in minplus semiring for instance, the communication with the minimum cost. Furthermore, if we interpret the cost as the energy consumption required for implementing the architecture in a network, then we would be able to derive which pattern of interactions, w 1 or w 2 , requires the minimum energy.
Example 7.7. (Weighted Publish/Subscribe) Let (wB, ϕ) be a weighted componentbased system with the Publish/Subscribe architecture described in Example 4.8. Our weighted system, shown in Figure 11, is comprised of two publisher, two topic, and three subscriber weighted components, hence wB = {wB(1), . . . , wB(7)} referring to these components, respectively. The permissible interactions range over I B , and the wEPIL formulaφ for the weighted Publish/Subscribe architecture isφ = (φ 1 ⊕φ 2 ⊕ (φ 1 φ 2 )) ⊕ with and where the following auxiliary subformulas: represent the cost for the connection of each of the two topics with the first publisher wB(1), or the second publisher wB(2) or with both of them, and describe the cost of the interactions of the two topics with each of the two publishers, and describe the cost of the connections of the two topics with each of the three subscribers. Each ofφ 1 andφ 2 capture the cost for implementing the interactions of topics wB(3) and wB(4), respectively, with some of the publisher and subscriber components. Then, ϕ 1 ⊕φ 2 ⊕ (φ 1 φ 2 ) expresses the cost for the participation of some of the topics in the architecture, and in turn the use of the weight iteration operator inφ allows to encode the overall cost of applying these interactions with recursion. Consider for instance the words w 1 , w 2 ∈ I + B encoding two interactions in the given weighted Publish/Subscribe architecture. Then, in the Viterbi semiring the value max{ φ (w 1 ), φ (w 2 )} shows the sequence of interactions executed with the maximum probability.  , j), wt(i)), where B(i, j) = (Q(i, j), P (i, j), q 0 (i, j), R(i, j)) is the j-th instance of B(i), and it is called a parametric weighted component or a weighted component instance. We set pwB = {wB(i, j) | i ∈ [n], j ≥ 1} and call it a set of parametric weighted components. We impose on pwB the same assumptions as for pB. Abusing notations, we denote by wt(i), i ∈ [n], the weight mapping of wB(i, j), j ≥ 1, meaning that it assigns the value wt(i)(p) to every port p(j) ∈ P (i, j). Now we can introduce the weighted first-order extended interaction logic as a modelling language for describing the weight of the interactions in parametric weighted componentbased systems.
As in FOEIL we equip wEPIL formulas with variables. Let pwB = {wB(i, j) | i ∈ [n], j ≥ 1} be a set of parametric weighted components. We consider pairwise disjoint countable sets of first-order variables X (1) , . . . , X (n) referring to instances of weighted component types wB(1), . . . , wB(n), respectively. Definition 7.8. Let pwB = {wB(i, j) | i ∈ [n], j ≥ 1} be a set of parametric weighted components. Then the syntax of weighted first-order extended interaction logic (wFOEIL for short) formulasψ over pwB and K is given by the grammar where k ∈ K, ψ is a FOEIL formula over pB, x (i) , y (i) are first-order variables in X (i) , (resp. ) denotes the weighted existential (resp. universal) quantifier, (resp. ) denotes the weighted existential (resp. universal) concatenation quantifier, and (resp. ) the weighted existential (resp. universal) shuffle quantifier. Furthermore, we assume that whenψ contains a subformula of the form x (i) .ψ or x (i) .ψ , andψ contains a FOEIL formula ψ, then the application of negation in ψ is permitted only in PIL formulas, and formulas of the form x (j) = y (j) .
Letψ be a wFOEIL formula over pwB and r : [n] → N a mapping. As for (unweighted) parametric systems the value r(i), for every i ∈ [n], intends to represent the finite number of instances of the weighted component type wB(i) in the parametric system. We let pwB(r) = {wB(i, j) | i ∈ [n], j ∈ [r(i)]} and call it the instantiation of pwB w.r.t. r. The set of ports and the set of interactions of pwB(r) are the same as the corresponding ones in pB(r), hence we use for simplicity the same symbols P pB(r) and I pB(r) , respectively. We interpret wFOEIL formulasψ as series ψ over triples consisting of a mapping r : [n] → N, a (V, r)-assignment σ, and a word w ∈ I + pB(r) , and K. Intuitively, the use of weighted existential and universal concatenation (resp. shuffle) quantifiers x (i) .ψ and x (i) .ψ (resp. x (i) .ψ and x (i) .ψ) serves to compute the weight of the partial and whole participation of the weighted component instances, determined by the application of the assignment σ to x (i) , in sequential (resp. interleaving) interactions.
Ifψ is a wFOEIL sentence over pwB and K, then we simply write ψ (r, w). Let alsõ ψ be a wFOEIL sentence over pwB and K. Then,ψ andψ are called equivalent w.r.t. r whenever ψ (r, w) = ψ (r, w), for every w ∈ I + pB(r) . Now we are ready to formally define the concept of a parametric weighted componentbased system. Definition 7.10. A parametric weighted component-based system over K is a pair (pwB,ψ) where pwB = {wB(i, j) | i ∈ [n], j ≥ 1} is a set of parametric weighted components andψ is a wFOEIL sentence over pwB and K.
In the sequel, for simplicity we refer to parametric weighted component-based systems by parametric weighted systems, and we often omit the term "weighted" when we refer to instances.
For our examples in the sequel, we need the following macro wFOEIL formula. Let pwB = {wB(i, j) | i ∈ [n], j ≥ 1} and 1 ≤ i 1 , . . . , i m ≤ n be pairwise different indices. Let p i 1 ∈ P (i 1 ), . . . , p im ∈ P (i m ) and k i 1 , . . . , k im denote the weights in K assigned to p i 1 , . . . , p im , respectively, i.e., k i 1 = wt(i 1 )(p i 1 ), . . . , k im = wt(i m )(p im ). We set The weighted conjunctions in the right-hand side of the first line, in the above formula, express that the ports appearing in the argument of # w participate in the interaction with their corresponding weights. In the second line, the double indexed conjunctions in the first pair of big parentheses disable all the other ports of the participating instances of weighted components of type i 1 , . . . , i m described by variables x (i 1 ) , . . . , x (im) , respectively; conjunctions in the second pair of parentheses disable all ports of remaining instances of weighted component types i 1 , . . . , i m . Finally, the last conjunct in the third line ensures that no ports in instances of remaining weighted component types participate in the interaction. Then we get Next we present three examples of wFOEIL sentences describing concrete parametric architectures with ordered interactions in the weighted setup. We note that as for the examples of FOEIL sentences, whenever is defined a unique instance for a weighted component type we may also consider the corresponding set of variables as a singleton.
Example 7.11. (Parametric weighted Blackboard) We consider weighted Blackboard architecture, described in Example 7.5, in the parametric setting. Therefore, blackboard's instance interacts with controller's instance and all the source instances for presenting the current state of the problem. Then, some of the source instances are triggered and logged 26:44

M. Pittou and G. Rahonis
Vol. 17:4 in the controller in arbitrary order, and in turn these triggered source instances add the new information on blackboard through the controller, again in any order. Hence we need to describe the overall weight for any possible scenario of the aforementioned interactions among the several instances. We consider three sets of variables, namely X (1) , X (2) , X (3) for the instances of blackboard, controller, and knowledge source weighted components, respectively. Therefore, the wFOEIL sentenceψ that encodes the cost of the interactions of parametric weighted Blackboard architecture is The weighted subformula # w (p d (x (1) )⊗p r (x (2) )) with the associated quantifiers x (1) , x (2) expresses the weight for the connection of blackboard with the controller in order for the latter to be informed for the available information. The subformula with the weighted universal shuffle quantifier x (3) captures the weight for the respective connections of blackboard with each of the source instances, in arbitrary order. Then, the last subformula with the weighted existential shuffle quantifier y (3) encodes the weight for the triggering process of some source instances, and in turn for updating the information in blackboard through the controller. These interactions may be applied in any order for some instances of the source weighted component, which justifies the use of for the variables y (3) . The application of the weighted iteration operators allows computing the cost of the repetition of the respective interactions in the architecture. An instantiation of the parametric weighted architecture for three sources is presented in Figure 9 of Example 7.5.
The wFOEIL subformula at the first line ofψ with the weighted universal shuffle quantifier x (2) encodes the weight of the interleaving interactions between registry instance ( x (1) ) and each of the service instances for their enrollment. The wFOEIL subformula in the second line ofψ captures the weight of the interactions between registry and each of the client instances in order for the latter to connect and take the services' address from registry. These interactions take place in arbitrary order for each of the distinct client instances, hence their weight should be computed accordingly, which is ensured by the use of the weighted universal shuffle quantifier x (3) . The wFOEIL subformula in the third line ofψ expresses the weight of the connections among client and service instances through their coordinator instance, applying the quantifiers y (2) , x (4) , and y (3) . The use of quantifier y (3) is justified by the fact that only one client instance should interact with each service instance, and hence the respective weight is computed analogously. On the other hand, for different instances of services interleaving among several client instances is permitted, and hence we derive the respective weight by the wFOEIL subformula quantified by y (2) . The EPIL subformula ∀y (4) ∀z (3) ∀z (2) . θ ∨ ∀t (3) ∀t (2) (z (2) = t (2) ).θ inψ serves as a constraint to ensure that a unique coordinator instance is assigned to each service instance. Finally, the weighted iteration operator returns the cost of implementing the corresponding interactions with recursion. An instantiation of the parametric weighted architecture for two clients and services is presented in Figure 10 of Example 7.6.
Example 7.13. (Parametric weighted Publish/Subscribe) We consider weighted Publish/Subscribe architecture, described in Example 7.7, in the parametric setting. We have that for some of the topic instances there are some publisher instances that advertise and transmit their messages. In turn, the same topic instances perform three consecutive interactions with some of the subscriber instances, in order for the latter to express their interest in some messages, receive the requested messages, and disconnect from the topic instances. In each case the interactions among the distinct instances are executed with interleaving. In the subsequent wFOEIL sentenceψ we encode the weight of all the possible cases for the aforementioned permissible interactions. We let X (1) , X (2) , X (3) denote the variable sets that correspond to publisher, topic, and subscriber weighted component instances, respectively. ψ = x (2) .
x (1) . # w (p a (x (1) ) ⊗ p n (x (2) )) # w (p t (x (1) ) ⊗ p r (x (2) )) We interpret the wFOEIL sentenceψ as follows. The wFOEIL subformula in the first line encodes the weight for the interactions among some of the topic instances (weighted existential shuffle quantifier x (2) ) and some publisher instances (weighted existential shuffle quantifier x (1) ) in order for the latter to advertise and in turn transmit their messages to the former. These interactions may take place in any order for the distinct instances, hence the associated weight needs to be computed accordingly. Then, in the second line the subformula with the weighted existential shuffle quantifier x (3) captures the weight of three sequential interactions between each of the topic instances, specified in the first line, and some of the subscriber instances. Since there is no restriction for the execution order of these interactions with respect to the distinct instances, we describe their weight with the corresponding weighted shuffle quantifiers. Finally, the use of the weighted iteration operator serves for computing the cost of the ongoing implementation of the architecture. An instantiation of the parametric weighted architecture is shown in Figure 11 of Example 7.7.
Parametric architectures of the above examples were considered in [BIS19b,MBBS16b], in the qualitative setting, and in the weighted setup in [PR17]. Though, neither the execution order nor the recursion of interactions was assumed in the work of [BIS19b,MBBS16b,PR17].
Note that similarly to FOEIL, its weighted counterpart, wFOEIL, can also be applied for the quantitative modelling of parametric architectures without order restrictions, i.e., for Examples 5.5-5.8. Next we present the wFOEIL sentences describing the parametric weighted Master/Slave and Repository, while the rest of the architectures can be described in the weighted setup analogously.
In the above sentence the weighted universal concatenation quantifier accompanied with the existential one encodes the weight of the interactions between every slave instance and a master instance. These connections are applied consecutively for the distinct slave instances, hence their weight is computed accordingly. Consider the instantiation of the architecture with two master and two slave weighted component instances. We let w 1 , w 2 , w 3 , and w 4 correspond to the four possible connections for the components in the system, defined as in the unweighted case and shown in Figure 4. Then, the values ψ (r, w 1 ), ψ (r, w 2 ), ψ (r, w 3 ), and ψ (r, w 4 ) return the cost of the implementation of each of the four possible connections in the architecture, according to the underlying semiring. In turn, the 'sum' ψ (r, w 1 ) + ψ (r, w 2 ) + ψ (r, w 3 ) + ψ (r, w 4 ) equals in the semiring of natural numbers for instance, to the total cost for executing these connections in the architecture.
Example 7.15. (Parametric weighted Repository) The subsequent wFOEIL sentencẽ ψ characterizes the parametric Repository architecture, presented in Example 5.8, with weighted features. We let X (1) and X (2) denote the variable sets that refer to instances of repository and data accessor weighted components, respectively. Then, Let a 1 , a 2 , a 3 , a 4 represent each of the four interactions for the architecture instantiation of Figure 7, in the weighted setup. Then, the value ψ (r, w) for w = a 1 a 2 a 3 a 4 is the 'total' cost for implementing the interactions in the system. 7.3. Decidability results for wFOEIL. In this subsection, we state an effective translation of wFOEIL sentences to weighted automata. For this, we use the corresponding result of Theorem 6.2, namely for every FOEIL sentence we can effectively construct, in exponential time, an expressively equivalent finite automaton. Then, we show that the equivalence of wFOEIL sentences over specific semirings is decidable. Firstly, we briefly recall basic notions and results on weighted automata. Let A be an alphabet. A (nondeterministic) weighted finite automaton (WFA for short) over A and K is a quadruple A = (Q, in, wt, ter) where Q is the finite state set, in : Q → K is the initial distribution, wt : Q×A×Q → K is the mapping assigning weights to transitions of A, and ter : Q → K is the terminal distribution.
Let w = a 1 . . . a n ∈ A * . A path P w of A over w is a sequence of transitions P w = ((q i−1 , a i , q i )) 1≤i≤n . The weight of P w is given by weight(P w ) = in(q 0 )· 1≤i≤n wt(q i−1 , a i , q i )· ter(q n ). The behavior of A is the series A : A * → K which is determined by A (w) = Pw weight(P w ).
Two WFA A and A over A and K are called equivalent if A = A . For our translation algorithm, of wFOEIL formulas to WFA, we shall need folklore results in WFA theory. We collect them in the following proposition (cf. for instance [DKV09,Sak09a]).
Proposition 7.16. Let A 1 = (Q 1 , in 1 , wt 1 , ter 1 ), A 2 = (Q 2 , in 2 , wt 2 , ter 2 ) and A = (Q, in, wt, ter) be three WFA's over A and K. Then, we can construct in polynomial time WFA's B, C, D, E over A and K accepting the sum, and the Hadamard, Cauchy and shuffle product of A 1 and A 2 , respectively. Moreover, if A is proper, then we can construct in polynomial time WFA A over A and K accepting the iteration of A .
Next we present the translation algorithm of wFOEIL formulas to WFA's. Our algorithm requires a doubly exponential time at its worst case. Specifically, we prove the following theorem.
Theorem 7.17. Let pwB = {wB(i, j) | i ∈ [n], j ≥ 1} be a set of parametric weighted components over a commutative semiring K, and r : [n] → N. Then, for every wFOEIL sentenceψ over pwB and K we can effectively construct a WFA Aψ ,r over I pB(r) and K such that ψ (r, w) = Aψ ,r (w) for every w ∈ I + pB(r) . The worst case run time for the translation algorithm is doubly exponential and the best case is exponential.
We shall prove Theorem 7.17 using the subsequent Proposition 7.19. For this, we need to slightly modify the corresponding result of Proposition 6.3. More precisely, we state the next proposition.
Proposition 7.18. Let ψ be a FOEIL formula over a set pB = {B(i, j) | i ∈ [n], j ≥ 1} of parametric components. Let also V ⊆ X be a finite set of variables containing free(ψ), r : [n] → N, and σ a (V, r)-assignment. Then, we can effectively construct a finite automaton 26:48

M. Pittou and G. Rahonis
Vol. 17:4 A ψ,r,σ over I pB(r) such that (r, σ, w) |= ψ iff w ∈ L(A ψ,r,σ ) for every w ∈ I + pB(r) . The worst case run time for the translation algorithm is exponential and the best case is polynomial.
Proposition 7.19. Letψ be a wFOEIL formula over a set pwB = {wB(i, j) | i ∈ [n], j ≥ 1} of parametric weighted components and K. Let also V ⊆ X be a finite set of variables containing free(ψ), r : [n] → N and σ a (V, r)-assignment. Then, we can effectively construct a WFA Aψ ,r,σ over I pB(r) and K such that ψ (r, σ, w) = Aψ ,r,σ (w) for every w ∈ I + pB(r) . The worst case run time for the translation algorithm is doubly exponential and the best case is exponential.
Proof. We prove our claim by induction on the structure of the wFOEIL formulaψ.
By our constructions above, we immediately get ψ (r, σ, w) = Aψ ,r,σ (w) for every w ∈ I + pB(r) . Hence, it remains to deal with the time complexity of our translation algorithm. Taking into account the above induction steps, we show that the worst case run time for our translation algorithm is doubly exponential. Indeed, ifψ = ψ is a FOEIL formula, then our claim holds by (ii) and Proposition 7.18. Then the constructions in steps (iii)-(vi), (viii) and (x) require a polynomial time (cf. Proposition 7.16). Finally, the translations in steps (vii) and (ix) require at most a doubly exponential run time because of the following reasons. Firstly, we need to compute all nonempty subsets of [r(i)] which requires an exponential time. Then, due to our restrictions forψ inψ = x (i) .ψ andψ = x (i) .ψ , and Proposition 7.18 (recall also the proof of Proposition 6.3), if a FOEIL subformula ψ occurs inψ , then we need a polynomial time to translate it to a finite automaton and by (ii) an exponential time to translate it to a WFA. We should note that ifψ contains a subformula of the form ∃ * x (i ) .ψ or ∃ ¡ x (i ) .ψ or x (i ) .ψ or x (i ) .ψ , then the computation of the subsets of [r(i )] is independent of the computation of the subsets of [r(i)]. On the other hand, the best case run time of the algorithm is exponential. Indeed, if in step (ii) we get A ψ,r,σ in polynomial time (cf. Proposition 7.18) and we need no translations of steps (vii) and (ix), then the required time is exponential. Now we are ready to state the proof of Theorem 7.17.
Proof of Theorem 7.17. We apply Proposition 7.19. Sinceψ is a weighted sentence it contains no free variables. Hence, we get a WFA Aψ ,r over I pB(r) and K such that ψ (r, w) = Aψ ,r (w) for every w ∈ I + pB(r) , and this concludes our proof. The worst case run time for the translation algorithm is doubly exponential and the best case is exponential.
Next we prove the decidability of the equivalence of wFOEIL sentences over (subsemirings of) skew fields. It is worth noting that the complexity remains the same with the one for the decidability of equivalence for FOEIL sentences (see Section 6).
Theorem 7.20. Let K be a (subsemiring of a) skew field, pwB = {wB(i, j) | i ∈ [n], j ≥ 1} a set of parametric weighted components over K, and r : [n] → N a mapping. Then, the equivalence problem for wFOEIL sentences over pwB and K w.r.t. r is decidable in doubly exponential time. Proof. It is well known that the equivalence problem for weighted automata, with weights taken in (a subsemiring of) a skew field, is decidable in cubic time (cf. Theorem 4.10 in [Sak09a], [Sak09b]). Hence, we conclude our result by Theorem 7.17.
Corollary 7.21. Let pwB = {wB(i, j) | i ∈ [n], j ≥ 1} be a set of parametric weighted components over Q and r : [n] → N a mapping. Then, the equivalence problem for wFOEIL sentences over pwB and Q w.r.t. r is decidable in doubly exponential time.

Conclusion
Efficient modelling of architectures plays a key role in component-based systems in order to be well-defined. In this paper we propose the formal study of architectures for parametric component-based systems that consist of a finite number of component types with an unknown number of instances. Specifically, we introduce a propositional logic, EPIL, which augments PIL from [MBBS16b] with a concatenation, a shuffle, and an iteration operator. We then interpret EPIL formulas on finite words over the set of interactions defined for a given set of ports. We also study FOEIL, the first-order level of EPIL, as a modelling language for the architectures of parametric systems. EPIL and FOEIL are proved expressive enough to return the permissible interactions and the order restrictions of architectures, as well as to encode recursive interactions. Several examples are presented for modelling parametric architectures with or without ordered interactions by FOEIL sentences. Also, we show that the equivalence and validity problems for FOEIL sentences are decidable in doubly exponential time, and the satisfiability problem for FOEIL sentences is decidable in exponential time. Moreover, we show the robustness of our theory by extending our results for the quantitative modelling of parametric architectures. For this, we introduce and study wEPIL and wFOEIL over a commutative semiring. Our weighted logics maintain the qualitative attributes of EPIL and FOEIL, and also model the quantitative properties of architectures, such as the 'total' cost or the maximum probability of implementing concrete interactions. We show that the equivalence problem for wFOEIL sentences over (a subsemiring of) a skew field is decidable in doubly exponential time, hence the complexity remains the same with the one for the decidability of FOEIL sentences. Furthermore, we apply wFOEIL for describing the quantitative aspects of several parametric architectures. Work in progress involves the study of the second-order level of EPIL and wEPIL in order to model parametric architectures in the qualitative and weighted setup, respectively, that cannot be formalized by first-order logics such as Ring, Linear, and Grid [DYBH12,MBBS16b]. Future work is also investigating the verification problem of parametric systems against formal properties [AD16,BIS19b], and specifically the application of architectures modelled by our logics for studying the behavior and proving properties (such as deadlockfreedom) in parametric systems. Moreover, it would be interesting to extend our logic-based framework for the investigation of dynamic and reconfigurable architectures [BJMS12,CST18,MG16] as well as for addressing the architecture composition problem [ABB + 16, BHM19]. Another research direction is the study of our logics over alternative weight structures, found in applications, like for instance valuation monoids [DM11,KP20]. Formal approaches for architectures are often extended with tools or graphical languages for supporting architectures' specification (cf. [APR06, KG06, KKW + 16, MBBS16a, MT00]). Therefore, in addition to theoretical directions, future work includes also the development of a tool and a language in order to facilitate the architecture modelling and identification process of parametric (weighted) systems. Finally, in a subsequent work we investigate parametric systems and their architectures in the fuzzy framework in order to address uncertainty and imprecision resulting from the components' communication.