Formal Aspects of Computing

, Volume 22, Issue 2, pp 193–213 | Cite as

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

Original Article

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.

Keywords

Formalized mathematics Software certification Code generation Homological algebra Isabelle/HOL 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. ABR04.
    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–235Google Scholar
  2. ABR05.
    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–168Google Scholar
  3. ABR08.
    Aransay J, Ballarin C, Rubio J (2008) A mechanized proof of the Basic Perturbation Lemma. J Autom Reason 40(4): 271–292MATHCrossRefMathSciNetGoogle Scholar
  4. Ara06.
    Aransay J (2006) Mechanized reasoning in homological algebra. PhD thesis, Universidad de La Rioja, http://www.unirioja.es/servicios/sp/tesis/tesis34.shtml
  5. Ara08.
    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. Bal04.
    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–50Google Scholar
  7. Bal06.
    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–43Google Scholar
  8. Ber03a.
    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–38Google Scholar
  9. Ber03b.
    Berghofer S (2003) Proofs, programs and executable specifications in higher order logic. PhD thesis, Technische Universität MünchenGoogle Scholar
  10. BL91.
    Barnes DW, Lambe LA (1991) Fixed point approach to Homological Perturbation Theory. Proc Am Math Soc 112(3): 881–892MATHCrossRefMathSciNetGoogle Scholar
  11. CS07.
    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–54Google Scholar
  12. DLR07.
    Domínguez C, Lambán L, Rubio J (2007) Object-oriented institutions to specify symbolic computation systems. Rairo Theor Inf Appl 41: 191–214MATHCrossRefGoogle Scholar
  13. DSS99.
    Dousson X, Sergeraert F, Siret Y (1999) The Kenzo program. http://www-fourier.ujf-grenoble.fr/~sergerar/Kenzo/, April 1999
  14. GMR07.
    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–101Google Scholar
  15. Gug72.
    Gugenheim VKAM (1972) On the chain complex of a fibration. Ill J Math 16(3): 398–414MATHMathSciNetGoogle Scholar
  16. Haf07a.
    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. Haf07b.
    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. Hal.
    Hales T, The flyspeck project. http://code.google.com/p/flyspeck/
  19. HN07.
    Haftmann F, Nipkow T (2007) A code generator framework for Isabelle/HOL. Technical Report 364/07, Department of Computer Science, University of KaiserslauternGoogle Scholar
  20. JJM97.
    Jones S, Jones M, Meijer E (1997) Type classes: an exploration of the design space. In: Proceedings of the Haskell Workshop, AmsterdamGoogle Scholar
  21. KP99.
    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–264MATHCrossRefGoogle Scholar
  22. Kra07.
    Krauss A (2007) Defining recursive functions in Isabelle/HOL. http://isabelle.in.tum.de/dist/Isabelle/doc/functions.pdf
  23. LPR03.
    Lambán L, Pascual V, Rubio J (2003) An object-oriented interpretation of the EAT system. Appl Algebra Eng Commun Comput 14(3): 187–215MATHCrossRefGoogle Scholar
  24. NPW02.
    Nipkow T, Paulson LC, Wenzel M (2002) Isabelle/HOL: a proof assistant for higher order logic. Lecture notes in computer science, vol 2283. Springer, HeidelbergGoogle Scholar
  25. NW98.
    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–366Google Scholar
  26. Obu05.
    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–244Google Scholar
  27. Obu07.
    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–231Google Scholar
  28. Obu08.
    Obua S (2008) Flyspeck II: the basic linear programs. PhD thesis, Technishe Universität MünchenGoogle Scholar
  29. OS08.
    Owens S, Slind K (2008) Adapting functional programs to higher order logic. Higher Order Symb Comput 21(4): 377–409MATHCrossRefGoogle Scholar
  30. RS97.
    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. WB89.
    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–76Google Scholar

Copyright information

© British Computer Society 2009

Authors and Affiliations

  1. 1.Departamento de Matemáticas y ComputaciónUniversidad de La RiojaLa RiojaSpain
  2. 2.Institut für InformatikTechnische Universität MünchenMunichGermany

Personalised recommendations