Skip to content


Repository files navigation


This is a copy of the Agda Universal Algebra Library which depends the Standard Library of the Agda proof assistant language. It is currently under active reconstruction, and should be regarded as α software.

The previous version of the library (which was called UALib and relied more heavily on the Type Topology library of Martín Escardó) is no longer maintained, but is still available at the following urls.


This repository contains the source code, as well as the files used to generate the documentation, of the Agda Universal Algebra Library.


Agda was used to generate html pages for each module. These pages are now served at


Install Agda

The library has been developed and tested with Agda version 2.6.2 and the Agda Standard Library version 1.7. (It may work with more recent versions, but there are no guarantees.)

If you don't have Agda, follow the official Agda installation instructions.

For reference, the following is a list of commands that should correctly install Agda version 2.6.2 on a Linux machine. These commands were tested on a Ubuntu 22.04 machine. Please submit a new issue or merge request if these commands don't work for you.

cabal update
git clone
cd agda
git checkout release-2.6.2
cabal install Agda-2.6.2 --program-suffix=-2.6.2  # (takes a very long time)
cd ~/.cabal/bin/
touch ~/.emacs
cp ~/.emacs ~/.emacs.backup
./agda-mode-2.6.2 setup
./agda-mode-2.6.2 compile
mkdir -p ~/bin
cp ~/.emacs ~/bin
cp ~/.emacs.backup ~/.emacs
cd ~/bin
echo '#!/bin/bash' > agdamacs
echo 'PATH=~/.cabal/bin:$PATH emacs --no-init-file --load ~/bin/.emacs $@' >> agdamacs
chmod +x agdamacs
echo 'export PATH=~/bin:~/.cabal/bin:$PATH' >> ~/.profile

Now invoking the command agdamacs will launch emacs with Agda 2.6.2 and agda-mode installed.)

For more details, see also:

Contributing to this repository

If you wish to contribute to this repository, the best way is to use the standard fork-clone-pull-request workflow.


The agda-algebras library is developed and maintained by the ualib/agda-algebras development team.

The agda-algebras development team

Jacques Carette
William DeMeo

Acknowledgements and attributions

We thank Andreas Abel, Jeremy Avigad, Andrej Bauer, Clifford Bergman, Venanzio Capretta, Martín Escardó, Ralph Freese, Hyeyoung Shin, and Siva Somayyajula for helpful discussions, corrections, advice, inspiration and encouragement.

Most of the mathematical results formalized in the agda-algebras are well known. Regarding the source code in the agda-algebras library, this is mainly due to the contributors listed above.


The following Agda documentation and tutorials helped inform and improve the agda-algebras library, especially the first one in the list.

Finally, the official Agda Wiki, Agda User's Manual, Agda Language Reference, and the (open source) Agda Standard Library source code are also quite useful.

How to cite the Agda Universal Algebra Library


To cite the agda-algebras software library in a publication or on a web page, please use the following BibTeX entry:

  author       = {De{M}eo, William and Carette, Jacques},
  title        = {{T}he {A}gda {U}niversal {A}lgebra {L}ibrary (agda-algebras)},
  year         = 2021,
  note         = {{D}ocumentation available at},
  version      = {2.0.1},
  doi          = {10.5281/zenodo.5765793},
  howpublished = {{G}it{H}},
  note         = {{V}er.~2.0.1; source code: \href{}{}, {G}it{H}ub repo: \href{}{}},

To cite the formalization of Birkhoff's HSP Theorem, please use the following BibTeX entry:

 author        = {De{M}eo, William and Carette, Jacques},
 title         = {A {M}achine-checked {P}roof of {B}irkhoff's {V}ariety {T}heorem
                  in {M}artin-{L}\"of {T}ype {T}heory}, 
 journal       = {CoRR},
 volume        = {abs/2101.10166},
 year          = {2021},
 eprint        = {2101.2101.10166},
 archivePrefix = {arXiv},
 primaryClass  = {cs.LO},
 url           = {},
 note          = {Source code: \href{}{}}

If you're looking for the latest (setoid-based) formalization of Brkhoff's Theorem, see the Proof of the HSP Theorem in the html documentation, or the source code of the [Setoid.Varieties.HSP][] module in the file [Setoid/Varieties/HSP.lagda][] in the agda-algebras GitHub repository.


Creative Commons License
The Agda Universal Algebra Library by William DeMeo and the Agda Algebras Development Team is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at