---
title: Logarithmic Space Bounded Counting Classes
url: https://www.emergentmind.com/topics/logarithmic-space-bounded-counting-classes
type: topic
---

# Logarithmic Space Bounded Counting Classes

Logarithmic space bounded counting classes are complexity classes defined from \(O(\log n)\)-space bounded machines when computational power is measured by counting computation paths, by taking differences of accepting and rejecting paths, or by testing those quantities against predicates such as positivity, exact zero, or congruence conditions. In this regime, nondeterministic logspace, exact and modular counting, unbounded-error probabilistic computation, determinant-like algebraic problems, and several logical and quantum formalisms meet in a single landscape centered on \(\#L\), \(GapL\), \(PL\), and \(C_{=}L\) [2507.23563][1001.1960][2105.02681].

## 1. Basic classes and counting semantics

The standard starting point is \(NL\), the class of languages decided by nondeterministic \(O(\log n)\)-space Turing machines. From the same machine model one obtains the fundamental counting classes by recording, for an input \(x\), the number of accepting paths \(\mathrm{acc}_M(x)\) and rejecting paths \(\mathrm{rej}_M(x)\). The basic function class is \(\#L\), where \(f(x)=\mathrm{acc}_M(x)\) for some \(O(\log n)\)-space nondeterministic machine \(M\). The signed analogue is \(GapL\), where \(f(x)=\mathrm{acc}_M(x)-\mathrm{rej}_M(x)\). The principal language classes built from \(GapL\) are \(PL\), defined by positivity, and \(C_{=}L\), defined by exact zero [2507.23563][2310.11874].

A complementary presentation of \(PL\) uses unbounded-error probabilistic logspace. In that formulation, a language lies in \(PL\) if it is recognized by a logarithmic-space probabilistic Turing machine whose acceptance probability is \(> \tfrac12\) on yes-instances and \(< \tfrac12\) on no-instances, with no time restriction; the same source notes that allowing no time bound does not change the class [2105.02681].

Because an \(O(\log n)\)-space machine has only polynomially many configurations on inputs of length \(n\), the number of computation paths can still be exponential, and the monograph records the bound
\[
|f(x)|\le 2^{p(|x|)}
\]
for some polynomial \(p\) whenever \(f\in \#L\) or \(f\in GapL\) [2507.23563].

| Class | Defining object | Membership or value condition |
|---|---|---|
| \(NL\) | \(O(\log n)\)-space NTM | \(x\in L\) iff some path accepts |
| \(\#L\) | \(O(\log n)\)-space NTM \(M\) | \(f(x)=\mathrm{acc}_M(x)\) |
| \(GapL\) | \(O(\log n)\)-space NTM \(M\) | \(f(x)=\mathrm{acc}_M(x)-\mathrm{rej}_M(x)\) |
| \(PL\) | \(GapL\) function \(f\); also unbounded-error PTM | \(x\in L \iff f(x)>0\), or acceptance probability crosses \(\tfrac12\) |
| \(C_{=}L\) | \(GapL\) function \(f\) | \(x\in L \iff f(x)=0\) |
| \(Mod_kL\) | \(\#L\) function \(f\) | \(x\in L \iff f(x)\not\equiv 0 \pmod{k}\) |

The broader family also includes unambiguous and modular variants. The monograph defines \(UL\) via a uniqueness-style \(\#L\) condition, and defines \(Mod_kL\) by nonzero residue modulo \(k\) of a \(\#L\) function [2507.23563].

## 2. Structural relations and closure phenomena

The foundational structural theorem is the Immerman–Szelepcsényi theorem:
\[
NL = coNL.
\]
In the logarithmic-space setting this implies closure of \(NL\) under complement, union, and intersection, and the monograph records the associated oracle collapses \(L^{NL}=NL\) and \(NL^{NL}=NL\) [2507.23563].

Within the counting hierarchy, a recent derivational line proves
\[
NL = C_{=}L \subseteq PL.
\]
The 2023 paper obtains this through closure properties of \(\#L\), threshold encodings of \(NL\)-membership, a symmetric-difference decomposition for \(C_{=}L\), and repeated use of \(NL=coNL\) [2310.11874]. The 2025 monograph states the same equality and inclusion as part of its overall picture of the subject [2507.23563].

The same landscape places \(PL\) above bounded-error logspace randomized and quantum computation. The 2021 quantum post-selection paper states
\[
L \subseteq NL = coNL \subseteq coC_{=}L = NQL = PL = PQL
\]
and
\[
L \subseteq BPL \subseteq BQL \subseteq PL = PQL,
\]
so unbounded-error quantum logspace and classical unbounded-error logspace coincide:
\[
PQL = PL.
\]
This identifies \(PL\) as the common endpoint of several classical and quantum low-space inclusions [2105.02681].

For modular counting, the monograph emphasizes especially strong behavior at prime moduli. For prime \(p\), \(Mod_pL\) is closed under union, intersection, complement, and logspace Turing reductions. It further records hierarchy collapses of the form
\[
\mathcal{C}H=\mathcal{C}
\]
for \(\mathcal{C}\in\{NL,C_{=}L,Mod_pL,PL\}\), giving a uniform closure picture for the main low-space counting classes [2507.23563].

A recurring theme is that low-space counting classes are unusually robust under operations that are delicate in higher-space or higher-time settings. This is most visible in the coexistence of exact-zero tests, sign tests, modulo tests, and nondeterministic acceptance within a tightly connected family.

## 3. Complete problems and algebraic characterizations

Complete problems for logarithmic-space bounded counting classes are dominated by graph reachability counting, matrix powering, and determinant. In the Cook–Nguyen framework, \(\#STCON\) is \(AC^0\)-complete for
\[
DET = AC^0(\#L) = \#LH,
\]
and matrix powering over \(\mathbb{GF}(2)\) is \(AC^0\)-complete for \(\oplus L\) [1001.1960].

The graph-theoretic completeness of \(\#STCON\) reflects the path-counting nature of \(\#L\): a logspace nondeterministic machine induces a configuration graph, and the number of accepting paths becomes the number of paths between designated vertices in that graph. This converts machine counting into combinatorial counting and underlies several completeness proofs [1001.1960].

On the algebraic side, the determinant is the central complete problem for \(GapL\). The monograph states that computing \(\det(A)\) for integer matrices is in \(GapL\), is \(GapL\)-hard under logspace many-one reductions, and is therefore \(GapL\)-complete. The key combinatorial tool is the Mahajan–Vinay theorem, which expresses the determinant as a signed sum over clow sequences and also as a difference of path sums in a specially constructed weighted layered DAG \(H_A\) [2507.23563].

The same source places a range of linear-algebraic problems in the same orbit: \(\mathrm{POWERELEMENT}\), \(\mathrm{ITMATPROD}\), and \(\mathrm{MATINV}\) are in \(GapL\) and are \(\#L\)-hard, while rank computation lies in \(L^{GapL}\). The determinant thus functions as the canonical algebraic hub of the logspace counting world [2507.23563].

The formal-theory paper uses matrix powering as the preferred complete problem because it fits bounded-arithmetic encoding particularly well. For parity counting, the complete problem is matrix powering over \(\mathbb{GF}(2)\); for \(DET\), the complete problem is integer matrix powering, with signed binary encodings supporting reductions from and to determinant-style computations [1001.1960].

## 4. Unambiguity, approximation, enumeration, and sampling

A distinct but closely related direction studies logspace-defined relations via nondeterministic logspace transducers. In that framework, a relation \(R\) belongs to \(\mathbf{NL}\) if it is accepted by an NL-transducer, and to \(\mathbf{UL}\) if it is accepted by an unambiguous NL-transducer. The counting object is
\[
W_R(x)=\{y\in\{0,1\}^*\mid (x,y)\in R\},
\]
and the associated counting problem is \(x\mapsto |W_R(x)|\) [1906.09226].

The algorithmic behavior sharply separates the unambiguous and general cases. If \(R\in \mathbf{UL}\), then the paper proves constant delay enumeration, exact polynomial-time counting, and polynomial-time uniform generation. If \(R\in \mathbf{NL}\), then it proves polynomial delay enumeration, FPRAS approximate counting, and a preprocessing polynomial-time Las Vegas uniform generator [1906.09226].

The key technical theorem is that \(\#\mathrm{NFA}\)—counting accepted words of length \(n\) for an NFA—admits an FPRAS. The abstract identifies this as an open problem resolved in the affirmative and states as a corollary that every function in \(SpanL\) admits an FPRAS [1906.09226]. This places approximate counting and exact uniform generation squarely inside a logspace-defined framework even when exact counting is hard.

Unambiguity also appears in the monograph through the Isolating Lemma. The stated version assigns random weights to elements of a finite set and guarantees with probability at least \(\tfrac12\) that a family of nonempty subsets has a unique minimum-weight member. Applied to reachability, this produces min-unique graphs and yields the nonuniform consequence
\[
NL=(UL\cap coUL)/poly.
\]
The same treatment shows that if a graph family can be transformed in logspace into a polynomially weighted min-unique graph preserving \(st\)-connectivity, then \(st\)-connectivity for that family lies in \(UL\cap coUL\) [2507.23563].

Taken together, these results show that low-space counting is not confined to exact path-counting functions. It also supports a refined algorithmic trinity—enumeration, approximate counting, and uniform generation—whose complexity depends on whether nondeterminism is unambiguous or unrestricted.

## 5. Logical and proof-theoretic formulations

Descriptive complexity provides a second axis for organizing logarithmic-space bounded counting classes. The formal-theory paper introduces two-sorted Cook–Nguyen style theories for \(\oplus L\) and \(DET\), using matrix powering over \(\mathbb{GF}(2)\) and over the integers as complete problems. In these theories, the provably total functions are exactly the functions of the corresponding complexity classes, and the \(\Delta_1^B\)-definable relations are exactly the associated decision problems [1001.1960].

A different logical line extends first-order logic with counting by limited recursion. The logic \(LREC\) adds an operator whose recursion depth is controlled by a numeric resource term, and its data complexity is in \(LOGSPACE\). The paper proves that \(LREC\) is strictly more expressive than deterministic transitive closure logic with counting, incomparable with \(STC\) and \(TC\), strictly contained in \(FPC\), and captures \(LOGSPACE\) on the class of directed trees [1212.6567].

The extension \(LREC=\) adds a quotienting mechanism via a definable equivalence relation before recursion. This restores closure under logical reductions and increases expressive power while remaining in \(LOGSPACE\) under data complexity and still inside \(FPC\). The same source proves that \(LREC=\) captures \(LOGSPACE\) on interval graphs [1212.6567].

For chordal claw-free graphs, \(LREC_{=}\)-definable canonization yields an especially strong package of consequences: a logarithmic-space canonization algorithm, a logarithmic-space graph isomorphism test, that \(LREC_{=}\) captures \(LOGSPACE\) on the class, and that fixed-point logic with counting captures polynomial time on the class [1802.10331]. In this sense, logspace counting and recursion are not merely machine-based phenomena; they can be internalized into logical systems with explicit counting syntax and resource-bounded recursion.

## 6. Quantum and parameterized extensions

Quantum space-bounded complexity adds a post-selection counterpart to the classical class \(PL\). The central theorem of the 2021 paper is
\[
PostBQL = PL,
\]
the space-bounded analogue of Aaronson’s polynomial-time identity \(PostBQP=PP\). One inclusion is obtained by converting a postselecting logarithmic-space quantum machine into an ordinary unbounded-error quantum machine, giving \(PostBQL\subseteq PQL=PL\). The reverse inclusion simulates a polynomial-time, log-space probabilistic machine by a logarithmic-width probabilistic circuit, then coherently by a postselecting quantum machine, and finally amplifies the sign of the bias \(A-\tfrac12\) through repeated postselected runs [2105.02681].

The same paper derives a collapse of several quantum logspace classes:
\[
PL = PQL = PostBQL = BQL(\exp) = BQL(\infty),
\]
and also proves
\[
NL = PostEPL = PostRL,\qquad coC_{=}L = PostRQL,
\]
together with
\[
C_{=}L \cap coC_{=}L = NQL \cap coNQL = PostEQL.
\]
These identities show that post-selection in logarithmic space exactly captures several exact and one-sided acceptance regimes [2105.02681].

Parameterized counting in logspace produces a parallel family of classes:
\[
\#\paraW L,\quad \#\paraB L,\quad \#\paraWt L,\quad \#\paraBt L.
\]
They are defined by \(k\)-bounded parameterized logspace machines, where \(W/B\) distinguishes multiple-read from read-once access to nondeterministic bits and the superscript \(t\) denotes tail-nondeterminism. The paper proves that all four classes are closed under addition and multiplication, and that \(\#\paraW L\) and \(\#\paraB L\) are closed under parameterized logspace parsimonious reductions [1904.12156].

Natural complete problems exist for each of these classes. Counting \(s\)-\(t\) walks of bounded length is complete for \(\#\paraB L\); a local bounded-arity first-order model-counting problem is complete for both \(\#\paraB L\) and \(\#\paraBt L\); unrestricted quantifier-free model counting is complete for \(\#\paraWt L\); and colored path homomorphism counting is \(\#\paraB L\)-complete. The paper also shows that the closure of \(\#\paraBt L\) under parameterized logspace parsimonious reductions coincides with \(\#\paraB L\), and that a parameterized determinant function on \((0,1)\)-matrices is \(\#\paraBt L\)-hard and can be written as the difference of two functions in \(\#\paraBt L\) [1904.12156].

These quantum and parameterized developments preserve the central pattern of the classical theory: path counts, sign tests, and restricted nondeterminism continue to determine the expressive power of logarithmic-space computation, even when enriched by post-selection or by parameter-bounded nondeterministic resources.

Source: https://www.emergentmind.com/topics/logarithmic-space-bounded-counting-classes