# An Algebraic Glimpse at Bunched Implications and Separation Logic

We overview the logic of Bunched Implications (BI) and Separation Logic (SL) from a perspective inspired by Hiroakira Ono's algebraic approach to substructural logics. We propose generalized BI algebras (GBI-algebras) as a common framework for algebras arising via "declarative resource reading", intuitionistic generalizations of relation algebras and arrow logics and the distributive Lambek calculus with intuitionistic implication. Apart from existing models of BI (in particular, heap models and effect algebras), we also cover models arising from weakening relations, formal languages or more fine-grained treatment of labelled trees and semistructured data. After briefly discussing the lattice of subvarieties of GBI, we present a suitable duality for GBI along the lines of Esakia and Priestley and an algebraic proof of cut elimination in the setting of residuated frames of Galatos and Jipsen. We also show how the algebraic approach allows generic results on decidability, both positive and negative ones. In the final part of the paper, we gently introduce the substructural audience to some theory behind state-of-art tools, culminating with an algebraic and proof-theoretic presentation of (bi-)abduction.

## Authors

• 3 publications
• 6 publications
• ### Stone-Type Dualities for Separation Logics

Stone-type duality theorems, which relate algebraic and relational/topol...
10/09/2017 ∙ by Simon Docherty, et al. ∙ 0

• ### Focused Proof-search in the Logic of Bunched Implications

The logic of Bunched Implications (BI) freely combines additive and mult...
10/16/2020 ∙ by Alexander Gheorghiu, et al. ∙ 0

• ### Modular Labelled Sequent Calculi for Abstract Separation Logics

Abstract separation logics are a family of extensions of Hoare logic for...
10/30/2017 ∙ by Zhé Hóu, et al. ∙ 0

• ### Syntactic Interpolation for Tense Logics and Bi-Intuitionistic Logic via Nested Sequents

We provide a direct method for proving Craig interpolation for a range o...
10/11/2019 ∙ by Tim Lyon, et al. ∙ 0

• ### On Algebraic Abstractions for Concurrent Separation Logics

Concurrent separation logic is distinguished by transfer of state owners...
10/23/2020 ∙ by František Farka, et al. ∙ 0

• ### Provability in BI's Sequent Calculus is Decidable

The logic of Bunched Implications (BI) combines both additive and multip...
03/03/2021 ∙ by Alexander Gheorghiu, et al. ∙ 0

• ### Duality for Normal Lattice Expansions and Sorted, Residuated Frames with Relations

We revisit the problem of Stone duality for lattices with various quasio...
10/13/2021 ∙ by Chrysafis, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

One of the major themes in the distinguished career of Hiroakira Ono, especially since the mid-1990s, has been the use of algebraic methods for substructural purposes. The monograph GalatosJKO07 which inspired the title of this overview is a monument to this approach. While for “standard” substructural logics we already have an impressive body of work, we believe the time has come to promote this approach for more applied systems, such as generalizations and extensions of the logic of Bunched Implications (BI).

The shortest description of BI is: take the (commutative) propositional substructural signature and add the Heyting implication adjoint to the additive conjunction , immediately forcing the lattice structure to be distributive. The system was explicitly introduced by O’Hearn and Pym OHearnP99:jsl; OHearn99:tlca; Pym99:lics; Pym02:book. Apart from these, more recent overviews of CS-motivated models and applications of BI and related formalisms such as separation logic are Pym et al. PymOHY04:tcs, Brotherston et al. BrotherstonC10:lmcs; BrotherstonK14:jacm, O’Hearn OHearn12:nato or Demri and Deters DemriD15:jancl.

We will have much more to say about these models and applications below. Still, perhaps the most important motivation can be summarized in one phrase: modular reasoning about the use of shared mutable data structures Reynolds00:intuitionistic; Reynolds02:lics, i.e.,

structures where an updatable field can be referenced from more than one point. Reynolds02:lics

In a narrow sense, this applies to heap mutation, pointer aliasing and (de)allocation: in short, dynamic memory management. As recently recalled by O’Hearn et al. OHearnPVH15, however, BI was originally proposed in the context of a broader investigation of “resource modelling” PymOHY04:tcs, with its “declarative” approach to resource contrasting with that of “proofs-as-actions” in linear logic. We are going to systematically overview important classes of models in §3. Unfortunately, we can only briefly discuss the most challenging application—i.e., shared-memory concurrency—in the concluding §10.3.

Despite the rather recent history of BI, several of the key ideas have been around for a long time and some of them can be immediately recognized by substructural logicians. Moreover, the authors of pioneering BI papers made no secret of substructural origins of these ideas. Indeed, according to O’Hearn and Pym (Pym99:lics, §9), OHearnP99:jsl, (Pym02:book, Ch. 1) not only should BI be seen as a relevance logic, in fact up to minor syntactic details, an instance of Belnap’s scheme of display logic Belnap82:jpl, but also the terminology bunches (for a structured term of formulas rather than a sequence of formulas) from which the phrase (logic of) bunched implications derives, comes from Dunn’s work on a sequent calculus for the relevance logic R Dunn75:chapter; Belnap82:jpl; Read88:book; cf. also the work of Mints Mints1976.

