Documentation

CslibFrontier.DataStructure.Dictionary.Minimap

Fixed-Capacity Leaf Minimap #

This file formalizes the pure fixed-capacity minimap representation of Tianxiao Li, Jingxun Liang, Huacheng Yu, and Renfei Zhou, Dynamic Dictionary with Subconstant Wasted Bits per Key ([LiLiangYuZhou2024, Section 3.4, Lemma 3.7 at r = 1, and Section 5.2]; arXiv:2310.20536v1, PDF pp. 11–12 / printed pp. 10–11 and PDF pp. 27–28 / printed pp. 26–27).

Given key-ID universe Fin U', slot capacity n' (1 ≤ n' ≤ U'), and payload universe Fin X (1 ≤ X), a minimap represents a map of m ≤ n' active keys (m = n' at fixed leaf capacity in Section 5.2) by separating metadata (header) from payload slots (slots):

  1. Each payload v < X is split via Spillover.encode n' (r_sp = n', [Patrascu2008, Lemma 3]; [LiLiangYuZhou2024, Lemma 3.8]) into a spillover value k ∈ Fin K (K = Spillover.spillUniv X n' ≤ 2 * n') and an M-bit slot word mem ∈ Fin (2 ^ M) (M = Spillover.memBits X n').
  2. The active key set S ⊆ Fin U' (S.card = m) together with the tuple of spillover values Fin m → Fin K listed in increasing order of key in S is bijected computably onto a single metadata index header : Fin (U'.choose m * K ^ m) via Cslib.BitString.subsetEquiv, finFunctionFinEquiv, and finProdFinEquiv.
  3. Under a dynamic matching scheme h : DynamicMatching.Scheme U' n' ([LiLiangYuZhou2024, Lemma 3.2]), each active key u ∈ S stores its M-bit word mem in slot matching h S hm ⟨u, hu⟩ : Fin n'.

At fixed leaf capacity m = n' (FixedEncoded U' n' X), bitWidth_le_infoBits_add_two proves that the total fixed bit budget ⌈log₂(C(U', n') * K ^ n')⌉ + n' * M exceeds the information-theoretic benchmark ⌈log₂(C(U', n') * X ^ n')⌉ by at most 2 bits, lookupHeader specifies the shared metadata-only lookup table of size U' * C(U', n') * K ^ n' ≤ U' * C(U', n') * (2 * n') ^ n' so query inspects at most one payload slot, and insert / delete / replace relocate O(T) slots (O(log (max n' 2)) in expectation under uniform permutations).

Scope note #

This module supplies the pure mathematical leaf-minimap specification for the large-parameter-regime dynamic dictionary of [LiLiangYuZhou2024, Section 5]. Word-RAM precomputed lookup-table and bit-packed M-bit slot evaluation, variable-length r > 1 outer-spillover minimaps inside adapter trees (Section 4), strong history independence, dynamic resizing, and super-polynomial key universes are not formalized here.

Main definitions #

Main results #

References #

Header bijection, bit-budget parameters, and minimap state #

