一句话:提出 Shoggoth,为策略重写建立指称语义与基于位置的弱前置条件演算,并在 Isabelle/HOL 中机化验证。
策略重写通过组合重写规则构造复杂策略,但其语义复杂:可能非确定、通过错误触发回溯且不终止,因此需要形式化基础来推理终止性、兼容性与后置条件。本文提出 Shoggoth 与核心语言 System S,给出其指称语义,并证明它与扩展了发散行为的大步操作语义等价。在此基础上定义基于位置的弱前置条件演算,证明其相对指称语义的可靠性,并展示如何推理策略的终止、良好组合及后置条件。全部语义与演算在 Isabelle/HOL 中形式化,所有证明均机器检查。
Rewriting is a versatile and powerful technique used in many domains. Strategic rewriting allows programmers to control the application of rewrite rules by composing individual rewrite rules into complex rewrite strategies. These strategies are semantically complex, as they may be nondeterministic, they may raise errors that trigger backtracking, and they may not terminate. Given such semantic complexity, it is necessary to establish a formal understanding of rewrite strategies and to enable reasoning about them in order to answer questions like: How do we know that a rewrite strategy terminates? How do we know that a rewrite strategy does not fail because we compose two incompatible rewrites? How do we know that a desired property holds after applying a rewrite strategy? In this paper, we introduce Shoggoth: a formal foundation for understanding, analysing and reasoning about strategic rewriting that is capable of answering these questions. We provide a denotational semantics of System S, a core language for strategic rewriting, and prove its equivalence to our big-step operational semantics, which extends existing work by explicitly accounting for divergence. We further define a location-based weakest precondition calculus to enable formal reasoning about rewriting strategies, and we prove this calculus sound with respect to the denotational semantics. We show how this calculus can be used in practice to reason about properties of rewriting strategies, including termination, that they are well-composed, and that desired postconditions hold. The semantics and calculus are formalised in Isabelle/HOL and all proofs are mechanised.
@article{paperbot2573,
title = {Shoggoth: A Formal Foundation for Strategic Rewriting},
author = {Xueying Qin and Liam O’Connor and Rob van Glabbeek and Peter Höfner and Ohad Kammar and Michel Steuwer},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {POPL},
year = {2024},
doi = {10.1145/3633211}
}