Condition/Decision Duality and the Internal Logic of Extensive Restriction Categories

05/22/2019 ∙ by Robin Kaarsgaard, et al. ∙ Københavns Uni 0

In flowchart languages, predicates play an interesting double role. In the textual representation, they are often presented as conditions, i.e., expressions which are easily combined with other conditions (often via Boolean combinators) to form new conditions, though they only play a supporting role in aiding branching statements choose a branch to follow. On the other hand, in the graphical representation they are typically presented as decisions, intrinsically capable of directing control flow yet mostly oblivious to Boolean combination. While categorical treatments of flowchart languages are abundant, none of them provide a treatment of this dual nature of predicates. In the present paper, we argue that extensive restriction categories are precisely categories that capture such a condition/decision duality, by means of morphisms which, coincidentally, are also called decisions. Further, we show that having these categorical decisions amounts to having an internal logic: Analogous to how subobjects of an object in a topos form a Heyting algebra, we show that decisions on an object in an extensive restriction category form a De Morgan quasilattice, the algebraic structure associated with the (three-valued) weak Kleene logic K^w_3. Full classical propositional logic can be recovered by restricting to total decisions, yielding extensive categories in the usual sense, and confirming (from a different direction) a result from effectus theory that predicates on objects in extensive categories form Boolean algebras. As an application, since (categorical) decisions are partial isomorphisms, this approach provides naturally reversible models of classical propositional logic and weak Kleene logic.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

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

Flowchart languages are a particular class of imperative programming languages which permit a pleasant and intuitive graphical representation of the control flow of programs. While conceptually very simple, flowchart languages form the foundation for modern imperative programming languages, and have been used for this reason as vehicles for program analysis (e.g., to measure coverage in white-box testing [1]), program transformations (e.g., partial evaluation, see [17]), and to express fundamental properties of imperative programming, such as the equivalence of expressivity in structured and unstructured programming in the Böhm-Jacopini theorem [4] (see also [3, 28]). Figure 1 shows the (textual and graphical) flowchart structures used by structured flowchart languages.

An interesting feature in flowchart languages is the dual presentation of predicates as conditions and decisions, depending on the context. On the one hand, the textual seems to favor the view of as a condition, i.e., a predicate which has inherently nothing to do with control flow, but which may easily be combined with other conditions to other conditions to form new ones. In other words, the textual representation considers the branching behaviour to be given by the semantics of rather than by the semantics of . This view is also emphasized by the usual (big-step) operational semantics of conditionals: Here, predicates are treated as expressions that may be evaluated in a state to yield a Boolean value, which the conditional may then branch on, as in

On the other hand, the graphical representation of conditionals in Figure 1(c) seems to rather prefer the view of as a decision, i.e., a kind of flowchart operation intrinsically capable of directing control flow. That is to say, that this is a structured flowchart (corresponding to a conditional) is purely coincidental; for unstructured flowcharts to make sense, must be able to direct control flow on its own. However, where conditions are most naturally composed via the Boolean combinators, the only natural way of composing decisions seems to be in sequence (though this leads to additional output branches).

While categorical models of structured flowchart languages have been widely studied (see, e.g., [26, 27, 2, 24, 10, 11]), none provide a treatment of this dual view of predicates. In this paper, we argue that extensive restriction categories are precisely categories that make clear this dual view on predicates as conditions and decisions, offering both the ease of combination of conditions and the control flow behaviour of decisions. Restriction categories (introduced in [7, 8, 9]) are categories of partial maps, in which each morphism is equipped with a restriction idempotent that, in a certain sense, gauges how partial that morphism is. Since models of flowchart languages most provide a notion of partiality (due to possible nontermination), restriction categories provide an ideal setting for such models. Coincidentally, the defining feature of extensive restriction categories111Note that while extensive restriction categories are strongly connected to extensive categories, they are confusingly not extensive in the usual sense of extensive categories [5]. is the presence of certain morphisms called decisions, which play a similar role as the decision view on predicates in flowchart languages.

