Abstract
A properly encapsulated data representation can be revised for refactoring or other purposes without affecting the correctness of client programs and extensions of a class. But encapsulation is difficult to achieve in object-oriented programs owing to heap based structures and reentrant callbacks. This chapter shows that it is achieved by a discipline using assertions and auxiliary fields to manage invariants and transferrable ownership. The main result is representation independence: a rule for modular proof of equivalence of class implementations.
Keywords
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.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Dietl, W., Müller, P.: Object Ownership in Program Verification. In: Clarke, D., Noble, J., Wrigstad, T. (eds.) Aliasing in Object-Oriented Programming. LNCS, vol. 7850, pp. 289–318. Springer, Heidelberg (2013)
Parkinson, M., Bierman, G.: Separation Logic for Object-Oriented Programming. In: Clarke, D., Noble, J., Wrigstad, T. (eds.) Aliasing in Object-Oriented Programming. LNCS, vol. 7850, pp. 366–406. Springer, Heidelberg (2013)
Smans, J., Jacobs, B., Piessens, F.: VeriFast for Java: A Tutorial. In: Clarke, D., Noble, J., Wrigstad, T. (eds.) Aliasing in Object-Oriented Programming. LNCS, vol. 7850, pp. 407–442. Springer, Heidelberg (2013)
Jacobs, B., Poll, E.: Java Program Verification at Nijmegen: Developments and Perspective. In: Futatsugi, K., Mizoguchi, F., Yonezaki, N. (eds.) ISSS 2003. LNCS, vol. 3233, pp. 134–153. Springer, Heidelberg (2004)
Hoare, C.A.R.: Proofs of correctness of data representations. Acta Informatica 1, 271–281 (1972)
Mitchell, J.C.: Representation independence and data abstraction. In: ACM Symp. on Princ. of Program. Lang., pp. 263–276 (1986)
de Roever, W.P., Engelhardt, K.: Data Refinement: Model-Oriented Proof Methods and their Comparison. Cambridge University Press (1998)
Banerjee, A., Naumann, D.A.: Ownership confinement ensures representation independence for object-oriented programs. J. ACM 52(6), 894–960 (2005)
Müller, P., Poetzsch-Heffter, A., Leavens, G.T.: Modular invariants for layered object structures. Sci. Comput. Program. 62(3), 253–286 (2006)
Barnett, M., DeLine, R., Fähndrich, M., Leino, K.R.M., Schulte, W.: Verification of object-oriented programs with invariants. Journal of Object Technology 3(6), 27–56 (2004)
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)
Detlefs, D.L., Leino, K.R.M., Nelson, G.: Wrestling with rep exposure. Research 156, DEC Systems Research Center (1998)
O’Hearn, P.W., Yang, H., Reynolds, J.C.: Separation and information hiding. ACM Trans. Program. Lang. Syst. 31(3) (2009)
Banerjee, A., Naumann, D.A.: Ownership transfer and abstraction. Technical Report TR 2004-1, Computing and Information Sciences, Kansas State University (2003)
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)
Cohen, E., Moskal, M., Schulte, W., Tobies, S.: Local Verification of Global Invariants in Concurrent Programs. In: Touili, T., Cook, B., Jackson, P. (eds.) CAV 2010. LNCS, vol. 6174, pp. 480–494. Springer, Heidelberg (2010)
Banerjee, A., Naumann, D.A.: State Based Ownership, Reentrance, and Encapsulation. In: Black, A. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 387–411. Springer, Heidelberg (2005)
Guttag, J.V., Horning, J.J. (eds.): Larch: Languages and Tools for Formal Specification. Texts and Monographs in Computer Science. Springer-Verlag (1993); With Garland, S.J., Jones, K.D., Modet, A., Wing, J.M.
Meyer, B.: Object-oriented Software Construction, 2nd edn. Prentice Hall, New York (1997)
Naumann, D.A., Barnett, M.: Towards imperative modules: Reasoning about invariants and sharing of mutable state. Theoretical Computer Science 365, 143–168 (2006)
Ahmed, A., Dreyer, D., Rossberg, A.: State-dependent representation independence. In: ACM Symp. on Princ. of Program. Lang., pp. 340–353 (2009)
Thamsborg, J., Birkedal, L., Yang, H.: Two for the price of one: lifting separation logic assertions. Logical Methods in Computer Science 8(3) (2012)
Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems 23(3), 396–459 (2001)
Naumann, D.A.: Verifying a Secure Information Flow Analyzer. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005. LNCS, vol. 3603, pp. 211–226. Springer, Heidelberg (2005)
Apt, K.R., de Boer, F.S., Olderog, E.R.: Verification of Sequential and Concurrent Programs, 3rd edn. Springer (2009)
Borba, P., Sampaio, A., Cornélio, M.: A Refinement Algebra for Object-oriented Programming. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 457–482. Springer, Heidelberg (2003)
Cavalcanti, A., Naumann, D.A.: Forward Simulation for Data Refinement of Classes. In: Eriksson, L.-H., Lindsay, P.A. (eds.) FME 2002. LNCS, vol. 2391, pp. 471–490. Springer, Heidelberg (2002)
Naumann, D.A., Sampaio, A., Silva, L.: Refactoring and representation independence for class hierachies. Theoretical Computer Science 433, 60–97 (2012)
Filipovic, I., O’Hearn, P.W., Torp-Smith, N., Yang, H.: Blaming the client: on data refinement in the presence of pointers. Formal Asp. Comput. 22(5), 547–583 (2010)
Reynolds, J.C.: Types, abstraction, and parametric polymorphism. In: Mason, R. (ed.) Information Processing 1983, pp. 513–523. North-Holland (1984)
Pitts, A.M.: Typed operational reasoning. In: Pierce, B.C. (ed.) Advanced Topics in Types and Programming Languages, pp. 245–289. The MIT Press (2005)
Ahmed, A.: Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 69–83. Springer, Heidelberg (2006)
Crary, K., Harper, R.: Syntactic logical relations for polymorphic and recursive types. Electr. Notes Theor. Comput. Sci. 172, 259–299 (2007)
Melliès, P.A., Vouillon, J.: Recursive polymorphic types and parametricity in an operational framework. In: IEEE Symp. on Logic in Computer Science, pp. 82–91 (2005)
Sumii, E., Pierce, B.C.: A bisimulation for type abstraction and recursion. J. ACM 54(5) (2007)
Koutavas, V., Wand, M.: Small bisimulations for reasoning about higher-order imperative programs. In: ACM Symp. on Princ. of Program. Lang., pp. 141–152 (2006)
Birkedal, L., Yang, H.: Relational parametricity and separation logic. Logical Methods in Computer Science 4(2) (2008)
Dreyer, D., Neis, G., Rossberg, A., Birkedal, L.: A relational modal logic for higher-order stateful adts. In: ACM Symp. on Princ. of Program. Lang., pp. 185–198 (2010)
Koutavas, V., Wand, M.: Reasoning about class behavior. In: Informal Proceedings of FOOL/WOOD (2007)
Banerjee, A., Naumann, D.A.: State based encapsulation and generics. Technical Report CS Report 2004-11, Stevens Institute of Technology (2004)
Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. In: OOPSLA 1998 Conference Proceedings. SIGPLAN, vol. 33(10), pp. 48–64 (October 1998)
Boyapati, C., Lee, R., Rinard, M.C.: Ownership types for safe programming: preventing data races and deadlocks. In: ACM Conference on Object-Oriented Programming Languages, Systems, and Applications, pp. 211–230 (2002)
Clarke, D., Drossopoulou, S.: Ownership, encapsulation and the disjointness of type and effect. In: ACM Conference on Object-Oriented Programming Languages, Systems, and Applications, pp. 292–310 (November 2002)
Boyapati, C., Liskov, B., Shrira, L.: Ownership types for object encapsulation. In: ACM Symp. on Princ. of Program. Lang., pp. 213–223 (2003) (invited paper)
Boyland, J., Noble, J., Retert, W.: Capabilities for Sharing: A Generalisation of Uniqueness and Read-Only. In: Lindskov Knudsen, J. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 2–7. Springer, Heidelberg (2001)
Smith, F., Walker, D., Morrisett, G.: Alias Types. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 366–381. Springer, Heidelberg (2000)
Müller, P., Rudich, A.: Ownership transfer in universe types. In: ACM Conference on Object-Oriented Programming Languages, Systems, and Applications, pp. 461–478 (2007)
Drossopoulou, S., Francalanza, A., Müller, P., Summers, A.J.: A Unified Framework for Verification Techniques for Object Invariants. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 412–437. Springer, Heidelberg (2008)
Barnett, M., Naumann, D.A.: 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)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley (1995)
Cameron, N.R., Drossopoulou, S., Noble, J., Smith, M.J.: Multiple ownership. In: ACM Conference on Object-Oriented Programming Languages, Systems, and Applications, pp. 441–460 (2007)
Cohen, E., Dahlweid, M., Hillebrand, M., Leinenbach, D., Moskal, M., Santen, T., Schulte, W., Tobies, S.: VCC: A Practical System for Verifying Concurrent C. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 23–42. Springer, Heidelberg (2009)
O’Hearn, P.W., Reynolds, J., Yang, H.: Local Reasoning about Programs that Alter Data Structures. In: Fribourg, L. (ed.) CSL 2001. LNCS, vol. 2142, pp. 1–19. Springer, Heidelberg (2001)
Kassios, I.T.: The dynamic frames theory. Formal Aspects of Computing 23(3), 267–288 (2011)
Banerjee, A., Naumann, D.A., Rosenberg, S.: Local reasoning for global invariants, part I: Region logic. Extended version of [64] (2011), http://www.cs.stevens.edu/~naumann/pub/locResGloInvI.pdf
Banerjee, A., Naumann, D.A.: Local reasoning for global invariants, part II: Dynamic boundaries. Extended version of [65] (2011), http://www.cs.stevens.edu/~naumann/pub/locResGloInvII.pdf
Verl: VErifier for Region Logic Software distribution, http://www.cs.stevens.edu/~naumann/pub/VERL/
Dafny: http://boogie.codeplex.com/
Leino, K.R.M.: Dafny: An Automatic Program Verifier for Functional Correctness. In: Clarke, E.M., Voronkov, A. (eds.) LPAR-16 2010. LNCS (LNAI), vol. 6355, pp. 348–370. Springer, Heidelberg (2010)
Parkinson, M.J., Bierman, G.M.: Separation logic and abstraction. In: ACM Symp. on Princ. of Program. Lang., pp. 247–258 (2005)
Distefano, D., Parkinson, M.J.: jStar: Towards practical verification for Java. In: ACM Conference on Object-Oriented Programming Languages, Systems, and Applications, pp. 213–226 (2008)
Parkinson, M.J.: Class invariants: the end of the road? In: International Workshop on Aliasing, Confinement and Ownership in Object-oriented Programming (2007)
Vitek, J., Bokowski, B.: Confined types in Java. Software Practice and Experience 31(6), 507–532 (2001)
Banerjee, A., Naumann, D.A., 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)
Naumann, D.A., Banerjee, A.: Dynamic Boundaries: Information Hiding by Second Order Framing with First Order Assertions. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 2–22. Springer, Heidelberg (2010)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Banerjee, A., Naumann, D.A. (2013). State Based Encapsulation for Modular Reasoning about Behavior-Preserving Refactorings. In: Clarke, D., Noble, J., Wrigstad, T. (eds) Aliasing in Object-Oriented Programming. Types, Analysis and Verification. Lecture Notes in Computer Science, vol 7850. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-36946-9_12
Download citation
DOI: https://doi.org/10.1007/978-3-642-36946-9_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-36945-2
Online ISBN: 978-3-642-36946-9
eBook Packages: Computer ScienceComputer Science (R0)