Documentation

Complexitylib.Algebraic.LowerBound.Nechiporuk.Sharing

Programs with shared gates over the full binary basis #

A SharedProgram over Binary.Formula on n inputs with k shared gates consists of k intermediate formulas over the full binary basis together with one output formula, where each formula may read the primary inputs and all previously computed shared values.

Fixing the coordinates outside a block Y ⊆ Fin n turns each of the k + 1 formulas into a subfunction of the coordinates in Y together with the active shared variables:

Applying Nechiporuk's counting lemma (Nechiporuk.card_subfunctions_le) to the active formulas yields |(subfunctions P.eval Y)| ≤ 2 ^ (P.activeShared Y + 1) · 16 ^ (P.inputLeavesIn Y + P.activeSharedLeaves Y) (SharedProgram.card_subfunctions_le_activeSharedLeaves), which in turn implies the global bound |(subfunctions P.eval Y)| ≤ 2 ^ (k + 1) · 16 ^ (P.inputLeavesIn Y + P.sharedLeaves n) (SharedProgram.card_subfunctions_le_inputLeavesIn).

Every single-output circuit c over Binary.signature decomposes from its last gate down into a SharedProgram with k ≤ KW.sharedGateCount c shared gates, at most c.size binary gates, at most sharedFanOut c total shared-variable leaves, and on every block Y ⊆ Fin n, at most activeSharedGateCount c Y active shared gates and activeSharedFanOut c Y active shared-variable leaves (exists_sharedProgram_of_circuit). Summed over a family of blocks, the active shared fan-out weights each shared gate by the number of blocks its syntactic input cone meets (sum_activeSharedFanOut, sum_activeSharedFanOut_le_of_gateBlockSpan_le, sum_activeSharedFanOut_le_add_highSpanSharedFanOut). Moreover, wireActive and gateActive coincide with having syntactic input support (Program.wireSupport) meeting Y (wireActive_eq_true_iff, gateActive_eq_true_iff), so over pairwise disjoint blocks a gate's block-span never exceeds the cardinality of its input support (gateBlockSpan_le_card_wireSupport), and in any single-output binary circuit sharedFanOut c ≤ 2 * c.size + 1 (sharedFanOut_le_two_mul_size_add_one).

The definitions live in Complexitylib.Algebraic.LowerBound.Nechiporuk.Sharing.Defs and the proof internals in Complexitylib.Algebraic.LowerBound.Nechiporuk.Sharing.Internal.

The input leaves of a program with k shared gates number at most gates + k + 1.

theorem Algebraic.Nechiporuk.SharedProgram.sum_inputLeavesIn_le_inputLeaves {m n : ℕ} (Y : Fin m → Finset (Fin n)) (disjoint : Pairwise fun (i j : Fin m) => Disjoint (Y i) (Y j)) {N k : ℕ} (P : SharedProgram N k) :
∑ i : Fin m, inputLeavesIn (Y i) P ≤ P.inputLeaves n

Over pairwise disjoint blocks of Fin n, inputLeavesIn sums to at most inputLeaves n.

At most k of the k shared gates of a program are active on any block.

The shared-variable leaves reading active shared gates are among all shared-variable leaves.

Sharpened Nechiporuk counting lemma for programs with shared gates. A program P has at most 2 ^ (P.activeShared Y + 1) · 16 ^ (P.activeLeavesIn Y) subfunctions on Y: shared gates with no leaves in the current active block contribute neither to the exponent of 2 nor to the active leaf count.

A program P has at most 2 ^ (P.activeShared Y + 1) · 16 ^ (P.inputLeavesIn Y + P.activeSharedLeaves Y) subfunctions on a primary block Y ⊆ Fin n.

Nechiporuk's counting lemma for programs with shared gates. A program with k shared gates has at most 2 ^ (k + 1) · 16 ^ (P.leavesIn Y) subfunctions on Y.

A program with k shared gates has at most 2 ^ (k + 1) · 16 ^ (P.inputLeavesIn Y + P.sharedLeaves n) subfunctions on Y.

Shared fan-out and translation from binary circuits to SharedProgram #

Every shared gate has fan-out at least two, so there are at most sharedFanOut c of them.

A circuit has at most c.size shared gates.

The shared gates active on a block are among all shared gates.

The fan-out of the shared gates active on a block is at most the total shared fan-out.

Each active shared gate has fan-out at least two, so it contributes at least one to activeSharedFanOut c Y.

theorem Algebraic.Nechiporuk.gateActive_eq_true_iff {σ : Signature} {n t : ℕ} (Y : Finset (Fin n)) (p : Program σ n t) (g : Fin t) :
gateActive Y p g = true ↔ ∃ i ∈ Y, i ∈ p.wireSupport (Wire.gate g)

Gate g is active on Y iff its syntactic input support intersects Y.

theorem Algebraic.Nechiporuk.wireActive_eq_true_iff {σ : Signature} {n t : ℕ} (Y : Finset (Fin n)) (p : Program σ n t) (w : Wire n t) :
wireActive Y p w = true ↔ ∃ i ∈ Y, i ∈ p.wireSupport w

