{"id":27214574,"url":"https://github.com/rocq-community/coq-program-verification-template","last_synced_at":"2025-07-09T22:35:44.525Z","repository":{"id":48343049,"uuid":"293039001","full_name":"rocq-community/coq-program-verification-template","owner":"rocq-community","description":"Template project for program verification in Coq, showcasing reasoning on CompCert's Clight language using the Verified Software Toolchain [maintainer=@palmskog]","archived":false,"fork":false,"pushed_at":"2024-07-31T09:09:16.000Z","size":51,"stargazers_count":31,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-26T03:45:13.146Z","etag":null,"topics":["coq","program-verification","template","template-repository"],"latest_commit_sha":null,"homepage":"","language":"Coq","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rocq-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-05T08:55:23.000Z","updated_at":"2025-02-03T01:30:05.000Z","dependencies_parsed_at":"2024-07-31T10:01:00.458Z","dependency_job_id":"bf7d6f4f-7124-4e5c-ad4a-873398c6df06","html_url":"https://github.com/rocq-community/coq-program-verification-template","commit_stats":null,"previous_names":["rocq-community/coq-program-verification-template","coq-community/coq-program-verification-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/rocq-community/coq-program-verification-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fcoq-program-verification-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fcoq-program-verification-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fcoq-program-verification-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fcoq-program-verification-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rocq-community","download_url":"https://codeload.github.com/rocq-community/coq-program-verification-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fcoq-program-verification-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264504615,"owners_count":23618831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coq","program-verification","template","template-repository"],"created_at":"2025-04-10T03:24:11.966Z","updated_at":"2025-07-09T22:35:44.495Z","avatar_url":"https://github.com/rocq-community.png","language":"Coq","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coq Program Verification Template\n\n[![Docker CI][docker-action-shield]][docker-action-link]\n\n[docker-action-shield]: https://github.com/coq-community/coq-program-verification-template/actions/workflows/docker-action.yml/badge.svg?branch=master\n[docker-action-link]: https://github.com/coq-community/coq-program-verification-template/actions/workflows/docker-action.yml\n\nTemplate project for program verification in Coq.\nUses the Verified Software Toolchain and a classic binary\nsearch program in C as an example.\n\n## Meta\n\n- License: [Unlicense](LICENSE) (change to your license of choice)\n- Compatible Coq versions: 8.16 or later\n- Additional dependencies:\n  - [CompCert](http://compcert.inria.fr) 3.13.1 or later\n  - [Verified Software Toolchain](https://vst.cs.princeton.edu) 2.13 or 2.14\n- Coq namespace: `ProgramVerificationTemplate`\n\n## Building instructions\n\n### Installing dependencies\n\nThe recommended way to install Coq and other dependencies is via\nthe [Coq Platform](https://github.com/coq/platform/releases/latest).\nTo install dependencies manually via [opam](https://opam.ocaml.org/doc/Install.html):\n```shell\nopam repo add coq-released https://coq.inria.fr/opam/released\nopam install coq.8.19.2 coq-compcert.3.13.1 coq-vst.2.14\n```\n\n### Obtaining the project\n\n```shell\ngit clone https://github.com/coq-community/coq-program-verification-template.git\ncd coq-program-verification-template\n```\n\n### Option 1: building the project using coq_makefile\n\nWith make and the [coq_makefile tool][coq-makefile-url] bundled with Coq:\n```shell\nmake   # or make -j \u003cnumber-of-cores-on-your-machine\u003e \n```\n\n### Option 2: building the project using Dune\n\nWith the [Dune build system][dune-url], version 3.5 or later:\n```shell\ndune build\n```\n\n### Compiling the program using CompCert (optional)\n\n```shell\nccomp -o bsearch src/binary_search.c\n```\n\n## File and directory structure\n\n### Core files\n\n- [`src/binary_search.c`](src/binary_search.c): C program that performs binary\n  search in a sorted array, inspired by [Joshua Bloch's Java version][binary-search-url].\n- [`theories/binary_search.v`](theories/binary_search.v): Coq representation\n  of the binary search C program in [CompCert's Clight language][compcert-c-url].\n- [`theories/binary_search_theory.v`](theories/binary_search_theory.v): General\n  Coq definitions and facts relevant to binary search, adapted from code in the\n  [Verified Software Toolchain][vst-url].\n- [`theories/binary_search_verif.v`](theories/binary_search_verif.v): Contract for the\n  Clight program following the [Java specification][java-specification-url] and a\n  Coq proof using the Verified Software Toolchain that the program upholds the contract.\n\n### General configuration\n\n- [`coq-program-verification-template.opam`](coq-program-verification-template.opam):\n  Project [opam package][opam-url] definition, including dependencies.\n- [`_CoqProject`](_CoqProject): File used by Coq editors to determine the Coq logical path,\n  and by the make-based build to obtain the list of files to include. \n- [`.github/workflows/docker-action.yml`](.github/workflows/docker-action.yml):\n  [GitHub Actions][github-actions-ci-url] continuous integration configuration for Coq,\n  using the opam package definition.\n\n### Make configuration\n\n- [`Makefile`](Makefile): Generic delegating makefile using [coq_makefile][coq-makefile-url].\n- [`Makefile.coq.local`](Makefile.coq.local): Custom optional Make tasks, including compilation\n  of the C program.\n\n### Dune configuration\n\n- [`dune-project`](dune-project): General configuration for the [Dune][dune-url] build system.\n- [`theories/dune`](theories/dune): Dune build configuration for Coq.\n\n## Caveats\n\n### coq_makefile vs. Dune\n\ncoq_makefile and Dune builds are independent. However, for local development,\nit is recommended to use coq_makefile, since Coq editors may not be able find\nfiles compiled by Dune. Due to its build hygiene requirements, Dune will\nrefuse to build when binary (`.vo`) files are present in `theories`;\nrun `make clean` to remove them.\n\n### Generating Clight for Coq\n\nThe Coq representation of the C program (`binary_search.v`) is kept in version\ncontrol due to licensing concerns for CompCert's `clightgen` tool.\nIf you have a license to use `clightgen`, you can delete the generated file\nand have the build system regenerate it. To regenerate the file manually, you need to run:\n```shell\nclightgen -o theories/binary_search.v -normalize src/binary_search.c\n```\n\n[binary-search-url]: http://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html\n[java-specification-url]: https://hg.openjdk.java.net/jdk10/jdk10/jdk/file/ffa11326afd5/src/java.base/share/classes/java/util/Arrays.java#l1846\n[vst-url]: https://vst.cs.princeton.edu\n[compcert-c-url]: https://compcert.org/compcert-C.html\n[coq-makefile-url]: https://coq.inria.fr/refman/practical-tools/utilities.html#building-a-coq-project-with-coq-makefile\n[github-actions-ci-url]: https://github.com/coq-community/docker-coq-action\n[opam-url]: https://opam.ocaml.org\n[dune-url]: https://dune.build\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocq-community%2Fcoq-program-verification-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocq-community%2Fcoq-program-verification-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocq-community%2Fcoq-program-verification-template/lists"}