Matching Logic - Extended Report

Hoare logics rely on the fact that logic formulae can encode, or specify, program states, including environments, stacks, heaps, path conditions, data constraints, and so on. Such formula encodings tend to lose the structure of the original program state and thus to be complex in practice, making it difficult to relate formal systems and program correctness proofs to the original programming language and program, respectively. Worse, since programs often manipulate mathematical objects such as lists, trees, graphs, etc., one needs to also encode, as logical formulae, the process of identifying these objects in the encoded program state. This paper proposes matching logic, an alternative to Hoare logics in which the state structure plays a crucial role. Program states are represented as algebraic datatypes called (concrete) configurations, and program state specifications are represented as configuration terms with variables and constraints on them, called (configuration) patterns. A pattern specifies those configurations that match it. Patterns can bind variables to their scope, allowing both for pattern abstraction and for expressing loop invariants. Matching logic is tightly connected to rewriting logic semantics (RLS): matching logic formal systems can systematically be obtained from executable RLS of languages. This relationship allows to prove soundness of matching logic formal systems w.r.t. complementary, testable semantics. All notions are exemplified using KernelC, a fragment of C with dynamic memory allocation/deallocation.

[1]  John C. Reynolds,et al.  The discoveries of continuations , 1993, LISP Symb. Comput..

[2]  S TraianFlorin A Rewriting Logic Approach to Operational Semantics , 2010 .

[3]  C. A. R. HOARE,et al.  An axiomatic basis for computer programming , 1969, CACM.

[4]  Gérard Berry,et al.  The chemical abstract machine , 1989, POPL '90.

[5]  John C. Reynolds,et al.  Separation logic: a logic for shared mutable data structures , 2002, Proceedings 17th Annual IEEE Symposium on Logic in Computer Science.

[6]  P. J. Landin The Mechanical Evaluation of Expressions , 1964, Comput. J..

[7]  Grigore Rosu,et al.  K: A Rewriting-Based Framework for Computations -- Preliminary version -- , 2007 .

[8]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[9]  José Meseguer,et al.  Conditioned Rewriting Logic as a United Model of Concurrency , 1992, Theor. Comput. Sci..

[10]  José Meseguer,et al.  The Rewriting Logic Semantics Project , 2006, Electron. Notes Theor. Comput. Sci..

[11]  Reinhard Wilhelm,et al.  Parametric shape analysis via 3-valued logic , 1999, POPL '99.

[12]  Michal Walicki,et al.  Algebraic approaches to nondeterminism—an overview , 1997, CSUR.

[13]  Jr. Hartley Rogers Theory of Recursive Functions and Effective Computability , 1969 .

[14]  Claude Kirchner,et al.  ELAN from a rewriting logic point of view , 2002, Theor. Comput. Sci..

[15]  Narciso Martí-Oliet,et al.  All About Maude - A High-Performance Logical Framework, How to Specify, Program and Verify Systems in Rewriting Logic , 2007, All About Maude.

[16]  Gordon D. Plotkin,et al.  A structural approach to operational semantics , 2004, J. Log. Algebraic Methods Program..

[17]  Peter W. O'Hearn,et al.  BI as an assertion language for mutable data structures , 2001, POPL '01.

[18]  Paul Klint,et al.  Compiling language definitions: the ASF+SDF compiler , 2000, TOPL.

[19]  Jerzy Tiuryn,et al.  Dynamic logic , 2001, SIGA.

[20]  Lasse R. Nielsen,et al.  Refocusing in Reduction Semantics , 2004 .

[21]  Shmuel Sagiv,et al.  TVLA: A System for Implementing Static Analyses , 2000, SAS.