Relation algebra and Kleene algebra in Rocq
Résumé
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: - [kat], which decides the (in)equational theory of KAT; - [hkat], which decides the Hoare (in)equational theory of KAT (i.e., KAT with Hoare hypotheses); - [ka], which decides the (in)equational theory of KA; - [ra], a normalisation based partial decision procedure for Relation algebra; - [ra_normalise], the underlying normalisation tactic. 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.