Generating JML Specifications from Alloy Expressions

  • Daniel Grunwald
  • Christoph Gladisch
  • Tianhai Liu
  • Mana Taghdiri
  • Shmuel Tyszberowicz
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8855)


Java Modeling Language (JML) is a specification language for Java programs, that follows the design by contract paradigm. However, it is not always easy to use JML, for example when specifying properties of linked data structures. Alloy, on the other hand, is a relational specification language with a built-in transitive closure operator, which makes it particularly suitable for writing concise specifications of linked data structures. This paper presents Alloy2JML, a tool that generates JML specifications from Alloy expression, in order to support both Alloy and JML specifications in the KeY verification engine. This translation allows Java programs with Alloy specifications to be fully verified for correctness. Moreover, Alloy2JML lets Alloy specifications be employed in a variety of tools that accept only JML as their specification language. Supporting Alloy has the additional advantage that users can validate the specifications beforehand using the Alloy Analyzer.


JML Alloy Java Theorem proving KeY Relational logic 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
    Beckert, B., Hähnle, R., Schmitt, P.H. (eds.): Verification of Object-Oriented Software. LNCS (LNAI), vol. 4334. Springer, Heidelberg (2007)Google Scholar
  3. 3.
    Bruns, D., Mostowski, W., Ulbrich, M.: Implementation-level verification of algorithms with KeY. STTT, 1–16 (2013)Google Scholar
  4. 4.
    Burdy, L., Cheon, Y., Cok, D., Ernst, M., Kiniry, J., Leavens, G., Leino, R., Poll, E.: An overview of JML tools and applications. STTT 7(3), 212–232 (2005)CrossRefGoogle Scholar
  5. 5.
    Cataño, N., Wahls, T., Rueda, C., Rivera, V., Yu, D.: Translating B Machines to JML Specifications. In: 27th ACM Symp. on App. Comp., pp. 1271–1277 (2012)Google Scholar
  6. 6.
    Cok, D.R., Kiniry, J.R.: ESC/Java2: Uniting eSC/Java and JML. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 108–128. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  7. 7.
    Dennis, G., Chang, F.S.-H., Jackson, D.: Modular verification of code with SAT. In: ISSTA, pp. 109–120. ACM (2006)Google Scholar
  8. 8.
    Dennis, G., Yessenov, K., Jackson, D.: Bounded verification of voting software. In: Shankar, N., Woodcock, J. (eds.) VSTTE 2008. LNCS, vol. 5295, pp. 130–145. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  9. 9.
    El Ghazi, A.A., Taghdiri, M.: Relational reasoning via SMT solving. In: Butler, M., Schulte, W. (eds.) FM 2011. LNCS, vol. 6664, pp. 133–148. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  10. 10.
    Filliâtre, J.-C., Marché, C.: The why/Krakatoa/Caduceus platform for deductive program verification. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 173–177. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  11. 11.
    Galeotti, J.P., Rosner, N., Pombo, C.L., Frias, M.: Analysis of invariants for efficient bounded verification. In: ISSTA, pp. 25–36. ACM (2010)Google Scholar
  12. 12.
    Galeotti, J.P., Rosner, N., Pombo, C.G.L., Frias, M.F.: TACO: Efficient SAT-based bounded verification using symmetry breaking and tight bounds. IEEE Transactions on Software Engineering 39(9), 1283–1307 (2013)CrossRefGoogle Scholar
  13. 13.
    Garis, A.G., Cunha, A., Riesco, D.: Translating Alloy specifications to UML class diagrams annotated with OCL. SoSyM, 1–21 (2013)Google Scholar
  14. 14.
    El Ghazi, A.A., Ulbrich, M., Gladisch, C., Tyszberowicz, S., Taghdiri, M.: JKelloy: A proof assistant for relational specifications of java programs. In: Badger, J.M., Rozier, K.Y. (eds.) NFM 2014. LNCS, vol. 8430, pp. 173–187. Springer, Heidelberg (2014)CrossRefGoogle Scholar
  15. 15.
    Gladisch, C., Tyszberowicz, S.: Specifying a linked data structure in JML for formal verification and runtime checking. In: Iyoda, J., de Moura, L. (eds.) SBMF 2013. LNCS, vol. 8195, pp. 99–114. Springer, Heidelberg (2013)Google Scholar
  16. 16.
    Grunwald, D.: Translating Alloy specifications to JML. Master’s thesis, Karlsruhe Institute of Technology (December 2013),
  17. 17.
    Hanada, K., et al.: Implementation of a prototype bi-directional translation tool between OCL and JML. J. Informatics Society 5(2), 89–95 (2013)Google Scholar
  18. 18.
    Jackson, D.: Software Abstractions (revised edition). MIT Press (2012)Google Scholar
  19. 19.
    Jin, D., Yang, Z.: Strategies of Modeling from VDM-SL to JML. In: Advanced Language Processing and Web Information Technology, pp. 320–323 (2008)Google Scholar
  20. 20.
    Klein, G., Nipkow, T.: A machine-checked model for a Java-like language, virtual machine, and compiler. ACM Trans. Program. Lang. Syst, 619–695 (2006)Google Scholar
  21. 21.
    Leavens, G.T., et al.: JML Reference Manual (draft, revision 1.235) (June 2008),
  22. 22.
    Liu, T., Nagel, M., Taghdiri, M.: Bounded program verification using an SMT solver: A case study. In: ICST, pp. 101–110 (April 2012)Google Scholar
  23. 23.
    Marché, C., et al.: The KRAKATOA tool for certification of JAVA/JAVACARD programs annotated in JML. J. Log. Algebr. Program. 58(1-2), 89–106 (2004)CrossRefzbMATHGoogle Scholar
  24. 24.
    Müller, P., et al.: Modular specification of frame properties in JML. Concurrency and Computation: Practice and Experience 15(2), 117–154 (2003)CrossRefzbMATHGoogle Scholar
  25. 25.
    Vaziri, M.: Finding Bugs in Software with a Constraint Solver. PhD thesis, Massachusetts Institute of Technology (2004)Google Scholar
  26. 26.
    Weiß, B.: Deductive Verification of Object-Oriented Software. PhD thesis, Karlsruhe Institute of Technology (2011)Google Scholar
  27. 27.
    Yessenov, K.T.: A Lightweight Specification Language for Bounded Program Verification. Master’s thesis, Massachusetts Institute of Technology (2009)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Daniel Grunwald
    • 1
  • Christoph Gladisch
    • 1
  • Tianhai Liu
    • 1
  • Mana Taghdiri
    • 1
  • Shmuel Tyszberowicz
    • 1
  1. 1.Karlsruhe Institute of TechnologyGermany

Personalised recommendations