Documentation

CslibFrontier.Computability.Circuit.Prefix.ConsistentTree

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 #

Main results #

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)).

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)).

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.

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).

  • tree : ConsistentTree self.a self.b

    Underlying consistent pair of interval and prefix trees.

  • inDepth_le : self.tree.inDepth ≤ d

    Input binary tree I has depth at most d.

  • outDepth_le : self.tree.outDepth ≤ h

    Output k-ary tree Q has depth at most h.

  • Output tree Q has fanout bounded by k.

noncomputable def Cslib.Circuits.Prefix.maxConsistentWidth (k d h : ℕ) :

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)).

theorem Cslib.Circuits.Prefix.maxConsistentWidth_le_two_mul {k d : ℕ} (hk : 2 ≤ k) (hd : 1 ≤ d) (h : ℕ) :

Halving bound w_k(d, h) ≤ 2 * w_k(d - 1, h) for d ≥ 1 ([Ser25a], Eq. (7)).

theorem Cslib.Circuits.Prefix.maxConsistentWidth_eq {k d h : ℕ} (hk : 2 ≤ k) (hd : 0 < d) (hh : 0 < h) :
maxConsistentWidth k d h = ∑ i ∈ Finset.Ico 1 (min d (k - 1)), maxConsistentWidth k (d - i) (h - 1) + 2 * maxConsistentWidth k (d - min d (k - 1)) (h - 1)

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)).