Recursive joint-profile and marginal families with actual affine bucket filters
Definitionmme_recursive_x_hash_familiesFix a half-grade , parent triples , word lengths , and prescribed integer joint histograms . Put
Let contain the words whose joint histogram in each parent component is exactly . Let contain all words whose three coordinate histograms in each component are the marginals of . Thus includes potential competitors with other joint histograms. Write for the full first-coordinate block and .
The module defines the componentwise recursive address space, the physical coordinate blocks, the exact target and full marginal-compatible ambient families, and the embedding of all positions into the finite affine hash domain. It records both common-label retention and independent coordinate-bucket filtering. No uniformity, collision bound, or existence of an isolated family is assumed. The support and histogram predicates reuse the existing recursive split definitions.
import Definitions.Def_mme_recursive_thin_split_data
import Definitions.Def_mme_dwz_asymmetric_affine_hash
open BigOperators MME.RecursiveThinSplit
set_option autoImplicit false
namespace MME.RecursiveXHash
/-- A recursive region has one word of admissible left-half splits per parent type. -/
abbrev Address (half R : ℕ) (parent : Fin R → Fin 3 → ℕ) (n : Fin R → ℕ) :=
∀ r, Fin (n r) → Split half (parent r)
/-- The physical coordinate block, kept separately within each parent type. -/
def block {half R : ℕ} {parent : Fin R → Fin 3 → ℕ} {n : Fin R → ℕ}
(i : Fin 3) (w : Address half R parent n) : ∀ r, Fin (n r) → Fin (half + 1) :=
fun r t ↦ (w r t).val i
/-- All triples with the prescribed coordinate histograms, including competitors
whose joint profiles differ from the prescribed profiles. -/
noncomputable def ambient {half R : ℕ} {parent : Fin R → Fin 3 → ℕ}
{n : Fin R → ℕ} (m : ∀ r, Split half (parent r) → ℕ) :
Finset (Address half R parent n) := by
classical
exact Finset.univ.filter (fun w ↦ ∀ r, HasMarginalCounts (w r) (m r))
/-- The exact joint-profile triples sought inside the ambient family. -/
noncomputable def target {half R : ℕ} {parent : Fin R → Fin 3 → ℕ}
{n : Fin R → ℕ} (m : ∀ r, Split half (parent r) → ℕ) :
Finset (Address half R parent n) := by
classical
exact Finset.univ.filter (fun w ↦ ∀ r, HasJointCounts (w r) (m r))
/-- Flatten the region's positions and embed its physical grades in the prime field. -/
def fieldWord {half R N : ℕ} {parent : Fin R → Fin 3 → ℕ} {n : Fin R → ℕ}
(p : ℕ) (e : Fin (N + 1) ≃ (r : Fin R) × Fin (n r))
(i : Fin 3) (w : Address half R parent n) : Fin (N + 1) → ZMod p :=
fun t ↦ ((block i w (e t).1 (e t).2).val : ZMod p)
/-- The full ambient family retained at common affine hash labels in S.
For an AP-free S this is exactly the independent three-coordinate bucket filter. -/
noncomputable def hashed {half R N p : ℕ} {parent : Fin R → Fin 3 → ℕ}
{n : Fin R → ℕ} (m : ∀ r, Split half (parent r) → ℕ)
(e : Fin (N + 1) ≃ (r : Fin R) × Fin (n r)) (S : Finset (ZMod p))
(q : (Fin (N + 2) → ZMod p) × ZMod p) : Finset (Address half R parent n) := by
classical
exact (ambient m).filter (fun w ↦ dwzAsymmetricAffineRetains (half : ZMod p) S
(fieldWord p e 0 w) (fieldWord p e 1 w) (fieldWord p e 2 w) q)
/-- Independent coordinate-bucket filtering, the actual first zeroing step. -/
noncomputable def bucketed {half R N p : ℕ} {parent : Fin R → Fin 3 → ℕ}
{n : Fin R → ℕ} (m : ∀ r, Split half (parent r) → ℕ)
(e : Fin (N + 1) ≃ (r : Fin R) × Fin (n r)) (S : Finset (ZMod p))
(q : (Fin (N + 2) → ZMod p) × ZMod p) : Finset (Address half R parent n) := by
classical
let ω := dwzAsymmetricHashStateOfAffine q
exact (ambient m).filter (fun w ↦
dwzAsymmetricHashX ω (fieldWord p e 0 w) ∈ S ∧
dwzAsymmetricHashY ω (fieldWord p e 1 w) ∈ S ∧
dwzAsymmetricHashZ (half : ZMod p) ω (fieldWord p e 2 w) ∈ S)
end MME.RecursiveXHash