Saved in:
Bibliographic Details
Main Authors: Garg, Mohit, Sarswat, Suneel
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2412.08624
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917866467491840
author Garg, Mohit
Sarswat, Suneel
author_facet Garg, Mohit
Sarswat, Suneel
contents 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(n \log n)$ time to match $n$ orders. This improves an earlier $O(n^2)$ verified implementation. We also prove a matching $Ω(n\log n)$ 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.
format Preprint
id arxiv_https___arxiv_org_abs_2412_08624
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Efficient and Verified Continuous Double Auctions
Garg, Mohit
Sarswat, Suneel
Logic in Computer Science
Trading and Market Microstructure
F.3.1; K.4.4
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(n \log n)$ time to match $n$ orders. This improves an earlier $O(n^2)$ verified implementation. We also prove a matching $Ω(n\log n)$ 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.
title Efficient and Verified Continuous Double Auctions
topic Logic in Computer Science
Trading and Market Microstructure
F.3.1; K.4.4
url https://arxiv.org/abs/2412.08624