APLAS 2004: Programming Languages and Systems pp 311-326

# A Functional Language for Logarithmic Space

• Peter Møller Neergaard
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3302)

## Abstract

More than being just a tool for expressing algorithms, a well-designed programming language allows the user to express her ideas efficiently. The design choices however effect the efficiency of the algorithms written in the languages. It is therefore important to understand how such choices effect the expressibility of programming languages.

The paper pursues the very low complexity programs by presenting a first-order function algebra BC$$^{\rm -}_{\epsilon}$$ that captures exactly lf, the functions computable in logarithmic space. This gives insights into the expressiveness of recursion.

The important technical features of BC$$^{\rm -}_{\epsilon}$$ are (1) a separation of variables into safe and normal variables where recursion can only be done over the latter; (2) linearity of the recursive call; and (3) recursion with a variable step length (course-of-value recursion). Unlike formulations of LF via Turing machines, BC$$^{\rm -}_{\epsilon}$$ makes no references to outside resource measures, e.g., the size of the memory used. This appears to be the first such characterization of LF-computable functions (not just predicates).

The proof that all BC$$^{\rm -}_{\epsilon}$$-programs can be evaluated in lf is of separate interest to programmers: it trades space for time and evaluates recursion with at most one recursive call without a call stack.

## Keywords

Turing Machine Complexity Class Recursive Call Normal Argument Logarithmic Space
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

## References

1. 1.
Barendregt, H.P.: The Lambda Calculus: Its Syntax and Semantics, revised edn. North-Holland, Amsterdam (1984)
2. 2.
Bellantoni, S., Cook, S.A.: A new recursion-theoretic characterization of the polytime functions. Computational Complexity 2, 97–110 (1992)
3. 3.
Bellantoni, S.J.: Predicative Recursion and Computational Complexity. Ph.D. thesis, University of Toronto, September 30 (1992)Google Scholar
4. 4.
Girard, J.-Y.: Light linear logic. Inform. & Comput. 143, 175–204 (1998)
5. 5.
Goerdt, A.: Characterizing complexity classes by higher type primitive recursive definitions. Theoret. Comput. Sci. 100(1), 45–66 (1992)
6. 6.
Hofmann, M.: Linear type and non-size-increasing polynomial time computation. In: Proc. 14th Ann. IEEE Symp. Logic in Comput. Sci. (July 1999)Google Scholar
7. 7.
Proc. Workshop on Implicit Computational Complexity (July 2002)Google Scholar
8. 8.
Immerman, N.: Languages that capture complexity classes. SIAM Journal of Computing 16(4), 760–778 (1987)
9. 9.
Jones, N.D.: The expressive power of higher-order types, or life without CONS. J. Funct. Programming 11(1), 55–94 (2001)
10. 10.
Kfoury, A.J., Mairson, H.G., Turbak, F.A., Wells, J.B.: Relating typability and expressibility in finite-rank intersection type systems. In: Proc. 1999 Int’l. Conf. Functional Programming, pp. 90–101. ACM Press, New York (1999)Google Scholar
11. 11.
Kristiansen, L.: New recursion-theoretic characterizations of well-knwon complexity classes. In: ICC 2002 Google Scholar
12. 12.
Milner, R., Tofte, M., Harper, R., MacQueen, D.B.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)Google Scholar
13. 13.
Møller Neergaard, P.: An example SML implemenation of a logspace linear bc evaluator (2003–2004)Google Scholar
14. 14.
Møller Neergaard, P.: Complexity Aspects of Programming Language Design—From Logspace to Elementary Time via Proofnets and Intersection Types. Ph.D. thesis, Brandeis University (October 2004)Google Scholar
15. 15.
Møller Neergaard, P., Mairson, H.G.: Types, potency, and impotency: Why nonlinearity and amnesia make a type system work. In: Proc. 9th Int’l. Conf. Functional Programming. ACM Press, New York (2004)Google Scholar
16. 16.
Murawski, A.S., Ong, C.-H.L.: Can safe recursion be interpreted in light logic? In: 2nd International Workshop on Implicit Computational Complexity (June 2000)Google Scholar
17. 17.
18. 18.
Paulson, L.C.: ML for the Working Programmer, 2nd edn. Cambridge University Press, Cambridge (1996)
19. 19.
Pippenger, N.: Pure versus impure lisp. In: Conf. Rec. POPL 1996: 23rd ACM Symp. Princ. of Prog. Langs., pp. 104–109 (1996)Google Scholar
20. 20.
Voda, P.J.: Two simple intrinsic characterizations of main complexity classes. In: ICC 2002 Google Scholar