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

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

MIT licensed by James M

ΔΛ (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]B 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 :

comments powered byDisqus