Relation algebra library for Coq
52
stars
184
commits
Rocq Prover
primary language
May 6, 2026
updated
Webpage of the project: http://perso.ens-lyon.fr/damien.pous/ra
This Rocq development is a modular library about relation algebra: those algebras admitting heterogeneous binary relations as a model, ranging from partially ordered monoid to residuated Kleene allegories and Kleene algebra with tests (KAT).
This library presents this large family of algebraic theories in a modular way; it includes several high-level reflexive tactics:
The tactic for Kleene algebra with tests is obtained by reflection, using a simple bisimulation-based algorithm working on the appropriate automaton of partial derivatives, for the generalised regular expressions corresponding to KAT.
Combined with a formalisation of KA completeness, and then of KAT completeness on top of it, this provides entirely axiom-free decision procedures for all model of these theories (including relations, languages, traces, min-max and max-plus algebras, etc...).
Algebraic structures are generalised in a categorical way: composition is typed like in categories, allowing us to reach "heterogeneous" models like rectangular matrices or heterogeneous binary relations, where most operations are partial. We exploit untyping theorems to avoid polluting decision algorithms with these additional typing constraints.
We give a few examples of applications of this library to program verification:
The easiest way to install this library is via OPAM. For the current
stable release of Rocq, the library can be installed directly through
the released repository:
opam repo add rocq-released https://rocq-prover.org/opam/released
opam install rocq-relation-algebra
Otherwise, use the provided opam file using opam pin add . (from the project directory)
To compile manually use ./configure --enable-ssr to enable building
the finite types model (requires rocq-mathcomp-ssreflect). Also use --enable-aac to enable building the bridge with AAC rewriting tactics (requires rocq-aac-tactics).
Then compile using make and install using make install.
Each module is documented, see index.html or http://perso.ens-lyon.fr/damien.pous/ra for:
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
Main author
Additional authors
Rocq Prover
84.6%
OCaml
11.8%
HTML
3.4%
Relation algebra library for Coq
52
stars
184
commits
Rocq Prover
primary language
May 6, 2026
updated
Webpage of the project: http://perso.ens-lyon.fr/damien.pous/ra
This Rocq development is a modular library about relation algebra: those algebras admitting heterogeneous binary relations as a model, ranging from partially ordered monoid to residuated Kleene allegories and Kleene algebra with tests (KAT).
This library presents this large family of algebraic theories in a modular way; it includes several high-level reflexive tactics:
The tactic for Kleene algebra with tests is obtained by reflection, using a simple bisimulation-based algorithm working on the appropriate automaton of partial derivatives, for the generalised regular expressions corresponding to KAT.
Combined with a formalisation of KA completeness, and then of KAT completeness on top of it, this provides entirely axiom-free decision procedures for all model of these theories (including relations, languages, traces, min-max and max-plus algebras, etc...).
Algebraic structures are generalised in a categorical way: composition is typed like in categories, allowing us to reach "heterogeneous" models like rectangular matrices or heterogeneous binary relations, where most operations are partial. We exploit untyping theorems to avoid polluting decision algorithms with these additional typing constraints.
We give a few examples of applications of this library to program verification:
The easiest way to install this library is via OPAM. For the current
stable release of Rocq, the library can be installed directly through
the released repository:
opam repo add rocq-released https://rocq-prover.org/opam/released
opam install rocq-relation-algebra
Otherwise, use the provided opam file using opam pin add . (from the project directory)
To compile manually use ./configure --enable-ssr to enable building
the finite types model (requires rocq-mathcomp-ssreflect). Also use --enable-aac to enable building the bridge with AAC rewriting tactics (requires rocq-aac-tactics).
Then compile using make and install using make install.
Each module is documented, see index.html or http://perso.ens-lyon.fr/damien.pous/ra for:
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.
Main author
Additional authors
Rocq Prover
84.6%
OCaml
11.8%
HTML
3.4%