Abstract
The behavior of concurrent, asynchronous procedures depends in general on the call context, because of the global protocol that governs scheduling. This context cannot be specified with the state-based Hoare-style contracts common in deductive verification. Recent work generalized state-based to trace contracts, which permit to specify the internal behavior of a procedure, such as calls or state changes, but not its call context. In this article we propose a program logic of context-aware trace contracts for specifying global behavior of asynchronous programs. We also provide a sound proof system that addresses two challenges: To observe the program state not merely at the end points of a procedure, we introduce the novel concept of an observation quantifier. And to combat combinatorial explosion of possible call sequences of procedures, we transfer Liskov’s principle of behavioral subtyping to the analysis of asynchronous procedures.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Additional specification elements, such as frames or exceptional behavior, can be considered as syntactic sugar to achieve concise post-conditions.
- 2.
We do not add the value to be written as a parameter, again for simplicity. This can be easily modelled with a global variable, if desired.
- 3.
Evaluation of a single process, in a known context.
- 4.
The split between local and global is inspired by the LAGC semantics for Active Objects [14]. There are some technical differences between our semantics and LAGC, most prominently that both our local and global semantics are only defined on concrete traces: We do not evaluate symbolically.
- 5.
This can be generalized as usual, if needed.
- 6.
\(\lceil q_{a_m}\rceil \) and \(\lceil q_{c_m}\rceil \) correspond to \(\lceil Pre\rceil \) and \(\lceil Post\rceil \) above. Of course, it is redundant that these formulas occur twice in \(C_m\), but we want each part of a trace contract to be readable on its own.
- 7.
In practice, this split shape must be obtained by suitable weakening rules on trace formulas. The details are future work.
- 8.
This insight was used already in [19] to formulate a Liskov principle for feature-oriented programming.
References
Ahrendt, W., Beckert, B., Bubel, R., Hähnle, R., Schmitt, P.H., Ulbrich, M. (eds.): Deductive Software Verification - The KeY Book - From Theory to Practice. LNCS, vol. 10001. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-49812-6
Albert, E., de la Banda, M.G., Gómez-Zamalloa, M., Isabel, M., Stuckey, P.J.: Optimal context-sensitive dynamic partial order reduction with observers. In: Zhang, D., Møller, A. (eds.) Proceedings 28th ACM SIGSOFT International Symposium on Software Testing and Analysis, ISSTA, pp. 352–362. ACM (2019)
Aldrich, J., Sunshine, J., Saini, D., Sparks, Z.: Typestate-oriented programming. In: OOPSLA Companion, pp. 1015–1022. ACM (2009)
Baumann, C., Beckert, B., Blasum, H., Bormer, T.: Lessons learned from microkernel verification - specification is the new bottleneck. In: Cassez, F., Huuck, R., Klein, G., Schlich, B. (eds.) Proceedings 7th Conference on Systems Software Verification. EPTCS, vol. 102, pp. 18–32 (2012)
Beckert, B., Bruns, D.: Dynamic logic with trace semantics. In: Bonacina, M.P. (ed.) CADE 2013. LNCS (LNAI), vol. 7898, pp. 315–329. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-38574-2_22
Bubel, R., Din, C.C., Hähnle, R., Nakata, K.: A dynamic logic with traces and coinduction. In: De Nivelle, H. (ed.) TABLEAUX 2015. LNCS (LNAI), vol. 9323, pp. 307–322. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-24312-2_21
Bubel, R., Gurov, D., Hähnle, R., Scaletta, M.: Trace-based deductive verification. In: Piskac, R., Voronkov, A. (eds.) Proceedings of 20th International Conference on Logic for Programming, Artificial Intelligence and Reasoning (LPAR), Manizales Colombia. EPiC Series in Computing. EasyChair (2023)
Clarke, E.M., Grumberg, O., Minea, M., Peled, D.A.: State space reduction using partial order techniques. Int. J. Softw. Tools Technol. Transf. 2(3), 279–287 (1999)
de Boer, F., et al.: A survey of active object languages. ACM Comput. Surv. 50(5), 76:1–76:39 (2017)
De Gouw, S., De Boer, F.S., Bubel, R., Hähnle, R., Rot, J., Steinhöfel, D.: Verifying OpenJDK’s sort method for generic collections. J. Autom. Reason. 62(1), 93–126 (2019)
DeLine, R., Fähndrich, M.: Typestates for objects. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 465–490. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-24851-4_21
Din, C.C., Bubel, R., Hähnle, R.: KeY-ABS: a deductive verification tool for the concurrent modelling language ABS. In: Felty, A.P., Middeldorp, A. (eds.) CADE 2015. LNCS (LNAI), vol. 9195, pp. 517–526. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21401-6_35
Din, C.C., Hähnle, R., Henrio, L., Johnsen, E.B., Pun, V.K.I., Tarifa, S.L.T.: LAGC semantics of concurrent programming languages. CoRR, abs/2202.12195 (2022)
Din, C.C., Hähnle, R., Johnsen, E.B., Pun, K.I., Tapia Tarifa, S.L.: Locally abstract, globally concrete semantics of concurrent programming languages. In: Schmidt, R.A., Nalon, C. (eds.) TABLEAUX 2017. LNCS (LNAI), vol. 10501, pp. 22–43. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66902-1_2
Din, C.C., Owe, O.: Compositional reasoning about active objects with shared futures. Formal Aspects Comput. 27(3), 551–572 (2015)
Guttag, J.V., Horning, J.J., Garland, S.J., Jones, K.D., Modet, A., Wing, J.M.: Larch: Languages and Tools for Formal Specification. Springer, New York (1993). https://doi.org/10.1007/978-1-4612-2704-5
Hähnle, R., Huisman, M.: Deductive software verification: from pen-and-paper proofs to industrial tools. In: Steffen, B., Woeginger, G. (eds.) Computing and Software Science. LNCS, vol. 10000, pp. 345–373. Springer, Cham (2019). https://doi.org/10.1007/978-3-319-91908-9_18
Hähnle, R., Kamburjan, E., Scaletta, M.: Context-aware trace contracts. CoRR, abs/2310.04384 (2023)
Hähnle, R., Schaefer, I.: A liskov principle for delta-oriented programming. In: Margaria, T., Steffen, B. (eds.) ISoLA 2012. LNCS, vol. 7609, pp. 32–46. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-34026-0_4
Halpern, J.Y., Shoham, Y.: A propositional modal logic of time intervals. J. ACM 38(4), 935–962 (1991)
Harel, D., Kozen, D., Parikh, R.: Process logic: expressiveness, decidability, completeness. In: 21st Annual Symposium on Foundations of Computer Science, Syracuse, New York, USA, 13–15 October 1980, pp. 129–142. IEEE Computer Society (1980)
Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, pp. 273–284 (2008)
Huisman, M., Ahrendt, W., Grahl, D., Hentschel, M.: Formal specification with the java modeling language. In: Deductive Software Verification – The KeY Book. LNCS, vol. 10001, pp. 193–241. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-49812-6_7
Johnsen, E.B., Hähnle, R., Schäfer, J., Schlatte, R., Steffen, M.: ABS: a core language for abstract behavioral specification. In: Aichernig, B.K., de Boer, F.S., Bonsangue, M.M. (eds.) FMCO 2010. LNCS, vol. 6957, pp. 142–164. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-25271-6_8
Jones, C.B.: Developing methods for computer programs including a notion of interference. Ph.D. thesis, University of Oxford, UK (1981)
Jones, C.B.: Granularity and the development of concurrent programs. In: Brookes, S.D., Main, M.G., Melton, A., Mislove, M.W. (eds.) 11th Annual Conference on Mathematical Foundations of Programming Semantics, MFPS, New Orleans, LA, USA. ENTCS, vol. 1, pp. 302–306. Elsevier (1995)
Kamburjan, E.: Behavioral program logic. In: Cerrito, S., Popescu, A. (eds.) TABLEAUX 2019. LNCS (LNAI), vol. 11714, pp. 391–408. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-29026-9_22
Kamburjan, E., Chen, T.-C.: Stateful behavioral types for active objects. In: Furia, C.A., Winter, K. (eds.) IFM 2018. LNCS, vol. 11023, pp. 214–235. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-98938-9_13
Kamburjan, E., Din, C.C., Chen, T.-C.: Session-based compositional analysis for actor-based languages using futures. In: Ogata, K., Lawford, M., Liu, S. (eds.) ICFEM 2016. LNCS, vol. 10009, pp. 296–312. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-47846-3_19
Kamburjan, E., Din, C.C., Hähnle, R., Johnsen, E.B.: Behavioral contracts for cooperative scheduling. In: Ahrendt, W., Beckert, B., Bubel, R., Hähnle, R., Ulbrich, M. (eds.) Deductive Software Verification: Future Perspectives. LNCS, vol. 12345, pp. 85–121. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-64354-6_4
Kamburjan, E., Scaletta, M., Rollshausen, N.: Deductive verification of active objects with crowbar. Sci. Comput. Program. 226, 102928 (2023)
Kassios, I.T.: The dynamic frames theory. Form. Asp. Comput. 23(3), 267–288 (2011)
Leavens, G.T., et al.: JML Reference Manual (2013). Draft revision 2344
Liskov, B., Wing, J.M.: A behavioral notion of subtyping. ACM Trans. Program. Lang. Syst. 16(6), 1811–1841 (1994)
Meyer, B.: Applying “design by contract’’. IEEE Comput. 25(10), 40–51 (1992)
Mota, J., Giunti, M., Ravara, A.: On using verifast, vercors, plural, and key to check object usage. CoRR, abs/2209.05136 (2022)
Müller, P., Schwerhoff, M., Summers, A.J.: Viper: a verification infrastructure for permission-based reasoning. In: Jobstmann, B., Leino, K.R.M. (eds.) VMCAI 2016. LNCS, vol. 9583, pp. 41–62. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49122-5_2
Nakata, K., Uustalu, T.: A Hoare logic for the coinductive trace-based big-step semantics of While. Log. Methods Comput. Sci. 11(1), 1–32 (2015)
O’Hearn, P.W.: Resources, concurrency and local reasoning. In: Gardner, P., Yoshida, N. (eds.) CONCUR 2004. LNCS, vol. 3170, pp. 49–67. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-28644-8_4
Pnueli, A.: The temporal logic of programs. In: 18th Annual Symposium on Foundations of Computer Science, Providence, Rhode Island, USA, pp. 46–57. IEEE Computer Society (1977)
Reynolds, J.C.: Separation logic: a logic for shared mutable data structures. In: LICS, pp. 55–74. IEEE Computer Society (2002)
Wolper, P.: Temporal logic can be more expressive. Inf. Control 56, 72–99 (1983)
Acknowledgements
This work was partially supported by the Research Council of Norway via the SIRIUS Centre (237898) and the PeTWIN project (294600), as well as the Hessian LOEWE initiative within the Software-Factory 4.0 project.
We profited enormously from the detailed and constructive remarks of the reviewers.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this chapter
Cite this chapter
Hähnle, R., Kamburjan, E., Scaletta, M. (2024). Context-Aware Trace Contracts. In: de Boer, F., Damiani, F., Hähnle, R., Broch Johnsen, E., Kamburjan, E. (eds) Active Object Languages: Current Research Trends. Lecture Notes in Computer Science, vol 14360. Springer, Cham. https://doi.org/10.1007/978-3-031-51060-1_11
Download citation
DOI: https://doi.org/10.1007/978-3-031-51060-1_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-51059-5
Online ISBN: 978-3-031-51060-1
eBook Packages: Computer ScienceComputer Science (R0)