From Sets to Bits in Coq

Computer Science abounds in folktales about how — in the early days of computer programming — bit vectors were ingeniously used to encode and manipulate finite sets. Algorithms have thus been developed to minimize memory footprint and maximize efficiency by taking advantage of microarchitectural features. With the development of automated and interactive theorem provers, finite sets have also made their way into the libraries of formalized mathematics. Tailored to ease proving , these representations are designed for symbolic manipulation rather than computational efficiency. This paper aims to bridge this gap. In the Coq proof assistant, we implement a bitset library and prove its correct-ness with respect to a formalization of finite sets. Our library enables a seamless interaction of sets for computing — bitsets — and sets for proving — finite sets.

[1]  Cyril Cohen,et al.  Refinements for Free! , 2013, CPP.

[2]  Henry S. Warren,et al.  Hacker's Delight , 2002 .

[3]  George C. Necula,et al.  Translation validation for an optimizing compiler , 2000, PLDI '00.

[4]  Enrico Tassi,et al.  A Small Scale Reflection Extension for the Coq system , 2008 .

[5]  Xavier Leroy,et al.  Formal verification of a realistic compiler , 2009, CACM.

[6]  Burton H. Bloom,et al.  Space/time trade-offs in hash coding with allowable errors , 1970, CACM.

[7]  Robert L. Constable,et al.  The semantics of reflected proof , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[8]  Jean-Christophe Filliâtre,et al.  Verifying Two Lines of C with Why3: An Exercise in Program Verification , 2012, VSTTE.

[9]  Jean-Raymond Abrial,et al.  The B-book - assigning programs to meanings , 1996 .

[10]  Michael Hedberg,et al.  A coherence theorem for Martin-Löf's type theory , 1998, Journal of Functional Programming.

[11]  Gerwin Klein,et al.  Secure Microkernels, State Monads and Scalable Refinement , 2008, TPHOLs.

[12]  Vincent Siles,et al.  A Refinement-Based Approach to Computational Algebra in Coq , 2012, ITP.

[13]  Arthur Charguéraud,et al.  Characteristic formulae for the verification of imperative programs , 2011, ICFP.

[14]  Adam Chlipala,et al.  Fiat , 2015, POPL.

[15]  Laurent Réveillère,et al.  Devil: an IDL for hardware programming , 2000, OSDI.

[16]  Nick Benton,et al.  Coq: the world's best macro assembler? , 2013, PPDP.

[17]  Tobias Nipkow,et al.  Data Refinement in Isabelle/HOL , 2013, ITP.

[18]  Magnus O. Myreen,et al.  A Trustworthy Monadic Formalization of the ARMv7 Instruction Set Architecture , 2010, ITP.