Keywords

1 Introduction

Architectures are a critical issue in design and development of complex software systems since they characterize coordination principles among the components of a system. Whenever the construction of a software system is based on a “good” architecture, then the system satisfies most of its functional and quality requirements. Well-defined architectures require a formal treatment in order to efficiently characterize their properties. A recent work towards this direction is [13], where the authors introduced propositional configuration logic (PCL for short) which was proved sufficient enough to describe architectures: the meaning of every PCL formula is a configuration set, which intuitively represents permissible component connections, and every architecture can be represented by a configuration set on the collection of its components. Furthermore, the authors of [13] studied the relation among architectures and architecture styles, i.e., architectures with the same types of components and topologies.

PCL is a specification logic of software architectures which is able to describe their qualitative features. However, several practical applications require also quantitative characteristics of architectures such as the cost of the interactions among the components of an architecture, the time needed, or the probability of the implementation of a concrete interaction. For instance, several IoT and cloud applications, which are based on Publish/Subscribe architecture, require quantitative features [14, 18, 19]. Moreover, considering a set of components and an architecture style, there may occur several architectures where each of them has a specific amount of some resource (e.g. memory or energy consumption). In such a setting, the most suitable architecture must be chosen, depending on the available resources or the performance. Generally, quantitative properties are essential for performance related properties and for resource-constrained systems.

The authors in [17] introduced and investigated a weighted PCL (wPCL for short) over a commutative semiring \((K, \oplus , \otimes ,0,1)\) which serves as a specification language for the study of software architectures with quantitative features such as the maximum cost of an architecture or the maximum priority of a component. Nevertheless, operations like average for response time or power consumption cannot be described within the algebraic structure of semirings. Such operations are important for practical applications and have been investigated for weighted automata in [4,5,6]. In [7, 8] the authors provided valuation monoids as a general algebraic framework, which describe several operations that cannot fit in the structure of semirings. More recently, in [15] nested weighted automata have been considered under probabilistic semantics for expressing properties such as “the long-run average resource consumption is below a threshold". Also, the authors in [6] presented algorithms which are designed specifically for computing the average response time on graphs, game graphs, and Markov chains.

However, the aforementioned works have not been developed for the setting of systems’ architectures and therefore cannot express characteristics such as the average cost of an architecture or the maximum most frequent cost/priority that occurs in an architecture. In this paper, we tackle this problem by extending the work of [17]. Specifically, we introduce and investigate a weighted PCL over product valuation monoids (w\(_{\text {pvm}}\)PCL for short) which is proved sufficient to serve as a specification language for software architectures with important quantitative features that are not covered in [17].

The contributions of our work are the following. We introduce the syntax and semantics of w\(_{\text {pvm}}\)PCL. The semantics of w\(_{\text {pvm}}\)PCL formulas are polynomials with values in the product valuation monoid. Then, in our main result, we prove that for every w\(_{\text {pvm}}\)PCL formula over a set of ports and a product valuation monoid with specific properties, we can effectively construct an equivalent one in full normal form, which is unique up to the equivalence relation. The second main result is the decidability of equivalence of w\(_{\text {pvm}}\)PCL formulas. Lastly, we describe in a strict logical way several well-known software architectures with quantitative characteristics. We skip detailed proofs of our results which are similar to the corresponding ones of [17] and [16]. We refer the reader to the full version of our paper on arXiv [11].

2 Preliminaries

In this section, we recall valuation monoids and product valuation monoids [8]. A valuation monoid \((D, \oplus , \mathrm{{val}}, 0)\) consists of a commutative monoid \((D, \oplus , 0)\) and a valuation function \(\mathrm{{val}}: D^+ \rightarrow D\), where \(D^+\) denotes the set of nonempty finite words over D, with \(\mathrm{{val}}(d) = d\) for all \(d\in D\) and \(\mathrm{{val}}(d_1, \dots , d_n) = 0\) whenever \(d_i=0\) for some \(i\in \{1,\dots ,n\}.\)

\((D, \oplus , \mathrm{{val}}, \otimes , 0, 1)\) is a product valuation monoid, or pv-monoid for short if \((D, \oplus , \mathrm{{val}}, 0)\) is a valuation monoid, \(\otimes : D^2 \rightarrow D\) is a binary operation, \(1\in D\) with \(\mathrm{{val}}(1)_{1\le i \le n} = 1\) for all \(n\ge 1\) and \(0\otimes d = d \otimes 0 = 0\), \(1\otimes d = d\otimes 1=d \) for all \(d\in D\). The pv-monoid is denoted simply by D if the operations and the constant elements are understood. A pv-monoid D is left-\(\oplus \)-distributive if \(d\otimes (d_1 \oplus d_2) = (d\otimes d_1) \oplus (d\otimes d_2)\) for any \(d,d_1, d_2 \in D.\) Right-\(\oplus \)-distributivity is defined analogously. If a pv-monoid D is both left- and right-\(\oplus \)-distributive, then it is \(\oplus \)-distributive. If \(\otimes \) is associative, then D is called associative. We call D left-val-distributive if for all \(n\ge 1\) and \(d, d_i\in D\) with \(i\in \{1, \dots , n\}\), it holds \(d\otimes \mathrm{{val}}(d_1, \dots , d_n) = \mathrm{{val}}(d\otimes d_1, \dots , d\otimes d_n).\) Moreover, the pv-monoid D is called (additively) idempotent if \(d\oplus d =d\) for every \(d\in D\).

In the following we recall some pv-monoids from [8]. The algebraic structures \((\mathbb {R} \cup \{-\infty \}, \max , \mathrm{{avg}},\) \( +, -\infty , 0)\) and \((\mathbb {R}\cup \{+\infty \},\) \( \min , \mathrm{{avg}}, +, +\infty , 0)\) with \(\mathrm{{avg}}(d_1, \dots , d_n) = \frac{1}{n} \sum _{i=1}^n d_i\) are pv-monoids. More precisely, they are left-\(\mathrm{{val}}\)-distributive and \(\oplus \)-distributive pv-monoids. Also, the structure \((\mathbb {R}\cup \{ -\infty ,+\infty \},\) \( \min , \mathrm{{maj}}, \max , +\infty , -\infty )\), where \(\mathrm{{maj}}(d_1, \dots , d_n)\) is the greatest value among all values that occur most frequently among \(d_1, \dots , d_n\), is a \(\oplus \)-distributive pv-monoid but not left-\(\mathrm{{val}}\)-distributive. Both \(\mathrm{{avg}}\) and \(\mathrm{{maj}}\) are symmetric functions, i.e., the value of the function given n arguments is the same no matter the order of the arguments. Moreover, the pv-monoids mentioned before are idempotent.

Throughout the paper \((D, \oplus , \mathrm{{val}}, \otimes , 0,1)\) will denote an idempotent pv-monoid where \(\mathrm{{val}}\) is symmetric.

Let Q be a set. A formal series (or simply series) over Q and D is a mapping \(s:Q\rightarrow D\). The support of s is the set \(\mathrm {supp}(s)=\{q \in Q \mid s(q) \ne 0 \}\). A series with finite support is called also a polynomial. We denote by \(D\left\langle Q \right\rangle \) the class of all polynomials over Q and D.

3 Weighted Propositional Interaction Logic

In this section, we introduce the weighted propositional interaction logic over pv-monoids. Firstly, we recall from [13] the propositional interaction logic.

