Skip to content

rocq-community/rocq-program-verification-template

Repository files navigation

Rocq Program Verification Template

Docker CI

Template project for program verification in the Rocq Prover. Uses the Verified Software Toolchain and a classic binary search program in C as an example.

Meta

Building instructions

Installing dependencies

The recommended way to install Rocq and other dependencies is via the Rocq Platform. To install dependencies manually via opam:

opam repo add rocq-released https://rocq-prover.org/opam/released
opam install coq-vst.2.16

Obtaining the project

git clone https://github.com/rocq-community/rocq-program-verification-template.git
cd rocq-program-verification-template

Option 1: building the project using rocq makefile

With make and the rocq makefile tool bundled with Rocq:

make   # or make -j <number-of-cores-on-your-machine> 

Option 2: building the project using Dune

With the Dune build system, version 3.21 or later:

dune build

Compiling the program using CompCert (optional)

ccomp -o bsearch src/binary_search.c

File and directory structure

Core files

General configuration

Make configuration

Dune configuration

Caveats

rocq makefile vs. Dune

rocq makefile and Dune builds are independent. However, for local development, it is recommended to use rocq makefile, since Rocq IDEs may not be able find files compiled by Dune. Due to its build hygiene requirements, Dune will refuse to build when binary (.vo) files are present in theories; run make clean to remove them.

Generating Clight for Rocq

The Rocq representation of the C program (binary_search.v) is kept in version control due to licensing concerns for CompCert's clightgen tool. If you have a license to use clightgen, you can delete the generated file and have the build system regenerate it. To regenerate the file manually, you need to run:

clightgen -o theories/binary_search.v -normalize src/binary_search.c

About

Template project for program verification in the Rocq Prover, showcasing reasoning on CompCert's Clight language using the Verified Software Toolchain [maintainer=@palmskog]

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages