Reasoning about Function Objects

  • Martin Nordio
  • Cristiano Calcagno
  • Bertrand Meyer
  • Peter Müller
  • Julian Tschannen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6141)


Modern object-oriented languages support higher-order implementations through function objects such as delegates in C#, agents in Eiffel, or closures in Scala. Function objects bring a new level of abstraction to the object-oriented programming model, and require a comparable extension to specification and verification techniques. We introduce a verification methodology that extends function objects with auxiliary side-effect free (pure) methods to model logical artifacts: preconditions, postconditions and modifies clauses. These pure methods can be used to specify client code abstractly, that is, independently from specific instantiations of the function objects. To demonstrate the feasibility of our approach, we have implemented an automatic prover, which verifies several non-trivial examples.


Function Object Proof Obligation Frame Problem Separation Logic Dynamic Frame 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Banerjee, A., Naumann, D., Rosenberg, S.: Regional Logic for Local Reasoning about Global Invariants. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 387–411. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  2. 2.
    Barnett, M., Leino, R., 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)Google Scholar
  3. 3.
    Berger, M., Honda, K., Yoshida, N.: A logical analysis of aliasing in imperative higher-order functions. In: ICFP ’05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programming, pp. 280–293. ACM, New York (2005)CrossRefGoogle Scholar
  4. 4.
    Biering, B., Birkedal, L., Torp-Smith, N.: BI-hyperdoctrines, higher-order separation logic, and abstraction. In: ToPLAS (2008)Google Scholar
  5. 5.
    Börger, E., Fruja, N.G., Gervasi, V., Stärk, R.F.: A high-level modular definition of the semantics of C#. Theor. Comput. Sci. 336(2-3), 235–284 (2005)zbMATHCrossRefGoogle Scholar
  6. 6.
    Clarke, D., Drossopoulou, S.: Ownership, encapsulation and the disjointness of type and effect. In: OOPSLA ’02, vol. 37, pp. 292–310. ACM Press, New York (2002)CrossRefGoogle Scholar
  7. 7.
    Darvas, Á.: Reasoning About Data Abstraction in Contract Languages. PhD thesis, ETH Zurich, Switzerland (to appear, 2009)Google Scholar
  8. 8.
    Darvas, A., 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)CrossRefGoogle Scholar
  9. 9.
    Distefano, D., Parkinson, M.J.: jStar: Towards Practical Verification for Java. In: OOPSLA ’08: Proceedings of the 23rd ACM SIGPLAN conference on Object oriented programming systems languages and applications, pp. 213–226 (2008)Google Scholar
  10. 10.
    EVE: Eiffel Verification Environment,
  11. 11.
    Findler, R.B., Felleisen, M.: Contracts for higher-order functions. SIGPLAN Not. 37(9), 48–59 (2002)CrossRefGoogle Scholar
  12. 12.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading (1994)Google Scholar
  13. 13.
    Honda, K., Yoshida, N., Berger, M.: An observationally complete program logic for imperative higher-order frame rules. In: LICS ’05: Proceedings of the Symposium on Logic in Computer Science, USA, pp. 260–279. IEEE Computer Society, Los Alamitos (2005)Google Scholar
  14. 14.
    Jacobs, B.: A Statically Verifiable Programming Model for Concurrent Object-Oriented Programs. PhD thesis, Katholieke Universiteit Leuven (2007)Google Scholar
  15. 15.
    Rustan, K., Leino, M.: Specification and verification of object-oriented software. Marktoberdorf International Summer School 2008, lecture notes (2008)Google Scholar
  16. 16.
    Rustan, K., Leino, M.: This is boogie 2. Technical Report Manuscript KRML 178, Microsoft Research (2008)Google Scholar
  17. 17.
    Kanig, J., Filliâtre, J.-C.: Who: A Verifier for Effectful Higher-order Programs. In: ACM SIGPLAN Workshop on ML, Edinburgh, Scotland, UK (2009)Google Scholar
  18. 18.
    Kassios, I.T.: Dynamic Frames: Support for Framing, Dependencies and Sharing Without Restrictions. In: Misra, J., Nipkow, T., Sekerinski, E. (eds.) FM 2006. LNCS, vol. 4085, pp. 268–283. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  19. 19.
    Krishnaswami, N., Aldrich, J., Birkedal, L.: Modular verification of the subject-observer pattern via higher-order separation logic. In: FTJP (2007)Google Scholar
  20. 20.
    Leavens, G.T., Leino, K.R.M., Müller, P.: Specification and verification challenges for sequential object-oriented programs. Formal Aspects of Computing 19(2), 159–189 (2007)zbMATHCrossRefGoogle Scholar
  21. 21.
    Leino, K.R.M., Müller, P.: Object invariants in dynamic contexts. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 491–516. Springer, Heidelberg (2004)Google Scholar
  22. 22.
    Leino, K.R.M., Müller, P.: Verification of equivalent-results methods. In: Drossopoulou, S. (ed.) ESOP 2008. LNCS, vol. 4960, pp. 307–321. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  23. 23.
    Müller, P., Ruskiewicz, J.N.: A modular verification methodology for C# delegates. In: Abrial, J.-R., Glässer, U. (eds.) Rigorous Methods for Software Construction and Analysis. LNCS, vol. 5115, pp. 187–203. Springer, Heidelberg (to appear, 2009)CrossRefGoogle Scholar
  24. 24.
    Nordio, M., Calcagno, C., Meyer, B., Müller, P.: Reasoning about Function Objects. Technical Report 615, ETH Zurich (2008)Google Scholar
  25. 25.
    Nordio, M., Calcagno, C., Müller, P., Meyer, B.: A Sound and Complete Program Logic for Eiffel. In: Oriol, M. (ed.) TOOLS-EUROPE 2009. Lecture Notes in Business and Information Processing, vol. 33, pp. 195–214 (2009)Google Scholar
  26. 26.
    O’Hearn, P.W., Yang, H., Reynolds, J.C.: Separation and information hiding. In: POPL ’04, pp. 268–280 (2004)Google Scholar
  27. 27.
    Paige, R., Ostroff, J.: ERC: an Object-Oriented Refinement Calculus for Eiffel. Formal Aspects of Computing 16, 51–79 (2004)zbMATHCrossRefGoogle Scholar
  28. 28.
    Parkinson, M., Bierman, G.: Separation logic and abstraction. In: POPL ’05, vol. 40, pp. 247–258. ACM, New York (2005)Google Scholar
  29. 29.
    Parkinson, M.J., Bierman, G.M.: Separation logic, abstraction and inheritance. In: POPL ’08, pp. 75–86. ACM, New York (2008)Google Scholar
  30. 30.
    Régis-Gianas, Y., Pottier, F.: A hoare logic for call-by-value functional programs. In: Audebaud, P., Paulin-Mohring, C. (eds.) MPC 2008. LNCS, vol. 5133, pp. 305–335. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  31. 31.
    Reynolds, J.C.: Separation logic: A logic for shared mutable data structures. In: LICS (2002)Google Scholar
  32. 32.
    Schoeller, B.: Making classes provable through contracts, models and frames. PhD thesis, ETH Zurich (2007)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Martin Nordio
    • 1
  • Cristiano Calcagno
    • 2
    • 3
  • Bertrand Meyer
    • 1
  • Peter Müller
    • 1
  • Julian Tschannen
    • 1
  1. 1.ETH ZurichSwitzerland
  2. 2.Monoidics Ltd 
  3. 3.Imperial CollegeLondonUK

Personalised recommendations