## Extending the Loop Language with Higher-Order Procedural Variables (2007)

Citations: | 9 - 6 self |

### BibTeX

@MISC{Crolard07extendingthe,

author = {T. Crolard and E. Polonowski and P. Valarcher},

title = {Extending the Loop Language with Higher-Order Procedural Variables},

year = {2007}

}

### OpenURL

### Abstract

We extend Meyer and Ritchie’s Loop language with higher-order procedures and procedural variables and we show that the resulting programming language (called Loop ω) is a natural imperative counterpart of Gödel System T. The argument is two-fold: 1. we define a translation of the Loop ω language into System T and we prove that this translation actually provides a lock-step simulation, 2. using a converse translation, we show that Loop ω is expressive enough to encode any term of System T. Moreover, we define the “iteration rank ” of a Loop ω program, which corresponds to the classical notion of “recursion rank ” in System T, and we show that both translations preserve ranks. Two applications of these results in the area of implicit complexity are described. 1

### Citations

1286 | A structural approach to operational semantics
- Plotkin
- 1981
(Show Context)
Citation Context ...rational semantics of Loop ω is presented first as a natural semantics (also called “big-step” semantics) in the style of [Kahn 1987]. Then a transition semantics (also called “small-step” semantics [=-=Plotkin 1981-=-]) tailored of the lock-step simulation and which refines the natural semantics is defined. The simulation theorem states that each evaluation step of a Loop ω program (according to the transition sem... |

733 | Notions of Computation and Monads
- Moggi
- 1991
(Show Context)
Citation Context ...achey tradition [Stoy 1977]. The idea of translating an imperative program into a functional one actually goes back to [McCarthy 1960]. However, our translation is somewhat closer to the state monad [=-=Moggi 1991-=-; Wadler 1990] used to encode a mutable state (or references) in a pure functional language. Although this encoding is usually global and thus changes the type of all terms, a local encoding can be ob... |

458 | Comprehending Monads
- Wadler
- 1990
(Show Context)
Citation Context ...ion [Stoy 1977]. The idea of translating an imperative program into a functional one actually goes back to [McCarthy 1960]. However, our translation is somewhat closer to the state monad [Moggi 1991; =-=Wadler 1990-=-] used to encode a mutable state (or references) in a pure functional language. Although this encoding is usually global and thus changes the type of all terms, a local encoding can be obtained if an ... |

345 | Recursive functions of symbolic expressions and their computation by machine
- McCarthy
- 1960
(Show Context)
Citation Context ...ics for an imperative language using a λ-calculus and thus follows the Scott-Strachey tradition [Stoy 1977]. The idea of translating an imperative program into a functional one actually goes back to [=-=McCarthy 1960-=-]. However, our translation is somewhat closer to the state monad [Moggi 1991; Wadler 1990] used to encode a mutable state (or references) in a pure functional language. Although this encoding is usua... |

330 |
The mechanical evaluation of expressions
- Landin
- 1964
(Show Context)
Citation Context ...sial features known to complicate the semantics). Moreover the type system forbids the well-known back-patching technique which exploits procedural variables to define arbitrary recursive procedures [=-=Landin 1964-=-] (and Loop ω is thus a “total” programming language as advocated in [Turner 2004]). As a consequence of these choices, both semantics presented in this paper are simple but rather unusual for imperat... |

302 | Natural semantics
- Kahn
- 1987
(Show Context)
Citation Context ...e language follows mostly the principles advocated in [Schmidt 1994]. The operational semantics of Loop ω is presented first as a natural semantics (also called “big-step” semantics) in the style of [=-=Kahn 1987-=-]. Then a transition semantics (also called “small-step” semantics [Plotkin 1981]) tailored of the lock-step simulation and which refines the natural semantics is defined. The simulation theorem state... |

220 | Revised5 report on the algorithmic language Scheme
- Kelsey, Clinger, et al.
- 1998
(Show Context)
Citation Context ...ch takes advantage of higher-order mutable variables (or function pointers) to define arbitrary recursive functions. This technique is used for instance in Scheme’s semantics of the letrec construct [=-=Kelsey et al. 1998-=-]. Here is such a definition of a fix-point in the Loop ω syntax, where fix : proc (out int) is a mutable variable, but this command is not typable in Loop ω (since fix occurs in the body of f): { }fi... |

