Enhancing the pre- and postcondition technique for more expressive specifications

  • Gary T. Leavens
  • Albert L. Baker
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1709)


We describe enhancements to the pre- and postcondition technique that help specifications convey information more effectively. Some enhancements allow one to specify redundant information that can be used in “debugging” specifications. For instance, adding examples to a specification gives redundant information that may aid some readers, and can also be used to help ensure that the specification says what is intended. Other enhancements allow improvements in frame axioms for object-oriented (OO) procedures, better treatments of exceptions and inheritance, and improved support for incompletely-specified types. Many of these enhancements were invented by other authors, but are not widely known. They have all been integrated into Larch/C+++, a Larchstyle behavioral interface specification language for C++. However, such enhancements could also be used to make other specification languages more effective tools for communication.


specification language design expressiveness liberal specification redundancy debugging history constraint Larch 


  1. [1]
    Derek Andrews. A Theory and Practice of Program Development. FACIT. Springer-Verlag, London, UK, 1997.zbMATHGoogle Scholar
  2. [2]
    R. J. R. Back. A calculus of refinements for program derivations. Acta Informatica, 25(6):593–624, August 1988.zbMATHCrossRefMathSciNetGoogle Scholar
  3. [3]
    R. J. R. Back and J. von Wright. Combining angels, deamons and miracles in program specifications. Theoretical Computer Science, 100(2):365–383, June 1992.zbMATHCrossRefMathSciNetGoogle Scholar
  4. [4]
    Ralph-Johan Back and Joakim von Wright. Refinement Calculus: A Systematic Introduction. Springer-Verlag, 1998.Google Scholar
  5. [5]
    Alex Borgida, John Mylopoulos, and Raymond Reiter. ’... and nothing else changes‘: The frame problem in procedure specification. In Proceedings Fifteenth International Conference on Software Engineering, Baltimore, May 1993. Preliminary version obtained from the authors.Google Scholar
  6. [6]
    Martin Büchi and Emil Sekerinski. Formal methods for component software: The refinement calculus perspective. In Proceedings of the Second Workshop on Component-Oriented Programming (WCOP), June 1997.
  7. [7]
    Patrice Chalin. On the Language Design and Semantic Foundation of LCL, a Larch/C Interface Specification Language. PhD thesis, Concordia University, 1455 de Maisonneuve Blvd. West, Montreal, Quebec, Canada, October 1995. Available as CU/DCS TR 95-12, from the URL
  8. [8]
    Patrice Chalin, Peter Grogono, and T. Radhakrishnan. Identification of and solutions to shortcomings of LCL, a Larch/C interface specification language. In Marie-Claude Gaudel and James Woodcock, editors, FME’ 96: Industrial Benefit and Advances in Formal Methods, volume 1051 of Lecture Notes in Computer Science, pages 385–404, New York, N.Y., March 1996. Springer-Verlag.Google Scholar
  9. [9]
    David L. Detlefs, K. Rustan M. Leino, Greg Nelson, and James B. Saxe. Extended static checking. SRC Research Report 159, Compaq Systems Research Center, 130 Lytton Ave., Palo Alto, Dec 1998.Google Scholar
  10. [10]
    Krishna Kishore Dhara. Behavioral subtyping in object-oriented languages. Technical Report TR97-09, Department of Computer Science, Iowa State University, 226 Atanasoff Hall, Ames IA 50011-1040, May 1997. The author’s Ph.D. dissertation.Google Scholar
  11. [11]
    Krishna Kishore Dhara and Gary T. Leavens. Forcing behavioral subtyping through specification inheritance. In Proceedings of the 18th International Conference on Software Engineering, Berlin, Germany, pages 258–267. IEEE Computer Society Press, March 1996. A corrected version is Iowa State University, Dept. of Computer Science TR #95-20c.Google Scholar
  12. [12]
    E. W. Dijkstra, editor. Formal Development of Programs and Proofs. University of Texas at Austin Year of Programming series. Addison-Wesley Publishing Co., 1990.Google Scholar
  13. [13]
    Edsger W. Dijkstra. A Discipline of Programming. Prentice-Hall, Inc., Englewood Cliffs, N.J., 1976.Google Scholar
  14. [14]
    Edsger W. Dijkstra and Carel S. Scholten. Predicate Calculus and program semantics. Springer-Verlag, NY, 1990.zbMATHGoogle Scholar
  15. [15]
    L. M. G. Feijs and H. B. M. Jonkers. Formal Specification and Design, volume 35 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, Cambridge, UK, 1992.zbMATHGoogle Scholar
  16. [16]
    John Fitzgerald and Peter Gorm Larsen. Modelling Systems: Practical Tools in Software Development. Cambridge, Cambridge, UK, 1998.Google Scholar
  17. [17]
    Stephen J. Garland, John V. Guttag, and James J. Horning. Debugging Larch Shared Language specifications. IEEE Transactions on Software Engineering, 16(6):1044–1057, September 1990.CrossRefGoogle Scholar
  18. [18]
    M. Gogolla, S. Conrad, G. Denker, R. Herzig, N. Vlachantonis, and H. Ehrig. the language and its development environment. In Manfred Broy and Stefan Jähnichen, editors, KORSO: Methods, Languages and Tools for the Construction of Correct Software, volume 1009 of Lecture Notes in Computer Science, pages 205–220. Springer-Verlag, New York, N.Y., 1995.CrossRefGoogle Scholar
  19. [19]
    David Gries. Teaching calculation and discrimination: A more effective curriculum. Communications of the ACM, 34(3):44–55, March 1991.CrossRefGoogle Scholar
  20. [20]
    David Gries and Fred B. Schneider. A Logical Approach to Discrete Math. Texts and Monographs in Computer Science. Springer-Verlag, New York, N.Y., 1994.Google Scholar
  21. [21]
    David Gries and Fred B. Schneider. Avoiding the undefined by underspecification. In Jan van Leeuwen, editor, Computer Science Today: Recent Trends and Developments, number 1000 in Lecture Notes in Computer Science, pages 366–373. Springer-Verlag, New York, N.Y., 1995.Google Scholar
  22. [22]
    M. Gurski and A. L. Baker. Testing SPECS-C++: A first step in validating distributed systems. In Intellegent Information Management Systems, pages 105–108, Anaheim, 1994. The International Society for Mini and Microcomputers-ISMM.Google Scholar
  23. [23]
    John V. Guttag, James J. Horning, S.J. Garland, K.D. Jones, A. Modet, and J.M. Wing. Larch: Languages and Tools for Formal Specification. Springer-Verlag, New York, N.Y., 1993.zbMATHGoogle Scholar
  24. [24]
    I. Hayes, editor. Specification Case Studies. International Series in Computer Science. Prentice-Hall, Inc., second edition, 1993.Google Scholar
  25. [25]
    Wim H. Hesselink. Programs, Recursion, and Unbounded Choice, volume 27 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, New York, N.Y., 1992.zbMATHGoogle Scholar
  26. [26]
    C. A. R. Hoare. An axiomatic basis for computer programming. Communications of the ACM, 12(10):576–583, October 1969.zbMATHCrossRefGoogle Scholar
  27. [27]
    C.B. Jones. Partial functions and logics: A warning. Information Processing Letters, 54(2):65–67, 1995.zbMATHCrossRefGoogle Scholar
  28. [28]
    Cliff B. Jones. Systematic Software Development Using VDM. International Series in Computer Science. Prentice Hall, Englewood Cliffs, N.J., second edition, 1990.Google Scholar
  29. [29]
    Kevin D. Jones. LM3: A Larch interface language for Modula-3: A definition and introduction: Version 1.0. Technical Report 72, Digital Equipment Corporation, Systems Research Center, 130 Lytton Avenue Palo Alto, CA 94301, June 1991. Order from Scholar
  30. [30]
    H. B. M. Jonkers. Upgrading the pre-and postcondition technique. In S. Prehn and W. J. Toetenel, editors, VDM’ 91 Formal Software Development Methods 4th International Symposium of VDM Europe Noordwijkerhout, The Netherlands, Volume 1: Conference Contributions, volume 551 of Lecture Notes in Computer Science, pages 428–456. Springer-Verlag, New York, N.Y., October 1991.Google Scholar
  31. [31]
    Kevin Lano. The B Language and Method: A guide to Practical Formal Development. Formal Appoaches to Computing and Information Technology. Springer-Verlag, London, UK, 1996.Google Scholar
  32. [32]
    Gary T. Leavens. An overview of Larch/C++: Behavioral specifications for C++ modules. In Haim Kilov and William Harvey, editors, Specification of Behavioral Semantics in Object-Oriented Information Modeling, chapter 8, pages 121–142. Kluwer Academic Publishers, Boston, 1996. An extended version is TR #96-01d, Department of Computer Science, Iowa State University, Ames, Iowa, 50011.CrossRefGoogle Scholar
  33. [33]
    Gary T. Leavens. Larch/C++ Reference Manual. Version 5.41. Available in or on the World Wide Web at the URL, April 1999.
  34. [34]
    Gary T. Leavens, Albert L. Baker, and Clyde Ruby. Preliminary design of JML: A behavioral interface specification language for Java. Technical Report 98-06e, Iowa State University, Department of Computer Science, June 1999.Google Scholar
  35. [35]
    Gary T. Leavens and Jeannette M. Wing. Protective interface specifications. In Michel Bidoit and Max Dauchet, editors, TAPSOFT’ 97: Theory and Practice of Software Development, 7th International Joint Conference CAAP/FASE, Lille, France, volume 1214 of Lecture Notes in Computer Science, pages 520–534. Springer-Verlag, New York, N.Y., 1997.Google Scholar
  36. [36]
    Gary T. Leavens and Jeannette M. Wing. Protective interface specifications. Formal Aspects of Computing, 10:59–75, 1998.zbMATHCrossRefGoogle Scholar
  37. [37]
    K. Rustan M. Leino. Toward Reliable Modular Programs. PhD thesis, California Institute of Technology, 1995. Available as Technical Report Caltech-CS-TR-95-03.Google Scholar
  38. [38]
    Barbara Liskov and Jeannette Wing. A behavioral notion of subtyping. ACM Transactions on Programming Languages and Systems, 16(6):1811–1841, November 1994.CrossRefGoogle Scholar
  39. [39]
    Barbara Liskov and Jeannette M. Wing. Specifications and their use in defining subtypes. ACM SIGPLAN Notices, 28(10):16–28, October 1993. OOPSLA’ 93 Proceedings, Andreas Paepcke (editor).Google Scholar
  40. [40]
    David Luckham. Programming with Specifications: An Introduction to Anna, A Language for Specifying Ada Programs. Texts and Monographs in Computer Science. Springer-Verlag, New York, N.Y., 1990.Google Scholar
  41. [41]
    David Luckham and FriedrichW. von Henke. An overview of anna-a specification language for Ada. IEEE Software, 2(2):9–23, March 1985.CrossRefGoogle Scholar
  42. [42]
    Bertrand Meyer. Object-oriented Software Construction. Prentice Hall, New York, N.Y., second edition, 1997.zbMATHGoogle Scholar
  43. [43]
    Carroll Morgan. Programming from Specifications: Second Edition. Prentice Hall International, Hempstead, UK, 1994.Google Scholar
  44. [44]
    Carroll Morgan and Trevor Vickers, editors. On the refinement calculus. Formal approaches of computing and information technology series. Springer-Verlag, New York, N.Y., 1994.Google Scholar
  45. [45]
    Joseph M. Morris. A theoretical basis for stepwise refinement and the programming calculus. Science of Computer Programming, 9(3):287–306, December 1987.zbMATHCrossRefMathSciNetGoogle Scholar
  46. [46]
    Greg Nelson. A generalization of Dijkstra’s calculus. ACM Transactions on Programming Languages and Systems, 11(4):517–561, October 1989.CrossRefGoogle Scholar
  47. [47]
    William F. Ogden, Murali Sitaraman, Bruce W. Weide, and Stuart H. Zweben. Part I: The RESOLVE framework and discipline-a research synopsis. ACM SIGSOFT Software Engineering Notes, 19(4):23–28, Oct 1994.CrossRefGoogle Scholar
  48. [48]
    D. E. Perry. The Inscape environment. In Proceedings of the 11th International Conference on Software Engineering, pages 2–12, May 1989.Google Scholar
  49. [49]
    Arnd Poetzsch-Heffter. Specification and verification of object-oriented programs. Habilitation thesis, Technical University of Munich, January 1997.Google Scholar
  50. [50]
    David S. Rosenblum. A practical approach to programming with assertions. IEEE Transactions on Software Engineering, 21(1):19–31, January 1995.CrossRefGoogle Scholar
  51. [51]
    Murali Sitaraman, Lonnie R. Welch, and Douglas E. Harms. On specification of reusable software components. International Journal of Software Engineering and Knowledege Engineering, 3(2):207–229, 1993.CrossRefGoogle Scholar
  52. [52]J
    . Michael Spivey. The Z Notation: A Reference Manual. International Series in Computer Science. Prentice-Hall, New York, N.Y., second edition, 1992.Google Scholar
  53. [53]
    Susan Stepney, Rosalind Barden, and David Cooper, editors. Object Orientation in Z. Workshops in Computing. Springer-Verlag, Cambridge CB2 1LQ, UK, 1992.Google Scholar
  54. [54]
    Yang Meng Tan. Formal specification techniques for promoting software modularity, enhancing documentation, and testing specifications. Technical Report 619, Massachusetts Institute of Technology, Laboratory for Computer Science, 545 Technology Square, Cambridge, Mass., June 1994.Google Scholar
  55. [55]
    Yang Meng Tan. Interface language for supporting programming styles. ACM SIGPLAN Notices, 29(8):74–83, August 1994. Proceedings of the Workshop on Interface Definition Languages.CrossRefGoogle Scholar
  56. [56]
    Yang Meng Tan. Formal Specification Techniques for Engineering Modular C Programs, volume 1 of Kluwer International Series in Software Engineering. Kluwer Academic Publishers, Boston, 1995.Google Scholar
  57. [57]
    Alan Wills. Specification in Fresco. In Stepney et al. [53], chapter 11, pages 127–135.Google Scholar
  58. [58]
    Jeannette M. Wing. Writing Larch interface language specifications. ACM Transactions on Programming Languages and Systems, 9(1):1–24, January 1987.zbMATHCrossRefMathSciNetGoogle Scholar
  59. [59]
    Jeannette Marie Wing. A two-tiered approach to specifying programs. Technical Report TR-299, Massachusetts Institute of Technology, Laboratory for Computer Science, 1983.Google Scholar
  60. [60]
    Jim Woodcock and Jim Davies. Using Z: Specification, Refinement, and Proof. Prentice Hall International Series in Computer Science, 1996.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Gary T. Leavens
    • 1
  • Albert L. Baker
    • 1
  1. 1.Department of Computer ScienceIowa State UniversityAmesUSA

Personalised recommendations