MyNixOS website logo
Description

A demonstration interpreter for type system delta-lambda (of N.G. De-bruijn)

A demonstration package for the type system delta-lambda (of N.G. De-bruijn) in ~1000 lines of haskell. this is at the moment exceptionally ALPHA level software. no tests for the validity of the type checker (only the type synthesizer), or the parser, or the repl, etc... there are dragons in here (soon to be tamed), and lots of them! todo: profiling, unit testing, formal verification of type correctness adequacy proof of the implemented type system.

ΔΛ (Delta-Lambda)

Build Status

Introduction :

This language is a test language for an implementation of the type system ΔΛ (Delta-Lambda) described by de Bruijn for simplifying the semantics of his Automath project. Eventually I will post the Coq/Idris/Agda/etc... proofs for the compliance of the code to the inferential rules specified by De Groote.

Syntax :

The syntax is expressed in EBNF.

expression syntax

Expression  = 'type'
	          | Identifier
            | '(' , Expression  , { ',' , Expression  } , ')' , Expression
            | '[' , Declaration , { ',' , Declaration } , ']' , Expression
            ;
Declaration = [ Identifier , { ',' , Identifier } ] ':' Expression
            ;

Semantics :

the semantics of delta-lambda are fairly simple, and involve inductive definitions on the structure of expressions. We will step through the inductive relations on terms and describe them in detail. We assume that beta equivalence is known to be the reflexive transitive symmetric closure of beta reduction, which is defined as normal. the notation [x := A]/CODE is used to represent substitution, which also takes on the typical meaning (pedants may examine de Bruijn's paper)

here are the relations (the names of which are the same in the code):

  1. typeOf
  • the typeOf function produces the type of a term, by replacing the tail variable with it's type

typeOf[context, x] = A if [x : A] in context

typeOf[context, (A) B] = (A) typeOf[context, B]

typeOf[context, [x : A] B] = [x: A] typeOf[[x : A] context, B])

  1. ftype
  • this function produces the 'final' type of a term, that is the term ends in type. (note that this essentially preforms eta expansion)

ftype[context, A] = A if tail[A] is type

ftype[context, A] = typef[context, typeOf[context, A]] if tail[A] is not type

  1. tail
  • this function computes the term at the 'end' of a spine.

tail[type] = type

tail[x] = x

tail[(A) B] = tail[B]

tail[[x : A] B] = tail[B]

  1. correct
  • this is the most important structural function, it's purpose is to prove (or disprove) that a given term is (or is not) correct.

correct[context, type] = true

correct[context, x] = true iff (x A) in context, else false

correct[context, [x : A] B] = correct[context, A] and correct[[x : A] context, B]

correct[context, (A) B] = correct[B] and typing[context, A] is beta equivalent to some [x : C] D and typeOf[context, B] is beta equivalent to C and correct[context, [x := B]D]

It must be reiterated that proofs of the conformance of these structural relations on Expressions have not been written yet, as the relations are not simply recursive, so a proof in Coq/Agda/Idris/etc... will be very difficult Also note that the code does not exactly follow this formalism.

References :

Metadata

Version

0.3.0.0

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows