Forward DAG closure, 2-SAT frontier states, and fan-out slicing #
This module develops three structural refinements of the frontier compiler:
- Forward DAG closure (
Program.DagSpan,Program.depthOneDetermined,Program.forwardDetermined). Along any cutPofCompiler.graph c, a gate wire on the cut whose arguments are already functionally determined bycutWires c Pcarries zero independent information across the cut. Removing any subsetD ⊆ c.program.forwardDetermined (cutWires c P)(in particularD = c.program.depthOneDetermined (cutWires c P)) preserves exact trace agreement oncutWires c P(Program.eqOn_of_eqOn_sdiff_forwardDetermined) and full output splicing (eval_splice_of_eqOn_cutWires_sdiff). - 2-SAT independent-set frontier bound (
ForbidsOutputPair,u2ClauseGraph,ncard_frontierValues_le_indepSetCount). In a Boolean circuit, every gate argumentawhose operation forbids at least one(arg, out)value pair (ForbidsOutputPair, satisfied on both inputs of everyAND-typeU₂gate(u ⊕ c₁) ∧ (v ⊕ c₂) ⊕ c₃) induces a 2-SAT clause across every wire subsetR. BySimpleGraph.ncard_le_indepSetCount_of_forall_adj, the number of distinct frontier states at steptis bounded by(u2ClauseGraph c.program I R).indepSetCounton the reduced cutR = cutWires c (π.initial t) \ D(F_{k + 2}on paths,2 ^ d + 1on stars). - Unary elimination and universal fan-out slicing (
Program.arityExcess,Program.gateConsumers,exists_sliced_fanout_lt,eventually_slicing_surplus). Eliminating nullary and unary gates and deduplicating repeated arguments inside each gate reduces any fan-in-rcircuit to one whose gates all have arity in[2, r]and injective argument wires, with gate count bounded byc.program.arityExcess(so unaryNOTgates are free). Repeatedly fixing by pigeonhole any wire (input or gate) read by≥ kbinary gates yields a multi-output residual circuit in which every wire feeds< kgates (≤ 4atk = 5) and proves the fan-out surplus lower bound(1 + 1/A - ε) n + (k - (1 + 1/A)) t < c.program.arityExcess.
Main definitions #
Cslib.Circuits.Program.DagSpan,Cslib.Circuits.Program.depthOneDetermined,Cslib.Circuits.Program.forwardDetermined: forward DAG span and determined cut wires (D₀,D*).Cslib.Circuits.Frontier.cutWires: the wires carried by edges crossing a vertex cut.Cslib.Circuits.Frontier.ForbidsOutputPair,Cslib.Circuits.Frontier.u2ClauseGraph: forbidden input-output pairs and the induced 2-SAT clause graph on a wire set.Cslib.Circuits.allOpsSignature,Cslib.Circuits.allOpsInterpretation: universal graded signature overU.Cslib.Circuits.Program.arityExcess,Cslib.Circuits.Program.gateConsumers: total arity excess∑ g, (arity(g) - 1)and number of gates reading a wire.
Main results #
Cslib.Circuits.Program.eqOn_of_eqOn_sdiff_forwardDetermined: trace agreement onW \ Dimplies trace agreement onWwheneverD ⊆ p.forwardDetermined W.Cslib.Circuits.Frontier.eval_splice_of_eqOn_cutWires_sdiff: splicing outputs from agreement oncutWires c P \ D.Cslib.Circuits.Frontier.ncard_frontierValues_le_indepSetCount: Boolean frontier states at steptnumber at most(u2ClauseGraph c.program I (cutWires c (π.initial t) \ D)).indepSetCount.Cslib.Circuits.Frontier.exists_sliced_fanout_lt: structural fan-out slicing (gateConsumers < kon every wire,arityExcess + k * t ≤ c.program.arityExcess,|U| ^ t * |S'| ≥ |S|).Cslib.Circuits.Frontier.eventually_slicing_surplus,Cslib.Circuits.Frontier.eventually_switched_slicing_surplus: asymptotic fan-out surplus bounds.
Forward DAG closure (D₀ and D*) #
Wires functionally determined by a base set B along the forward gate equations of p.
- base {σ : Signature} {n s : ℕ} {p : Program σ n s} {B : Set (Wire n s)} {w : Wire n s} : w ∈ B → p.DagSpan B w
Every wire in
Blies in the span. - gate {σ : Signature} {n s : ℕ} {p : Program σ n s} {B : Set (Wire n s)} {g : Fin s} : (∀ (a : Fin (σ.Arity (p.lines g).op)), p.DagSpan B ((p.lines g).wires a)) → p.DagSpan B (Wire.gate g)
A gate lies in the span whenever all of its argument wires do.
p.forwardDetermined W is a subset of W.
D₀(W) ⊆ D*(W): depth-one determined wires are forward-determined.
Acyclic basis reduction (DagSpan W = DagSpan (W \ D*(W))). Because p is topologically
ordered, removing all forward-determined wires from W leaves the forward DAG span unchanged.
Two inputs agreeing on B agree on every wire in p.DagSpan B.
Forward closure soundness (D*). If D ⊆ p.forwardDetermined W, trace agreement on
W \ D forces trace agreement on all of W.
Depth-one closure soundness (D₀). Trace agreement on W \ p.depthOneDetermined W forces
trace agreement on all of W.
Removing D ⊆ p.forwardDetermined W reduces the wire count by D.ncard.
Splicing and 2-SAT independent-set bounds across reduced cuts #
The set of circuit wires carried by the edges crossing a vertex cut P.
Splicing across a forward-reduced cut. If D ⊆ c.program.forwardDetermined (cutWires c P)
and x and y agree on cutWires c P \ D, then splicing x inside P with y outside P
produces outputs matching x inside P and y outside P.
Frontier edge values at layout step t are uniquely determined by the trace restricted to
cutWires c (π.initial t) \ D for any D ⊆ c.program.forwardDetermined (cutWires c (π.initial t)).
Every AND-type U₂ operation (v 0 ⊕ c₁) && (v 1 ⊕ c₂) ⊕ c₃ forbids a pair on each of its
two arguments ((c₁, !c₃) on argument 0, (c₂, !c₃) on argument 1).
Conjunction (&&) forbids (false, true) on both arguments.
Disjunction (||) forbids (true, false) on both arguments (!( !u && !w )).
Directed forbidden-pair edge between wires u and w in p: w = .gate g reads u in some
slot a whose gate operation forbids an output pair on a.
The 2-SAT clause graph on a wire set R. Two wires in R are adjacent when one is a gate
reading the other through an argument slot satisfying ForbidsOutputPair.
Trace projections on R are bounded by i(u2ClauseGraph p I R). Every edge of
u2ClauseGraph p I R forbids at least one pair of Boolean values across all program traces, so at
most (u2ClauseGraph p I R).indepSetCount distinct restrictions occur on R.
Combined D*(∂) + 2-SAT i(H) frontier state bound. Along any layout π of a Boolean
circuit c, after dropping any forward-determined wire subset
D ⊆ c.program.forwardDetermined (cutWires c (π.initial t)) (including D₀), the number of
distinct frontier states at step t across X is at most
(u2ClauseGraph c.program I (cutWires c (π.initial t) \ D)).indepSetCount.
Universal graded signature, arity excess, and fan-out slicing #
The universal graded signature on U, with an a-ary operation symbol for every a : ℕ and
every function (Fin a → U) → U.
Canonical evaluation of allOpsSignature U.
For fan-in at most r, p.arityExcess ≤ (r - 1) * p.innerGates.card.
Eliminating nullary/unary gates and deduplicating parallel gate inputs #
Currying a fixed wire across a program #
Universal fan-out slicing and multi-output surplus bounds #
Universal fan-out slicing (gateConsumers < k). Given any circuit c : Circuit σ n m of
fan-in at most r over a finite nonempty alphabet U, if the accepted set S is nonempty and
1 ≤ k, repeatedly slicing wires with gateConsumers ≥ k at their most popular value yields t
steps, a subset S' ⊆ S, and a program q : Program (allOpsSignature U) n g' with wire
constraints Acc' such that:
- every gate of
qhas arity in[2, r]and injective argument wires (c_q.innerSize = g'), - every wire
w : Wire n g'(both input and internal gate) satisfiesq.gateConsumers w < k, q.arityExcess + k * t ≤ c.program.arityExcess(withg' ≤ q.arityExcess, andg' = q.arityExcesswhenr = 2),S' = (Compiler.network (allWiresCircuit q) (allOpsInterpretation U) ...).acceptedandS.ncard ≤ Nat.card U ^ t * S'.ncard.
Fan-in-two slicing to gate fan-out ≤ 4. Specializing exists_sliced_fanout_lt to r = 2
and k = 5, every nonempty fan-in-two accepted set S admits t wire slices to a residual
strictly-binary program q of size g' where every wire (input or gate) feeds ≤ 4 gates,
g' + 5 * t ≤ c.program.arityExcess ≤ c.innerSize, and S.ncard ≤ |U| ^ t * S'.ncard.
Componentwise frontier counting on allWiresCircuit #
Asymptotic fan-out slicing surplus lower bound. Fix r ≥ 2, LayoutBound (r + 1) A with
A > 0, a dense K_n-rectangle-free family S_n ⊆ U^n, and a slicing threshold k ≥ 1. For
every ε > 0 and all large n, every circuit c of fan-in at most r deciding S_n admits a
slicing count t : ℕ (witnessing t wires of gateConsumers ≥ k sliced down to a residual
circuit where every wire has gateConsumers < k and g' + k * t ≤ c.program.arityExcess) such
that:
(1 + 1 / A - ε) * n + ((r - 1) * k - (1 + 1 / A)) * t < (r - 1) * c.program.arityExcess.
At r = 2 ((r - 1) = 1), this reads (1 + 1 / A - ε) * n + (k - (1 + 1 / A)) * t < c.program.arityExcess ≤ c.innerSize, simultaneously making unary (NOT) gates free (at t = 0 or
k large) and charging + (k - (1 + 1 / A)) gates of surplus per high-fan-out slice when
k > 1 + 1 / A.
Unconditional median-switched fan-out-≤ 4 surplus bound (L₃ ≈ 4.575972). For every
dense K_n-rectangle-free family S_n ⊆ U^n and every ε > 0, eventually every fan-in-two
circuit c deciding S_n slices (t times, killing ≥ 5 binary consumers per slice) to a
residual program q with gateConsumers ≤ 4 on every wire and
(L₃ - ε) * n + (5 - L₃) * t < c.program.arityExcess ≤ c.innerSize,
where L₃ = 1 + 2π / (3 arccos (5 / 6)) ≈ 4.575972 and 5 - L₃ > 0.424.