Skip to main content
preprint

MathDSL: A Domain-Specific Language for Concise Mathematical Solutions Via Program Synthesis

arXiv preprint arXiv:2409.17490, 2024

MathDSL explainer shared by Dr. Costilla Reyes in August 2025, introducing the program-synthesis approach to equation solving.
Figure from the paper showing how the neurosymbolic programming (NP) lifecycle feeds into and draws on the scientific process, from choosing a research question to reporting to the community, shared with the paper announcement. Related photograph from Neurosymbolic programming for science. Credit: Image courtesy of Dr. Omar Costilla Reyes.

Research summary

MathDSL is a domain-specific language that lets the DreamCoder program-synthesis system write short, readable equation-solving programs. It is a 2024 arXiv paper led by Sagnik Anupam.

A language for solving equations with programs

Posted to arXiv on September 26, 2024, by Sagnik Anupam, Maddy Bowers, Omar Costilla-Reyes, and Armando Solar-Lezama, MathDSL gives the DreamCoder program-synthesis system a domain-specific vocabulary for mathematical problem solving. The research was led by Anupam while an undergraduate at MIT; he had worked with Dr. Costilla Reyes as a SuperUROP student and presented an earlier version of the project, “Neurosymbolic Reasoning for Mathematical Domains,” at MIT in December 2022.

Program synthesis is the practice of having a computer write programs that meet a goal, and DreamCoder is a system that does this while learning reusable functions from the programs it finds. A domain-specific language (DSL) is a small, purpose-built set of operations. In MathDSL, a solution to an equation is a short program made of algebra operations, so each answer can be read and checked one step at a time.

What the paper reports

In experiments on linear equations, the authors report that DreamCoder using MathDSL improves accuracy and conciseness over the reinforcement-learning methods evaluated in the paper, including when earlier reinforcement-learning action spaces are used as DSLs. They also introduce a quantitative measure of how concise a solution is, and show that the strategies DreamCoder learns can be converted into human-readable solution strategies, which the authors note could be useful in mathematics education. Together these results show that a domain-specific language lets program synthesis produce shorter, readable solutions to linear equations.

Explainer and related work

In August 2025 Dr. Costilla Reyes shared an explanatory video about the research, describing the result as state-of-the-art test accuracy and solutions more concise than popular AI baselines, with far less training data. He framed the work as a response to the observation that today’s AI still fails at basic mathematics: teaching a system to solve equations by writing small, human-readable programs gives each solution a form that can be verified step by step. MathDSL is related to LEMMA, which learns higher-level symbolic actions for equation solving, and to the broader Neurosymbolic Programming for Science agenda he coordinated at MIT CSAIL.

Publication details

Authors
Sagnik Anupam, Maddy Bowers, Omar Costilla-Reyes, Armando Solar-Lezama
Venue
arXiv preprint arXiv:2409.17490
Year
2024

BibTeX citation

@misc{costilla2024mathdsladomain,
  title = {MathDSL: A Domain-Specific Language for Concise Mathematical Solutions Via Program Synthesis},
  author = {Sagnik Anupam and Maddy Bowers and Omar Costilla-Reyes and Armando Solar-Lezama},
  year = {2024},
  
  archivePrefix = {arXiv},
  eprint = {2409.17490},
  doi = {10.48550/arXiv.2409.17490},
}

Topics