Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f25c63f
update flake.nix
thibautbenjamin Sep 18, 2024
b46e668
update flake
thibautbenjamin Sep 18, 2024
f904036
update dune-project file
thibautbenjamin Sep 18, 2024
1cb4fe8
remove files shell.nix and default.nix
thibautbenjamin Sep 18, 2024
934d996
cleanup dune files
thibautbenjamin Sep 18, 2024
9bb8f8e
change the github action to use nix instead
thibautbenjamin Sep 19, 2024
707219c
use the cram testing functionality in dune
thibautbenjamin Sep 19, 2024
7a2f7d2
run dune tests with `nix flake check`
thibautbenjamin Sep 19, 2024
b4019bd
cleanup the test files
thibautbenjamin Sep 19, 2024
b24b2f7
create package for catt-mode in emacs
thibautbenjamin Sep 19, 2024
938f565
fix online version of catt
thibautbenjamin Sep 20, 2024
1c916d0
catch parsing errors
thibautbenjamin Sep 21, 2024
0eebb75
completely rebuilt the online version to have a small editor
thibautbenjamin Sep 21, 2024
e83aa4d
package definition for the web version of catt
thibautbenjamin Sep 21, 2024
a8dd065
test github workflow
thibautbenjamin Sep 21, 2024
5f202a3
remove deprecated files and directory
thibautbenjamin Sep 21, 2024
e35f20c
add nix formatting as a check, and fix nix formatting
thibautbenjamin Sep 21, 2024
6dcfaad
add linting of ocaml sources in the tests of flake + linting
thibautbenjamin Sep 21, 2024
c5adcca
add catt option to keep going and catch uncaught exceptions
thibautbenjamin Sep 22, 2024
476808e
add tests for failing cases to check for uncaught exceptions
thibautbenjamin Sep 22, 2024
e17665d
better error reporting on the web version
thibautbenjamin Sep 23, 2024
9744fd8
added Eckamann-Hilton (0,2) argument in dimension 3
regular-citizen Aug 8, 2024
50a485b
fix issue with inferrence of implicit suspension
thibautbenjamin Aug 29, 2024
174af8c
simplifcation of 3d eckmann-hilton
thibautbenjamin Aug 29, 2024
62bb661
moved file for eckmann-hilton in dimension 3
thibautbenjamin Aug 29, 2024
5107703
simplify 3d eckmann-hilton
thibautbenjamin Sep 2, 2024
b5ed169
attempt at 4d eckmann-hilton
thibautbenjamin Sep 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
name: Publish to GitHub Pages

on:
push:
branches:
- master

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v1

- name: Set-up OCaml
uses: ocaml/setup-ocaml@v2
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
ocaml-compiler: "5.0"

- name: Install dependencies
run: opam install -y dune base js_of_ocaml-compiler js_of_ocaml-ppx

- name: Build the type-checker
run: opam exec -- dune build