In this setting, we show that the correspondence between conditions and decisions is exhibited precisely as a natural isomorphism between the predicate fibration of predicates and predicate transformers (see also [6, 16]), and the decision fibration of decisions (certain morphisms ) and decision transformers. We then go on to explore the structure of (or equivalently, ), showing that this extends to a fibration over the category of De Morgan quasilattices and homomorphisms, which give algebraic semantics [12] to Kleene’s weak logic  [21]. Intuitively, can be seen as a partial version of classical (Boolean) logic. We make this statement precise in this setting by showing that if we restrict ourselves to total decisions and decision transformations, classical logic can be recovered. Since the subcategory of objects and total morphisms of a (split) extensive restriction category is an extensive category in the usual sense (see, e.g., [5]), we can use this to provide an alternative proof of a statement from Effectus theory [16, 6] that predicates over each extensive category forms a fibred Boolean algebra via the predicate fibration [6, Prop. 61, Prop. 88]. This yields a relationship diagram of effecti, extensive categories, and extensive restriction categories and their corresponding logics as shown in Figure 2.

fc_struct

Figure 1: The four flowchart structures.

This paper is structured as follows: Section 2 gives a brief introduction to extensive restriction categories. Section 3 demonstrates the condition/decision duality of extensive restriction categories by showing that the decision and predicate fibrations are naturally isomorphic; and, as a consequence, that decisions are a property of the predicates. Then, in Section 4, we show that the decisions on an object form models of , with decision transformers as homomorphisms. By restricting to only total decisions, we show that these restrict to models of classical logic. Finally, 5 offers some concluding remarks.

Extensive category
Boolean algebras

Extensive restriction category
De Morgan quasilattices

Effectus
Effect algebras

Figure 2: Extensive categories, extensive restriction categories, and effecti: their relationships and associated logics.

2 Extensive restriction categories

This section gives an introduction to extensive restriction categories as it will be applied in the sections that follow. The experienced reader may safely skip this section on a first reading, and instead refer back to it as necessary.

Restriction categories are categories equipped with notions of partiality and totality of morphisms. This is done by means of a restriction combinator, assigning to each morphism its restriction idempotent (subject to certain laws) which may intuitively be thought of as a partial identity defined precisely where is defined. In this way, restriction categories provide an axiomatic (and relatively light-weight) approach to partiality of morphisms in categories. Formally, restriction categories are defined in the following way:

A restriction structure on a category consists of a combinator mapping each morphism to its restriction idempotent , i.e.

subject to the restriction laws:

  • for all ,

  • for all and ,

  • for all and , and

  • for all and .

A category equipped with a restriction structure is called a restriction category.

As the name suggests, a restriction structure is a structure on a category rather than a property of it; in particular, a category can be equipped with several different restriction structures. For this reason, we must in principle specify which restriction structure we are using when speaking of a particular category as a restriction category, though this is often omitted when the restriction structure is implicitly given to be a canonical one.

Given that restriction categories are built on a foundation of idempotents, one would expect it to be occasionally useful when all such restriction idempotents split, and indeed this is the case. Say that restriction structure is split when all restriction idempotents split, and let denote the category arising from the usual idempotent splitting (i.e., the Karoubi envelope) of all restriction idempotents in . That is a restriction category when is follows by [7, Prop. 2.26]

As a canonical example, the category of sets and partial functions is a restriction category, with the restriction idempotent for given by

In a restriction category, say that a morphism is total if , and that it is a partial isomorphism if there exists such that and . Partial isomorphisms thus generalize ordinary isomorphisms, as an isomorphism is then a partial isomorphism such that both and are total.

Since total morphisms are closed under composition and include all identities, they form an important subcategory of any restriction category . Likewise, partial isomorphisms are closed under composition and include all identities, so all objects and partial isomorphisms of form the subcategory . As the notation suggests, this category is not just a restriction category but an inverse category (indeed, it is the cofree such [18]) in the usual sense (see [7, 20]).

A useful property of restriction categories is that they come with a natural partial order on homsets (which extends to enrichment in ) given by iff . Intuitively, this can be thought of as an information order; if can do everything can do, and possibly more.