On the mathematical side of things, another important early reference is the work of Day Day70:lnm showing that a monoidal (not necessarily closed) structure on a category induces a monoidal closed structure on the corresponding category of Set-presheaves. Together with Urquhart’s work on the semantics of multiplicative intuitionistic linear logic Urquhart72:jsl, this motivated O’Hearn and Pym OHearnP99:jsl; Pym99:lics; Pym02:book to consider total monoid semantics (known to be incomplete in the presence of (Pym02:book, Prop. 4.8), (PymOHY04:tcs, Prop. 6)).

On the CS side of things, Reynolds Reynolds00:intuitionistic; Reynolds02:lics claims that the earliest motivation for separating conjunction is implicit in Burstall’s Burstall72:mi early idea of a distinct nonrepeating tree system. To be more precise, rather than inspiring directly the earliest BI references, Burstall’s work seems to have inspired Reynolds’ development of a language of Hoare triples8) for programs involving shared mutable data structures. Ishtiaq and O’Hearn IshtiaqOH01:popl clarify the connection between that language, which came to be known as separation logic (§§810), and BI as the core of its assertional part; let us note here that this paper is very explicit about the substructural character of BI.

We hope to dispel here whatever remains of a prejudice which seemed to linger in the early days of BI, best illustrated by the following claim:

We are not looking for an algebraic semantics here, where one takes (say) a Heyting algebra with enough structure to model the multiplicatives; this would just be a collapsed version of the DCC semantics, and would not be very informative. (OHearnP99:jsl, §5)

It is worth noting that even a later influential paper by those authors PymOHY04:tcs does find the need for algebras as unifying framework when one is simply interested in theoremhood rather than, say, the structure of proofs.

More importantly, it is all too rarely mentioned that the core idea of BI—that of having both substructural implication adjoint to multiplicative conjunction/fusion and ordinary implication adjoint to additive conjunction—has been seriously studied before even within the confines of boolean propositional base, which is the preferred setup of separation logic these days. This was happening mostly in the 1990’s for two convergent reasons. On the one hand, such research was motivated by generalizing the theory of relation algebras, like in the PhD dissertation of the first author Jipsen92. On the other hand, it was inspired by a dynamic trend in formal semantics of natural language and in information processing. Volumes of collected papers from the period such as Arrow Logic and Multi-Modal Logic marx:arro96 illustrate how fruitful this convergence was. The separation logic and BI communities seem largely unaware of this body of work and, at least in some cases, have proved results which overlap with much earlier ones. Let us point out here just two examples, both of which can be traced back to the above-mentioned 1996 collection marx:arro96 and which will be presented in more detail in §6.2:

• Algebraic results regarding (un)decidability for arrow logics AndrekaKNSS96:csli overlap with results for boolean BI announced almost two decades later.

• Another example is provided by logic for layered graphs CollinsonMDP14:jlc, which essentially reinvents conjugated arrow logic Mikulas96:csli (see Remark 6.4).

To unify these convergent lines of research, in §2 we take as our base variety the class of generalized BI algebras, dropping the assumption of commutativity. In other words, we replace and in the substructural reduct by and : clearly, one needs two residuals instead of one (and we change the notation for the fusion connective to one more in line with the monograph GalatosJKO07, also to highlight that commutativity is not required). This is not an uncommon step in the substructural setting; it is enough to recall how BL algebras were generalized to GBL algebras JipsenTsinakis02. In §3, after overviewing commutative models, we will argue that allowing non-commutativity is crucial to fully cover important classes of models and applications such as weakening relations (§3.3.1) or formal languages (§3.3.2); actually, even to improve the treatment of labelled trees and semistructured data (§3.2.3).111Let us note in passing that dropping associativity of multiplicative conjunction has also been considered from all three perspectives, i.e., that of arrow logic, that of substructural logic, and most recently that of BI and resource reasoning. See Remark 6.4 for more information.

§4 discusses more systematically subvarieties of , both those arising as generalizations of relation algebras and those obtained by adopting subvarieties of residuated lattices/FL-algebras such as those in (GalatosJKO07, §3.5) to our signature. In §5, we present another advantage of algebraic apparatus: a systematic approach to semantics via suitable variants/extensions of Esakia and Priestley dualities. §6 provides an overview of decidability and undecidability results from an algebraic point of view. §7 discusses an algebraic take on proof theory of (G)BI—in particular cut elimination—inspired by recent work on residuated frames; given the contributions of Hiroakira Ono to the literature on algebraic cut elimination BelardinelliJO04; GalatosJKO07; GalatosO10:apal, this seems particularly natural material to present here. §8 provides a gentle introduction to separation logic (SL) for an algebraically oriented audience. §9 reexamines the themes of §6 and §7 from the perspective of SL; in particular, we sketch a substructural proof system for SL and an algebraic and proof-theoretic presentation of (bi-) abduction. Finally, §10 provides a short glimpse at applications and developments we could not cover in detail in this overview, especially state-of-the art tools or the treatment of concurrency.

Given the size of this paper (and possibly divergent interests of its readers), we tried to ensure a reasonable degree of independence between sections, even at the expense of certain redundancy.

## 2 Logic and Algebra

In this section, we discuss the basic algebraic setup and connection to Hilbert-style calculus. The main goal here is to present the class of generalized (non-commutative) BI algebras as a general framework for our paper. However, even when it comes to standard, commutative BI-algebras, we believe the Hilbert style axiomatization we provide in §2.3 has certain advantages over those presented in earlier BI literature.

### 2.1 Algebras

