Skip to main content

Comparison Between Model Fields and Abstract Predicates

  • Conference paper
  • First Online:
Programming Languages (SBLP 2016)

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

Included in the following conference series:

  • 850 Accesses

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.

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.

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

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

    Article  Google Scholar 

  2. Parkinson, M., Bierman, G.: Separation logic and abstraction. In: POPL 2005, pp. 247–258. ACM (2005)

    Google Scholar 

  3. Leino, K.R.: Toward reliable modular programs. Ph.D. thesis, California Institute of Technology (1995)

    Google Scholar 

  4. Bruns, D.: Formal semantics for the java modeling language. Diplomarbeit, Universität Karlsruhe, June 2009

    Google Scholar 

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

    Chapter  Google Scholar 

  6. Reynolds, J.C.: Separation logic: a logic for shared mutable data structures. In: LICS 2002, pp. 55–74. IEEE CS (2002)

    Google Scholar 

  7. Parkinson, M.J., Bierman, G.M.: Separation logic, abstraction and inheritance. In: POPL 2008, pp. 75–86. ACM (2008)

    Google Scholar 

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

    Chapter  Google Scholar 

  9. Jacobs, B., Piessens, F.: The VeriFast program verifier. CW Reports (2008)

    Google Scholar 

  10. Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. In: OOPSLA 1998, pp. 48–64. ACM (1998)

    Google Scholar 

  11. Leavens, G.T., Poll, E., Clifton, C., Cheon, Y., Ruby, C., Cok, D., Müller, P., Kiniry, J., Chalin, P.: JML Reference Manual (2008)

    Google Scholar 

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

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

    Article  MATH  Google Scholar 

  14. Parkinson, M.: Class invariants: the end of the road. In: International Workshop on Aliasing, Confinement and Ownership, vol. 23 (2007)

    Google Scholar 

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

    Article  Google Scholar 

  16. Leavens, G.T., Müller, P.: Information hiding and visibility in interface specifications. In: ICSE 2007, pp. 385–395. IEEE CS (2007)

    Google Scholar 

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

    Google Scholar 

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

    Chapter  Google Scholar 

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

    Chapter  Google Scholar 

  20. Leino, K.R.M.: Data groups: specifying the modification of extended state. In: OOPSLA 1998, pp. 144–153. ACM (1998)

    Google Scholar 

  21. Burgman, R.: Specifying multi-threaded Java programs (2010). http://referaat.cs.utwente.nl/conference/12/paper

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ke Zhang .

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics