- Epigram (programming language)
Epigram is the name of a
functional programming language withdependent type s and of the IDE usually packaged with it. Epigram'stype system is strong enough to expressprogram specification s. The goal is to support a smooth transition from ordinary programming to integrated programs and proofs whose correctness can be checked and certified by thecompiler . Epigram exploits thepropositions as types principle , and is based onintuitionistic type theory .The Epigram prototype was implemented by Conor McBride based on joint work with James McKinna. Its development is continued by the Epigram group in
Nottingham ,Durham ,St Andrews andRoyal Holloway in the UK. The current experimental implementation of the Epigram system is freely available from the [http://www.e-pig.org/ Epigram homepage] together with a user manual, a tutorial and some background material. The system has been used underLinux , Windows andMac OS X .Syntax
Epigram uses a two-dimensional syntax, with a LaTeX version and an ASCII version. Here are some examples from [http://www.e-pig.org/downloads/epigram-notes.pdf "The Epigram Tutorial"] :
Examples
The natural numbers
The following declaration defines the
natural numbers :
The declaration says that( ! ( ! ( n : Nat !data !---------! where !----------! ; !-----------! ! Nat : * ) !zero : Nat) !suc n : Nat)Nat
is a type with kind*
(i.e., it is a simple type) and two constructors:zero
andsuc
. The constructorsuc
takes a singleNat
argument and returns aNat
. This is equivalent to the Haskell declaration "data Nat = Zero | Suc Nat
".In LaTex, the code is displayed as:
Recursion on naturals
...And in ASCII:
NatInd : all P : Nat -> * => P zero -> (all n : Nat => P n -> P (suc n)) -> all n : Nat => P nNatInd P mz ms zero => mzNatInd P mz ms (suc n) => ms n (NatInd P mz ms n)Addition
...And in ASCII:
plus x y <= rec x { plus x y <= case x { plus zero y => y plus (suc x) y => suc (plus x y)Dependent types in Epigram
Epigram is essentially a
typed lambda calculus withgeneralized algebraic data type extensions, except for two extensions. First, types are first-class entities, of type ; types are arbitrary expressions of type , and type equivalence is defined in terms of the types' normal forms. Second, it has a dependent function type; instead of , , where is bound in to the value that the function's argument (of type ) eventually takes.Full dependent types, as implemented in Epigram, are a powerful abstraction. (Unlike in
Dependent ML , the value(s) depended upon may be of any valid type.) A sample of the new formal specification capabilities dependent types bring may be found in [http://www.e-pig.org/downloads/epigram-notes.pdf "The Epigram Tutorial"] .It is planned that the forthcoming version of Epigram, Epigram 2, will be based on [http://www.cs.nott.ac.uk/~txa/publ/ott-conf.pdf Observational Type Theory] (note: link is to an incomplete draft paper), a new development of constructive type theory.
See also
* [http://www.macs.hw.ac.uk/~fairouz/projects/EffProClaLog.html EPSRC] on ALF, lego and related
*Alf, the Algebraic Logic Functional programming languageExternal links
*The [http://www.e-pig.org/ home page of the Epigram project]
*Conor McBride and James McKinna (2004), [http://www.e-pig.org/downloads/view.pdf "The view from the left"] (pdf), Journal of Functional Programming
*Conor McBride (2004), [http://www.e-pig.org/downloads/epigram-system.pdf "The Epigram Prototype, a nod and two winks"] (pdf)
*Conor McBride (2004), [http://www.e-pig.org/downloads/epigram-notes.pdf "The Epigram Tutorial"] (pdf)
*Thorsten Altenkirch, Conor McBride and James McKinna (2005), [http://www.e-pig.org/downloads/ydtm.pdf "Why Dependent Types Matter"] (pdf)
Wikimedia Foundation. 2010.