https://github.com/jozefg/nbe-for-mltt
Normalization by Evaluation for Martin-Löf Type Theory
https://github.com/jozefg/nbe-for-mltt
Last synced: 6 months ago
JSON representation
Normalization by Evaluation for Martin-Löf Type Theory
- Host: GitHub
- URL: https://github.com/jozefg/nbe-for-mltt
- Owner: jozefg
- Created: 2018-05-07T06:26:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-05T19:48:02.000Z (12 months ago)
- Last Synced: 2024-12-07T04:30:51.955Z (6 months ago)
- Language: OCaml
- Homepage:
- Size: 62.5 KB
- Stars: 122
- Watchers: 13
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## nbe-for-mltt
An implementation of Normalization by Evaluation for Martin-Löf Type Theory with dependent products
(pi), dependent sums (sigma), natural numbers, and a cumulative hierarchy. This implementation
correctly handles eta for both pi and sigma.This implementation has also been extended to include a type checker based on Coquand's semantic
type checker. In order to interact with the normalizer, therefore, one can write a file containing a
list of definitions and commands to normalize various terms.For example:
```
let plus : Nat -> Nat -> Nat =
fun m ->
fun n ->
rec n at x -> Nat with
| zero -> m
| suc _, p -> suc plet fib : Nat -> Nat =
fun n ->
let worker : Nat * Nat =
rec n at _ -> Nat * Nat with
| zero -> <1, 0>
| suc _, p -> in
snd workernormalize fib 25 at Nat
```A list of other examples may be found in `test/`.
The algorithm for normalization is heavily based on the description provided in "Normalization by
Evaluation Dependent Types and Impredicativity" by Andreas Abel. The type checker is loosely based
on "A simple type-theoretic language: Mini-TT" by Thierry Coquand, Yoshiki Kinoshita, Bengt
Nordström, and Makoto Takeyama.An explanation of the algorithm may be found in `nbe-explanation.md`. An explanation of the type
checker may be found (eventually) in `check-explanation.md`.## Compiling the code
In order to compile the code, it is necessary to install the dependent libraries:
opam install --deps-only .
Afterwards run `make all` or `dune build @install` to build the code. Specific files can be executed
with `dune exec -- mltt test/somefile.tt`.