Abstract
We present a new approach to improve the model checking performance for B models. We build on the high-level code generator B2Program, which unlike B’s original code generators can already be applied at an early stage to high-level B models. We extend B2Program to generate efficient model checkers in Java and C++. The generated model checkers are customized and compiled for specific B models and include features like parallelization and caching. We evaluate the approach on a wide range of B models, comparing the performance to existing B model checkers. The results show that for some models we can obtain significant performance improvements, while for others ProB remains the tool of choice. For lower-level models, our new approach improves upon the existing TLC backend. In summary, the B2Program model checker is a very useful new tool addition for the B method.
The works of Fabian Vu and Michael Leuschel are part of the IVOIRE project, which is funded by “Deutsche Forschungsgemeinschaft” (DFG) and the Austrian Science Fund (FWF) grant # I 4744-N.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Available at: https://github.com/favu100/b2program.
- 2.
In the absence of the WHILE loop, such a rewriting is always possible (cf. the normal form for substitutions in Chap. 6 of [1]).
- 3.
Note that top-level preconditions are treated as similar to guards, and we only allow top-level guards and preconditions as non-determinism.
- 4.
Note that TLC also has problems when the number of variables of a model increases, in terms of stack consumption and runtime degradation.
- 5.
64-Bit Server VM (build 15+36-1562, mixed mode, sharing).
- 6.
Apple clang version 13.0.0 (clang-1300.0.29.30).
- 7.
Revision b6d1b600dbf06b7984dd2a1dd7403206cfd9d394.
References
Abrial, J., Hoare, A.: The B-Book: Assigning Programs to Meanings. Cambridge University Press, Cambridge (2005)
Abrial, J.-R.: Modeling in Event-B: System and Software Engineering. Cambridge University Press, Cambridge (2010)
Baier, C., Katoen, J.-P.: Principles of Model Checking. MIT Press, Cambridge (2008)
Bendisposto, J., et al: Symbolic Reachability Analysis of B Through ProB and LTSmin. ArXiv, abs/1603.04401 (2016)
Bendisposto, J., Krings, S., Leuschel, M.: Who watches the watchers: validating the prob validation tool. In: Proceedings F-IDE, EPTCS 149. Electronic Proceedings in Theoretical Computer Science (2014)
Bendisposto, J., Leuschel, M.: Proof assisted model checking for B. In: Breitman, K., Cavalcanti, A. (eds.) ICFEM 2009. LNCS, vol. 5885, pp. 504–520. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-10373-5_26
Bonfanti, S., Carissoni, M., Gargantini, A., Mashkoor, A.: Asm2C++: a tool for code generation from abstract state machines to Arduino. In: Barrett, C., Davies, M., Kahsai, T. (eds.) NFM 2017. LNCS, vol. 10227, pp. 295–301. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-57288-8_21
Cataño, N., Rivera, V.: EventB2Java: a code generator for event-B. In: Rayadurgam, S., Tkachuk, O. (eds.) NFM 2016. LNCS, vol. 9690, pp. 166–171. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-40648-0_13
ClearSy. Atelier B, User and Reference Manuals. Aix-en-Provence, France (2016). http://www.atelierb.eu/
Cordeiro, L., Kesseli, P., Kroening, D., Schrammel, P., Trtik, M.: JBMC: a bounded model checking tool for verifying java bytecode. In: Chockler, H., Weissenbacher, G. (eds.) CAV 2018. LNCS, vol. 10981, pp. 183–190. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-96145-3_10
de Jonge, M., Ruys, T.C.: The SpinJa model checker. In: van de Pol, J., Weber, M. (eds.) SPIN 2010. LNCS, vol. 6349, pp. 124–128. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-16164-3_9
Dobrikov, I., Leuschel, M.: Enabling analysis for event-B. In: Proceedings ABZ, pp. 102–118 (2016)
Edmunds, A.: Templates for event-B code generation. In : Ait Ameur, Y., Schewe, K.D. (eds) Abstract State Machines, Alloy, B, TLA, VDM, and Z. ABZ 2014. Lecture Notes in Computer Science, vol. 8477, pp. 284–289. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-662-43652-3_25
Fürst, A., Hoang, T.S., Basin, D., Desai, K., Sato, N., Miyazaki, K.: Code generation for event-B. In: Albert, E., Sekerinski, E. (eds.) IFM 2014. LNCS, vol. 8739, pp. 323–338. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-10181-1_20
Hansen, D., Leuschel, M.: Translating B to TLA + for Validation with TLC. In: Ait Ameur, Y., Schewe, K.D. (eds.) Proceedings ABZ, LNCS, vol. 8477, pp. 40–55. Springer, Heidelberg (2014)
Holzmann, G.: The SPIN Model Checker: Primer and Reference Manual, 1st edn. Addison-Wesley Professional, Boston (2011)
Jørgensen, P.W.V., Larsen, M., Couto, L.D.: A code generation platform for VDM. In: Proceedings of the 12th Overture Workshop. School of Computing Science, Newcastle University, UK, Technical Report CS-TR-1446 (2015)
Kant, G., Laarman, A., Meijer, J., van de Pol, J., Blom, S., van Dijk, T.: LTSmin: high-performance language-independent model checking. In: Baier, C., Tinelli, C. (eds.) TACAS 2015. LNCS, vol. 9035, pp. 692–707. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46681-0_61
Körner, P., Leuschel, M., Meijer, J.: State-of-the-art model checking for B and event-B using ProB and LTSmin. In: Furia, C.A., Winter, K. (eds.) IFM 2018. LNCS, vol. 11023, pp. 275–295. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-98938-9_16
Kroening, D., Tautschnig, M.: CBMC – C bounded model checker. In: Ábrahám, E., Havelund, K. (eds.) TACAS 2014. LNCS, vol. 8413, pp. 389–391. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54862-8_26
Ladenberger, L., Hansen, D., Wiegard, H., Bendisposto, J., Leuschel, M.: Validation of the ABZ landing gear system using ProB. Int. J. Softw. Tools Technol. Transf. 19(2), 187–203 (2015). https://doi.org/10.1007/s10009-015-0395-9
Leuschel, M.: Operation Caching and State Compression for Model Checking of High-Level Models - How to have your cake and eat it. In: Proceedings iFM. LNCS, vol. 13274, pp. 129–145. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-07727-2_8
Leuschel, M., Bendisposto, J., Hansen, D.: Unlocking the mysteries of a formal model of an interlocking system. In: Proceedings Rodin Workshop (2014)
Leuschel, M., Butler, M.: ProB: A model checker for B. In: Araki, K., Gnesi, S., Mandrioli, D. (eds.) FME 2003. LNCS, vol. 2805, pp. 855–874. Springer, Heidelberg (2003). https://doi.org/10.1007/978-3-540-45236-2_46
Mehlitz, P., Rungta, N., Visser, W.: A hands-on Java Pathfinder tutorial. In: Proceedings ICSE, pp. 1493–1495 (2013)
Méry, D., Singh, N.K.: Automatic code generation from event-B models. In: Proceedings SoICT, pp. 179–188. ACM ICPS (2011)
Oliver, I.: Experiences in using B and UML in industrial development. In: Julliand, J., Kouchnarenko, O. (eds.) B 2007. LNCS, vol. 4355, pp. 248–251. Springer, Heidelberg (2006). https://doi.org/10.1007/11955757_20
Parr, T.: StringTemplate Website. http://www.stringtemplate.org/ (2013). Accessed 23 Sep 2021
Rivera, V., Cataño, N., Wahls, T., Rueda, C.: Code generation for event-B. STTT 19(1), 31–52 (2017)
van der Berg, F.I., Laarman, A.: SpinS: extending LTSmin with Promela through SpinJa. Electron. Notes Theor. Comput. Sci. 296, 95–105 (2013)
Vu, F., Hansen, D., Körner, P., Leuschel, M.: A multi-target code generator for high-level B. In: Ahrendt, W., Tapia Tarifa, S.L. (eds.) IFM 2019. LNCS, vol. 11918, pp. 456–473. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-34968-4_25
Vu, F., Happe, C., Leuschel, M.: Generating domain-specific interactive validation documents. In: Proceedings FMICS, pp. 32–49 (2022). To appear in LNCS 13487
Witulski, J.: A Python B Implementation - PyB A Second Tool-Chain. PhD thesis, Universitäts-und Landesbibliothek der Heinrich-Heine-Universität Düsseldorf (2018)
Yu, Y., Manolios, P., Lamport, L.: Model checking TLA+ specifications. In: Pierre, L., Kropf, T. (eds.) CHARME 1999. LNCS, vol. 1703, pp. 54–66. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48153-2_6
Acknowledgements
We would like to thank Florian Mager and Klaus Sausen. They have been working on a student’s model checking project from which some ideas have emerged for this work. We would also like to thank Lucas Döring, who is currently improving B2Program’s model checking performance. We would also like to thank Sebastian Stock for proofreading this paper and anonymous referees for their feedback.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Benchmarks
A Benchmarks
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
Vu, F., Brandt, D., Leuschel, M. (2022). Model Checking B Models via High-Level Code Generation. In: Riesco, A., Zhang, M. (eds) Formal Methods and Software Engineering. ICFEM 2022. Lecture Notes in Computer Science, vol 13478. Springer, Cham. https://doi.org/10.1007/978-3-031-17244-1_20
Download citation
DOI: https://doi.org/10.1007/978-3-031-17244-1_20
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-17243-4
Online ISBN: 978-3-031-17244-1
eBook Packages: Computer ScienceComputer Science (R0)