Chapter V: Reactive Contracts
5.3 Reactive Contracts
haveEC =2π΄andMC =2π΄βπΊ. Therefore, ifC β€ C1,C2, then by Definition 5.2.3, MC β MC1β© MC2 = 2π΄1βπΊ1 β©2π΄2βπΊ2 = 2(π΄1βπΊ1)β§(π΄2βπΊ2) and 2π΄1β¨π΄2 =2π΄1 βͺ 2π΄2 =EC1βͺ EC2 β EC (since the intersection/union of powersets of two sets is the powerset of their intersection/union). By the fact that (π΄1 βπΊ1) β§ (π΄2β πΊ2) is saturated, we haveC1β§ C2= (π΄1β¨ π΄2,(π΄1β πΊ1) β§ (π΄2 βπΊ2)). By induction, we can conclude the following:
Proposition 10. If forπ=1,2, . . . , π,πΆπare assume-guarantee contracts, then
β§ππ=1Cπ =(β¨ππ=1π΄π,β§ππ=1π΄π β πΊπ). (5.5) Note that we can apply an analogous argument to the disjunction of contracts (defined as their join) to conclude that the set of all saturated contracts forms a complete lattice. Equation (5.5) shows that the βparametric contractβ formalism given in (Kim, Arcak, and Seshia, 2017) is exactly the result of applying the conjunction operation to the constituent contracts. That is, if π is an implementation of the conjunctionβ§πCπcontainingπ such thatπ βπΈ whereπΈ is an environment ofβ§πCπ, then there exists at least a π β {1,2, . . . , π} such that π β π΄π and for all such π, π β πΊπ. In other words, for any behavior π in which the environment satisfies any assumption π΄π in {π΄1, π΄2, . . . , π΄π}, the system must react by providing the corresponding guarantee πΊπ. Thus in contract conjunctions, 1) the reactions are defined by pairing each π΄π with the correspondingπΊπ, and 2) π΄π βπΊπ must hold over the sequenceπin its entirety. The second restriction is partially relaxed in the
βdynamic contractβ formalism, used for instance in (Kim, Sadraddini, et al., 2017), where assumptions are allowed to change over fixed time intervals. Our reactive contract framework will 1) remove the one-to-one restriction to allow for a more flexible assumption-guarantee pairing process, 2) enforces immediate guarantee reactions to assumption changes directly on each element π β B, and 3) enables automated synthesis.
5.3 Reactive Contracts
sequence concatenationoperator mapping from(Pref(B)ΓPref(B))βͺ(Pref(B)ΓB) to Pref(B) βͺ B.
Definition 5.3.1(Witness). Letπ β B, π΄β B andπ, π βN0βͺ {β} :π < π. We say thatπis awitnessforπ΄fromπup until πand writeπ |=πβπ π΄ifππβπ βPref(π΄) βͺπ΄. If π β β, we consider the witness relation as beingstrict and write π |=ππ βπ π΄ if π |=πβπ π΄, butπ 6|=πβπ+1 π΄. If π =β, the witness relation is always strict.
To describe and keep track of assumption changes, we appeal to the notion of assigningsignatures(or labels) to each behavior that undergoes those changes.
Definition 5.3.2 (Signature). Given a set of assertions A β 2B, an A-signature is any nonempty assertion sequence πΌ = hπΌπiπ
π=0 β Aβ where π β Nβͺ {β}. If π < β, we sayπ β B is a witness forπΌand putπ |=πΌif there exists a partitioning sequencehππiπ
π=0inN0satisfying 0=π0 < π1 < . . . < ππ such that withππ+1 B β, we have
βπ β {0,1, . . . , π}.π |=ππβππ+1 πΌπ. (5.6) We say thatπ is a strict witness for the signatureπΌand writeπ |=π πΌif the witness relation in equation (5.6) is strict. Analogously, if π = β, then π |= πΌ if there exists a (strictly monotone) partitioning sequencehππiβ
π=0inN0satisfyingπ0 =0 and equation (5.6) with{0,1, . . . , π}replaced byN0.
In general, a given π β B may be a strict witness for more than one signature in Aβ. For example, if A = {π΄1, π΄2} where π΄1 β© π΄2 β β , then any behavior π β π΄1β© π΄2 satisfies π |=π hπ΄πi for π β {1,2}. This may still be the case even when π΄1β© π΄2 =β . ForV = {π₯ , π¦}, π΄1 = {h{π₯}iβ
π=0} and π΄2 = {h{π¦}iβ
π=0} βͺ {π} whereπsatisfiesππ ={π₯}forπ =0 andππ ={π¦}, otherwise. Thenπ |=π hπ΄1, π΄2i and π |=π hπ΄2i. This non-uniqueness makes it unclear as to which assumption change sequence should be considered and how/when to properly react to it. Being able to restrict the set of assumptions so that this does not happen is necessary because in order to react at all, the system must be able to consistently detect which assumption to operate under next. The following proposition gives a necessary and sufficient condition.
Proposition 11. LetAbe a collection of assertions, then
βπΌ, π½β Aβ.βπ β B.(π |=π πΌβ§π |=π π½) βπΌ= π½, (5.7)
if and only if
βπ΄1, π΄2β A. π΄1β π΄2βPref1(π΄1) β©Pref1(π΄2) =β . (5.8) Proof. First, assume thatAdoes not satisfy Formula (5.8). Let π΄1, π΄2be such that π΄1 β π΄2and Pref1(π΄1) β©Pref1(π΄2) β β . Observe that for anyπ βN0andπ β B, if π0βπ+1 βPrefπ+1(π΄1) β©Prefπ+1(π΄2) thenπ0βπ β Prefπ(π΄1) β©Prefπ(π΄2). Hence, eitherπ΄1β©π΄2β β , in which case (5.7) clearly does not hold, or there exists aπ0β₯ 1 such that Prefπ0(π΄1)β©Prefπ0(π΄2) β β and Prefπ0+1(π΄1)β©Prefπ0+1(π΄2) =β . Letπ0β Prefπ0(π΄1) β©Prefπ0(π΄2)andπ1 β π΄1,π2β π΄2be such that π10βπ0 =π20βπ0 =π0. If for all 0 < π < π0, we haveπ0
π = π0
0, then hπ0
0iβ
π=0 |=π hπ΄1ior hπ0
0iβ
π=0 |=π hπ΄1iβ
π=0
while hπ0
0iβ
π=0 |=π hπ΄2i or hπ0
0iβ
π=0 |=π hπ΄2iβ
π=0. On the other hand, if there is an 0 < π < π0 such that π0
π β π0
0, then for π00 B π0
0βπ+1 Β· π0
0βπ+1 Β· . . ., we have π00 |=π hπ΄1iβ
π=0andπ00 |=π hπ΄1iβ
π=0. Both of these cases contradict Formula (5.7).
For the other direction, assume thatAsatisfies (5.8). LetπΌ, π½β Aβandπ β Bbe such thatπ |=π πΌandπ |=π π½. Letπ β Nβͺ {β}be the length ofπΌ. By the fact thatπ0 βPref1(πΌ0) β©Pref1(π½0)andβπ΄ β A. π΄β πΌ0 βPref1(π΄) β©Pref1(πΌ0)=β , we conclude that πΌ0 = π½0. Suppose that up toπ < π, πΌπ = π½π for all π satisfying 0 β€ π β€ π. We will show thatπΌπ+1and π½π+1are defined and equal to one another.
Indeed, since π < π, the (π + 1)th term of πΌ, πΌπ+1, exists. Let hππiπ
π=0 be a partitioning sequence forπ |=π πΌ given by Definition 5.3.2. By strictness and the induction hypothesis, we have ππ
πβ(ππ+1+1) 6|= πΌπ = π½π. Since π |=π π½, it follows that π½π+1 exists as well. From π |=π πΌ, ifπ+2 β€ π, we have π |=ππ
π+1βππ+2
πΌπ+1 and, in particular,ππ
π+1 βPref1(πΌπ+1) β©Pref1(π½π+1), which by Formula (5.8) yields πΌπ+1= π½π+1. Ifπ+2> π, thenπ |=π
ππ+1ββπΌπ+1, arguing similarly, we arrive at the additional conclusion that π½also has lengthπ. This implies Formula (5.7).
AnyAthat satisfies (5.8) is calledinitially disjoint. Hence, Proposition 11 says that Ais a set of assertions that are initially disjoint if and only if any behavior is a strict witness for at most oneA-signature. LetBA B {π β B | βπΌβ Aβ.π |=π πΌ}, the set of behaviors that haveA-signatures. IfAis initially disjoint, then the function UA : BA β Aβ mapping each π β BA to the unique signature UA(π) β Aβ for which it is a witness is well-defined. Lastly, for any π β BA, we denote by UA(π) the set of signatures generated byπ, namely,{UA(π) | π β π}.
Contracts
Definition 5.3.3(Reactive contracts). A reactive assume-guarantee contractCis a 4-tuple(A,G,Ξ, π ) where
1. A,G β 2B are called theassumptionandguarantee sets, respectively. A is required to be initially disjoint.
2. Ξ β Aβ is called the contingency set, consisting of assumption change scenarios that may happen.
3. π β (A Γ G)β is called thereaction set.
Observe thatAandGare not necessarily of the same cardinality and that from each π β π , we can obtain a uniqueA-signature by βprojecting away theGdimension.β
We denote the projection function byΞ A : π β Aβ so thatΞ A(hπ΄π, πΊπiπ
π=0) B hπ΄πiπ
π=0for any hπ΄π, πΊπiπ
π=0 β π .
Definition 5.3.4(Environment). Anenvironment forC = (A,G,Ξ, π ) is any πΈ β BA such that UA(πΈ) β Ξ, namely each π β πΈ is a strict witness for some A- signature inΞ.
Thus, for a reactive contract, assumptions about its environmentβs behaviors are allowed to change according to the contingency specified inΞ. As these assumptions change, the system should provide the corresponding guarantees as specified by the reaction setπ . We characterizeπ via the following definitions.
Definition 5.3.5 (Reactive satisfaction). Let π β B, π = h(π΄π, πΊπ)iπ
π=0 β π . We say thatπ reactively satisfiesπ and writeπ |=ππ if the following hold
1. π |=π Ξ A(π) with the partitioning sequencehππiπ
π=0. 2. a) Ifπ < β, thenβπ β {0,1, . . . , π}.ππ
πβππ+1 |=πΊπ withππ+1B β;
b) otherwise,βπ βN0.ππ
πβππ+1 |=πΊπ.
Definition 5.3.6(Implementation). An implementation of a reactive contract C = (A,G,Ξ, π ) is anyπ β Bsuch that for any environmentπΈ ofC, we have
βπ β (πβ©πΈ).βπ βπ .π |=π πβ§Ξ A(π) =UA(π).
Intuitively, an implementation consists of all behaviors π in which either the as- sumptions do not change according to Ξ, i.e., UA(π) β Ξ, or the system reacts according to instructions specified by the setπ , namely there exists a reactionπ β π , such thatπreactively satisfiesπ, in which the system must satisfy the guarantee cor- responding to the current assumption for as long as the latter holds and is required to immediately adapt to any new assumption by committing itself to the corresponding new obligation. Let us compare this formalism to βstandardβ assume-guarantee contracts. First, we mention that the following holds.
Proposition 12. Corresponding to each standard assume-guarantee contract C = (π΄, πΊ) is a reactive assume-guarantee contract Cπ = (A,G,Ξ, π ) with A = {π΄},G = {πΊ},Ξ = {hπ΄i}, and π = {h(π΄, πΊ)i} such that C = Cπ in the sense that they have same sets of environments and implementations.
Recall that any parametric assume-guarantee contract is a standard assume-guarantee contract obtained by taking the conjunction of a set of standard assume-guarantee contracts. Therefore, by Proposition 12, each parametric assume-guarantee contract has a reactive version. In particular, when all assumptions are initially disjoint, we have the following generalization of Proposition 12.
Proposition 13. If π β₯ 1, {π΄1, π΄2, . . . , π΄π} is a set of initially disjoint assertions and forπ β {1,2, . . . , π}, Cπ = (π΄π, πΊπ) are assume-guarantee contracts, then there exists a reactive assume-guarantee contractCπ such thatβ§π
π=1C= Cπ. Proof. LetCπ =(A,G,Ξ, π ) be defined with
β’ A B {π΄1, π΄2, . . . , π΄π},
β’ G B {πΊ1, πΊ2, . . . , πΊπ},
β’ ΞB {hπ΄1i,hπ΄2i, . . . ,hπ΄πi},
β’ π B {h(π΄1, πΊ1)i,h(π΄2, πΊ2)i, . . . ,h(π΄π, πΊπ)i}. Then,πΈ β EC if and only if
βπ βπΈ .π β β¨ππ=1π΄π
β βπ βπΈ .βπ β {1,2, . . . , π}.π β π΄π
β βπ β πΈ .βπ β {1,2, . . . , π}.UA(π) =hπ΄πi βΞ
which holds if and only ifπΈ β ECπ. Also, π β MC β βπ β π .π β β§π
π=1(π΄π β πΊπ). Since the π΄πβs are initially disjoint, and therefore disjoint, there are two cases: eitherπ β β§π
π=1Β¬π΄π, in which caseUA(π) β Ξ, or there is an π΄π such that π β π΄πβ§πΊπ, in which case,π |=π h(π΄π, πΊπ)iandUA(π) = Ξ A(h(π΄π, πΊπ)i) = hπ΄πi.
This implies π β MCπ. On the other hand, π β MCπ implies βπ β π, either π |=π h(π΄π, πΊπ)i for someπ β {1,2, . . . , π}, which by Definition 5.3.5, shows that π β π΄πβ§πΊπ, orUA(π) β Ξ, which implies thatπ β β§π
π=1Β¬π΄π.
The following example shows the greater flexibility offered by reactive contracts over parametric ones.
Example 5.3.1. Let π΄1, π΄2 be initially disjoint and C = (π΄1β¨ π΄2,(π΄1 β πΊ1) β§ (π΄2 β πΊ2)) and ΛCπ = (AΛ,GΛ,ΞΛ,π Λ) where ΛA = {π΄1, π΄2}, ΛG = {πΊ1, πΊ2}, ΛΞ = {hπ΄1i,hπ΄2i,hπ΄1, π΄2i}, Λπ = {h(π΄1, πΊ1)i,h(π΄2, πΊ2)i,h(π΄1, πΊ1),(π΄2, πΊ2)i}. We can verify that ΛCπ Cusing the fact that by Proposition 13,C=Cπ = (A,G,Ξ, π ) where π΄ =AΛ, πΊ = GΛ, Ξ ={hπ΄1i,hπ΄2i}, and π ={h(π΄1, πΊ1)i,h(π΄2, πΊ2)i}. With the inclusion of h(π΄1, πΊ1),(π΄2, πΊ2)i in Λπ , ΛCπ is receptive to environments whose behaviors exhibit a change in assumptions from π΄1toπ΄2and requires implementa- tions to adapt accordingly by changing their guarantee fromπΊ1toπΊ2. On the other hand, Cπ only specifies the set of implementations to be those behaviors in which either neither π΄1or π΄2is satisfied or at least a pair (π΄π, πΊπ)is always satisfied.
Algebra
Let A be a set of initially disjoint assumptions andG be a set of guarantees. We can construct an algebra on the set β(A,G) of all reactive contracts obtained from A and G as follows. Let β B (A Γ G)β, the set of all (A Γ G)-signatures and Ξβ π B {π |π βββ§Ξ A(π) β Ξ} βͺπ , the set of all (A Γ G)-signatures that are either a reaction in π or have an assumption change sequence not specified in the contingency Ξ. Also, let π βΞ = {π β π | Ξ A(π) β Ξ} and Ξ\R = {πΏ β Ξ | βπ β π .Ξ A(π) β Ξ}. From these definitions, we have:
Proposition 14.IfC= (A,G,Ξ, π )is a reactive contract, thenCβ B (A,G,Ξ,Ξβ π ) satisfiesCβ =C.
Proof. First, by Definition 5.3.4, it is clear that EC = ECβ . Also, π β MC is
equivalent to
βπΈ β EC.βπ β (πβ©πΈ).βπ β π .π |=π πβ§Ξ A(π)=UA(π)
β βπΈ β ECβ .βπ β (πβ©πΈ).βπ β π .π |=π πβ§Ξ A(π)=UA(π)
β βπΈ β ECβ .βπ β (π β©πΈ).βπ βΞβ π .π |=π πβ§Ξ A(π)=UA(π) which is equivalent to π β MCβ . Note that the forward direction of the last βββ follows from the fact that π β Ξβ π . The reverse direction holds because for any π β πβ©πΈ whereπΈ β ECβ =EC, we haveUA(π) βΞ, which implies that for any π0 β {π | π β ββ§Ξ A(π) β Ξ}, we obtain π 6|=π Ξ A(π0) by the initial disjointness ofA. By the first condition of Definition 5.3.5, we haveπ 6|=π π0. Therefore, theπ
that satisfiesΞβ π must satisfyπ β π .
In light of this, we will say that a reactive contractC= (A,G,Ξ, π )is incanonical form ifπ = Ξβ π . We will also denote byπΈC,maxthe set{π β B | βπΏ βΞ. π |=π πΏ}. Observe thatMC B {π β B | π β πΈC,maxβ¨ (π β πΈC,maxβ§ βπ β π .π |=π π}) = B β {π β B | π β πΈC,maxβ§ Β¬(βπ β π .π |=π π)} = B β {π β πΈC,max | Β¬(βπ β π .π |=π π)}. In the following, forπ β {1,2}, let Cπ = (A,G,Ξπ, π π) be canonical reactive contracts. The next lemma follows from the fact thatAis initially disjoint:
Lemma 1. Ξ2 βΞ1βπΈC
2,max β πΈC
1,max. Proof. Assume thatπΈC
2,max β πΈC
1,max. For any πΏ β Ξ2, choose aπ β B such that π |=π πΏ. By Definition 5.3.4, π β πΈC
2,max and therefore π β πΈC
1,max. Since A is initially disjoint, by Proposition 5.8, any πΏ0 β Ξ1 such that π |=π πΏ0 must satisfy πΏ =πΏ0. Thus,πΏ βΞ1. The other direction follows directly from the definition of the πΈC
π,maxβs.
Proposition 15. (Ξ2 β Ξ1β§π 1 β π 2) β C1 C2. Proof. We haveπΈ β EC2 βπΈ β πΈC
2,max
πΏ ππ π π1
β πΈ β πΈC
1,max βπΈ β EC1. On the other hand, π β MC1 β π β B β {π β πΈC
1,max | Β¬(βπ β π 1.π |=π π)} πΏ ππ π πβ 1 π β B β {π β πΈC
2,max | Β¬(βπ β π 1.π |=π π)} π 1ββπ 2 π β B β {π β πΈC
2,max |
Β¬(βπ β π 2.π |=π π)} βπ β MC2.
Lemma 2. C1 C2β βC0
2 ββ(π΄,πΊ).EC0
2 =EC2β§MC0
2 =MC2β§Ξ0
2 β Ξ1β§π 1 β π 0
2. Proof. We claim that C0
2 can be obtained by lettingΞ02 B Ξ2 and π 0
2 B π 1βͺπ 2. Then, clearly, EC0
2 = EC2, π 1 β π 0
2. Since C1 C2, we have EC2 β EC1, and in
particular, πΈC
2,max β EC1. This implies that πΈC
2,max β πΈC
1,max asβπΈ β EC1. πΈ β πΈC
1,max. HenceΞ02 = Ξ2 β Ξ1. Now since MC1 β MC2, we have {π β πΈC
2,max |
Β¬(βπ β π 2.π |=π π)} β {π β πΈC
1,max | Β¬(βπ β π 1.π |=π π)}. In particular, becauseπΈC
2,max β πΈC
1,max,βπ βπΈC
2,max.Β¬(βπ β π 2.π |=ππ) β Β¬(βπ β π 1.π |=π π). Thereforeβπ β πΈC
2,max.Β¬(βπ β π 2.π |=π π) β Β¬(βπ β π 1βͺπ 2.π |=π π).
Therefore,MC0
2 =MC2.
A reaction setR is said to beunambiguousfor a contingency setΞif for eachπΏ βΞ, there is at most oneπ β π withΞ A(π) =πΏ.
Proposition 16. If π 1βΞ
1 βͺπ 2βΞ
2is unambiguous forΞ1βͺΞ2, thenC =C1β§ C2 B (A,G,Ξ1βͺΞ2, π 1β©π 2)is the infimum for C1andC2inβ(A,G).
Proof. It is not hard to see that C is a canonical reactive contract in β(π΄,πΊ). The main thing to check here is that ifπ ββandΞ A(π) β Ξ1βͺΞ2, thenπ β π 1β©π 2. Indeed, sinceΞ A(π)β Ξ1β§Ξ A(π) β Ξ2, we haveπ β π 1β§π β π 2sinceC1andC2 are canonical. By Proposition 15, we haveC C1andC C2. Next, we will show that, if π is a behavior such that {π} β MC1 β© MC2, then {π} β MC. Because any subset of an implementation is also an implementation, this will imply that MC1β© MC2 β MCand henceMC1β© MC2 =MC. Ifπ βBA orUA(π) β Ξ1βͺΞ2, then this is obvious. Suppose therefore that UA(π) β Ξ1 βͺΞ2. Consider the following cases:
1. Without loss of generality, suppose that π β Ξ1 and π β Ξ2. Then since {π} β MC1, there is anπ β π 1 such thatπ |=π π. SinceΞ A(π) β Ξ2 by the initial disjointness of A and π 2 is in canonical form, we have π β π 2 and thereforeπ βπ 1β©π 2.
2. π βΞ1β©Ξ2, then there areπ1 βπ 1andπ2β π 2such thatπ |=ππ1β§π |=π π2. By the unambiguity assumption, we haveπ1=π2. Therefore,{π} β MC. Let C0 = (A,G,Ξ0, π 0) be such that C0 C1 and C0 C2. This implies that MC0 β MC1β© MC2. By the initial disjointness ofA, we haveΞ1β©Ξ2 β Ξ0. Since CsatisfiesMC =MC1β© MC2andΞ1β©Ξ2= ΞandEC0 is monotone inΞ0, we have
C0 C.
Proposition 17. C =C1β¨ C2 B (A,G,Ξ1β©Ξ2, π 1βͺπ 2) is the supremum forC1 andC2inβ(A,G).
Proof. LetC0 = (A,G,Ξ0, π 0) be such that C1 C0and C2 C0. Applying (the proof of) Lemma 2 twice, we obtain the contract (A,G,Ξ0, π 0βͺπ 1βͺπ 1) that is equal to C. In addition, since EC0 β EC1 and EC0 β EC2, Ξ0 β Ξ1 β©Ξ2. By Proposition 15, we have C1 C, C2 C, and C C0. Since C0 is an arbitrary
upper bound, we are done.
Finally, for composing reactive contracts, we have the following proposition.
Proposition 18. Ifπ 1βΞ
1βͺπ 2βΞ
2 is unambiguous forΞ1βͺΞ2, thenC=C1β C2 B (A,G,(Ξ1 β©Ξ2) βͺ Ξ1\π 1 βͺ Ξ2\π 2), π 1 β© π 2) is the least contract that has the composition property, namely, for any π1 β MC1, π2 β MC2, and πΈ β EC, we have π1β π2 β MC, π1β πΈ β EC2, andπ2βπΈ β EC1.
Proof. Letπ β π1βπ2andπΏ β (Ξ1β©Ξ2) βͺΞ1\π 1βͺΞ2\π 2such thatπ |=π πΏ. Then asπ β π1andπ β π2,πΏ βΞ1β©Ξ2, and there existπ1 βπ 1andπ2 β π 2such that π |=ππ1withΞ A(π1)=πΏandπ |=ππ2withΞ A(π2)=πΏ. By the initial disjointness of A and the unambiguity assumption onC1and C2, we haveπ1 =π2 β π 1β©π 2. Therefore{π} β MC. This implies π1β π2 β MC. Now, letπ β π1βπΈ. Then there existsπΏ β (Ξ1β©Ξ2) βͺΞ2\π 2 such that π |=π πΏ. As (Ξ1β©Ξ2) βͺΞ2\π 2 β Ξ2, clearly {π} β EC2, which implies π1β πΈ β EC2. Arguing similarly, we also have π2β πΈ β EC1. This shows that Chas the composition property. Suppose that C0 also has the composition property, then Ξ0 β Ξ. Indeed, suppose that there is a πΏ β Ξ0 such that πΏ β (Ξ1 β©Ξ2) βͺΞ1\π 1 βͺΞ2\π 2. Let π |=π πΏ. If πΏ β Ξ1βͺΞ2. Then clearly, {π} β MC1 β© EC0. However, π β EC2. Suppose on the other hand thatπΏ βΞ1βͺΞ2. Without loss of generality, assume thatπΏ βΞ1. Then the fact that πΏ β Ξ1β©Ξ2 impliesπΏ β Ξ2 and {π} β EC2. Furthermore, π β Ξ1\π 1 means that {π} β MC1 β© EC0, a contradiction. Next, we will show thatMC β MC0. Indeed, the requirement that for any π1 β MC1andπ2 β MC2, π1βπ2β MC0 (implying MC1β© MC2 β MC0) will enforce this. It suffices to show that for anyπ β Bsuch that{π} β MC, we have{π} β MC1β© MC2. We will prove the contrapositive. Let π β B be such that {π} βMC1 β© MC2. Let us show{π} βMC. Without loss of generality, assume that {π} β MC1. Then there is a πΏ β Ξ1\π 1 such that π |=π πΏ. But this implies that there exists no π β π 1β© π 2 such that π |=π π. Therefore, {π} β MC. Thus,C0satisfiesMC β MC0 andΞ0 β Ξ. SinceEC0 is monotone in Ξ0, Cis indeed the least contract with the composition property.
In the next section, we will show how this formalism can be applied to reactive synthesis.