The algebras of bunched implication logic are Heyting algebras with a residuated commutative monoid. While commutativity is a feature of many applications, it is interesting to first investigate a more general theory where this assumption is not built-in.

A Heyting algebra is a bounded lattice such that is the residual of , i.e.,

 x∧y≤z⟺y≤x→zfor all x,y,z∈A.

It follows from this property that distributes over , hence is a distributive lattice, which in turn implies that distributes over . In fact the residuation property easily implies the following stronger identities: if and exist then

 x∧⋁yi=⋁(x∧yi), x→⋀yi=⋀(x→yi) and (⋁yi)→x=⋀(yi→x).

Heyting algebras are the algebraic semantics of intuitionistic logic, with (non-classical) negation defined by .

A generalized bunched implication algebra, or GBI-algebra for short, is of the form where is a Heyting algebra, is a monoid and are the left and right residuals of , i.e.,

 x⋅y≤z⟺y≤x∖z⟺x≤z/yfor all x,y,z∈A.

We usually write instead of , and assume that this operation has the highest priority, followed by , then , and finally . The residuation property implies that for all existing meets and joins

 x(⋁yi)=⋁xyix∖⋀yi=⋀x∖yi(⋁yi)∖x=⋀yi∖x.
 (⋁yi)x=⋁yix(⋀yi)/x=⋀yi/xx/(⋁yi)=⋀x/yi.

GBI-algebras have distributive residuated lattices as reducts, i.e., if are omitted. Many other properties and results follow simply from this observation (see GalatosJKO07).

Homomorphisms between GBI-algebras are functions that preserve all the operations, i.e., such that for all , , and ( follows since ).

The classes of Heyting algebras and of GBI-algebras are denoted by and respectively. They are both finitely based equational classes, meaning they are determined by finitely many equations (or inequations, since and are equivalent). For it suffices to take the equations of bounded lattices together with

 x≤y→((x∧y)∨z)x∧(x→y)≤y

and for GBI-algebras one can add the inequations

 x≤(xy∨z)/y((x/y)∧z)y≤xx≤y∖(yx∨z)x((x∖y)∧z)≤y.

By Birkhoff’s HSP theorem, equational classes are precisely the classes that are varieties, i.e., closed under homomorphic images (H), subalgebras (S) and direct products (P), and moreover, for any class of algebras (of the same type) the variety generated by is HSP (for more details see Raftery:here).

The variety of bunched implication algebras (or BI-algebras) is the subclass of all commutative GBI-algebras. In this case we use the more traditional notation of BI logic: and . The subvariety of Boolean BI-algebras is denoted by , and is obtained by adding the identity .

### 2.2 Congruences

An equivalence relation on an algebra is a congruence if implies for each argument of all fundamental operations of . The set of all such congruences, ordered by inclusion, forms the congruence lattice Con. The structure of this lattice determines several interesting properties of the algebra and of the class containing the algebras Raftery:here so we now consider how to determine congruences of GBI-algebras.

An algebra with a constant operation is called -congruence regular if every congruence relation is determined by its -congruence class , i.e.,

 for all θ,ψ, [e]θ=[e]ψ⟹θ=ψ.

In such an algebra it suffices to describe the -congruence classes, and the poset of these classes, ordered by inclusion, is isomorphic to the congruence lattice of the algebra.

For example, groups are -congruence regular and Heyting algebras are -congruence regular, whereas monoids and lattices (even with bounds and distributivity) are not -congruence regular with respect to any constant operation . In the case of Heyting algebras, the -congruence classes are precisely the lattice-filters of the algebra, i.e., sets such that and imply . The congruence associated with the filter is defined by .

If we ignore the Heyting operations then GBI-algebras are residuated lattices. Congruence classes of lattices are always convex (i.e., if and are in a class, then is also in the class), and as mentioned above, residuated lattices are -congruence regular (see e.g. JipsenTsinakis02). The -congruence classes are precisely the convex subalgebras that are closed under conjugation, i.e., for all and all it follows that . Given such a congruence class , the congruence is determined by .

From these observations we conclude that GBI-algebras are both -congruence regular and -congruence regular. The following criterion can be used to check whether a residuated lattice congruence is a GBI-congruence.

###### Theorem 2.1

Suppose is a residuated lattice congruence on the -free reduct of a GBI-algebra . Then the following are equivalent:

1. is a GBI-congruence.

2. For all if then and .

### 2.3 Logic

Throughout we use algebraic term syntax for logical formulas. Propositional intuitionistic logic uses the symbols to build formulas (= terms) from variables , and abbreviates the formula . The consequence relation of intuitionistic logic is defined by the following Hilbert system, traditionally denoted by HJ. The axioms are all substitution instances of the formulas below, and modus ponens is the only inference rule:

 \inferrulexx→yy⊥→xx→⊤
 x→(y→x)(x→(y→z))→((x→y)→(x→z))
 x∧y→xx∧y→yx→(y→x∧y)
 x→x∨yx→y∨x(x→z)→((y→z)→(x∨y→z))

Given a set of formulas, holds if there is a finite sequence of formulas such that each is in , is an axiom, or is the result of modus ponens applied to for some . For example, a standard (but rather non-obvious) deduction shows that is transitive: . The theorems (or tautologies) of IL are all the formulas such that , or equivalently .

HJ is extended to a Hilbert system HGBI for by adding symbols , all substitution instances of the following formulas as axioms

 (xy)z↔x(yz)1x↔xx1↔x

