# Balancing Straight-Line Programs

arXiv: https://arxiv.org/abs/1902.03568 · HTML: https://mlsanity.com/paper/1902.03568/

## Key facts

- Cited by 1 papers in the map (data through 24 Nov 2026).
- Submitted 10 Feb 2019.

## Built on by (most cited first, 1 of 1)

- [What's in a Tree ? Hierarchical n-gram models as controlled approximators of language](https://mlsanity.com/paper/2611.23093/) (2026)

## Abstract (arXiv)

It is shown that a context-free grammar of size m that produces a single string w (such a grammar is also called a string straight-line program) can be transformed in linear time into a context-free grammar for w of size O(m), whose unique derivation tree has depth O(log |w|). This solves an open problem in the area of grammar-based compression. Similar results are shown for two formalism for grammar-based tree compression: top dags and forest straight-line programs. These balancing results are all deduced from a single meta theorem stating that the depth of an algebraic circuit over an algebra with a certain finite base property can be reduced to O(log n) with the cost of a constant multiplicative size increase. Here, n refers to the size of the unfolding (or unravelling) of the circuit.
