Consistent tree pairs, segment-width recurrences, and optimal prefix circuit synthesis #
Following Sergeev [Ser25a], decomposing a zero-deficiency fanout-k prefix circuit
along its principal chain partitions its segments into consistent pairs of a binary interval
aggregation tree I_d of depth ≤ d and a fanout-k prefix distribution tree Q_d of depth
≤ h (ConsistentTree, ConsistentChain, ConsistentTreePair).
We prove Sergeev's exact recurrence (maxConsistentWidth_eq, Claim (4)) for the maximum segment
width w_k(d, h) (maxConsistentWidth k d h) of consistent tree pairs, deduce the closed form
w_2(d, h) = 2 ^ min d h (maxConsistentWidth_two) and the order-k linear recurrence
w_k*(D) = (∑_{i=2}^{k-1} w_k*(D - i)) + 2 * w_k*(D - k) + k (maxCircuitWidthUpper_recurrence)
for w_k*(D) = ∑_{d=0}^D w_k(d, D - d) (maxCircuitWidthUpper k D), and constructively synthesize
an optimal (zero-deficiency) fanout-k universal prefix circuit of depth at most D for every
width 1 ≤ N ≤ 1 + w_k*(D - 1) (exists_optimalPrefixCircuit_of_le_maxCircuitWidthUpper).
Main definitions #
Cslib.Circuits.Prefix.ConsistentTree,Cslib.Circuits.Prefix.ConsistentChain,Cslib.Circuits.Prefix.ConsistentTreePair: consistent pairs of interval aggregation and prefix distribution trees.Cslib.Circuits.Prefix.maxConsistentWidth,Cslib.Circuits.Prefix.maxCircuitWidthUpper: maximum segment widthw_k(d, h)and circuit width sumw_k*(D).
Main results #
Cslib.Circuits.Prefix.maxConsistentWidth_eq,Cslib.Circuits.Prefix.maxConsistentWidth_two: Sergeev's Claim (4) forw_k(d, h)and closed formw_2(d, h) = 2 ^ min d h.Cslib.Circuits.Prefix.maxCircuitWidthUpper_recurrence: linear recurrencew_k*(D) = (∑_{i=2}^{k-1} w_k*(D - i)) + 2 * w_k*(D - k) + kforD ≥ k ≥ 2.Cslib.Circuits.Prefix.exists_optimalPrefixCircuit_of_le_maxCircuitWidthUpper: constructive existence of optimal fanout-kuniversal prefix circuits of depth≤ Dfor all widths1 ≤ N ≤ 1 + w_k*(D - 1).
References #
A consistent pair of interval aggregation and prefix distribution trees over [a, b) along
the left spine of an interval tree ([Sergeev2025PrefixDepth], Fig. 1 and Eq. (5)).
- leaf (a : ℕ) : ConsistentTree a (a + 1)
- buffer {a b : ℕ} (child : ConsistentTree a b) : ConsistentTree a b
- split {a m b : ℕ} (chain : ConsistentChain a m b) : ConsistentTree a b
A contiguous chain of ≥ 2 consistent tree pairs covering [a, b) along the left spine of an
interval tree ([Sergeev2025PrefixDepth], Fig. 1 and Eq. (5)).
- two {a m b : ℕ} (first : ConsistentTree a m) (second : ConsistentTree m b) : ConsistentChain a m b
- snoc {a m₁ m₂ b : ℕ} (init : ConsistentChain a m₁ m₂) (last : ConsistentTree m₂ b) : ConsistentChain a m₁ b
Depth of the binary interval aggregation tree I underlying a ConsistentTree.
Depth of the left-associated binary interval aggregation tree formed by a ConsistentChain.
Depth of the prefix distribution tree Q in a ConsistentTree.
Maximum outDepth among the children in a ConsistentChain.
Number of immediate branches in a ConsistentChain.
Fanout bound ≤ k at every node of the prefix distribution tree Q.
Fanout bound ≤ k across all subtrees in a ConsistentChain.
Every ConsistentTree a b spans a nonempty interval a < b.
A pair of consistent trees (I, Q) of input-tree depth ≤ d, output-tree depth ≤ h, and
output-tree fanout ≤ k ([Ser25a], p. 3).
- a : ℕ
Left endpoint of the input/output interval
[a, b). - b : ℕ
Right endpoint of the input/output interval
[a, b). Underlying consistent pair of interval and prefix trees.
Input binary tree
Ihas depth at mostd.Output
k-ary treeQhas depth at mosth.- fanout_le : ConsistentTree.FanoutAtMost k self.tree
Output tree
Qhas fanout bounded byk.
Width w = b - a of a ConsistentTreePair.
Maximum width w_k(d, h) of a consistent tree pair with input depth ≤ d, output depth ≤ h,
and fanout ≤ k ([Ser25a], p. 3).
Sum of maximum segment widths w_k*(D) = ∑_{d=0}^D w_k(d, D - d) ([Ser25a],
p. 3).
Closed-form recurrence helper segmentWidth and equivalence with maxConsistentWidth #
Boundary value w_k(d, 0) = 1 ([Ser25a], p. 4).
Boundary value w_k(0, h) = 1 ([Ser25a], p. 4).
Monotonicity w_k(d, h) ≤ w_k(d + 1, h) ([Ser25a], Eq. (6)).
Sergeev's Claim (4) ([Ser25a], p. 3, Eq. (4)): for d, h > 0 and
l = min d (k - 1),
w_k(d, h) = (∑_{i=1}^{l-1} w_k(d - i, h - 1)) + 2 * w_k(d - l, h - 1).
Exact closed form w_2(d, h) = 2 ^ min d h at fanout k = 2.
Sergeev's order-k linear recurrence ([Ser25a], p. 4): for k ≥ 2 and
D ≥ k, w_k*(D) = (∑_{i=2}^{k-1} w_k*(D - i)) + 2 * w_k*(D - k) + k.
Constructive compilation of optimal fanout-bounded prefix circuits #
Constructive existence of an optimal (zero-deficiency) fanout-k universal prefix circuit of
depth at most D for every width 1 ≤ N ≤ 1 + w_k*(D - 1) when k ≥ 2 and D ≥ 1
([Ser25a], p. 3, Eq. (3)).