Advertisement

Formalising FinFuns – Generating Code for Functions as Data from Isabelle/HOL

  • Andreas Lochbihler
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5674)

Abstract

FinFuns are total functions that are constant except for a finite set of points, i.e. a generalisation of finite maps. We formalise them in Isabelle/HOL and present how to safely set up Isabelle’s code generator such that operations like equality testing and quantification on FinFuns become executable. On the code output level, FinFuns are explicitly represented by constant functions and pointwise updates, similarly to associative lists. Inside the logic, they behave like ordinary functions with extensionality. Via the update/constant pattern, a recursion combinator and an induction rule for FinFuns allow for defining and reasoning about operators on FinFuns that directly become executable. We apply the approach to an executable formalisation of sets and use it for the semantics for a subset of concurrent Java.

Keywords

Kernel Function Type Class Partial Function Recursive Call Recursive Equation 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Berghofer, S., Nipkow, T.: Random testing in Isabelle/HOL. In: Proc. SEFM 2004, pp. 230–239. IEEE Computer Society, Los Alamitos (2004)Google Scholar
  2. 2.
    Berghofer, S., Wenzel, M.: Inductive datatypes in HOL – lessons learned in formal-logic engineering. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C., Théry, L. (eds.) TPHOLs 1999. LNCS, vol. 1690, pp. 19–36. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  3. 3.
    Berghofer, S., Nipkow, T.: Executing higher order logic. In: Callaghan, P., Luo, Z., McKinna, J., Pollack, R. (eds.) TYPES 2000. LNCS, vol. 2277, pp. 24–40. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  4. 4.
    Collins, G., Syme, D.: A theory of finite maps. In: Schubert, E.T., Alves-Foss, J., Windley, P. (eds.) HUG 1995. LNCS, vol. 971, pp. 122–137. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  5. 5.
    Dybjer, P., Haiyan, Q., Takeyama, M.: Combining testing and proving in dependent type theory. In: Basin, D., Wolff, B. (eds.) TPHOLs 2003. LNCS, vol. 2758, pp. 188–203. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  6. 6.
    Haftmann, F., Nipkow, T.: A code generator framework for Isabelle/HOL. Technical Report 364/07, Dept. of Computer Science, University of Kaiserslautern (2007)Google Scholar
  7. 7.
    Haftmann, F., Wenzel, M.: Constructive type classes in Isabelle. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006. LNCS, vol. 4502, pp. 160–174. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  8. 8.
    Harrison, J.: Metatheory and reflection in theorem proving: A survey and critique. Technical Report CRC-053, SRI International Cambridge Computer Science Research Centre (1995)Google Scholar
  9. 9.
    Klein, G., Nipkow, T.: A machine-checked model for a Java-like language, virtual machine and compiler. ACM TOPLAS 28, 619–695 (2006)CrossRefGoogle Scholar
  10. 10.
    Krauss, A.: Partial recursive functions in higher-order logic. In: Furbach, U., Shankar, N. (eds.) IJCAR 2006. LNCS, vol. 4130, pp. 589–603. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  11. 11.
    Lochbihler, A.: Jinja with threads. The Archive of Formal Proofs. Formal proof development (2007), http://afp.sf.net/entries/JinjaThreads.shtml
  12. 12.
    Lochbihler, A.: Type safe nondeterminism - a formal semantics of Java threads. In: FOOL 2008 (2008)Google Scholar
  13. 13.
    Lochbihler, A.: Code generation for functions as data. The Archive of Formal Proofs. Formal proof development (2009), http://afp.sf.net/entries/FinFun.shtml
  14. 14.
    Nipkow, T., Paulson, L.C.: Proof pearl: Defining functions over finite sets. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005. LNCS, vol. 3603, pp. 385–396. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  15. 15.
    Nipkow, T., Pusch, C.: AVL trees. The Archive of Formal Proofs. Formal proof development (2004), http://afp.sf.net/entries/AVL-Trees.shtml
  16. 16.
    Urban, C.: Nominal techniques in Isabelle/HOL. Journal of Automatic Reasoning 40(4), 327–356 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Urban, C., Berghofer, S.: A recursion combinator for nominal datatypes implemented in Isabelle/HOL. In: Furbach, U., Shankar, N. (eds.) IJCAR 2006. LNCS, vol. 4130, pp. 498–512. Springer, Heidelberg (2006)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Andreas Lochbihler
    • 1
  1. 1.Universität Karlsruhe (TH)Germany

Personalised recommendations