The Logical Abstract Machine: A Curry-Howard Isomorphism for Machine Code
The Logical Abstract Machine: A Curry-Howard Isomorphism for Machine Code
复制标题
逻辑抽象机:机器代码的柯里-霍华德同构
DOI:
--
复制
发表时间:
1999
期刊:
影响因子:
--
通讯作者:
A. Ohori
中科院分区:
文献类型:
--
作者:
A. Ohori
This paper presents a logical framework for low-level machine code and code generation. We first define a calculus, called sequential sequent calculus, of intuitionistic propositional logic. A proof of the calculus only contains left rules and has a linear (non-branching) structure, which reflects the properties of sequential machine code. We then establish a Curry-Howard isomorphism between this proof system and machine code based on the following observation. An ordinary machine instruction corresponds to a polymorphic proof transformer that extends a given proof with one inference step. A return instruction, which turns a sequence of instructions into a program, corresponds to a logical axiom (an initial proof tree). Sequential execution of code corresponds to transforming a proof to a smaller one by successively eliminating the last inference step. This logical correspondence enables us to present and analyze various low-level implementation processes of a functional language within the logical framework. For example, a code generation algorithm for the lambda calculus is extracted from a proof of the equivalence theorem between the natural deduction and the sequential sequent calculus.