Abstract
The B landscape can be confusing to formal methods outsiders, especially due to the fact that it is partitioned into classical B for software and Event-B for systems modelling. In this article we shed light on commonalities and differences between these formalisms, based on our experience in building tools that support both of them. In particular, we examine not so well-known pitfalls. For example, despite sharing a common mathematical foundation in predicate logic, set theory and arithmetic, there are formulas that are true in Event-B and false in classical B, and vice-versa.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
- 2.
Alloy’s multiplicity annotations cannot be understood so simply in this way; see [30].
- 3.
- 4.
Attribute grammars with inherited and synthesised attributes (see [10]).
- 5.
Without parentheses the Atelier-B parser thus interprets \(\texttt {1=2 <=> 2=3}\) as the invalid \(\texttt {((1=2) <=> 2)=3}\). In ProB the grammar specifies that = has two expressions as arguments, and expressions cannot make use of = or \(\texttt {<=>}\). Hence, even without parentheses, \(\texttt {1=2 <=> 2=3}\) is unambiguously interpreted as \(\texttt {(1=2) <=> (2=3)}\).
- 6.
One reason is that classical B allows composed identifiers in the grammar (e.g., xx.xx can refer to variable xx in an included machine xx). Note that, however, \(\exists xx.2<x\) is also not accepted by Atelier-B.
- 7.
Note, however, that the statement in Sect. 3.2.3 of [41]: “\(\forall x.P \implies Q\) is parsed as \((\forall x.P) \implies Q\) in classical B” is not true: without parentheses \(\forall x.P \implies Q\) cannot be parsed at all.
- 8.
Private communication from Laurent Voisin, Paris, 17th September 2019.
- 9.
See also https://plus.maths.org/content/pemdas-paradox for this particular example.
- 10.
In other formal languages this may be different; see Sect. 5.2.
- 11.
The rodin handbook requires modulo arguments to be non-negative, which is correct; [41] is in error.
- 12.
ProB warns when such variable captures appear. The price to pay is that ProB does not really treat definitions as macros, every definition body has to be a valid formula; it cannot consist of a partial text of a formula.
- 13.
In classical B one can of course just use the \(\varSigma \) operator for this example. Here we just wish to illustrate the various approaches to recursion on a simple example.
- 14.
References
Abrial, J.-R.: On B and Event-B: principles, success and challenges. In: Butler, M., Raschke, A., Hoang, T.S., Reichl, K. (eds.) ABZ 2018. LNCS, vol. 10817, pp. 31–35. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-91271-4_3
Abrial, J., Hallerstede, S.: Refinement, decomposition, and instantiation of discrete models: application to Event-B. Fundam. Inform. 77(1–2), 1–28 (2007)
Abrial, J.-R.: The B-Book. Cambridge University Press, Cambridge (1996)
Abrial, J.-R.: B#: toward a Synthesis between Z and B. In: Bert, D., Bowen, J.P., King, S., Waldén, M. (eds.) ZB 2003. LNCS, vol. 2651, pp. 168–177. Springer, Heidelberg (2003). https://doi.org/10.1007/3-540-44880-2_12
Abrial, J.-R.: Modeling in Event-B: System and Software Engineering. Cambridge University Press, Cambridge (2010)
Abrial, J.-R., Butler, M., Hallerstede, S., Voisin, L.: An open extensible tool environment for event-B. In: Liu, Z., He, J. (eds.) ICFEM 2006. LNCS, vol. 4260, pp. 588–605. Springer, Heidelberg (2006). https://doi.org/10.1007/11901433_32
Abrial, J.-R., Cansell, D., Méry, D.: Refinement and reachability in event-B. In: Treharne, H., King, S., Henson, M., Schneider, S. (eds.) ZB 2005. LNCS, vol. 3455, pp. 222–241. Springer, Heidelberg (2005). https://doi.org/10.1007/11415787_14
Abrial, J.-R., Mussat, L.: Introducing dynamic constraints in B. In: Bert, D. (ed.) B 1998. LNCS, vol. 1393, pp. 83–128. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0053357
Abrial, J.-R., Mussat, L.: On using conditional definitions in formal theories. In: Bert, D., Bowen, J.P., Henson, M.C., Robinson, K. (eds.) ZB 2002. LNCS, vol. 2272, pp. 242–269. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-45648-1_13
Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools, 2nd edn. Addison-Wesley, Boston (2007)
B-Core (UK) Ltd, Oxon, UK. B-Toolkit, On-line manual (1999). http://sens.cse.msu.edu/Software/B-Toolkit/BKIT/BHELP/BToolkit.html
Bendisposto, J., Fritz, F., Jastram, M., Leuschel, M., Weigelt, I.: Developing Camille, a text editor for Rodin. Softw. Prac. Exp. 41(2), 189–198 (2011)
Börger, E.: Abstract State Machines. Springer, Heidelberg (2003). https://doi.org/10.1007/978-3-642-18216-7
Butler, M., et al.: The first twenty-five years of industrial use of the B-method. In: ter Beek, M.H., Ničković, D. (eds.) FMICS 2020. LNCS, vol. 12327, pp. 189–209. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-58298-2_8
Butler, M., Maamria, I.: Practical theory extension in event-B. In: Liu, Z., Woodcock, J., Zhu, H. (eds.) Theories of Programming and Formal Methods. LNCS, vol. 8051, pp. 67–81. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39698-4_5
ClearSy. Atelier B, User and Reference Manuals. Aix-en-Provence, France (2009). http://www.atelierb.eu/
Comptier, M., Déharbe, D., Perez, J.M., Mussat, L., Thibaut, P., Sabatier, D.: Safety analysis of a CBTC system: a rigorous approach with Event-B. In: Fantechi, A., Lecomte, T., Romanovsky, A.B. (eds.) Proceedings RSSRail 2017, LNCS, vol. 10598, pp. 148–159. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-68499-4_10
Comptier, M., Leuschel, M., Mejia, L.-F., Perez, J.M., Mutz, M.: Property-based modelling and validation of a CBTC zone controller in Event-B. In: Collart-Dutilleul, S., Lecomte, T., Romanovsky, A. (eds.) RSSRail 2019. LNCS, vol. 11495, pp. 202–212. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-18744-6_13
Derrick, J., Boiten, E.: State-based languages: event-B and ASM. Refinement, pp. 149–176. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-92711-4_8
Derrick, J., Boiten, E.: State-based languages: Z and B. Refinement, pp. 121–147. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-92711-4_7
Dollé, D., Essamé, D., Falampin, J.: B dans le transport ferroviaire. L’expérience de Siemens Transportation Systems. Technique et Science Informatiques 22(1), 11–32 (2003)
Essamé, D., Dollé, D.: B in large-scale projects: the canarsie line CBTC experience. In: Julliand, J., Kouchnarenko, O. (eds.) B 2007. LNCS, vol. 4355, pp. 252–254. Springer, Heidelberg (2006). https://doi.org/10.1007/11955757_21
Evans, N., Butler, M.: A proposal for records in event-B. In: Misra, J., Nipkow, T., Sekerinski, E. (eds.) FM 2006. LNCS, vol. 4085, pp. 221–235. Springer, Heidelberg (2006). https://doi.org/10.1007/11813040_16
Hansen, D., Schneider, D., Leuschel, M.: Using B and ProB for data validation projects. In: Butler, M., Schewe, K.-D., Mashkoor, A., Biro, M. (eds.) ABZ 2016. LNCS, vol. 9675, pp. 167–182. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-33600-8_10
Herman, D., Wand, M.: A theory of hygienic macros. In: Drossopoulou, S. (ed.) ESOP 2008. LNCS, vol. 4960, pp. 48–62. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78739-6_4
Hoang, T.S., Voisin, L., Salehi, A., Butler, M.J., Wilkinson, T., Beauger, N.: Theory plug-in for Rodin 3.x. CoRR, abs/1701.08625 (2017)
Iliasov, A.: Use case scenarios as verification conditions: event-B/flow approach. In: Troubitsyna, E.A. (ed.) SERENE 2011. LNCS, vol. 6968, pp. 9–23. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-24124-6_2
Iliasov, A., et al.: Supporting reuse in event B development: modularisation approach. In: Frappier, M., Glässer, U., Khurshid, S., Laleau, R., Reeves, S. (eds.) ABZ 2010. LNCS, vol. 5977, pp. 174–188. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-11811-1_14
Jackson, D.: Alloy: a lightweight object modelling notation. ACM Trans. Softw. Eng. Methodol. 11, 256–290 (2002)
Krings, S., Leuschel, M., Schmidt, J., Schneider, D., Frappier, M.: Translating alloy and extensions to classical B. Sci. Comput. Program. 188, 102378 (2020)
Lamport, L.: Specifying Systems, the TLA+ Language and Tools for Hardware and Software Engineers. Addison-Wesley, Boston (2002)
Lamport, L., Paulson, L.C.: Should your specification language be typed. ACM Trans. Program. Lang. Syst. 21(3), 502–526 (1999)
Lecomte, T., Deharbe, D., Prun, E., Mottin, E.: Applying a formal method in industry: a 25-year trajectory. In: Cavalheiro, S., Fiadeiro, J. (eds.) SBMF 2017. LNCS, vol. 10623, pp. 70–87. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-70848-5_6
Leuschel, M.: Fast and effective well-definedness checking. In: Dongol, B., Troubitsyna, E. (eds.) IFM 2020. LNCS, vol. 12546, pp. 63–81. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-63461-2_4
Leuschel, M., Börger, E.: A compact encoding of sequential ASMs in event-B. In: Butler, M., Schewe, K.-D., Mashkoor, A., Biro, M. (eds.) ABZ 2016. LNCS, vol. 9675, pp. 119–134. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-33600-8_7
Leuschel, M., Butler, M.J.: ProB: an automated analysis toolset for the B method. STTT 10(2), 185–203 (2008). https://doi.org/10.1007/s10009-007-0063-9
Leuschel, M., Cansell, D., Butler, M.: Validating and animating higher-order recursive functions in B. In: Abrial, J.-R., Glässer, U. (eds.) Rigorous Methods for Software Construction and Analysis. LNCS, vol. 5115, pp. 78–92. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-11447-2_6
Leuschel, M., Mutz, M., Werth, M.: Modelling and validating an automotive system in classical B and event-B. In: Raschke, A., Méry, D., Houdek, F. (eds.) ABZ 2020. LNCS, vol. 12071, pp. 335–350. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-48077-6_27
Mariano, G.: Évaluation de Logiciels Critiques Développés par la Méthode B: Une Approche Quantitative. Ph.D. thesis, Université de Valenciennes et Du Hainaut-Cambrésis, December 1997
Mehta, F.: A practical approach to partiality – a proof based approach. In: Liu, S., Maibaum, T., Araki, K. (eds.) ICFEM 2008. LNCS, vol. 5256, pp. 238–257. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-88194-0_16
Métayer, C., Voisin, L.: The event-B mathematical language (2009). http://wiki.event-b.org/index.php/Event-B_Mathematical_Language
Sabatier, D.: Using formal proof and B method at system level for industrial projects. In: Lecomte, T., Pinger, R., Romanovsky, A. (eds.) RSSRail 2016. LNCS, vol. 9707, pp. 20–31. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-33951-1_2
Sabatier, D., Burdy, L., Requet, A., Guéry, J.: Formal proofs for the NYCT line 7 (flushing) modernization project. In: Derrick, J., et al. (eds.) ABZ 2012. LNCS, vol. 7316, pp. 369–372. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-30885-7_34
Said, M.Y., Butler, M., Snook, C.: A method of refinement in UML-B. Softw. Syst. Model. 14(4), 1557–1580 (2013). https://doi.org/10.1007/s10270-013-0391-z
Schneider, S.: The B-Method: An introduction. Palgrave Macmillan, London (2001)
Silva, R., Butler, M.: Shared event composition/decomposition in event-B. In: Aichernig, B.K., de Boer, F.S., Bonsangue, M.M. (eds.) FMCO 2010. LNCS, vol. 6957, pp. 122–141. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-25271-6_7
Silva, R., Pascal, C., Hoang, T.S., Butler, M.J.: Decomposition tool for Event-B. Softw. Pract. Exper. 41(2), 199–208 (2011)
Spivey, J.M.: The Z Notation: A Reference Manual. Prentice-Hall, Hoboken (1992)
Acknowledgements
Egon Börger visited my group at the University of Düsseldorf in summer of 2015. Egon was funded by a renewed Forschungspreis grant of the Humboldt Foundation. This visit was very fruitful and helped me gain a better understanding of ASMs and enabled us to write the ABZ 2016 paper on a compact encoding of ASMs in Event-B. Egon also played an important role in establishing the ABZ conference series, which was instrumental in establishing bridges between the various state-based formalisms and led to considerable cross-fertilization. I hope that this article provides an additional bridge and helps researches travel more easily between the various state-based formalisms.
I also wish to thank Jean-Raymond Abrial, Lilian Burdy, Michael Butler, Stefan Hallerstede, Luis-Fernando Mejia, Sebastian Stock, Laurent Voisin, and Fabian Vu for useful feedback, Atelier-B and rodin implementation details and pointers. Finally, an anonymous referee provided a lot of detailed feedback, for which I am grateful.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this chapter
Cite this chapter
Leuschel, M. (2021). Spot the Difference: A Detailed Comparison Between B and Event-B. In: Raschke, A., Riccobene, E., Schewe, KD. (eds) Logic, Computation and Rigorous Methods. Lecture Notes in Computer Science(), vol 12750. Springer, Cham. https://doi.org/10.1007/978-3-030-76020-5_9
Download citation
DOI: https://doi.org/10.1007/978-3-030-76020-5_9
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-76019-9
Online ISBN: 978-3-030-76020-5
eBook Packages: Computer ScienceComputer Science (R0)