Let P be a nonempty finite set of ports. We let \(I(P)=\mathcal {P}(P) \backslash \{ \emptyset \}\), where \(\mathcal {P}(P)\) denotes the power set of P. Every set \(\alpha \in I(P)\) is called an interaction. The syntax of propositional interaction logic (PIL for short) formulas over P is given by the grammar

$$\begin{aligned} \phi \,{:}{:}{=}\,\,true \mid p \mid \overline{\phi } \mid \phi \vee \phi \end{aligned}$$

where \(p\in P\). As usual, we set \(\overline{\overline{\phi }} = \phi \) for every PIL formula \(\phi \) and \(false=\overline{true}.\) Hence, the conjunction of two PIL formulas \(\phi , \phi ^\prime \) is defined by \(\phi \wedge \phi ^\prime = \overline{\left( \overline{\phi } \vee \overline{\phi ^\prime }\right) }\). A PIL formula of the form \(p_1\wedge \dots \wedge p_n\) with \(n>0\), and \(p_i\in P\) or \(p_i=\overline{p_i^\prime }\) with \(p_i^\prime \in P\) for every \(1\le i \le n\), is called a monomial. For simplicity we denote a monomial \(p_1\wedge \dots \wedge p_n\) by \(p_1\dots p_n.\) Monomials of the form \(\bigwedge _{p\in P_+} p \wedge \bigwedge _{p\in P_{-}} \overline{p}\) with \(P_+ \cup P_{-} = P\) and \(P_+\cap P_{-} = \emptyset \) are called full monomials.

Let \(\phi \) be a PIL formula and \(\alpha \) an interaction. We define the satisfaction relation \(\alpha \,\models _i\, \phi \) by induction on the structure of \(\phi \) as follows:

figure b

For every \(\alpha \in I(P)\) it holds . Moreover, for every interaction \(\alpha \in I(P)\) we define its characteristic monomial \(m_{\alpha } = \bigwedge _{p\in \alpha } p \wedge \bigwedge _{p\not \in \alpha } \overline{p}.\) A characteristic monomial \(m_{\alpha }\) is actually a full monomial that formalises the interaction \(\alpha \). Then, for every \(\alpha ^\prime \in I(P)\) we trivially get \(\alpha ^\prime \,\models _i\, m_{\alpha }\) iff \(\alpha ^\prime = \alpha .\)

Throughout the paper P will denote a nonempty finite set of ports.

Definition 1

Let D be a pv-monoid. Then, the syntax of formulas of weighted PIL (\(w _{pvm }\)PIL for short) over P and D is given by the grammar

$$\begin{aligned} \varphi \,{:}{:}{=}\,\, d \mid \phi \mid \varphi \oplus \varphi \mid \varphi \otimes \varphi \end{aligned}$$

where \(d\in D\) and \(\phi \) denotes a PIL formula over P.

We denote by PIL(DP) the set of all w\(_{\text {pvm}}\)PIL formulas over P and D. Next, we present the semantics of formulas \(\varphi \in PIL(D,P)\) as polynomials \(\left\| \varphi \right\| \in D \left\langle I(P) \right\rangle \). For the semantics of PIL formulas \(\phi \) over P we use the satisfaction relation as defined above. Hence, the semantics of PIL formulas \(\phi \) gets only the values 0 and 1.

Definition 2

Let \(\varphi \in PIL(D,P)\). The semantics of \(\varphi \) is a polynomial \(\left\| \varphi \right\| \in D \left\langle I(P) \right\rangle \). For every \(\alpha \in I(P)\) the value \(\left\| \varphi \right\| (\alpha )\) is defined inductively on the structure of \(\varphi \) as follows:

figure c

4 Weighted Propositional Configuration Logic

In this section, we introduce and investigate the weighted propositional configuration logic over pv-monoids. But first, we recall the propositional configuration logic (PCL for short) from [13]. The syntax of PCL formulas over P is given by the grammar

$$\begin{aligned} f\,{:}{:}{=}\,\, true \mid \phi \mid \lnot f \mid f\sqcup f \mid f+f \end{aligned}$$

where \(\phi \) denotes a PIL formula over P. The operators \(\lnot \), \(\sqcup \), and \(+\) are called complementation, union, and coalescing, respectively. The intersection \(\sqcap \) is defined by \(f_1 \sqcap f_2 := \lnot \left( \lnot f_1 \sqcup \lnot f_2 \right) \).

We let \(C(P)= \mathcal {P}(I(P)) \backslash \{ \emptyset \} \). For every PCL formula f and \(\gamma \in C(P)\) the satisfaction relation \(\gamma \,\models \, f\) is defined inductively on the structure of f as follows:

figure d

We define the closure \(\sim f\) of every PCL formula f by \(\sim f := f+true.\)

Two PCL formulas \(f, f^\prime \) are called equivalent, and we denote it by \(f\equiv f^\prime \), whenever \(\gamma \,\models \, f\) iff \(\gamma \,\models \, f^\prime \) for every \(\gamma \in C(P)\). We refer the reader to [13] and [17] for properties of PCL formulas.

Next, we introduce our weighted PCL over pv-monoids.

Definition 3

Let D be a pv-monoid. The syntax of formulas of the weighted PCL (w\(_{pvm }\)PCL for short) over P and D is given by the grammar

$$ \zeta \, {:}{:}{=}\,\, d\mid f \mid \zeta \oplus \zeta \mid \zeta \otimes \zeta \mid \zeta \uplus \zeta \mid *\zeta $$

where \(d\in D\), f denotes a PCL formula over P, and \(\uplus \) denotes the coalescing operator among w\(_{pvm }\)PCL formulas. The operator \(*\) is called valuation operator.

We denote by PCL(D,P) the set of all w\(_{\text {pvm}}\)PCL formulas over P and D. We present the semantics of formulas \(\zeta \in PCL(D,P)\) as polynomials \( \left\| \zeta \right\| \in D\left\langle C(P)\right\rangle \). For the semantics of PCL formulas we use the satisfaction relation as defined previously.

Definition 4

