6. APLICACIÓN DE LA METODOLOGÍA DEL SISTEMA DE GESTIÓN
6.2 LA COOPERATIVA RUMIÑAHUI
6.2.9 PROCESO DE CONTRATACIÓN Y EJECUCIÓN
Distributed protocols often exhibit symmetric behavior, e.g., the behavior of the state machines in Peterson’s mutual exclusion algorithm described in Section 1.2.3 exhibits symmetry. To allow the programmer to express such symmetric behavior, we use symmetric types, which are similar to thescalarsetconstruct used in the Murϕmodel checker [ID96].
A symmetric typeT ∈Tis characterized by (1) its name, and (2) its cardinality,|T|, which is a finite natural number. The only operations permitted on values of a symmetric type are comparisons for equality and disequality between two values. Given a collection of state machines parameterized by a set of symmetric types, e.g., the state machinesP0andP1in Peterson’s algorithm, the behavior of the system is required to be invariant under permutations (i.e., renaming) of the parameter values.
Given a symmetric typeT, letperm(T)be the set of all permutationsπT :T →T, over the symmetric typeT. For ease of notation, we defineπT(v) =vfor valuesv /∈T,i.e., values whose type is notT, provided that the type ofvis not an array or record type. If the type ofvis a record type, thenπT(v)is defined as the record value obtained by applyingπT on each field ofv. If the type ofvis an array type, whose index type isnotT, thenπT(v)is defined as the array value obtained by applyingπT recursively to all the elements ofv. If the type ofvis an array type
whose index type isT, thenπT(v)is defined as the value obtained by first recursively applying
πT to all the elements ofvand then permuting the array elements themselves according to πT,i.e., for allj∈T,πT(v)[πT(j)]≡πT(v[j]). Given the collection of symmetric types in the system,T1,T2, . . . ,Tn ∈B, we define the set ofsystem widepermutations,perm(TB), as the composition of the permutations over the individual types,πT1◦πT2◦ · · · ◦πTn.
esms, esm-sks and messages may be parameterized by a list of parameter variables, each of a symmetric type. The semantics of such parameterization is that there exists one
instance of the object for every possible value that the parameter variables can take. Consider a parameterized messagemhp1:T1,p2:T2, . . . ,pn:Tni. Herep1,p2, . . . ,pnare parameter
variables which can take values of types T1,T2, . . . ,Tn respectively. Then for every possi-
ble list of values hv1,v2, . . . ,vni, where vi ∈ Ti, and i ∈ [1,n], there exists an instance
mhp17→v1,p27→v2, . . . ,pn7→vni of the parameterized messagem. The semantics of a parameterizedesmoresm-skare similar, except that the parameter variablespiare available for use as read-only variables within the guards and updates of theesmoresm-sk.
Given the set of typesTBan interpretationIis said to be symmetric with respect toTBif and only if for allfu:d1,d2, . . . ,dn→r∈U, for allπ∈perm(TB), and for alle1∈d1,e2∈
d2, . . . ,en ∈dn, we have thatπ(fu(π(e1),π(e2), . . . ,π(en))) ≡fu(e1,e2, . . . ,en). Anesm
oresm-skAis said to be symmetric with respect toTB, if and only if for any interpretationI such thatIis symmetric with respect toTB, and for allπ∈perm(TB), every execution ofA underIof the form:
e,(l0,σ0)−→∗1 (l
1,σ1)−→ · · ·∗2 ∗n
−→(ln,σn) ∗n+1 −−−→ · · ·
where∗iis one ofmi?vmi ormi!vmi or, implies that thepermutedexecution of the form: π(e),(π(l1),π(σ1))−−−→π(∗1) (π(l2),π(σ2))−−−→ · · ·π(∗2) π(∗n)
−−−−→(π(ln),π(σn)) π(∗n+1) −−−−−→ · · · is also admitted byAunder the same interpretationI. Here π(∗i)
−−−→represents a transition along which the instances of messages parameterized by symmetric types and message payloads are also permuted according to the permutationπ. Further, we also require thateis a weakly (respectively, strongly) fair execution ofAif and only ifπ(e)is a weakly (respectively, strongly) fair execution ofA. In other words, we require the strong and weak fairness assumptions onA to be symmetric as well.
Our framework allows the programmer to describe protocols which are symmetric according to the notion of symmetry just described. We ensure that symmetry breaking constructs are not used by enforcing syntactic restrictions on the description ofesms andesm-sks. This is done in a manner similar to the what has been described in earlier work [ID96]. Further, we also ensure that any interpretationsIthat are generated during the process of synthesis are such that they satisfy the symmetry assumptions made on theesm-sks that they are a part of, as we shall describe in later sections.