Documentation

CslibFrontier.DataStructure.Dictionary.CellProbe.MetaTree

Divisibility-Free Meta-Operation Tree, LCA Probe Attribution, and Mixed-State Replay #

This module formalizes the hierarchical meta-operation tree, lowest-common-ancestor (LCA) probe accounting, bad-cell intersection inequality, and mixed-memory interval replay used in the dynamic succinct dictionary cell-probe lower bounds of Li, Liang, Yu, and Zhou ([LLYZ23b]; locators below follow arXiv:2306.02253v3, where printed page p is PDF page p + 1).

  1. Divisibility-free bottom-up MetaTree and forest-top height adaptation: In [LLYZ23b], Section 3 (p. 11 / PDF p. 12), the authors assume m_{ℓ-1} ∣ m_ℓ for simplicity and terminate at a single root with m_h = n covering all n meta-operations (and in Section 6, p. 25 / PDF p. 26, Footnote 6, assume all parameters are integers for simplicity). Our local formalization adaptation MetaTree specifies positive even integer fanouts fanout ℓ (λ_ℓ) from the leaves up, setting blockSize 0 = 1 and blockSize (ℓ + 1) = blockSize ℓ * fanout (ℓ + 1) (m_ℓ), so blockSize ℓ ∣ blockSize (ℓ + 1) holds definitionally and 2 ∣ blockSize ℓ holds for every ℓ ≥ 1. Because exact bottom-up products need not equal horizon, MetaTree.ofFanout chooses height as the largest level with blockSize height ≤ horizon / 2 (so there is no single root covering all horizon meta-operations as in m_h = n, and each blockSize ℓ for ℓ ≤ height also fits Lemma 5.1's m < n / 2 regime up to equality). At each level ℓ, nodeCount ℓ := horizon / blockSize ℓ disjoint full intervals [b * blockSize ℓ, (b + 1) * blockSize ℓ) are packed into [0, horizon), retaining at least half of [0, horizon) (horizon ≤ 2 * (nodeCount ℓ * blockSize ℓ)) whenever blockSize ℓ ≤ horizon (any < blockSize ℓ trailing meta-operations are simply omitted from that level's full-block sum).
  2. Iterated-log and geometric schedules (iterLogMetaTree and geomMetaTree):
    • iterLogMetaTree n k c ([LLYZ23b], Section 3, p. 11 / PDF p. 12, for Theorems 1.1 and 1.3(1)): uses Nat.iterLog with even m_1 and λ_ℓ = 2 * max (2 ^ 63) (Nat.iterLog (ℓ - 1) n / (2 * Nat.iterLog ℓ n)) for ℓ ≥ 2, preserving blockSize ℓ * Nat.iterLog ℓ n = Θ(c * n * Nat.iterLog k n) across levels with 71 ≤ Nat.iterLog ℓ n without exponential rounding loss and achieving height ≥ k - O_c(1).
    • geomMetaTree n m₁_half ([LLYZ23b], Section 6, pp. 25–26 / PDF pp. 26–27, for Theorems 1.2 and 1.3(2)): uses constant even fanout λ = 2 ^ 64 above m_1 = 2 * max 1 m₁_half with n < 4 * max 1 m₁_half * (2 ^ 64) ^ height.
  3. LCA probe accounting, Eq. (5) bad-cell bound, and memory qualification: Over any step-indexed D_det : IndexedScheme Op Result cells w where meta-operation t runs stride elementary steps starting at initLen + stride * t:
    • nodeCost (cost_u, [LLYZ23b], Section 3, p. 11 / PDF p. 12) assigns s - 1 units to internal node (ℓ + 1, b) for each cell probed in s distinct child segments, telescoping across all levels to ≤ D_det.seqProbes ops (sum_nodeCost_le_seqProbes).
    • badCells (S_bad, [LLYZ23b], Section 4.2, p. 14 / PDF p. 15) collects cells probed in at least two distinct child segments, satisfying Eq. (5) ([LLYZ23b], Section 4.3, Claim 4.1, p. 17 / PDF p. 18: ∑ i, (segProbedCells ... i ∩ badCells ...).card ≤ 2 * nodeCost ...), post-memory qualification soundness (mem_badCells_of_seg_postMem_ne_node_postMem, Section 4.2, pp. 14–15 / PDF pp. 15–16 and Section 4.3, Claim 4.2, p. 17 / PDF p. 18), and its local symmetric pre-memory counterpart (mem_badCells_of_seg_preMem_ne_node_preMem).
    • mixMem wraps IndexedScheme.runInterval_eq_of_eq_on_probedCellsInterval for mixed-state segment replay C_mix ([LLYZ23b], Section 5.1, p. 22 / PDF p. 23 and Section 8, p. 29 / PDF p. 30).