and the bidirectional residuation rules

 \mprsetfraction====\inferrulexy→zy→x∖z\inferrulexy→zx→z/y.

While many other axioms (or rules) can be used to axiomatize (see further examples below) the axiomatization given here emphasizes the close relationship between Hilbert systems (of sufficient strength) and equational deduction. Neither approach is as effective as the sequent calculus decision procedure that is outlined in Section 7, but Birkhoff’s system of equational deduction requires perhaps less explanation than the corresponding logical systems, and it allows substitution of equal terms based on equalities derived from the axioms or assumptions.

###### Theorem 2.2

HGBI corresponds to GBI: if and only if can be derived by equational reasoning from .

###### Proof

The result is well-known for intuitionistic logic and Heyting algebras. The HGBI axioms clearly correspond to the equational monoid axioms. It remains to show that Birkhoff’s congruence rules are derivable in HGBI. For example the rule is proved as follows:

 1. x→y2. y∖z→y∖z3. y(y∖z)→z4. y→z/(y∖z)
 5. x→z/(y∖z)6. x(y∖z)→z7. y∖z→x∖z

where transitivity of was used for step 5. Hence . The rules , , , , are proved similarly.

A Hilbert system HBI for bunched implication logic is obtained by adding an axiom , in which case the rules for can be omitted, and the rules for are rewritten with . The resulting system is similar to the one in Pym02:book. Alternatively one can use the following system with two more axioms and simpler rules (in addition to the axioms and rules of HJ).

 (x∗y)∗z↔x∗(y∗z)x∗y→y∗xx∗1↔xx∗(x−∗y)→y
 x−∗(y−∗z)↔x∗y−∗z\inferrulex→yx∗z→y∗z\inferrulex→y1→x−∗y.

## 3 Concrete Models

As we already suggested in the Introduction, GBI admits a wealth of practically motivated models. While the models available in the literature are mostly models of the commutative subvariety , dropping the requirement of commutativity widens the catchment area even more impressively.

### 3.1 Generalized PPMs

In order to streamline the discussion and facilitate checking the GBI axioms for a large class of examples, let us follow the example of Pym et al. (PymOHY04:tcs, §3.6) (see also GalmicheMP05:mscs) and define a convenient semantics

• whose defining properties are easily verifiable,

• which covers many natural models and yet

• avoids the full generality of semantics for distributive substructural logics based on ternary relations.

More specifically, consider preordered partial monoids with for and with

• semigroup laws holding up to the equivalence relation defined as ,

• being a collection of unit elements, i.e., for any ,

 ∅≠{x}⋅E⊆[x]≡∅≠E⋅{x}⊆[x]≡

(we always assume the closure of under ),

• the bifunctoriality condition

, and implies and

holding for any .

Such a structure will be called a generalized PPM (short for preordered partial monoid), and the notation is used to indicate that is defined. Most of the time, we will restrict attention to the case where for some ; in such a case, we will speak of a (proper) PPM. Define now , the complex algebra of , as the algebra in GBI-signature whose

• universe consists of all upsets of ,

• Heyting connectives are interpreted in the standard intuitionistic way,

• the unit element is defined as the upset of ,

• is as defined above,

• the residuals are obtained using the fact that upsets are closed under arbitrary unions and distributes over these unions.

###### Fact 3.1

The complex algebra of any PPM is a GBI-algebra.

This is a straightforward generalization of the facts used by Pym et al. PymOHY04:tcs and Galmiche et al. GalmicheMP05:mscs with the obvious difference that we are not assuming commutativity. Of course, from the point of view of a substructural logician, such partial monoids can be turned into instances of ternary relation semantics by setting whenever . We will return to relational semantics in §5.2 and §7, each time with a somewhat different focus and somewhat different notation.

#### 3.1.1 Intuitionistic vs. Classical Resource Models

Most PPM-style models discussed below can be in fact obtained in two flavours: a monoid with a degenerate or discrete order (thus yielding a boolean GBI-algebra) and an associated intuitionistic structure with a nontrivial order definable in terms of the monoid operation. This has been noted early on in the development of BI logic, leading to Gödel-McKinsey-Tarski-style modal translations between intuitionistic and classical logics of suitable classes of models (IshtiaqOH01:popl, Prop. 9) (see also Galmiche2006) and commonly used terms intuitionistic semantics and intuitionistic assertion.

Thus, the idea is well-known, but in our setting we can present it in a rather convenient way. Let a PME (a partial monoid up to equivalence) be a generalized PPM where the ordering is an equivalence relation .

We speak of CPME (commutative partial monoid up to equivalence) when the commutativity law holds. While commutativity makes transition from the boolean to the intuitionistic setting much smoother, we can do without it, at the expense of introducing some additional apparatus. Given a (not necessarily commutative!) PME , let be its center, i.e., the collection of those for which

• for any , whenever , there exists s.t. and

• for any , whenever , there exists s.t. .

Here are some basic facts about the center:

###### Fact 3.2

In any PME :

(i)

,

(ii)

, that is, ,

(iii)

For any , and ,

(iv)

Whenever is commutative, .

Now let us define the substate relation222In the theory of semigroups, one would rather use the name algebraic preordering., generalizing the corresponding definition for separation algebras (see below) proposed by Calcagno et al. Calcagno2007:

iff   .

###### Theorem 3.3

Let be a PME. Then

(i)

