Exact cache-miss count for a prescribed joint digit type
ProvedThreeSumFuture.fixed_joint_type_cache_miss_count3sumalgorithmscombinatorics
Fix a reference pair of words on the same finite set of coordinates. Let be the full type class of , and let contain only words of the type of . Link to when has the joint type of . Let be the number of queries linked to . For every set of stored predecessors,
In particular the identity holds for any selection of stored values, including a store with no weight threshold. When the reference pair is coordinatewise ordered, it gives the exact number of uncached predecessors in the associated joint-type layer of a convolution.
Preamble
import Mathlib.Algebra.BigOperators.Ring.Finset import Mathlib.Data.Fintype.BigOperators import Mathlib.Data.Fintype.EquivFin import Mathlib.Logic.Equiv.Basic open scoped BigOperators
Formal statement
theorem ThreeSumFuture.fixed_joint_type_cache_miss_count {I A B : Type} [Fintype I] [Fintype A] [Fintype B]
[DecidableEq A] [DecidableEq B] (q₀ : I → A) (p₀ : I → B)
(queryWords : Finset (I → A)) (predecessorWords store : Finset (I → B))
(hQuery : ∀ q, q ∈ queryWords ↔ ∀ a : A,
(Finset.univ.filter fun i => q i = a).card = (Finset.univ.filter fun i => q₀ i = a).card)
(hPred : ∀ p ∈ predecessorWords, ∀ b : B,
(Finset.univ.filter fun i => p i = b).card = (Finset.univ.filter fun i => p₀ i = b).card)
(edge : (I → A) → (I → B) → Prop) [DecidableRel edge]
(hEdge : ∀ q p, edge q p ↔ ∀ ab : A × B,
(Finset.univ.filter fun i => (q i, p i) = ab).card =
(Finset.univ.filter fun i => (q₀ i, p₀ i) = ab).card) :
(∑ q ∈ queryWords, ((predecessorWords \ store).filter fun p => edge q p).card) =
(predecessorWords \ store).card * (queryWords.filter fun q => edge q p₀).card := by sorrySource
Original counting lemma for joint-type reconstruction in 3SUM. Context: Jionghan Wang, A refined deterministic 3SUM bound with a certified weighted-cache optimization limit, PROOF.md §1–3, https://github.com/Wang-jiong-han/3sum-weighted-cache/blob/e1ae71db2231f172c6541820e2ce0a54aa14fc64/PROOF.md