请输入您要查询的百科知识:

 

词条 Epigram (programming language)
释义

  1. Syntax

      Examples    The natural numbers    Recursion on naturals    Addition  

  2. Dependent types

  3. See also

  4. Further reading

  5. External links

  6. References

{{short description|Functional programming language}}{{Infobox programming language
| name = Epigram
| logo =
| paradigm = Functional
| year = 2004
| designer = Conor McBride and
James McKinna
| developer = Unmaintained
| latest_release_version = 1
| latest release date ={{release date|mf=yes|2006|10|11}}
| typing = strong, static, dependent
| implementations =
| dialects =
| influenced_by = ALF
| influenced = Agda, Idris
| operating_system = Cross-platform: Linux, Windows, Mac OS X
| license = MIT[1]
| file_ext =
}}

Epigram is a functional programming language with dependent types. Epigram also refers to the IDE usually packaged with the language. 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 together with a user manual, a tutorial and some background material. The system has been used under Linux, Windows and Mac OS X.

It is currently unmaintained, and version 2, which was intended to implement Observational Type Theory, was never officially released, however there exists a GitHub mirror, last updated in 2012. The design of Epigram and Epigram 2 have inspired the development of other systems such as Agda, Idris and Coq.

Syntax

Epigram uses a two-dimensional, natural deduction style syntax, with a LaTeX version and an ASCII version. Here are some examples from 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:

The horizontal-line notation can be read as "assuming (what is on the top) is true, we can infer that (what is on the bottom) is true." For example, "assuming n is of type Nat, then suc n is of type Nat." If nothing is on the top, then the bottom statement is always true: "zero is of type Nat (in all cases)."

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

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 ; 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 The Epigram Tutorial.

See also

  • Alf, a proof assistant among the predecessors of Epigram.

Further reading

  • Conor McBride and James McKinna (2004), The view from the left, Journal of Functional Programming
  • Conor McBride (2004), The Epigram Prototype, a nod and two winks
  • Conor McBride (2004), The Epigram Tutorial
  • Thorsten Altenkirch, Conor McBride and James McKinna (2005), Why Dependent Types Matter
  • James Chapman, Thorsten Altenkirch, Conor McBride (2006), "Epigram Reloaded: A Standalone Typechecker for ETT"
  • James Chapman, Pierre-Évariste Dagand, Conor McBride, Peter Morris (2010), "The gentle art of levitation"

External links

  • [https://web.archive.org/web/20060209235723/http://www.macs.hw.ac.uk/~fairouz/projects/EffProClaLog.html EPSRC] on ALF, lego and related (archived version from 2006)
  • [https://github.com/david-christiansen/epigram1 Epigram 1 GitHub repo]
  • [https://github.com/mietek/epigram2 Epigram 2 GitHub repo]

References

1. ^{{cite web|title = epigram - Official website|url = https://code.google.com/p/epigram/|accessdate=28 November 2015}}

4 : Functional languages|Dependently typed languages|Proof assistants|Discontinued programming languages

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/10 6:54:01