Main definitions #

Main results #

References #

Divisibility-free bottom-up meta-operation tree #

Divisibility-free bottom-up meta-operation tree over horizon meta-operations ([LLYZ23b], Section 3, p. 11 / PDF p. 12 and Section 6, p. 25 / PDF p. 26).

  • horizon : ℕ

    Total number of meta-operations [0, horizon).

  • height : ℕ

    Active internal tree height (levels 1, …, height).

  • fanout : ℕ → ℕ

    Child fanout λ_ℓ at level ℓ (ℓ ≥ 1; fanout 0 is unused).

  • fanout_pos (ℓ : ℕ) : 1 ≤ ℓ → 0 < self.fanout ℓ

    Every internal level ℓ ≥ 1 has positive fanout.

  • even_fanout (ℓ : ℕ) : 1 ≤ ℓ → 2 ∣ self.fanout ℓ

    Every internal level ℓ ≥ 1 has even fanout (2 ∣ fanout ℓ).

Number of consecutive meta-operations m_ℓ represented by each level-ℓ node.

Number of disjoint full level-ℓ nodes q_ℓ = horizon / blockSize ℓ packed into [0, horizon).

Starting meta-operation index b * blockSize ℓ of node (ℓ, b).

Exclusive ending meta-operation index (b + 1) * blockSize ℓ of node (ℓ, b).

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.blockSize_dvd_of_le (T : MetaTree) {ℓ₁ ℓ₂ : ℕ} (h : ℓ₁ ≤ ℓ₂) :
T.blockSize ℓ₁ ∣ T.blockSize ℓ₂
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.child_lt_nodeCount (T : MetaTree) {ℓ b : ℕ} (hb : b < T.nodeCount (ℓ + 1)) (i : Fin (T.fanout (ℓ + 1))) :
b * T.fanout (ℓ + 1) + ↑i < T.nodeCount ℓ
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeStart_child (T : MetaTree) (ℓ b i : ℕ) :
T.nodeStart ℓ (b * T.fanout (ℓ + 1) + i) = T.nodeStart (ℓ + 1) b + i * T.blockSize ℓ
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeStop_child (T : MetaTree) (ℓ b i : ℕ) :
T.nodeStop ℓ (b * T.fanout (ℓ + 1) + i) = T.nodeStart (ℓ + 1) b + (i + 1) * T.blockSize ℓ

Divisibility-free packing lower bound: whenever blockSize ℓ ≤ horizon, full level-ℓ nodes cover at least half of [0, horizon) (horizon ≤ 2 * (nodeCount ℓ * blockSize ℓ)).

Canonical ofFanout constructor, geomMetaTree, and iterLogMetaTree #

def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.ofFanout (horizon : ℕ) (fanout : ℕ → ℕ) (hpos : ∀ (ℓ : ℕ), 1 ≤ ℓ → 0 < fanout ℓ) (heven : ∀ (ℓ : ℕ), 1 ≤ ℓ → 2 ∣ fanout ℓ) :

Build a MetaTree over horizon meta-operations from any positive even fanout, choosing height as the largest level h with blockSize h ≤ horizon / 2 (or 0 when horizon < 2). Unlike the paper's single-root convention m_h = n, stopping at horizon / 2 avoids assuming that bottom-up integer products divide horizon while ensuring at least two full blocks at level height when 2 ≤ horizon.

