Dates and calendar periods (i.e., days, months, years) appear frequently in tasks involving analysis of software, data, and documents. Prior research has shown that computer logic involving dates and calendrical calculations is error-prone due to tricky rules (e.g., irregularly sized months), ambiguities (e.g., scheduling one month from "January 31st"), and edge cases (e.g., leap years). However, existing program analysis and verification tools do not provide native support for dates, making it hard to reason symbolically about calendrical arithmetic. This paper presents DateSAT, the first framework for expressing and solving satisfiability constraints involving dates and calendar periods. The paper first formalizes an input language and the semantics of date and period arithmetic. The paper then presents four strategies for solving DateSAT constraints based on reductions to SMT formulas involving integers, with mechanized proofs of their correctness, and an implementation of each using Z3 as a backend. We curate a dataset of 800 DateSAT constraints synthesized using LLM prompting, grammar-based sampling, and mining legal documents, and present an empirical evaluation of DateSAT solver performance, which shows that the encodings have complementary strengths and that routing each constraint to a suitable encoding solves more constraints than any single encoding.
翻译:暂无翻译