xieyuheng / cat

A categorical semantics library in Agda.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cat -- A categorical semantics library in Agda

[Work in progress, but you can star it first.]

The aim of this library is to provide semantics to type theories.
For examples,

  • inductive types can be modeled by initial algebras,
  • the validity of a group of introduction rules and elimination rule can be ensured by adjoint functors.

Using inconsistent system

The inconsistent type-in-type system is used.
At this early stage of development, we care more about easy to use than consistency.

An inconsistent system is still very valuable for creative reasoning,
and we can always use a consistent system later in the development.

This argument is like the argument against premature optimization in programming.

Coding style

A consistent and scale-able coding style is important for keeping a software library maintainable.
This is specially true for languages with strong syntax extension supports (like Agda).
The preferred coding style of this library includes,

  • prefer to use ASCII instead of unicode,
  • prefer to use prefix notation instead of infix notation,
    except for syntax sugar and some associative binary functions,
  • prefer to use lisp-naming-convention (see the following code example) instead of camelCase.

Example

record category-t : type where
  field
    object-t : type
    morphism-t : object-t -> object-t -> type
    id : (a : object-t) -> morphism-t a a
    compose : {a b c : object-t} ->
      morphism-t a b ->
      morphism-t b c ->
      morphism-t a c
    id-left : {a b : object-t} ->
      (f : morphism-t a b) ->
      the-eqv-t (morphism-t a b)
        (compose (id a) f) f
    id-right : {a b : object-t} ->
      (f : morphism-t a b) ->
      the-eqv-t (morphism-t a b)
        (compose f (id b)) f
    compose-associative : {a b c d : object-t} ->
      (f : morphism-t a b) ->
      (g : morphism-t b c) ->
      (h : morphism-t c d) ->
      the-eqv-t (morphism-t a d)
        (compose f (compose g h))
        (compose (compose f g) h)

Community

Contributions are welcome, see current TODO list for tasks.
(Please add yourself to the AUTHORS list if you made any contributions.)

License

About

A categorical semantics library in Agda.

License:GNU General Public License v3.0


Languages

Language:Agda 98.4%Language:Shell 1.6%