Matching logic explained

Matching logic is a formal logic mainly used to reason about the correctness of computer programs. Its operators use pattern matching to operate on the power set of states, rather than the set of states. It was created by Grigore Roșu and is used in the K Framework.

Overview

Matching logic operates on patterns.[1] Statements evaluate to the set of values that "match" them, not to true or false.

Given a set of signatures

\Sigma

, a pattern can be:

x\inVar

\sigma\in\Sigma

using other patterns:

\sigma(p1,p2,...,pn)

\negp

p1\landp2

\existsx.p

with

x\inVar

A matching logic may also have a set

S

of sorts. In that case, each pattern belongs to a particular sort. Structures can be used to combine patterns of different sorts together. Some examples of sorts used when working with program semantics might be "32-bit integer values", "stack frames", or "heap memory".

Some derived concepts are defined as:

\top\equiv\existsx.x

\bot\equiv\neg\top

p1\lorp2\equiv\neg(\negp1\land\negp2)

p1\impliesp2\equiv\negp1\lorp2

p1\Leftrightarrowp2\equivp1\impliesp2\landp2\impliesp1

\forallx.p\equiv\neg(\existsx.\negp)

\top

is matched by all elements.

\bot

is matched by none.

"One should be careful when reasoning with such non-classic logics, as basic intuitions may deceive."

When interpreting matching logic (that is, defining its semantic meaning), a pattern is modeled with a power set. The statement's interpretation is the set of values that match the pattern.

Matching μ-Logic

Matching

\mu

-logic adds a fixed-point operator

\mu

.[2]

Applications

Matching logic is used with reachability logic[3] by the K Framework to specify an operational semantics and, from them, to create a Hoare logic.

Matching logic can be converted to first-order logic with equality, which allows the K Framework to use existing SMT-solvers to find proofs for theorems.

See also

Notes and References

  1. Roșu . Grigore . Matching Logic . Logical Methods in Computer Science . 2017 .
  2. Chen . Xiaohong . Roșu . Grigore . Matching μ-Logic . 2019-01-19 . University of Illinois Research and Tech Reports . Computer Science .
  3. Roșu . Grigore . ̧Ștefănescu . Andrei . Ciobâcă . Ștefan . Moore . Brandon M. . Reachability Logic . University of Illinois Technical Report . 2012 .