Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Coq
  3. Category Theory in Coq

Category Theory in Coq

BSD-3-ClauseRocq Prover1.0.0

An axiom-free formalization of category theory in Coq for representation, manipulation, and realization of categorical terms.

GitHubGitHub
808 stars83 forks0 contributors

What is Category Theory in Coq?

Category Theory in Coq is a formal library that encodes the fundamental structures and theorems of category theory within the Coq proof assistant. It allows users to define, manipulate, and reason about categories, functors, natural transformations, adjunctions, and other categorical concepts in a type-safe, axiom-free environment. The project bridges theoretical category theory with practical applications in programming and verification.

Target Audience

Researchers and practitioners in formal methods, theorem proving, and programming language theory who need to work with category theory in a rigorous, machine-checkable setting. It is also suitable for Coq developers interested in applied category theory or building verified software using categorical abstractions.

Value Proposition

It offers a unique, axiom-free formalization that ensures constructive correctness, extensive support for duality to reduce proof duplication, and a practical programming sub-library that connects abstract category theory with concrete Coq development. The library's design avoids proprietary or closed-source theorem prover dependencies, providing a fully open, verifiable foundation.

Overview

An axiom-free formalization of category theory in Coq for personal study and practical work

Use Cases

Best For

  • Formalizing categorical proofs in a proof assistant
  • Studying category theory with machine-checked correctness
  • Building verified software using categorical structures in Coq
  • Implementing Haskell-like monad hierarchies in Coq
  • Experimenting with dual constructions in category theory
  • Teaching category theory with executable, formal examples

Not Ideal For

  • Developers needing to implement category theory in production code without formal verification requirements
  • Teams seeking graphical or intuitive tools for categorical diagramming and visualization
  • Projects with tight deadlines that cannot afford the proof overhead of homsetoid-based equivalence
  • Users unfamiliar with Coq or theorem proving who want a quick introduction to category theory

Pros & Cons

Pros

Axiom-Free Foundation

The core theory avoids axioms, ensuring constructive proofs and higher reliability for formal verification, as stated in the design decisions.

Dual Construction Efficiency

Leverages opposite categories to define dual concepts like comonads in one line, reducing code duplication and proof effort through built-in duality simplifications.

Practical Programming Integration

Includes a sub-library for applied category theory in Coq, mimicking Haskell's monad hierarchy while using general categorical proofs to establish lawfulness, as shown in the programming sub-library examples.

Flexible Equivalence via Homsets

Uses homsetoids (crelations) instead of strict equality, allowing customizable notions of arrow equivalence for different categories, though it increases proof obligations.

Rich and Familiar Notations

Provides extensive notations for morphisms, functors, and categorical operations, improving readability and expressiveness for users familiar with category theory texts.

Cons

Increased Proof Burden

The use of homsetoids requires additional proofs to preserve equivalence relations at all levels, slowing down development and increasing term complexity.

Complex Setup and Dependencies

Requires specific Coq versions (8.14-8.20 or Rocq 9.0-9.1) and Coq-Equations, with builds often relying on Nix, which can be a barrier for users not versed in these tools.

Artificial Constructions for Duality

Some definitions include repeated laws to support dual simplifications, making initial definitions more verbose and adding to proof obligations, as admitted in the duality section.

Niche and Specialized Ecosystem

As a Coq-specific library for formal category theory, it has a smaller community and fewer resources compared to mainstream programming libraries, limiting support and adoption.

Frequently Asked Questions

Quick Stats

Stars808
Forks83
Contributors0
Open Issues653
Last commit23 hours ago
CreatedSince 2014

Tags

#mathematics#functional-programming#coq#formal-methods#category-theory#monad#theorem-proving#monoid#type-theory#category#formal-verification#proof-assistant

Built With

N
Nix
M
Make
C
Coq
L
Lefthook

Included in

Coq380
Auto-fetched 10 hours ago

Related Projects

Homotopy Type TheoryHomotopy Type Theory

A Coq library for Homotopy Type Theory

Stars1,407
Forks204
Last commit3 days ago
UniMathUniMath

This rocq library aims to formalize a substantial body of mathematics using the univalent point of view.

Stars1,019
Forks187
Last commit2 days ago
Four Color TheoremFour Color Theorem

Formal proof of the Four Color Theorem [maintainer=@ybertot]

Stars248
Forks27
Last commit19 days ago
AnalysisAnalysis

Mathematical Components compliant Analysis Library

Stars247
Forks74
Last commit16 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub