functional-programmingformal-methodscurry-howard

What are the most interesting equivalences arising from the Curry-Howard Isomorphism?


I came upon the Curry-Howard Isomorphism relatively late in my programming life, and perhaps this contributes to my being utterly fascinated by it. It implies that for every programming concept there exists a precise analogue in formal logic, and vice versa. Here's a "basic" list of such analogies, off the top of my head:

program/definition        | proof
type/declaration          | proposition
inhabited type            | theorem/lemma
function                  | implication
function argument         | hypothesis/antecedent
function result           | conclusion/consequent
function application      | modus ponens
recursion                 | induction
identity function         | tautology
non-terminating function  | absurdity/contradiction
tuple                     | conjunction (and)
disjoint union            | disjunction (or)          -- corrected by Antal S-Z
parametric polymorphism   | universal quantification

So, to my question: what are some of the more interesting/obscure implications of this isomorphism? I'm no logician so I'm sure I've only scratched the surface with this list.

For example, here are some programming notions for which I'm unaware of pithy names in logic:

currying                  | "((a & b) => c) iff (a => (b => c))"
scope                     | "known theory + hypotheses"

And here are some logical concepts which I haven't quite pinned down in programming terms:

primitive type?           | axiom
set of valid programs?    | theory

Edit:

Here are some more equivalences collected from the responses:

function composition      | syllogism                -- from Apocalisp
continuation-passing      | double negation          -- from camccann

Solution

  • Since you explicitly asked for the most interesting and obscure ones:

    You can extend C-H to many interesting logics and formulations of logics to obtain a really wide variety of correspondences. Here I've tried to focus on some of the more interesting ones rather than on the obscure, plus a couple of fundamental ones that haven't come up yet.

    evaluation             | proof normalisation/cut-elimination
    variable               | assumption
    S K combinators        | axiomatic formulation of logic   
    pattern matching       | left-sequent rules 
    subtyping              | implicit entailment (not reflected in expressions)
    intersection types     | implicit conjunction
    union types            | implicit disjunction
    open code              | temporal next
    closed code            | necessity
    effects                | possibility
    reachable state        | possible world
    monadic metalanguage   | lax logic
    non-termination        | truth in an unobservable possible world
    distributed programs   | modal logic S5/Hybrid logic
    meta variables         | modal assumptions
    explicit substitutions | contextual modal necessity
    pi-calculus            | linear logic
    

    EDIT: A reference I'd recommend to anyone interested in learning more about extensions of C-H:

    "A Judgmental Reconstruction of Modal Logic" http://www.cs.cmu.edu/~fp/papers/mscs00.pdf - this is a great place to start because it starts from first principles and much of it is aimed to be accessible to non-logicians/language theorists. (I'm the second author though, so I'm biased.)