Read-once branching programs #
A read-once branching program of length L over an alphabet X, with states S, reads a word
x : Fin L → X letter by letter in the standard order: it starts in the state start, at time
i it moves from its current state s to step i s (x i), and it accepts when the final state
satisfies accept (ReadOnceProgram, ReadOnceProgram.eval). Its width is the number of
states Fintype.card S. Read-once branching programs of width w and length L model
computations of length L with log w bits of memory reading a one-way stream of random letters,
the tests fooled by Nisan's generator. These are the standard-order read-once branching programs
of Hatami and Hoza, Definition 1.5, the oblivious read-once branching programs of
Vadhan, Section 8.2.1 (with layers of states S and edges labelled by letters). A
program of length m * n over X regroups into a program of length m over the blocks
Fin n → X with the same states (ReadOnceProgram.blocks, ReadOnceProgram.eval_blocks); the
words of length m * n are the blocks concatenated by Cslib.BitString.blocksEquiv.symm.
The run of a time-dependent transition function δ : ℕ → S → X → S on a list of letters l,
starting at time t in state s, is the indexed fold l.foldlIdx δ s t (List.foldlIdx_append
splits runs). A program runs its transition function extended by the identity after time L
(ReadOnceProgram.finalState_eq).
Read-once branching programs are a sequential form of monoid programs
(Cslib.BranchingPrograms.MonoidProgram) over the transformation monoid Function.End S. That
model fixes a monoid element for each letter read, but lets instructions read positions in any
order and any number of times, and measures length rather than width. A read-once program is the
monoid program whose i-th instruction from the end reads position i and selects
step i · a on the letter a; since the last instruction of a program over Function.End S acts
first, it maps the start state to the final state (ReadOnceProgram.toMonoidProgram,
ReadOnceProgram.eval_toMonoidProgram). The read-once nondeterministic programs
Cslib.Circuits.Frontier.ReadOnceNBP instead read sets of coordinates in a layout order, with
nondeterministic transitions.
A read-once program with finitely many states is also a deterministic branching program
(Cslib.BranchingPrograms.BranchingProgram), which may query any coordinate at any node: its nodes
are the pairs of a time and a state, so it has (L + 1) * Fintype.card S of them
(ReadOnceProgram.toBranchingProgram, ReadOnceProgram.eval_toBranchingProgram,
ReadOnceProgram.size_toBranchingProgram).
Main definitions #
Cslib.BranchingPrograms.ReadOnceProgram: a read-once branching program in standard order.Cslib.BranchingPrograms.ReadOnceProgram.eval: its output on a word.Cslib.BranchingPrograms.ReadOnceProgram.stepAt: its transition function extended to all times.Cslib.BranchingPrograms.ReadOnceProgram.runFrom: the state reached by reading the rest of a word from a given time and state.Cslib.BranchingPrograms.ReadOnceProgram.blocks: the program on blocks ofnletters.Cslib.BranchingPrograms.ReadOnceProgram.toMonoidProgram: the program as a monoid program overFunction.End S.Cslib.BranchingPrograms.ReadOnceProgram.toBranchingProgram: the program as a deterministic branching program.
Main results #
Cslib.BranchingPrograms.ReadOnceProgram.finalState_eq: the final state is the run of the extended transition function.Cslib.BranchingPrograms.ReadOnceProgram.eval_blocks: regrouping into blocks preserves outputs.Cslib.BranchingPrograms.ReadOnceProgram.eval_toMonoidProgram: the monoid program evaluates to the map from start states to final states.Cslib.BranchingPrograms.ReadOnceProgram.eval_toBranchingProgram,Cslib.BranchingPrograms.ReadOnceProgram.size_toBranchingProgram: the branching program computes the same function, with(L + 1) * Fintype.card Snodes.
References #
A read-once branching program in standard order, of length L over the alphabet X with
states S: from the state start, at time i it moves from state s to step i s a on reading
the i-th letter a, and it accepts when the final state satisfies accept. Its width is
Fintype.card S Hatami and Hoza, Definition 1.5.
The state of the program after reading the word x.
The output of the program on the word x: whether its final state is accepting.
The transition function of the program at every time, the identity from time L on.
The final state is the run of the extended transition function stepAt on the word.
The state reached from the state s at time t by reading the rest of the word x.
Reading the whole word from the start gives the final state.
Before time L, one step of runFrom reads x ⟨t, ht⟩ and advances to t + 1.
Blocks #
The program of length m on blocks of n letters: at time i it runs P on the i-th
block, from time n * i. It has the same states, hence the same width.
Regrouping into blocks preserves final states.
Regrouping into blocks preserves outputs.
Monoid programs #
The program as a monoid program over Function.End S: the i-th instruction from the end
reads position i and selects step i · a on the letter a.
Read-once programs are monoid programs: the monoid program P.toMonoidProgram evaluates on
x to the map sending the start state to the final state of P on x.
Branching programs #
The program as a graph on the pairs of a time and a state: at a time t < L the node (t, s)
queries position t and moves to (t + 1, step t s a) on the letter a, and at time L it is a
sink returning accept s.
From the node (t, s), the graph of P reaches the output of P run from time t and state
s.
The program as a deterministic branching program, with a node for each time and state.
Read-once programs are branching programs: P.toBranchingProgram computes the same
function as P.
The branching program of a read-once program has (L + 1) * Fintype.card S nodes.