the complex algebra of sums of equivalence classes is a boolean GBI algebra,

(ii)

is a preorder, with the associated equivalence relation containing the original ,

(iii)

is a generalized PPM and hence is a GBI-algebra,

(iv)

Elements of are exactly those sets of equivalence classes in which in satisfy one of the following equivalent conditions:

 A⊆A/CM, CM⊆A∖A, A⋅CM⊆A, A⋅CM=A, A⊆CM∖A, CM⊆A/A, CM⋅A⊆A, CM⋅A=A.
(v)

For any s.t. (where denotes an element of rather than ) , it holds that . Hence, whenever is a CPME, (cf. §4) .

###### Proof

(i) A direct corollary of Fact 3.1: sums of equivalence classes are upsets of PME and they are closed under complementation.

(ii) Transitivity of follows from associativity of and Fact 3.2.(ii), whereas reflexivity of follows from the monoidal unit law and Fact 3.2.(i) (both up to bifunctoriality of and equivalence). The latter assures also the containment claim, jointly with transitivity of .

(iii) In the light of (ii), we only need to ensure bifunctoriality of ; note that this is the first time when we use the fact that the substate relation is defined in terms of . Assume s.t. and . By bifunctoriality of , we get that . Iterating the associativity law yields . Now we use the definition of to pick a suitable s.t. . Thanks to Fact 3.2.(ii), we obtain that .

(iv) By definition, a set of equivalence classes is an element of iff for any and , it is the case that . This is an equivalent way of stating that , it holds that . The rest follows form Fact 3.2.(iii).

(v) Assume , and . That is, there are s.t. . By assumption, we get that , thus and we just use the fact that , like all elements of , is -upward closed.

One problem with this construction is that may happen to be bigger than the original , also when is just the diagonal (equality relation). Let us say that a PME is right-cancellative if implies (in presence of commutativity, this also implies left-cancellativity) and satisfies indivisibility of units if

implies (and hence also ).

###### Theorem 3.4

Let be a PME. Whenever is right-cancellative and satisfies indivisibility of units, then the associated equivalence relation of is the same as the original in .

###### Proof

We have already established in Theorem 3.3.(ii) that contains the original . Thus, we have only to show the converse inclusion. Assume then that , and . Therefore, . Right-cancellativity implies that and indivisibility of units implies that , hence .

Whenever in is the equality relation (as it happens in most natural examples), Theorem 3.4 says that cancellativity and indivisibility of units of entail that is a partial ordering.

Separation algebras Calcagno2007 are 1) those CPME’s (i.e., commutative PME’s) which moreover 2) are cancellative, 3) have , i.e., are (proper) PPMs in our terminology, and where 4) is just the identity relation.

### 3.2 Standard Models of BI

In this subsection, we are overviewing models previously investigated in the commutative setting, using Pym et al. (PymOHY04:tcs, §4) as our blueprint. Even here, we are going to see potential for non-commutative generalizations; we are going to explore more “natively non-commutative” models in §3.3.

#### 3.2.1 Resource Allocation and Generalized Effect Algebras

Given any set (which is thought of as the supply of resources), one can impose a separation algebra structure on the set of all its subsets by taking to be whenever these two sets are disjoint and undefined otherwise. The order can be taken to be discrete (equality) or one can transfer it via Theorems 3.3 and 3.4, obtaining ordinary inclusion relation as the ordering. The empty set is the identity element, and the collection of finite subsets form a subalgebra. This example is discussed in detail in Section 4.3 of Pym et al. PymOHY04:tcs (see also IshtiaqOH01:popl; Reynolds00:intuitionistic; Reynolds02:lics).

A generalized effect algebra is a separation algebra that satisfies the positivity law: if then . It is worth mentioning that positivity holds for the separation algebra defined by disjoint union, so this is actually a generalized effect algebra.

The more specialized concept of effect algebra was defined by Foulis and Bennett FoulisBennett94 as an abstraction of quantum effect operators in Hilbert space (i.e., self-adjoint operators with spectrum in the unit interval).

#### 3.2.2 Resource Separation, Memory and the Heap Model

The next example follows the same idea the separation algebra given by disjoint union IshtiaqOH01:popl; Reynolds00:intuitionistic; Reynolds02:lics; PymOHY04:tcs; OHearn12:nato; DemriD15:jancl

. It is also probably the one most responsible for the success of BI in computer science. This time, resources are interpreted concretely as portions of computer memory. A good overview of various possible notions of

memory models can be found in the recent work of Brotherston and Kanovich (BrotherstonK14:jacm, §2) and also in Demri and Deters DemriD15:jancl.

More specifically, given an infinite set of locations and a set of record values , the latter possibly with some additional structure, we define heaps (or heaplets, as suggestively named by Berdine et al. Berdine2006) as finite partial functions from to . Particularly when reasoning about linked data structure, it is common to demand that each contains a (possibly dangling or null) pointer to another , i.e., that we have in addition a function , where is a fixed null pointer. Actually, separation logic overviews quite often restrict attention to single-linked lists, defining to be and the set of base values is typically taken to be, e.g., . There are other possible choices for , for example it can be taken to be .

One obtains a separation algebra structure on heaps by setting to be their union when domains of and are disjoint and undefined otherwise. Again, the intuitionistic option offered by Theorems 3.3 and 3.4 orders heaps by inclusion between their graphs. Interestingly, one of the earliest papers by Reynolds on separation logic Reynolds00:intuitionistic took the latter route (see also IshtiaqOH01:popl; Reynolds02:lics; PymOHY04:tcs)