- name: Include the backend to the file
run: opam exec -- dune install --prefix="./_install"
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- run: nix build ./.#catt-web
- id: find-web-path
run: |
path=$(nix eval ./.#catt-web.outPath --raw)
echo "web-path=$path" >> "$GITHUB_OUTPUT"
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _install/share
folder: ${{ steps.find-web-path.outputs.web-path }}/share
26 changes: 7 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
name: Check All

on: [push]

jobs:
test:
tests:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v1

- name: Set-up OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: "5.0"

- name: Install dependencies
run: opam install -y dune base js_of_ocaml-compiler js_of_ocaml-ppx

- name: Build the type-checker
run: opam exec -- dune build

- name: Run tests
run: bash ./check_all.sh
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix build
- run: nix flake check --all-systems
2 changes: 2 additions & 0 deletions .ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

profile=default
25 changes: 0 additions & 25 deletions Makefile

This file was deleted.

33 changes: 23 additions & 10 deletions bin/catt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,35 @@ let usage = "catt [options] [file]"
let interactive = ref false
let no_builtins = ref false
let debug = ref false
let keep_going = ref false

let () =
Printexc.record_backtrace true;
let file_in = ref [] in
Stdlib.Arg.parse
[
"-i", Stdlib.Arg.Set interactive, "Interactive mode.";
"--no-builtins", Stdlib.Arg.Set no_builtins, "Prevent using built-in compositions and identities";
"--debug", Stdlib.Arg.Set debug, "Debug mode: stop on error and drops a menu"
("-i", Stdlib.Arg.Set interactive, "Interactive mode.");
( "--no-builtins",
Stdlib.Arg.Set no_builtins,
"Prevent using built-in compositions and identities" );
( "--debug",
Stdlib.Arg.Set debug,
"Debug mode: stop on error and drops a menu" );
( "--keep-going",
Stdlib.Arg.Set keep_going,
"Do not exit on terms that don't typecheck." );
]
(fun s -> file_in := s::!file_in)
(fun s -> file_in := s :: !file_in)
usage;
let _ = match !file_in with
| [f] ->
Catt.Settings.use_builtins := not !no_builtins;
Catt.Settings.debug := !debug;
Catt.Command.exec ~loop_fn:Catt.Prover.loop (parse_file f)
let _ =
match !file_in with
| [ f ] -> (
Catt.Settings.use_builtins := not !no_builtins;
Catt.Settings.keep_going := !keep_going;
Catt.Settings.debug := !debug;
match parse_file f with
| Ok cmds -> Catt.Command.exec ~loop_fn:Catt.Prover.loop cmds
| Error () -> exit 1)
| _ -> ()
in if !interactive then Catt.Prover.loop ()
in
if !interactive then Catt.Prover.loop ()
10 changes: 5 additions & 5 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(executable
(package catt)
(public_name catt)
(name catt)
(libraries
; landmarks
catt)
; (preprocess (pps landmarks-ppx --auto))
)
(libraries catt))

(cram
(deps %{bin:catt}))
37 changes: 0 additions & 37 deletions catt-mode.el

This file was deleted.

30 changes: 30 additions & 0 deletions catt-web.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Browser embedded version of the catt theorem prover"
description: "Browser embedded version of the catt theorem prover"
maintainer: ["Thibaut Benjamin" "Chiara Sarti"]
authors: ["Thibaut Benjamin" "Chiara Sarti"]
license: "MIT"
tags: ["higher-categories" "dependent-type-theory"]
homepage: "https://github.com/thibautbenjamin/catt"
bug-reports: "https://github.com/thibautbenjamin/catt/issues"
depends: [
"ocaml"
"dune" {>= "3.16"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/thibautbenjamin/catt.git"
25 changes: 0 additions & 25 deletions check_all.sh

This file was deleted.

6 changes: 0 additions & 6 deletions default.nix

This file was deleted.

29 changes: 17 additions & 12 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
(lang dune 3.7)
(lang dune 3.16)

(name catt)

(generate_opam_files true)

(source
(github thibautbenjamin/catt))

(authors "Thibaut Benjamin")

(maintainers "Thibaut Benjamin")

(source (github thibautbenjamin/catt))
(authors "Thibaut Benjamin"
"Chiara Sarti")
(maintainers "Thibaut Benjamin"
"Chiara Sarti")
(license MIT)

(using menhir 2.0)
(cram enable)

(package
(name catt)
(synopsis "An infinity-categorical coherence typechecker")
(description "An infinity-categorical coherence typechecker")
(depends ocaml dune)
(tags
(higher-categories dependent-type-theory)))
(higher-categories dependent-type-theory)))

(package
(name catt-web)
(synopsis "Browser embedded version of the catt theorem prover")
(description "Browser embedded version of the catt theorem prover")
(depends ocaml dune)
(allow_empty)
(tags
(higher-categories dependent-type-theory)))
19 changes: 19 additions & 0 deletions examples/eckmann-hilton-dimensions/eh2d.catt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
coh unitl (x(f)y) : comp (id _) f -> f
coh unit (x) : comp (id x) (id x) -> id x
coh lsimp (x) : (unitl (id x)) -> unit x
coh Ilsimp (x) : I (unitl (id x)) -> I (unit x)
coh exch (x(f(a)g)y(h(b)k)z) : comp (comp _ [b]) (id (comp f k)) (comp [a] _) -> comp [a] [b]

coh eh1 (x(f(a)g(b)h)y) :
comp a b -> comp (I (unitl f))
(comp (comp _ [a]) (comp (unitl g) (I (op { 1 } (unitl g)))) (comp [b] _))
(op { 1 } (unitl h))

