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.
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
x\inVar
\sigma\in\Sigma
\sigma(p1,p2,...,pn)
\negp
p1\landp2
\existsx.p
x\inVar
A matching logic may also have a set
S
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
\bot
"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
\mu
\mu
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.