Like any other categorical structure, when working in restriction categories we require everything in sight to cooperate with the restriction structure. One of the simplest examples of cooperation with restriction structure is given in the definition of a restriction terminal object: This is simply a terminal object in the usual sense, which further satisfies that the unique map is total for all objects . For coproducts, this means that we not only require the restriction category to have all finite coproducts in the usual sense, but also that the coproduct injections and are total. In this case, we say that the restriction category has restriction coproducts. There is also a similar notion of a restriction zero object : a zero object in the usual sense which additionally satisfies that each zero endomorphism is its own restriction idempotent, i.e., that (or equivalently, that for all zero morphisms ). When zero morphisms exist, they serve as least element in their homset with respect to the natural ordering, and when a category has restriction coproducts and a restriction zero object, the restriction zero object serves as unit for the restriction coproduct. When this is the case, restriction coproduct injections are further partial isomorphisms (e.g., the partial inverse to is ).

Extensivity for restriction categories means that the restriction coproducts are particularly well-behaved, in the sense that they admit a calculus of matrices [9]. Concretely, this means that each morphism is associated with a unique morphism , its decision, which, intuitively, makes the same branching choices as does, but doesn’t do any actual work. Extensive restriction categories are defined as follows.

A restriction category with restriction coproducts and a restriction zero is said to be an extensive restriction category if each morphism has a unique decision , i.e.

satisfying the decision laws

where is the natural codiagonal . Note that extensive restriction categories are not extensive in the usual sense – rather, extensive restriction categories are the “partial” version of extensive categories. This connection is made precise by the following proposition due to [9]. Whenever is an extensive restriction category, is an extensive category. A straightforward example of an extensive restriction category is . Here, the decision of a partial function is given by

For further examples and details on extensive restriction categories, see [9].

3 Condition/decision duality

Categorical models of flowcharts are categories with a notion of partiality (due to possible nontermination) and coproducts (corresponding to the control flows of the flowchart). As such, restriction categories with restriction coproducts serve as a good starting point for these. We show in this section that the additional requirement of extensivity of the restriction coproduct allows the category to exhibit a condition/decision duality, analogous to the flowchart languages. This manifests in the category as a natural isomorphism between the decisions and predicates over an object (with their corresponding transformations).

We start with a few technical lemmas regarding the partial order on morphisms in a restriction category as well as properties of decisions in extensive restriction categories.

It is the case that

  1. implies ,

  2. ,

  3. implies and ,

  4. and iff .

  5. implies .

Let and be arbitrary morphisms of an extensive restriction category, and any restriction idempotent. It is the case that

  1. is a partial isomorphism and

  2. is a decision and

A few of these identities were shown already in [9]; the rest are mostly straightforward to derive. Note that a direct consequence of (i) is that ; we will make heavy use of this fact in Section 4. Another particularly useful identity is the following, stating intuitively that anything that behaves as a decision in each component is, in fact, a decision.

If and then . By Lemma 3(ii) . Since and it follows that and so it follows by the universal mapping property of the coproduct that , and finally by unicity of partial inverses.

As a corollary, is a decision if and are both restriction idempotents (i.e., if and ) since all decisions decide themselves (i.e., since ).

There is a functor given by mapping objects to their decisions, and morphisms to decision transformers. Define this functor by on objects, and by on morphisms. This is contravariantly functorial since by Lemma 3(i), and by Lemma 3(vi) and definition of , as desired.

From now on, we will use the notation for the decision transformation .

This is an example of a fibred category, which have historically been important in categorical presentations of logic, e.g., in topoi (see [15] for a thorough treatment of indexed and fibred categories in categorical logic). In Section 4, we will see that this indexed category extends beyond to a model of . For now, it is sufficient to show the equivalence between conditions (morphisms ) and decisions (morphisms satisfying the decision laws of Definition 2).

[Condition/decision duality] Decisions and predicates are naturally isomorphic in any extensive restriction category with a restriction terminal object: . Let be an extensive restriction category with a restriction terminal object, and some object of ; we begin by showing that the mappings

