Skip to main content
Log in

Generating certified code from formal proofs: a case study in homological algebra

  • Original Article
  • Published:
Formal Aspects of Computing

Abstract

We apply current theorem proving technology to certified code in the domain of abstract algebra. More concretely, based on a formal proof of the Basic Perturbation Lemma (a central result in homological algebra) in the prover Isabelle/HOL, we apply various code generation techniques, which lead to certified implementations of the associated algorithm in ML. In the formal proof, algebraic structures occurring in the Basic Perturbation Lemma are represented in a way, which is not directly amenable to code generation with the available tools. Interestingly, this representation is required in the proof, while for the algorithm simpler data structures are sufficient. Our approach is to establish a link between the non-executable setting of the proof and the executable representation in the algorithm, which is to be generated. This correspondence is established within the logical framework of Isabelle/HOL—that is, it is formally proved correct. The generated code is applied to and illustrated with a number of examples.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aransay J, Ballarin C, Rubio J (2004) Four approaches to automated reasoning with differential algebraic structures. In: Buchberger B, Campbell JA (eds) AISC 2004, 7th International conference on artificial intelligence and symbolic computation, Linz, Austria, September 2004. Lecture notes in artificial intelligence vol 3249. Springer, Heidelberg, pp 222–235

  2. Aransay J, Ballarin C, Rubio J (2005) Extracting computer algebra programs from statements. In: Moreno-Díaz R, Pichler F, Quesada-Arencibia A (eds) EUROCAST 2005, 10th international conference on computer aided systems theory, Las Palmas de Gran Canaria, Spain, February 2005. Lecture notes in computer science, vol 3643. Springer, Hidelberg, pp 159–168

  3. Aransay J, Ballarin C, Rubio J (2008) A mechanized proof of the Basic Perturbation Lemma. J Autom Reason 40(4): 271–292

    Article  MATH  MathSciNet  Google Scholar 

  4. Aransay J (2006) Mechanized reasoning in homological algebra. PhD thesis, Universidad de La Rioja, http://www.unirioja.es/servicios/sp/tesis/tesis34.shtml

  5. Aransay J (2008) Code generation from the Basic Perturbation Lemma in Isabelle/HOL, http://www.unirioja.es/cu/jearansa/BPL/code_generation/index.html

  6. Ballarin C (2004) Locales and locale expressions in Isabelle/Isar. In: Berardi S, Coppo M, Damiani F (eds) TYPES 2003, 3rd international workshop on types for proofs and programs, Torino, Italy, May 2003. Lecture notes in computer science, vol 3085. Springer, Heidelberg, pp 34–50

  7. Ballarin C (2006) Interpretation of locales in Isabelle: Theories and proof contexts. In: Borwein JM, Farmer WM (eds), MKM 2006, 5th international conference on mathematical knowledge management, wokingham, UK, August 2006. Lecture notes in artificial intelligence, vol. 4108. Springer, Heidelberg, pp 31–43

  8. Berghofer S (2003) Program extraction in simply-typed higher order logic. In: Geuvers H, Wiedijk F (eds) TYPES 2002, 2nd international workshop on types for proofs and programs, Berg en Dal, The Netherlands, April 2002. Lecture Notes in Computer Science, vol 2646. Springer, Heidelberg, pp 21–38

  9. Berghofer S (2003) Proofs, programs and executable specifications in higher order logic. PhD thesis, Technische Universität München

  10. Barnes DW, Lambe LA (1991) Fixed point approach to Homological Perturbation Theory. Proc Am Math Soc 112(3): 881–892

    Article  MATH  MathSciNet  Google Scholar 

  11. Coquand T, Spiwack A (2007) Towards constructive homological algebra in type theory. In: Miner R, Kauers M, Kerber M, Windsteiger W (eds) 14th Symposium, Calculemus 2007, 6th International Conference, MKM 2007, Hagenberg, Austria, June 2007. Lecture notes in computer science, vol 4573. Springer, Heidelberg, pp 40–54

  12. Domínguez C, Lambán L, Rubio J (2007) Object-oriented institutions to specify symbolic computation systems. Rairo Theor Inf Appl 41: 191–214

    Article  MATH  Google Scholar 

  13. Dousson X, Sergeraert F, Siret Y (1999) The Kenzo program. http://www-fourier.ujf-grenoble.fr/~sergerar/Kenzo/, April 1999

  14. Gonthier G, Mahboubi A, Rideau L, Tassi E, Théry L (2007) A modular formalisation of finite group theory. In: Schneider K, Brandt J (eds) TPHOLs’07, 20th international conference on theorem proving in higher-order logics, Kaiserslautern, Germany, September 2007. Lecture notes in computer science, vol 4732. Springer, Heidelberg, pp 86–101

  15. Gugenheim VKAM (1972) On the chain complex of a fibration. Ill J Math 16(3): 398–414

    MATH  MathSciNet  Google Scholar 

  16. Haftmann F (2007) Code generation from Isabelle/HOL theories. Technical report, Technische Universität München, http://isabelle.in.tum.de/doc/codegen.pdf

  17. Haftmann F (2007) Haskell-style type classes with Isabelle/Isar. Technical report, Technische Universität München, http://isabelle.in.tum.de/doc/classes.pdf

  18. Hales T, The flyspeck project. http://code.google.com/p/flyspeck/

  19. Haftmann F, Nipkow T (2007) A code generator framework for Isabelle/HOL. Technical Report 364/07, Department of Computer Science, University of Kaiserslautern

  20. Jones S, Jones M, Meijer E (1997) Type classes: an exploration of the design space. In: Proceedings of the Haskell Workshop, Amsterdam

  21. Kammüller F, Paulson LC (1999) A formal proof of Sylow’s Theorem—an experiment in Abstract Algebra with Isabelle/HOL. J Autom Reason 23(3): 235–264

    Article  MATH  Google Scholar 

  22. Krauss A (2007) Defining recursive functions in Isabelle/HOL. http://isabelle.in.tum.de/dist/Isabelle/doc/functions.pdf

  23. Lambán L, Pascual V, Rubio J (2003) An object-oriented interpretation of the EAT system. Appl Algebra Eng Commun Comput 14(3): 187–215

    Article  MATH  Google Scholar 

  24. Nipkow T, Paulson LC, Wenzel M (2002) Isabelle/HOL: a proof assistant for higher order logic. Lecture notes in computer science, vol 2283. Springer, Heidelberg

  25. Naraschewski W, Wenzel M (1998) Object-oriented verification based on record subtyping in higher-order logic. In: Grundy J, Newey M (eds) TPHOLs’98, 11th international conference on theorem proving in higher-order logics, Canberra, Australia, September 1998. Lecture notes in computer science, vol 1479. Springer, Heidelberg, pp 349–366

  26. Obua S (2005) Proving bounds for real linear programs in Isabelle/HOL. In: Hurd J, Melham T (eds) TPHOLs’05, 18th international conference on theorem proving in higher-order logics 2007, Oxford, UK, August 2005. Lecture notes in computer science, vol 3603. Springer, Heidelberg, pp 227–244

  27. Obua S (2007) Proof pearl: looping around the orbit. In: Schneider K, Brandt J (eds) TPHOLs’07, 20th international conference on theorem proving in higher-order logics 2007, Kaiserslautern, Germany, September 2007. Lecture notes in computer science, vol. 4732. Springer, Heidelberg, pp 223–231

  28. Obua S (2008) Flyspeck II: the basic linear programs. PhD thesis, Technishe Universität München

  29. Owens S, Slind K (2008) Adapting functional programs to higher order logic. Higher Order Symb Comput 21(4): 377–409

    Article  MATH  Google Scholar 

  30. Rubio J, Sergeraert F (1997) Constructive algebraic topology. Lecture notes summer school in fundamental algebraic topology, Institut Fourier, http://www-fourier.ujf-grenoble.fr/~sergerar/Summer-School/

  31. Wadler P, Blott S (1989) How to make ad-hoc polymorphism less ad-hoc. In: Conference record of the 16th annual ACM symposium on principles of programming languages. ACM, New York, pp 60–76

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jesús Aransay.

Additional information

Communicated by M. Broy

This work has been partially supported by Ministerio de Educación y Ciencia, project MTM2006-06513.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Aransay, J., Ballarin, C. & Rubio, J. Generating certified code from formal proofs: a case study in homological algebra. Form Asp Comp 22, 193–213 (2010). https://doi.org/10.1007/s00165-009-0120-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00165-009-0120-0

Keywords

Navigation