Epigram is a
functional programming
In computer science, functional programming is a programming paradigm where programs are constructed by Function application, applying and Function composition (computer science), composing Function (computer science), functions. It is a declarat ...
language with
dependent type
In computer science and logic, a dependent type is a type whose definition depends on a value. It is an overlapping feature of type theory and type systems. In intuitionistic type theory, dependent types are used to encode logic's quantifiers lik ...
s, and the
integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
(IDE) usually packaged with the language. Epigram's
type system
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a ''type'' (for example, integer, floating point, string) to every '' term'' (a word, phrase, or other set of symbols). Usu ...
is strong enough to express
program specification
In computer science, formal specifications are mathematically based techniques whose purpose is to help with the implementation of systems and software. They are used to describe a system, to analyze its behavior, and to aid in its design by verify ...
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 the
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
. Epigram exploits the ''
Curry–Howard correspondence
In programming language theory and proof theory, the Curry–Howard correspondence is the direct relationship between computer programs and mathematical proofs. It is also known as the Curry–Howard isomorphism or equivalence, or the proofs-as-p ...
'', also termed the ''propositions as types principle'', and is based on
intuitionistic type theory
Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory (MLTT)) is a type theory and an alternative foundation of mathematics.
Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematicia ...
.
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
Nottingham ( , East Midlands English, locally ) is a City status in the United Kingdom, city and Unitary authorities of England, unitary authority area in Nottinghamshire, East Midlands, England. It is located south-east of Sheffield and nor ...
,
Durham,
St Andrews
St Andrews (; ; , pronounced ʰʲɪʎˈrˠiː.ɪɲ is a town on the east coast of Fife in Scotland, southeast of Dundee and northeast of Edinburgh. St Andrews had a recorded population of 16,800 , making it Fife's fourth-largest settleme ...
, and
Royal Holloway, University of London
Royal Holloway, University of London (RH), formally incorporated as Royal Holloway and Bedford New College, is a public university, public research university and a constituent college, member institution of the federal University of London. It ...
in the
United Kingdom
The United Kingdom of Great Britain and Northern Ireland, commonly known as the United Kingdom (UK) or Britain, is a country in Northwestern Europe, off the coast of European mainland, the continental mainland. It comprises England, Scotlan ...
(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
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, and
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
.
It is currently unmaintained, and version 2, which was intended to implement Observational Type Theory, was never officially released but exists in
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
.
Syntax
Epigram uses a two-dimensional,
natural deduction
In logic and proof theory, natural deduction is a kind of proof calculus in which logical reasoning is expressed by inference rules closely related to the "natural" way of reasoning. This contrasts with Hilbert-style systems, which instead use ...
style syntax, with versions in
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well.
In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
and
ASCII
ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
. Here are some examples from ''The Epigram Tutorial'':
Examples
The natural numbers
The following declaration defines the
natural numbers
In mathematics, the natural numbers are the numbers 0, 1, 2, 3, and so on, possibly excluding 0. Some start counting with 0, defining the natural numbers as the non-negative integers , while others start with 1, defining them as the positiv ...
:
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
Haskell () is a general-purpose, statically typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell pioneered several programming language ...
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:
Addition
:
...And in ASCII:
Dependent types
Epigram is essentially a
typed lambda calculus
A typed lambda calculus is a typed formalism that uses the lambda symbol (\lambda) to denote anonymous function abstraction. In this context, types are usually objects of a syntactic nature that are assigned to lambda terms; the exact nature of a ...
with
generalized algebraic data type
In functional programming, a generalized algebraic data type (GADT, also first-class phantom type, guarded recursive datatype, or equality-qualified type) is a generalization of a Parametric polymorphism, parametric algebraic data type (ADT).
Ove ...
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
*
*
*
*
*
*
References
External links
*
*
* {{GitHub, mietek/epigram2, Epigram2
EPSRCon ALF, lego and related; archived version from 2006
Academic programming languages
Functional languages
Dependently typed languages
Proof assistants
Discontinued programming languages