Abstract
In industrial-sized cyber-physical systems, ensuring fulfillment of requirements gets increasingly more costly as the number of components increases. To make the task feasible, compositional verification has been suggested as a scalable solution. Such techniques allow verification by divide-and-conquer, often using assume-guarantee contracts. Although previous research has focused mostly on the non-probabilistic setting, in the real world, probabilities often arise due to random hardware failures, stochastic communication delays, sensor ghost objects, machine learning components, rounding errors caused by finite-precision arithmetic, human behavior, and probabilistic algorithms. Therefore, for contract theories to be practically relevant to cyber-physical systems, there is a need to support probabilistic reasoning, for instance regarding safety and reliability. To this end, we propose a completely trace-based probabilistic contract theory, supporting general probability measures, continuous time, and continuous state spaces. To verify decompositions of such contracts, we also present a deductive system, which is illustrated on an industrially inspired automatic emergency braking example.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
Note that there are alternative ways to define measurable functions when f is a bounded function defined on a set of finite measure, which is true for probability measures. In this case, f is measurable if and only if f is Lebesgue integrable [32], or, alternatively, approximable to arbitrary precision using simple functions [14]. To put this into perspective, note that the set of all Lebesgue measurable functions contains, among others, all functions that are Riemann integrable.
References
Bauer, S., Mayer, P., Legay, A.: Mio workbench: a tool for compositional design with modal input/output interfaces. In: Proceedings of the 9th International Symposium on Automated Technology for Verification and Analysis (ATVA), pp. 418–421 (2011)
Benveniste, A., Caillaud, B., Nickovic, D., Raclet, J.B., Passerone, R.: Contracts for System Design. now Publishers Inc. (2018)
Benveniste, A., Raclet, J.B.: Mixed nondeterministic-probabilistic automata: blending graphical probabilistic models with nondeterminism. Discr. Event Dyn. Syst. 33(4), 455–505 (2023)
Caillaud, B., Delahaye, B., Larsen, K.G., Legay, A., Pedersen, M.L., Wasowski, A.: Compositional design methodology with constraint Markov chains. In: 2010 Seventh International Conference on the Quantitative Evaluation of Systems, pp. 123–132. IEEE (2010)
Cimatti, A., Dorigatti, M., Tonetta, S.: OCRA: a tool for checking the refinement of temporal contracts. In: 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 702–705. IEEE (2013)
Clarkson, M.R., Finkbeiner, B., Koleini, M., Micinski, K.K., Rabe, M.N., Sánchez, C.: Temporal logics for hyperproperties. In: Abadi, M., Kremer, S. (eds.) POST 2014. LNCS, vol. 8414, pp. 265–284. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54792-8_15
Cuoq, P., Kirchner, F., Kosmatov, N., Prevosto, V., Signoles, J., Yakobowski, B.: Frama-C. In: Eleftherakis, G., Hinchey, M., Holcombe, M. (eds.) SEFM 2012. LNCS, vol. 7504, pp. 233–247. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-33826-7_16
Roever, W.-P.: The need for compositional proof systems: a survey. In: de Roever, W.-P., Langmaack, H., Pnueli, A. (eds.) COMPOS 1997. LNCS, vol. 1536, pp. 1–22. Springer, Heidelberg (1998). https://doi.org/10.1007/3-540-49213-5_1
Delahaye, B., Caillaud, B., Legay, A.: Probabilistic contracts: a compositional reasoning methodology for the design of systems with stochastic and/or non-deterministic aspects. Formal Meth. Syst. Des. 38(1), 1–32 (2011)
Delahaye, B., Katoen, J.-P., Larsen, K.G., Legay, A., Pedersen, M.L., Sher, F., Wąsowski, A.: Abstract probabilistic automata. In: Jhala, R., Schmidt, D. (eds.) VMCAI 2011. LNCS, vol. 6538, pp. 324–339. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-18275-4_23
Der Kiureghian, A., Ditlevsen, O.: Aleatory or epistemic? Does it matter? Struct. Saf. 31(2), 105–112 (2009)
Friedenthal, S., Moore, A., Steiner, R.: A Practical Guide to SysML: The Systems Modeling Language, 3rd edn. The MK/OMG Press, Morgan Kaufmann (2014)
Gössler, G., Xu, D.N., Girault, A.: Probabilistic contracts for component-based design. Formal Meth. Syst. Des. 41(2), 211–231 (2012)
Gut, A.: Probability: A Graduate Course, vol. 200. Springer, New York (2006). https://doi.org/10.1007/978-1-4614-4708-5
Hampus, A., Nyberg, M.: Verifying refinement of probabilistic contracts using timed automata. In: David, C., Sun, M. (eds.) Proceedings of the 17th International Symposium on Theoretical Aspects of Software Engineering, TASE 2023, Bristol, UK, 4–6 July 2023, pp. 95–113. Springer, Cham (2023). https://doi.org/10.1007/978-3-031-35257-7_6
Hampus, A., Nyberg, M. Formally verifying decompositions of stochastic specifications. Int. J. Softw. Tools Technol. Transfer 26, 207–228 (2024). https://doi.org/10.1007/s10009-024-00742-5
Hampus, A., Nyberg, M.: A theory of probabilistic contracts (with proofs). Technical report, KTH Royal Institute of Technology (2024)
Incer, I., et al.: Pacti: scaling assume-guarantee reasoning for system analysis and design. arXiv preprint arXiv:2303.17751 (2023)
Incer, I., Benveniste, A., Sangiovanni-Vincentelli, A., Seshia, S.A.: Hypercontracts. In: Deshmukh, J.V., Havelund, K., Perez, I. (eds.) Proceedings of the 14th International Symposium on NASA Formal Methods, NFM 2022, Pasadena, CA, USA, 24–27 May 2022, pp. 674–692. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-06773-0_36
ISO 21434: “Road vehicles - Cybersecurity engineering” (2021)
ISO 26262: “Road vehicles - Functional safety” (2018)
Jonsson, B., Larsen, K.G.: Specification and refinement of probabilistic processes. In: Proceedings 1991 Sixth Annual IEEE Symposium on Logic in Computer Science, pp. 266–267. IEEE Computer Society (1991)
Jonsson, B., Yi, W.: Testing preorders for probabilistic processes can be characterized by simulations. Theoret. Comput. Sci. 282(1), 33–51 (2002)
Lanotte, R., Maggiolo-Schettini, A., Troina, A.: Parametric probabilistic transition systems for system design and analysis. Formal Aspects Comput. 19(1), 93–109 (2007)
Lapidoth, A.: A Foundation in Digital Communication. Cambridge University Press (2017)
de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78800-3_24
Nuzzo, P., Li, J., Sangiovanni-Vincentelli, A.L., Xi, Y., Li, D.: Stochastic assume-guarantee contracts for cyber-physical system design. ACM Trans. Embed. Comput. Syst. (TECS) 18(1), 1–26 (2019)
Nyberg, M., Westman, J., Gurov, D.: Formally proving compositionality in industrial systems with informal specifications. In: Margaria, T., Steffen, B. (eds.) ISoLA 2020. LNCS, vol. 12478, pp. 348–365. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-61467-6_22
Official Journal of the European Union: (EU) 2022/1426, L:2022:221 (August 2022). https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=OJ:L:2022:221:FULL
Paul, W., Baschnagel, J.: Stochastic processes. From Physics to finance (1999)
Resnick, S.: A probability path (2019)
Royden, H., Fitzpatrick, P.M.: Real analysis. China Machine Press (2010)
Segala, R., Lynch, N.: Probabilistic simulations for probabilistic processes. In: Jonsson, B., Parrow, J. (eds.) CONCUR 1994. LNCS, vol. 836, pp. 481–496. Springer, Heidelberg (1994). https://doi.org/10.1007/978-3-540-48654-1_35
Slind, K., Norrish, M.: A brief overview of HOL4. In: Mohamed, O.A., Muñoz, C., Tahar, S. (eds.) TPHOLs 2008. LNCS, vol. 5170, pp. 28–32. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-71067-7_6
Acknowledgement
Supported by Vinnova FFI, Sweden, through the SafeDim project. Some of the concepts presented here were discussed at the Lorentz center workshop on Contract Languages, 4–8 March 2024.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendices
Proofs of Correctness for the Inference Rules
Proposition 2
(\(\hbox {ai}_1\)). Let \(\mathcal {M} \in \mathbb {M}_{\mathbb {C},\mathbb {S}}\) be any model conforming to the metatheory. If \(\mathcal {M} \vDash \forall q_1 \forall q_2 \ . \ (q_1 : S) \wedge (q_1 \times q_2 : \copyright ) \rightarrow q_1 \times q_2 : S\), then also \(\mathcal {M} \vDash \textsf{Assertional}(S)\). \(\square \)
Proposition 3
(am). Let \(\mathcal {M} \in \mathbb {M}_{\mathbb {C},\mathbb {S}}\) be any model conforming to the metatheory. If \(\mathcal {M} \vDash c_1 : S\), \(\mathcal {M} \vDash \textsf{Assertional}(S)\), and \(\mathcal {M} \vDash c_1 \times c_2 : \copyright \), then also \( \mathcal {M} \vDash c_1 \times c_2 : S \). \(\square \)
Proposition 4
(recp-i\(_1\)). Let \(\mathcal {M} \in \mathbb {M}_{\mathbb {C},\mathbb {S}}\) be any model conforming to the metatheory. If \( \mathcal {M} \vDash c : \textsf{in}_X \), then also \( \mathcal {M} \vDash \textsf{recp}_{X} \). \(\square \)
Proposition 5
(recp-i\(_2\)). Let \(\mathcal {M} \in \mathbb {M}_{\mathbb {C},\mathbb {S}}\) be any model conforming to the metatheory. If \( \mathcal {M} \vDash c : \textsf{out}_X \), then also \( \mathcal {M} \vDash \textsf{recp}_{X^c} \). \(\square \)
Proposition 6
(recp-i\(_3\)). Let \(\mathcal {M} \in \mathbb {M}_{\mathbb {C},\mathbb {S}}\) be any model conforming to the metatheory. If \( \mathcal {M} \vDash c : \textsf{recp}_{X_1} \) and \(\mathcal {M} \vDash c : \textsf{recp}_{X_2} \), then also \( \mathcal {M} \vDash \textsf{recp}_{X_1 \cup X_2} \). \(\square \)
Proposition 7
(recp-e). Let \(\mathcal {M} \in \mathbb {M}_{\mathbb {C},\mathbb {S}}\) be any model conforming to the metatheory. If \( \mathcal {M} \vDash c : \textsf{recp}_{X_1 \cup X_2} \), then also \( \mathcal {M} \vDash \textsf{recp}_{X_1} \). \(\square \)
Proposition 8
(recp-comps). Let \(\mathcal {M} \in \mathbb {M}_{\mathbb {C},\mathbb {S}}\) be any model conforming to the metatheory. If \( \mathcal {M} \vDash c_1 : \textsf{recp}_{X_1}, \dots , \mathcal {M} \vDash c_n : \textsf{recp}_{X_n} \), then also \( \mathcal {M} \vDash c_1 \times \dots \times c_n : \textsf{recp}_{X_1 \cap \dots \cap X_n} \). \(\square \)
Proposition 9
(\(\copyright \)i). Let \(\mathcal {M} \in \mathbb {M}_{\mathfrak {B},\mathbb {C},\mathbb {S}}\) be any model conforming to the probabilistic instantiation of the metatheory. If \( \mathcal {M} \vDash c_1 : \textsf{recp}_{X_1}, \dots , \mathcal {M} \vDash c_n : \textsf{recp}_{X_n} \), \( \forall i \ne j \ . \ X_i^c \cap X_j^c = \emptyset \), and \( \forall i \in \{1..n\} \ . \ (\mathcal {M} \vDash c_i : \textsf{in}_{X_i'}) \wedge X_i' \subseteq \bigcap _{j=i+1}^n X_j \), then also \( \mathcal {M} \vDash c_1 \times \dots \times c_n : \copyright \). \(\square \)
Proposition 10
(ai\(_2\)). Let \(\mathcal {M} \in \mathbb {M}_{\mathfrak {B},\mathbb {C},\mathbb {S}}\) be any model conforming to the probabilistic instantiation of the metatheory. Then \( \mathcal {M} \vDash \textsf{Assertional}\big (\left( f(\textbf{x}) \perp \!\!\!\perp g(\textbf{y})\right) \big ) \). \(\square \)
Proposition 11
(\(\perp \!\!\!\perp \)i). Let \(\mathcal {M} \in \mathbb {M}_{\mathfrak {B},\mathbb {C},\mathbb {S}}\) be any model conforming to the probabilistic instantiation of the metatheory. If \( \mathcal {M} \vDash c_1 : \textsf{in}_{\{y_{1}\}} \), \( \mathcal {M} \vDash c_1 : \left( f_1(\textbf{x}_1) \perp \!\!\!\perp y_1\right) \), \( \mathcal {M} \vDash c_2 : \textsf{in}_{\{y_{2}\}} \), \( \mathcal {M} \vDash c_2 : \left( f_2(\textbf{x}_2) \perp \!\!\!\perp y_2\right) \), and \( \mathcal {M} \vDash c_1 \times c_2 : \copyright \), then also \( \mathcal {M} \vDash c_1 \times c_2 : \left( f_1(\textbf{x}_1) \perp \!\!\!\perp f_2(\textbf{x}_2)\right) \). \(\square \)
Refinement Proof
Proof of the sequent (16)
Rights and permissions
Copyright information
© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Hampus, A., Nyberg, M. (2025). A Theory of Probabilistic Contracts. In: Margaria, T., Steffen, B. (eds) Leveraging Applications of Formal Methods, Verification and Validation. Specification and Verification. ISoLA 2024. Lecture Notes in Computer Science, vol 15221. Springer, Cham. https://doi.org/10.1007/978-3-031-75380-0_17
Download citation
DOI: https://doi.org/10.1007/978-3-031-75380-0_17
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-75379-4
Online ISBN: 978-3-031-75380-0
eBook Packages: Computer ScienceComputer Science (R0)