Giter VIP home page Giter VIP logo

plugin_tutorials's Introduction

How to write plugins in Coq

Working environment : merlin, tuareg (open question)

OCaml & related tools

These instructions use OPAM

opam init --root=$PWD/CIW2018 --compiler=4.06.0 -j2
eval `opam config env --root=$PWD/CIW2018`
opam install camlp5 ocamlfind num # Coq's dependencies
opam install lablgtk              # Coqide's dependencies (optional)
opam install merlin               # prints instructions for vim and emacs

Coq

git clone [email protected]:coq/coq.git
cd coq
./configure -profile devel
make -j2
cd ..
export PATH=$PWD/coq/bin:$PATH

This tutorial

git clone [email protected]:ybertot/plugin_tutorials.git
cd plugin_tutorials/tuto0
make .merlin                # run before opening .ml files in your editor
make                        # build

tuto0 : basics of project organization

package a ml4 file in a plugin, organize a Makefile, _CoqProject

  • Example of syntax to add a new toplevel command
  • Example of function call to print a simple message
  • Example of syntax to add a simple tactic (that does nothing and prints a message)
  • To use it:
    cd tuto0; make
    coqtop -I src -R theories Tuto0

In the Coq session type:

    Require Import Tuto0.Loader. HelloWorld.

tuto1 : Ocaml to Coq communication

Explore the memory of Coq, modify it

  • Commands that take arguments: strings, symbols, expressions of the calculus of constructions
  • Commands that interact with type-checking in Coq
  • A command that adds a new definition or theorem
  • A command that uses a name and exploits the existing definitions or theorems
  • A command that exploits an existing ongoing proof
  • A command that defines a new tactic

Compilation and loading must be performed as for tuto0.

tuto2 : Ocaml to Coq communication

A more step by step introduction to writing commands

  • Explanation of the syntax of entries
  • Adding a new type to and parsing to the available choices
  • Handling commands that store information in user-chosen registers and tables

Compilation and loading must be performed as for tuto1.

tuto3 : manipulating terms of the calculus of constructions

Manipulating terms, inside commands and tactics.

  • Obtaining existing values from memory
  • Composing values
  • Verifying types
  • Using these terms in commands
  • Using these terms in tactics
  • Automatic proofs without tactics using type classes and canonical structures

compilation and loading must be performed as for tuto0.

plugin_tutorials's People

Contributors

ybertot avatar

Watchers

Maxime Dénès avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.