(Version 2.04 of 27 Apr 2022)

**Abstract**. The Agda Universal Algebra Library is a collection of types and programs (theorems and proofs) that formalizes the foundations of universal algebra in dependent type theory using the Agda proof assistant language.

The library contains definitions of many new types for representing important constructs and theorems comprising a substantial part of the foundations of general (universal) algebra and equational logic. These types are implemented in so called “literate” Agda files (with the `.lagda`

extension), and they are grouped into modules which can be easily imported and integrated into other Agda developments.

To get an idea of the current scope of the library, note that it now includes a formal proof of Birkhoff’s HSP Theorem, which asserts that every *variety* is an *equational class*. That is, if 𝒦 is a class of algebras which is closed under the taking of homomorphic images, subalgebras, and arbitrary products, then 𝒦 is the class of all algebras satisfying some set of identities. To our knowledge, ours is the first formal, machine-checked proof of Birkhoff’s Theorem. (If you have evidence refuting this claim, we would love to hear about it; please email us!)

We hope the library is useful to mathematicians and computer scientists who wish to formalize their work in dependent type theory and verify their results with a proof assistant. Indeed, the agda-algebras library aims to become an indispensable companion on our mathematical journeys, helping us authenticate the discoveries we make along the way.

**Keywords and phrases**. Universal algebra, Equational logic, Martin-Löf Type Theory, Birkhoff’s HSP Theorem, Formalization of mathematics, Agda

**Software Repository**. github.com/ualib/agda-algebras

**Citing this work**. See the instructions at agda-algebras/Preface.html.

**Primary Contributors**. William DeMeo and Jacques Carette

We have organized the library into three main modules, called Base, Setoid, and Cubical, which are imported below (after the Preface module, which doesn’t contain any Agda code). These three modules are independent of one another. The Base module contains submodules that comprise the first version of the library. The Setoid contains the second version of the library that is based on setoids. Finally, we have begun work on a third version of the library, which is based on Cubical Agda and will consist of submodules of the Cubical module.

{-# OPTIONS --without-K --exact-split --safe --cubical #-}

module agda-algebras where open import Preface open import Base -- standard version of the library open import Setoid -- setoid-based version of the library open import Demos -- demonstrations (e.g., proof of the HSP Theorem in a single module) open import Cubical -- forthcoming version of the library based on Cubical Agda

The [Demos/HSP][] module presents a fairly self-contained formal proof of Birkhoff’s HSP Theorem in a single module.

An earlier version of the proof is described in the Birkhoff HSP Theorem Section of the documentation; specifically, see Setoid.Varieties.HSP.

The source code containing the complete formal proof of Birkhoff’s Theorem is available in the agda-algebras GitHub repository; see Demos/HSP.lagda or Setoid/Varieties/HSP.lagda.

The agda-algebras library and its documentation,
by
William DeMeo
and the agda algebras team,
is licensed under a
Creative Commons Attribution-ShareAlike 4.0 International License.

BibTeX citation information.

Based on the work at
https://gitlab.com/ualib/ualib.gitlab.io.

*Updated 27 Apr 2022, 16:52*