160 |
The essence of Algol
- Reynolds
- 1981
(Show Context)
Citation Context ...s · 7 However, for our purpose, a location-free semantics is sufficient. A discussion on this subject can be found in [Plotkin 1981] p. 70 (see also [Felleisen and Friedman 1987], [Donahue 1977] and [=-=Reynolds 1981-=-]). 3.1 Syntax The syntax of imperative types and phrase types is the following: σ, τ ::= int | proc (in �τ; out �σ) T ::= τ | comm | seq Note that we consider only two formal parameter modes in and o... |

150 | The type and effect discipline
- Talpin, Jouvelot
- 1994
(Show Context)
Citation Context ...tational Logic, Vol. V, No. N, October 2007.s8 · T. Crolard, E. Polonowski and P. Valarcher 3.2 Type system The type system of Loop ω may be seen as a simple effect system [Gifford and Lucassen 1986; =-=Talpin and Jouvelot 1994-=-] since it is able to guarantee the absence of side-effects, aliasing and fix-points in well-typed programs. Its main feature is the distinction between mutable variables and read-only variables. More... |

145 |
Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes
- Gödel
- 1958
(Show Context)
Citation Context ...itive recursion at all types. This calculus (called System T) was first introduced by Gödel in its prooftheoretic study of Peano arithmetic (see its Dialectica paper on the consistency of arithmetic [=-=Gödel 1958-=-], reproduced with English translation in [Gödel 1990]). Moreover, System T is well suited to give a formal semantics to constructs found in (higher-order) programming languages [Girard et al. 1989]. ... |

131 |
Syntactic control of interference
- Reynolds
- 1978
(Show Context)
Citation Context ...earn and Tennent 1997]) and this work has influenced the design of most modern programming languages. For instance, the Loop ω language is very close in spirit to the language partially described in [=-=Reynolds 1978-=-] whose purpose was in particular to show that it is possible to avoid aliasing while retaining Algol-like higher-order procedures. More generally, our work can also be seen as providing a denotationa... |

131 | Modern Compiler Implementation in ML - Appel - 1998 |

130 | Representing monads
- Filinski
- 1994
(Show Context)
Citation Context ...ffects can still be simulated in most cases by passing the non-local variable as an explicit in out parameter. This simulation is often referred to as the “state-passing transform” (see for instance [=-=Filinski 1994-=-] and [Wadler 1990]). Remark 3.5. (no fix-points). Rule (t.proc) also forbids the reading of nonlocal mutable variables: this is necessary to prevents the definition of fix-points in the language. Ind... |

99 |
Proof Theory
- Schütte
- 1977
(Show Context)
Citation Context ...ural numbers that are definable in this system correspond exactly to functions that are provably total in first-order Peano arithmetic (see also the survey [Avigad and Feferman 1998] or the textbook [=-=Schütte 1967-=-]). More precisely, that there is a syntactic hierarchy of fragments Tn of System T such that the class of functions representable in Tn is identical to the class of functions provably recursive in th... |

94 |
Computability and Complexity from a Programming Perspective
- Jones
- 1997
(Show Context)
Citation Context ...erification (no simulation is defined). Finally, compiling one programming language into another in order to derive complexity properties is a common approach. The reader is referred for instance to [=-=Jones 1997-=-] for various applications of this technique. Plan of the paper. In Section 2, we present our variant of Gödel System T. In Section 3, we describe the Loop ω language (syntax, type system and semantic... |

92 | The Marriage of Effects and Monads
- Wadler
- 1998
(Show Context)
Citation Context ...coding can be obtained if an effect system [Gifford and Lucassen 1986] is used for the source language (instead of a conventional type system). A simulation based on such an encoding is described in [=-=Wadler 1998-=-]. Similarly, in [Filliâtre 2003], the author defines a monadic translation of simplytyped functional programs with references (annotated with Floyd-Hoare assertions) into a type theory. Their transla... |

85 |
Integrating functional and imperative programming
- Gifford, Lucassen
- 1986
(Show Context)
Citation Context ...e a mutable state (or references) in a pure functional language. Although this encoding is usually global and thus changes the type of all terms, a local encoding can be obtained if an effect system [=-=Gifford and Lucassen 1986-=-] is used for the source language (instead of a conventional type system). A simulation based on such an encoding is described in [Wadler 1998]. Similarly, in [Filliâtre 2003], the author defines a mo... |

76 |
Theories of Programming Languages
- Reynolds
- 1998
(Show Context)
Citation Context ...antics, this technique is not widespread in transition semantics. The ingenious idea consisting in updating a local variable directly in the source (in rule s.var-ii) is attributed to Eugene Fink in [=-=Reynolds 1998-=-] p. 130. This technique is however well-known in functional language semantics [Felleisen and Friedman 1987]. ACM Transactions on Computational Logic, Vol. V, No. N, October 2007.sExtending the Loop ... |

69 | Gödel’s functional (“Dialectica”) interpretation
- Avigad, Feferman
- 1998
(Show Context)
Citation Context ...isel 1951] states that functions on the natural numbers that are definable in this system correspond exactly to functions that are provably total in first-order Peano arithmetic (see also the survey [=-=Avigad and Feferman 1998-=-] or the textbook [Schütte 1967]). More precisely, that there is a syntactic hierarchy of fragments Tn of System T such that the class of functions representable in Tn is identical to the class of fun... |

