## A Type System for Bounded Space and Functional in-Place Update (2000)

### Cached

### Download Links

- [www.dcs.ed.ac.uk]
- [www.dcs.ed.ac.uk]
- [www.dcs.ed.ac.uk]
- [www.tcs.informatik.uni-muenchen.de]
- [www.dcs.ed.ac.uk]
- DBLP

### Other Repositories/Bibliography

Citations: | 91 - 15 self |

### BibTeX

@MISC{Hofmann00atype,

author = {Martin Hofmann},

title = {A Type System for Bounded Space and Functional in-Place Update},

year = {2000}

}

### Years of Citing Articles

### OpenURL

### Abstract

We show how linear typing can be used to obtain functional programs which modify heap-allocated data structures in place. We present this both as a "design pattern" for writing C-code in a functional style and as a compilation process from linearly typed first-order functional programs into malloc()-free C code. The main technical result is the correctness of this compilation. The crucial innovation over previous linear typing schemes consists of the introduction of a resource type # which controls the number of constructor symbols such as cons in recursive definitions and ensures linear space while restricting expressive power surprisingly little. While the space e#ciency brought about by the new typing scheme and the compilation into C can also be realised by with state-of-the-art optimising compilers for functional languages such as Ocaml [16], the present method provides guaranteed bounds on heap space which will be of use for applications such as languages for embedd...

### Citations

1163 | Proof-carrying code
- Necula
- 1997
(Show Context)
Citation Context ...ctional languages such as Ocaml [15], the present method provides guaranteed bounds on heap space which will be of use for applications such as languages for embedded systems or `proof carrying code' =-=[18]-=-. 1 Introduction In-place modification of heap-allocated data structures such as lists, trees, queues in an imperative language such as C is notoriously cumbersome, error prone, and di#cult to teach. ... |

667 | Linear logic
- Girard
- 1987
(Show Context)
Citation Context ...elf is very similar to the system described by the author in [9] which in turn was inspired by Caseiro's analysis of recursive equations [5] and bears some remote similarity with Bounded Linear Logic =-=[8]-=- Mention should also be made of Baker's Linear LISP [2, 3] which bears some similarity to our language. It does not contain the resource type # or a comparable feature, thus it is not clear how the si... |

293 | Region-based memory management
- Tofte, Talpin
- 1997
(Show Context)
Citation Context ...g linearly typed functional code directly into C seems to be new there exist a number of related approaches aimed at controlling the space usage of functional programs. Tofte-Talpin's region calculus =-=[19]-=- tries to minimise garbage collection by dividing the heap into a list of regions which are allocated and deallocated according to a stack discipline. A type systems ensures that the deallocation of a... |

290 | Computational interpretation of linear logic
- Abramsky
- 1990
(Show Context)
Citation Context ...andard one and no optimisation due to heap space reuse is taken into account. The relationship between linear types and garbage collection has been recognised as early as '87 by Lafont [14], see also =-=[10, 1, 21, 16]-=-. But again, due to the absence of #-types, these systems do not provide in place update but merely deallocate a linear argument immediately after its use. This e#ect, however, is already achieved by ... |

243 | Purely Functional Data Structures - Okasaki - 1998 |

135 | Syntactic control of interference - Reynolds - 1978 |

120 | Resource bound certification
- Crary, Weirich
- 2000
(Show Context)
Citation Context ...ile this system allows one to estimate the required heap and stack size it does not perform in place update either (and cannot due to the absence of linear types). In a similar vein Crary and Weirich =-=[7]-=- have given a type system which allows one to formalise and certify informal reasoning about time consumption of recursive programs involving lists and trees. Their language is a standard one and no o... |

94 |
The linear abstract machine
- Lafont
- 1988
(Show Context)
Citation Context ...anguage is a standard one and no optimisation due to heap space reuse is taken into account. The relationship between linear types and garbage collection has been recognised as early as '87 by Lafont =-=[14]-=-, see also [10, 1, 21, 16]. But again, due to the absence of #-types, these systems do not provide in place update but merely deallocate a linear argument immediately after its use. This e#ect, howeve... |

93 | Lively linear Lisp — ‘Look Ma, no garbage
- Baker
- 1992
(Show Context)
Citation Context ...or in [9] which in turn was inspired by Caseiro's analysis of recursive equations [5] and bears some remote similarity with Bounded Linear Logic [8] Mention should also be made of Baker's Linear LISP =-=[2, 3]-=- which bears some similarity to our language. It does not contain the resource type # or a comparable feature, thus it is not clear how the size of intermediate data structures is limited, cf. Remark ... |

93 |
Abstract Interpretation a d Optimising Transformation f rAp- plicative programs
- Mycroft
- 1981
(Show Context)
Citation Context ...rable feature, thus it is not clear how the size of intermediate data structures is limited, cf. Remark 31. Similar ideas, without explicit mention of linearity are also contained in Mycroft's thesis =-=[17]-=- Other related approaches are uniqueness types in Clean [4], linear ADTs and monads [11] which will be compared in the full paper. In a seminar talk in Edinburgh, John Reynolds has reported about ongo... |

83 | Recursion and Dynamic DataStructures in Bounded Space; Towards Embedded ML Programming
- Hughes, Pareto
- 1999
(Show Context)
Citation Context ...llocation operator). This will make our system useful in situations where space economy and guaranteed resource bounds are of the essence. Examples are programming languages for embedded systems (see =-=[12] for a sur-=-vey) or "proof-carrying code". In a nutshell the approach works as follows. The type # (dia t in the C examples) gets translated into a pointer type, say void * whose values point to heap sp... |

74 | Linear types and non-size-increasing polynomial time computation
- Hofmann
(Show Context)
Citation Context ...ee bounded heap size and obtain a simple C program realising it which can be run on any machine or system supporting C. The type system itself is very similar to the system described by the author in =-=[9]-=- which in turn was inspired by Caseiro's analysis of recursive equations [5] and bears some remote similarity with Bounded Linear Logic [8] Mention should also be made of Baker's Linear LISP [2, 3] wh... |

74 | A region inference algorithm
- Tofte, Birkedal
- 1998
(Show Context)
Citation Context ... regions which are allocated and deallocated according to a stack discipline. A type systems ensures that the deallocation of a region does not destroy data which is still needed; an inference system =-=[20]-=- generates the required annotations automatically for raw ML code. The di#erence to the present work is not so much the inference mechanism (see above) but the fact that even with regions the required... |

46 | Operational aspects of linear lambda calculus
- Lincoln, Mitchell
- 1992
(Show Context)
Citation Context ...andard one and no optimisation due to heap space reuse is taken into account. The relationship between linear types and garbage collection has been recognised as early as '87 by Lafont [14], see also =-=[10, 1, 21, 16]-=-. But again, due to the absence of #-types, these systems do not provide in place update but merely deallocate a linear argument immediately after its use. This e#ect, however, is already achieved by ... |

45 |
The Objective Caml system, documentation and user’s guide. INRIA
- Leroy
(Show Context)
Citation Context ...e. While the space e#ciency brought about by the new typing scheme and the compilation into C can also be realised by with state-of-the-art optimising compilers for functional languages such as Ocaml =-=[15]-=-, the present method provides guaranteed bounds on heap space which will be of use for applications such as languages for embedded systems or `proof carrying code' [18]. 1 Introduction In-place modifi... |

