Repository logo
Log in(current)
Repository logoMIT Open ScholarshipDSpace@MIT
  1. Home
  2. MIT Libraries
  3. MIT Theses
  4. Graduate Theses
  5. Program Optimization With Collection Annotations and Database-Style Term Rewriting

Program Optimization With Collection Annotations and Database-Style Term Rewriting

Thumbnail Image
Download
Name

zhang-zhangx3-sm-eecs-2026-thesis.pdf

Size

806.51 KB

Format

Adobe PDF

Checksum (MD5)

3f5e11bd9fa212fb5aae87963c073942

Author(s)
Zhang, Xin
Advisor(s)
Chlipala, Adam
Date Issued
May 2026
Publisher
Massachusetts Institute of Technology
Abstract
Since the 1970s, database engines have optimized queries by representing them in core calculi and repeatedly applying algebraic rewrite rules. Larger applications often treat database engines as important external data structures, benefiting from their internal optimizations. However, those applications are typically optimized with more conventional compiler techniques like dataflow analysis. We present here our experiences fusing application code with database logic and jointly optimizing them, now with algebraic rewrites for both, not just queries. That is, database-style data structures and algorithms are optimized with ahead-of-time knowledge of not just access patterns but also how query results are used in general-purpose code. The top new enabling idea is keeping track of contexts around queries using coercions between different consistency levels (list, bag, set). Our method is embodied in a library within the Rocq Prover, allowing rapid assembly of custom compilation pipelines with mechanized proof of correctness. We parameterized our compiler over optimization hints and conducted experiments using a range of example programs. The compiler was formally verified to produce semantically preserving pipelines when instantiated with arbitrary optimization hints. It achieved the expected asymptotic optimizations using hints generated by a large-language model, and the concrete runtime of each optimized program was comparable to that of the corresponding program written in Python with access to a SQLite database.
MIT Department
Massachusetts Institute of Technology. Department of Electrical Engineering and Computer Science
Terms of Use
In Copyright - Educational Use Permitted
https://rightsstatements.org/page/InC-EDU/1.0/
Copyright retained by author(s)
Persistent DSpace Link
https://dspace.mit.edu/handle/1721.1/177359
Repository logo
PrivacyPermissionsAccessibilityContact us
Repository logo
Notify us about copyright concerns.