Synthesizing Formal Semantics from Executable Interpreters

Jiangyi Liu, Charlie Murphy, Anvay Grover, Keith J. C. Johnson, Thomas Reps, Loris D'Antoni
{"title":"Synthesizing Formal Semantics from Executable Interpreters","authors":"Jiangyi Liu, Charlie Murphy, Anvay Grover, Keith J. C. Johnson, Thomas Reps, Loris D'Antoni","doi":"arxiv-2408.14668","DOIUrl":null,"url":null,"abstract":"Program verification and synthesis frameworks that allow one to customize the\nlanguage in which one is interested typically require the user to provide a\nformally defined semantics for the language. Because writing a formal semantics can be a daunting and error-prone task,\nthis requirement stands in the way of such frameworks being adopted by\nnon-expert users. We present an algorithm that can automatically synthesize inductively defined\nsyntax-directed semantics when given (i) a grammar describing the syntax of a\nlanguage and (ii) an executable (closed-box) interpreter for computing the\nsemantics of programs in the language of the grammar. Our algorithm synthesizes the semantics in the form of Constrained-Horn\nClauses (CHCs), a natural, extensible, and formal logical framework for\nspecifying inductively defined relations that has recently received widespread\nadoption in program verification and synthesis. The key innovation of our synthesis algorithm is a Counterexample-Guided\nSynthesis (CEGIS) approach that breaks the hard problem of synthesizing a set\nof constrained Horn clauses into small, tractable expression-synthesis problems\nthat can be dispatched to existing SyGuS synthesizers. Our tool Synantic synthesized inductively-defined formal semantics from 14\ninterpreters for languages used in program-synthesis applications. When synthesizing formal semantics for one of our benchmarks, Synantic\nunveiled an inconsistency in the semantics computed by the interpreter for a\nlanguage of regular expressions; fixing the inconsistency resulted in a more\nefficient semantics and, for some cases, in a 1.2x speedup for a synthesizer\nsolving synthesis problems over such a language.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2024-08-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2408.14668","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Program verification and synthesis frameworks that allow one to customize the language in which one is interested typically require the user to provide a formally defined semantics for the language. Because writing a formal semantics can be a daunting and error-prone task, this requirement stands in the way of such frameworks being adopted by non-expert users. We present an algorithm that can automatically synthesize inductively defined syntax-directed semantics when given (i) a grammar describing the syntax of a language and (ii) an executable (closed-box) interpreter for computing the semantics of programs in the language of the grammar. Our algorithm synthesizes the semantics in the form of Constrained-Horn Clauses (CHCs), a natural, extensible, and formal logical framework for specifying inductively defined relations that has recently received widespread adoption in program verification and synthesis. The key innovation of our synthesis algorithm is a Counterexample-Guided Synthesis (CEGIS) approach that breaks the hard problem of synthesizing a set of constrained Horn clauses into small, tractable expression-synthesis problems that can be dispatched to existing SyGuS synthesizers. Our tool Synantic synthesized inductively-defined formal semantics from 14 interpreters for languages used in program-synthesis applications. When synthesizing formal semantics for one of our benchmarks, Synantic unveiled an inconsistency in the semantics computed by the interpreter for a language of regular expressions; fixing the inconsistency resulted in a more efficient semantics and, for some cases, in a 1.2x speedup for a synthesizer solving synthesis problems over such a language.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
从可执行解释器合成形式语义
程序验证和综合框架允许用户定制自己感兴趣的语言,但通常要求用户为语言提供正式定义的语义。由于编写正式语义是一项艰巨且容易出错的任务,这一要求阻碍了此类框架被非专业用户采用。我们提出了一种算法,当给定(i)描述语言语法的语法和(ii)在语法语言中计算程序语义的可执行(封闭盒)解释器时,它可以自动合成归纳定义的语法导向语义。我们的算法以约束角式语句(CHC)的形式合成语义,这是一种自然、可扩展的正式逻辑框架,用于指定归纳定义的关系,最近在程序验证和合成中得到了广泛应用。我们的合成算法的关键创新点在于反例引导合成(Counterexample-GuidedSynthesis,CEGIS)方法,它将合成一组受限霍恩子句的难题分解成小而易懂的表达式合成问题,这些问题可以分派给现有的 SyGuS 合成器。我们的工具 Synantic 从程序合成应用中使用的 14 种语言解释器中合成了归纳定义的形式语义。在为我们的一个基准合成形式语义时,Synantic 发现解释器为正则表达式语言计算的语义存在不一致性;修正不一致性后,语义效率更高,在某些情况下,合成器解决这种语言合成问题的速度提高了 1.2 倍。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Memory Consistency and Program Transformations No Saved Kaleidosope: an 100% Jitted Neural Network Coding Language with Pythonic Syntax Towards Quantum Multiparty Session Types The Incredible Shrinking Context... in a decompiler near you Scheme Pearl: Quantum Continuations
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1