Dynamic dictionary specification with deletions and succinct space bounds #
This file defines a deterministic abstract specification
(Cslib.DataStructure.Dictionary.Dynamic.spec)
for a bounded-capacity dynamic dictionary mapping keys from a finite universe Fin U to
natural-number values bounded by V, supporting query, insert (with in-place value overwrite),
and delete, with at most n_max distinct keys present at any point in time.
Unlike the insert-only interface Cslib.DataStructure.Dictionary.spec (which provides query and
insert), Cslib.DataStructure.Dictionary.Dynamic.Op includes key deletion (delete u, removing
u if present and acting as a no-op if absent) while sharing the underlying state representation
Dictionary.State U = Fin U → Option ℕ, empty state Dictionary.empty U, active key set
Dictionary.dom, and value-bound invariant Dictionary.ValuesBounded. When U ≤ n_max, the
capacity condition (dom s).card < n_max ∨ (s u).isSome holds automatically for every state s
and key u, so spec U V n_max also covers unbounded-capacity dynamic dictionaries over Fin U
(valid_insert_iff_of_le).
This file also defines the information-theoretic bit bound
optBits U V n = ⌈log₂ C(U, n)⌉ + n * ⌈log₂ V⌉ for n keys. When 0 < V and n ≤ U,
optBits U V n equals the exact minimum ⌈log₂ (C(U, n) * V^n)⌉ when V is a power of two and
exceeds it by at most n bits otherwise. When n > U, C(U, n) = 0; when V = 0, there are no
valued non-empty dictionaries. From optBits, succinctWords C C₀ U V w n_max defines the word
bound ⌈(optBits U V n_max + C * n_max * ⌈log₂ ⌈log₂ (max n_max 4)⌉⌉) / w⌉ + C₀ on the w-bit
Word RAM.
Main definitions #
Cslib.DataStructure.Dictionary.Dynamic.Op: dynamic dictionary operations (query,insert,delete).Cslib.DataStructure.Dictionary.Dynamic.step,valid,spec: pure transition function, admissibility predicate, andStateTransitionSpecfor bounded-capacity dynamic dictionaries.Cslib.DataStructure.Dictionary.Dynamic.optBits,logLogFactor,succinctWords: information-theoretic bit bound and succinct Word-RAM space bound.
Main results #
dom_delete,dom_delete_of_notMem,dom_delete_of_eq_none,card_dom_delete_le,card_dom_delete_eq_of_isSome,card_dom_delete_eq_of_eq_none: domain and cardinality laws under key deletion.card_dom_le_univ,valid_insert_iff_of_le: every state has at mostUpresent keys, so any capacity boundn_max ≥ Uimposes no capacity restriction on insertions.card_dom_step_le_of_valid,card_dom_run_le_of_validHistory,card_dom_run_empty_le: any admissible operation history starting fromempty Umaintains(dom s).card ≤ n_max.valuesBounded_delete,valuesBounded_step_of_valid,valuesBounded_run_of_validHistory,valuesBounded_run_empty: any admissible operation history maintainsValuesBounded V s.optBits_zero_right,one_le_logLogFactor,logLogFactor_mono: basic properties of the succinct space-bound quantities.
References #
Lookup, insertion (with in-place value overwrite), and deletion operations on a dynamic
dictionary over keys Fin U and natural-number values.
- query {U : ℕ} (u : Fin U) : Op U
Look up the value associated with key
u, returningsome vif present with valuevornoneif absent. - insert {U : ℕ} (u : Fin U) (v : ℕ) : Op U
Associate key
uwith valuev, insertinguif absent or overwriting its existing value in place if present. - delete {U : ℕ} (u : Fin U) : Op U
Remove key
ufrom the dictionary if present, or leave the dictionary unchanged ifuis absent.
Instances For
Admissibility precondition for bounded-capacity dynamic dictionary operations:
query and delete are always admissible; insert u v is admissible whenever v < V and
either (dom s).card < n_max or u is already present in s ((s u).isSome, in which case
updating s u overwrites its value in place without increasing (dom s).card).
Bounded-capacity dynamic dictionary specification over key universe Fin U, value bound V,
and maximum key count n_max.
Domain, deletion, capacity, and value-bound lemmas #
When U ≤ n_max, every key insertion into s : State U satisfies the capacity condition
(dom s).card < n_max ∨ (s u).isSome automatically, so insertion admissibility reduces to
v < V.
Any admissible dynamic dictionary operation history preserves (dom s).card ≤ n_max.
Any admissible dynamic dictionary operation history starting from empty U reaches a state
with at most n_max keys.
Deleting a key u preserves ValuesBounded V.
Any single admissible dynamic dictionary operation preserves ValuesBounded V.
Any admissible dynamic dictionary operation history preserves ValuesBounded V.
Any admissible dynamic dictionary operation history starting from empty U reaches a state
satisfying ValuesBounded V.
Information-theoretic minimum bits and succinct word bounds #
Information-theoretic bit bound OPT(U, V, n) = ⌈log₂ C(U, n)⌉ + n * ⌈log₂ V⌉
for representing n keys in Fin U with values in Fin V. When 0 < V and n ≤ U, this equals
the exact minimum ⌈log₂ (C(U, n) * V^n)⌉ when V is a power of two and exceeds it by at most n
bits otherwise. When n > U, U.choose n = 0; when V = 0, there are no valued non-empty
dictionaries.
Iterated logarithmic factor ⌈log₂ ⌈log₂ (max n 4)⌉⌉ ≥ 1.
Succinct space bound ⌈(OPT(U, V, n_max) + C * n_max * ⌈log₂ ⌈log₂ (max n_max 4)⌉⌉) / w⌉ + C₀
in w-bit machine words.
For every n : ℕ, 1 ≤ logLogFactor n.
logLogFactor is monotone.
Scaling bound for Dynamic.logLogFactor under 2x epoch size expansion.
Quadrupling n increases logLogFactor by at most 2.
Quadrupling n increases logLogFactor by at most a factor of 4.