Thesis
Thesis
adam fiedler
Master’s Thesis
Faculty of Informatics
Masaryk University
May 2022
Adam Fiedler: Deduction in Matching Logic, Master’s Thesis.
© May 2022
D E C L A R AT I O N
Adam Fiedler
ACKNOWLEDGMENTS
First, I would like to thank my advisor, doc. Mgr. Jan Obdržálek, PhD.,
for his continuous guidance and patience with me. My complicated
writing style remains a problem. However, this thesis would be much
more difficult to understand without his help. Always when I thought
that something could not be explained more clearly, he proved me
wrong. He gave me so many helpful writing suggestions that I have
the feeling he read the thesis in more detail than I did.
Most warm-hearted thanks go to Xiaohong Chen for all the inspiring
discussions we had throughout the year, his brilliant permutation idea,
and his willingness to read all my drafts. Xiaohong taught me much
about matching logic and research. His passion for science never fails
to astonish me. I would also like to thank the rest of the FSL laboratory
at the UIUC for taking me as their own and for their amazing work.
Last but not least, I would like to thank my family and Juliana for
their understanding in these difficult couple of months. Writing is a
great ordeal when other things have to be put aside. It is important to
remember the support of those around the writer.
v
ABSTRACT
KEYWORDS
vii
CONTENTS
1 introduction 1
1.1 Mathematical conventions 3
1.2 A brief review of first-order logic 4
2 matching logic 7
2.1 Syntax 9
2.2 Semantics 11
2.3 Syntactic sugar 13
2.4 Entailment 14
2.5 Equality and definedness 17
2.6 Equality extensions 21
3 connections with first-order logic 23
3.1 Embedding ML in first-order logic with equality 23
3.2 Embedding first-order logic in ML 24
4 two proof systems for matching logic 29
4.1 System P 29
4.2 System H 32
4.2.1 Frame reasoning 35
4.2.2 Equivalence as a congruence 37
4.2.3 Deduction property 37
4.2.4 Local completeness 40
5 is system h complete? 43
5.1 An if-and-only-if condition for completeness 44
5.2 Reduction to finite theories 49
5.3 Theories without symbols are H-complete 50
5.4 Consistency, satisfiability, and compactness 54
5.5 Negation-complete theories 58
5.6 Open leads 60
6 canonical models for equality extensions 63
6.1 Local consistency 63
6.2 Canonical models 65
6.3 New results 70
7 conclusion 73
bibliography 75
ix
INTRODUCTION
1
Matching logic (ML) [8, 11, 27] is a logic designed for reasoning about
programs by means of operational semantics. We can define the op-
erational semantics of a programming language as a matching logic
theory and then derive operational behaviors in this logical theory [23].
The goal is to have a single source of truth in the form of operational
semantics and use it unchanged to generate the entire toolkit (e.g.,
compiler, debugger, verifier, or state-space explorer) for the given pro-
gramming language automatically [27, p. 3]. This is because we would
like to verify programs with a minimal trust base that is consistent for
all stages of the development process.
The current consensus is that operational semantics is too low-level
to be used for practical formal verification [27, p. 3]. Many state-of-
the-art formal methods thus rely on alternative semantics, various
translations, or “ad hoc” techniques. Even if these methods are proved
to be correct (and the proofs are themselves correct), each indirection
creates a possibility where things can go wrong. ML was born in an
effort to overcome the obstacles associated with operational semantics
and use it directly: as a single point of reference. Operational semantics
is usually easy to understand, scales well, and can be debugged
and tested because it is executable [27, p. 3]. The K framework [28],
based on matching logic, is proof that using operational semantics
for both execution and verification is feasible. In a nutshell, K takes
operational semantics of a language L as input and generates an
interpreter and verifier for L as output. The list of programming
languages successfully defined in K includes C [19], Java [6], and
JavaScript [24]. The K verifier was able to verify several complex heap-
manipulating programs in [29] at a performance level comparable
with verifiers crafted for a specific language [27, p. 4].
ML has grown considerably since its introduction as a variant of first-
order logic in [27]. It turned out to be well-suited not only for defining
operational semantics but also for capturing other logics, which is
another strong argument for using ML. ML can conveniently express
and unify many popular logics as ML theories. The basic matching
logic introduced in [27] is expressive enough to capture first-order logic
and the well-known modal logic S5 [1, 3, 22]. In [11], matching logic
was extended with the least fixpoint µ-binder. This allowed capturing
many other logics such as first-order logic with least fixpoints, modal
µ-logic [21], dynamic logic [17], as well as various temporal logics
such as linear temporal logic [25] or reachability logic [26]. Another
variant called applicative matching logic (AML) was introduced in [9]
1
2 introduction
Γ |= ϕ implies Γ `H ϕ.
What these theories have in common is that they can define equality
“=”. The question of whether H is complete w.r.t. all theories, even for
those without equality, has been open for several years [11, p. 1].
An = A × . . . × A
| {z }
n times
Notice that ϕSUM is not an FOL formula; the reason is that h·, ·i is
neither a predicate symbol nor a function symbol. In ML, there is no
distinction between predicates (formulas) and terms.
Formulas of ML are called patterns. A pattern is interpreted in ML
as a set of model elements that “match” this pattern, similar to pattern
matching in functional programming languages such as Haskell. To
illustrate this, suppose we want to define a Haskell function f only for
triples ( x, y, z) of integers such that x + y = z. We could define f with
guarded pattern matching as follows.
f :: (Integer, Integer, Integer) -> ...
f (x, y, z) | x + y == z = ...
The domain of the partial function f exactly matches the pattern ϕSUM
defined in the first paragraph if we interpret symbols of ϕSUM in a
reasonable manner. This means we can define an ML model N of
integers where ϕSUM is a pattern that N interprets as the set
{(n1 , n2 , n3 ) ∈ Z3 | n1 + n2 = n3 } = dom(f).
| {z } | {z }
structure logical constraint
Take N as a black box for now. ML models are different from FOL
models because formal symbols are interpreted in ML models as maps
from elements to sets of model elements, not to model elements. On
an abstract level, our model N interprets h·, ·i as a tuple constructor
1 We use the acronym ML throughout the thesis to mean matching logic, not the Meta
Language due to Milner et al.
7
8 matching logic
ϕ
M1
ϕ M4
M3
M2
then the pattern hprime, hprime, evenii distributes h·, ·i over all elements
matched by even and prime in the corresponding positions, i.e., it is
interpreted by N as
matches some triple in N for every even number greater than 2 iff
Goldbach’s conjecture is true. We did not need to change anything
about the pattern ϕSUM from the first paragraph. ML semantics make
structural reasoning very compact and composable (modular). That
is why ML is well-suited for operational semantics of programming
languages and formal verification using these semantics, which was
one of the motivations behind introducing ML [27]. Readers interested
in how to use ML for formal verification are referred to [29] for details.
The pattern ϕGB defined above also illustrates the dual character
of patterns; patterns can specify sets of model elements as well as
specify models among other models (Figure 2.1). This is different from
FOL formulas. Consider some closed FOL formulas ψ1 , ψ2 ; then the
notation
{ψ1 } 6|=FOL ψ2 ,
2.1 syntax 9
says that there is an FOL model of the FOL theory {ψ1 } where ψ2
does not hold. Here ψ1 “specifies” FOL models we are considering,
ψ2 is an untrue statement about those models. FOL formulas express
properties of models by referring to model elements with terms, where
properties are either true or false. On the other hand, the notation
{ψ1 } 6|=ML ψ2 ,
2.1 syntax
¬ ϕ ∧ ψ ≡ (¬ ϕ) ∧ ψ.
If Γfin is a finite set of patterns, we also make our lives slightly easier
and write Γ to mean the pattern γ∈Γfin γ.
V V
ϕ( x1 , . . . , xn ) means FV( ϕ) ⊆ { x1 , . . . , xn }.
2 Note that ψ in ϕ[ψ/x ] can be any pattern as there is technically no difference between
predicates and terms in matching logic.
2.2 semantics 11
2.2 semantics
σ M ( A1 , . . . , A n ) = σ M ( a1 , . . . , a n ).
[
a1 ∈ A1 ,...,an ∈ An
M : M = { m1 , m2 , . . . }, σ M ( m ) = A
3 ϕ
1
...
0
5
2 4
s( ϕ)
M = (N, {s M })
• ρM ( x ) = {ρ( x )},
• ρM (¬ ϕ) = M \ ρM ( ϕ),
• ρM ( ϕ1 ∧ ϕ2 ) = ρM ( ϕ1 ) ∩ ρM ( ϕ2 ),
• ρM (∃ x. ϕ) = ρ[m/x ]M ( ϕ),
S
m∈ M
• ρM (σ( ϕ1 , . . . , ϕn )) = σM (ρM ( ϕ1 ), . . . , ρM ( ϕn )) if σ ∈ Σn ,
where ρ[m/x ]( x ) = m and ρ[m/x ](y) = ρ(y) for all y 6= x. We say
that ϕ evaluates to A (with ρ) if ρM ( ϕ) = A. We say that a matches ϕ
or ϕ matches a (with x := m) if a ∈ ρ[ x/m]M ( ϕ) for some ρ.
Notice that M-valuations are maps from variables to elements of M.
Similarly to other logics, we then extend M-valuations to valuations of
patterns (formulas), which also depend on interpretations of symbols
in the model M. Logical connectives correspond to basic operations
over sets, symbols are arbitrary maps given by models from elements
to sets of elements. This is illustrated by the following example.
Example 2.2.1 (Natural numbers). Consider the {0, s(·)}-model (de-
picted in Figure 2.2) defined as
ρM ((1 ∨ 2 ∨ 3) ∧ ¬ x ) = {1, 3}
(1 ∨ 2 ∨ 3) ∧ ¬ x matches 1 and 3 for x := 2 .
2.3 syntactic sugar 13
1≤ i ≤ k
Of course, M-valuations have no effect on valuations of closed
patterns, i.e., closed patterns match the same elements no matter how
we interpret variables. We use this argument several times in the thesis,
so it is useful to have it stated properly. This intuition is a corollary of
the following proposition.3
ϕ1 ∨ ϕ2 ≡ ¬(¬ ϕ1 ∧ ¬ ϕ2 ) ∀ x. ϕ ≡ ¬∃ x. ¬ ϕ
ϕ1 → ϕ2 ≡ ¬ ϕ1 ∨ ϕ2 > ≡ (∃ x. x ) ∨ ¬(∃ x. x )
ϕ1 ↔ ϕ2 ≡ ( ϕ1 → ϕ2 ) ∧ ( ϕ2 → ϕ1 ) ⊥ ≡ ¬>
• ρM ( ϕ1 ∨ ϕ2 ) = ρM ( ϕ1 ) ∪ ρM ( ϕ2 ),
• ρM ( ϕ1 → ϕ2 ) = ( M \ ρM ( ϕ1 )) ∪ ρM ( ϕ2 )
= M \ (ρM ( ϕ1 ) \ ρM ( ϕ2 )),
• ρM (∀ x. ϕ) = ρ[m/x ]M ( ϕ),
T
m∈ M
∀ ϕ ( x1 , . . . , x n ) ≡ ∀ x1 . . . ∀ x n . ϕ ( x1 , . . . , x n ).
2.4 entailment
We are now ready to define the relation |=ML . Throughout the thesis,
we usually drop ML in |=ML and simply write |=. Because ML does not
distinguish between formulas and terms, patterns play a dual role. We
have seen that each pattern is interpreted as a set of elements given by
the pattern valuations ρM (Definition 2.2.2). Here we learn to think of
patterns in their second role as formulas play in FOL, i.e., patterns can
specify properties of models. A pattern is called valid in an ML model
if the pattern matches all elements of the model, regardless of how we
interpret variables.
Definition 2.4.1 (Validity). Let M be a Σ-model. We say that a pattern
ϕ ∈ PatternΣ is valid in M, denoted M |= ϕ, iff ρM ( ϕ) = M for every
M-valuation ρ.
2.4 entailment 15
Example 2.4.1. Consider the theory {¬ x }. Given any model M with There is a new result
| M| > 1, for every M-valuation ρ it is easy to see that stronger than
Example 2.4.1 that
we cover in
∅ ⊂ ρM (¬ x ) = M \ {ρ( x )} ⊂ M.
Chapter 5.
The direction (⇐) does not hold for arbitrary closed patterns. For
example, in the Σ-model M : M = {0, 1}, λM = {0} we have both
M 6|= ¬λ and M 6|= λ where λ ∈ Σ0 is a closed pattern.
We can also prove that M-predicates are preserved under all stan-
dard connectives:
Proof.
Is this possible without extending the syntax of ML? Note that FOL
with equality is an extension of FOL in both syntax and semantics.
There is indeed no FOL formula EQ(t1 , t2 ) that is true in any given
FOL interpretation iff the terms t1 , t2 point to the same element of the
FOL model. An easy way to prove this is using the Lowenheim-Skolem
theorem (LST):
Then the theory {∀ x ∀y. EQ( x, y)} is countable and satisfiable but
has no infinite model, which is a contradiction with Lowenheim-
Skolem.
ρM (∃y. f ( x ) ↔ y) =
[
M \ ( f M (ρ( x ))4{m})
m∈ M
= ( M \ {0}) ∪ ( M \ {1})
= M.
How can we define d·e to behave this way? It is not that difficult; we
only need d·eM (m) = M for all m ∈ M! How do we specify models
with such a definition of d·e? We consider theories containing the
axiom d x e, which enforces the symbol d·e to behave this way:
(Definedness) d x e.
For this particular symbol d·e we also define totality “b·c”, equality
“=”, membership “∈”, and set containment5 “⊆” as derived constructs:
b ϕc ≡ ¬d¬ ϕe ϕ1 = ϕ2 ≡ b ϕ1 ↔ ϕ2 c
x ∈ ϕ ≡ d x ∧ ϕe ϕ1 ⊆ ϕ2 ≡ b ϕ1 → ϕ2 c
2.6 equality extensions 21
{d x e}= ≡ {d x e, x}
• t( x, m) = ( x = m),
• t ( ϕ1 ∧ ϕ2 , m ) = t ( ϕ1 , m ) ∧ t ( ϕ2 , m ),
• t(∃ x. ϕ, m) = ∃ x. t( ϕ, m),
23
24 connections with first-order logic
• t(σ( ϕ1 , . . . , ϕn ), m) = ∃ x1 . . . ∃ xn . Pσ ( x1 , . . . , xn , m)
^
∧ t ( ϕ i , x i ).
1≤ i ≤ n
for all FOL formulas ϕ. This was proved for many-sorted matching
logic in [27, p. 38] constructing ΓFOL with at least two sorts. Since we
use a single-sorted variant of ML, we have to show a slightly different
method sketched in [8, p. 6]. To mitigate reinventing the wheel, we
include a full proof of a stronger result that for every FOL S-theory Φ
there is an ML theory ΓS such that
for every FOL S-formula ϕ. This was proved neither in [27] nor [8]. Our
construction has also nice properties that were not explicitly showed
in [8].
Given an FOL signature S = (Var, Func, Pred) with variables Var,
function symbols Func = {Func0 , Func1 , . . .} and predicate symbols
Pred = {Pred1 , Pred2 , . . .}, we can notice that FOL structures corre-
spond to a special class of matching logic models if we allow FOL
domains to be sets. Namely every FOL structure can be translated to
an ML model as follows:
• M = A,
(Function) ∃ y . σ ( x1 , . . . , x n ) = y
For the axiom (Function) we can show a lemma that confirms our
intuition:
ΓS = {d x e}
∪ {∃y. f ( x1 , . . . , xn ) = y | f ∈ Funcn }n∈N
∪ { P( x1 , . . . , xn ) = ⊥ ∨ P( x1 , . . . , xn ) = > | P ∈ Predn }n∈N+ .
Note that we w.l.o.g. assume that d·e ∈/ Func ∪ Pred. The following
lemma shows that the axioms ∃y. f ( x1 , . . . , xn ) = y suffice to enforce
that all terms are singletons in a model of ΓS , not just simple function
applications:
ρ x ( x1 ) = m1 , . . . , ρ x ( x n ) = m n .
Then we have
• A = M,
• (m1 , . . . , mn ) ∈ PA if PM (m1 , . . . , mn ) = M,
/ PA if PM (m1 , . . . , mn ) = ∅ where P 6= d·e.
( m1 , . . . , m n ) ∈
• ϕ ≡ P ( t1 , . . . , t n ).
(A, v) |=FOL P(t1 , . . . , tn ) iff (vA (t1 ), . . . , vA (tn )) ∈ PA
h
iff PM (vA (t1 ), . . . , vA (tn )) = M
iff PM ({vA (t1 )}, . . . , {vA (tn )}) = M
1
iff PM (ρM (t1 ), . . . , ρM (tn )) = M
iff ρM ( P(t1 , . . . , tn )) = M
where (1) follows from the first requirement on h.
28 connections with first-order logic
This yields what we set out to prove as A |=ML ϕ iff (A, v) |=ML ϕ
for every valuation v : Var → A iff ρM ( ϕ) = M for every M-valuation
ρ : Var → M iff M |=ML ϕ. Equivalence (2) is given by the proved
statement and the fact that obviously {v | v : Var → A} = {ρ | ρ :
Var → M } because A = M by construction.
Proof.
(⇒) Let A |=FOL Φ. Take the corresponding ML model M from
Theorem 3.2.1, which yields that M |=ML Φ. We also have M |=ML ΓS
by construction, i.e., M |=ML Φ ∪ ΓS .
(⇐) Let M |=ML Φ ∪ ΓS . Take the corresponding FOL structure A
from Theorem 3.2.1. Then A |=FOL Φ.
4.1 system p
A Hilbert-style proof system for ML has been known since the intro-
duction of ML [27, p. 53]. Because ML is very close to FOL, the idea
was to take a complete proof system for FOL and make it work for
matching logic. However, there is a catch; we cannot use the following
axiom for term substitutions:
(∀ x. ϕ) → ϕ[t/x ].
29
30 two proof systems for matching logic
{d x e} |= ((∃y. ψ = y) ∧ ∀ x. ϕ) → ϕ[ψ/x ] if y ∈
/ FV(ψ).
Building upon this idea, [27] presents System P that is sound and
complete for theories containing (Definedness). This system can be
divided into two groups of rules, as outlined by the separator in
Figure 4.1. The first group is a proof system for predicate logic1 with
equality with a workaround for term substitutions. The second group
are technical rules for “∈” that were needed to show completeness
using a translation “backwards” from the translation in Section 3.1. The
symbol Cσ occurring in the last rule will be explained in Section 4.2.
For the rest of the details, we recommend interested readers to see [27,
p. 54].
System P certainly serves its purpose and is educational by showing
how matching logic proofs relate to FOL proofs; the proof of complete-
ness goes by reduction to a complete FOL proof system. Unfortunately,
the inspiration for P is also the very reason why P makes sense only
Observe that symbols such as “=” or “∈” are mere syntactic sugar
over the fixed symbol d·e, e.g., ϕ1 = ϕ2 ≡ ¬d¬ ϕ1 ↔ ϕ2 e. What if Γ
uses the symbol d·e for something else than (Definedness), e.g., for
¬∀ x. d x e? System P does not make sense for these theories.
We defined the so-called equality extensions in Definition 2.6.1, which
add a definedness axiom with a fresh symbol that can be different
from d·e. Why cannot System P use “=” that is a sugar for
ϕ1 = ϕ2 ≡ ¬¬ ϕ1 ↔ ϕ2 ?
We can define a class of proof systems that are the same as P , except
they use any definedness symbol we choose:
One could suggest that we simply add d·e to the ML syntax with
the expected semantics and add d x e as an axiom to P . However, this
is contrary to the principles of ML. ML tries to build upon as small a
core as possible because it is meant to be flexible and simple so that it
is trustworthy.
We would naturally like to find a complete proof system for all
theories or find a fundamental reason why such a system cannot
exist. A counterexample would be interesting as matching logic can be
easily embedded in FOL (Chapter 3) and for FOL we have a complete
proof system. Apart from practical motivations, there is also a strictly
theoretical one: the connection of ML to modal logic (see, e.g., [11]). If
we find a proof system for ML without (Definedness), we might find
an alternative proof system for several modal logics, which could be
defined as ML theories. This would be another strong argument for
ML as a logic unifying other logics.
4.2 system h
We have seen that System P (Section 4.1) makes sense only for theories
containing (Definedness). Moreover, P is not well-suited for the
intentions behind ML, which is discussed already in [27, pp. 53, 57].
The second group of rules in P are more technical than practical; they
axiomatize working with the membership constructs “∈”. Instead, we
would like to axiomatize something more fundamental for matching
logic and derive all of the technical rules as lemmas.
C1 ≡ σ(>) ∧ ∀ x. ,
Cσ ≡ σ( ϕ1 , . . . , ϕi−1 , , ϕi+1 , . . . , ϕn )
(1) The first group is a proof system for propositional logic, which
can be include because of Proposition 2.3.1. Given a tautology of
propositional logic such as p ∨ ¬ p, (PT) says that replacing each
propositional variable pi with a pattern ϕi in this propositional
tautology yields an axiom. If we wish to avoid the meta-rule (PT)
that adds infinitely many rules, we can simply replace it with
any sound and complete system for propositional logic.
Theorem 4.2.1 (Soundness [10]). For every Σ-theory Γ and every pat-
tern ϕ ∈ PatternΣ we have that Γ ` ϕ implies Γ |= ϕ.
closed patterns. Notice that (Sub) and (Gen) mean that we can
focus only on closed patterns in the next discussion without loss of
generality. Intuitively this is because we can always close a pattern
with the corresponding universal quantifiers and vice versa. This is
formally stated in the next theorem.
Proof.
(⇒) Let Γ ` ϕ. By definition of ` there is a finite Σ-theory Γ0 ⊆ Γ
such that Γ0 ` ϕ. The following is the proof of ∀Γ ` ∀ ϕ.
For now it seems that H does not give us much in comparison with
P . On the contrary, let us go through several important properties
that System H provably enjoys. Besides getting rid of the symbol d·e
in our proof system, we have gained an easy way to reason in contexts
(Section 4.2.1, Section 4.2.2), an analogue of the deduction property
(Section 4.2.3), or even the so-called local completeness (Section 4.2.4).
(N, +, ∗) |= 5 ∗ 5 → 25.
5 Recall that the pattern intuitively says: every element that matches 5 ∗ 5 also matches
25.
36 two proof systems for matching logic
Lemma 4.2.5 ([10]). Let C be any context (not just a nested symbol
context). Then Γ ` ϕ1 ↔ ϕ2 implies Γ ` C [ ϕ1 ] ↔ C [ ϕ2 ].
This answers the hanging question about equality from the end of
Section 2.5. Lemma 4.2.5 is stronger than the axiom
^
ϕi = ϕi0 → σ( ϕ1 , . . . , ϕn ) = σ( ϕ10 , . . . , ϕ0n )
1≤ i ≤ n
Γ ∪ {ψ} `D ϕ iff Γ `D ψ → ϕ.
1. λ
2. λ → (∃ x. x → λ) (PT)
3. ∃ x. x → λ 1., 2. (MP)
4. σ(∃ x. x ) → σ(λ) 3. (Framing)
5. σ(∃ x. x ) ↔ ∃ x. σ( x ) Lemma 4.2.3
6. ∃ x. σ( x )
7. (∃ x. σ( x )) → σ(λ) 4., 5. Lemma 4.2.5
8. σ(λ) 6., 7. (MP)
Besides the fact that H is complete w.r.t. theories containing the axiom
(Definedness), H is complete for empty theories (Theorem 4.2.5). The
proof draws inspiration from [5] and is rather technical, combining
techniques from both hybrid modal logic and first-order logic [10,
p. 4]. We provide the result here only for reference.
Γ |= ϕ implies Γ ` ϕ
We shall see that the deduction property plays a central role in the
question whether H is complete.
The structure of this chapter is as follows. We try to follow Henkin’s
method of proving completeness for FOL [20] to see exactly where it
fails for ML: the deduction property. This will lead us to an alternative
characterization of completeness, which is the main result of this
thesis. We notice we can formalize the notion that (Definedness)
“makes” H complete. It turns out H is complete if and only if every
equality extension is a conservative extension. It is difficult to show that
an extension is conservative without a complete proof system and the
deduction property. However, this result will allow us to reduce the
problem of completeness to finite theories and prove some instances
of completeness. By an instance of completeness we mean that H is
complete w.r.t. some given class of theories:
43
44 is system h complete?
(1) We show where Henkin’s method fails when applied to ML. Then
we find an alternative characterization of H-complete theories:
we reduce the completeness problem of H to proving that every
equality extension is a conservative extension (Section 5.1).
(6) We conclude the chapter with open leads to proving other in-
stances of completeness.
Proof.
(⇒) Let Φ be a D -consistent theory, i.e., Φ 6`D ⊥FOL . Then by
completeness of D we get Φ 6|=FOL ⊥FOL . By definition of |=FOL this
means that there exists a model A of Φ such that A 6|=FOL ⊥FOL , i.e., Φ
is satisfiable.
(⇐) We want to prove that D is complete, i.e., Φ 6`D ϕ implies
Φ 6|=FOL ϕ. Let Φ 6`D ϕ.
Φ `D ¬ ϕ → ⊥FOL .
Proof.
(⇒) Let ϕ ∈ PatternΣ . We show the contraposition of (2). If Γ 6`
ϕ, by (1) we have Γ 6|= ϕ. By the extension by definedness lemma
(Lemma 5.1.1) we have Γ= 6|= ϕ. By correctness of H we finally get
Γ= 6` ϕ.
(⇐) Let ϕ ∈ PatternΣ . We show the contraposition of (1). If Γ 6` ϕ,
by (2) we have Γ= 6` ϕ. By completeness of H w.r.t. Γ= , we have
Γ= 6|= ϕ. By extension by definedness lemma (Lemma 5.1.1) we finally
get Γ 6|= ϕ.
∀ x1 . . . ∀ x n . P ( x1 , . . . , x n ) ↔ ϕ ( x1 , . . . , x n )
Proof.
(⇒) Let Γ= ` ϕ and w.l.o.g assume Γ= \ Γ = {d x e} where d·e ∈ / Σ.
By definition of ` there is some finite theory Γ0 ⊆ Γ= such that Γ0 ` ϕ.
Note that Γ0 is not necessarily a Σ-theory because Γ0 can contain
d x e. That is why we instead consider the Σ-theory Γ00 = Γ0 \ {d x e}. By
our assumption from Definition 2.6.1 about the fixed fresh symbol for
Σ we have Γ0 ⊆ Γ00= ⊆ Γ= . But then obviously Γ00= ` ϕ. Because Γ00 is
50 is system h complete?
finite, we can apply (1) to get Γ00 ` ϕ. But then trivially Γ ` ϕ because
Γ00 ⊆ Γ.
(⇐) Trivial.
π ( X ) = { π ( x ) | x ∈ X }.
π (ρ[m/x ]M ( ϕ)).
[
iff π (b) ∈
m∈ M
• ϕ ≡ x. By definition
• ϕ ≡ ∃ x. ϕ.
1 [
π (ρM (∃ x. ϕ)) = π ( ρ[m/x ]M ( ϕ)) = π (ρ[m/x ]M ( ϕ))
[
m∈ M m∈ M
IH [
= (π ◦ ρ[m/x ])M ( ϕ)
m∈ M
2 [
= (π ◦ ρ)[π (m)/x ]M ( ϕ)
m∈ M
3 M 4
(π ◦ ρ)[m0 /x ] ( ϕ) = (π ◦ ρ)M (∀ x. ϕ)
[
=
m0 ∈ M
Equalities (1) and (2) are given by Lemma 5.3.1. IH can be used
because we are proving this for every M-valuation, including
ρ[m/x ]. Equality (3) holds because π is surjective. Equality (4)
is again by definition of pattern interpretation (π ◦ ρ is an M-
valuation).
(1) Γ ` ⊥
1. σ(¬σ(>))
2. ¬σ(>) → > (PT)
3. σ(¬σ(>)) → σ(>) 2. (Framing)
4. σ(>) 1., 3. (MP)
5. ¬σ(¬σ(>)) 4. (Lemma 4.2.4)
6. ⊥ 1., 5. (Lemma 5.4.1)
b∈ M
ψ ` ⊥ implies ` ψ → ⊥.
(2) Γ 6` ⊥ implies Γ= 6` ⊥
(adding a definition does not break consistency).
Proof. We have Γ 6|= ⊥ iff Γ= 6|= ⊥ (Lemma 5.1.1) and Γ= 6|= ⊥ iff
Γ= 6` ⊥ (Proposition 4.2.2).
Theorem 5.4.5 (Henkin’s reduction in ML). Let us assume for any the-
ory Γ that every closed Γ-predicate is a Γ-deduct. Then the following
two statements are equivalent:
(1) H is complete.
(a) H is complete,
Th(M) = { ϕ ∈ PatternΣ | M |= ϕ}
ψ is a Γ= -predicate ψ is a Γ= -deduct
We have shown that the arrow (1) holds only for H-complete theories.
If we proved the arrow (1) or (2) for every theory Γ, Theorem 5.4.5
says that completeness of H is equivalent to claiming that every H-
consistent theory has a model. This would greatly simplify things.
Until then, it is unclear if this direction has more to offer.
There are two more directions which could lead to new results.
First, recall that a theory Γ is H-complete iff Γ= is a conservative
extension of Γ (Theorem 5.1.2). Conservative extensions are tricky to
work with directly but maybe there are some techniques that we have
not tried. Second, we still have not looked at constructing some form
of a canonical model.
We mentioned that we cannot copy the construction of canonical
models from FOL because we do not have negation-complete theories.
That is why we have to look for inspiration elsewhere, namely in
modal logic. Modal logic has much in common with matching logic
and offers two insights into completeness of H:
The next chapter deals with how we can approach (2) and where it
could potentially lead.
C A N O N I C A L M O D E L S F O R E Q UA L I T Y E X T E N S I O N S
6
In Chapter 5 we looked at ways how to approach completeness of H
using conservative extensions. Now we would like to turn to canonical
models. Canonical models are in various forms a widely-known tech-
nique for proving completeness of proof systems (see e.g. [14] or [3]).
Recall that in FOL, canonical models are built using negation-complete
theories. In Section 5.5 we saw that these are problematic in ML. We
have to look elsewhere for inspiration, namely into modal logic [5].
In this chapter we show a new technique how to construct canonical
models for equality extensions that builds upon the theory developed
in [10], which used canonical models from [5] to show local complete-
ness of H. Our contribution extends their construction as follows. For
any given consistent equality extension Γ= , we show a construction of
a model MΓ= such that
Γ= ` ϕ iff MΓ= |= ϕ.
63
64 canonical models for equality extensions
Lemma 6.1.2 (MCS properties [10]). Let Γ be an MCS in (Σ, Var). The
following properties hold.
(1) ϕ ∈ Γ iff Γ ϕ;
(2) ¬ ϕ ∈ Γ iff ϕ ∈
/ Γ;
(4) ϕ1 ∨ ϕ1 ∈ Γ iff ϕ1 ∈ Γ or ϕ2 ∈ Γ;
(5) ϕ1 , ϕ1 → ϕ2 ∈ Γ implies ϕ2 ∈ Γ.
Proof. (⇒) Let Γ ϕ. Then there is some finite Γfin ⊆ Γ such that `
Γfin → ϕ. This is the same as ` Γfin → (¬ ϕ → ⊥), by propositional
V V
Now as we finally know what witnessed MCS’s are and what proper-
ties they have, we can define canonical models:
66 canonical models for equality extensions
• Γ ∈ M,
• P(Γ, ε).
∆ ∈ σ K ( ∆1 , . . . , ∆ n )
∆10
x2
∆2
π1 ...
∆6 x1 ∆1
∆5 ∆3
x Γ ∆9 x3
∆4
x7 π2
∆7 ∆8
...
Figure 6.1: A simplified sketch of the carrier set in some Γ-generated model M.
Each circle is a witnessed MCS in the canonical model K. Dashed
circles are witnessed MCS from K that are not included in M.
Regular circles are witnessed MCS included in M by definition of
Γ-generated models, i.e., each one of these MCS is added by some
generating path π and is represented by some unique variable
(Lemma 6.2.3).
• Cε ≡ is a path context,
Path contexts are interesting because of the fact that they are con-
tained in the basis Γ of the Γ-generated model. This means that rep-
resentatives of every set we add to the generated model are already
given at the start of the construction:
ϕ ∈ ∆ iff ∆ ∈ ρM ( ϕ).
M ∪ {∗} some x ∈ Var is not M-covered
• M∗ =
M otherwise
∗
• σ M ( m1 , . . . , m n ) =
∅ mi = ∗ for some 1 ≤ i ≤ n
= σM (m1 , . . . , mn ) ∪ {∗} mi = Γ for some 1 ≤ i ≤ n, ∗ ∈ M∗
M
σ ( m1 , . . . , m n ) otherwise
Notice that if a Γ-generated model M has all variables covered, then
M is a (unique) Γ-completed model. We only add ∗ if some variable
is not M-covered, in which case there can be multiple completed
models (depending on the chosen ∗). This will be very important
in our construction. Once we have completed models, we can easily
define the so-called completed valuation, for which we already gave the
intuition:
Completed valuations are well-defined because
Lemma 6.2.5 (Truth Lemma [10]). Let Γ be a witnessed MCS in (Var, Σ).
Consider a Γ-completed model M and the corresponding completed
valuation ρ.
For every witnessed MCS ∆ ∈ M, every ϕ ∈ PatternΣ we have
ϕ ∈ ∆ iff ∆ ∈ ρM ( ϕ).
This lemma is the main idea behind proving local completeness of
H, which we discussed in Section 4.2.4. We do not present the proof
here, interested readers are referred to [10] for details.
70 canonical models for equality extensions
Γ ` ϕ iff M |= ϕ.
what worked. We looked away from FOL and tried to prove many
things directly in ML. First, the intuition that (Definedness) “makes”
H complete led to a more tractable if-and-only-if condition for com-
pleteness of H: System H is complete iff every equality extension is a
conservative extension. To the best of our knowledge, we have not seen
such an approach in completeness proofs. What is more, this approach
allowed us to focus on finite theories and prove completeness on a
case-by-case basis. Second, the modal logic idea for canonical models
led to a constructive proof that H is complete w.r.t. equality extensions.
We now know what canonical models for equality extensions look
like, no matter what these theories with equality specify. This is a new
result, which did not follow directly from the results presented in [10].
73
74 conclusion
[1] Oskar Becker. Zur Logik der Modalitäten. Max Niemeyer Verlag,
1930.
[2] Johan F. A. K. van Benthem. “Two simple incomplete modal
logics.” In: Theoria 44.1 (Feb. 11, 2008), pp. 25–37. issn: 00405825,
17552567. doi: 10 . 1111 / j . 1755 - 2567 . 1978 . tb00830 . x. url:
https : / / onlinelibrary . wiley . com / doi / 10 . 1111 / j . 1755 -
2567.1978.tb00830.x (visited on 05/10/2022).
[3] Patrick Blackburn, Johan F. A. K. van Benthem, and Frank
Wolter, eds. Handbook of Modal Logic. 1st edition. Amsterdam
Boston: Elsevier Science, Dec. 25, 2006. 1260 pp. isbn: 978-0-444-
51690-9.
[4] Patrick Blackburn, Maarten de Rijke, and Yde Venema. Modal
Logic. Cambridge: Cambridge University Press, Sept. 30, 2002.
578 pp. isbn: 978-0-521-52714-9.
[5] Patrick Blackburn and Miroslava Tzakova. “Hybrid complete-
ness.” In: Logic Journal of the IGPL 6.4 (July 1998), pp. 625–650.
issn: 1367-0751. doi: 10 . 1093 / jigpal / 6 . 4 . 625. url: https :
//academic.oup.com/jigpal/article-pdf/6/4/625/1878635/
060625.pdf.
[6] Denis Bogdanas and Grigore Roşu. “K-Java: A Complete Seman-
tics of Java.” In: Proceedings of the 42nd Annual ACM SIGPLAN-
SIGACT Symposium on Principles of Programming Languages. POPL
’15: The 42nd Annual ACM SIGPLAN-SIGACT Symposium on
Principles of Programming Languages. Mumbai India: ACM,
Jan. 14, 2015, pp. 445–456. isbn: 978-1-4503-3300-9. doi: 10.1145/
2676726 . 2676982. url: https : / / dl . acm . org / doi / 10 . 1145 /
2676726.2676982 (visited on 05/01/2022).
[7] George Boolos and Giovanni Sambin. “An incomplete system of
modal logic.” In: Journal of Philosophical Logic 14.4 (Nov. 1, 1985),
pp. 351–358. issn: 1573-0433. doi: 10 . 1007 / BF00649480. url:
https://doi.org/10.1007/BF00649480 (visited on 05/10/2022).
[8] Xiaohong Chen, Dorel Lucanu, and Grigore Roşu. “Match-
ing logic explained.” In: Journal of Logical and Algebraic Meth-
ods in Programming 120 (2021), p. 100638. issn: 2352-2208. doi:
https : / / doi . org / 10 . 1016 / j . jlamp . 2021 . 100638. url:
https : / / www . sciencedirect . com / science / article / pii /
S2352220821000018.
[9] Xiaohong Chen and Grigore Roşu. “Applicative matching logic.”
In: (July 31, 2019). url: https://www.ideals.illinois.edu/
handle/2142/104616 (visited on 05/09/2022).
75
76 bibliography
[17] David Harel, Dexter Kozen, and Jerzy Tiuryn. Dynamic logic.
Foundations of computing series. Cambridge, Mass. London:
MIT Press, 2000. 459 pp. isbn: 978-0-262-52766-8 978-0-262-08289-
1.
[18] John Harrison. Handbook of Practical Logic and Automated Reason-
ing. 1st edition. Cambridge ; New York: Cambridge University
Press, Apr. 13, 2009. 702 pp. isbn: 978-0-521-89957-4.
[19] Chris Hathhorn, Chucky Ellison, and Grigore Roşu. “Defining
the undefinedness of C.” In: ACM SIGPLAN Notices 50.6 (Aug. 7,
2015), pp. 336–345. issn: 0362-1340, 1558-1160. doi: 10.1145/
2813885 . 2737979. url: https : / / dl . acm . org / doi / 10 . 1145 /
2813885.2737979 (visited on 05/01/2022).
[25] Amir Pnueli. “The temporal logic of programs.” In: 18th Annual
Symposium on Foundations of Computer Science (sfcs 1977). 18th
Annual Symposium on Foundations of Computer Science (sfcs
1977). Providence, RI, USA: IEEE, Sept. 1977, pp. 46–57. doi:
10.1109/SFCS.1977.32. url: http://ieeexplore.ieee.org/
document/4567924/ (visited on 05/01/2022).
[29] Andrei Stefănescu, Daejun Park, Shijiao Yuwen, Yilong Li, and
Grigore Roşu. “Semantics-based program verifiers for all lan-
guages.” In: ACM SIGPLAN Notices 51.10 (Dec. 5, 2016), pp. 74–
91. issn: 0362-1340, 1558-1160. doi: 10.1145/3022671.2984027.
78 bibliography