Let us mention here one more possible tweak to these models, which makes them closer to memory models of actual programming languages and more convenient from the point of view of development of program logics as discussed in §8. It is also our first opportunity to use generalized rather than proper PPM’s. Namely, assume that in addition to the collection of locations , we also have a collection of ordinary program variables , and in addition to record values , we also have store values (or stack values) . We define then stores (or stacks) as mappings from to , either total or (finite) partial ones,333Brotherston and Kanovich (BrotherstonK14:jacm, §2.2) stick to the finite partial definition, but in fact the total one is arguably more natural and common (see e.g. PierceSF; Winskel93; DemriD15:jancl); this is one of differences between stores (stacks) and heap(let)s. Especially under the total perspective the name store, used also by Demri and Deters DemriD15:jancl seems more adequate. Nevertheless, both perspectives can be brought together: one can think of the constant function as the default or unintialized stack (store) and restrict the attention to stacks almost everywhere equal to zero. and the store-and-heap (or stack-and-heap) model (BrotherstonK14:jacm, §2.2)) as consisting of pairs with a store and a heap. The set of units is defined then as the collection of all pairs . We say is defined whenever and (as introduced above) is defined. As we are going to see in §8, having stores at our disposal we do not need anymore the above-mentioned restrictions on the structure of such as the one that each should contain a pointer to another .

[inline,marginclue]Which additional conditions does the preceding sentence refer to?[inline,marginclue]is it clear now?

#### 3.2.3 Ambient Logic, Trees and Semistructured Data

Pym et al. (PymOHY04:tcs, §4.2) illustrate how to obtain a PPM using Cardelli and Gordon’s ambient logic CardelliG00:popl. This influential formalism was developed further in a number of references, some of them focusing on reasoning about trees and semistructured data CardelliG04:mscs; CardelliG01:esop. Subsequent developments included context logic, a formalism specifically intended for analyzing dynamic updates to tree-like structures with pointers (such as XML with identifiers and idrefs) CalcagnoGZ05:popl; CalcagnoDY10:ic. As this example generalizes particularly nicely to the non-commutative setting, we discuss it in more detail.

Consider a set of labels . The set of labelled trees (which might be more adequately called labelled forests following the terminology used in W3C specifications; cf. the discussion in Cardelli and Ghelli (CardelliG04:mscs, §3.4)) is given by the following syntax:

 S,T::=0∣a[S]∣S⋅T

where . This is a standard way to represent semistructured data like XML documents. One identifies forests using the equivalence relation generated by associativity of and being a neutral element for , which obviously yields a generalized PPM. In this free construction of labelled trees, the operation is total and indeed it was intended to be total in several references CardelliG04:mscs; CardelliG01:esop; PymOHY04:tcs, but as pointed out by e.g. Calcagno et al. (CalcagnoGZ05:popl, §2), it is natural to restrict the attention to trees with uniquely identifying labels. Under such an assumption, will be defined only if the labels occurring in are disjoint—and thus we would have yet another example of a partially defined monoid.

However, from our point of view it is even more interesting to note that while almost all references mentioned in this subsection insists on commutativity of , it is hardly the most obvious assumption. In fact, not only are XML documents defined as finite sibling-ordered trees, but official specifications of languages standardized by W3C for the purpose of querying and navigating XML documents like XPath and XQuery allows explicit access to the sibling order (see, e.g., ten Cate et al. tCateLM10:jal; tCateFL10:jancl for more information and further references, including a discussion of the relationship of these formalisms to modal logics). And, needless to say, any representation of trees for storage or manipulation purposes would involve ordering on nodes; in short, should be thought of as creating lists rather than multisets. While this issue is occasionally discussed in the relevant literature (see, e.g., Cardelli and Ghelli (CardelliG04:mscs, Secs. 3.1 and 3.4)), most references quoted here tend to glide over this problem. Dropping the requirement of commutativity makes the complex algebra of such a PPM an instance of a GBI algebra which is not a BI algebra.

Finally, let us note that a natural choice leading to a GBI algebra with a non-boolean Heyting reduct is to replace the discrete order on trees by defined as “ is a generated subtree (or, strictly speaking, a generated subforest) of ”.

#### 3.2.4 Costs, Logic Programming and Petri Nets

Pym et al. (PymOHY04:tcs, §4) describe three other classes of CS-motivated PPM’s giving rise to natural BI complex algebras:

• an adjustment of the Petri net semantics of linear logic described by Engberg and Winskel EngbergW97:apal. An interesting feature of this example is that the PPM in question illustrates the benefits of allowing preorders instead of insisting on posets. Modelling of Petri nets using separation algebras is discussed by Calcagno et al. (Calcagno2007, §2);

• a logic programming model of Armelín and Pym

ArmelinP01:ijcar based on a commutative total PPM of hereditary Harrop bunches and

• a money and cost example, deliberately tailored to highlight both similarities and differences with Girard’s Marlboros and Camels linear logic example.

We refer the reader to Pym et al. (PymOHY04:tcs, §4) for details and references. Brotherston and Calcagno (BrotherstonC10:lmcs, §5) provide some additional commutative models, focusing on involutive boolean ones, i.e., those whose dual algebras belong to the variety denoted in §4 as (Brotherston and Calcagno BrotherstonC10:lmcs use the term classical).

