Accumulating circuits #
A sequence of circuits step r : Circuit σ (K₀ + w * r) (K₀ + w * r + w) composes into
Circuit.accumulate step R : Circuit σ K₀ (K₀ + w * R): round r reads every value produced so
far and appends w new ones. When each round keeps its inputs and appends a block sel r y
computed from the values y so far, the output keeps the input
(Circuit.eval_accumulate_input), a longer accumulation extends a shorter one
(Circuit.eval_accumulate_prefix), and the block of round r is sel r of the output after r
rounds (Circuit.eval_accumulate_block). Size, weighted cost, weighted depth and fan-in add up or
are inherited round by round.
Unlike Circuit.iterate, the width grows with every round, so later rounds can read the blocks of
all earlier ones.
Main definitions #
Cslib.Circuits.Circuit.accumulate:Rrounds composed in sequence, each appendingwvalues.
Main results #
Cslib.Circuits.Circuit.eval_accumulate_input,Cslib.Circuits.Circuit.eval_accumulate_prefix,Cslib.Circuits.Circuit.eval_accumulate_block: the semantics of an accumulation of rounds that keep their inputs.Cslib.Circuits.Circuit.size_accumulate,Cslib.Circuits.Circuit.cost_program_accumulate,Cslib.Circuits.Circuit.depthWith_accumulate_le,Cslib.Circuits.Circuit.fanInAtMost_accumulate: the measures of an accumulation.
R rounds composed in sequence: round r maps the K₀ + w * r values produced so far to
K₀ + w * r + w values. A wiring cast realigns K₀ + w * r + w with K₀ + w * (r + 1); it adds
no gates.
Rounds of fan-in at most f accumulate to fan-in at most f.
In an accumulation of rounds that keep their inputs and append sel r, the output after
R rounds extends the output after r ≤ R rounds.
In an accumulation of rounds that keep their inputs, the output keeps the input.
In an accumulation of rounds that keep their inputs and append sel r, the block appended in
round r < R is sel r of the output after r rounds.