首页 > 最新文献

arXiv - CS - Programming Languages最新文献

英文 中文
Six Ways to Implement Divisibility by Three in miniKanren 在 miniKanren 中实现三除法的六种方法
Pub Date : 2024-08-29 DOI: arxiv-2408.16259
Brett Schreiber, Brysen Pfingsten, Jason Hemann
This paper explores options for implementing the relation $n equiv 0 (text{mod} 3)$ within miniKanren using miniKanren numbers and its arithmeticsuite. We examine different approaches starting from straightforwardimplementations to more optimized versions. The implementations discussedinclude brute-force arithmetic methods, divisibility tricks, and derivationfrom a finite automaton. Our contributions include an in-depth look at theprocess of implementing a miniKanren relation and observations on benchmarkingtexttt{defrel}s. This study aims to provide practical insights for miniKanrenprogrammers on both performance and implementation techniques.
本文探讨了在 miniKanren 中使用 miniKanren 数字及其算术套件实现关系式 $n equiv 0 (text{mod} 3)$ 的方案。我们研究了从直接实现到更优化版本的不同方法。讨论的实现方法包括暴力算术法、可分性技巧以及从有限自动机推导。我们的贡献包括深入探讨了迷你坎伦关系的实现过程,以及对基准文本的观察。本研究旨在为迷你坎仁函数编程人员提供性能和实现技术方面的实用见解。
{"title":"Six Ways to Implement Divisibility by Three in miniKanren","authors":"Brett Schreiber, Brysen Pfingsten, Jason Hemann","doi":"arxiv-2408.16259","DOIUrl":"https://doi.org/arxiv-2408.16259","url":null,"abstract":"This paper explores options for implementing the relation $n equiv 0 \u0000(text{mod} 3)$ within miniKanren using miniKanren numbers and its arithmetic\u0000suite. We examine different approaches starting from straightforward\u0000implementations to more optimized versions. The implementations discussed\u0000include brute-force arithmetic methods, divisibility tricks, and derivation\u0000from a finite automaton. Our contributions include an in-depth look at the\u0000process of implementing a miniKanren relation and observations on benchmarking\u0000texttt{defrel}s. This study aims to provide practical insights for miniKanren\u0000programmers on both performance and implementation techniques.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-29","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142179553","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Omega: The Power of Visual Simplicity 欧米茄:视觉简约的力量
Pub Date : 2024-08-28 DOI: arxiv-2408.15631
Benoit SonntagLSIIT, Dominique ColnetKIWI
We are currently developing an innovative and visually-driven programminglanguage called Omega.Although the Omega code is stored in text files, thesefiles are not intended for manual editing or traditional printing.Furthermore,parsing these files using a context-free grammar is not possible.The parsing ofthe code and the facilitation of user-friendly manual editing both necessitatea global knowledge of the codebase.Strictly speaking, code visualization is notan integral part of the Omega language; instead, this task is delegated to theediting tools.Thanks to the global knowledge of the code, the editing processbecomes remarkably straightforward, with numerous automatic completion featuresthat enhance usability.Omega leverages a visual-oriented approach to encompassall fundamental aspects of software engineering.It offers robust features,including safe static typing, design by contracts, rules for accessing slots,operator definitions, and more,all presented in an intuitively and visuallycomprehensible manner, eliminating the need for obscure syntax.
虽然 Omega 代码存储在文本文件中,但这些文件并不用于手动编辑或传统的打印,此外,使用无上下文语法来解析这些文件也是不可能的。严格来说,代码可视化并不是 Omega 语言的组成部分;相反,这项任务被委托给了编辑工具。Omega 利用面向视觉的方法涵盖了软件工程的所有基本方面。它提供了强大的功能,包括安全静态类型、合约设计、访问插槽的规则、运算符定义等,所有这些都以直观、可视化的方式呈现,无需使用晦涩难懂的语法。
{"title":"Omega: The Power of Visual Simplicity","authors":"Benoit SonntagLSIIT, Dominique ColnetKIWI","doi":"arxiv-2408.15631","DOIUrl":"https://doi.org/arxiv-2408.15631","url":null,"abstract":"We are currently developing an innovative and visually-driven programming\u0000language called Omega.Although the Omega code is stored in text files, these\u0000files are not intended for manual editing or traditional printing.Furthermore,\u0000parsing these files using a context-free grammar is not possible.The parsing of\u0000the code and the facilitation of user-friendly manual editing both necessitate\u0000a global knowledge of the codebase.Strictly speaking, code visualization is not\u0000an integral part of the Omega language; instead, this task is delegated to the\u0000editing tools.Thanks to the global knowledge of the code, the editing process\u0000becomes remarkably straightforward, with numerous automatic completion features\u0000that enhance usability.Omega leverages a visual-oriented approach to encompass\u0000all fundamental aspects of software engineering.It offers robust features,\u0000including safe static typing, design by contracts, rules for accessing slots,\u0000operator definitions, and more,all presented in an intuitively and visually\u0000comprehensible manner, eliminating the need for obscure syntax.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-28","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142223613","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Verifying Solutions to Semantics-Guided Synthesis Problems 验证语义引导合成问题的解决方案
Pub Date : 2024-08-28 DOI: arxiv-2408.15475
Charlie Murphy, Keith Johnson, Thomas Reps, Loris D'Antoni
Semantics-Guided Synthesis (SemGuS) provides a framework to specify synthesisproblems in a solver-agnostic and domain-agnostic way, by allowing a user toprovide both the syntax and semantics of the language in which the desiredprogram should be synthesized. Because synthesis and verification are closelyintertwined, the SemGuS framework raises the problem of how to verify programsin a solver and domain-agnostic way. We prove that the problem of verifying whether a program is a valid solutionto a SemGuS problem can be reduced to proving validity of a query in the `CLPcalculus, a fixed-point logic that generalizes Constrained Horn Clauses andco-Constrained Horn Clauses. Our encoding into `CLP allows us to furtherclassify the SemGuS verification problems into ones that are reducible tovalidity of (i) first-order-logic formulas, (ii) Constrained Horn Clauses,(iii) co-Constrained Horn Clauses, and (iv) `CLP queries. Furthermore, ourencoding shines light on some limitations of the SemGuS framework, such as itsinability to model nondeterminism and reactive synthesis. We thus propose amodification to SemGuS that makes it more expressive, and for which verifyingsolutions is exactly equivalent to proving validity of a query in the `CLPcalculus. Our implementation of SemGuS verifiers based on the above encodingcan verify instances that were not even encodable in previous work.Furthermore, we use our SemGuS verifiers within an enumeration-based SemGuSsolver to correctly synthesize solutions to SemGuS problems that no previousSemGuS synthesizer could solve.
语义指导合成(Semantics-Guided Synthesis,SemGuS)提供了一种框架,允许用户同时提供合成所需程序的语言的语法和语义,从而以与求解器和领域无关的方式指定合成问题。由于综合与验证紧密相连,SemGuS 框架提出了如何以与求解器和领域无关的方式验证程序的问题。我们证明,验证程序是否是SemGuS问题的有效解决方案的问题可以简化为证明`CLP微积分(Constrained Horn Clauses andco-Constrained Horn Clauses)中查询的有效性。我们对 "CLP "的编码使我们能够将SemGuS验证问题进一步分类为可还原为以下几种有效性的问题:(1)一阶逻辑公式;(2)约束Horn子句;(3)共约束Horn子句;以及(4)"CLP "查询。此外,我们的编码还揭示了SemGuS框架的一些局限性,比如它无法模拟非确定性和反应式合成。因此,我们提出了对SemGuS的修改,使其更具表现力,对它来说,验证解决方案完全等同于证明CLP微积分中查询的有效性。此外,我们在基于枚举的SemGuS求解器(SemGuSsolver)中使用我们的SemGuS验证器,正确地合成出以前的SemGuS合成器无法解决的SemGuS问题的解决方案。
{"title":"Verifying Solutions to Semantics-Guided Synthesis Problems","authors":"Charlie Murphy, Keith Johnson, Thomas Reps, Loris D'Antoni","doi":"arxiv-2408.15475","DOIUrl":"https://doi.org/arxiv-2408.15475","url":null,"abstract":"Semantics-Guided Synthesis (SemGuS) provides a framework to specify synthesis\u0000problems in a solver-agnostic and domain-agnostic way, by allowing a user to\u0000provide both the syntax and semantics of the language in which the desired\u0000program should be synthesized. Because synthesis and verification are closely\u0000intertwined, the SemGuS framework raises the problem of how to verify programs\u0000in a solver and domain-agnostic way. We prove that the problem of verifying whether a program is a valid solution\u0000to a SemGuS problem can be reduced to proving validity of a query in the `CLP\u0000calculus, a fixed-point logic that generalizes Constrained Horn Clauses and\u0000co-Constrained Horn Clauses. Our encoding into `CLP allows us to further\u0000classify the SemGuS verification problems into ones that are reducible to\u0000validity of (i) first-order-logic formulas, (ii) Constrained Horn Clauses,\u0000(iii) co-Constrained Horn Clauses, and (iv) `CLP queries. Furthermore, our\u0000encoding shines light on some limitations of the SemGuS framework, such as its\u0000inability to model nondeterminism and reactive synthesis. We thus propose a\u0000modification to SemGuS that makes it more expressive, and for which verifying\u0000solutions is exactly equivalent to proving validity of a query in the `CLP\u0000calculus. Our implementation of SemGuS verifiers based on the above encoding\u0000can verify instances that were not even encodable in previous work.\u0000Furthermore, we use our SemGuS verifiers within an enumeration-based SemGuS\u0000solver to correctly synthesize solutions to SemGuS problems that no previous\u0000SemGuS synthesizer could solve.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-28","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142179554","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Automating Pruning in Top-Down Enumeration for Program Synthesis Problems with Monotonic Semantics 在单调语义的程序合成问题自顶向下枚举中自动剪枝
Pub Date : 2024-08-28 DOI: arxiv-2408.15822
Keith J. C. Johnson, Rahul Krishnan, Thomas Reps, Loris D'Antoni
In top-down enumeration for program synthesis, abstraction-based pruning usesan abstract domain to approximate the set of possible values that a partialprogram, when completed, can output on a given input. If the set does notcontain the desired output, the partial program and all its possiblecompletions can be pruned. In its general form, abstraction-based pruningrequires manually designed, domain-specific abstract domains and semantics, andthus has only been used in domain-specific synthesizers. This paper provides sufficient conditions under which a form ofabstraction-based pruning can be automated for arbitrary synthesis problems inthe general-purpose Semantics-Guided Synthesis (SemGuS) framework withoutrequiring manually-defined abstract domains. We show that if the semantics ofthe language for which we are synthesizing programs exhibits some monotonicityproperties, one can obtain an abstract interval-based semantics for free fromthe concrete semantics of the programming language, and use such semantics toeffectively prune the search space. We also identify a condition that ensuressuch abstract semantics can be used to compute a precise abstraction of the setof values that a program derivable from a given hole in a partial program canproduce. These precise abstractions make abstraction-based pruning moreeffective. We implement our approach in a tool, Moito, which can tackle synthesisproblems defined in the SemGuS framework. Moito can automate interval-basedpruning without any a-priori knowledge of the problem domain, and solvesynthesis problems that previously required domain-specific, abstraction-basedsynthesizers -- e.g., synthesis of regular expressions, CSV file schema, andimperative programs from examples.
在用于程序综合的自顶向下枚举中,基于抽象的剪枝使用一个抽象域来近似估计部分程序在完成后可在给定输入上输出的可能值集合。如果该集合不包含所需的输出,则可以剪枝该部分程序及其所有可能的完成。一般来说,基于抽象的剪枝需要人工设计特定领域的抽象域和语义,因此只在特定领域的合成器中使用过。本文提供了充分条件,在这些条件下,通用语义引导合成(Semantics-Guided Synthesis,SemGuS)框架中的任意合成问题都可以自动实现基于抽象的剪枝,而无需人工定义抽象域。我们的研究表明,如果我们正在合成程序的语言的语义表现出某些单调性特性,我们就可以从编程语言的具体语义中免费获得基于区间的抽象语义,并利用这种语义有效地剪裁搜索空间。我们还确定了一个条件,确保抽象语义可用于计算部分程序中给定洞可派生程序所能产生的值集的精确抽象。这些精确的抽象使得基于抽象的剪枝更加有效。我们在工具 Moito 中实现了我们的方法,它可以处理 SemGuS 框架中定义的综合问题。Moito 可以自动进行基于区间的剪枝,而不需要任何关于问题领域的先验知识,并且可以解决以前需要特定领域、基于抽象的合成器才能解决的合成问题--例如,正则表达式、CSV 文件模式和示例中的交互式程序的合成。
{"title":"Automating Pruning in Top-Down Enumeration for Program Synthesis Problems with Monotonic Semantics","authors":"Keith J. C. Johnson, Rahul Krishnan, Thomas Reps, Loris D'Antoni","doi":"arxiv-2408.15822","DOIUrl":"https://doi.org/arxiv-2408.15822","url":null,"abstract":"In top-down enumeration for program synthesis, abstraction-based pruning uses\u0000an abstract domain to approximate the set of possible values that a partial\u0000program, when completed, can output on a given input. If the set does not\u0000contain the desired output, the partial program and all its possible\u0000completions can be pruned. In its general form, abstraction-based pruning\u0000requires manually designed, domain-specific abstract domains and semantics, and\u0000thus has only been used in domain-specific synthesizers. This paper provides sufficient conditions under which a form of\u0000abstraction-based pruning can be automated for arbitrary synthesis problems in\u0000the general-purpose Semantics-Guided Synthesis (SemGuS) framework without\u0000requiring manually-defined abstract domains. We show that if the semantics of\u0000the language for which we are synthesizing programs exhibits some monotonicity\u0000properties, one can obtain an abstract interval-based semantics for free from\u0000the concrete semantics of the programming language, and use such semantics to\u0000effectively prune the search space. We also identify a condition that ensures\u0000such abstract semantics can be used to compute a precise abstraction of the set\u0000of values that a program derivable from a given hole in a partial program can\u0000produce. These precise abstractions make abstraction-based pruning more\u0000effective. We implement our approach in a tool, Moito, which can tackle synthesis\u0000problems defined in the SemGuS framework. Moito can automate interval-based\u0000pruning without any a-priori knowledge of the problem domain, and solve\u0000synthesis problems that previously required domain-specific, abstraction-based\u0000synthesizers -- e.g., synthesis of regular expressions, CSV file schema, and\u0000imperative programs from examples.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-28","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142179555","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Galley: Modern Query Optimization for Sparse Tensor Programs Galley:稀疏张量程序的现代查询优化
Pub Date : 2024-08-27 DOI: arxiv-2408.14706
Kyle Deeds, Willow Ahrens, Magda Balazinska, Dan Suciu
The tensor programming abstraction has become the key . This framework allowsusers to write high performance programs for bulk computation via a high-levelimperative interface. Recent work has extended this paradigm to sparse tensors(i.e. tensors where most entries are not explicitly represented) with the useof sparse tensor compilers. These systems excel at producing efficient code forcomputation over sparse tensors, which may be stored in a wide variety offormats. However, they require the user to manually choose the order ofoperations and the data formats at every step. Unfortunately, these decisionsare both highly impactful and complicated, requiring significant effort tomanually optimize. In this work, we present Galley, a system for declarativesparse tensor programming. Galley performs cost-based optimization to lowerthese programs to a logical plan then to a physical plan. It then leveragessparse tensor compilers to execute the physical plan efficiently. We show thatGalley achieves high performance on a wide variety of problems includingmachine learning algorithms, subgraph counting, and iterative graph algorithms.
张量编程抽象已成为.NET技术的关键。这一框架允许用户通过高级操作界面编写用于批量计算的高性能程序。最近的研究利用稀疏张量编译器将这一范式扩展到了稀疏张量(即大部分条目没有明确表示的张量)。这些系统擅长为稀疏张量的计算生成高效代码,稀疏张量可以以多种格式存储。然而,它们要求用户在每一步都手动选择操作顺序和数据格式。遗憾的是,这些决定既影响大又复杂,需要花费大量精力手动优化。在这项工作中,我们提出了一个用于声明解析张量编程的系统 Galley。Galley 执行基于成本的优化,将这些程序降低为逻辑计划,然后再降低为物理计划。然后,它利用稀疏张量编译器高效执行物理计划。我们的研究表明,Galley 在包括机器学习算法、子图计数和迭代图算法在内的各种问题上都取得了很高的性能。
{"title":"Galley: Modern Query Optimization for Sparse Tensor Programs","authors":"Kyle Deeds, Willow Ahrens, Magda Balazinska, Dan Suciu","doi":"arxiv-2408.14706","DOIUrl":"https://doi.org/arxiv-2408.14706","url":null,"abstract":"The tensor programming abstraction has become the key . This framework allows\u0000users to write high performance programs for bulk computation via a high-level\u0000imperative interface. Recent work has extended this paradigm to sparse tensors\u0000(i.e. tensors where most entries are not explicitly represented) with the use\u0000of sparse tensor compilers. These systems excel at producing efficient code for\u0000computation over sparse tensors, which may be stored in a wide variety of\u0000formats. However, they require the user to manually choose the order of\u0000operations and the data formats at every step. Unfortunately, these decisions\u0000are both highly impactful and complicated, requiring significant effort to\u0000manually optimize. In this work, we present Galley, a system for declarative\u0000sparse tensor programming. Galley performs cost-based optimization to lower\u0000these programs to a logical plan then to a physical plan. It then leverages\u0000sparse tensor compilers to execute the physical plan efficiently. We show that\u0000Galley achieves high performance on a wide variety of problems including\u0000machine learning algorithms, subgraph counting, and iterative graph algorithms.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142179557","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Generation of Compiler Backends from Formal Models of Hardware 从硬件的形式化模型生成编译器后端
Pub Date : 2024-08-27 DOI: arxiv-2408.15429
Gus Henry Smith
Compilers convert between representations -- usually, from higher-level,human writable code to lower-level, machine-readable code. A compiler backendis the portion of the compiler containing optimizations and code generationroutines for a specific hardware target. In this dissertation, I advocate for aspecific way of building compiler backends: namely, by automatically generatingthem from explicit, formal models of hardware using automated reasoningalgorithms. I describe how automatically generating compilers from formalmodels of hardware leads to increased optimization ability, strongercorrectness guarantees, and reduced development time for compiler backends. Asevidence, I present two case studies: first, Glenside, which uses equalitysaturation to increase the 3LA compiler's ability to offload operations tomachine learning accelerators, and second, Lakeroad, a technology mapper forFPGAs which uses program synthesis and semantics extracted from Verilog to maphardware designs to complex, programmable hardware primitives.
编译器在各种表示法之间进行转换,通常是从高级的、人类可写的代码转换为低级的、机器可读的代码。编译器后端是编译器中包含针对特定硬件目标的优化和代码生成程序的部分。在这篇论文中,我主张采用一种特定的方式来构建编译器后端:即使用自动推理算法从硬件的显式形式模型中自动生成编译器后端。我描述了如何从硬件的形式化模型自动生成编译器,从而提高优化能力、加强正确性保证并缩短编译器后端开发时间。作为例证,我介绍了两个案例研究:第一,Glenside,它使用相等饱和度来提高 3LA 编译器向机器学习加速器卸载操作的能力;第二,Lakeroad,一种用于FPGA 的技术映射器,它使用从 Verilog 中提取的程序综合和语义将硬件设计映射到复杂的可编程硬件基元。
{"title":"Generation of Compiler Backends from Formal Models of Hardware","authors":"Gus Henry Smith","doi":"arxiv-2408.15429","DOIUrl":"https://doi.org/arxiv-2408.15429","url":null,"abstract":"Compilers convert between representations -- usually, from higher-level,\u0000human writable code to lower-level, machine-readable code. A compiler backend\u0000is the portion of the compiler containing optimizations and code generation\u0000routines for a specific hardware target. In this dissertation, I advocate for a\u0000specific way of building compiler backends: namely, by automatically generating\u0000them from explicit, formal models of hardware using automated reasoning\u0000algorithms. I describe how automatically generating compilers from formal\u0000models of hardware leads to increased optimization ability, stronger\u0000correctness guarantees, and reduced development time for compiler backends. As\u0000evidence, I present two case studies: first, Glenside, which uses equality\u0000saturation to increase the 3LA compiler's ability to offload operations to\u0000machine learning accelerators, and second, Lakeroad, a technology mapper for\u0000FPGAs which uses program synthesis and semantics extracted from Verilog to map\u0000hardware designs to complex, programmable hardware primitives.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142223614","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Synthesizing Formal Semantics from Executable Interpreters 从可执行解释器合成形式语义
Pub Date : 2024-08-26 DOI: arxiv-2408.14668
Jiangyi Liu, Charlie Murphy, Anvay Grover, Keith J. C. Johnson, Thomas Reps, Loris D'Antoni
Program verification and synthesis frameworks that allow one to customize thelanguage in which one is interested typically require the user to provide aformally 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 bynon-expert users. We present an algorithm that can automatically synthesize inductively definedsyntax-directed semantics when given (i) a grammar describing the syntax of alanguage and (ii) an executable (closed-box) interpreter for computing thesemantics of programs in the language of the grammar. Our algorithm synthesizes the semantics in the form of Constrained-HornClauses (CHCs), a natural, extensible, and formal logical framework forspecifying inductively defined relations that has recently received widespreadadoption in program verification and synthesis. The key innovation of our synthesis algorithm is a Counterexample-GuidedSynthesis (CEGIS) approach that breaks the hard problem of synthesizing a setof constrained Horn clauses into small, tractable expression-synthesis problemsthat can be dispatched to existing SyGuS synthesizers. Our tool Synantic synthesized inductively-defined formal semantics from 14interpreters for languages used in program-synthesis applications. When synthesizing formal semantics for one of our benchmarks, Synanticunveiled an inconsistency in the semantics computed by the interpreter for alanguage of regular expressions; fixing the inconsistency resulted in a moreefficient semantics and, for some cases, in a 1.2x speedup for a synthesizersolving synthesis problems over such a language.
程序验证和综合框架允许用户定制自己感兴趣的语言,但通常要求用户为语言提供正式定义的语义。由于编写正式语义是一项艰巨且容易出错的任务,这一要求阻碍了此类框架被非专业用户采用。我们提出了一种算法,当给定(i)描述语言语法的语法和(ii)在语法语言中计算程序语义的可执行(封闭盒)解释器时,它可以自动合成归纳定义的语法导向语义。我们的算法以约束角式语句(CHC)的形式合成语义,这是一种自然、可扩展的正式逻辑框架,用于指定归纳定义的关系,最近在程序验证和合成中得到了广泛应用。我们的合成算法的关键创新点在于反例引导合成(Counterexample-GuidedSynthesis,CEGIS)方法,它将合成一组受限霍恩子句的难题分解成小而易懂的表达式合成问题,这些问题可以分派给现有的 SyGuS 合成器。我们的工具 Synantic 从程序合成应用中使用的 14 种语言解释器中合成了归纳定义的形式语义。在为我们的一个基准合成形式语义时,Synantic 发现解释器为正则表达式语言计算的语义存在不一致性;修正不一致性后,语义效率更高,在某些情况下,合成器解决这种语言合成问题的速度提高了 1.2 倍。
{"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":"https://doi.org/arxiv-2408.14668","url":null,"abstract":"Program verification and synthesis frameworks that allow one to customize the\u0000language in which one is interested typically require the user to provide a\u0000formally defined semantics for the language. Because writing a formal semantics can be a daunting and error-prone task,\u0000this requirement stands in the way of such frameworks being adopted by\u0000non-expert users. We present an algorithm that can automatically synthesize inductively defined\u0000syntax-directed semantics when given (i) a grammar describing the syntax of a\u0000language and (ii) an executable (closed-box) interpreter for computing the\u0000semantics of programs in the language of the grammar. Our algorithm synthesizes the semantics in the form of Constrained-Horn\u0000Clauses (CHCs), a natural, extensible, and formal logical framework for\u0000specifying inductively defined relations that has recently received widespread\u0000adoption in program verification and synthesis. The key innovation of our synthesis algorithm is a Counterexample-Guided\u0000Synthesis (CEGIS) approach that breaks the hard problem of synthesizing a set\u0000of constrained Horn clauses into small, tractable expression-synthesis problems\u0000that can be dispatched to existing SyGuS synthesizers. Our tool Synantic synthesized inductively-defined formal semantics from 14\u0000interpreters for languages used in program-synthesis applications. When synthesizing formal semantics for one of our benchmarks, Synantic\u0000unveiled an inconsistency in the semantics computed by the interpreter for a\u0000language of regular expressions; fixing the inconsistency resulted in a more\u0000efficient semantics and, for some cases, in a 1.2x speedup for a synthesizer\u0000solving synthesis problems over such a language.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142179556","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
MetaFFI -- Multilingual Indirect Interoperability System MetaFFI -- 多语言间接互操作系统
Pub Date : 2024-08-26 DOI: arxiv-2408.14175
Tsvi Cherny-Shahar, Amiram Yehudai
The development of software applications using multiple programming languageshas increased in recent years, as it allows the selection of the most suitablelanguage and runtime for each component of the system and the integration ofthird-party libraries. However, this practice involves complexity and errorproneness, due to the absence of an adequate system for the interoperability ofmultiple programming languages. Developers are compelled to resort toworkarounds, such as library reimplementation or language-specific wrappers,which are often dependent on C as the common denominator for interoperability.These challenges render the use of multiple programming languages a burdensomeand demanding task that necessitates highly skilled developers forimplementation, debugging, and maintenance, and raise doubts about the benefitsof interoperability. To overcome these challenges, we propose MetaFFI, apluggable in-process indirect-interoperability system that allows the loadingand utilization of entities from multiple programming languages. This isachieved by exploiting the less restrictive shallow binding mechanisms (e.g.,Foreign Function Interface) to offer deep binding features (e.g., objectcreation, methods, fields). MetaFFI provides a runtime-independent framework toload and emph{xcall} (Cross-Call) foreign entities (e.g., functions, objects).MetaFFI uses Common Data Types (CDTs) to pass parameters and return values,including objects and complex types, and even cross-language callbacks. Theindirect interoperability approach of MetaFFI has the significant advantage ofrequiring only $2n$ mechanisms to support $n$ languages, as opposed to thedirect interoperability approaches that need $n^2$ mechanisms. We havesuccessfully tested the binding between Go, Python3.11, and Java in aproof-of-concept on Windows and Ubuntu.
近年来,使用多种编程语言开发应用软件的情况越来越多,因为这样可以为系统的每个组件选择最合适的语言和运行时间,并集成第三方库。然而,由于缺乏适当的系统来实现多种编程语言的互操作性,这种做法既复杂又容易出错。这些挑战使使用多种编程语言成为一项繁重而艰巨的任务,需要高技能的开发人员来实现、调试和维护,并使人们对互操作性的好处产生怀疑。为了克服这些挑战,我们提出了 MetaFFI,这是一个可插拔的进程内间接互操作系统,允许加载和使用来自多种编程语言的实体。这是通过利用限制较少的浅层绑定机制(如外来函数接口)来提供深层绑定功能(如对象创建、方法、字段)来实现的。MetaFFI 提供了一个独立于运行时的框架,用于加载和调用(Cross-Call)外来实体(如函数、对象)。MetaFFI 使用通用数据类型(Common Data Types,CDT)来传递参数和返回值,包括对象和复杂类型,甚至是跨语言回调。与需要 n^2 种机制的直接互操作方法相比,MetaFFI 的直接互操作方法的显著优势在于只需要 2n$ 种机制来支持 n$ 种语言。我们已经在 Windows 和 Ubuntu 上成功测试了 Go、Python3.11 和 Java 之间的概念验证绑定。
{"title":"MetaFFI -- Multilingual Indirect Interoperability System","authors":"Tsvi Cherny-Shahar, Amiram Yehudai","doi":"arxiv-2408.14175","DOIUrl":"https://doi.org/arxiv-2408.14175","url":null,"abstract":"The development of software applications using multiple programming languages\u0000has increased in recent years, as it allows the selection of the most suitable\u0000language and runtime for each component of the system and the integration of\u0000third-party libraries. However, this practice involves complexity and error\u0000proneness, due to the absence of an adequate system for the interoperability of\u0000multiple programming languages. Developers are compelled to resort to\u0000workarounds, such as library reimplementation or language-specific wrappers,\u0000which are often dependent on C as the common denominator for interoperability.\u0000These challenges render the use of multiple programming languages a burdensome\u0000and demanding task that necessitates highly skilled developers for\u0000implementation, debugging, and maintenance, and raise doubts about the benefits\u0000of interoperability. To overcome these challenges, we propose MetaFFI, a\u0000pluggable in-process indirect-interoperability system that allows the loading\u0000and utilization of entities from multiple programming languages. This is\u0000achieved by exploiting the less restrictive shallow binding mechanisms (e.g.,\u0000Foreign Function Interface) to offer deep binding features (e.g., object\u0000creation, methods, fields). MetaFFI provides a runtime-independent framework to\u0000load and emph{xcall} (Cross-Call) foreign entities (e.g., functions, objects).\u0000MetaFFI uses Common Data Types (CDTs) to pass parameters and return values,\u0000including objects and complex types, and even cross-language callbacks. The\u0000indirect interoperability approach of MetaFFI has the significant advantage of\u0000requiring only $2n$ mechanisms to support $n$ languages, as opposed to the\u0000direct interoperability approaches that need $n^2$ mechanisms. We have\u0000successfully tested the binding between Go, Python3.11, and Java in a\u0000proof-of-concept on Windows and Ubuntu.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142179559","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Law and Order for Typestate with Borrowing 借贷类型国家的法律和秩序
Pub Date : 2024-08-26 DOI: arxiv-2408.14031
Hannes Saffrich, Yuki Nishida, Peter Thiemann
Typestate systems are notoriously complex as they require sophisticatedmachinery for tracking aliasing. We propose a new, transition-orientedfoundation for typestate in the setting of impure functional programming. Ourapproach relies on ordered types for simple alias tracking and itsformalization draws on work on bunched implications. Yet, we support a flexiblenotion of borrowing in the presence of typestate. Our core calculus comes with a notion of resource types indexed by an orderedpartial monoid that models abstract state transitions. We prove syntactic typesoundness with respect to a resource-instrumented semantics. We give analgorithmic version of our type system and prove its soundness. Algorithmictyping facilitates a simple surface language that does not expose tediousdetails of ordered types. We implemented a typechecker for the surface languagealong with an interpreter for the core language.
类型状态系统是出了名的复杂,因为它们需要复杂的机器来跟踪别名。我们为不纯函数式编程环境中的类型状态提出了一种新的、面向过渡的基础。我们的方法依赖于有序类型来实现简单的别名跟踪,其形式化借鉴了有关成串含义的工作。然而,我们支持在存在类型状态的情况下灵活借用。我们的核心微积分包含一个资源类型概念,该概念由一个有序部分单元索引,该单元对抽象状态转换进行建模。我们证明了资源工具语义的语法类型健全性。我们给出了类型系统的算法版本,并证明了其合理性。算法类型化为简单的表面语言提供了便利,它不会暴露有序类型的繁琐细节。我们为表面语言实现了一个类型检查器,同时还为核心语言实现了一个解释器。
{"title":"Law and Order for Typestate with Borrowing","authors":"Hannes Saffrich, Yuki Nishida, Peter Thiemann","doi":"arxiv-2408.14031","DOIUrl":"https://doi.org/arxiv-2408.14031","url":null,"abstract":"Typestate systems are notoriously complex as they require sophisticated\u0000machinery for tracking aliasing. We propose a new, transition-oriented\u0000foundation for typestate in the setting of impure functional programming. Our\u0000approach relies on ordered types for simple alias tracking and its\u0000formalization draws on work on bunched implications. Yet, we support a flexible\u0000notion of borrowing in the presence of typestate. Our core calculus comes with a notion of resource types indexed by an ordered\u0000partial monoid that models abstract state transitions. We prove syntactic type\u0000soundness with respect to a resource-instrumented semantics. We give an\u0000algorithmic version of our type system and prove its soundness. Algorithmic\u0000typing facilitates a simple surface language that does not expose tedious\u0000details of ordered types. We implemented a typechecker for the surface language\u0000along with an interpreter for the core language.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142223615","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
Making Formulog Fast: An Argument for Unconventional Datalog Evaluation (Extended Version) 让 Formulog 更快:非常规数据模型评估论证(扩展版)
Pub Date : 2024-08-26 DOI: arxiv-2408.14017
Aaron BembenekUniversity of Melbourne, Michael GreenbergStevens Institute of Technology, Stephen ChongHarvard University
By combining Datalog, SMT solving, and functional programming, the languageFormulog provides an appealing mix of features for implementing SMT-basedstatic analyses (e.g., refinement type checking, symbolic execution) in anatural, declarative way. At the same time, the performance of its customDatalog solver can be an impediment to using Formulog beyond prototyping -- acommon problem for Datalog variants that aspire to solve large probleminstances. In this work we speed up Formulog evaluation, with surprisingresults: while 2.2x speedups are obtained by using the conventional techniquesfor high-performance Datalog (e.g., compilation, specialized data structures),the big wins come by abandoning the central assumption in modern performantDatalog engines, semi-naive Datalog evaluation. In its place, we develop eagerevaluation, a concurrent Datalog evaluation algorithm that explores the logicalinference space via a depth-first traversal order. In practice, eagerevaluation leads to an advantageous distribution of Formulog's SMT workload toexternal SMT solvers and improved SMT solving times: our eager evaluationextensions to the Formulog interpreter and Souffl'e's code generator achievemean 5.2x and 7.6x speedups, respectively, over the optimized code generated byoff-the-shelf Souffl'e on SMT-heavy Formulog benchmarks. Using compilation and eager evaluation, Formulog implementations ofrefinement type checking, bottom-up pointer analysis, and symbolic executionachieve speedups on 20 out of 23 benchmarks over previously published,hand-tuned analyses written in F#, Java, and C++, providing strong evidencethat Formulog can be the basis of a realistic platform for SMT-based staticanalysis. Moreover, our experience adds nuance to the conventional wisdom thatsemi-naive evaluation is the one-size-fits-all best Datalog evaluationalgorithm for static analysis workloads.
通过将 Datalog、SMT 求解和函数式编程相结合,Formulog 语言为以自然、声明的方式实现基于 SMT 的静态分析(如细化类型检查、符号执行)提供了极具吸引力的功能组合。与此同时,其自定义 Datalog 求解器的性能可能会阻碍 Formulog 在原型设计之外的使用--这对于希望解决大型问题实例的 Datalog 变体来说是一个常见问题。在这项工作中,我们加快了 Formulog 的评估速度,结果令人吃惊:虽然使用高性能 Datalog 的传统技术(如编译、专用数据结构)可以获得 2.2 倍的速度提升,但放弃现代高性能 Datalog 引擎的核心假设--半零 Datalog 评估--则会带来巨大的收益。取而代之的是我们开发的 eagerevaluation,一种通过深度优先遍历顺序探索逻辑推理空间的并发 Datalog 评估算法。在实践中,eagerevaluation 能将 Formulog 的 SMT 工作负载有利地分配给外部 SMT 求解器,并提高 SMT 求解时间:在重 SMT 的 Formulog 基准上,我们对 Formulog 解释器和 Souffl'e 代码生成器的急切评估扩展,比现成的 Souffl'e 生成的优化代码分别提高了 5.2 倍和 7.6 倍的速度。通过编译和急迫评估,Formulog 实现了细化类型检查、自下而上的指针分析和符号执行,在 23 个基准中的 20 个基准上的速度超过了以前发布的、用 F#、Java 和 C++ 编写的手工调整分析,有力地证明了 Formulog 可以成为基于 SMT 的静态分析的现实平台的基础。此外,我们的经验为传统观点增添了微妙的变化,即对于静态分析工作负载而言,无损评估是放之四海而皆准的最佳 Datalog 评估算法。
{"title":"Making Formulog Fast: An Argument for Unconventional Datalog Evaluation (Extended Version)","authors":"Aaron BembenekUniversity of Melbourne, Michael GreenbergStevens Institute of Technology, Stephen ChongHarvard University","doi":"arxiv-2408.14017","DOIUrl":"https://doi.org/arxiv-2408.14017","url":null,"abstract":"By combining Datalog, SMT solving, and functional programming, the language\u0000Formulog provides an appealing mix of features for implementing SMT-based\u0000static analyses (e.g., refinement type checking, symbolic execution) in a\u0000natural, declarative way. At the same time, the performance of its custom\u0000Datalog solver can be an impediment to using Formulog beyond prototyping -- a\u0000common problem for Datalog variants that aspire to solve large problem\u0000instances. In this work we speed up Formulog evaluation, with surprising\u0000results: while 2.2x speedups are obtained by using the conventional techniques\u0000for high-performance Datalog (e.g., compilation, specialized data structures),\u0000the big wins come by abandoning the central assumption in modern performant\u0000Datalog engines, semi-naive Datalog evaluation. In its place, we develop eager\u0000evaluation, a concurrent Datalog evaluation algorithm that explores the logical\u0000inference space via a depth-first traversal order. In practice, eager\u0000evaluation leads to an advantageous distribution of Formulog's SMT workload to\u0000external SMT solvers and improved SMT solving times: our eager evaluation\u0000extensions to the Formulog interpreter and Souffl'e's code generator achieve\u0000mean 5.2x and 7.6x speedups, respectively, over the optimized code generated by\u0000off-the-shelf Souffl'e on SMT-heavy Formulog benchmarks. Using compilation and eager evaluation, Formulog implementations of\u0000refinement type checking, bottom-up pointer analysis, and symbolic execution\u0000achieve speedups on 20 out of 23 benchmarks over previously published,\u0000hand-tuned analyses written in F#, Java, and C++, providing strong evidence\u0000that Formulog can be the basis of a realistic platform for SMT-based static\u0000analysis. Moreover, our experience adds nuance to the conventional wisdom that\u0000semi-naive evaluation is the one-size-fits-all best Datalog evaluation\u0000algorithm for static analysis workloads.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0,"publicationDate":"2024-08-26","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"142227598","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 0
期刊
arXiv - CS - Programming Languages
全部 Acc. Chem. Res. ACS Applied Bio Materials ACS Appl. Electron. Mater. ACS Appl. Energy Mater. ACS Appl. Mater. Interfaces ACS Appl. Nano Mater. ACS Appl. Polym. Mater. ACS BIOMATER-SCI ENG ACS Catal. ACS Cent. Sci. ACS Chem. Biol. ACS Chemical Health & Safety ACS Chem. Neurosci. ACS Comb. Sci. ACS Earth Space Chem. ACS Energy Lett. ACS Infect. Dis. ACS Macro Lett. ACS Mater. Lett. ACS Med. Chem. Lett. ACS Nano ACS Omega ACS Photonics ACS Sens. ACS Sustainable Chem. Eng. ACS Synth. Biol. Anal. Chem. BIOCHEMISTRY-US Bioconjugate Chem. BIOMACROMOLECULES Chem. Res. Toxicol. Chem. Rev. Chem. Mater. CRYST GROWTH DES ENERG FUEL Environ. Sci. Technol. Environ. Sci. Technol. Lett. Eur. J. Inorg. Chem. IND ENG CHEM RES Inorg. Chem. J. Agric. Food. Chem. J. Chem. Eng. Data J. Chem. Educ. J. Chem. Inf. Model. J. Chem. Theory Comput. J. Med. Chem. J. Nat. Prod. J PROTEOME RES J. Am. Chem. Soc. LANGMUIR MACROMOLECULES Mol. Pharmaceutics Nano Lett. Org. Lett. ORG PROCESS RES DEV ORGANOMETALLICS J. Org. Chem. J. Phys. Chem. J. Phys. Chem. A J. Phys. Chem. B J. Phys. Chem. C J. Phys. Chem. Lett. Analyst Anal. Methods Biomater. Sci. Catal. Sci. Technol. Chem. Commun. Chem. Soc. Rev. CHEM EDUC RES PRACT CRYSTENGCOMM Dalton Trans. Energy Environ. Sci. ENVIRON SCI-NANO ENVIRON SCI-PROC IMP ENVIRON SCI-WAT RES Faraday Discuss. Food Funct. Green Chem. Inorg. Chem. Front. Integr. Biol. J. Anal. At. Spectrom. J. Mater. Chem. A J. Mater. Chem. B J. Mater. Chem. C Lab Chip Mater. Chem. Front. Mater. Horiz. MEDCHEMCOMM Metallomics Mol. Biosyst. Mol. Syst. Des. Eng. Nanoscale Nanoscale Horiz. Nat. Prod. Rep. New J. Chem. Org. Biomol. Chem. Org. Chem. Front. PHOTOCH PHOTOBIO SCI PCCP Polym. Chem.
×
引用
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