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.

[1]  Tobias Nipkow,et al.  A Code Generator Framework for Isabelle / HOL , 2007 .

[2]  Christian Urban,et al.  Nominal Techniques in Isabelle/HOL , 2005, Journal of Automated Reasoning.

[3]  Jim Alves-Foss,et al.  Higher Order Logic Theorem Proving and its Applications 8th International Workshop, Aspen Grove, Ut, Usa, September 11-14, 1995 : Proceedings , 1995 .

[4]  Andreas Lochbihler Jinja with Threads , 2007, Arch. Formal Proofs.

[5]  Don Syme,et al.  A Theory of Finite Maps , 1995, TPHOLs.

[6]  Alexander Krauss Partial Recursive Functions in Higher-Order Logic , 2006, IJCAR.

[7]  Markus Wenzel,et al.  Constructive Type Classes in Isabelle , 2006, TYPES.

[8]  Tobias Nipkow,et al.  Proof Pearl: Defining Functions over Finite Sets , 2005, TPHOLs.

[9]  Tobias Nipkow,et al.  Random testing in Isabelle/HOL , 2004, Proceedings of the Second International Conference on Software Engineering and Formal Methods, 2004. SEFM 2004..

[10]  Stefan Berghofer,et al.  Inductive Datatypes in HOL - Lessons Learned in Formal-Logic Engineering , 1999, TPHOLs.

[11]  Tobias Nipkow,et al.  Executing Higher Order Logic , 2000, TYPES.

[12]  Peter Dybjer,et al.  Combining Testing and Proving in Dependent Type Theory , 2003, TPHOLs.

[13]  Maribel Fernández,et al.  Curry-Style Types for Nominal Terms , 2006, TYPES.

[14]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

[15]  J. Harrison Metatheory and Reflection in Theorem Proving: A Survey and Critique , 1995 .

[16]  Christian Urban,et al.  A Recursion Combinator for Nominal Datatypes Implemented in Isabelle/HOL , 2006, IJCAR.

[17]  David Aspinall,et al.  Formalising Java's Data Race Free Guarantee , 2007, TPHOLs.

[18]  Andreas Lochbihler Type Safe Nondeterminism ñ A Formal Semantics of Java Threads , 2007 .

[19]  Andreas Lochbihler Code Generation for Functions as Data , 2009, Arch. Formal Proofs.

[20]  Tobias Nipkow,et al.  AVL Trees , 2004, Arch. Formal Proofs.

[21]  Larry Wos,et al.  What Is Automated Reasoning? , 1987, J. Autom. Reason..