Skip to main content
×
Home
    • Aa
    • Aa

Proof-producing translation of higher-order logic into pure and stateful ML

  • MAGNUS O. MYREEN (a1) and SCOTT OWENS (a2)
Abstract
Abstract

The higher-order logic found in proof assistants such as Coq and various HOL systems provides a convenient setting for the development and verification of functional programs. However, to efficiently run these programs, they must be converted (or ‘extracted’) to functional programs in a programming language such as ML or Haskell. With current techniques, this step, which must be trusted, relates similar looking objects that have very different semantic definitions, such as the set-theoretic model of a logic and the operational semantics of a programming language. In this paper, we show how to increase the trustworthiness of this step with an automated technique. Given a functional program expressed in higher-order logic, our technique provides the corresponding program for a functional language defined with an operational semantics, and it provides a mechanically checked theorem relating the two. This theorem can then be used to transfer verified properties of the logical function to the program. We have implemented our technique in the HOL4 theorem prover, translating functions to a subset of Standard ML, and have applied the implementation to examples including functional data structures, a parser generator, cryptographic algorithms, a garbage collector and the 500-line kernel of the HOL light theorem prover. This paper extends our previous conference publication with new material that shows how functions defined in terms of a state-and-exception monad can be translated, with proofs, into stateful ML code. The HOL light example is also new.

Copyright
Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

R. S. Boyer & J. S. Moore (1975) Proving theorems about LISP functions. J. Assoc. Comput. Mach. 22 (1), 129144.

T. Coquand & G. Huet (1988) The calculus of constructions. Inf. Comput. 76 (2–3), 95120.

J. Hurd (2003) Verification of the Miller-Rabin probabilistic primality test. J. Log. Algebr. Program. 56 (1–2), 321.

X. Leroy (2009) A formally verified compiler back-end. J. Autom. Reasoning 43 (4), 363446.

P. Letouzey (2003) A new extraction for Coq. In Types for Proofs and Programs (TYPES). Berlin: Springer, pp. 200219.

G. Li & K. Slind (2007) Compilation as rewriting in higher order logic. In Automated Deduction (CADE), F. Pfenning (ed), vol. 4603. Berlin: Springer, pp. 1934.

G. Li & K. Slind (2008) Trusted source translation of a total function language. In Tools and Algorithms for the Construction and Analysis of Systems (TACAS), C. R. Ramakrishnan & J. Rehof (eds), vol. 4963. Berlin: Springer, pp. 471485.

M. O. Myreen (2010) Reusable verification of a copying collector. In Verified Software: Theories, Tools, Experiments (VSTTE), G. T. Leavens , P. W. O'Hearn & S. K. Rajamani (eds). Berlin: Springer, pp. 142156.

M. O. Myreen (2012) Functional programs: conversions between deep and shallow embeddings. In Interactive Theorem Proving (ITP), L. Beringer & A. Felty (eds), vol. 7406. Berlin: Springer, pp. 412417.

M. O. Myreen & G. Curello (2013) Proof pearl: A verified bignum implementation in x86-64 machine code. In Certified Programs and Proofs (CPP). Cham, Switzerland: Springer, pp. 6681.

M. O. Myreen & J. Davis (2011) A verified runtime for a verified theorem prover. In Interactive Theorem Proving (ITP), M. C. J. D. van Eekelen , H. Geuvers , J. Schmaltz & F. Wiedijk (eds), vol. 6898. Berlin: Springer, pp. 265280.

M. O. Myreen , S. Owens , & R. Kumar (2013) Steps towards verified implementations of HOL Light. In Interactive Theorem Proving (ITP), S. Blazy , C. Paulin-Mohring , & D. Pichardie (eds). Berlin: Springer, pp. 490495.

M. Norrish & K. Slind (2002) A thread of HOL development. Comput. J. 45 (1), 3745.

C. Okasaki (1998) Purely Functional Data Structures. Cambridge, UK: Cambridge University.

S. Owens & K. Slind (2008) Adapting functional programs to higher-order logic. Higher-order Symb. Comput. 21 (4), 377409.

K. Slind , S. Owens , J. Iyoda & M. Gordon (2007) Proof producing synthesis of arithmetic and cryptographic hardware. Form. Asp. Comput. 19 (3), 343362.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics