Extraction of Structured Programs from Specification Proofs

  • John N. Crossley
  • Iman Poernomo
  • Martin Wirsing
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1827)


We present a method using an extended logical system for obtaining programs from specifications written in a sublanguage of CASL. These programs are “correct” in the sense that they satisfy their specifications. The technique we use is to extract programs from proofs in formal logic by techniques due to Curry and Howard. The logical calculus, however, is novel because it adds structural rules corresponding to the standard ways of modifying specifications: translating (renaming), taking unions, and hiding signatures. Although programs extracted by the Curry-Howard process can be very cumbersome, we use a number of simplifications that ensure that the programs extracted are in a language close to a standard high-level programming language. We use this to produce an executable refinement of a given specification and we then provide a method for producing a program module that maximally respects the original structure of the specification. Throughout the paper we demonstrate the technique with a simple example.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Albrecht, D.W., Crossley, J.N.: Program extraction, simplified proof-terms and realizability, Technical Report 271, Dept of Computer Science, Monash University, Australia (1997) Google Scholar
  2. 2.
    Anderson, P.: Representing proof transformations for program optimization. In: Bundy, A. (ed.) CADE 1994. LNCS, vol. 814, pp. 575–590. Springer, Heidelberg (1994)Google Scholar
  3. 3.
    Barbanera, F., Berardi, S.: A Symmetric Lambda-Calculus for “Classical” Program Extraction”. Information and Computation 125, 103–117 (1996)CrossRefMathSciNetMATHGoogle Scholar
  4. 4.
    Berger, U., Schwichtenberg, H.: Program development by Proof Transformation. In: Proceedings of the NATO Advanced Study Institute on Proof and Computation, Marktoberdorf, Germany (1993); published in cooperation with the NATO Scientific Affairs Division, pp. 1–45 Google Scholar
  5. 5.
    CoFI Language Design Task Group, CASL – The CoFI Algebraic Specification Language – Summary, version 1.0, 22 (July 1999), available at http://www.dcs.ed.ac.uk/home/dts/CoFI/Documents/CASL/Summary/index.html
  6. 6.
    Cengarle, M. V., Formal Specifications with Higher-Order Parametrization, PhD Thesis, Ludwig-Maximilians-Universität, München (1994) Google Scholar
  7. 7.
    Constable, R.L.: Implementing Mathematics with the Nuprl Proof Development System. Prentice Hall, Englewood Cliffs (1986)Google Scholar
  8. 8.
    Crossley, J.N., Shepherdson, J.C.: Extracting programs from proofs by an extension of the Curry-Howard process. In: Crossley, J.N., Remmel, J.B., Shore, R.A., Sweedler, M.E. (eds.) Logical Methods, pp. 222–288. Birkhäuser, Boston (1993)Google Scholar
  9. 9.
    Crossley, J.N., Poernomo, I.H., Wirsing, M.: Extracting Structured Programs from Specification Proofs (in preparation) Google Scholar
  10. 10.
    Gallier, J.: Constructive Logics. A Tutorial on Proof-systems and Typed λ-Calculi. TCS 110, 249–339 (1993)MathSciNetMATHGoogle Scholar
  11. 11.
    Girard, J.-Y., Lafont, Y., Taylor, P.: Proofs and types. Cambridge University Press, Cambridge (1989)MATHGoogle Scholar
  12. 12.
    Harrop, R.: Concerning formulas of the types AB ∨ C, A → (Ex)B(x) in Intuitionistic Formal Systems. J. Symb. Logic 25, 27–32 (1960)CrossRefMathSciNetMATHGoogle Scholar
  13. 13.
    Hayashi, S., Nakano, H.: PX, a computational logic. MIT Press, Cambridge (1988)Google Scholar
  14. 14.
    Hennicker, R., Wirsing, M., Bidoit, M.: Proof systems for structured specifications with observability operators. TCS 173, 393–443 (1997)CrossRefMathSciNetMATHGoogle Scholar
  15. 15.
    Jeavons, J., Poernomo, I., Crossley, J., Basit, B.: Fred: an implementation of a layered approach to extracting programs from proofs. Part I: an application in graph theory. In: Lloyd, J.W. (ed.) AWCL (Australian Workshop on Computational Logic), Proceedings, Canberra, Australia, pp. 57–66 (February 2000)Google Scholar
  16. 16.
    Kleene, S.C.: Introduction to Metamathematics. North-Holland, Amsterdam (1952)MATHGoogle Scholar
  17. 17.
    Sannella, D.T., Tarlecki, A.: Toward formal development of programs from algebraic specifications: Implementations revisited. Acta Informatica 25, 233–281 (1988)CrossRefMathSciNetMATHGoogle Scholar
  18. 18.
    Santen, T., Kammüller, F., Jähnichen, S., Beyer, M.: Formalization of Algebraic Specification in the Development language DEVA. In: Jähnichen, S., Broy, M. (eds.) KORSO 1995. LNCS, vol. 1009, pp. 223–238. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  19. 19.
    Smith, D.R.: Constructing Specification Morphisms. J. Symbolic Computation 15, 571–606 (1993)CrossRefMATHGoogle Scholar
  20. 20.
    Wirsing, M. and M. Broy: A modular framework for algebraic specification and implementation, in J. Diaz and F. Orejas (eds), TAPSOFT 89, LNCS 351, vol. 1, Springer, 1989, pp. 42–73. 420 Google Scholar
  21. 21.
    Wirsing, M., Crossley, J.N., Peterreins, H.: Proof normalization of structured algebraic specifications is convergent. In: Fiadeiro, J.L. (ed.) WADT 1998. LNCS, vol. 1589, pp. 326–340. Springer, Heidelberg (1999)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • John N. Crossley
    • 1
  • Iman Poernomo
    • 1
  • Martin Wirsing
    • 2
  1. 1.School of Computer Science and Software EngineeringMonash University ClaytonAustralia
  2. 2.Institut für InformatikLudwig-Maximilians UniversitätMünchenGermany

Personalised recommendations