between and yields a bijection. In other words, we must show that and . To show , we show that decides by using the fact that the unique map is total by restriction terminal, and by . Thus , as desired.

To show that for we show something slightly more general, namely that for any . That then follows as a special case since by terminal, so . This slightly more general statement follows by commutativity of the diagram below.

(i)

(ii)

(iii)

Here, (i) commutes by the second axiom of decisions, while (ii) and (iii) both commute by terminal.

To see that this bijection extends to a natural isomorphism, we must fix some and chase the diagram

where we use to denote the functorial action , . Picking some we must have , which indeed follows by the statement above. On the other hand, picking some , chasing yields that we must have , which follows directly by Lemma 3 (vi).

A consequence of this equivalence in extensive restriction categories is that decisions are a property of the predicates rather than a property of arbitrary maps, as it is commonly presented. This is shown in the following corollary to Theorem 3.

A restriction category with restriction coproducts, a restriction zero, and a restriction terminal object has all decisions (i.e., is extensive as a restriction category) iff it has all decisions of predicates. It follows directly that having decisions for all morphisms implies having decisions for all predicates. On the other hand, suppose that the category only has decisions for predicates, and let be an arbitrary morphism. But then, by the proof of Theorem 3, the decision for the predicate decides (by ), and we are done.

4 The internal logic of extensive restriction categories

Having established the natural isomorphism of decisions and predicates (with their respective transformers) which forms the condition/decision duality at the categorical level, we now turn to their structure. The main result of this section, Theorem 4.2, shows that the decisions on an object form a model of , and that decision transformers are homomorphisms of these models. We first recall Kleene’s three valued logics, in particular and its algebraic counterpart of De Morgan quasilattices.

4.1 Kleene’s three valued logics and De Morgan quasilattices

Kleene’s three valued logics of (strong Kleene logic) and (weak Kleene logic), both introduced in [21], are logics based on partial predicates with a computational interpretation: Predicates are conceived of as programs which may not terminate, but if they do, they terminate with a Boolean truth value as output. In this way, both and can be thought of as partial versions of classical logic. Here, possible nontermination is handled analogously to how it is handled in domain theory, i.e., by the introduction of a third truth value in addition to truth and falsehood , denoted in Kleene’s presentation [21], which should be read as “undefined”.

The difference between and lies in how they cope with undefined truth values. In (see Figure 3), undefinedness is “contagious”: if any part of an expression is undefined, the truth value of the entire expression is undefined as well222This contagious behaviour has also been used to explain other phenomena. In philosophy, is better known as or Bochvar’s nonsense logic (see, e.g., [12]), and the third truth value read as “meaningless” or “nonsensical” rather than “undefined”. The central idea is that nonsense is contagious: e.g., “ and gobbledygook” is nonsensical even if part of it can be assigned meaning.. This fits well into a computation paradigm with possible nontermination and only sequential composition available. In contrast, the semantics of is to try to recover definite truth values whenever possible, even if part of the computation fails to terminate. For example, in (and unlike ), is considered false if one of and is false, even if the other is undefined. While this allows for some recovery in the face of nontermination, computationally it seems to require parallel processing capabilities.

(a) Weak conjunction.
(b) Weak disjunction.
(c) Negation.
Figure 3: The three-valued semantics of .

Like classical logic takes its algebraic semantics in Boolean algebras, the corresponding algebraic structure for is that of De Morgan quasilattices (see, e.g., [12]). As is sometimes done, we assume these to be distributive; i.e., what we call De Morgan quasilattices are sometimes called distributive De Morgan quasilattices or even (distributive) De Morgan bisemilattices (see, e.g., [23]). Note that we generally do not require these to be bounded, i.e., for top and bottom elements and to exist.

A De Morgan quasilattice (in its algebraic formulation) is a quadruple satisfying the following equations, for all :

  1. ,

  2. ,

  3. ,

  4. ,

  5. ,

  6. ,

  7. ,

  8. ,

  9. ,

  10. ,

  11. ,