62 | Multi-prover Verification of C Programs - Filliâtre, Marché - 2004 |

52 | Verification of non-functional programs using interpretations in type theory - Filliâtre - 2003 |

47 |
Recursive Functions
- Peter
- 1967
(Show Context)
Citation Context ...of terms with recursion rank less or equal to n. 2.1 Example: the Ackermann function Our running example in this paper is the Ackermann function. This function is known not to be primitive recursive [=-=Peter 1968-=-] but it can be represented in System T, for instance as follows: ack(m, n) = (rec(m, λy.succ(y), λh.λi.λy.rec(y, (h S(0)), λk.λj.(h k))) n) ACM Transactions on Computational Logic, Vol. V, No. N, Oct... |

43 |
The structure of Typed Programming Languages
- Schmidt
- 1994
(Show Context)
Citation Context ... also intensionally. In order to develop this point, we need to give some details about the formal semantics of Loop ω . The overall design of the language follows mostly the principles advocated in [=-=Schmidt 1994-=-]. The operational semantics of Loop ω is presented first as a natural semantics (also called “big-step” semantics) in the style of [Kahn 1987]. Then a transition semantics (also called “small-step” s... |

40 | The complexity of loop programs - Meyer, Ritchie - 1976 |

35 |
Theories of Computational Complexity
- Calude
- 1988
(Show Context)
Citation Context ...op programs compute exactly the class of primitive recursive functions. The Loop language has since been widely studied in the literature (see for instance the textbooks [Davis and Weyuker 1983] and [=-=Calude 1988-=-]). Authors address: Laboratoire d’Algorithmique, Complexité et Logique – Université Paris Est – Université Paris 12 Val de Marne – 61, av. du Général de Gaulle – 94010 Créteil Cedex, France. Permissi... |

29 | Total Functional Programming
- Turner
- 2004
(Show Context)
Citation Context ...s the well-known back-patching technique which exploits procedural variables to define arbitrary recursive procedures [Landin 1964] (and Loop ω is thus a “total” programming language as advocated in [=-=Turner 2004-=-]). As a consequence of these choices, both semantics presented in this paper are simple but rather unusual for imperative languages: they are both location-free semantics (see [Donahue 1977], [Plotki... |

26 |
On the interpretation of non-finitist proofs, part I
- Kreisel
- 1951
(Show Context)
Citation Context ...ositional) and type-preserving, we can be even more specific about the correspondence between a functional program and its imperative counterpart. Recall that a major result concerning System T from [=-=Kreisel 1951-=-] states that functions on the natural numbers that are definable in this system correspond exactly to functions that are provably total in first-order Peano arithmetic (see also the survey [Avigad an... |

24 |
A calculus for assignments in higher-order languages
- Felleisen, Friedman
- 1987
(Show Context)
Citation Context ...equence of these choices, both semantics presented in this paper are simple but rather unusual for imperative languages: they are both location-free semantics (see [Donahue 1977], [Plotkin 1981] and [=-=Felleisen and Friedman 1987-=-]) and they rely crucially on the distinction between mutable and read-only (immutable) variables. The second result is obtained by defining a converse translation (from System T into Loop ω ) and pro... |

24 |
The Definition of Standard ML, Revised edition
- Milner, Tofte, et al.
- 1997
(Show Context)
Citation Context ...nt) { h(1, p); for j := 1 to y { h(p; p); }p; }p; g := aux; }g; g(n, r); }r; By applying translation ( ) ⋆ , we obtain the following anonymous function. For clarity, we use Standard ML derived forms [=-=Milner et al. 1997-=-] for declaring several functions (keyword fun) and values (keyword val) within a unique let. fn (m: int, n: int) ⇒ let fun next(y: int) = let val p = y val p = succ(p) in p end val g = next val g = r... |

22 | E.: "Computability, Complexity and Languages - Davis - 1983 |

21 |
About primitive recursive algorithms
- Colson
- 1991
(Show Context)
Citation Context ...ers n,m with time-complexity O(min(n, m)). APPENDIX A. ULTIMATE OBSTINACY In this appendix, we show that (non-trivial) terms of System T are “ultimately obstinate” (this terminology is borrowed from [=-=Colson 1991-=-]) even in the presence a one-step predecessor operation and product types. However, since the techniques developed in [Colson and Fredholm 1998] do not seem to generalize easily to this case, we pres... |

18 | Algol-like Languages - O’Hearn, Tennent - 1997 |

11 |
System T, call-by-value and the minimum problem
- Colson, Fredholm
- 1998
(Show Context)
Citation Context ...lar, we obtain that any Loop ω program in which any bound of loop is a read-only input variable is elementary. A second application is intensional and is related to the so-called minimum problem. In [=-=Colson and Fredholm 1998-=-], the authors proved that in call-by-value System T, any algorithm which computes a non-trivial binary function (where trivial means constant or projection plus constant), has a time-complexity which... |

7 |
Locations considered unnecessary
- Donahue
- 1977
(Show Context)
Citation Context ...ocated in [Turner 2004]). As a consequence of these choices, both semantics presented in this paper are simple but rather unusual for imperative languages: they are both location-free semantics (see [=-=Donahue 1977-=-], [Plotkin 1981] and [Felleisen and Friedman 1987]) and they rely crucially on the distinction between mutable and read-only (immutable) variables. The second result is obtained by defining a convers... |

