Download PDFOpen PDF in browser

Efficient and Verified Continuous Double Auctions

13 pagesPublished: May 26, 2024


Continuous double auctions are commonly used to match orders at currency, stock, and commodities exchanges. A verified implementation of continuous double auctions is a useful tool for market regulators as they give rise to automated checkers that are guaranteed to detect errors in the trade logs of an existing exchange if they contain trades that violate the matching rules. We provide an efficient and formally verified implementation of continuous double auctions that takes O(nlogn) time to match n orders. This improves an earlier O(n2) verified implementation. We also prove a matching Ω(nlogn) lower bound on the running time for continuous double auctions. Our new implementation takes only a couple of minutes to run on ten million randomly generated orders as opposed to a few days taken by the earlier implementation. Our new implementation gives rise to an efficient automatic checker.
We use the Coq proof assistant for verifying our implementation and extracting a verified OCaml program. While using Coq’s standard library implementation of red-black trees to obtain our improvement, we observed that its specification has serious gaps, which we fill in this work; this might be of independent interest.

In: Nikolaj Bjorner, Marijn Heule and Andrei Voronkov (editors). LPAR 2024 Complementary Volume, vol 18, pages 1--13

BibTeX entry
  author    = {Mohit Garg and Suneel Sarswat},
  title     = {Efficient and Verified Continuous Double Auctions},
  booktitle = {LPAR 2024 Complementary Volume},
  editor    = {Nikolaj Bj\{\textbackslash{}o\}rner and Marijn Heule and Andrei Voronkov},
  series    = {Kalpa Publications in Computing},
  volume    = {18},
  pages     = {1--13},
  year      = {2024},
  publisher = {EasyChair},
  bibsource = {EasyChair,},
  issn      = {2515-1762},
  url       = {},
  doi       = {10.29007/92jt}}
Download PDFOpen PDF in browser