Further, a De Morgan quasilattice is said to be bounded if there exist elements such that the following are satisfied (for all ):

  1. , and

  2. .

A homomorphism of De Morgan quasilattices is a function which preserves , , and . A homomorphism of bounded De Morgan quasilattices is one which additionally preserves and . Being a De Morgan quasilattice is a strictly weaker property than being a Boolean algebra. In particular, a Boolean algebra is a bounded De Morgan quasilattice which further satisfies the absorption laws and , and the laws of contradiction and tertium non datur, and .

De Morgan quasilattices and their homomorphisms form a category which we call . As for Boolean algebras, one can derive a partial order on De Morgan quasilattices by iff , and another one by iff . Unlike as for Boolean algebras, however, these do not coincide, though they are anti-isomorphic, as it follows from the De Morgan laws that iff . We will return to these in Section 4 and argue why is the one more suitable as the entailment relation for .

4.2 The internal logic

With and De Morgan quasilattices introduced, we return to the construction of the internal logic. To aid in its presentation (and subsequent proofs), we start by introducing a graphical language of extensive restriction categories, based on the one for cocartesian categories (see, e.g., [25]). Then, we show how the constants and connectives of can be interpreted (Definition 4.2) as decisions on an object (Lemma 4.2). Finally, we show that decisions on an object form a model of (Lemma 4.2), and that decision transformations are homomorphisms of these models (Lemma 4.2), concluding this construction. We go on to explore an important corollary to this construction, namely that if we restrict ourselves from ordinary decisions to total decisions and total decision transformations, we obtain a fibration over Boolean algebras instead (Corollary 4.2 Theorem 4.2). The latter is a well-known property of extensive categories first shown in [6], though this proof uses entirely different machinery.

Figure 4

shows the graphical language of extensive restriction categories, which has the restriction coproduct as its monoidal tensor. The first five gadgets are from cocartesian categories (

is here the twist map, ). We add gadgets corresponding to decisions , inverses to decisions (as all decisions are partial isomorphisms, see Lemma 3(ii)), and restriction idempotents . The gadget for inverses to decisions was inspired by assertions in reversible flowcharts (see [29]). Useful derived gadgets include graphical_derived Just as the graphical language of cocartesian categories, isomorphism or isotopy of diagrams is not enough for coherence – equations only hold in the graphical language up to diagrammatic manipulations corresponding to the decision laws, as well as the diagrammatic manipulations for coproducts (e.g., the commutative monoid axioms and naturality for the codiagonal, the zero morphism laws, etc.). For more on the latter, see [25]. For example, graphically, the decision laws are decision_laws As in the example above, when the signature is clear from the context, we omit the object annotations (e.g., in Figure 4).

graphical_language

Figure 4: An overview of the gadgets that make up the graphical language of extensive restriction categories.

With the graphical language in place, we proceed to give the definition of the internal logic of decisions in an extensive restriction category, i.e., the entailment relation and construction of constants and propositional connectives.

In an extensive restriction category, propositional constants and connectives are defined for decisions as follows, using the graphical language: logic Entailment is defined by iff (explicitly, iff ).

For those more textually inclined, this defines , , , , and .

Intuitively, we think of decisions as representing partial predicates by separating values into witnesses and counterexamples of that partial predicate (see also [19]). The definitions of and express the convention that the first component carries witnesses, while the second component carries counterexamples. Negation of partial predicates then amounts to swapping witnesses for counterexamples and vice versa, i.e., by composing with the symmetry. The intuition behind conjunction (and, dually, disjunction) is less obvious: Using the intuition of decisions as morphisms that tag inputs with a branch but doesn’t change it otherwise, we see that a witness of has to be a witness of both and , while a counterexample of is either a counterexample of which is further defined for (necessary to ensure commutativity), or a witness of which is a counterexample of . The case for disjunctions is dual.

Before we move on to show that this actually has the logical structure we’re after, we first obliged to show that these connectives and constants actually define well-formed decisions. This fact is expressed in the following lemma. The constants and connectives of Definition 4.2 are decisions. See appendix. Before we can proceed, we need a small technical lemma. Let pdec and qdec be decisions. It is the case that

  1. commstmt

  2. con_irrev

  3. dis_irrev

