Skip to main content

Preserving Contract Satisfiability Under Non-monotonic Composition

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 10854))

Abstract

A contracts theory embeds non-monotonic composition (with respect to implementation) if the fact that a composition of two components implements a specification \(\mathcal {S}\) does not generally follow from one of these components implementing \(\mathcal {S}\). In contrast to monotonic composition, non-monotonic composition offers the additional expressiveness of specifying properties that only hold locally for a component since non-monotonic composition does not enforce all properties to be preserved when composing. Despite that this additional expressiveness is clearly needed, it implies that cases where monotony is indeed desired needs to be managed explicitly. The present paper elaborates on this topic by introducing a contracts theory embedding non-monotonic composition, and exploring conditions for ensuring monotonic composition in the context of this theory.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

References

  1. Bauer, S.S., David, A., Hennicker, R., Guldstrand Larsen, K., Legay, A., Nyman, U., Wąsowski, A.: Moving from specifications to contracts in component-based design. In: de Lara, J., Zisman, A. (eds.) FASE 2012. LNCS, vol. 7212, pp. 43–58. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-28872-2_3

    Chapter  Google Scholar 

  2. Benveniste, A., Caillaud, B., Ferrari, A., Mangeruca, L., Passerone, R., Sofronis, C.: Multiple viewpoint contract-based specification and design. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2007. LNCS, vol. 5382, pp. 200–225. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-92188-2_9

    Chapter  MATH  Google Scholar 

  3. Benveniste, A., Caillaud, B., Nickovic, D., Passerone, R., Raclet, J.B., Reinkemeier, P., Sangiovanni-Vincentelli, A., Damm, W., Henzinger, T., Larsen, K.G.: Contracts for system design. Rapport de recherche RR-8147, INRIA, November 2012. http://hal.inria.fr/hal-00757488

  4. Benveniste, A., Caillaud, B., Passerone, R.: Multi-viewpoint state machines for rich component models. In: Nicolescu, G., Mosterman, P. (eds.) Model-Based Design for Embedded Systems, pp. 487–518. Taylor & Francis (2009). http://www.google.se/books?id=8Cjg2mM-m1MC

  5. Brookes, S.D., Hoare, C.A.R., Roscoe, A.W.: A theory of communicating sequential processes. J. ACM 31(3), 560–599 (1984). http://doi.acm.org/10.1145/828.833

  6. Cimatti, A., Tonetta, S.: A property-based proof system for contract-based design. In: 2012 38th Euromicro Conference on Software Engineering and Advanced Applications, pp. 21–28, September 2012

    Google Scholar 

  7. Dill, D.L.: Trace theory for automatic hierarchical verification of speed-independent circuits. In: Proceedings of the Fifth MIT Conference on Advanced Research in VLSI, pp. 51–65. MIT Press, Cambridge (1988). http://dl.acm.org/citation.cfm?id=88056.88061

  8. Hoare, C.A.R.: An axiomatic basis for computer programming. Commun. ACM 12(10), 576–580 (1969). http://doi.acm.org/10.1145/363235.363259

  9. Maier, P.: A set-theoretic framework for assume-guarantee reasoning. In: Orejas, F., Spirakis, P.G., van Leeuwen, J. (eds.) ICALP 2001. LNCS, vol. 2076, pp. 821–834. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-48224-5_67

    Chapter  Google Scholar 

  10. Meyer, B.: Applying “Design by Contract”. IEEE Comput. 25, 40–51 (1992)

    Article  Google Scholar 

  11. Negulescu, R.: Process spaces. In: Proceedings of the 11th International Conference on Concurrency Theory, CONCUR 20000, pp. 199–213. Springer, London (2000). http://dl.acm.org/citation.cfm?id=646735.701627

  12. Quinton, S., Graf, S.: Contract-based verification of hierarchical systems of components. In: Sixth IEEE International Conference on Software Engineering and Formal Methods, SEFM 2008, pp. 377–381, November 2008

    Google Scholar 

  13. Westman, J., Nyberg, M.: Conditions of contracts for separating responsibilities in heterogeneous systems. Form. Methods Syst. Des. 52(2), 147–192 (2017). https://doi.org/10.1007/s10703-017-0294-7

  14. Wolf, E.S.: Hierarchical models of synchronous circuits for formal verification and substitution. Ph.D. thesis. Stanford University, Stanford, CA, USA (1996). uMI Order No. GAX96-12052

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jonas Westman .

