Documentation

CslibFrontier.Computability.Circuit.Boolean.PopulationCount.PolyTime

Native generation of linear-size threshold circuits #

The population tree is generated one height at a time. Its state includes the current number of leaves in unary as well as the complete circuit code. Only logarithmically many heights are visited, and each intermediate tree has at most twice the requested number of leaves. Thus all wire numbers, framing bits, and intermediate circuit descriptions have polynomial total length.

The resulting polynomial-time certificate concerns the actual gate-and-output encoding used by the native circuit counter.

Combine two copies of a counter on p inputs, using an exact w-bit adder.

Generate the power-of-two tree selected by an arbitrary unary input count.

The complete linear-size population-count circuit is generated in polynomial time from its unary number of inputs.