在我编程生涯的后期,我遇到了Curry-Howard同构,也许这让我完全被它迷住了。这意味着对于每个编程概念,形式逻辑中都有一个精确的类似物,反之亦然。这是此类比喻的“基本”清单,让我无所适从:
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
那么,我的问题是:同构的一些更有趣/模糊的含义是什么?我不是逻辑学家,所以我敢肯定,我只用这份清单打了水漂。
例如,以下是一些编程概念,我不了解它们的逻辑名称:
currying | "((a & b) => c) iff (a => (b => c))"
scope | "known theory + hypotheses"
这里是一些我在编程方面还没有完全确定的逻辑概念:
primitive type? | axiom
set of valid programs? | theory
编辑:
这是从响应中收集的更多等效项:
function composition | syllogism -- from Apocalisp
continuation-passing | double negation -- from camccann
goto | jumping to conclusions