Abstract

Coq supports a range of built-in tactics, which are engineered primarily to support backward reasoning . Starting from a desired goal, the Coq programmer can use these tactics to manipulate the proof state interactively, applying axioms or lemmas to break the goal into subgoals until all subgoals have been solved. Additionally, it provides support for tactic programming via OCaml and Ltac, so that users can roll their own custom proof automation routines. Unfortunately, though, these tactic languages share a significant weakness. They do not offer the tactic programmer any static guarantees about the soundness of their custom tactics, making large tactic developments difficult to maintain. To address this limitation, Ziliani et al. previously proposed Mtac , a new typed approach to custom proof automation in Coq which provides the static guarantees that OCaml and Ltac are missing. However, despite its name, Mtac is really more of a metaprogramming language than it is a full-blown tactic language: it misses an essential feature of tactic programming, namely the ability to directly manipulate Coq’s proof state and perform backward reasoning on it. In this paper, we present Mtac2 , a next-generation version of Mtac that combines its support for typed metaprogramming with additional support for the programming of backward-reasoning tactics in the style of Ltac. In so doing, Mtac2 introduces a novel feature in tactic programming languages—what we call typed backward reasoning . With this feature, Mtac2 is capable of statically ruling out several classes of errors that would otherwise remain undetected at tactic definition time. We demonstrate the utility of Mtac2’s typed tactics by porting several tactics from a large Coq development, the Iris Proof Mode, from Ltac to Mtac2.

Highlights

  • The Coq proof assistant provides a rich dependently-typed framework in which to formalize 78 mathematics and programming language metatheory

  • We present Mtac2, a next-generation version of Mtac that combines its support for typed metaprogramming with additional support for the programming of backward-reasoning tactics in the style of Ltac

  • This style of backward reasoning is convenient because Coq can often infer many details about how to instantiate lemmas by inspection of the current proof state, and as a result the Coq user can omit these tedious details from their interactive proof scripts

Read more

Summary

INTRODUCTION

Neither offers the tactic programmer any static guarantees about the soundness of their custom tactics: it is easy to define tactics that are accepted by the OCaml compiler (or Ltac interpreter) but that construct ill-typed terms or generate inscrutable errors when they are applied To address this limitation, Ziliani et al [2013, 2015] recently proposed Mtac, a new interpreted language for custom proof automation in Coq which provides the static guarantees that OCaml and Ltac are missing. Mtac is based on the key realization that, at its core, tactic programming is essentially functional programmingÐof the sort already supported by Coq’s functional language GallinaÐextended with certain effects, such as general recursion, syntax inspection, and exception handling These effectful operations are not directly available in Gallina, their static semantics can be described using the type structure of Gallina, and they can be supported by means of a monadic extension to GallinaÐnot unlike the way Haskell extends its pure functional core with computational effects via the IO monad. Mtac introduces a novel feature in tactic programming languagesÐwhat we call typed backward reasoning

An Example Motivating Typed Backward Reasoning
Contributions
THE CORE OF MTAC BY EXAMPLE
MTAC2: ADDING BACKWARD REASONING TO MTAC1
What Is Tactic Composition?
Example Tactic: cintro
TYPED BACKWARD REASONING
CASE STUDY
Symbolic Execution in Ltac
Problems with the Ltac Implementation
Symbolic Execution in Mtac2
Benefits of the Mtac2 Implementation
Backtracking Semantics
Term Reduction
Polymorphic Universes
Opaque Definitions
RELATED AND FUTURE WORK
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.