Treesets: Efficient Finite Sets with Unique Representations

arXiv:2612.05743 · cs.LO · Submitted 2026-12-03 · Read on arXiv

cs.LO

Submitted: 2026-12-03

Updated: 2026-12-03

Comments: In Proceedings ACL2-2026, arXiv:2612.03645

Journal ref: EPTCS 459, 2026, pp. 70-87

DOI: 10.4204/EPTCS.459.6

License: http://creativecommons.org/licenses/by/4.0/

The gist: Unique representations allow ACL2 users to reason about data structures with ordinary equality rather than weaker equivalence relations.

Terminology

Abstract

Unique representations allow ACL2 users to reason about data structures with ordinary equality rather than weaker equivalence relations. The osets library uses totally ordered lists to uniquely model finite sets, but this representation results in linear time for core primitives like membership, insertion, and deletion. We present the new treeset library, an alternative representation of ordered finite sets based on hash-ordered treaps. Like osets, the data structure is purely functional with a unique representation, while achieving expected logarithmic time for the basic search and update primitives. The core operations are functionally verified and an isomorphism is established with osets. Performance is supported empirically through benchmarking. Finally, we implement and verify a bidirectional iterator over treesets based on zippers.

Related papers