The Structure of First-Order Causality
Game semantics describe the interactive behavior of proofs by interpreting formulas as games on which proofs induce strategies. Such a semantics is introduced here for capturing dependencies induced by quantifications in first-order propositional logic. One of the main difficulties that has to be faced during the elaboration of this kind of semantics is to characterize definable strategies, that is strategies which actually behave like a proof. This is usually done by restricting the model to strategies satisfying subtle combinatorial conditions, whose preservation under composition is often difficult to show. Here, we present an original methodology to achieve this task, which requires to combine advanced tools from game semantics, rewriting theory and categorical algebra. We introduce a diagrammatic presentation of the monoidal category of definable strategies of our model, by the means of generators and relations: those strategies can be generated from a finite set of atomic strategies and the equality between strategies admits a finite axiomatization, this equational structure corresponding to a polarized variation of the notion of bialgebra. This work thus bridges algebra and denotational semantics in order to reveal the structure of dependencies induced by first-order quantifiers, and lays the foundations for a mechanized analysis of causality in programming languages.
Denotational semantics were introduced to provide useful abstract invariants of proofs and programs modulo cut-elimination or reduction. In particular, game semantics, introduced in the nineties, have been very successful in capturing precisely the interactive behavior of programs. In these semantics, every type is interpreted as a game (that is as a set of moves that can be played during the game) together with the rules of the game (formalized by a partial order on the moves of the game indicating the dependencies between them). Every move is to be played by one of the two players, called Proponent and Opponent, who should be thought respectively as the program and its environment. A program is characterized by the sequences of moves that it can exchange with its environment during an execution and thus defines a strategy reflecting the interactive behavior of the program inside the game specified by the type of the program.
The notion of pointer game, introduced by Hyland and Ong [?], gave one of the first fully abstract models of PCF (a simply-typed extended with recursion, conditional branching and arithmetical constants). It has revealed that PCF programs generate strategies with partial memory, called innocent because they react to Opponent moves according to their own view of the play. Innocence is in this setting the main ingredient to characterize definable strategies, that is strategies which are the interpretation of a PCF term, because it describes the behavior of the purely functional core of the language (-terms), which also corresponds to proofs in propositional logic. This seminal work has lead to an extremely successful series of semantics: by relaxing in various ways the innocence constraint on strategies, it became suddenly possible to generalize this characterization to PCF programs extended with imperative features such as references, control, non-determinism, etc.
Unfortunately, these constraints are quite specific to game semantics and remain difficult to link with other areas of computer science or algebra. They are moreover very subtle and combinatorial and thus sometimes difficult to work with. This work is an attempt to find new ways to describe the behavior of proofs.
Generating instead of restricting. In this paper, we introduce a game semantics capturing dependencies induced by quantifiers in first-order propositional logic, forming a strict monoidal category called . Instead of characterizing definable strategies of the model by restricting to strategies satisfying particular conditions, we show here that we can equivalently use here a kind of converse approach. We show how to generate definable strategies by giving a presentation of those strategies: a finite set of definable strategies can be used to generate all definable strategies by composition and tensoring, and the equality between strategies obtained this way can be finitely axiomatized.
What we mean precisely by a presentation is a generalization of the usual notion of presentation of a monoid to monoidal categories. For example, consider the additive monoid . It admits the presentation , where and are two generators and is a relation between two elements of the free monoid on . This means that is isomorphic to the free monoid on the two generators, quotiented by the smallest congruence (wrt multiplication) such that . More generally, a (strict) monoidal category (such as ) can be presented by a polygraph, consisting of typed generators in dimension 1 and 2 and relations in dimension 3, such that the category is monoidally equivalent to the free monoidal category on the generators, quotiented by the congruence generated by the relations.
Reasoning locally. The usefulness of our construction is both theoretic and practical. It reveals that the essential algebraic structure of dependencies induced by quantifiers is a polarized variation of the well-known structure of bialgebra, thus bridging game semantics and algebra. It also proves very useful from a technical point of view: this presentation allows us to reason locally about strategies. In particular, it enables us to deduce a posteriori that the strategies of the category are definable (one only needs to check that generators are definable) and that these strategies actually compose, which is not trivial. Finally, the presentation gives a finite description of the category, that we can hope to manipulate with a computer, paving the way for a series of new tools to automate the study of semantics of programming languages.
A game semantics capturing first-order causality. Game semantics has revealed that proofs in logic describe particular strategies to explore formulas. Namely, a formula is a syntactic tree expressing in which order its connectives must be introduced in cut-free proofs of . In this sense, it can be seen as the rules of a game whose moves correspond to connectives. For instance, consider a formula of the form
where and are propositional formulas which may contain free variables. When searching for a proof of , the quantification must be introduced before the quantification, and the quantification can be introduced independently. Here, introducing an existential quantification should be thought as playing a Proponent move (the strategy gives a witness for which the formula holds) and introducing an universal quantification as playing an Opponent move (the strategy receives a term from its environment, for which it has to show that the formula holds). So, the game associated to the formula will be the partial order on the first-order quantifications appearing in the formula, depicted below (to be read from the top to the bottom):
To understand exactly which dependencies induced by proofs are interesting, we shall examine proofs of the formula , which induces the following game:
By permuting the order of introduction rules, the proof of this formula on the left-hand side of
might be reorganized as the proof on the right-hand side if and only if the term used in the introduction rule of the connective does not have as free variable. If the variable is free in then the rule introducing can only be used after the rule introducing the connective. In this case, it will be reflected by a causal dependency in the strategy corresponding to the proof, depicted by an oriented wire:
and we sometimes say that the move justifies the move . A simple further study of permutability of introduction rules of first-order quantifiers shows that this is the only kind of relevant dependencies. These permutations of rules where the motivation for the introduction of non-alternating asynchronous game semantics [?]. However, we focus here on causality and define strategies by the dependencies they induce on moves.
We thus build a strict monoidal category whose objects are games and whose morphisms are strategies, in which we can interpret formulas and proofs in first-order propositional logic, and write for the subcategory of definable strategies. This paper is devoted to the construction of a presentation for this category. We introduce formally the notion of presentation of a monoidal category in Section 1 and recall some useful classical algebraic structures in Section 2. Then, we give a presentation of the category of relations in Section 3 and extend this presentation to the category , that we define formally in Section 4.
1Presentations of monoidal categories
For the lack of space, we don’t recall here the basic definitions in category theory, such as the definition of monoidal categories. The interested reader can find a presentation of these concepts in MacLane’s reference book [?].
Monoidal theories. A monoidal theory is a strict monoidal category whose objects are the natural integers, such that the tensor product on objects is the addition of integers. By an integer , we mean here the finite ordinal and the addition is given by . An algebra of a monoidal theory in a strict monoidal category is a strict monoidal functor from to ; we write for the category of algebras from to and monoidal natural transformations between them. Monoidal theories are sometimes called PRO, this terminology was introduced by Mac Lane in [?] as an abbreviation for “category with products”. They generalize equational theories (or Lawere theories [?]) in the sense that operations are typed and can moreover have multiple outputs as well as multiple inputs, and are not necessarily cartesian but only monoidal.
Presentations of monoidal categories. We now recall the notion of presentation of a monoidal category by the means of typed 1- and 2-dimensional generators and relations.
Suppose that we are given a set whose elements are called atomic types. We write for the free monoid on the set and for the corresponding injection; the product of this monoid is written . The elements of are called types. Suppose moreover that we are given a set , whose elements are called generators, together with two functions , which to every generator associate a type called respectively its source and target. We call a signature such a 4-uple :
Every such signature generates a free strict monoidal category , whose objects are the elements of and whose morphisms are formal composite and tensor products of elements of , quotiented by suitable laws imposing associativity of composition and tensor and compatibility of composition with tensor, see [?]. If we write for the morphisms of this category and for the injection of the generators into this category, we get a diagram
in together with a structure of monoidal category on the graph
where the morphisms are the morphisms (unique by universality of ) such that and . The size of a morphism in is defined inductively by
In particular, a morphism is of size if and only if it is an identity.
Our constructions are a particular case of Burroni’s polygraphs [?] (and Street’s 2-computads [?]) who made precise the sense in which the generated monoidal category is free on the signature. In particular, the following notion of equational theory is a specialization of the definition of a 3-polygraph to the case where there is only one 0-cell.
Every equational theory defines a monoidal category obtained from the monoidal category generated by the signature by quotienting the morphisms by the congruence generated by the relations of the equational theory : it is the smallest congruence (wrt both composition and tensoring) such that for every element of . We say that a monoidal equational theory is a presentation of a strict monoidal category when is monoidally equivalent to the category generated by .
We sometimes informally say that an equational theory has a generator to mean that is an element of such that and . We also say that the equational theory has a relation to mean that there exists an element of such that and .
It is remarkable that every monoidal equational theory where the set is reduced to only one object generates a monoidal category which is a monoidal theory ( is the free monoid on one object), thus giving a notion of presentation of those categories.
Presented categories as models. Suppose that a strict monoidal category is presented by an equational theory , generating a category . The proof that presents can generally be decomposed in two parts:
is a model of the equational theory
: there exists a functor from the category to . This amounts to checking that there exists a functor such that for all morphisms in , implies .
is a fully-complete model of the equational theory
: the functor is full and faithful.
We say that a morphism of represents the morphism of .
Usually, the first point is a straightforward verification. Proving that the functor is full and faithful often requires more work. In this paper, we use the methodology introduced by Burroni [?] and refined by Lafont [?]. We first define canonical forms which are canonical representatives of the equivalence classes of morphisms of under the congruence generated by the relations of . Proving that every morphism is equal to a canonical form can be done by induction on the size of the morphisms. Then, we show that the functor is full and faithful by showing that the canonical forms are in bijection with the morphisms of .
It should be noted that this is not the only technique to prove that an equational theory presents a monoidal category. In particular, Joyal and Street have used topological methods [?] by giving a geometrical construction of the category generated by a signature, in which morphisms are equivalence classes under continuous deformation of progressive plane diagrams (we give some more details about those diagrams, also called string diagrams, later on). Their work is for example extended by Baez and Langford in [?] to give a presentation of the 2-category of 2-tangles in 4 dimensions. The other general methodology the author is aware of, is given by Lack in [?], by constructing elaborate monoidal theories from simpler monoidal theories. Namely, a monoidal theory can be seen as a monad in a particular span bicategory, and monoidal theories can therefore be “composed” given a distributive law between their corresponding monads. We chose not to use those methods because, even though they can be very helpful to build intuitions, they are difficult to formalize and even more to mechanize.
String diagrams. String diagrams provide a convenient way to represent and manipulate the morphisms in the category generated by a presentation. Given an object in a strict monoidal category , a morphism can be drawn graphically as a device with two inputs and one output of type as follows:
when it is clear from the context which morphism of type we are picturing (we sometimes even omit the source and target of the morphisms). Similarly, the identity (which we sometimes simply write ) can be pictured as a wire
The tensor of two morphisms and is obtained by putting the diagram corresponding to above the diagram corresponding to . So, for instance, the morphism can be drawn diagrammatically as
Finally, the composite of two morphisms and can be drawn diagrammatically by putting the diagram corresponding to at the right of the diagram corresponding to and “linking the wires”. The diagram corresponding to the morphism is thus
Suppose that is a signature. Every element of such that
where the and are elements of , can be similarly represented by a diagram
Bigger diagrams can be constructed from these diagrams by composing and tensoring them, as explained above. Joyal and Street have shown in details in [?] that the category of those diagrams, modulo continuous deformations, is precisely the free category generated by a signature (which they call a “tensor scheme”). For example, the equality
in the category of the above example, which holds because of the axioms satisfied in any monoidal category, can be shown by continuously deforming the diagram on the left-hand side below into the diagram on the right-hand side:
All the equalities satisfied in any monoidal category generated by a signature have a similar geometrical interpretation. And conversely, any deformation of diagrams corresponds to an equality of morphisms in monoidal categories.
In this section, we recall the categorical formulation of some well-known algebraic structures. We give those definitions in the setting of a strict monoidal category which is not required to be symmetric. We suppose that is a strict monoidal category, fixed throughout the section. For the lack of space, we will only give graphical representations of axioms, but they can always be reformulated as commutative diagrams.
Symmetric objects. A symmetric object of is an object together with a morphism
called symmetry and pictured as
such that the two equalities
hold (the first equation is sometimes called the Yang-Baxter equation for braids). In particular, in a symmetric monoidal category, every object is canonically equipped with a structure of symmetric object.
Monoids. A monoid in is an object together with two morphisms
called respectively multiplication and unit and pictured respectively as
satisfying the three equations
A symmetric monoid is a monoid which admits a symmetry which is compatible with the operations of the monoid in the sense that the equalities
are satisfied, as well as the equations obtained by turning the diagrams upside-down. A commutative monoid is a symmetric monoid such that the equality
is satisfied. In particular, a commutative monoid in a symmetric monoidal category is a commutative monoid whose symmetry corresponds to the symmetry of the category: . In this case, the equations can always be deduced from the naturality of the symmetry of the monoidal category.
A comonoid in is an object together with two morphisms
respectively drawn as
satisfying dual coherence diagrams. Similarly, the notions symmetric comonoid and cocommutative comonoid can be defined by duality.
The definition of a monoid can be reformulated internally, in the language of equational theories:
The equations are the algebraic formulation of the equations . If we write for the monoidal category generated by the equational theory , the algebras of in a strict monoidal category are precisely its monoids: the category of algebras of the monoidal theory in is monoidally equivalent to the category of monoids in . Similarly, all the algebraic structures introduced in this section can be defined using algebraic theories.
Bialgebras. A bialgebra in is an object together with four morphisms
such that is a symmetry for , is a symmetric monoid and is a symmetric comonoid. The morphism is thus pictured as in , and as in , and and as in . Those two structures should be coherent, in the sense that the four equalities
should be satisfied.
A bialgebra is commutative (cocommutative) when the induced symmetric monoid (symmetric comonoid ) is commutative (cocommutative), and bicommutative when it is both commutative and cocommutative. A bialgebra is qualitative when the following equality holds:
We write for the equational theory of bicommutative bialgebras and for the equational theory of qualitative bicommutative bialgebras.
Dual objects. An object of is said to be left dual to an object when there exists two morphisms
called respectively the unit and the counit of the duality and respectively pictured as
such that the two morphisms
are equal to the identities on and respectively. We write for the equational theory associated to dual objects.
3Presenting the category of relations
We now introduce a presentation of the category of finite ordinals and relations, by refining presentations of simpler categories. This result is mentioned in Examples 6 and 7 of [?] and is proved in three different ways in [?], [?] and [?]. The methodology adopted here to build this presentation has the advantage of being simple to check (although very repetitive) and can be extended to give the presentation of the category of games and strategies described in Section ?. For the lack of space, most of the proofs have been omitted or only sketched; detailed proofs can be found in the author’s PhD thesis [?].
The simplicial category. The simplicial category is the monoidal theory whose morphisms are the monotone functions from to . It has been known for a long time that this category is closely related to the notion of monoid, see [?] or [?] for example. This result can be formulated as follows:
In this sense, the simplicial category impersonates the notion of monoid. We extend here this result to more complex categories.
Multirelations. A multirelation between two finite sets and is a function . It can be equivalently be seen as a multiset whose elements are in or as a matrix over (or as a span in the category of finite sets). If and are two multirelations, their composition is defined by
(this corresponds to the usual composition of matrices if we see and as matrices over ). The cardinal of a multirelation is the sum of its coefficients. We write for the monoidal theory of multirelations: its objects are finite ordinals and morphisms are multirelations between them. It is a strict symmetric monoidal category with the tensor product defined on objects and morphisms by disjoint union, and thus a monoidal theory. In this category, the object can be equipped with the obvious bicommutative bialgebra structure . For example, is the multirelation defined by for or . We now show that the category of multirelations is presented by the equational theory of bicommutative bialgebras. We write for the monoidal category generated by .
For every morphism in , where , we define a morphism by
The stairs morphisms are defined inductively as either or where is a stair, and are represented graphically as
The length of a stairs is defined as if it is an identity, or as the length of the stairs plus one if it is of the form .
Morphisms which are precanonical forms are defined inductively: is either empty or
where is a precanonical form. In this case, we write respectively as (the identity morphism ), as (where is the length of the stairs in the morphism), as or as . Precanonical forms are thus the well formed morphisms (where compositions respect types) generated by the following grammar:
It is easy to see that every non-identity morphism of a category generated by a monoidal equational theory (such as ) can be written as , where is a generator, thus allowing us to reason inductively about morphisms, by case analysis on the integer and on the generator . Using this technique, we can prove that
The canonical forms are precanonical forms which are normal wrt the following rewriting system:
when considered as words generated by the grammar . This rewriting system can easily be shown to be terminating and confluent, and moreover two morphisms and such that can be shown to be equivalent. By Lemma ?, every morphism of is therefore equivalent to an unique canonical form.
We prove by induction on and on the cardinal of that is represented by a precanonical form.
If then is represented by the canonical form (with occurrences of ).
If and for every , then is of the form and is necessarily represented by a precanonical form where is a precanonical form representing , obtained by induction hypothesis.
Otherwise, is necessarily represented by a precanonical form of the form , where is the greatest index such that and is a precanonical form, obtained by induction, representing the relation defined by
It can be moreover shown that every precanonical form representing corresponds to such an enumeration of the coefficients of , that the precanonical form constructed by the proof above is canonical, and that it is the only way to obtain a precanonical form representing .
Finally, we can deduce that
Relations. The monoidal category has finite ordinals as objects and relations as morphisms. This category can be obtained from by quotienting the morphisms by the equivalence relation on multirelations such that two multirelations are equivalent when they have the same null coefficients. We can therefore easily adapt the previous presentation to show that
In particular, precanonical forms are the same and canonical forms are defined by adding the rule to the rewriting system .
4A game semantics for first-order causality
Suppose that we are given a fixed first-order language , that is a set of proposition symbols with given arities, a set of function symbols with given arities and a set of first-order variables . Terms and formulas are respectively generated by the following grammars:
(we only consider formulas without connectives here). We suppose that application of propositions and functions always respect arities. Formulas are considered modulo renaming of bound variables and substitution of a free variable by a term in a formula is defined as usual, avoiding capture of variables. In the following, we sometimes omit the arguments of propositions when they are clear from the context. We also suppose given a set of axioms, that is pairs of propositions, which is reflexive, transitive and closed under substitution. The logic associated to these formulas has the following inference rules:
Games and strategies. Games are defined as follows.
If and are two games, their tensor product is defined by disjoint union on moves, polarities and causality, the opposite game of the game is obtained from by inverting polarities and the arrow game is defined by . A game is filiform when the associated partial order is total (we are mostly interested in such games in the following).
The size of a game is the cardinal of and the size of a strategy is the cardinal of the relation . If and are two strategies, their composite is the partial order on the moves of , defined as the restriction of the transitive closure of the union of the partial orders and (considered as relations). The identity strategy on a game is the strategy such that for every move of we have if and if , where () is the instance of a move in the left-hand side (right-hand side) copy of .
Since composition of strategies is defined in the category of relations, we still have to check that the composite of two strategies and is actually a strategy. The preservation by composition of the polarity condition is immediate. However, proving that the relation corresponding to the composite strategy is acyclic is more difficult: a direct proof of this property is combinatorial, lengthy and requires global reasoning about strategies. For now, we define the category as the category whose objects are finite filiform games, and whose sets of morphisms are the smallest sets containing the strategies on the game as morphisms between two objects and and are moreover closed under composition. We will deduce at the end of the section, from its presentation, that strategies are in fact the only morphisms of this category.
If and are two games, the game (to be read before ) is the game defined as on moves and polarities and is the transitive closure of the relation
This operation is extended as a bifunctor on strategies as follows. If and are two strategies, the strategy is defined as the relation . This bifunctor induces a monoidal structure on the category , where denotes the empty game.
We write for a game with only one Opponent move and for a game with only one Proponent move. It can be easily remarked that finite filiform games are generated by the following grammar
A strategy is represented graphically by drawing a line from a move to a move whenever . For example, the strategy
is the strategy on the game in which both Opponent move of the left-hand game justify the Proponent move of the right-hand game. When a move does not justify (or is not justified by) any other move, we draw a line ended by a small circle. For example, the strategy , drawn as
is the unique strategy from to the terminal object . With these conventions, we introduce notations for some morphisms which are depicted in Figure ?.
A game semantics. A formula is interpreted as a filiform game by
A cut-free proof is interpreted as a strategy whose causality partial order is defined as follows. For every Proponent move interpreting a quantifier introduced by a rule which is either
every Opponent move interpreting an universal quantification on the right-hand side of a sequent, or an existential quantification on the left-hand side of a sequent, is such that whenever the variable is free in the term . For example, a proof
is interpreted respectively by the strategies
when the free variables of are , or .
An equational theory of strategies. We can now introduce the equational theory which will be shown to present the category .
We write for the monoidal category generated by . It can be noticed that the generators , , , , and are superfluous in this presentation (since they can be deduced from the Opponent structure and duality). However, removing them would seriously complicate the proofs.
We can now proceed as in Section 3 to show that the theory introduced in Definition ? presents the category . First, in the category with the monoidal structure induced by , the objects and can be canonically equipped with thirteen morphisms as shown in Figure ? in order to form a model of the theory .
Conversely, we need to introduce a notion of canonical form for the morphisms of . Stairs are defined similarly as before, but are now constructed from the three kinds of polarized crossings , and instead of simply in . The notion of precanonical form is now defined inductively as shown in Figure ?,
where the object is either or and is a precanonical form. These cases correspond respectively to the productions of the following grammar
By induction on the size of morphisms, it can be shown that every morphism of is equivalent to a precanonical form and a notion of canonical form can be defined by adapting the rewriting system into a normalizing rewriting system for precanonical forms. Finally, a reasoning similar to Lemma ? shows that canonical forms are in bijection with morphisms of the category .
As a direct consequence of this Theorem, we deduce that
the composite of two strategies, in the sense of Definition ?, is itself a strategy (in particular, the acyclicity property is preserved by composition),
the strategies of are definable (when the set of axioms is reasonable enough): it is enough to check that generators are definable – for example, the first case of shows that is definable.
We have constructed a game semantics for first-order propositional logic and given a presentation of the category of games and definable strategies. This has revealed the essential structure of causality induced by quantifiers as well as provided technical tools to show definability and composition of strategies.
We consider this work much more as a starting point to bridge semantics and algebra than as a final result. The methodology presented here seems to be very general and many tracks remain to be explored. First, we would like to extend the presentation to a game semantics for richer logic systems, containing connectives (such as conjunction or disjunction). Whilst we do not expect essential technical complications, this case is much more difficult to grasp and manipulate, since a presentation of such a semantics would have generators up to dimension 3 (one dimension is added since games would be trees instead of lines) and corresponding diagrams would now live in a 3-dimensional space. It would also be interesting to know whether it is possible to orient the equalities in the presentations in order to obtain strongly normalizing rewriting systems for the algebraic structures described in the paper. Such rewriting systems are given in [?] – for monoids and commutative monoids for example – but finding a strongly normalizing rewriting system presenting the theory of bialgebras is a difficult problem [?]. Finally, some of the proofs (such as the proof of Lemma ?) are very repetitive and we believe that they could be mechanically checked or automated. However, finding a good representation of morphisms, in order for a program to be able to manipulate them, is a difficult task that we should address in subsequent works.
Acknowledgements. I would like to thank my PhD supervisor Paul-André Melliès as well as John Baez, Albert Burroni, Yves Guiraud, Martin Hyland, Yves Lafont and François Métayer for the lively discussion we had, during which I learned so much.