See appendix. The first part of this lemma can be seen as a form of commutativity for decisions – and, indeed, it performs most of the heavy lifting in showing commutativity of conjunction and disjunction. On the other hand, parts (ii) and (iii) shows that we could have defined conjunction and disjunction more simply in Definition 4.2. The reason why we chose the current definition is that it yields entirely reversible models (see also [19]), i.e., involving only partial isomorphisms. We will discuss this property further in Section 5. For now, we continue with the internal logic.

is a bounded De Morgan quasilattice for any object . We show only a few of the cases here using the graphical language. See the appendix for the rest. Idempotence of conjunction, i.e., , follows by con_idemp and similarly for disjunction. That is shown simply by con_unit and again, the unit law for disjunction has an analogous proof. The first De Morgan law, that dm1 and the proof of the second De Morgan law follows similarly. As such, we have that each collection of decisions on an object form a local model of , giving us the first part of the fibration. For the second, we need to show that decision transformers preserve entailment and the propositional connectives (though not necessarily the constants). This is shown in the following lemma.

Let . Then is a homomorphism of De Morgan quasilattices, i.e.,

  1. implies

In addition, if is total then is a homomorphism of bounded De Morgan quasilattice; i.e., we also have and . (i) follows by (iii) since iff iff , which in turn implies that , so as well, i.e., .

For (ii), we compute (using Lemma 3).

(iii) follows by lengthy but straightforward computation(see appendix).

(iv) is analogous to the previous case.

Notice the final part regarding preservation of units. Generally, , so , so if is not total, (instead ).

Putting the two lemmas together gives us the main result:

In every extensive restriction category , decisions over form a fibred De Morgan quasilattice via the decision fibration. By Lemmas 4.2 and 4.2. We previously claimed that the conjunction order was the more suitable one for entailment in extensive restriction categories. We are finally ready to state why:

Entailment is upwards directed in truth and definedness: iff . See appendix.

In other words, entails iff is both at least as true and at least as defined as is. That is, entailment preserves not only truth (as we expect all entailments to) but also information (as we expect of orders on partial maps). Compare this to the disjunction partial order for which instead states that is less false and less defined than : In other words, it prefers for information to be forgotten rather than preserved.

We move on now to an important special case of the situation above, which is when only total decisions are considered rather than arbitrary ones. For this, we need a small lemma regarding the restriction idempotents of decisions when composed using the propositional connectives.

We state some facts about restriction idempotents of decisions:

  1. ,

  2. ,

  3. ,

  4. and ,

  5. and .

See appendix. We can now show that total decisions form a fibred Boolean algebra. is a Boolean algebra for any object , and is homomorphism of Boolean algebras for any total . Since is a De Morgan quasilattice (Lemma 4.2), since total decisions are specifically decisions, and since the constants are total and the connectives preserve totality (Lemma 4.2), it suffices to show that when and are total they satisfy the absorption laws and , and the laws of contradiction and tertium non datur, and . The first absorption law follows by absorption and the other follows analogously. Likewise, the law of contradiction can be shown as contradiction and similarly for tertium non datur.

Using the previous corollary, it follows (see [6] for the original proofs from effectus theory) that predicates over an extensive category form a fibred Boolean algebra. Predicates (or, equivalently, decisions) over an extensive category is a fibred Boolean algebra via the predicate fibration (or, equivalently, the decision fibration). Since total decisions on objects form Boolean algebras by Corollary 4.2, it suffices to show that every extensive category arises as the subcategory of total morphisms of an extensive restriction category.

Let be an extensive category, and denote the collection of all coproduct injections of . As remarked in [7], this is a stable system of monics, and by Example 4.17 of [8],

is a classified restriction category under the

