One common assignment of representation tags supports different group caps per query
ProvedThreeSumFuture.common_nested_representation_tags3sumalgorithmscombinatorics
Queries have finite neighborhoods in one common set A. Each query coarsens a shared label set T into its own bins, with at most a prescribed number of labels mapping to a single bin. Under the stated counting inequality, there is one assignment of labels to A for which no query puts cap or more of its neighbors in one bin. In the grouped 3SUM construction, a query uses a prefix of the tag assigned to each left operand; the same assignment serves all prefix lengths.
Preamble
module public import Mathlib.Data.Finset.Powerset public import Mathlib.Data.Fintype.Pi public import Mathlib.Data.Fintype.Card public import Mathlib.Data.Fintype.BigOperators public import Mathlib.Algebra.Order.BigOperators.Group.Finset public section open scoped BigOperators
Formal statement
theorem ThreeSumFuture.common_nested_representation_tags {A Q T : Type} [Fintype A] [Fintype Q] [Fintype T]
[DecidableEq A] (neighbors : Q → Finset A) (bins : Q → ℕ)
(label : ∀ q, T → Fin (bins q)) (width : Q → ℕ) (cap : ℕ)
(hwidth : ∀ q j, ∃ labels : Finset T, labels.card ≤ width q ∧
∀ x, label q x = j → x ∈ labels)
(hbudget : (∑ q, bins q * ((neighbors q).card.choose cap *
(width q ^ cap * Fintype.card T ^ (Fintype.card A - cap)))) <
Fintype.card T ^ Fintype.card A) :
∃ assign : A → T, ∀ q j,
((neighbors q).filter (fun a => label q (assign a) = j)).card < cap := by sorrySource
Original shared-label selection lemma for replacing the worst-fiber paired cleanup in the pooled rank-class approach to weighted-cache 3SUM.