7 | Thunks and the lambda-calculus
- Hatcliff, Danvy
- 1997
(Show Context)
Citation Context ..., λx.λy.t) be the next redex to contract. In fact, one can easily show that call-by-name evaluation can be simulated under call-by-value evaluation using this rule and the usual thunk-based encoding [=-=Hatcliff and Danvy 1997-=-]. Note that [Colson and Fredholm 1998] do not consider product types nor a predecessor operation. However, as a direct corollary of this theorem and the lock-step simulation, we can still obtain: Cor... |

5 | Characterizing the elementary recursive functions by a fragment of Gödel’s T. Archive for Mathematical Logic - Beckmann, Weiermann - 2000 |

4 | On the Expressive Power of the Loop Language - Crolard, Lacas, et al. - 2006 |

4 | Parameter-induced aliasing in Ada - Gellerich, Plodereder - 2001 |

4 |
Denotational Semantics of Programming Languages: The Scott-Strachey Approach to Programming Language Theory
- Stoy
- 1977
(Show Context)
Citation Context ...e higher-order procedures. More generally, our work can also be seen as providing a denotational semantics for an imperative language using a λ-calculus and thus follows the Scott-Strachey tradition [=-=Stoy 1977-=-]. The idea of translating an imperative program into a functional one actually goes back to [McCarthy 1960]. However, our translation is somewhat closer to the state monad [Moggi 1991; Wadler 1990] u... |

2 |
The Programming Language Ada. Reference Manual
- DOD
- 1980
(Show Context)
Citation Context ...ax of imperative types and phrase types is the following: σ, τ ::= int | proc (in �τ; out �σ) T ::= τ | comm | seq Note that we consider only two formal parameter modes in and out (borrowed from Ada [=-=DOD 1980-=-]) which specify “abstractly” the direction of data flow between caller and callee (without implying a specific parameter-passing mechanism). The raw syntax of imperative programs is given below. Ther... |

2 | C♯ language specification ISO/IEC - ISO - 2003 |

1 |
Extending the Loop Language with Higher-Order Procedural Variables · 35
- Appel
- 1998
(Show Context)
Citation Context ... out �σ)) = proc (in �y : �τ; out z : �σ){}�z Lemma 3.11. The typing judgment ∅; ∅ ⊢ ɛ(σ) : σ is derivable. Remark 3.12. Default values could be dispensed with using standard data-flow analysis (see [=-=Appel 1998-=-] for instance). This technique (also called liveness analysis) allows to determine whether there is a potential execution path on which a variable is used before it has been assigned an initial value... |

1 | The complexity of loop programs - Crolard, Polonowski, et al. - 1976 |