Indexed min-priority queue specification #
This file defines a deterministic, graph-free abstract specification
(Cslib.Algorithms.Lean.IndexedMinPQ.spec) for an indexed min-priority queue over finite handles
Fin n and natural-number keys bounded by K_max.
States map each handle v : Fin n to Option ℕ (none when absent, some k when present with
key k). To make extractMin a deterministic state transition (Cslib.Stateful.Spec.step) that
depends only on the abstract state and not on insertion history, findMin breaks equal-key ties by
choosing the smallest handle index (PrioLE). Both binary heaps and Fibonacci heaps over the word
RAM can realize this exact specification.
Main definitions #
Cslib.Algorithms.Lean.IndexedMinPQ.Op: priority-queue operations (isEmpty,getKey,insert,decreaseKey,extractMin).Cslib.Algorithms.Lean.IndexedMinPQ.State,empty,dom: abstract map state, empty queue, and present-handle set.Cslib.Algorithms.Lean.IndexedMinPQ.RawPrioLE,PrioLE,RawPrioLT,PrioLT,findMin: weak and strict lexicographic(key, handle)priority orders and deterministic minimum selection.Cslib.Algorithms.Lean.IndexedMinPQ.spec: theCslib.Stateful.Specwith key boundK_max.
Main results #
not_rawPrioLT_iff_rawPrioLE,not_prioLT_iff_prioLE,prioLT_or_prioLT_of_ne: relationship between strict and weak lexicographic priority orders.dom_empty,dom_insert,dom_decreaseKey,dom_extractMin: domain evolution under each operation.findMin_eq_none_iff,findMin_eq_some_iff,findMin_mem_dom,findMin_le,findMin_key_le: characterization and optimality offindMin.
References #
Operations on an indexed min-priority queue over handles Fin n and natural-number keys.
- isEmpty {n : ℕ} : Op n
Test whether the queue holds no handles.
- getKey {n : ℕ} (v : Fin n) : Op n
Query the current key of handle
v, if present. - insert {n : ℕ} (v : Fin n) (k : ℕ) : Op n
Insert an absent handle
vwith keyk. - decreaseKey {n : ℕ} (v : Fin n) (k : ℕ) : Op n
Lower the key of a present handle
vtok. - extractMin {n : ℕ} : Op n
Remove and return the present
(handle, key)pair of minimum(key, handle).
Instances For
Instances For
The empty priority queue on Fin n.
Instances For
Graph-free indexed min-priority queue specification with key upper bound K_max.