ArticleslgStudy

mathematics

Epigram (programming language)

Epigram (programming language) is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Epigram (programming language) rather than just read about it. In short: Epigram is a functional programming language with dependent types, and the integrated development environment (IDE) usually packaged with the language. Epigram's type system is strong enough to express program specifications.

Key takeaways

  • Epigram (programming language) belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Epigram (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Epigram (programming language) from memory before moving on to harder problems.

Reference excerpt

Epigram is a functional programming language with dependent types, and the integrated development environment (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 Curry–Howard correspondence, also termed 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, University of London in the United Kingdom (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 macOS. It is currently unmaintained, and version 2, which was intended to implement Observational Type Theory, was never officially released but exists in GitHub.

Syntax Epigram uses a two-dimensional, natural deduction style syntax, with versions in LaTeX and ASCII. Here are some examples from The Epigram Tutorial:

Examples

The natural numbers The following declaration defines the natural numbers:

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:

data_(𝖭𝖺𝗍:⋆)where_(𝗓𝖾𝗋𝗈:𝖭𝖺𝗍);(n:𝖭𝖺𝗍𝗌𝗎𝖼 n:𝖭𝖺𝗍) 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 𝖭𝖺𝗍𝖨𝗇𝖽:∀P:𝖭𝖺𝗍→⋆⇒P 𝗓𝖾𝗋𝗈→(∀n:𝖭𝖺𝗍⇒P n→P (𝗌𝗎𝖼 n))→∀n:𝖭𝖺𝗍⇒P n 𝖭𝖺𝗍𝖨𝗇𝖽 P mz ms 𝗓𝖾𝗋𝗈≡mz 𝖭𝖺𝗍𝖨𝗇𝖽 P mz ms (𝗌𝗎𝖼 n)≡ms n (NatInd P mz ms n) In ASCII:

Addition 𝗉𝗅𝗎𝗌 x y⇐rec_ x { 𝗉𝗅𝗎𝗌 x y⇐case_ x { 𝗉𝗅𝗎𝗌 𝗓𝖾𝗋𝗈 y⇒y 𝗉𝗅𝗎𝗌 (𝗌𝗎𝖼 x) y⇒𝗌𝗎𝖼 (𝗉𝗅𝗎𝗌 x y) } } In ASCII:

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 P→Q, ∀x:P⇒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 The Epigram Tutorial.

See also ALF, a proof assistant among the predecessors of Epigram.

Further reading McBride, Conor; McKinna, James (2004). "The view from the left". Journal of Functional Programming. 14: 69–111. doi:10.1017/S0956796803004829. S2CID 6232997. McBride, Conor (2004). The Epigram Prototype, a nod and two winks (Report). McBride, Conor (2004). The Epigram Tutorial (Report). Altenkirch, Thorsten; McBride, Conor; McKinna, James (2005). Why Dependent Types Matter (Report). Chapman, James; Altenkirch, Thorsten; McBride, Conor (2006). Epigram Reloaded: A Standalone Typechecker for ETT (Report). Chapman, James; Dagand, Pierre-Évariste; McBride, Conor; Morris, Peter (2010). The gentle art of levitation (Report).

References

External links Official website Epigram 1 on GitHub Epigram2 on GitHub EPSRC on ALF, lego and related; archived version from 2006

Worked examples

Example 1 — a first encounter with Epigram (programming language)

Start with the simplest possible case. Write down what Epigram (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Epigram (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Epigram (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Epigram (programming language)

In research
Epigram (programming language) appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Epigram (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Epigram (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Academic programming languages, Dependently typed languages, Discontinued programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for Epigram (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Epigram (programming language)” →

How to study Epigram (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Epigram (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Epigram (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Epigram (programming language) in simple terms?

Epigram is a functional programming language with dependent types, and the integrated development environment (IDE) usually packaged with the language. Epigram's type system is strong enough to express program specifications.

Why does Epigram (programming language) matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Epigram (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Epigram (programming language).

Tags

  • Academic programming languages
  • Dependently typed languages
  • Discontinued programming languages
  • Functional languages
  • Proof assistants

Keep exploring