Skip to main content

Spot the Difference: A Detailed Comparison Between B and Event-B

  • Chapter
  • First Online:
Logic, Computation and Rigorous Methods

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

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.

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

Access this chapter

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

Institutional subscriptions

Notes

  1. 1.

    See http://rodin.cs.ncl.ac.uk.

  2. 2.

    Alloy’s multiplicity annotations cannot be understood so simply in this way; see [30].

  3. 3.

    https://wiki.event-b.org/index.php/Records_Extension.

  4. 4.

    Attribute grammars with inherited and synthesised attributes (see [10]).

  5. 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. 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. 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. 8.

    Private communication from Laurent Voisin, Paris, 17th September 2019.

  9. 9.

    See also https://plus.maths.org/content/pemdas-paradox for this particular example.

  10. 10.

    In other formal languages this may be different; see Sect. 5.2.

  11. 11.

    The rodin handbook requires modulo arguments to be non-negative, which is correct; [41] is in error.

  12. 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. 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. 14.

    https://www.methode-b.com/en/download-b-tools/rodin/b2rodin/.

References

  1. 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

  2. Abrial, J., Hallerstede, S.: Refinement, decomposition, and instantiation of discrete models: application to Event-B. Fundam. Inform. 77(1–2), 1–28 (2007)

    Google Scholar 

  3. Abrial, J.-R.: The B-Book. Cambridge University Press, Cambridge (1996)

    Book  Google Scholar 

  4. 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

  5. Abrial, J.-R.: Modeling in Event-B: System and Software Engineering. Cambridge University Press, Cambridge (2010)

    Book  Google Scholar 

  6. 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

    Chapter  Google Scholar 

  7. 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

    Chapter  MATH  Google Scholar 

  8. 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

    Chapter  Google Scholar 

  9. 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

    Chapter  MATH  Google Scholar 

  10. Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools, 2nd edn. Addison-Wesley, Boston (2007)

    MATH  Google Scholar 

  11. B-Core (UK) Ltd, Oxon, UK. B-Toolkit, On-line manual (1999). http://sens.cse.msu.edu/Software/B-Toolkit/BKIT/BHELP/BToolkit.html

  12. 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)

    Article  Google Scholar 

  13. Börger, E.: Abstract State Machines. Springer, Heidelberg (2003). https://doi.org/10.1007/978-3-642-18216-7

  14. 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

    Chapter  Google Scholar 

  15. 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

    Chapter  Google Scholar 

  16. ClearSy. Atelier B, User and Reference Manuals. Aix-en-Provence, France (2009). http://www.atelierb.eu/

  17. 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

  18. 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

    Chapter  Google Scholar 

  19. 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

    Chapter  MATH  Google Scholar 

  20. 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

    Chapter  MATH  Google Scholar 

  21. 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)

    Google Scholar 

  22. 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

    Chapter  Google Scholar 

  23. 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

    Chapter  Google Scholar 

  24. 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

    Chapter  Google Scholar 

  25. 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

    Chapter  Google Scholar 

  26. 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)

    Google Scholar 

  27. 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

    Chapter  Google Scholar 

  28. 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

    Chapter  Google Scholar 

  29. Jackson, D.: Alloy: a lightweight object modelling notation. ACM Trans. Softw. Eng. Methodol. 11, 256–290 (2002)

    Article  Google Scholar 

  30. Krings, S., Leuschel, M., Schmidt, J., Schneider, D., Frappier, M.: Translating alloy and extensions to classical B. Sci. Comput. Program. 188, 102378 (2020)

    Google Scholar 

  31. Lamport, L.: Specifying Systems, the TLA+ Language and Tools for Hardware and Software Engineers. Addison-Wesley, Boston (2002)

    Google Scholar 

  32. Lamport, L., Paulson, L.C.: Should your specification language be typed. ACM Trans. Program. Lang. Syst. 21(3), 502–526 (1999)

    Article  Google Scholar 

  33. 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

    Chapter  Google Scholar 

  34. 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

    Chapter  Google Scholar 

  35. 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

    Chapter  Google Scholar 

  36. 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

  37. 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

    Chapter  Google Scholar 

  38. 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

    Chapter  Google Scholar 

  39. 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

    Google Scholar 

  40. 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

    Chapter  Google Scholar 

  41. Métayer, C., Voisin, L.: The event-B mathematical language (2009). http://wiki.event-b.org/index.php/Event-B_Mathematical_Language

  42. 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

    Chapter  Google Scholar 

  43. 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

    Chapter  Google Scholar 

  44. 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

    Article  Google Scholar 

  45. Schneider, S.: The B-Method: An introduction. Palgrave Macmillan, London (2001)

    Google Scholar 

  46. 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

    Chapter  Google Scholar 

  47. Silva, R., Pascal, C., Hoang, T.S., Butler, M.J.: Decomposition tool for Event-B. Softw. Pract. Exper. 41(2), 199–208 (2011)

    Article  Google Scholar 

  48. Spivey, J.M.: The Z Notation: A Reference Manual. Prentice-Hall, Hoboken (1992)

    MATH  Google Scholar 

Download references

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

Authors

Corresponding author

Correspondence to Michael Leuschel .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics