Formalising FinFuns – Generating Code for Functions as Data from Isabelle/HOL
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.
KeywordsKernel Function Type Class Partial Function Recursive Call Recursive Equation
Unable to display preview. Download preview PDF.
- 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
- 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
- 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
- 11.Lochbihler, A.: Jinja with threads. The Archive of Formal Proofs. Formal proof development (2007), http://afp.sf.net/entries/JinjaThreads.shtml
- 12.Lochbihler, A.: Type safe nondeterminism - a formal semantics of Java threads. In: FOOL 2008 (2008)Google Scholar
- 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
- 15.Nipkow, T., Pusch, C.: AVL trees. The Archive of Formal Proofs. Formal proof development (2004), http://afp.sf.net/entries/AVL-Trees.shtml