Mar 20 2018 cs.PL
Verification tools for effectful programming languages often rely on automated theorem provers such as SMT solvers to discharge their proof obligations, usually with very limited facilities for user interaction. When the need arises for logics (e.g., higher order or separation logic) or theories (e.g., non-linear arithmetic) that are hard for SMT solvers to efficiently automate, this style of program verification becomes problematic. Building on ideas from the interactive theorem proving community we introduce Meta-F*, a metaprogramming framework for the F* effectful language and SMT-based program verification tool. Meta-F* allows developers to write effectful metaprograms suitable for proof scripting, user-defined proof automation, and verified program construction and transformation. Metaprograms are effectful programs in F* itself, making good use of F*'s libraries, IDE support, and extraction to efficient native code. Meta-F*, moreover, is well-integrated with F*'s weakest precondition calculus and can solve or pre-process parts of the verification condition while leaving the rest for the SMT solver. We evaluate Meta-F* on a variety of examples, demonstrating that tactics, and metaprogramming in general, improve proof stability and automation in F*. Using metaprogrammed decision procedures for richer logics in combination with SMT solving makes it practical to apply F* in settings that were previously out of reach, such as separation logic, or that suffered from poor automation, such as the non-linear arithmetic proofs needed for verifying cryptographic primitives.