### 3.3 Noncommutative Models

Finally, we present two more classes of examples, illustrating the advantages of dropping the assumption of commutativity.

#### 3.3.1 Weakening Relations and Relation Algebras

This example requires generalized rather than proper PPM’s. Consider a poset . Say that is a weakening relation on iff , where is the relation composition. The collection of all the weakening relations on is written as .

###### Fact 3.5

is closed under arbitrary unions and intersections , with distributing over and being the neutral element of .

Consequently, carries the structure of a GBI algebra.

It is possible to see as a complex algebra of a (generalized!) PPM. Set and consider . The set of unit elements and the partial monoid operation are defined then in an obvious way, i.e., and whenever and undefined otherwise. Fact 3.5 is then obtained as a corollary of Fact 3.1.

What is particularly interesting about this example is that when we restrict attention to discrete , we obtain exactly what is known as full set relation algebras (HenkinMT85:book2, Def. 5.3.2) or square relation algebras (Maddux2006:book, Ch. 6.0.3).

#### 3.3.2 Language Models

Consider an alphabet . As usual, we will write the set of words in as . The notions of language and regular language are standard and so is the notion of composition of languages. It is well-known that the set of regular languages, just like of all languages, is closed under finite sums and intersections, residuals and boolean complementation; for reference see, e.g., Pratt (Pratt91:lncs, Section 3.2). Therefore, both arbitrary languages and regular languages over a given form a nice example of a boolean GBI. In fact, we can see this as another instance of the PPM setting, but once again dropping the assumption of commutativity was crucial to achieve full generality.

[inline,marginclue]Parikh languages?[inline,marginclue]Yes, briefly, to beef this section up a bit.

## 4 Subvarieties of GBI-algebras and InGBI-algebras

As mentioned before, GBI-algebras form a variety denoted . A subvariety of  is any subclass that is closed under HSP, or equivalently any subclass that is determined by a set of identities (that includes the equational axioms of ). The collection of all subvarieties of  is denoted by or simply . Since subvarieties are determined by sets of identities, contains at most continuum many subvarieties. Jankov Jankov68 showed that there are indeed continuum many subvarieties of Heyting algebras, hence the same is true for GBI. Subvarieties are ordered by inclusion, and is in fact an algebraic distributive lattice, with and . The least element is the trivial variety of one-element GBI-algebras, and the largest element is .

For an involutive GBI-algebra, we first need to expand the language with a new constant symbol , which is used to term-define the linear negations and . Then we add the identities to define the variety .

Some prominent subvarieties444The reader is encouraged to compare this list with those found in (GalatosJKO07, §3.5). of and are:

• The variety defined relative to by .

• The variety of GBI-algebras that satisfy the structural rule of weakening, defined by the identity , or equivalently by .

• The variety of Boolean GBI-algebras, defined by . It is also known as , the variety of residuated Boolean monoids Jipsen92.

• The variety of cyclic involutive GBI algebras, defined relative to by .

• The variety of involutive BI-algebras, defined relative to by .

• The variety of weakening representable relation algebras, generated by all full weakening relation algebras where ranges over all sets.

• The variety of sequential algebras, defined relative to by the Euclidean law where JipsenMaddux97.

• The variety of relation algebras, defined by JonssonTsinakis93. The term is the converse operation in relation algebras, denoted by .

• The variety of representable relation algebras, generated by all full relation algebras where ranges over all sets.

• The variety of commutative relation algebras, defined relative to by .

• The variety of group relation algebras, generated by all complex algebras of groups.

• The variety of symmetric relation algebras, defined relative to by .

• The variety of Boolean BI-algebras (= in Jipsen92).

• is generated by all linearly ordered GBI-algebras, or equivalently defined by the identity .

• The variety of basic logic BI-algebras, defined by .

• The variety of Heyting algebras, defined by .

• The variety of Gödel algebras, defined by and .

• The variety of multi-valued BI-algebras, defined relative to by .

Figure 1 shows how these and some other varieties are related to each other. However, the picture is just a subposet of the infinite lattice of subvarieties of GBI and cannot be used to deduce joins and meets of varieties.

Recall (from Raftery:here) that an algebra is subdirectly irreducible if its congruence lattice has a minimal nontrivial congruence, and that any algebra is a subalgebra of a product of its subdirectly irreducible homomorphic images. The subdirectly irreducible members of a variety are denoted by , hence .

Every variety is equal to for some algebra since varieties contain countably generated free algebras. A variety is finitely generated if it is of the form for some finite algebra. In this case, if is congruence distributive (i.e., all members have distributive congruence lattices), then Jónsson’s Lemma implies . Hence any subvariety of a finitely generated congruence distributive variety is again finitely generated and for a finite algebra , has only finitely many subvarieties. Since we also have , the collection of finitely generated subvarieties of form a lattice ideal. In particular, the varieties of residuated lattices and GBI-algebras are congruence distributive, since they are varieties of lattice-ordered algebras and all lattices have distributive congruence lattices.

As a result we can investigate the bottom of the lattice by investigating finite subdirectly irreducible GBI-algebras. In any GBI-algebra one has , hence . It follows that a GBI-algebra with must be trivial, hence it generates the variety . The smallest nontrivial GBI-algebra is the 2-element Boolean algebra, with , and . Naturally this algebra generates the variety of Boolean algebras.

