Context. Variability-intensive programs (program families) appear in many application areas and for many reasons today. Different family members, called variants, are derived by switching statically configurable options (features) on and off, while reuse of the common code is maximized.
Inquiry. Verification of program families is challenging since the number of variants is exponential in the number of features. Existing single-program analysis and verification tools cannot be applied directly to program families, and designing and implementing the corresponding variability-aware versions is tedious and laborious.
Approach. In this work, we propose a range of variability-related transformations for translating program families into single programs by replacing compile-time variability with run-time variability (non-determinism). The obtained transformed programs can be subsequently analyzed using the conventional off- the-shelf single-program analysis tools such as type checkers, symbolic executors, model checkers, and static analyzers.
Knowledge. Our variability-related transformations are outcome-preserving, which means that the relation between the outcomes in the transformed single program and the union of outcomes of all variants derived from the original program family is equality.
Grounding. We show our transformation rules and their correctness with respect to a minimal core imperative language IMP. Then, we discuss our experience of implementing and using the transformations for efficient and effective analysis and verification of real-world C program families.
Importance. We report some interesting variability-related bugs that we discovered using various state-of-the-art single-program C verification tools, such as Frama-C, Clang, LLBMC.
Pure Tensor Program Rewriting via Access Patterns (Representation Pearl)
机器学习(ML)中的张量内核通常对应于纯数学表达式,使得项重写成为优化和映射到专用硬件加速器的有吸引力的策略。然而,现有的ML中间表示(IR)倾向于要么是\textit{pure but high-level},使得对硬件目标的低级重写不可表达,要么是\textit{low-level but impure},完全阻碍了术语重写的使用。本文介绍了Glenside,一个纯IR的核心抽象-\textit{access pattern} -使低层次,布局感知,以硬件为中心的程序重写。我们演示了如何在Glenside长期重写可以用来映射程序片段的硬件加速器调用,并自动发现经典的数据布局转换,如\texttt{im2col}。Glenside为进一步探索优化低级张量程序的项重写技术奠定了新的基础。
Termination of canonical context-sensitive rewriting and productivity of rewrite systems
程序的终止,即,不存在无限的计算,确保了所有初始表达式的范式的存在,从而为函数式程序的规范化语义的定义提供了必要的成分。然而,在惰性函数式语言中,无限的数据结构通常作为计算的结果来交付。例如,所有素数的列表可以作为数值表达式或数据结构的永不结束的流返回。如果允许这样的流,要求终止是无望的。在这种情况下,生产力的概念可以用来提供一个无限数据结构计算的帐户,因为它“捕捉了可计算性的概念,无限列表程序的进展”(B.A. Sijtsma,On the Productivity of Recursive List Definitions,ACM Transactions on程序设计语言and Systems 11(4):633-649,1989)。然而,在领域的长期重写系统,这可以被看作是(一阶,无类型,无条件)的功能程序,上下文敏感重写(CSR)的终止已被证明相当于重写系统的生产力,通过适当的转换。通过这种方式,可以使用证明CSR终止的工具来证明生产力。在术语重写中,CSR是当仅允许对函数符号的选定参数进行约简时产生的重写限制。在本文中,我们表明,众所周知的CSR的计算能力的结果是有用的,以更好地了解现有的重写系统的生产力和终止CSR之间的联系,并获得更强大的技术来证明重写系统的生产力。
Reflective Metagraph Rewriting as a Foundation for an AGI "Language of Thought"
MeTTa(Meta Type Talk)是一种新的程序设计语言,用于OpenCog Hyperon AGI系统。它被设计为一种元语言,具有非常基本和通用的设施,用于处理符号、接地、变量、类型、替换和模式匹配。原语的存在是为了创建新的类型系统和相关的DSL。非正式地说,MeTTa是Hyperon最低级的“思想语言”--学习更具体知识表示的算法将在其中操作的元语言,并且这些算法本身可以在其中表示。在这里,我们解释了如何将MeTTa语言形式化为元数据重写规则系统,这种方法自然适合Hyperon框架,因为后者的核心组件是分布式元数据知识存储(Atomspace)。构成MeTTa程序的元图重写规则也可以表示为元图,为MeTTa反射和自修改代码提供了自然模型。考虑到MeTTa程序计算其他MeTTa程序的执行轨迹之间的等价性,允许我们使用同伦类型论来建模MeTTa执行轨迹的空间。考虑到在MeTTa程序的执行轨迹之间映射的MeTTa程序的限制,我们发现,给定的MeTTa码基被有效地建模为无穷广群,并且所有MeTTa码基的空间被建模为(无穷,1)-topis。在离散物理学上下文中,该拓扑基本上与先前从关于超图的重写规则导出的所谓的“Ruliad”相同。作为元数据重写规则的MeTTA的形式化还可以提供有用的框架,用于在MeTTa解释器内构造用于模式匹配和等式推断的有效方法的实现。