Skip to content

Commit a14d964

Browse files
author
Xiaohong Chen
committed
add matching logic homepage
1 parent 15e1fb3 commit a14d964

File tree

2 files changed

+180
-3
lines changed

2 files changed

+180
-3
lines changed

assets/logics.png

701 KB
Loading

index.md

Lines changed: 180 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,184 @@
22
title: Matching Logic
33
---
44

5-
## Under Construction
65

7-
This page is under construction, as we migrate to a static website.
8-
For resources about matching logic please refer to: https://fsl.cs.illinois.edu/projects/matching-logic/
6+
## What is Matching Logic?
7+
8+
### For programming language semanticists:
9+
10+
Matching logic is a unifying foundational logic for programming
11+
languages, specification, verification. It serves as the foundation of
12+
the [K framework](https://kframework.org): a formal language framework
13+
where all programming languages must have a formal semantics and all
14+
language tools are automatically generated by the framework from the
15+
semantics at no additional costs, in a correct-by-construction manner.
16+
17+
Traditionally, concrete behaviors of programs are defined by
18+
[operational
19+
semantics](https://en.wikipedia.org/wiki/Operational_semantics), while
20+
the properties of them are specified and proved using [axiomatic
21+
semantics](https://en.wikipedia.org/wiki/Axiomatic_semantics), such as
22+
[Hoare logic](https://en.wikipedia.org/wiki/Hoare_logic). Unfortunately,
23+
axiomatic semantics of real languages are rather complex, so correctness
24+
proofs are necessary in order to trust the proven properties. Moreover,
25+
such proofs have to be maintained as the language changes, which is
26+
generally perceived as a burden. Ideally, we would like to have only
27+
*one* reference language semantics, which are used for both deriving
28+
program behaviors and verifying programs.
29+
30+
Matching logic allows us to regard a programming language through both
31+
operational and axiomatic lenses at the same time, making no distinction
32+
between the two. The semantics of a programming language is given in
33+
matching logic as a set of rewrite rules. Both operational behaviors and
34+
formal properties of a program are derived using the
35+
*language-independent* proof system of matching logic. That is, we use
36+
the same proof system to reason about all programming languages, which
37+
is different from the classic axiomatic semantics approach where
38+
different languages require their own set of proof rules (see, e.g.,
39+
[Hoare logic rules](https://en.wikipedia.org/wiki/Hoare_logic#Rules) for
40+
a set of proof rules that were designed specifically for a simple
41+
imperative language). In conclusion, one matching logic semantics
42+
fulfills the roles of both operational and axiomatic semantics in a
43+
uniform manner.
44+
45+
One of the key observations made by matching logic is that program
46+
states can be represented as algebraic datatypes called
47+
*configurations*. A configuration contains all information of the
48+
program state, such as its current computation (i.e. the program/code),
49+
its computing context (e.g., environments, heaps, etc.), input and
50+
output buffer, and many others. Program configurations can be *matched*
51+
by (configuration) *patterns*, which are matching logic formulas with
52+
variables and constraints. A rewrite rule of a matching logic semantics
53+
has the form lhs =\> rhs where lhs and rhs are patterns. It specifies
54+
that all configurations matching lhs should rewrite to the
55+
configurations matching rhs, in one computation step. In this way,
56+
matching logic defines the formal semantics of a programming language by
57+
defining the set of all its configurations and then defining a
58+
[transition system](https://en.wikipedia.org/wiki/Transition_system)
59+
over the configurations using rewrite rules.
60+
61+
### For logicians:
62+
63+
Matching logic is a powerful extension of the [normal modal
64+
logic](https://en.wikipedia.org/wiki/Normal_modal_logic) with
65+
many-sorted universes, many-sorted modalities, first-order logic (FOL)
66+
quantifiers ∀ and ∃, and the least fixpoint μ-binder. Many
67+
logics/calculi/models, especially those important in the study of
68+
programming languages, can be defined as theories in matching logic.
69+
Here is a non-exhaustive list of the logics/calculi/models that are
70+
definable in matching
71+
logic:
72+
73+
- First-order logic (FOL) and its extension with least fixpoints;
74+
- Modal logic variants and extensions, in particular, modal μ-logic
75+
and hybrid logic;
76+
- Temporal logics such as linear temporal logic (LTL) and computation
77+
tree logic (CTL);
78+
- Dynamic logic;
79+
- Hoare logic, which is the foundation of most existing
80+
state-of-the-art program verifiers;
81+
- Reachability logic, which is the foundation of language-independent
82+
program verification that is implemented by the K framework;
83+
- Separation logic and its extension with recursive definitions;
84+
- Equational and rewriting logic;
85+
- Many-sorted and order-sorted algebras;
86+
- Complex type structures such as polymorphic types, function types,
87+
and dependent types;
88+
- λ-calculus;
89+
- Pure type systems;
90+
91+
<img src="/assets/logics.png" alt="Matching Logic" width="800"/>
92+
93+
The diagram above on the right depicts the relationship among these
94+
logics/calculi/models, where arrows mean "is subsumed by" or "can be
95+
defined in".
96+
As seen, many important logical systems can be subsumed by or
97+
defined in matching logic as its fragments and/or logical theories.
98+
99+
## Getting Started
100+
101+
Matching logic is the result of a continuous 20-year effort in finding a
102+
foundation logic for formal language frameworks,
103+
such as [the K language framework](https:kframework.org), and has led
104+
many research papers. Here, we select
105+
some milestone papers for starters, discuss the ongoing projects and
106+
open problems, and review some earlier papers that compare matching
107+
logic with the classic Hoare-style program verification.
108+
109+
### Core publications
110+
111+
- **Grigore Rosu**. *[Matching Logic](https://fsl.cs.illinois.edu/publications/rosu-2017-lmcs.html)*,
112+
LMCS, 2017.
113+
- This paper is a comprehensive in-depth survey paper of the mathematical
114+
foundations of matching logic. The paper discusses the motivation of
115+
matching logic and its usage in K, defines its syntax and semantics,
116+
shows that many logics can be defined as theories, including FOL,
117+
modal logic S5, and separation logic, and proposes a sound and
118+
complete proof system.
119+
120+
- **Xiaohong Chen, Grigore Rosu**. *[Matching mu-Logic](https://fsl.cs.illinois.edu/publications/chen-rosu-2019-lics.html)*,
121+
LICS, 2019.
122+
- This paper is the canonical paper that proposes matching logic in its full
123+
generality. It discuss more logics that can be defined in matching logic, including FOL
124+
with least fixpoints, modal μ-logic, temporal logics, dynamic logic,
125+
separation logic with recursive definitions, and reachability logic.
126+
127+
### Other publications
128+
129+
- **Xiaohong Chen, Minh-Thai Trinh, Nishant Rodrigues, Lucas Pena, Grigore Rosu**.
130+
*[Towards A Unified Proof Framework for Automated Fixpoint Reasoning Using Matching Logic](https://fsl.cs.illinois.edu/publications/chen-pena-rodrigues-rosu-trinh-2020-oopsla.html)*,
131+
OOPSLA, 2020.
132+
- Automation of fixpoint reasoning has been extensively studied for various mathematical structures, logical formalisms, and computational domains, resulting in specialized fixpoint provers for heaps, for streams, for term algebras, for temporal properties, for program correctness, and for many other formal systems and inductive and coinductive properties. However, in spite of great theoretical and practical interest, there is no unified framework for automated fixpoint reasoning. Although several attempts have been made, there is no evidence that such a unified framework is possible, or practical. In this paper, we propose a candidate based on matching logic, a formalism recently shown to theoretically unify the above mentioned formal systems. Unfortunately, the (Knaster-Tarski) proof rule of matching logic, which enables inductive reasoning, is not syntax-driven. Worse, it can be applied at any step during a proof, making automation seem hopeless. Inspired by recent advances in automation of inductive proofs in separation logic, we propose an alternative proof system for matching logic, which is amenable for automation. We then discuss our implementation of it, which although not superior to specialized state-of-the-art automated provers for specific domains, we believe brings some evidence and hope that a unified framework for automated reasoning is not out of reach.
133+
- **Xiaohong Chen, Grigore Rosu**.
134+
*[A General Approach to Define Binders Using Matching Logic](https://fsl.cs.illinois.edu/publications/chen-rosu-2020-icfp.html)*,
135+
ICFP, 2020.
136+
- We propose a novel definition of binders using matching logic, where the binding behavior of object-level binders is directly inherited from the built-in exists binder of matching logic. We show that the behavior of binders in various logical systems such as lambda-calculus, System F, pi-calculus, pure type systems, can be axiomatically defined in matching logic as notations and logical theories. We show the correctness of our definitions by proving conservative extension theorems, which state that a sequent/judgment is provable in the original system if and only if it is provable in matching logic, in the corresponding theory. Our matching logic definition of binders also yields models to all binders, which are deductively complete with respect to formal reasoning in the original systems. For lambda-calculus, we further show that the yielded models are representationally complete, a desired property that is not enjoyed by many existing lambda-calculus semantics. This work is part of a larger effort to develop a logical foundation for the programming language semantics framework K (http://kframework.org).
137+
- **Xiaohong Chen, Dorel Lucanu, Grigore Rosu**.
138+
*[Initial Algebra Semantics in Matching Logic](https://fsl.cs.illinois.edu/publications/chen-lucanu-rosu-2020-tr.html)*,
139+
Technical Report, 2020.
140+
- Matching logic is a unifying foundational logic for defining formal programming language semantics, which adopts a minimalist design with few primitive constructs that are enough to express all properties within a variety of logical systems, including FOL, separation logic, (dependent) type systems, modal mu-logic, and more. In this paper, we consider initial algebra semantics and show how to capture it by matching logic specifications. Formally, given an algebraic specification E that defines a set of sorts (of data) and a set of operations whose behaviors are defined by a set of equational axioms, we define a corresponding matching logic specification, denoted INITIALALGEBRA(E), whose models are exactly the initial algebras of E. Thus, we reduce initial E-algebra semantics to the matching logic specifications INITIALALGEBRA(E), and reduce extrinsic initial E-algebra reasoning, which includes inductive reasoning, to generic, intrinsic matching logic reasoning.
141+
- **Xiaohong Chen, Dorel Lucanu, Grigore Rosu**.
142+
*[Matching Logic Explained](https://fsl.cs.illinois.edu/publications/chen-lucanu-rosu-2020-trb.html)*,
143+
JLAMP, To Appear.
144+
- Matching logic was recently proposed as a unifying logic for specifying and reasoning about static structure and dynamic behavior of programs. In matching logic, patterns and specifications are used to uniformly represent mathematical domains (such as numbers and Boolean values), datatypes, and transition systems, whose properties can be reasoned about using one fixed matching logic proof system. In this paper we give a tutorial to matching logic. We use a suite of examples to explain the basic concepts of matching logic and show how to capture many important mathematical domains, datatypes, and transition systems using patterns and specifications. We put special emphasis on the general principles of induction and coinduction in matching logic and show how to do inductive and coinductive reasoning about datatypes and codatatypes. To encourage the development of the future tools for matching logic, we propose and use throughout the paper a human-readable formal syntax to write specifications in a modular and compact way.
145+
146+
147+
To understand how matching logic powers
148+
**formal program verification *for all languages***, read the following publications, where we compare
149+
our approach to program verification with the traditional Hoare-style
150+
verification approach:
151+
152+
- **Xiaohong Chen, Grigore Rosu**.
153+
*[A Language-Independent Program Verification Framework](https://fsl.cs.illinois.edu/publications/chen-rosu-2018-isola.html)*,
154+
ISoLA, 2018.
155+
- This invited paper describes an approach to language-independent deductive verification using the K semantics framework, in which an operational semantics of a language is defined and a program verifier together with other language tools are generated automatically, correct-by-construction.
156+
157+
- **Xiaohong Chen, Daejun Park, Grigore Rosu**.
158+
*[A Language-Independent Approach to Smart Contract Verification](https://fsl.cs.illinois.edu/publications/chen-park-rosu-2018-isola.html)*,
159+
ISoLA, 2018.
160+
- This invited paper reports the current progress of smart contract verification with the K framework in a language-independent style.
161+
162+
- **Andrei Stefanescu, Stefan Ciobaca, Radu Mereuta, Brandon Moore, Traian Florin Serbanuta, Grigore Rosu**.
163+
*[All-Path Reachability Logic](https://fsl.cs.illinois.edu/publications/stefanescu-ciobaca-mereuta-moore-serbanuta-rosu-2014-rta.html)*,
164+
RTA, 2014.
165+
- This paper presents a language-independent proof system for reachability properties of programs written in non-deterministic (e.g. concurrent) languages, referred to as *all-path reachability logic*. It derives partial-correctness properties with all-path semantics (a state satisfying a given precondition reaches states satisfying a given postcondition on all terminating execution paths). The proof system takes as axioms any unconditional operational semantics, and is sound (partially correct) and (relatively) complete, independent of the object language; the soundness has also been mechanized (Coq). This approach is implemented in a tool for semantics-based verification as part of the K framework.
166+
167+
- **Grigore Rosu, Andrei Stefanescu, Stefan Ciobaca, Brandon Moore**.
168+
*[One-Path Reachability Logic](https://fsl.cs.illinois.edu/publications/rosu-stefanescu-ciobaca-moore-2013-lics.html)*,
169+
LICS, 2013.
170+
- This paper introduces *reachability logic*, a language-independent proof system for program verification, which takes an operational semantics as axioms and derives *reachability rules*, which generalize Hoare triples. This system improves on previous work by allowing operational semantics given with *conditional* rewrite rules, which are known to support all major styles of operational semantics. In particular, Kahn's big-step and Plotkin's small-step semantic styles are newly supported. The reachability logic proof system is shown sound (i.e., partially correct) and (relatively) complete. Reachability logic thus eliminates the need to independently define an axiomatic and an operational semantics for each language, and the non-negligible effort to prove the former sound and complete w.r.t. the latter. The soundness result has also been formalized in Coq, allowing reachability logic derivations to serve as formal proof certificates that rely only on the operational semantics.
171+
172+
- **Grigore Rosu, Andrei Stefanescu**.
173+
*[From Hoare Logic to Matching Logic Reachability](https://fsl.cs.illinois.edu/publications/rosu-stefanescu-2012-fm.html)*,
174+
FM, 2012.
175+
- Matching logic reachability has been recently proposed as an alternative program verification approach. Unlike Hoare logic, where one defines a language-specific proof system that needs to be proved sound for each language separately, matching logic reachability provides a *language-independent* and *sound* proof system that directly uses the trusted operational semantics of the language as axioms. Matching logic reachability thus has a clear practical advantage: it eliminates the need for an additional semantics of the same language in order to reason about programs, and implicitly eliminates the need for tedious soundness proofs. What is not clear, however, is whether matching logic reachability is as powerful as Hoare logic. This paper introduces a technique to mechanically translate Hoare logic proof derivations into equivalent matching logic reachability proof derivations. The presented technique has two consequences: first, it suggests that matching logic reachability has no theoretical limitation over Hoare logic; and second, it provides a new approach to prove Hoare logics sound.
176+
177+
- **Grigore Rosu, Andrei Stefanescu**.
178+
*[Checking Reachability using Matching Logic](https://fsl.cs.illinois.edu/publications/rosu-stefanescu-2012-oopsla.html)*,
179+
OOPSLA, 2012.
180+
- This paper presents a verification framework that is parametric in a (trusted) operational semantics of some programming language. The underlying proof system is language-independent and consists of eight proof rules. The proof system is proved partially correct and relatively complete (with respect to the programming language configuration model). To show its practicality, the generic framework is instantiated with a fragment of C and evaluated with encouraging results.
181+
182+
183+
## Related Links
184+
185+
- The [K framework](https://kframework.org) homepage.

0 commit comments

Comments
 (0)