Hostname: page-component-6766d58669-6mz5d Total loading time: 0 Render date: 2026-05-15T20:04:33.694Z Has data issue: false hasContentIssue false

Read/write factorizable programs

Published online by Cambridge University Press:  08 June 2023

SIDDHARTH BHASKAR
Affiliation:
University of Copenhagen, Copenhagen, Denmark (e-mail: bhask2sk@jmu.edu)
JAKOB GRUE SIMONSEN
Affiliation:
University of Copenhagen, Copenhagen, Denmark (e-mail: simonsen@di.ku.dk)
Rights & Permissions [Opens in a new window]

Abstract

In the cons-free programming paradigm, we eschew constructors and program using only destructors. Cons-free programs in a simple first-order language with string data capture exactly P, the class of polynomial-time relations. By varying the underlying language and considering other data types, we can capture several other complexity classes. However, no cons-free programming language captures any functional complexity class for fundamental reasons. In this paper, we cleanly extend the cons-free paradigm to encompass functional complexity classes. Namely, we introduce programs with data that can either only be destructed or only be constructed, which we enforce by a type system on the program variables. We call the resulting programs read/write- (or RW-)factorizable, show that RW-factorizable string programs capture exactly the class FP of polynomial-time functions, and that tail-recursive RW-factorizable programs capture exactly the class FL of logarithmic-space functions. Finally, we state and solve the nontrivial problem of syntactic composition of two RW-factorizable programs.

Information

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2023. Published by Cambridge University Press
Figure 0

Fig 1. RW-terms. Letters $\alpha$, $\beta$, and each $\alpha_i$ range over product types and each $\tau_i$ ranges over the atomic types 2 and R.

Figure 1

Fig. 2. Program Semantics. In the bottom two rules, $\mathtt{f}(\mathtt{x}) = T^\mathtt{f}$ or $\mathtt{f}(\mathtt{x},\mathtt{w}) = T^\mathtt{f}$ is the recursive definition of $\mathtt{f}$ in p. Also, w ranges over values of type W; r and r’ range over values of type R; b ranges over values of type 2; the $a_i$ range over values of type 2 and R; v, v’, $v_i$ range over values of any product type; and u ranges over values of any type. The value $v_0 \circ \dots \circ v_{n-1}$ denotes concatenation of the constituent tuples. For example if $v_0 = (a_0,a_1)$ and $v_1 = (a_2,a_3,a_4)$ then $v_0 \circ v_1 = (a_0, a_1, a_2, a_3, a_4)$. In general we will not carefully maintain this correspondence between variable names and their types.

Figure 2

Table 1. A correspondence between languages in the present paper on the left and Jones (1999) on the right. A bit-length program is C-free if it contains no counting modules

Figure 3

Fig 3. Bit/length terms. Here $\alpha$ ranges over product types and $\tau$ over atomic types.

Figure 4

Fig 4. Semantics for bit-length programs. Dependence of $\vdash$ on x, n, and $\rho$ is suppressed for legibility. $\mathtt{f}(\mathtt{x}^\mathtt{f}) = T^\mathtt{f}$ is the recursive definition of $\mathtt{f}$ in p and $x_i$ is the i-th bit of $x = x_{|x|} \dots x_1$. Variables c and d range over C(n), i ranges over I(x), the $a_i$ range over values in any atomic type, and v, v’ and the $v_i$ range over values of any type. In general we will not carefully maintain this correspondence between variables and their types. As in RW-factorizable programs, note that while we can form larger tuples from smaller proper tuples, we can only decompose tuples into atomic types.

Submit a response

Discussions

No Discussions have been published for this article.