monad. Since has coproducts and is classified, it follows by Proposition 2.3 of [9] that has restriction coproducts. That is a restriction zero in follows straightforwardly, with the span as the unique zero morphism . As such, it suffices to show that decisions can be constructed in . Let be an arbitrary morphism of . Since is extensive it has pullbacks of coproduct injections along arbitrary morphisms, so the two squares

X_1 [r, ”m_1”] [d, ”f_1”’] & X’ [d, ”f”] & X_2 [l, ”m_2”’] [d, ”f_2”]

Y [r, ”κ_1”’] & Y+Z & Z [l, ”κ_2”]

are pullbacks, and so the top row is a coproduct diagram (i.e., ). But then it readily follows that

[cramped, sep=tiny, font=] & & X_1+X_2 [rd, ”m_1+m_2”] [ld, ”≅”’] & &

& X’ [ld, ”m”’] & & X’+X’ [rd, ”m+m”] &

X & & & & X+X

is a decision for in , and we are done.

5 Conclusion and future work

Motivated by an observation from flowchart languages that predicates serve a dual role as both condition and decision, we have given an account of extensive restriction categories (due to [7, 8, 9]) as categories with an internal logic (namely ) that internalize this duality, in the form of a natural isomorphism between the predicate fibration and the decision fibration.

We have also extended the graphical language of cocartesian categories to one for extensive restriction categories, and used our results to give an alternative proof of the fact that extensive categories, too, are categories with an internal logic – classical logic. While the graphical language has proven itself useful in proving theorems, it does have its shortcomings. For example, the only way to express restriction idempotents of compositions, such as , is, awkwardly, as ridmfg. That is, we would want only one representation of composition as placing gadgets in sequence, but since cannot generally be expressed as a composite involving only smaller things (e.g., and ), we are forced in this case to let the textual representation (i.e., juxtaposition) bleed into the graphical language. The graphical notation for decisions has similar issues.

An application of the developed theory is in reversible models of logics, which was also the motivation for defining the connectives in slightly more involved fashion, using partial inverses to decisions rather than the codiagonal. Indeed, the inspiration for using decisions as predicates came from the study of the categorical semantics of reversible flowchart languages (see [13, 19]). Since a decision in is still a decision in (see [19]), is still a De Morgan quasilattice in , though the homomorphisms between fibres differ (i.e., only decision transformers that are partial isomorphisms occur in the decision fibration on ).

We have only considered the weak Kleene logic here, as it can be constructed by purely sequential means. However, we conjecture that the strong Kleene logic can be modelled as well in extensive restriction categories if additionally a parallel composition operator such as finite joins (see [14]) is available. Finally, just the propositional fragment of and classical logic has been considered in this paper. Though decisions on an object yields a fibred category with a logical structure, we have not explored extensions to models of first-order logics, e.g., by investigating the feasibility of adjoints to substitution, as in the standard trick due to Lawvere [22] (see also [15]).