43 | Uniqueness typing for functional languages with graph rewriting semantics
- Barendsen, Smetsers
- 1996
(Show Context)
Citation Context ...iate data structures is limited, cf. Remark 31. Similar ideas, without explicit mention of linearity are also contained in Mycroft's thesis [17] Other related approaches are uniqueness types in Clean =-=[4]-=-, linear ADTs and monads [11] which will be compared in the full paper. In a seminar talk in Edinburgh, John Reynolds has reported about ongoing work on using linear types for in-place update. At the ... |

40 | Syntactic control of interference revisited - O’Hearn, Power, et al. - 1999 |

35 | Reference counting as a computational interpretation of linear logic
- Chirimar, Gunter, et al.
- 1996
(Show Context)
Citation Context ...mediately after its use. This e#ect, however, is already achieved by traditional reference counting which may be the reason why linear functional programming hasn't really got o# the ground, see also =-=[6]-=-. While the runtime advantages of the present approach might also be realised through reference counting (and indeed seem to be by the Ocamlopt compiler) the distinctive novelty lies in the fact that ... |

33 | A statically allocated parallel functional language - Mycroft, Sharp - 2000 |

27 | Operational interpretations of linear logic
- Turner, Wadler
- 1999
(Show Context)
Citation Context ...andard one and no optimisation due to heap space reuse is taken into account. The relationship between linear types and garbage collection has been recognised as early as '87 by Lafont [14], see also =-=[10, 1, 21, 16]-=-. But again, due to the absence of #-types, these systems do not provide in place update but merely deallocate a linear argument immediately after its use. This e#ect, however, is already achieved by ... |

19 |
Equations for Defining Poly-time Functions
- Caseiro
- 1997
(Show Context)
Citation Context ... run on any machine or system supporting C. The type system itself is very similar to the system described by the author in [9] which in turn was inspired by Caseiro's analysis of recursive equations =-=[5]-=- and bears some remote similarity with Bounded Linear Logic [8] Mention should also be made of Baker's Linear LISP [2, 3] which bears some similarity to our language. It does not contain the resource ... |

19 |
A linear functional language
- Holmström
- 1988
(Show Context)
Citation Context |

13 | Rolling your own mutable adt: A connection between linear types and monads
- Chen, Hudak
- 1997
(Show Context)
Citation Context ...ted, cf. Remark 31. Similar ideas, without explicit mention of linearity are also contained in Mycroft's thesis [17] Other related approaches are uniqueness types in Clean [4], linear ADTs and monads =-=[11]-=- which will be compared in the full paper. In a seminar talk in Edinburgh, John Reynolds has reported about ongoing work on using linear types for in-place update. At the time of writing there was no ... |

7 | A ’Linear Logic’ quicksort
- Baker
- 1994
(Show Context)
Citation Context ...or in [9] which in turn was inspired by Caseiro's analysis of recursive equations [5] and bears some remote similarity with Bounded Linear Logic [8] Mention should also be made of Baker's Linear LISP =-=[2, 3]-=- which bears some similarity to our language. It does not contain the resource type # or a comparable feature, thus it is not clear how the size of intermediate data structures is limited, cf. Remark ... |

7 | Linear-time simulation of deterministic two-way pushdown automata. Information Processing 71 - Cook - 1972 |

2 |
A book on C, third edition. Benjamin/Cummings
- Kelley, Pohl
- 1995
(Show Context)
Citation Context ...implement breadth first search). Then all the basic list code (list t, nil(), cons(), etc. ) will have to be rewritten (this problem could presumably also be overcome through the use of C++ templates =-=[13]-=-). Thirdly, a formalised language with linear type system will allow us to enforce the usage restrictions on which the correctness of the above code relies. Finally, this will open up the possibility ... |