An experimental proof assistant for synthetic ∞-categories.
This project has started with the idea of bringing Riehl and Shulman's 2017 paper [1] to "life" by implementing a proof assistant based on their type theory with shapes. Currently an early prototype with an online playground is available. The current implementation is capable of checking various formalisations. Perhaps, the largest formalisations are available in two related projects: https://github.com/fizruk/sHoTT and https://github.com/emilyriehl/yoneda. sHoTT
project (originally a fork of the yoneda project) aims to cover more formalisations in simplicial HoTT and ∞-categories, while yoneda
project aims to compare different formalisations of the Yoneda lemma.
Internally, rzk
uses a version of second-order abstract syntax allowing relatively straightforward handling of binders (such as lambda abstraction). In the future, rzk
aims to support dependent type inference relying on E-unification for second-order abstract syntax [2].
Using such representation is motivated by automatic handling of binders and easily automated boilerplate code. The idea is that this should keep the implementation of rzk
relatively small and less error-prone than some of the existing approaches to implementation of dependent type checkers.
An important part of rzk
is a tope layer solver, which is essentially a theorem prover for a part of the type theory. A related project, dedicated just to that part is available at https://github.com/fizruk/simple-topes. simple-topes
supports used-defined cubes, topes, and tope layer axioms. Once stable, simple-topes
will be merged into rzk
, expanding the proof assistant to the type theory with shapes, allowing formalisations for (variants of) cubical, globular, and other geometric versions of HoTT.
For relatively small single-file formalisations, you can use the online playground at https://fizruk.github.io/rzk/playground.html
However, for larger and multi-file formalisations you should install a version of rzk
locally:
-
You can install the latest "stable" version of
rzk
from Hackage:cabal install rzk
-
You can install the latest "development" version of
rzk
from thedevelop
branch of this repository:git clone https://github.com/fizruk/rzk.git cd rzk git checkout develop stack build && stack install
There exists a VS Code extension for rzk
available on the Marketplace. The extension supports basic syntax highlighting, but more features may come in the future.
To check a multi-file project, you need to call rzk typecheck
specifying the files in correct order, e.g.:
rzk typecheck first.rzk second.rzk third.rzk
A proper support for inter-file dependencies will be implemented in the future. Until then, it is recommented to start names of files with a number, ensuring correct order when using a wildcard (*
). For example:
.
├── 0-common.md
├── 1-paths.md
├── 2-contractible.md
├── 3-homotopies.md
├── 4-equivalences.md
├── 5-sigma.md
└── 6-trivial-fibrations.md
1 directory, 7 files
Inside of such directory, you can run rzk typecheck
on all files using wildcards:
rzk typecheck *-*.md
First, you need to install MkDocs and mdx_math
Markdown extension (to enable LaTeX):
pip install python-markdown-math
Now, you can build and serve the documentation locally by running
mkdocs serve --config-file docs/mkdocs.yml
The (locally built) documentation should be available at http://127.0.0.1:8000
The pages of the documentation are the *.md
files in docs/docs directory and its subdirectories.
To add a new page, you can create a new *.md
file and add it to the navigation by modifying docs/mkdocs.yml.
The project is developed with both Stack and Nix (for GHCJS version).
For quick local development and testing it is recommended to work with a GHC version, using Stack tool. Clone this project and simply run stack build
:
git clone [email protected]:fizruk/rzk.git
cd rzk
stack build
The build provides an executable rzk
which can be used to typecheck files:
stack exec -- rzk typecheck FILE
try-rzk
package is designed to be compiled using GHCJS for an in-browser version of the proof assistant. To build this package you need to use Nix. It is recommended that you use Cachix to avoid recompiling lots of dependencies:
# Install Nix
curl https://nixos.org/nix/install | sh
# (optionally) Install Cachix
nix-env -iA cachix -f https://cachix.org/api/v1/install
# (optionally) Use cached miso from Cachix
cachix use miso-haskell
Clone the repository, enter try-rzk
directory and use nix-build
:
git clone [email protected]:fizruk/rzk.git
cd rzk/try-rzk
nix-build
Now open playground.html
to see the result. Note that if local GHCJS build is unavailable, playground.html
will use the JS file from GitHub Pages as a fallback.
The flake in this repository allows to build try-rzk
incrementally and reproducibly.
-
Install
Nix
via single-user installation:- Run script
sh <(curl -L https://nixos.org/nix/install) --no-daemon
- Permanently enable flakes
-
Enter the
devShell
withGHC
(notGHCJS
). Answery
toNix
prompts to use binary caches.nix develop
-
The shell provides
ghc
,haskell-language-server
,cabal-install
,hpack
. -
(Optionally) Install direnv to start the
devShell
when you enter the repository directory. -
Build
rzk
.cabal build
-
Enter the
devShell
withGHCJS
.nix develop .#ghcjs
-
Build
try-rzk
. This may require ~10 GB of RAM.cabal build --ghcjs
-
(Optionally) Build
rzk
viaNix
. The resulting executable will be inresult/bin/rzk
.nix build .#rzk
-
(Optionally) Run
rzk
viaNix
.nix run .#rzk
-
(Optionally) Build
try-rzk
viaNix
. This may require ~10 GB of RAM. The resulting executable will be intry-rzk/result/bin/try-rzk.jsexe
.nix build .#try-rzk --out-link try-rzk/result
-
Open the app in a browser.
firefox try-rzk/playground.html
- Emily Riehl & Michael Shulman. A type theory for synthetic ∞-categories. Higher Structures 1(1), 147-224. 2017. https://arxiv.org/abs/1705.07442
- Nikolai Kudasov. E-unification for Second-Order Abstract Syntax. 2023. https://arxiv.org/abs/2302.05815