Reference. Shoggoth: A Formal Foundation for Strategic Rewriting
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.
Cite
Cites 50 works (2 here)
With notes (2)
NetKAT: Semantic foundations for networks anderson2014netkat
Recent years have seen growing interest in high-level languages for programming networks. But the design of these languages has been largely ad hoc, driven more by the needs of applications and the capabilities of network hardware than by foundational principles. The lack of a semantic foundation has left language designers with little guidance in determining how to incorporate new features, and programmers without a means to reason precisely about their code. This paper presents NetKAT, a new network programming language that is based on a solid mathematical foundation and comes equipped with a sound and complete equational theory. We describe the design of NetKAT, including primitives for filtering, modifying, and transmitting packets; union and sequential composition operators; and a Kleene star operator that iterates programs. We show that NetKAT is an instance of a canonical and well-studied mathematical structure called a Kleene algebra with tests (KAT) and prove that its equational theory is sound and complete with respect to its denotational semantics. Finally, we present practical applications of the equational theory including syntactic techniques for checking reachability, proving non-interference properties that ensure isolation between programs, and establishing the correctness of compilation algorithms.
Kleene algebra with tests kozen1997kleene
We introduce Kleene algebra with tests, an equational system for manipulating programs. We give a purely equational proof, using Kleene algebra with tests and commutativity conditions, of the following classical result: every while program can be simulated by a while program with at most one while loop. The proof illustrates the use of Kleene algebra with tests and commutativity conditions in program equivalence proofs.
External (48)
- Achieving High Performance the Functional Way: Expressing High-Performance Optimizations as Rewrite Strategies (2023)
- Artifact for Shoggoth - A Formal Foundation for Strategic Rewriting (2023)
- Traced Types for Safe Strategic Rewriting (2023)
- Weakest preconditions in fibrations (2022)
- Fusing Industry and Academia at GitHub (Experience Report) (2022)
- Concurrent NetKAT: Modeling and analyzing stateful, concurrent networks (2022)
- Achieving high-performance the functional way: a functional pearl on expressing high-performance optimizations as rewrite strategies (2020)
- Gradually typing strategies (2020)
- A predicate transformer semantics for effects (functional pearl) (2019)
- Foundations of Software Science and Computation Structures (2018)
- Language Design with the Spoofax Language Workbench (2014)
- Proof-relevant rewriting strategies in Coq (2014)
- A Relatively Complete Generic Hoare Logic for Order-Enriched Effects (2013)
- Programming errors in traversal programs over structured data (2012)
- Concurrent Kleene Algebra and its Foundations (2011)
- A Generic Operational Metatheory for Algebraic Effects (2010)
- Dafny: An Automatic Program Verifier for Functional Correctness (2010)
- VCC: A Practical System for Verifying Concurrent C (2009)
- An Isabelle/HOL-based model of stratego-like traversal strategies (2009)
- Stratego/XT 0.17. A language and toolset for program transformation (2008)
- Coinductive big-step operational semantics (2008)
- Transformation of structure-shy programs: applied to XPath queries and strategic functions (2007)
- Scrap your boilerplate with XPath-like combinators (2007)
- Efficient weakest preconditions (2005)
- Computational adequacy for recursive types in models of intuitionistic set theory (2004)
- The transient combinator, higher-order strategies, and the distributed data problem (2004)
- On Hoare logic and Kleene algebra with tests (2003)
- Extended static checking for Java (2002)
- A completeness theorem for Kleene algebras and the algebra of regular events (2002)
- Typed generic traversal with term rewriting strategies (2002)
- Design patterns for functional strategic programming (2002)
- Isabelle/HOL (2002)
- A Logic for Rewriting Strategies (2001)
- Stratego: A Language for Program Transformation Based on Rewriting Strategies System Description of Stratego (2001)
- Adequacy for Algebraic Effects (2001)
- Building program optimizers with rewriting strategies (1998)
- A Core Language for Rewriting (1998)
- ELAN (1996)
- Programming from specifications (1994)
- Semantics, orderings and recursion in the weakest precondition calculus (1993)
- Assigning Meanings to Programs (1993)
- Computing with rewrite systems (1985)
- Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory (1985)
- Full abstraction for a simple parallel programming language (1979)
- Soundness and Completeness of an Axiom System for Program Verification (1978)
- A Powerdomain Construction (1976)
- Guarded commands, nondeterminacy and formal derivation of programs (1975)
- An axiomatic basis for computer programming (1969)