我来到了库里-霍华德同构 http://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence我的编程生涯相对较晚,也许这使得我对它完全着迷。这意味着对于每个编程概念,形式逻辑中都存在精确的类比,反之亦然。这是我脑海中浮现出来的此类类比的“基本”列表:
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
Edit:
以下是从回复中收集的更多等效项:
function composition | syllogism -- from Apocalisp
continuation-passing | double negation -- from camccann
由于您明确要求最有趣和最晦涩的内容:
您可以将 C-H 扩展到许多有趣的逻辑和逻辑公式,以获得真正广泛的对应关系。在这里,我试图关注一些更有趣的问题,而不是晦涩难懂的问题,以及一些尚未出现的基本问题。
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
编辑:我向任何有兴趣了解更多有关 C-H 扩展的人推荐参考:
《模态逻辑的判断性重构》http://www.cs.cmu.edu/~fp/papers/mscs00.pdf http://www.cs.cmu.edu/~fp/papers/mscs00.pdf- 这是一个很好的起点,因为它从第一原则开始,其中大部分内容旨在让非逻辑学家/语言理论家能够理解。 (虽然我是第二作者,所以我有偏见。)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)