def Cslib.DataStructure.Dictionary.Minimap.headerEquiv (U' m K : ℕ) :
{ S : Finset (Fin U') // S.card = m } × (Fin m → Fin K) ≃ Fin (U'.choose m * K ^ m)

Computable bijection packing an m-subset S ⊆ Fin U' and its m spillover values Fin m → Fin K (listed in increasing order of key in S) into Fin (U'.choose m * K ^ m).

Bit-budget parameters, minimap state, and shared lookup table #

@[reducible, inline]

Metadata universe size C(U', m) * K ^ m for m active keys.

Fixed bit width ⌈log₂(C(U', m) * K ^ m)⌉ of the metadata header.

Total fixed bit width ⌈log₂(C(U', n') * K ^ n')⌉ + n' * M of a full-capacity leaf minimap (Section 5.2).

Exact ceiling ⌈log₂(C(U', n') * X ^ n')⌉ of the information-theoretic leaf bit benchmark.

theorem Cslib.DataStructure.Dictionary.Minimap.bitWidth_le_infoBits_add_two {U' n' X : ℕ} (hn1 : 1 ≤ n') (hnU : n' ≤ U') (hX : 1 ≤ X) :
bitWidth U' n' X ≤ infoBits U' n' X + 2

Sharp fixed-capacity leaf bit-redundancy bound (Lemma 3.7 at r = 1 rounded to a fixed bit width in Section 5.2): bitWidth U' n' X ≤ infoBits U' n' X + 2.

theorem Cslib.DataStructure.Dictionary.Minimap.queryTableSize_le {U' n' X : ℕ} (hn1 : 1 ≤ n') :
U' * headerUniv U' n' X n' ≤ U' * U'.choose n' * (2 * n') ^ n'

Size bound on the shared metadata lookup table ([LiLiangYuZhou2024, Section 3.4, Lemma 3.7]): U' * headerUniv U' n' X n' ≤ U' * C(U', n') * (2 * n') ^ n'.

Minimap state with m active keys in Fin U', n' memory slots, and payload bound X.

  • header : Fin (headerUniv U' n' X m)

    Packed subset-plus-spillover metadata index.

  • slots : Fin n' → Fin (2 ^ Spillover.memBits X n')

    Fixed array of n' memory-word slots of Spillover.memBits X n' bits each.

def Cslib.DataStructure.Dictionary.Minimap.instDecidableEqEncoded.decEq {U'✝ n'✝ X✝ m✝ : ℕ} (x✝ x✝¹ : Encoded U'✝ n'✝ X✝ m✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]
instance Cslib.DataStructure.Dictionary.Minimap.instDecidableEqEncoded {U'✝ n'✝ X✝ m✝ : ℕ} :
DecidableEq (Encoded U'✝ n'✝ X✝ m✝)
@[reducible, inline]

Full-capacity leaf minimap (m = n', Section 5.2 of Li–Liang–Yu–Zhou 2024).

Bounded-capacity minimap (0 ≤ m ≤ n' active keys in n' slots).

  • size : Fin (n' + 1)

    Current active key count m ≤ n'.

  • encoded : Encoded U' n' X ↑self.size

    Underlying size-indexed minimap state.

def Cslib.DataStructure.Dictionary.Minimap.instDecidableEqBoundedEncoded.decEq {U'✝ n'✝ X✝ : ℕ} (x✝ x✝¹ : BoundedEncoded U'✝ n'✝ X✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]

Active key set S ⊆ Fin U' stored in e.header.

@[simp]

Shared metadata-only lookup function (Lemma 3.7 first lookup table, Section 5.6 metadata probe): given scheme h, header hdr, and queried key u, returns some (k_u, slotIdx) if u is active and matched, or none otherwise, without inspecting any payload slots.

def Cslib.DataStructure.Dictionary.Minimap.queryFin {U' n' X m : ℕ} (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') :

Look up u : Fin U' in e as an Option (Fin X), reading e.header via lookupHeader and at most one slot e.slots b.

def Cslib.DataStructure.Dictionary.Minimap.query {U' n' X m : ℕ} (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') :

Look up u : Fin U' in e as an Option ℕ (Dictionary.State U' convention).

Decode e to an abstract Dictionary.State U'.

def Cslib.DataStructure.Dictionary.Minimap.slotDiff {U' n' X m₁ m₂ : ℕ} (e₁ : Encoded U' n' X m₁) (e₂ : Encoded U' n' X m₂) :

Number of payload slots in Fin n' whose stored M-bit words differ between e₁ and e₂.

def Cslib.DataStructure.Dictionary.Minimap.WellFormed {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) :

Well-formedness of an encoded minimap state: every active key's (spillover, slot) pair lies in the valid range < X of Spillover.decodeVal.

Canonical packing, encoding, and dynamic update operations #

theorem Cslib.DataStructure.Dictionary.Minimap.queryFin_of_notMem {U' n' X m : ℕ} (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) {u : Fin U'} (hu : u ∉ activeSet e) :
def Cslib.DataStructure.Dictionary.Minimap.encode {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m) :
Encoded U' n' X m

Encode an abstract Dictionary.State U' of cardinality m ≤ n' with values < X.

Empty 0-key minimap on n' slots.

@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.activeSet_encode {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m) :
activeSet (encode hm h s hb hs) = dom s
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.query_encode {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m) (u : Fin U') :
query h (encode hm h s hb hs) u = s u
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.decode_encode {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m) :
decode h (encode hm h s hb hs) = s

Direct encoded-space updates (insert, delete, replace) #

def Cslib.DataStructure.Dictionary.Minimap.insertNew {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∉ activeSet e) :
Encoded U' n' X (m + 1)

Insert a fresh key u ∉ activeSet e with value v < X, advancing active size m to m + 1 ≤ n'.

def Cslib.DataStructure.Dictionary.Minimap.overwrite {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) :
Encoded U' n' X m

Overwrite the value of u with v < X in place when u ∈ activeSet e; an absent key u ∉ activeSet e is never inserted, leaving activeSet and all queries unchanged.

def Cslib.DataStructure.Dictionary.Minimap.deleteMem {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X (m + 1)) (u : Fin U') (hu : u ∈ activeSet e) :
Encoded U' n' X m

Delete an active key u ∈ activeSet e, reducing active size m + 1 to m.

def Cslib.DataStructure.Dictionary.Minimap.replace {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (e : FixedEncoded U' n' X) (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : x_old ∈ activeSet e) (hx_new : x_new ∉ (activeSet e).erase x_old) :
FixedEncoded U' n' X

Atomic fixed-capacity leaf key replacement (Section 5.2 leaf minimap update): removes x_old ∈ activeSet e and inserts (x_new, v_new) (x_new ∉ (activeSet e).erase x_old, covering both fresh x_new ∉ activeSet e and in-place x_new = x_old) at fixed capacity n'.

@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.activeSet_insertNew {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∉ activeSet e) :
activeSet (insertNew hm' h e u v hv hu) = insert u (activeSet e)
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.activeSet_overwrite {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) :
activeSet (overwrite hm h e u v hv) = activeSet e
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.activeSet_deleteMem {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X (m + 1)) (u : Fin U') (hu : u ∈ activeSet e) :
activeSet (deleteMem hm' h e u hu) = (activeSet e).erase u
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.activeSet_replace {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (e : FixedEncoded U' n' X) (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : x_old ∈ activeSet e) (hx_new : x_new ∉ (activeSet e).erase x_old) :
activeSet (replace h e x_old x_new v_new hv hx_old hx_new) = insert x_new ((activeSet e).erase x_old)
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.query_insertNew {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∉ activeSet e) (u' : Fin U') :
query h (insertNew hm' h e u v hv hu) u' = Function.update (query h e) u (some v) u'
theorem Cslib.DataStructure.Dictionary.Minimap.query_overwrite_of_ne {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) {u' : Fin U'} (hne : u' ≠ u) :
query h (overwrite hm h e u v hv) u' = query h e u'

Off-key lookup in overwrite is unchanged, whether or not u ∈ activeSet e.

@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.query_overwrite {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∈ activeSet e) (u' : Fin U') :
query h (overwrite hm h e u v hv) u' = Function.update (query h e) u (some v) u'
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.query_deleteMem {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X (m + 1)) (u : Fin U') (hu : u ∈ activeSet e) (u' : Fin U') :
query h (deleteMem hm' h e u hu) u' = Function.update (query h e) u none u'
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.query_replace {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (e : FixedEncoded U' n' X) (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : x_old ∈ activeSet e) (hx_new : x_new ∉ (activeSet e).erase x_old) (u' : Fin U') :
query h (replace h e x_old x_new v_new hv hx_old hx_new) u' = Function.update (Function.update (query h e) x_old none) x_new (some v_new) u'

Empty bounded-capacity minimap (0 active keys).

Encode an abstract Dictionary.State U' of size ≤ n' with values < X.

Decode b to an abstract Dictionary.State U'.

def Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.insert {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (b : BoundedEncoded U' n' X) (u : Fin U') (v : ℕ) (hv : v < X) (hcap : ↑b.size < n' ∨ u ∈ activeSet b.encoded) :

Insert or overwrite (u, v) in b (b.size.val < n' ∨ u ∈ activeSet b.encoded, v < X).

Delete u from b (no-op if u ∉ activeSet b.encoded).

@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.query_encode {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card ≤ n') (u : Fin U') :
query h (encode h s hb hs) u = s u
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.size_encode {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card ≤ n') :
↑(encode h s hb hs).size = (dom s).card
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.activeSet_insert {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (b : BoundedEncoded U' n' X) (u : Fin U') (v : ℕ) (hv : v < X) (hcap : ↑b.size < n' ∨ u ∈ activeSet b.encoded) :
theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.size_insert_of_notMem {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (b : BoundedEncoded U' n' X) (u : Fin U') (v : ℕ) (hv : v < X) (hcap : ↑b.size < n' ∨ u ∈ activeSet b.encoded) (hu : u ∉ activeSet b.encoded) :
↑(insert h b u v hv hcap).size = ↑b.size + 1
theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.size_insert_of_mem {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (b : BoundedEncoded U' n' X) (u : Fin U') (v : ℕ) (hv : v < X) (hcap : ↑b.size < n' ∨ u ∈ activeSet b.encoded) (hu : u ∈ activeSet b.encoded) :
↑(insert h b u v hv hcap).size = ↑b.size
@[simp]
theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.query_insert {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (b : BoundedEncoded U' n' X) (u : Fin U') (v : ℕ) (hv : v < X) (hcap : ↑b.size < n' ∨ u ∈ activeSet b.encoded) (u' : Fin U') :
query h (insert h b u v hv hcap) u' = Function.update (query h b) u (some v) u'
@[simp]

Canonical slot invariant, encode commutativity, and slot-relocation bounds #

Invariant stating that every slot b : Fin n' not matched to an active key holds 0. Holds automatically for empty, encode, insertNew, overwrite, deleteMem, and replace, is preserved by BoundedEncoded.delete, and holds unconditionally for every full-capacity leaf state e : FixedEncoded U' n' X (unusedSlotsZero_fixed).

theorem Cslib.DataStructure.Dictionary.Minimap.unusedSlotsZero_encode {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m) :
UnusedSlotsZero h (encode hm h s hb hs)
theorem Cslib.DataStructure.Dictionary.Minimap.unusedSlotsZero_insertNew {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∉ activeSet e) :
UnusedSlotsZero h (insertNew hm' h e u v hv hu)
theorem Cslib.DataStructure.Dictionary.Minimap.unusedSlotsZero_overwrite {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (u : Fin U') (v : ℕ) (hv : v < X) :
UnusedSlotsZero h (overwrite hm h e u v hv)
theorem Cslib.DataStructure.Dictionary.Minimap.unusedSlotsZero_deleteMem {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X (m + 1)) (u : Fin U') (hu : u ∈ activeSet e) :
UnusedSlotsZero h (deleteMem hm' h e u hu)
theorem Cslib.DataStructure.Dictionary.Minimap.unusedSlotsZero_replace {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (e : FixedEncoded U' n' X) (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : x_old ∈ activeSet e) (hx_new : x_new ∉ (activeSet e).erase x_old) :
UnusedSlotsZero h (replace h e x_old x_new v_new hv hx_old hx_new)

Every full-capacity leaf minimap e : FixedEncoded U' n' X (m = n') satisfies UnusedSlotsZero h e unconditionally because matching is a bijection onto Fin n'.

theorem Cslib.DataStructure.Dictionary.Minimap.wellFormed_iff_queryFin_isSome {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) :
WellFormed hm h e ↔ ∀ u ∈ activeSet e, (queryFin h e u).isSome = true
theorem Cslib.DataStructure.Dictionary.Minimap.wellFormed_iff_query_isSome {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) :
WellFormed hm h e ↔ ∀ u ∈ activeSet e, (query h e u).isSome = true
theorem Cslib.DataStructure.Dictionary.Minimap.wellFormed_encode {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m) :
WellFormed hm h (encode hm h s hb hs)
theorem Cslib.DataStructure.Dictionary.Minimap.wellFormed_insertNew {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') {e : Encoded U' n' X m} (hwf : WellFormed ⋯ h e) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∉ activeSet e) :
WellFormed hm' h (insertNew hm' h e u v hv hu)
theorem Cslib.DataStructure.Dictionary.Minimap.wellFormed_overwrite {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') {e : Encoded U' n' X m} (hwf : WellFormed hm h e) (u : Fin U') (v : ℕ) (hv : v < X) :
WellFormed hm h (overwrite hm h e u v hv)
theorem Cslib.DataStructure.Dictionary.Minimap.wellFormed_deleteMem {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') {e : Encoded U' n' X (m + 1)} (hwf : WellFormed hm' h e) (u : Fin U') (hu : u ∈ activeSet e) :
WellFormed ⋯ h (deleteMem hm' h e u hu)
theorem Cslib.DataStructure.Dictionary.Minimap.wellFormed_replace {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') {e : FixedEncoded U' n' X} (hwf : WellFormed ⋯ h e) (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : x_old ∈ activeSet e) (hx_new : x_new ∉ (activeSet e).erase x_old) :
WellFormed ⋯ h (replace h e x_old x_new v_new hv hx_old hx_new)
@[reducible, inline]

Well-formedness of a bounded-capacity minimap state.

theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.wellFormed_insert {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') {b : BoundedEncoded U' n' X} (hwf : WellFormed h b) (u : Fin U') (v : ℕ) (hv : v < X) (hcap : ↑b.size < n' ∨ u ∈ activeSet b.encoded) :
WellFormed h (insert h b u v hv hcap)
theorem Cslib.DataStructure.Dictionary.Minimap.BoundedEncoded.unusedSlotsZero_insert {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (b : BoundedEncoded U' n' X) (u : Fin U') (v : ℕ) (hv : v < X) (hcap : ↑b.size < n' ∨ u ∈ activeSet b.encoded) :
UnusedSlotsZero h (insert h b u v hv hcap).encoded
theorem Cslib.DataStructure.Dictionary.Minimap.eq_of_query_eq {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') {e₁ e₂ : Encoded U' n' X m} (hwf₁ : WellFormed hm h e₁) (hwf₂ : WellFormed hm h e₂) (hz₁ : UnusedSlotsZero h e₁) (hz₂ : UnusedSlotsZero h e₂) (hq : query h e₁ = query h e₂) :
e₁ = e₂

Canonical representation (history independence) of Encoded: for a fixed matching scheme h, any two well-formed minimap states with zeroed unused slots that induce the same query map are identical (header and slots agree bit-for-bit).

theorem Cslib.DataStructure.Dictionary.Minimap.eq_of_query_eq_fixed {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') {e₁ e₂ : FixedEncoded U' n' X} (hwf₁ : WellFormed ⋯ h e₁) (hwf₂ : WellFormed ⋯ h e₂) (hq : query h e₁ = query h e₂) :
e₁ = e₂

Canonicality of well-formed full-capacity leaf states FixedEncoded U' n' X (m = n'), without an explicit UnusedSlotsZero hypothesis.

theorem Cslib.DataStructure.Dictionary.Minimap.slotDiff_insertNew_le {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (hz : UnusedSlotsZero h e) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∉ activeSet e) :
slotDiff e (insertNew hm' h e u v hv hu) ≤ 4 * (DynamicMatching.rounds h (activeSet e) + 1)

Deterministic O(T) slot-relocation bound for inserting a fresh key (Lemma 3.7 and Lemma 3.2): slotDiff ≤ 4 * (rounds h (activeSet e) + 1).

theorem Cslib.DataStructure.Dictionary.Minimap.slotDiff_overwrite_le {U' n' X m : ℕ} (hm : m ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X m) (hz : UnusedSlotsZero h e) (u : Fin U') (v : ℕ) (hv : v < X) :
slotDiff e (overwrite hm h e u v hv) ≤ 2

overwrite changes at most 2 slots (at most u's matched slot when u ∈ activeSet e, and no slots when u ∉ activeSet e, since an absent key is never inserted).

theorem Cslib.DataStructure.Dictionary.Minimap.slotDiff_deleteMem_le {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (h : DynamicMatching.Scheme U' n') (e : Encoded U' n' X (m + 1)) (hz : UnusedSlotsZero h e) (u : Fin U') (hu : u ∈ activeSet e) :

Deterministic O(T) slot-relocation bound for deleting an active key: slotDiff ≤ 4 * (rounds h (activeSet e) + 1).

theorem Cslib.DataStructure.Dictionary.Minimap.slotDiff_replace_le {U' n' X : ℕ} (h : DynamicMatching.Scheme U' n') (e : FixedEncoded U' n' X) (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : x_old ∈ activeSet e) (hx_new : x_new ∉ (activeSet e).erase x_old) :
slotDiff e (replace h e x_old x_new v_new hv hx_old hx_new) ≤ 8 * DynamicMatching.rounds h (activeSet e) + 14

Deterministic O(T) slot-relocation bound for atomic leaf replacement on FixedEncoded (requires no UnusedSlotsZero hypothesis, since unusedSlotsZero_fixed holds automatically): slotDiff ≤ 8 * rounds h (activeSet e) + 14.

theorem Cslib.DataStructure.Dictionary.Minimap.expect_slotDiff_insertNew_le {U' n' X m : ℕ} (hm' : m + 1 ≤ n') {S : Finset (Fin U')} (e : DynamicMatching.Scheme U' n' → Encoded U' n' X m) (hact : ∀ (h : DynamicMatching.Scheme U' n'), activeSet (e h) = S) (hz : ∀ (h : DynamicMatching.Scheme U' n'), UnusedSlotsZero h (e h)) (u : Fin U') (v : ℕ) (hv : v < X) (hu : ∀ (h : DynamicMatching.Scheme U' n'), u ∉ activeSet (e h)) :
∑ h : DynamicMatching.Scheme U' n', ((DynamicMatching.schemePMF U' n') h).toReal * ↑(slotDiff (e h) (insertNew hm' h (e h) u v hv ⋯)) ≤ 16 * ↑(Nat.clog 2 (max n' 2))

Expected O(log (max n' 2)) slot-relocation bound for fresh-key insertion (Lemma 3.7) across any scheme-indexed family e with fixed active key set S.

theorem Cslib.DataStructure.Dictionary.Minimap.expect_slotDiff_insertNew_encode_le {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m) (u : Fin U') (v : ℕ) (hv : v < X) (hu : u ∉ dom s) :
∑ h : DynamicMatching.Scheme U' n', ((DynamicMatching.schemePMF U' n') h).toReal * ↑(slotDiff (encode ⋯ h s hb hs) (insertNew hm' h (encode ⋯ h s hb hs) u v hv ⋯)) ≤ 16 * ↑(Nat.clog 2 (max n' 2))

Expected O(log (max n' 2)) slot-relocation bound for inserting a fresh key (u, v) into the canonical encoding encode _ h s hb hs of any fixed dictionary s (Lemma 3.7).

theorem Cslib.DataStructure.Dictionary.Minimap.expect_slotDiff_deleteMem_le {U' n' X m : ℕ} (hm' : m + 1 ≤ n') {S : Finset (Fin U')} (e : DynamicMatching.Scheme U' n' → Encoded U' n' X (m + 1)) (hact : ∀ (h : DynamicMatching.Scheme U' n'), activeSet (e h) = S) (hz : ∀ (h : DynamicMatching.Scheme U' n'), UnusedSlotsZero h (e h)) (u : Fin U') (hu : ∀ (h : DynamicMatching.Scheme U' n'), u ∈ activeSet (e h)) :
∑ h : DynamicMatching.Scheme U' n', ((DynamicMatching.schemePMF U' n') h).toReal * ↑(slotDiff (e h) (deleteMem hm' h (e h) u ⋯)) ≤ 16 * ↑(Nat.clog 2 (max n' 2))

Expected O(log (max n' 2)) slot-relocation bound for active-key deletion (Lemma 3.7) across any scheme-indexed family e with fixed active key set S.

theorem Cslib.DataStructure.Dictionary.Minimap.expect_slotDiff_deleteMem_encode_le {U' n' X m : ℕ} (hm' : m + 1 ≤ n') (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = m + 1) (u : Fin U') (hu : u ∈ dom s) :
∑ h : DynamicMatching.Scheme U' n', ((DynamicMatching.schemePMF U' n') h).toReal * ↑(slotDiff (encode hm' h s hb hs) (deleteMem hm' h (encode hm' h s hb hs) u ⋯)) ≤ 16 * ↑(Nat.clog 2 (max n' 2))

Expected O(log (max n' 2)) slot-relocation bound for deleting an active key u from the canonical encoding encode hm' h s hb hs of any fixed dictionary s (Lemma 3.7).

theorem Cslib.DataStructure.Dictionary.Minimap.expect_slotDiff_replace_le {U' n' X : ℕ} {S : Finset (Fin U')} (e : DynamicMatching.Scheme U' n' → FixedEncoded U' n' X) (hact : ∀ (h : DynamicMatching.Scheme U' n'), activeSet (e h) = S) (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : ∀ (h : DynamicMatching.Scheme U' n'), x_old ∈ activeSet (e h)) (hx_new : ∀ (h : DynamicMatching.Scheme U' n'), x_new ∉ (activeSet (e h)).erase x_old) :
∑ h : DynamicMatching.Scheme U' n', ((DynamicMatching.schemePMF U' n') h).toReal * ↑(slotDiff (e h) (replace h (e h) x_old x_new v_new hv ⋯ ⋯)) ≤ 38 * ↑(Nat.clog 2 (max n' 2))

Expected O(log (max n' 2)) slot-relocation bound for atomic leaf replacement (Section 5.2) across any scheme-indexed full-capacity family e with fixed active key set S.

theorem Cslib.DataStructure.Dictionary.Minimap.expect_slotDiff_replace_encode_le {U' n' X : ℕ} (s : State U') (hb : ValuesBounded X s) (hs : (dom s).card = n') (x_old x_new : Fin U') (v_new : ℕ) (hv : v_new < X) (hx_old : x_old ∈ dom s) (hx_new : x_new ∉ (dom s).erase x_old) :
∑ h : DynamicMatching.Scheme U' n', ((DynamicMatching.schemePMF U' n') h).toReal * ↑(slotDiff (encode ⋯ h s hb hs) (replace h (encode ⋯ h s hb hs) x_old x_new v_new hv ⋯ ⋯)) ≤ 38 * ↑(Nat.clog 2 (max n' 2))

Expected O(log (max n' 2)) slot-relocation bound for atomic leaf replacement (Section 5.2) on the canonical encoding encode le_rfl h s hb hs of any fixed n'-key dictionary s.