Order Maintenance in Worst-Case Constant Time, Verified
Abstract
Order maintenance asks for a data structure that keeps a sequence of elements under insertions and deletions and tells which of two elements comes first. We give an algorithm, assembled from published components, that performs each operation in worst-case constant time, and verify it in Lean 4. The algorithm is a program for a random-access machine deeply embedded in Lean, whose interpreter counts every instruction. We prove that the program answers every query as a simple reference specification does, that each operation takes at most a fixed number of steps, independent of the number of elements and of the history, and that after operations no value it has computed has more than bits, so it runs unchanged on a machine with words of that size. A verified translation that preserves step counts exactly connects the high-level proofs to the machine program, so the interpreter is the only cost model to trust. An unverified native implementation shows the algorithm's practical cost.
Create a lesson
Metadata
- Categories
- cs.LO, cs.DS
Related papers
TPTL-dist: A Formalised Calculus with Proof Automation for Verifying Real-Time Distributed Systems
Shared title terminologycs.LOJavier Enríquez Mendoza, Sam Speight, Vincent Rahli
CrossCheck II: A Compiler Plugin for Certified Cost Bounds of Real-Time C and C++ Code, and its Evaluation
Shared title terminologycs.LOLuca Dall'Olio
CrossCheck I: Cost Bounds of Imperative Programs as Constrained Optimization, with a Sound Cost Logic and a Verified Certificate Checker
Shared title terminologycs.LOLuca Dall'Olio
Probabilistic Timed Automata with Multiple Sure and Threshold Objectives
Shared title terminologycs.LOJeremy Sproston
Hereditary permutations for simple types revisited: A baby case for University Algebra
Shared title terminologycs.LOThorsten Altenkirch
On the monitorability of linear-time timed logics
Shared title terminologycs.LOMouloud Amara, Mohammed Aristide Foughali, Giovanni Bernardi et al.