Code Monkey home page Code Monkey logo

anders's Introduction

Anders

CCHM homotopy system type checker based on Mini-TT for OCaml.

Features

  • MLTT with Leibniz equality (axiomatic J and comp₆) in 500 LOC
  • Parser in 50 LOC
  • Lexer in 50 LOC
  • Full Agda-style UTF-8 support
  • Lean comma-syntax for ΠΣ
  • Non-2D syntax with top-level specificators
  • Best suited for academic papers

Prerequisites

$ apt install ocaml ocamlbuild menhir

Try

Reality checking.

def MLTT (A: U) : U := Σ
    (Π-form  : Π (B : A → U), U) -- Pi Type
    (Π-ctor₁ : Π (B : A → U), Pi A B → Pi A B)
    (Π-elim₁ : Π (B : A → U), Pi A B → Pi A B)
    (Π-comp₁ : Π (B : A → U) (a : A) (f : Pi A B), Equ (B a) (Π-elim₁ B (Π-ctor₁ B f) a) (f a))
    (Π-comp₂ : Π (B : A → U) (a : A) (f : Pi A B), Equ (Pi A B) f (λ (x : A), f x))
    (Σ-form  : Π (B : A → U), U) -- Sigma Type
    (Σ-ctor₁ : Π (B : A → U) (a : A) (b : B a), Sigma A B)
    (Σ-elim₁ : Π (B : A → U) (_ : Sigma A B), A)
    (Σ-elim₂ : Π (B : A → U) (x : Sigma A B), B (pr₁ A B x))
    (Σ-comp₁ : Π (B : A → U) (a : A) (b: B a), Equ A a (Σ-elim₁ B (Σ-ctor₁ B a b)))
    (Σ-comp₂ : Π (B : A → U) (a : A) (b: B a), Equ (B a) b (Σ-elim₂ B (a, b)))
    (Σ-comp₃ : Π (B : A → U) (p : Sigma A B), Equ (Sigma A B) p (pr₁ A B p, pr₂ A B p))
    (=-form  : Π (a : A), A → U) -- Identity Type
    (=-ctor₁ : Π (a : A), Equ A a a)
    (=-elim₁ : Π (a : A) (C: D A) (d: C a a (=-ctor₁ a)) (y: A) (p: Equ A a y), C a y p)
    (=-comp₁ : Π (a : A) (C: D A) (d: C a a (=-ctor₁ a)),
       Equ (C a a (=-ctor₁ a)) d (=-elim₁ a C d a (=-ctor₁ a))),
    U
def instance (A : U) : MLTT A :=
    (Pi A, lambda A, app A, comp₁ A, comp₂ A,
     Sigma A, pair A, pr₁ A, pr₂ A, comp₃ A, comp₄ A, comp₅ A,
     Equ A, refl A, J A, comp₆ A, A)
$ ocamlbuild -use-menhir -yaccflag "--explain" anders.native
$ ./anders.native girard check experiments/mltt.anders

Papers

Credits

  • Siegmentation Fault
  • 5HT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.