Let \(\zeta \in PCL(D,P)\). The semantics of \(\zeta \) is a polynomial \(\left\| \zeta \right\| \in D\left\langle C(P)\right\rangle \) where for every \(\gamma \in C(P)\) the value \(\left\| \zeta \right\| (\gamma ) \) is defined inductively on the structure of \(\zeta \) as follows:

  • \(\left\| d \right\| (\gamma ) = d\),

  • \(\left\| f\right\| (\gamma )=\left\{ \begin{array} [c]{rl} 1 &{} \text { if }\gamma \,\models \, f\\ 0 &{} \text { otherwise} \end{array} ,\right. \)

  • \(\left\| \zeta _1 \oplus \zeta _2\right\| (\gamma ) = \left\| \zeta _1\right\| (\gamma ) \oplus \left\| \zeta _2\right\| (\gamma ) \),

  • \(\left\| \zeta _1 \otimes \zeta _2\right\| (\gamma ) = \left\| \zeta _1\right\| (\gamma ) \otimes \left\| \zeta _2\right\| (\gamma ) \),

  • ,

where denotes that the sets \(\gamma _1, \dots , \gamma _n\) consist a partition of \(\gamma \) for every \(n>0.\)

It is important to note here that since the semantics of every w\(_{\text {pvm}}\)PCL formula is defined on C(P), the sets \(\gamma _1\) and \(\gamma _2\) in \(\left\| \zeta _1 \uplus \zeta _2\right\| (\gamma ) \) and the sets \(\gamma _1, \dots , \gamma _n\) in \(\left\| *\zeta \right\| (\gamma )\) are nonempty. Trivially in \(\left\| *\zeta \right\| (\gamma ) \), the maximum value of n is \(|\gamma |\), i.e., the cardinality of \(\gamma \). Hence,

Moreover, in \(\left\| *\zeta \right\| (\gamma )\), let the sets \(\gamma _i \in C(P)\) where \(i\in \{1, \dots ,n\}\) and . Consider a permutation \((i_1, \dots , i_n)\) of \((1, \dots ,n)\). Then

$$\mathrm{{val}} (\left\| \zeta \right\| (\gamma _1) \dots , \left\| \zeta \right\| (\gamma _n) ) = \mathrm{{val}} (\left\| \zeta \right\| (\gamma _{i_1}), \dots , \left\| \zeta \right\| (\gamma _{i_n}) ). $$

Hence, \(\mathrm{{val}} (\left\| \zeta \right\| (\gamma _1), \dots , \) \( \left\| \zeta \right\| (\gamma _n) ) \oplus \mathrm{{val}} (\left\| \zeta \right\| (\gamma _{i_1}), \dots , \left\| \zeta \right\| (\gamma _{i_n}) ) = \) \( \mathrm{{val}} (\left\| \zeta \right\| (\gamma _1), \) \(\dots , \left\| \zeta \right\| (\gamma _n) )\) by the idempotency of D. Therefore, for every analysis of , the value \(\mathrm{{val}} \left( \left\| \zeta \right\| (\gamma _1), \right. \) \( \left. \dots , \left\| \zeta \right\| (\gamma _n) \right) \) in \(\left\| *\zeta \right\| (\gamma ) \) is computed only once.

Two w\(_{\text {pvm}}\)PCL formulas \(\zeta _1, \zeta _2\) are called equivalent, and we write \(\zeta _1 \equiv \zeta _2\), whenever \(\left\| \zeta _1 \right\| (\gamma )= \left\| \zeta _2 \right\| (\gamma ) \) for every \(\gamma \in C(P)\). The closure \(\sim \zeta \) of every w\(_{\text {pvm}}\)PCL formula \(\zeta \in PCL(D,P)\) is determined by:

  • \( \sim \zeta := \zeta \oplus (\zeta \uplus 1).\)

Lemma 1

Let \(\zeta \in PCL(D,P)\). Then

$$\left\| {\sim }\zeta \right\| (\gamma )=\bigoplus \nolimits _{\gamma ^{\prime }\subseteq \gamma }\left\| \zeta \right\| (\gamma ^{\prime })$$

for every \(\gamma \in C(P)\).

Next, we present several properties of our w\(_{\text {pvm}}\)PCL formulas.

Proposition 1

Let \(\zeta , \zeta _1, \zeta _2, \zeta _3 \in PCL(D,P)\) and \(d\in D\). Then

  1. (i)

    \(\zeta \uplus 0 \equiv 0 \equiv 0\uplus \zeta . \)

If \(\otimes \) is commutative, then

  1. (ii)

    \(\zeta _1 \uplus \zeta _2 \equiv \zeta _2 \uplus \zeta _1.\)

If D is associative and \(\oplus \)-distributive, then

  1. (iii)

    \( (\zeta _1 \uplus \zeta _2) \uplus \zeta _3 \equiv \zeta _1 \uplus (\zeta _2 \uplus \zeta _3).\)

If D is left-\(\oplus \)-distributive, then

  1. (iv)

    \(\zeta \otimes (\zeta _1\oplus \zeta _2) \equiv (\zeta \otimes \zeta _1)\oplus (\zeta \otimes \zeta _2).\)

If D is right-\(\oplus \)-distributive, then

  1. (v)

    \((\zeta _1\oplus \zeta _2) \otimes \zeta \equiv (\zeta _1\otimes \zeta )\oplus (\zeta _2\otimes \zeta ).\)

Proposition 2

Let \(\zeta \in PCL(D,P)\) with \(\zeta =d \in D\). If D is left-\(\mathrm{{val}}\)-distributi-ve, then

$$\begin{aligned} *\zeta \equiv d. \end{aligned}$$

Proof

For every \(\gamma =\{ a_1, \dots , a_s \}\) where \(s\in \mathbb {N}\), we have

where the second and the last equalities hold since D is idempotent, and the third one since D is left-\(\mathrm{{val}}\)-distributive.

Moreover, D is called \(\oplus \)-preservative whenever \(\mathrm{{val}}(d_1 \oplus d_2 , d ) = \mathrm{{val}}(d_1,d) \oplus \mathrm{{val}}(d_2,d)\) and \(\mathrm{{val}}(d, d_1 \oplus d_2) = \mathrm{{val}}(d, d_1) \oplus \mathrm{{val}}(d, d_2)\) for every \(d, d_1, d_2\in D.\) The pv-monoids \((\mathbb {R}\cup \{-\infty \}, \max , \mathrm{{avg}}, +, -\infty , 0)\) and \((\mathbb {R} \) \( \cup \) \(\{+\infty \}, \) \(\min ,\) \( \mathrm{{avg}}, +, +\infty ,\) 0), are \(\oplus \)-preservative.

By a straightforward calculation we can show the next proposition.

Proposition 3

Let D be a valuation monoid. If \(\mathrm{{val}}\) is \(\oplus \)-preservative, then

$$\begin{aligned} \mathrm{{val}} \left( \bigoplus _{ i\in I } d_i, \bigoplus _{j\in J}d_j^\prime \right) = \bigoplus _{i\in I, j\in J} \mathrm{{val}}\left( d_i, d_j^\prime \right) \end{aligned}$$

where IJ are finite index sets and \(d_i, d_j^\prime \in D\) for every \(i\in I\) and \(j\in J\).

Proposition 4

Let \(\zeta \in PCL(D,P)\). If D is \(\oplus \)-preservative, then

$$\begin{aligned} \sim (*\zeta ) \equiv * (\sim \zeta ). \end{aligned}$$

Proof

Let \(\gamma \in C(P)\). Then

where the third equality holds since D is \(\oplus \)-preservative and the next equalities due to the commutativity of \(\oplus .\)

Proposition 5

Let \(\zeta , \zeta _1, \zeta _2 \in PCL(D,P)\). If D is left-\(\oplus \)-distributive, then

$$\begin{aligned} \zeta \uplus (\zeta _1 \oplus \zeta _2) \equiv (\zeta \uplus \zeta _1) \oplus (\zeta \uplus \zeta _2). \end{aligned}$$

Next, we show a special case when \(\otimes \) distributes over \(\uplus \). In general \(\otimes \) does not distribute over \(\uplus \). For example, let \(P=\{ p,q \}\) and the w\(_{\text {pvm}}\)PCL formulas \(\zeta , \zeta _1, \zeta _2\), where \(\zeta =2\) and \(\zeta _1=\zeta _2 = 1\). If we consider the set \(\gamma = \{ \{p\}, \{q\} \}\) and the pv-monoid \((\mathbb {R}\cup \{-\infty \}, \max , \mathrm{{avg}}, +, -\infty , 0)\), then it is easy to show that \(\left\| \zeta \otimes (\zeta _1 \uplus \zeta _2) \right\| (\gamma ) \not = \left\| (\zeta \otimes \zeta _1) \uplus (\zeta \otimes \zeta _2) \right\| (\gamma )\). Hence, \(\zeta \otimes (\zeta _1 \uplus \zeta _2) \not \equiv (\zeta \otimes \zeta _1) \uplus (\zeta \otimes \zeta _2).\) However, this is not the case when \(\zeta \) is a PIL formula and D is left-\(\oplus \)-distributive.

Proposition 6

Let \(\phi \) be a PIL formula over P and \(\zeta _{1},\zeta _{2}\ \in PCL(D,P)\). If D is left-\(\oplus \)-distributive, then

$$ \phi \otimes (\zeta _{1}\uplus \zeta _{2})\equiv (\phi \otimes \zeta _{1})\uplus (\phi \otimes \zeta _{2}). $$

5 Full Normal Form for W\(_{\text {pvm}}\)PCL Formulas

In this section, we show that for every w\(_{\text {pvm}}\)PCL formula \(\zeta \in PCL(D,P)\), where D is a pv-monoid satisfying specific properties, we can effectively construct an equivalent formula of a special form which is called full normal form. For this, we will use corresponding results from [13] and [17]. More precisely, for every PCL formula f over P we can effectively construct a unique equivalent PCL formula of the form trueFootnote 1 or \(\bigsqcup _{i\in I} \sum _{j\in J_{i}} m_{i,j}\) (cf. Theorem 4.43 in [13]), and for every weighted PCL formula \(\zeta \) over P and a commutative semiring \((K, \oplus , \otimes , 0,1)\) we can construct a unique equivalent weighted PCL formula of the form k or \(\bigoplus _{i\in I} \left( k_i \otimes \sum _{j\in J_i} m_{i,j} \right) \) (cf. Theorem 1 in [17] and Theorem 25 in [16]). The index sets I and \(J_i\), for every \(i\in I\), are finite, k and \(k_i \in K\) and \(m_{i,j}\)’s are full monomials over P. We show that we can also effectively build a unique full normal form for every w\(_{\text {pvm}}\)PCL formula over P and a pv-monoid D satisfying specific properties shown below. Uniqueness is up to the equivalence relation. Lastly, we show that the equivalence problem of w\(_{\text {pvm}}\)PCL formulas is decidable.

Definition 5

A w\(_{\text {pvm}}\)PCL formula \(\zeta \in \) PCL(DP) is said to be in full normal form if either

  1. 1.

    \(\zeta = d\), with \(d\in D\), or

  2. 2.

    there are finite index sets I and \(J_i\) for every \(i \in I,d_i \in D,\) and full monomials \(m_{i,j}\) for every \(i \in I\) and \( j \in J_i \) such that \(\zeta =\bigoplus _{i\in I}\left( d_i \otimes \sum _{j\in J_i} m_{i,j}\right) .\)

Following [16], for every full normal form we can construct an equivalent one satisfying the subsequent statements:

  1. (i)

    \(j \not = j^\prime \) implies \(m_{i,j} \not \equiv m_{i,j^\prime }\) for every \(i\in I\), \(j,j^\prime \in J_i\), and

  2. (ii)

    \(i\not = i^\prime \) implies \(\sum _{j\in J_i} m_{i,j} \not \equiv \sum _{j\in J_{i^\prime }} m_{i^\prime , j} \) for every \(i, i^\prime \in I\).

By Lemma 1 in [17], if \(m_{i,j} \equiv m_{i, j^\prime }\) for some \(j\not = j^\prime \), then we get \(m_{i,j} + m_{i,j^\prime } \equiv m_{i,j}\). So, we replace \(m_{i,j} + m_{i,j^\prime }\) by \(m_{i,j}\). For the second case, let \(\sum _{j\in J_i} m_{i,j} \equiv \sum _{j\in J_{i^\prime }} m_{i^\prime , j}\) for some \(i\not = i^\prime \). Then, we replace \( \left( d_i \otimes \sum _{j\in J_i} m_{i,j} \right) \) \( \oplus \left( d_{i^\prime } \otimes \sum _{j\in J_{i^\prime }} m_{i^\prime ,j} \right) \) by its equivalent formula \( \left( d_i \oplus d_{i^\prime } \right) \otimes \sum _{j\in J_i} m_{i,j} \). In the sequel, we assume that every full normal form satisfies Statements (i) and (ii).

For the construction of the full normal form of every \(\zeta \in PCL(D,P)\) we shall need the next results. Specifically, we omit the proofs of Lemmas 2, 3 and Proposition 7 which are similar to the corresponding ones in [16].

Lemma 2

Let J be an index set and \(m_{j}\) full monomials for every \(j\in J\). Then, there exists a unique \(\overline{\gamma }\in C(P)\) such that for every \(\gamma \in C(P)\) we have \(\left\| \sum \nolimits _{j\in J}m_{j}\right\| (\gamma )=1\) if \(\gamma =\overline{\gamma }\) and \(\left\| \sum \nolimits _{j\in J}m_{j}\right\| (\gamma )=0\), otherwise.

Proposition 7

Let f be a PCL formula over P and D a pv-monoid. Then there exist finite index sets I and \(J_{i}\) for every \(i\in I\), and full monomials \(m_{i,j}\) for every \(i\in I\) and \(j\in J_{i}\) such that

$$ f\equiv \bigoplus _{i\in I}\sum _{j\in J_{i}}m_{i,j}\equiv \bigoplus _{i\in I}\left( 1\otimes \sum _{j\in J_{i}}m_{i,j}\right) . $$

Lemma 3

Let \(m_{i},m_{j}^{\prime }\) be full monomials for every \(i\in I\) and \(j\in J\). Then,

$$\begin{aligned} \left( \underset{i\in I}{\sum }m_{i}\right) \otimes \left( \underset{j\in J}{\sum }m_{j}^{\prime }\right) \equiv \left\{ \begin{array} [c]{ll} \underset{i\in I}{\sum }m_{i} &{} \text { if }\underset{i\in I}{\sum }m_{i} \equiv \underset{j\in J}{\sum }m_{j}^{\prime },\\ 0 &{} \text { otherwise.}\end{array} \right. \end{aligned}$$

Proposition 8

Let \(d_1, d_2 \in D\) and \(\zeta _1, \zeta _2\in PCL(D,P)\). If D is left-\(\oplus \)-distribu-tive and \(\otimes \) is commutative and associative, then

$$\begin{aligned} \left( d_1 \otimes \zeta _1 \right) \uplus \left( d_2 \otimes \zeta _2 \right) \equiv d_1 \otimes d_2 \otimes (\zeta _1 \uplus \zeta _2). \end{aligned}$$

Proposition 9

Let \(m_i, m_j^\prime \) be full monomials for every \(i \in I\) and \(j\in J\). Then

Proposition 10

Let \(\zeta \in PCL(D,P)\) which is in full normal form, i.e., \(\zeta = \bigoplus _{i\in I} \left( d_i \otimes \sum _{j\in J_i} m_{i,j} \right) \). Then

  1. i.

    \(*\zeta \equiv \bigoplus _{I^\prime \subseteq I} \left( \mathrm{{val}}(d_i)_{i\in I^\prime } \otimes \left( \biguplus _{i\in I^\prime } \sum _{j\in J_i} m_{i,j} \right) \right) ,\)

  2. ii.

    \((*\zeta )\otimes \left( \biguplus _{i\in I} \sum _{j\in J_i} m_{i,j} \right) \equiv \ \mathrm{{val}}(d_1, \dots , d_{ |I| }) \otimes \left( \biguplus _{i\in I} \sum _{j\in J_i} m_{i,j} \right) . \)

Proof

i. Let \(\gamma \in C(P)\). Then we get

By Lemma 2, for every \(i\in I\) there exists a unique \(\overline{\gamma _i} \in C(P)\) such that for every \(\gamma \in C(P)\) we have \(\left\| \sum _{i\in J_i} m_{i,j} \right\| (\gamma ) = 1 \) if \(\gamma =\overline{\gamma _i}\) and \(\left\| \sum _{i\in J_i} m_{i,j} \right\| (\gamma ) = 0 \), otherwise. Hence, \(\mathrm{{val}} \left( \left\| \zeta \right\| (\gamma _1), \dots , \left\| \zeta \right\| (\gamma _n) \right) \not = 0\) when for every \(i\in \{1,\dots , n\}\) there exists \(j_i\in I\) such that \(\gamma _i = \overline{\gamma _{j_i}}\) and, by definition of \(\left\| *\zeta \right\| (\gamma )\), the sets \(\gamma _1, \dots , \gamma _n\) consist a partition of \(\gamma \). Moreover,

$$\begin{aligned} \mathrm{{val}} \left( \left\| \zeta \right\| (\overline{\gamma _{j_1}}), \dots , \left\| \zeta \right\| (\overline{\gamma _{j_n}}) \right) = \mathrm{{val}}\left( d_{j_1}, \dots , d_{j_n} \right) . \end{aligned}$$

Since \(\mathrm{{val}} \) is a symmetric function and D is idempotent, we get \(\left\| *\zeta \right\| (\gamma ) = \bigoplus _{I^{\prime \prime }\subseteq I } \mathrm{{val}} (d_i)_{i\in I^{ \prime \prime }}\) where for every \(I^{\prime \prime } \subseteq I\) it holds or equivalently \(\left\| \biguplus _{i\in I^{\prime \prime } } \sum _{j\in J_i} m_{i,j} \right\| \) \((\gamma ) = 1. \) For every other \(I^{\prime \prime \prime }\) subset of I it holds \(\left\| \biguplus _{ i\in I^{\prime \prime \prime } } \sum _{j\in J_i } m_{i,j} \right\| (\gamma )=0\). So, we get the following \( *\zeta \equiv \bigoplus _{I^\prime \subseteq I} \left( \mathrm{{val}}(d_i)_{i\in I^\prime }\right. \) \( \left. \otimes \left( \biguplus _{i\in I^\prime } \sum _{j\in J_i} m_{i,j} \right) \right) . \)

ii. Let \(\gamma \in C(P)\). Then we get

$$\begin{aligned} \left\| (*\zeta ) \otimes \left( \biguplus _{i\in I} \sum _{j\in J_i} m_{i,j} \right) \right\| (\gamma )&= \left\| *\zeta \right\| (\gamma ) \otimes \left\| \biguplus _{i\in I}\sum _{j\in J_i} m_{i,j} \right\| (\gamma ). \end{aligned}$$

We can easily prove that \(\left\| \biguplus _{i\in I}\sum _{j\in J_i} m_{i,j} \right\| (\gamma ) = 1 \) if and \(\left\| \biguplus _{i\in I} \right. \) \( \left. \sum _{j\in J_i} m_{i,j} \right\| (\gamma ) = 0 \) otherwise. If , then since D is idempotent we get \(\left\| *\zeta \right\| (\gamma ) = \mathrm{{val}}\left( d_1, \dots , d_{|I|} \right) .\) Hence,

and we are done.

Theorem 1

Let D be an associative, idempotent and \(\oplus \)-distributive pv-monoid, where \(\otimes \) is commutative. Then, for every w\(_{\text {pvm}}\)PCL formula \(\zeta \in PCL(D,P)\) we can effectively construct an equivalent w\(_{\text {pvm}}\)PCL formula \(\zeta ^\prime \in PCL(D,P)\) in full normal form which is unique up to the equivalence relation.

Proof

We prove our theorem by induction on the structure of w\(_{\text {pvm}}\)PCL formulas over P and D. Let \(\zeta = f\) be a PCL formula. Then, we conclude our claim by Proposition 7. Next let \(\zeta = d\) with \(d\in D\), then we have nothing to prove.

In the sequel, assume that \(\zeta _1,\zeta _2 \in PCL(D,P)\). In [11] we show how we can construct w\(_{\text {pvm}}\)PCL formulas \(\zeta ^{(1)}, \zeta ^{(2)}\) and \(\zeta ^{(3)}\) in full normal form which are equivalent to \(\zeta _1\oplus \zeta _2\), \(\zeta _1 \otimes \zeta _2\) and \(\zeta _1 \uplus \zeta _2\), respectively.

Finally, let \(\zeta = *\zeta _1\) and \(\zeta _1^\prime =\bigoplus _{i_1\in I_1}\left( d_{i_1} \otimes \sum _{j_1\in J_{i_1}} m_{i_1,j_1}\right) \) be its equivalent w\(_{\text {pvm}}\)PCL formula in full normal form. We consider the formula \(\zeta ^\prime = *\zeta _1^\prime \). By Proposition 10, \(\zeta ^\prime \) can be equivalently written as follows

$$\begin{aligned} \zeta ^\prime \equiv \bigoplus _{I_1^\prime \subseteq I_1} \left( \mathrm{{val}}(d_{i_1})_{i_1\in I_1^\prime } \otimes \left( \biguplus _{i_1\in I_1^\prime } \sum _{ j_1\in J_{i_1} } m_{i_1,j_1} \right) \right) . \end{aligned}$$

We consider the sets \(I_1^{(1)}, \dots ,I_1^{(k)} \) with \(k \in \mathbb {N}\) to be an enumeration of all \(I_1^\prime \)’s such that \(\biguplus _{i_1\in I_1^\prime } \sum _{ j_1\in J_{i_1} }\) \( m_{i_1,j_1} \not \equiv 0.\) Hence, by Proposition 9, \(\biguplus _{i\in I_1^{(s)}} \sum _{j\in J_i}m_{i,j} \equiv \sum _{i\in I_1^{(s)}} \sum _{j\in J_i}m_{i,j} \) for every \(s\in \{1, \dots , k\}\). Moreover, for every \(s\in \{1, \dots , k \}\) we let \(d_s^\prime = \mathrm{{val}}(d_i)_{i\in I_1^{(s)}} \). So,

$$\begin{aligned} \zeta ^\prime \equiv \bigoplus _{s\in \{1, \dots , k\}} \left( d_s^\prime \otimes \left( \sum _{i\in I_1^{(s)}} \sum _{j\in J_i} m_{i,j} \right) \right) . \end{aligned}$$

Lastly, if \( \sum _{i\in I_1^{(s)}} \sum _{j\in J_i} m_{i,j} \not \equiv \sum _{i\in I_1^{(s^\prime )}} \sum _{j\in J_i} m_{i,j} \) for every \(s, s^\prime \in \{1, \dots , k\}\) with \(s\not = s^\prime \), then we are done. However, let \(\sum _{i\in I_1^{(s)}} \sum _{j\in J_i} m_{i,j} \equiv \sum _{i\in I_1^{(s^\prime )}} \sum _{j\in J_i} \) \(m_{i,j}\) for some \(s\not =s^\prime \). Then, we replace \(\left( d_s^\prime \otimes \left( \sum _{i\in I_1^{(s)}} \sum _{j\in J_i} m_{i,j} \right) \right) \oplus \left( d^\prime _{s^\prime } \otimes \left( \sum _{i\in I_1^{(s^\prime )}} \sum _{j\in J_i} m_{i,j} \right) \right) \) by its equivalent formula \((d^\prime _s \oplus d^\prime _{s^\prime }) \otimes \sum _{i\in I_1^{(s)}} \sum _{j\in J_i} m_{i,j}. \) We conclude to a full normal form which by construction, it is equivalent to \(\zeta .\)

The uniqueness of \(\zeta ^{(1)},\) \(\zeta ^{(2)},\) \(\zeta ^{(3)}\) and \(\zeta ^\prime \), up to equivalence, is derived in a straightforward way using Statements (i) and (ii).

In the sequel, we present an example where we compute the full normal form of a w\(_{\text {pvm}}\)PCL formula.

Example 1

Let P be the set of ports and D a pv-monoid which satisfies the properties of Theorem 1. We consider the w\(_{\text {pvm}}\)PCL formula

$$\begin{aligned} \zeta = \left( (d_1 \otimes m_1) \uplus (d_2 \otimes (m_2 \oplus m_3)) \right) \oplus (d_3 \otimes (m_4 + m_5)) \end{aligned}$$

where \(d_1, d_2, d_3 \in D\) and \(m_i\) is a full monomial over P for every \(i\in \{1, \dots , 5\}\). We will compute the full normal form of \(\zeta ^\prime = *\zeta .\) Firstly, we compute the full normal form of \(\zeta \).

$$\begin{aligned} \zeta&\equiv \left( (d_1\otimes d_2) \otimes (m_1 +m_2) \right) \oplus \left( (d_1\otimes d_2) \otimes (m_1 +m_3) \right) \oplus (d_3 \otimes (m_4 + m_5)). \end{aligned}$$

By Proposition 10 we get

which is in full normal form.

Theorem 2

Let D be an associative, idempotent and \(\oplus \)-distributive pv-monoid, where \(\otimes \) is commutative, and P a finite nonempty set of ports. Then for every \(\zeta ,\xi \in PCL(D,P)\) the equality \(\Vert \zeta \Vert =\Vert \xi \Vert \) is decidable.

Proof

We follow the proof of Theorem 26 in [16]. By Theorem 1 we can effectively construct w\(_{\text {pvm}}\)PCL formulas \(\zeta ',\xi '\) in full normal form such that \(\Vert \zeta \Vert =\Vert \zeta '\Vert \) and \(\Vert \xi \Vert =\Vert \xi '\Vert \). Let us assume that \(\zeta '=\bigoplus _{i\in I}\left( d_{i}\otimes \sum _{j\in J_{i}}m_{i,j}\right) \) and \(\xi '=\bigoplus _{l\in L}\left( d'_{l}\otimes \sum _{r\in M_l}m'_{l,r}\right) \) which moreover satisfy Statements (i) and (ii). Then, by Statement (ii) we get that \(\Vert \zeta '\Vert =\Vert \xi '\Vert \) iff the following requirements (1)–(3) hold:

  1. 1)

    \(\mathrm {card}(I)=\mathrm {card}(L)\),

  2. 2)

    \(\{d_i \mid i \in I \}= \{d'_l \mid l\in L \}\), and

  3. 3)
    1. a)

      if \(\mathrm {card}(I)= \mathrm {card}(\{d_i \mid i \in I \})\), then \(\sum _{j\in J_{i}}m_{i,j} \equiv \sum _{r\in M_l}m'_{l,r}\) for every \(i \in I\) and \(l \in L\) such that \(d_i=d'_l\),

      or

    2. b)

      if \(\mathrm {card}(I)>\mathrm {card}(\{d_i \mid i \in I \})\), then we get

      \(\zeta ' \equiv \bigoplus _{i'\in I'}\left( d_{i'}\otimes \bigsqcup _{i\in R_{i'}}\sum _{j\in J_{i}}m_{i,j}\right) \) where \(I' \varsubsetneq I\), \(d_{i'}\)’s (\(i' \in I'\)) are pairwise disjoint, and \(R_{i'}\) (\(i' \in I'\)) is the set of all i in I such that \(d_i=d_{i'}\). Similarly, we get \(\xi ' \equiv \bigoplus _{l'\in L'}\left( d'_{l'}\otimes \bigsqcup _{l\in S_{l'}}\sum _{r\in M_l}m'_{l,r}\right) \) where \(L' \varsubsetneq L\), \(d'_{l'}\)’s (\(l' \in L'\)) are pairwise disjoint, and \(S_{l'}\) (\(l' \in L'\)) is the set of all l in L such that \(d'_{l}=d'_{l'}\). Then \(\bigsqcup _{i\in R_{i'}}\sum _{j\in J_{i}}m_{i,j} \equiv \bigsqcup _{l\in S_{l'}}\sum _{r\in M_l}m'_{l,r}\) for every \(i' \in I'\) and \(l' \in L'\) such that \(d_{i'}=d'_{l'}\).

By Lemma 2 the decidability of equivalences in (3a) is reduced to decidability of equality of sets of interactions corresponding to full monomials, whereas the decidability of equivalences in (3b) is reduced to the decidability of equality of sets whose elements are sets of interactions corresponding to full monomials.

6 Examples

In this section, we provide w\(_{\text {pvm}}\)PCL formulas which describe well-known architectures equipped with quantitative features. But first, we introduce a new symbol which we use in order to simplify the form of the formulas in our examples.

Let \(\zeta \) be a w\(_{\text {pvm}}\)PCL formula. By Theorem 1, \(\zeta \) can be written in full normal form, hence \(\zeta \equiv \bigoplus _{i\in I} \left( d_i\otimes \sum _{j\in J_i}m_{i,j} \right) \). We define the full valuation \(\circledast \zeta \) of \(\zeta \) by:

  • \(\circledast \zeta : = \left( *\zeta \right) \otimes \left( \biguplus _{i\in I}\sum _{j\in J_i} m_{i,j} \right) .\)

Then, by Proposition 10 we get \(\circledast \zeta \equiv \mathrm{{val}}(d_1, \dots , d_{ |I| }) \otimes \left( \biguplus _{i\in I} \sum _{j\in J_i} m_{i,j} \right) .\)

Example 2

We recall from [13] the Master/Slave architecture for two masters \(M_1, M_2\) and two slaves \(S_1, S_2\) with ports \(m_1, m_2\) and \(s_1, s_2\), respectively. Masters can interact only with slaves, and vice versa, and each slave can interact with only one master. In the following we present four different w\(_{\text {pvm}}\)PCL formulas, which according to the underlying pv-monoid we get interesting results.

The monomial \(\phi _{i,j} = m_{ \{ s_i, m_j \} }\) for every \(i,j \in \{ 1,2 \}\) represents the binary interaction between the ports \(s_i\) and \(m_j\). For every \(i,j\in \{ 1,2 \}\) we consider a value \(d_{i,j} \in D\) and the w\(_{\text {pvm}}\)PIL formula \(\varphi _{i,j} = d_{i,j} \otimes \phi _{i,j} \). Hence, \(d_{i,j} \) can be considered as the “cost” for the implementation of the interaction \(\{ s_i,m_j \}\). For our example we consider the configuration set \(\gamma =\{ \{s_1,m_1\}, \{s_1,m_2\}, \{s_2,m_1\}, \{s_2,m_2\} \}\) and the pv-monoid \((\mathbb {R}\cup \{-\infty \}, \max , \) \( \mathrm{{avg}}, +, \) \(-\infty , 0)\).

Let us assume that we want to compute the average cost of each of the possible architectures and then the maximum of those values. We consider the w\(_{\text {pvm}}\)PCL formula

$$\begin{aligned} \zeta&= \sim \bigoplus _{i,j \in \{1,2\}} \circledast \left( \varphi _{1,i} \oplus \varphi _{2,j} \right) . \end{aligned}$$

Then, the value

$$\begin{aligned} \left\| \zeta \right\| (\gamma )&= \left\| \sim \bigoplus _{i,j \in \{1,2\}} \circledast \left( \varphi _{1,i} \oplus \varphi _{2,j} \right) \right\| (\gamma ) \\&= \max \left\{ \mathrm{{avg}} (d_{1,1}, d_{2,1}) , \mathrm{{avg}} (d_{1,1}, d_{2,2}) , \mathrm{{avg}} (d_{1,2}, d_{2,1}) , \mathrm{{avg}} (d_{1,2}, d_{2,2}) \right\} \end{aligned}$$

computes the average cost for each of the four possible instances and then the maximum of those values. It is interesting to note that \(\left\| \zeta \right\| (\gamma ) = \left\| \zeta \right\| (\gamma ^\prime )\) for every \(\gamma ^\prime \in C(P)\) with \(\gamma \subseteq \gamma ^\prime . \)

Moreover, let the following w\(_{\text {pvm}}\)PCL formula

$$\begin{aligned} \zeta&= \bigotimes _{i,j \in \{1,2\}} \sim \left( \circledast \left( \varphi _{1,i} \oplus \varphi _{2,j} \right) \right) . \end{aligned}$$

Then, the value

$$\begin{aligned} \left\| \zeta \right\| (\gamma )&= \mathrm{{avg}}(d_{1,1}, d_{2,1}) + \mathrm{{avg}}(d_{1,2}, d_{2,1}) + \mathrm{{avg}}(d_{1,1}, d_{2,2}) + \mathrm{{avg}}(d_{1,2}, d_{2,2}) \end{aligned}$$

is the sum of the average costs of all architecture schemes.

As a third case, we want to compute the slave which has the maximum average cost with the existing masters. Therefore, we consider the following w\(_{\text {pvm}}\)PCL formula:

$$\begin{aligned} \zeta&= \sim \bigoplus _{ i\in \{1,2\} } \left( \circledast \left( \varphi _{i,1} \oplus \varphi _{i,2} \right) \right) . \end{aligned}$$

Then we get

$$\begin{aligned} \left\| \zeta \right\| (\gamma )&= \left\| \sim \bigoplus _{ i\in \{1,2\} } \left( \circledast \left( \varphi _{i,1} \oplus \varphi _{i,2} \right) \right) \right\| (\gamma ) = \max \{ \mathrm{{avg}} (d_{1,1}, d_{1,2}) , \mathrm{{avg}} (d_{2,1}, d_{2,2}) \} \end{aligned}$$

which is the wanted outcome.

Fig. 1.
figure 1

Weighted Publish/Subscribe architecture.

Example 3

Publish/Subscribe is a software architecture used in development of applications in IoT [14], cloud computing [19] and robots’ operating systems [12]. It has three types of components namely, publishers, topics, and subscribers denoted by the letters PTS, respectively (cf. [9, 10, 17]). Publishers send messages to subscribers but they do not have any information about subscribers and vice versa. So, in order to send messages, publishers characterize messages according to classes/topics. Subscribers, on the other hand, express their interest in one or more topics and receive all messages which have been published to the topics to which they subscribe (Fig. 1).

In our example we assign weights, describing priorities, to interactions among publishers and topics, and to interactions among topics and subscribers. Component P has one port p, T has two ports \(t_{1}\) and \(t_{2}\), and S has the port s. We assume two publisher components \(P_1, P_2\), four subscriber components \(S_1, S_2, S_3, S_4\) and three topic components \(T_1, T_2, T_3\). Hence, the set of ports is \(P=\left\{ p_1,p_2, s_1, s_2, s_3, s_4, t_{11}, t_{12}, t_{21}, t_{22}, t_{31}, t_{32} \right\} \). For every \(i\in \{1,2,3,4\}\), \(j\in \{1,2,3\}\) and \(k\in \{ 1,2 \}\) we denote by \(d_{s_i,t_{j2}} \in D\) the weight of the interaction among \(S_i\) and \(T_j\), i.e., the priority that the subscriber \(S_i\) assigns to the receivement of a message from \(T_j\), and by \(d_{p_k,t_{j1}} \in D\), the weight of the interaction among \(P_k\) and \(T_j\), i.e., the priority that the topic \(T_j\) assigns to the receivement of a message from \(P_k.\)

In the sequel, we develop w\(_{\text {pvm}}\)PCL formulas whose semantics compute the maximum average priority with which a subscriber will receive a message and also the maximum most frequent priority of each topic. For every \(i\in \{1,2\}\) and \(j\in \{ 1,2,3 \}\), the w\(_{\text {pvm}}\)PIL formula \(\varphi _{pt}(p_i, t_{j1}) = d_{ p_i,t_{j1} } \otimes m_{ \{ p_i, t_{j1} \} }\) characterizes the interaction between a publisher \(P_i\) and a topic \(T_j\) with its corresponding weight. Moreover, for every \(i\in \{ 1,2,3,4 \}\) and \(j\in \{ 1,2,3 \}\), the w\(_{\text {pvm}}\)PIL \(\varphi _{ st }( s_i,t_{j2} ) = d_{s_i,t_{j2}} \otimes m_{ \{ s_i,t_{j2} \} } \) characterizes the interaction between a subscriber \(S_i\) and a topic \(T_j\) with its corresponding weight. Then, the w\(_{\text {pvm}}\)PCL formula

$$\begin{aligned} \zeta _{s_i} = \bigoplus _{ j\in \{1,2,3\} } \bigoplus _{k\in \{ 1,2 \}}\circledast \left( \varphi _{pt}(p_k, t_{j1}) \oplus \varphi _{st}(s_i,t_{j2}) \right) \end{aligned}$$

describes the behavior of subscriber \(S_i\) with publishers \(P_1, P_2\) and topics \(T_1, T_2,\) \( T_3\). Let the configuration set \(\gamma = \left\{ \{ p_i, t_{j1} \}, \{ s_k, t_{j2} \} \mid i\in \{1,2\}, j\in \{ 1,2,3 \}, k\in \right. \) \(\left. \{1,2,3,4 \} \right\} ,\) and the pv-monoid \((\mathbb {R}\cup \{-\infty \}, \max , \) \( \mathrm{{avg}}, +, -\infty , 0)\). Then the value \(\left\| \sim \zeta _{s_i}\right\| (\gamma ) \) represents the maximum average priority with which the subscriber \(S_i\) will receive a message. Also, consider the w\(_{\text {pvm}}\)PCL formula \(\zeta = \bigotimes _{i\in \{ 1,2,3,4 \}}\left( \sim \zeta _{s_i} \right) \). Then, the following value

$$\begin{aligned} \left\| \zeta \right\| (\gamma ) = \sum _{ i \in \{1,2,3,4\}} \left( \max _{j\in \{ 1,2,3 \}} \left\{ \mathrm{{avg}}(d_{p_1, t_{j1}}, d_{s_i, t_{j2}}), \mathrm{{avg}}(d_{p_2, t_{j1}}, d_{s_i, t_{j2}}) \right\} \right) \end{aligned}$$

is the sum of the values \(\left\| \sim \zeta _{s_i}\right\| (\gamma )\) for \( i \in \{ 1,2,3,4 \} \).

Moreover, let us assume that we want to erase one component of the architecture in case, for example, where the system is overloaded and needs to be ‘lightened’. Consider the case where we choose to erase a topic which is not as popular as the others. A way to do this is to compute for every topic the most frequent priorities that the publishers and subscribers give to that component and then the maximum one of those. Hence, the topic that has the minimum most frequent priority among the other topics is the least popular topic and so it can be erased. The following w\(_{\text {pvm}}\)PCL formula

$$\begin{aligned} \zeta _{t_i} = \circledast \left( \bigoplus _{j\in \{ 1,2 \}} \varphi _{pt}(p_j, t_{i1}) \oplus \bigoplus _{k\in \{ 1,2,3,4 \}} \varphi _{st}(s_k,t_{i2}) \right) \end{aligned}$$

for \(i\in \{ 1,2,3 \}\) describes the full valuation of the weighted interactions of the topic \(T_i\) with the publishers \(P_1\), \(P_2\) and the subscribers \(S_1, S_2, S_3\) and \(S_4\). Consider the configuration \(\gamma \) given above and the pv-monoid \((\mathbb {R}\cup \{ +\infty , -\infty \},\) \( \min , \mathrm{{maj}}, \max , +\infty , -\infty )\). Then,

$$\begin{aligned} \left\| \sim \zeta _{t_i} \right\| (\gamma )&= \mathrm{{maj}} \left( d_{p_1, t_{i1}}, d_{p_2, t_{i1}}, d_{s_1, t_{i2}}, d_{s_2, t_{i2}},d_{s_3, t_{i2}}, d_{s_4, t_{i2}}\right) \end{aligned}$$

for \(i\in \{ 1,2,3 \}\) is the maximum priority, among the most frequent ones, that the publishers and subscribers give to topic \(T_i\). Lastly, if we consider the w\(_{\text {pvm}}\)PCL formula

$$\begin{aligned} \zeta ^\prime = \sim \left( \zeta _{t_1} \oplus \zeta _{t_2} \oplus \zeta _{t_3} \right) , \end{aligned}$$

then \(\left\| \zeta ^\prime \right\| (\gamma ) = \min _{i\in \{1,2,3\} } \left\{ \mathrm{{maj}} \left( d_{p_1, t_{i1}}, d_{p_2, t_{i1}}, d_{s_1, t_{i2}}, d_{s_2, t_{i2}},d_{s_3, t_{i2}}, d_{s_4, t_{i2}}\right) \right\} \)

and so we erase the topic with the minimum value.

Example 4

Consider the Star architecture [13]. Star architecture is a software architecture relating components of the same type. Given a set of components one of them is considered as the central one and is connected to every other component through a binary interaction. No other interactions are permitted.

In our example we consider five components. We assume that each component has a single port, hence the set of ports is \(P=\{ s_1, s_2, s_3, s_4, s_5 \}\). We denote by \(d_{i,j} \in D\) the weight of the binary interaction between \(s_i\) and \(s_j\) for every \(i,j\in I=\{1, \dots , 5\}\) with \(i\not = j\), when \(s_i\) is considered as the central component. The w\(_{\text {pvm}}\)PIL formula characterizing this interaction, for every \(i,j\in I\) with \(i\not = j\), is given by \(\varphi _{ij} = d_{i,j} \otimes m_{\{s_i,s_j\} }\). Therefore, the w\(_{\text {pvm}}\)PCL formula

$$\begin{aligned} \zeta _i=\circledast \left( \bigoplus _{j\in I\backslash \{i\}}\varphi _{ij}\right) \end{aligned}$$

describes the full valuation of the binary interactions of the central component \(s_i\) with the rest of all other components. Next, consider the w\(_{\text {pvm}}\)PCL formula \(\zeta = \sim \left( \bigoplus _{ i \in I } \zeta _i\right) \) which describes the five alternative versions of the Star architecture. Let \(\gamma = \{ \{s_i,s_j\}/\ i,j \in I \) and \(i\ne j\}\) and \((\mathbb {R} \) \( \cup \) \(\{+\infty \}, \min , \mathrm{{avg}}, +, +\infty , 0)\). Then we get

$$\begin{aligned} \left\| \zeta \right\| (\gamma )&=\min \{ \mathrm{{avg}} (d_{1,2},d_{1,3},d_{1,4},d_{1,5}),...,\mathrm{{avg}} (d_{5,1},d_{5,2},d_{5,3},d_{5,4})\} \end{aligned}$$

which is the minimum value among the average costs of each component when it is considered as the central one.

7 Discussion

In our definition of w\(_{\text {pvm}}\)PIL and w\(_{\text {pvm}}\)PCL over P and D, we excluded, following [13], the empty interaction and the empty set of interactions. The empty interaction satisfies only the PIL formula false. If we consider the empty interaction, then several properties do not hold in PCL of [13]. For instance the equivalence \(f + \mathrm {false} \equiv \mathrm {false}\) (Proposition 4.4 in [13]) for \(f \not \equiv \mathrm {false}\), which is used in the computation of the full normal form of a PCL formula (more specifically in proof of Proposition 4.19 and in turn in proof of Proposition 4.35 in [13]). Hence, it is clear that if we consider the empty interaction and the empty set of interactions, then we need to rebuilt not only our theory but also the theory of PCL. Moreover, the empty interaction adds no value in single interactions but it does in architectural composition (cf. for instance [2, 3]), where it represents the case where two architectures cannot be composed. However, this is beyond the scope of this paper.

In our logic we consider the algebraic structure of product valuation monoids. The semantics of w\(_{\text {pvm}}\)PCL formulas are polynomials with values in the product valuation monoid. In Theorem 1 we prove that for every w\(_{\text {pvm}}\)PCL formula \(\zeta \in PCL(D,P)\), where D satisfies specific properties, we can effectively construct an equivalent w\(_{\text {pvm}}\)PCL formula \(\zeta ^\prime \in PCL(D,P)\) in full normal form. For this, we require D to be an associative, idempotent and \(\oplus \)-distributive pv-monoid, where \(\otimes \) is commutative. We need to clarify that a pv-monoid D satisfying those properties is not a semiring since a pv-monoid contains a valuation function which can not be supported by the structure of semirings. For instance, let the pv-monoid \((\mathbb {R}\,\cup \,\{-\infty \}, \max , \) \( \mathrm{{avg}}, +, \) \(-\infty , 0)\) which is associative, idempotent, \(\oplus \)-distributive and the operator \(+\) is commutative. The valuation function \(\mathrm {avg}\) can not be written using the operations \(\max \) and \(+\) of the semiring \((\mathbb {R}\cup \{-\infty \}, \max , +, \) \(-\infty , 0)\). Hence, the pv-monoids satisfying the above properties constitute a different structure than the one of semirings.

8 Conclusion

We introduced a weighted PCL over a set of ports and a pv-monoid, and investigated several properties of the class of polynomials obtained as semantics of this logic with the condition that our pv-monoid satisfies specific properties. We proved that for every w\({_{\text {pvm}}}\)PCL formula \(\zeta \) over a set of ports P and a pv-monoid D which is associative, \(\oplus \)-distributive, idempotent and \(\otimes \) is commutative, we can effectively construct an equivalent one \(\zeta ^\prime \) in full normal form. This result implied the decidability of the equivalence problem for w\(_{\text {pvm}}\)PCL formulas. Lastly, we provided examples describing well-known software architectures with quantitative characteristics such as the average cost of an architecture or the maximum most frequent priority of a component in the architecture. These are important properties which can not be represented by the framework of semirings in [17]. Future work includes the investigation of the complexity for the construction of full normal form for formulas in our logic and the time needed for that construction using the Maude rewriting system [1]. Furthermore, it would be interesting to study the first-order level of w\(_{\text {pvm}}\)PCL for the description of architecture styles with quantitative features.