Abstract
To modularly specify and verify object oriented programs on some abstract level, we need abstraction techniques to hide the implementation details of the classes. Model fields and abstract predicates are two most important approaches to address the requirements. In this paper, we mainly compare their expressiveness. We develop two translation algorithms, which can translate a program with model fields based specification to one with abstract predicates based specification. We prove that the translation algorithms are correct, and the resulting specifications are well-encapsulated and well-formed. This shows that the abstract predicates technique is more expressive. On the other hand, the model fields based specifications are more user friendly and useful in automatic verification. In addition, we discuss the different characteristics of the two approaches in framing, inheritance, and recursion.
K. Zhang — The work is supported by the NSFC under grant No. 61272160 and No. 61202069.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
In literature on ownership, the nodes of a list do not own each other, instead, they have a same owner. If we define that each node owns the next node in JML, we cannot loop through the list and modify its elements, since it violates the owner-as-modifier discipline; in Spec#, we cannot even loop through the list since the owner of a variable must be kept unchanged in a loop.
- 2.
In fact, different encapsulation disciplines (e.g. owner-as-modifier in JML, dynamic ownership in Spec#) lead to different proof obligations of the invariants. Here [H-INVM] needs to generate all the proof obligations of the invariants, according to the adopted encapsulation discipline.
References
Leavens, G.T., Baker, A.L., Ruby, C.: Preliminary design of JML: a behavioral interface specification language for java. SIGSOFT Softw. Eng. Notes 31(3), 1–38 (2006)
Parkinson, M., Bierman, G.: Separation logic and abstraction. In: POPL 2005, pp. 247–258. ACM (2005)
Leino, K.R.: Toward reliable modular programs. Ph.D. thesis, California Institute of Technology (1995)
Bruns, D.: Formal semantics for the java modeling language. Diplomarbeit, Universität Karlsruhe, June 2009
Leino, K.R.M., Müller, P.: A verification methodology for model fields. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 115–130. Springer, Heidelberg (2006)
Reynolds, J.C.: Separation logic: a logic for shared mutable data structures. In: LICS 2002, pp. 55–74. IEEE CS (2002)
Parkinson, M.J., Bierman, G.M.: Separation logic, abstraction and inheritance. In: POPL 2008, pp. 75–86. ACM (2008)
Barnett, M., Leino, K.R.M., Schulte, W.: The Spec# programming system: an overview. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 49–69. Springer, Heidelberg (2005)
Jacobs, B., Piessens, F.: The VeriFast program verifier. CW Reports (2008)
Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. In: OOPSLA 1998, pp. 48–64. ACM (1998)
Leavens, G.T., Poll, E., Clifton, C., Cheon, Y., Ruby, C., Cok, D., Müller, P., Kiniry, J., Chalin, P.: JML Reference Manual (2008)
Zhang, K., Qiu, Z.: Comparison between Model Fields and Abstract Predicates. Technical report, School of Math., Peking University (2016). https://github.com/fm-pku/mf-ap/blob/master/mf-ap.pdf
Müller, P., Poetzsch-Heffter, A., Leavens, G.T.: Modular specification of frame properties in JML. Concurrency Comput. Pract. Exp. 15(2), 117–154 (2003)
Parkinson, M.: Class invariants: the end of the road. In: International Workshop on Aliasing, Confinement and Ownership, vol. 23 (2007)
Cheon, Y., Leavens, G., Sitaraman, M., Edwards, S.: Model variables: cleanly supporting abstraction in design by contract: research articles. Softw. Pract. Exp. 35(6), 583–599 (2005)
Leavens, G.T., Müller, P.: Information hiding and visibility in interface specifications. In: ICSE 2007, pp. 385–395. IEEE CS (2007)
Liu, Y., Hong, A., Qiu, Z.: Inheritance and modularity in specification and verification of OO programs. In: TASE 2011, pp. 19–26. IEEE CS (2011)
Zongyan, Q., Ali, H., Yijing, L.: Modular verification of OO programs with interfaces. In: Aoki, T., Taguchi, K. (eds.) ICFEM 2012. LNCS, vol. 7635, pp. 151–166. Springer, Heidelberg (2012)
Darvas, Á., Leino, K.R.M.: Practical reasoning about invocations and implementations of pure methods. In: Dwyer, M.B., Lopes, A. (eds.) FASE 2007. LNCS, vol. 4422, pp. 336–351. Springer, Heidelberg (2007)
Leino, K.R.M.: Data groups: specifying the modification of extended state. In: OOPSLA 1998, pp. 144–153. ACM (1998)
Burgman, R.: Specifying multi-threaded Java programs (2010). http://referaat.cs.utwente.nl/conference/12/paper
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Zhang, K., Qiu, Z. (2016). Comparison Between Model Fields and Abstract Predicates. In: Castor, F., Liu, Y. (eds) Programming Languages. SBLP 2016. Lecture Notes in Computer Science(), vol 9889. Springer, Cham. https://doi.org/10.1007/978-3-319-45279-1_12
Download citation
DOI: https://doi.org/10.1007/978-3-319-45279-1_12
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-45278-4
Online ISBN: 978-3-319-45279-1
eBook Packages: Computer ScienceComputer Science (R0)