In this paper
AbstractIntroductionNormal form and the interval recurrenceThe block circuitDiagonal wordsProper intermediate blocksCompleting a cross-block wordHeight of the circuitSpace-efficient uniform evaluationRelation to earlier workReferencesWorksComputer Science
Sublinear-space recognition for Boolean grammars
Abstract
For every fixed Boolean grammar in the standard language family considered by Okhotin, we give a deterministic membership algorithm using working space on an input of length . In particular, the whole family is contained in , answering Okhotin's Problem 4 affirmatively. The construction partitions substring endpoints into blocks of size . It represents the parsing recurrence by a constant-fan-in circuit with -bit values and dependency height . Splits in the endpoint blocks are resolved locally, and an ordering of the remaining splits controls the height even when a split is highly unbalanced. Applying the Cook–Mertz tree-evaluation algorithm to the implicitly unfolded circuit gives the space bound.
Introduction
Boolean grammars extend context-free grammars by allowing conjunction and negation in production rules [1]. Their standard recognition algorithms exploit the dependence of a substring’s syntactic properties on properties of its proper substrings. In his 2007 list of open problems, Okhotin asked whether the entire family of Boolean languages is contained in DSPACE for some constant [2 Section 3.4, Problem 4]. The question concerns working space, permits a different recognizer for each fixed grammar, and allows a tradeoff in time.
Theorem 1.1. Let be a fixed Boolean grammar in the standard family of [2]. There is a deterministic algorithm deciding membership in , with read-only access to its input, using
bits of working space on every input of length .
Corollary 1.2. The family of Boolean languages is contained in DSPACE. More generally, it is contained in DSPACE for every fixed .
All constants implicit in may depend on . The proof uses the normal-form substring recurrence together with Cook–Mertz tree evaluation [5]. Williams’s expanded author version [6 Theorem 2.2 and Appendix A] makes explicit the variable-height trees and implicit access used here. The contribution is a block circuit for the grammar recurrence whose value length and dependency height can be balanced.
Normal form and the interval recurrence
We use the standard Boolean-language family of [2 Definitions 6 and 7]. In that presentation, the semantics are defined through strongly unique solutions of the associated language equations. A grammar in this family admits an equivalent binary normal form [1, 3]. Its nonterminal set and terminal alphabet are finite, and its rules have the forms
There may also be a rule , with the start symbol absent from all right-hand sides. Membership of the empty word is handled separately. The condition in (1) is automatic on nonempty substrings.
Fix an input , where . For and $0 \le i < j \le n$, define
Let consist of the ordered nonterminal pairs that occur in positive or negative binary conjuncts. For each , put
For , there is a fixed Boolean function such that
Explicitly, disjoins the alternatives for , conjoining positive pair flags and complemented negative pair flags within each alternative. For , the value is determined by the terminal rules.
Equations (2) and (3) are the usual binary-normal-form recognition recurrence [3 Section 2, pp. 4–5]. Every interval used on the right of (2) is strictly shorter. In particular, the negation in (3) is applied after the complete disjunction over splits has been computed.
The block circuit
Choose an integer and partition the endpoint set into consecutive blocks
each of size at most , with all but the last of size . For $0 \le r \le s < m$, a chart word encodes
Fix a coordinate order and use zero padding so that every value in the circuit has the same bit length
where the fixed positive integer is large enough for either a chart word or a word with one flag for each . Padding coordinates are ignored by each gate function.
Diagonal words
For each , is a leaf whose value can be generated on demand. Compute all intervals with endpoints in in increasing length, using (2) and (3). Every smaller interval needed remains in the same block. Store the partial chart and a constant number of flags. The resulting space requirement is
A terminal query uses a logarithmic-size position counter and a scan of the read-only input.
Proper intermediate blocks
For , let be a gate with inputs and . Its output coordinate is
Every such is an eligible split because the blocks are consecutive and . Both input chart words have strictly smaller block span than . The output is computed by loops over the designated coordinates and split positions, in the space (4).
To aggregate these products, fix , put , and list the interior indices as in increasing order of , breaking ties by increasing . Let be the zero word and define
where acts componentwise. The aggregate is . For , this is the zero leaf, since there are no proper intermediate blocks.
Completing a cross-block word
The gate for , where , takes the three inputs
It fills its output coordinates in increasing interval length. For a cell and each , start with the aggregate flag and include by OR exactly those splits with and .
If , then is in the supplied diagonal word, and is an already computed cell of the current output. If , then is an already computed output cell, and is in the other diagonal word. In both cases the output cell used has strictly smaller interval length. Once all pair flags for have been accumulated, apply (2.3). A length-one cell is filled from the terminal rules, including when its endpoints lie in adjacent blocks.
This is a total Boolean function of its three input words. Even when the inputs are arbitrary bit strings, the local computation has no circular dependency. The output chart, temporary flags, and loop counters fit in (3.1). To obtain length order, one may loop through all global lengths and inspect the cells with endpoints in . Only space is being bounded.
Lemma 3.1. The circuit is acyclic and computes all chart words correctly. Every gate has fan-in at most three and is evaluable on arbitrary Boolean arguments in the space (3.1).
Proof. Product gates use chart words of smaller block span. At a fixed span, the aggregate gates form the finite chain (3.3). The cross-block gate uses that aggregate and two diagonal words. These observations give acyclicity.
Induct on the block span. The diagonal case is the ordinary recurrence. For a cross-block word, induct also on interval length within the word. The possible split positions partition into the left endpoint block, the proper intermediate blocks, and the right endpoint block. The product and aggregate gates compute exactly the intermediate contribution. The local procedure supplies exactly the two endpoint contributions using known shorter cells. Thus the pair flags agree with (2.2), and (2.3) gives the correct membership bits. The descriptions of the gates give the fan-in and space bounds.
Height of the circuit
Height counts edges on a path from a gate toward a leaf.
Lemma 3.2. Every path from to a leaf has length at most . The circuit required for the membership bit has height .
Proof. The diagonal words are leaves. Suppose . Consider a path that leaves through the aggregate and reaches . Put
There are at most two interior blocks at each distance from the nearer endpoint. The prescribed ordering therefore gives . The path to either input chart word of the product uses edges. Since ,
Either input chart word has block span at most . By induction, the remainder of the path has length at most , so the total is at most . The route from to the aggregate zero leaf has length , and its direct routes to diagonal leaves have length one. These exhaust the possibilities and complete the induction. An additional constant-fan-in gate can move the desired bit into the first coordinate of the output, increasing the height by only a constant. □
Space-efficient uniform evaluation
We use the following established evaluation bound. For a tree with -bit node values, maximum height , and fan-in at most three, Cook–Mertz evaluation uses
bits [5 Theorem 7]. The bound applies to variable-height trees and smaller arities, as described in the expanded author version of [6 Theorem 2.2 and Appendix A].
Here the tree is represented implicitly by unfolding the circuit backward from the output. Multiple occurrences of a circuit gate are treated as separate tree nodes. This preserves the output and the height bound.
Lemma 4.1. The unfolded block circuit can be evaluated in deterministic working space
Proof. We verify the access operations needed by the evaluator. A circuit gate name consists of its type and a constant number of block indices or aggregation ranks. It requires bits. Given a gate name and a child choice, the child name is computable in the same space. In particular, the rank- interior index can be found by enumerating distances from the nearer endpoint and emitting the two corresponding indices in increasing order, with a coincident midpoint emitted once.
The evaluator stores a tree node as its sequence of child choices from the root. To recover the associated circuit gate, replay that sequence from the output, keeping only the current gate name and a position counter. This uses additional bits beyond the stored path.
We give explicit parameters for the packed interpolation in [6 Appendix A]. Set and supply zero-valued dummy leaves at gates of smaller arity, with those arguments ignored. Let be a field of characteristic two and choose
Using the polynomial-basis representation of , let be the subset whose last binary coordinates are zero. Thus , and an element of encodes bits. Extend each gate to words of bits by ignoring the extra input bits and zeroing the extra output bits. Its -th output block defines a total function , for .
For , define the Lagrange polynomial
All denominators are nonzero. An extension of the output-block function is
It agrees with on , and its total degree is at most
This is the degree condition needed in the Cook–Mertz averaging step. Indeed, for any of total degree less than ,
To check the identity, expand in . The positive powers have zero sum over , and the constant term is repeated an odd number of times in characteristic two. Thus this choice of and extension supports the same packed evaluation procedure.
Each of the shared registers holds field elements and occupies bits. A recursion frame stores a counter over field elements, a child choice, and a constant-size program counter in bits. Field arithmetic can be implemented in space [5 Proposition 2]. A polynomial representation and a primitive element can also be found by enumeration within this space. In particular, the interpolation parameters do not require storing a table of field elements.
To compute (8), enumerate , store one tuple in bits, and accumulate its interpolation weight by looping over and . Decode the tuple, evaluate the named Boolean gate, and extract its -th block. Lemma 3.1 bounds this gate computation by scratch bits even on arbitrary decoded inputs. All remaining arithmetic uses scratch bits. Leaf words obey the same bound by (4).
These local queries make no recursive calls to other tree nodes. Their scratch is reused and cleared before each recursive call of the evaluator, while the shared registers and the recursion stack are preserved. Consequently it contributes only one additive term to (7), establishing the lemma. □
Proof of Theorem 1.1. Lemmas 3.2 and 4.1, together with , give working space
Choose
This integer can be computed using logarithmic working space, for example by testing successive integer cubes against the displayed integer target. Substitution into (9) gives for all sufficiently large . The finitely many remaining lengths and the empty word are handled in finite control. The root bit decides membership. □
Proof of Corollary 1.2. For each fixed ,
Apply Theorem 1.1. Taking gives the stated common exponent. □
Relation to earlier work
The binary normal form and the interval recurrence are established parts of Boolean-grammar theory [1, 3]. The known deterministic linear-space recognition bound is discussed in [2, 4]. The proposed improvement uses a different organization of the recurrence, with local completion of the endpoint blocks and a distance-ordered aggregation of the intermediate blocks.
Grandjean, Grénte, and Terrier characterize Boolean languages by SCYK automata [7] and give corresponding characterizations for conjunctive and context-free subclasses. This supplies a parallel view of the substring recurrence. The result here instead organizes that recurrence into bounded endpoint blocks and controls the dependency height of their aggregation in order to obtain the sequential working-space bound of Theorem 1.1.
The evaluator itself is due to Cook and Mertz [5]. The proof uses the implicit-tree implementation explained by Williams [6]. No new tree-evaluation theorem is needed.
Email address: [email protected]
Email address: [email protected]
Email address: [email protected]
Email address: [email protected]
References
- [1]A. Okhotin, Boolean grammars, Information and Computation 194 (2004), no. 1, 19–48. doi:10.1016/j.ic.2004.03.006.DOI
- [2]A. Okhotin, Nine open problems on conjunctive and Boolean grammars, Bulletin of the EATCS 91 (2007), 96–119. Publisher PDF.
- [3]A. Okhotin and C. Reitwießner, Parsing unary Boolean grammars using online convolution, Dagstuhl Seminar Proceedings 10501 (2011), 1–11. doi:10.4230/DagSemProc.10501.3.DOI
- [4]M. Barash and A. Okhotin, Linear-space recognition for grammars with contexts, Theoretical Computer Science 719 (2018), 73–85. doi:10.1016/j.tcs.2017.11.006.DOI
- [5]J. Cook and I. Mertz, Tree evaluation is in space O(log n · log log n), Proceedings of the 56th Annual ACM Symposium on Theory of Computing (STOC 2024), 1268–1278. doi:10.1145/3618260.3649664.DOI
- [6]R. R. Williams, Simulating time with square-root space, Proceedings of the 57th Annual ACM Symposium on Theory of Computing (STOC 2025), 13–23. doi:10.1145/3717823.3718225. Expanded author version, 25 February 2025, arXiv:2502.17779v1 (including Appendix A).DOI
- [7]É. Grandjean, T. Grente, and V. Terrier, Context-free, conjunctive and Boolean grammars and SCYK automata, in M.-P. Béal and P. Caron (eds.), Developments in Language Theory (DLT 2026), Lecture Notes in Computer Science 16578, Springer, 2026, 139–152. doi:10.1007/978-3-032-28404-4_11.DOI