Editor information

Editors and Affiliations

A  Propositions and Lemmas

A  Propositions and Lemmas

The following two lemmas are used to prove Propositions 1 and 2, which follow after the lemmas.

Lemma 2

For any two sets of variables X and Y, it holds that

Proof

Consider an arbitrary . In accordance with Definition 3, this means that \(\exists \mu \, . \, \omega [Y] = \mu [Y] \wedge \mu \in \{ \omega '\in \varOmega | \omega '[X] = \nu [X], \nu \in \mathsf {B}\}\). This can be rewritten as \(\exists \nu \exists \mu \, . \, \omega [Y] = \mu [Y] \wedge \mu [X]= \nu [X] \wedge \nu \in \mathsf {B}\). Since \(X\cap Y \subseteq X\) and \(X\cap Y \subseteq Y\), and \(\mu [X]= \nu [X]\) and \(\omega [Y] = \mu [Y]\), it holds that \(\mu [X\cap Y]= \nu [X\cap Y]\) and \(\omega [X\cap Y] = \mu [X\cap Y]\), which also means that \(\omega [X\cap Y]=\nu [X\cap Y]\). Thus, it holds \(\exists \nu \, . \, \omega [X\cap Y] = \nu [X\cap Y] \wedge \nu \in \mathsf {B}\). In accordance with Definition 3, this means that . Since \(\omega \) represents an arbitrary run in , it must hold that each run in is also in , which means that .

Next consider an arbitrary . In accordance with Definition 3, this means that \(\exists \nu \, . \, \omega [X\cap Y] = \nu [X\cap Y] \wedge \nu \in \mathsf {B}\). Create a run \(\mu \) such that \(\mu [X]= \nu [X]\) and \(\mu [X^\mathsf {C}] = \omega [X^\mathsf {C}]\). Since \(\mu [X^\mathsf {C}] = \omega [X^\mathsf {C}]\), \(\omega [X\cap Y] = \nu [X\cap Y]\), and \(Y\subseteq X^\mathsf {C}\cup (X\cap Y)\), it follows that \(\omega [Y] = \mu [Y]\). Thus, we have shown that \(\exists \nu \exists \mu \, . \, \omega [Y] = \mu [Y] \wedge \mu [X]= \nu [X] \wedge \nu \in \mathsf {B}\), which can, as previously mentioned, be rewritten as \(\exists \mu \, . \, \omega [Y] = \mu [Y] \wedge \mu \in \{ \omega '\in \varOmega | \omega '[X] = \nu [X], \nu \in \mathsf {B}\}\). In accordance with Definition 3, this means that . Since \(\omega \) represents an arbitrary run in , it must hold that each run in is also in , which means that . Since it was previously also shown that , it follows that , which ends the proof.   \(\square \)

Lemma 3

It holds that .

Proof

In accordance with Definition 4, it holds that for each variable in \(X^\mathsf {C}_{\mathsf {B}}=\{x_1,\ldots ,x_N\}\). It follows that

It follows in accordance with Lemma 2 that and since \(X_{\mathsf {B}}=\{x_1\}^{\mathsf {C}}\cap \ldots \cap \{x_N\}^{\mathsf {C}}\), it also holds that , which ends the proof.   \(\square \)

Proposition 1

Let \(\mathsf {B}_1\) and \(\mathsf {B}_2\) be two behaviors such that \(X_{\mathsf {B}_1} \cap X_{\mathsf {B}_2} = \emptyset \). Then, for an arbitrary set of variables Y, it holds

Proof

To prove , assume . According to Definition 3, this means that there exist a \(\nu \in (\mathsf {B}_1 \cap \mathsf {B}_2)\) such that \(\nu [Y] = \omega [Y]\). Thus for \(i=1,2\), it holds that \(\nu \in \mathsf {B}_i\) and \(\nu [Y] = \omega [Y]\), and therefore that , which ends the proof.

To prove also that , consider an arbitrary run . According to Definition 3 this means that:

