Considerate Reasoning and the Composite Design Pattern

  • Alexander J. Summers
  • Sophia Drossopoulou
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5944)


We propose Considerate Reasoning, a novel specification and verification technique based on object invariants. This technique supports succinct specifications of implementations which follow the pattern of breaking properties of other objects and then notifying them appropriately. It allows the specification to be concerned only with the properties directly relevant to the current method call, with no need to explicitly mention the concerns of subcalls. In this way, the specification reflects the division of responsibility present in the implementation, and reflects what we regard as the natural argument behind the design.

We specify and prove the well-known Composite design pattern using Considerate Reasoning. We show how to encode our approach in Boogie2. The resulting specification verifies automatically within a few seconds; no manual guidance is required beyond the careful representation of the invariants themselves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
    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
  3. 3.
    Barnett, M., DeLine, R., Fähndrich, M., Leino, K.R.M., Schulte, W.: Verification of object-oriented programs with invariants. JOT 3(6), 27–56 (2004)Google Scholar
  4. 4.
    Barnett, M., Naumann, D.: Friends need a bit more: Maintaining invariants over shared state. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 54–84. Springer, Heidelberg (2004)Google Scholar
  5. 5.
    Bierhof, K., Aldrich, J.: Permissions to specify the Composite Design Pattern. In: SAVCBS (2008)Google Scholar
  6. 6.
    Detlefs, D., Nelson, G., Saxe, J.B.: Simplify: a theorem prover for program checking. Journal of the ACM (52) (2005)Google Scholar
  7. 7.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design patterns: elements of reusable object-oriented software. Addison-Wesley, Reading (1995)Google Scholar
  8. 8.
    Jacobs, B., Piessens, F.: The verifast program verifier. Technical report, Katholieke Universiteit Leuven (August 2008)Google Scholar
  9. 9.
    Jacobs, B., Smans, J., Piessens, F.: Verifying the Composite Pattern using Separation Logic. In: SAVCBS (2008)Google Scholar
  10. 10.
    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
  11. 11.
    Leavens, G.T., Leino, K.R.M., Müller, P.: Specification and verification challenges for sequential object-oriented programs. FAC 19(2), 159–189 (2007)MATHCrossRefGoogle Scholar
  12. 12.
    Leino, K.R.M., Müller, P.: Object invariants in dynamic contexts. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 491–515. Springer, Heidelberg (2004)Google Scholar
  13. 13.
    Rustan, K., Leino, M.: This is Boogie 2,
  14. 14.
    Leino, K.R.M., Monahan, R.: Reasoning about comprehensions with first-order smt solvers. In: SAC 2009. ACM, New York (2009)Google Scholar
  15. 15.
    Middelkoop, R., Huizing, C., Kuiper, R., Luit, E.J.: Invariants for non-hierarchical object structures. ENTCS 195, 211–229 (2008)Google Scholar
  16. 16.
    Müller, P., Poetzsch-Heffter, A., Leavens, G.T.: Modular invariants for layered object structures. Science of Computer Programming 62, 253–286 (2006)MATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    O’Hearn, P.W., Yang, H., Reynolds, J.C.: Separation and information hiding. In: POPL. ACM Press, New York (2004)Google Scholar
  18. 18.
    Parkinson, M., Bierman, G.: Separation logic and abstraction. In: POPL. ACM Press, New York (2005)Google Scholar
  19. 19.
    Poetzsch-Heffter, A.: Specification and verification of object-oriented programs. Habilitation thesis, Technical University of Munich (1997)Google Scholar
  20. 20.
    Reynolds, J.C.: Separation logic: A logic for shared mutable data structures. In: LICS. IEEE Computer Society Press, Los Alamitos (2002)Google Scholar
  21. 21.
    Rosenberg, S., Banerjee, A., Naumann, D.: Local Reasoning and Dynamic Framing for the Composite Pattern and its Clients,
  22. 22.
    Sha, L., Rajkumar, R., Lehoczky, J.P.: Priority inheritance protocols: An approach to real-time synchronization. IEEE Trans. Comp. 39(9), 1175–1185 (1990)CrossRefMathSciNetGoogle Scholar
  23. 23.
    Smans, J., Jacobs, B., Piessens, F.: Implicit dynamic frames: Combining dynamic frames and separation logic. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 148–172. Springer, Heidelberg (2009)Google Scholar
  24. 24.
    Summers, A.J., Drossopoulou, S., Müller, P.: The need for flexible Object Invariants. In: IWACO 2009 (2009)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Alexander J. Summers
    • 1
    • 2
  • Sophia Drossopoulou
    • 1
  1. 1.Imperial College London 
  2. 2.ETH Zürich 

Personalised recommendations