Skip to content
1.0
Switch branches/tags
Code

Latest commit

Syntax is: `rewrite [pattern]rule`

In this form, `pattern` is first searched against the
current goal and rule LHS is then matched against the
instanciated pattern. E.g.

  `rewrite [y+_]addrC`

will instantiate `addrC` to `y` and `z` assuming that
the first match of `y+_` in the current goal is `y+z`.

This syntax is compatible with other variants:

  `rewrite -{2}[y+_]addrC`
aa6dc07

Git stats

Files

Permalink
Failed to load latest commit information.

EasyCrypt: Computer-Aided Cryptographic Proofs

EasyCrypt is a toolset for reasoning about relational properties of probabilistic computations with adversarial code. Its main application is the construction and verification of game-based cryptographic proofs.

Table of Contents

Installation requirements

EasyCrypt uses the following third-party tools/libraries:

On POSIX/Win32 systems (GNU/Linux, *BSD, OS-X), we recommend that users install EasyCrypt and all its dependencies via opam.

Via OPAM

Installing requirements using OPAM 2 (POSIX systems)

Opam can be easily installed from source or via your packages manager:

  • On Ubuntu and derivatives:

    $> add-apt-repository ppa:avsm/ppa
    $> apt-get update
    $> apt-get install ocaml ocaml-native-compilers camlp4-extra opam
    
  • On Fedora/OpenSUSE:

    $> sudo dnf update
    $> sudo dnf install ocaml ocaml-docs ocaml-camlp4-devel opam
    
  • On MacOSX using brew:

    $> brew install ocaml opam
    

Once opam and ocaml has been successfully installed run the following:

$> opam init
$> eval $(opam env)

For any issues encountered installing opam see:

You can then install all the needed dependencies via the opam OCaml packages manager.

  1. Optionally, switch to a dedicated compiler for EasyCrypt:

    $> opam switch create easycrypt $OVERSION
    

    where $OVERSION is a valid OCaml version (e.g. ocaml-base-compiler.4.07.0)

  2. Add the EasyCrypt package from repository:

    $> opam pin -yn add easycrypt https://github.com/EasyCrypt/easycrypt.git
    
  3. Optionally, use opam to install the system dependencies:

    $> opam install depext
    $> opam depext easycrypt
    
  4. Install EasyCrypt's dependencies:

    $> opam install --deps-only easycrypt
    $> opam install alt-ergo
    

    If you get errors about ocamlbuild failing because it's already installed, the check can be skipped with the following:

    CHECK_IF_PREINSTALLED=false opam install --deps-only easycrypt
    
  5. You can download extra provers at the following URLs:

Installing requirements using OPAM (non-POSIX systems)

You can install all the needed dependencies via the opam OCaml packages manager.

  1. Install the opam Ocaml packages manager, following the instructions at:

    https://fdopen.github.io/opam-repository-mingw/installation/

  2. Add the EasyCrypt package from repository:

    $> opam pin -yn add easycrypt https://github.com/EasyCrypt/easycrypt.git
    
  3. Use opam to install the system dependencies:

    $> opam install depext depext-cygwinports
    $> opam depext easycrypt
    
  4. Install EasyCrypt's dependencies:

    $> opam install --deps-only easycrypt
    $> opam install alt-ergo
    
  5. You can download extra provers at the following URLs:

Via NIX

First, install the Nix package manager by following these instructions.

Then, at the root of the EasyCrypt source tree, type:

```
$> nix-shell
```

These should install all the required dependencies. From there, simply run:

```
$> make
```

to compile EasyCrypt.

Configuring Why3

Before running EasyCrypt and after the installation/removal/update of an SMT prover, you need to (re)configure Why3.

$> why3 config detect

EasyCrypt is using the default Why3 location, i.e. ~/.why3.conf. If you have several versions of Why3 installed, it may be impossible to share the same configuration file among them. EasyCrypt via the option -why3, allows you to load a Why3 configuration file from a custom location. For instance:

$> why3 config --detect -C $WHY3CONF.conf
$> ./ec.native -why3 $WHY3CONF.conf

where $WHY3CONF must be replaced by some custom location.

Note on Prover Versions

Why3 and SMT solvers are independent pieces of software with their own version-specific interactions. Obtaining a working SMT setup may require installing specific versions of some of the provers.

At the time of writing, we depend on Why3 1.4.x, which supports the following versions (and some versions below):

  • Alt-Ergo 2.4.0 (if you install alt-ergo using opam, you can prevent upgrades using opam pin alt-ergo 2.4.0)
  • CVC4 1.8
  • Z3 4.8.10

Installing/Compiling EasyCrypt

If installing from source, running

$> make
$> make install

builds and install EasyCrypt (under the binary named easycrypt), assuming that all dependencies have been successfully installed. If you choose not to install EasyCrypt system wide, you can use the binary ec.native that is located at the root of the source tree.

It is possible to change the installation prefix by setting the environment variable PREFIX:

$> make PREFIX=/my/prefix install

EasyCrypt comes also with an opam package. Running

$> opam install easycrypt

installs EasyCrypt and its dependencies via opam. In that case, the EasyCrypt binary is named easycrypt.

Proof General Front-End

EasyCrypt mode has been integrated upstream. Please, go to https://github.com/ProofGeneral/PG and follow the instructions.