$$\begin{aligned}&\exists \nu _1 \in \mathsf {\mathsf {B}_1} . \nu _1[Y] = \omega [Y] \\&\exists \nu _2 \in \mathsf {\mathsf {B}_2} . \nu _2[Y] = \omega [Y] \end{aligned}$$

Now consider the vector \(\nu =( \nu _1[X_{\mathsf {B}_1}], \nu _2[X^C_{\mathsf {B}_1}])\). Clearly it holds that \(\omega [Y]=\nu [Y]\).

Since \(\nu _1 \in \mathsf {B}_1\), and \(\nu [X_{\mathsf {B}_1}] = \nu _1[X_{\mathsf {B}_1}]\), it holds according to Definition 3 that . Then, according to Lemma 3, it also holds that \(\nu _1 \in \mathsf {B}_1\). Similarly, since \(\nu _2 \in \mathsf {B}_2\), and \(\nu [X_{\mathsf {B}_2}] = \nu _2[X_{\mathsf {B}_2}]\), it must hold that \(\nu \in \mathsf {B}_2\).

Thus, we have shown that \(\nu \in \mathsf {B}_1 \cap \mathsf {B}_2\) and that \(\omega [Y]=\nu [Y]\). Therefore, according to Definition 3, it holds that , which ends the proof.   \(\square \)

Proposition 2

It holds that if \(Y\cap X_{\mathsf {B}}\ne \emptyset \).

Proof

In accordance with Lemma 3, it holds that , and further that in accordance with Lemma 2. If \(Y\cap X_{\mathsf {B}}\ne \emptyset \), it follows that .    \(\square \)

The following two lemmas are used to prove Theorem 2.

Lemma 4

If a behavior set \(\mathcal {Q}\) is agnostic to a variable set X, then it is also agnostic to any variable set \(Y \subseteq X\).

Proof

Consider a \(\mathsf {B} \in \mathcal {Q}\) and a \(\mathsf {B}'\) such that . Since \(X^C \subseteq Y^C\), it holds according to Lemma 2, that

From this equality and since \(\mathcal {Q}\) is agnostic to X, it follows that \(\mathsf {B}'\in \mathcal {Q}\). Thus, we have shown that \(\mathcal {Q}\) is agnostic to also Y.    \(\square \)

Lemma 5

Given two behaviors \(\mathsf {B}\) and \(\mathsf {B}'\) where \(\mathsf {B}\cap \mathsf {B}'\ne \emptyset \), it holds that \(X_{\mathsf {B}\cap \mathsf {B}'}\subseteq X_{\mathsf {B}}\cup X_{\mathsf {B}'}\).

Proof

Assume \(X_{\mathsf {B}\cap \mathsf {B}'}\nsubseteq X_{\mathsf {B}}\cup X_{\mathsf {B}'} \), which will be shown to lead to a contradiction. This means that there exists an x such that \(x\notin X_{\mathsf {B}}\), \(x\notin X_{\mathsf {B}'}\), and \(x\in X_{\mathsf {B}\cap \mathsf {B}'}\). In accordance with Definition 4, this respectively means that

(12)
(13)
(14)

Proposition 1 and (14) imply , which in combination with (12) and (13) imply that \(\mathsf {B}\cap \mathsf {B}'\ne \mathsf {B}\cap \mathsf {B}'\). Since this is a contradiction, assumption \(X_{\mathsf {B}\cap \mathsf {B}'}\nsubseteq X_{\mathsf {B}}\cup X_{\mathsf {B}'} \) must be false, and it must rather hold that \(X_{\mathsf {B}\cap \mathsf {B}'}\subseteq X_{\mathsf {B}}\cup X_{\mathsf {B}'}\), which completes the proof.    \(\square \)

Rights and permissions

Reprints and permissions

Copyright information

© 2018 IFIP International Federation for Information Processing

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Westman, J., Nyberg, M. (2018). Preserving Contract Satisfiability Under Non-monotonic Composition. In: Baier, C., Caires, L. (eds) Formal Techniques for Distributed Objects, Components, and Systems. FORTE 2018. Lecture Notes in Computer Science(), vol 10854. Springer, Cham. https://doi.org/10.1007/978-3-319-92612-4_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-92612-4_10

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-92611-7

  • Online ISBN: 978-3-319-92612-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics