An Isbell Duality Theorem for Type Refinement Systems
aa r X i v : . [ c s . L O ] J u l An Isbell Duality Theorem for Type Refinement Systems
Paul-André Melliès and Noam ZeilbergerAugust 21, 2018
Abstract
Any refinement system ( = functor) has a fully faithful representation in the refinement system ofpresheaves, by interpreting types as relative slice categories, and refinement types as presheaves over thosecategories. Motivated by an analogy between side e ff ects in programming and context e ff ects in linear logic,we study logical aspects of this “positive” (covariant) representation, as well as of an associated “negative”(contravariant) representation. We establish several preservation properties for these representations,including a generalization of Day’s embedding theorem for monoidal closed categories. Then we establishthat the positive and negative representations satisfy an Isbell-style duality. As corollaries, we derivetwo di ff erent formulas for the positive representation of a pushforward (inspired by the classical negativetranslations of proof theory), which express it either as the dual of a pullback of a dual, or as the double dualof a pushforward. Besides explaining how these constructions on refinement systems generalize familiarcategory-theoretic ones (by viewing categories as special refinement systems), our main running examplesinvolve representations of Hoare Logic and linear sequent calculus. Contents
A Proof of Prop. 2.2 31
A.1 The β equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31A.2 The η equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Introduction
This paper continues the study of type systems from the perspective outlined in [Melliès and Zeilberger 2015].There, we suggested that it is useful to view a type system as a functor from a category of typing derivationsto a category of underlying terms, and that this can even serve as a working definition of “type system” (orwhat we call a refinement system ), as being (in the most general case) simply an arbitrary functor.
Definition 1.1. A (type) refinement system is a functor t : D → T . Definition 1.2.
We say that an object P ∈ D refines an object A ∈ T (notated P ⊏ A ) if t ( P ) = A . Definition 1.3. A typing judgment is a triple ( P , c , Q ), where c is a morphism of T such that P ⊏ dom( c )and Q ⊏ cod( c ) (notated P = ⇒ c Q ). In the special case where P and Q refine the same object P , Q ⊏ A and c isthe identity morphism c = id A , the typing judgment ( P , c , Q ) is also called a subtyping judgment (notated P = ⇒ Q ). Definition 1.4. A derivation of a (sub)typing judgment ( P , c , Q ) is a morphism α : P → Q in D such that t ( α ) = c (notated α P = ⇒ c Q ).It is useful to think of any category C as a trivial example of a refinement system in at least two ways –either as the identity functor id C : C → C or as the terminal functor ! C : C → • Take T to be a category with a single object W representing the state space and morphisms c : W → W corresponding to state transformers. • Take D to be a category whose objects P , Q ∈ D are predicates over the state space W and whosemorphisms ( c , α ) : P → Q are commands c : W → W equipped with a verification α that c will takeany state satisfying P to a state satisfying Q . • Take t : D → T to be the evident forgetful functor.In this case, a typing judgment is nothing but a
Hoare triple { P } c { Q } , and what the example highlights is thata typing judgment can describe not just a logical entailment but also a side e ff ect (here the transformation c upon the state).In fact, one of our original motivations for studying this framework came from apparent connectionsbetween side e ff ects and linear logic, and in particular its proof theory [Girard 1987, Andreoli 1992]. Let usillustrate this idea by considering the right-rule for multiplicative conjunction (“tensor”) in intuitionisticlinear logic: Γ ⊢ A ∆ ⊢ B Γ , ∆ ⊢ A ⊗ B ⊗ R Following the tradition of [Gentzen 1935], it is common to call A ⊗ B the principal formula of the ⊗ R rule, and A and B its side formulas . The letters Γ and ∆ then stand for arbitrary sequences of formulas – often called contexts – which are carried through from the premises into the conclusion. Now, one can try to internalizethe fact that the inference rule is parametric in Γ and ∆ by first organizing contexts into some category W .Assuming a reasonable definition of morphism (between contexts) in W , any formula C then induces apresheaf C + : W op → Set by considering all the proofs of C in a given context: C + = Γ
7→ { π | π Γ ⊢ C } W as a category whose objects are lists (or multisets) of linear logic formulasand whose morphisms are linear substitutions , i.e., where a morphism ∆ → Γ is given by a list of proofs π ∆ ⊢ A · · · π n ∆ n ⊢ A n such that ∆ = ∆ , . . . , ∆ n and Γ = A , . . . , A n . With that definition of W , the functorial action of C + is justto perform a multicut: given a proof π of Γ ⊢ C and a linear substitution σ : ∆ → Γ , one obtains a proof C + ( σ )( π ) of ∆ ⊢ C by cutting the proofs σ = ( π , . . . , π n ) for the assumptions Γ = A , . . . , A n in π .Next, noting that for any pair of presheaves φ : C op1 → Set and φ : C op2 → Set one can construct their external tensor product as the presheaf φ • φ : ( C × C ) op → Set defined by( φ • φ )( x , x ) = φ ( x ) × φ ( x ) , we might hope to represent the fact that the ⊗ R rule is parametric in Γ and ∆ by interpreting ⊗ R as a natural transformation from the external tensor product A + • B + to the “internal” tensor product ( A ⊗ B ) + .The di ffi culty is that this is not well-typed! The point is that A + • B + is a presheaf over the product category W × W , whereas ( A ⊗ B ) + is a presheaf over W , and so, literally interpreted, it does not make sense tospeak of natural transformations between them. What is missing is that the ⊗ R rule also has an implicit“context e ff ect”, namely the operation of concatenating (or taking a multiset union of) Γ and ∆ . If we makethis operation explicit as a functor m : W × W → W then we can literally interpret the ⊗ R rule as an honest natural transformation: not directly between the twopresheaves A + • B + to ( A ⊗ B ) + , but rather from A + • B + to the presheaf ( A ⊗ B ) + precomposed with the functor m . What this example exposes is the danger of limiting one’s attention to a single presheaf category, andit suggests taking an alternative approach: to use the language of type refinement to speak directly aboutpresheaves living in di ff erent presheaf categories. Concretely, there is a refinement system defined as theforgetful functor u : Psh → Cat , which sends a pair ( C , φ ) of a category C equipped with a presheaf φ : C op → Set to the underlying category C . Our tentative interpretation of the ⊗ R rule of linear logic as a“natural transformation with side e ff ects” can now be given a concise formulation, simply stating that ⊗ R can be interpreted as a derivation of the typing judgment A + • B + = ⇒ m ( A ⊗ B ) + in the refinement system u : Psh → Cat .Moreover, it turns out that this presheaf interpretation of the sequent calculus of linear logic may bevastly generalized: in fact, any refinement system t : D → T can be given a presheaf interpretation, asa morphism of refinement systems t → u which is fully faithful in an appropriate sense. The idea ofrepresenting logical formulas as presheaves over context categories was one of our original motivationsfor studying the notion of type refinement, and we believe that this embedding theorem sending anyrefinement system into u : Psh → Cat justifies that point of view. After presenting some background inSection 2, we describe the “positive” representation ( − ) + : t → u of a refinement system together withan associated “negative” representation ( − ) − : t op → u in Section 3. We also establish there a few basicproperties of these representations and consider various examples. Then, in Section 4 we show that thetwo presheaf representations P + and P − of a refinement type P ⊏ A satisfy a form of duality generalizing Isbell duality (i.e., the duality between the covariant and contravariant representable presheaves associatedto an object of a category under the Yoneda embedding). Finally, by combining this duality theorem withpreservation properties of the two presheaf representations, we show that the positive representation ( c P ) + of a pushforward of a refinement P ⊏ A (in t : D → T ) along a morphism c : A → B can be explicitlycomputed (in u : Psh → Cat ) using either of two “negative translation”-style formulas, which express ( c P ) + both as the dual of a pullback of a dual and as the double dual of a pushforward.3 Preliminaries
We recall some conventions from [Melliès and Zeilberger 2015] for working with functors as type refinementsystems. Given a fixed functor t : D → T , we refer to the objects of T as types , to the morphisms of T as terms , and to the objects of D as refinement types (or refinements for short). Since these notions are relative toa functor t , to avoid ambiguity one can speak of t -types, t -refinements, and so on. We say that a judgment( P , c , Q ) is valid in a given refinement system t if it has a derivation in the sense of Defn. 1.4, i.e., there existsa morphism α : P → Q in D which is mapped to c by the functor t . More generally, we say that a typingrule is valid when there is an operation transforming derivations of the premises into a derivation of theconclusion. For example, the rule P = ⇒ c Q Q = ⇒ d RP = ⇒ c ; d R ;is valid for any refinement system as an immediate consequence of functoriality: given a morphism α : P → Q such that t ( α ) = c and a morphism β : Q → R such that t ( β ) = d , there is a morphism ( α ; β ) : P → R andmoreover t ( α ; β ) = ( t ( α ); t ( β )) = ( c ; d ).We consider t -typing judgments modulo equality of terms (i.e., equality of morphisms in T ), but oftenwe mark applications of an equality by an explicit conversion step (which can be seen as admitting thepossibility that T is a higher-dimensional category, although we will not pursue that idea rigorously here).For example, the rule of “covariant subsumption” of subtyping (also called “post-strengthening” in HoareLogic) P = ⇒ c Q Q = ⇒ RP = ⇒ c R can be derived from the composition typing rule (;) just above by P = ⇒ c Q Q = ⇒ RP = ⇒ c ;id R ; P = ⇒ c R ∼ where at ∼ we have applied the axiom c = ( c ; id) which is valid in any category.The notions of a cartesian morphism and of a fibration of categories [Borceux 1994] may be naturallyexpressed in the language of refinement systems by first defining a pullback of Q along c as a refinement c ∗ Q c : A → B Q ⊏ Bc ∗ Q ⊏ A equipped with a pair of typing rules c ∗ Q = ⇒ c Q Lc ∗ P = ⇒ d ; c QP = ⇒ d c ∗ Q Rc ∗ satisfying equations P β = ⇒ d ; c QP = ⇒ d c ∗ Q Rc ∗ c ∗ Q = ⇒ c Q Lc ∗ P = ⇒ d ; c Q ; = P β = ⇒ d ; c Q P η = ⇒ d c ∗ Q = P η = ⇒ d c ∗ Q c ∗ Q = ⇒ c Q Lc ∗ P = ⇒ d ; c Q ; P = ⇒ d c ∗ Q Rc ∗ Dually, a pushforward of P along c is defined as a refinement c PP ⊏ A c : A → Bc P ⊏ B equipped with a pair of typing rules P = ⇒ c ; d Qc P = ⇒ d Q Lc P = ⇒ c c P Rc satisfying a similar pair of equations. Note that pullbacks and pushforwards are always determined upto vertical isomorphism , where we say that two refinements P , Q ⊏ A of a common type are verticallyisomorphic (written P ≡ Q ) when there exists a pair of subtyping derivations α P = ⇒ Q β Q = ⇒ P which compose to the identities on P and Q . We record the following type-theoretic transcriptions ofstandard facts in the categorical literature: Proposition 2.1.
Whenever the corresponding pullbacks and / or pushforwards exist:1) the following subtyping rules are valid: Q = ⇒ Q c ∗ Q = ⇒ c ∗ Q P = ⇒ P c P = ⇒ c P
2) we have vertical isomorphisms ( d ; c ) ∗ Q ≡ d ∗ c ∗ Q ( c ; d ) P ≡ d c P id ∗ Q ≡ Q id P ≡ P A functor t : D → T is a fibration (respectively opfibration ) if and only if a pullback c ∗ Q (pushforward c P )exists for all compatible c and Q ( c and P ). The definition of a fibration (originally due to Grothendieck)is to a large extent motivated by the fact that there is an equivalence between fibrations D → T and(pseudo)functors T op → Cat , and similarly between opfibrations
D → T and (pseudo)functors
T →
Cat .The reader will observe that one direction of these equivalences is contained in Prop. 2.1. As the definitionsmake plain, though, it is possible to speak of specific pullbacks and pushforwards, even if t is not necessarilya fibration and / or opfibration.Recall that a category is monoidal if it is equipped with a tensor product and unit operation • : C × C → C I : 1 → C which are associative and unital up to coherent isomorphism, and that it is closed if it is additionally equippedwith left and right residuation operations \ : C op × C → C / : C × C op → C which are right adjoint to tensor product in each component: C ( Y , X \ Z ) (cid:27) C ( X • Y , Z ) (cid:27) C ( X , Z / Y )5 (closed) monoidal refinement system is a refinement system t : D → T such that D and T are (closed)monoidal, and t strictly preserves tensor products (and residuals) and the unit. By our conventions, amonoidal refinement system thus admits the following refinement rules and typing rules P ⊏ A P ⊏ A P • P ⊏ A • A I ⊏ I P = ⇒ c Q P = ⇒ c Q P • P = ⇒ c • c Q • Q • I = ⇒ I I I (we are overloading notation for the monoidal structure on D and T ) while a closed monoidal refinementsystem admits the following additional rules: P ⊏ A R ⊏ CP \ R ⊏ A \ C R ⊏ C Q ⊏ BR / Q ⊏ C / BP • ( P \ R ) = ⇒ leval R leval P • Q = ⇒ m RQ = ⇒ λ [ m ] P \ R λ ( R / Q ) • Q = ⇒ reval R reval P • Q = ⇒ m RP = ⇒ ρ [ m ] R / Q ρ Moreover, derivations built using these typing rules satisfy a few equations, which we elide here. Finally,we remark that the notion of a closed monoidal refinement system can be generalized by allowing theresiduation operations to be partial, i.e., by weakening the requirement that D and T be closed, whilemaintaining the requirement that the functor t : D → T preserves any residuals which may exist in D .We call such a functor a logical refinement system . Whenever the corresponding residuals exist, a logicalrefinement system can be treated in essentially the same way as a closed monoidal refinement system, andin particular all of the above rules are valid. Given a pair of refinement systems t : D → T and b : E → B , by a morphism of refinement systems from t to b we mean a pair F = ( F D , F T ) of functors F D : D → E and F T : T → B such that the square D F D / / t (cid:15) (cid:15) E b (cid:15) (cid:15) T F T / / B commutes strictly. Omitting subscripts on the functors F , a morphism from t to b thus induces a pair ofrules P ⊏ AF [ P ] ⊏ F [ A ] P = ⇒ c QF [ P ] = ⇒ F [ c ] F [ Q ] F transporting t -refinements to b -refinements and derivations of t -judgments to derivations of b -judgments.Given a pair of morphisms of refinement systems F = ( F D , F T ) : t → b and G = ( G D , G T ) : b → t , an adjunction of refinement systems F ⊣ G consists of a pair of adjunctions of categories F D ⊣ G D and F T ⊣ G T such that the unit and counit of the adjunction F D ⊣ G D are mapped by t and b onto the unit and counit of F T ⊣ G T . D F D ' ' G D g g ⊥ t (cid:15) (cid:15) E b (cid:15) (cid:15) T F T ' ' G T g g ⊥ B ι and o (without subscripts) for the unit and counit of both adjunctions F D ⊣ G D and F T ⊣ G T , anadjunction of refinement systems thus induces a pair of typing rules P = ⇒ ι GF [ P ] ι FG [ Q ] = ⇒ o Q o in addition to the typing rules F and G , and we remark moreover that typing derivations constructed usingthese four rules are subject to various equations implied by the definition of an adjunction of categories,such as the triangle laws.Finally, we say that a morphism of refinement systems F : t → b is fully faithful if the induced typingrule P = ⇒ c QF [ P ] = ⇒ F [ c ] F [ Q ] F is invertible , in the sense that to any b -derivation β F [ P ] = ⇒ F [ c ] F [ Q ]there is a unique t -derivation F ∗ β P = ⇒ c Q such that β F [ P ] = ⇒ F [ c ] F [ Q ] = F ∗ β P = ⇒ c QF [ P ] = ⇒ F [ c ] F [ Q ] F . Equivalently, a morphism of refinement systems F : t → b is fully faithful when the induced functor D → E × B T to the pullback of F T and b is fully faithful in the traditional categorical sense. We begin by establishing a basic result about adjunctions of refinement systems, analogous to the well-known fact that in an adjunction of categories the right adjoint functor preserves limits. Although a similarlemma was proved in [Ghani, Johann, Fumex 2013] for the specific case of two fibrations over the same base,we do not know whether this elementary observation on general functors has already appeared somewherein the literature. In particular, it is worth pointing out that Prop. 2.2 becomes vacuous if stated in terms oftraditional fibred adjunctions [Borceux 1994, Hermida 1993], since any morphism in the usual 2-category offibrations must (by definition) preserve cartesian arrows.
Proposition 2.2.
If G : b → t is a right adjoint, then G sends b -pullbacks to t -pullbacks, i.e., for all c : A → Band Q ⊏ B, whenever the b -pullback c ∗ Q exists, then the t -pullback G [ c ] ∗ G [ Q ] exists, and moreover we have thatG [ c ∗ Q ] ≡ G [ c ] ∗ G [ Q ] .Proof. We need to show that G [ c ∗ Q ] is a pullback of G [ Q ] along G [ c ]. By definition, this means constructinga pair of typing rules G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] LG [ c ] ∗ P = ⇒ d ; G [ c ] G [ Q ] P = ⇒ d G [ c ∗ Q ] RG [ c ] ∗ satisfying the β and η equations. The left-rule is derived immediately from the left-rule for c ∗ Q by applying G : c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] G c ∗ Q , assuming the existence of an F such that F ⊣ G : P = ⇒ ι GF [ P ] ι P = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o Q ; F [ P ] = ⇒ F [ d ]; o ; c Q ∼ F [ P ] = ⇒ F [ d ]; o c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o ] G [ c ∗ Q ] GP = ⇒ ι ; GF [ d ]; G [ o ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ Here at ∼ and ∼ we invoke, respectively, naturality of the counit and a triangle law for F T ⊣ G T . Finally, thefact that these typing rules satisfy the β and η equations can be verified by a long but mechanical calculation(see Appendix A). (cid:3) By duality, we also immediately obtain the following:
Proposition 2.3.
If F : t → b is a left adjoint, then F sends t -pushforwards to b -pushforwards, i.e., for all c : A → Band P ⊏ A, whenever the t -pushforward c P exists, then the b -pushforward F [ c ] F [ P ] exists, and moreover we havethat F [ c ] F [ P ] ≡ F [ c P ] . In passing, we note that Propositions 2.2 and 2.3 also imply the classical result about ordinary adjunctionsof categories. To see this, begin by observing that for any category C , one can consider the forgetful functor Cat (cid:12)
C →
Cat as the refinement system of diagrams in C . Here Cat (cid:12) C is the category whose objectsare pairs of an indexing category I together with a functor φ : I → C (hence, “diagrams in C ”), andwhose morphisms ( I , φ ) → ( J , ψ ) consist of a reindexing functor F : I → J together with a naturaltransformation θ : φ ⇒ ( F ; ψ ). The important point is that with respect to this refinement system, apushforward of a diagram ( I , φ ) along the unique functor ! I : I → φ : I → C (and more generally, the pushforward along a functor F : I → J corresponds to aleft Kan extension of φ along F ). Since an adjunction C L ' ' R e e ⊥ D between two categories C and D lifts to a vertical adjunction Cat (cid:12) C Cat (cid:12) L , , Cat (cid:12) R k k ⊥ (cid:30) (cid:30) ❃❃❃❃❃❃❃❃❃ Cat (cid:12) D (cid:127) (cid:127) (cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0)(cid:0) Cat between the respective refinement systems of diagrams, Prop. 2.3 then implies that the left adjoint functor L sends colimits in C to colimits in D (and more generally, it preserves left Kan extensions in Cat ). By asimilar argument, one can use Prop. 2.2 to derive that the right adjoint functor R sends limits in D to limitsin C .Our main application of Propositions 2.2 and 2.3 in this paper will be the following corollary, about thedistributivity properties of pullbacks and pushforwards with respect to tensors and residuals.8 roposition 2.4. If t : D → T is a closed monoidal refinement system, then whenever the corresponding pullbacksand pushforwards exist we have vertical isomorphisms ( c • d ) ( P • Q ) ≡ c P • d Q (a) c P \ d ∗ R ≡ ( c \ d ) ∗ ( P \ R ) (b) d ∗ R / c Q ≡ ( d / c ) ∗ ( R / Q ) (c) Proof.
The subtyping judgments in the left-to-right direction are easy to derive, e.g., (a) can be derived inany monoidal refinement system: P = ⇒ c c P Rc Q = ⇒ d d Q RdP • Q = ⇒ c • d c P • d Q • ( c • d ) ( P • Q ) = ⇒ c P • d Q L ( c • d ) The assumption of monoidal closure implies that these are vertical isomorphisms, using the fact that t comesequipped with a family of adjunctions D P •− ' ' P \− g g ⊥ t (cid:15) (cid:15) D t (cid:15) (cid:15) T A •− ' ' A \− g g ⊥ T D −• Q ' ' − / Q g g ⊥ t (cid:15) (cid:15) D t (cid:15) (cid:15) T −• B ' ' − / B g g ⊥ T as well as a family of contravariant adjunctions D R / − ) ) −\ R h h ⊥ t (cid:15) (cid:15) D op t op (cid:15) (cid:15) T C / − ) ) −\ C h h ⊥ T op D −\ R ) ) R / − h h ⊥ t (cid:15) (cid:15) D op t op (cid:15) (cid:15) T −\ C ) ) C / − h h ⊥ T op for all P ⊏ A , Q ⊏ B , R ⊏ C . Explicitly, we have (a) by( c • d ) ( P • Q ) ≡ (id • d ) ( c • id) ( P • Q ) (Prop. 2.1) ≡ (id • d ) ( c P • Q ) ( − • Q ⊣ − / Q ) ≡ c P • d Q ( c P • − ⊣ c P \ − )and (b) (and similarly (c)) by c P \ d ∗ R ≡ (id \ d ) ∗ ( c P \ R ) ( c P • − ⊣ c P \ − ) ≡ (id \ d ) ∗ ( c \ id) ∗ ( P \ R ) ( R / − ⊣ − \ R ) ≡ ( c \ d ) ∗ ( P \ R ) (Prop. 2.1)where in the second-to-last step we use the fact that a t op -pullback is the same thing as a t -pushforward. (cid:3) The refinement system of presheaves u : Psh → Cat is defined as follows:9
Cat is the category whose objects are categories and whose morphisms are functors. • Objects of
Psh are pairs ( A , φ ), where A is a category and φ : A op → Set is a contravariant presheafover that category. • Morphisms ( A , φ ) → ( B , ψ ) of Psh are pairs ( F , θ ), where F : A → B is a functor and θ : φ ⇒ ( F ; ψ ) isa natural transformation. • u : Psh → Cat is the evident forgetful functor.We typically write φ ⊏ A to indicate that φ is a presheaf over A , rather than the more verbose ( A , φ ) ⊏ A .This convention is unproblematic so long as we understand that there is an implicit coercion to view φ asan object of Psh . Proposition 3.1. u is a closed monoidal refinement system with all pullbacks and pushforwards.Proof.
Pullbacks are defined by precomposition, pushforwards as coends: F : A → B ψ ⊏ B F ∗ ψ ⊏ A F ∗ ψ def = a ψ ( Fa ) φ ⊏ A F : A → B F φ ⊏ B F φ def = b
7→ ∃ a . B ( b , Fa ) × φ ( a )Tensor products and residuals in Cat are defined using its usual cartesian closed structure (i.e., by buildingproduct categories and functor categories), and lifted to
Psh as follows (we show only the definitions ofpresheaves, not the structural maps): I ⊏ φ ⊏ A ψ ⊏ B φ • ψ ⊏ A × B φ • ψ def = ( a , b ) φ ( a ) × ψ ( b ) I def = ∗ 7→ { ∗ } φ ⊏ A ω ⊏ C φ \ ω ⊏ [ A , C ] φ \ ω def = F
7→ ∀ a .φ ( a ) → ω ( Fa ) ω ⊏ C ψ ⊏ B ω / ψ ⊏ [ B , C ] ω / ψ def = F
7→ ∀ a .ψ ( a ) → ω ( Fa )Note that these definitions may be naturally generalized to the refinement system of V -valued presheavesover V -enriched categories, but for concreteness we only work with ordinary categories here. (cid:3) We can also identify a subsystem of u that will play an important analytical role later on. Let Cat • be thecategory whose objects consist of categories A together with a chosen object a ∈ A , and whose morphisms( A , a ) → ( B , b ) are pairs ( F , h ) consisting of a functor F : A → B together with a morphism h : F ( a ) → b of B . The refinement system of pointed categories is defined as the evident forgetful functor s : Cat • → Cat .This is a “subsystem” of u in the sense that there is a vertical morphism of refinement systems y : s → u ,corresponding to the classical Yoneda embedding: Cat • s (cid:15) (cid:15) y / / Psh u (cid:15) (cid:15) Cat Cat
Read as a vertical morphism of refinement systems, the Yoneda embedding interprets an object a ∈ A asthe contravariant presheaf A ( − , a ) over the same category A . Finally, since any object a ∈ A can also beseen as a functor a : 1 → A in Cat , let us observe that y : s → u may equivalently be defined in terms ofpushforward of the unit presheaf: In this paper we adopt the logical notation ∀ x . Φ ( x , x ) and ∃ y . Ψ ( y , y ) to denote ends and coends, respectively, rather than the moretraditional R x Φ ( x , x ) and R y Ψ ( y , y ) of category theory [Kelly 1982]. roposition 3.2. For all a ∈ A , we have A ( − , a ) ≡ a I in u .Proof. Immediate from the definition of pushforwards in u (see Prop. 3.1). (cid:3) In this section we show that any refinement system t : D → T has a sound and complete presheafinterpretation, in the sense of a fully faithful morphism of refinement systems t → u . We give a directdescription of this representation here, as well as some examples, and we will provide some furthermotivation of the definitions in Section 3.3. Definition 3.3.
For any t -type B , the category B + t is defined as follows: • Objects are pairs ( P ⊏ A , c : A → B ) • Morphisms ( P , c ) → ( P , c ) are derivations α P = ⇒ e P such that c = e ; c . Proposition 3.4.
The assignment B B + t extends to a functor ( − ) + t : T →
Cat . Definition 3.5.
For any t -refinement Q ⊏ B , the presheaf Q + t ⊏ B + t is defined on objects by( P , c )
7→ { α | α P = ⇒ c Q } and with the contravariant functorial action transforming any morphism ( P , c ) → ( P , c ) given as aderivation α P = ⇒ e P such that c = e ; c into a typing rule (parametric in Q ) P = ⇒ c QP = ⇒ c Q derived as α P = ⇒ e P P = ⇒ c QP = ⇒ e ; c Q ; P = ⇒ c Q ∼ Proposition 3.6.
The assignment ( Q ⊏ B ) ( B + t , Q + t ) extends to a functor ( − ) + t : D →
Psh . Proposition 3.7.
The pair of functors ( − ) + t : T →
Cat and ( − ) + t : D →
Psh define a morphism of refinementsystems from t to u , i.e., a commuting square D ( − ) + t / / t (cid:15) (cid:15) Psh u (cid:15) (cid:15) T ( − ) + t / / Cat
As we discussed in Section 2.2, any morphism of refinement systems induces a pair of refinement rules andtyping rules, and in this case in particular we have rules P ⊏ AP + t ⊏ A + t P = ⇒ c QP + t = ⇒ c + t Q + t + t which we call the positive representation of the refinement system t in the refinement system of presheaves.11 roposition 3.8. The positive representation of t is sound and complete, in the sense that the morphism of refinementsystems ( − ) + t : t → u is fully faithful. Remember that we say a morphism of refinement systems is fully faithful when the induced typing rule isinvertible, in this case meaning that to any natural transformation θ P + t = ⇒ c + t Q + t in u there exists a unique t -derivation ( + t ) ∗ θ P = ⇒ c Q such that θ P + t = ⇒ c + t Q + t = ( + t ) ∗ θ P = ⇒ c QP + t = ⇒ c + t Q + t + t To prove Prop. 3.8, we first observe that the presheaves P + t are representable (in the classical sense[Mac Lane 1971, III.2]), so that the positive representation factors via the refinement system of pointedcategories. Proposition 3.9.
The morphism ( − ) + t : t → u factors as a morphism ( − ) + t : t → s followed by the Yoneda embedding, D t (cid:15) (cid:15) ( − ) + t / / Psh u (cid:15) (cid:15) T ( − ) + t / / Cat = D t (cid:15) (cid:15) ( − ) + t / / Cat • s (cid:15) (cid:15) y / / Psh u (cid:15) (cid:15) T ( − ) + t / / Cat Cat where ( − ) + t : D →
Cat • is defined by P + t def = ( P , id A ) ∈ A + t for all P ⊏ A.Proof.
Immediate from the definitions. (We overload the notation P + t to stand both for the presheaf on A + t and for its representing object, but this is harmless since the aspect of P + t we are referring to will always bededucible from context.) (cid:3) Proof of Prop. 3.8.
By Prop. 3.9, it su ffi ces to show separately that each factor ( − ) + t : t → s and y : s → u is afully faithful morphism of refinement systems: ( ( − ) + t : t → s is fully faithful.) Suppose given a derivation of P + t = ⇒ c + t Q + t in s . By definition of the refine-ment system s : Cat • → Cat and of the functor c + t : A + t → B + t , such a derivation is the same thing asa morphism ( P , c ) → ( Q , id B ) in B + t . In turn, it is easy to check from the definition of the category B + t that such a morphism is nothing but a t -derivation of P = ⇒ c Q . ( y : s → u is fully faithful.) This may of course be reduced to the usual Yoneda lemma, but we can alsoestablish it directly by using the characterization (Prop. 3.2) of representable presheaves as pushfor-wards of the unit presheaf A ( − , a ) ≡ a I . Consider a s -typing judgment a = ⇒ F b given by a pair of objects a ∈ A and b ∈ B together with a functor F : A → B . By the universal property of the pushforward, u -derivations of a I = ⇒ F b I are in bijective correspondence with u -derivations of I = ⇒ a ; F b I . The lattercorrespond exactly to elements of B ( F ( a ) , b ), which by definition are the same thing as derivations of a = ⇒ F b in s . (cid:3) xample 1. Recall from the Introduction that Hoare Logic can be viewed as a refinement system over acategory with one object W . With respect to this refinement system, the category W + has pairs ( P , c ) of astate predicate P and a command c as objects, while a morphism( P , c ) → ( P , c )corresponds to a derivation of a triple { P } e { P } for some e such that c = e ; c . Traditionally Hoare Logic isseen through a “proof irrelevant” lens, so that a Hoare triple is either valid or invalid, and not much attentionis paid to the derivation itself. If we adopt that simplifying assumption, then the positive embedding isessentially just a set of guarded commands: Q + = { ( P , c ) | ⊢ { P } c { Q } } In other words, ( P , c ) ∈ Q + just in case it is possible to run c in a state satisfying the precondition P to obtaina state satisfying Q . Example 2.
We will formulate the example of sequent calculus for linear logic in a bit more abstract termsas follows. To any multicategory F , there is associated a free monoidal category M [ F ], whose objects (andmorphisms) are lists of objects (and morphisms) of F , and where the monoidal structure on M [ F ] is givenby concatenation. Moreover this category is equipped with a forgetful functor |−| : M [ F ] → ∆ into the(augmented) simplex category (whose objects are finite ordinals and monotone maps), which interprets alist of objects by its length, and a list of morphisms as a monotone function.Similarly, there is an analogous construction of the free symmetric monoidal category SM [ F ] on asymmetric multicategory F , where one simply replaces lists by multisets, and the forgetful functor |−| : SM [ F ] → Fin maps into the category of finite sets and functions (which contains ∆ as a subcategory).To model intuitionistic linear sequent calculus along the lines suggested in the Introduction, we willassume given a symmetric multicategory F whose objects are linear logic formulas, and whose multimor-phisms are sequent calculus proofs. Then, we take the category of contexts to be W = SM [ F ] and considerthe forgetful functor |−| : W →
Fin as a refinement system. Since the one-point set is a terminal objectin Fin , the category + is equivalent to W , and the positive embedding of a linear logic formula C (seen asa singleton context C ⊏ ) is the presheaf C + on W defined exactly as in the Introduction (here we write F ( Γ ; C ) for the set of multimorphisms from Γ to C ): C + = Γ
7→ W ( Γ , C ) = F ( Γ ; C ) = { π | π Γ ⊢ C } (cid:3) In Prop. 3.9 we explained that the positive representation ( − ) + t : t → u can be factored as a morphism( − ) + t : t → s followed by the Yoneda embedding y : s → u of pointed categories into presheaves. Forthe interested (and categorically-minded) reader, in this section we provide some further discussion andmotivation of the embedding into pointed categories, explaining its relationship to the free opfibration overa functor, as well as the role played by s : Cat • → Cat as a “universal” opfibration.We begin by remarking that the category B + t can be seen as an analogue of the slice category over B , andreduces to the ordinary slice of T over B in the case where t = id T : T → T . As such, we will sometimesrefer to B + t as the t-slice (or “relative slice”) of B . Note that the relative slice construction also appears in[Maltsiniotis 2005, §1.1.2], where the notation D / B is used instead of B + t . Remark 3.10.
In the case where t = ! D : D → , the relative slice over the unique object ∗ of is D itself, and thepositive representation Q + t of an object Q ∈ D is just Q itself when viewed as a refinement in s , or the ordinary Yonedaembedding of Q when viewed as a refinement in u . More generally, for any t : D → T and t -refinement Q ⊏ B, if Bis a terminal object in T then B + t ≡ D , and Q + t is represented by the object Q itself. − ) + t : T →
Cat reduces to the ordinary slice functor in the case where t is the identity can also be understood in terms of the following decomposition: T ( − ) + t / / Cat = T B ( t − , B ) / / [ D op , Set ] R / / Cat
That is, the relative slice functor factors as the nerve of t followed by the category of elements construction.Seen as a covariant indexed category encoding an opfibration, this composite is just the free opfibration ont , in the sense that the (covariant) category of elements of ( − ) + t : T →
Cat is the comma category t ↓ T ,which has the property that1) The projection functor cod t : t ↓ T → T is an opfibration.2) There is a (vertical) morphism of refinement systems from t to cod t , D t (cid:15) (cid:15) (id , t ) / / t ↓ T cod t (cid:15) (cid:15) T T where (id , t ) : D → t ↓ T is the functor sending any Q ⊏ B to the object ( Q , id B , B ).3) Any morphism of refinement systems F : t → b from t into an opfibration b factors uniquely as amorphism ˜ F : cod t → b composed with the morphism (id , t ) : t → cod t .Next, we can observe that any opfibration has a representation (what one might call the covariant “Grothendieckrepresentation”) in the refinement system of pointed categories, E b (cid:15) (cid:15) ∂ + b / / Cat • s (cid:15) (cid:15) B ∂ + b / / Cat where ∂ + b : B →
Cat sends any object X ∈ B to the fiber E X of b over X , while ∂ + b : E →
Cat • coerces anyrefinement R ⊏ X (i.e., an object R ∈ E such that b ( R ) = X ) into the corresponding element R ∈ E X of thefiber category. Note that it is important that b : E → B be an opfibration in order for these operations todefine functors.By combining these two separate observations, we get a simple factorization of the positive embeddinginto pointed categories.
Proposition 3.11.
The morphism ( − ) + t : t → s factors as the free opfibration on t followed by the covariantGrothendieck representation: D t (cid:15) (cid:15) ( − ) + t / / Cat • s (cid:15) (cid:15) T ( − ) + t / / Cat = D t (cid:15) (cid:15) (id , t ) / / t ↓ T cod t (cid:15) (cid:15) ∂ + cod t / / Cat • s (cid:15) (cid:15) T T ∂ + cod t / / Cat .4 The negative representation Every functor t : D → T induces an opposite functor t op : D op → T op , and one can consider the positiverepresentation of t op D op ( − ) + t op / / t op (cid:15) (cid:15) Psh u (cid:15) (cid:15) T op ( − ) + t op / / Cat as another negative representation of t . Letting ( − ) − t def = ( − ) + t op : t op → u , this means we have rules P ⊏ AP − t ⊏ A − t P = ⇒ c QQ − t = ⇒ c − t P − t − t giving a fully faithful, contravariant embedding of t into u .Unravelling the definitions, we can verify that • A − t is the opposite of the category whose objects consist of pairs ( c , Q ) such that c : A → B and Q ⊏ B ,and whose morphisms ( c , Q ) → ( c , Q ) correspond to derivations α Q = ⇒ e Q such that c ; e = c .Dually to A + t , we can read ( A − t ) op as the t-coslice (or “relative coslice”) category out of A . • For any t -refinement P ⊏ A , the presheaf P − t ⊏ A − t is defined on objects by( c , Q )
7→ { α | α P = ⇒ c Q } and on morphisms by α Q = ⇒ e Q P = ⇒ c Q α Q = ⇒ e Q P = ⇒ c ; e Q ; P = ⇒ c Q ∼ Note that P − t is a contravariant presheaf over A − t , and thus a covariant presheaf over the t -coslicecategory.By a similar line of reasoning as in Sections 3.2 and 3.3, we can decompose the negative representation( − ) − t : t op → u into three separate components. Proposition 3.12.
The morphism ( − ) − t : t op → u factors as a morphism ( − ) − t : t op → s followed by the Yonedaembedding, D op t op (cid:15) (cid:15) ( − ) − t / / Psh u (cid:15) (cid:15) T op ( − ) − t / / Cat = D op t op (cid:15) (cid:15) ( − ) − t / / Cat • s (cid:15) (cid:15) y / / Psh u (cid:15) (cid:15) T op ( − ) − t / / Cat Cat where ( − ) − t : D op → Cat • is defined by P − t def = (id A , P ) ∈ A − t for all P ⊏ A. roposition 3.13. The morphism ( − ) − t : t op → s factors as the free fibration on t followed by the contravariantGrothendieck representation: D op t op (cid:15) (cid:15) ( − ) − t / / Cat • s (cid:15) (cid:15) T op ( − ) − t / / Cat = D op t op (cid:15) (cid:15) ( t , id) / / ( T ↓ t ) opdom op t (cid:15) (cid:15) ∂ − dom t / / Cat • s (cid:15) (cid:15) T op T op ∂ − dom t / / CatExample 3.
If we again follow the classical tradition of treating a Hoare triple { P } c { Q } as either valid orinvalid (with no interesting content to the derivation), then the negative representation of a state predicate P − = { ( c , Q ) | ⊢ { P } c { Q } } is essentially just the set of all possible continuations of a state satisfying P . Example 4.
With respect to the refinement system |−| : W →
Fin defined in Example 2, the relative cosliceout of has objects ( i : → n , Γ ⊏ n ) corresponding to pointed contexts , in the sense that the map i : → n serves to select a distinguished formula A i in Γ = A , . . . , A n . A morphism of pointed contexts ( j , ∆ ) → ( i , Γ )(by which we mean a morphism ( i , Γ ) → ( j , ∆ ) in − ) corresponds to a linear substitution σ : ∆ → Γ whoseunderlying function maps j to i , implying that the chosen formula B j is used (possibly together with otherformulas of ∆ ) as part of the proof of A i .To better understand this category, it is helpful to adopt a more evocative notation for pointed contexts.For example, we could draw the diagram A A A A • • ⊙ • to represent the pointed context ( i , Γ ) where Γ = A , . . . , A and i =
3. Any morphism of pointed contexts B B B B • ⊙ • • −→ A A A A • • ⊙ • must have an underlying function mapping 2 to 3, for example like so:1 • / / • ⊙ ( ( ◗◗◗◗◗◗ • • / / ⊙ • = = ④④④④④④④④ • π B ⊢ A , π B ⊢ A , π B , B ⊢ A , and π · ⊢ A . Now, suppose given a formula A ⊏ . Its negative representation A − ⊏ − corresponds to the presheafwhich sends any pointed context B . . . B j . . . B m • . . . ⊙ . . . • to the collection of morphisms of pointed contexts A ⊙ −→ B . . . B j . . . B m • . . . ⊙ . . . •
16y definition, such a morphism must contain a proof of A ⊢ B j together with closed proofs of each of the B , . . . , B j − , B j + , . . . , B m .As a shorthand notation, we can write ∆ [ B ] to stand for a pointed context with chosen formula B andremaining formulas ∆ . Then the presheaf A − ⊏ − is computed on objects by the following expression: A − = ∆ [ B ]
7→ F ( A ; B ) × W ( · , ∆ ) We have seen that any refinement system (i.e., any functor) t : D → T may be embedded both covariantlyand contravariantly into the refinement system of pointed categories, t ( − ) + t / / s t op( − ) − t o o and that by composing these morphisms with the Yoneda embedding t ( − ) + t / / ( − ) + t (cid:30) (cid:30) ❃❃❃❃❃❃❃❃ s y (cid:15) (cid:15) t op( − ) − t o o ( − ) − t ~ ~ ⑥⑥⑥⑥⑥⑥⑥⑥ u one obtains two fully faithful presheaf representations of t . But why not stop at s ? As we will see, thebenefit of extending the voyage of t and t op all the way into u is that this refinement system has a muchricher logical structure than s , which we can apply in order to talk about the original refinement system t .By way of illustration, an important property of the positive presheaf representation ( − ) + t : t → u is that it preserves any pullbacks which may already exist in t . Proposition 3.14.
Whenever c ∗ Q exists in t , we have ( c ∗ Q ) + t ≡ ( c + t ) ∗ Q + t in u .Proof. By expanding definitions, the elements of ( c ∗ Q ) + t correspond to t -derivations P α = ⇒ d c ∗ Q where P ⊏ X and d : X → A , while the elements of ( c + t ) ∗ Q + t correspond to t -derivations P β = ⇒ d ; c Q . So, the proposition follows from the universal property of the t -pullback. (cid:3) As an immediate corollary, we have that the negative representation sends ( t -)pushforwards to ( u -)pullbacks. Proposition 3.15.
Whenever c P exists in t , we have ( c P ) − t ≡ ( c − t ) ∗ P − t in u . On the other hand, the positive representation need not preserve pushforwards: although it’s true thatthe u -subtyping judgment c + t P + t = ⇒ ( c P ) + t is valid whenever the pushforward c P exists in t (indeed, thisis true whenever one has a morphism of refinement systems and the pushforward exists on both sides),in general the converse subtyping judgment need not be valid. Fortunately, in Section 4.4 we will showthat although the positive representation need not preserve pushforwards, it at least preserves them “up todouble dualization” in u . 17 .6 Preservation of logical connectives up to change-of-basis Suppose that t : D → T is a monoidal refinement system. By definition, this means that D and T aremonoidal and that we have a commuting square D × D • (cid:15) (cid:15) t × t / / T × T • (cid:15) (cid:15) D t / / T (as well as a commuting triangle associated to the tensor unit, but we will ignore the unit in this section,since its treatment is completely analogous). Since u : Psh → Cat is also a monoidal refinement system, thepositive representation of t thus induces a cube Psh × Psh / / (cid:15) (cid:15) Cat × Cat (cid:15) (cid:15)
D × D : : tttt / / (cid:15) (cid:15) a T × T : : tttt (cid:15) (cid:15) b Psh / / Cat D / / : : ttttt T : : ttttt where all but the left and right faces marked a and b commute strictly.These latter faces need only commute in the lax sense that there are natural transformations D × D ( − ) + t × ( − ) + t / / • (cid:15) (cid:15) ✏✏✏✏ (cid:4) (cid:12) m Psh × Psh • (cid:15) (cid:15) D ( − ) + t / / Psh
T × T ( − ) + t × ( − ) + t / / • (cid:15) (cid:15) ✏✏✏✏ (cid:4) (cid:12) m Cat × Cat × (cid:15) (cid:15) T ( − ) + t / / Cat and moreover the natural transformation on the right is the projection of the one on the left along the cube,this meaning that we have a family of functors m B , B : B + t × B + t → ( B • B ) + t (1)and a family of u -derivations Q + t • Q + t m Q , Q = ⇒ m B , B ( Q • Q ) + t (2)natural in Q ⊏ B and Q ⊏ B . Explicitly, the functors m B , B are defined by the action sending any pair ofobjects ( P , c ) ( P , c )(where P ⊏ A , c : A → B , P ⊏ A , c : A → B ) to the object( P • P , c • c )while the natural transformations m Q , Q are defined by the action sending any pair of t -derivations α P = ⇒ c Q α P = ⇒ c Q
18o the t -derivation α P = ⇒ c Q α P = ⇒ c Q P • P = ⇒ c • c Q • Q • We can summarize all this by saying that the positive representation is a lax morphism of monoidalrefinement systems in the expected sense.From this it follows for purely formal reasons that when t is a logical refinement system (i.e., it ismonoidal and strictly preserves residuals) we can likewise build functors a A , C : ( A \ C ) + t → A + t \ C + t (3)whenever the corresponding residual A \ C exists in T , and u -derivations( P \ R ) + t a P , R = ⇒ a A , C P + t \ R + t (4)whenever the residual P \ R exists in D . For example, we can define a A , C by a A , C def = λ [ m A , A \ C ; leval + t ]and then construct the derivations as follows: P + t • ( P \ R ) + t = ⇒ m ( P • ( P \ R )) + t m P • ( P \ R ) = ⇒ leval R leval ( P • ( P \ R )) + t = ⇒ leval + t R + t + t P + t • ( P \ R ) + t = ⇒ m ; leval + t R + t ;( P \ R ) + t = ⇒ λ [ m ; leval + t ] P + t \ R + t λ Finally, we also have ( R / Q ) + t a ′ Q , R = ⇒ a ′ B , C R + t / Q + t (5)defined in the analogous way. Again, all this can be summarized as saying that the positive representationis a lax morphism of logical refinement systems.However, we can actually establish a much better property about the positive representation, which saysthat in a certain precise sense it strongly preserves the logical structure of t , but only “up to change-of-basis”. Proposition 3.16.
Let P ⊏ A, Q ⊏ B, R ⊏ C be refinements in a logical refinement system t . Then all of the followingvertical isomorphisms hold in u , where (2) and (3) are conditioned on the assumption that the corresponding residualsexist in t : m A , B ( P + t • Q + t ) ≡ ( P • Q ) + t (a)( P \ R ) + t ≡ a A , C ∗ ( P + t \ R + t ) (b)( R / Q ) + t ≡ a ′ B , C ∗ ( R + t / Q + t ) (c)19 roof. We can give a purely formal calculation of (a): m A , B ( P + t • Q + t ) ≡ m A , B ( P + t I • Q + t I ) (Propositions 3.2 and 3.9) ≡ m A , B ( P + t • Q + t ) ( I • I ) (Prop. 2.4) ≡ m A , B ( P + t • Q + t ) I ( I ≡ I • I ) ≡ ( P + t • Q + t ; m A , B ) I (Prop. 2.1) ≡ (( P , id A ) • ( Q , id B ); m A , B ) I (defn. of P + t and Q + t ) ≡ ( P • Q , id A • id B ) I (defn. of m A , B ) ≡ ( P • Q , id A • B ) I (id A • B = id A • id B ) ≡ ( P • Q ) + t I (defn. of ( P • Q ) + t ) ≡ ( P • Q ) + t (Propositions 3.2 and 3.9)For (b), through similar reasoning we can derive that a A , C ∗ ( P + t \ R + t ) ≡ ( a A , C ; ( P + t \ id C )) ∗ R + t and by expanding definitions we can compute that the elements of the presheaf on the right correspond toderivations P • Q α = ⇒ id • d R where Q ⊏ B and d : B → A \ C . But then the universal property of the left residual in t says that thesederivations are in one-to-one correspondence with the elements of ( P \ R ) + t . The case of (c) is similar. (cid:3) In categorical language, an equivalent way of stating Prop. 3.16 is that the morphisms m P , Q : P + • Q + → ( P • Q ) + a P , R : ( P \ R ) + → P + \ R + a ′ Q , R : ( R / Q ) + → R + / Q + which come from the lax monoidal structure of the functor ( − ) + t : D →
Psh are in fact opcartesian, cartesian,and cartesian, respectively, relative to the functor u : Psh → Cat . As a consequence, Prop. 3.16 is reallyan analogue of Day’s embedding theorem for monoidal categories [Day 1970], generalized to the case oflogical refinement systems.
Remark 3.17.
Consider the case where D is a monoidal category and t = ! D : D → (cf. Remark 3.10). In this casethere is a single functor m ∗ , ∗ : D × D → D corresponding to the tensor product on D , and we get a type-theoreticdecomposition of the “Day construction” [Day 1970, Kelly 1982], which transports any monoidal category into aclosed monoidal category. In particular, the operation of taking an (“external”) tensor product of presheaves andpushing forward along m defines an (“internal”) monoidal structure on the presheaf category [ D op , Set ] , while theoperations of taking an (“external”) residual and pulling back along the functors a or a ′ (which are the left / rightcurryings of m) places an (“internal”) closed structure on [ D op , Set ] . Thus, Prop. 3.16 specializes to the fact that theYoneda functor preserves the monoidal structure of D , as well as any closed structure which may exist. Moreover, this remark can be extended to the general case of a monoidal refinement system t : D →T . We have shown in [Melliès and Zeilberger 2015] that in any such refinement system with enoughpushforwards, the fiber D W of any monoid W in T comes equipped with a monoidal structure defined bypushing forward along the multiplication map p : W • W → W : P ⊗ W Q def = p ( P • Q ) ( P , Q ⊏ W )20he positive representation induces (by restriction) a functor( − ) + : D W → [( W + ) op , Set ] (6)from the fiber of W into the presheaf category over W + . Moreover, the category W + inherits a monoidalstructure from the monoid W , defined as: W + × W + m W , W / / ( W • W ) + p + / / W + The associated presheaf category [( W + ) op , Set ] comes thus equipped with a (closed) monoidal structureprovided by the Day tensor product. Now, the functor (6) is in general only lax monoidal, with the coercionmorphism P + ⊗ W + Q + / / ( P ⊗ W Q ) + constructed by applying the universal property of P + ⊗ W + Q + (defined as the u -pushforward of P + • Q + along ( m W , W ; p + )) to the composite derivation P + • Q + m P , Q = ⇒ m W , W ( P • Q ) + α + = ⇒ p + ( P ⊗ W Q ) + where the right-hand derivation is built by applying the positive representation functor to the derivation P • Q α = ⇒ p P ⊗ W Q coming from the definition of P ⊗ W Q as a t -pushforward of P • Q along p . Proposition 3.18.
Let W be a monoid in a monoidal refinement system t with enough pushforwards. Then the functor ( − ) + : D W → [( W + ) op , Set ] is lax monoidal. In particular, the subtyping judgment P + ⊗ W + Q + = ⇒ ( P ⊗ W Q ) + isvalid (in u : Psh → Set ) for all t -refinements P , Q ⊏ W. Since the derivation m P , Q is cocartesian (Prop. 3.16), the coercion P + ⊗ W + Q + → ( P ⊗ W Q ) + is an isomorphismjust in case the positive representation transports the cocartesian derivation α to a cocartesian derivation α + .This is precisely what happens in the special case discussed in Remark 3.17, where p is equal to the identity.In the case of a logical refinement system t : D → T with enough pullbacks, the fiber D W is not justmonoidal, but also closed [Melliès and Zeilberger 2015], with the residuals defined by pulling back alongthe left and right curryings of the monoid multiplication map: P ⊸ W R def = λ [ p ] ∗ ( P \ R ) ( P , R ⊏ W ) R W ⊸ Q def = ρ [ p ] ∗ ( R / Q ) ( Q , R ⊏ W )There are two canonical coercion morphisms( P ⊸ W R ) + / / P + ⊸ W + R + and ( R W ⊸ Q ) + / / R + W + ⊸ Q + induced by the lax monoidal structure of (6), which can be constructed as the composite derivations( P ⊸ W R ) + α + = ⇒ ( λ [ p ]) + ( P \ R ) + a P , R = ⇒ a W , W P + \ R + and ( R W ⊸ Q ) + α + = ⇒ ( ρ [ p ]) + ( R / Q ) + a ′ Q , R = ⇒ a ′ W , W R + / Q + where α and α are the cartesian derivations coming from the definition of P ⊸ W R and R W ⊸ Q aspullbacks. One key di ff erence with the previous situation is that the positive representation preserves allcartesian morphisms (Prop. 3.14), which implies that the two coercion morphisms are in fact isomorphisms.21 roposition 3.19. Let W be a monoid in a logical refinement system t with enough residuals and pullbacks. Then thefunctor ( − ) + : D W → [( W + ) op , Set ] preserves residuals. In particular, we have vertical isomorphisms ( P ⊸ W R ) + ≡ P + ⊸ W + R + and ( R W ⊸ Q ) + ≡ R + W + ⊸ Q + for all t -refinements P , Q , R ⊏ W. The definition of the linear implications P ⊸ W R and R W ⊸ Q relative to a monoid W are in fact instances ofa more general pattern, which can be implemented in any logical refinement system b : E → B with enoughresiduals and pullbacks. Suppose given an arbitrary binary operation p : X • Y → Z in the basis B . Then every refinement R ⊏ Z defines a pair of dualization operatorsP ⊥ def = λ [ p ] ∗ ( P \ R ) ( P ⊏ X ) ⊥ Q def = ρ [ p ] ∗ ( R / Q ) ( Q ⊏ Y )inducing a contravariant adjunction E X ( − ) ⊥ & & ⊥ E op Y ⊥ ( − ) f f between the refinements of X and the refinements of Y , as witnessed by the following equivalences of typingand subtyping judgments: P • Q = ⇒ p RP = ⇒ λ [ p ] R / QP = ⇒ ⊥ Q P • Q = ⇒ p RQ = ⇒ ρ [ p ] P \ RQ = ⇒ P ⊥ Observe that we don’t require that p be the multiplication of a monoid W in order to implement this pattern,although of course we can apply it in that situation.For example, consider this construction in the refinement system u : Psh → Cat , applied to a monoidalcategory C seen as an object of Cat having a tensor product operation p : C × C → C . In that case, the fiberassociated to C is the presheaf category [ C op , Set ], and given a fixed presheaf R ∈ [ C op , Set ] one recoversa familiar pattern from the theory of linear continuations [Thielecke 1997, Melliès 2012]: a contravariantadjunction [ C op , Set ] − ⊸ R * * ⊥ [ C op , Set ] op R ⊸ − j j induced by negation into R , where the definition of the two dualization operators coincides with the biclosedmonoidal structure on [ C op , Set ] equipped with the Day tensor product (cf. Remark 3.17).But besides the connection with linear continuations, the situation is also strongly reminiscent of Isbellduality [Isbell 1966] between the categories of covariant and contravariant presheaves over a given category C . In that case, however, while still working in the refinement system u : Psh → Cat , one takes X = C Y = C op Z = C × C op p = id : C × C op → C × C op R = C ( − , − ) the hom-bimodule of C . Then one recovers the contravariant adjunction[ C op , Set ] ( − ) ⊥ ) ) ⊥ [ C , Set ] op ⊥ ( − ) i i called Isbell conjugation [Lawvere 2005, §7], which transforms any contravariant presheaf into a covariantone, and vice versa. Expanding the definitions of the refinement type constructors in u : Psh → Cat (Prop. 3.1), these conjugation operations can be computed explicitly by the following end formulas: φ ⊥ = y
7→ ∀ x .φ ( x ) → C ( x , y ) ⊥ ψ = x
7→ ∀ y .ψ ( y ) → C ( x , y )One fascinating observation by Isbell is that every pair of representable presheaves a + = C ( − , a ) : C op → Set a − = C ( a , − ) : C →
Set generated by the same object a ∈ C form a dual pair, in the sense that a + ≡ ⊥ ( a − ) and a − ≡ ( a + ) ⊥ (7)as can be verified by direct application of the Yoneda lemma: C ( x , a ) (cid:27) ∀ y . C ( a , y ) → C ( x , y ) C ( a , y ) (cid:27) ∀ x . C ( x , a ) → C ( x , y )Although the equations (7) may appear counterintuitive if one thinks about the traditional way of workingwith continuations, the philosophy of Isbell duality says that one can find objects which are invariant withrespect to double dualization, provided that the answer type R is su ffi ciently large and discriminating.In the specific case of classical Isbell duality, the operation p is trivial, and the role of R is provided bythe hom-bimodule. Our main theorem in this section states that an even more general Isbell-style dualityarises for refinement systems, in the sense that any refinement P ⊏ A in an arbitrary refinement system t gives rise to a dual pair P + t ⊏ A + t P − t ⊏ A − t in the refinement system of presheaves. We then develop one application of this theorem, showing how itcan be used to explicitly calculate the positive representation of a pushforward, through a sort of negativeencoding analogous to the classical double-negation translations of first-order logic into intuitionistic first-order logic. As a consequence, we also obtain a negative encoding of the positive representation of afiberwise tensor product, as the double dualization of a Day tensor product. Again, we suppose given an arbitrary refinement system t : D → T . Definition 4.1.
The category of judgments T ♯ t is defined as follows: • objects are t -typing judgments: triples ( P , c , Q ) where P ⊏ A , c : A → B , and Q ⊏ B . • morphisms ( P , c , Q ) → ( P , c , Q ) are pairs of t -derivations β P = ⇒ e P γ Q = ⇒ e ′ Q such that c = e ; c ; e ′ . 23 efinition 4.2. The presheaf of derivations is the refinement D ♯ t ⊏ T ♯ t in u : Psh → Cat defined by D ♯ t = ( P , c , Q )
7→ { α | α P = ⇒ c Q } on objects, and with the functorial action transforming any morphism ( P , c , Q ) → ( P , c , Q ) in T ♯ t givenas a pair of t -derivations β P = ⇒ e P γ Q = ⇒ e ′ Q such that c = e ; c ; e ′ into a typing rule P = ⇒ c Q P = ⇒ c Q derived as β P = ⇒ e P P = ⇒ c Q γ Q = ⇒ e ′ Q P = ⇒ e ; c ; e ′ Q ; − ; P = ⇒ c Q ∼ Remark 4.3.
The category of judgments T ♯ t can be seen as an analogue of the “twisted arrow category” of T [Mac Lane 1971] (see also [Lawvere 1970, p.11] and [Maltsiniotis 2005, §1.1.18]), reducing to the opposite of theusual twisted arrow category of T in the case t = id T . Remark 4.4.
In the case where t = ! D : D → , the presheaf of derivations of t reduces to the hom-bimodule D ♯ t = D ( − , − ) (noting that in that case T ♯ t ≡ D × D op ). Example 5.
For the Hoare Logic refinement system, the category of judgments has objects correspondingto Hoare triples, and has a morphism { P } c { Q } → { P } c { Q } whenever c can be factored as c = e ; c ; e ′ for some e and e ′ such that the triples { P } e { P } and { Q } e ′ { Q } are valid. In particular (in the case where e and e ′ are equal to the identity), this means that T ♯ t includesmorphisms between Hoare triples generated by inverting the “Rules of Consequence” [Hoare 1969], i.e.,that there is a morphism { P } c { Q } → { P } c { Q } whenever ⊢ P ⊃ P and ⊢ Q ⊃ Q . We begin by defining a family of bracket operations, which will play the role of “ p ” in the template describedin Section 4.1. Definition 4.5.
Let B be a t -type. The B -bracket is the functor ⊛ B : B + t × B − t → T ♯ t defined by ⊛ B (( P , c ) , ( d , R )) = ( P , ( c ; d ) , R ). 24ne way to understand the family of bracket operations is as an extranatural transformation from the externalproduct of the relative slice and coslice functors T × T op ( − ) + t × ( − ) − t / / Cat × Cat × / / Cat into the category of judgments, in the sense of
Proposition 4.6.
For any t -term c : A → B we have ( c + t × id B − t ); ⊛ B = (id A + t × c − t ); ⊛ A . Moreover, although we will not need this fact, the extranatural transformation is universal in the sense thatit exhibits the category of judgments as a coend T ♯ t ≡ ∃ A . A + t × A − t [Mac Lane 1971, see exercise 3 on p. 227for an analogous remark].Following the general pattern described in Section 4.1, we can use the B -bracket in combination with thepresheaf of derivations to build a contravariant adjunction[( B + t ) op , Set ] ( − ) ⊥ + + ⊥ [( B − t ) op , Set ] op ⊥ ( − ) k k between presheaves over B + t and presheaves over B − t , where the dualization operators are defined by φ ⊥ def = λ [ ⊛ B ] ∗ ( φ \ D ♯ t ) ( φ ⊏ B + t ) ⊥ ψ def = ρ [ ⊛ B ] ∗ ( D ♯ t / ψ ) ( ψ ⊏ B − t )Moreover, we can establish an Isbell-like duality between the positive and negative representations, relyingon the fact that both can be expressed as pullbacks of the presheaf of derivations. Recall from Sections 3.2and 3.4 that every t -refinement Q ⊏ B induces a pair of objects Q + t ∈ B + t and Q − t ∈ B − t , which representthe corresponding presheaves Q + t ⊏ B + t and Q − t ⊏ B − t in u : Psh → Cat . Given such a t -refinement Q ⊏ B ,define two functors k Q : B + t → T ♯ t and v Q : B − t → T ♯ t by k Q def = (id B + t × Q − t ); ⊛ B and v Q def = ( Q + t × id B − t ); ⊛ B . Lemma 4.7.
For any t -refinement Q ⊏ B, we have Q + t ≡ k Q ∗ D ♯ t and Q − t ≡ v Q ∗ D ♯ t .Proof. Expanding definitions, k Q and v Q reduce to the following actions on objects: k Q = ( P , c ) ( P , c , Q ) v Q = ( d , R ) ( Q , d , R )The identities Q + t ≡ k Q ∗ D ♯ t and Q − t ≡ v Q ∗ D ♯ t are immediate by definition of D ♯ t . (cid:3) Theorem 4.8.
For any t -refinement Q ⊏ B, we have Q − t ≡ ( Q + t ) ⊥ and Q + t ≡ ⊥ ( Q − t ) .Proof. The proof is similar to the proof of Prop. 3.16. We show one case (the other is symmetric):( Q + t ) ⊥ def = λ [ ⊛ B ] ∗ ( Q + t \ D ♯ t ) ≡ λ [ ⊛ B ] ∗ ( Q + t I \ D ♯ t ) (Propositions 3.2 and 3.9) ≡ λ [ ⊛ B ] ∗ ( Q + t \ id) ∗ ( I \ D ♯ t ) (Prop. 2.4) ≡ λ [ ⊛ B ] ∗ ( Q + t \ id) ∗ D ♯ t ( D ♯ t ≡ I \ D ♯ t ) ≡ ( λ [ ⊛ B ]; ( Q + t \ id)) ∗ D ♯ t (Prop. 2.1) ≡ (( Q + t × id); ⊛ B ) ∗ D ♯ t ( β conversion) ≡ Q − t (Lemma 4.7) (cid:3) emark 4.9. When t = ! D : D → , the operations φ φ ⊥ and ψ ⊥ ψ reduce to Isbell conjugation betweenthe category [ D op , Set ] of contravariant presheaves and the category [ D , Set ] op of op’d covariant presheaves, andThm. 4.8 reduces to the fact that Isbell conjugation restricts to an equivalence on representable presheaves. We begin by proving a useful lemma.
Lemma 4.10.
For any t -term c : A → B and presheaf φ ⊏ A + t we have ( c − t ) ∗ φ ⊥ ≡ ( c + t φ ) ⊥ .Proof. The reasoning is similar to the proofs of Prop. 3.16 and Thm. 4.8, except for the appeal in the middleto extranaturality of the bracket operations:( c + t φ ) ⊥ ≡ ( λ [ ⊛ B ]; ( c + t \ id)) ∗ ( φ \ D ♯ t ) ≡ ( c + t • id; ⊛ B ) ∗ ( φ \ D ♯ t ) ≡ (id • c − t ; ⊛ A ) ∗ ( φ \ D ♯ t ) (Prop. 4.6) ≡ ( c − t ; λ [ ⊛ A ]) ∗ ( φ \ D ♯ t ) ≡ ( c − t ) ∗ φ ⊥ (cid:3) A more conceptual way of understanding the lemma is as follows. Given any term c : A → B in T , pullingback and pushing forward along the functors c + and c − induces a pair of adjunctions[( A + ) op , Set ] c + * * ⊥ [( B + ) op , Set ] ( c + ) ∗ j j [( B − ) op , Set ] c − * * ⊥ [( A − ) op , Set ] ( c − ) ∗ j j which may be combined with the adjunctions induced by the dualization operators to build a “thickenedsquare”: [( B + ) op , Set ] ( c + ) ∗ (cid:8) (cid:8) ( − ) ⊥ * * ⊥ [( B − ) op , Set ] op c − op (cid:8) (cid:8) ⊥ ( − ) j j ⊣ ⊣ [( A + ) op , Set ] c + H H ( − ) ⊥ * * ⊥ [( A − ) op , Set ] op( c − ) ∗ op H H ⊥ ( − ) j j Beware: not all paths along this diagram commute! However, Lemma 4.10 says that travelling from thelower left corner to the upper right corner along the outer face is equivalent to travelling with the same originand destination along the inner face. Moreover, from the existence of the adjunctions we can automaticallyderive the following statements, which summarize what happens when one takes di ff erent paths along thesquare. Corollary 4.11.
For any t -term c : A → B and presheaves ψ ⊏ B − t , ρ ⊏ B + t , and σ ⊏ A − t : ( c + t ) ∗ ⊥ ψ ≡ ⊥ ( c − t ψ ) (a)( c − t ) ρ ⊥ = ⇒ (( c + t ) ∗ ρ ) ⊥ (b)( c + t ) ⊥ σ = ⇒ ⊥ (( c − t ) ∗ σ ) (c)26 roof. (a) follows immediately from Lemma 4.10, since the two composite functors ( c + t ) ∗ ◦ ⊥ ( − ) and ⊥ ( − ) ◦ c − t are right adjoints to the two composite functors ( − ) ⊥ ◦ c + t and ( c − t ) ∗ ◦ ( − ) ⊥ . Likewise, (b) and (c) followautomatically as mates [Kelly 1982, §1.11] of the subtyping relations( c − t ) ∗ φ ⊥ = ⇒ ( c + t φ ) ⊥ and ( c + t ) ∗ ⊥ ψ = ⇒ ⊥ ( c − t ψ ) . Let us nonetheless observe, though, that (b) and (c) are equivalent to the fact that the following typing rulesare valid in u : Psh → Cat : ρ • ψ = ⇒ ⊛ B D ♯ t ( c + t ) ∗ ρ • ( c − t ψ ) = ⇒ ⊛ A D ♯ t φ • σ = ⇒ ⊛ A D ♯ t ( c + t φ ) • ( c − t ) ∗ σ = ⇒ ⊛ B D ♯ t The rule on the left, for example, can be derived as follows:( c + ) ∗ φ = ⇒ c + φ L ( c + ) ∗ ψ = ⇒ id B − ψ id( c + ) ∗ φ • ψ = ⇒ c + × id B − φ • ψ • φ • ψ = ⇒ ⊛ B D ♯ t ( c + ) ∗ φ • ψ = ⇒ ( c + × id B − ); ⊛ B D ♯ t ;( c + ) ∗ φ • ψ = ⇒ (id A + × c − ); ⊛ A D ♯ t Prop. 4.6( id A + × c − )(( c + ) ∗ φ • ψ ) = ⇒ ⊛ A D ♯ t L (id × c − )( c + ) ∗ φ • ( c − ψ ) = ⇒ ⊛ A D ♯ t Prop. 2.4 (cid:3)
As we mentioned at the end of Section 3.5, the positive representation does not in general preserve push-forwards, although there is always a coercion c + P + = ⇒ ( c P ) + whenever the pushforward c P exists in t : D → T . Similarly, as we discussed at the end of Section 3.6, given a monoid W in T , the inducedfiberwise tensor product ⊗ W on D W is not strictly mapped by the functor ( − ) + : D W → [( W + ) op , Set ] to theDay tensor product ⊗ W + , although we have a coercion P + ⊗ W + Q + = ⇒ ( P ⊗ W Q ) + for all t -refinements P , Q ⊏ W (Prop. 3.18). One could say that the situation with pullbacks c ∗ Q and fiberwise residuals P ⊸ W R and R W ⊸ Q is nicer, since they are both preserved by the positive representation (Propositions 3.14 and 3.19). However,things are not as bad as they seem for pushforward and fiberwise tensor product, because as we alluded toearlier, this discrepancy may be resolved “up to double dualization”, by appeal to the Isbell duality theoremfor type refinement systems. Proposition 4.12.
Whenever the pushforward c P exists in t , we have ( c P ) + t ≡ ⊥ (( c − t ) ∗ P − t ) (a)( c P ) + t ≡ ⊥ (( c + t P + t ) ⊥ ) (b) Proof.
We can derive equation (a) in two steps:( c P ) + t (Thm. 4.8) ≡ ⊥ ( c P ) − t (Prop. 3.15) ≡ ⊥ (( c − t ) ∗ P − t )Then equation (b) follows in two more steps from (a): ⊥ (( c − t ) ∗ P − t ) (Thm. 4.8) ≡ ⊥ (( c − t ) ∗ ( P + t ) ⊥ ) (Lemma 4.10) ≡ ⊥ (( c + t P + t ) ⊥ ) (cid:3) roposition 4.13. Let W be a monoid in a monoidal refinement system with enough pushforwards. Then for any t -refinements P , Q ⊏ W, we have ( P ⊗ W Q ) + t ≡ ⊥ (( P + t ⊗ W + t Q + t ) ⊥ ) .Proof. We have that P + t ⊗ W + Q + t def = ( m W , W ; p + ) ( P + • Q + ) ≡ p + m W , W ( P + • Q + ) (Prop. 2.1) ≡ p + ( P • Q ) + (Prop. 3.16)and moreover P ⊗ W Q def = p ( P • Q ), so that the proposition follows as a corollary of Prop. 4.12. (cid:3) Example 6.
In Hoare Logic, a pushforward c P is called a strongest postcondition [Gordon and Collavizza 2010,see §2]. Although in general strongest postconditions need not exist, it is easy to check that in the case when c P does exist, its positive representation( c P ) + = { ( P ′ , c ′ ) | ⊢ { P ′ } c ′ { c P } } (as computed in Example 1) contains exactly the same guarded commands as ⊥ (( c − ) ∗ P − ) = { ( P ′ , c ′ ) | ∀ ( d , R ) . { P } c ; d { R } ⊢ { P ′ } c ′ ; d { R } } . Conversely, this latter formula provides a way of reasoning using strongest postconditions, even when theydo not exist. (cid:3)
Example 7.
Let A , B ∈ F be two formulas of linear logic, considered as singleton contexts A ⊏ and B ⊏ in the refinement system |−| : W →
Fin of Example 2. The object is a monoid in Fin , with multiplication µ : → defined as the unique map from the two-point set onto the one-point set. In linear logic, the leftintroduction rule A , B , Γ ⊢ CA ⊗ B , Γ ⊢ C ⊗ L for multiplicative conjunction is invertible, in the sense that it induces a bijection between the proofs of A , B , Γ ⊢ C and the proofs of A ⊗ B , Γ ⊢ C (considered up to the appropriate equational theory). Taking Γ tobe empty, this ensures that the pushforward µ ( A , B ) exists in |−| : W →
Fin , and is given by the formula A ⊗ B ⊏ . Since this pushforward exists for every pair of formulas, by Prop. 3.18 there is a lax monoidalfunctor ( − ) + : W → [ W op , Set ](recall that W is equivalent to + ), with a coercion A + ⊗ + B + = ⇒ ( A ⊗ B ) + for every A ⊏ and B ⊏ . Here we write ⊗ + for the Day tensor product on [ W op , Set ], which can becomputed as φ ⊗ + ψ def = ( m , ; µ + ) ( φ • ψ ) ≡ µ + m , ( φ • ψ )for any pair of presheaves φ, ψ ⊏ W , where m , : W × W → + is the functor defined by the lax monoidalstructure of ( − ) + : Fin → Cat (see (1) in Section 3.6). In particular, we have that A + ⊗ + B + ≡ µ + m , ( A + • B + ).Now, an object of + (namely, a context Γ ⊏ n together with a function f : n → ) is nothing but apartition of a context Γ into two disjoint pieces Γ and Γ , which may be notated conveniently as a shu ffl e Γ = Γ (cid:1) Γ . So, the functor m , : W × W → + is the operation which takes a pair of contexts Γ and Γ into the corresponding partition Γ = ( Γ , Γ ) of a single context into two contiguous pieces. By Prop. 3.16,we know that m , ( A + • B + ) ≡ ( A , B ) + , and the latter simplifies to( A , B ) + = Γ (cid:1) Γ
7→ W ( Γ , A ) × W ( Γ , B ) . A , B ) + along µ + : + → + . By the coend formula for pushforwards ofpresheaves (see Prop. 3.1), the presheaf µ + ( A , B ) + ⊏ W may be calculated as follows: µ + ( A , B ) + = Γ
7→ ∃ Γ , Γ . W ( Γ , ( Γ , Γ )) × W ( Γ , A ) × W ( Γ , B )There is no reason why this presheaf should be isomorphic to( A ⊗ B ) + = Γ
7→ W ( Γ , A ⊗ B ) . In particular, a counterexample is provided by evaluating both presheaves at the singleton context
Γ = A ⊗ B ,since one can certainly prove A ⊗ B ⊢ A ⊗ B , but in general there is no way to split Γ into a context proving A and a context proving B .On the other hand, Prop. 4.12(b) tells us that this mismatch is accounted for by taking a double dual:( A ⊗ B ) + ≡ ⊥ (( µ + ( A , B ) + ) ⊥ ) (8)By Lemma 4.10 and Thm. 4.8, Equation (8) is equivalent to( A ⊗ B ) + ≡ ⊥ (( µ − ) ∗ ( A , B ) − ) (9)which can be derived from the simple equation( A ⊗ B ) − ≡ ( µ − ) ∗ ( A , B ) − (10)by one application of Thm. 4.8. Equation (10) itself follows from the definition of A ⊗ B as a pushforwardand Prop. 3.15. In order to understand this equation, recall from Example 4 that − is the category of pointedcontexts, and that the negative representation ( A ⊗ B ) − ⊏ − is defined by the action ∆ [ C ]
7→ F ( A ⊗ B ; C ) × W ( · , ∆ ) . In other words, ( A ⊗ B ) − transports a pointed context ∆ [ C ] into the set of tuples consisting of a proof of A ⊗ B ⊢ C together with a closed proof of each formula in ∆ . A careful computation shows that ( µ − ) ∗ ( A , B ) − is defined by the action ∆ [ C ]
7→ F ( A , B ; C ) × W ( · , ∆ ) . So Equation (10) reduces to the fact that the left introduction rule ⊗ L is invertible. In particular, observethat whereas we could distinguish ( A ⊗ B ) + from µ + ( A , B ) + by considering the context Γ = A ⊗ B , their duals( A ⊗ B ) − and ( µ − ) ∗ ( A , B ) − cannot be distinguished by pointed contexts. References [Andreoli 1992] Jean-Marc Andreoli. Logic programming with focussing proofs in Linear Logic.
Journal ofLogic and Computation
Handbook of Categorical Algebra 2: Categories and Structures . CambridgeUniversity Press, 1994.[Day 1970] B.J. Day. On closed categories of functors,
Lecture Notes in Mathematics
137 (1970), 1–38.[Gentzen 1935] Gerhard Gentzen.
Untersuchungen über das logische Schliessen (Investigations into Logical In-ference) , Ph.D. thesis, Universität Göttingen. English translation in
The Collected Papers of Gerhard Gentzen ,M. Szabo (ed.), Amsterdam: North Holland (1969).[Ghani, Johann, Fumex 2013] Neil Ghani, Patricia Johann, Clément Fumex. Indexed Induction and Coin-duction, Fibrationally.
Logical Methods in Computer Science
Theoretical Computer Science
50 (1987), 1–102.[Gordon and Collavizza 2010] Mike Gordon and Hélène Collavizza. Forward with Hoare. In
Reflections onthe Work of C.A.R. Hoare , Cli ff Jones, A. W. Roscoe, Kenneth R. Wood (eds.). Springer, 2010.[Hermida 1993] Claudio Hermida.
Fibrations, Logical predicates and indeterminates , Ph.D. thesis, Universityof Edinburgh, November 1993.[Hoare 1969] C.A.R. Hoare. An Axiomatic Basis for Computer Programming,
Communications of the ACM
Bulletin of the American Mathematical Society
72 (1966), 619–655.[Kelly 1982] Max Kelly.
Basic concepts in enriched category theory . Cambridge University Press, 1982.[Lawvere 1970] F. William Lawvere. Equality in hyperdoctrines and comprehension schema as an adjointfunctor, In
Proceedings of the AMS Symposium on Pure Mathematics XVII (1970), 1–14.[Lawvere 2005] F. William Lawvere. Taking Categories Seriously.
Reprints in Theory and Applications ofCategories
Categories for the Working Mathematician . Springer, 1971.[Maltsiniotis 2005] Georges Maltsiniotis.
La théorie de l’homotopie de Grothendieck . Astérisque, 2005.[Melliès 2012] Paul-André Melliès. Game Semantics in String Diagrams. In
Proceedings of the 27th AnnualIEEE Conference on Logic in Computer Science , Dubrovnik, 2012.[Melliès and Zeilberger 2015] Paul-André Melliès and Noam Zeilberger. Functors are Type RefinementSystems. In
Proceedings of the 42nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming ,Mumbai, 2015.[Thielecke 1997] Hayo Thielecke.
Categorical Structure of Continuation Passing Style , Ph.D. thesis, Universityof Edinburgh, 1997. 30
Proof of Prop. 2.2
We complete the proof of Prop. 2.2 by showing that the typing rules LG [ c ] ∗ and RG [ c ] ∗ defined by c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] G P = ⇒ ι GF [ P ] ι P = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o Q ; F [ P ] = ⇒ F [ d ]; o ; c Q ∼ F [ P ] = ⇒ F [ d ]; o c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o ] G [ c ∗ Q ] GP = ⇒ ι ; GF [ d ]; G [ o ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ satisfy the β equation P β = ⇒ d ; G [ c ] G [ Q ] P = ⇒ d G [ c ∗ Q ] RG [ c ] ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] LG [ c ] ∗ P = ⇒ d ; G [ c ] G [ Q ] ; = P β = ⇒ d ; G [ c ] G [ Q ]as well as the η equation P η = ⇒ d G [ c ∗ Q ] = P η = ⇒ d G [ c ∗ Q ] G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] LG [ c ] ∗ P = ⇒ d ; G [ c ] G [ Q ] ; P = ⇒ d G [ c ∗ Q ] RG [ c ] ∗ In both cases, we establish these equations by showing a series of typing derivations, with each successivederivation related to its predecessor by an elementary step of reasoning.
A.1 The β equation P = ⇒ ι X GF [ P ] ι P β = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] GP = ⇒ d ; G [ c ] G [ Q ] ; = ⇒ ι X GF [ P ] ι P β = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ]; G [ c ] G [ Q ] ; P = ⇒ d ; G [ c ] G [ Q ] ∼ P = ⇒ ι X GF [ P ] ι P β = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] G c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] GGF [ P ] = ⇒ GF [ d ]; G [ o A ]; G [ c ] G [ c ∗ Q ] ; P = ⇒ ι X ; GF [ d ]; G [ o A ]; G [ c ] G [ Q ] ; P = ⇒ d ; G [ c ] G [ Q ] ∼ P = ⇒ ι X GF [ P ] ι P β = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ c ∗ Q = ⇒ c Q Lc ∗ F [ P ] = ⇒ F [ d ]; o A ; c G [ c ∗ Q ] ; GF [ P ] = ⇒ GF [ d ]; G [ o A ]; G [ c ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ]; G [ c ] G [ Q ] ; P = ⇒ d ; G [ c ] G [ Q ] ∼ = ⇒ ι X GF [ P ] ι P β = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ GF [ P ] = ⇒ GF [ d ]; G [ o A ]; G [ c ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ]; G [ c ] G [ Q ] ; P = ⇒ d ; G [ c ] G [ Q ] ∼ P = ⇒ ι X GF [ P ] ι P β = ⇒ d ; G [ c ] G [ Q ] F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; GF [ P ] = ⇒ GF [ d ]; GFG [ c ]; G [ o B ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; GFG [ c ]; G [ o A ] G [ Q ] ; P = ⇒ d ; G [ c ] G [ Q ] ∼ P β = ⇒ d ; G [ c ] G [ Q ]33 .2 The η equation P η = ⇒ d G [ c ∗ Q ] P = ⇒ ι X GF [ P ] ι P η = ⇒ d G [ c ∗ Q ] F [ P ] = ⇒ F [ d ] FG [ c ∗ Q ] F FG [ c ∗ Q ] = ⇒ o A c ∗ Q oFG [ c ∗ Q ] = ⇒ F [ d ]; o A G [ Q ] ; GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ P = ⇒ ι X GF [ P ] ι P η = ⇒ d G [ c ∗ Q ] F [ P ] = ⇒ F [ d ] FG [ c ∗ Q ] F FG [ c ∗ Q ] = ⇒ o A c ∗ Q oFG [ c ∗ Q ] = ⇒ F [ d ]; o A G [ Q ] ; c ∗ Q = ⇒ c Q Lc ∗ F [ P ] = ⇒ F [ d ]; o A ; c Q ; F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ P = ⇒ ι X GF [ P ] ι P η = ⇒ d G [ c ∗ Q ] F [ P ] = ⇒ F [ d ] FG [ c ∗ Q ] F FG [ c ∗ Q ] = ⇒ o A c ∗ Q o c ∗ Q = ⇒ c Q Lc ∗ FG [ c ∗ Q ] = ⇒ o A ; c G [ Q ] ; F [ P ] = ⇒ F [ d ]; o A ; c Q ; F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ = ⇒ ι X GF [ P ] ι P η = ⇒ d G [ c ∗ Q ] F [ P ] = ⇒ F [ d ] FG [ c ∗ Q ] F c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] GFG [ c ∗ Q ] = ⇒ FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oFG [ c ∗ Q ] = ⇒ FG [ c ]; o B G [ Q ] ; F [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ P = ⇒ ι X GF [ P ] ι P η = ⇒ d G [ c ∗ Q ] F [ P ] = ⇒ F [ d ] FG [ c ∗ Q ] F c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] GFG [ c ∗ Q ] = ⇒ FG [ c ] FG [ Q ] FF [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] ; FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼ P = ⇒ ι X GF [ P ] ι P η = ⇒ d G [ c ∗ Q ] c ∗ Q = ⇒ c Q Lc ∗ G [ c ∗ Q ] = ⇒ G [ c ] G [ Q ] GP = ⇒ d ; G [ c ] G [ Q ] ; F [ P ] = ⇒ F [ d ]; FG [ c ] FG [ Q ] F FG [ Q ] = ⇒ o B Q oF [ P ] = ⇒ F [ d ]; FG [ c ]; o B Q ; F [ P ] = ⇒ F [ d ]; o A ; c Q ∼ F [ P ] = ⇒ F [ d ]; o A c ∗ Q Rc ∗ GF [ P ] = ⇒ GF [ d ]; G [ o A ] G [ c ∗ Q ] GP = ⇒ ι X ; GF [ d ]; G [ o A ] G [ c ∗ Q ] ; P = ⇒ d G [ c ∗ Q ] ∼∼