let eh2 (x : *) (a : id x -> id x) (b : id x -> id x) =
comp [Ilsimp _]
[comp (comp _ [comp (comp [lsimp _] [op { 1 } (Ilsimp _)]) (U (unit _))] _)
(exch b a)]
[op { 1 } (lsimp _)]

let eh (x : *) (a : id x -> id x) (b : id x -> id x) =
comp (eh1 a b) (eh2 a b) (I (op { 1 } (eh2 b a))) (I (op { 1 } (eh1 b a)))
44 changes: 44 additions & 0 deletions examples/eckmann-hilton-dimensions/eh3d.catt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
coh unitl (x(f)y) : comp (id _) f -> f
coh unit (x) : comp (id x) (id x) -> id x
coh lsimp (x) : (unitl (id x)) -> unit x
coh Ilsimp (x) : I (unitl (id x)) -> I (unit x)

coh sandwisk (x(f)y(g(a)h)z(k)w) : comp f g k -> comp f h k

let sandwich (x : *) (y : *) (f : x -> y) (g : x -> y) (a : f -> g) = comp (I (unitl f)) (comp [id (id x)] [a]) (unitl g)
coh uunitl (x(f(a)g)y) : a -> sandwich a

coh step1 (x(f(a(m)b(n)c)g)y) : comp m n ->
comp (uunitl a) (comp (sandwich [m]) (comp (I (uunitl b)) (op { 1 } (uunitl b))) (op { 1 } (sandwich [n]))) (op { 1 } (I (uunitl c)))

coh toaster (x) : comp (I (uunitl (id (id x)))) (op { 1 } (uunitl (id (id x)))) ->
comp
(comp [Ilsimp _] (comp [id (id x)] [id (id x)]) [lsimp _])
(comp [I (op { 1 } (Ilsimp _))] (comp [id (id x)] [id (id x)]) [I (op { 1 } (lsimp _))])

coh unfocus (x(f)y(g)z(h)w(k)u) : comp f (comp g h) k -> comp (comp f g) (comp h k)

let step21 (x : *) (m : id (id x) -> id (id x)) (n : id (id x) -> id (id x)) =
comp (sandwich [m]) [toaster _] (op { 1 } (sandwich [n]))

let step23 (x : *) (m : id (id x) -> id (id x)) (n : id (id x) -> id (id x)) =
comp [sandwisk [Ilsimp x] (comp [id (id x)] [[m]]) [lsimp x]]
[I (sandwisk [I (op { 1 } (Ilsimp x))] (comp [[n]] [id (id x)]) [I (op { 1 } (lsimp x))])]

coh sandswitch (x(f)y(g(a)h(b)k)z(l)w) : comp (sandwisk f a l) (sandwisk f b l) -> sandwisk f (comp a b) l

let step24 (x : *) (m : id (id x) -> id (id x)) (n : id (id x) -> id (id x)) =
sandswitch (I (unit x)) (comp [id (id x)] [[m]]) (comp [[n]] [id (id x)]) (unit x)

coh intch20 (x(f(a(n)b)g)y(h(c(m)d)k)z) : comp (comp [a] [[m]]) (comp [[n]] [d]) -> comp [[n]] [[m]]

let step25 (x : *) (m : id (id x) -> id (id x)) (n : id (id x) -> id (id x)) =
sandwisk (I (unit x)) [intch20 n m] (unit x)

let step2inner (x : *) (m : id (id x) -> id (id x)) (n : id (id x) -> id (id x)) =
comp (step21 m n) (unfocus (sandwich [m]) _ _ _ ) (step23 m n) (I (unfocus (comp [Ilsimp x] _ [lsimp x]) _ _ _)) (comp _ [comp (step24 m n) (step25 m n)] _)

let step2 (x : *) (m : id (id x) -> id (id x)) (n : id (id x) -> id (id x)) =
comp (uunitl (id (id x))) [step2inner m n] (op { 1 } (I (uunitl (id (id x)))))

let final (x : *) (m : id (id x) -> id (id x)) (n : id (id x) -> id (id x)) = comp (step1 m n) (step2 m n)
Loading