Git Product home page Git Product logo

spartan-type-theory's Introduction

An implementation of spartan type theory

This repository shows how to implement a minimalist type theory of the kind that is sometimes called “spartan”. The current version is an updated version of the one presented at the School and Workshop on Univalent Mathematics which took place at the University of Birmingham in December 2017.

The type theory

The dependent type theory spartan has the following ingridients:

  • A universe Type with Type : Type.
  • Dependent products, written as forall (x : T₁), T₂ or ∀ (x : T₁), T₂ or ∏ (x : T₁), T₂.
  • Functions, written as one of fun (x : T) => e or λ (x : T) ⇒ e. The typing annotation may be omitted, i.e., fun x => e, and multiple abstractions may be shortened as λ x y (z u : T) (w : U) ⇒ e.
  • Application e₁ e₂.
  • Type ascription written as e : T.

Top-level commands:

  • Definition x := e. -- define a value
  • Axiom x : T. -- assume a constant x of type T
  • Check e. -- print the type of e
  • Eval e. -- evaluate e a la call-by-value
  • Load "⟨file⟩". -- load a file

Prerequisites

  • OCaml and OPAM

  • The OPAM packages dune, menhir, mehirLib, sedlex and bindlib:

      opam install dune menhir menihirLib sedlex bindlib
    
  • It is recommended that you also install the rlwrap or ledit command line wrapper.

Compilation

You can type:

  • dune build to compile the spartan.exe executable.
  • dune clean to clean up.

Usage

Once you compile the program, you can run it in interactive mode as ./spartan.exe

Run ./spartan.exe --help to see the command-line options and general usage.

Source code

The purpose of the implementation is to keep the source uncomplicated and short. The essential bits of source code can be found in the following files. It should be possible for you to just read the entire source code.

It is best to first familiarize yourself with the core:

Continue with the infrastructure:

spartan-type-theory's People

Contributors

andrejbauer avatar franklinchen avatar spl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

spartan-type-theory's Issues

Compilation fails with current Makefile

Hi,

Wanted to report that with current versions of sedlex (at least on my machine) compilation will not work unless the Makefile line is changed from:

OCAMLBUILD_FLAGS = -j 4 -cflags -w,+a-4-27-29-50,"-warn-error +a" -lib unix -use-ocamlfind -pkg menhirLib -pkg sedlex

to

OCAMLBUILD_FLAGS = -j 4 -cflags -w,+a-4-27-29-50,"-warn-error +a" -lib unix -use-ocamlfind -pkg menhirLib -pkg sedlex.ppx

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.