References

  • [1] P. Ammann and J. Offutt. Introduction to Software Testing. Cambridge University Press, 1st edition, 2008.
  • [2] M. A. Arbib and E. G. Manes. Partially additive categories and flow-diagram semantics. Journal of Algebra, 62(1):203 – 227, 1980.
  • [3] E. Ashcroft and Z. Manna. The translation of ’go to’ programs into ’while’ programs. In C. V. Freiman, J. E. Griffith, and J. L. Rosenfeld, editors, Proceedings of IFIP Congress 71, volume 1, pages 250–255. North-Holland, 1972.
  • [4] C. Böhm and G. Jacopini.

    Flow diagrams, Turing machines and languages with only two formation rules.

    Communications of the ACM, 9(5):366–371, 1966.
  • [5] A. Carboni, S. Lack, and R. Walters. Introduction to extensive and distributive categories. Journal of Pure and Applied Algebra, 84(2):145–158, 1993.
  • [6] K. Cho, B. Jacobs, B. Westerbaan, and A. Westerbaan. An introduction to effectus theory. See http://arxiv.org/abs/1512.05813, 2015.
  • [7] J. R. B. Cockett and S. Lack. Restriction categories I: Categories of partial maps. Theoretical Computer Science, 270(1–2):223–259, 2002.
  • [8] J. R. B. Cockett and S. Lack. Restriction categories II: Partial map classification. Theoretical Computer Science, 294(1–2):61–102, 2003.
  • [9] R. Cockett and S. Lack. Restriction categories III: Colimits, partial limits and extensivity. Mathematical Structures in Computer Science, 17(4):775–817, 2007.
  • [10] C. C. Elgot. Monadic computation and iterative algebraic theories. In H. E. Rose and J. C. Shepherdson, editors, Logic Colloquium, pages 175–230. North Holland, 1975.
  • [11] C. C. Elgot. Structured programming with and without GO TO statements. IEEE Transactions on Software Engineering, SE-2:41–53, 1976.
  • [12] V. K. Finn and R. Grigolia. Nonsense logics and their algebraic properties. Theoria, 59(1–3):207–273, 1993.
  • [13] R. Glück and R. Kaarsgaard. A categorical foundation for structured reversible flowchart languages. In A. Silva, editor, The Thirty-third Conference on the Mathematical Foundations of Programming Semantics (MFPS XXXIII), volume 336 of Electronic Notes in Theoretical Computer Science. Elsevier, 2017.
  • [14] X. Guo. Products, Joins, Meets, and Ranges in Restriction Categories. PhD thesis, University of Calgary, 2012.
  • [15] B. Jacobs. Categorical Logic and Type Theory, volume 141 of Studies in Logic and the Foundations of Mathematics. Elsevier, first edition, 1999.
  • [16] B. Jacobs. New directions in categorical logic, for classical, probabilistic and quantum logic. Logical Methods in Computer Science, 11(3), 2015.
  • [17] N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall International, 1993.
  • [18] R. Kaarsgaard, H. B. Axelsen, and R. Glück. Join inverse categories and reversible recursion. Journal of Logical and Algebraic Methods in Programming, 87:33–50, 2017.
  • [19] R. Kaarsgaard and R. Glück. A categorical foundation for structured reversible flowchart languages: Soundness and adequacy. Logical Methods in Computer Science, 14(3):1–38, 2018.
  • [20] J. Kastl. Inverse categories. In H.-J. Hoehnke, editor, Algebraische Modelle, Kategorien und Gruppoide, volume 7 of Studien zur Algebra und ihre Anwendungen, pages 51–60. Akademie-Verlag, 1979.
  • [21] S. C. Kleene. Introduction to metamathematics. North Holland, 1st edition, 1952.
  • [22] F. W. Lawvere. Adjointness in foundations. Dialectica, 23:281–296, 1969.
  • [23] A. Ledda. Stone-type representations and dualities for varieties of bisemilattices. Studia Logica, 106(2):417–448, 2018.
  • [24] E. G. Manes and M. A. Arbib. Algebraic approaches to program semantics. Springer, 1986.
  • [25] P. Selinger. A survey of graphical languages for monoidal categories. In B. Coecke, editor, New Structures for Physics, pages 289–355. Springer, 2011.
  • [26] G. Ştefănescu. An algebraic theory of flowchart schemes. In P. Franchi-Zannettacci, editor, CAAP ’86, volume 214 of Lecture Notes in Computer Science, pages 60–73. Springer, 1986.
  • [27] G. Ştefănescu. On flowchart theories part I: The deterministic case. Journal of Computer and System Sciences, 35(2):163 – 191, 1987.
  • [28] M. Williams and H. Ossher. Conversion of unstructured flow diagrams into structured form. The Computer Journal, 21(2):161–167, 1978.
  • [29] T. Yokoyama, H. B. Axelsen, and R. Glück. Fundamentals of reversible flowchart languages. Theoretical Computer Science, 611:87–115, 2016.

Appendix A Omitted proofs

[Proof of Lemma 3] For (i) and (ii), see [9]. (iii) follows by (ii) since

For (iv), . To show (v) we show that decides , since and

which was what we wanted. We show (vi) analogously by showing that decides since and

For (vii), we observe that so To show (viii), we show that the two morphism decide one another. We see that decides since (see (vii) above) and