A 3-element lattice must be linearly ordered, so we can assume . There are in fact 3 such algebras: The 3-element Gödel algebra where and , the 3-element MV-algebra where (hence ), and the Sugihara algebra where . The operations are uniquely determined by the order and the monoid operation, and it is easy to check that these algebras are subdirectly irreducible.

An algebra is simple if it has exactly two congruences, and it is strictly simple if, in addition, it has no proper subalgebras. Using Jónsson’s Lemma it is easy to see that strictly simple algebras generate varieties that only contains as proper subvariety. Note that is strictly simple, is simple but not strictly simple, and is subdirectly irreducible but not simple. Both and have a subalgebra isomorphic to the 2-element Boolean algebra, hence they generate varieties with two proper subvarieties.

There are several methods for constructing larger residuated lattices from given ones. We consider two that also apply to GBI-algebras. These constructions are used in Table 1 to provide convenient names for some of the algebras.

Generalized ordinal sum: Let , be GBI-algebras and assume that the identity element of is comparable with all elements of . Let

 A[B]=(A−{1})∪B,

and extend the operations to by and for all , and . Also, if then in , and dually, if then . If satisfies then this is the usual ordinal sum of two bounded lattice-ordered algebras.

Adding a new top: Let be a GBI-algebra with . The algebra is defined by where is strictly greater than . The fusion operation is extended by for all . Hence is almost an identity element, except that . It is easy to check that the operation is associative, and the residuals are definable in terms of and . Therefore the algebra is also a GBI-algebra.

We note that there are exactly 20 nonisomorphic GBI-algebras with 4 elements (see Table 1 and Figure 1). The number of nonisomorphic join-preserving monoid operations on a finite distributive lattice increase rapidly. The number of nonisomorphic (G)BI-algebras for small values of are as follows.

2 3 4 5 6 7 8
GBI 1 3 20 115 899 7782 80468
BI 1 3 16 70 399 2261 14358

Any finite distributive residuated lattice is the reduct of a GBI-algebra, but this observation does not extend to all distributive residuated lattices. For example, one may consider any bounded distributive lattice that is not the reduct of a Heyting algebra, and that has an atom . On such a lattice one can define a fusion operation by

 x⋅y={1 if x≠⊥≠y⊥ otherwise

and check that it is a monoid operation that is residuated.

## 5 Semantics via Duality

Heyting algebras and BI-algebras provide algebraic semantics for intuitionistic logic and bunched implication logic respectively. However the algebras that are of interest can be rather large, or they may have quite complicated order structure. Since they have distributive lattice reducts, it is useful to consider smaller or more concrete combinatorial structures from which the lattice order can be recovered. Considering the categories and , with homomorphisms as morphisms, one would like to have equivalent or dually equivalent categories. For there is a well-developed duality theory based on Esakia spaces, and we briefly recall the relevant details here. Adding a suitable ternary Kripke relation extends this duality to GBI-algebras as well as to involutive GBI-algebras. Finally we consider a relational semantics based on residuated frames, since this is closely related to the proof theory that we present in Section 7.

Before presenting the topological dualities, we first consider Birkhoff’s duality for finite distributive lattices, and its extension to complete and perfect distributive lattices. Note that for an element in a lattice, always exists, and is either or a dual cover of . In the latter case, is said to be completely join-irreducible, and its dual cover is denoted by .The set of completely join-irreducible elements of a lattice is denoted by . Dually, a completely meet-irreducible element satisfies , and the set of all such elements is denoted .

A lattice is complete if all joins and meets exist. Even for a complete lattice, and/or may be empty, as happens for the unit interval of real numbers.

A lattice is join-perfect if every element is the join of completely join-irreducible elements, it is meet-perfect if very element is the meet of completely meet-irreducible elements, and it is perfect if both conditions hold. For example, a Boolean algebra is join-perfect if it is atomic (= every element is a join of atoms, defined as minimal non-zero elements), and every finite lattice is perfect. For a Boolean algebra, being join-perfect is equivalent to being meet-perfect since complementation is a dual isomorphism. However, even for complete distributive lattices this is not the case, as can be seen from the join-perfect distributive lattice completed with a top element, since it has no completely meet-irreducible elements.

###### Lemma 1

Any join-perfect Heyting algebra is also meet-perfect, hence a perfect lattice.

###### Proof

Suppose is an element in a join-perfect Heyting algebra , and let . If then there exists a lower bound of such that . Since is a join of completely join-irreducibles, there exists such that and . Let , where is the unique dual cover of . We show that then it follows that , which is a contradiction.

From we get , hence . To see that , note that if then , therefore and hence . It follows that , and since we conclude that .

The converse of this lemma does not hold, since for example the dual of with a bottom added is a (complete) meet-perfect Heyting algebra that is not join-perfect.

For complete Heyting algebras, the notion of being perfect is equivalent to being a doubly algebraic lattice (i.e., a complete lattice in which every element is the join of compact elements and the meet of co-compact elements).

### 5.1 Semantics and Duality for Heyting Algebras

Tarski proved that complete and atomic Boolean algebras are isomorphic to powerset algebras, and that homomorphisms between Boolean algebras are induced by functions (in the opposite direction) between their sets of atoms. In a nutshell this is the categorical duality between and , the category of sets.

Birkhoff observed that every finite distributive lattice is isomorphic to the set of downward closed subsets of