Warning
Everything in this repository, except this file (including most commit messages!) was generated by Claude Fable 5.1, and almost none of it has been reviewed closely by a human.
Update: Kovács has generously looked at the code, and pointed out several ways in which it is quite crap. I will archive this project as a curiosity, and consider doing a next version mostly by hand, taking some learnings salvagable from this project. (E.g. how to reuse the Lean parser, and a working(?) example of defunctionalization by Lean metaprogramming.)
This is an experimental implementation of a "Kleene" CCHM cubical type theory,1 with the interval taken to be the free Kleene algebra rather than the free De Morgan algebra, as suggested in the remark in §3 in the CCHM paper.
The implementation is heavily based on András Kovács' work; in particular elaboration-zoo 2 (04 for basic implicit arg support), cctt 3, and smalltt 4.
Of course, for the CCHM bits, we also used cubicaltt 5 and Cubical Agda 6 as references.
As far as I know, there are no new ideas here at all.
kleenextt implements a "CHM"7 variant of CCHM, with
hcomp and transp primitives as suggested in §3.4 there. The intent
is to closely match Cubical Agda 6, but
I haven't checked to what extent this is true. In particular we do
also use ghcomp.
kleenextt includes a built-in "hlevel" tactic which fills any cube given an h-level proof. The implementation is based on KANG Rongji's extend 8 (unfortunately still not merged in Cubical Agda as a tactic.)
The examples contain some definitions adapted from prior cubicaltt 5 and cctt 3 examples, and from the "Cubical"9 Cubical Agda 6 library.
The showcase example is Pi4S3.ktt though I still need to give it a cleanup pass, and we probably need some more features to make it nicer.
See also REFERENCES.md for a (somewhat) more complete list of references.
Goals:
- Be simpler than Cubical Agda 6 but more usable than cubicaltt 5: usable enough to comfortably write "Brunerie-number" examples without postulates.
- Be fast enough to check my computational proof that
$\pi_4\mathbb{S}^3$ is nontrivial. It seems hopeless to compute this example in Cubical Agda today. It might be feasible to compute an analogous example incctt, but I never managed to do it. Currently in kleenextt, this example checks in around 6 minutes and 10GB of RAM, for me. - Don't be written in Haskell.
- Get
leanandlakee.g. this way or this way -
make(orlake build) builds the executable in./.lake/build/bin/kleenextt; you mightexport PATH=$(pwd)/.lake/build/bin:$PATH. -
kleenextt check examples/Pi4S3.kttto check one file.
Footnotes
-
Cyril Cohen, Thierry Coquand, Simon Huber, and Anders Mörtberg. Cubical Type Theory: A Constructive Interpretation of the Univalence Axiom. In 21st International Conference on Types for Proofs and Programs (TYPES 2015), LIPIcs 69, pp. 5:1–5:34. Schloss Dagstuhl, 2018. doi:10.4230/LIPIcs.TYPES.2015.5, arXiv:1611.02108. ↩
-
András Kovács. elaboration-zoo: minimal implementations for dependent type checking and elaboration. Software, AndrasKovacs/elaboration-zoo. ↩
-
András Kovács. cctt: high-performance cubical evaluation. 2023. Software, AndrasKovacs/cctt. See also HoTT 2023 slides. (note that my contribution was merely a couple of Brunerie-number type examples!) ↩ ↩2
-
András Kovács. smalltt: demo for high-performance type theory elaboration. Software, AndrasKovacs/smalltt. ↩
-
Cyril Cohen, Thierry Coquand, Simon Huber, Anders Mörtberg. cubicaltt: Experimental implementation of Cubical Type Theory. Software, mortberg/cubicaltt ↩ ↩2 ↩3
-
Andrea Vezzosi, Anders Mörtberg, and Andreas Abel. Cubical Agda: A Dependently Typed Programming Language with Univalence and Higher Inductive Types. Proceedings of the ACM on Programming Languages 3(ICFP), article 87, 2019. doi:10.1145/3341691, PDF. Extended version: Journal of Functional Programming 31, article e8, 2021. doi:10.1017/S0956796821000034. ↩ ↩2 ↩3 ↩4
-
Thierry Coquand, Simon Huber, and Anders Mörtberg. On Higher Inductive Types in Cubical Type Theory. In 33rd Annual ACM/IEEE Symposium on Logic in Computer Science (LICS 2018), pp. 255–264. ACM, 2018. doi:10.1145/3209108.3209197, arXiv:1802.01170. ↩
-
KANG Rongji. 2023. Software, agda/cubical#1059. ↩
-
The Agda Community. (2025). Cubical Agda Library (Version 0.9) Software, agda/cubical. ↩