Wire w is active on Y iff its syntactic input support intersects Y.

theorem Algebraic.Nechiporuk.gateBlockSpan_le_card_wireSupport {σ : Signature} {n t B : ℕ} {Y : Fin B → Finset (Fin n)} (hdisj : Pairwise fun (i j : Fin B) => Disjoint (Y i) (Y j)) (p : Program σ n t) (g : Fin t) :

Over pairwise disjoint blocks Y, the number of blocks on which gate g is active is at most the cardinality of its syntactic input support.

theorem Algebraic.Nechiporuk.gateBlockSpan_le {σ : Signature} {n t B : ℕ} (Y : Fin B → Finset (Fin n)) (p : Program σ n t) (g : Fin t) :

A gate is active on at most all B blocks.

In any single-output circuit over Binary.signature, the total fan-out of all shared gates is at most 2 * c.size + 1: each binary gate reads two wires and the circuit reads one output wire.

theorem Algebraic.Nechiporuk.sum_activeSharedGateCount {σ : Signature} {n m B : ℕ} (c : Circuit σ n m) (Y : Fin B → Finset (Fin n)) :
∑ i : Fin B, activeSharedGateCount c (Y i) = ∑ g : Fin c.size with 2 ≤ KW.gateFanOut c g, gateBlockSpan Y c.program g

Summing activeSharedGateCount over a family of blocks equals summing the block-spans of all shared gates.

theorem Algebraic.Nechiporuk.sum_activeSharedFanOut {σ : Signature} {n m B : ℕ} (c : Circuit σ n m) (Y : Fin B → Finset (Fin n)) :
∑ i : Fin B, activeSharedFanOut c (Y i) = ∑ g : Fin c.size with 2 ≤ KW.gateFanOut c g, KW.gateFanOut c g * gateBlockSpan Y c.program g

Summing activeSharedFanOut over a family of blocks equals summing KW.gateFanOut c g * gateBlockSpan Y c.program g over all shared gates g.

theorem Algebraic.Nechiporuk.sum_activeSharedFanOut_le_of_gateBlockSpan_le {σ : Signature} {n m B s : ℕ} (c : Circuit σ n m) (Y : Fin B → Finset (Fin n)) (hs : ∀ (g : Fin c.size), 2 ≤ KW.gateFanOut c g → gateBlockSpan Y c.program g ≤ s) :
∑ i : Fin B, activeSharedFanOut c (Y i) ≤ s * sharedFanOut c

If every shared gate of c is active on at most s blocks of Y, then the sum of activeSharedFanOut c (Y i) over all blocks is at most s * sharedFanOut c.

theorem Algebraic.Nechiporuk.sum_activeSharedFanOut_le {σ : Signature} {n m B : ℕ} (c : Circuit σ n m) (Y : Fin B → Finset (Fin n)) :
∑ i : Fin B, activeSharedFanOut c (Y i) ≤ B * sharedFanOut c

Over B blocks, the active shared fan-out sums to at most B * sharedFanOut c.

theorem Algebraic.Nechiporuk.highSpanSharedFanOut_eq_zero_of_gateBlockSpan_le {σ : Signature} {n m B d : ℕ} (c : Circuit σ n m) (Y : Fin B → Finset (Fin n)) (hd : ∀ (g : Fin c.size), 2 ≤ KW.gateFanOut c g → gateBlockSpan Y c.program g ≤ d) :

When every shared gate of c is active on at most d blocks of Y, highSpanSharedFanOut c Y d vanishes.

theorem Algebraic.Nechiporuk.highSpanSharedFanOut_eq_zero_of_card_wireSupport_le {σ : Signature} {n m B d : ℕ} (c : Circuit σ n m) {Y : Fin B → Finset (Fin n)} (hdisj : Pairwise fun (i j : Fin B) => Disjoint (Y i) (Y j)) (hd : ∀ (g : Fin c.size), 2 ≤ KW.gateFanOut c g → (c.program.wireSupport (Wire.gate g)).card ≤ d) :

Over pairwise disjoint blocks Y, if the syntactic input support of every shared gate has size at most d, then highSpanSharedFanOut c Y d vanishes.

Splitting ∑ i, activeSharedFanOut c (Y i) at block-span threshold d: shared gates active on at most d blocks contribute at most d * sharedFanOut c, while shared gates active on strictly more than d blocks are active on at most B blocks and contribute at most B * highSpanSharedFanOut c Y d.

Full-binary-basis circuits as programs with shared gates. Every single-output circuit c over Binary.signature computing f yields a SharedProgram computing f with at most KW.sharedGateCount c shared gates, at most c.size binary gates, at most sharedFanOut c shared-variable leaves, and on every block Y ⊆ Fin n, at most activeSharedGateCount c Y active shared gates and activeSharedFanOut c Y active shared-variable leaves.