@[simp]
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.ofFanout_horizon (horizon : ℕ) (fanout : ℕ → ℕ) (hpos : ∀ (ℓ : ℕ), 1 ≤ ℓ → 0 < fanout ℓ) (heven : ∀ (ℓ : ℕ), 1 ≤ ℓ → 2 ∣ fanout ℓ) :
(ofFanout horizon fanout hpos heven).horizon = horizon
@[simp]
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.ofFanout_fanout (horizon : ℕ) (fanout : ℕ → ℕ) (hpos : ∀ (ℓ : ℕ), 1 ≤ ℓ → 0 < fanout ℓ) (heven : ∀ (ℓ : ℕ), 1 ≤ ℓ → 2 ∣ fanout ℓ) :
(ofFanout horizon fanout hpos heven).fanout = fanout
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.lt_blockSize_height_ofFanout_succ (horizon : ℕ) (fanout : ℕ → ℕ) (hpos : ∀ (ℓ : ℕ), 1 ≤ ℓ → 0 < fanout ℓ) (heven : ∀ (ℓ : ℕ), 1 ≤ ℓ → 2 ∣ fanout ℓ) :
have T := ofFanout horizon fanout hpos heven; horizon / 2 < T.blockSize (T.height + 1)
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.le_height_ofFanout_iff {horizon : ℕ} (hn : 2 ≤ horizon) (fanout : ℕ → ℕ) (hpos : ∀ (ℓ : ℕ), 1 ≤ ℓ → 0 < fanout ℓ) (heven : ∀ (ℓ : ℕ), 1 ≤ ℓ → 2 ∣ fanout ℓ) (ℓ : ℕ) :
have T := ofFanout horizon fanout hpos heven; ℓ ≤ T.height ↔ T.blockSize ℓ ≤ horizon / 2

Fanout schedule for geomMetaTree: fanout 1 = 2 * max 1 m₁_half and fanout ℓ = 2 ^ 64 for ℓ ≥ 2.

Geometric meta-operation tree ([LLYZ23b], Section 6, pp. 25–26 / PDF pp. 26–27, for Theorems 1.2 and 1.3(2)): blockSize 1 = 2 * max 1 m₁_half (even) and constant even fanout 2 ^ 64 at all levels ℓ ≥ 2.

theorem Cslib.DataStructure.Dictionary.CellProbe.le_height_geomMetaTree_iff {n : ℕ} (hn : 2 ≤ n) (m₁_half ℓ : ℕ) :
ℓ ≤ (geomMetaTree n m₁_half).height ↔ (geomMetaTree n m₁_half).blockSize ℓ ≤ n / 2
theorem Cslib.DataStructure.Dictionary.CellProbe.blockSize_geomMetaTree (n m₁_half : ℕ) {ℓ : ℕ} (hℓ : 1 ≤ ℓ) :
(geomMetaTree n m₁_half).blockSize ℓ = 2 * max 1 m₁_half * (2 ^ 64) ^ (ℓ - 1)
theorem Cslib.DataStructure.Dictionary.CellProbe.lt_mul_pow_height_geomMetaTree (n m₁_half : ℕ) :
n < 4 * max 1 m₁_half * (2 ^ 64) ^ (geomMetaTree n m₁_half).height

Multiplicative height lower bound for geomMetaTree: n < 4 * max 1 m₁_half * (2 ^ 64) ^ (geomMetaTree n m₁_half).height.

Logarithmic level-count lower bound for geomMetaTree.

Fanout schedule for iterLogMetaTree: fanout 1 = 2 * max 1 ((c * n * iterLog k n) / (2 * iterLog 1 n)) and fanout ℓ = 2 * max (2 ^ 63) (iterLog (ℓ - 1) n / (2 * iterLog ℓ n)) for ℓ ≥ 2.

Iterated-logarithm meta-operation tree ([LLYZ23b], Section 3, p. 11 / PDF p. 12, for Theorems 1.1 and 1.3(1)).

theorem Cslib.DataStructure.Dictionary.CellProbe.fanout_mul_iterLog_le_iterLogMetaTree (n k c : ℕ) {ℓ : ℕ} (hℓ : 2 ≤ ℓ) (hx : 71 ≤ ℓ.iterLog n) :
(iterLogMetaTree n k c).fanout ℓ * ℓ.iterLog n ≤ (ℓ - 1).iterLog n

