Home

Awesome

Rewriter

CI (Coq) CI (Coq, dev, Docker) CI (Coq, Alpine)

Publications

Building

This repository requires Coq 8.17 or later, and requires that the version of OCaml used to build Coq be installed and accessible on the system.

Git submodules are used for some dependencies. If you did not clone with --recursive, run

git submodule update --init --recursive

To build:

make

Usage

The entry point is src/Rewriter/Util/plugins/RewriterBuild.v. (Better entry point coming in the future.) There are some examples in src/Rewriter/Rewriter/Examples.v.

The examples from the paper are in src/Rewriter/Rewriter/Examples/PerfTesting/. On the branch with performance data, the perf-*.txt files in the top-level directory contain selected performance data in two-column format, while the perf*.csv files contain all performance data in CSV format. The logs with raw timing data live in the subdirectories of src/Rewriter/Rewriter/Examples/PerfTesting/, and were made with the targets perf-SuperFast, perf-Fast, and perf-Medium targets. The text and csv files were generated with make perf-csv. (The targets perf-Slow and perf-VerySlow exist but take a very, very, very long time to run.)

License

This project is distributed under the terms of the MIT License, the Apache License (Version 2.0), and the BSD 1-Clause License; users may pick which license to apply.

See COPYRIGHT, LICENSE-MIT, LICENSE-APACHE, and LICENSE-BSD-1 for details.

Reading The Code

Actual Synthesis Pipeline

The entry point for clients of the PHOAS expressions we use is Language/API.v. Refer to comments in that file for an explanation of the interface; the following text describes how the expressions are generated, not how to interact with them.

The ordering of files (eliding *Proofs.v files) is:

Language/*.v
    ↑
Rewriter/*.v

Within each directory, the dependency graphs (again eliding *Proofs.v and related files) are:

Within Language/:

  PreCommon.v ←─────────── Pre.v
    ↑                        ↑
Language.v ←── IdentifiersBasicLibrary.v ←──── IdentifiersBasicGenerate.v
    ↑                        ↑
    ├────────────────┐       └────────────────────────────┐
UnderLets.v    IdentifiersLibrary.v ←──────────── IdentifiersGenerate.v
                     ↑                                       ↑
              IdentifiersLibraryProofs.v ←─── IdentifiersGenerateProofs.v

We will come back to the Rewriter/* files shortly.

The files contain:

The files defined in Rewriter/ are split up into the following dependency graph (including some files from Language/ at the top):

IdentifiersLibrary.v ←───────────────────────── IdentifiersGenerate.v
    ↑ ↑                                                   ↑
    │ └──────────────── IdentifiersLibraryProofs.v ←──────┴─ IdentifiersGenerateProofs.v
    │                                     ↑
    │                                     │
    │                                     │
    │                                     │
    │                                     │
Rewriter.v ←────────────────────── ProofsCommon.v ←──────────────────── ProofsCommonTactics.v
    ↑                                 ↗        ↖                                ↑
Reify.v ←──────────────┐           Wf.v   InterpProofs.v                        │
                       │              ↖        ↗                                │
                       └──────────── AllTactics.v ──────────────────────────────┘

Proofs files: For Language.v, there is a semi-arbitrary split between two files Language.Inversion and Language.Wf.

Extended Walkthrough

There's an extended description of much of the codebase in rewriting-extended.md.