Monoid programs #
For a monoid M, a program over M reads an input x : ι → α, a word over the alphabet α
with positions in ι. It is a word of instructions (MonoidProgram), each of which reads the
letter at a position i and selects an element of M by a function α → M (Instruction). On
an input the program computes the product of the selected elements, the first instruction leftmost
(MonoidProgram.eval); evaluation is a monoid homomorphism from programs under concatenation
(MonoidProgram.eval_mul) [BT88]. Programs are covariant in the monoid
(MonoidProgram.map), and contravariant in the alphabet (MonoidProgram.comap) and in the
positions (MonoidProgram.rename).
Branching programs of width w are the programs over Function.End (Fin w), and permutation
branching programs those over Equiv.Perm (Fin w); since (σ * τ) a = σ (τ a), the last
instruction acts first. A program σ-computes a Boolean-valued function f of its input when
its value is σ where f is true and 1 elsewhere (MonoidProgram.Computes) [Bar89].
Programs over groups can be inverted (MonoidProgram.eval_inv), and every program can be pushed
along a monoid homomorphism, for instance a conjugation (MonoidProgram.eval_map). So computed
functions can be negated (MonoidProgram.Computes.not) and combined by commutators
(MonoidProgram.Computes.and), the two steps of Barrington's theorem.
Main definitions #
Cslib.BranchingPrograms.Instruction: an instruction, a position and a function from the alphabet to the monoid;Cslib.BranchingPrograms.Instruction.cond: the instruction selecting one of two elements by a bit.Cslib.BranchingPrograms.MonoidProgram: a program over a monoid, a word of instructions.Cslib.BranchingPrograms.MonoidProgram.eval: the value of a program on an input.Cslib.BranchingPrograms.MonoidProgram.map,Cslib.BranchingPrograms.MonoidProgram.comap,Cslib.BranchingPrograms.MonoidProgram.rename: change of monoid, alphabet and positions.Cslib.BranchingPrograms.MonoidProgram.inv,Cslib.BranchingPrograms.MonoidProgram.mulLeft: the inverse of a program over a group, and left multiplication of its value.Cslib.BranchingPrograms.MonoidProgram.Computes:σ-computing a Boolean-valued function.
Main results #
Cslib.BranchingPrograms.MonoidProgram.Computes.not,Cslib.BranchingPrograms.MonoidProgram.Computes.and: negation and conjunction of computed functions.
Implementation notes #
An instruction selects by a function α → M, as in [BT88], rather than by an
element of M for each letter. Barrington's instructions over Boolean inputs, which select one of
two elements according to the bit read [Bar89], are the instructions with α := Bool
built by Instruction.cond, and every instruction over Bool is one of them
(Instruction.cond_var_select). Barrington's programs over n Boolean variables are thus the
programs over Fin n → Bool, the bit strings BitString n, with ι := Fin n and α := Bool.
References #
An instruction of a program over M on inputs x : ι → α: read the letter x var and select
the element select (x var) of M.
- var : ι
The position read.
- select : α → M
The element selected for each letter.
Instances For
The element an instruction selects on an input.
Instances For
The instruction over Boolean inputs that reads the bit at position i and selects t when it
is true and e when it is false.
Instances For
The instruction that reads position i and selects m whatever the letter.
Instances For
The instruction selecting φ m instead of each m.
Instances For
The instruction on inputs over β that reads each letter b as g b.
Instances For
The instruction that reads position f I.var instead of I.var.
Instances For
The product of the elements a program selects on an input, the first instruction leftmost.
Instances For
A program σ-computes a Boolean-valued function f of its input when its value is σ on the
inputs where f is true and 1 elsewhere.
Instances For
The program selecting φ m instead of each m.
Instances For
The program on inputs over β that reads each letter b as g b.
Instances For
The program that reads position f i wherever P reads position i.
Instances For
The program with the instructions in reverse order and their elements inverted.
Instances For
Multiply the value of a program by g on the left, without making it longer unless it is
empty.
Instances For
If P σ⁻¹-computes f, multiplying by σ makes it σ-compute the negation of f.
The commutator of programs σ- and τ-computing f and g computes f ∧ g with the
commutator σ τ σ⁻¹ τ⁻¹.