Faithful Autoformalization of Natural Language Assertions

Liu, Hongyi, Parthasarathy, Madhusudan, Murali, Adithya

–arXiv.org Artificial Intelligence 

Formal specifications for modular code, in terms of contracts or postcondition assertions, have been a cornerstone in enabling robust and effective software development. Formal specifications realized as runtime checks enable testing code at the unit level, enable formal verification efforts, and enable evolution of software where modules can be swapped with others that satisfy the same specifications. The paradigm of Design by Contract [26] concretizes this approach to development of software, and several specification languages for contracts have been developed over decades, ranging from Eiffel [27], JML [22], Spec# [8], and Code Contracts [23], the latter two at Microsoft. However, despite the advantages, we have always struggled in getting programmers to write formal specifications, primarily due to it being perceived as a "burden" that slows the time to ship out software. The advent of AI opens up two avenues that transform the framework of writing code with contracts.