• Stars
    star
    107
  • Rank 312,680 (Top 7 %)
  • Language
    OCaml
  • Created about 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Normalization by Evaluation for Martin-Löf Type Theory

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 p

let fib : Nat -> Nat =
  fun n ->
  let worker : Nat * Nat =
    rec n at _ -> Nat * Nat with
    | zero -> <1, 0>
    | suc _, p -> <plus (fst p) (snd p), fst p> in
  snd worker

normalize 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.

More Repositories

1

learn-tt

A collection of resources for learning type theory and type theory adjacent fields.
1,913
star
2

higher-order-unification

A small implementation of higher-order unification
Haskell
165
star
3

pcf

A small compiler for PCF
Haskell
118
star
4

blott

An experimental type checker for a modal dependent type theory.
OCaml
110
star
5

hm

A small implementation of type inference
Standard ML
74
star
6

miniprl

A small implementation of a proof refinement logic.
Standard ML
49
star
7

wiki-summary.el

Get summaries of wikipedia articles in Emacs
Emacs Lisp
27
star
8

undergraduate-thesis

A discouraging story.
TeX
15
star
9

graph-models

Notes on P-omega
TeX
14
star
10

modal

Modal logic in Haskell through Static Pointers
Haskell
8
star
11

sml-fingertree

The ugliness is worth it, the ugliness is worth it, the ugliness...
Standard ML
8
star
12

cooked-pi

What if we built the same frustrating type checker over and over again? For science.
Haskell
7
star
13

independence-of-the-continuum-hypothesis

Some notes on the independence of the continuum hypothesis.
TeX
7
star
14

c-dsl

a dsl for generating C
Haskell
7
star
15

register-alloc

WIP - A little doodle of a register allocator with an explanation of how it works.
Haskell
6
star
16

fibrational-semantics

Notes on simple fibrational semantics.
TeX
6
star
17

hlf

an implementation of LF
Haskell
5
star
18

hi

A toy interpreter for Haskell
Haskell
5
star
19

sml-kanren

Let's make another miniKanren.
Standard ML
5
star
20

concurrent-stack-with-helping

A case study in Iris formalizing a concurrent stack with helping.
TeX
4
star
21

ds-kanren

a tiny logic programming language
Haskell
4
star
22

emacs.d

my emacs config
Emacs Lisp
3
star
23

secret-notes

Containing small notes which aren't original or noteworthy, but which I don't want to lose.
TeX
3
star
24

hasquito

a dysfunctional compiler to javascript
Haskell
3
star
25

sml-abt-unify

Simple unification for ABTs in SML
Standard ML
3
star
26

blog

the source for jozefg.bitbucket.org
HTML
3
star
27

a-short-talk-on-iris

The notes for a short talk given on Iris in a seminar on concurrent separation logic at Carnegie Mellon.
TeX
2
star
28

bound-gen

Making bound play nice with monad-gen.
Haskell
2
star
29

regex

an exercise in decision procedures in Agda
Agda
2
star
30

folds-common

A conglomeration of folds.
Haskell
2
star
31

ctt.elf

Probably wrong formalization of computational type theory in Twelf.
2
star
32

classical-realizability

Notes on a realizability model for a classical logic
TeX
2
star
33

drafts

Drafts of posts for my blog
TeX
2
star
34

kripke

Modal logic and Kripke semantics in Twelf
2
star
35

oplss

My notes from OPLSS and related pre-lecture-thingies
2
star
36

hotc

Notes on higher-order typed compilation. Probably wrong
TeX
2
star
37

sml-higher-order-matching

A (probably broken) second order pattern matching
Standard ML
2
star
38

simple-abt

Nothing fancy, just binding without pain
Standard ML
2
star
39

generic-church

automatic church encodings
Haskell
2
star
40

monad-gen

a monad for fresh values
Haskell
2
star
41

f2js

A compiler in need of a better name
Haskell
2
star
42

jozefg.github.io

website
HTML
1
star
43

reified-records

automatic reification of records to maps
Haskell
1
star
44

c_of_scheme

a lousy scheme compiler
Haskell
1
star