The Cook–Mertz procedure for Tree Evaluation with fan-in d #
This generalizes the binary procedure Cslib.TreeEval.proc to fan-in d; at d = 2 it is that
procedure step for step (Cslib.TreeEval.Ary.proc_ofBinary, proved beside the binary procedure,
which derives its correctness from this file). The procedure keeps d + 1 registers, each
holding ℓ elements of a finite field K, as global storage shared by all levels of the
recursion. Called on a subtree, a coefficient c and a target register t, it adds c times the
value of the subtree (read as 0/1 field elements) to register t and leaves the other d
registers unchanged, whatever their contents.
The child j of a target t uses the register reg t j = t + (j + 1), so the d children use
exactly the registers other than t; for d = 2 these are the registers t + 1 and t + 2 of
the binary procedure. At an internal node with gate f, the procedure runs one round for every
unit u of K. A round scales the child registers by u, adds the children's values to them by
recursive calls, subtracts c times the multilinear extension of f at the masked values from
register t, and then undoes the recursive calls and the scaling. Summed over all units, the masks
cancel (FiniteField.sum_units_eval_mul_add), because the extension has degree at most
d * ℓ < |K| - 1, and register t has gained c • f (v₀, …, v_{d-1}).
procWith separates the Boolean value length from the register width and accepts a supplied
value representation and gate extension. Its correctness requires only a signed unmasking law;
this lets packed finite-alphabet extensions reuse the same masking proof. The original
multilinear procedure is its exact specialization (procWith_embed).
This file proves correctness only; space bounds are separate.
Main definitions #
Cslib.TreeEval.embed: anℓ-bit value read as0/1field elements, for any fan-in.Cslib.TreeEval.Ary.reg: the register of a child.Cslib.TreeEval.Ary.gatePoly: the multilinear extension of an output bit of a gate.Cslib.TreeEval.Ary.proc: the procedure, parametrized by an enumeration of the units ofK.Cslib.TreeEval.Ary.procWith: the procedure with a supplied representation and gate extension.
Main results #
Cslib.TreeEval.Ary.procWith_eq: correctness for any supplied extension satisfying unmasking.Cslib.TreeEval.Ary.procWith_embed: the multilinear procedure is a specialization, round for round.Cslib.TreeEval.Ary.proc_eq: the procedure addsctimes the value of the tree to the target register and leaves the other registers unchanged.Cslib.TreeEval.Ary.proc_zero: started from zero registers, it leaves the value of the tree in the target register.Cslib.TreeEval.Ary.embed_eval_eq_proc: the same, for the canonical enumeration of the units.
References #
- J. Cook and I. Mertz, Tree Evaluation is in Space O(log n · log log n),
Lemma 13 and Theorem 10, for fan-in
d. - O. Goldreich, On the Cook–Mertz Tree Evaluation procedure, Algorithm 1, whose signed recursive calls are followed here.
The global storage: d + 1 registers of ℓ field elements.
One round of the procedure at a gate f, for the unit u, given procedures p j for the
subtrees. The target is t, and the child registers reg t j hold the masks.
Subtract a coefficient times a supplied gate extension from the target register. The extension may use a different number of field coordinates from the gate's bit length.
A masking round with a supplied gate extension, sharing the same registers across recursive calls. No polynomial representation or relation between bit length and register width is needed.
The Cook–Mertz procedure with a supplied representation of bit values and gate extension.
The representation has r field coordinates, independently of the ℓ bits in a value.
Correctness with a supplied gate extension. The unmasking identity is the only property required of the representation and extension: the sum over all nonzero masks must be minus the represented gate value. The conclusion holds from arbitrary initial register contents.
Correctness of the Cook–Mertz procedure for fan-in d. If us enumerates the units of
K without repetition and d * ℓ < |K| - 1, then the procedure adds c times the value of the
tree to the target register and leaves the other registers unchanged, whatever their initial
contents.
Started from zero registers, the procedure leaves the value of the tree in the target register.
Tree Evaluation with fan-in d by the Cook–Mertz procedure. Run over the units of K in
any order with d * ℓ < |K| - 1, from zero registers, the procedure computes the value of the
tree into the target register.