Epigram (programming language)

Epigram (programming language)

Epigram is the name of a functional programming language with dependent types and of the IDE usually packaged with it. Epigram's type system is strong enough to express program specifications. The goal is to support a smooth transition from ordinary programming to integrated programs and proofs whose correctness can be checked and certified by the compiler. Epigram exploits the propositions as types principle, and is based on intuitionistic 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 and Royal 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 under Linux, Windows and Mac 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:

( ! ( ! ( n : Nat !data !---------! where !----------! ; !-----------! ! Nat : * ) !zero : Nat) !suc n : Nat)
The declaration says that Nat is a type with kind * (i.e., it is a simple type) and two constructors: zero and suc. The constructor suc takes a single Nat argument and returns a Nat. This is equivalent to the Haskell declaration "data Nat = Zero | Suc Nat".

In LaTex, the code is displayed as:

underlinemathrm{data} ; left(frac{}{mathsf{Nat} : star} ight) ; underlinemathrm{where} ; left(frac{}{mathsf{zero} : mathsf{Nat ight) ; ; ; left(frac{n : mathsf{Nat{mathsf{suc} n : mathsf{Nat ight)

Recursion on naturals

mathsf{NatInd} : egin{matrix} forall P : mathsf{Nat} ightarrow star Rightarrow P mathsf{zero} ightarrow \ (forall n : mathsf{Nat} Rightarrow P n ightarrow P (mathsf{suc} n)) ightarrow\ forall n : mathsf{Nat} Rightarrow P n end{matrix}

mathsf{NatInd} P mz ms zero equiv mz

mathsf{NatInd} P mz ms (mathsf{suc} n) equiv ms n (NatInd P mz ms n)

...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 with generalized algebraic data type extensions, except for two extensions. First, types are first-class entities, of type star; types are arbitrary expressions of type star, and type equivalence is defined in terms of the types' normal forms. Second, it has a dependent function type; instead of P ightarrow Q, forall x : P Rightarrow Q, where x is bound in Q to the value that the function's argument (of type P) 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 language

External 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.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Haskell (programming language) — Haskell Paradigm(s) functional, lazy/non strict, modular Appeared in 1990 Designed by Simon Peyton Jones, Lennart Aug …   Wikipedia

  • Epigram (disambiguation) — An epigram is a short poem with a clever twist, or a concise and witty statement.Epigram may also refer to:* Epigram (programming language), a functional programming language with dependent types * Epigram (newspaper), the independent student… …   Wikipedia

  • language — /lang gwij/, n. 1. a body of words and the systems for their use common to a people who are of the same community or nation, the same geographical area, or the same cultural tradition: the two languages of Belgium; a Bantu language; the French… …   Universalium

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

  • Sapir–Whorf and programming languages — The Sapir–Whorf hypothesis is sometimes applied in computer science to postulate that programmers skilled in a certain programming language may not have a (deep) understanding of some concepts of other languages. Though it may equally apply to… …   Wikipedia

  • Haskell — Класс языка: функциональный, ленивый, модульный Тип исполнения: компилируемый, интерпретируемый Появился в: 1990 …   Википедия

  • Agda — Класс языка: функциональный, доказыватель теорем[en] Автор(ы): Ульф Норелл Релиз: 2.3.2 (12 ноября 2012) …   Википедия

  • Соответствие Карри — Соответствие Карри  Ховарда (изоморфизм Карри  Ховарда, англ. formulae as types interpretation)  наблюдаемая структурная эквивалентность между математическими доказательствами и программами. Эта эквивалентность может быть… …   Википедия

  • Type system — Type systems Type safety Inferred vs. Manifest Dynamic vs. Static Strong vs. Weak Nominal vs. Structural Dependent typing Duck typing Latent typing Linear typing Uniqueness typing …   Wikipedia

  • Turing completeness — For the usage of this term in the theory of relative computability by oracle machines, see Turing reduction. In computability theory, a system of data manipulation rules (such as an instruction set, a programming language, or a cellular… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”