At any level ℓ ≥ 2 with 71 ≤ Nat.iterLog ℓ n, the level-ℓ fanout of iterLogMetaTree satisfies fanout ℓ * iterLog ℓ n ≤ iterLog (ℓ - 1) n.

theorem Cslib.DataStructure.Dictionary.CellProbe.blockSize_mul_iterLog_le_iterLogMetaTree (n k c : ℕ) {ℓ : ℕ} (hℓ : 1 ≤ ℓ) (hx : 71 ≤ ℓ.iterLog n) :
(iterLogMetaTree n k c).blockSize ℓ * ℓ.iterLog n ≤ max (2 * Nat.iterLog 1 n) (c * n * k.iterLog n)

Upper bound on blockSize ℓ * iterLog ℓ n for iterLogMetaTree: for all 1 ≤ ℓ with 71 ≤ iterLog ℓ n, blockSize ℓ * iterLog ℓ n ≤ max (2 * iterLog 1 n) (c * n * iterLog k n).

Lower bound on blockSize 1 * iterLog 1 n for iterLogMetaTree when 2 ≤ n: c * n * iterLog k n ≤ blockSize 1 * iterLog 1 n + 2 * iterLog 1 n.

Telescoping ratio preservation for iterLogMetaTree: at every level 1 ≤ ℓ with 71 ≤ iterLog ℓ n, floor truncation across intermediate fanouts loses in total at most a factor of 2 (blockSize 1 * iterLog 1 n ≤ 2 * (blockSize ℓ * iterLog ℓ n)).

theorem Cslib.DataStructure.Dictionary.CellProbe.le_height_iterLogMetaTree_add {n k c : ℕ} (hn : 2 ≤ n) (hk : 1 ≤ k.iterLog n) (hc : 2 * Nat.iterLog 1 n ≤ c * n * k.iterLog n) :
k ≤ (iterLogMetaTree n k c).height + ((max 71 (4 * c * (4 * c + 71))).logStar + 2)

Height lower bound for iterLogMetaTree: whenever 2 ≤ n, 1 ≤ iterLog k n, and 2 * iterLog 1 n ≤ c * n * iterLog k n, the tree height is within an O(log* c) additive constant of k.

Step-indexed meta-operation execution and LCA probe accounting #

def Cslib.DataStructure.Dictionary.CellProbe.memAt {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (ops : List Op) (stepIdx : ℕ) :

Cell memory snapshot right after executing the first stepIdx elementary operations of ops from (0, D.init).

def Cslib.DataStructure.Dictionary.CellProbe.elemSlice {Op : Type u_1} (initLen stride : ℕ) (ops : List Op) (t₁ t₂ : ℕ) :
List Op

Elementary operation slice corresponding to meta-operation range [t₁, t₂) when initLen initial operations precede the meta-operations and each meta-operation spans stride elementary operations (stride = 3 for insertQueryDeleteDist, stride = 2 for insertDeleteDist).

def Cslib.DataStructure.Dictionary.CellProbe.rangeProbedCells {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t₁ t₂ : ℕ) :
Finset (Fin cells)

Set of distinct cells probed during meta-operation range [t₁, t₂).

def Cslib.DataStructure.Dictionary.CellProbe.rangeProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t₁ t₂ : ℕ) :

Number of cell probes executed during meta-operation range [t₁, t₂).

def Cslib.DataStructure.Dictionary.CellProbe.metaProbedCells {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t : ℕ) :
Finset (Fin cells)

Set of distinct cells probed during single meta-operation t.

def Cslib.DataStructure.Dictionary.CellProbe.metaProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t : ℕ) :

Number of cell probes executed during single meta-operation t.

