Home

Awesome

lngen build

Tool for generating Locally Nameless definitions and proofs in Coq, working together with Ott

Overview

LNgen generates statements and proofs of "infrastructure" lemmas for locally nameless representations in the [Coq proof assistant] 1. It takes as input language definitions written in the [Ott specification language] 2. LNgen is not a complete replacement for Ott's Coq back end: the output from LNgen relies on the definitions generated by Ott.

Dependencies

Building LNgen

You can use either the Haskell tools cabal or stack to build lngen.

To compile and run with cabal (new style, uses system GHC)

  cabal new-build
  cabal new-exec lngen  <command line flags, see below>

To compile and run with stack (GHC version determined by stack.yaml)

  stack build
  stack exec lngen <command line flags, see below>

To compile with cabal (old style, installs lngen in your path):

  cabal v1-build
  lngen

Using LNgen

  1. Write an Ott specification for your language, e.g., lang.ott, keeping in mind the restrictions below.

  2. Run ott on the specification to produce a Coq file containing the language's definitions, e.g.,

     ott --coq lang_ott.v lang.ott
    
  3. Run lngen on the specification to produce a Coq file containing additional infrastructure for the language, e.g.,

     lngen --coq lang_inf.v lang.ott
    

Options

The following options to lngen may be useful:

Restrictions on Ott specifications

Examples

The examples directory contains examples of Ott specifications and the corresponding outputs generated by Ott and LNgen. Each example uses LoadPath directives and symlinks to import copy the metatheory library that comes with the LNgen distribution. The README file in the examples directory contains additional information about each example.

To compile the Coq code for all the examples, run make examples.

Credit

Original code by Brian Aydemir