A program logic for higher-order procedural variables and non-local jumps
📝 Abstract
Relying on the formulae-as-types paradigm for classical logic, we define a program logic for an imperative language with higher-order procedural variables and non-local jumps. Then, we show how to derive a sound program logic for this programming language. As a by-product, we obtain a non-dependent type system which is more permissive than what is usually found in statically typed imperative languages. As a generic example, we encode imperative versions of delimited continuations operators shift and reset.
💡 Analysis
Relying on the formulae-as-types paradigm for classical logic, we define a program logic for an imperative language with higher-order procedural variables and non-local jumps. Then, we show how to derive a sound program logic for this programming language. As a by-product, we obtain a non-dependent type system which is more permissive than what is usually found in statically typed imperative languages. As a generic example, we encode imperative versions of delimited continuations operators shift and reset.
📄 Content
A program logic for higher-order procedural variables and non-local jumps Tristan Crolard Emmanuel Polonowski December 2011 TR–LACL–2011–4 Laboratoire d’Algorithmique, Complexité et Logique (LACL) Département d’Informatique Université Paris-Est Créteil – Val de Marne, Faculté des Sciences et Technologie 61, Avenue du Général de Gaulle, 94010 Créteil cedex, France Tel.: (33)(1) 45 17 16 47, Fax: (33)(1) 45 17 66 01 arXiv:1112.1554v1 [cs.LO] 7 Dec 2011 Laboratory of Algorithmics, Complexity and Logic (LACL) University Paris-Est Créteil Technical Report TR–LACL–2011–4 Tristan Crolard, Emmanuel Polonowski. A program logic for higher-order procedural variables and non-local jumps © Tristan Crolard, Emmanuel Polonowski, December 2011. A program logic for higher-order procedural variables and non-local jumps T. Crolarda,1, E. Polonowskia,1 aLACL, Université Paris Est, 61 avenue du Général de Gaulle, 94010 Créteil Cedex, France Abstract Relying on the formulae-as-types paradigm for classical logic, we define a program logic for an imperative language with higher-order procedural variables and non-local jumps. Then, we show how to derive a sound program logic for this programming language. As a by-product, we obtain a non-dependent type system which is more permissive than what is usually found in statically typed imperative languages. As a generic example, we encode imperative versions of delimited continuations operators shift and reset. Key words: callcc, continuation, monad, reset, shift, imperative programming, loop, jump, goto. 1 Introduction In his seminal series of papers [44, 45, 46], Landin proposed a direct translation of an idealized Algol into the λ-calculus. This translation required to extend the λ-calculus with a new operator J in order to handle non- local jumps in Algol. This operator, which was described in detail in [47] (see also [74] for an introduction), is the father to all control operators in functional languages (such as the famous call/cc of Scheme [40] or Standard ML of New Jersey [32]). The syntactic theory of control has subsequently been explored thoroughly by Felleisen [21]. A type system for control operators which extends the so-called Curry-Howard correspondence [16, 39] to classical logic first appeared in Griffin’s pioneering work [31], and was immediately generalized to first-order dependent types (and Peano’s arithmetic) by Murthy in his thesis [56]. The following years, this extension of the formulas-as-types paradigm to classical logic has then studied by several researchers, for instance in [7, 69, 19, 41, 62] and many others since. It is thus tempting to revisit Landin’s work in the light of the formulas-as-types interpretation of control. Indeed, it is notoriously difficult to derive a sound program logic for an imperative language with procedures and non-local jumps [60], especially in the presence of local variables and higher-order procedures [73]. On the other hand, adding first-order dependent types to such an imperative language, and translating type derivations into proof derivations appears more tractable. The difficult to obtain program logic is then mechanically derived. Moreover, this logic permits by construction to deal elegantly with mutable higher- order procedural variables. As a stepping stone, we focus in this paper on Peano’s arithmetic. The corresponding functional language (through the proofs-as-programs paradigm) is thus an extension of Gödel System T [30] with control opera- tors as described in [56]. We shall use instead a variant which was proposed by Leivant [48, 49] (and redis- covered independently by Krivine and Parigot in the second-order framework [42]). The main advantage of this variant is that it requires no encoding in formulas (with Gödel numbers) to reason about functional pro- grams. Moreover it can be extended to any other algebraic datatypes (such as lists or trees). In this paper, the control operators are given an indirect semantics through a call-by-value CPS transform (we do not con- sider any direct style semantics). As noticed in [56], this CPS transformation operates a variant of Kuroda’s translation on dependent types [43]. The imperative counterpart of Gödel System T [30] (called Loopω) which was defined by the authors in [15], is essentially an extension of Meyer and Ritchie’s Loop language [51] with higher-order procedural vari- ables. Loopω is a genuine imperative language as opposed to functional languages with imperative features. However, Loopω is a “pure” imperative language: side-effects and aliasing are forbidden. These restrictions
- Email addresses: crolard@u-pec.fr (T. Crolard), polonowski@u-pec.fr (E. Polonowski) 1 enable simple location-free operational semantics [20]. Moreover, the type system relies on the distinction between mutable and read-only variables to prevent procedure bodies to refer to non-local mutable variables. This property is crucial to guarantee that fix-points cannot be encoded using procedural varia
This content is AI-processed based on ArXiv data.