@[simp]
theorem Cslib.DataStructure.Dictionary.CellProbe.rangeProbes_self {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t : ℕ) :
rangeProbes D initLen stride ops t t = 0
@[simp]
theorem Cslib.DataStructure.Dictionary.CellProbe.rangeProbedCells_self {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t : ℕ) :
rangeProbedCells D initLen stride ops t t = ∅
theorem Cslib.DataStructure.Dictionary.CellProbe.card_rangeProbedCells_le_rangeProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t₁ t₂ : ℕ) :
(rangeProbedCells D initLen stride ops t₁ t₂).card ≤ rangeProbes D initLen stride ops t₁ t₂
theorem Cslib.DataStructure.Dictionary.CellProbe.memAt_eq_runInterval_elemSlice {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) {t₁ t₂ : ℕ} (h : t₁ ≤ t₂) :
memAt D ops (initLen + stride * t₂) = (D.runInterval (initLen + stride * t₁) (memAt D ops (initLen + stride * t₁)) (elemSlice initLen stride ops t₁ t₂)).2

Running elemSlice initLen stride ops t₁ t₂ from (initLen + stride * t₁, memAt ...) reaches exact post-memory memAt D ops (initLen + stride * t₂) whenever t₁ ≤ t₂.

theorem Cslib.DataStructure.Dictionary.CellProbe.rangeProbes_append {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) {t₁ t₂ t₃ : ℕ} (h₁₂ : t₁ ≤ t₂) (h₂₃ : t₂ ≤ t₃) :
rangeProbes D initLen stride ops t₁ t₃ = rangeProbes D initLen stride ops t₁ t₂ + rangeProbes D initLen stride ops t₂ t₃

Additivity of rangeProbes across contiguous meta-operation intervals [t₁, t₂) and [t₂, t₃).

theorem Cslib.DataStructure.Dictionary.CellProbe.rangeProbedCells_append {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) {t₁ t₂ t₃ : ℕ} (h₁₂ : t₁ ≤ t₂) (h₂₃ : t₂ ≤ t₃) :
rangeProbedCells D initLen stride ops t₁ t₃ = rangeProbedCells D initLen stride ops t₁ t₂ ∪ rangeProbedCells D initLen stride ops t₂ t₃

Union law for rangeProbedCells across contiguous meta-operation intervals [t₁, t₂) and [t₂, t₃).

theorem Cslib.DataStructure.Dictionary.CellProbe.rangeProbes_le_seqProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (t₁ t₂ : ℕ) :
rangeProbes D initLen stride ops t₁ t₂ ≤ D.seqProbes ops
def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeProbedCells {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
Finset (Fin cells)

Distinct cells probed during the b-th level-ℓ node [nodeStart ℓ b, nodeStop ℓ b).

def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :

Total cell probes incurred during the b-th level-ℓ node (probe_u in [LLYZ23b], Section 3, p. 11 / PDF p. 12).

def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.segProbedCells {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (i : Fin (T.fanout (ℓ + 1))) :
Finset (Fin cells)

Distinct cells probed during the i-th child segment of internal node (ℓ + 1, b), i.e., level-ℓ node b * T.fanout (ℓ + 1) + i.1 (S_A^{[i]} in [LLYZ23b], Section 4.2, p. 14 / PDF p. 15).

def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.segProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (i : Fin (T.fanout (ℓ + 1))) :

Cell probes incurred during the i-th child segment of internal node (ℓ + 1, b).

def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.segHitCount {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (j : Fin cells) :

Number of distinct child segments of internal node (ℓ + 1, b) in which cell j is probed.

def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.badCells {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
Finset (Fin cells)

Bad cells of internal node (ℓ + 1, b) (S_bad in [LLYZ23b], Section 4.2, p. 14 / PDF p. 15): cells probed in at least two distinct child segments of (ℓ + 1, b).

def Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeCost {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :

LCA probe cost cost_u assigned to internal node (ℓ + 1, b) ([LLYZ23b], Section 3, p. 11 / PDF p. 12): a cell probed in s distinct child segments has s - 1 consecutive cross-segment re-visits whose LCA is (ℓ + 1, b).

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.mem_badCells_iff {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (j : Fin cells) :
j ∈ T.badCells D initLen stride ops ℓ b ↔ 2 ≤ T.segHitCount D initLen stride ops ℓ b j
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.mem_badCells_iff_exists_ne {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (j : Fin cells) :
j ∈ T.badCells D initLen stride ops ℓ b ↔ ∃ (i₁ : Fin (T.fanout (ℓ + 1))) (i₂ : Fin (T.fanout (ℓ + 1))), i₁ ≠ i₂ ∧ j ∈ T.segProbedCells D initLen stride ops ℓ b i₁ ∧ j ∈ T.segProbedCells D initLen stride ops ℓ b i₂

A cell belongs to badCells if and only if it is probed in two distinct child segments of (ℓ + 1, b).

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.mem_badCells_of_mem_segProbedCells_ne {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) {i₁ i₂ : Fin (T.fanout (ℓ + 1))} (hne : i₁ ≠ i₂) {j : Fin cells} (hj₁ : j ∈ T.segProbedCells D initLen stride ops ℓ b i₁) (hj₂ : j ∈ T.segProbedCells D initLen stride ops ℓ b i₂) :
j ∈ T.badCells D initLen stride ops ℓ b
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.sum_nodeProbes_le_seqProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ : ℕ) :
∑ b ∈ Finset.range (T.nodeCount ℓ), T.nodeProbes D initLen stride ops ℓ b ≤ D.seqProbes ops

Level-wise probe bound: the sum of nodeProbes across all packed nodes at any single level ℓ never exceeds D.seqProbes ops.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeProbes_succ_eq_sum_segProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
T.nodeProbes D initLen stride ops (ℓ + 1) b = ∑ i : Fin (T.fanout (ℓ + 1)), T.segProbes D initLen stride ops ℓ b i

Probes at internal node (ℓ + 1, b) decompose into the sum over its T.fanout (ℓ + 1) child segments.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeProbedCells_succ_eq_biUnion_segProbedCells {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
T.nodeProbedCells D initLen stride ops (ℓ + 1) b = Finset.univ.biUnion fun (i : Fin (T.fanout (ℓ + 1))) => T.segProbedCells D initLen stride ops ℓ b i

Probed cells at internal node (ℓ + 1, b) equal the union over its T.fanout (ℓ + 1) child segments.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.sum_card_segProbedCells_le_nodeProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
∑ i : Fin (T.fanout (ℓ + 1)), (T.segProbedCells D initLen stride ops ℓ b i).card ≤ T.nodeProbes D initLen stride ops (ℓ + 1) b
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.card_badCells_le_nodeCost {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
(T.badCells D initLen stride ops ℓ b).card ≤ T.nodeCost D initLen stride ops ℓ b
theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.sum_card_segProbedCells_inter_badCells_le_two_mul_nodeCost {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
∑ i : Fin (T.fanout (ℓ + 1)), (T.segProbedCells D initLen stride ops ℓ b i ∩ T.badCells D initLen stride ops ℓ b).card ≤ 2 * T.nodeCost D initLen stride ops ℓ b

Bad-cell intersection bound ([LLYZ23b], Section 4.3, Claim 4.1, Eq. (5), p. 17 / PDF p. 18): across all λ_{ℓ+1} child segments of internal node (ℓ + 1, b), the sum of |S_A^{[i]} ∩ S_bad| is at most 2 * nodeCost, since every cell probed in s ≥ 2 segments contributes s to the left-hand side and s - 1 ≥ s / 2 to nodeCost.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.nodeCost_add_card_nodeProbedCells {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) :
T.nodeCost D initLen stride ops ℓ b + (T.nodeProbedCells D initLen stride ops (ℓ + 1) b).card = ∑ i : Fin (T.fanout (ℓ + 1)), (T.segProbedCells D initLen stride ops ℓ b i).card

Exact per-node telescoping identity: nodeCost plus the number of distinct cells probed in (ℓ + 1, b) equals the sum of distinct cells probed across its T.fanout (ℓ + 1) children.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.sum_nodeCost_le_seqProbes_of_height {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (H : ℕ) :
∑ ℓ ∈ Finset.range H, ∑ b ∈ Finset.range (T.nodeCount (ℓ + 1)), T.nodeCost D initLen stride ops ℓ b ≤ D.seqProbes ops

Global LCA probe conservation ([LLYZ23b], Section 3, p. 11 / PDF p. 12): summing nodeCost across all packed internal nodes in the first H internal levels never exceeds D.seqProbes ops (instantiating H = T.height covers the entire MetaTree).

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.sum_nodeCost_le_seqProbes {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) :
∑ ℓ ∈ Finset.range T.height, ∑ b ∈ Finset.range (T.nodeCount (ℓ + 1)), T.nodeCost D initLen stride ops ℓ b ≤ D.seqProbes ops

Global LCA probe conservation across all active internal levels 1, …, T.height of T.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.mem_badCells_of_seg_preMem_ne_node_preMem {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (i : Fin (T.fanout (ℓ + 1))) {j : Fin cells} (hj : j ∈ T.segProbedCells D initLen stride ops ℓ b i) (hne : memAt D ops (initLen + stride * T.nodeStart ℓ (b * T.fanout (ℓ + 1) + ↑i)) j ≠ memAt D ops (initLen + stride * T.nodeStart (ℓ + 1) b) j) :
j ∈ T.badCells D initLen stride ops ℓ b

Pre-memory qualification soundness (local symmetric counterpart to post-memory qualification in [LLYZ23b], Section 4.2, pp. 14–15 / PDF pp. 15–16 and Section 4.3, Claim 4.2, p. 17 / PDF p. 18, which argues the post-memory direction): if cell j is probed during child segment i of internal node (ℓ + 1, b) and segment i's pre-memory disagrees with the node's start-of-block memory at j, then j must also have been probed in an earlier child segment i' < i, so j ∈ T.badCells D initLen stride ops ℓ b.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.card_filter_seg_preMem_ne_node_preMem_le {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (i : Fin (T.fanout (ℓ + 1))) :
{j ∈ T.segProbedCells D initLen stride ops ℓ b i | memAt D ops (initLen + stride * T.nodeStart ℓ (b * T.fanout (ℓ + 1) + ↑i)) j ≠ memAt D ops (initLen + stride * T.nodeStart (ℓ + 1) b) j}.card ≤ (T.segProbedCells D initLen stride ops ℓ b i ∩ T.badCells D initLen stride ops ℓ b).card

Corollary of mem_badCells_of_seg_preMem_ne_node_preMem (local symmetric counterpart to post-memory qualification): on child segment i, the number of probed cells whose pre-segment value differs from the start-of-node memory is at most |S_A^{[i]} ∩ S_bad|.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.mem_badCells_of_seg_postMem_ne_node_postMem {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (i : Fin (T.fanout (ℓ + 1))) {j : Fin cells} (hj : j ∈ T.segProbedCells D initLen stride ops ℓ b i) (hne : memAt D ops (initLen + stride * T.nodeStop ℓ (b * T.fanout (ℓ + 1) + ↑i)) j ≠ memAt D ops (initLen + stride * T.nodeStop (ℓ + 1) b) j) :
j ∈ T.badCells D initLen stride ops ℓ b

Post-memory qualification soundness ([LLYZ23b], Section 4.2, pp. 14–15 / PDF pp. 15–16 and Section 4.3, Claim 4.2, p. 17 / PDF p. 18): if cell j is probed during child segment i of internal node (ℓ + 1, b) and segment i's post-memory disagrees with the node's end-of-block memory at j, then j must also be probed in a later child segment i' > i, so j ∈ T.badCells D initLen stride ops ℓ b.

theorem Cslib.DataStructure.Dictionary.CellProbe.MetaTree.card_filter_seg_postMem_ne_node_postMem_le {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (T : MetaTree) (D : CellProbe.IndexedScheme Op Result cells w) (initLen stride : ℕ) (ops : List Op) (ℓ b : ℕ) (i : Fin (T.fanout (ℓ + 1))) :
{j ∈ T.segProbedCells D initLen stride ops ℓ b i | memAt D ops (initLen + stride * T.nodeStop ℓ (b * T.fanout (ℓ + 1) + ↑i)) j ≠ memAt D ops (initLen + stride * T.nodeStop (ℓ + 1) b) j}.card ≤ (T.segProbedCells D initLen stride ops ℓ b i ∩ T.badCells D initLen stride ops ℓ b).card

Corollary of mem_badCells_of_seg_postMem_ne_node_postMem: on child segment i, the number of probed cells whose post-segment value differs from the end-of-node memory is at most |S_A^{[i]} ∩ S_bad|.

Mixed memory mixMem and segment replay #

def Cslib.DataStructure.Dictionary.CellProbe.mixMem {cells w : ℕ} (m_bef m_after : CellProbe.Mem cells w) (mask : Finset (Fin cells)) :

Artificial mixed memory state C_mix ([LLYZ23b], Section 5.1, p. 22 / PDF p. 23 and Section 8, p. 29 / PDF p. 30): takes pre-segment memory m_bef on mask (S_B ⊆ mask) and post-segment memory m_after outside mask.

@[simp]
theorem Cslib.DataStructure.Dictionary.CellProbe.mixMem_of_mem {cells w : ℕ} {m_bef m_after : CellProbe.Mem cells w} {mask : Finset (Fin cells)} {j : Fin cells} (hj : j ∈ mask) :
mixMem m_bef m_after mask j = m_bef j
@[simp]
theorem Cslib.DataStructure.Dictionary.CellProbe.mixMem_of_notMem {cells w : ℕ} {m_bef m_after : CellProbe.Mem cells w} {mask : Finset (Fin cells)} {j : Fin cells} (hj : j ∉ mask) :
mixMem m_bef m_after mask j = m_after j
theorem Cslib.DataStructure.Dictionary.CellProbe.runInterval_mixMem_eq_of_probedCellsInterval_subset {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (t₀ : ℕ) (m_bef m_after : CellProbe.Mem cells w) (mask : Finset (Fin cells)) (ops_B : List Op) (hsub : D.probedCellsInterval t₀ m_bef ops_B ⊆ mask) :
(D.runInterval t₀ (mixMem m_bef m_after mask) ops_B).1 = (D.runInterval t₀ m_bef ops_B).1 ∧ D.probesInterval t₀ (mixMem m_bef m_after mask) ops_B = D.probesInterval t₀ m_bef ops_B ∧ D.probedCellsInterval t₀ (mixMem m_bef m_after mask) ops_B = D.probedCellsInterval t₀ m_bef ops_B ∧ ∀ j ∈ D.probedCellsInterval t₀ m_bef ops_B, (D.runInterval t₀ (mixMem m_bef m_after mask) ops_B).2 j = (D.runInterval t₀ m_bef ops_B).2 j

Mixed-memory interval replay: whenever D.probedCellsInterval t₀ m_bef ops_B ⊆ mask, simulating ops_B from (t₀, mixMem m_bef m_after mask) produces the exact same transcript, probe count, probed-cell set S_B, and post-memory values on S_B as simulating ops_B from (t₀, m_bef).

theorem Cslib.DataStructure.Dictionary.CellProbe.mixMem_eq_postMem_of_notMem_inter {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (D : CellProbe.IndexedScheme Op Result cells w) (t₀ : ℕ) (m_bef : CellProbe.Mem cells w) (ops_A : List Op) (mask S_B : Finset (Fin cells)) (hsep : mask ∩ D.probedCellsInterval t₀ m_bef ops_A ⊆ S_B) {j : Fin cells} (hj : j ∉ D.probedCellsInterval t₀ m_bef ops_A ∩ S_B) :
mixMem m_bef (D.runInterval t₀ m_bef ops_A).2 mask j = (D.runInterval t₀ m_bef ops_A).2 j

Non-intersection cell recovery from mixMem ([LLYZ23b], Section 5.1, p. 23 / PDF p. 24 and Section 8, p. 29 / PDF p. 30): if m_A = (D.runInterval t₀ m_bef ops_A).2 with probed-cell set S_A := D.probedCellsInterval t₀ m_bef ops_A, and mask avoids S_A \ S_B (mask ∩ S_A ⊆ S_B), then mixMem m_bef m_A mask already equals m_A at every cell outside S_A ∩ S_B.